From 799d9f3111686c03386c38eaa82346bee47bb237 Mon Sep 17 00:00:00 2001 From: DuckDB Labs GitHub Bot Date: Wed, 21 Jan 2026 09:07:39 +0000 Subject: [PATCH 01/16] Update vendored DuckDB sources to 9612b5bea5 --- .../core_functions/lambda_functions.cpp | 15 +- .../scalar/list/list_reduce.cpp | 27 +- src/duckdb/extension/icu/icu-timezone.cpp | 4 +- .../extension/parquet/parquet_extension.cpp | 2 +- src/duckdb/src/catalog/catalog.cpp | 36 +- src/duckdb/src/common/encryption_state.cpp | 13 + src/duckdb/src/common/enum_util.cpp | 86 +- .../src/common/enums/compression_type.cpp | 35 - src/duckdb/src/common/file_system.cpp | 4 - src/duckdb/src/common/string_util.cpp | 8 + src/duckdb/src/common/types.cpp | 2 +- src/duckdb/src/common/types/geometry.cpp | 1066 +- .../types/row/tuple_data_scatter_gather.cpp | 14 +- src/duckdb/src/common/virtual_file_system.cpp | 267 +- .../src/execution/expression_executor.cpp | 2 +- src/duckdb/src/execution/index/art/art.cpp | 25 +- .../src/execution/index/art/art_key.cpp | 7 - src/duckdb/src/execution/index/art/node.cpp | 71 +- .../src/execution/index/art/prefix_handle.cpp | 10 +- src/duckdb/src/execution/join_hashtable.cpp | 2 +- .../operator/aggregate/physical_window.cpp | 2 +- .../operator/helper/physical_reset.cpp | 32 +- .../operator/helper/physical_set.cpp | 63 +- .../operator/helper/physical_transaction.cpp | 2 +- .../operator/join/physical_hash_join.cpp | 2 +- .../persistent/physical_copy_to_file.cpp | 9 +- .../operator/persistent/physical_delete.cpp | 2 +- .../operator/scan/physical_table_scan.cpp | 27 +- .../physical_plan/plan_aggregate.cpp | 2 +- .../physical_plan/plan_asof_join.cpp | 4 +- .../physical_plan/plan_comparison_join.cpp | 6 +- .../execution/physical_plan/plan_explain.cpp | 4 +- .../execution/physical_plan/plan_insert.cpp | 2 +- .../src/execution/physical_plan_generator.cpp | 2 +- .../aggregate/distributive/minmax.cpp | 2 +- .../aggregate/sorted_aggregate_function.cpp | 2 +- .../src/function/cast/cast_function_set.cpp | 4 +- .../function/cast/variant/from_variant.cpp | 57 +- src/duckdb/src/function/function_list.cpp | 1 + .../src/function/scalar/generic/invoke.cpp | 104 + .../function/scalar/operator/arithmetic.cpp | 2 +- .../scalar/variant/variant_extract.cpp | 227 +- .../function/scalar/variant/variant_utils.cpp | 37 +- .../function/table/system/duckdb_secrets.cpp | 9 +- .../function/table/system/duckdb_settings.cpp | 2 +- .../table/system/enable_profiling.cpp | 4 +- src/duckdb/src/function/table/table_scan.cpp | 6 +- .../function/table/version/pragma_version.cpp | 6 +- .../function/variant/variant_shredding.cpp | 3 +- src/duckdb/src/include/duckdb.h | 2 +- .../src/include/duckdb/catalog/catalog.hpp | 1 + .../include/duckdb/common/column_index.hpp | 105 +- .../duckdb/common/column_index_map.hpp | 10 +- .../duckdb/common/encryption_state.hpp | 2 + .../src/include/duckdb/common/enum_util.hpp | 16 + .../common/enums/allow_parser_override.hpp | 22 + .../duckdb/common/enums/compression_type.hpp | 1 - .../duckdb/common/enums/expression_type.hpp | 7 - .../duckdb/common/enums/lambda_syntax.hpp | 17 + .../src/include/duckdb/common/file_system.hpp | 3 - .../src/include/duckdb/common/http_util.hpp | 2 + .../duckdb/common/opener_file_system.hpp | 4 - .../common/row_operations/row_operations.hpp | 2 - .../include/duckdb/common/shared_ptr_ipp.hpp | 12 + .../src/include/duckdb/common/string_util.hpp | 2 + .../include/duckdb/common/types/geometry.hpp | 15 + .../common/types/row/row_data_collection.hpp | 132 - .../types/row/row_data_collection_scanner.hpp | 123 - .../duckdb/common/types/row/row_layout.hpp | 82 - .../include/duckdb/common/types/variant.hpp | 13 +- .../duckdb/common/virtual_file_system.hpp | 17 +- .../duckdb/execution/index/art/art.hpp | 4 - .../duckdb/execution/index/art/art_key.hpp | 1 - .../duckdb/execution/index/art/node.hpp | 9 - .../execution/index/art/prefix_handle.hpp | 5 +- .../operator/helper/physical_set.hpp | 4 +- .../execution/physical_table_scan_enum.hpp | 2 +- .../duckdb/function/lambda_functions.hpp | 10 +- .../function/scalar/generic_functions.hpp | 10 + .../duckdb/function/scalar/variant_utils.hpp | 21 +- .../src/include/duckdb/logging/logging.hpp | 6 - .../include/duckdb/main/attached_database.hpp | 2 +- .../src/include/duckdb/main/client_config.hpp | 27 +- .../include/duckdb/main/client_context.hpp | 4 +- .../src/include/duckdb/main/client_data.hpp | 2 - src/duckdb/src/include/duckdb/main/config.hpp | 125 +- .../include/duckdb/main/extension_entries.hpp | 4 + .../include/duckdb/main/extension_helper.hpp | 4 +- .../src/include/duckdb/main/setting_info.hpp | 20 +- .../src/include/duckdb/main/settings.hpp | 526 +- .../src/include/duckdb/main/user_settings.hpp | 88 + .../optimizer/expression_heuristics.hpp | 2 +- .../join_order/relation_statistics_helper.hpp | 2 +- .../optimizer/remove_unused_columns.hpp | 17 +- .../include/duckdb/optimizer/rule/list.hpp | 1 - .../duckdb/optimizer/rule/not_elimination.hpp | 31 - .../optimizer/statistics_propagator.hpp | 2 +- .../duckdb/optimizer/window_self_join.hpp | 1 + .../parser/expression/lambda_expression.hpp | 2 +- .../parser/parsed_data/create_table_info.hpp | 6 + .../include/duckdb/parser/parser_options.hpp | 3 +- .../duckdb/parser/tableref/showref.hpp | 2 +- .../src/include/duckdb/parser/transformer.hpp | 2 + .../expression_binder/having_binder.hpp | 2 + .../storage/caching_file_system_wrapper.hpp | 1 - .../duckdb/storage/compression/bitpacking.hpp | 3 - .../storage/single_file_block_manager.hpp | 4 + .../storage/standard_buffer_manager.hpp | 2 + .../storage/statistics/base_statistics.hpp | 2 +- .../storage/statistics/geometry_stats.hpp | 144 +- .../storage/statistics/variant_stats.hpp | 7 + .../include/duckdb/storage/storage_index.hpp | 44 +- .../include/duckdb/storage/storage_info.hpp | 29 + .../duckdb/storage/storage_manager.hpp | 3 + .../duckdb/storage/storage_options.hpp | 3 + .../storage/table/array_column_data.hpp | 5 +- .../duckdb/storage/table/column_data.hpp | 85 +- .../duckdb/storage/table/geo_column_data.hpp | 83 + .../duckdb/storage/table/list_column_data.hpp | 5 +- .../storage/table/row_group_collection.hpp | 2 +- .../storage/table/row_id_column_data.hpp | 3 +- .../duckdb/storage/table/scan_state.hpp | 3 + .../storage/table/standard_column_data.hpp | 3 +- .../storage/table/struct_column_data.hpp | 23 +- .../storage/table/variant_column_data.hpp | 9 +- src/duckdb/src/include/duckdb_extension.h | 4 +- src/duckdb/src/logging/logging.cpp | 11 - src/duckdb/src/main/attached_database.cpp | 15 +- src/duckdb/src/main/client_context.cpp | 63 +- src/duckdb/src/main/config.cpp | 245 +- src/duckdb/src/main/database.cpp | 22 +- .../src/main/extension/extension_helper.cpp | 29 +- .../src/main/extension/extension_install.cpp | 11 +- .../src/main/extension/extension_load.cpp | 22 +- .../src/main/extension_install_info.cpp | 8 +- src/duckdb/src/main/http/http_util.cpp | 11 +- .../main/settings/autogenerated_settings.cpp | 454 +- .../src/main/settings/custom_settings.cpp | 412 +- src/duckdb/src/main/settings/settings.cpp | 20 + src/duckdb/src/main/user_settings.cpp | 172 + src/duckdb/src/main/valid_checker.cpp | 5 +- .../optimizer/build_probe_side_optimizer.cpp | 2 +- .../optimizer/column_lifetime_analyzer.cpp | 2 +- .../src/optimizer/expression_heuristics.cpp | 2 +- src/duckdb/src/optimizer/filter_combiner.cpp | 26 + .../join_order/join_order_optimizer.cpp | 4 +- .../optimizer/join_order/plan_enumerator.cpp | 2 +- .../join_order/relation_statistics_helper.cpp | 2 +- .../src/optimizer/late_materialization.cpp | 4 +- src/duckdb/src/optimizer/optimizer.cpp | 1 - .../src/optimizer/pushdown/pushdown_get.cpp | 3 +- .../src/optimizer/remove_unused_columns.cpp | 279 +- .../src/optimizer/rule/not_elimination.cpp | 215 - .../statistics/operator/propagate_get.cpp | 8 +- src/duckdb/src/optimizer/window_self_join.cpp | 160 +- src/duckdb/src/parallel/executor.cpp | 3 +- src/duckdb/src/parallel/pipeline.cpp | 2 +- src/duckdb/src/parallel/task_scheduler.cpp | 24 +- .../parser/parsed_data/create_table_info.cpp | 37 +- src/duckdb/src/parser/parser.cpp | 9 +- .../parser/query_node/set_operation_node.cpp | 2 +- .../constraint/transform_constraint.cpp | 16 +- .../expression/transform_expression.cpp | 3 + .../statement/transform_create_index.cpp | 7 +- .../statement/transform_create_table.cpp | 16 + .../transform/statement/transform_show.cpp | 5 +- src/duckdb/src/parser/transformer.cpp | 22 + src/duckdb/src/planner/binder.cpp | 6 +- .../expression/bind_aggregate_expression.cpp | 2 +- .../expression/bind_function_expression.cpp | 50 +- .../planner/binder/expression/bind_lambda.cpp | 18 +- .../binder/query_node/plan_subquery.cpp | 2 +- .../planner/binder/statement/bind_create.cpp | 4 +- .../planner/binder/statement/bind_delete.cpp | 41 +- .../binder/tableref/bind_basetableref.cpp | 6 +- .../planner/binder/tableref/bind_pivot.cpp | 4 +- .../planner/binder/tableref/bind_showref.cpp | 10 + src/duckdb/src/planner/collation_binding.cpp | 2 +- .../expression/bound_function_expression.cpp | 8 +- src/duckdb/src/planner/expression_binder.cpp | 7 +- .../expression_binder/having_binder.cpp | 4 + .../expression_binder/order_binder.cpp | 2 +- src/duckdb/src/planner/planner.cpp | 3 +- .../src/storage/caching_file_system.cpp | 2 +- .../storage/caching_file_system_wrapper.cpp | 4 - .../storage/checkpoint/table_data_writer.cpp | 2 +- src/duckdb/src/storage/checkpoint_manager.cpp | 8 +- .../src/storage/compression/bitpacking.cpp | 43 +- src/duckdb/src/storage/compression/fsst.cpp | 2 +- src/duckdb/src/storage/compression/zstd.cpp | 3 +- .../src/storage/external_file_cache_util.cpp | 5 +- .../src/storage/optimistic_data_writer.cpp | 2 +- .../serialization/serialize_create_info.cpp | 6 + .../storage/serialization/serialize_nodes.cpp | 4 + .../src/storage/single_file_block_manager.cpp | 161 +- .../src/storage/standard_buffer_manager.cpp | 16 +- .../storage/statistics/base_statistics.cpp | 4 +- .../src/storage/statistics/geometry_stats.cpp | 22 +- .../src/storage/statistics/variant_stats.cpp | 99 + src/duckdb/src/storage/storage_manager.cpp | 77 +- .../src/storage/table/array_column_data.cpp | 16 +- src/duckdb/src/storage/table/column_data.cpp | 272 +- .../table/column_data_checkpointer.cpp | 10 +- .../src/storage/table/geo_column_data.cpp | 531 + .../src/storage/table/list_column_data.cpp | 17 +- src/duckdb/src/storage/table/row_group.cpp | 33 +- .../storage/table/row_group_collection.cpp | 8 +- .../src/storage/table/row_id_column_data.cpp | 3 +- .../storage/table/standard_column_data.cpp | 3 +- .../src/storage/table/struct_column_data.cpp | 158 +- .../src/storage/table/variant_column_data.cpp | 349 +- .../src/storage/temporary_file_manager.cpp | 3 +- src/duckdb/src/storage/wal_replay.cpp | 4 +- .../transaction/duck_transaction_manager.cpp | 2 +- .../libpg_query/include/nodes/parsenodes.hpp | 2 + .../libpg_query/src_backend_parser_gram.cpp | 21506 ++++++++-------- src/duckdb/ub_src_function_scalar_generic.cpp | 2 + src/duckdb/ub_src_main.cpp | 2 + src/duckdb/ub_src_main_settings.cpp | 2 + src/duckdb/ub_src_optimizer_rule.cpp | 2 - src/duckdb/ub_src_storage_table.cpp | 2 + 221 files changed, 16441 insertions(+), 13796 deletions(-) create mode 100644 src/duckdb/src/function/scalar/generic/invoke.cpp create mode 100644 src/duckdb/src/include/duckdb/common/enums/allow_parser_override.hpp create mode 100644 src/duckdb/src/include/duckdb/common/enums/lambda_syntax.hpp delete mode 100644 src/duckdb/src/include/duckdb/common/types/row/row_data_collection.hpp delete mode 100644 src/duckdb/src/include/duckdb/common/types/row/row_data_collection_scanner.hpp delete mode 100644 src/duckdb/src/include/duckdb/common/types/row/row_layout.hpp create mode 100644 src/duckdb/src/include/duckdb/main/user_settings.hpp delete mode 100644 src/duckdb/src/include/duckdb/optimizer/rule/not_elimination.hpp create mode 100644 src/duckdb/src/include/duckdb/storage/table/geo_column_data.hpp create mode 100644 src/duckdb/src/main/settings/settings.cpp create mode 100644 src/duckdb/src/main/user_settings.cpp delete mode 100644 src/duckdb/src/optimizer/rule/not_elimination.cpp create mode 100644 src/duckdb/src/storage/table/geo_column_data.cpp diff --git a/src/duckdb/extension/core_functions/lambda_functions.cpp b/src/duckdb/extension/core_functions/lambda_functions.cpp index 89356921c..0e9e9e03e 100644 --- a/src/duckdb/extension/core_functions/lambda_functions.cpp +++ b/src/duckdb/extension/core_functions/lambda_functions.cpp @@ -22,10 +22,11 @@ struct LambdaExecuteInfo { // get the input types for the input chunk vector input_types; + + input_types.push_back(child_vector.GetType()); if (has_index) { input_types.push_back(LogicalType::BIGINT); } - input_types.push_back(child_vector.GetType()); for (idx_t i = 1; i < args.ColumnCount(); i++) { input_types.push_back(args.data[i].GetType()); } @@ -152,8 +153,9 @@ struct ListFilterFunctor { // slice the input chunk's corresponding vector to get the new lists // and append them to the result - idx_t source_list_idx = execute_info.has_index ? 1 : 0; - Vector result_lists(execute_info.input_chunk.data[source_list_idx], sel, count); + + // The first vector in the input chunk is always the list vector + Vector result_lists(execute_info.input_chunk.data[0], sel, count); ListVector::Append(result, result_lists, count, 0); } }; @@ -190,8 +192,8 @@ static void ExecuteExpression(const idx_t elem_cnt, const LambdaFunctions::Colum // reference the child vector (and the index vector) if (info.has_index) { - info.input_chunk.data[0].Reference(index_vector); - info.input_chunk.data[1].Reference(slice); + info.input_chunk.data[0].Reference(slice); + info.input_chunk.data[1].Reference(index_vector); } else { info.input_chunk.data[0].Reference(slice); } @@ -247,7 +249,8 @@ LogicalType LambdaFunctions::DetermineListChildType(const LogicalType &child_typ } else if (child_type.id() == LogicalTypeId::LIST) { return ListType::GetChildType(child_type); } - throw InternalException("The first argument must be a list or array type"); + + throw BinderException("Invalid LIST argument during lambda function binding!"); } return child_type; 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..3f9d9b0c7 100644 --- a/src/duckdb/extension/core_functions/scalar/list/list_reduce.cpp +++ b/src/duckdb/extension/core_functions/scalar/list/list_reduce.cpp @@ -41,11 +41,13 @@ struct ReduceExecuteInfo { } left_slice->Slice(left_vector, reduced_row_idx); + input_types.push_back(left_slice->GetType()); + input_types.push_back(left_slice->GetType()); + if (info.has_index) { input_types.push_back(LogicalType::BIGINT); } - 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()); @@ -133,18 +135,19 @@ bool ExecuteReduce(const idx_t loops, ReduceExecuteInfo &execute_info, LambdaFun input_chunk.InitializeEmpty(execute_info.input_types); input_chunk.SetCardinality(reduced_row_idx); - const idx_t slice_offset = info.has_index ? 1 : 0; - if (info.has_index) { - input_chunk.data[0].Reference(index_vector); - } + idx_t vec_offset = 0; if (loops == 0 && info.has_initial) { - info.column_infos[0].vector.get().Slice(execute_info.active_rows_sel, reduced_row_idx); - input_chunk.data[slice_offset + 1].Reference(info.column_infos[0].vector); + info.column_infos[vec_offset].vector.get().Slice(execute_info.active_rows_sel, reduced_row_idx); + input_chunk.data[vec_offset++].Reference(info.column_infos[0].vector); } else { - input_chunk.data[slice_offset + 1].Reference(*execute_info.left_slice); + input_chunk.data[vec_offset++].Reference(*execute_info.left_slice); + } + input_chunk.data[vec_offset++].Reference(right_slice); + + if (info.has_index) { + input_chunk.data[vec_offset++].Reference(index_vector); } - input_chunk.data[slice_offset].Reference(right_slice); // add the other columns // skip the initial value if there is one @@ -153,12 +156,12 @@ bool ExecuteReduce(const idx_t loops, ReduceExecuteInfo &execute_info, LambdaFun for (idx_t i = 0; i < info.column_infos.size() - initial_offset; i++) { if (info.column_infos[i].vector.get().GetVectorType() == VectorType::CONSTANT_VECTOR) { // only reference constant vectors - input_chunk.data[slice_offset + 2 + i].Reference(info.column_infos[initial_offset + i].vector); + input_chunk.data[vec_offset++].Reference(info.column_infos[initial_offset + i].vector); } else { // slice the other vectors slices.emplace_back(info.column_infos[initial_offset + i].vector, execute_info.active_rows_sel, reduced_row_idx); - input_chunk.data[slice_offset + 2 + i].Reference(slices.back()); + input_chunk.data[vec_offset++].Reference(slices.back()); } } 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/parquet/parquet_extension.cpp b/src/duckdb/extension/parquet/parquet_extension.cpp index 59102a8eb..357915146 100644 --- a/src/duckdb/extension/parquet/parquet_extension.cpp +++ b/src/duckdb/extension/parquet/parquet_extension.cpp @@ -340,7 +340,7 @@ static unique_ptr ParquetWriteBind(ClientContext &context, CopyFun } } if (row_group_size_bytes_set) { - if (DBConfig::GetSetting(context)) { + if (Settings::Get(context)) { throw BinderException("ROW_GROUP_SIZE_BYTES does not work while preserving insertion order. Use \"SET " "preserve_insertion_order=false;\" to disable preserving insertion order."); } diff --git a/src/duckdb/src/catalog/catalog.cpp b/src/duckdb/src/catalog/catalog.cpp index 0dec15f20..de3fca397 100644 --- a/src/duckdb/src/catalog/catalog.cpp +++ b/src/duckdb/src/catalog/catalog.cpp @@ -139,6 +139,10 @@ optional_ptr Catalog::CreateTable(ClientContext &context, unique_p optional_ptr Catalog::CreateTable(CatalogTransaction transaction, SchemaCatalogEntry &schema, BoundCreateTableInfo &info) { + auto supports_create_table = SupportsCreateTable(info); + if (supports_create_table.HasError()) { + supports_create_table.Throw(); + } return schema.CreateTable(transaction, info); } @@ -520,8 +524,7 @@ bool Catalog::TryAutoLoad(ClientContext &context, const string &original_name) n return true; } #ifndef DUCKDB_DISABLE_EXTENSION_LOAD - auto &dbconfig = DBConfig::GetConfig(context); - if (!dbconfig.options.autoload_known_extensions) { + if (!Settings::Get(context)) { return false; } try { @@ -537,8 +540,7 @@ bool Catalog::TryAutoLoad(ClientContext &context, const string &original_name) n String Catalog::AutoloadExtensionByConfigName(ClientContext &context, const String &configuration_name) { #ifndef DUCKDB_DISABLE_EXTENSION_LOAD - auto &dbconfig = DBConfig::GetConfig(context); - if (dbconfig.options.autoload_known_extensions) { + if (Settings::Get(context)) { auto extension_name = ExtensionHelper::FindExtensionInEntries(configuration_name.ToStdString(), EXTENSION_SETTINGS); if (ExtensionHelper::CanAutoloadExtension(extension_name)) { @@ -594,8 +596,7 @@ static bool CompareCatalogTypes(CatalogType type_a, CatalogType type_b) { bool Catalog::AutoLoadExtensionByCatalogEntry(DatabaseInstance &db, CatalogType type, const string &entry_name) { #ifndef DUCKDB_DISABLE_EXTENSION_LOAD - auto &dbconfig = DBConfig::GetConfig(db); - if (dbconfig.options.autoload_known_extensions) { + if (Settings::Get(db)) { string extension_name; if (IsAutoloadableFunction(type)) { auto lookup_result = ExtensionHelper::FindExtensionInFunctionEntries(entry_name, EXTENSION_FUNCTIONS); @@ -640,7 +641,7 @@ CatalogException Catalog::UnrecognizedConfigurationError(ClientContext &context, // the setting is not in an extension // get a list of all options vector potential_names = DBConfig::GetOptionNames(); - for (auto &entry : DBConfig::GetConfig(context).extension_parameters) { + for (auto &entry : DBConfig::GetConfig(context).GetExtensionSettings()) { potential_names.push_back(entry.first); } throw CatalogException::MissingEntry("configuration parameter", name, potential_names); @@ -651,7 +652,7 @@ CatalogException Catalog::CreateMissingEntryException(CatalogEntryRetriever &ret const reference_set_t &schemas) { auto &context = retriever.GetContext(); auto entries = SimilarEntriesInSchemas(context, lookup_info, schemas); - auto max_schema_count = DBConfig::GetSetting(context); + auto max_schema_count = Settings::Get(context); reference_set_t unseen_schemas; auto &db_manager = DatabaseManager::Get(context); @@ -1211,6 +1212,25 @@ optional_ptr Catalog::GetDependencyManager() { return nullptr; } +ErrorData Catalog::SupportsCreateTable(BoundCreateTableInfo &info) { + auto &base = info.Base().Cast(); + if (!base.partition_keys.empty()) { + return ErrorData( + ExceptionType::CATALOG, + StringUtil::Format("PARTITIONED BY is not supported for tables in a %s catalog", GetCatalogType())); + } + if (!base.sort_keys.empty()) { + return ErrorData(ExceptionType::CATALOG, + StringUtil::Format("SORTED BY is not supported for tables in a %s catalog", GetCatalogType())); + } + if (!base.options.empty()) { + return ErrorData( + ExceptionType::CATALOG, + StringUtil::Format("WITH clause is not supported for tables in a %s catalog", GetCatalogType())); + } + return ErrorData(); +} + string Catalog::GetDefaultSchema() const { return DEFAULT_SCHEMA; } diff --git a/src/duckdb/src/common/encryption_state.cpp b/src/duckdb/src/common/encryption_state.cpp index 0763bc5a6..28e23f310 100644 --- a/src/duckdb/src/common/encryption_state.cpp +++ b/src/duckdb/src/common/encryption_state.cpp @@ -29,6 +29,8 @@ void EncryptionState::GenerateRandomData(data_ptr_t, idx_t) { throw NotImplementedException("EncryptionState Abstract Class is called"); } +static constexpr EncryptionTypes::EncryptionVersion MAX_VERSION = EncryptionTypes::V0_1; + string EncryptionTypes::CipherToString(CipherType cipher_p) { switch (cipher_p) { case GCM: @@ -56,6 +58,17 @@ EncryptionTypes::CipherType EncryptionTypes::StringToCipher(const string &encryp return INVALID; } +EncryptionTypes::EncryptionVersion EncryptionTypes::StringToVersion(const string &encryption_version_p) { + if (encryption_version_p == "v0") { + return V0_0; + } else if (encryption_version_p == "v1") { + return V0_1; + } else { + throw NotImplementedException("No encryption version higher then v%d is supported yet in this DuckDB version", + MAX_VERSION); + } +} + string EncryptionTypes::KDFToString(KeyDerivationFunction kdf_p) { switch (kdf_p) { case SHA256: diff --git a/src/duckdb/src/common/enum_util.cpp b/src/duckdb/src/common/enum_util.cpp index 9e04cf913..afb826453 100644 --- a/src/duckdb/src/common/enum_util.cpp +++ b/src/duckdb/src/common/enum_util.cpp @@ -16,6 +16,7 @@ #include "duckdb/common/column_index.hpp" #include "duckdb/common/enums/access_mode.hpp" #include "duckdb/common/enums/aggregate_handling.hpp" +#include "duckdb/common/enums/allow_parser_override.hpp" #include "duckdb/common/enums/arrow_format_version.hpp" #include "duckdb/common/enums/cache_validation_mode.hpp" #include "duckdb/common/enums/catalog_lookup_behavior.hpp" @@ -38,6 +39,7 @@ #include "duckdb/common/enums/index_constraint_type.hpp" #include "duckdb/common/enums/join_type.hpp" #include "duckdb/common/enums/joinref_type.hpp" +#include "duckdb/common/enums/lambda_syntax.hpp" #include "duckdb/common/enums/logical_operator_type.hpp" #include "duckdb/common/enums/memory_tag.hpp" #include "duckdb/common/enums/merge_action_type.hpp" @@ -180,6 +182,7 @@ #include "duckdb/storage/statistics/variant_stats.hpp" #include "duckdb/storage/storage_index.hpp" #include "duckdb/storage/table/chunk_info.hpp" +#include "duckdb/storage/table/column_data.hpp" #include "duckdb/storage/table/column_segment.hpp" #include "duckdb/storage/table/table_index_list.hpp" #include "duckdb/storage/temporary_file_manager.hpp" @@ -355,6 +358,26 @@ AggregateType EnumUtil::FromString(const char *value) { return static_cast(StringUtil::StringToEnum(GetAggregateTypeValues(), 2, "AggregateType", value)); } +const StringUtil::EnumStringLiteral *GetAllowParserOverrideValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(AllowParserOverride::DEFAULT_OVERRIDE), "DEFAULT" }, + { static_cast(AllowParserOverride::FALLBACK_OVERRIDE), "FALLBACK" }, + { static_cast(AllowParserOverride::STRICT_OVERRIDE), "STRICT" }, + { static_cast(AllowParserOverride::STRICT_WHEN_SUPPORTED), "STRICT_WHEN_SUPPORTED" } + }; + return values; +} + +template<> +const char* EnumUtil::ToChars(AllowParserOverride value) { + return StringUtil::EnumToString(GetAllowParserOverrideValues(), 4, "AllowParserOverride", static_cast(value)); +} + +template<> +AllowParserOverride EnumUtil::FromString(const char *value) { + return static_cast(StringUtil::StringToEnum(GetAllowParserOverrideValues(), 4, "AllowParserOverride", value)); +} + const StringUtil::EnumStringLiteral *GetAlterDatabaseTypeValues() { static constexpr StringUtil::EnumStringLiteral values[] { { static_cast(AlterDatabaseType::RENAME_DATABASE), "RENAME_DATABASE" } @@ -1124,22 +1147,22 @@ CompressedMaterializationDirection EnumUtil::FromString(CompressionType::COMPRESSION_AUTO), "COMPRESSION_AUTO" }, - { static_cast(CompressionType::COMPRESSION_UNCOMPRESSED), "COMPRESSION_UNCOMPRESSED" }, - { static_cast(CompressionType::COMPRESSION_CONSTANT), "COMPRESSION_CONSTANT" }, - { static_cast(CompressionType::COMPRESSION_RLE), "COMPRESSION_RLE" }, - { static_cast(CompressionType::COMPRESSION_DICTIONARY), "COMPRESSION_DICTIONARY" }, - { static_cast(CompressionType::COMPRESSION_PFOR_DELTA), "COMPRESSION_PFOR_DELTA" }, - { static_cast(CompressionType::COMPRESSION_BITPACKING), "COMPRESSION_BITPACKING" }, - { static_cast(CompressionType::COMPRESSION_FSST), "COMPRESSION_FSST" }, - { static_cast(CompressionType::COMPRESSION_CHIMP), "COMPRESSION_CHIMP" }, - { static_cast(CompressionType::COMPRESSION_PATAS), "COMPRESSION_PATAS" }, - { static_cast(CompressionType::COMPRESSION_ALP), "COMPRESSION_ALP" }, - { static_cast(CompressionType::COMPRESSION_ALPRD), "COMPRESSION_ALPRD" }, - { static_cast(CompressionType::COMPRESSION_ZSTD), "COMPRESSION_ZSTD" }, - { static_cast(CompressionType::COMPRESSION_ROARING), "COMPRESSION_ROARING" }, - { static_cast(CompressionType::COMPRESSION_EMPTY), "COMPRESSION_EMPTY" }, - { static_cast(CompressionType::COMPRESSION_DICT_FSST), "COMPRESSION_DICT_FSST" }, + { static_cast(CompressionType::COMPRESSION_AUTO), "AUTO" }, + { static_cast(CompressionType::COMPRESSION_UNCOMPRESSED), "UNCOMPRESSED" }, + { static_cast(CompressionType::COMPRESSION_CONSTANT), "CONSTANT" }, + { static_cast(CompressionType::COMPRESSION_RLE), "RLE" }, + { static_cast(CompressionType::COMPRESSION_DICTIONARY), "DICTIONARY" }, + { static_cast(CompressionType::COMPRESSION_PFOR_DELTA), "PFOR" }, + { static_cast(CompressionType::COMPRESSION_BITPACKING), "BITPACKING" }, + { static_cast(CompressionType::COMPRESSION_FSST), "FSST" }, + { static_cast(CompressionType::COMPRESSION_CHIMP), "CHIMP" }, + { static_cast(CompressionType::COMPRESSION_PATAS), "PATAS" }, + { static_cast(CompressionType::COMPRESSION_ALP), "ALP" }, + { static_cast(CompressionType::COMPRESSION_ALPRD), "ALPRD" }, + { static_cast(CompressionType::COMPRESSION_ZSTD), "ZSTD" }, + { static_cast(CompressionType::COMPRESSION_ROARING), "ROARING" }, + { static_cast(CompressionType::COMPRESSION_EMPTY), "EMPTY" }, + { static_cast(CompressionType::COMPRESSION_DICT_FSST), "DICT_FSST" }, { static_cast(CompressionType::COMPRESSION_COUNT), "COMPRESSION_COUNT" } }; return values; @@ -1952,6 +1975,25 @@ ExtraDropInfoType EnumUtil::FromString(const char *value) { return static_cast(StringUtil::StringToEnum(GetExtraDropInfoTypeValues(), 2, "ExtraDropInfoType", value)); } +const StringUtil::EnumStringLiteral *GetExtraPersistentColumnDataTypeValues() { + static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(ExtraPersistentColumnDataType::INVALID), "INVALID" }, + { static_cast(ExtraPersistentColumnDataType::VARIANT), "VARIANT" }, + { static_cast(ExtraPersistentColumnDataType::GEOMETRY), "GEOMETRY" } + }; + return values; +} + +template<> +const char* EnumUtil::ToChars(ExtraPersistentColumnDataType value) { + return StringUtil::EnumToString(GetExtraPersistentColumnDataTypeValues(), 3, "ExtraPersistentColumnDataType", static_cast(value)); +} + +template<> +ExtraPersistentColumnDataType EnumUtil::FromString(const char *value) { + return static_cast(StringUtil::StringToEnum(GetExtraPersistentColumnDataTypeValues(), 3, "ExtraPersistentColumnDataType", value)); +} + const StringUtil::EnumStringLiteral *GetExtraTypeInfoTypeValues() { static constexpr StringUtil::EnumStringLiteral values[] { { static_cast(ExtraTypeInfoType::INVALID_TYPE_INFO), "INVALID_TYPE_INFO" }, @@ -4326,19 +4368,20 @@ const StringUtil::EnumStringLiteral *GetShowTypeValues() { static constexpr StringUtil::EnumStringLiteral values[] { { static_cast(ShowType::SUMMARY), "SUMMARY" }, { static_cast(ShowType::DESCRIBE), "DESCRIBE" }, - { static_cast(ShowType::SHOW_FROM), "SHOW_FROM" } + { static_cast(ShowType::SHOW_FROM), "SHOW_FROM" }, + { static_cast(ShowType::SHOW_UNQUALIFIED), "SHOW_UNQUALIFIED" } }; return values; } template<> const char* EnumUtil::ToChars(ShowType value) { - return StringUtil::EnumToString(GetShowTypeValues(), 3, "ShowType", static_cast(value)); + return StringUtil::EnumToString(GetShowTypeValues(), 4, "ShowType", static_cast(value)); } template<> ShowType EnumUtil::FromString(const char *value) { - return static_cast(StringUtil::StringToEnum(GetShowTypeValues(), 3, "ShowType", value)); + return static_cast(StringUtil::StringToEnum(GetShowTypeValues(), 4, "ShowType", value)); } const StringUtil::EnumStringLiteral *GetSimplifiedTokenTypeValues() { @@ -5113,6 +5156,7 @@ UnionInvalidReason EnumUtil::FromString(const char *value) { const StringUtil::EnumStringLiteral *GetVariantChildLookupModeValues() { static constexpr StringUtil::EnumStringLiteral values[] { + { static_cast(VariantChildLookupMode::INVALID), "INVALID" }, { static_cast(VariantChildLookupMode::BY_KEY), "BY_KEY" }, { static_cast(VariantChildLookupMode::BY_INDEX), "BY_INDEX" } }; @@ -5121,12 +5165,12 @@ const StringUtil::EnumStringLiteral *GetVariantChildLookupModeValues() { template<> const char* EnumUtil::ToChars(VariantChildLookupMode value) { - return StringUtil::EnumToString(GetVariantChildLookupModeValues(), 2, "VariantChildLookupMode", static_cast(value)); + return StringUtil::EnumToString(GetVariantChildLookupModeValues(), 3, "VariantChildLookupMode", static_cast(value)); } template<> VariantChildLookupMode EnumUtil::FromString(const char *value) { - return static_cast(StringUtil::StringToEnum(GetVariantChildLookupModeValues(), 2, "VariantChildLookupMode", value)); + return static_cast(StringUtil::StringToEnum(GetVariantChildLookupModeValues(), 3, "VariantChildLookupMode", value)); } const StringUtil::EnumStringLiteral *GetVariantLogicalTypeValues() { diff --git a/src/duckdb/src/common/enums/compression_type.cpp b/src/duckdb/src/common/enums/compression_type.cpp index 427cfbe91..15cfdac70 100644 --- a/src/duckdb/src/common/enums/compression_type.cpp +++ b/src/duckdb/src/common/enums/compression_type.cpp @@ -73,41 +73,6 @@ CompressionAvailabilityResult CompressionTypeIsAvailable(CompressionType compres return CompressionAvailabilityResult(); } -CompressionType CompressionTypeFromString(const string &str) { - auto compression = StringUtil::Lower(str); - //! NOTE: this explicitly does not include 'constant' and 'empty validity', these are internal compression functions - //! not general purpose - if (compression == "uncompressed") { - return CompressionType::COMPRESSION_UNCOMPRESSED; - } else if (compression == "rle") { - return CompressionType::COMPRESSION_RLE; - } else if (compression == "dictionary") { - return CompressionType::COMPRESSION_DICTIONARY; - } else if (compression == "pfor") { - return CompressionType::COMPRESSION_PFOR_DELTA; - } else if (compression == "bitpacking") { - return CompressionType::COMPRESSION_BITPACKING; - } else if (compression == "fsst") { - return CompressionType::COMPRESSION_FSST; - } else if (compression == "chimp") { - return CompressionType::COMPRESSION_CHIMP; - } else if (compression == "patas") { - return CompressionType::COMPRESSION_PATAS; - } else if (compression == "zstd") { - return CompressionType::COMPRESSION_ZSTD; - } else if (compression == "alp") { - return CompressionType::COMPRESSION_ALP; - } else if (compression == "alprd") { - return CompressionType::COMPRESSION_ALPRD; - } else if (compression == "roaring") { - return CompressionType::COMPRESSION_ROARING; - } else if (compression == "dict_fsst") { - return CompressionType::COMPRESSION_DICT_FSST; - } else { - return CompressionType::COMPRESSION_AUTO; - } -} - string CompressionTypeToString(CompressionType type) { switch (type) { case CompressionType::COMPRESSION_AUTO: diff --git a/src/duckdb/src/common/file_system.cpp b/src/duckdb/src/common/file_system.cpp index ce4f9022a..76f832795 100644 --- a/src/duckdb/src/common/file_system.cpp +++ b/src/duckdb/src/common/file_system.cpp @@ -611,10 +611,6 @@ void FileSystem::RegisterSubSystem(FileCompressionType compression_type, unique_ throw NotImplementedException("%s: Can't register a sub system on a non-virtual file system", GetName()); } -void FileSystem::UnregisterSubSystem(const string &name) { - throw NotImplementedException("%s: Can't unregister a sub system on a non-virtual file system", GetName()); -} - unique_ptr FileSystem::ExtractSubSystem(const string &name) { throw NotImplementedException("%s: Can't extract a sub system on a non-virtual file system", GetName()); } diff --git a/src/duckdb/src/common/string_util.cpp b/src/duckdb/src/common/string_util.cpp index 682a94392..9c8cf8295 100644 --- a/src/duckdb/src/common/string_util.cpp +++ b/src/duckdb/src/common/string_util.cpp @@ -77,6 +77,14 @@ idx_t StringUtil::ToUnsigned(const string &str) { return std::stoull(str); } +int64_t StringUtil::ToSigned(const string &str) { + return std::stoll(str); +} + +double StringUtil::ToDouble(const string &str) { + return std::stod(str); +} + void StringUtil::LTrim(string &str) { auto it = str.begin(); while (it != str.end() && CharacterIsSpace(*it)) { diff --git a/src/duckdb/src/common/types.cpp b/src/duckdb/src/common/types.cpp index 83374d0de..74bdcc318 100644 --- a/src/duckdb/src/common/types.cpp +++ b/src/duckdb/src/common/types.cpp @@ -1278,7 +1278,7 @@ struct ForceGetTypeOperation { bool LogicalType::TryGetMaxLogicalType(ClientContext &context, const LogicalType &left, const LogicalType &right, LogicalType &result) { - if (DBConfig::GetSetting(context)) { + if (Settings::Get(context)) { result = LogicalType::ForceMaxLogicalType(left, right); return true; } diff --git a/src/duckdb/src/common/types/geometry.cpp b/src/duckdb/src/common/types/geometry.cpp index cc9bacfda..52c17c405 100644 --- a/src/duckdb/src/common/types/geometry.cpp +++ b/src/duckdb/src/common/types/geometry.cpp @@ -929,7 +929,6 @@ void ConvertWKB(BlobReader &reader, FixedSizeBlobWriter &writer) { // Public interface //---------------------------------------------------------------------------------------------------------------------- namespace duckdb { - constexpr const idx_t Geometry::MAX_RECURSION_DEPTH; bool Geometry::FromBinary(const string_t &wkb, string_t &result, Vector &result_vector, bool strict) { @@ -1083,6 +1082,11 @@ static uint32_t ParseVertices(BlobReader &reader, GeometryExtent &extent, uint32 } uint32_t Geometry::GetExtent(const string_t &wkb, GeometryExtent &extent) { + bool has_any_empty = false; + return GetExtent(wkb, extent, has_any_empty); +} + +uint32_t Geometry::GetExtent(const string_t &wkb, GeometryExtent &extent, bool &has_any_empty) { BlobReader reader(wkb.GetData(), static_cast(wkb.GetSize())); uint32_t vertex_count = 0; @@ -1106,16 +1110,33 @@ uint32_t Geometry::GetExtent(const string_t &wkb, GeometryExtent &extent) { switch (geom_type) { case GeometryType::POINT: { - vertex_count += ParseVertices(reader, extent, 1, vert_type, true); + const auto parsed_count = ParseVertices(reader, extent, 1, vert_type, true); + if (parsed_count == 0) { + has_any_empty = true; + continue; + } + vertex_count += parsed_count; } break; case GeometryType::LINESTRING: { const auto vert_count = reader.Read(); + if (vert_count == 0) { + has_any_empty = true; + continue; + } vertex_count += ParseVertices(reader, extent, vert_count, vert_type, false); } break; case GeometryType::POLYGON: { const auto ring_count = reader.Read(); + if (ring_count == 0) { + has_any_empty = true; + continue; + } for (uint32_t ring_idx = 0; ring_idx < ring_count; ring_idx++) { const auto vert_count = reader.Read(); + if (vert_count == 0) { + has_any_empty = true; + continue; + } vertex_count += ParseVertices(reader, extent, vert_count, vert_type, false); } } break; @@ -1123,8 +1144,10 @@ uint32_t Geometry::GetExtent(const string_t &wkb, GeometryExtent &extent) { case GeometryType::MULTILINESTRING: case GeometryType::MULTIPOLYGON: case GeometryType::GEOMETRYCOLLECTION: { - // Skip count. We don't need it for extent calculation. - reader.Skip(sizeof(uint32_t)); + const auto part_count = reader.Read(); + if (part_count == 0) { + has_any_empty = true; + } } break; default: throw InvalidInputException("Unsupported geometry type %d in WKB", static_cast(geom_type)); @@ -1133,4 +1156,1039 @@ uint32_t Geometry::GetExtent(const string_t &wkb, GeometryExtent &extent) { return vertex_count; } +//---------------------------------------------------------------------------------------------------------------------- +// Shredding +//---------------------------------------------------------------------------------------------------------------------- + +template +static void ToPoints(Vector &source_vec, Vector &target_vec, idx_t row_count) { + // Flatten the source vector to extract all vertices + source_vec.Flatten(row_count); + + const auto geom_data = FlatVector::GetData(source_vec); + const auto &vert_parts = StructVector::GetEntries(target_vec); + double *vert_data[V::WIDTH]; + + for (idx_t i = 0; i < V::WIDTH; i++) { + vert_data[i] = FlatVector::GetData(*vert_parts[i]); + } + + for (idx_t row_idx = 0; row_idx < row_count; row_idx++) { + if (FlatVector::IsNull(source_vec, row_idx)) { + FlatVector::SetNull(target_vec, row_idx, true); + continue; + } + + const auto &blob = geom_data[row_idx]; + const auto blob_data = blob.GetData(); + const auto blob_size = blob.GetSize(); + + BlobReader reader(blob_data, static_cast(blob_size)); + + // Skip byte order and type/meta + reader.Skip(sizeof(uint8_t) + sizeof(uint32_t)); + + for (uint32_t dim_idx = 0; dim_idx < V::WIDTH; dim_idx++) { + vert_data[dim_idx][row_idx] = reader.Read(); + } + } +} + +template +static void FromPoints(Vector &source_vec, Vector &target_vec, idx_t row_count, idx_t result_offset) { + // Flatten the source vector to extract all vertices + source_vec.Flatten(row_count); + + const auto &vert_parts = StructVector::GetEntries(source_vec); + const auto geom_data = FlatVector::GetData(target_vec); + double *vert_data[V::WIDTH]; + + for (idx_t i = 0; i < V::WIDTH; i++) { + vert_data[i] = FlatVector::GetData(*vert_parts[i]); + } + + for (idx_t row_idx = 0; row_idx < row_count; row_idx++) { + const auto out_idx = result_offset + row_idx; + + if (FlatVector::IsNull(source_vec, row_idx)) { + FlatVector::SetNull(target_vec, out_idx, true); + continue; + } + + // byte order + type/meta + vertex data + const auto blob_size = sizeof(uint8_t) + sizeof(uint32_t) + sizeof(V); + auto blob = StringVector::EmptyString(target_vec, blob_size); + const auto blob_data = blob.GetDataWriteable(); + + FixedSizeBlobWriter writer(blob_data, static_cast(blob_size)); + + const auto meta = static_cast(GeometryType::POINT) + (V::HAS_Z ? 1000 : 0) + (V::HAS_M ? 2000 : 0); + + writer.Write(1); // Little-endian + writer.Write(meta); // Type/meta + + // Write vertex data + for (uint32_t dim_idx = 0; dim_idx < V::WIDTH; dim_idx++) { + writer.Write(vert_data[dim_idx][row_idx]); + } + + blob.Finalize(); + geom_data[out_idx] = blob; + } +} + +template +static void ToLineStrings(Vector &source_vec, Vector &target_vec, idx_t row_count) { + // Flatten the source vector to extract all vertices + source_vec.Flatten(row_count); + + idx_t vert_total = 0; + idx_t vert_start = 0; + + // First pass, figure out how many vertices are in this linestring + for (idx_t row_idx = 0; row_idx < row_count; row_idx++) { + if (FlatVector::IsNull(source_vec, row_idx)) { + FlatVector::SetNull(target_vec, row_idx, true); + continue; + } + + const auto &blob = FlatVector::GetData(source_vec)[row_idx]; + const auto blob_data = blob.GetData(); + const auto blob_size = blob.GetSize(); + + BlobReader reader(blob_data, static_cast(blob_size)); + // Skip byte order and type/meta + reader.Skip(sizeof(uint8_t) + sizeof(uint32_t)); + const auto vert_count = reader.Read(); + + vert_total += vert_count; + } + + ListVector::Reserve(target_vec, vert_total); + ListVector::SetListSize(target_vec, vert_total); + + auto list_data = ListVector::GetData(target_vec); + auto &vert_parts = StructVector::GetEntries(ListVector::GetEntry(target_vec)); + double *vert_data[V::WIDTH]; + for (idx_t i = 0; i < V::WIDTH; i++) { + vert_data[i] = FlatVector::GetData(*vert_parts[i]); + } + + // Second pass, write out the linestrings + + for (idx_t row_idx = 0; row_idx < row_count; row_idx++) { + if (FlatVector::IsNull(source_vec, row_idx)) { + continue; + } + + const auto &blob = FlatVector::GetData(source_vec)[row_idx]; + const auto blob_data = blob.GetData(); + const auto blob_size = blob.GetSize(); + + BlobReader reader(blob_data, static_cast(blob_size)); + // Skip byte order and type/meta + reader.Skip(sizeof(uint8_t) + sizeof(uint32_t)); + const auto vert_count = reader.Read(); + + // Set list entry + auto &list_entry = list_data[row_idx]; + list_entry.offset = vert_start; + list_entry.length = vert_count; + + // Read vertices + for (uint32_t vert_idx = 0; vert_idx < vert_count; vert_idx++) { + for (uint32_t dim_idx = 0; dim_idx < V::WIDTH; dim_idx++) { + vert_data[dim_idx][vert_start + vert_idx] = reader.Read(); + } + } + + vert_start += vert_count; + } + + D_ASSERT(vert_start == vert_total); +} + +template +static void FromLineStrings(Vector &source_vec, Vector &target_vec, idx_t row_count, idx_t result_offset) { + // Flatten the source vector to extract all vertices + source_vec.Flatten(row_count); + + const auto line_data = ListVector::GetData(source_vec); + const auto &vert_parts = StructVector::GetEntries(ListVector::GetEntry(source_vec)); + + double *vert_data[V::WIDTH]; + for (idx_t i = 0; i < V::WIDTH; i++) { + vert_data[i] = FlatVector::GetData(*vert_parts[i]); + } + + for (idx_t row_idx = 0; row_idx < row_count; row_idx++) { + const auto out_idx = result_offset + row_idx; + if (FlatVector::IsNull(source_vec, row_idx)) { + FlatVector::SetNull(target_vec, out_idx, true); + continue; + } + + const auto &line_entry = line_data[row_idx]; + const auto vert_count = line_entry.length; + + // byte order + type/meta + vertex data + const auto blob_size = sizeof(uint8_t) + sizeof(uint32_t) + sizeof(uint32_t) + vert_count * sizeof(V); + auto blob = StringVector::EmptyString(target_vec, blob_size); + const auto blob_data = blob.GetDataWriteable(); + + FixedSizeBlobWriter writer(blob_data, static_cast(blob_size)); + + const auto meta = + static_cast(GeometryType::LINESTRING) + (V::HAS_Z ? 1000 : 0) + (V::HAS_M ? 2000 : 0); + + writer.Write(1); // Little-endian + writer.Write(meta); // Type/meta + writer.Write(UnsafeNumericCast(vert_count)); // Vertex count + + // Write vertex data + for (uint32_t vert_idx = 0; vert_idx < vert_count; vert_idx++) { + for (uint32_t dim_idx = 0; dim_idx < V::WIDTH; dim_idx++) { + writer.Write(vert_data[dim_idx][line_entry.offset + vert_idx]); + } + } + + blob.Finalize(); + FlatVector::GetData(target_vec)[out_idx] = blob; + } +} + +template +static void ToPolygons(Vector &source_vec, Vector &target_vec, idx_t row_count) { + source_vec.Flatten(row_count); + + idx_t vert_total = 0; + idx_t ring_total = 0; + idx_t vert_start = 0; + idx_t ring_start = 0; + + // First pass, figure out how many vertices and rings are in this polygon + for (idx_t row_idx = 0; row_idx < row_count; row_idx++) { + if (FlatVector::IsNull(source_vec, row_idx)) { + FlatVector::SetNull(target_vec, row_idx, true); + continue; + } + + const auto &blob = FlatVector::GetData(source_vec)[row_idx]; + const auto blob_data = blob.GetData(); + const auto blob_size = blob.GetSize(); + + BlobReader reader(blob_data, static_cast(blob_size)); + + // Skip byte order and type/meta + reader.Skip(sizeof(uint8_t) + sizeof(uint32_t)); + + const auto ring_count = reader.Read(); + for (uint32_t ring_idx = 0; ring_idx < ring_count; ring_idx++) { + const auto vert_count = reader.Read(); + + // Skip vertices + reader.Skip(sizeof(V) * vert_count); + + vert_total += vert_count; + } + ring_total += ring_count; + } + + // Reserve space in the target vector + ListVector::Reserve(target_vec, ring_total); + ListVector::SetListSize(target_vec, ring_total); + + auto &ring_vec = ListVector::GetEntry(target_vec); + ListVector::Reserve(ring_vec, vert_total); + ListVector::SetListSize(ring_vec, vert_total); + + const auto poly_data = ListVector::GetData(target_vec); + const auto ring_data = ListVector::GetData(ring_vec); + auto &vert_parts = StructVector::GetEntries(ListVector::GetEntry(ring_vec)); + double *vert_data[V::WIDTH]; + + for (idx_t i = 0; i < V::WIDTH; i++) { + vert_data[i] = FlatVector::GetData(*vert_parts[i]); + } + + for (idx_t row_idx = 0; row_idx < row_count; row_idx++) { + if (FlatVector::IsNull(source_vec, row_idx)) { + continue; + } + + const auto &blob = FlatVector::GetData(source_vec)[row_idx]; + const auto blob_data = blob.GetData(); + const auto blob_size = blob.GetSize(); + + BlobReader reader(blob_data, static_cast(blob_size)); + + // Skip byte order and type/meta + reader.Skip(sizeof(uint8_t) + sizeof(uint32_t)); + + const auto ring_count = reader.Read(); + // Set polygon entry + auto &poly_entry = poly_data[row_idx]; + poly_entry.offset = ring_start; + poly_entry.length = ring_count; + + for (uint32_t ring_idx = 0; ring_idx < ring_count; ring_idx++) { + const auto vert_count = reader.Read(); + + // Set ring entry + auto &ring_entry = ring_data[ring_start + ring_idx]; + ring_entry.offset = vert_start; + ring_entry.length = vert_count; + + // Read vertices + for (uint32_t vert_idx = 0; vert_idx < vert_count; vert_idx++) { + for (uint32_t dim_idx = 0; dim_idx < V::WIDTH; dim_idx++) { + vert_data[dim_idx][vert_start + vert_idx] = reader.Read(); + } + } + + vert_start += vert_count; + } + + ring_start += ring_count; + } + + D_ASSERT(vert_start == vert_total); + D_ASSERT(ring_start == ring_total); +} + +template +static void FromPolygons(Vector &source_vec, Vector &target_vec, idx_t row_count, idx_t result_offset) { + source_vec.Flatten(row_count); + + const auto poly_data = ListVector::GetData(source_vec); + const auto &ring_vec = ListVector::GetEntry(source_vec); + const auto ring_data = ListVector::GetData(ring_vec); + const auto &vert_parts = StructVector::GetEntries(ListVector::GetEntry(ring_vec)); + + double *vert_data[V::WIDTH]; + for (idx_t i = 0; i < V::WIDTH; i++) { + vert_data[i] = FlatVector::GetData(*vert_parts[i]); + } + + for (idx_t row_idx = 0; row_idx < row_count; row_idx++) { + const auto out_idx = result_offset + row_idx; + + if (FlatVector::IsNull(source_vec, row_idx)) { + FlatVector::SetNull(target_vec, out_idx, true); + continue; + } + + const auto &poly_entry = poly_data[row_idx]; + const auto ring_count = poly_entry.length; + + // First, compute total size + idx_t blob_size = sizeof(uint8_t) + sizeof(uint32_t) + sizeof(uint32_t); // byte order + type/meta + ring count + + for (uint32_t ring_idx = 0; ring_idx < ring_count; ring_idx++) { + const auto &ring_entry = ring_data[poly_entry.offset + ring_idx]; + const auto vert_count = ring_entry.length; + // vertex count + blob_size += sizeof(uint32_t); + // vertex data + blob_size += vert_count * sizeof(V); + } + + auto blob = StringVector::EmptyString(target_vec, blob_size); + const auto blob_data = blob.GetDataWriteable(); + + FixedSizeBlobWriter writer(blob_data, static_cast(blob_size)); + + const auto meta = static_cast(GeometryType::POLYGON) + (V::HAS_Z ? 1000 : 0) + (V::HAS_M ? 2000 : 0); + + writer.Write(1); // Little-endian + writer.Write(meta); // Type/meta + writer.Write(UnsafeNumericCast(ring_count)); // Ring count + + for (uint32_t ring_idx = 0; ring_idx < ring_count; ring_idx++) { + const auto &ring_entry = ring_data[poly_entry.offset + ring_idx]; + const auto vert_count = ring_entry.length; + + writer.Write(UnsafeNumericCast(vert_count)); // Vertex count + + // Write vertex data + for (uint32_t vert_idx = 0; vert_idx < vert_count; vert_idx++) { + for (uint32_t dim_idx = 0; dim_idx < V::WIDTH; dim_idx++) { + writer.Write(vert_data[dim_idx][ring_entry.offset + vert_idx]); + } + } + } + + blob.Finalize(); + FlatVector::GetData(target_vec)[out_idx] = blob; + } +} + +template +static void ToMultiPoints(Vector &source_vec, Vector &target_vec, idx_t row_count) { + source_vec.Flatten(row_count); + + const auto geom_data = FlatVector::GetData(source_vec); + + idx_t vert_total = 0; + idx_t vert_start = 0; + + // First pass, figure out how many vertices are in this multipoint + for (idx_t row_idx = 0; row_idx < row_count; row_idx++) { + if (FlatVector::IsNull(source_vec, row_idx)) { + FlatVector::SetNull(target_vec, row_idx, true); + continue; + } + const auto &blob = geom_data[row_idx]; + const auto blob_data = blob.GetData(); + const auto blob_size = blob.GetSize(); + + BlobReader reader(blob_data, static_cast(blob_size)); + + // Skip byte order and type/meta + reader.Skip(sizeof(uint8_t) + sizeof(uint32_t)); + const auto part_count = reader.Read(); + vert_total += part_count; + } + + // Reserve space in the target vector + ListVector::Reserve(target_vec, vert_total); + ListVector::SetListSize(target_vec, vert_total); + + auto mult_data = ListVector::GetData(target_vec); + auto &vert_parts = StructVector::GetEntries(ListVector::GetEntry(target_vec)); + double *vert_data[V::WIDTH]; + for (idx_t i = 0; i < V::WIDTH; i++) { + vert_data[i] = FlatVector::GetData(*vert_parts[i]); + } + + // Second pass, write out the multipoints + for (idx_t row_idx = 0; row_idx < row_count; row_idx++) { + if (FlatVector::IsNull(source_vec, row_idx)) { + continue; + } + + const auto &blob = geom_data[row_idx]; + const auto blob_data = blob.GetData(); + const auto blob_size = blob.GetSize(); + + BlobReader reader(blob_data, static_cast(blob_size)); + + // Skip byte order and type/meta + reader.Skip(sizeof(uint8_t) + sizeof(uint32_t)); + const auto part_count = reader.Read(); + + // Set multipoint entry + auto &mult_entry = mult_data[row_idx]; + mult_entry.offset = vert_start; + mult_entry.length = part_count; + + for (uint32_t part_idx = 0; part_idx < part_count; part_idx++) { + // Skip byte order and type/meta of the point + reader.Skip(sizeof(uint8_t) + sizeof(uint32_t)); + + for (uint32_t dim_idx = 0; dim_idx < V::WIDTH; dim_idx++) { + vert_data[dim_idx][vert_start + part_idx] = reader.Read(); + } + } + + vert_start += part_count; + } + + D_ASSERT(vert_start == vert_total); +} + +template +static void FromMultiPoints(Vector &source_vec, Vector &target_vec, idx_t row_count, idx_t result_offset) { + // Flatten the source vector to extract all vertices + source_vec.Flatten(row_count); + + const auto mult_data = ListVector::GetData(source_vec); + const auto &vert_parts = StructVector::GetEntries(ListVector::GetEntry(source_vec)); + + double *vert_data[V::WIDTH]; + for (idx_t i = 0; i < V::WIDTH; i++) { + vert_data[i] = FlatVector::GetData(*vert_parts[i]); + } + + for (idx_t row_idx = 0; row_idx < row_count; row_idx++) { + const auto out_idx = result_offset + row_idx; + if (FlatVector::IsNull(source_vec, row_idx)) { + FlatVector::SetNull(target_vec, out_idx, true); + continue; + } + + const auto &mult_entry = mult_data[row_idx]; + const auto part_count = mult_entry.length; + + // First, compute total size + // byte order + type/meta + part count + idx_t blob_size = sizeof(uint8_t) + sizeof(uint32_t) + sizeof(uint32_t); + + for (uint32_t part_idx = 0; part_idx < part_count; part_idx++) { + // point byte order + type/meta + vertex data + blob_size += sizeof(uint8_t) + sizeof(uint32_t) + sizeof(V); + } + + auto blob = StringVector::EmptyString(target_vec, blob_size); + const auto blob_data = blob.GetDataWriteable(); + + FixedSizeBlobWriter writer(blob_data, static_cast(blob_size)); + + const auto meta = + static_cast(GeometryType::MULTIPOINT) + (V::HAS_Z ? 1000 : 0) + (V::HAS_M ? 2000 : 0); + + writer.Write(1); // Little-endian + writer.Write(meta); // Type/meta + writer.Write(UnsafeNumericCast(part_count)); // Part count + + for (uint32_t part_idx = 0; part_idx < part_count; part_idx++) { + // Write point byte order and type/meta + const auto point_meta = + static_cast(GeometryType::POINT) + (V::HAS_Z ? 1000 : 0) + (V::HAS_M ? 2000 : 0); + writer.Write(1); // Little-endian + writer.Write(point_meta); // Type/meta + + // Write vertex data + for (uint32_t dim_idx = 0; dim_idx < V::WIDTH; dim_idx++) { + writer.Write(vert_data[dim_idx][mult_entry.offset + part_idx]); + } + } + + blob.Finalize(); + FlatVector::GetData(target_vec)[out_idx] = blob; + } +} + +template +static void ToMultiLineStrings(Vector &source_vec, Vector &target_vec, idx_t row_count) { + // Flatten the source vector to extract all vertices + source_vec.Flatten(row_count); + + // This is basically the same as Polygons + + idx_t vert_total = 0; + idx_t line_total = 0; + idx_t vert_start = 0; + idx_t line_start = 0; + + // First pass, figure out how many vertices and lines are in this multilinestring + for (idx_t row_idx = 0; row_idx < row_count; row_idx++) { + if (FlatVector::IsNull(source_vec, row_idx)) { + FlatVector::SetNull(target_vec, row_idx, true); + continue; + } + + const auto &blob = FlatVector::GetData(source_vec)[row_idx]; + const auto blob_data = blob.GetData(); + const auto blob_size = blob.GetSize(); + + BlobReader reader(blob_data, static_cast(blob_size)); + + // Skip byte order and type/meta + reader.Skip(sizeof(uint8_t) + sizeof(uint32_t)); + + // Line count + const auto line_count = reader.Read(); + for (uint32_t line_idx = 0; line_idx < line_count; line_idx++) { + // Skip line metadata + reader.Skip(sizeof(uint8_t) + sizeof(uint32_t)); + + // Read vertex count + const auto vert_count = reader.Read(); + // Skip vertices + reader.Skip(sizeof(V) * vert_count); + + vert_total += vert_count; + } + line_total += line_count; + } + + // Reserve space in the target vector + ListVector::Reserve(target_vec, line_total); + ListVector::SetListSize(target_vec, line_total); + + auto &line_vec = ListVector::GetEntry(target_vec); + ListVector::Reserve(line_vec, vert_total); + ListVector::SetListSize(line_vec, vert_total); + + const auto mult_data = ListVector::GetData(target_vec); + const auto line_data = ListVector::GetData(line_vec); + auto &vert_parts = StructVector::GetEntries(ListVector::GetEntry(line_vec)); + double *vert_data[V::WIDTH]; + for (idx_t i = 0; i < V::WIDTH; i++) { + vert_data[i] = FlatVector::GetData(*vert_parts[i]); + } + + // Second pass, write out the multilinestrings + for (idx_t row_idx = 0; row_idx < row_count; row_idx++) { + if (FlatVector::IsNull(source_vec, row_idx)) { + continue; + } + const auto &blob = FlatVector::GetData(source_vec)[row_idx]; + const auto blob_data = blob.GetData(); + const auto blob_size = blob.GetSize(); + + BlobReader reader(blob_data, static_cast(blob_size)); + // Skip byte order and type/meta + reader.Skip(sizeof(uint8_t) + sizeof(uint32_t)); + const auto line_count = reader.Read(); + + // Set multilinestring entry + auto &mult_entry = mult_data[row_idx]; + mult_entry.offset = line_start; + mult_entry.length = line_count; + + for (uint32_t line_idx = 0; line_idx < line_count; line_idx++) { + // Skip line byte order and type/meta + reader.Skip(sizeof(uint8_t) + sizeof(uint32_t)); + + // Read vertex count + const auto vert_count = reader.Read(); + + // Set line entry + auto &line_entry = line_data[line_start + line_idx]; + line_entry.offset = vert_start; + line_entry.length = vert_count; + + // Read vertices + for (uint32_t vert_idx = 0; vert_idx < vert_count; vert_idx++) { + for (uint32_t dim_idx = 0; dim_idx < V::WIDTH; dim_idx++) { + vert_data[dim_idx][vert_start + vert_idx] = reader.Read(); + } + } + + vert_start += vert_count; + } + line_start += line_count; + } + + D_ASSERT(vert_start == vert_total); + D_ASSERT(line_start == line_total); +} + +template +static void FromMultiLineStrings(Vector &source_vec, Vector &target_vec, idx_t row_count, idx_t result_offset) { + // Flatten the source vector to extract all vertices + + source_vec.Flatten(row_count); + + const auto mult_data = ListVector::GetData(source_vec); + const auto line_vec = ListVector::GetEntry(source_vec); + const auto line_data = ListVector::GetData(line_vec); + const auto &vert_parts = StructVector::GetEntries(ListVector::GetEntry(line_vec)); + double *vert_data[V::WIDTH]; + for (idx_t i = 0; i < V::WIDTH; i++) { + vert_data[i] = FlatVector::GetData(*vert_parts[i]); + } + + for (idx_t row_idx = 0; row_idx < row_count; row_idx++) { + const auto out_idx = result_offset + row_idx; + if (FlatVector::IsNull(source_vec, row_idx)) { + FlatVector::SetNull(target_vec, out_idx, true); + continue; + } + + const auto &mult_entry = mult_data[row_idx]; + const auto line_count = mult_entry.length; + + // First, compute total size + // byte order + type/meta + line count + idx_t blob_size = sizeof(uint8_t) + sizeof(uint32_t) + sizeof(uint32_t); + + for (uint32_t line_idx = 0; line_idx < line_count; line_idx++) { + const auto &line_entry = line_data[mult_entry.offset + line_idx]; + const auto vert_count = line_entry.length; + // line byte order + type/meta + vertex count + blob_size += sizeof(uint8_t) + sizeof(uint32_t) + sizeof(uint32_t); + // vertex data + blob_size += vert_count * sizeof(V); + } + + auto blob = StringVector::EmptyString(target_vec, blob_size); + const auto blob_data = blob.GetDataWriteable(); + + FixedSizeBlobWriter writer(blob_data, static_cast(blob_size)); + + const auto meta = + static_cast(GeometryType::MULTILINESTRING) + (V::HAS_Z ? 1000 : 0) + (V::HAS_M ? 2000 : 0); + + writer.Write(1); // Little-endian + writer.Write(meta); // Type/meta + writer.Write(UnsafeNumericCast(line_count)); // Line count + + for (uint32_t line_idx = 0; line_idx < line_count; line_idx++) { + const auto &line_entry = line_data[mult_entry.offset + line_idx]; + const auto vert_count = line_entry.length; + + // Write line byte order and type/meta + const auto line_meta = + static_cast(GeometryType::LINESTRING) + (V::HAS_Z ? 1000 : 0) + (V::HAS_M ? 2000 : 0); + writer.Write(1); // Little-endian + writer.Write(line_meta); // Type/meta + writer.Write(UnsafeNumericCast(vert_count)); // Vertex count + + // Write vertex data + for (uint32_t vert_idx = 0; vert_idx < vert_count; vert_idx++) { + for (uint32_t dim_idx = 0; dim_idx < V::WIDTH; dim_idx++) { + writer.Write(vert_data[dim_idx][line_entry.offset + vert_idx]); + } + } + } + blob.Finalize(); + FlatVector::GetData(target_vec)[out_idx] = blob; + } +} + +template +static void ToMultiPolygons(Vector &source_vec, Vector &target_vec, idx_t row_count) { + // Flatten the source vector to extract all vertices + source_vec.Flatten(row_count); + + idx_t vert_total = 0; + idx_t ring_total = 0; + idx_t poly_total = 0; + idx_t vert_start = 0; + idx_t ring_start = 0; + idx_t poly_start = 0; + + // First pass, figure out how many vertices, rings and polygons are in this multipolygon + for (idx_t row_idx = 0; row_idx < row_count; row_idx++) { + if (FlatVector::IsNull(source_vec, row_idx)) { + FlatVector::SetNull(target_vec, row_idx, true); + continue; + } + + const auto &blob = FlatVector::GetData(source_vec)[row_idx]; + const auto blob_data = blob.GetData(); + const auto blob_size = blob.GetSize(); + BlobReader reader(blob_data, static_cast(blob_size)); + + // Skip byte order and type/meta + reader.Skip(sizeof(uint8_t) + sizeof(uint32_t)); + + const auto poly_count = reader.Read(); + for (uint32_t poly_idx = 0; poly_idx < poly_count; poly_idx++) { + // Skip polygon byte order and metadata + reader.Skip(sizeof(uint8_t) + sizeof(uint32_t)); + + // Read ring count + const auto ring_count = reader.Read(); + for (uint32_t ring_idx = 0; ring_idx < ring_count; ring_idx++) { + // Read vertex count + const auto vert_count = reader.Read(); + // Skip vertices + reader.Skip(sizeof(V) * vert_count); + + vert_total += vert_count; + } + ring_total += ring_count; + } + poly_total += poly_count; + } + + // Reserve space in the target vector + ListVector::Reserve(target_vec, poly_total); + ListVector::SetListSize(target_vec, poly_total); + auto &poly_vec = ListVector::GetEntry(target_vec); + ListVector::Reserve(poly_vec, ring_total); + ListVector::SetListSize(poly_vec, ring_total); + auto &ring_vec = ListVector::GetEntry(poly_vec); + ListVector::Reserve(ring_vec, vert_total); + ListVector::SetListSize(ring_vec, vert_total); + + const auto mult_data = ListVector::GetData(target_vec); + const auto poly_data = ListVector::GetData(poly_vec); + const auto ring_data = ListVector::GetData(ring_vec); + auto &vert_parts = StructVector::GetEntries(ListVector::GetEntry(ring_vec)); + double *vert_data[V::WIDTH]; + for (idx_t i = 0; i < V::WIDTH; i++) { + vert_data[i] = FlatVector::GetData(*vert_parts[i]); + } + + // Second pass, write out the multipolygons + for (idx_t row_idx = 0; row_idx < row_count; row_idx++) { + if (FlatVector::IsNull(source_vec, row_idx)) { + continue; + } + const auto &blob = FlatVector::GetData(source_vec)[row_idx]; + const auto blob_data = blob.GetData(); + const auto blob_size = blob.GetSize(); + + BlobReader reader(blob_data, static_cast(blob_size)); + + // Skip byte order and type/meta + reader.Skip(sizeof(uint8_t) + sizeof(uint32_t)); + const auto poly_count = reader.Read(); + + // Set multipolygon entry + auto &mult_entry = mult_data[row_idx]; + mult_entry.offset = poly_start; + mult_entry.length = poly_count; + + // Read polygons + for (uint32_t poly_idx = 0; poly_idx < poly_count; poly_idx++) { + // Skip polygon byte order and type/meta + reader.Skip(sizeof(uint8_t) + sizeof(uint32_t)); + + // Read ring count + const auto ring_count = reader.Read(); + + // Set polygon entry + auto &poly_entry = poly_data[poly_start + poly_idx]; + poly_entry.offset = ring_start; + poly_entry.length = ring_count; + + // Read rings + for (uint32_t ring_idx = 0; ring_idx < ring_count; ring_idx++) { + // Read vertex count + const auto vert_count = reader.Read(); + // Set ring entry + auto &ring_entry = ring_data[ring_start + ring_idx]; + ring_entry.offset = vert_start; + ring_entry.length = vert_count; + + // Read vertices + for (uint32_t vert_idx = 0; vert_idx < vert_count; vert_idx++) { + for (uint32_t dim_idx = 0; dim_idx < V::WIDTH; dim_idx++) { + vert_data[dim_idx][vert_start + vert_idx] = reader.Read(); + } + } + vert_start += vert_count; + } + ring_start += ring_count; + } + poly_start += poly_count; + } +} + +template +static void FromMultiPolygons(Vector &source_vec, Vector &target_vec, idx_t row_count, idx_t result_offset) { + // Flatten the source vector to extract all vertices + source_vec.Flatten(row_count); + + const auto mult_data = ListVector::GetData(source_vec); + const auto &poly_vec = ListVector::GetEntry(source_vec); + const auto poly_data = ListVector::GetData(poly_vec); + const auto &ring_vec = ListVector::GetEntry(poly_vec); + const auto ring_data = ListVector::GetData(ring_vec); + const auto &vert_parts = StructVector::GetEntries(ListVector::GetEntry(ring_vec)); + double *vert_data[V::WIDTH]; + for (idx_t i = 0; i < V::WIDTH; i++) { + vert_data[i] = FlatVector::GetData(*vert_parts[i]); + } + + for (idx_t row_idx = 0; row_idx < row_count; row_idx++) { + const auto out_idx = result_offset + row_idx; + if (FlatVector::IsNull(source_vec, row_idx)) { + FlatVector::SetNull(target_vec, out_idx, true); + continue; + } + + const auto &mult_entry = mult_data[row_idx]; + const auto poly_count = mult_entry.length; + + // First, compute total size + // byte order + type/meta + polygon count + idx_t blob_size = sizeof(uint8_t) + sizeof(uint32_t) + sizeof(uint32_t); + + for (uint32_t poly_idx = 0; poly_idx < poly_count; poly_idx++) { + const auto &poly_entry = poly_data[mult_entry.offset + poly_idx]; + const auto ring_count = poly_entry.length; + // polygon byte order + type/meta + ring count + blob_size += sizeof(uint8_t) + sizeof(uint32_t) + sizeof(uint32_t); + + for (uint32_t ring_idx = 0; ring_idx < ring_count; ring_idx++) { + const auto &ring_entry = ring_data[poly_entry.offset + ring_idx]; + const auto vert_count = ring_entry.length; + // vertex count + blob_size += sizeof(uint32_t); + // vertex data + blob_size += vert_count * sizeof(V); + } + } + + auto blob = StringVector::EmptyString(target_vec, blob_size); + const auto blob_data = blob.GetDataWriteable(); + + FixedSizeBlobWriter writer(blob_data, static_cast(blob_size)); + + const auto meta = + static_cast(GeometryType::MULTIPOLYGON) + (V::HAS_Z ? 1000 : 0) + (V::HAS_M ? 2000 : 0); + writer.Write(1); // Little-endian + writer.Write(meta); // Type/meta + writer.Write(UnsafeNumericCast(poly_count)); // Polygon count + + for (uint32_t poly_idx = 0; poly_idx < poly_count; poly_idx++) { + const auto &poly_entry = poly_data[mult_entry.offset + poly_idx]; + const auto ring_count = poly_entry.length; + + // Write polygon byte order and type/meta + const auto poly_meta = + static_cast(GeometryType::POLYGON) + (V::HAS_Z ? 1000 : 0) + (V::HAS_M ? 2000 : 0); + writer.Write(1); // Little-endian + writer.Write(poly_meta); // Type/meta + writer.Write(UnsafeNumericCast(ring_count)); // Ring count + + for (uint32_t ring_idx = 0; ring_idx < ring_count; ring_idx++) { + const auto &ring_entry = ring_data[poly_entry.offset + ring_idx]; + const auto vert_count = ring_entry.length; + + writer.Write(UnsafeNumericCast(vert_count)); // Vertex count + + // Write vertex data + for (uint32_t vert_idx = 0; vert_idx < vert_count; vert_idx++) { + for (uint32_t dim_idx = 0; dim_idx < V::WIDTH; dim_idx++) { + writer.Write(vert_data[dim_idx][ring_entry.offset + vert_idx]); + } + } + } + } + + blob.Finalize(); + FlatVector::GetData(target_vec)[out_idx] = blob; + } +} + +template +static void ToVectorizedFormatInternal(Vector &source, Vector &target, idx_t count, GeometryType geom_type) { + switch (geom_type) { + case GeometryType::POINT: + ToPoints(source, target, count); + break; + case GeometryType::LINESTRING: + ToLineStrings(source, target, count); + break; + case GeometryType::POLYGON: + ToPolygons(source, target, count); + break; + case GeometryType::MULTIPOINT: + ToMultiPoints(source, target, count); + break; + case GeometryType::MULTILINESTRING: + ToMultiLineStrings(source, target, count); + break; + case GeometryType::MULTIPOLYGON: + ToMultiPolygons(source, target, count); + break; + default: + throw NotImplementedException("Unsupported geometry type %d", static_cast(geom_type)); + } +} + +void Geometry::ToVectorizedFormat(Vector &source, Vector &target, idx_t count, GeometryType geom_type, + VertexType vert_type) { + switch (vert_type) { + case VertexType::XY: + ToVectorizedFormatInternal(source, target, count, geom_type); + break; + case VertexType::XYZ: + ToVectorizedFormatInternal(source, target, count, geom_type); + break; + case VertexType::XYM: + ToVectorizedFormatInternal(source, target, count, geom_type); + break; + case VertexType::XYZM: + ToVectorizedFormatInternal(source, target, count, geom_type); + break; + default: + throw InvalidInputException("Unsupported vertex type %d", static_cast(vert_type)); + } +} + +template +static void FromVectorizedFormatInternal(Vector &source, Vector &target, idx_t count, GeometryType geom_type, + idx_t result_offset) { + switch (geom_type) { + case GeometryType::POINT: + FromPoints(source, target, count, result_offset); + break; + case GeometryType::LINESTRING: + FromLineStrings(source, target, count, result_offset); + break; + case GeometryType::POLYGON: + FromPolygons(source, target, count, result_offset); + break; + case GeometryType::MULTIPOINT: + FromMultiPoints(source, target, count, result_offset); + break; + case GeometryType::MULTILINESTRING: + FromMultiLineStrings(source, target, count, result_offset); + break; + case GeometryType::MULTIPOLYGON: + FromMultiPolygons(source, target, count, result_offset); + break; + default: + throw NotImplementedException("Unsupported geometry type %d", static_cast(geom_type)); + } +} + +void Geometry::FromVectorizedFormat(Vector &source, Vector &target, idx_t count, GeometryType geom_type, + VertexType vert_type, idx_t result_offset) { + switch (vert_type) { + case VertexType::XY: + FromVectorizedFormatInternal(source, target, count, geom_type, result_offset); + break; + case VertexType::XYZ: + FromVectorizedFormatInternal(source, target, count, geom_type, result_offset); + break; + case VertexType::XYM: + FromVectorizedFormatInternal(source, target, count, geom_type, result_offset); + break; + case VertexType::XYZM: + FromVectorizedFormatInternal(source, target, count, geom_type, result_offset); + break; + default: + throw InvalidInputException("Unsupported vertex type %d", static_cast(vert_type)); + } +} + +static LogicalType GetVectorizedTypeInternal(GeometryType geom_type, LogicalType vertex_type) { + switch (geom_type) { + case GeometryType::POINT: + return vertex_type; + case GeometryType::LINESTRING: + return LogicalType::LIST(vertex_type); + case GeometryType::POLYGON: + return LogicalType::LIST(LogicalType::LIST(vertex_type)); + case GeometryType::MULTIPOINT: + return LogicalType::LIST(vertex_type); + case GeometryType::MULTILINESTRING: + return LogicalType::LIST(LogicalType::LIST(vertex_type)); + case GeometryType::MULTIPOLYGON: + return LogicalType::LIST(LogicalType::LIST(LogicalType::LIST(vertex_type))); + case GeometryType::GEOMETRYCOLLECTION: + throw NotImplementedException("GEOMETRYCOLLECTION vectorized type not implemented"); + default: + throw InvalidInputException("Unsupported geometry type %d", static_cast(geom_type)); + } +} + +LogicalType Geometry::GetVectorizedType(GeometryType geom_type, VertexType vert_type) { + switch (vert_type) { + case VertexType::XY: { + auto vert = LogicalType::STRUCT({{"x", LogicalType::DOUBLE}, {"y", LogicalType::DOUBLE}}); + return GetVectorizedTypeInternal(geom_type, std::move(vert)); + } + case VertexType::XYZ: { + auto vert = + LogicalType::STRUCT({{"x", LogicalType::DOUBLE}, {"y", LogicalType::DOUBLE}, {"z", LogicalType::DOUBLE}}); + return GetVectorizedTypeInternal(geom_type, std::move(vert)); + } + case VertexType::XYM: { + auto vert = + LogicalType::STRUCT({{"x", LogicalType::DOUBLE}, {"y", LogicalType::DOUBLE}, {"m", LogicalType::DOUBLE}}); + return GetVectorizedTypeInternal(geom_type, std::move(vert)); + } + case VertexType::XYZM: { + auto vert = LogicalType::STRUCT({{"x", LogicalType::DOUBLE}, + {"y", LogicalType::DOUBLE}, + {"z", LogicalType::DOUBLE}, + {"m", LogicalType::DOUBLE}}); + return GetVectorizedTypeInternal(geom_type, std::move(vert)); + } + default: + throw InvalidInputException("Unsupported vertex type %d", static_cast(vert_type)); + } +} + } // namespace duckdb diff --git a/src/duckdb/src/common/types/row/tuple_data_scatter_gather.cpp b/src/duckdb/src/common/types/row/tuple_data_scatter_gather.cpp index 3c967d448..99e694121 100644 --- a/src/duckdb/src/common/types/row/tuple_data_scatter_gather.cpp +++ b/src/duckdb/src/common/types/row/tuple_data_scatter_gather.cpp @@ -29,7 +29,7 @@ static void TupleDataValueStore(const T &source, data_t *__restrict const &row_l template <> inline void TupleDataValueStore(const string_t &source, data_t *__restrict const &row_location, const idx_t &offset_in_row, data_ptr_t &heap_location) { -#ifdef D_ASSERT_IS_ENABLED +#ifdef DEBUG source.VerifyCharacters(); #endif if (source.IsInlined()) { @@ -54,7 +54,7 @@ static void TupleDataWithinListValueStore(const T &source, const data_ptr_t &loc template <> inline void TupleDataWithinListValueStore(const string_t &source, const data_ptr_t &location, data_ptr_t &heap_location) { -#ifdef D_ASSERT_IS_ENABLED +#ifdef DEBUG source.VerifyCharacters(); #endif Store(UnsafeNumericCast(source.GetSize()), location); @@ -64,14 +64,14 @@ inline void TupleDataWithinListValueStore(const string_t &source, const data_ptr template void TupleDataValueVerify(const LogicalType &, const T &) { -#ifdef D_ASSERT_IS_ENABLED +#ifdef DEBUG // NOP #endif } template <> inline void TupleDataValueVerify(const LogicalType &type, const string_t &value) { -#ifdef D_ASSERT_IS_ENABLED +#ifdef DEBUG if (type.id() == LogicalTypeId::VARCHAR) { value.Verify(); } @@ -516,7 +516,7 @@ void TupleDataCollection::CollectionWithinCollectionComputeHeapSizes(Vector &hea D_ASSERT(source_format.children.size() == 1); auto &child_format = source_format.children[0]; #ifdef D_ASSERT_IS_ENABLED - // In debug mode this should be deleted by ResetCombinedListData + // Should be deleted by ResetCombinedListData if assertions are enabled D_ASSERT(!child_format.combined_list_data); #endif if (!child_format.combined_list_data) { @@ -647,7 +647,7 @@ static void InitializeValidityMask(const data_ptr_t row_locations[], const idx_t void TupleDataCollection::Scatter(TupleDataChunkState &chunk_state, const DataChunk &new_chunk, const SelectionVector &append_sel, const idx_t append_count) const { -#ifdef D_ASSERT_IS_ENABLED +#ifdef DEBUG Vector heap_locations_copy(LogicalType::POINTER); if (!layout.AllConstant()) { const auto heap_locations = FlatVector::GetData(chunk_state.heap_locations); @@ -686,7 +686,7 @@ void TupleDataCollection::Scatter(TupleDataChunkState &chunk_state, const DataCh } } -#ifdef D_ASSERT_IS_ENABLED +#ifdef DEBUG // Verify that the size of the data written to the heap is the same as the size we computed it would be if (!layout.AllConstant()) { const auto original_heap_locations = FlatVector::GetData(heap_locations_copy); diff --git a/src/duckdb/src/common/virtual_file_system.cpp b/src/duckdb/src/common/virtual_file_system.cpp index 6374ec963..777d1e353 100644 --- a/src/duckdb/src/common/virtual_file_system.cpp +++ b/src/duckdb/src/common/virtual_file_system.cpp @@ -9,13 +9,108 @@ namespace duckdb { +struct FileSystemHandle { + explicit FileSystemHandle(unique_ptr fs) : file_system(std::move(fs)) { + } + + unique_ptr file_system; +}; + +//! The FileSystemRegistry holds the set of file systems that are registered. +//! Note that it should be treated as read-only. +//! When a change is made (e.g. by registering new file system) a copy of the registry is made +struct FileSystemRegistry { + explicit FileSystemRegistry(unique_ptr fs) + : default_fs(make_shared_ptr(std::move(fs))) { + } + + vector> sub_systems; + map> compressed_fs; + const shared_ptr default_fs; + unordered_set disabled_file_systems; + +public: + shared_ptr RegisterSubSystem(unique_ptr fs) const; + shared_ptr RegisterSubSystem(FileCompressionType compression_type, + unique_ptr fs) const; + shared_ptr SetDisabledFileSystems(const vector &names) const; + shared_ptr ExtractSubSystem(const string &name, unique_ptr &result) const; +}; + +shared_ptr FileSystemRegistry::RegisterSubSystem(unique_ptr fs) const { + auto new_registry = make_shared_ptr(*this); + const auto &name = fs->GetName(); + for (auto &sub_system : new_registry->sub_systems) { + if (sub_system->file_system->GetName() == name) { + throw InvalidInputException("Filesystem with name %s has already been registered, cannot re-register!", + name); + } + } + new_registry->sub_systems.push_back(make_shared_ptr(std::move(fs))); + return new_registry; +} + +shared_ptr FileSystemRegistry::RegisterSubSystem(FileCompressionType compression_type, + unique_ptr fs) const { + auto new_registry = make_shared_ptr(*this); + new_registry->compressed_fs[compression_type] = make_shared_ptr(std::move(fs)); + return new_registry; +} + +shared_ptr FileSystemRegistry::SetDisabledFileSystems(const vector &names) const { + auto new_registry = make_shared_ptr(*this); + unordered_set new_disabled_file_systems; + for (auto &name : names) { + if (name.empty()) { + continue; + } + if (new_disabled_file_systems.find(name) != new_disabled_file_systems.end()) { + throw InvalidInputException("Duplicate disabled file system \"%s\"", name); + } + new_disabled_file_systems.insert(name); + } + for (auto &disabled_fs : disabled_file_systems) { + if (new_disabled_file_systems.find(disabled_fs) == new_disabled_file_systems.end()) { + throw InvalidInputException("File system \"%s\" has been disabled previously, it cannot be re-enabled", + disabled_fs); + } + } + new_registry->disabled_file_systems = std::move(new_disabled_file_systems); + return new_registry; +} + +shared_ptr FileSystemRegistry::ExtractSubSystem(const string &name, + unique_ptr &result) const { + auto new_registry = make_shared_ptr(*this); + // If the subsystem has been disabled, we don't allow extraction and return nullptr here. + if (disabled_file_systems.find(name) != disabled_file_systems.end()) { + return nullptr; + } + + for (auto iter = new_registry->sub_systems.begin(); iter != new_registry->sub_systems.end(); ++iter) { + auto &cur_filesystem = (*iter)->file_system; + if (cur_filesystem->GetName() == name) { + result = std::move(cur_filesystem); + new_registry->sub_systems.erase(iter); + return new_registry; + } + } + + // Requested subfilesystem is not registered. + return nullptr; +} + VirtualFileSystem::VirtualFileSystem() : VirtualFileSystem(FileSystem::CreateLocal()) { } -VirtualFileSystem::VirtualFileSystem(unique_ptr &&inner) : default_fs(std::move(inner)) { +VirtualFileSystem::VirtualFileSystem(unique_ptr &&inner) + : file_system_registry(make_shared_ptr(std::move(inner))) { VirtualFileSystem::RegisterSubSystem(FileCompressionType::GZIP, make_uniq()); } +VirtualFileSystem::~VirtualFileSystem() { +} + unique_ptr VirtualFileSystem::OpenFileExtended(const OpenFileInfo &file, FileOpenFlags flags, optional_ptr opener) { auto compression = flags.Compression(); @@ -38,7 +133,8 @@ unique_ptr VirtualFileSystem::OpenFileExtended(const OpenFileInfo &f // open the base file handle in UNCOMPRESSED mode flags.SetCompression(FileCompressionType::UNCOMPRESSED); - auto &internal_filesystem = FindFileSystem(file.path, opener); + auto registry = file_system_registry.atomic_load(); + auto &internal_filesystem = FindFileSystem(registry, file.path, opener); // File handle gets created. unique_ptr file_handle = nullptr; @@ -61,8 +157,8 @@ unique_ptr VirtualFileSystem::OpenFileExtended(const OpenFileInfo &f if (file_handle->GetType() == FileType::FILE_TYPE_FIFO) { file_handle = PipeFileSystem::OpenPipe(context, std::move(file_handle)); } else if (compression != FileCompressionType::UNCOMPRESSED) { - auto entry = compressed_fs.find(compression); - if (entry == compressed_fs.end()) { + auto entry = registry->compressed_fs.find(compression); + if (entry == registry->compressed_fs.end()) { if (compression == FileCompressionType::ZSTD) { throw NotImplementedException( "Attempting to open a compressed file, but the compression type is not supported.\nConsider " @@ -71,7 +167,8 @@ unique_ptr VirtualFileSystem::OpenFileExtended(const OpenFileInfo &f throw NotImplementedException( "Attempting to open a compressed file, but the compression type is not supported"); } - file_handle = entry->second->OpenCompressedFile(context, std::move(file_handle), flags.OpenForWriting()); + auto &compressed_fs = *entry->second->file_system; + file_handle = compressed_fs.OpenCompressedFile(context, std::move(file_handle), flags.OpenForWriting()); } return file_handle; } @@ -118,14 +215,14 @@ void VirtualFileSystem::FileSync(FileHandle &handle) { // need to look up correct fs for this bool VirtualFileSystem::DirectoryExists(const string &directory, optional_ptr opener) { - return FindFileSystem(directory).DirectoryExists(directory, opener); + return FindFileSystem(directory, opener).DirectoryExists(directory, opener); } void VirtualFileSystem::CreateDirectory(const string &directory, optional_ptr opener) { - FindFileSystem(directory).CreateDirectory(directory, opener); + FindFileSystem(directory, opener).CreateDirectory(directory, opener); } void VirtualFileSystem::RemoveDirectory(const string &directory, optional_ptr opener) { - FindFileSystem(directory).RemoveDirectory(directory, opener); + FindFileSystem(directory, opener).RemoveDirectory(directory, opener); } bool VirtualFileSystem::ListFilesExtended(const string &directory, @@ -135,7 +232,7 @@ bool VirtualFileSystem::ListFilesExtended(const string &directory, } void VirtualFileSystem::MoveFile(const string &source, const string &target, optional_ptr opener) { - FindFileSystem(source).MoveFile(source, target, opener); + FindFileSystem(source, opener).MoveFile(source, target, opener); } bool VirtualFileSystem::FileExists(const string &filename, optional_ptr opener) { @@ -143,21 +240,21 @@ bool VirtualFileSystem::FileExists(const string &filename, optional_ptr opener) { - return FindFileSystem(filename).IsPipe(filename, opener); + return FindFileSystem(filename, opener).IsPipe(filename, opener); } void VirtualFileSystem::RemoveFile(const string &filename, optional_ptr opener) { - FindFileSystem(filename).RemoveFile(filename, opener); + FindFileSystem(filename, opener).RemoveFile(filename, opener); } bool VirtualFileSystem::TryRemoveFile(const string &filename, optional_ptr opener) { - return FindFileSystem(filename).TryRemoveFile(filename, opener); + return FindFileSystem(filename, opener).TryRemoveFile(filename, opener); } void VirtualFileSystem::RemoveFiles(const vector &filenames, optional_ptr opener) { reference_map_t> files_by_fs; for (const auto &filename : filenames) { - auto &fs = FindFileSystem(filename); + auto &fs = FindFileSystem(filename, opener); files_by_fs[fs].push_back(filename); } for (auto &entry : files_by_fs) { @@ -166,7 +263,7 @@ void VirtualFileSystem::RemoveFiles(const vector &filenames, optional_pt } string VirtualFileSystem::PathSeparator(const string &path) { - return FindFileSystem(path).PathSeparator(path); + return FindFileSystem(path, nullptr).PathSeparator(path); } vector VirtualFileSystem::Glob(const string &path, FileOpener *opener) { @@ -174,55 +271,38 @@ vector VirtualFileSystem::Glob(const string &path, FileOpener *ope } void VirtualFileSystem::RegisterSubSystem(unique_ptr fs) { - // Sub-filesystem number is not expected to be huge, also filesystem registration should be called infrequently. - const auto &name = fs->GetName(); - for (auto sub_system = sub_systems.begin(); sub_system != sub_systems.end(); sub_system++) { - if (sub_system->get()->GetName() == name) { - throw InvalidInputException("Filesystem with name %s has already been registered, cannot re-register!", - name); - } - } - sub_systems.push_back(std::move(fs)); -} - -void VirtualFileSystem::UnregisterSubSystem(const string &name) { - for (auto sub_system = sub_systems.begin(); sub_system != sub_systems.end(); sub_system++) { - if (sub_system->get()->GetName() == name) { - sub_systems.erase(sub_system); - return; - } - } - throw InvalidInputException("Could not find filesystem with name %s", name); + lock_guard guard(registry_lock); + auto new_registry = file_system_registry->RegisterSubSystem(std::move(fs)); + file_system_registry.atomic_store(new_registry); } void VirtualFileSystem::RegisterSubSystem(FileCompressionType compression_type, unique_ptr fs) { - compressed_fs[compression_type] = std::move(fs); + lock_guard guard(registry_lock); + auto new_registry = file_system_registry->RegisterSubSystem(compression_type, std::move(fs)); + file_system_registry.atomic_store(new_registry); } +void VirtualFileSystem::SetDisabledFileSystems(const vector &names) { + lock_guard guard(registry_lock); + auto new_registry = file_system_registry->SetDisabledFileSystems(names); + file_system_registry.atomic_store(new_registry); +} unique_ptr VirtualFileSystem::ExtractSubSystem(const string &name) { - // If the subsystem has been disabled, we don't allow extraction and return nullptr here. - if (disabled_file_systems.find(name) != disabled_file_systems.end()) { - return nullptr; + lock_guard guard(registry_lock); + unique_ptr result; + auto new_registry = file_system_registry->ExtractSubSystem(name, result); + if (new_registry) { + file_system_registry.atomic_store(new_registry); } - - unique_ptr extracted_filesystem; - for (auto iter = sub_systems.begin(); iter != sub_systems.end(); ++iter) { - auto &cur_filesystem = *iter; - if (cur_filesystem->GetName() == name) { - extracted_filesystem = std::move(cur_filesystem); - sub_systems.erase(iter); - return extracted_filesystem; - } - } - - // Requested subfilesystem is not registered. - return nullptr; + return result; } vector VirtualFileSystem::ListSubSystems() { - vector names(sub_systems.size()); - for (idx_t i = 0; i < sub_systems.size(); i++) { - names[i] = sub_systems[i]->GetName(); + auto registry = file_system_registry.atomic_load(); + auto &sub_systems = registry->sub_systems; + vector names; + for (auto &sub_system : sub_systems) { + names.push_back(sub_system->file_system->GetName()); } return names; } @@ -231,47 +311,34 @@ std::string VirtualFileSystem::GetName() const { return "VirtualFileSystem"; } -void VirtualFileSystem::SetDisabledFileSystems(const vector &names) { - unordered_set new_disabled_file_systems; - for (auto &name : names) { - if (name.empty()) { - continue; - } - if (new_disabled_file_systems.find(name) != new_disabled_file_systems.end()) { - throw InvalidInputException("Duplicate disabled file system \"%s\"", name); - } - new_disabled_file_systems.insert(name); - } - for (auto &disabled_fs : disabled_file_systems) { - if (new_disabled_file_systems.find(disabled_fs) == new_disabled_file_systems.end()) { - throw InvalidInputException("File system \"%s\" has been disabled previously, it cannot be re-enabled", - disabled_fs); - } - } - disabled_file_systems = std::move(new_disabled_file_systems); -} - bool VirtualFileSystem::SubSystemIsDisabled(const string &name) { + auto registry = file_system_registry.atomic_load(); + auto &disabled_file_systems = registry->disabled_file_systems; return disabled_file_systems.find(name) != disabled_file_systems.end(); } bool VirtualFileSystem::IsDisabledForPath(const string &path) { + auto registry = file_system_registry.atomic_load(); + auto &disabled_file_systems = registry->disabled_file_systems; if (disabled_file_systems.empty()) { return false; } - auto fs = FindFileSystemInternal(path); + auto fs = FindFileSystemInternal(*registry, path); if (!fs) { - fs = default_fs.get(); + fs = registry->default_fs->file_system; } return disabled_file_systems.find(fs->GetName()) != disabled_file_systems.end(); } FileSystem &VirtualFileSystem::FindFileSystem(const string &path, optional_ptr opener) { - return FindFileSystem(path, FileOpener::TryGetDatabase(opener)); + auto registry = file_system_registry.atomic_load(); + return FindFileSystem(registry, path, opener); } -FileSystem &VirtualFileSystem::FindFileSystem(const string &path, optional_ptr db_instance) { - auto fs = FindFileSystemInternal(path); +FileSystem &VirtualFileSystem::FindFileSystem(shared_ptr ®istry, const string &path, + optional_ptr opener) { + auto db_instance = FileOpener::TryGetDatabase(opener); + auto fs = FindFileSystemInternal(*registry, path); if (!fs && db_instance) { string required_extension; @@ -282,9 +349,8 @@ FileSystem &VirtualFileSystem::FindFileSystem(const string &path, optional_ptrExtensionIsLoaded(required_extension)) { - auto &dbconfig = DBConfig::GetConfig(*db_instance); if (!ExtensionHelper::CanAutoloadExtension(required_extension) || - !dbconfig.options.autoload_known_extensions) { + !Settings::Get(*db_instance)) { auto error_message = "File " + path + " requires the extension " + required_extension + " to be loaded"; error_message = ExtensionHelper::AddExtensionInstallHintToErrorMsg(*db_instance, error_message, required_extension); @@ -293,48 +359,35 @@ FileSystem &VirtualFileSystem::FindFileSystem(const string &path, optional_ptrdefault_fs->file_system; } + auto &disabled_file_systems = registry->disabled_file_systems; if (!disabled_file_systems.empty() && disabled_file_systems.find(fs->GetName()) != disabled_file_systems.end()) { throw PermissionException("File system %s has been disabled by configuration", fs->GetName()); } return *fs; } -FileSystem &VirtualFileSystem::FindFileSystem(const string &path) { - auto fs = FindFileSystemInternal(path); - if (!fs) { - fs = default_fs; - } - if (!disabled_file_systems.empty() && disabled_file_systems.find(fs->GetName()) != disabled_file_systems.end()) { - throw PermissionException("File system %s has been disabled by configuration", fs->GetName()); - } - return *fs; -} - -optional_ptr VirtualFileSystem::FindFileSystemInternal(const string &path) { - FileSystem *fs = nullptr; - - for (auto &sub_system : sub_systems) { - if (sub_system->CanHandleFile(path)) { - if (sub_system->IsManuallySet()) { - return *sub_system; +optional_ptr VirtualFileSystem::FindFileSystemInternal(FileSystemRegistry ®istry, const string &path) { + optional_ptr fs; + for (auto &sub_system : registry.sub_systems) { + auto &sub_fs = *sub_system->file_system; + if (sub_fs.CanHandleFile(path)) { + if (sub_fs.IsManuallySet()) { + return sub_fs; } - fs = sub_system.get(); + fs = sub_fs; } } - if (fs) { - return *fs; - } - - // We could use default_fs, that's on the caller - return nullptr; + return fs; } } // namespace duckdb diff --git a/src/duckdb/src/execution/expression_executor.cpp b/src/duckdb/src/execution/expression_executor.cpp index 0278df506..ac803eca2 100644 --- a/src/duckdb/src/execution/expression_executor.cpp +++ b/src/duckdb/src/execution/expression_executor.cpp @@ -11,7 +11,7 @@ namespace duckdb { ExpressionExecutor::ExpressionExecutor(ClientContext &context) : context(&context) { - debug_vector_verification = DBConfig::GetSetting(context); + debug_vector_verification = Settings::Get(context); } ExpressionExecutor::ExpressionExecutor(ClientContext &context, const Expression *expression) diff --git a/src/duckdb/src/execution/index/art/art.cpp b/src/duckdb/src/execution/index/art/art.cpp index 800135f0d..3387116e2 100644 --- a/src/duckdb/src/execution/index/art/art.cpp +++ b/src/duckdb/src/execution/index/art/art.cpp @@ -49,7 +49,7 @@ ART::ART(const string &name, const IndexConstraintType index_constraint_type, co const shared_ptr, ALLOCATOR_COUNT>> &allocators_ptr, const IndexStorageInfo &info) : BoundIndex(name, ART::TYPE_NAME, index_constraint_type, column_ids, table_io_manager, unbound_expressions, db), - allocators(allocators_ptr), owns_data(false), verify_max_key_len(false) { + allocators(allocators_ptr), owns_data(false) { // FIXME: Use the new byte representation function to support nested types. for (idx_t i = 0; i < types.size(); i++) { switch (types[i]) { @@ -73,12 +73,6 @@ ART::ART(const string &name, const IndexConstraintType index_constraint_type, co } } - if (types.size() > 1) { - verify_max_key_len = true; - } else if (types[0] == PhysicalType::VARCHAR) { - verify_max_key_len = true; - } - // Initialize the allocators. SetPrefixCount(info); if (!allocators) { @@ -393,25 +387,11 @@ void GenerateKeysInternal(ArenaAllocator &allocator, DataChunk &input, unsafe_ve template <> void ART::GenerateKeys<>(ArenaAllocator &allocator, DataChunk &input, unsafe_vector &keys) { GenerateKeysInternal(allocator, input, keys); - if (!verify_max_key_len) { - return; - } - auto max_len = MAX_KEY_LEN * idx_t(prefix_count); - for (idx_t i = 0; i < input.size(); i++) { - keys[i].VerifyKeyLength(max_len); - } } template <> void ART::GenerateKeys(ArenaAllocator &allocator, DataChunk &input, unsafe_vector &keys) { GenerateKeysInternal(allocator, input, keys); - if (!verify_max_key_len) { - return; - } - auto max_len = MAX_KEY_LEN * idx_t(prefix_count); - for (idx_t i = 0; i < input.size(); i++) { - keys[i].VerifyKeyLength(max_len); - } } void ART::GenerateKeyVectors(ArenaAllocator &allocator, DataChunk &input, Vector &row_ids, unsafe_vector &keys, @@ -705,8 +685,6 @@ bool ART::Scan(IndexScanState &state, const idx_t max_count, set &row_ids D_ASSERT(scan_state.values[0].type().InternalType() == types[0]); ArenaAllocator arena_allocator(Allocator::Get(db)); auto key = ARTKey::CreateKey(arena_allocator, types[0], scan_state.values[0]); - auto max_len = MAX_KEY_LEN * prefix_count; - key.VerifyKeyLength(max_len); lock_guard l(lock); if (scan_state.values[1].IsNull()) { @@ -730,7 +708,6 @@ bool ART::Scan(IndexScanState &state, const idx_t max_count, set &row_ids // Two predicates. D_ASSERT(scan_state.values[1].type().InternalType() == types[0]); auto upper_bound = ARTKey::CreateKey(arena_allocator, types[0], scan_state.values[1]); - upper_bound.VerifyKeyLength(max_len); bool left_equal = scan_state.expressions[0] == ExpressionType ::COMPARE_GREATERTHANOREQUALTO; bool right_equal = scan_state.expressions[1] == ExpressionType ::COMPARE_LESSTHANOREQUALTO; diff --git a/src/duckdb/src/execution/index/art/art_key.cpp b/src/duckdb/src/execution/index/art/art_key.cpp index 7a6df37ce..0d380701f 100644 --- a/src/duckdb/src/execution/index/art/art_key.cpp +++ b/src/duckdb/src/execution/index/art/art_key.cpp @@ -16,13 +16,6 @@ ARTKey::ARTKey(ArenaAllocator &allocator, idx_t len) : len(len) { data = allocator.Allocate(len); } -void ARTKey::VerifyKeyLength(const idx_t max_len) const { - if (len > max_len) { - throw InvalidInputException("key size of %d bytes exceeds the maximum size of %d bytes for this ART", len, - max_len); - } -} - template <> ARTKey ARTKey::CreateARTKey(ArenaAllocator &allocator, string_t value) { auto string_data = const_data_ptr_cast(value.GetData()); diff --git a/src/duckdb/src/execution/index/art/node.cpp b/src/duckdb/src/execution/index/art/node.cpp index fec9c9c70..917504777 100644 --- a/src/duckdb/src/execution/index/art/node.cpp +++ b/src/duckdb/src/execution/index/art/node.cpp @@ -359,32 +359,57 @@ bool Node::IsAnyLeaf() const { // TransformToDeprecated //===--------------------------------------------------------------------===// +template +static void TransformToDeprecatedPushChildren(ART &art, Node &node, NType type, vector> &stack) { + auto ptr = Node::InMemoryRef(art, node, type); + if (ptr) { + NODE::Iterator(*ptr, [&](Node &child) { stack.emplace_back(child); }); + } +} + void Node::TransformToDeprecated(ART &art, Node &node, TransformToDeprecatedState &state) { - D_ASSERT(node.HasMetadata()); + vector> stack; + stack.emplace_back(node); - if (node.GetGateStatus() == GateStatus::GATE_SET) { - D_ASSERT(node.GetType() != NType::LEAF_INLINED); - return Leaf::TransformToDeprecated(art, node); - } + while (!stack.empty()) { + Node ¤t = stack.back().get(); + stack.pop_back(); - auto type = node.GetType(); - switch (type) { - case NType::PREFIX: - return PrefixHandle::TransformToDeprecated(art, node, state); - case NType::LEAF_INLINED: - return; - case NType::LEAF: - return; - case NType::NODE_4: - return TransformToDeprecatedInternal(art, InMemoryRef(art, node, type), state); - case NType::NODE_16: - return TransformToDeprecatedInternal(art, InMemoryRef(art, node, type), state); - case NType::NODE_48: - return TransformToDeprecatedInternal(art, InMemoryRef(art, node, type), state); - case NType::NODE_256: - return TransformToDeprecatedInternal(art, InMemoryRef(art, node, type), state); - default: - throw InternalException("invalid node type for TransformToDeprecated: %d", type); + D_ASSERT(current.HasMetadata()); + + if (current.GetGateStatus() == GateStatus::GATE_SET) { + D_ASSERT(current.GetType() != NType::LEAF_INLINED); + Leaf::TransformToDeprecated(art, current); + continue; + } + + auto type = current.GetType(); + switch (type) { + case NType::PREFIX: { + auto child = PrefixHandle::TransformToDeprecated(art, current, state); + if (child) { + stack.emplace_back(*child); + } + break; + } + case NType::LEAF_INLINED: + case NType::LEAF: + break; + case NType::NODE_4: + TransformToDeprecatedPushChildren(art, current, type, stack); + break; + case NType::NODE_16: + TransformToDeprecatedPushChildren(art, current, type, stack); + break; + case NType::NODE_48: + TransformToDeprecatedPushChildren(art, current, type, stack); + break; + case NType::NODE_256: + TransformToDeprecatedPushChildren(art, current, type, stack); + break; + default: + throw InternalException("invalid node type for TransformToDeprecated: %d", type); + } } } diff --git a/src/duckdb/src/execution/index/art/prefix_handle.cpp b/src/duckdb/src/execution/index/art/prefix_handle.cpp index a8d954988..b52a5690e 100644 --- a/src/duckdb/src/execution/index/art/prefix_handle.cpp +++ b/src/duckdb/src/execution/index/art/prefix_handle.cpp @@ -48,19 +48,19 @@ PrefixHandle PrefixHandle::NewDeprecated(FixedSizeAllocator &allocator, Node &no return handle; } -void PrefixHandle::TransformToDeprecated(ART &art, Node &node, TransformToDeprecatedState &state) { +optional_ptr PrefixHandle::TransformToDeprecated(ART &art, Node &node, TransformToDeprecatedState &state) { // Early-out, if we do not need any transformations. if (!state.HasAllocator()) { reference ref(node); while (ref.get().GetType() == PREFIX && ref.get().GetGateStatus() == GateStatus::GATE_NOT_SET) { auto &alloc = Node::GetAllocator(art, PREFIX); if (!alloc.LoadedFromStorage(ref)) { - return; + return nullptr; } PrefixHandle handle(art, ref); ref = *handle.child; } - return Node::TransformToDeprecated(art, ref, state); + return ref.get(); } // We need to create a new prefix (chain) in the deprecated format. @@ -72,7 +72,7 @@ void PrefixHandle::TransformToDeprecated(ART &art, Node &node, TransformToDeprec while (current_node.GetType() == PREFIX && current_node.GetGateStatus() == GateStatus::GATE_NOT_SET) { auto &alloc = Node::GetAllocator(art, PREFIX); if (!alloc.LoadedFromStorage(current_node)) { - return; + return nullptr; } PrefixHandle current_handle(art, current_node); @@ -87,7 +87,7 @@ void PrefixHandle::TransformToDeprecated(ART &art, Node &node, TransformToDeprec } node = new_node; - return Node::TransformToDeprecated(art, *new_handle.child, state); + return new_handle.child; } PrefixHandle PrefixHandle::TransformToDeprecatedAppend(ART &art, FixedSizeAllocator &allocator, const uint8_t byte) { diff --git a/src/duckdb/src/execution/join_hashtable.cpp b/src/duckdb/src/execution/join_hashtable.cpp index ef2fe68ac..d37ec7c84 100644 --- a/src/duckdb/src/execution/join_hashtable.cpp +++ b/src/duckdb/src/execution/join_hashtable.cpp @@ -109,7 +109,7 @@ JoinHashTable::JoinHashTable(ClientContext &context_p, const PhysicalOperator &o memset(dead_end.get(), 0, layout_ptr->GetRowWidth()); if (join_type == JoinType::SINGLE) { - single_join_error_on_multiple_rows = DBConfig::GetSetting(context); + single_join_error_on_multiple_rows = Settings::Get(context); } if (conditions.size() == 1 && diff --git a/src/duckdb/src/execution/operator/aggregate/physical_window.cpp b/src/duckdb/src/execution/operator/aggregate/physical_window.cpp index 5e23c8cd3..5ec34c03a 100644 --- a/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +++ b/src/duckdb/src/execution/operator/aggregate/physical_window.cpp @@ -298,7 +298,7 @@ WindowGlobalSinkState::WindowGlobalSinkState(const PhysicalWindow &op, ClientCon D_ASSERT(op.select_list[op.order_idx]->GetExpressionClass() == ExpressionClass::BOUND_WINDOW); auto &wexpr = op.select_list[op.order_idx]->Cast(); - const auto mode = DBConfig::GetSetting(client); + const auto mode = Settings::Get(client); for (idx_t expr_idx = 0; expr_idx < op.select_list.size(); ++expr_idx) { D_ASSERT(op.select_list[expr_idx]->GetExpressionClass() == ExpressionClass::BOUND_WINDOW); auto &wexpr = op.select_list[expr_idx]->Cast(); diff --git a/src/duckdb/src/execution/operator/helper/physical_reset.cpp b/src/duckdb/src/execution/operator/helper/physical_reset.cpp index 4402d6e3e..d549d633b 100644 --- a/src/duckdb/src/execution/operator/helper/physical_reset.cpp +++ b/src/duckdb/src/execution/operator/helper/physical_reset.cpp @@ -1,4 +1,5 @@ #include "duckdb/execution/operator/helper/physical_reset.hpp" +#include "duckdb/execution/operator/helper/physical_set.hpp" #include "duckdb/common/string_util.hpp" #include "duckdb/main/database.hpp" @@ -12,10 +13,11 @@ void PhysicalReset::ResetExtensionVariable(ExecutionContext &context, DBConfig & extension_option.set_function(context.client, scope, extension_option.default_value); } if (scope == SetScope::GLOBAL) { - config.ResetOption(name); + config.ResetOption(extension_option); } else { auto &client_config = ClientConfig::GetConfig(context.client); - client_config.set_variables[name.ToStdString()] = extension_option.default_value; + auto setting_index = extension_option.setting_index.GetIndex(); + client_config.user_settings.SetUserSetting(setting_index, extension_option.default_value); } } @@ -29,32 +31,21 @@ SourceResultType PhysicalReset::GetDataInternal(ExecutionContext &context, DataC auto &config = DBConfig::GetConfig(context.client); config.CheckLock(name); auto option = DBConfig::GetOptionByName(name); - if (!option) { // check if this is an extra extension variable - auto entry = config.extension_parameters.find(name.ToStdString()); - if (entry == config.extension_parameters.end()) { + ExtensionOption extension_option; + if (!config.TryGetExtensionOption(name, extension_option)) { auto extension_name = Catalog::AutoloadExtensionByConfigName(context.client, name); - entry = config.extension_parameters.find(name.ToStdString()); - if (entry == config.extension_parameters.end()) { + if (!config.TryGetExtensionOption(name, extension_option)) { throw InvalidInputException("Extension parameter %s was not found after autoloading", name); } } - ResetExtensionVariable(context, config, entry->second); + ResetExtensionVariable(context, config, extension_option); return SourceResultType::FINISHED; } // Transform scope - SetScope variable_scope = scope; - if (variable_scope == SetScope::AUTOMATIC) { - if (option->set_local) { - variable_scope = SetScope::SESSION; - } else if (option->set_global) { - variable_scope = SetScope::GLOBAL; - } else { - variable_scope = option->default_scope; - } - } + SetScope variable_scope = PhysicalSet::GetSettingScope(*option, scope); if (option->default_value) { if (option->set_callback) { @@ -63,11 +54,12 @@ SourceResultType PhysicalReset::GetDataInternal(ExecutionContext &context, DataC Value reset_val = Value(option->default_value).CastAs(context.client, parameter_type); option->set_callback(info, reset_val); } + auto setting_index = option->setting_idx.GetIndex(); if (variable_scope == SetScope::SESSION) { auto &client_config = ClientConfig::GetConfig(context.client); - client_config.set_variables.erase(option->name); + client_config.user_settings.ClearSetting(setting_index); } else { - config.ResetGenericOption(option->name); + config.ResetGenericOption(setting_index); } return SourceResultType::FINISHED; } diff --git a/src/duckdb/src/execution/operator/helper/physical_set.cpp b/src/duckdb/src/execution/operator/helper/physical_set.cpp index 82f505113..c9d65340e 100644 --- a/src/duckdb/src/execution/operator/helper/physical_set.cpp +++ b/src/duckdb/src/execution/operator/helper/physical_set.cpp @@ -6,13 +6,13 @@ namespace duckdb { -void PhysicalSet::SetGenericVariable(ClientContext &context, const String &name, SetScope scope, Value target_value) { +void PhysicalSet::SetGenericVariable(ClientContext &context, idx_t setting_index, SetScope scope, Value target_value) { if (scope == SetScope::GLOBAL) { auto &config = DBConfig::GetConfig(context); - config.SetOption(name, std::move(target_value)); + config.SetOption(setting_index, std::move(target_value)); } else { auto &client_config = ClientConfig::GetConfig(context); - client_config.set_variables[name.ToStdString()] = std::move(target_value); + client_config.user_settings.SetUserSetting(setting_index, std::move(target_value)); } } @@ -26,7 +26,39 @@ void PhysicalSet::SetExtensionVariable(ClientContext &context, ExtensionOption & if (scope == SetScope::AUTOMATIC) { scope = extension_option.default_scope; } - SetGenericVariable(context, name, scope, std::move(target_value)); + auto setting_index = extension_option.setting_index.GetIndex(); + SetGenericVariable(context, setting_index, scope, std::move(target_value)); +} + +SetScope PhysicalSet::GetSettingScope(const ConfigurationOption &option, SetScope variable_scope) { + if (variable_scope == SetScope::AUTOMATIC) { + if (option.set_local) { + return SetScope::SESSION; + } + if (option.set_global) { + return SetScope::GLOBAL; + } + // generic setting + switch (option.scope) { + case SettingScopeTarget::LOCAL_ONLY: + case SettingScopeTarget::LOCAL_DEFAULT: + return SetScope::SESSION; + case SettingScopeTarget::GLOBAL_ONLY: + case SettingScopeTarget::GLOBAL_DEFAULT: + return SetScope::GLOBAL; + default: + throw InvalidInputException("Setting \"%s\" does not have a valid scope defined", option.name); + } + } + if (variable_scope == SetScope::SESSION && option.scope == SettingScopeTarget::GLOBAL_ONLY) { + throw InvalidInputException("Setting \"%s\" cannot be set as a session variable - it can only be set globally", + option.name); + } + if (variable_scope == SetScope::GLOBAL && option.scope == SettingScopeTarget::LOCAL_ONLY) { + throw InvalidInputException( + "Setting \"%s\" cannot be set as a global variable - it can only be set per session", option.name); + } + return variable_scope; } SourceResultType PhysicalSet::GetDataInternal(ExecutionContext &context, DataChunk &chunk, @@ -36,28 +68,18 @@ SourceResultType PhysicalSet::GetDataInternal(ExecutionContext &context, DataChu config.CheckLock(name); auto option = DBConfig::GetOptionByName(name); if (!option) { + ExtensionOption extension_option; // check if this is an extra extension variable - auto entry = config.extension_parameters.find(name.ToStdString()); - if (entry == config.extension_parameters.end()) { + if (!config.TryGetExtensionOption(name, extension_option)) { auto extension_name = Catalog::AutoloadExtensionByConfigName(context.client, name); - entry = config.extension_parameters.find(name.ToStdString()); - if (entry == config.extension_parameters.end()) { + if (!config.TryGetExtensionOption(name, extension_option)) { throw InvalidInputException("Extension parameter %s was not found after autoloading", name); } } - SetExtensionVariable(context.client, entry->second, name, scope, value); + SetExtensionVariable(context.client, extension_option, name, scope, value); return SourceResultType::FINISHED; } - SetScope variable_scope = scope; - if (variable_scope == SetScope::AUTOMATIC) { - if (option->set_local) { - variable_scope = SetScope::SESSION; - } else if (option->set_global) { - variable_scope = SetScope::GLOBAL; - } else { - variable_scope = option->default_scope; - } - } + SetScope variable_scope = GetSettingScope(*option, scope); Value input_val = value.CastAs(context.client, DBConfig::ParseLogicalType(option->parameter_type)); if (option->default_value) { @@ -65,7 +87,8 @@ SourceResultType PhysicalSet::GetDataInternal(ExecutionContext &context, DataChu SettingCallbackInfo info(context.client, variable_scope); option->set_callback(info, input_val); } - SetGenericVariable(context.client, option->name, variable_scope, std::move(input_val)); + auto setting_index = option->setting_idx.GetIndex(); + SetGenericVariable(context.client, setting_index, variable_scope, std::move(input_val)); return SourceResultType::FINISHED; } switch (variable_scope) { diff --git a/src/duckdb/src/execution/operator/helper/physical_transaction.cpp b/src/duckdb/src/execution/operator/helper/physical_transaction.cpp index 8e34f10b7..2e75990ca 100644 --- a/src/duckdb/src/execution/operator/helper/physical_transaction.cpp +++ b/src/duckdb/src/execution/operator/helper/physical_transaction.cpp @@ -32,7 +32,7 @@ SourceResultType PhysicalTransaction::GetDataInternal(ExecutionContext &context, if (info->modifier == TransactionModifierType::TRANSACTION_READ_ONLY) { client.transaction.SetReadOnly(); } - if (DBConfig::GetSetting(context.client)) { + if (Settings::Get(context.client)) { // if immediate transaction mode is enabled then start all transactions immediately auto databases = DatabaseManager::Get(client).GetDatabases(client); for (auto &db : databases) { diff --git a/src/duckdb/src/execution/operator/join/physical_hash_join.cpp b/src/duckdb/src/execution/operator/join/physical_hash_join.cpp index 12ec306b8..e7fb060b1 100644 --- a/src/duckdb/src/execution/operator/join/physical_hash_join.cpp +++ b/src/duckdb/src/execution/operator/join/physical_hash_join.cpp @@ -707,7 +707,7 @@ class HashJoinRepartitionEvent : public BasePipelineEvent { bool JoinFilterPushdownInfo::CanUseInFilter(const ClientContext &context, optional_ptr ht, const ExpressionType &cmp) const { - auto dynamic_or_filter_threshold = DBConfig::GetSetting(context); + auto dynamic_or_filter_threshold = Settings::Get(context); return ht && ht->Count() > 1 && ht->Count() <= dynamic_or_filter_threshold && cmp == ExpressionType::COMPARE_EQUAL; } diff --git a/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp b/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp index a96ea4d6d..f3b91b8dc 100644 --- a/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp +++ b/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp @@ -51,7 +51,7 @@ class CopyToFunctionGlobalState : public GlobalSinkState { explicit CopyToFunctionGlobalState(ClientContext &context_p) : context(context_p), finalized(false), initialized(false), rows_copied(0), last_file_offset(0), file_write_lock_if_rotating(make_uniq()) { - max_open_files = DBConfig::GetSetting(context); + max_open_files = Settings::Get(context); } ~CopyToFunctionGlobalState() override; @@ -275,7 +275,7 @@ class CopyToFunctionLocalState : public LocalSinkState { public: explicit CopyToFunctionLocalState(ClientContext &context, unique_ptr local_state) : local_state(std::move(local_state)) { - partitioned_write_flush_threshold = DBConfig::GetSetting(context); + partitioned_write_flush_threshold = Settings::Get(context); } unique_ptr global_state; unique_ptr local_state; @@ -410,11 +410,6 @@ void CheckDirectory(FileSystem &fs, const string &file_path, CopyOverwriteMode o // with overwrite or ignore we fully ignore the presence of any files instead of erasing them return; } - if (fs.IsRemoteFile(file_path) && overwrite_mode == CopyOverwriteMode::COPY_OVERWRITE) { - // we can only remove files for local file systems currently - // as remote file systems (e.g. S3) do not support RemoveFile - throw NotImplementedException("OVERWRITE is not supported for remote file systems"); - } vector file_list; vector directory_list; directory_list.push_back(file_path); diff --git a/src/duckdb/src/execution/operator/persistent/physical_delete.cpp b/src/duckdb/src/execution/operator/persistent/physical_delete.cpp index 8aefe29c2..4e01e5c84 100644 --- a/src/duckdb/src/execution/operator/persistent/physical_delete.cpp +++ b/src/duckdb/src/execution/operator/persistent/physical_delete.cpp @@ -83,6 +83,7 @@ SinkResultType PhysicalDelete::Sink(ExecutionContext &context, DataChunk &chunk, if (use_input_columns) { // Use columns from the input chunk - they were passed through from the scan + // Only physical columns are passed; generated columns are computed in the RETURNING projection for (idx_t i = 0; i < table.ColumnCount(); i++) { D_ASSERT(return_columns[i] != DConstants::INVALID_INDEX); l_state.delete_chunk.data[i].Reference(chunk.data[return_columns[i]]); @@ -91,7 +92,6 @@ SinkResultType PhysicalDelete::Sink(ExecutionContext &context, DataChunk &chunk, } else { // Fall back to fetching columns by row ID // This path is used when: - // - Table has generated columns (can't be scanned, must be computed) // - Unique indexes exist but no RETURNING (need indexed columns for delete tracking) // - MERGE INTO operations (optimization not implemented there yet) auto &transaction = DuckTransaction::Get(context.client, table.db); diff --git a/src/duckdb/src/execution/operator/scan/physical_table_scan.cpp b/src/duckdb/src/execution/operator/scan/physical_table_scan.cpp index c38036e1b..5ac221ec0 100644 --- a/src/duckdb/src/execution/operator/scan/physical_table_scan.cpp +++ b/src/duckdb/src/execution/operator/scan/physical_table_scan.cpp @@ -30,8 +30,7 @@ PhysicalTableScan::PhysicalTableScan(PhysicalPlan &physical_plan, vector(context); + physical_table_scan_execution_strategy = Settings::Get(context); if (op.dynamic_filters && op.dynamic_filters->HasFilters()) { table_filters = op.dynamic_filters->GetFinalTableFilters(op, op.table_filters.get()); @@ -285,10 +284,26 @@ void AddProjectionNames(const ColumnIndex &index, const string &name, const Logi result += name; return; } - auto &child_types = StructType::GetChildTypes(type); - for (auto &child_index : index.GetChildIndexes()) { - auto &ele = child_types[child_index.GetPrimaryIndex()]; - AddProjectionNames(child_index, name + "." + ele.first, ele.second, result); + + if (type.id() == LogicalTypeId::STRUCT) { + auto &child_types = StructType::GetChildTypes(type); + for (auto &child_index : index.GetChildIndexes()) { + if (child_index.HasPrimaryIndex()) { + auto &ele = child_types[child_index.GetPrimaryIndex()]; + AddProjectionNames(child_index, name + "." + ele.first, ele.second, result); + } else { + auto field_type = child_index.HasType() ? child_index.GetType() : LogicalType::VARIANT(); + AddProjectionNames(child_index, name + "." + child_index.GetFieldName(), field_type, result); + } + } + } else if (type.id() == LogicalTypeId::VARIANT) { + for (auto &child_index : index.GetChildIndexes()) { + D_ASSERT(!child_index.HasPrimaryIndex()); + auto field_type = child_index.HasType() ? child_index.GetType() : LogicalType::VARIANT(); + AddProjectionNames(child_index, name + "." + child_index.GetFieldName(), field_type, result); + } + } else { + throw InternalException("Unexpected type (%s) in AddProjectionNames", type.ToString()); } } diff --git a/src/duckdb/src/execution/physical_plan/plan_aggregate.cpp b/src/duckdb/src/execution/physical_plan/plan_aggregate.cpp index 8bd9837bd..647ffad19 100644 --- a/src/duckdb/src/execution/physical_plan/plan_aggregate.cpp +++ b/src/duckdb/src/execution/physical_plan/plan_aggregate.cpp @@ -217,7 +217,7 @@ static bool CanUsePerfectHashAggregate(ClientContext &context, LogicalAggregate bits_per_group.push_back(required_bits); perfect_hash_bits += required_bits; // check if we have exceeded the bits for the hash - if (perfect_hash_bits > DBConfig::GetSetting(context)) { + if (perfect_hash_bits > Settings::Get(context)) { // too many bits for perfect hash return false; } diff --git a/src/duckdb/src/execution/physical_plan/plan_asof_join.cpp b/src/duckdb/src/execution/physical_plan/plan_asof_join.cpp index 3d84506fa..909921504 100644 --- a/src/duckdb/src/execution/physical_plan/plan_asof_join.cpp +++ b/src/duckdb/src/execution/physical_plan/plan_asof_join.cpp @@ -292,9 +292,9 @@ PhysicalOperator &PhysicalPlanGenerator::PlanAsOfJoin(LogicalComparisonJoin &op) // If there is a non-comparison predicate, we have to use NLJ. const bool has_predicate = op.predicate.get(); - const bool force_asof_join = DBConfig::GetSetting(context); + const bool force_asof_join = Settings::Get(context); if (!force_asof_join || has_predicate) { - const idx_t asof_join_threshold = DBConfig::GetSetting(context); + const idx_t asof_join_threshold = Settings::Get(context); if (has_predicate || (op.children[0]->has_estimated_cardinality && lhs_cardinality < asof_join_threshold)) { auto result = PlanAsOfLoopJoin(op, left, right); if (result) { diff --git a/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp b/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp index aeb77a800..8e8c19ed9 100644 --- a/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +++ b/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp @@ -51,7 +51,7 @@ PhysicalOperator &PhysicalPlanGenerator::PlanComparisonJoin(LogicalComparisonJoi break; } // TODO: Extend PWMJ to handle all comparisons and projection maps - bool prefer_range_joins = DBConfig::GetSetting(context); + bool prefer_range_joins = Settings::Get(context); prefer_range_joins = prefer_range_joins && can_iejoin; if (has_equality && !prefer_range_joins) { // Equality join with small number of keys : possible perfect join optimization @@ -63,7 +63,7 @@ PhysicalOperator &PhysicalPlanGenerator::PlanComparisonJoin(LogicalComparisonJoi } D_ASSERT(op.left_projection_map.empty()); - idx_t nested_loop_join_threshold = DBConfig::GetSetting(context); + idx_t nested_loop_join_threshold = Settings::Get(context); if (left.estimated_cardinality < nested_loop_join_threshold || right.estimated_cardinality < nested_loop_join_threshold) { can_iejoin = false; @@ -71,7 +71,7 @@ PhysicalOperator &PhysicalPlanGenerator::PlanComparisonJoin(LogicalComparisonJoi } if (can_merge && can_iejoin) { - idx_t merge_join_threshold = DBConfig::GetSetting(context); + idx_t merge_join_threshold = Settings::Get(context); if (left.estimated_cardinality < merge_join_threshold || right.estimated_cardinality < merge_join_threshold) { can_iejoin = false; } diff --git a/src/duckdb/src/execution/physical_plan/plan_explain.cpp b/src/duckdb/src/execution/physical_plan/plan_explain.cpp index 2bb227077..e9227b657 100644 --- a/src/duckdb/src/execution/physical_plan/plan_explain.cpp +++ b/src/duckdb/src/execution/physical_plan/plan_explain.cpp @@ -3,8 +3,8 @@ #include "duckdb/execution/operator/helper/physical_explain_analyze.hpp" #include "duckdb/execution/operator/scan/physical_column_data_scan.hpp" #include "duckdb/execution/physical_plan_generator.hpp" -#include "duckdb/main/client_context.hpp" #include "duckdb/planner/operator/logical_explain.hpp" +#include "duckdb/main/settings.hpp" namespace duckdb { @@ -21,7 +21,7 @@ PhysicalOperator &PhysicalPlanGenerator::CreatePlan(LogicalExplain &op) { // Format the plan and set the output of the EXPLAIN. op.physical_plan = plan.ToString(op.explain_format); vector keys, values; - switch (ClientConfig::GetConfig(context).explain_output_type) { + switch (Settings::Get(context)) { case ExplainOutputType::OPTIMIZED_ONLY: keys = {"logical_opt"}; values = {logical_plan_opt}; diff --git a/src/duckdb/src/execution/physical_plan/plan_insert.cpp b/src/duckdb/src/execution/physical_plan/plan_insert.cpp index ab8df5393..bc7eda78c 100644 --- a/src/duckdb/src/execution/physical_plan/plan_insert.cpp +++ b/src/duckdb/src/execution/physical_plan/plan_insert.cpp @@ -44,7 +44,7 @@ bool PhysicalPlanGenerator::PreserveInsertionOrder(ClientContext &context, Physi return false; } // preserve insertion order - check flags - if (!DBConfig::GetSetting(context)) { + if (!Settings::Get(context)) { // preserving insertion order is disabled by config return false; } diff --git a/src/duckdb/src/execution/physical_plan_generator.cpp b/src/duckdb/src/execution/physical_plan_generator.cpp index 30a28ea70..c5d583bec 100644 --- a/src/duckdb/src/execution/physical_plan_generator.cpp +++ b/src/duckdb/src/execution/physical_plan_generator.cpp @@ -57,7 +57,7 @@ unique_ptr PhysicalPlanGenerator::PlanInternal(LogicalOperator &op physical_plan->SetRoot(CreatePlan(op)); physical_plan->Root().estimated_cardinality = op.estimated_cardinality; - auto debug_verify_vector = DBConfig::GetSetting(context); + auto debug_verify_vector = Settings::Get(context); if (debug_verify_vector != DebugVectorVerification::NONE) { if (debug_verify_vector != DebugVectorVerification::DICTIONARY_EXPRESSION && debug_verify_vector != DebugVectorVerification::VARIANT_VECTOR) { diff --git a/src/duckdb/src/function/aggregate/distributive/minmax.cpp b/src/duckdb/src/function/aggregate/distributive/minmax.cpp index ce8f80aea..40c96d412 100644 --- a/src/duckdb/src/function/aggregate/distributive/minmax.cpp +++ b/src/duckdb/src/function/aggregate/distributive/minmax.cpp @@ -335,7 +335,7 @@ unique_ptr BindMinMax(ClientContext &context, AggregateFunction &f vector> &arguments) { if (arguments[0]->return_type.id() == LogicalTypeId::VARCHAR) { auto str_collation = StringType::GetCollation(arguments[0]->return_type); - if (!str_collation.empty() || !DBConfig::GetSetting(context).empty()) { + if (!str_collation.empty() || !Settings::Get(context).empty()) { // If aggr function is min/max and uses collations, replace bound_function with arg_min/arg_max // to make sure the result's correctness. string function_name = function.name == "min" ? "arg_min" : "arg_max"; diff --git a/src/duckdb/src/function/aggregate/sorted_aggregate_function.cpp b/src/duckdb/src/function/aggregate/sorted_aggregate_function.cpp index ea78de81b..9f08f7189 100644 --- a/src/duckdb/src/function/aggregate/sorted_aggregate_function.cpp +++ b/src/duckdb/src/function/aggregate/sorted_aggregate_function.cpp @@ -24,7 +24,7 @@ struct SortedAggregateBindData : public FunctionData { SortedAggregateBindData(ClientContext &context, Expressions &children, AggregateFunction &aggregate, BindInfoPtr &bind_info, OrderBys &order_bys) : context(context), function(aggregate), bind_info(std::move(bind_info)), - threshold(DBConfig::GetSetting(context)) { + threshold(Settings::Get(context)) { // Describe the arguments. for (const auto &child : children) { buffered_cols.emplace_back(buffered_cols.size()); diff --git a/src/duckdb/src/function/cast/cast_function_set.cpp b/src/duckdb/src/function/cast/cast_function_set.cpp index 606fa9010..ae4ac3846 100644 --- a/src/duckdb/src/function/cast/cast_function_set.cpp +++ b/src/duckdb/src/function/cast/cast_function_set.cpp @@ -179,9 +179,9 @@ int64_t CastFunctionSet::ImplicitCastCost(optional_ptr context, c if (score < 0 && source.id() != LogicalTypeId::BLOB && target.id() == LogicalTypeId::VARCHAR) { bool old_implicit_casting = false; if (context) { - old_implicit_casting = DBConfig::GetSetting(*context); + old_implicit_casting = Settings::Get(*context); } else if (config) { - old_implicit_casting = DBConfig::GetSetting(*config); + old_implicit_casting = Settings::Get(*config); } if (old_implicit_casting) { // very high cost to avoid choosing this cast if any other option is available diff --git a/src/duckdb/src/function/cast/variant/from_variant.cpp b/src/duckdb/src/function/cast/variant/from_variant.cpp index a70e65683..65f8acbd4 100644 --- a/src/duckdb/src/function/cast/variant/from_variant.cpp +++ b/src/duckdb/src/function/cast/variant/from_variant.cpp @@ -203,9 +203,18 @@ static bool ConvertVariantToList(FromVariantConversionData &conversion_data, Vec child_data = reinterpret_cast(owned_child_data.get()); } - auto collection_result = - VariantUtils::CollectNestedData(conversion_data.variant, VariantLogicalType::ARRAY, sel, count, row, offset, - child_data, FlatVector::Validity(result)); + //! Initialize the validity with that of the result (in case some rows are already set to invalid, we need to + //! respect that) + auto &result_validity = FlatVector::Validity(result); + ValidityMask validity(count); + for (idx_t i = 0; i < count; i++) { + if (!result_validity.RowIsValid(offset + i)) { + validity.SetInvalid(i); + } + } + + auto collection_result = VariantUtils::CollectNestedData(conversion_data.variant, VariantLogicalType::ARRAY, sel, + count, row, offset, child_data, validity); if (!collection_result.success) { conversion_data.error = StringUtil::Format("Expected to find VARIANT(ARRAY), found VARIANT(%s) instead, can't convert", @@ -216,7 +225,7 @@ static bool ConvertVariantToList(FromVariantConversionData &conversion_data, Vec idx_t max_children = 0; for (idx_t i = 0; i < count; i++) { auto &child_data_entry = child_data[i]; - if (child_data_entry.is_null) { + if (!validity.RowIsValid(i)) { continue; } if (child_data_entry.child_count > max_children) { @@ -239,7 +248,7 @@ static bool ConvertVariantToList(FromVariantConversionData &conversion_data, Vec auto row_index = row.IsValid() ? row.GetIndex() : i; auto &child_data_entry = child_data[i]; - if (child_data_entry.is_null) { + if (!validity.RowIsValid(i)) { FlatVector::SetNull(result, offset + i, true); continue; } @@ -269,9 +278,18 @@ static bool ConvertVariantToArray(FromVariantConversionData &conversion_data, Ve child_data = reinterpret_cast(owned_child_data.get()); } - auto collection_result = - VariantUtils::CollectNestedData(conversion_data.variant, VariantLogicalType::ARRAY, sel, count, row, offset, - child_data, FlatVector::Validity(result)); + //! Initialize the validity with that of the result (in case some rows are already set to invalid, we need to + //! respect that) + auto &result_validity = FlatVector::Validity(result); + ValidityMask validity(count); + for (idx_t i = 0; i < count; i++) { + if (!result_validity.RowIsValid(offset + i)) { + validity.SetInvalid(i); + } + } + + auto collection_result = VariantUtils::CollectNestedData(conversion_data.variant, VariantLogicalType::ARRAY, sel, + count, row, offset, child_data, validity); if (!collection_result.success) { conversion_data.error = StringUtil::Format("Expected to find VARIANT(ARRAY), found VARIANT(%s) instead, can't convert", @@ -282,7 +300,7 @@ static bool ConvertVariantToArray(FromVariantConversionData &conversion_data, Ve const auto array_size = ArrayType::GetSize(result.GetType()); for (idx_t i = 0; i < count; i++) { auto &child_data_entry = child_data[i]; - if (child_data_entry.is_null) { + if (!validity.RowIsValid(i)) { continue; } if (child_data_entry.child_count != array_size) { @@ -302,7 +320,7 @@ static bool ConvertVariantToArray(FromVariantConversionData &conversion_data, Ve auto row_index = row.IsValid() ? row.GetIndex() : i; auto &child_data_entry = child_data[i]; - if (child_data_entry.is_null) { + if (!validity.RowIsValid(i)) { FlatVector::SetNull(result, offset + i, true); total_offset += array_size; continue; @@ -327,9 +345,18 @@ static bool ConvertVariantToStruct(FromVariantConversionData &conversion_data, V child_data = reinterpret_cast(owned_child_data.get()); } - auto collection_result = - VariantUtils::CollectNestedData(conversion_data.variant, VariantLogicalType::OBJECT, sel, count, row, offset, - child_data, FlatVector::Validity(result)); + //! Initialize the validity with that of the result (in case some rows are already set to invalid, we need to + //! respect that) + auto &result_validity = FlatVector::Validity(result); + ValidityMask validity(count); + for (idx_t i = 0; i < count; i++) { + if (!result_validity.RowIsValid(offset + i)) { + validity.SetInvalid(i); + } + } + + auto collection_result = VariantUtils::CollectNestedData(conversion_data.variant, VariantLogicalType::OBJECT, sel, + count, row, offset, child_data, validity); if (!collection_result.success) { conversion_data.error = StringUtil::Format("Expected to find VARIANT(OBJECT), found VARIANT(%s) instead, can't convert", @@ -338,7 +365,7 @@ static bool ConvertVariantToStruct(FromVariantConversionData &conversion_data, V } for (idx_t i = 0; i < count; i++) { - if (child_data[i].is_null) { + if (!validity.RowIsValid(i)) { FlatVector::SetNull(result, offset + i, true); } } @@ -367,7 +394,7 @@ static bool ConvertVariantToStruct(FromVariantConversionData &conversion_data, V component.lookup_mode = VariantChildLookupMode::BY_KEY; ValidityMask lookup_validity(count); VariantUtils::FindChildValues(conversion_data.variant, component, row_sel, child_values_sel, lookup_validity, - child_data, count); + child_data, validity, count); if (!lookup_validity.AllValid()) { optional_idx nested_index; for (idx_t i = 0; i < count; i++) { diff --git a/src/duckdb/src/function/function_list.cpp b/src/duckdb/src/function/function_list.cpp index 4e269f060..4ceb3d555 100644 --- a/src/duckdb/src/function/function_list.cpp +++ b/src/duckdb/src/function/function_list.cpp @@ -110,6 +110,7 @@ static const StaticFunctionDefinition function[] = { DUCKDB_AGGREGATE_FUNCTION_SET(FirstFun), DUCKDB_SCALAR_FUNCTION(GetVariableFun), DUCKDB_SCALAR_FUNCTION(IlikeEscapeFun), + DUCKDB_SCALAR_FUNCTION(InvokeFun), DUCKDB_AGGREGATE_FUNCTION_SET(LastFun), DUCKDB_SCALAR_FUNCTION_ALIAS(LcaseFun), DUCKDB_SCALAR_FUNCTION_SET_ALIAS(LenFun), diff --git a/src/duckdb/src/function/scalar/generic/invoke.cpp b/src/duckdb/src/function/scalar/generic/invoke.cpp new file mode 100644 index 000000000..a611d1406 --- /dev/null +++ b/src/duckdb/src/function/scalar/generic/invoke.cpp @@ -0,0 +1,104 @@ +#include "duckdb/function/scalar/generic_functions.hpp" +#include "duckdb/function/lambda_functions.hpp" +#include "duckdb/common/serializer/serializer.hpp" +#include "duckdb/common/serializer/deserializer.hpp" + +namespace duckdb { + +namespace { + +struct LambdaInvokeData final : public LambdaFunctionData { + unique_ptr lambda_expr; + + explicit LambdaInvokeData(unique_ptr lambda_expr_p) : lambda_expr(std::move(lambda_expr_p)) { + } + + unique_ptr Copy() const override { + auto lambda_expr_copy = lambda_expr ? lambda_expr->Copy() : nullptr; + return make_uniq(std::move(lambda_expr_copy)); + } + + bool Equals(const FunctionData &other_p) const override { + auto &other = other_p.Cast(); + return Expression::Equals(lambda_expr, other.lambda_expr); + } + + //! Serializes a lambda function's bind data + static void Serialize(Serializer &serializer, const optional_ptr bind_data_p, + const ScalarFunction &function) { + auto &bind_data = bind_data_p->Cast(); + serializer.WritePropertyWithDefault(101, "lambda_expr", bind_data.lambda_expr, unique_ptr()); + } + + //! Deserializes a lambda function's bind data + static unique_ptr Deserialize(Deserializer &deserializer, ScalarFunction &) { + auto lambda_expr = deserializer.ReadPropertyWithExplicitDefault>( + 101, "lambda_expr", unique_ptr()); + return make_uniq(std::move(lambda_expr)); + } + + const unique_ptr &GetLambdaExpression() const override { + return lambda_expr->Cast().lambda_expr; + } +}; + +struct LambdaInvokeState final : public FunctionLocalState { + unique_ptr executor; + + explicit LambdaInvokeState(unique_ptr executor_p) : executor(std::move(executor_p)) { + } + + static unique_ptr Init(ExpressionState &state, const BoundFunctionExpression &expr, + FunctionData *bind_data) { + auto &bdata = bind_data->Cast(); + auto &bound_lambda_expr = bdata.lambda_expr->Cast(); + auto executor = make_uniq(state.GetContext(), *bound_lambda_expr.lambda_expr); + return make_uniq(std::move(executor)); + } +}; + +void LambdaInvokeFunction(DataChunk &args, ExpressionState &state, Vector &result) { + auto &lstate = ExecuteFunctionState::GetFunctionState(state)->Cast(); + lstate.executor->ExecuteExpression(args, result); +} + +unique_ptr LambdaInvokeBind(ClientContext &context, ScalarFunction &bound_function, + vector> &arguments) { + // the list column and the bound lambda expression + if (arguments[0]->GetExpressionClass() != ExpressionClass::BOUND_LAMBDA) { + throw BinderException("Invalid lambda expression passed to 'invoke' function."); + } + + auto &bound_lambda_expr = arguments[0]->Cast(); + if (bound_lambda_expr.parameter_count != arguments.size() - 1) { + throw BinderException("The number of lambda parameters does not match the number of arguments passed to the " + "'invoke' function, expected %d, got %d.", + bound_lambda_expr.parameter_count, arguments.size() - 1); + } + + bound_function.SetReturnType(bound_lambda_expr.lambda_expr->return_type); + + return make_uniq(bound_lambda_expr.Copy()); +} + +LogicalType LambdaInvokeBindParameters(ClientContext &context, const vector &function_child_types, + const idx_t parameter_idx) { + // The first parameter is always the lambda + return function_child_types[1 + parameter_idx]; +} + +} // namespace + +ScalarFunction InvokeFun::GetFunction() { + ScalarFunction fun("invoke", {LogicalType::LAMBDA, LogicalType::ANY}, LogicalType::ANY, LambdaInvokeFunction); + fun.bind = LambdaInvokeBind; + fun.varargs = LogicalType::ANY; + fun.SetNullHandling(FunctionNullHandling::SPECIAL_HANDLING); + fun.SetBindLambdaCallback(LambdaInvokeBindParameters); + fun.SetInitStateCallback(LambdaInvokeState::Init); + fun.SetSerializeCallback(LambdaInvokeData::Serialize); + fun.SetDeserializeCallback(LambdaInvokeData::Deserialize); + return fun; +} + +} // namespace duckdb diff --git a/src/duckdb/src/function/scalar/operator/arithmetic.cpp b/src/duckdb/src/function/scalar/operator/arithmetic.cpp index 83224332b..7bc3fd2ac 100644 --- a/src/duckdb/src/function/scalar/operator/arithmetic.cpp +++ b/src/duckdb/src/function/scalar/operator/arithmetic.cpp @@ -1100,7 +1100,7 @@ scalar_function_t GetBinaryFunctionIgnoreZero(PhysicalType type) { template unique_ptr BindBinaryFloatingPoint(ClientContext &context, ScalarFunction &bound_function, vector> &arguments) { - if (DBConfig::GetSetting(context)) { + if (Settings::Get(context)) { bound_function.SetFunctionCallback(GetScalarBinaryFunction(bound_function.GetReturnType().InternalType())); } else { bound_function.SetFunctionCallback( diff --git a/src/duckdb/src/function/scalar/variant/variant_extract.cpp b/src/duckdb/src/function/scalar/variant/variant_extract.cpp index 118175004..bfa43e8e7 100644 --- a/src/duckdb/src/function/scalar/variant/variant_extract.cpp +++ b/src/duckdb/src/function/scalar/variant/variant_extract.cpp @@ -8,42 +8,21 @@ namespace duckdb { -namespace { - -struct BindData : public FunctionData { -public: - explicit BindData(const string &str); - explicit BindData(uint32_t index); - BindData(const BindData &other) = default; - -public: - unique_ptr Copy() const override; - bool Equals(const FunctionData &other) const override; - -public: - VariantPathComponent component; -}; - -} // namespace - -BindData::BindData(const string &str) : FunctionData() { - component.lookup_mode = VariantChildLookupMode::BY_KEY; - component.key = str; +VariantExtractBindData::VariantExtractBindData(const string &str) : FunctionData(), component(str) { } -BindData::BindData(uint32_t index) : FunctionData() { +VariantExtractBindData::VariantExtractBindData(uint32_t index) : FunctionData() { if (index == 0) { throw BinderException("Extracting index 0 from VARIANT(ARRAY) is invalid, indexes are 1-based"); } - component.lookup_mode = VariantChildLookupMode::BY_INDEX; - component.index = index - 1; + component = VariantPathComponent(index - 1); } -unique_ptr BindData::Copy() const { - return make_uniq(*this); +unique_ptr VariantExtractBindData::Copy() const { + return make_uniq(*this); } -bool BindData::Equals(const FunctionData &other) const { - auto &bind_data = other.Cast(); +bool VariantExtractBindData::Equals(const FunctionData &other) const { + auto &bind_data = other.Cast(); if (bind_data.component.lookup_mode != component.lookup_mode) { return false; } @@ -68,62 +47,26 @@ static bool GetConstantArgument(ClientContext &context, Expression &expr, Value return false; } -optional_ptr FindShreddedStats(const BaseStatistics &shredded, - const VariantPathComponent &component) { - D_ASSERT(shredded.GetType().id() == LogicalTypeId::STRUCT); - D_ASSERT(StructType::GetChildTypes(shredded.GetType()).size() == 2); - - auto &typed_value_type = StructType::GetChildTypes(shredded.GetType())[1].second; - auto &typed_value_stats = StructStats::GetChildStats(shredded, 1); - switch (component.lookup_mode) { - case VariantChildLookupMode::BY_INDEX: { - if (typed_value_type.id() != LogicalTypeId::LIST) { - return nullptr; - } - auto &child_stats = ListStats::GetChildStats(typed_value_stats); - return child_stats; - } - case VariantChildLookupMode::BY_KEY: { - if (typed_value_type.id() != LogicalTypeId::STRUCT) { - return nullptr; - } - auto &object_fields = StructType::GetChildTypes(typed_value_type); - for (idx_t i = 0; i < object_fields.size(); i++) { - auto &object_field = object_fields[i]; - if (StringUtil::CIEquals(object_field.first, component.key)) { - return StructStats::GetChildStats(typed_value_stats, i); - } - } - return nullptr; - } - default: - throw InternalException("VariantChildLookupMode::%s not implemented for FindShreddedStats", - EnumUtil::ToString(component.lookup_mode)); - } -} - static unique_ptr VariantExtractPropagateStats(ClientContext &context, FunctionStatisticsInput &input) { auto &child_stats = input.child_stats; auto &bind_data = input.bind_data; - auto &info = bind_data->Cast(); + auto &info = bind_data->Cast(); auto &variant_stats = child_stats[0]; const bool is_shredded = VariantStats::IsShredded(variant_stats); if (!is_shredded) { return nullptr; } auto &shredded_stats = VariantStats::GetShreddedStats(variant_stats); - auto found_stats = FindShreddedStats(shredded_stats, info.component); - if (!found_stats) { + if (!VariantShreddedStats::IsFullyShredded(shredded_stats)) { + return nullptr; + } + auto found_stats = VariantShreddedStats::FindChildStats(shredded_stats, info.component); + if (!found_stats || !VariantShreddedStats::IsFullyShredded(*found_stats)) { return nullptr; } - auto &unshredded_stats = VariantStats::GetUnshreddedStats(variant_stats); - auto child_variant_stats = VariantStats::CreateShredded(found_stats->GetType()); - VariantStats::SetUnshreddedStats(child_variant_stats, unshredded_stats); - VariantStats::SetShreddedStats(child_variant_stats, *found_stats); - - return child_variant_stats.ToUnique(); + return VariantStats::WrapExtractedFieldAsVariant(variant_stats, *found_stats); } static unique_ptr VariantExtractBind(ClientContext &context, ScalarFunction &bound_function, @@ -143,29 +86,16 @@ static unique_ptr VariantExtractBind(ClientContext &context, Scala } if (constant_arg.type().id() == LogicalTypeId::VARCHAR) { - return make_uniq(constant_arg.GetValue()); + return make_uniq(constant_arg.GetValue()); } else if (constant_arg.type().id() == LogicalTypeId::UINTEGER) { - return make_uniq(constant_arg.GetValue()); + return make_uniq(constant_arg.GetValue()); } else { throw InternalException("Constant-folded argument was not of type UINTEGER or VARCHAR"); } } -//! FIXME: it could make sense to allow a third argument: 'default' -//! This can currently be achieved with COALESCE(TRY(), 'default') -static void VariantExtractFunction(DataChunk &input, ExpressionState &state, Vector &result) { - auto count = input.size(); - - D_ASSERT(input.ColumnCount() == 2); - auto &variant_vec = input.data[0]; - D_ASSERT(variant_vec.GetType() == LogicalType::VARIANT()); - - auto &path = input.data[1]; - D_ASSERT(path.GetVectorType() == VectorType::CONSTANT_VECTOR); - (void)path; - - auto &func_expr = state.expr.Cast(); - auto &info = func_expr.bind_info->Cast(); +void VariantUtils::VariantExtract(Vector &variant_vec, const vector &components, Vector &result, + idx_t count) { auto &allocator = Allocator::DefaultAllocator(); RecursiveUnifiedVectorFormat source_format; @@ -176,58 +106,48 @@ static void VariantExtractFunction(DataChunk &input, ExpressionState &state, Vec //! Extract always starts by looking at value_index 0 SelectionVector value_index_sel; value_index_sel.Initialize(count); - for (idx_t i = 0; i < count; i++) { - value_index_sel[i] = 0; - } SelectionVector new_value_index_sel; new_value_index_sel.Initialize(count); + for (idx_t i = 0; i < count; i++) { + value_index_sel[i] = 0; + } + auto owned_nested_data = allocator.Allocate(sizeof(VariantNestedData) * count); auto nested_data = reinterpret_cast(owned_nested_data.get()); - auto &component = info.component; - auto expected_type = component.lookup_mode == VariantChildLookupMode::BY_INDEX ? VariantLogicalType::ARRAY - : VariantLogicalType::OBJECT; - auto collection_result = VariantUtils::CollectNestedData( - variant, expected_type, value_index_sel, count, optional_idx(), 0, nested_data, FlatVector::Validity(result)); - if (!collection_result.success) { - if (expected_type == VariantLogicalType::ARRAY) { - throw InvalidInputException("Can't extract index %d from a VARIANT(%s)", component.index, - EnumUtil::ToString(collection_result.wrong_type)); - } else { - D_ASSERT(expected_type == VariantLogicalType::OBJECT); - throw InvalidInputException("Can't extract key '%s' from a VARIANT(%s)", component.key, - EnumUtil::ToString(collection_result.wrong_type)); - } - } - - //! Look up the value_index of the child we're extracting - ValidityMask lookup_validity(count); - VariantUtils::FindChildValues(variant, component, nullptr, new_value_index_sel, lookup_validity, nested_data, - count); - if (!lookup_validity.AllValid()) { - optional_idx index; - for (idx_t i = 0; i < count; i++) { - if (!lookup_validity.RowIsValid(i)) { - index = i; - break; + //! Perform the extract + ValidityMask validity(count); + for (idx_t i = 0; i < components.size(); i++) { + auto &component = components[i]; + auto &input_indices = i % 2 == 0 ? value_index_sel : new_value_index_sel; + auto &output_indices = i % 2 == 0 ? new_value_index_sel : value_index_sel; + + auto expected_type = component.lookup_mode == VariantChildLookupMode::BY_INDEX ? VariantLogicalType::ARRAY + : VariantLogicalType::OBJECT; + + (void)VariantUtils::CollectNestedData(variant, expected_type, input_indices, count, optional_idx(), 0, + nested_data, validity); + //! Look up the value_index of the child we're extracting + ValidityMask lookup_validity(count); + VariantUtils::FindChildValues(variant, component, nullptr, output_indices, lookup_validity, nested_data, + validity, count); + + for (idx_t j = 0; j < count; j++) { + if (!validity.RowIsValid(j)) { + continue; + } + if (!lookup_validity.AllValid() && !lookup_validity.RowIsValid(j)) { + //! No child could be extracted, set to NULL + validity.SetInvalid(j); + continue; + } + //! Get the index into 'values' + auto type_id = variant.GetTypeId(j, output_indices[j]); + if (type_id == VariantLogicalType::VARIANT_NULL) { + validity.SetInvalid(j); } - } - D_ASSERT(index.IsValid()); - switch (component.lookup_mode) { - case VariantChildLookupMode::BY_INDEX: { - auto nested_index = index.GetIndex(); - throw InvalidInputException("VARIANT(ARRAY(%d)) is missing index %d", nested_data[nested_index].child_count, - component.index); - } - case VariantChildLookupMode::BY_KEY: { - auto nested_index = index.GetIndex(); - auto row_index = nested_index; - auto object_keys = VariantUtils::GetObjectKeys(variant, row_index, nested_data[nested_index]); - throw InvalidInputException("VARIANT(OBJECT(%s)) is missing key '%s'", StringUtil::Join(object_keys, ","), - component.key); - } } } @@ -256,14 +176,16 @@ static void VariantExtractFunction(DataChunk &input, ExpressionState &state, Vec result_values_data[i] = values_data[values.sel->get_index(i)]; } + auto &result_indices = components.size() % 2 == 0 ? value_index_sel : new_value_index_sel; + //! Prepare the selection vector to remap index 0 of each row SelectionVector new_sel(0, values_list_size); for (idx_t i = 0; i < count; i++) { - if (nested_data[i].is_null) { + if (!validity.RowIsValid(i)) { continue; } auto &list_entry = values_data[values.sel->get_index(i)]; - new_sel.set_index(list_entry.offset, list_entry.offset + new_value_index_sel[i]); + new_sel.set_index(list_entry.offset, list_entry.offset + result_indices[i]); } auto &result_type_id = VariantVector::GetValuesTypeId(result); @@ -273,17 +195,42 @@ static void VariantExtractFunction(DataChunk &input, ExpressionState &state, Vec result_byte_offset.Dictionary(VariantVector::GetValuesByteOffset(variant_vec), values_list_size, new_sel, values_list_size); - auto value_is_null = VariantUtils::ValueIsNull(variant, new_value_index_sel, count, optional_idx()); - if (!value_is_null.empty()) { - result.Flatten(count); - for (auto &i : value_is_null) { - FlatVector::SetNull(result, i, true); + if (!validity.AllValid()) { + //! Create a copy of the vector, because we used Reference before, and we now need to adjust the data + //! Which is a problem if we're still sharing the memory with 'input' + Vector other(result.GetType(), count); + VectorOperations::Copy(result, other, count, 0, 0); + result.Reference(other); + + for (idx_t i = 0; i < count; i++) { + if (!validity.RowIsValid(i)) { + FlatVector::SetNull(result, i, true); + } } } - if (input.AllConstant()) { + if (variant_vec.GetVectorType() == VectorType::CONSTANT_VECTOR) { result.SetVectorType(VectorType::CONSTANT_VECTOR); } + result.Verify(count); +} + +//! FIXME: it could make sense to allow a third argument: 'default' +//! This can currently be achieved with COALESCE(TRY(), 'default') +static void VariantExtractFunction(DataChunk &input, ExpressionState &state, Vector &result) { + auto count = input.size(); + + D_ASSERT(input.ColumnCount() == 2); + auto &variant_vec = input.data[0]; + D_ASSERT(variant_vec.GetType() == LogicalType::VARIANT()); + + auto &path = input.data[1]; + D_ASSERT(path.GetVectorType() == VectorType::CONSTANT_VECTOR); + (void)path; + + auto &func_expr = state.expr.Cast(); + auto &info = func_expr.bind_info->Cast(); + VariantUtils::VariantExtract(variant_vec, {info.component}, result, count); } ScalarFunctionSet VariantExtractFun::GetFunctions() { diff --git a/src/duckdb/src/function/scalar/variant/variant_utils.cpp b/src/duckdb/src/function/scalar/variant/variant_utils.cpp index 5160d9381..ec75966bc 100644 --- a/src/duckdb/src/function/scalar/variant/variant_utils.cpp +++ b/src/duckdb/src/function/scalar/variant/variant_utils.cpp @@ -56,7 +56,6 @@ VariantNestedData VariantUtils::DecodeNestedData(const UnifiedVariantVectorData auto ptr = data + byte_offset; VariantNestedData result; - result.is_null = false; result.child_count = VarintDecode(ptr); if (result.child_count) { result.children_idx = VarintDecode(ptr); @@ -78,14 +77,15 @@ vector VariantUtils::GetObjectKeys(const UnifiedVariantVectorData &varia void VariantUtils::FindChildValues(const UnifiedVariantVectorData &variant, const VariantPathComponent &component, optional_ptr sel, SelectionVector &res, - ValidityMask &res_validity, VariantNestedData *nested_data, idx_t count) { + ValidityMask &res_validity, const VariantNestedData *nested_data, + const ValidityMask &validity, idx_t count) { for (idx_t i = 0; i < count; i++) { auto row_index = sel ? sel->get_index(i) : i; - auto &nested_data_entry = nested_data[i]; - if (nested_data_entry.is_null) { + if (!validity.RowIsValid(i)) { continue; } + auto &nested_data_entry = nested_data[i]; if (component.lookup_mode == VariantChildLookupMode::BY_INDEX) { auto child_idx = component.index; if (child_idx >= nested_data_entry.child_count) { @@ -139,26 +139,41 @@ vector VariantUtils::ValueIsNull(const UnifiedVariantVectorData &varia VariantNestedDataCollectionResult VariantUtils::CollectNestedData(const UnifiedVariantVectorData &variant, VariantLogicalType expected_type, - const SelectionVector &sel, idx_t count, optional_idx row, idx_t offset, + const SelectionVector &value_index_sel, idx_t count, optional_idx row, idx_t offset, VariantNestedData *child_data, ValidityMask &validity) { + VariantLogicalType wrong_type = VariantLogicalType::VARIANT_NULL; for (idx_t i = 0; i < count; i++) { auto row_index = row.IsValid() ? row.GetIndex() : i; //! NOTE: the validity is assumed to be from a FlatVector - if (!variant.RowIsValid(row_index) || !validity.RowIsValid(offset + i)) { - child_data[i].is_null = true; + //! Is the input row NULL ? + if (!variant.RowIsValid(row_index) || !validity.RowIsValid(i)) { + validity.SetInvalid(i); continue; } - auto type_id = variant.GetTypeId(row_index, sel[i]); + + //! Is the variant value NULL ? + auto type_id = variant.GetTypeId(row_index, value_index_sel[i]); if (type_id == VariantLogicalType::VARIANT_NULL) { - child_data[i].is_null = true; + validity.SetInvalid(i); continue; } + //! Is the type of the VARIANT correct? if (type_id != expected_type) { - return VariantNestedDataCollectionResult(type_id); + if (wrong_type == VariantLogicalType::VARIANT_NULL) { + //! Record the type of the first row that doesn't have the expected type + wrong_type = type_id; + } + validity.SetInvalid(i); + continue; } - child_data[i] = DecodeNestedData(variant, row_index, sel[i]); + + child_data[i] = DecodeNestedData(variant, row_index, value_index_sel[i]); + } + + if (wrong_type != VariantLogicalType::VARIANT_NULL) { + return VariantNestedDataCollectionResult(wrong_type); } return VariantNestedDataCollectionResult(); } diff --git a/src/duckdb/src/function/table/system/duckdb_secrets.cpp b/src/duckdb/src/function/table/system/duckdb_secrets.cpp index ae7f3104a..29365b3e9 100644 --- a/src/duckdb/src/function/table/system/duckdb_secrets.cpp +++ b/src/duckdb/src/function/table/system/duckdb_secrets.cpp @@ -1,12 +1,8 @@ #include "duckdb/function/table/system_functions.hpp" -#include "duckdb/common/file_system.hpp" -#include "duckdb/common/map.hpp" -#include "duckdb/common/string_util.hpp" #include "duckdb/function/function_set.hpp" #include "duckdb/main/client_context.hpp" -#include "duckdb/main/database.hpp" -#include "duckdb/main/extension_helper.hpp" +#include "duckdb/main/settings.hpp" #include "duckdb/main/secret/secret_manager.hpp" namespace duckdb { @@ -47,8 +43,7 @@ static unique_ptr DuckDBSecretsBind(ClientContext &context, TableF } } - if (!DBConfig::GetConfig(context).options.allow_unredacted_secrets && - result->redact == SecretDisplayType::UNREDACTED) { + if (!Settings::Get(context) && result->redact == SecretDisplayType::UNREDACTED) { throw InvalidInputException("Displaying unredacted secrets is disabled"); } diff --git a/src/duckdb/src/function/table/system/duckdb_settings.cpp b/src/duckdb/src/function/table/system/duckdb_settings.cpp index 9908854bd..75da7b495 100644 --- a/src/duckdb/src/function/table/system/duckdb_settings.cpp +++ b/src/duckdb/src/function/table/system/duckdb_settings.cpp @@ -91,7 +91,7 @@ unique_ptr DuckDBSettingsInit(ClientContext &context, } result->settings.push_back(std::move(value)); } - for (auto &ext_param : config.extension_parameters) { + for (auto &ext_param : config.GetExtensionSettings()) { Value setting_val; auto scope = SettingScope::GLOBAL; auto lookup_result = context.TryGetCurrentSetting(ext_param.first, setting_val); diff --git a/src/duckdb/src/function/table/system/enable_profiling.cpp b/src/duckdb/src/function/table/system/enable_profiling.cpp index a7a8cdac2..2aec20fde 100644 --- a/src/duckdb/src/function/table/system/enable_profiling.cpp +++ b/src/duckdb/src/function/table/system/enable_profiling.cpp @@ -64,8 +64,6 @@ static unique_ptr BindEnableProfiling(ClientContext &context, Tabl auto bind_data = make_uniq(); - auto config = ClientConfig::GetConfig(context); - bool metrics_set = false; for (const auto &named_param : input.named_parameters) { @@ -78,7 +76,7 @@ static unique_ptr BindEnableProfiling(ClientContext &context, Tabl bind_data->coverage = StringUtil::Lower(named_param.second.ToString()); break; case ProfilingParameterNames::SAVE_LOCATION: - bind_data->save_location = StringUtil::Lower(named_param.second.ToString()); + bind_data->save_location = named_param.second.ToString(); break; case ProfilingParameterNames::MODE: bind_data->mode = StringUtil::Lower(named_param.second.ToString()); diff --git a/src/duckdb/src/function/table/table_scan.cpp b/src/duckdb/src/function/table/table_scan.cpp index 7e0999dea..ca1173402 100644 --- a/src/duckdb/src/function/table/table_scan.cpp +++ b/src/duckdb/src/function/table/table_scan.cpp @@ -676,8 +676,8 @@ unique_ptr TableScanInitGlobal(ClientContext &context, return DuckTableScanInitGlobal(context, input, storage, bind_data); } - auto scan_percentage = DBConfig::GetSetting(context); - auto scan_max_count = DBConfig::GetSetting(context); + auto scan_percentage = Settings::Get(context); + auto scan_max_count = Settings::Get(context); auto total_rows = storage.GetTotalRows(); auto total_rows_from_percentage = LossyNumericCast(double(total_rows) * scan_percentage); @@ -823,7 +823,7 @@ static bool TableSupportsPushdownExtract(const FunctionData &bind_data_ref, cons return false; } auto column_type = column.GetType(); - if (column_type.id() != LogicalTypeId::STRUCT) { + if (column_type.id() != LogicalTypeId::STRUCT && column_type.id() != LogicalTypeId::VARIANT) { return false; } return true; diff --git a/src/duckdb/src/function/table/version/pragma_version.cpp b/src/duckdb/src/function/table/version/pragma_version.cpp index 6aaa51872..86605bb64 100644 --- a/src/duckdb/src/function/table/version/pragma_version.cpp +++ b/src/duckdb/src/function/table/version/pragma_version.cpp @@ -1,5 +1,5 @@ #ifndef DUCKDB_PATCH_VERSION -#define DUCKDB_PATCH_VERSION "0-dev5476" +#define DUCKDB_PATCH_VERSION "0-dev5756" #endif #ifndef DUCKDB_MINOR_VERSION #define DUCKDB_MINOR_VERSION 5 @@ -8,10 +8,10 @@ #define DUCKDB_MAJOR_VERSION 1 #endif #ifndef DUCKDB_VERSION -#define DUCKDB_VERSION "v1.5.0-dev5476" +#define DUCKDB_VERSION "v1.5.0-dev5756" #endif #ifndef DUCKDB_SOURCE_ID -#define DUCKDB_SOURCE_ID "1c62e11b82" +#define DUCKDB_SOURCE_ID "9612b5bea5" #endif #include "duckdb/function/table/system_functions.hpp" #include "duckdb/main/database.hpp" diff --git a/src/duckdb/src/function/variant/variant_shredding.cpp b/src/duckdb/src/function/variant/variant_shredding.cpp index ee69da0e9..416618d39 100644 --- a/src/duckdb/src/function/variant/variant_shredding.cpp +++ b/src/duckdb/src/function/variant/variant_shredding.cpp @@ -198,8 +198,9 @@ void VariantShredding::WriteTypedObjectValues(UnifiedVariantVectorData &variant, path_component.key = key; ValidityMask lookup_validity(count); + ValidityMask all_valid_validity(count); VariantUtils::FindChildValues(variant, path_component, sel, child_values_indexes, lookup_validity, - nested_data.get(), count); + nested_data.get(), all_valid_validity, count); if (!lookup_validity.AllValid()) { auto &child_variant_vectors = StructVector::GetEntries(child_vec); diff --git a/src/duckdb/src/include/duckdb.h b/src/duckdb/src/include/duckdb.h index 30e240159..e8aaa62ba 100644 --- a/src/duckdb/src/include/duckdb.h +++ b/src/duckdb/src/include/duckdb.h @@ -903,7 +903,7 @@ struct duckdb_extension_access { //! Indicate that an error has occurred. void (*set_error)(duckdb_extension_info info, const char *error); //! Fetch the database on which to register the extension. - duckdb_database (*get_database)(duckdb_extension_info info); + duckdb_database *(*get_database)(duckdb_extension_info info); //! Fetch the API struct pointer. const void *(*get_api)(duckdb_extension_info info, const char *version); }; diff --git a/src/duckdb/src/include/duckdb/catalog/catalog.hpp b/src/duckdb/src/include/duckdb/catalog/catalog.hpp index 9817f6c03..58513a186 100644 --- a/src/duckdb/src/include/duckdb/catalog/catalog.hpp +++ b/src/duckdb/src/include/duckdb/catalog/catalog.hpp @@ -328,6 +328,7 @@ class Catalog { virtual string GetEncryptionCipher() const { return string(); } + virtual ErrorData SupportsCreateTable(BoundCreateTableInfo &info); //! Whether or not this catalog should search a specific type with the standard priority DUCKDB_API virtual CatalogLookupBehavior CatalogTypeLookupRule(CatalogType type) const { diff --git a/src/duckdb/src/include/duckdb/common/column_index.hpp b/src/duckdb/src/include/duckdb/common/column_index.hpp index d1c3c672d..ea5607833 100644 --- a/src/duckdb/src/include/duckdb/common/column_index.hpp +++ b/src/duckdb/src/include/duckdb/common/column_index.hpp @@ -25,19 +25,37 @@ enum class ColumnIndexType : uint8_t { struct ColumnIndex { public: //! FIXME: this initializes the index to COLUMN_IDENTIFIER_ROW_ID (same numeric representation as INVALID_INDEX) - ColumnIndex() : index(DConstants::INVALID_INDEX), index_type(ColumnIndexType::INVALID) { + ColumnIndex() : has_index(true), index(DConstants::INVALID_INDEX), index_type(ColumnIndexType::FULL_READ) { } explicit ColumnIndex(idx_t index) - : index(index), type(LogicalType::INVALID), index_type(ColumnIndexType::FULL_READ) { + : has_index(true), index(index), type(LogicalType::INVALID), index_type(ColumnIndexType::FULL_READ) { } + explicit ColumnIndex(const string &field) + : has_index(false), field(field), type(LogicalType::INVALID), index_type(ColumnIndexType::FULL_READ) { + } + ColumnIndex(idx_t index, vector child_indexes_p) - : index(index), index_type(ColumnIndexType::FULL_READ), child_indexes(std::move(child_indexes_p)) { + : has_index(true), index(index), index_type(ColumnIndexType::FULL_READ), + child_indexes(std::move(child_indexes_p)) { + } + ColumnIndex(const string &field, vector child_indexes_p) + : has_index(false), field(field), index_type(ColumnIndexType::FULL_READ), + child_indexes(std::move(child_indexes_p)) { } inline bool operator==(const ColumnIndex &rhs) const { - if (index != rhs.index) { + if (has_index != rhs.has_index) { return false; } + if (has_index) { + if (index != rhs.index) { + return false; + } + } else { + if (field != rhs.field) { + return false; + } + } if (type != rhs.type) { return false; } @@ -66,11 +84,27 @@ struct ColumnIndex { } public: + bool HasPrimaryIndex() const { + return has_index; + } idx_t GetPrimaryIndex() const { + if (!has_index) { + throw InternalException("Attempted to get the primary index (numeric) for an index that consists of a " + "field identifier (string: %s)", + field); + } return index; } + const string &GetFieldName() const { + if (has_index) { + throw InternalException("Attempted to get the field identifier (string) for an index that consists of a " + "primary index (numeric: %d)", + index); + } + return field; + } LogicalIndex ToLogical() const { - return LogicalIndex(index); + return LogicalIndex(GetPrimaryIndex()); } bool HasChildren() const { return !child_indexes.empty(); @@ -100,23 +134,38 @@ struct ColumnIndex { void SetType(const LogicalType &type_information) { type = type_information; } - void SetPushdownExtractType(const LogicalType &type_information, optional_ptr cast_type = nullptr) { + void SetPushdownExtractType(const LogicalType &type_information, + optional_ptr cast_type = nullptr) { //! We can upgrade the optional prune hint to a PUSHDOWN_EXTRACT, which is no longer optional index_type = ColumnIndexType::PUSHDOWN_EXTRACT; type = type_information; D_ASSERT(child_indexes.size() == 1); auto &child = child_indexes[0]; - auto &child_types = StructType::GetChildTypes(type); - auto &child_type = child_types[child.GetPrimaryIndex()].second; - if (child.child_indexes.empty()) { - if (cast_type) { - child.SetType(*cast_type); + if (child.HasPrimaryIndex()) { + auto &child_types = StructType::GetChildTypes(type); + auto &child_type = child_types[child.GetPrimaryIndex()].second; + if (child.child_indexes.empty()) { + if (cast_type) { + child.SetType(*cast_type); + } else { + child.SetType(child_type); + } } else { - child.SetType(child_type); + child.SetPushdownExtractType(child_type, cast_type); } } else { - child.SetPushdownExtractType(child_type, cast_type); + D_ASSERT(type_information.id() == LogicalTypeId::VARIANT); + if (child.child_indexes.empty()) { + if (cast_type) { + child.SetType(*cast_type); + } else { + //! Without a cast, the child will always be VARIANT + child.SetType(type_information); + } + } else { + child.SetPushdownExtractType(type_information, cast_type); + } } } const LogicalType &GetScanType() const { @@ -134,12 +183,21 @@ struct ColumnIndex { this->child_indexes.push_back(std::move(new_index)); } bool IsRowIdColumn() const { + if (!has_index) { + return false; + } return index == COLUMN_IDENTIFIER_ROW_ID; } bool IsEmptyColumn() const { + if (!has_index) { + return false; + } return index == COLUMN_IDENTIFIER_EMPTY; } bool IsVirtualColumn() const { + if (!has_index) { + return false; + } return index >= VIRTUAL_COLUMN_START; } void VerifySinglePath() const { @@ -160,8 +218,20 @@ struct ColumnIndex { reference b(path); while (true) { - if (a.get().GetPrimaryIndex() != b.get().GetPrimaryIndex()) { - return false; + if (a.get().HasPrimaryIndex()) { + if (!b.get().HasPrimaryIndex()) { + return false; + } + if (a.get().GetPrimaryIndex() != b.get().GetPrimaryIndex()) { + return false; + } + } else { + if (b.get().HasPrimaryIndex()) { + return false; + } + if (a.get().GetFieldName() != b.get().GetFieldName()) { + return false; + } } const bool a_has_children = a.get().HasChildren(); const bool b_has_children = b.get().HasChildren(); @@ -187,7 +257,12 @@ struct ColumnIndex { static ColumnIndex Deserialize(Deserializer &deserializer); private: + //! The column/field index (if structured type) + bool has_index = true; idx_t index; + //! The column/field name (if semi-structured type) + string field; + //! The logical type of the column this references (if pushdown extract) LogicalType type = LogicalType::INVALID; //! The type of index, controlling how it's interpreted diff --git a/src/duckdb/src/include/duckdb/common/column_index_map.hpp b/src/duckdb/src/include/duckdb/common/column_index_map.hpp index 713351c8b..7c9e0a8eb 100644 --- a/src/duckdb/src/include/duckdb/common/column_index_map.hpp +++ b/src/duckdb/src/include/duckdb/common/column_index_map.hpp @@ -9,7 +9,8 @@ namespace duckdb { struct ColumnIndexHashFunction { uint64_t operator()(const ColumnIndex &index) const { - auto hasher = std::hash(); + auto index_hasher = std::hash(); + auto field_hasher = std::hash(); queue> to_hash; hash_t result = 0; @@ -20,7 +21,12 @@ struct ColumnIndexHashFunction { for (auto &child : children) { to_hash.push(child); } - result ^= hasher(current.get().GetPrimaryIndex()); + + if (current.get().HasPrimaryIndex()) { + result ^= index_hasher(current.get().GetPrimaryIndex()); + } else { + result ^= field_hasher(current.get().GetFieldName()); + } to_hash.pop(); } return result; diff --git a/src/duckdb/src/include/duckdb/common/encryption_state.hpp b/src/duckdb/src/include/duckdb/common/encryption_state.hpp index 4aece4a2f..6503e83c8 100644 --- a/src/duckdb/src/include/duckdb/common/encryption_state.hpp +++ b/src/duckdb/src/include/duckdb/common/encryption_state.hpp @@ -18,11 +18,13 @@ class EncryptionTypes { enum CipherType : uint8_t { INVALID = 0, GCM = 1, CTR = 2, CBC = 3 }; enum KeyDerivationFunction : uint8_t { DEFAULT = 0, SHA256 = 1, PBKDF2 = 2 }; enum Mode { ENCRYPT, DECRYPT }; + enum EncryptionVersion : uint8_t { V0_0 = 0, V0_1 = 1, NONE = 127 }; static string CipherToString(CipherType cipher_p); static CipherType StringToCipher(const string &encryption_cipher_p); static string KDFToString(KeyDerivationFunction kdf_p); static KeyDerivationFunction StringToKDF(const string &key_derivation_function_p); + static EncryptionVersion StringToVersion(const string &encryption_version_p); }; class EncryptionState { diff --git a/src/duckdb/src/include/duckdb/common/enum_util.hpp b/src/duckdb/src/include/duckdb/common/enum_util.hpp index d1b35028c..76c318975 100644 --- a/src/duckdb/src/include/duckdb/common/enum_util.hpp +++ b/src/duckdb/src/include/duckdb/common/enum_util.hpp @@ -50,6 +50,8 @@ enum class AggregateOrderDependent : uint8_t; enum class AggregateType : uint8_t; +enum class AllowParserOverride : uint8_t; + enum class AlterDatabaseType : uint8_t; enum class AlterForeignKeyType : uint8_t; @@ -190,6 +192,8 @@ enum class ExtensionUpdateResultTag : uint8_t; enum class ExtraDropInfoType : uint8_t; +enum class ExtraPersistentColumnDataType : uint8_t; + enum class ExtraTypeInfoType : uint8_t; enum class FileBufferType : uint8_t; @@ -516,6 +520,9 @@ const char* EnumUtil::ToChars(AggregateOrderDependent v template<> const char* EnumUtil::ToChars(AggregateType value); +template<> +const char* EnumUtil::ToChars(AllowParserOverride value); + template<> const char* EnumUtil::ToChars(AlterDatabaseType value); @@ -726,6 +733,9 @@ const char* EnumUtil::ToChars(ExtensionUpdateResultTag template<> const char* EnumUtil::ToChars(ExtraDropInfoType value); +template<> +const char* EnumUtil::ToChars(ExtraPersistentColumnDataType value); + template<> const char* EnumUtil::ToChars(ExtraTypeInfoType value); @@ -1201,6 +1211,9 @@ AggregateOrderDependent EnumUtil::FromString(const char template<> AggregateType EnumUtil::FromString(const char *value); +template<> +AllowParserOverride EnumUtil::FromString(const char *value); + template<> AlterDatabaseType EnumUtil::FromString(const char *value); @@ -1411,6 +1424,9 @@ ExtensionUpdateResultTag EnumUtil::FromString(const ch template<> ExtraDropInfoType EnumUtil::FromString(const char *value); +template<> +ExtraPersistentColumnDataType EnumUtil::FromString(const char *value); + template<> ExtraTypeInfoType EnumUtil::FromString(const char *value); diff --git a/src/duckdb/src/include/duckdb/common/enums/allow_parser_override.hpp b/src/duckdb/src/include/duckdb/common/enums/allow_parser_override.hpp new file mode 100644 index 000000000..f342cf224 --- /dev/null +++ b/src/duckdb/src/include/duckdb/common/enums/allow_parser_override.hpp @@ -0,0 +1,22 @@ +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/common/enums/allow_parser_override.hpp +// +// +//===----------------------------------------------------------------------===// + +#pragma once + +#include "duckdb/common/constants.hpp" + +namespace duckdb { + +enum class AllowParserOverride : uint8_t { + DEFAULT_OVERRIDE, + FALLBACK_OVERRIDE, + STRICT_OVERRIDE, + STRICT_WHEN_SUPPORTED +}; + +} // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/common/enums/compression_type.hpp b/src/duckdb/src/include/duckdb/common/enums/compression_type.hpp index 5198f7627..988667145 100644 --- a/src/duckdb/src/include/duckdb/common/enums/compression_type.hpp +++ b/src/duckdb/src/include/duckdb/common/enums/compression_type.hpp @@ -79,7 +79,6 @@ struct CompressionAvailabilityResult { CompressionAvailabilityResult CompressionTypeIsAvailable(CompressionType compression_type, optional_ptr storage_manager = nullptr); vector ListCompressionTypes(void); -CompressionType CompressionTypeFromString(const string &str); string CompressionTypeToString(CompressionType type); } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/common/enums/expression_type.hpp b/src/duckdb/src/include/duckdb/common/enums/expression_type.hpp index 36153967b..0a5728aa6 100644 --- a/src/duckdb/src/include/duckdb/common/enums/expression_type.hpp +++ b/src/duckdb/src/include/duckdb/common/enums/expression_type.hpp @@ -208,13 +208,6 @@ enum class ExpressionClass : uint8_t { BOUND_EXPANDED = 51 }; -// Hash function for expression type. -struct ExpressionTypeHash { - uint32_t operator()(ExpressionType type) const { - return static_cast(type); - } -}; - DUCKDB_API string ExpressionTypeToString(ExpressionType type); string ExpressionTypeToOperator(ExpressionType type); diff --git a/src/duckdb/src/include/duckdb/common/enums/lambda_syntax.hpp b/src/duckdb/src/include/duckdb/common/enums/lambda_syntax.hpp new file mode 100644 index 000000000..c729b953e --- /dev/null +++ b/src/duckdb/src/include/duckdb/common/enums/lambda_syntax.hpp @@ -0,0 +1,17 @@ +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/common/enums/lambda_syntax.hpp +// +// +//===----------------------------------------------------------------------===// + +#pragma once + +#include "duckdb/common/constants.hpp" + +namespace duckdb { + +enum class LambdaSyntax : uint8_t { DEFAULT = 0, ENABLE_SINGLE_ARROW = 1, DISABLE_SINGLE_ARROW = 2 }; + +} // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/common/file_system.hpp b/src/duckdb/src/include/duckdb/common/file_system.hpp index 825f22d17..d723340b2 100644 --- a/src/duckdb/src/include/duckdb/common/file_system.hpp +++ b/src/duckdb/src/include/duckdb/common/file_system.hpp @@ -258,9 +258,6 @@ class FileSystem { DUCKDB_API virtual void RegisterSubSystem(unique_ptr sub_fs); DUCKDB_API virtual void RegisterSubSystem(FileCompressionType compression_type, unique_ptr fs); - //! Unregister a sub-filesystem by name - DUCKDB_API virtual void UnregisterSubSystem(const string &name); - // !Extract a sub-filesystem by name, with ownership transfered, return nullptr if not registered or the subsystem // has been disabled. DUCKDB_API virtual unique_ptr ExtractSubSystem(const string &name); diff --git a/src/duckdb/src/include/duckdb/common/http_util.hpp b/src/duckdb/src/include/duckdb/common/http_util.hpp index a493647b3..e0666dc26 100644 --- a/src/duckdb/src/include/duckdb/common/http_util.hpp +++ b/src/duckdb/src/include/duckdb/common/http_util.hpp @@ -219,6 +219,8 @@ struct PostRequestInfo : public BaseRequest { const_data_ptr_t buffer_in; idx_t buffer_in_len; string buffer_out; + //! Used to send a GET request with a body (non-standard but supported by some servers) + bool send_post_as_get_request = false; }; class HTTPClient { diff --git a/src/duckdb/src/include/duckdb/common/opener_file_system.hpp b/src/duckdb/src/include/duckdb/common/opener_file_system.hpp index 265de2aff..8197b06af 100644 --- a/src/duckdb/src/include/duckdb/common/opener_file_system.hpp +++ b/src/duckdb/src/include/duckdb/common/opener_file_system.hpp @@ -146,10 +146,6 @@ class OpenerFileSystem : public FileSystem { GetFileSystem().RegisterSubSystem(compression_type, std::move(fs)); } - void UnregisterSubSystem(const string &name) override { - GetFileSystem().UnregisterSubSystem(name); - } - void SetDisabledFileSystems(const vector &names) override { GetFileSystem().SetDisabledFileSystems(names); } diff --git a/src/duckdb/src/include/duckdb/common/row_operations/row_operations.hpp b/src/duckdb/src/include/duckdb/common/row_operations/row_operations.hpp index ee1d11afb..382b60dd2 100644 --- a/src/duckdb/src/include/duckdb/common/row_operations/row_operations.hpp +++ b/src/duckdb/src/include/duckdb/common/row_operations/row_operations.hpp @@ -18,9 +18,7 @@ class ArenaAllocator; struct AggregateObject; struct AggregateFilterData; class DataChunk; -class RowLayout; class TupleDataLayout; -class RowDataCollection; struct SelectionVector; class StringHeap; struct UnifiedVectorFormat; diff --git a/src/duckdb/src/include/duckdb/common/shared_ptr_ipp.hpp b/src/duckdb/src/include/duckdb/common/shared_ptr_ipp.hpp index 8668bbb4c..6b6d8dcc9 100644 --- a/src/duckdb/src/include/duckdb/common/shared_ptr_ipp.hpp +++ b/src/duckdb/src/include/duckdb/common/shared_ptr_ipp.hpp @@ -250,6 +250,18 @@ class shared_ptr { // NOLINT: invalid case style return internal >= other.internal; } + shared_ptr atomic_load() const { + return shared_ptr(std::atomic_load(&internal)); + } + + shared_ptr atomic_load(std::memory_order order) const { + return shared_ptr(std::atomic_load_explicit(&internal, order)); + } + + void atomic_store(const shared_ptr &new_ptr) { + std::atomic_store(&internal, new_ptr.internal); + } + private: // This overload is used when the class inherits from 'enable_shared_from_this' template static string ToString(const vector &input, const string &separator) { diff --git a/src/duckdb/src/include/duckdb/common/types/geometry.hpp b/src/duckdb/src/include/duckdb/common/types/geometry.hpp index 1fcc9d7a1..65fff18d6 100644 --- a/src/duckdb/src/include/duckdb/common/types/geometry.hpp +++ b/src/duckdb/src/include/duckdb/common/types/geometry.hpp @@ -35,6 +35,7 @@ struct VertexXY { static constexpr auto TYPE = VertexType::XY; static constexpr auto HAS_Z = false; static constexpr auto HAS_M = false; + static constexpr auto WIDTH = 2; double x; double y; @@ -48,6 +49,7 @@ struct VertexXYZ { static constexpr auto TYPE = VertexType::XYZ; static constexpr auto HAS_Z = true; static constexpr auto HAS_M = false; + static constexpr auto WIDTH = 3; double x; double y; @@ -61,6 +63,7 @@ struct VertexXYM { static constexpr auto TYPE = VertexType::XYM; static constexpr auto HAS_M = true; static constexpr auto HAS_Z = false; + static constexpr auto WIDTH = 3; double x; double y; @@ -75,6 +78,7 @@ struct VertexXYZM { static constexpr auto TYPE = VertexType::XYZM; static constexpr auto HAS_Z = true; static constexpr auto HAS_M = true; + static constexpr auto WIDTH = 4; double x; double y; @@ -219,6 +223,17 @@ class Geometry { //! Update the bounding box, return number of vertices processed DUCKDB_API static uint32_t GetExtent(const string_t &wkb, GeometryExtent &extent); + DUCKDB_API static uint32_t GetExtent(const string_t &wkb, GeometryExtent &extent, bool &has_any_empty); + + //! Convert to vectorized format + DUCKDB_API static void ToVectorizedFormat(Vector &source, Vector &target, idx_t count, GeometryType geom_type, + VertexType vert_type); + //! Convert from vectorized format + DUCKDB_API static void FromVectorizedFormat(Vector &source, Vector &target, idx_t count, GeometryType geom_type, + VertexType vert_type, idx_t result_offset); + + //! Get the vectorized logical type for a given geometry and vertex type + DUCKDB_API static LogicalType GetVectorizedType(GeometryType geom_type, VertexType vert_type); }; } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/common/types/row/row_data_collection.hpp b/src/duckdb/src/include/duckdb/common/types/row/row_data_collection.hpp deleted file mode 100644 index 74196f00c..000000000 --- a/src/duckdb/src/include/duckdb/common/types/row/row_data_collection.hpp +++ /dev/null @@ -1,132 +0,0 @@ -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/common/types/row/row_data_collection.hpp -// -// -//===----------------------------------------------------------------------===// - -#pragma once - -#include "duckdb/common/common.hpp" -#include "duckdb/common/types/vector.hpp" -#include "duckdb/storage/buffer_manager.hpp" -#include "duckdb/storage/buffer/block_handle.hpp" - -namespace duckdb { - -struct RowDataBlock { -public: - RowDataBlock(MemoryTag tag, BufferManager &buffer_manager, idx_t capacity, idx_t entry_size) - : capacity(capacity), entry_size(entry_size), count(0), byte_offset(0) { - auto size = MaxValue(buffer_manager.GetBlockSize(), capacity * entry_size); - auto buffer_handle = buffer_manager.Allocate(tag, size, false); - block = buffer_handle.GetBlockHandle(); - D_ASSERT(BufferManager::GetAllocSize(size + block->block_manager.GetBlockHeaderSize()) == - block->GetMemoryUsage()); - } - - explicit RowDataBlock(idx_t entry_size) : entry_size(entry_size) { - } - //! The buffer block handle - shared_ptr block; - //! Capacity (number of entries) and entry size that fit in this block - idx_t capacity; - const idx_t entry_size; - //! Number of entries currently in this block - idx_t count; - //! Write offset (if variable size entries) - idx_t byte_offset; - -private: - //! Implicit copying is not allowed - RowDataBlock(const RowDataBlock &) = delete; - -public: - unique_ptr Copy() { - auto result = make_uniq(entry_size); - result->block = block; - result->capacity = capacity; - result->count = count; - result->byte_offset = byte_offset; - return result; - } -}; - -struct BlockAppendEntry { - BlockAppendEntry(data_ptr_t baseptr, idx_t count) : baseptr(baseptr), count(count) { - } - data_ptr_t baseptr; - idx_t count; -}; - -class RowDataCollection { -public: - RowDataCollection(BufferManager &buffer_manager, idx_t block_capacity, idx_t entry_size, bool keep_pinned = false); - - unique_ptr CloneEmpty(bool keep_pinned = false) const { - return make_uniq(buffer_manager, block_capacity, entry_size, keep_pinned); - } - - //! BufferManager - BufferManager &buffer_manager; - //! The total number of stored entries - idx_t count; - //! The number of entries per block - idx_t block_capacity; - //! Size of entries in the blocks - idx_t entry_size; - //! The blocks holding the main data - vector> blocks; - //! The blocks that this collection currently has pinned - vector pinned_blocks; - //! Whether the blocks should stay pinned (necessary for e.g. a heap) - const bool keep_pinned; - -public: - idx_t AppendToBlock(RowDataBlock &block, BufferHandle &handle, vector &append_entries, - idx_t remaining, idx_t entry_sizes[]); - RowDataBlock &CreateBlock(); - vector Build(idx_t added_count, data_ptr_t key_locations[], idx_t entry_sizes[], - const SelectionVector *sel = FlatVector::IncrementalSelectionVector()); - - void Merge(RowDataCollection &other); - - void Clear() { - blocks.clear(); - pinned_blocks.clear(); - count = 0; - } - - //! The size (in bytes) of this RowDataCollection - idx_t SizeInBytes() const { - VerifyBlockSizes(); - idx_t size = 0; - for (auto &block : blocks) { - size += block->block->GetMemoryUsage(); - } - return size; - } - - //! Verifies that the block sizes are correct (Debug only) - void VerifyBlockSizes() const { -#ifdef DEBUG - for (auto &block : blocks) { - D_ASSERT(block->block->GetMemoryUsage() == - BufferManager::GetAllocSize(block->capacity * entry_size + Storage::DEFAULT_BLOCK_HEADER_SIZE)); - } -#endif - } - - static inline idx_t EntriesPerBlock(const idx_t width, const idx_t block_size) { - return block_size / width; - } - -private: - mutex rdc_lock; - - //! Copying is not allowed - RowDataCollection(const RowDataCollection &) = delete; -}; - -} // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/common/types/row/row_data_collection_scanner.hpp b/src/duckdb/src/include/duckdb/common/types/row/row_data_collection_scanner.hpp deleted file mode 100644 index b805c0955..000000000 --- a/src/duckdb/src/include/duckdb/common/types/row/row_data_collection_scanner.hpp +++ /dev/null @@ -1,123 +0,0 @@ -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/common/types/row/row_data_collection_scanner.hpp -// -// -//===----------------------------------------------------------------------===// - -#pragma once - -#include "duckdb/common/types.hpp" -#include "duckdb/common/types/row/row_layout.hpp" - -namespace duckdb { - -class BufferHandle; -class RowDataCollection; -struct RowDataBlock; -class DataChunk; - -//! Used to scan the data into DataChunks after sorting -struct RowDataCollectionScanner { -public: - using Types = vector; - - struct ScanState { - explicit ScanState(const RowDataCollectionScanner &scanner_p) : scanner(scanner_p), block_idx(0), entry_idx(0) { - } - - void PinData(); - - //! The data layout - const RowDataCollectionScanner &scanner; - - idx_t block_idx; - idx_t entry_idx; - - BufferHandle data_handle; - BufferHandle heap_handle; - - // We must pin ALL blocks we are going to gather from - vector pinned_blocks; - }; - - //! Ensure that heap blocks correspond to row blocks - static void AlignHeapBlocks(RowDataCollection &dst_block_collection, RowDataCollection &dst_string_heap, - RowDataCollection &src_block_collection, RowDataCollection &src_string_heap, - const RowLayout &layout); - - RowDataCollectionScanner(RowDataCollection &rows, RowDataCollection &heap, const RowLayout &layout, bool external, - bool flush = true); - - // Single block scan - RowDataCollectionScanner(RowDataCollection &rows, RowDataCollection &heap, const RowLayout &layout, bool external, - idx_t block_idx, bool flush); - - //! The type layout of the payload - inline const vector &GetTypes() const { - return layout.GetTypes(); - } - - //! The number of rows in the collection - inline idx_t Count() const { - return total_count; - } - - //! The number of rows scanned so far - inline idx_t Scanned() const { - return total_scanned; - } - - //! The number of remaining rows - inline idx_t Remaining() const { - return total_count - total_scanned; - } - - //! The number of remaining rows - inline idx_t BlockIndex() const { - return read_state.block_idx; - } - - //! Swizzle the blocks for external scanning - //! Swizzling is all or nothing, so if we have scanned previously, - //! we need to re-swizzle. - void ReSwizzle(); - - void SwizzleBlock(idx_t block_idx); - - //! Scans the next data chunk from the sorted data - void Scan(DataChunk &chunk); - - //! Resets to the start and updates the flush flag - void Reset(bool flush = true); - -private: - //! The row data being scanned - RowDataCollection &rows; - //! The row heap being scanned - RowDataCollection &heap; - //! The data layout - const RowLayout layout; - //! Read state - ScanState read_state; - //! The total count of sorted_data - idx_t total_count; - //! The number of rows scanned so far - idx_t total_scanned; - //! Addresses used to gather from the sorted data - Vector addresses = Vector(LogicalType::POINTER); - //! Whether the blocks can be flushed to disk - const bool external; - //! Whether to flush the blocks after scanning - bool flush; - //! Whether we are unswizzling the blocks - const bool unswizzling; - - //! Swizzle a single block - void SwizzleBlockInternal(RowDataBlock &data_block, RowDataBlock &heap_block); - //! Checks that the newest block is valid - void ValidateUnscannedBlock() const; -}; - -} // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/common/types/row/row_layout.hpp b/src/duckdb/src/include/duckdb/common/types/row/row_layout.hpp deleted file mode 100644 index 702cba4d2..000000000 --- a/src/duckdb/src/include/duckdb/common/types/row/row_layout.hpp +++ /dev/null @@ -1,82 +0,0 @@ -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/common/types/row/row_layout.hpp -// -// -//===----------------------------------------------------------------------===// - -#pragma once - -#include "duckdb/common/common.hpp" -#include "duckdb/common/types/validity_mask.hpp" -#include "duckdb/execution/operator/aggregate/aggregate_object.hpp" -#include "duckdb/planner/expression.hpp" - -namespace duckdb { - -class RowLayout { -public: - friend class TupleDataLayout; - using ValidityBytes = TemplatedValidityMask; - - //! Creates an empty RowLayout - RowLayout(); - -public: - //! Initializes the RowLayout with the specified types to an empty RowLayout - void Initialize(vector types, bool align = true); - //! Returns the number of data columns - inline idx_t ColumnCount() const { - return types.size(); - } - //! Returns a list of the column types for this data chunk - inline const vector &GetTypes() const { - return types; - } - //! Returns the total width required for each row, including padding - inline idx_t GetRowWidth() const { - return row_width; - } - //! Returns the offset to the start of the data - inline idx_t GetDataOffset() const { - return flag_width; - } - //! Returns the total width required for the data, including padding - inline idx_t GetDataWidth() const { - return data_width; - } - //! Returns the offset to the start of the aggregates - inline idx_t GetAggrOffset() const { - return flag_width + data_width; - } - //! Returns the column offsets into each row - inline const vector &GetOffsets() const { - return offsets; - } - //! Returns whether all columns in this layout are constant size - inline bool AllConstant() const { - return all_constant; - } - inline idx_t GetHeapOffset() const { - return heap_pointer_offset; - } - -private: - //! The types of the data columns - vector types; - //! The width of the validity header - idx_t flag_width; - //! The width of the data portion - idx_t data_width; - //! The width of the entire row - idx_t row_width; - //! The offsets to the columns and aggregate data in each row - vector offsets; - //! Whether all columns in this layout are constant size - bool all_constant; - //! Offset to the pointer to the heap for each row - idx_t heap_pointer_offset; -}; - -} // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/common/types/variant.hpp b/src/duckdb/src/include/duckdb/common/types/variant.hpp index 280c9e695..4db6007b0 100644 --- a/src/duckdb/src/include/duckdb/common/types/variant.hpp +++ b/src/duckdb/src/include/duckdb/common/types/variant.hpp @@ -17,9 +17,18 @@ struct UnifiedVariantVector; struct RecursiveUnifiedVectorFormat; struct UnifiedVectorFormat; -enum class VariantChildLookupMode : uint8_t { BY_KEY, BY_INDEX }; +enum class VariantChildLookupMode : uint8_t { INVALID, BY_KEY, BY_INDEX }; struct VariantPathComponent { +public: + explicit VariantPathComponent() : lookup_mode(VariantChildLookupMode::INVALID) { + } + explicit VariantPathComponent(const string &key) : lookup_mode(VariantChildLookupMode::BY_KEY), key(key) { + } + explicit VariantPathComponent(uint32_t index) : lookup_mode(VariantChildLookupMode::BY_INDEX), index(index) { + } + +public: VariantChildLookupMode lookup_mode; string key; uint32_t index; @@ -30,8 +39,6 @@ struct VariantNestedData { uint32_t child_count; //! Index of the first child uint32_t children_idx; - //! Whether the row is null - bool is_null; }; struct VariantDecimalData { diff --git a/src/duckdb/src/include/duckdb/common/virtual_file_system.hpp b/src/duckdb/src/include/duckdb/common/virtual_file_system.hpp index e1b978ba7..278be615e 100644 --- a/src/duckdb/src/include/duckdb/common/virtual_file_system.hpp +++ b/src/duckdb/src/include/duckdb/common/virtual_file_system.hpp @@ -14,12 +14,14 @@ #include "duckdb/main/extension_helper.hpp" namespace duckdb { +struct FileSystemRegistry; // bunch of wrappers to allow registering protocol handlers class VirtualFileSystem : public FileSystem { public: VirtualFileSystem(); explicit VirtualFileSystem(unique_ptr &&inner_file_system); + ~VirtualFileSystem() override; void Read(FileHandle &handle, void *buffer, int64_t nr_bytes, idx_t location) override; void Write(FileHandle &handle, void *buffer, int64_t nr_bytes, idx_t location) override; @@ -54,9 +56,6 @@ class VirtualFileSystem : public FileSystem { vector Glob(const string &path, FileOpener *opener = nullptr) override; void RegisterSubSystem(unique_ptr fs) override; - - void UnregisterSubSystem(const string &name) override; - void RegisterSubSystem(FileCompressionType compression_type, unique_ptr fs) override; unique_ptr ExtractSubSystem(const string &name) override; @@ -87,15 +86,13 @@ class VirtualFileSystem : public FileSystem { private: FileSystem &FindFileSystem(const string &path, optional_ptr file_opener); - FileSystem &FindFileSystem(const string &path, optional_ptr database_instance); - FileSystem &FindFileSystem(const string &path); - optional_ptr FindFileSystemInternal(const string &path); + FileSystem &FindFileSystem(shared_ptr ®istry, const string &path, + optional_ptr file_opener); + optional_ptr FindFileSystemInternal(FileSystemRegistry ®istry, const string &path); private: - vector> sub_systems; - map> compressed_fs; - const unique_ptr default_fs; - unordered_set disabled_file_systems; + mutex registry_lock; + shared_ptr file_system_registry; }; } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/execution/index/art/art.hpp b/src/duckdb/src/include/duckdb/execution/index/art/art.hpp index 09e10aa80..35858ce7f 100644 --- a/src/duckdb/src/include/duckdb/execution/index/art/art.hpp +++ b/src/duckdb/src/include/duckdb/execution/index/art/art.hpp @@ -45,8 +45,6 @@ class ART : public BoundIndex { static constexpr uint8_t ALLOCATOR_COUNT = 9; //! FixedSizeAllocator count of deprecated ARTs. static constexpr uint8_t DEPRECATED_ALLOCATOR_COUNT = ALLOCATOR_COUNT - 3; - //! Keys must not exceed MAX_KEY_LEN * prefix_count. - static constexpr idx_t MAX_KEY_LEN = 8192; public: ART(const string &name, const IndexConstraintType index_constraint_type, const vector &column_ids, @@ -70,8 +68,6 @@ class ART : public BoundIndex { shared_ptr, ALLOCATOR_COUNT>> allocators; //! True, if the ART owns its data. bool owns_data; - //! True, if keys need a key length verification pass. - bool verify_max_key_len; public: //! Try to initialize a scan on the ART with the given expression and filter. diff --git a/src/duckdb/src/include/duckdb/execution/index/art/art_key.hpp b/src/duckdb/src/include/duckdb/execution/index/art/art_key.hpp index 49793f364..ddcffc8ba 100644 --- a/src/duckdb/src/include/duckdb/execution/index/art/art_key.hpp +++ b/src/duckdb/src/include/duckdb/execution/index/art/art_key.hpp @@ -73,7 +73,6 @@ class ARTKey { void Concat(ArenaAllocator &allocator, const ARTKey &other); row_t GetRowId() const; idx_t GetMismatchPos(const ARTKey &other, const idx_t start) const; - void VerifyKeyLength(const idx_t max_len) const; private: template diff --git a/src/duckdb/src/include/duckdb/execution/index/art/node.hpp b/src/duckdb/src/include/duckdb/execution/index/art/node.hpp index 3a02c3eec..465eddfab 100644 --- a/src/duckdb/src/include/duckdb/execution/index/art/node.hpp +++ b/src/duckdb/src/include/duckdb/execution/index/art/node.hpp @@ -225,15 +225,6 @@ class Node : public IndexPointer { inline void operator=(const IndexPointer &ptr) { Set(ptr.Get()); } - -private: - template - static void TransformToDeprecatedInternal(ART &art, unsafe_optional_ptr ptr, - TransformToDeprecatedState &state) { - if (ptr) { - NODE::Iterator(*ptr, [&](Node &child) { Node::TransformToDeprecated(art, child, state); }); - } - } }; //! NodeChildren holds the extracted bytes of a node, and their respective children. diff --git a/src/duckdb/src/include/duckdb/execution/index/art/prefix_handle.hpp b/src/duckdb/src/include/duckdb/execution/index/art/prefix_handle.hpp index d85a51747..3b5c905c4 100644 --- a/src/duckdb/src/include/duckdb/execution/index/art/prefix_handle.hpp +++ b/src/duckdb/src/include/duckdb/execution/index/art/prefix_handle.hpp @@ -39,7 +39,10 @@ class PrefixHandle { //! Create a new deprecated prefix node and return a handle to it. static PrefixHandle NewDeprecated(FixedSizeAllocator &allocator, Node &node); - static void TransformToDeprecated(ART &art, Node &node, TransformToDeprecatedState &state); + //! Transform prefix chain to deprecated format. + //! nullptr denotes an early out optimization (the prefix has not been loaded from storage, hence we do not need + //! to transform it. Otherwise, we get a pointer to the child node at the end of the prefix chain. + static optional_ptr TransformToDeprecated(ART &art, Node &node, TransformToDeprecatedState &state); private: PrefixHandle TransformToDeprecatedAppend(ART &art, FixedSizeAllocator &allocator, const uint8_t byte); diff --git a/src/duckdb/src/include/duckdb/execution/operator/helper/physical_set.hpp b/src/duckdb/src/include/duckdb/execution/operator/helper/physical_set.hpp index 88345b3cc..56da7a90e 100644 --- a/src/duckdb/src/include/duckdb/execution/operator/helper/physical_set.hpp +++ b/src/duckdb/src/include/duckdb/execution/operator/helper/physical_set.hpp @@ -16,6 +16,7 @@ namespace duckdb { struct DBConfig; +struct ConfigurationOption; struct ExtensionOption; //! PhysicalSet represents a SET operation (e.g. SET a = 42) @@ -42,7 +43,8 @@ class PhysicalSet : public PhysicalOperator { static void SetExtensionVariable(ClientContext &context, ExtensionOption &extension_option, const String &name, SetScope scope, const Value &value); - static void SetGenericVariable(ClientContext &context, const String &name, SetScope scope, Value target_value); + static void SetGenericVariable(ClientContext &context, idx_t setting_index, SetScope scope, Value target_value); + static SetScope GetSettingScope(const ConfigurationOption &option, SetScope variable_scope); public: String name; diff --git a/src/duckdb/src/include/duckdb/execution/physical_table_scan_enum.hpp b/src/duckdb/src/include/duckdb/execution/physical_table_scan_enum.hpp index 7fddde85d..0d275e2b3 100644 --- a/src/duckdb/src/include/duckdb/execution/physical_table_scan_enum.hpp +++ b/src/duckdb/src/include/duckdb/execution/physical_table_scan_enum.hpp @@ -1,7 +1,7 @@ //===----------------------------------------------------------------------===// // DuckDB // -// duckdb/common/enums/physical_table_scan_enum.hpp +// duckdb/execution/physical_table_scan_enum.hpp // // //===----------------------------------------------------------------------===// diff --git a/src/duckdb/src/include/duckdb/function/lambda_functions.hpp b/src/duckdb/src/include/duckdb/function/lambda_functions.hpp index 828dd609a..ac4208f1a 100644 --- a/src/duckdb/src/include/duckdb/function/lambda_functions.hpp +++ b/src/duckdb/src/include/duckdb/function/lambda_functions.hpp @@ -17,7 +17,11 @@ namespace duckdb { -struct ListLambdaBindData final : public FunctionData { +struct LambdaFunctionData : public FunctionData { + DUCKDB_API virtual const unique_ptr &GetLambdaExpression() const = 0; +}; + +struct ListLambdaBindData final : public LambdaFunctionData { public: ListLambdaBindData(const LogicalType &return_type, unique_ptr lambda_expr, const bool has_index = false, const bool has_initial = false) @@ -49,6 +53,10 @@ struct ListLambdaBindData final : public FunctionData { const ScalarFunction &function); //! Deserializes a lambda function's bind data static unique_ptr Deserialize(Deserializer &deserializer, ScalarFunction &); + + const unique_ptr &GetLambdaExpression() const override { + return lambda_expr; + } }; class LambdaFunctions { diff --git a/src/duckdb/src/include/duckdb/function/scalar/generic_functions.hpp b/src/duckdb/src/include/duckdb/function/scalar/generic_functions.hpp index f502b4e82..f476ff431 100644 --- a/src/duckdb/src/include/duckdb/function/scalar/generic_functions.hpp +++ b/src/duckdb/src/include/duckdb/function/scalar/generic_functions.hpp @@ -55,4 +55,14 @@ struct CreateSortKeyFun { static ScalarFunction GetFunction(); }; +struct InvokeFun { + static constexpr const char *Name = "invoke"; + static constexpr const char *Parameters = "lambda,arg1,arg2,..."; + static constexpr const char *Description = "Invokes a lambda function with the given arguments"; + static constexpr const char *Example = "invoke(x -> x + 1, 5)"; + static constexpr const char *Categories = ""; + + static ScalarFunction GetFunction(); +}; + } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/function/scalar/variant_utils.hpp b/src/duckdb/src/include/duckdb/function/scalar/variant_utils.hpp index 1c20b19c0..78eb7bd36 100644 --- a/src/duckdb/src/include/duckdb/function/scalar/variant_utils.hpp +++ b/src/duckdb/src/include/duckdb/function/scalar/variant_utils.hpp @@ -16,6 +16,20 @@ namespace duckdb { +struct VariantExtractBindData : public FunctionData { +public: + explicit VariantExtractBindData(const string &str); + explicit VariantExtractBindData(uint32_t index); + VariantExtractBindData(const VariantExtractBindData &other) = default; + +public: + unique_ptr Copy() const override; + bool Equals(const FunctionData &other) const override; + +public: + VariantPathComponent component; +}; + struct VariantNestedDataCollectionResult { public: VariantNestedDataCollectionResult() : success(true) { @@ -73,10 +87,11 @@ struct VariantUtils { DUCKDB_API static void FindChildValues(const UnifiedVariantVectorData &variant, const VariantPathComponent &component, optional_ptr sel, SelectionVector &res, - ValidityMask &res_validity, VariantNestedData *nested_data, idx_t count); + ValidityMask &res_validity, const VariantNestedData *nested_data, + const ValidityMask &validity, idx_t count); DUCKDB_API static VariantNestedDataCollectionResult CollectNestedData(const UnifiedVariantVectorData &variant, VariantLogicalType expected_type, - const SelectionVector &sel, idx_t count, optional_idx row, idx_t offset, + const SelectionVector &value_index_sel, idx_t count, optional_idx row, idx_t offset, VariantNestedData *child_data, ValidityMask &validity); DUCKDB_API static vector ValueIsNull(const UnifiedVariantVectorData &variant, const SelectionVector &sel, idx_t count, optional_idx row); @@ -85,6 +100,8 @@ struct VariantUtils { DUCKDB_API static bool Verify(Vector &variant, const SelectionVector &sel_p, idx_t count); DUCKDB_API static void FinalizeVariantKeys(Vector &variant, OrderedOwningStringMap &dictionary, SelectionVector &sel, idx_t sel_size); + DUCKDB_API static void VariantExtract(Vector &input, const vector &components, Vector &result, + idx_t count); }; } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/logging/logging.hpp b/src/duckdb/src/include/duckdb/logging/logging.hpp index 11d0760c7..8c74d38fa 100644 --- a/src/duckdb/src/include/duckdb/logging/logging.hpp +++ b/src/duckdb/src/include/duckdb/logging/logging.hpp @@ -41,12 +41,6 @@ struct LogConfig { LogConfig(); - DUCKDB_API static LogConfig Create(bool enabled, LogLevel level); - DUCKDB_API static LogConfig CreateFromEnabled(bool enabled, LogLevel level, - unordered_set &enabled_log_types); - DUCKDB_API static LogConfig CreateFromDisabled(bool enabled, LogLevel level, - unordered_set &disabled_log_types); - DUCKDB_API bool IsConsistent() const; bool enabled; diff --git a/src/duckdb/src/include/duckdb/main/attached_database.hpp b/src/duckdb/src/include/duckdb/main/attached_database.hpp index 7a0d95a1b..da561c982 100644 --- a/src/duckdb/src/include/duckdb/main/attached_database.hpp +++ b/src/duckdb/src/include/duckdb/main/attached_database.hpp @@ -154,7 +154,7 @@ class AttachedDatabase : public CatalogEntry, public enable_shared_from_this close_lock; unordered_map attach_options; private: diff --git a/src/duckdb/src/include/duckdb/main/client_config.hpp b/src/duckdb/src/include/duckdb/main/client_config.hpp index e2b5c6926..40980b8a0 100644 --- a/src/duckdb/src/include/duckdb/main/client_config.hpp +++ b/src/duckdb/src/include/duckdb/main/client_config.hpp @@ -17,6 +17,7 @@ #include "duckdb/main/profiling_info.hpp" #include "duckdb/parser/expression/lambda_expression.hpp" #include "duckdb/main/query_profiler.hpp" +#include "duckdb/main/user_settings.hpp" namespace duckdb { @@ -27,8 +28,6 @@ class PreparedStatementData; typedef std::function get_result_collector_t; struct ClientConfig { - //! The home directory used by the system (if any) - string home_directory; //! If the query profiler is enabled or not. bool enable_profiler = false; //! If detailed query profiling is enabled @@ -57,9 +56,6 @@ struct ClientConfig { //! The wait time before showing the progress bar int wait_time = 2000; - //! The maximum expression depth limit in the parser - idx_t max_expression_depth = 1000; - //! Whether or not aggressive query verification is enabled bool query_verification_enabled = false; //! Whether or not verification of external operators is enabled, used for testing @@ -88,21 +84,12 @@ struct ClientConfig { //! Callback to create a progress bar display progress_bar_display_create_func_t display_create_func = nullptr; - //! The explain output type used when none is specified (default: PHYSICAL_ONLY) - ExplainOutputType explain_output_type = ExplainOutputType::PHYSICAL_ONLY; - - //! If DEFAULT or ENABLE_SINGLE_ARROW, it is possible to use the deprecated single arrow operator (->) for lambda - //! functions. Otherwise, DISABLE_SINGLE_ARROW. - LambdaSyntax lambda_syntax = LambdaSyntax::DEFAULT; //! The profiling coverage. SELECT is the default behavior, and ALL emits profiling information for all operator //! types. ProfilingCoverage profiling_coverage = ProfilingCoverage::SELECT; - //! Output error messages as structured JSON instead of as a raw string - bool errors_as_json = false; - //! Generic options - case_insensitive_map_t set_variables; + LocalUserSettings user_settings; //! Variables set by the user case_insensitive_map_t user_variables; @@ -127,16 +114,6 @@ struct ClientConfig { bool GetUserVariable(const string &name, Value &result); void ResetUserVariable(const String &name); - template - static typename OP::RETURN_TYPE GetSetting(const ClientContext &context) { - return OP::GetSetting(context).template GetValue(); - } - - template - static Value GetSettingValue(const ClientContext &context) { - return OP::GetSetting(context); - } - public: void SetDefaultStreamingBufferSize(); }; diff --git a/src/duckdb/src/include/duckdb/main/client_context.hpp b/src/duckdb/src/include/duckdb/main/client_context.hpp index 02edee9ca..962ad0cde 100644 --- a/src/duckdb/src/include/duckdb/main/client_context.hpp +++ b/src/duckdb/src/include/duckdb/main/client_context.hpp @@ -200,6 +200,8 @@ class ClientContext : public enable_shared_from_this { //! Equivalent to CURRENT_SETTING(key) SQL function. DUCKDB_API SettingLookupResult TryGetCurrentSetting(const string &key, Value &result) const; + //! Returns the value of the current setting set by the user - if the user has set it. + DUCKDB_API SettingLookupResult TryGetCurrentUserSetting(idx_t setting_index, Value &result) const; //! Returns the parser options for this client context DUCKDB_API ParserOptions GetParserOptions() const; @@ -309,8 +311,6 @@ class ClientContext : public enable_shared_from_this { unique_ptr statement, PendingQueryParameters parameters); - SettingLookupResult TryGetCurrentSettingInternal(const string &key, Value &result) const; - private: //! Lock on using the ClientContext in parallel mutex context_lock; diff --git a/src/duckdb/src/include/duckdb/main/client_data.hpp b/src/duckdb/src/include/duckdb/main/client_data.hpp index 7e901c498..a2068b68e 100644 --- a/src/duckdb/src/include/duckdb/main/client_data.hpp +++ b/src/duckdb/src/include/duckdb/main/client_data.hpp @@ -44,8 +44,6 @@ struct ClientData { //! The catalog search path. unique_ptr catalog_search_path; - //! The file search path. - string file_search_path; //! The file opener of the client context. unique_ptr file_opener; diff --git a/src/duckdb/src/include/duckdb/main/config.hpp b/src/duckdb/src/include/duckdb/main/config.hpp index 757d67c89..e66bea925 100644 --- a/src/duckdb/src/include/duckdb/main/config.hpp +++ b/src/duckdb/src/include/duckdb/main/config.hpp @@ -38,6 +38,7 @@ #include "duckdb/function/encoding_function.hpp" #include "duckdb/main/setting_info.hpp" #include "duckdb/logging/log_manager.hpp" +#include "duckdb/main/user_settings.hpp" namespace duckdb { @@ -87,6 +88,9 @@ class SerializationCompatibility { SerializationCompatibility() = default; }; +//! NOTE: DBConfigOptions is mostly deprecated. +//! If you want to add a setting that can be set by the user, add it as a generic setting to `settings.json`. +//! See e.g. "http_proxy" (HTTPProxySetting) as an example struct DBConfigOptions { //! Database file path. May be empty for in-memory mode string database_path; @@ -100,33 +104,12 @@ struct DBConfigOptions { bool use_direct_io = false; //! Whether extensions should be loaded on start-up bool load_extensions = true; -#ifdef DUCKDB_EXTENSION_AUTOLOAD_DEFAULT - //! Whether known extensions are allowed to be automatically loaded when a query depends on them - bool autoload_known_extensions = DUCKDB_EXTENSION_AUTOLOAD_DEFAULT; -#else - bool autoload_known_extensions = false; -#endif -#ifdef DUCKDB_EXTENSION_AUTOINSTALL_DEFAULT - //! Whether known extensions are allowed to be automatically installed when a query depends on them - bool autoinstall_known_extensions = DUCKDB_EXTENSION_AUTOINSTALL_DEFAULT; -#else - bool autoinstall_known_extensions = false; -#endif - //! Setting for the parser override registered by extensions. Allowed options: "default, "fallback", "strict" - string allow_parser_override_extension = "default"; - //! Override for the default extension repository - string custom_extension_repo = ""; - //! Override for the default autoload extension repository - string autoinstall_extension_repo = ""; //! The maximum memory used by the database system (in bytes). Default: 80% of System available memory idx_t maximum_memory = DConstants::INVALID_INDEX; //! The maximum size of the 'temp_directory' folder when set (in bytes). Default: 90% of available disk space. idx_t maximum_swap_space = DConstants::INVALID_INDEX; //! The maximum amount of CPU threads used by the database system. Default: all available. idx_t maximum_threads = DConstants::INVALID_INDEX; - //! The number of external threads that work on DuckDB tasks. Default: 1. - //! Must be smaller or equal to maximum_threads. - idx_t external_threads = 1; //! Whether or not to create and use a temporary directory to store intermediates that do not fit in memory bool use_temporary_directory = true; //! Directory to store temporary structures that do not fit in memory @@ -136,20 +119,6 @@ struct DBConfigOptions { bool trim_free_blocks = false; //! Record timestamps of buffer manager unpin() events. Usable by custom eviction policies. bool buffer_manager_track_eviction_timestamps = false; - //! Whether or not to allow printing unredacted secrets - bool allow_unredacted_secrets = false; - //! Disables invalidating the database instance when encountering a fatal error. - bool disable_database_invalidation = false; - //! enable COPY and related commands - bool enable_external_access = true; - //! Whether or not the global http metadata cache is used - bool http_metadata_cache_enable = false; - //! HTTP Proxy config as 'hostname:port' - string http_proxy; - //! HTTP Proxy username for basic auth - string http_proxy_username; - //! HTTP Proxy password for basic auth - string http_proxy_password; //! Force checkpoint when CHECKPOINT is called or on shutdown, even if no changes have been made bool force_checkpoint = false; //! Run a checkpoint on successful shutdown and delete the WAL, to leave only a single database file behind @@ -161,52 +130,26 @@ struct DBConfigOptions { bool initialize_default_database = true; //! The set of disabled optimizers (default empty) set disabled_optimizers; - //! The average string length required to use ZSTD compression. - uint64_t zstd_min_string_length = 4096; - //! Force a specific compression method to be used when checkpointing (if available) - CompressionType force_compression = CompressionType::COMPRESSION_AUTO; - //! Force a specific bitpacking mode to be used when using the bitpacking compression method - BitpackingMode force_bitpacking_mode = BitpackingMode::AUTO; //! Force a specific schema for VARIANT shredding LogicalType force_variant_shredding = LogicalType::INVALID; - //! Minimum size of a rowgroup to enable VARIANT shredding, -1 to disable - int64_t variant_minimum_shredding_size = 30000; - //! Database configuration variables as controlled by SET - case_insensitive_map_t set_variables; //! Database configuration variable default values; case_insensitive_map_t set_variable_defaults; - //! Directory to store extension binaries in - string extension_directory; //! Additional directories to store extension binaries in vector extension_directories; - //! Whether unsigned extensions should be loaded - bool allow_unsigned_extensions = false; - //! Whether community extensions should be loaded - bool allow_community_extensions = true; //! Debug setting - how to initialize blocks in the storage layer when allocating DebugInitialize debug_initialize = DebugInitialize::NO_INITIALIZE; //! The set of user-provided options case_insensitive_map_t user_options; //! The set of unrecognized (other) options case_insensitive_map_t unrecognized_options; - //! Whether or not the configuration settings can be altered - bool lock_configuration = false; //! Whether to print bindings when printing the plan (debug mode only) static bool debug_print_bindings; // NOLINT: debug setting //! The peak allocation threshold at which to flush the allocator after completing a task (1 << 27, ~128MB) idx_t allocator_flush_threshold = 134217728ULL; //! If bulk deallocation larger than this occurs, flush outstanding allocations (1 << 30, ~1GB) idx_t allocator_bulk_deallocation_flush_threshold = 536870912ULL; - //! Whether the allocator background thread is enabled - bool allocator_background_threads = false; - //! DuckDB API surface - string duckdb_api; //! Metadata from DuckDB callers string custom_user_agent; - //! Encrypt the temp files - bool temp_file_encryption = false; - //! The default block allocation size for new duckdb database files (new as-in, they do not yet exist). - idx_t default_block_alloc_size = DEFAULT_BLOCK_ALLOC_SIZE; //! The default block header size for new duckdb database files. idx_t default_block_header_size = DUCKDB_BLOCK_HEADER_STORAGE_SIZE; //! Whether or not to abort if a serialization exception is thrown during WAL playback (when reading truncated WAL) @@ -217,18 +160,6 @@ struct DBConfigOptions { set allowed_directories; //! The log configuration LogConfig log_config = LogConfig(); - //! Whether to enable external file caching using CachingFileSystem - bool enable_external_file_cache = true; - //! Cache validation mode, by default all cache entries are validated. - CacheValidationMode validate_external_file_cache = CacheValidationMode::VALIDATE_ALL; - //! Partially process tasks before rescheduling - allows for more scheduler fairness between separate queries -#ifdef DUCKDB_ALTERNATIVE_VERIFY - bool scheduler_process_partial = true; -#else - bool scheduler_process_partial = false; -#endif - //! Whether to pin threads to cores (linux only, default AUTOMATIC: on when there are more than 64 cores) - ThreadPinMode pin_threads = ThreadPinMode::AUTO; //! Physical memory that the block allocator is allowed to use (this memory is never freed and cannot be reduced) idx_t block_allocator_size = 0; @@ -245,12 +176,9 @@ struct DBConfig { DUCKDB_API DBConfig(const case_insensitive_map_t &config_dict, bool read_only); DUCKDB_API ~DBConfig(); - mutable mutex config_lock; //! Replacement table scans are automatically attempted when a table name cannot be found in the schema vector replacement_scans; - //! Extra parameters that can be SET for loaded extensions - case_insensitive_map_t extension_parameters; //! The FileSystem to use, can be overwritten to allow for injecting custom file systems for testing purposes (e.g. //! RamFS or something similar) unique_ptr file_system; @@ -288,6 +216,8 @@ struct DBConfig { shared_ptr db_cache_entry; //! Reference to the database file path manager shared_ptr path_manager; + //! Database configuration variables as controlled by SET + GlobalUserSettings user_settings; public: DUCKDB_API static DBConfig &GetConfig(ClientContext &context); @@ -305,7 +235,9 @@ struct DBConfig { DUCKDB_API void AddExtensionOption(const string &name, string description, LogicalType parameter, const Value &default_value = Value(), set_option_callback_t function = nullptr, SetScope default_scope = SetScope::SESSION); - DUCKDB_API bool HasExtensionOption(const string &name); + DUCKDB_API bool HasExtensionOption(const string &name) const; + DUCKDB_API case_insensitive_map_t GetExtensionSettings() const; + DUCKDB_API bool TryGetExtensionOption(const String &name, ExtensionOption &result) const; //! Fetch an option by index. Returns a pointer to the option, or nullptr if out of range DUCKDB_API static optional_ptr GetOptionByIndex(idx_t index); //! Fetcha n alias by index, or nullptr if out of range @@ -314,12 +246,15 @@ struct DBConfig { DUCKDB_API static optional_ptr GetOptionByName(const String &name); DUCKDB_API void SetOption(const ConfigurationOption &option, const Value &value); DUCKDB_API void SetOption(optional_ptr db, const ConfigurationOption &option, const Value &value); + DUCKDB_API void SetOption(const string &name, Value value); + DUCKDB_API void SetOption(idx_t setting_index, Value value); DUCKDB_API void SetOptionByName(const string &name, const Value &value); DUCKDB_API void SetOptionsByName(const case_insensitive_map_t &values); DUCKDB_API void ResetOption(optional_ptr db, const ConfigurationOption &option); - DUCKDB_API void SetOption(const String &name, Value value); - DUCKDB_API void ResetOption(const String &name); - DUCKDB_API void ResetGenericOption(const String &name); + DUCKDB_API void ResetOption(const ExtensionOption &extension_option); + DUCKDB_API void ResetGenericOption(idx_t setting_index); + DUCKDB_API optional_idx TryGetSettingIndex(const String &name, + optional_ptr &option) const; static LogicalType ParseLogicalType(const string &type); DUCKDB_API void CheckLock(const String &name); @@ -364,26 +299,12 @@ struct DBConfig { OrderByNullType ResolveNullOrder(ClientContext &context, OrderType order_type, OrderByNullType null_type) const; const string UserAgent() const; + //! Returns the value of a setting currently. If the setting is not set by the user, returns the default value. SettingLookupResult TryGetCurrentSetting(const string &key, Value &result) const; - - template - static typename std::enable_if::value, typename OP::RETURN_TYPE>::type - GetSetting(const SOURCE &source) { - return EnumUtil::FromString( - GetSettingInternal(source, OP::Name, OP::DefaultValue).ToString()); - } - - template - static typename std::enable_if::value, typename OP::RETURN_TYPE>::type - GetSetting(const SOURCE &source) { - return GetSettingInternal(source, OP::Name, OP::DefaultValue).template GetValue(); - } - - template - Value GetSettingValue(const ClientContext &context) const { - lock_guard lock(config_lock); - return OP::GetSetting(context); - } + //! Returns the value of a setting set by the user currently + SettingLookupResult TryGetCurrentUserSetting(idx_t setting_index, Value &result) const; + //! Returns the default value of an option + static SettingLookupResult TryGetDefaultValue(optional_ptr option, Value &result); bool CanAccessFile(const string &path, FileType type); void AddAllowedDirectory(const string &path); @@ -391,11 +312,7 @@ struct DBConfig { string SanitizeAllowedPath(const string &path) const; private: - static Value GetSettingInternal(const DatabaseInstance &db, const char *setting, const char *default_value); - static Value GetSettingInternal(const DBConfig &config, const char *setting, const char *default_value); - static Value GetSettingInternal(const ClientContext &context, const char *setting, const char *default_value); - -private: + mutable mutex config_lock; unique_ptr compression_functions; unique_ptr encoding_functions; unique_ptr arrow_extensions; diff --git a/src/duckdb/src/include/duckdb/main/extension_entries.hpp b/src/duckdb/src/include/duckdb/main/extension_entries.hpp index df7a0a7c3..2ea4cc2ce 100644 --- a/src/duckdb/src/include/duckdb/main/extension_entries.hpp +++ b/src/duckdb/src/include/duckdb/main/extension_entries.hpp @@ -1044,6 +1044,7 @@ static constexpr ExtensionEntry EXTENSION_SETTINGS[] = { {"ducklake_retry_wait_ms", "ducklake"}, {"enable_curl_server_cert_verification", "httpfs"}, {"enable_geoparquet_conversion", "parquet"}, + {"enable_global_s3_configuration", "httpfs"}, {"enable_server_cert_verification", "httpfs"}, {"force_download", "httpfs"}, {"hf_max_per_page", "httpfs"}, @@ -1056,9 +1057,12 @@ static constexpr ExtensionEntry EXTENSION_SETTINGS[] = { {"http_timeout", "httpfs"}, {"httpfs_client_implementation", "httpfs"}, {"iceberg_via_aws_sdk_for_catalog_interactions", "iceberg"}, + {"merge_http_secret_into_s3_request", "httpfs"}, {"mysql_bit1_as_boolean", "mysql_scanner"}, {"mysql_debug_show_queries", "mysql_scanner"}, + {"mysql_enable_transactions", "mysql_scanner"}, {"mysql_experimental_filter_pushdown", "mysql_scanner"}, + {"mysql_incomplete_dates_as_nulls", "mysql_scanner"}, {"mysql_session_time_zone", "mysql_scanner"}, {"mysql_time_as_time", "mysql_scanner"}, {"mysql_tinyint1_as_boolean", "mysql_scanner"}, diff --git a/src/duckdb/src/include/duckdb/main/extension_helper.hpp b/src/duckdb/src/include/duckdb/main/extension_helper.hpp index 480bc398f..4f5fc7621 100644 --- a/src/duckdb/src/include/duckdb/main/extension_helper.hpp +++ b/src/duckdb/src/include/duckdb/main/extension_helper.hpp @@ -11,6 +11,7 @@ #include "duckdb.hpp" #include "duckdb/main/extension_entries.hpp" #include "duckdb/main/extension_install_info.hpp" +#include "duckdb/main/settings.hpp" #include @@ -207,9 +208,8 @@ class ExtensionHelper { //! Lookup a name in an extension entry and try to autoload it template static void TryAutoloadFromEntry(DatabaseInstance &db, const string &entry, const ExtensionEntry (&entries)[N]) { - auto &dbconfig = DBConfig::GetConfig(db); #ifndef DUCKDB_DISABLE_EXTENSION_LOAD - if (dbconfig.options.autoload_known_extensions) { + if (Settings::Get(db)) { auto extension_name = ExtensionHelper::FindExtensionInEntries(entry, entries); if (ExtensionHelper::CanAutoloadExtension(extension_name)) { ExtensionHelper::AutoLoadExtension(db, extension_name); diff --git a/src/duckdb/src/include/duckdb/main/setting_info.hpp b/src/duckdb/src/include/duckdb/main/setting_info.hpp index 7968c4d8f..8aaa19223 100644 --- a/src/duckdb/src/include/duckdb/main/setting_info.hpp +++ b/src/duckdb/src/include/duckdb/main/setting_info.hpp @@ -17,8 +17,6 @@ class ClientContext; class DatabaseInstance; struct DBConfig; -const string GetDefaultUserAgent(); - enum class SettingScope : uint8_t { //! Setting is from the global Setting scope GLOBAL, @@ -30,6 +28,18 @@ enum class SettingScope : uint8_t { INVALID }; +enum class SettingScopeTarget { + INVALID, + //! Setting can be set in global scope only + GLOBAL_ONLY, + //! Setting can be set in local scope only + LOCAL_ONLY, + //! Setting can be set in both scopes - but defaults to global + GLOBAL_DEFAULT, + //! Setting can be set in both scopes - but defaults to local + LOCAL_DEFAULT +}; + struct SettingLookupResult { public: SettingLookupResult() : scope(SettingScope::INVALID) { @@ -79,9 +89,10 @@ struct ConfigurationOption { reset_global_function_t reset_global; reset_local_function_t reset_local; get_setting_function_t get_setting; - SetScope default_scope; + SettingScopeTarget scope; const char *default_value; set_callback_t set_callback; + optional_idx setting_idx; }; struct ConfigurationAlias { @@ -92,6 +103,8 @@ struct ConfigurationAlias { typedef void (*set_option_callback_t)(ClientContext &context, SetScope scope, Value ¶meter); struct ExtensionOption { + ExtensionOption() : set_function(nullptr), default_scope(SetScope::AUTOMATIC) { + } // NOLINTNEXTLINE: work around bug in clang-tidy ExtensionOption(string description_p, LogicalType type_p, set_option_callback_t set_function_p, Value default_value_p, SetScope default_scope_p) @@ -104,6 +117,7 @@ struct ExtensionOption { set_option_callback_t set_function; Value default_value; SetScope default_scope; + optional_idx setting_index; }; } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/main/settings.hpp b/src/duckdb/src/include/duckdb/main/settings.hpp index d87f8aa1a..4506c1231 100644 --- a/src/duckdb/src/include/duckdb/main/settings.hpp +++ b/src/duckdb/src/include/duckdb/main/settings.hpp @@ -8,21 +8,78 @@ #pragma once -#include "duckdb/main/config.hpp" #include "duckdb/main/setting_info.hpp" -#include "duckdb/common/enums/access_mode.hpp" -#include "duckdb/common/enums/cache_validation_mode.hpp" -#include "duckdb/common/enums/checkpoint_abort.hpp" -#include "duckdb/common/enums/debug_vector_verification.hpp" -#include "duckdb/common/enums/window_aggregation_mode.hpp" -#include "duckdb/common/enums/order_type.hpp" -#include "duckdb/common/enums/output_type.hpp" -#include "duckdb/common/enums/thread_pin_mode.hpp" -#include "duckdb/common/enums/arrow_format_version.hpp" -#include "duckdb/common/enums/storage_block_prefetch.hpp" +#include "duckdb/common/enum_util.hpp" namespace duckdb { +struct Settings { + template + static typename std::enable_if::value, typename OP::RETURN_TYPE>::type + Get(const SOURCE &source) { + Value result; + if (TryGetSettingInternal(source, OP::SettingIndex, result)) { + return EnumUtil::FromString(StringValue::Get(result)); + } + return EnumUtil::FromString(OP::DefaultValue); + } + + template + static typename std::enable_if::value, string>::type + Get(const SOURCE &source) { + Value result; + if (TryGetSettingInternal(source, OP::SettingIndex, result)) { + return StringValue::Get(result); + } + return OP::DefaultValue; + } + + template + static typename std::enable_if::value, bool>::type + Get(const SOURCE &source) { + Value result; + if (TryGetSettingInternal(source, OP::SettingIndex, result)) { + return BooleanValue::Get(result); + } + return StringUtil::Equals(OP::DefaultValue, "true"); + } + + template + static typename std::enable_if::value, idx_t>::type + Get(const SOURCE &source) { + Value result; + if (TryGetSettingInternal(source, OP::SettingIndex, result)) { + return UBigIntValue::Get(result); + } + return StringUtil::ToUnsigned(OP::DefaultValue); + } + + template + static typename std::enable_if::value, int64_t>::type + Get(const SOURCE &source) { + Value result; + if (TryGetSettingInternal(source, OP::SettingIndex, result)) { + return BigIntValue::Get(result); + } + return StringUtil::ToSigned(OP::DefaultValue); + } + + template + static typename std::enable_if::value, double>::type + Get(const SOURCE &source) { + Value result; + if (TryGetSettingInternal(source, OP::SettingIndex, result)) { + return DoubleValue::Get(result); + } + return StringUtil::ToDouble(OP::DefaultValue); + } + +private: + static bool TryGetSettingInternal(const DatabaseInstance &db, idx_t setting_index, Value &result); + static bool TryGetSettingInternal(const DBConfig &config, idx_t setting_index, Value &result); + static bool TryGetSettingInternal(const ClientContext &context, idx_t setting_index, Value &result); +}; + //===----------------------------------------------------------------------===// // This code is autogenerated from 'update_settings_header_file.py'. // Please do not make any changes directly here, as they will be overwritten. @@ -46,11 +103,10 @@ struct AllocatorBackgroundThreadsSetting { static constexpr const char *Name = "allocator_background_threads"; static constexpr const char *Description = "Whether to enable the allocator background thread."; static constexpr const char *InputType = "BOOLEAN"; - static void SetGlobal(DatabaseInstance *db, DBConfig &config, const Value ¶meter); - static void ResetGlobal(DatabaseInstance *db, DBConfig &config); - static bool OnGlobalSet(DatabaseInstance *db, DBConfig &config, const Value &input); - static bool OnGlobalReset(DatabaseInstance *db, DBConfig &config); - static Value GetSetting(const ClientContext &context); + static constexpr const char *DefaultValue = "false"; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; + static constexpr idx_t SettingIndex = 0; + static void OnSet(SettingCallbackInfo &info, Value &input); }; struct AllocatorBulkDeallocationFlushThresholdSetting { @@ -80,11 +136,10 @@ struct AllowCommunityExtensionsSetting { static constexpr const char *Name = "allow_community_extensions"; static constexpr const char *Description = "Allow to load community built extensions"; static constexpr const char *InputType = "BOOLEAN"; - static void SetGlobal(DatabaseInstance *db, DBConfig &config, const Value ¶meter); - static void ResetGlobal(DatabaseInstance *db, DBConfig &config); - static bool OnGlobalSet(DatabaseInstance *db, DBConfig &config, const Value &input); - static bool OnGlobalReset(DatabaseInstance *db, DBConfig &config); - static Value GetSetting(const ClientContext &context); + static constexpr const char *DefaultValue = "true"; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; + static constexpr idx_t SettingIndex = 1; + static void OnSet(SettingCallbackInfo &info, Value &input); }; struct AllowExtensionsMetadataMismatchSetting { @@ -93,19 +148,19 @@ struct AllowExtensionsMetadataMismatchSetting { static constexpr const char *Description = "Allow to load extensions with not compatible metadata"; static constexpr const char *InputType = "BOOLEAN"; static constexpr const char *DefaultValue = "false"; - static constexpr SetScope DefaultScope = SetScope::GLOBAL; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; + static constexpr idx_t SettingIndex = 2; }; struct AllowParserOverrideExtensionSetting { - using RETURN_TYPE = string; + using RETURN_TYPE = AllowParserOverride; static constexpr const char *Name = "allow_parser_override_extension"; static constexpr const char *Description = "Allow extensions to override the current parser"; static constexpr const char *InputType = "VARCHAR"; - static void SetGlobal(DatabaseInstance *db, DBConfig &config, const Value ¶meter); - static void ResetGlobal(DatabaseInstance *db, DBConfig &config); - static bool OnGlobalSet(DatabaseInstance *db, DBConfig &config, const Value &input); - static bool OnGlobalReset(DatabaseInstance *db, DBConfig &config); - static Value GetSetting(const ClientContext &context); + static constexpr const char *DefaultValue = "DEFAULT"; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; + static constexpr idx_t SettingIndex = 3; + static void OnSet(SettingCallbackInfo &info, Value &input); }; struct AllowPersistentSecretsSetting { @@ -124,11 +179,10 @@ struct AllowUnredactedSecretsSetting { static constexpr const char *Name = "allow_unredacted_secrets"; static constexpr const char *Description = "Allow printing unredacted secrets"; static constexpr const char *InputType = "BOOLEAN"; - static void SetGlobal(DatabaseInstance *db, DBConfig &config, const Value ¶meter); - static void ResetGlobal(DatabaseInstance *db, DBConfig &config); - static bool OnGlobalSet(DatabaseInstance *db, DBConfig &config, const Value &input); - static bool OnGlobalReset(DatabaseInstance *db, DBConfig &config); - static Value GetSetting(const ClientContext &context); + static constexpr const char *DefaultValue = "false"; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; + static constexpr idx_t SettingIndex = 4; + static void OnSet(SettingCallbackInfo &info, Value &input); }; struct AllowUnsignedExtensionsSetting { @@ -136,11 +190,10 @@ struct AllowUnsignedExtensionsSetting { static constexpr const char *Name = "allow_unsigned_extensions"; static constexpr const char *Description = "Allow to load extensions with invalid or missing signatures"; static constexpr const char *InputType = "BOOLEAN"; - static void SetGlobal(DatabaseInstance *db, DBConfig &config, const Value ¶meter); - static void ResetGlobal(DatabaseInstance *db, DBConfig &config); - static bool OnGlobalSet(DatabaseInstance *db, DBConfig &config, const Value &input); - static bool OnGlobalReset(DatabaseInstance *db, DBConfig &config); - static Value GetSetting(const ClientContext &context); + static constexpr const char *DefaultValue = "false"; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; + static constexpr idx_t SettingIndex = 5; + static void OnSet(SettingCallbackInfo &info, Value &input); }; struct AllowedDirectoriesSetting { @@ -172,7 +225,8 @@ struct ArrowLargeBufferSizeSetting { "Whether Arrow buffers for strings, blobs, uuids and bits should be exported using large buffers"; static constexpr const char *InputType = "BOOLEAN"; static constexpr const char *DefaultValue = "false"; - static constexpr SetScope DefaultScope = SetScope::GLOBAL; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; + static constexpr idx_t SettingIndex = 6; }; struct ArrowLosslessConversionSetting { @@ -183,7 +237,8 @@ struct ArrowLosslessConversionSetting { "with a duckdb.type_name extension name."; static constexpr const char *InputType = "BOOLEAN"; static constexpr const char *DefaultValue = "false"; - static constexpr SetScope DefaultScope = SetScope::GLOBAL; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; + static constexpr idx_t SettingIndex = 7; }; struct ArrowOutputListViewSetting { @@ -193,7 +248,8 @@ struct ArrowOutputListViewSetting { "Whether export to Arrow format should use ListView as the physical layout for LIST columns"; static constexpr const char *InputType = "BOOLEAN"; static constexpr const char *DefaultValue = "false"; - static constexpr SetScope DefaultScope = SetScope::GLOBAL; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; + static constexpr idx_t SettingIndex = 8; }; struct ArrowOutputVersionSetting { @@ -203,7 +259,8 @@ struct ArrowOutputVersionSetting { "Whether strings should be produced by DuckDB in Utf8View format instead of Utf8"; static constexpr const char *InputType = "VARCHAR"; static constexpr const char *DefaultValue = "1.0"; - static constexpr SetScope DefaultScope = SetScope::GLOBAL; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; + static constexpr idx_t SettingIndex = 9; static void OnSet(SettingCallbackInfo &info, Value &input); }; @@ -214,7 +271,8 @@ struct AsofLoopJoinThresholdSetting { "The maximum number of rows we need on the left side of an ASOF join to use a nested loop join"; static constexpr const char *InputType = "UBIGINT"; static constexpr const char *DefaultValue = "64"; - static constexpr SetScope DefaultScope = SetScope::SESSION; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; + static constexpr idx_t SettingIndex = 10; }; struct AutoinstallExtensionRepositorySetting { @@ -223,9 +281,9 @@ struct AutoinstallExtensionRepositorySetting { static constexpr const char *Description = "Overrides the custom endpoint for extension installation on autoloading"; static constexpr const char *InputType = "VARCHAR"; - static void SetGlobal(DatabaseInstance *db, DBConfig &config, const Value ¶meter); - static void ResetGlobal(DatabaseInstance *db, DBConfig &config); - static Value GetSetting(const ClientContext &context); + static constexpr const char *DefaultValue = ""; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; + static constexpr idx_t SettingIndex = 11; }; struct AutoinstallKnownExtensionsSetting { @@ -234,9 +292,13 @@ struct AutoinstallKnownExtensionsSetting { static constexpr const char *Description = "Whether known extensions are allowed to be automatically installed when a query depends on them"; static constexpr const char *InputType = "BOOLEAN"; - static void SetGlobal(DatabaseInstance *db, DBConfig &config, const Value ¶meter); - static void ResetGlobal(DatabaseInstance *db, DBConfig &config); - static Value GetSetting(const ClientContext &context); +#if defined(DUCKDB_EXTENSION_AUTOINSTALL_DEFAULT) && DUCKDB_EXTENSION_AUTOINSTALL_DEFAULT + static constexpr const char *DefaultValue = "true"; +#else + static constexpr const char *DefaultValue = "false"; +#endif + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; + static constexpr idx_t SettingIndex = 12; }; struct AutoloadKnownExtensionsSetting { @@ -245,9 +307,13 @@ struct AutoloadKnownExtensionsSetting { static constexpr const char *Description = "Whether known extensions are allowed to be automatically loaded when a query depends on them"; static constexpr const char *InputType = "BOOLEAN"; - static void SetGlobal(DatabaseInstance *db, DBConfig &config, const Value ¶meter); - static void ResetGlobal(DatabaseInstance *db, DBConfig &config); - static Value GetSetting(const ClientContext &context); +#if defined(DUCKDB_EXTENSION_AUTOLOAD_DEFAULT) && DUCKDB_EXTENSION_AUTOLOAD_DEFAULT + static constexpr const char *DefaultValue = "true"; +#else + static constexpr const char *DefaultValue = "false"; +#endif + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; + static constexpr idx_t SettingIndex = 13; }; struct BlockAllocatorMemorySetting { @@ -268,7 +334,8 @@ struct CatalogErrorMaxSchemasSetting { "The maximum number of schemas the system will scan for \"did you mean...\" style errors in the catalog"; static constexpr const char *InputType = "UBIGINT"; static constexpr const char *DefaultValue = "100"; - static constexpr SetScope DefaultScope = SetScope::GLOBAL; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; + static constexpr idx_t SettingIndex = 14; }; struct CheckpointThresholdSetting { @@ -287,9 +354,9 @@ struct CustomExtensionRepositorySetting { static constexpr const char *Name = "custom_extension_repository"; static constexpr const char *Description = "Overrides the custom endpoint for remote extension installation"; static constexpr const char *InputType = "VARCHAR"; - static void SetGlobal(DatabaseInstance *db, DBConfig &config, const Value ¶meter); - static void ResetGlobal(DatabaseInstance *db, DBConfig &config); - static Value GetSetting(const ClientContext &context); + static constexpr const char *DefaultValue = ""; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; + static constexpr idx_t SettingIndex = 15; }; struct CustomProfilingSettingsSetting { @@ -318,7 +385,8 @@ struct DebugAsofIejoinSetting { static constexpr const char *Description = "DEBUG SETTING: force use of IEJoin to implement AsOf joins"; static constexpr const char *InputType = "BOOLEAN"; static constexpr const char *DefaultValue = "false"; - static constexpr SetScope DefaultScope = SetScope::SESSION; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; + static constexpr idx_t SettingIndex = 16; }; struct DebugCheckpointAbortSetting { @@ -328,7 +396,8 @@ struct DebugCheckpointAbortSetting { "DEBUG SETTING: trigger an abort while checkpointing for testing purposes"; static constexpr const char *InputType = "VARCHAR"; static constexpr const char *DefaultValue = "NONE"; - static constexpr SetScope DefaultScope = SetScope::GLOBAL; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; + static constexpr idx_t SettingIndex = 17; static void OnSet(SettingCallbackInfo &info, Value &input); }; @@ -338,7 +407,8 @@ struct DebugCheckpointSleepMsSetting { static constexpr const char *Description = "DEBUG SETTING: time to sleep before a checkpoint"; static constexpr const char *InputType = "UBIGINT"; static constexpr const char *DefaultValue = "0"; - static constexpr SetScope DefaultScope = SetScope::GLOBAL; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; + static constexpr idx_t SettingIndex = 18; }; struct DebugForceExternalSetting { @@ -359,7 +429,8 @@ struct DebugForceNoCrossProductSetting { "DEBUG SETTING: Force disable cross product generation when hyper graph isn't connected, used for testing"; static constexpr const char *InputType = "BOOLEAN"; static constexpr const char *DefaultValue = "false"; - static constexpr SetScope DefaultScope = SetScope::SESSION; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; + static constexpr idx_t SettingIndex = 19; }; struct DebugPhysicalTableScanExecutionStrategySetting { @@ -369,7 +440,8 @@ struct DebugPhysicalTableScanExecutionStrategySetting { "DEBUG SETTING: force use of given strategy for executing physical table scans"; static constexpr const char *InputType = "VARCHAR"; static constexpr const char *DefaultValue = "DEFAULT"; - static constexpr SetScope DefaultScope = SetScope::GLOBAL; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; + static constexpr idx_t SettingIndex = 20; static void OnSet(SettingCallbackInfo &info, Value &input); }; @@ -379,7 +451,8 @@ struct DebugSkipCheckpointOnCommitSetting { static constexpr const char *Description = "DEBUG SETTING: skip checkpointing on commit"; static constexpr const char *InputType = "BOOLEAN"; static constexpr const char *DefaultValue = "false"; - static constexpr SetScope DefaultScope = SetScope::GLOBAL; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; + static constexpr idx_t SettingIndex = 21; }; struct DebugVerifyBlocksSetting { @@ -388,7 +461,8 @@ struct DebugVerifyBlocksSetting { static constexpr const char *Description = "DEBUG SETTING: verify block metadata during checkpointing"; static constexpr const char *InputType = "BOOLEAN"; static constexpr const char *DefaultValue = "false"; - static constexpr SetScope DefaultScope = SetScope::GLOBAL; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; + static constexpr idx_t SettingIndex = 22; }; struct DebugVerifyVectorSetting { @@ -397,7 +471,8 @@ struct DebugVerifyVectorSetting { static constexpr const char *Description = "DEBUG SETTING: enable vector verification"; static constexpr const char *InputType = "VARCHAR"; static constexpr const char *DefaultValue = "NONE"; - static constexpr SetScope DefaultScope = SetScope::GLOBAL; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; + static constexpr idx_t SettingIndex = 23; static void OnSet(SettingCallbackInfo &info, Value &input); }; @@ -407,7 +482,8 @@ struct DebugWindowModeSetting { static constexpr const char *Description = "DEBUG SETTING: switch window mode to use"; static constexpr const char *InputType = "VARCHAR"; static constexpr const char *DefaultValue = "WINDOW"; - static constexpr SetScope DefaultScope = SetScope::GLOBAL; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; + static constexpr idx_t SettingIndex = 24; static void OnSet(SettingCallbackInfo &info, Value &input); }; @@ -417,9 +493,10 @@ struct DefaultBlockSizeSetting { static constexpr const char *Description = "The default block size for new duckdb database files (new as-in, they do not yet exist)."; static constexpr const char *InputType = "UBIGINT"; - static void SetGlobal(DatabaseInstance *db, DBConfig &config, const Value ¶meter); - static void ResetGlobal(DatabaseInstance *db, DBConfig &config); - static Value GetSetting(const ClientContext &context); + static constexpr const char *DefaultValue = "262144"; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; + static constexpr idx_t SettingIndex = 25; + static void OnSet(SettingCallbackInfo &info, Value &input); }; struct DefaultCollationSetting { @@ -428,7 +505,8 @@ struct DefaultCollationSetting { static constexpr const char *Description = "The collation setting used when none is specified"; static constexpr const char *InputType = "VARCHAR"; static constexpr const char *DefaultValue = ""; - static constexpr SetScope DefaultScope = SetScope::GLOBAL; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; + static constexpr idx_t SettingIndex = 26; static void OnSet(SettingCallbackInfo &info, Value &input); }; @@ -438,7 +516,8 @@ struct DefaultNullOrderSetting { static constexpr const char *Description = "NULL ordering used when none is specified (NULLS_FIRST or NULLS_LAST)"; static constexpr const char *InputType = "VARCHAR"; static constexpr const char *DefaultValue = "NULLS_LAST"; - static constexpr SetScope DefaultScope = SetScope::GLOBAL; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; + static constexpr idx_t SettingIndex = 27; static void OnSet(SettingCallbackInfo &info, Value &input); }; @@ -448,7 +527,8 @@ struct DefaultOrderSetting { static constexpr const char *Description = "The order type used when none is specified (ASC or DESC)"; static constexpr const char *InputType = "VARCHAR"; static constexpr const char *DefaultValue = "ASCENDING"; - static constexpr SetScope DefaultScope = SetScope::GLOBAL; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; + static constexpr idx_t SettingIndex = 28; static void OnSet(SettingCallbackInfo &info, Value &input); }; @@ -469,11 +549,10 @@ struct DisableDatabaseInvalidationSetting { "Disables invalidating the database instance when encountering a fatal error. Should be used with great care, " "as DuckDB cannot guarantee correct behavior after a fatal error."; static constexpr const char *InputType = "BOOLEAN"; - static void SetGlobal(DatabaseInstance *db, DBConfig &config, const Value ¶meter); - static void ResetGlobal(DatabaseInstance *db, DBConfig &config); - static bool OnGlobalSet(DatabaseInstance *db, DBConfig &config, const Value &input); - static bool OnGlobalReset(DatabaseInstance *db, DBConfig &config); - static Value GetSetting(const ClientContext &context); + static constexpr const char *DefaultValue = "false"; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; + static constexpr idx_t SettingIndex = 29; + static void OnSet(SettingCallbackInfo &info, Value &input); }; struct DisableTimestamptzCastsSetting { @@ -482,7 +561,8 @@ struct DisableTimestamptzCastsSetting { static constexpr const char *Description = "Disable casting from timestamp to timestamptz "; static constexpr const char *InputType = "BOOLEAN"; static constexpr const char *DefaultValue = "false"; - static constexpr SetScope DefaultScope = SetScope::SESSION; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; + static constexpr idx_t SettingIndex = 30; }; struct DisabledCompressionMethodsSetting { @@ -530,9 +610,10 @@ struct DuckDBAPISetting { static constexpr const char *Name = "duckdb_api"; static constexpr const char *Description = "DuckDB API surface"; static constexpr const char *InputType = "VARCHAR"; - static void SetGlobal(DatabaseInstance *db, DBConfig &config, const Value ¶meter); - static void ResetGlobal(DatabaseInstance *db, DBConfig &config); - static Value GetSetting(const ClientContext &context); + static constexpr const char *DefaultValue = ""; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; + static constexpr idx_t SettingIndex = 31; + static void OnSet(SettingCallbackInfo &info, Value &input); }; struct DynamicOrFilterThresholdSetting { @@ -542,7 +623,8 @@ struct DynamicOrFilterThresholdSetting { "The maximum amount of OR filters we generate dynamically from a hash join"; static constexpr const char *InputType = "UBIGINT"; static constexpr const char *DefaultValue = "50"; - static constexpr SetScope DefaultScope = SetScope::SESSION; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; + static constexpr idx_t SettingIndex = 32; }; struct EnableExternalAccessSetting { @@ -552,11 +634,10 @@ struct EnableExternalAccessSetting { "Allow the database to access external state (through e.g. loading/installing modules, COPY TO/FROM, CSV " "readers, pandas replacement scans, etc)"; static constexpr const char *InputType = "BOOLEAN"; - static void SetGlobal(DatabaseInstance *db, DBConfig &config, const Value ¶meter); - static void ResetGlobal(DatabaseInstance *db, DBConfig &config); - static bool OnGlobalSet(DatabaseInstance *db, DBConfig &config, const Value &input); - static bool OnGlobalReset(DatabaseInstance *db, DBConfig &config); - static Value GetSetting(const ClientContext &context); + static constexpr const char *DefaultValue = "true"; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; + static constexpr idx_t SettingIndex = 33; + static void OnSet(SettingCallbackInfo &info, Value &input); }; struct EnableExternalFileCacheSetting { @@ -564,9 +645,10 @@ struct EnableExternalFileCacheSetting { static constexpr const char *Name = "enable_external_file_cache"; static constexpr const char *Description = "Allow the database to cache external files (e.g., Parquet) in memory."; static constexpr const char *InputType = "BOOLEAN"; - static void SetGlobal(DatabaseInstance *db, DBConfig &config, const Value ¶meter); - static void ResetGlobal(DatabaseInstance *db, DBConfig &config); - static Value GetSetting(const ClientContext &context); + static constexpr const char *DefaultValue = "true"; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; + static constexpr idx_t SettingIndex = 34; + static void OnSet(SettingCallbackInfo &info, Value &input); }; struct EnableFSSTVectorsSetting { @@ -576,7 +658,8 @@ struct EnableFSSTVectorsSetting { "Allow scans on FSST compressed segments to emit compressed vectors to utilize late decompression"; static constexpr const char *InputType = "BOOLEAN"; static constexpr const char *DefaultValue = "false"; - static constexpr SetScope DefaultScope = SetScope::GLOBAL; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; + static constexpr idx_t SettingIndex = 35; }; struct EnableHTTPLoggingSetting { @@ -594,9 +677,9 @@ struct EnableHTTPMetadataCacheSetting { static constexpr const char *Name = "enable_http_metadata_cache"; static constexpr const char *Description = "Whether or not the global http metadata is used to cache HTTP metadata"; static constexpr const char *InputType = "BOOLEAN"; - static void SetGlobal(DatabaseInstance *db, DBConfig &config, const Value ¶meter); - static void ResetGlobal(DatabaseInstance *db, DBConfig &config); - static Value GetSetting(const ClientContext &context); + static constexpr const char *DefaultValue = "false"; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; + static constexpr idx_t SettingIndex = 36; }; struct EnableLogging { @@ -616,7 +699,8 @@ struct EnableMacroDependenciesSetting { "Enable created MACROs to create dependencies on the referenced objects (such as tables)"; static constexpr const char *InputType = "BOOLEAN"; static constexpr const char *DefaultValue = "false"; - static constexpr SetScope DefaultScope = SetScope::GLOBAL; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; + static constexpr idx_t SettingIndex = 37; }; struct EnableObjectCacheSetting { @@ -625,7 +709,8 @@ struct EnableObjectCacheSetting { static constexpr const char *Description = "[PLACEHOLDER] Legacy setting - does nothing"; static constexpr const char *InputType = "BOOLEAN"; static constexpr const char *DefaultValue = "false"; - static constexpr SetScope DefaultScope = SetScope::GLOBAL; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; + static constexpr idx_t SettingIndex = 38; }; struct EnableProfilingSetting { @@ -670,7 +755,8 @@ struct EnableViewDependenciesSetting { "Enable created VIEWs to create dependencies on the referenced objects (such as tables)"; static constexpr const char *InputType = "BOOLEAN"; static constexpr const char *DefaultValue = "false"; - static constexpr SetScope DefaultScope = SetScope::GLOBAL; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; + static constexpr idx_t SettingIndex = 39; }; struct EnabledLogTypes { @@ -688,9 +774,9 @@ struct ErrorsAsJSONSetting { static constexpr const char *Name = "errors_as_json"; static constexpr const char *Description = "Output error messages as structured JSON instead of as a raw string"; static constexpr const char *InputType = "BOOLEAN"; - static void SetLocal(ClientContext &context, const Value ¶meter); - static void ResetLocal(ClientContext &context); - static Value GetSetting(const ClientContext &context); + static constexpr const char *DefaultValue = "false"; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; + static constexpr idx_t SettingIndex = 40; }; struct ExperimentalMetadataReuseSetting { @@ -699,7 +785,8 @@ struct ExperimentalMetadataReuseSetting { static constexpr const char *Description = "EXPERIMENTAL: Re-use row group and table metadata when checkpointing."; static constexpr const char *InputType = "BOOLEAN"; static constexpr const char *DefaultValue = "true"; - static constexpr SetScope DefaultScope = SetScope::GLOBAL; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; + static constexpr idx_t SettingIndex = 41; }; struct ExplainOutputSetting { @@ -707,9 +794,10 @@ struct ExplainOutputSetting { static constexpr const char *Name = "explain_output"; static constexpr const char *Description = "Output of EXPLAIN statements (ALL, OPTIMIZED_ONLY, PHYSICAL_ONLY)"; static constexpr const char *InputType = "VARCHAR"; - static void SetLocal(ClientContext &context, const Value ¶meter); - static void ResetLocal(ClientContext &context); - static Value GetSetting(const ClientContext &context); + static constexpr const char *DefaultValue = "PHYSICAL_ONLY"; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; + static constexpr idx_t SettingIndex = 42; + static void OnSet(SettingCallbackInfo &info, Value &input); }; struct ExtensionDirectoriesSetting { @@ -727,9 +815,9 @@ struct ExtensionDirectorySetting { static constexpr const char *Name = "extension_directory"; static constexpr const char *Description = "Set the directory to store extensions in"; static constexpr const char *InputType = "VARCHAR"; - static void SetGlobal(DatabaseInstance *db, DBConfig &config, const Value ¶meter); - static void ResetGlobal(DatabaseInstance *db, DBConfig &config); - static Value GetSetting(const ClientContext &context); + static constexpr const char *DefaultValue = ""; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; + static constexpr idx_t SettingIndex = 43; }; struct ExternalThreadsSetting { @@ -737,11 +825,10 @@ struct ExternalThreadsSetting { static constexpr const char *Name = "external_threads"; static constexpr const char *Description = "The number of external threads that work on DuckDB tasks."; static constexpr const char *InputType = "UBIGINT"; - static void SetGlobal(DatabaseInstance *db, DBConfig &config, const Value ¶meter); - static void ResetGlobal(DatabaseInstance *db, DBConfig &config); - static bool OnGlobalSet(DatabaseInstance *db, DBConfig &config, const Value &input); - static bool OnGlobalReset(DatabaseInstance *db, DBConfig &config); - static Value GetSetting(const ClientContext &context); + static constexpr const char *DefaultValue = "1"; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; + static constexpr idx_t SettingIndex = 44; + static void OnSet(SettingCallbackInfo &info, Value &input); }; struct FileSearchPathSetting { @@ -749,29 +836,31 @@ struct FileSearchPathSetting { static constexpr const char *Name = "file_search_path"; static constexpr const char *Description = "A comma separated list of directories to search for input files"; static constexpr const char *InputType = "VARCHAR"; - static void SetLocal(ClientContext &context, const Value ¶meter); - static void ResetLocal(ClientContext &context); - static Value GetSetting(const ClientContext &context); + static constexpr const char *DefaultValue = ""; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; + static constexpr idx_t SettingIndex = 45; }; struct ForceBitpackingModeSetting { - using RETURN_TYPE = string; + using RETURN_TYPE = BitpackingMode; static constexpr const char *Name = "force_bitpacking_mode"; static constexpr const char *Description = "DEBUG SETTING: forces a specific bitpacking mode"; static constexpr const char *InputType = "VARCHAR"; - static void SetGlobal(DatabaseInstance *db, DBConfig &config, const Value ¶meter); - static void ResetGlobal(DatabaseInstance *db, DBConfig &config); - static Value GetSetting(const ClientContext &context); + static constexpr const char *DefaultValue = "AUTO"; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; + static constexpr idx_t SettingIndex = 46; + static void OnSet(SettingCallbackInfo &info, Value &input); }; struct ForceCompressionSetting { - using RETURN_TYPE = string; + using RETURN_TYPE = CompressionType; static constexpr const char *Name = "force_compression"; static constexpr const char *Description = "DEBUG SETTING: forces a specific compression method to be used"; static constexpr const char *InputType = "VARCHAR"; - static void SetGlobal(DatabaseInstance *db, DBConfig &config, const Value ¶meter); - static void ResetGlobal(DatabaseInstance *db, DBConfig &config); - static Value GetSetting(const ClientContext &context); + static constexpr const char *DefaultValue = "auto"; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; + static constexpr idx_t SettingIndex = 47; + static void OnSet(SettingCallbackInfo &info, Value &input); }; struct ForceVariantShredding { @@ -785,14 +874,26 @@ struct ForceVariantShredding { static Value GetSetting(const ClientContext &context); }; +struct GeometryMinimumShreddingSize { + using RETURN_TYPE = int64_t; + static constexpr const char *Name = "geometry_minimum_shredding_size"; + static constexpr const char *Description = "Minimum size of a rowgroup to enable GEOMETRY shredding, or set to -1 " + "to disable entirely. Defaults to 1/4th of a rowgroup"; + static constexpr const char *InputType = "BIGINT"; + static constexpr const char *DefaultValue = "30000"; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; + static constexpr idx_t SettingIndex = 48; +}; + struct HomeDirectorySetting { using RETURN_TYPE = string; static constexpr const char *Name = "home_directory"; static constexpr const char *Description = "Sets the home directory used by the system"; static constexpr const char *InputType = "VARCHAR"; - static void SetLocal(ClientContext &context, const Value ¶meter); - static void ResetLocal(ClientContext &context); - static Value GetSetting(const ClientContext &context); + static constexpr const char *DefaultValue = ""; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; + static constexpr idx_t SettingIndex = 49; + static void OnSet(SettingCallbackInfo &info, Value &input); }; struct HTTPLoggingOutputSetting { @@ -811,9 +912,9 @@ struct HTTPProxySetting { static constexpr const char *Name = "http_proxy"; static constexpr const char *Description = "HTTP proxy host"; static constexpr const char *InputType = "VARCHAR"; - static void SetGlobal(DatabaseInstance *db, DBConfig &config, const Value ¶meter); - static void ResetGlobal(DatabaseInstance *db, DBConfig &config); - static Value GetSetting(const ClientContext &context); + static constexpr const char *DefaultValue = ""; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; + static constexpr idx_t SettingIndex = 50; }; struct HTTPProxyPasswordSetting { @@ -821,9 +922,9 @@ struct HTTPProxyPasswordSetting { static constexpr const char *Name = "http_proxy_password"; static constexpr const char *Description = "Password for HTTP proxy"; static constexpr const char *InputType = "VARCHAR"; - static void SetGlobal(DatabaseInstance *db, DBConfig &config, const Value ¶meter); - static void ResetGlobal(DatabaseInstance *db, DBConfig &config); - static Value GetSetting(const ClientContext &context); + static constexpr const char *DefaultValue = ""; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; + static constexpr idx_t SettingIndex = 51; }; struct HTTPProxyUsernameSetting { @@ -831,9 +932,9 @@ struct HTTPProxyUsernameSetting { static constexpr const char *Name = "http_proxy_username"; static constexpr const char *Description = "Username for HTTP proxy"; static constexpr const char *InputType = "VARCHAR"; - static void SetGlobal(DatabaseInstance *db, DBConfig &config, const Value ¶meter); - static void ResetGlobal(DatabaseInstance *db, DBConfig &config); - static Value GetSetting(const ClientContext &context); + static constexpr const char *DefaultValue = ""; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; + static constexpr idx_t SettingIndex = 52; }; struct IeeeFloatingPointOpsSetting { @@ -843,7 +944,8 @@ struct IeeeFloatingPointOpsSetting { "Use IEE754-compliant floating point operations (returning NAN instead of errors/NULL)."; static constexpr const char *InputType = "BOOLEAN"; static constexpr const char *DefaultValue = "true"; - static constexpr SetScope DefaultScope = SetScope::SESSION; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; + static constexpr idx_t SettingIndex = 53; }; struct ImmediateTransactionModeSetting { @@ -853,7 +955,8 @@ struct ImmediateTransactionModeSetting { "Whether transactions should be started lazily when needed, or immediately when BEGIN TRANSACTION is called"; static constexpr const char *InputType = "BOOLEAN"; static constexpr const char *DefaultValue = "false"; - static constexpr SetScope DefaultScope = SetScope::GLOBAL; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; + static constexpr idx_t SettingIndex = 54; }; struct IndexScanMaxCountSetting { @@ -864,7 +967,8 @@ struct IndexScanMaxCountSetting { "index_scan_percentage * total_row_count) rows match, we perform an index scan instead of a table scan."; static constexpr const char *InputType = "UBIGINT"; static constexpr const char *DefaultValue = "2048"; - static constexpr SetScope DefaultScope = SetScope::GLOBAL; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; + static constexpr idx_t SettingIndex = 55; }; struct IndexScanPercentageSetting { @@ -875,7 +979,8 @@ struct IndexScanPercentageSetting { "index_scan_percentage * total_row_count) rows match, we perform an index scan instead of a table scan."; static constexpr const char *InputType = "DOUBLE"; static constexpr const char *DefaultValue = "0.001"; - static constexpr SetScope DefaultScope = SetScope::GLOBAL; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; + static constexpr idx_t SettingIndex = 56; static void OnSet(SettingCallbackInfo &info, Value &input); }; @@ -886,18 +991,20 @@ struct IntegerDivisionSetting { "Whether or not the / operator defaults to integer division, or to floating point division"; static constexpr const char *InputType = "BOOLEAN"; static constexpr const char *DefaultValue = "false"; - static constexpr SetScope DefaultScope = SetScope::SESSION; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; + static constexpr idx_t SettingIndex = 57; }; struct LambdaSyntaxSetting { - using RETURN_TYPE = string; + using RETURN_TYPE = LambdaSyntax; static constexpr const char *Name = "lambda_syntax"; static constexpr const char *Description = "Configures the use of the deprecated single arrow operator (->) for lambda functions."; static constexpr const char *InputType = "VARCHAR"; - static void SetLocal(ClientContext &context, const Value ¶meter); - static void ResetLocal(ClientContext &context); - static Value GetSetting(const ClientContext &context); + static constexpr const char *DefaultValue = "DEFAULT"; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; + static constexpr idx_t SettingIndex = 58; + static void OnSet(SettingCallbackInfo &info, Value &input); }; struct LateMaterializationMaxRowsSetting { @@ -907,7 +1014,8 @@ struct LateMaterializationMaxRowsSetting { "The maximum amount of rows in the LIMIT/SAMPLE for which we trigger late materialization"; static constexpr const char *InputType = "UBIGINT"; static constexpr const char *DefaultValue = "50"; - static constexpr SetScope DefaultScope = SetScope::SESSION; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; + static constexpr idx_t SettingIndex = 59; }; struct LockConfigurationSetting { @@ -915,9 +1023,9 @@ struct LockConfigurationSetting { static constexpr const char *Name = "lock_configuration"; static constexpr const char *Description = "Whether or not the configuration can be altered"; static constexpr const char *InputType = "BOOLEAN"; - static void SetGlobal(DatabaseInstance *db, DBConfig &config, const Value ¶meter); - static void ResetGlobal(DatabaseInstance *db, DBConfig &config); - static Value GetSetting(const ClientContext &context); + static constexpr const char *DefaultValue = "false"; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; + static constexpr idx_t SettingIndex = 60; }; struct LogQueryPathSetting { @@ -926,9 +1034,10 @@ struct LogQueryPathSetting { static constexpr const char *Description = "Specifies the path to which queries should be logged (default: NULL, queries are not logged)"; static constexpr const char *InputType = "VARCHAR"; - static void SetLocal(ClientContext &context, const Value ¶meter); - static void ResetLocal(ClientContext &context); - static Value GetSetting(const ClientContext &context); + static constexpr const char *DefaultValue = ""; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; + static constexpr idx_t SettingIndex = 61; + static void OnSet(SettingCallbackInfo &info, Value &input); }; struct LoggingLevel { @@ -968,9 +1077,9 @@ struct MaxExpressionDepthSetting { "The maximum expression depth limit in the parser. WARNING: increasing this setting and using very deep " "expressions might lead to stack overflow errors."; static constexpr const char *InputType = "UBIGINT"; - static void SetLocal(ClientContext &context, const Value ¶meter); - static void ResetLocal(ClientContext &context); - static Value GetSetting(const ClientContext &context); + static constexpr const char *DefaultValue = "1000"; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; + static constexpr idx_t SettingIndex = 62; }; struct MaxMemorySetting { @@ -1000,7 +1109,8 @@ struct MaxVacuumTasksSetting { static constexpr const char *Description = "The maximum vacuum tasks to schedule during a checkpoint."; static constexpr const char *InputType = "UBIGINT"; static constexpr const char *DefaultValue = "100"; - static constexpr SetScope DefaultScope = SetScope::GLOBAL; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; + static constexpr idx_t SettingIndex = 63; }; struct MergeJoinThresholdSetting { @@ -1009,7 +1119,8 @@ struct MergeJoinThresholdSetting { static constexpr const char *Description = "The maximum number of rows on either table to choose a merge join"; static constexpr const char *InputType = "UBIGINT"; static constexpr const char *DefaultValue = "1000"; - static constexpr SetScope DefaultScope = SetScope::SESSION; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; + static constexpr idx_t SettingIndex = 64; }; struct NestedLoopJoinThresholdSetting { @@ -1019,7 +1130,8 @@ struct NestedLoopJoinThresholdSetting { "The maximum number of rows on either table to choose a nested loop join"; static constexpr const char *InputType = "UBIGINT"; static constexpr const char *DefaultValue = "5"; - static constexpr SetScope DefaultScope = SetScope::SESSION; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; + static constexpr idx_t SettingIndex = 65; }; struct OldImplicitCastingSetting { @@ -1028,7 +1140,8 @@ struct OldImplicitCastingSetting { static constexpr const char *Description = "Allow implicit casting to/from VARCHAR"; static constexpr const char *InputType = "BOOLEAN"; static constexpr const char *DefaultValue = "false"; - static constexpr SetScope DefaultScope = SetScope::GLOBAL; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; + static constexpr idx_t SettingIndex = 66; }; struct OrderByNonIntegerLiteralSetting { @@ -1038,7 +1151,8 @@ struct OrderByNonIntegerLiteralSetting { "Allow ordering by non-integer literals - ordering by such literals has no effect."; static constexpr const char *InputType = "BOOLEAN"; static constexpr const char *DefaultValue = "false"; - static constexpr SetScope DefaultScope = SetScope::SESSION; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; + static constexpr idx_t SettingIndex = 67; }; struct OrderedAggregateThresholdSetting { @@ -1047,7 +1161,8 @@ struct OrderedAggregateThresholdSetting { static constexpr const char *Description = "The number of rows to accumulate before sorting, used for tuning"; static constexpr const char *InputType = "UBIGINT"; static constexpr const char *DefaultValue = "262144"; - static constexpr SetScope DefaultScope = SetScope::SESSION; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; + static constexpr idx_t SettingIndex = 68; static void OnSet(SettingCallbackInfo &info, Value &input); }; @@ -1058,7 +1173,8 @@ struct PartitionedWriteFlushThresholdSetting { "The threshold in number of rows after which we flush a thread state when writing using PARTITION_BY"; static constexpr const char *InputType = "UBIGINT"; static constexpr const char *DefaultValue = "524288"; - static constexpr SetScope DefaultScope = SetScope::SESSION; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; + static constexpr idx_t SettingIndex = 69; }; struct PartitionedWriteMaxOpenFilesSetting { @@ -1068,7 +1184,8 @@ struct PartitionedWriteMaxOpenFilesSetting { "The maximum amount of files the system can keep open before flushing to disk when writing using PARTITION_BY"; static constexpr const char *InputType = "UBIGINT"; static constexpr const char *DefaultValue = "100"; - static constexpr SetScope DefaultScope = SetScope::SESSION; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; + static constexpr idx_t SettingIndex = 70; }; struct PasswordSetting { @@ -1076,9 +1193,9 @@ struct PasswordSetting { static constexpr const char *Name = "password"; static constexpr const char *Description = "The password to use. Ignored for legacy compatibility."; static constexpr const char *InputType = "VARCHAR"; - static void SetGlobal(DatabaseInstance *db, DBConfig &config, const Value ¶meter); - static void ResetGlobal(DatabaseInstance *db, DBConfig &config); - static Value GetSetting(const ClientContext &context); + static constexpr const char *DefaultValue = ""; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; + static constexpr idx_t SettingIndex = 71; }; struct PerfectHtThresholdSetting { @@ -1087,7 +1204,8 @@ struct PerfectHtThresholdSetting { static constexpr const char *Description = "Threshold in bytes for when to use a perfect hash table"; static constexpr const char *InputType = "UBIGINT"; static constexpr const char *DefaultValue = "12"; - static constexpr SetScope DefaultScope = SetScope::SESSION; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; + static constexpr idx_t SettingIndex = 72; static void OnSet(SettingCallbackInfo &info, Value &input); }; @@ -1097,9 +1215,10 @@ struct PinThreadsSetting { static constexpr const char *Description = "Whether to pin threads to cores (Linux only, default AUTO: on when there are more than 64 cores)"; static constexpr const char *InputType = "VARCHAR"; - static void SetGlobal(DatabaseInstance *db, DBConfig &config, const Value ¶meter); - static void ResetGlobal(DatabaseInstance *db, DBConfig &config); - static Value GetSetting(const ClientContext &context); + static constexpr const char *DefaultValue = "auto"; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; + static constexpr idx_t SettingIndex = 73; + static void OnSet(SettingCallbackInfo &info, Value &input); }; struct PivotFilterThresholdSetting { @@ -1109,7 +1228,8 @@ struct PivotFilterThresholdSetting { "The threshold to switch from using filtered aggregates to LIST with a dedicated pivot operator"; static constexpr const char *InputType = "UBIGINT"; static constexpr const char *DefaultValue = "20"; - static constexpr SetScope DefaultScope = SetScope::SESSION; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; + static constexpr idx_t SettingIndex = 74; }; struct PivotLimitSetting { @@ -1118,7 +1238,8 @@ struct PivotLimitSetting { static constexpr const char *Description = "The maximum number of pivot columns in a pivot statement"; static constexpr const char *InputType = "UBIGINT"; static constexpr const char *DefaultValue = "100000"; - static constexpr SetScope DefaultScope = SetScope::SESSION; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; + static constexpr idx_t SettingIndex = 75; }; struct PreferRangeJoinsSetting { @@ -1127,7 +1248,8 @@ struct PreferRangeJoinsSetting { static constexpr const char *Description = "Force use of range joins with mixed predicates"; static constexpr const char *InputType = "BOOLEAN"; static constexpr const char *DefaultValue = "false"; - static constexpr SetScope DefaultScope = SetScope::SESSION; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; + static constexpr idx_t SettingIndex = 76; }; struct PreserveIdentifierCaseSetting { @@ -1137,7 +1259,8 @@ struct PreserveIdentifierCaseSetting { "Whether or not to preserve the identifier case, instead of always lowercasing all non-quoted identifiers"; static constexpr const char *InputType = "BOOLEAN"; static constexpr const char *DefaultValue = "true"; - static constexpr SetScope DefaultScope = SetScope::SESSION; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; + static constexpr idx_t SettingIndex = 77; }; struct PreserveInsertionOrderSetting { @@ -1148,7 +1271,8 @@ struct PreserveInsertionOrderSetting { "that do not contain ORDER BY clauses."; static constexpr const char *InputType = "BOOLEAN"; static constexpr const char *DefaultValue = "true"; - static constexpr SetScope DefaultScope = SetScope::GLOBAL; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; + static constexpr idx_t SettingIndex = 78; }; struct ProduceArrowStringViewSetting { @@ -1158,7 +1282,8 @@ struct ProduceArrowStringViewSetting { "Whether Arrow strings should be produced by DuckDB in Utf8View format instead of Utf8"; static constexpr const char *InputType = "BOOLEAN"; static constexpr const char *DefaultValue = "false"; - static constexpr SetScope DefaultScope = SetScope::GLOBAL; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; + static constexpr idx_t SettingIndex = 79; }; struct ProfileOutputSetting { @@ -1210,7 +1335,8 @@ struct ScalarSubqueryErrorOnMultipleRowsSetting { "When a scalar subquery returns multiple rows - return a random row instead of returning an error."; static constexpr const char *InputType = "BOOLEAN"; static constexpr const char *DefaultValue = "true"; - static constexpr SetScope DefaultScope = SetScope::SESSION; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; + static constexpr idx_t SettingIndex = 80; }; struct SchedulerProcessPartialSetting { @@ -1219,9 +1345,13 @@ struct SchedulerProcessPartialSetting { static constexpr const char *Description = "Partially process tasks before rescheduling - allows for more scheduler fairness between separate queries"; static constexpr const char *InputType = "BOOLEAN"; - static void SetGlobal(DatabaseInstance *db, DBConfig &config, const Value ¶meter); - static void ResetGlobal(DatabaseInstance *db, DBConfig &config); - static Value GetSetting(const ClientContext &context); +#ifdef DUCKDB_ALTERNATIVE_VERIFY + static constexpr const char *DefaultValue = "true"; +#else + static constexpr const char *DefaultValue = "false"; +#endif + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; + static constexpr idx_t SettingIndex = 81; }; struct SchemaSetting { @@ -1262,7 +1392,8 @@ struct StorageBlockPrefetchSetting { static constexpr const char *Description = "In which scenarios to use storage block prefetching"; static constexpr const char *InputType = "VARCHAR"; static constexpr const char *DefaultValue = "REMOTE_ONLY"; - static constexpr SetScope DefaultScope = SetScope::GLOBAL; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; + static constexpr idx_t SettingIndex = 82; static void OnSet(SettingCallbackInfo &info, Value &input); }; @@ -1302,9 +1433,10 @@ struct TempFileEncryptionSetting { static constexpr const char *Name = "temp_file_encryption"; static constexpr const char *Description = "Encrypt all temporary files if database is encrypted"; static constexpr const char *InputType = "BOOLEAN"; - static void SetGlobal(DatabaseInstance *db, DBConfig &config, const Value ¶meter); - static void ResetGlobal(DatabaseInstance *db, DBConfig &config); - static Value GetSetting(const ClientContext &context); + static constexpr const char *DefaultValue = "false"; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; + static constexpr idx_t SettingIndex = 83; + static void OnSet(SettingCallbackInfo &info, Value &input); }; struct ThreadsSetting { @@ -1322,9 +1454,9 @@ struct UsernameSetting { static constexpr const char *Name = "username"; static constexpr const char *Description = "The username to use. Ignored for legacy compatibility."; static constexpr const char *InputType = "VARCHAR"; - static void SetGlobal(DatabaseInstance *db, DBConfig &config, const Value ¶meter); - static void ResetGlobal(DatabaseInstance *db, DBConfig &config); - static Value GetSetting(const ClientContext &context); + static constexpr const char *DefaultValue = ""; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; + static constexpr idx_t SettingIndex = 84; }; struct ValidateExternalFileCacheSetting { @@ -1335,19 +1467,20 @@ struct ValidateExternalFileCacheSetting { "remote cache entries), or NO_VALIDATION (disable cache validation)."; static constexpr const char *InputType = "VARCHAR"; static constexpr const char *DefaultValue = "VALIDATE_ALL"; - static constexpr SetScope DefaultScope = SetScope::GLOBAL; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; + static constexpr idx_t SettingIndex = 85; static void OnSet(SettingCallbackInfo &info, Value &input); }; -struct VariantMinimumShreddingSize { +struct VariantMinimumShreddingSizeSetting { using RETURN_TYPE = int64_t; static constexpr const char *Name = "variant_minimum_shredding_size"; static constexpr const char *Description = "Minimum size of a rowgroup to enable VARIANT shredding, or set to -1 " "to disable entirely. Defaults to 1/4th of a rowgroup"; static constexpr const char *InputType = "BIGINT"; - static void SetGlobal(DatabaseInstance *db, DBConfig &config, const Value ¶meter); - static void ResetGlobal(DatabaseInstance *db, DBConfig &config); - static Value GetSetting(const ClientContext &context); + static constexpr const char *DefaultValue = "30000"; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; + static constexpr idx_t SettingIndex = 86; }; struct WriteBufferRowGroupCountSetting { @@ -1357,7 +1490,8 @@ struct WriteBufferRowGroupCountSetting { "them together. Reducing this setting can reduce memory consumption."; static constexpr const char *InputType = "UBIGINT"; static constexpr const char *DefaultValue = "5"; - static constexpr SetScope DefaultScope = SetScope::GLOBAL; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; + static constexpr idx_t SettingIndex = 87; }; struct ZstdMinStringLengthSetting { @@ -1366,9 +1500,13 @@ struct ZstdMinStringLengthSetting { static constexpr const char *Description = "The (average) length at which to enable ZSTD compression, defaults to 4096"; static constexpr const char *InputType = "UBIGINT"; - static void SetGlobal(DatabaseInstance *db, DBConfig &config, const Value ¶meter); - static void ResetGlobal(DatabaseInstance *db, DBConfig &config); - static Value GetSetting(const ClientContext &context); + static constexpr const char *DefaultValue = "4096"; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; + static constexpr idx_t SettingIndex = 88; +}; + +struct GeneratedSettingInfo { + static constexpr idx_t MaxSettingIndex = 89; }; //===----------------------------------------------------------------------===// diff --git a/src/duckdb/src/include/duckdb/main/user_settings.hpp b/src/duckdb/src/include/duckdb/main/user_settings.hpp new file mode 100644 index 000000000..7354805df --- /dev/null +++ b/src/duckdb/src/include/duckdb/main/user_settings.hpp @@ -0,0 +1,88 @@ +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/main/user_settings.hpp +// +// +//===----------------------------------------------------------------------===// + +#pragma once + +#include "duckdb/common/common.hpp" +#include "duckdb/common/mutex.hpp" +#include "duckdb/common/types/value.hpp" +#include "duckdb/main/setting_info.hpp" +#include "duckdb/common/atomic.hpp" + +namespace duckdb { + +struct GenericSetting { + GenericSetting() : is_set(false) { + } + + bool is_set; + Value value; +}; + +struct UserSettingsMap { +public: + void SetUserSetting(idx_t setting_index, Value target_value); + void ClearSetting(idx_t setting_index); + bool IsSet(idx_t setting_index) const; + bool TryGetSetting(idx_t setting_index, Value &result_value) const; + +private: + vector settings; +}; + +struct CachedGlobalSettings { + CachedGlobalSettings(idx_t version, UserSettingsMap settings); + + idx_t version; + UserSettingsMap settings; +}; + +struct GlobalUserSettings { +public: + GlobalUserSettings(); + // enable copy constructors + GlobalUserSettings(const GlobalUserSettings &other); + GlobalUserSettings &operator=(const GlobalUserSettings &); + + void SetUserSetting(idx_t setting_index, Value target_value); + void ClearSetting(idx_t setting_index); + bool IsSet(idx_t setting_index) const; + SettingLookupResult TryGetSetting(idx_t setting_index, Value &result_value) const; + bool HasExtensionOption(const string &name) const; + idx_t AddExtensionOption(const string &name, ExtensionOption extension_option); + case_insensitive_map_t GetExtensionSettings() const; + bool TryGetExtensionOption(const String &name, ExtensionOption &result) const; + shared_ptr GetSettings(shared_ptr &cache) const; + +private: + mutable mutex lock; + //! Database-global settings + UserSettingsMap settings_map; + //! Extra parameters that can be SET for loaded extensions + case_insensitive_map_t extension_parameters; + //! Current version of the settings - incremented when settings are modified + atomic settings_version; +}; + +struct LocalUserSettings { +public: + ~LocalUserSettings(); + + void SetUserSetting(idx_t setting_index, Value target_value); + void ClearSetting(idx_t setting_index); + bool IsSet(idx_t setting_index) const; + SettingLookupResult TryGetSetting(const GlobalUserSettings &global_settings, idx_t setting_index, + Value &result_value) const; + +private: + //! Client-local settings + UserSettingsMap settings_map; + //! Cache of global settings - used to allow lock-free access to global settings in a thread-safe manner + mutable shared_ptr global_settings_cache; +}; +} // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/optimizer/expression_heuristics.hpp b/src/duckdb/src/include/duckdb/optimizer/expression_heuristics.hpp index 49bb11e5b..0ae354854 100644 --- a/src/duckdb/src/include/duckdb/optimizer/expression_heuristics.hpp +++ b/src/duckdb/src/include/duckdb/optimizer/expression_heuristics.hpp @@ -46,6 +46,6 @@ class ExpressionHeuristics : public LogicalOperatorVisitor { static idx_t ExpressionCost(BoundFunctionExpression &expr); static idx_t ExpressionCost(BoundOperatorExpression &expr, ExpressionType expr_type); static idx_t ExpressionCost(PhysicalType return_type, idx_t multiplier); - static idx_t Cost(TableFilter &filter); + static idx_t Cost(const TableFilter &filter); }; } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/optimizer/join_order/relation_statistics_helper.hpp b/src/duckdb/src/include/duckdb/optimizer/join_order/relation_statistics_helper.hpp index 060274b36..b6a34facc 100644 --- a/src/duckdb/src/include/duckdb/optimizer/join_order/relation_statistics_helper.hpp +++ b/src/duckdb/src/include/duckdb/optimizer/join_order/relation_statistics_helper.hpp @@ -57,7 +57,7 @@ class RelationStatisticsHelper { static constexpr double DEFAULT_SELECTIVITY = 0.2; public: - static idx_t InspectTableFilter(idx_t cardinality, idx_t column_index, TableFilter &filter, + static idx_t InspectTableFilter(idx_t cardinality, idx_t column_index, const TableFilter &filter, BaseStatistics &base_stats); // static idx_t InspectConjunctionOR(idx_t cardinality, idx_t column_index, ConjunctionOrFilter &filter, // BaseStatistics &base_stats); diff --git a/src/duckdb/src/include/duckdb/optimizer/remove_unused_columns.hpp b/src/duckdb/src/include/duckdb/optimizer/remove_unused_columns.hpp index 4d02f224c..a4fad42ac 100644 --- a/src/duckdb/src/include/duckdb/optimizer/remove_unused_columns.hpp +++ b/src/duckdb/src/include/duckdb/optimizer/remove_unused_columns.hpp @@ -89,13 +89,16 @@ class BaseColumnPruner : public LogicalOperatorVisitor { //! ret: The amount of bindings created idx_t ReplaceBinding(ColumnBinding current_binding, ColumnBinding new_binding); - bool HandleStructExtract(unique_ptr *expression, - optional_ptr> cast_expression = nullptr); - - bool HandleStructExtractRecursive(unique_ptr &expr, optional_ptr &colref, - vector &indexes, vector &expressions); + bool HandleExtractExpression(unique_ptr *expression, + optional_ptr> cast_expression = nullptr); + + bool HandleStructExtract(unique_ptr &expr, optional_ptr &colref, + reference &path_ref, vector &expressions); + bool HandleVariantExtract(unique_ptr &expr, optional_ptr &colref, + reference &path_ref, vector &expressions); + bool HandleExtractRecursive(unique_ptr &expr, optional_ptr &colref, + reference &path_ref, vector &expressions); void SetMode(BaseColumnPrunerMode mode); - bool HandleStructPack(Expression &expr); BaseColumnPrunerMode GetMode() const; private: @@ -134,6 +137,6 @@ class RemoveUnusedColumns : public BaseColumnPruner { void RewriteExpressions(LogicalProjection &proj, idx_t expression_count); void WritePushdownExtractColumns( const ColumnBinding &binding, ReferencedColumn &col, idx_t original_idx, const LogicalType &column_type, - const std::function cast_type)> &callback); + const std::function cast_type)> &callback); }; } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/optimizer/rule/list.hpp b/src/duckdb/src/include/duckdb/optimizer/rule/list.hpp index b6cfcba69..312fa7d93 100644 --- a/src/duckdb/src/include/duckdb/optimizer/rule/list.hpp +++ b/src/duckdb/src/include/duckdb/optimizer/rule/list.hpp @@ -10,7 +10,6 @@ #include "duckdb/optimizer/rule/empty_needle_removal.hpp" #include "duckdb/optimizer/rule/like_optimizations.hpp" #include "duckdb/optimizer/rule/move_constants.hpp" -#include "duckdb/optimizer/rule/not_elimination.hpp" #include "duckdb/optimizer/rule/enum_comparison.hpp" #include "duckdb/optimizer/rule/regex_optimizations.hpp" #include "duckdb/optimizer/rule/ordered_aggregate_optimizer.hpp" diff --git a/src/duckdb/src/include/duckdb/optimizer/rule/not_elimination.hpp b/src/duckdb/src/include/duckdb/optimizer/rule/not_elimination.hpp deleted file mode 100644 index b01ca788c..000000000 --- a/src/duckdb/src/include/duckdb/optimizer/rule/not_elimination.hpp +++ /dev/null @@ -1,31 +0,0 @@ -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/optimizer/rule/not_elimination.hpp -// -// -//===----------------------------------------------------------------------===// - -#pragma once - -#include "duckdb/optimizer/rule.hpp" - -namespace duckdb { - -// Eliminate the NOT operator expression with following rules. -// 1. NOT NOT Expression ==> Expression -// 2. NOT IS_NOT_NULL/IS_NULL ==> IS_NULL/IS_NOT_NULL -// 3. NOT (Expression1 AND Expression2) ==> !Expression1 OR !Expression2 -// 4. NOT (Expression1 OR Expression2) ==> !Expression1 AND !Expression2 -class NotEliminationRule : public Rule { -public: - explicit NotEliminationRule(ExpressionRewriter &rewriter); - - unique_ptr Apply(LogicalOperator &op, vector> &bindings, bool &changes_made, - bool is_root) override; - -private: - unique_ptr NegateExpression(const Expression &expr); -}; - -} // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/optimizer/statistics_propagator.hpp b/src/duckdb/src/include/duckdb/optimizer/statistics_propagator.hpp index 1ec4acaa9..08340b0a5 100644 --- a/src/duckdb/src/include/duckdb/optimizer/statistics_propagator.hpp +++ b/src/duckdb/src/include/duckdb/optimizer/statistics_propagator.hpp @@ -81,7 +81,7 @@ class StatisticsPropagator { //! Run a comparison between the statistics and the table filter; returns the prune result FilterPropagateResult PropagateTableFilter(ColumnBinding stats_binding, BaseStatistics &stats, TableFilter &filter); //! Update filter statistics from a TableFilter - void UpdateFilterStatistics(BaseStatistics &input, TableFilter &filter); + void UpdateFilterStatistics(BaseStatistics &input, const TableFilter &filter); //! Add cardinalities together (i.e. new max is stats.max + new_stats.max): used for union void AddCardinalities(unique_ptr &stats, NodeStatistics &new_stats); diff --git a/src/duckdb/src/include/duckdb/optimizer/window_self_join.hpp b/src/duckdb/src/include/duckdb/optimizer/window_self_join.hpp index dc9c0a300..bac7e9976 100644 --- a/src/duckdb/src/include/duckdb/optimizer/window_self_join.hpp +++ b/src/duckdb/src/include/duckdb/optimizer/window_self_join.hpp @@ -21,6 +21,7 @@ class WindowSelfJoinOptimizer { unique_ptr Optimize(unique_ptr op); private: + bool CanOptimize(const BoundWindowExpression &w_expr, const BoundWindowExpression &w_expr0) const; unique_ptr OptimizeInternal(unique_ptr op, ColumnBindingReplacer &replacer); Optimizer &optimizer; diff --git a/src/duckdb/src/include/duckdb/parser/expression/lambda_expression.hpp b/src/duckdb/src/include/duckdb/parser/expression/lambda_expression.hpp index 276edf418..08c02f835 100644 --- a/src/duckdb/src/include/duckdb/parser/expression/lambda_expression.hpp +++ b/src/duckdb/src/include/duckdb/parser/expression/lambda_expression.hpp @@ -11,10 +11,10 @@ #include "duckdb/common/unordered_set.hpp" #include "duckdb/common/vector.hpp" #include "duckdb/parser/parsed_expression.hpp" +#include "duckdb/common/enums/lambda_syntax.hpp" namespace duckdb { -enum class LambdaSyntax : uint8_t { DEFAULT = 0, ENABLE_SINGLE_ARROW = 1, DISABLE_SINGLE_ARROW = 2 }; enum class LambdaSyntaxType : uint8_t { SINGLE_ARROW_STORAGE = 0, SINGLE_ARROW = 1, LAMBDA_KEYWORD = 2 }; //! DuckDB 1.3. introduced a new lambda syntax: lambda x, y: x + y. diff --git a/src/duckdb/src/include/duckdb/parser/parsed_data/create_table_info.hpp b/src/duckdb/src/include/duckdb/parser/parsed_data/create_table_info.hpp index 84423dc59..6004d428f 100644 --- a/src/duckdb/src/include/duckdb/parser/parsed_data/create_table_info.hpp +++ b/src/duckdb/src/include/duckdb/parser/parsed_data/create_table_info.hpp @@ -29,6 +29,12 @@ struct CreateTableInfo : public CreateInfo { vector> constraints; //! CREATE TABLE as QUERY unique_ptr query; + //! Table Partition definitions + vector> partition_keys; + //! Table Sort definitions + vector> sort_keys; + //! Extra Table options if any + case_insensitive_map_t> options; public: DUCKDB_API unique_ptr Copy() const override; diff --git a/src/duckdb/src/include/duckdb/parser/parser_options.hpp b/src/duckdb/src/include/duckdb/parser/parser_options.hpp index d9a42632a..2a83b6ad3 100644 --- a/src/duckdb/src/include/duckdb/parser/parser_options.hpp +++ b/src/duckdb/src/include/duckdb/parser/parser_options.hpp @@ -9,6 +9,7 @@ #pragma once #include "duckdb/common/common.hpp" +#include "duckdb/common/enums/allow_parser_override.hpp" namespace duckdb { class ParserExtension; @@ -18,7 +19,7 @@ struct ParserOptions { bool integer_division = false; idx_t max_expression_depth = 1000; const vector *extensions = nullptr; - string parser_override_setting = "default"; + AllowParserOverride parser_override_setting = AllowParserOverride::DEFAULT_OVERRIDE; }; } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/parser/tableref/showref.hpp b/src/duckdb/src/include/duckdb/parser/tableref/showref.hpp index 163bf66ad..78a1e1266 100644 --- a/src/duckdb/src/include/duckdb/parser/tableref/showref.hpp +++ b/src/duckdb/src/include/duckdb/parser/tableref/showref.hpp @@ -14,7 +14,7 @@ namespace duckdb { -enum class ShowType : uint8_t { SUMMARY, DESCRIBE, SHOW_FROM }; +enum class ShowType : uint8_t { SUMMARY, DESCRIBE, SHOW_FROM, SHOW_UNQUALIFIED }; //! Represents a SHOW/DESCRIBE/SUMMARIZE statement class ShowRef : public TableRef { diff --git a/src/duckdb/src/include/duckdb/parser/transformer.hpp b/src/duckdb/src/include/duckdb/parser/transformer.hpp index 8a8ba2ecb..de6eb2c4d 100644 --- a/src/duckdb/src/include/duckdb/parser/transformer.hpp +++ b/src/duckdb/src/include/duckdb/parser/transformer.hpp @@ -156,6 +156,8 @@ class Transformer { unique_ptr TransformCopy(duckdb_libpgquery::PGCopyStmt &stmt); void TransformCopyOptions(CopyInfo &info, optional_ptr options); void TransformCreateSecretOptions(CreateSecretInfo &info, optional_ptr options); + void TransformTableOptions(case_insensitive_map_t> &info, + optional_ptr options); //! Transform a Postgres duckdb_libpgquery::T_PGTransactionStmt node into a TransactionStatement unique_ptr TransformTransaction(duckdb_libpgquery::PGTransactionStmt &stmt); //! Transform a Postgres T_DeleteStatement node into a DeleteStatement diff --git a/src/duckdb/src/include/duckdb/planner/expression_binder/having_binder.hpp b/src/duckdb/src/include/duckdb/planner/expression_binder/having_binder.hpp index b111cc368..02c70229a 100644 --- a/src/duckdb/src/include/duckdb/planner/expression_binder/having_binder.hpp +++ b/src/duckdb/src/include/duckdb/planner/expression_binder/having_binder.hpp @@ -27,6 +27,8 @@ class HavingBinder : public BaseSelectBinder { unique_ptr QualifyColumnName(ColumnRefExpression &col_ref, ErrorData &error) override; + bool DoesColumnAliasExist(const ColumnRefExpression &colref) override; + private: ColumnAliasBinder column_alias_binder; AggregateHandling aggregate_handling; diff --git a/src/duckdb/src/include/duckdb/storage/caching_file_system_wrapper.hpp b/src/duckdb/src/include/duckdb/storage/caching_file_system_wrapper.hpp index 005c6563d..3e1f9ec39 100644 --- a/src/duckdb/src/include/duckdb/storage/caching_file_system_wrapper.hpp +++ b/src/duckdb/src/include/duckdb/storage/caching_file_system_wrapper.hpp @@ -101,7 +101,6 @@ class CachingFileSystemWrapper : public FileSystem, public enable_shared_from_th DUCKDB_API void RegisterSubSystem(unique_ptr sub_fs) override; DUCKDB_API void RegisterSubSystem(FileCompressionType compression_type, unique_ptr fs) override; - DUCKDB_API void UnregisterSubSystem(const string &name) override; DUCKDB_API unique_ptr ExtractSubSystem(const string &name) override; DUCKDB_API vector ListSubSystems() override; DUCKDB_API bool CanHandleFile(const string &fpath) override; diff --git a/src/duckdb/src/include/duckdb/storage/compression/bitpacking.hpp b/src/duckdb/src/include/duckdb/storage/compression/bitpacking.hpp index 6b87e5bb1..0e1131f8f 100644 --- a/src/duckdb/src/include/duckdb/storage/compression/bitpacking.hpp +++ b/src/duckdb/src/include/duckdb/storage/compression/bitpacking.hpp @@ -14,7 +14,4 @@ namespace duckdb { enum class BitpackingMode : uint8_t { INVALID, AUTO, CONSTANT, CONSTANT_DELTA, DELTA_FOR, FOR }; -BitpackingMode BitpackingModeFromString(const string &str); -string BitpackingModeToString(const BitpackingMode &mode); - } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/storage/single_file_block_manager.hpp b/src/duckdb/src/include/duckdb/storage/single_file_block_manager.hpp index 7a2dce826..7819ccf00 100644 --- a/src/duckdb/src/include/duckdb/storage/single_file_block_manager.hpp +++ b/src/duckdb/src/include/duckdb/storage/single_file_block_manager.hpp @@ -38,6 +38,8 @@ struct EncryptionOptions { uint32_t key_length = MainHeader::DEFAULT_ENCRYPTION_KEY_LENGTH; //! User key pointer (to StorageOptions) shared_ptr user_key; + //! Version of duckdb-encryption + EncryptionTypes::EncryptionVersion encryption_version = EncryptionTypes::NONE; }; struct StorageManagerOptions { @@ -156,6 +158,8 @@ class SingleFileBlockManager : public BlockManager { static void StoreEncryptedCanary(AttachedDatabase &db, MainHeader &main_header, const string &key_id); static void StoreDBIdentifier(MainHeader &main_header, const data_ptr_t db_identifier); void StoreEncryptionMetadata(MainHeader &main_header) const; + template + static void WriteEncryptionData(MemoryStream &stream, const T &val); //! Check and adding Encryption Keys void CheckAndAddEncryptionKey(MainHeader &main_header, string &user_key); diff --git a/src/duckdb/src/include/duckdb/storage/standard_buffer_manager.hpp b/src/duckdb/src/include/duckdb/storage/standard_buffer_manager.hpp index 6b88247d0..e6585e982 100644 --- a/src/duckdb/src/include/duckdb/storage/standard_buffer_manager.hpp +++ b/src/duckdb/src/include/duckdb/storage/standard_buffer_manager.hpp @@ -163,6 +163,8 @@ class StandardBufferManager : public BufferManager { void BatchRead(vector> &handles, const map &load_map, block_id_t first_block, block_id_t last_block); + bool EncryptTemporaryFiles(); + protected: // These are stored here because temp_directory creation is lazy // so we need to store information related to the temporary directory before it's created diff --git a/src/duckdb/src/include/duckdb/storage/statistics/base_statistics.hpp b/src/duckdb/src/include/duckdb/storage/statistics/base_statistics.hpp index 237ddec7e..203fdef6e 100644 --- a/src/duckdb/src/include/duckdb/storage/statistics/base_statistics.hpp +++ b/src/duckdb/src/include/duckdb/storage/statistics/base_statistics.hpp @@ -89,7 +89,7 @@ class BaseStatistics { void Set(StatsInfo info); void CombineValidity(const BaseStatistics &left, const BaseStatistics &right); - void CopyValidity(BaseStatistics &stats); + void CopyValidity(const BaseStatistics &stats); //! Set that the CURRENT level can have null values //! Note that this is not correct for nested types unless this information is propagated in a different manner //! Use Set(StatsInfo::CAN_HAVE_NULL_VALUES) in the general case diff --git a/src/duckdb/src/include/duckdb/storage/statistics/geometry_stats.hpp b/src/duckdb/src/include/duckdb/storage/statistics/geometry_stats.hpp index 78f7608d3..2adf308d6 100644 --- a/src/duckdb/src/include/duckdb/storage/statistics/geometry_stats.hpp +++ b/src/duckdb/src/include/duckdb/storage/statistics/geometry_stats.hpp @@ -75,6 +75,69 @@ class GeometryTypeSet { } } + //! Check if only the given geometry and vertex type is present + //! (all others are absent) + bool HasOnly(GeometryType geom_type, VertexType vert_type) const { + const auto vert_idx = static_cast(vert_type); + const auto geom_idx = static_cast(geom_type); + D_ASSERT(vert_idx < VERT_TYPES); + D_ASSERT(geom_idx < PART_TYPES); + for (uint8_t v_idx = 0; v_idx < VERT_TYPES; v_idx++) { + for (uint8_t g_idx = 1; g_idx < PART_TYPES; g_idx++) { + if (v_idx == vert_idx && g_idx == geom_idx) { + if (!(sets[v_idx] & (1 << g_idx))) { + return false; + } + } else { + if (sets[v_idx] & (1 << g_idx)) { + return false; + } + } + } + } + return true; + } + + bool HasSingleType() const { + idx_t type_count = 0; + for (uint8_t v_idx = 0; v_idx < VERT_TYPES; v_idx++) { + for (uint8_t g_idx = 1; g_idx < PART_TYPES; g_idx++) { + if (sets[v_idx] & (1 << g_idx)) { + type_count++; + if (type_count > 1) { + return false; + } + } + } + } + return type_count == 1; + } + + bool TryGetSingleType(GeometryType &geom_type, VertexType &vert_type) const { + auto result_geom = GeometryType::INVALID; + auto result_vert = VertexType::XY; + auto result_found = false; + + for (uint8_t v_idx = 0; v_idx < VERT_TYPES; v_idx++) { + for (uint8_t g_idx = 1; g_idx < PART_TYPES; g_idx++) { + if (sets[v_idx] & (1 << g_idx)) { + if (result_found) { + // Multiple types found + return false; + } + result_found = true; + result_geom = static_cast(g_idx); + result_vert = static_cast(v_idx); + } + } + } + if (result_found) { + geom_type = result_geom; + vert_type = result_vert; + } + return result_found; + } + void AddWKBType(int32_t wkb_type) { const auto vert_idx = static_cast((wkb_type / 1000) % 10); const auto geom_idx = static_cast(wkb_type % 1000); @@ -100,23 +163,85 @@ class GeometryTypeSet { uint8_t sets[VERT_TYPES]; }; +class GeometryStatsFlags { +public: + // There are two types of "empty" + // 1. Empty geometry: A geometry that contains no vertices (e.g., POINT EMPTY) + // 2. Empty part: A geometry that contains at least one empty geometry (e.g., MULTIPOINT(POINT EMPTY, POINT(1 2))) + + static GeometryStatsFlags Unknown() { + GeometryStatsFlags flags; + flags.flags = 0xF; // All bits set + return flags; + } + + static GeometryStatsFlags Empty() { + GeometryStatsFlags flags; + flags.flags = 0x0; // No bits set + return flags; + } + void Clear() { + flags = 0x0; + } + bool HasEmptyGeometry() const { + return (flags & HAS_EMPTY_GEOM) != 0; + } + bool HasNonEmptyGeometry() const { + return (flags & HAS_NON_EMPTY_GEOM) != 0; + } + bool HasEmptyPart() const { + return (flags & HAS_EMPTY_PART) != 0; + } + bool HasNonEmptyPart() const { + return (flags & HAS_NON_EMPTY_PART) != 0; + } + void SetHasEmptyGeometry() { + flags |= HAS_EMPTY_GEOM; + } + void SetHasNonEmptyGeometry() { + flags |= HAS_NON_EMPTY_GEOM; + } + void SetHasEmptyPart() { + flags |= HAS_EMPTY_PART; + } + void SetHasNonEmptyPart() { + flags |= HAS_NON_EMPTY_PART; + } + + void Merge(const GeometryStatsFlags &other) { + flags |= other.flags; + } + + uint8_t flags; + +private: + static constexpr auto HAS_EMPTY_GEOM = 0x1; + static constexpr auto HAS_NON_EMPTY_GEOM = 0x2; + static constexpr auto HAS_EMPTY_PART = 0x4; + static constexpr auto HAS_NON_EMPTY_PART = 0x8; +}; + struct GeometryStatsData { GeometryTypeSet types; GeometryExtent extent; + GeometryStatsFlags flags; void SetEmpty() { types = GeometryTypeSet::Empty(); extent = GeometryExtent::Empty(); + flags = GeometryStatsFlags::Empty(); } void SetUnknown() { types = GeometryTypeSet::Unknown(); extent = GeometryExtent::Unknown(); + flags = GeometryStatsFlags::Unknown(); } void Merge(const GeometryStatsData &other) { types.Merge(other.types); extent.Merge(other.extent); + flags.Merge(other.flags); } void Update(const string_t &geom_blob) { @@ -125,7 +250,21 @@ struct GeometryStatsData { types.Add(type_info.first, type_info.second); // Update extent - Geometry::GetExtent(geom_blob, extent); + bool has_any_empty = false; + const auto vert_count = Geometry::GetExtent(geom_blob, extent, has_any_empty); + + // Update flags + if (has_any_empty) { + flags.SetHasEmptyPart(); + } else { + flags.SetHasNonEmptyPart(); + } + + if (vert_count == 0) { + flags.SetHasEmptyGeometry(); + } else { + flags.SetHasNonEmptyGeometry(); + } } }; @@ -152,8 +291,9 @@ struct GeometryStats { DUCKDB_API static const GeometryExtent &GetExtent(const BaseStatistics &stats); DUCKDB_API static GeometryTypeSet &GetTypes(BaseStatistics &stats); DUCKDB_API static const GeometryTypeSet &GetTypes(const BaseStatistics &stats); + DUCKDB_API static GeometryStatsFlags &GetFlags(BaseStatistics &stats); + DUCKDB_API static const GeometryStatsFlags &GetFlags(const BaseStatistics &stats); -private: static GeometryStatsData &GetDataUnsafe(BaseStatistics &stats); static const GeometryStatsData &GetDataUnsafe(const BaseStatistics &stats); }; diff --git a/src/duckdb/src/include/duckdb/storage/statistics/variant_stats.hpp b/src/duckdb/src/include/duckdb/storage/statistics/variant_stats.hpp index e2cbfae94..a91ff7c03 100644 --- a/src/duckdb/src/include/duckdb/storage/statistics/variant_stats.hpp +++ b/src/duckdb/src/include/duckdb/storage/statistics/variant_stats.hpp @@ -2,6 +2,7 @@ #include "duckdb/common/types/variant.hpp" #include "duckdb/common/types/selection_vector.hpp" +#include "duckdb/storage/storage_index.hpp" namespace duckdb { class BaseStatistics; @@ -25,6 +26,8 @@ struct VariantStatsData { struct VariantShreddedStats { public: DUCKDB_API static bool IsFullyShredded(const BaseStatistics &stats); + DUCKDB_API static optional_ptr FindChildStats(const BaseStatistics &stats, + const VariantPathComponent &component); }; //! VARIANT as a type can hold arbitrarily typed values within the same column. @@ -65,6 +68,8 @@ struct VariantStats { DUCKDB_API static bool MergeShredding(BaseStatistics &stats, const BaseStatistics &other, BaseStatistics &new_stats); + DUCKDB_API static unique_ptr WrapExtractedFieldAsVariant(const BaseStatistics &base_variant, + const BaseStatistics &extracted_field); public: DUCKDB_API static void Serialize(const BaseStatistics &stats, Serializer &serializer); @@ -75,6 +80,8 @@ struct VariantStats { DUCKDB_API static void Merge(BaseStatistics &stats, const BaseStatistics &other); DUCKDB_API static void Verify(const BaseStatistics &stats, Vector &vector, const SelectionVector &sel, idx_t count); DUCKDB_API static void Copy(BaseStatistics &stats, const BaseStatistics &other); + DUCKDB_API static unique_ptr PushdownExtract(const BaseStatistics &stats, + const StorageIndex &index); private: static VariantStatsData &GetDataUnsafe(BaseStatistics &stats); diff --git a/src/duckdb/src/include/duckdb/storage/storage_index.hpp b/src/duckdb/src/include/duckdb/storage/storage_index.hpp index 09aec8e1c..75f5fe8d4 100644 --- a/src/duckdb/src/include/duckdb/storage/storage_index.hpp +++ b/src/duckdb/src/include/duckdb/storage/storage_index.hpp @@ -19,12 +19,20 @@ enum class StorageIndexType : uint8_t { FULL_READ, PUSHDOWN_EXTRACT }; struct StorageIndex { public: - StorageIndex() : index(COLUMN_IDENTIFIER_ROW_ID), index_type(StorageIndexType::FULL_READ) { + StorageIndex() : has_index(true), index(COLUMN_IDENTIFIER_ROW_ID), index_type(StorageIndexType::FULL_READ) { } - explicit StorageIndex(idx_t index) : index(index), index_type(StorageIndexType::FULL_READ) { + explicit StorageIndex(idx_t index) : has_index(true), index(index), index_type(StorageIndexType::FULL_READ) { + } + explicit StorageIndex(const string &field) + : has_index(false), field(field), index_type(StorageIndexType::FULL_READ) { } StorageIndex(idx_t index, vector child_indexes_p) - : index(index), index_type(StorageIndexType::FULL_READ), child_indexes(std::move(child_indexes_p)) { + : has_index(true), index(index), index_type(StorageIndexType::FULL_READ), + child_indexes(std::move(child_indexes_p)) { + } + StorageIndex(const string &field, vector child_indexes_p) + : has_index(false), field(field), index_type(StorageIndexType::FULL_READ), + child_indexes(std::move(child_indexes_p)) { } inline bool operator==(const StorageIndex &rhs) const { @@ -43,7 +51,12 @@ struct StorageIndex { for (auto &child_id : column_id.GetChildIndexes()) { result.push_back(StorageIndex::FromColumnIndex(child_id)); } - auto storage_index = StorageIndex(column_id.GetPrimaryIndex(), std::move(result)); + StorageIndex storage_index; + if (column_id.HasPrimaryIndex()) { + storage_index = StorageIndex(column_id.GetPrimaryIndex(), std::move(result)); + } else { + storage_index = StorageIndex(column_id.GetFieldName(), std::move(result)); + } if (column_id.HasType()) { storage_index.SetType(column_id.GetType()); } @@ -54,15 +67,31 @@ struct StorageIndex { } public: + bool HasPrimaryIndex() const { + return has_index; + } idx_t GetPrimaryIndex() const { + D_ASSERT(has_index); return index; } + const string &GetFieldName() const { + D_ASSERT(!has_index); + return field; + } PhysicalIndex ToPhysical() const { + D_ASSERT(has_index); return PhysicalIndex(index); } bool HasType() const { return type.id() != LogicalTypeId::INVALID; } + const LogicalType &GetScanType() const { + D_ASSERT(HasType()); + if (IsPushdownExtract()) { + return child_indexes[0].GetScanType(); + } + return GetType(); + } const LogicalType &GetType() const { return type; } @@ -95,14 +124,21 @@ struct StorageIndex { return index_type == StorageIndexType::PUSHDOWN_EXTRACT; } void SetIndex(idx_t new_index) { + D_ASSERT(has_index); index = new_index; } bool IsRowIdColumn() const { + if (!has_index) { + return false; + } return index == DConstants::INVALID_INDEX; } private: + bool has_index = true; idx_t index; + string field; + LogicalType type = LogicalType::INVALID; StorageIndexType index_type; vector child_indexes; diff --git a/src/duckdb/src/include/duckdb/storage/storage_info.hpp b/src/duckdb/src/include/duckdb/storage/storage_info.hpp index f919bac33..228865b9c 100644 --- a/src/duckdb/src/include/duckdb/storage/storage_info.hpp +++ b/src/duckdb/src/include/duckdb/storage/storage_info.hpp @@ -96,6 +96,8 @@ class MainHeader { uint64_t version_number; //! The set of flags used by the database. uint64_t flags[FLAG_COUNT]; + //! Encryption version + uint8_t encryption_version; //! The length of the unique database identifier. static constexpr idx_t DB_IDENTIFIER_LEN = 16; @@ -123,6 +125,9 @@ class MainHeader { void SetEncrypted() { flags[0] |= MainHeader::ENCRYPTED_DATABASE_FLAG; } + void SetEncryptionVersion(uint8_t version) { + encryption_version = version; + } void SetEncryptionMetadata(data_ptr_t source) { memset(encryption_metadata, 0, ENCRYPTION_METADATA_LEN); @@ -133,6 +138,10 @@ class MainHeader { return static_cast(encryption_metadata[2]); } + EncryptionTypes::EncryptionVersion GetEncryptionVersion() const { + return static_cast(encryption_metadata[3]); + } + void SetDBIdentifier(data_ptr_t source) { memset(db_identifier, 0, DB_IDENTIFIER_LEN); memcpy(db_identifier, source, DB_IDENTIFIER_LEN); @@ -143,10 +152,28 @@ class MainHeader { memcpy(encrypted_canary, source, CANARY_BYTE_SIZE); } + void SetCanaryIV(data_ptr_t source) { + memset(canary_iv, 0, AES_IV_LEN); + memcpy(canary_iv, source, AES_IV_LEN); + } + + void SetCanaryTag(data_ptr_t source) { + memset(canary_tag, 0, AES_TAG_LEN); + memcpy(canary_tag, source, AES_TAG_LEN); + } + data_ptr_t GetDBIdentifier() { return db_identifier; } + data_ptr_t GetIV() { + return canary_iv; + } + + data_ptr_t GetTag() { + return canary_tag; + } + static bool CompareDBIdentifiers(const data_ptr_t db_identifier_1, const data_ptr_t db_identifier_2) { for (idx_t i = 0; i < DB_IDENTIFIER_LEN; i++) { if (db_identifier_1[i] != db_identifier_2[i]) { @@ -170,6 +197,8 @@ class MainHeader { //! The unique database identifier and optional encryption salt. data_t db_identifier[DB_IDENTIFIER_LEN]; data_t encrypted_canary[CANARY_BYTE_SIZE]; + data_t canary_iv[AES_IV_LEN]; + data_t canary_tag[AES_IV_LEN]; }; //! The DatabaseHeader contains information about the current state of the database. Every storage file has two diff --git a/src/duckdb/src/include/duckdb/storage/storage_manager.hpp b/src/duckdb/src/include/duckdb/storage/storage_manager.hpp index b6e0fda94..7861b53f9 100644 --- a/src/duckdb/src/include/duckdb/storage/storage_manager.hpp +++ b/src/duckdb/src/include/duckdb/storage/storage_manager.hpp @@ -131,6 +131,9 @@ class StorageManager { bool IsEncrypted() const { return storage_options.encryption; } + uint8_t GetEncryptionVersion() const { + return storage_options.encryption_version; + } protected: virtual void LoadDatabase(QueryContext context) = 0; diff --git a/src/duckdb/src/include/duckdb/storage/storage_options.hpp b/src/duckdb/src/include/duckdb/storage/storage_options.hpp index 4cf1f539b..63af588a2 100644 --- a/src/duckdb/src/include/duckdb/storage/storage_options.hpp +++ b/src/duckdb/src/include/duckdb/storage/storage_options.hpp @@ -36,7 +36,10 @@ struct StorageOptions { //! encryption key //! FIXME: change to a unique_ptr in the future shared_ptr user_key; + //! encryption version (set default to 1) + EncryptionTypes::EncryptionVersion encryption_version = EncryptionTypes::NONE; + void SetEncryptionVersion(string &storage_version_user_provided); void Initialize(const unordered_map &options); }; diff --git a/src/duckdb/src/include/duckdb/storage/table/array_column_data.hpp b/src/duckdb/src/include/duckdb/storage/table/array_column_data.hpp index 79b2d007c..f9b15b0f1 100644 --- a/src/duckdb/src/include/duckdb/storage/table/array_column_data.hpp +++ b/src/duckdb/src/include/duckdb/storage/table/array_column_data.hpp @@ -52,7 +52,8 @@ class ArrayColumnData : public ColumnData { unique_ptr CreateCheckpointState(const RowGroup &row_group, PartialBlockManager &partial_block_manager) override; - unique_ptr Checkpoint(const RowGroup &row_group, ColumnCheckpointInfo &info) override; + unique_ptr Checkpoint(const RowGroup &row_group, ColumnCheckpointInfo &info, + const BaseStatistics &old_stats) override; bool IsPersistent() override; bool HasAnyChanges() const override; @@ -67,6 +68,8 @@ class ArrayColumnData : public ColumnData { void SetValidityData(shared_ptr validity); void SetChildData(shared_ptr child_column); + const BaseStatistics &GetChildStats(const ColumnData &child) const override; + protected: //! The child-column of the list shared_ptr child_column; diff --git a/src/duckdb/src/include/duckdb/storage/table/column_data.hpp b/src/duckdb/src/include/duckdb/storage/table/column_data.hpp index 53f309ce4..ad291434f 100644 --- a/src/duckdb/src/include/duckdb/storage/table/column_data.hpp +++ b/src/duckdb/src/include/duckdb/storage/table/column_data.hpp @@ -104,6 +104,9 @@ class ColumnData : public enable_shared_from_this { D_ASSERT(HasParent()); return *parent; } + + virtual const BaseStatistics &GetChildStats(const ColumnData &child) const; + const LogicalType &GetType() const { return type; } @@ -175,7 +178,11 @@ class ColumnData : public enable_shared_from_this { virtual unique_ptr CreateCheckpointState(const RowGroup &row_group, PartialBlockManager &partial_block_manager); - virtual unique_ptr Checkpoint(const RowGroup &row_group, ColumnCheckpointInfo &info); + //! If this is a nested column, "stats" are the corresponding statistics from the parent column + //! Otherwise, "stats" == this->statistics->stats + unique_ptr Checkpoint(const RowGroup &row_group, ColumnCheckpointInfo &info); + virtual unique_ptr Checkpoint(const RowGroup &row_group, ColumnCheckpointInfo &info, + const BaseStatistics &stats); virtual void CheckpointScan(ColumnSegment &segment, ColumnScanState &state, idx_t count, Vector &scan_vector) const; @@ -202,6 +209,7 @@ class ColumnData : public enable_shared_from_this { void MergeStatistics(const BaseStatistics &other); void MergeIntoStatistics(BaseStatistics &other); unique_ptr GetStatistics() const; + const BaseStatistics &GetStatisticsRef() const; protected: //! Append a transient segment @@ -243,10 +251,10 @@ class ColumnData : public enable_shared_from_this { unique_ptr updates; //! The lock for the stats mutable mutex stats_lock; - //! The stats of the root segment - unique_ptr stats; //! Total transient allocation size atomic allocation_size; + //! The stats of the root segment + unique_ptr stats; private: //! Whether or not this column data belongs to a main table or if it is transaction local @@ -270,6 +278,69 @@ class ColumnData : public enable_shared_from_this { } }; +enum class ExtraPersistentColumnDataType : uint8_t { + INVALID = 0, + VARIANT = 1, + GEOMETRY = 2, +}; + +class ExtraPersistentColumnData { +public: + ExtraPersistentColumnDataType GetType() const { + return type; + } + + virtual ~ExtraPersistentColumnData() = default; + + template + TARGET &Cast() { + D_ASSERT(type == TARGET::TYPE); + DynamicCastCheck(this); + return reinterpret_cast(*this); + } + template + const TARGET &Cast() const { + D_ASSERT(type == TARGET::TYPE); + DynamicCastCheck(this); + return reinterpret_cast(*this); + } + + void Serialize(Serializer &serializer) const; + static unique_ptr Deserialize(Deserializer &deserializer); + +protected: + explicit ExtraPersistentColumnData(ExtraPersistentColumnDataType type_p) : type(type_p) { + } + +private: + ExtraPersistentColumnDataType type; +}; + +class VariantPersistentColumnData final : public ExtraPersistentColumnData { +public: + static constexpr auto TYPE = ExtraPersistentColumnDataType::VARIANT; + VariantPersistentColumnData() : ExtraPersistentColumnData(TYPE) { + } + explicit VariantPersistentColumnData(const LogicalType &storage_type) + : ExtraPersistentColumnData(TYPE), logical_type(storage_type) { + } + + LogicalType logical_type; +}; + +class GeometryPersistentColumnData final : public ExtraPersistentColumnData { +public: + static constexpr auto TYPE = ExtraPersistentColumnDataType::GEOMETRY; + GeometryPersistentColumnData() : ExtraPersistentColumnData(TYPE) { + } + GeometryPersistentColumnData(GeometryType type, VertexType vert) + : ExtraPersistentColumnData(TYPE), geom_type(type), vert_type(vert) { + } + + GeometryType geom_type = GeometryType::INVALID; + VertexType vert_type = VertexType::XY; +}; + struct PersistentColumnData { public: explicit PersistentColumnData(const LogicalType &logical_type); @@ -288,15 +359,15 @@ struct PersistentColumnData { void DeserializeField(Deserializer &deserializer, field_id_t field_idx, const char *field_name, const LogicalType &type); bool HasUpdates() const; - void SetVariantShreddedType(const LogicalType &shredded_type); public: - PhysicalType physical_type; - LogicalTypeId logical_type_id; + LogicalType logical_type; vector pointers; vector child_columns; bool has_updates = false; - LogicalType variant_shredded_type; + + //! Extra persistent data for specific column types + unique_ptr extra_data; }; struct PersistentRowGroupData { diff --git a/src/duckdb/src/include/duckdb/storage/table/geo_column_data.hpp b/src/duckdb/src/include/duckdb/storage/table/geo_column_data.hpp new file mode 100644 index 000000000..d091530e7 --- /dev/null +++ b/src/duckdb/src/include/duckdb/storage/table/geo_column_data.hpp @@ -0,0 +1,83 @@ +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/storage/table/geo_column_data.hpp +// +// +//===----------------------------------------------------------------------===// + +#pragma once + +#include "duckdb/storage/table/column_data.hpp" +#include "duckdb/storage/table/validity_column_data.hpp" + +namespace duckdb { + +class GeoColumnData final : public ColumnData { +public: + GeoColumnData(BlockManager &block_manager, DataTableInfo &info, idx_t column_index, LogicalType type, + ColumnDataType data_type, optional_ptr parent); + + //! The actual column data + //! The "shape" of this might differ depending on if we "shred" this column or not. + shared_ptr base_column; + + //! Shredding state of the column + GeometryType geom_type = GeometryType::INVALID; + VertexType vert_type = VertexType::XY; + +public: + idx_t GetMaxEntry() override; + + void InitializeChildScanStates(ColumnScanState &state); + + void InitializePrefetch(PrefetchState &prefetch_state, ColumnScanState &scan_state, idx_t rows) override; + void InitializeScan(ColumnScanState &state) override; + void InitializeScanWithOffset(ColumnScanState &state, idx_t row_idx) override; + + idx_t Scan(TransactionData transaction, idx_t vector_index, ColumnScanState &state, Vector &result, + idx_t scan_count) override; + + idx_t ScanCount(ColumnScanState &state, Vector &result, idx_t count, idx_t result_offset = 0) override; + + void Skip(ColumnScanState &state, idx_t count = STANDARD_VECTOR_SIZE) override; + + void InitializeAppend(ColumnAppendState &state) override; + void Append(BaseStatistics &stats, ColumnAppendState &state, Vector &vector, idx_t count) override; + void RevertAppend(row_t new_count) override; + idx_t Fetch(ColumnScanState &state, row_t row_id, Vector &result) override; + void FetchRow(TransactionData transaction, ColumnFetchState &state, const StorageIndex &storage_index, row_t row_id, + Vector &result, idx_t result_idx) override; + void Update(TransactionData transaction, DataTable &data_table, idx_t column_index, Vector &update_vector, + row_t *row_ids, idx_t update_count, idx_t row_group_start) override; + void UpdateColumn(TransactionData transaction, DataTable &data_table, const vector &column_path, + Vector &update_vector, row_t *row_ids, idx_t update_count, idx_t depth, + idx_t row_group_start) override; + unique_ptr GetUpdateStatistics() override; + + unique_ptr CreateCheckpointState(const RowGroup &row_group, + PartialBlockManager &partial_block_manager) override; + unique_ptr Checkpoint(const RowGroup &row_group, ColumnCheckpointInfo &info, + const BaseStatistics &old_stats) override; + + bool IsPersistent() override; + bool HasAnyChanges() const override; + PersistentColumnData Serialize() override; + void InitializeColumn(PersistentColumnData &column_data, BaseStatistics &target_stats) override; + + void GetColumnSegmentInfo(const QueryContext &context, idx_t row_group_index, vector col_path, + vector &result) override; + + void Verify(RowGroup &parent) override; + + void VisitBlockIds(BlockIdVisitor &visitor) const override; + +private: + static void Specialize(Vector &source, Vector &target, idx_t count, GeometryType geom_type, VertexType vert_type); + static void Reassemble(Vector &source, Vector &target, idx_t count, GeometryType geom_type, VertexType vert_type, + idx_t offset); + static void InterpretStats(BaseStatistics &source, BaseStatistics &target, GeometryType geom_type, + VertexType vert_type); +}; + +} // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/storage/table/list_column_data.hpp b/src/duckdb/src/include/duckdb/storage/table/list_column_data.hpp index 31b99e223..547d56fbb 100644 --- a/src/duckdb/src/include/duckdb/storage/table/list_column_data.hpp +++ b/src/duckdb/src/include/duckdb/storage/table/list_column_data.hpp @@ -50,7 +50,8 @@ class ListColumnData : public ColumnData { unique_ptr CreateCheckpointState(const RowGroup &row_group, PartialBlockManager &partial_block_manager) override; - unique_ptr Checkpoint(const RowGroup &row_group, ColumnCheckpointInfo &info) override; + unique_ptr Checkpoint(const RowGroup &row_group, ColumnCheckpointInfo &info, + const BaseStatistics &old_stats) override; bool IsPersistent() override; bool HasAnyChanges() const override; @@ -63,6 +64,8 @@ class ListColumnData : public ColumnData { void SetValidityData(shared_ptr validity_p); void SetChildData(shared_ptr child_column_p); + const BaseStatistics &GetChildStats(const ColumnData &child) const override; + protected: //! The child-column of the list shared_ptr child_column; diff --git a/src/duckdb/src/include/duckdb/storage/table/row_group_collection.hpp b/src/duckdb/src/include/duckdb/storage/table/row_group_collection.hpp index 7134e06ea..ed88da77d 100644 --- a/src/duckdb/src/include/duckdb/storage/table/row_group_collection.hpp +++ b/src/duckdb/src/include/duckdb/storage/table/row_group_collection.hpp @@ -70,7 +70,7 @@ class RowGroupCollection { void InitializeCreateIndexScan(CreateIndexScanState &state); void InitializeScanWithOffset(const QueryContext &context, CollectionScanState &state, const vector &column_ids, idx_t start_row, idx_t end_row); - static bool InitializeScanInRowGroup(const QueryContext &context, CollectionScanState &state, + static bool InitializeScanInRowGroup(ClientContext &context, CollectionScanState &state, RowGroupCollection &collection, SegmentNode &row_group, idx_t vector_index, idx_t max_row); void InitializeParallelScan(ParallelCollectionScanState &state); diff --git a/src/duckdb/src/include/duckdb/storage/table/row_id_column_data.hpp b/src/duckdb/src/include/duckdb/storage/table/row_id_column_data.hpp index 19987764f..c58f2907b 100644 --- a/src/duckdb/src/include/duckdb/storage/table/row_id_column_data.hpp +++ b/src/duckdb/src/include/duckdb/storage/table/row_id_column_data.hpp @@ -54,7 +54,8 @@ class RowIdColumnData : public ColumnData { unique_ptr CreateCheckpointState(const RowGroup &row_group, PartialBlockManager &partial_block_manager) override; - unique_ptr Checkpoint(const RowGroup &row_group, ColumnCheckpointInfo &info) override; + unique_ptr Checkpoint(const RowGroup &row_group, ColumnCheckpointInfo &info, + const BaseStatistics &old_stats) override; void CheckpointScan(ColumnSegment &segment, ColumnScanState &state, idx_t count, Vector &scan_vector) const override; diff --git a/src/duckdb/src/include/duckdb/storage/table/scan_state.hpp b/src/duckdb/src/include/duckdb/storage/table/scan_state.hpp index 7d1e92e37..822edc4cb 100644 --- a/src/duckdb/src/include/duckdb/storage/table/scan_state.hpp +++ b/src/duckdb/src/include/duckdb/storage/table/scan_state.hpp @@ -132,6 +132,9 @@ struct ColumnScanState { //! Whether or not updates should be allowed UpdateScanType update_scan_type = UpdateScanType::STANDARD; +public: + void PushDownCast(const LogicalType &original_type, const LogicalType &cast_type); + public: void Initialize(const QueryContext &context_p, const LogicalType &type, const StorageIndex &column_id, optional_ptr options); diff --git a/src/duckdb/src/include/duckdb/storage/table/standard_column_data.hpp b/src/duckdb/src/include/duckdb/storage/table/standard_column_data.hpp index b432ba6d4..7249aaf08 100644 --- a/src/duckdb/src/include/duckdb/storage/table/standard_column_data.hpp +++ b/src/duckdb/src/include/duckdb/storage/table/standard_column_data.hpp @@ -53,7 +53,8 @@ class StandardColumnData : public ColumnData { unique_ptr CreateCheckpointState(const RowGroup &row_group, PartialBlockManager &partial_block_manager) override; - unique_ptr Checkpoint(const RowGroup &row_group, ColumnCheckpointInfo &info) override; + unique_ptr Checkpoint(const RowGroup &row_group, ColumnCheckpointInfo &info, + const BaseStatistics &stats) override; void CheckpointScan(ColumnSegment &segment, ColumnScanState &state, idx_t count, Vector &scan_vector) const override; diff --git a/src/duckdb/src/include/duckdb/storage/table/struct_column_data.hpp b/src/duckdb/src/include/duckdb/storage/table/struct_column_data.hpp index a64da2ef3..538152b1d 100644 --- a/src/duckdb/src/include/duckdb/storage/table/struct_column_data.hpp +++ b/src/duckdb/src/include/duckdb/storage/table/struct_column_data.hpp @@ -15,6 +15,20 @@ namespace duckdb { //! Struct column data represents a struct class StructColumnData : public ColumnData { +public: + struct StructColumnDataChild { + public: + StructColumnDataChild(ColumnData &col, optional_idx vector_index, ColumnScanState &child, bool should_scan) + : col(col), vector_index(vector_index), state(child), should_scan(should_scan) { + } + + public: + ColumnData &col; + optional_idx vector_index; + ColumnScanState &state; + bool should_scan; + }; + public: StructColumnData(BlockManager &block_manager, DataTableInfo &info, idx_t column_index, LogicalType type, ColumnDataType data_type, optional_ptr parent); @@ -27,8 +41,7 @@ class StructColumnData : public ColumnData { void InitializeScan(ColumnScanState &state) override; void InitializeScanWithOffset(ColumnScanState &state, idx_t row_idx) override; - void IterateFields(ColumnScanState &state, - const std::function &callback); + vector GetStructChildren(ColumnScanState &state) const; idx_t Scan(TransactionData transaction, idx_t vector_index, ColumnScanState &state, Vector &result, idx_t scan_count) override; @@ -53,7 +66,8 @@ class StructColumnData : public ColumnData { unique_ptr CreateCheckpointState(const RowGroup &row_group, PartialBlockManager &partial_block_manager) override; - unique_ptr Checkpoint(const RowGroup &row_group, ColumnCheckpointInfo &info) override; + unique_ptr Checkpoint(const RowGroup &row_group, ColumnCheckpointInfo &info, + const BaseStatistics &old_stats) override; bool IsPersistent() override; bool HasAnyChanges() const override; @@ -67,6 +81,9 @@ class StructColumnData : public ColumnData { void SetValidityData(shared_ptr validity_p); void SetChildData(idx_t i, shared_ptr child_column_p); + const ColumnData &GetChildColumn(idx_t index) const; + + const BaseStatistics &GetChildStats(const ColumnData &child) const override; protected: //! The sub-columns of the struct diff --git a/src/duckdb/src/include/duckdb/storage/table/variant_column_data.hpp b/src/duckdb/src/include/duckdb/storage/table/variant_column_data.hpp index 973f8bf72..90646d384 100644 --- a/src/duckdb/src/include/duckdb/storage/table/variant_column_data.hpp +++ b/src/duckdb/src/include/duckdb/storage/table/variant_column_data.hpp @@ -33,7 +33,6 @@ class VariantColumnData : public ColumnData { void InitializeScan(ColumnScanState &state) override; void InitializeScanWithOffset(ColumnScanState &state, idx_t row_idx) override; - Vector CreateUnshreddingIntermediate(idx_t count); idx_t Scan(TransactionData transaction, idx_t vector_index, ColumnScanState &state, Vector &result, idx_t scan_count) override; idx_t ScanCount(ColumnScanState &state, Vector &result, idx_t count, idx_t result_offset = 0) override; @@ -57,7 +56,8 @@ class VariantColumnData : public ColumnData { unique_ptr CreateCheckpointState(const RowGroup &row_group, PartialBlockManager &partial_block_manager) override; - unique_ptr Checkpoint(const RowGroup &row_group, ColumnCheckpointInfo &info) override; + unique_ptr Checkpoint(const RowGroup &row_group, ColumnCheckpointInfo &info, + const BaseStatistics &old_stats) override; bool IsPersistent() override; bool HasAnyChanges() const override; @@ -76,9 +76,14 @@ class VariantColumnData : public ColumnData { void SetChildData(vector> child_data); private: + Vector CreateUnshreddingIntermediate(idx_t count) const; vector> WriteShreddedData(const RowGroup &row_group, const LogicalType &shredded_type, BaseStatistics &stats); + bool PushdownShreddedFieldExtract(const StorageIndex &variant_extract, StorageIndex &out_struct_extract) const; void CreateScanStates(ColumnScanState &state); + idx_t ScanWithCallback(ColumnScanState &state, Vector &result, idx_t target_count, + const std::function &callback) const; LogicalType GetShreddedType(); }; diff --git a/src/duckdb/src/include/duckdb_extension.h b/src/duckdb/src/include/duckdb_extension.h index c023bd8a1..63a809001 100644 --- a/src/duckdb/src/include/duckdb_extension.h +++ b/src/duckdb/src/include/duckdb_extension.h @@ -1416,9 +1416,9 @@ typedef struct { DUCKDB_EXTENSION_EXTERN_C_GUARD_OPEN DUCKDB_CAPI_ENTRY_VISIBILITY DUCKDB_EXTENSION_API bool DUCKDB_EXTENSION_GLUE( \ DUCKDB_EXTENSION_NAME, _init_c_api)(duckdb_extension_info info, struct duckdb_extension_access * access) { \ DUCKDB_EXTENSION_API_INIT(info, access, DUCKDB_EXTENSION_API_VERSION_STRING); \ - duckdb_database db = access->get_database(info); \ + duckdb_database *db = access->get_database(info); \ duckdb_connection conn; \ - if (duckdb_connect(db, &conn) == DuckDBError) { \ + if (duckdb_connect(*db, &conn) == DuckDBError) { \ access->set_error(info, "Failed to open connection to database"); \ return false; \ } \ diff --git a/src/duckdb/src/logging/logging.cpp b/src/duckdb/src/logging/logging.cpp index b0a614627..4585c8d7b 100644 --- a/src/duckdb/src/logging/logging.cpp +++ b/src/duckdb/src/logging/logging.cpp @@ -20,17 +20,6 @@ bool LogConfig::IsConsistent() const { return false; } -LogConfig LogConfig::Create(bool enabled, LogLevel level) { - return LogConfig(enabled, level, LogMode::LEVEL_ONLY, nullptr, nullptr); -} -LogConfig LogConfig::CreateFromEnabled(bool enabled, LogLevel level, unordered_set &enabled_log_types) { - return LogConfig(enabled, level, LogMode::ENABLE_SELECTED, enabled_log_types, nullptr); -} - -LogConfig LogConfig::CreateFromDisabled(bool enabled, LogLevel level, unordered_set &disabled_log_types) { - return LogConfig(enabled, level, LogMode::DISABLE_SELECTED, nullptr, disabled_log_types); -} - LogConfig::LogConfig(bool enabled, LogLevel level_p, LogMode mode_p, optional_ptr> enabled_log_types_p, optional_ptr> disabled_log_types_p) diff --git a/src/duckdb/src/main/attached_database.cpp b/src/duckdb/src/main/attached_database.cpp index 3a2ce8896..98a453a33 100644 --- a/src/duckdb/src/main/attached_database.cpp +++ b/src/duckdb/src/main/attached_database.cpp @@ -87,7 +87,7 @@ AttachOptions::AttachOptions(const unordered_map &attach_options, AttachedDatabase::AttachedDatabase(DatabaseInstance &db, AttachedDatabaseType type) : CatalogEntry(CatalogType::DATABASE_ENTRY, type == AttachedDatabaseType::SYSTEM_DATABASE ? SYSTEM_CATALOG : TEMP_CATALOG, 0), - db(db), type(type) { + db(db), type(type), close_lock(make_shared_ptr()) { // This database does not have storage, or uses temporary_objects for in-memory storage. D_ASSERT(type == AttachedDatabaseType::TEMP_DATABASE || type == AttachedDatabaseType::SYSTEM_DATABASE); if (type == AttachedDatabaseType::TEMP_DATABASE) { @@ -104,7 +104,7 @@ AttachedDatabase::AttachedDatabase(DatabaseInstance &db, AttachedDatabaseType ty AttachedDatabase::AttachedDatabase(DatabaseInstance &db, Catalog &catalog_p, string name_p, string file_path_p, AttachOptions &options) : CatalogEntry(CatalogType::DATABASE_ENTRY, catalog_p, std::move(name_p)), db(db), parent_catalog(&catalog_p), - attach_options(options.options) { + close_lock(make_shared_ptr()), attach_options(options.options) { if (options.access_mode == AccessMode::READ_ONLY) { type = AttachedDatabaseType::READ_ONLY_DATABASE; } else { @@ -124,7 +124,7 @@ AttachedDatabase::AttachedDatabase(DatabaseInstance &db, Catalog &catalog_p, str AttachedDatabase::AttachedDatabase(DatabaseInstance &db, Catalog &catalog_p, StorageExtension &storage_extension_p, ClientContext &context, string name_p, AttachInfo &info, AttachOptions &options) : CatalogEntry(CatalogType::DATABASE_ENTRY, catalog_p, std::move(name_p)), db(db), parent_catalog(&catalog_p), - storage_extension(&storage_extension_p), attach_options(options.options) { + storage_extension(&storage_extension_p), close_lock(make_shared_ptr()), attach_options(options.options) { if (options.access_mode == AccessMode::READ_ONLY) { type = AttachedDatabaseType::READ_ONLY_DATABASE; } else { @@ -199,11 +199,10 @@ string AttachedDatabase::ExtractDatabaseName(const string &dbpath, FileSystem &f } void AttachedDatabase::InvokeCloseIfLastReference(shared_ptr &attached_db) { - { - lock_guard guard(attached_db->close_lock); - if (attached_db.use_count() == 1) { - attached_db->Close(DatabaseCloseAction::CHECKPOINT); - } + auto close_lock = attached_db->close_lock; + lock_guard guard(*close_lock); + if (attached_db.use_count() == 1) { + attached_db->Close(DatabaseCloseAction::CHECKPOINT); } attached_db.reset(); } diff --git a/src/duckdb/src/main/client_context.cpp b/src/duckdb/src/main/client_context.cpp index 998cb9772..0b93f3a88 100644 --- a/src/duckdb/src/main/client_context.cpp +++ b/src/duckdb/src/main/client_context.cpp @@ -183,7 +183,7 @@ void ClientContext::Destroy() { void ClientContext::ProcessError(ErrorData &error, const string &query) const { error.FinalizeError(); - if (config.errors_as_json) { + if (Settings::Get(*this)) { error.ConvertErrorToJSON(); } else { error.AddErrorLocation(query); @@ -1424,43 +1424,40 @@ unique_ptr ClientContext::Execute(const shared_ptr &relat return ErrorResult(ErrorData(err_str)); } -SettingLookupResult ClientContext::TryGetCurrentSettingInternal(const string &key, Value &result) const { - // check the client session values - const auto &session_config_map = config.set_variables; - - auto session_value = session_config_map.find(key); - bool found_session_value = session_value != session_config_map.end(); - if (found_session_value) { - result = session_value->second; +SettingLookupResult ClientContext::TryGetCurrentSetting(const string &key, Value &result) const { + optional_ptr option; + // try to get the setting index + auto &db_config = DBConfig::GetConfig(*this); + auto setting_index = db_config.TryGetSettingIndex(key, option); + if (setting_index.IsValid()) { + // generic setting - try to fetch it + auto lookup_result = + config.user_settings.TryGetSetting(db_config.user_settings, setting_index.GetIndex(), result); + if (lookup_result) { + return lookup_result; + } + } + if (option && option->get_setting) { + // legacy callback + result = option->get_setting(*this); return SettingLookupResult(SettingScope::LOCAL); } - // finally check the global session values - return db->TryGetCurrentSetting(key, result); + // setting is not set - get the default value + return DBConfig::TryGetDefaultValue(option, result); } -SettingLookupResult ClientContext::TryGetCurrentSetting(const string &key, Value &result) const { - // first check the built-in settings +SettingLookupResult ClientContext::TryGetCurrentUserSetting(idx_t setting_index, Value &result) const { auto &db_config = DBConfig::GetConfig(*this); - auto option = db_config.GetOptionByName(key); - if (option) { - if (option->get_setting) { - result = option->get_setting(*this); - return SettingLookupResult(SettingScope::LOCAL); - } - // alias - search for the default key - return TryGetCurrentSettingInternal(option->name, result); - } - return TryGetCurrentSettingInternal(key, result); + return config.user_settings.TryGetSetting(db_config.user_settings, setting_index, result); } ParserOptions ClientContext::GetParserOptions() const { - auto &client_config = ClientConfig::GetConfig(*this); ParserOptions options; - options.preserve_identifier_case = DBConfig::GetSetting(*this); - options.integer_division = DBConfig::GetSetting(*this); - options.max_expression_depth = client_config.max_expression_depth; + options.preserve_identifier_case = Settings::Get(*this); + options.integer_division = Settings::Get(*this); + options.max_expression_depth = Settings::Get(*this); options.extensions = &DBConfig::GetConfig(*this).parser_extensions; - options.parser_override_setting = DBConfig::GetConfig(*this).options.allow_parser_override_extension; + options.parser_override_setting = Settings::Get(*this); return options; } @@ -1472,13 +1469,13 @@ ClientProperties ClientContext::GetClientProperties() { timezone = result.ToString(); } ArrowOffsetSize arrow_offset_size = ArrowOffsetSize::REGULAR; - if (DBConfig::GetSetting(*this)) { + if (Settings::Get(*this)) { arrow_offset_size = ArrowOffsetSize::LARGE; } - bool arrow_use_list_view = DBConfig::GetSetting(*this); - bool arrow_lossless_conversion = DBConfig::GetSetting(*this); - bool arrow_use_string_view = DBConfig::GetSetting(*this); - auto arrow_format_version = DBConfig::GetSetting(*this); + bool arrow_use_list_view = Settings::Get(*this); + bool arrow_lossless_conversion = Settings::Get(*this); + bool arrow_use_string_view = Settings::Get(*this); + auto arrow_format_version = Settings::Get(*this); return {timezone, arrow_offset_size, arrow_use_list_view, diff --git a/src/duckdb/src/main/config.cpp b/src/duckdb/src/main/config.cpp index 86bed2d5b..4143243ab 100644 --- a/src/duckdb/src/main/config.cpp +++ b/src/duckdb/src/main/config.cpp @@ -5,6 +5,7 @@ #include "duckdb/common/operator/cast_operators.hpp" #include "duckdb/common/operator/multiply.hpp" #include "duckdb/common/string_util.hpp" +#include "duckdb/main/database.hpp" #include "duckdb/main/settings.hpp" #include "duckdb/storage/storage_extension.hpp" #include "duckdb/common/serializer/serializer.hpp" @@ -26,30 +27,34 @@ bool DBConfigOptions::debug_print_bindings = false; #define DUCKDB_SETTING(_PARAM) \ { \ _PARAM::Name, _PARAM::Description, _PARAM::InputType, nullptr, nullptr, nullptr, nullptr, nullptr, \ - _PARAM::DefaultScope, _PARAM::DefaultValue, nullptr \ + _PARAM::Scope, _PARAM::DefaultValue, nullptr, _PARAM::SettingIndex \ } #define DUCKDB_SETTING_CALLBACK(_PARAM) \ { \ _PARAM::Name, _PARAM::Description, _PARAM::InputType, nullptr, nullptr, nullptr, nullptr, nullptr, \ - _PARAM::DefaultScope, _PARAM::DefaultValue, _PARAM::OnSet \ + _PARAM::Scope, _PARAM::DefaultValue, _PARAM::OnSet, _PARAM::SettingIndex \ } #define DUCKDB_GLOBAL(_PARAM) \ { \ _PARAM::Name, _PARAM::Description, _PARAM::InputType, _PARAM::SetGlobal, nullptr, _PARAM::ResetGlobal, \ - nullptr, _PARAM::GetSetting, SetScope::AUTOMATIC, nullptr, nullptr \ + nullptr, _PARAM::GetSetting, SettingScopeTarget::INVALID, nullptr, nullptr, optional_idx() \ } #define DUCKDB_LOCAL(_PARAM) \ { \ _PARAM::Name, _PARAM::Description, _PARAM::InputType, nullptr, _PARAM::SetLocal, nullptr, _PARAM::ResetLocal, \ - _PARAM::GetSetting, SetScope::AUTOMATIC, nullptr, nullptr \ + _PARAM::GetSetting, SettingScopeTarget::INVALID, nullptr, nullptr, optional_idx() \ } #define DUCKDB_GLOBAL_LOCAL(_PARAM) \ { \ _PARAM::Name, _PARAM::Description, _PARAM::InputType, _PARAM::SetGlobal, _PARAM::SetLocal, \ - _PARAM::ResetGlobal, _PARAM::ResetLocal, _PARAM::GetSetting, SetScope::AUTOMATIC, nullptr, nullptr \ + _PARAM::ResetGlobal, _PARAM::ResetLocal, _PARAM::GetSetting, SettingScopeTarget::INVALID, nullptr, \ + nullptr, optional_idx() \ } #define FINAL_SETTING \ - { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, SetScope::AUTOMATIC, nullptr, nullptr } + { \ + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, SettingScopeTarget::INVALID, nullptr, \ + nullptr, optional_idx() \ + } #define DUCKDB_SETTING_ALIAS(_ALIAS, _SETTING_INDEX) \ { _ALIAS, _SETTING_INDEX } @@ -59,15 +64,15 @@ bool DBConfigOptions::debug_print_bindings = false; static const ConfigurationOption internal_options[] = { DUCKDB_GLOBAL(AccessModeSetting), - DUCKDB_GLOBAL(AllocatorBackgroundThreadsSetting), + DUCKDB_SETTING_CALLBACK(AllocatorBackgroundThreadsSetting), DUCKDB_GLOBAL(AllocatorBulkDeallocationFlushThresholdSetting), DUCKDB_GLOBAL(AllocatorFlushThresholdSetting), - DUCKDB_GLOBAL(AllowCommunityExtensionsSetting), + DUCKDB_SETTING_CALLBACK(AllowCommunityExtensionsSetting), DUCKDB_SETTING(AllowExtensionsMetadataMismatchSetting), - DUCKDB_GLOBAL(AllowParserOverrideExtensionSetting), + DUCKDB_SETTING_CALLBACK(AllowParserOverrideExtensionSetting), DUCKDB_GLOBAL(AllowPersistentSecretsSetting), - DUCKDB_GLOBAL(AllowUnredactedSecretsSetting), - DUCKDB_GLOBAL(AllowUnsignedExtensionsSetting), + DUCKDB_SETTING_CALLBACK(AllowUnredactedSecretsSetting), + DUCKDB_SETTING_CALLBACK(AllowUnsignedExtensionsSetting), DUCKDB_GLOBAL(AllowedDirectoriesSetting), DUCKDB_GLOBAL(AllowedPathsSetting), DUCKDB_SETTING(ArrowLargeBufferSizeSetting), @@ -75,13 +80,13 @@ static const ConfigurationOption internal_options[] = { DUCKDB_SETTING(ArrowOutputListViewSetting), DUCKDB_SETTING_CALLBACK(ArrowOutputVersionSetting), DUCKDB_SETTING(AsofLoopJoinThresholdSetting), - DUCKDB_GLOBAL(AutoinstallExtensionRepositorySetting), - DUCKDB_GLOBAL(AutoinstallKnownExtensionsSetting), - DUCKDB_GLOBAL(AutoloadKnownExtensionsSetting), + DUCKDB_SETTING(AutoinstallExtensionRepositorySetting), + DUCKDB_SETTING(AutoinstallKnownExtensionsSetting), + DUCKDB_SETTING(AutoloadKnownExtensionsSetting), DUCKDB_GLOBAL(BlockAllocatorMemorySetting), DUCKDB_SETTING(CatalogErrorMaxSchemasSetting), DUCKDB_GLOBAL(CheckpointThresholdSetting), - DUCKDB_GLOBAL(CustomExtensionRepositorySetting), + DUCKDB_SETTING(CustomExtensionRepositorySetting), DUCKDB_LOCAL(CustomProfilingSettingsSetting), DUCKDB_GLOBAL(CustomUserAgentSetting), DUCKDB_SETTING(DebugAsofIejoinSetting), @@ -94,24 +99,24 @@ static const ConfigurationOption internal_options[] = { DUCKDB_SETTING(DebugVerifyBlocksSetting), DUCKDB_SETTING_CALLBACK(DebugVerifyVectorSetting), DUCKDB_SETTING_CALLBACK(DebugWindowModeSetting), - DUCKDB_GLOBAL(DefaultBlockSizeSetting), + DUCKDB_SETTING_CALLBACK(DefaultBlockSizeSetting), DUCKDB_SETTING_CALLBACK(DefaultCollationSetting), DUCKDB_SETTING_CALLBACK(DefaultNullOrderSetting), DUCKDB_SETTING_CALLBACK(DefaultOrderSetting), DUCKDB_GLOBAL(DefaultSecretStorageSetting), - DUCKDB_GLOBAL(DisableDatabaseInvalidationSetting), + DUCKDB_SETTING_CALLBACK(DisableDatabaseInvalidationSetting), DUCKDB_SETTING(DisableTimestamptzCastsSetting), DUCKDB_GLOBAL(DisabledCompressionMethodsSetting), DUCKDB_GLOBAL(DisabledFilesystemsSetting), DUCKDB_GLOBAL(DisabledLogTypes), DUCKDB_GLOBAL(DisabledOptimizersSetting), - DUCKDB_GLOBAL(DuckDBAPISetting), + DUCKDB_SETTING_CALLBACK(DuckDBAPISetting), DUCKDB_SETTING(DynamicOrFilterThresholdSetting), - DUCKDB_GLOBAL(EnableExternalAccessSetting), - DUCKDB_GLOBAL(EnableExternalFileCacheSetting), + DUCKDB_SETTING_CALLBACK(EnableExternalAccessSetting), + DUCKDB_SETTING_CALLBACK(EnableExternalFileCacheSetting), DUCKDB_SETTING(EnableFSSTVectorsSetting), DUCKDB_LOCAL(EnableHTTPLoggingSetting), - DUCKDB_GLOBAL(EnableHTTPMetadataCacheSetting), + DUCKDB_SETTING(EnableHTTPMetadataCacheSetting), DUCKDB_GLOBAL(EnableLogging), DUCKDB_SETTING(EnableMacroDependenciesSetting), DUCKDB_SETTING(EnableObjectCacheSetting), @@ -120,34 +125,35 @@ static const ConfigurationOption internal_options[] = { DUCKDB_LOCAL(EnableProgressBarPrintSetting), DUCKDB_SETTING(EnableViewDependenciesSetting), DUCKDB_GLOBAL(EnabledLogTypes), - DUCKDB_LOCAL(ErrorsAsJSONSetting), + DUCKDB_SETTING(ErrorsAsJSONSetting), DUCKDB_SETTING(ExperimentalMetadataReuseSetting), - DUCKDB_LOCAL(ExplainOutputSetting), + DUCKDB_SETTING_CALLBACK(ExplainOutputSetting), DUCKDB_GLOBAL(ExtensionDirectoriesSetting), - DUCKDB_GLOBAL(ExtensionDirectorySetting), - DUCKDB_GLOBAL(ExternalThreadsSetting), - DUCKDB_LOCAL(FileSearchPathSetting), - DUCKDB_GLOBAL(ForceBitpackingModeSetting), - DUCKDB_GLOBAL(ForceCompressionSetting), + DUCKDB_SETTING(ExtensionDirectorySetting), + DUCKDB_SETTING_CALLBACK(ExternalThreadsSetting), + DUCKDB_SETTING(FileSearchPathSetting), + DUCKDB_SETTING_CALLBACK(ForceBitpackingModeSetting), + DUCKDB_SETTING_CALLBACK(ForceCompressionSetting), DUCKDB_GLOBAL(ForceVariantShredding), - DUCKDB_LOCAL(HomeDirectorySetting), + DUCKDB_SETTING(GeometryMinimumShreddingSize), + DUCKDB_SETTING_CALLBACK(HomeDirectorySetting), DUCKDB_LOCAL(HTTPLoggingOutputSetting), - DUCKDB_GLOBAL(HTTPProxySetting), - DUCKDB_GLOBAL(HTTPProxyPasswordSetting), - DUCKDB_GLOBAL(HTTPProxyUsernameSetting), + DUCKDB_SETTING(HTTPProxySetting), + DUCKDB_SETTING(HTTPProxyPasswordSetting), + DUCKDB_SETTING(HTTPProxyUsernameSetting), DUCKDB_SETTING(IeeeFloatingPointOpsSetting), DUCKDB_SETTING(ImmediateTransactionModeSetting), DUCKDB_SETTING(IndexScanMaxCountSetting), DUCKDB_SETTING_CALLBACK(IndexScanPercentageSetting), DUCKDB_SETTING(IntegerDivisionSetting), - DUCKDB_LOCAL(LambdaSyntaxSetting), + DUCKDB_SETTING_CALLBACK(LambdaSyntaxSetting), DUCKDB_SETTING(LateMaterializationMaxRowsSetting), - DUCKDB_GLOBAL(LockConfigurationSetting), - DUCKDB_LOCAL(LogQueryPathSetting), + DUCKDB_SETTING(LockConfigurationSetting), + DUCKDB_SETTING_CALLBACK(LogQueryPathSetting), DUCKDB_GLOBAL(LoggingLevel), DUCKDB_GLOBAL(LoggingMode), DUCKDB_GLOBAL(LoggingStorage), - DUCKDB_LOCAL(MaxExpressionDepthSetting), + DUCKDB_SETTING(MaxExpressionDepthSetting), DUCKDB_GLOBAL(MaxMemorySetting), DUCKDB_GLOBAL(MaxTempDirectorySizeSetting), DUCKDB_SETTING(MaxVacuumTasksSetting), @@ -158,9 +164,9 @@ static const ConfigurationOption internal_options[] = { DUCKDB_SETTING_CALLBACK(OrderedAggregateThresholdSetting), DUCKDB_SETTING(PartitionedWriteFlushThresholdSetting), DUCKDB_SETTING(PartitionedWriteMaxOpenFilesSetting), - DUCKDB_GLOBAL(PasswordSetting), + DUCKDB_SETTING(PasswordSetting), DUCKDB_SETTING_CALLBACK(PerfectHtThresholdSetting), - DUCKDB_GLOBAL(PinThreadsSetting), + DUCKDB_SETTING_CALLBACK(PinThreadsSetting), DUCKDB_SETTING(PivotFilterThresholdSetting), DUCKDB_SETTING(PivotLimitSetting), DUCKDB_SETTING(PreferRangeJoinsSetting), @@ -172,7 +178,7 @@ static const ConfigurationOption internal_options[] = { DUCKDB_LOCAL(ProfilingModeSetting), DUCKDB_LOCAL(ProgressBarTimeSetting), DUCKDB_SETTING(ScalarSubqueryErrorOnMultipleRowsSetting), - DUCKDB_GLOBAL(SchedulerProcessPartialSetting), + DUCKDB_SETTING(SchedulerProcessPartialSetting), DUCKDB_LOCAL(SchemaSetting), DUCKDB_LOCAL(SearchPathSetting), DUCKDB_GLOBAL(SecretDirectorySetting), @@ -180,21 +186,21 @@ static const ConfigurationOption internal_options[] = { DUCKDB_GLOBAL(StorageCompatibilityVersionSetting), DUCKDB_LOCAL(StreamingBufferSizeSetting), DUCKDB_GLOBAL(TempDirectorySetting), - DUCKDB_GLOBAL(TempFileEncryptionSetting), + DUCKDB_SETTING_CALLBACK(TempFileEncryptionSetting), DUCKDB_GLOBAL(ThreadsSetting), - DUCKDB_GLOBAL(UsernameSetting), + DUCKDB_SETTING(UsernameSetting), DUCKDB_SETTING_CALLBACK(ValidateExternalFileCacheSetting), - DUCKDB_GLOBAL(VariantMinimumShreddingSize), + DUCKDB_SETTING(VariantMinimumShreddingSizeSetting), DUCKDB_SETTING(WriteBufferRowGroupCountSetting), - DUCKDB_GLOBAL(ZstdMinStringLengthSetting), + DUCKDB_SETTING(ZstdMinStringLengthSetting), FINAL_SETTING}; -static const ConfigurationAlias setting_aliases[] = {DUCKDB_SETTING_ALIAS("memory_limit", 90), +static const ConfigurationAlias setting_aliases[] = {DUCKDB_SETTING_ALIAS("memory_limit", 91), DUCKDB_SETTING_ALIAS("null_order", 38), - DUCKDB_SETTING_ALIAS("profiling_output", 109), - DUCKDB_SETTING_ALIAS("user", 124), + DUCKDB_SETTING_ALIAS("profiling_output", 110), + DUCKDB_SETTING_ALIAS("user", 125), DUCKDB_SETTING_ALIAS("wal_autocheckpoint", 22), - DUCKDB_SETTING_ALIAS("worker_threads", 123), + DUCKDB_SETTING_ALIAS("worker_threads", 124), FINAL_ALIAS}; vector DBConfig::GetOptions() { @@ -286,10 +292,10 @@ void DBConfig::SetOptionByName(const string &name, const Value &value) { return; } - auto param = extension_parameters.find(name); - if (param != extension_parameters.end()) { - Value target_value = value.DefaultCastAs(param->second.type); - SetOption(name, std::move(target_value)); + ExtensionOption extension_option; + if (TryGetExtensionOption(name, extension_option)) { + Value target_value = value.DefaultCastAs(extension_option.type); + SetOption(extension_option.setting_index.GetIndex(), std::move(target_value)); } else { options.unrecognized_options[name] = value; } @@ -304,7 +310,6 @@ void DBConfig::SetOptionsByName(const case_insensitive_map_t &values) { } void DBConfig::SetOption(optional_ptr db, const ConfigurationOption &option, const Value &value) { - lock_guard l(config_lock); Value input = value.DefaultCastAs(ParseLogicalType(option.parameter_type)); if (option.default_value) { // generic option @@ -312,52 +317,58 @@ void DBConfig::SetOption(optional_ptr db, const ConfigurationO SettingCallbackInfo info(*this, db); option.set_callback(info, input); } - options.set_variables.emplace(option.name, std::move(input)); + user_settings.SetUserSetting(option.setting_idx.GetIndex(), std::move(input)); return; } if (!option.set_global) { throw InvalidInputException("Could not set option \"%s\" as a global option", option.name); } + lock_guard guard(config_lock); D_ASSERT(option.reset_global); option.set_global(db.get(), *this, input); } void DBConfig::ResetOption(optional_ptr db, const ConfigurationOption &option) { - lock_guard l(config_lock); if (option.default_value) { // generic option - options.set_variables.erase(option.name); + user_settings.ClearSetting(option.setting_idx.GetIndex()); return; } if (!option.reset_global) { throw InternalException("Could not reset option \"%s\" as a global option", option.name); } + lock_guard guard(config_lock); D_ASSERT(option.set_global); option.reset_global(db.get(), *this); } -void DBConfig::SetOption(const String &name, Value value) { - lock_guard l(config_lock); - options.set_variables[name.ToStdString()] = std::move(value); +void DBConfig::SetOption(idx_t setting_index, Value value) { + user_settings.SetUserSetting(setting_index, std::move(value)); +} + +void DBConfig::SetOption(const string &name, Value value) { + optional_ptr option; + auto setting_index = TryGetSettingIndex(name, option); + if (!setting_index.IsValid()) { + throw InternalException("Unrecognized option %s in DBConfig::SetOption", name); + } + SetOption(setting_index.GetIndex(), std::move(value)); } -void DBConfig::ResetOption(const String &name) { - lock_guard l(config_lock); - auto extension_option = extension_parameters.find(name.ToStdString()); - D_ASSERT(extension_option != extension_parameters.end()); - auto &default_value = extension_option->second.default_value; +void DBConfig::ResetOption(const ExtensionOption &extension_option) { + auto &default_value = extension_option.default_value; + auto setting_index = extension_option.setting_index.GetIndex(); if (!default_value.IsNull()) { // Default is not NULL, override the setting - options.set_variables[name.ToStdString()] = default_value; + user_settings.SetUserSetting(setting_index, default_value); } else { // Otherwise just remove it from the 'set_variables' map - options.set_variables.erase(name.ToStdString()); + user_settings.ClearSetting(setting_index); } } -void DBConfig::ResetGenericOption(const String &name) { - lock_guard l(config_lock); - options.set_variables.erase(name.ToStdString()); +void DBConfig::ResetGenericOption(idx_t setting_index) { + user_settings.ClearSetting(setting_index); } LogicalType DBConfig::ParseLogicalType(const string &type) { @@ -450,28 +461,35 @@ LogicalType DBConfig::ParseLogicalType(const string &type) { return type_id; } -bool DBConfig::HasExtensionOption(const string &name) { - lock_guard l(config_lock); - return extension_parameters.find(name) != extension_parameters.end(); +bool DBConfig::HasExtensionOption(const string &name) const { + return user_settings.HasExtensionOption(name); +} + +bool DBConfig::TryGetExtensionOption(const String &name, ExtensionOption &result) const { + return user_settings.TryGetExtensionOption(name, result); } void DBConfig::AddExtensionOption(const string &name, string description, LogicalType parameter, const Value &default_value, set_option_callback_t function, SetScope default_scope) { - lock_guard l(config_lock); - extension_parameters.insert(make_pair( - name, ExtensionOption(std::move(description), std::move(parameter), function, default_value, default_scope))); + ExtensionOption extension_option(std::move(description), std::move(parameter), function, default_value, + default_scope); + auto setting_index = user_settings.AddExtensionOption(name, std::move(extension_option)); // copy over unrecognized options, if they match the new extension option auto iter = options.unrecognized_options.find(name); if (iter != options.unrecognized_options.end()) { - options.set_variables[name] = iter->second; + user_settings.SetUserSetting(setting_index, iter->second); options.unrecognized_options.erase(iter); } - if (!default_value.IsNull() && options.set_variables.find(name) == options.set_variables.end()) { + if (!default_value.IsNull() && !user_settings.IsSet(setting_index)) { // Default value is set, insert it into the 'set_variables' list - options.set_variables[name] = default_value; + user_settings.SetUserSetting(setting_index, default_value); } } +case_insensitive_map_t DBConfig::GetExtensionSettings() const { + return user_settings.GetExtensionSettings(); +} + bool DBConfig::IsInMemoryDatabase(const char *database_path) { if (!database_path) { // Entirely empty @@ -523,7 +541,7 @@ void DBConfig::SetDefaultTempDirectory() { } void DBConfig::CheckLock(const String &name) { - if (!options.lock_configuration) { + if (!Settings::Get(*this)) { // not locked return; } @@ -600,7 +618,6 @@ idx_t DBConfig::ParseMemoryLimit(const string &arg) { if (!error.empty()) { if (error == "Memory cannot be negative") { - // mapping negative memory values to infinite return NumericLimits::Maximum(); } else { throw ParserException(error); @@ -666,44 +683,47 @@ OrderType DBConfig::ResolveOrder(ClientContext &context, OrderType order_type) c if (order_type != OrderType::ORDER_DEFAULT) { return order_type; } - return GetSetting(context); + return Settings::Get(context); } -Value DBConfig::GetSettingInternal(const ClientContext &context, const char *setting, const char *default_value) { - Value result_val; - if (context.TryGetCurrentSetting(setting, result_val)) { - return result_val; - } - return Value(default_value); +SettingLookupResult DBConfig::TryGetCurrentUserSetting(idx_t setting_index, Value &result) const { + return user_settings.TryGetSetting(setting_index, result); } -Value DBConfig::GetSettingInternal(const DBConfig &config, const char *setting, const char *default_value) { - Value result_val; - if (config.TryGetCurrentSetting(setting, result_val)) { - return result_val; +SettingLookupResult DBConfig::TryGetDefaultValue(optional_ptr option, Value &result) { + if (!option || !option->default_value) { + return SettingLookupResult(); } - return Value(default_value); -} - -Value DBConfig::GetSettingInternal(const DatabaseInstance &db, const char *setting, const char *default_value) { - return GetSettingInternal(DBConfig::GetConfig(db), setting, default_value); + auto input_type = ParseLogicalType(option->parameter_type); + result = Value(option->default_value).DefaultCastAs(input_type); + return SettingLookupResult(SettingScope::GLOBAL); } SettingLookupResult DBConfig::TryGetCurrentSetting(const string &key, Value &result) const { - const auto &global_config_map = options.set_variables; + optional_ptr option; + auto setting_index = TryGetSettingIndex(key, option); + if (setting_index.IsValid()) { + auto lookup_result = TryGetCurrentUserSetting(setting_index.GetIndex(), result); + if (lookup_result) { + return lookup_result; + } + } + return TryGetDefaultValue(option, result); +} - auto global_value = global_config_map.find(key); - if (global_value != global_config_map.end()) { - result = global_value->second; - return SettingLookupResult(SettingScope::GLOBAL); +optional_idx DBConfig::TryGetSettingIndex(const String &name, optional_ptr &option) const { + ExtensionOption extension_option; + if (TryGetExtensionOption(name, extension_option)) { + // extension setting + return extension_option.setting_index; } - auto option = GetOptionByName(key); - if (option && option->default_value) { - auto input_type = ParseLogicalType(option->parameter_type); - result = Value(option->default_value).DefaultCastAs(input_type); - return SettingLookupResult(SettingScope::GLOBAL); + option = GetOptionByName(name); + if (option) { + // built-in setting + return option->setting_idx; } - return SettingLookupResult(); + // unknown setting + return optional_idx(); } OrderByNullType DBConfig::ResolveNullOrder(ClientContext &context, OrderType order_type, @@ -711,7 +731,7 @@ OrderByNullType DBConfig::ResolveNullOrder(ClientContext &context, OrderType ord if (null_type != OrderByNullType::ORDER_DEFAULT) { return null_type; } - auto null_order = GetSetting(context); + auto null_order = Settings::Get(context); switch (null_order) { case DefaultOrderByNullType::NULLS_FIRST: return OrderByNullType::NULLS_FIRST; @@ -726,11 +746,16 @@ OrderByNullType DBConfig::ResolveNullOrder(ClientContext &context, OrderType ord } } +string GetDefaultUserAgent() { + return StringUtil::Format("duckdb/%s(%s)", DuckDB::LibraryVersion(), DuckDB::Platform()); +} + const string DBConfig::UserAgent() const { auto user_agent = GetDefaultUserAgent(); - if (!options.duckdb_api.empty()) { - user_agent += " " + options.duckdb_api; + auto duckdb_api = Settings::Get(*this); + if (!duckdb_api.empty()) { + user_agent += " " + duckdb_api; } if (!options.custom_user_agent.empty()) { @@ -766,7 +791,7 @@ void DBConfig::AddAllowedPath(const string &path) { } bool DBConfig::CanAccessFile(const string &input_path, FileType type) { - if (options.enable_external_access) { + if (Settings::Get(*this)) { // all external access is allowed return true; } diff --git a/src/duckdb/src/main/database.cpp b/src/duckdb/src/main/database.cpp index 6badf7f9d..cfd40872f 100644 --- a/src/duckdb/src/main/database.cpp +++ b/src/duckdb/src/main/database.cpp @@ -220,7 +220,7 @@ void DatabaseInstance::LoadExtensionSettings() { // copy the map, to protect against modifications during auto unrecognized_options_copy = config.options.unrecognized_options; - if (config.options.autoload_known_extensions) { + if (Settings::Get(*this)) { if (unrecognized_options_copy.empty()) { // Nothing to do return; @@ -243,14 +243,14 @@ void DatabaseInstance::LoadExtensionSettings() { "To set the %s setting, the %s extension needs to be loaded. But it could not be autoloaded.", name, extension_name); } - auto it = config.extension_parameters.find(name); - if (it == config.extension_parameters.end()) { + ExtensionOption extension_option; + if (!config.TryGetExtensionOption(name, extension_option)) { throw InternalException("Extension %s did not provide the '%s' config setting", extension_name, name); } // if the extension provided the option, it should no longer be unrecognized. D_ASSERT(config.options.unrecognized_options.find(name) == config.options.unrecognized_options.end()); auto &context = *con.context; - PhysicalSet::SetExtensionVariable(context, it->second, name, SetScope::GLOBAL, value); + PhysicalSet::SetExtensionVariable(context, extension_option, name, SetScope::GLOBAL, value); extension_options.push_back(name); } @@ -287,7 +287,8 @@ void DatabaseInstance::Initialize(const char *database_path, DBConfig *user_conf log_manager = make_uniq(*this, LogConfig()); log_manager->Initialize(); - external_file_cache = make_uniq(*this, config.options.enable_external_file_cache); + bool enable_external_file_cache = Settings::Get(config); + external_file_cache = make_uniq(*this, enable_external_file_cache); result_set_manager = make_uniq(*this); scheduler = make_uniq(*this); @@ -323,7 +324,7 @@ void DatabaseInstance::Initialize(const char *database_path, DBConfig *user_conf } // only increase thread count after storage init because we get races on catalog otherwise - scheduler->SetThreads(config.options.maximum_threads, config.options.external_threads); + scheduler->SetThreads(config.options.maximum_threads, Settings::Get(config)); scheduler->RelaunchThreads(); } @@ -414,8 +415,9 @@ Allocator &Allocator::Get(AttachedDatabase &db) { void DatabaseInstance::Configure(DBConfig &new_config, const char *database_path) { config.options = new_config.options; + config.user_settings = new_config.user_settings; - if (config.options.duckdb_api.empty()) { + if (Settings::Get(*this).empty()) { config.SetOptionByName("duckdb_api", "cpp"); } @@ -432,13 +434,12 @@ void DatabaseInstance::Configure(DBConfig &new_config, const char *database_path if (config.options.access_mode == AccessMode::UNDEFINED) { config.options.access_mode = AccessMode::READ_WRITE; } - config.extension_parameters = new_config.extension_parameters; if (new_config.file_system) { config.file_system = std::move(new_config.file_system); } else { config.file_system = make_uniq(FileSystem::CreateLocal()); } - if (database_path && !config.options.enable_external_access) { + if (database_path && !Settings::Get(*this)) { config.AddAllowedPath(database_path); config.AddAllowedPath(database_path + string(".wal")); if (!config.options.temporary_directory.empty()) { @@ -461,7 +462,8 @@ void DatabaseInstance::Configure(DBConfig &new_config, const char *database_path if (!config.allocator) { config.allocator = make_uniq(); } - config.block_allocator = make_uniq(*config.allocator, config.options.default_block_alloc_size, + auto default_block_size = Settings::Get(config); + config.block_allocator = make_uniq(*config.allocator, default_block_size, DBConfig::GetSystemAvailableMemory(*config.file_system) * 8 / 10, config.options.block_allocator_size); config.replacement_scans = std::move(new_config.replacement_scans); diff --git a/src/duckdb/src/main/extension/extension_helper.cpp b/src/duckdb/src/main/extension/extension_helper.cpp index 9058f19e1..a9737342d 100644 --- a/src/duckdb/src/main/extension/extension_helper.cpp +++ b/src/duckdb/src/main/extension/extension_helper.cpp @@ -181,18 +181,16 @@ string ExtensionHelper::AddExtensionInstallHintToErrorMsg(DatabaseInstance &db, const string &extension_name) { string install_hint; - auto &config = db.config; - if (!ExtensionHelper::CanAutoloadExtension(extension_name)) { install_hint = "Please try installing and loading the " + extension_name + " extension:\nINSTALL " + extension_name + ";\nLOAD " + extension_name + ";\n\n"; - } else if (!config.options.autoload_known_extensions) { + } else if (!Settings::Get(db)) { install_hint = "Please try installing and loading the " + extension_name + " extension by running:\nINSTALL " + extension_name + ";\nLOAD " + extension_name + ";\n\nAlternatively, consider enabling auto-install " "and auto-load by running:\nSET autoinstall_known_extensions=1;\nSET autoload_known_extensions=1;"; - } else if (!config.options.autoinstall_known_extensions) { + } else if (!Settings::Get(db)) { install_hint = "Please try installing the " + extension_name + " extension by running:\nINSTALL " + extension_name + ";\n\nAlternatively, consider enabling autoinstall by running:\nSET autoinstall_known_extensions=1;"; @@ -209,11 +207,10 @@ bool ExtensionHelper::TryAutoLoadExtension(ClientContext &context, const string if (context.db->ExtensionIsLoaded(extension_name)) { return true; } - auto &dbconfig = DBConfig::GetConfig(context); try { - if (dbconfig.options.autoinstall_known_extensions) { - auto autoinstall_repo = ExtensionRepository::GetRepositoryByUrl( - StringValue::Get(DBConfig::GetConfig(context).options.autoinstall_extension_repo)); + if (Settings::Get(context)) { + auto autoinstall_repo_setting = Settings::Get(context); + auto autoinstall_repo = ExtensionRepository::GetRepositoryByUrl(autoinstall_repo_setting); ExtensionInstallOptions options; options.repository = autoinstall_repo; ExtensionHelper::InstallExtension(context, extension_name, options); @@ -225,10 +222,10 @@ bool ExtensionHelper::TryAutoLoadExtension(ClientContext &context, const string } } -static string GetAutoInstallExtensionsRepository(const DBConfigOptions &options) { - string repository_url = options.autoinstall_extension_repo; +static string GetAutoInstallExtensionsRepository(const DBConfig &config) { + string repository_url = Settings::Get(config); if (repository_url.empty()) { - repository_url = options.custom_extension_repo; + repository_url = Settings::Get(config); } return repository_url; } @@ -240,8 +237,8 @@ bool ExtensionHelper::TryAutoLoadExtension(DatabaseInstance &instance, const str auto &dbconfig = DBConfig::GetConfig(instance); try { auto &fs = FileSystem::GetFileSystem(instance); - if (dbconfig.options.autoinstall_known_extensions) { - auto repository_url = GetAutoInstallExtensionsRepository(dbconfig.options); + if (Settings::Get(instance)) { + auto repository_url = GetAutoInstallExtensionsRepository(dbconfig); auto autoinstall_repo = ExtensionRepository::GetRepositoryByUrl(repository_url); ExtensionInstallOptions options; options.repository = autoinstall_repo; @@ -274,7 +271,7 @@ static ExtensionUpdateResult UpdateExtensionInternal(ClientContext &context, Dat // Parse the version of the extension before updating auto ext_binary_handle = fs.OpenFile(full_extension_path, FileOpenFlags::FILE_FLAGS_READ); auto parsed_metadata = ExtensionHelper::ParseExtensionMetaData(*ext_binary_handle); - if (!parsed_metadata.AppearsValid() && !DBConfig::GetSetting(context)) { + if (!parsed_metadata.AppearsValid() && !Settings::Get(context)) { throw IOException( "Failed to update extension: '%s', the metadata of the extension appears invalid! To resolve this, either " "reinstall the extension using 'FORCE INSTALL %s', manually remove the file '%s', or enable '" @@ -388,8 +385,8 @@ void ExtensionHelper::AutoLoadExtension(DatabaseInstance &db, const string &exte try { auto fs = FileSystem::CreateLocal(); #ifndef DUCKDB_WASM - if (dbconfig.options.autoinstall_known_extensions) { - auto repository_url = GetAutoInstallExtensionsRepository(dbconfig.options); + if (Settings::Get(db)) { + auto repository_url = GetAutoInstallExtensionsRepository(dbconfig); auto autoinstall_repo = ExtensionRepository::GetRepositoryByUrl(repository_url); ExtensionInstallOptions options; options.repository = autoinstall_repo; diff --git a/src/duckdb/src/main/extension/extension_install.cpp b/src/duckdb/src/main/extension/extension_install.cpp index 5241810b0..3fa2ebff7 100644 --- a/src/duckdb/src/main/extension/extension_install.cpp +++ b/src/duckdb/src/main/extension/extension_install.cpp @@ -100,8 +100,9 @@ vector ExtensionHelper::GetExtensionDirectoryPath(DatabaseInstance &db, vector extension_directories; auto &config = db.config; - if (!config.options.extension_directory.empty()) { - extension_directories.push_back(config.options.extension_directory); + auto custom_extension_directory = Settings::Get(config); + if (!custom_extension_directory.empty()) { + extension_directories.push_back(custom_extension_directory); } if (!config.options.extension_directories.empty()) { @@ -269,7 +270,7 @@ static void CheckExtensionMetadataOnInstall(DatabaseInstance &db, void *in_buffe auto metadata_mismatch_error = parsed_metadata.GetInvalidMetadataError(); - if (!metadata_mismatch_error.empty() && !DBConfig::GetSetting(db)) { + if (!metadata_mismatch_error.empty() && !Settings::Get(db)) { throw IOException("Failed to install '%s'\n%s", extension_name, metadata_mismatch_error); } @@ -310,7 +311,7 @@ static unique_ptr DirectInstallExtension(DatabaseInstance if (context) { auto &db = DatabaseInstance::GetDatabase(*context); if (extension == "httpfs" && !db.ExtensionIsLoaded("httpfs") && - db.config.options.autoload_known_extensions) { + Settings::Get(*context)) { ExtensionHelper::AutoLoadExtension(*context, "httpfs"); } } @@ -531,7 +532,7 @@ unique_ptr ExtensionHelper::InstallExtensionInternal(Datab if (fs.FileExists(local_extension_path) && !options.force_install) { // File exists: throw error if origin mismatches - if (options.throw_on_origin_mismatch && !DBConfig::GetSetting(db) && + if (options.throw_on_origin_mismatch && !Settings::Get(db) && fs.FileExists(local_extension_path + ".info")) { ThrowErrorOnMismatchingExtensionOrigin(fs, local_extension_path, extension_name, extension, options.repository); diff --git a/src/duckdb/src/main/extension/extension_load.cpp b/src/duckdb/src/main/extension/extension_load.cpp index 0b88a2071..1003354bf 100644 --- a/src/duckdb/src/main/extension/extension_load.cpp +++ b/src/duckdb/src/main/extension/extension_load.cpp @@ -81,14 +81,14 @@ struct ExtensionAccess { } //! Called by the extension get a pointer to the database that is loading it - static duckdb_database GetDatabase(duckdb_extension_info info) { + static duckdb_database *GetDatabase(duckdb_extension_info info) { auto &load_state = DuckDBExtensionLoadState::Get(info); try { // Create the duckdb_database load_state.database_data = make_uniq(); load_state.database_data->database = make_shared_ptr(load_state.db); - return reinterpret_cast(load_state.database_data.get()); + return reinterpret_cast(load_state.database_data.get()); } catch (std::exception &ex) { load_state.has_error = true; load_state.error_data = ErrorData(ex); @@ -315,7 +315,7 @@ bool ExtensionHelper::TryInitialLoad(DatabaseInstance &db, FileSystem &fs, const #ifdef DUCKDB_DISABLE_EXTENSION_LOAD throw PermissionException("Loading external extensions is disabled through a compile time flag"); #else - if (!db.config.options.enable_external_access) { + if (!Settings::Get(db)) { throw PermissionException("Loading external extensions is disabled through configuration"); } auto filename = fs.ConvertSeparators(extension); @@ -365,8 +365,9 @@ bool ExtensionHelper::TryInitialLoad(DatabaseInstance &db, FileSystem &fs, const // Collect all directories to search for extensions vector search_directories; - if (!db.config.options.extension_directory.empty()) { - search_directories.push_back(db.config.options.extension_directory); + auto custom_extension_directory = Settings::Get(db); + if (!custom_extension_directory.empty()) { + search_directories.push_back(custom_extension_directory); } if (!db.config.options.extension_directories.empty()) { @@ -423,11 +424,11 @@ bool ExtensionHelper::TryInitialLoad(DatabaseInstance &db, FileSystem &fs, const metadata_mismatch_error = StringUtil::Format("Failed to load '%s', %s", extension, metadata_mismatch_error); } - if (!db.config.options.allow_unsigned_extensions) { + if (!Settings::Get(db)) { bool signature_valid; if (parsed_metadata.AppearsValid()) { - signature_valid = - CheckExtensionSignature(*handle, parsed_metadata, db.config.options.allow_community_extensions); + bool allow_community_extensions = Settings::Get(db); + signature_valid = CheckExtensionSignature(*handle, parsed_metadata, allow_community_extensions); } else { signature_valid = false; } @@ -439,7 +440,7 @@ bool ExtensionHelper::TryInitialLoad(DatabaseInstance &db, FileSystem &fs, const if (!signature_valid) { throw IOException(db.config.error_manager->FormatException(ErrorType::UNSIGNED_EXTENSION, filename)); } - } else if (!DBConfig::GetSetting(db)) { + } else if (!Settings::Get(db)) { if (!metadata_mismatch_error.empty()) { // Unsigned extensions AND configuration allowing n, loading allowed, mainly for // debugging purposes @@ -514,8 +515,7 @@ ExtensionInitResult ExtensionHelper::InitialLoad(DatabaseInstance &db, FileSyste string error; ExtensionInitResult result; if (!TryInitialLoad(db, fs, extension, result, error)) { - auto &config = DBConfig::GetConfig(db); - if (!config.options.autoinstall_known_extensions || !ExtensionHelper::AllowAutoInstall(extension)) { + if (!Settings::Get(db) || !ExtensionHelper::AllowAutoInstall(extension)) { throw IOException(error); } // the extension load failed - try installing the extension diff --git a/src/duckdb/src/main/extension_install_info.cpp b/src/duckdb/src/main/extension_install_info.cpp index 8c9e69e00..86cc58be2 100644 --- a/src/duckdb/src/main/extension_install_info.cpp +++ b/src/duckdb/src/main/extension_install_info.cpp @@ -1,6 +1,7 @@ #include "duckdb/main/extension_install_info.hpp" #include "duckdb/common/string.hpp" #include "duckdb/common/file_system.hpp" +#include "duckdb/main/settings.hpp" #include "duckdb/common/serializer/buffered_file_reader.hpp" #include "duckdb/common/serializer/binary_deserializer.hpp" @@ -45,8 +46,11 @@ string ExtensionRepository::TryConvertUrlToKnownRepository(const string &url) { } ExtensionRepository ExtensionRepository::GetDefaultRepository(optional_ptr config) { - if (config && !config->options.custom_extension_repo.empty()) { - return ExtensionRepository("", config->options.custom_extension_repo); + if (config) { + auto custom_extension_repo = Settings::Get(*config); + if (!custom_extension_repo.empty()) { + return ExtensionRepository("", custom_extension_repo); + } } return GetCoreRepository(); diff --git a/src/duckdb/src/main/http/http_util.cpp b/src/duckdb/src/main/http/http_util.cpp index f562dd8cc..8a1008436 100644 --- a/src/duckdb/src/main/http/http_util.cpp +++ b/src/duckdb/src/main/http/http_util.cpp @@ -8,6 +8,7 @@ #include "duckdb/main/client_data.hpp" #include "duckdb/main/database.hpp" #include "duckdb/main/database_file_opener.hpp" +#include "duckdb/main/settings.hpp" #ifndef DISABLE_DUCKDB_REMOTE_INSTALL #ifndef DUCKDB_DISABLE_EXTENSION_LOAD @@ -456,16 +457,16 @@ HTTPUtil::RunRequestWithRetry(const std::function(void) void HTTPParams::Initialize(optional_ptr opener) { auto db = FileOpener::TryGetDatabase(opener); if (db) { - auto &config = db->config; - if (!config.options.http_proxy.empty()) { + auto http_proxy_setting = Settings::Get(*db); + if (!http_proxy_setting.empty()) { idx_t port; string host; - HTTPUtil::ParseHTTPProxyHost(config.options.http_proxy, host, port); + HTTPUtil::ParseHTTPProxyHost(http_proxy_setting, host, port); http_proxy = host; http_proxy_port = port; } - http_proxy_username = config.options.http_proxy_username; - http_proxy_password = config.options.http_proxy_password; + http_proxy_username = Settings::Get(*db); + http_proxy_password = Settings::Get(*db); } auto client_context = FileOpener::TryGetClientContext(opener); diff --git a/src/duckdb/src/main/settings/autogenerated_settings.cpp b/src/duckdb/src/main/settings/autogenerated_settings.cpp index d15157226..b876fdd8e 100644 --- a/src/duckdb/src/main/settings/autogenerated_settings.cpp +++ b/src/duckdb/src/main/settings/autogenerated_settings.cpp @@ -34,114 +34,11 @@ Value AccessModeSetting::GetSetting(const ClientContext &context) { return Value(StringUtil::Lower(EnumUtil::ToString(config.options.access_mode))); } -//===----------------------------------------------------------------------===// -// Allocator Background Threads -//===----------------------------------------------------------------------===// -void AllocatorBackgroundThreadsSetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) { - if (!OnGlobalSet(db, config, input)) { - return; - } - config.options.allocator_background_threads = input.GetValue(); -} - -void AllocatorBackgroundThreadsSetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) { - if (!OnGlobalReset(db, config)) { - return; - } - config.options.allocator_background_threads = DBConfigOptions().allocator_background_threads; -} - -Value AllocatorBackgroundThreadsSetting::GetSetting(const ClientContext &context) { - auto &config = DBConfig::GetConfig(context); - return Value::BOOLEAN(config.options.allocator_background_threads); -} - -//===----------------------------------------------------------------------===// -// Allow Community Extensions -//===----------------------------------------------------------------------===// -void AllowCommunityExtensionsSetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) { - if (!OnGlobalSet(db, config, input)) { - return; - } - config.options.allow_community_extensions = input.GetValue(); -} - -void AllowCommunityExtensionsSetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) { - if (!OnGlobalReset(db, config)) { - return; - } - config.options.allow_community_extensions = DBConfigOptions().allow_community_extensions; -} - -Value AllowCommunityExtensionsSetting::GetSetting(const ClientContext &context) { - auto &config = DBConfig::GetConfig(context); - return Value::BOOLEAN(config.options.allow_community_extensions); -} - //===----------------------------------------------------------------------===// // Allow Parser Override Extension //===----------------------------------------------------------------------===// -void AllowParserOverrideExtensionSetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) { - if (!OnGlobalSet(db, config, input)) { - return; - } - config.options.allow_parser_override_extension = input.GetValue(); -} - -void AllowParserOverrideExtensionSetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) { - if (!OnGlobalReset(db, config)) { - return; - } - config.options.allow_parser_override_extension = DBConfigOptions().allow_parser_override_extension; -} - -Value AllowParserOverrideExtensionSetting::GetSetting(const ClientContext &context) { - auto &config = DBConfig::GetConfig(context); - return Value(config.options.allow_parser_override_extension); -} - -//===----------------------------------------------------------------------===// -// Allow Unredacted Secrets -//===----------------------------------------------------------------------===// -void AllowUnredactedSecretsSetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) { - if (!OnGlobalSet(db, config, input)) { - return; - } - config.options.allow_unredacted_secrets = input.GetValue(); -} - -void AllowUnredactedSecretsSetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) { - if (!OnGlobalReset(db, config)) { - return; - } - config.options.allow_unredacted_secrets = DBConfigOptions().allow_unredacted_secrets; -} - -Value AllowUnredactedSecretsSetting::GetSetting(const ClientContext &context) { - auto &config = DBConfig::GetConfig(context); - return Value::BOOLEAN(config.options.allow_unredacted_secrets); -} - -//===----------------------------------------------------------------------===// -// Allow Unsigned Extensions -//===----------------------------------------------------------------------===// -void AllowUnsignedExtensionsSetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) { - if (!OnGlobalSet(db, config, input)) { - return; - } - config.options.allow_unsigned_extensions = input.GetValue(); -} - -void AllowUnsignedExtensionsSetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) { - if (!OnGlobalReset(db, config)) { - return; - } - config.options.allow_unsigned_extensions = DBConfigOptions().allow_unsigned_extensions; -} - -Value AllowUnsignedExtensionsSetting::GetSetting(const ClientContext &context) { - auto &config = DBConfig::GetConfig(context); - return Value::BOOLEAN(config.options.allow_unsigned_extensions); +void AllowParserOverrideExtensionSetting::OnSet(SettingCallbackInfo &info, Value ¶meter) { + EnumUtil::FromString(StringValue::Get(parameter)); } //===----------------------------------------------------------------------===// @@ -151,54 +48,6 @@ void ArrowOutputVersionSetting::OnSet(SettingCallbackInfo &info, Value ¶mete EnumUtil::FromString(StringValue::Get(parameter)); } -//===----------------------------------------------------------------------===// -// Autoinstall Extension Repository -//===----------------------------------------------------------------------===// -void AutoinstallExtensionRepositorySetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) { - config.options.autoinstall_extension_repo = input.GetValue(); -} - -void AutoinstallExtensionRepositorySetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) { - config.options.autoinstall_extension_repo = DBConfigOptions().autoinstall_extension_repo; -} - -Value AutoinstallExtensionRepositorySetting::GetSetting(const ClientContext &context) { - auto &config = DBConfig::GetConfig(context); - return Value(config.options.autoinstall_extension_repo); -} - -//===----------------------------------------------------------------------===// -// Autoinstall Known Extensions -//===----------------------------------------------------------------------===// -void AutoinstallKnownExtensionsSetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) { - config.options.autoinstall_known_extensions = input.GetValue(); -} - -void AutoinstallKnownExtensionsSetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) { - config.options.autoinstall_known_extensions = DBConfigOptions().autoinstall_known_extensions; -} - -Value AutoinstallKnownExtensionsSetting::GetSetting(const ClientContext &context) { - auto &config = DBConfig::GetConfig(context); - return Value::BOOLEAN(config.options.autoinstall_known_extensions); -} - -//===----------------------------------------------------------------------===// -// Autoload Known Extensions -//===----------------------------------------------------------------------===// -void AutoloadKnownExtensionsSetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) { - config.options.autoload_known_extensions = input.GetValue(); -} - -void AutoloadKnownExtensionsSetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) { - config.options.autoload_known_extensions = DBConfigOptions().autoload_known_extensions; -} - -Value AutoloadKnownExtensionsSetting::GetSetting(const ClientContext &context) { - auto &config = DBConfig::GetConfig(context); - return Value::BOOLEAN(config.options.autoload_known_extensions); -} - //===----------------------------------------------------------------------===// // Checkpoint Threshold //===----------------------------------------------------------------------===// @@ -206,22 +55,6 @@ void CheckpointThresholdSetting::ResetGlobal(DatabaseInstance *db, DBConfig &con config.options.checkpoint_wal_size = DBConfigOptions().checkpoint_wal_size; } -//===----------------------------------------------------------------------===// -// Custom Extension Repository -//===----------------------------------------------------------------------===// -void CustomExtensionRepositorySetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) { - config.options.custom_extension_repo = input.GetValue(); -} - -void CustomExtensionRepositorySetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) { - config.options.custom_extension_repo = DBConfigOptions().custom_extension_repo; -} - -Value CustomExtensionRepositorySetting::GetSetting(const ClientContext &context) { - auto &config = DBConfig::GetConfig(context); - return Value(config.options.custom_extension_repo); -} - //===----------------------------------------------------------------------===// // Custom User Agent //===----------------------------------------------------------------------===// @@ -275,66 +108,6 @@ void DebugWindowModeSetting::OnSet(SettingCallbackInfo &info, Value ¶meter) EnumUtil::FromString(StringValue::Get(parameter)); } -//===----------------------------------------------------------------------===// -// Disable Database Invalidation -//===----------------------------------------------------------------------===// -void DisableDatabaseInvalidationSetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) { - if (!OnGlobalSet(db, config, input)) { - return; - } - config.options.disable_database_invalidation = input.GetValue(); -} - -void DisableDatabaseInvalidationSetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) { - if (!OnGlobalReset(db, config)) { - return; - } - config.options.disable_database_invalidation = DBConfigOptions().disable_database_invalidation; -} - -Value DisableDatabaseInvalidationSetting::GetSetting(const ClientContext &context) { - auto &config = DBConfig::GetConfig(context); - return Value::BOOLEAN(config.options.disable_database_invalidation); -} - -//===----------------------------------------------------------------------===// -// Enable External Access -//===----------------------------------------------------------------------===// -void EnableExternalAccessSetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) { - if (!OnGlobalSet(db, config, input)) { - return; - } - config.options.enable_external_access = input.GetValue(); -} - -void EnableExternalAccessSetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) { - if (!OnGlobalReset(db, config)) { - return; - } - config.options.enable_external_access = DBConfigOptions().enable_external_access; -} - -Value EnableExternalAccessSetting::GetSetting(const ClientContext &context) { - auto &config = DBConfig::GetConfig(context); - return Value::BOOLEAN(config.options.enable_external_access); -} - -//===----------------------------------------------------------------------===// -// Enable H T T P Metadata Cache -//===----------------------------------------------------------------------===// -void EnableHTTPMetadataCacheSetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) { - config.options.http_metadata_cache_enable = input.GetValue(); -} - -void EnableHTTPMetadataCacheSetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) { - config.options.http_metadata_cache_enable = DBConfigOptions().http_metadata_cache_enable; -} - -Value EnableHTTPMetadataCacheSetting::GetSetting(const ClientContext &context) { - auto &config = DBConfig::GetConfig(context); - return Value::BOOLEAN(config.options.http_metadata_cache_enable); -} - //===----------------------------------------------------------------------===// // Enable Progress Bar //===----------------------------------------------------------------------===// @@ -358,203 +131,32 @@ Value EnableProgressBarSetting::GetSetting(const ClientContext &context) { return Value::BOOLEAN(config.enable_progress_bar); } -//===----------------------------------------------------------------------===// -// Errors As J S O N -//===----------------------------------------------------------------------===// -void ErrorsAsJSONSetting::SetLocal(ClientContext &context, const Value &input) { - auto &config = ClientConfig::GetConfig(context); - config.errors_as_json = input.GetValue(); -} - -void ErrorsAsJSONSetting::ResetLocal(ClientContext &context) { - ClientConfig::GetConfig(context).errors_as_json = ClientConfig().errors_as_json; -} - -Value ErrorsAsJSONSetting::GetSetting(const ClientContext &context) { - auto &config = ClientConfig::GetConfig(context); - return Value::BOOLEAN(config.errors_as_json); -} - //===----------------------------------------------------------------------===// // Explain Output //===----------------------------------------------------------------------===// -void ExplainOutputSetting::SetLocal(ClientContext &context, const Value &input) { - auto &config = ClientConfig::GetConfig(context); - auto str_input = StringUtil::Upper(input.GetValue()); - config.explain_output_type = EnumUtil::FromString(str_input); -} - -void ExplainOutputSetting::ResetLocal(ClientContext &context) { - ClientConfig::GetConfig(context).explain_output_type = ClientConfig().explain_output_type; -} - -Value ExplainOutputSetting::GetSetting(const ClientContext &context) { - auto &config = ClientConfig::GetConfig(context); - return Value(StringUtil::Lower(EnumUtil::ToString(config.explain_output_type))); -} - -//===----------------------------------------------------------------------===// -// Extension Directory -//===----------------------------------------------------------------------===// -void ExtensionDirectorySetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) { - config.options.extension_directory = input.GetValue(); -} - -void ExtensionDirectorySetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) { - config.options.extension_directory = DBConfigOptions().extension_directory; -} - -Value ExtensionDirectorySetting::GetSetting(const ClientContext &context) { - auto &config = DBConfig::GetConfig(context); - return Value(config.options.extension_directory); -} - -//===----------------------------------------------------------------------===// -// External Threads -//===----------------------------------------------------------------------===// -void ExternalThreadsSetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) { - if (!OnGlobalSet(db, config, input)) { - return; - } - config.options.external_threads = input.GetValue(); -} - -void ExternalThreadsSetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) { - if (!OnGlobalReset(db, config)) { - return; - } - config.options.external_threads = DBConfigOptions().external_threads; -} - -Value ExternalThreadsSetting::GetSetting(const ClientContext &context) { - auto &config = DBConfig::GetConfig(context); - return Value::UBIGINT(config.options.external_threads); -} - -//===----------------------------------------------------------------------===// -// Home Directory -//===----------------------------------------------------------------------===// -void HomeDirectorySetting::ResetLocal(ClientContext &context) { - ClientConfig::GetConfig(context).home_directory = ClientConfig().home_directory; -} - -Value HomeDirectorySetting::GetSetting(const ClientContext &context) { - auto &config = ClientConfig::GetConfig(context); - return Value(config.home_directory); -} - -//===----------------------------------------------------------------------===// -// H T T P Proxy -//===----------------------------------------------------------------------===// -void HTTPProxySetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) { - config.options.http_proxy = input.GetValue(); -} - -void HTTPProxySetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) { - config.options.http_proxy = DBConfigOptions().http_proxy; -} - -Value HTTPProxySetting::GetSetting(const ClientContext &context) { - auto &config = DBConfig::GetConfig(context); - return Value(config.options.http_proxy); -} - -//===----------------------------------------------------------------------===// -// H T T P Proxy Password -//===----------------------------------------------------------------------===// -void HTTPProxyPasswordSetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) { - config.options.http_proxy_password = input.GetValue(); -} - -void HTTPProxyPasswordSetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) { - config.options.http_proxy_password = DBConfigOptions().http_proxy_password; -} - -Value HTTPProxyPasswordSetting::GetSetting(const ClientContext &context) { - auto &config = DBConfig::GetConfig(context); - return Value(config.options.http_proxy_password); -} - -//===----------------------------------------------------------------------===// -// H T T P Proxy Username -//===----------------------------------------------------------------------===// -void HTTPProxyUsernameSetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) { - config.options.http_proxy_username = input.GetValue(); -} - -void HTTPProxyUsernameSetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) { - config.options.http_proxy_username = DBConfigOptions().http_proxy_username; -} - -Value HTTPProxyUsernameSetting::GetSetting(const ClientContext &context) { - auto &config = DBConfig::GetConfig(context); - return Value(config.options.http_proxy_username); +void ExplainOutputSetting::OnSet(SettingCallbackInfo &info, Value ¶meter) { + EnumUtil::FromString(StringValue::Get(parameter)); } //===----------------------------------------------------------------------===// -// Lock Configuration +// Force Bitpacking Mode //===----------------------------------------------------------------------===// -void LockConfigurationSetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) { - config.options.lock_configuration = input.GetValue(); -} - -void LockConfigurationSetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) { - config.options.lock_configuration = DBConfigOptions().lock_configuration; -} - -Value LockConfigurationSetting::GetSetting(const ClientContext &context) { - auto &config = DBConfig::GetConfig(context); - return Value::BOOLEAN(config.options.lock_configuration); +void ForceBitpackingModeSetting::OnSet(SettingCallbackInfo &info, Value ¶meter) { + EnumUtil::FromString(StringValue::Get(parameter)); } //===----------------------------------------------------------------------===// -// Max Expression Depth +// Lambda Syntax //===----------------------------------------------------------------------===// -void MaxExpressionDepthSetting::SetLocal(ClientContext &context, const Value &input) { - auto &config = ClientConfig::GetConfig(context); - config.max_expression_depth = input.GetValue(); -} - -void MaxExpressionDepthSetting::ResetLocal(ClientContext &context) { - ClientConfig::GetConfig(context).max_expression_depth = ClientConfig().max_expression_depth; -} - -Value MaxExpressionDepthSetting::GetSetting(const ClientContext &context) { - auto &config = ClientConfig::GetConfig(context); - return Value::UBIGINT(config.max_expression_depth); +void LambdaSyntaxSetting::OnSet(SettingCallbackInfo &info, Value ¶meter) { + EnumUtil::FromString(StringValue::Get(parameter)); } //===----------------------------------------------------------------------===// // Pin Threads //===----------------------------------------------------------------------===// -void PinThreadsSetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) { - auto str_input = StringUtil::Upper(input.GetValue()); - config.options.pin_threads = EnumUtil::FromString(str_input); -} - -void PinThreadsSetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) { - config.options.pin_threads = DBConfigOptions().pin_threads; -} - -Value PinThreadsSetting::GetSetting(const ClientContext &context) { - auto &config = DBConfig::GetConfig(context); - return Value(StringUtil::Lower(EnumUtil::ToString(config.options.pin_threads))); -} - -//===----------------------------------------------------------------------===// -// Scheduler Process Partial -//===----------------------------------------------------------------------===// -void SchedulerProcessPartialSetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) { - config.options.scheduler_process_partial = input.GetValue(); -} - -void SchedulerProcessPartialSetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) { - config.options.scheduler_process_partial = DBConfigOptions().scheduler_process_partial; -} - -Value SchedulerProcessPartialSetting::GetSetting(const ClientContext &context) { - auto &config = DBConfig::GetConfig(context); - return Value::BOOLEAN(config.options.scheduler_process_partial); +void PinThreadsSetting::OnSet(SettingCallbackInfo &info, Value ¶meter) { + EnumUtil::FromString(StringValue::Get(parameter)); } //===----------------------------------------------------------------------===// @@ -571,36 +173,4 @@ void ValidateExternalFileCacheSetting::OnSet(SettingCallbackInfo &info, Value &p EnumUtil::FromString(StringValue::Get(parameter)); } -//===----------------------------------------------------------------------===// -// Variant Minimum Shredding Size -//===----------------------------------------------------------------------===// -void VariantMinimumShreddingSize::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) { - config.options.variant_minimum_shredding_size = input.GetValue(); -} - -void VariantMinimumShreddingSize::ResetGlobal(DatabaseInstance *db, DBConfig &config) { - config.options.variant_minimum_shredding_size = DBConfigOptions().variant_minimum_shredding_size; -} - -Value VariantMinimumShreddingSize::GetSetting(const ClientContext &context) { - auto &config = DBConfig::GetConfig(context); - return Value::BIGINT(config.options.variant_minimum_shredding_size); -} - -//===----------------------------------------------------------------------===// -// Zstd Min String Length -//===----------------------------------------------------------------------===// -void ZstdMinStringLengthSetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) { - config.options.zstd_min_string_length = input.GetValue(); -} - -void ZstdMinStringLengthSetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) { - config.options.zstd_min_string_length = DBConfigOptions().zstd_min_string_length; -} - -Value ZstdMinStringLengthSetting::GetSetting(const ClientContext &context) { - auto &config = DBConfig::GetConfig(context); - return Value::UBIGINT(config.options.zstd_min_string_length); -} - } // namespace duckdb diff --git a/src/duckdb/src/main/settings/custom_settings.cpp b/src/duckdb/src/main/settings/custom_settings.cpp index 9c5635815..72953fc16 100644 --- a/src/duckdb/src/main/settings/custom_settings.cpp +++ b/src/duckdb/src/main/settings/custom_settings.cpp @@ -12,7 +12,6 @@ #include "duckdb/main/settings.hpp" #include "duckdb/common/enums/access_mode.hpp" -#include "duckdb/common/enums/cache_validation_mode.hpp" #include "duckdb/common/enum_util.hpp" #include "duckdb/catalog/catalog_search_path.hpp" #include "duckdb/common/string_util.hpp" @@ -48,10 +47,6 @@ constexpr const char *EnabledLogTypes::Name; constexpr const char *DisabledLogTypes::Name; constexpr const char *DisabledFilesystemsSetting::Name; -const string GetDefaultUserAgent() { - return StringUtil::Format("duckdb/%s(%s)", DuckDB::LibraryVersion(), DuckDB::Platform()); -} - namespace { template @@ -78,18 +73,10 @@ bool AccessModeSetting::OnGlobalSet(DatabaseInstance *db, DBConfig &config, cons //===----------------------------------------------------------------------===// // Allocator Background Threads //===----------------------------------------------------------------------===// -bool AllocatorBackgroundThreadsSetting::OnGlobalSet(DatabaseInstance *db, DBConfig &config, const Value &input) { - if (db) { - TaskScheduler::GetScheduler(*db).SetAllocatorBackgroundThreads(input.GetValue()); - } - return true; -} - -bool AllocatorBackgroundThreadsSetting::OnGlobalReset(DatabaseInstance *db, DBConfig &config) { - if (db) { - TaskScheduler::GetScheduler(*db).SetAllocatorBackgroundThreads(DBConfigOptions().allocator_background_threads); +void AllocatorBackgroundThreadsSetting::OnSet(SettingCallbackInfo &info, Value &input) { + if (info.db) { + TaskScheduler::GetScheduler(*info.db).SetAllocatorBackgroundThreads(input.GetValue()); } - return true; } //===----------------------------------------------------------------------===// @@ -143,46 +130,10 @@ Value AllocatorFlushThresholdSetting::GetSetting(const ClientContext &context) { //===----------------------------------------------------------------------===// // Allow Community Extensions //===----------------------------------------------------------------------===// -bool AllowCommunityExtensionsSetting::OnGlobalSet(DatabaseInstance *db, DBConfig &config, const Value &input) { - if (db && !config.options.allow_community_extensions) { - auto new_value = input.GetValue(); - if (new_value) { - throw InvalidInputException("Cannot upgrade allow_community_extensions setting while database is running"); - } - return false; +void AllowCommunityExtensionsSetting::OnSet(SettingCallbackInfo &info, Value &input) { + if (info.db && input.GetValue()) { + throw InvalidInputException("Cannot change allow_community_extensions setting while database is running"); } - return true; -} - -bool AllowCommunityExtensionsSetting::OnGlobalReset(DatabaseInstance *db, DBConfig &config) { - if (db && !config.options.allow_community_extensions) { - if (DBConfigOptions().allow_community_extensions) { - throw InvalidInputException("Cannot upgrade allow_community_extensions setting while database is running"); - } - return false; - } - return true; -} - -//===----------------------------------------------------------------------===// -// Allow Parser Override -//===----------------------------------------------------------------------===// -bool AllowParserOverrideExtensionSetting::OnGlobalSet(DatabaseInstance *db, DBConfig &config, const Value &input) { - auto new_value = input.GetValue(); - vector supported_options = {"default", "fallback", "strict", "strict_when_supported"}; - string supported_option_string; - for (const auto &option : supported_options) { - if (StringUtil::CIEquals(new_value, option)) { - return true; - } - } - throw InvalidInputException("Unrecognized value for parser override setting. Valid options are: %s", - StringUtil::Join(supported_options, ", ")); -} - -bool AllowParserOverrideExtensionSetting::OnGlobalReset(DatabaseInstance *db, DBConfig &config) { - config.options.allow_parser_override_extension = "default"; - return true; } //===----------------------------------------------------------------------===// @@ -205,59 +156,35 @@ Value AllowPersistentSecretsSetting::GetSetting(const ClientContext &context) { //===----------------------------------------------------------------------===// // Allow Unredacted Secrets //===----------------------------------------------------------------------===// -bool AllowUnredactedSecretsSetting::OnGlobalSet(DatabaseInstance *db, DBConfig &config, const Value &input) { - if (db && input.GetValue()) { - throw InvalidInputException("Cannot change allow_unredacted_secrets setting while database is running"); - } - return true; -} - -bool AllowUnredactedSecretsSetting::OnGlobalReset(DatabaseInstance *db, DBConfig &config) { - if (db) { +void AllowUnredactedSecretsSetting::OnSet(SettingCallbackInfo &info, Value &input) { + if ((info.db || info.context) && input.GetValue()) { throw InvalidInputException("Cannot change allow_unredacted_secrets setting while database is running"); } - return true; } //===----------------------------------------------------------------------===// // Disable Database Invalidation //===----------------------------------------------------------------------===// -bool DisableDatabaseInvalidationSetting::OnGlobalSet(DatabaseInstance *db, DBConfig &config, const Value &input) { - if (db && input.GetValue()) { +void DisableDatabaseInvalidationSetting::OnSet(SettingCallbackInfo &info, Value &input) { + if (info.db || info.context) { throw InvalidInputException("Cannot change disable_database_invalidation setting while database is running"); } - return true; -} - -bool DisableDatabaseInvalidationSetting::OnGlobalReset(DatabaseInstance *db, DBConfig &config) { - if (db) { - throw InvalidInputException("Cannot change disable_database_invalidation setting while database is running"); - } - return true; } //===----------------------------------------------------------------------===// // Allow Unsigned Extensions //===----------------------------------------------------------------------===// -bool AllowUnsignedExtensionsSetting::OnGlobalSet(DatabaseInstance *db, DBConfig &config, const Value &input) { - if (db && input.GetValue()) { +void AllowUnsignedExtensionsSetting::OnSet(SettingCallbackInfo &info, Value &input) { + if (info.db && input.GetValue()) { throw InvalidInputException("Cannot change allow_unsigned_extensions setting while database is running"); } - return true; -} - -bool AllowUnsignedExtensionsSetting::OnGlobalReset(DatabaseInstance *db, DBConfig &config) { - if (db) { - throw InvalidInputException("Cannot change allow_unsigned_extensions setting while database is running"); - } - return true; } //===----------------------------------------------------------------------===// // Allowed Directories //===----------------------------------------------------------------------===// void AllowedDirectoriesSetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) { - if (!config.options.enable_external_access) { + if (!Settings::Get(config)) { throw InvalidInputException("Cannot change allowed_directories when enable_external_access is disabled"); } if (!config.file_system) { @@ -271,7 +198,7 @@ void AllowedDirectoriesSetting::SetGlobal(DatabaseInstance *db, DBConfig &config } void AllowedDirectoriesSetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) { - if (!config.options.enable_external_access) { + if (!Settings::Get(config)) { throw InvalidInputException("Cannot change allowed_directories when enable_external_access is disabled"); } config.options.allowed_directories = DBConfigOptions().allowed_directories; @@ -290,7 +217,7 @@ Value AllowedDirectoriesSetting::GetSetting(const ClientContext &context) { // Allowed Paths //===----------------------------------------------------------------------===//void void AllowedPathsSetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) { - if (!config.options.enable_external_access) { + if (!Settings::Get(config)) { throw InvalidInputException("Cannot change allowed_paths when enable_external_access is disabled"); } if (!config.file_system) { @@ -305,7 +232,7 @@ void AllowedPathsSetting::SetGlobal(DatabaseInstance *db, DBConfig &config, cons } void AllowedPathsSetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) { - if (!config.options.enable_external_access) { + if (!Settings::Get(config)) { throw InvalidInputException("Cannot change allowed_paths when enable_external_access is disabled"); } config.options.allowed_paths = DBConfigOptions().allowed_paths; @@ -581,19 +508,9 @@ void CustomUserAgentSetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) //===----------------------------------------------------------------------===// // Default Block Size //===----------------------------------------------------------------------===// -void DefaultBlockSizeSetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) { +void DefaultBlockSizeSetting::OnSet(SettingCallbackInfo &, Value &input) { auto block_alloc_size = input.GetValue(); Storage::VerifyBlockAllocSize(block_alloc_size); - config.options.default_block_alloc_size = block_alloc_size; -} - -void DefaultBlockSizeSetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) { - config.options.default_block_alloc_size = DBConfigOptions().default_block_alloc_size; -} - -Value DefaultBlockSizeSetting::GetSetting(const ClientContext &context) { - auto &config = DBConfig::GetConfig(context); - return Value::UBIGINT(config.options.default_block_alloc_size); } //===----------------------------------------------------------------------===// @@ -674,12 +591,15 @@ void DisabledCompressionMethodsSetting::SetGlobal(DatabaseInstance *db, DBConfig disabled_compression_methods.clear(); break; } - auto compression_type = CompressionTypeFromString(param); - if (compression_type == CompressionType::COMPRESSION_UNCOMPRESSED) { - throw InvalidInputException("Uncompressed compression cannot be disabled"); - } - if (compression_type == CompressionType::COMPRESSION_AUTO) { - throw InvalidInputException("Unrecognized compression method \"%s\"", entry); + auto compression_type = EnumUtil::FromString(param); + switch (compression_type) { + case CompressionType::COMPRESSION_AUTO: + case CompressionType::COMPRESSION_CONSTANT: + case CompressionType::COMPRESSION_EMPTY: + case CompressionType::COMPRESSION_UNCOMPRESSED: + throw InvalidInputException("Compression method %s cannot be disabled", param); + default: + break; } disabled_compression_methods.push_back(compression_type); } @@ -759,39 +679,26 @@ Value DisabledOptimizersSetting::GetSetting(const ClientContext &context) { //===----------------------------------------------------------------------===// // Duckdb Api //===----------------------------------------------------------------------===// -void DuckDBAPISetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) { - auto new_value = input.GetValue(); - if (db) { +void DuckDBAPISetting::OnSet(SettingCallbackInfo &info, Value &input) { + if (info.db) { throw InvalidInputException("Cannot change duckdb_api setting while database is running"); } - config.options.duckdb_api = new_value; -} - -void DuckDBAPISetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) { - if (db) { - throw InvalidInputException("Cannot change duckdb_api setting while database is running"); - } - config.options.duckdb_api = GetDefaultUserAgent(); -} - -Value DuckDBAPISetting::GetSetting(const ClientContext &context) { - auto &config = DBConfig::GetConfig(context); - return Value(config.options.duckdb_api); } //===----------------------------------------------------------------------===// // Enable External Access //===----------------------------------------------------------------------===// -bool EnableExternalAccessSetting::OnGlobalSet(DatabaseInstance *db, DBConfig &config, const Value &input) { - if (!db) { - return true; +void EnableExternalAccessSetting::OnSet(SettingCallbackInfo &info, Value &input) { + if (!info.db) { + return; } if (input.GetValue()) { - throw InvalidInputException("Cannot change enable_external_access setting while database is running"); + throw InvalidInputException("Cannot enable external access while database is running"); } - if (db && config.options.enable_external_access) { + auto &config = info.config; + if (info.db && Settings::Get(*info.db)) { // we are turning off external access - add any already attached databases to the list of accepted paths - auto &db_manager = DatabaseManager::Get(*db); + auto &db_manager = DatabaseManager::Get(*info.db); auto attached_paths = db_manager.GetAttachedDatabasePaths(); for (auto &path : attached_paths) { config.AddAllowedPath(path); @@ -804,38 +711,17 @@ bool EnableExternalAccessSetting::OnGlobalSet(DatabaseInstance *db, DBConfig &co // if temp directory is enabled we can also write there config.AddAllowedDirectory(config.options.temporary_directory); } - return true; -} - -bool EnableExternalAccessSetting::OnGlobalReset(DatabaseInstance *db, DBConfig &config) { - if (db) { - throw InvalidInputException("Cannot change enable_external_access setting while database is running"); - } - return true; } //===----------------------------------------------------------------------===// // Enable External File Cache //===----------------------------------------------------------------------===// -void EnableExternalFileCacheSetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) { - config.options.enable_external_file_cache = input.GetValue(); - if (db) { - ExternalFileCache::Get(*db).SetEnabled(config.options.enable_external_file_cache); - } -} - -void EnableExternalFileCacheSetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) { - config.options.enable_external_file_cache = DBConfigOptions().enable_external_file_cache; - if (db) { - ExternalFileCache::Get(*db).SetEnabled(config.options.enable_external_file_cache); +void EnableExternalFileCacheSetting::OnSet(SettingCallbackInfo &info, Value &input) { + if (info.db) { + ExternalFileCache::Get(*info.db).SetEnabled(input.GetValue()); } } -Value EnableExternalFileCacheSetting::GetSetting(const ClientContext &context) { - auto &config = DBConfig::GetConfig(context); - return Value(config.options.enable_external_file_cache); -} - //===----------------------------------------------------------------------===// // Enable Logging //===----------------------------------------------------------------------===// @@ -1178,76 +1064,26 @@ bool EnableProgressBarSetting::OnLocalReset(ClientContext &context) { //===----------------------------------------------------------------------===// // External Threads //===----------------------------------------------------------------------===// -bool ExternalThreadsSetting::OnGlobalSet(DatabaseInstance *db, DBConfig &config, const Value &input) { - auto new_val = input.GetValue(); - if (new_val < 0) { - throw SyntaxException("Must have a non-negative number of external threads!"); +void ExternalThreadsSetting::OnSet(SettingCallbackInfo &info, Value &input) { + auto new_external_threads = input.GetValue(); + if (info.db) { + TaskScheduler::GetScheduler(*info.db).SetThreads(info.config.options.maximum_threads, new_external_threads); } - auto new_external_threads = NumericCast(new_val); - if (db) { - TaskScheduler::GetScheduler(*db).SetThreads(config.options.maximum_threads, new_external_threads); - } - return true; -} - -bool ExternalThreadsSetting::OnGlobalReset(DatabaseInstance *db, DBConfig &config) { - idx_t new_external_threads = DBConfigOptions().external_threads; - if (db) { - TaskScheduler::GetScheduler(*db).SetThreads(config.options.maximum_threads, new_external_threads); - } - return true; -} - -//===----------------------------------------------------------------------===// -// File Search Path -//===----------------------------------------------------------------------===// -void FileSearchPathSetting::SetLocal(ClientContext &context, const Value &input) { - auto parameter = input.ToString(); - auto &client_data = ClientData::Get(context); - client_data.file_search_path = parameter; -} - -void FileSearchPathSetting::ResetLocal(ClientContext &context) { - auto &client_data = ClientData::Get(context); - client_data.file_search_path.clear(); -} - -Value FileSearchPathSetting::GetSetting(const ClientContext &context) { - auto &client_data = ClientData::Get(context); - return Value(client_data.file_search_path); -} - -//===----------------------------------------------------------------------===// -// Force Bitpacking Mode -//===----------------------------------------------------------------------===// -void ForceBitpackingModeSetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) { - auto mode_str = StringUtil::Lower(input.ToString()); - auto mode = BitpackingModeFromString(mode_str); - if (mode == BitpackingMode::INVALID) { - throw ParserException("Unrecognized option for force_bitpacking_mode, expected none, constant, constant_delta, " - "delta_for, or for"); - } - config.options.force_bitpacking_mode = mode; -} - -void ForceBitpackingModeSetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) { - config.options.force_bitpacking_mode = DBConfigOptions().force_bitpacking_mode; -} - -Value ForceBitpackingModeSetting::GetSetting(const ClientContext &context) { - return Value(BitpackingModeToString(context.db->config.options.force_bitpacking_mode)); } //===----------------------------------------------------------------------===// // Force Compression //===----------------------------------------------------------------------===// -void ForceCompressionSetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) { +void ForceCompressionSetting::OnSet(SettingCallbackInfo &info, Value &input) { auto compression = StringUtil::Lower(input.ToString()); if (compression == "none" || compression == "auto") { - config.options.force_compression = CompressionType::COMPRESSION_AUTO; + input = "auto"; } else { - auto compression_type = CompressionTypeFromString(compression); - //! FIXME: do we want to try to retrieve the AttachedDatabase here to get the StorageManager ?? + auto compression_type = EnumUtil::FromString(compression); + if (compression_type == CompressionType::COMPRESSION_CONSTANT || + compression_type == CompressionType::COMPRESSION_EMPTY) { + throw ParserException("auto / constant cannot be used for force_compression"); + } auto compression_availability_result = CompressionTypeIsAvailable(compression_type); if (!compression_availability_result.IsAvailable()) { if (compression_availability_result.IsDeprecated()) { @@ -1258,32 +1094,27 @@ void ForceCompressionSetting::SetGlobal(DatabaseInstance *db, DBConfig &config, CompressionTypeToString(compression_type)); } } - if (compression_type == CompressionType::COMPRESSION_AUTO) { - auto compression_types = StringUtil::Join(ListCompressionTypes(), ", "); - throw ParserException("Unrecognized option for PRAGMA force_compression, expected %s", compression_types); - } - config.options.force_compression = compression_type; } } -void ForceCompressionSetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) { - config.options.force_compression = DBConfigOptions().force_compression; -} - -Value ForceCompressionSetting::GetSetting(const ClientContext &context) { - auto &config = DBConfig::GetConfig(*context.db); - return CompressionTypeToString(config.options.force_compression); -} - //===----------------------------------------------------------------------===// // Home Directory //===----------------------------------------------------------------------===// -void HomeDirectorySetting::SetLocal(ClientContext &context, const Value &input) { - auto &config = ClientConfig::GetConfig(context); - if (!input.IsNull() && FileSystem::GetFileSystem(context).IsRemoteFile(input.ToString())) { - throw InvalidInputException("Cannot set the home directory to a remote path"); +void HomeDirectorySetting::OnSet(SettingCallbackInfo &info, Value &input) { + optional_ptr fs; + if (info.context) { + fs = FileSystem::GetFileSystem(*info.context); + } else if (info.db) { + fs = FileSystem::GetFileSystem(*info.db); + } else { + fs = info.config.file_system.get(); + } + if (fs && !input.IsNull()) { + auto new_home_directory = input.ToString(); + if (fs->IsRemoteFile(new_home_directory)) { + throw InvalidInputException("Cannot set the home directory to a remote path"); + } } - config.home_directory = input.IsNull() ? string() : input.ToString(); } //===----------------------------------------------------------------------===// @@ -1345,50 +1176,24 @@ void IndexScanPercentageSetting::OnSet(SettingCallbackInfo &, Value &input) { } } -//===----------------------------------------------------------------------===// -// Lambda Syntax Setting -//===----------------------------------------------------------------------===// -void LambdaSyntaxSetting::SetLocal(ClientContext &context, const Value &input) { - auto setting_type = EnumUtil::FromString(input.ToString()); - auto &config = ClientConfig::GetConfig(context); - config.lambda_syntax = setting_type; -} - -void LambdaSyntaxSetting::ResetLocal(ClientContext &context) { - auto &config = ClientConfig::GetConfig(context); - config.lambda_syntax = LambdaSyntax::DEFAULT; -} - -Value LambdaSyntaxSetting::GetSetting(const ClientContext &context) { - const auto &config = ClientConfig::GetConfig(context); - return Value(EnumUtil::ToString(config.lambda_syntax)); -} - //===----------------------------------------------------------------------===// // Log Query Path //===----------------------------------------------------------------------===// -void LogQueryPathSetting::SetLocal(ClientContext &context, const Value &input) { - auto &client_data = ClientData::Get(context); +void LogQueryPathSetting::OnSet(SettingCallbackInfo &info, Value &input) { + if (!info.context) { + throw InvalidInputException("log_query_path can only be set when a context is present"); + } + auto &client_data = ClientData::Get(*info.context); auto path = input.ToString(); if (path.empty()) { // empty path: clean up query writer client_data.log_query_writer = nullptr; } else { - client_data.log_query_writer = make_uniq(FileSystem::GetFileSystem(context), path, + client_data.log_query_writer = make_uniq(FileSystem::GetFileSystem(*info.context), path, BufferedFileWriter::DEFAULT_OPEN_FLAGS); } } -void LogQueryPathSetting::ResetLocal(ClientContext &context) { - auto &client_data = ClientData::Get(context); - client_data.log_query_writer = nullptr; -} - -Value LogQueryPathSetting::GetSetting(const ClientContext &context) { - auto &client_data = ClientData::Get(context); - return client_data.log_query_writer ? Value(client_data.log_query_writer->path) : Value(); -} - //===----------------------------------------------------------------------===// // Max Memory //===----------------------------------------------------------------------===// @@ -1467,21 +1272,6 @@ void OrderedAggregateThresholdSetting::OnSet(SettingCallbackInfo &info, Value &i } } -//===----------------------------------------------------------------------===// -// Password -//===----------------------------------------------------------------------===// -void PasswordSetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) { - // nop -} - -void PasswordSetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) { - // nop -} - -Value PasswordSetting::GetSetting(const ClientContext &context) { - return Value(); -} - //===----------------------------------------------------------------------===// // Perfect Ht Threshold //===----------------------------------------------------------------------===// @@ -1719,7 +1509,7 @@ Value StreamingBufferSizeSetting::GetSetting(const ClientContext &context) { // Temp Directory //===----------------------------------------------------------------------===// void TempDirectorySetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) { - if (!config.options.enable_external_access) { + if (!Settings::Get(config)) { throw PermissionException("Modifying the temp_directory has been disabled by configuration"); } config.options.temporary_directory = input.IsNull() ? "" : input.ToString(); @@ -1731,7 +1521,7 @@ void TempDirectorySetting::SetGlobal(DatabaseInstance *db, DBConfig &config, con } void TempDirectorySetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) { - if (!config.options.enable_external_access) { + if (!Settings::Get(config)) { throw PermissionException("Modifying the temp_directory has been disabled by configuration"); } config.SetDefaultTempDirectory(); @@ -1750,44 +1540,15 @@ Value TempDirectorySetting::GetSetting(const ClientContext &context) { //===----------------------------------------------------------------------===// // Temporary File Encryption //===----------------------------------------------------------------------===// -void TempFileEncryptionSetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) { - auto setting = input.GetValue(); - if (config.options.temp_file_encryption == setting) { - // setting is the current setting - return; - } - - if (db) { - auto &buffer_manager = BufferManager::GetBufferManager(*db); - if (buffer_manager.HasFilesInTemporaryDirectory()) { - throw PermissionException("Existing temporary files found: Modifying the temp_file_encryption setting " - "while there are existing temporary files is disabled."); - } - } - - config.options.temp_file_encryption = setting; -} - -void TempFileEncryptionSetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) { - if (config.options.temp_file_encryption == true) { - // setting is the current setting +void TempFileEncryptionSetting::OnSet(SettingCallbackInfo &info, Value &input) { + if (!info.db) { return; } - - if (db) { - auto &buffer_manager = BufferManager::GetBufferManager(*db); - if (buffer_manager.HasFilesInTemporaryDirectory()) { - throw PermissionException("Existing temporary files found: Modifying the temp_file_encryption setting " - "while there are existing temporary files is disabled."); - } + auto &buffer_manager = BufferManager::GetBufferManager(*info.db); + if (buffer_manager.HasFilesInTemporaryDirectory()) { + throw PermissionException("Existing temporary files found: Modifying the temp_file_encryption setting " + "while there are existing temporary files is disabled."); } - - config.options.temp_file_encryption = true; -} - -Value TempFileEncryptionSetting::GetSetting(const ClientContext &context) { - auto &config = DBConfig::GetConfig(context); - return Value::BOOLEAN(config.options.temp_file_encryption); } //===----------------------------------------------------------------------===// @@ -1800,7 +1561,7 @@ void ThreadsSetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Val } auto new_maximum_threads = NumericCast(new_val); if (db) { - TaskScheduler::GetScheduler(*db).SetThreads(new_maximum_threads, config.options.external_threads); + TaskScheduler::GetScheduler(*db).SetThreads(new_maximum_threads, Settings::Get(config)); } config.options.maximum_threads = new_maximum_threads; } @@ -1808,7 +1569,7 @@ void ThreadsSetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Val void ThreadsSetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) { idx_t new_maximum_threads = config.GetSystemMaxThreads(*config.file_system); if (db) { - TaskScheduler::GetScheduler(*db).SetThreads(new_maximum_threads, config.options.external_threads); + TaskScheduler::GetScheduler(*db).SetThreads(new_maximum_threads, Settings::Get(config)); } config.options.maximum_threads = new_maximum_threads; } @@ -1818,19 +1579,4 @@ Value ThreadsSetting::GetSetting(const ClientContext &context) { return Value::BIGINT(NumericCast(config.options.maximum_threads)); } -//===----------------------------------------------------------------------===// -// Username -//===----------------------------------------------------------------------===// -void UsernameSetting::SetGlobal(DatabaseInstance *db, DBConfig &config, const Value &input) { - // nop -} - -void UsernameSetting::ResetGlobal(DatabaseInstance *db, DBConfig &config) { - // nop -} - -Value UsernameSetting::GetSetting(const ClientContext &context) { - return Value(); -} - } // namespace duckdb diff --git a/src/duckdb/src/main/settings/settings.cpp b/src/duckdb/src/main/settings/settings.cpp new file mode 100644 index 000000000..3ab1a7d4a --- /dev/null +++ b/src/duckdb/src/main/settings/settings.cpp @@ -0,0 +1,20 @@ +#include "duckdb/main/settings.hpp" +#include "duckdb/main/client_context.hpp" +#include "duckdb/main/config.hpp" + +namespace duckdb { + +bool Settings::TryGetSettingInternal(const ClientContext &context, idx_t setting_index, Value &result) { + return context.TryGetCurrentUserSetting(setting_index, result); +} + +bool Settings::TryGetSettingInternal(const DBConfig &config, idx_t setting_index, Value &result) { + auto lookup_result = config.TryGetCurrentUserSetting(setting_index, result); + return lookup_result; +} + +bool Settings::TryGetSettingInternal(const DatabaseInstance &db, idx_t setting_index, Value &result) { + return TryGetSettingInternal(DBConfig::GetConfig(db), setting_index, result); +} + +} // namespace duckdb diff --git a/src/duckdb/src/main/user_settings.cpp b/src/duckdb/src/main/user_settings.cpp new file mode 100644 index 000000000..9e3ccccc6 --- /dev/null +++ b/src/duckdb/src/main/user_settings.cpp @@ -0,0 +1,172 @@ +#include "duckdb/main/user_settings.hpp" +#include "duckdb/main/settings.hpp" +#include "duckdb/common/types/string.hpp" + +namespace duckdb { + +void UserSettingsMap::SetUserSetting(idx_t setting_index, Value target_value) { + if (setting_index >= settings.size()) { + settings.resize(setting_index + 1); + } + auto &generic_setting = settings[setting_index]; + generic_setting.is_set = true; + generic_setting.value = std::move(target_value); +} + +void UserSettingsMap::ClearSetting(idx_t setting_index) { + if (setting_index >= settings.size()) { + // never set + return; + } + auto &generic_setting = settings[setting_index]; + generic_setting.is_set = false; + generic_setting.value = Value(); +} + +bool UserSettingsMap::IsSet(idx_t setting_index) const { + if (setting_index >= settings.size()) { + // never set + return false; + } + return settings[setting_index].is_set; +} + +bool UserSettingsMap::TryGetSetting(idx_t setting_index, Value &result_value) const { + if (setting_index >= settings.size()) { + // never set + return false; + } + auto &generic_setting = settings[setting_index]; + if (!generic_setting.is_set) { + return false; + } + result_value = generic_setting.value; + return true; +} + +//===--------------------------------------------------------------------===// +// GlobalUserSettings +//===--------------------------------------------------------------------===// +GlobalUserSettings::GlobalUserSettings() : settings_version(0) { +} + +GlobalUserSettings::GlobalUserSettings(const GlobalUserSettings &other) + : settings_map(other.settings_map), extension_parameters(other.extension_parameters), + settings_version(other.settings_version.load()) { +} + +GlobalUserSettings &GlobalUserSettings::operator=(const GlobalUserSettings &other) { + settings_map = other.settings_map; + extension_parameters = other.extension_parameters; + settings_version = other.settings_version.load(); + return *this; +} + +void GlobalUserSettings::SetUserSetting(idx_t setting_index, Value target_value) { + lock_guard guard(lock); + settings_map.SetUserSetting(setting_index, std::move(target_value)); + ++settings_version; +} + +void GlobalUserSettings::ClearSetting(idx_t setting_index) { + lock_guard guard(lock); + settings_map.ClearSetting(setting_index); + ++settings_version; +} + +bool GlobalUserSettings::IsSet(idx_t setting_index) const { + lock_guard guard(lock); + return settings_map.IsSet(setting_index); +} + +SettingLookupResult GlobalUserSettings::TryGetSetting(idx_t setting_index, Value &result_value) const { + lock_guard guard(lock); + if (!settings_map.TryGetSetting(setting_index, result_value)) { + return SettingLookupResult(); + } + return SettingLookupResult(SettingScope::GLOBAL); +} + +bool GlobalUserSettings::HasExtensionOption(const string &name) const { + lock_guard l(lock); + return extension_parameters.find(name) != extension_parameters.end(); +} + +idx_t GlobalUserSettings::AddExtensionOption(const string &name, ExtensionOption extension_option) { + lock_guard l(lock); + auto setting_index = GeneratedSettingInfo::MaxSettingIndex + extension_parameters.size(); + extension_option.setting_index = setting_index; + extension_parameters.insert(make_pair(name, std::move(extension_option))); + ++settings_version; + return setting_index; +} + +case_insensitive_map_t GlobalUserSettings::GetExtensionSettings() const { + lock_guard l(lock); + return extension_parameters; +} + +bool GlobalUserSettings::TryGetExtensionOption(const String &name, ExtensionOption &result) const { + lock_guard l(lock); + auto entry = extension_parameters.find(name.ToStdString()); + if (entry == extension_parameters.end()) { + return false; + } + result = entry->second; + return true; +} + +shared_ptr GlobalUserSettings::GetSettings(shared_ptr &cache) const { + auto current_cache = cache.atomic_load(std::memory_order_relaxed); + auto current_version = settings_version.load(std::memory_order_relaxed); + if (current_cache && current_cache->version == current_version) { + // we have a cached version and it is up to date - done + return current_cache; + } + lock_guard guard(lock); + // check if another thread updated the cache while we were waiting for the lock + if (cache && current_version == cache->version) { + // already written - load + return cache; + } + auto new_cache = make_shared_ptr(settings_version, settings_map); + cache.atomic_store(new_cache); + return new_cache; +} + +CachedGlobalSettings::CachedGlobalSettings(idx_t version, UserSettingsMap settings_p) + : version(version), settings(std::move(settings_p)) { +} + +//===--------------------------------------------------------------------===// +// LocalUserSettings +//===--------------------------------------------------------------------===// +LocalUserSettings::~LocalUserSettings() { +} + +void LocalUserSettings::SetUserSetting(idx_t setting_index, Value target_value) { + settings_map.SetUserSetting(setting_index, std::move(target_value)); +} + +void LocalUserSettings::ClearSetting(idx_t setting_index) { + settings_map.ClearSetting(setting_index); +} + +bool LocalUserSettings::IsSet(idx_t setting_index) const { + return settings_map.IsSet(setting_index); +} + +SettingLookupResult LocalUserSettings::TryGetSetting(const GlobalUserSettings &global_settings, idx_t setting_index, + Value &result_value) const { + if (settings_map.TryGetSetting(setting_index, result_value)) { + return SettingLookupResult(SettingScope::LOCAL); + } + // look-up in global settings + auto cache = global_settings.GetSettings(global_settings_cache); + if (cache->settings.TryGetSetting(setting_index, result_value)) { + return SettingLookupResult(SettingScope::GLOBAL); + } + return SettingLookupResult(); +} + +} // namespace duckdb diff --git a/src/duckdb/src/main/valid_checker.cpp b/src/duckdb/src/main/valid_checker.cpp index d3fcd5bff..4afa56aaf 100644 --- a/src/duckdb/src/main/valid_checker.cpp +++ b/src/duckdb/src/main/valid_checker.cpp @@ -1,6 +1,5 @@ #include "duckdb/main/valid_checker.hpp" - -#include "duckdb/main/database.hpp" +#include "duckdb/main/settings.hpp" namespace duckdb { @@ -14,7 +13,7 @@ void ValidChecker::Invalidate(string error) { } bool ValidChecker::IsInvalidated() { - if (db.config.options.disable_database_invalidation) { + if (Settings::Get(db)) { return false; } return is_invalidated; diff --git a/src/duckdb/src/optimizer/build_probe_side_optimizer.cpp b/src/duckdb/src/optimizer/build_probe_side_optimizer.cpp index b5c422133..b4e92b7cd 100644 --- a/src/duckdb/src/optimizer/build_probe_side_optimizer.cpp +++ b/src/duckdb/src/optimizer/build_probe_side_optimizer.cpp @@ -230,7 +230,7 @@ void BuildProbeSideOptimizer::VisitOperator(LogicalOperator &op) { // if the conditions have no equality, do not flip the children. // There is no physical join operator (yet) that can do an inequality right_semi/anti join. idx_t has_range = 0; - bool prefer_range_joins = DBConfig::GetSetting(context); + bool prefer_range_joins = Settings::Get(context); if (op.type == LogicalOperatorType::LOGICAL_ANY_JOIN || (op.Cast().HasEquality(has_range) && !prefer_range_joins)) { TryFlipJoinChildren(join); diff --git a/src/duckdb/src/optimizer/column_lifetime_analyzer.cpp b/src/duckdb/src/optimizer/column_lifetime_analyzer.cpp index 7098caae4..8bb1b0cb6 100644 --- a/src/duckdb/src/optimizer/column_lifetime_analyzer.cpp +++ b/src/duckdb/src/optimizer/column_lifetime_analyzer.cpp @@ -82,7 +82,7 @@ void ColumnLifetimeAnalyzer::VisitOperator(LogicalOperator &op) { // FIXME: for now, we only push into the projection map for equality (hash) joins idx_t has_range = 0; - bool prefer_range_joins = DBConfig::GetSetting(optimizer.context); + bool prefer_range_joins = Settings::Get(optimizer.context); if (!comp_join.HasEquality(has_range) || prefer_range_joins) { return; } diff --git a/src/duckdb/src/optimizer/expression_heuristics.cpp b/src/duckdb/src/optimizer/expression_heuristics.cpp index 766ac8d88..0bba42962 100644 --- a/src/duckdb/src/optimizer/expression_heuristics.cpp +++ b/src/duckdb/src/optimizer/expression_heuristics.cpp @@ -222,7 +222,7 @@ idx_t ExpressionHeuristics::Cost(Expression &expr) { return 1000; } -idx_t ExpressionHeuristics::Cost(TableFilter &filter) { +idx_t ExpressionHeuristics::Cost(const TableFilter &filter) { switch (filter.filter_type) { case TableFilterType::DYNAMIC_FILTER: case TableFilterType::OPTIONAL_FILTER: diff --git a/src/duckdb/src/optimizer/filter_combiner.cpp b/src/duckdb/src/optimizer/filter_combiner.cpp index e2480b963..9b2f426c6 100644 --- a/src/duckdb/src/optimizer/filter_combiner.cpp +++ b/src/duckdb/src/optimizer/filter_combiner.cpp @@ -354,6 +354,10 @@ FilterPushdownResult FilterCombiner::TryPushdownConstantFilter(TableFilterSet &t if (!TryGetBoundColumnIndex(column_ids, expr, column_index)) { return FilterPushdownResult::NO_PUSHDOWN; } + if (column_index.IsPushdownExtract()) { + //! FIXME: can't push down filters on a column that has a pushed down extract currently + return FilterPushdownResult::NO_PUSHDOWN; + } auto &constant_list = constant_values.find(equiv_set)->second; for (auto &constant_cmp : constant_list) { @@ -400,6 +404,10 @@ FilterPushdownResult FilterCombiner::TryPushdownGenericExpression(LogicalGet &ge auto &column_ids = get.GetColumnIds(); auto expr_filter = make_uniq(std::move(filter_expr)); auto &column_index = column_ids[bindings[0].column_index]; + if (column_index.IsPushdownExtract()) { + //! FIXME: can't support filters on a pushed down extract currently + return FilterPushdownResult::NO_PUSHDOWN; + } get.table_filters.PushFilter(column_index, std::move(expr_filter)); return FilterPushdownResult::PUSHED_DOWN_FULLY; } @@ -426,6 +434,10 @@ FilterPushdownResult FilterCombiner::TryPushdownPrefixFilter(TableFilterSet &tab return FilterPushdownResult::NO_PUSHDOWN; } auto &column_index = column_ids[column_ref.binding.column_index]; + if (column_index.IsPushdownExtract()) { + //! FIXME: can't support filter pushdown on pushed down extract currently + return FilterPushdownResult::NO_PUSHDOWN; + } //! Replace prefix with a set of comparisons auto lower_bound = make_uniq(ExpressionType::COMPARE_GREATERTHANOREQUALTO, Value(prefix_string)); table_filters.PushFilter(column_index, std::move(lower_bound)); @@ -457,6 +469,11 @@ FilterPushdownResult FilterCombiner::TryPushdownLikeFilter(TableFilterSet &table auto &column_ref = func.children[0]->Cast(); auto &constant_value_expr = func.children[1]->Cast(); auto &column_index = column_ids[column_ref.binding.column_index]; + if (column_index.IsPushdownExtract()) { + //! FIXME: can't support filter pushdown on pushed down extract currently + return FilterPushdownResult::NO_PUSHDOWN; + } + // constant value expr can sometimes be null. if so, push is not null filter, which will // make the filter unsatisfiable and return no results. if (constant_value_expr.value.IsNull()) { @@ -508,6 +525,11 @@ FilterPushdownResult FilterCombiner::TryPushdownInFilter(TableFilterSet &table_f } auto &column_ref = func.children[0]->Cast(); auto &column_index = column_ids[column_ref.binding.column_index]; + if (column_index.IsPushdownExtract()) { + //! FIXME: can't support filter pushdown on pushed down extract currently + return FilterPushdownResult::NO_PUSHDOWN; + } + //! check if all children are const expr bool children_constant = true; for (size_t i {1}; i < func.children.size(); i++) { @@ -603,6 +625,10 @@ FilterPushdownResult FilterCombiner::TryPushdownOrClause(TableFilterSet &table_f if (i == 0) { auto &col_id = column_ids[column_ref->binding.column_index]; column_id = col_id.GetPrimaryIndex(); + if (col_id.IsPushdownExtract()) { + //! FIXME: can't support filter pushdown on pushed down extract currently + return FilterPushdownResult::NO_PUSHDOWN; + } } else if (column_id != column_ids[column_ref->binding.column_index].GetPrimaryIndex()) { return FilterPushdownResult::NO_PUSHDOWN; } diff --git a/src/duckdb/src/optimizer/join_order/join_order_optimizer.cpp b/src/duckdb/src/optimizer/join_order/join_order_optimizer.cpp index 767b918c4..39e60bd69 100644 --- a/src/duckdb/src/optimizer/join_order/join_order_optimizer.cpp +++ b/src/duckdb/src/optimizer/join_order/join_order_optimizer.cpp @@ -7,6 +7,7 @@ #include "duckdb/optimizer/join_order/plan_enumerator.hpp" #include "duckdb/planner/expression/list.hpp" #include "duckdb/planner/operator/list.hpp" +#include "duckdb/main/settings.hpp" namespace duckdb { @@ -25,7 +26,8 @@ JoinOrderOptimizer JoinOrderOptimizer::CreateChildOptimizer() { unique_ptr JoinOrderOptimizer::Optimize(unique_ptr plan, optional_ptr stats) { - if (depth > query_graph_manager.context.config.max_expression_depth) { + auto max_expression_depth = Settings::Get(query_graph_manager.context); + if (depth > max_expression_depth) { // Very deep plans will eventually consume quite some stack space // Returning the current plan is always a valid choice return plan; diff --git a/src/duckdb/src/optimizer/join_order/plan_enumerator.cpp b/src/duckdb/src/optimizer/join_order/plan_enumerator.cpp index ec39dbd05..07f103925 100644 --- a/src/duckdb/src/optimizer/join_order/plan_enumerator.cpp +++ b/src/duckdb/src/optimizer/join_order/plan_enumerator.cpp @@ -470,7 +470,7 @@ void PlanEnumerator::InitLeafPlans() { // Moerkotte and Thomas Neumannn, see that paper for additional info/documentation bonus slides: // https://db.in.tum.de/teaching/ws1415/queryopt/chapter3.pdf?lang=de void PlanEnumerator::SolveJoinOrder() { - bool force_no_cross_product = DBConfig::GetSetting(query_graph_manager.context); + bool force_no_cross_product = Settings::Get(query_graph_manager.context); // first try to solve the join order exactly if (query_graph_manager.relation_manager.NumRelations() >= THRESHOLD_TO_SWAP_TO_APPROXIMATE) { SolveJoinOrderApproximately(); diff --git a/src/duckdb/src/optimizer/join_order/relation_statistics_helper.cpp b/src/duckdb/src/optimizer/join_order/relation_statistics_helper.cpp index 2db600c7a..b78341240 100644 --- a/src/duckdb/src/optimizer/join_order/relation_statistics_helper.cpp +++ b/src/duckdb/src/optimizer/join_order/relation_statistics_helper.cpp @@ -443,7 +443,7 @@ RelationStats RelationStatisticsHelper::ExtractEmptyResultStats(LogicalEmptyResu return stats; } -idx_t RelationStatisticsHelper::InspectTableFilter(idx_t cardinality, idx_t column_index, TableFilter &filter, +idx_t RelationStatisticsHelper::InspectTableFilter(idx_t cardinality, idx_t column_index, const TableFilter &filter, BaseStatistics &base_stats) { auto cardinality_after_filters = cardinality; switch (filter.filter_type) { diff --git a/src/duckdb/src/optimizer/late_materialization.cpp b/src/duckdb/src/optimizer/late_materialization.cpp index 3b19b3612..6d1a06d9b 100644 --- a/src/duckdb/src/optimizer/late_materialization.cpp +++ b/src/duckdb/src/optimizer/late_materialization.cpp @@ -21,7 +21,7 @@ namespace duckdb { LateMaterialization::LateMaterialization(Optimizer &optimizer) : optimizer(optimizer) { - max_row_count = DBConfig::GetSetting(optimizer.context); + max_row_count = Settings::Get(optimizer.context); } vector LateMaterialization::ConstructRHS(unique_ptr &op) { @@ -371,7 +371,7 @@ bool LateMaterialization::TryLateMaterialization(unique_ptr &op } bool LateMaterialization::OptimizeLargeLimit(LogicalLimit &limit, idx_t limit_val, bool has_offset) { - if (!has_offset && !DBConfig::GetSetting(optimizer.context)) { + if (!has_offset && !Settings::Get(optimizer.context)) { // we avoid optimizing large limits if preserve insertion order is false // since the limit is executed in parallel anyway return false; diff --git a/src/duckdb/src/optimizer/optimizer.cpp b/src/duckdb/src/optimizer/optimizer.cpp index d826e88bc..97585c1f0 100644 --- a/src/duckdb/src/optimizer/optimizer.cpp +++ b/src/duckdb/src/optimizer/optimizer.cpp @@ -47,7 +47,6 @@ namespace duckdb { Optimizer::Optimizer(Binder &binder, ClientContext &context) : context(context), binder(binder), rewriter(context) { rewriter.rules.push_back(make_uniq(rewriter)); rewriter.rules.push_back(make_uniq(rewriter)); - rewriter.rules.push_back(make_uniq(rewriter)); rewriter.rules.push_back(make_uniq(rewriter)); rewriter.rules.push_back(make_uniq(rewriter)); rewriter.rules.push_back(make_uniq(rewriter)); diff --git a/src/duckdb/src/optimizer/pushdown/pushdown_get.cpp b/src/duckdb/src/optimizer/pushdown/pushdown_get.cpp index ac4b6532a..d8c371c42 100644 --- a/src/duckdb/src/optimizer/pushdown/pushdown_get.cpp +++ b/src/duckdb/src/optimizer/pushdown/pushdown_get.cpp @@ -53,9 +53,10 @@ unique_ptr FilterPushdown::PushdownGet(unique_ptr(std::move(op)); } + auto &column_ids = get.GetColumnIds(); //! We generate the table filters that will be executed during the table scan vector pushdown_results; - get.table_filters = combiner.GenerateTableScanFilters(get.GetColumnIds(), pushdown_results); + get.table_filters = combiner.GenerateTableScanFilters(column_ids, pushdown_results); GenerateFilters(); diff --git a/src/duckdb/src/optimizer/remove_unused_columns.cpp b/src/duckdb/src/optimizer/remove_unused_columns.cpp index 7b0e49c6b..da67bb4da 100644 --- a/src/duckdb/src/optimizer/remove_unused_columns.cpp +++ b/src/duckdb/src/optimizer/remove_unused_columns.cpp @@ -23,6 +23,7 @@ #include "duckdb/planner/operator/logical_set_operation.hpp" #include "duckdb/planner/operator/logical_simple.hpp" #include "duckdb/function/scalar/struct_utils.hpp" +#include "duckdb/function/scalar/variant_utils.hpp" #include "duckdb/function/scalar/nested_functions.hpp" #include @@ -337,54 +338,64 @@ static idx_t GetColumnIdsIndexForFilter(vector &column_ids, idx_t f return static_cast(std::distance(column_ids.begin(), it)); } -static ColumnIndex PathToIndex(const vector &path, optional_ptr> cast_expression) { - D_ASSERT(!path.empty()); - ColumnIndex index = ColumnIndex(path[0]); - reference current(index); - for (idx_t i = 1; i < path.size(); i++) { - current.get().AddChildIndex(ColumnIndex(path[i])); - current = current.get().GetChildIndex(0); +//! returns: found_path, depth of the found path +std::pair FindShortestMatchingPath(column_index_set &all_paths, + const ColumnIndex &full_path) { + idx_t depth = 0; + column_index_set::iterator entry; + + ColumnIndex copy; + if (full_path.HasPrimaryIndex()) { + copy = ColumnIndex(full_path.GetPrimaryIndex()); + } else { + copy = ColumnIndex(full_path.GetFieldName()); } - if (cast_expression) { - auto &cast = *cast_expression; - current.get().SetType(cast->return_type); + + reference path_iter(full_path); + reference copy_iter(copy); + while (true) { + if (path_iter.get().HasType()) { + copy_iter.get().SetType(path_iter.get().GetType()); + } + entry = all_paths.find(copy); + if (entry != all_paths.end()) { + //! Path found, we're done + return make_pair(entry, depth); + } + if (!path_iter.get().HasChildren()) { + break; + } + path_iter = path_iter.get().GetChildIndex(0); + + ColumnIndex new_child; + if (path_iter.get().HasPrimaryIndex()) { + new_child = ColumnIndex(path_iter.get().GetPrimaryIndex()); + } else { + new_child = ColumnIndex(path_iter.get().GetFieldName()); + } + + copy_iter.get().AddChildIndex(new_child); + copy_iter = copy_iter.get().GetChildIndex(0); + depth++; } - return index; + return make_pair(all_paths.end(), depth); } void RemoveUnusedColumns::WritePushdownExtractColumns( const ColumnBinding &binding, ReferencedColumn &col, idx_t original_idx, const LogicalType &column_type, - const std::function cast_type)> &callback) { + const std::function cast_type)> &callback) { //! For each struct extract, replace the expression with a BoundColumnRefExpression //! The expression references a binding created for the extracted path, 1 per unique path for (auto &struct_extract : col.struct_extracts) { //! Replace the struct extract expression at the right depth with a BoundColumnRefExpression - auto &full_path = struct_extract.extract_path; - idx_t depth = 0; - column_index_set::iterator entry; - ColumnIndex copy(full_path.GetPrimaryIndex()); - reference path_iter(full_path); - reference copy_iter(copy); - while (true) { - if (path_iter.get().HasType()) { - copy_iter.get().SetType(path_iter.get().GetType()); - } - entry = col.unique_paths.find(copy); - if (entry != col.unique_paths.end()) { - //! Path found, we're done - break; - } - if (!path_iter.get().HasChildren()) { - throw InternalException("This path wasn't found in the registered paths for this expression at all!?"); - } - path_iter = path_iter.get().GetChildIndex(0); - copy_iter.get().AddChildIndex(ColumnIndex(path_iter.get().GetPrimaryIndex())); - copy_iter = copy_iter.get().GetChildIndex(0); - depth++; + auto res = FindShortestMatchingPath(col.unique_paths, full_path); + auto entry = res.first; + auto depth = res.second; + if (entry == col.unique_paths.end()) { + throw InternalException("This path wasn't found in the registered paths for this expression at all!?"); } - D_ASSERT(entry != col.unique_paths.end()); D_ASSERT(struct_extract.components.size() > depth); auto &component = struct_extract.components[depth]; auto &expr = component.cast ? *component.cast : component.extract; @@ -461,7 +472,7 @@ void RemoveUnusedColumns::RewriteExpressions(LogicalProjection &proj, idx_t expr //! Pushdown Extract is supported, emit a column for every field WritePushdownExtractColumns( entry->first, entry->second, i, column_type, - [&](const ColumnIndex &extract_path, optional_ptr cast_type) -> idx_t { + [&](const ColumnIndex &extract_path, optional_ptr cast_type) -> idx_t { auto target = make_uniq(column_type, original_binding); target->SetAlias(expr.GetAlias()); auto new_extract = ConstructStructExtractFromPath(context, std::move(target), extract_path); @@ -645,23 +656,24 @@ void RemoveUnusedColumns::RemoveColumnsFromLogicalGet(LogicalGet &get) { auto struct_column_index = old_column_ids[col_sel_idx].GetPrimaryIndex(); //! Pushdown Extract is supported, emit a column for every field - WritePushdownExtractColumns(entry->first, entry->second, col_sel_idx, column_type, - [&](const ColumnIndex &extract_path, optional_ptr cast_type) -> idx_t { - ColumnIndex new_index(struct_column_index, {extract_path}); - new_index.SetPushdownExtractType(column_type, cast_type); - - auto column_binding_index = new_column_ids.size(); - auto entry = child_map.find(new_index); - if (entry == child_map.end()) { - //! Adds the binding for the child only if it doesn't exist yet - entry = child_map.emplace(new_index, column_binding_index).first; - created_bindings[new_index.GetPrimaryIndex()]++; - - new_column_ids.emplace_back(std::move(new_index)); - original_ids.emplace_back(col_sel_idx); - } - return entry->second; - }); + WritePushdownExtractColumns( + entry->first, entry->second, col_sel_idx, column_type, + [&](const ColumnIndex &extract_path, optional_ptr cast_type) -> idx_t { + ColumnIndex new_index(struct_column_index, {extract_path}); + new_index.SetPushdownExtractType(column_type, cast_type); + + auto column_binding_index = new_column_ids.size(); + auto entry = child_map.find(new_index); + if (entry == child_map.end()) { + //! Adds the binding for the child only if it doesn't exist yet + entry = child_map.emplace(new_index, column_binding_index).first; + created_bindings[new_index.GetPrimaryIndex()]++; + + new_column_ids.emplace_back(std::move(new_index)); + original_ids.emplace_back(col_sel_idx); + } + return entry->second; + }); } if (new_column_ids.empty()) { // this generally means we are only interested in whether or not anything exists in the table (e.g. @@ -710,64 +722,126 @@ BaseColumnPrunerMode BaseColumnPruner::GetMode() const { return mode; } -bool BaseColumnPruner::HandleStructExtractRecursive(unique_ptr &expr_p, - optional_ptr &colref, - vector &indexes, - vector &expressions) { - auto &expr = *expr_p; - if (expr.GetExpressionClass() != ExpressionClass::BOUND_FUNCTION) { - return false; - } - auto &function = expr.Cast(); - if (function.function.name != "struct_extract_at" && function.function.name != "struct_extract" && - function.function.name != "array_extract") { - return false; +bool BaseColumnPruner::HandleStructExtract(unique_ptr &expr_p, + optional_ptr &colref, + reference &path_ref, + vector &expressions) { + auto &function = expr_p->Cast(); + auto &child = function.children[0]; + D_ASSERT(child->return_type.id() == LogicalTypeId::STRUCT); + auto &bind_data = function.bind_info->Cast(); + // struct extract, check if left child is a bound column ref + if (child->GetExpressionClass() == ExpressionClass::BOUND_COLUMN_REF) { + // column reference - check if it is a struct + auto &ref = child->Cast(); + if (ref.return_type.id() != LogicalTypeId::STRUCT) { + return false; + } + colref = &ref; + auto &path = path_ref.get(); + path.AddChildIndex(ColumnIndex(bind_data.index)); + path_ref = path.GetChildIndex(0); + expressions.emplace_back(expr_p); + return true; } - if (!function.bind_info) { + // not a column reference - try to handle this recursively + if (!HandleExtractRecursive(child, colref, path_ref, expressions)) { return false; } + auto &path = path_ref.get(); + path.AddChildIndex(ColumnIndex(bind_data.index)); + path_ref = path.GetChildIndex(0); + + expressions.emplace_back(expr_p); + return true; +} + +bool BaseColumnPruner::HandleVariantExtract(unique_ptr &expr_p, + optional_ptr &colref, + reference &path_ref, + vector &expressions) { + auto &function = expr_p->Cast(); auto &child = function.children[0]; - if (child->return_type.id() != LogicalTypeId::STRUCT) { + D_ASSERT(child->return_type.id() == LogicalTypeId::VARIANT); + auto &bind_data = function.bind_info->Cast(); + if (bind_data.component.lookup_mode != VariantChildLookupMode::BY_KEY) { + //! We don't push down variant extract on ARRAY values return false; } - auto &bind_data = function.bind_info->Cast(); - // struct extract, check if left child is a bound column ref + // variant extract, check if left child is a bound column ref if (child->GetExpressionClass() == ExpressionClass::BOUND_COLUMN_REF) { - // column reference - check if it is a struct + // column reference - check if it is a variant auto &ref = child->Cast(); - if (ref.return_type.id() != LogicalTypeId::STRUCT) { + if (ref.return_type.id() != LogicalTypeId::VARIANT) { return false; } colref = &ref; - indexes.push_back(bind_data.index); + + auto &path = path_ref.get(); + path.AddChildIndex(ColumnIndex(bind_data.component.key)); + path_ref = path.GetChildIndex(0); + expressions.emplace_back(expr_p); return true; } // not a column reference - try to handle this recursively - if (!HandleStructExtractRecursive(child, colref, indexes, expressions)) { + if (!HandleExtractRecursive(child, colref, path_ref, expressions)) { return false; } - indexes.push_back(bind_data.index); + + auto &path = path_ref.get(); + path.AddChildIndex(ColumnIndex(bind_data.component.key)); + path_ref = path.GetChildIndex(0); + expressions.emplace_back(expr_p); return true; } -bool BaseColumnPruner::HandleStructExtract(unique_ptr *expression, - optional_ptr> cast_expression) { +bool BaseColumnPruner::HandleExtractRecursive(unique_ptr &expr_p, + optional_ptr &colref, + reference &path_ref, + vector &expressions) { + auto &expr = *expr_p; + if (expr.GetExpressionClass() != ExpressionClass::BOUND_FUNCTION) { + return false; + } + auto &function = expr.Cast(); + if (function.function.name != "struct_extract_at" && function.function.name != "struct_extract" && + function.function.name != "array_extract" && function.function.name != "variant_extract") { + return false; + } + if (!function.bind_info) { + return false; + } + auto &child = function.children[0]; + auto child_type = child->return_type.id(); + switch (child_type) { + case LogicalTypeId::STRUCT: + return HandleStructExtract(expr_p, colref, path_ref, expressions); + case LogicalTypeId::VARIANT: + return HandleVariantExtract(expr_p, colref, path_ref, expressions); + default: + return false; + } +} + +bool BaseColumnPruner::HandleExtractExpression(unique_ptr *expression, + optional_ptr> cast_expression) { optional_ptr colref; - vector indexes; vector expressions; - if (!HandleStructExtractRecursive(*expression, colref, indexes, expressions)) { + ColumnIndex path(0); + reference path_ref(path); + if (!HandleExtractRecursive(*expression, colref, path_ref, expressions)) { return false; } if (cast_expression) { auto &top_level = expressions.back(); top_level.cast = cast_expression; + path_ref.get().SetType((*cast_expression)->return_type); } - auto index = PathToIndex(indexes, cast_expression); - AddBinding(*colref, std::move(index), expressions); + AddBinding(*colref, path.GetChildIndex(0), expressions); return true; } @@ -779,8 +853,20 @@ void BaseColumnPruner::MergeChildColumns(vector ¤t_child_colu } // if we are already extract sub-fields, add it (if it is not there yet) for (auto &binding : current_child_columns) { - if (binding.GetPrimaryIndex() != new_child_column.GetPrimaryIndex()) { - continue; + if (binding.HasPrimaryIndex()) { + if (!new_child_column.HasPrimaryIndex()) { + continue; + } + if (binding.GetPrimaryIndex() != new_child_column.GetPrimaryIndex()) { + continue; + } + } else { + if (new_child_column.HasPrimaryIndex()) { + continue; + } + if (binding.GetFieldName() != new_child_column.GetFieldName()) { + continue; + } } // found a match: sub-field is already projected // check if we have child columns @@ -827,26 +913,13 @@ void ReferencedColumn::AddPath(const ColumnIndex &path) { } path.VerifySinglePath(); - //! Do not add the path if it is a child of an existing path - ColumnIndex copy(path.GetPrimaryIndex()); - reference path_iter(path); - reference copy_iter(copy); - while (true) { - if (path_iter.get().HasType()) { - copy_iter.get().SetType(path_iter.get().GetType()); - } - //! Create a subset of the path up to an increasing depth, so we can check if the parent path already exists - if (unique_paths.count(copy)) { - //! The parent path already exists, don't add the new path - return; - } - if (!path_iter.get().HasChildren()) { - break; - } - path_iter = path_iter.get().GetChildIndex(0); - copy_iter.get().AddChildIndex(ColumnIndex(path_iter.get().GetPrimaryIndex())); - copy_iter = copy_iter.get().GetChildIndex(0); + auto res = FindShortestMatchingPath(unique_paths, path); + auto entry = res.first; + if (entry != unique_paths.end()) { + //! The parent path already exists, don't add the new path + return; } + //! No parent path exists, but child paths could already be added, remove them if they exist auto it = unique_paths.begin(); for (; it != unique_paths.end();) { @@ -912,14 +985,14 @@ void BaseColumnPruner::VisitExpression(unique_ptr *expression) { //! Check if this is a struct extract wrapped in a cast optional_ptr> cast_child; if (TryGetCastChild(*expression, cast_child)) { - if (HandleStructExtract(cast_child.get(), expression)) { + if (HandleExtractExpression(cast_child.get(), expression)) { // already handled return; } } //! Check if this is a struct extract - if (HandleStructExtract(expression)) { + if (HandleExtractExpression(expression)) { // already handled return; } diff --git a/src/duckdb/src/optimizer/rule/not_elimination.cpp b/src/duckdb/src/optimizer/rule/not_elimination.cpp deleted file mode 100644 index 380f2ae7e..000000000 --- a/src/duckdb/src/optimizer/rule/not_elimination.cpp +++ /dev/null @@ -1,215 +0,0 @@ -#include "duckdb/optimizer/rule/not_elimination.hpp" - -#include "duckdb/optimizer/expression_rewriter.hpp" -#include "duckdb/planner/expression/bound_operator_expression.hpp" -#include "duckdb/planner/expression/bound_conjunction_expression.hpp" -#include "duckdb/planner/expression/bound_comparison_expression.hpp" - -namespace duckdb { - -namespace { - -class RecursiveConjunctionExpressionMatcher : public ExpressionMatcher { -public: - explicit RecursiveConjunctionExpressionMatcher(unique_ptr matcher) - : ExpressionMatcher(ExpressionClass::BOUND_CONJUNCTION), matcher(std::move(matcher)) { - } - bool Match(Expression &expr_p, vector> &bindings) override { - if (RecursiveMatch(expr_p, bindings)) { - bindings.clear(); - bindings.push_back(expr_p); - return true; - } - return false; - } - -private: - bool RecursiveMatch(Expression &expr_p, vector> &bindings) { - if (!matcher->Match(expr_p, bindings)) { - return false; - } - - auto &expr = expr_p.Cast(); - for (auto &child : expr.children) { - if (child->GetExpressionClass() == ExpressionClass::BOUND_CONJUNCTION) { - if (!RecursiveMatch(*child, bindings)) { - return false; - } - } - } - - return true; - } - - unique_ptr matcher; -}; - -class NotExpressionMatcher : public ExpressionMatcher { -public: - NotExpressionMatcher() : ExpressionMatcher(ExpressionClass::BOUND_OPERATOR) { - } - // The matchers for the child expressions. - vector> matchers; - - bool Match(Expression &expr_p, vector> &bindings) override { - if (!ExpressionMatcher::Match(expr_p, bindings)) { - return false; - } - auto &expr = expr_p.Cast(); - for (auto &child : expr.children) { - for (auto &matcher : matchers) { - if (matcher->Match(*child, bindings)) { - bindings.clear(); - bindings.push_back(expr); - return true; - } - } - } - return false; - } -}; - -} // namespace - -NotEliminationRule::NotEliminationRule(ExpressionRewriter &rewriter) : Rule(rewriter) { - // Matcher for child NOT. - // eg. NOT NOT Expression. - auto child_not_matcher = make_uniq(); - child_not_matcher->expr_class = ExpressionClass::BOUND_OPERATOR; - child_not_matcher->expr_type = make_uniq(ExpressionType::OPERATOR_NOT); - - // Matcher for child IS_NULL/IS_NOT_NULL. - // eg. NOT IS_NULL/IS_NOT_NULL - auto child_null_matcher = make_uniq(); - child_null_matcher->expr_class = ExpressionClass::BOUND_OPERATOR; - child_null_matcher->expr_type = make_uniq( - vector {ExpressionType::OPERATOR_IS_NOT_NULL, ExpressionType::OPERATOR_IS_NULL}); - - // Matcher for child AND/OR conjunction. - // eg. NOT (col1 > 3 AND (col3 > 0 AND col2 < 2)) - static const vector valid_types = { - ExpressionType::COMPARE_EQUAL, - ExpressionType::COMPARE_NOTEQUAL, - ExpressionType::COMPARE_LESSTHAN, - ExpressionType::COMPARE_GREATERTHAN, - ExpressionType::COMPARE_LESSTHANOREQUALTO, - ExpressionType::COMPARE_GREATERTHANOREQUALTO, - ExpressionType::COMPARE_DISTINCT_FROM, - ExpressionType::COMPARE_NOT_DISTINCT_FROM, - ExpressionType::CONJUNCTION_AND, - ExpressionType::CONJUNCTION_OR, - }; - auto expr_matcher = make_uniq(); - expr_matcher->expr_type = make_uniq(valid_types); - auto child_conjunction_matcher = make_uniq(std::move(expr_matcher)); - - // Matcher for root NOT. - auto not_matcher = make_uniq(); - not_matcher->expr_class = ExpressionClass::BOUND_OPERATOR; - not_matcher->expr_type = make_uniq(ExpressionType::OPERATOR_NOT); - not_matcher->matchers.push_back(std::move(child_not_matcher)); - not_matcher->matchers.push_back(std::move(child_null_matcher)); - not_matcher->matchers.push_back(std::move(child_conjunction_matcher)); - root = std::move(not_matcher); -} - -unique_ptr NotEliminationRule::NegateExpression(const Expression &expr) { - static const unordered_map negate_types = { - {ExpressionType::COMPARE_EQUAL, ExpressionType::COMPARE_NOTEQUAL}, - {ExpressionType::COMPARE_NOTEQUAL, ExpressionType::COMPARE_EQUAL}, - {ExpressionType::COMPARE_LESSTHAN, ExpressionType::COMPARE_GREATERTHANOREQUALTO}, - {ExpressionType::COMPARE_GREATERTHAN, ExpressionType::COMPARE_LESSTHANOREQUALTO}, - {ExpressionType::COMPARE_LESSTHANOREQUALTO, ExpressionType::COMPARE_GREATERTHAN}, - {ExpressionType::COMPARE_GREATERTHANOREQUALTO, ExpressionType::COMPARE_LESSTHAN}, - {ExpressionType::COMPARE_DISTINCT_FROM, ExpressionType::COMPARE_NOT_DISTINCT_FROM}, - {ExpressionType::COMPARE_NOT_DISTINCT_FROM, ExpressionType::COMPARE_DISTINCT_FROM}, - {ExpressionType::OPERATOR_IS_NULL, ExpressionType::OPERATOR_IS_NOT_NULL}, - {ExpressionType::OPERATOR_IS_NOT_NULL, ExpressionType::OPERATOR_IS_NULL}, - {ExpressionType::CONJUNCTION_OR, ExpressionType::OPERATOR_NOT}, - {ExpressionType::CONJUNCTION_AND, ExpressionType::OPERATOR_NOT}, - }; - - auto negate_type_iter = negate_types.find(expr.GetExpressionType()); - if (DUCKDB_UNLIKELY(negate_type_iter == negate_types.end())) { - return nullptr; - } - - switch (expr.GetExpressionType()) { - case ExpressionType::CONJUNCTION_OR: - case ExpressionType::CONJUNCTION_AND: { - auto not_expr = make_uniq(negate_type_iter->second, expr.return_type); - not_expr->children.push_back(expr.Copy()); - return std::move(not_expr); - } - case ExpressionType::OPERATOR_IS_NULL: - case ExpressionType::OPERATOR_IS_NOT_NULL: { - const auto &op_expr = expr.Cast(); - auto negate_op_expr = make_uniq(negate_type_iter->second, LogicalType::BOOLEAN); - negate_op_expr->children.push_back(op_expr.children[0]->Copy()); - return std::move(negate_op_expr); - } - case ExpressionType::COMPARE_EQUAL: - case ExpressionType::COMPARE_NOTEQUAL: - case ExpressionType::COMPARE_LESSTHAN: - case ExpressionType::COMPARE_GREATERTHAN: - case ExpressionType::COMPARE_LESSTHANOREQUALTO: - case ExpressionType::COMPARE_GREATERTHANOREQUALTO: - case ExpressionType::COMPARE_DISTINCT_FROM: - case ExpressionType::COMPARE_NOT_DISTINCT_FROM: { - const auto &compare_expr = expr.Cast(); - return make_uniq(negate_type_iter->second, compare_expr.left->Copy(), - compare_expr.right->Copy()); - } - default: - return nullptr; - } -} - -unique_ptr NotEliminationRule::Apply(LogicalOperator &op, vector> &bindings, - bool &changes_made, bool is_root) { - auto &root = bindings.back().get().Cast(); - D_ASSERT(root.GetExpressionType() == ExpressionType::OPERATOR_NOT); - D_ASSERT(root.children.size() == 1); - auto &child = *(root.children[0].get()); - - if (child.GetExpressionClass() == ExpressionClass::BOUND_OPERATOR) { - auto &child_op = child.Cast(); - D_ASSERT(child_op.children.size() == 1); - // NOT NOT Expression ==> Expression. - if (child.GetExpressionType() == ExpressionType::OPERATOR_NOT) { - return child_op.children[0]->Copy(); - } else { - // NOT IS_NULL/IS_NOT_NULL ===> IS_NOT_NULL/IS_NULL. - D_ASSERT(child.GetExpressionType() == ExpressionType::OPERATOR_IS_NULL || - child.GetExpressionType() == ExpressionType::OPERATOR_IS_NOT_NULL); - return NegateExpression(child); - } - } - - D_ASSERT(child.GetExpressionClass() == ExpressionClass::BOUND_CONJUNCTION); - auto &conjunction_child = child.Cast(); - vector> new_children; - for (const auto &expr : conjunction_child.children) { - auto neg_expr = NegateExpression(*expr); - if (neg_expr == nullptr) { - return nullptr; - } - new_children.push_back(std::move(neg_expr)); - } - - // NOT (Expression1 AND Expression2) ==> !Expression1 OR !Expression2 - if (conjunction_child.GetExpressionType() == ExpressionType::CONJUNCTION_AND) { - auto comp = make_uniq(ExpressionType::CONJUNCTION_OR); - comp->children = std::move(new_children); - return std::move(comp); - - } else { - // NOT (Expression1 OR Expression2) ==> !Expression1 AND !Expression2 - D_ASSERT(conjunction_child.GetExpressionType() == ExpressionType::CONJUNCTION_OR); - auto comp = make_uniq(ExpressionType::CONJUNCTION_AND); - comp->children = std::move(new_children); - return std::move(comp); - } -} - -} // namespace duckdb diff --git a/src/duckdb/src/optimizer/statistics/operator/propagate_get.cpp b/src/duckdb/src/optimizer/statistics/operator/propagate_get.cpp index 708221883..362830447 100644 --- a/src/duckdb/src/optimizer/statistics/operator/propagate_get.cpp +++ b/src/duckdb/src/optimizer/statistics/operator/propagate_get.cpp @@ -15,7 +15,7 @@ namespace duckdb { -static void GetColumnIndex(unique_ptr &expr, idx_t &index, string &alias) { +static void GetColumnIndex(const unique_ptr &expr, idx_t &index, string &alias) { if (expr->type == ExpressionType::BOUND_REF) { auto &bound_ref = expr->Cast(); index = bound_ref.index; @@ -59,7 +59,7 @@ FilterPropagateResult StatisticsPropagator::PropagateTableFilter(ColumnBinding s return filter.CheckStatistics(stats); } -void StatisticsPropagator::UpdateFilterStatistics(BaseStatistics &input, TableFilter &filter) { +void StatisticsPropagator::UpdateFilterStatistics(BaseStatistics &input, const TableFilter &filter) { // FIXME: update stats... switch (filter.filter_type) { case TableFilterType::CONJUNCTION_AND: { @@ -79,7 +79,7 @@ void StatisticsPropagator::UpdateFilterStatistics(BaseStatistics &input, TableFi } } -static bool IsConstantOrNullFilter(TableFilter &table_filter) { +static bool IsConstantOrNullFilter(const TableFilter &table_filter) { if (table_filter.filter_type != TableFilterType::EXPRESSION_FILTER) { return false; } @@ -91,7 +91,7 @@ static bool IsConstantOrNullFilter(TableFilter &table_filter) { return ConstantOrNull::IsConstantOrNull(func, Value::BOOLEAN(true)); } -static bool CanReplaceConstantOrNull(TableFilter &table_filter) { +static bool CanReplaceConstantOrNull(const TableFilter &table_filter) { if (!IsConstantOrNullFilter(table_filter)) { throw InternalException("CanReplaceConstantOrNull() called on unexepected Table Filter"); } diff --git a/src/duckdb/src/optimizer/window_self_join.cpp b/src/duckdb/src/optimizer/window_self_join.cpp index a3879b27e..f1f9f42d2 100644 --- a/src/duckdb/src/optimizer/window_self_join.cpp +++ b/src/duckdb/src/optimizer/window_self_join.cpp @@ -4,6 +4,8 @@ #include "duckdb/planner/operator/logical_window.hpp" #include "duckdb/planner/operator/logical_comparison_join.hpp" #include "duckdb/planner/operator/logical_aggregate.hpp" +#include "duckdb/planner/operator/logical_dummy_scan.hpp" +#include "duckdb/planner/operator/logical_expression_get.hpp" #include "duckdb/planner/operator/logical_projection.hpp" #include "duckdb/planner/expression/bound_window_expression.hpp" #include "duckdb/planner/expression/bound_columnref_expression.hpp" @@ -17,6 +19,23 @@ namespace duckdb { class WindowSelfJoinTableRebinder : public LogicalOperatorVisitor { public: + static bool CanRebind(const LogicalOperator &op) { + switch (op.type) { + case LogicalOperatorType::LOGICAL_GET: + case LogicalOperatorType::LOGICAL_EXPRESSION_GET: + case LogicalOperatorType::LOGICAL_PROJECTION: + case LogicalOperatorType::LOGICAL_AGGREGATE_AND_GROUP_BY: + case LogicalOperatorType::LOGICAL_DUMMY_SCAN: + if (!op.children.empty()) { + return CanRebind(*op.children[0]); + } + return true; + default: + break; + } + return false; + } + explicit WindowSelfJoinTableRebinder(Optimizer &optimizer) : optimizer(optimizer) { } @@ -46,6 +65,19 @@ class WindowSelfJoinTableRebinder : public LogicalOperatorVisitor { agg.aggregate_index = new_agg_idx; agg.group_index = new_grp_idx; } + if (op.type == LogicalOperatorType::LOGICAL_EXPRESSION_GET) { + auto &get = op.Cast(); + auto new_idx = optimizer.binder.GenerateTableIndex(); + table_map[get.table_index] = new_idx; + get.table_index = new_idx; + } + if (op.type == LogicalOperatorType::LOGICAL_DUMMY_SCAN) { + auto &dummy = op.Cast(); + auto new_idx = optimizer.binder.GenerateTableIndex(); + table_map[dummy.table_index] = new_idx; + dummy.table_index = new_idx; + } + // TODO: Handle other operators defining tables if needed // But Get/Projection/Aggregate are most common in subplans. @@ -63,6 +95,46 @@ class WindowSelfJoinTableRebinder : public LogicalOperatorVisitor { } VisitExpressionChildren(**expression); } + + unique_ptr TranslateAggregate(const BoundWindowExpression &w_expr) { + auto agg_func = *w_expr.aggregate; + unique_ptr bind_info; + if (w_expr.bind_info) { + bind_info = w_expr.bind_info->Copy(); + } else { + bind_info = nullptr; + } + + vector> children; + for (auto &child : w_expr.children) { + auto child_copy = child->Copy(); + VisitExpression(&child_copy); // Update bindings + children.push_back(std::move(child_copy)); + } + + unique_ptr filter; + if (w_expr.filter_expr) { + filter = w_expr.filter_expr->Copy(); + VisitExpression(&filter); // Update bindings + } + + auto aggr_type = w_expr.distinct ? AggregateType::DISTINCT : AggregateType::NON_DISTINCT; + + auto result = make_uniq(std::move(agg_func), std::move(children), std::move(filter), + std::move(bind_info), aggr_type); + + if (!w_expr.arg_orders.empty()) { + result->order_bys = make_uniq(); + auto &orders = result->order_bys->orders; + for (auto &order : w_expr.arg_orders) { + auto order_copy = order.Copy(); + VisitExpression(&order_copy.expression); // Update bindings + orders.emplace_back(std::move(order_copy)); + } + } + + return std::move(result); + } }; WindowSelfJoinOptimizer::WindowSelfJoinOptimizer(Optimizer &optimizer) : optimizer(optimizer) { @@ -77,6 +149,26 @@ unique_ptr WindowSelfJoinOptimizer::Optimize(unique_ptr WindowSelfJoinOptimizer::OptimizeInternal(unique_ptr op, ColumnBindingReplacer &replacer) { if (op->type == LogicalOperatorType::LOGICAL_WINDOW) { @@ -85,23 +177,18 @@ unique_ptr WindowSelfJoinOptimizer::OptimizeInternal(unique_ptr // Check recursively window.children[0] = OptimizeInternal(std::move(window.children[0]), replacer); - if (window.expressions.size() != 1) { - return op; - } - if (window.expressions[0]->type != ExpressionType::WINDOW_AGGREGATE) { + if (!WindowSelfJoinTableRebinder::CanRebind(*window.children[0])) { return op; } - auto &w_expr = window.expressions[0]->Cast(); - if (w_expr.aggregate->name != "count" && w_expr.aggregate->name != "count_star") { - return op; - } - if (!w_expr.orders.empty()) { - return op; - } - if (w_expr.partitions.empty()) { - return op; + auto &w_expr0 = window.expressions[0]->Cast(); + for (auto &expr : window.expressions) { + auto &w_expr = expr->Cast(); + if (!CanOptimize(w_expr, w_expr0)) { + return op; + } } + auto &partitions = w_expr0.partitions; // --- Transformation --- @@ -119,34 +206,17 @@ unique_ptr WindowSelfJoinOptimizer::OptimizeInternal(unique_ptr vector> aggregates; // Create Aggregate Operator - for (auto &part : w_expr.partitions) { + for (auto &part : partitions) { auto part_copy = part->Copy(); rebinder.VisitExpression(&part_copy); // Update bindings groups.push_back(std::move(part_copy)); } - auto count_func = *w_expr.aggregate; - unique_ptr bind_info; - if (w_expr.bind_info) { - bind_info = w_expr.bind_info->Copy(); - } else { - bind_info = nullptr; - } - - vector> children; - for (auto &child : w_expr.children) { - auto child_copy = child->Copy(); - rebinder.VisitExpression(&child_copy); // Update bindings - children.push_back(std::move(child_copy)); + for (auto &expr : window.expressions) { + auto &w_expr = expr->Cast(); + aggregates.emplace_back(rebinder.TranslateAggregate(w_expr)); } - auto aggr_type = w_expr.distinct ? AggregateType::DISTINCT : AggregateType::NON_DISTINCT; - - auto agg_expr = make_uniq(std::move(count_func), std::move(children), nullptr, - std::move(bind_info), aggr_type); - - aggregates.push_back(std::move(agg_expr)); - // args: group_index, aggregate_index, ... auto agg_op = make_uniq(group_index, aggregate_index, std::move(aggregates)); @@ -161,12 +231,11 @@ unique_ptr WindowSelfJoinOptimizer::OptimizeInternal(unique_ptr // Inner Join on the partition keys auto join = make_uniq(JoinType::INNER); - for (size_t i = 0; i < w_expr.partitions.size(); ++i) { + for (size_t i = 0; i < partitions.size(); ++i) { JoinCondition cond; cond.comparison = ExpressionType::COMPARE_NOT_DISTINCT_FROM; - cond.left = w_expr.partitions[i]->Copy(); - cond.right = - make_uniq(w_expr.partitions[i]->return_type, ColumnBinding(group_index, i)); + cond.left = partitions[i]->Copy(); + cond.right = make_uniq(partitions[i]->return_type, ColumnBinding(group_index, i)); join->conditions.push_back(std::move(cond)); } @@ -174,13 +243,14 @@ unique_ptr WindowSelfJoinOptimizer::OptimizeInternal(unique_ptr join->children.push_back(std::move(agg_op)); join->ResolveOperatorTypes(); - // Replace Count binding - // Old window column: (window.window_index, 0) - // New constant column: (aggregate_index, 0) - ColumnBinding old_binding(window.window_index, 0); - ColumnBinding new_binding(aggregate_index, 0); - - replacer.replacement_bindings.emplace_back(old_binding, new_binding); + // Replace aggregate bindings + // Old window column: (window.window_index, x) + // New constant column: (aggregate_index, x) + for (idx_t column_index = 0; column_index < window.expressions.size(); ++column_index) { + ColumnBinding old_binding(window.window_index, column_index); + ColumnBinding new_binding(aggregate_index, column_index); + replacer.replacement_bindings.emplace_back(old_binding, new_binding); + } return std::move(join); } else if (!op->children.empty()) { diff --git a/src/duckdb/src/parallel/executor.cpp b/src/duckdb/src/parallel/executor.cpp index 9a9cf4703..9ab72c3c7 100644 --- a/src/duckdb/src/parallel/executor.cpp +++ b/src/duckdb/src/parallel/executor.cpp @@ -8,6 +8,7 @@ #include "duckdb/execution/physical_operator.hpp" #include "duckdb/main/client_context.hpp" #include "duckdb/main/client_data.hpp" +#include "duckdb/main/settings.hpp" #include "duckdb/parallel/meta_pipeline.hpp" #include "duckdb/parallel/pipeline_complete_event.hpp" #include "duckdb/parallel/pipeline_event.hpp" @@ -593,7 +594,7 @@ PendingExecutionResult Executor::ExecuteTask(bool dry_run) { if (!HasError()) { // we (partially) processed a task and no exceptions were thrown // give back control to the caller - if (task && DBConfig::GetConfig(context).options.scheduler_process_partial) { + if (task && Settings::Get(context)) { auto &token = *task->token; TaskScheduler::GetScheduler(context).ScheduleTask(token, task); task.reset(); diff --git a/src/duckdb/src/parallel/pipeline.cpp b/src/duckdb/src/parallel/pipeline.cpp index 1e5a20b4a..e213d78be 100644 --- a/src/duckdb/src/parallel/pipeline.cpp +++ b/src/duckdb/src/parallel/pipeline.cpp @@ -157,7 +157,7 @@ bool Pipeline::IsOrderDependent() const { return true; } } - if (!DBConfig::GetSetting(executor.context)) { + if (!Settings::Get(executor.context)) { return false; } if (sink && sink->SinkOrderDependent()) { diff --git a/src/duckdb/src/parallel/task_scheduler.cpp b/src/duckdb/src/parallel/task_scheduler.cpp index b5ed2db24..0a0635c70 100644 --- a/src/duckdb/src/parallel/task_scheduler.cpp +++ b/src/duckdb/src/parallel/task_scheduler.cpp @@ -5,6 +5,7 @@ #include "duckdb/common/numeric_utils.hpp" #include "duckdb/main/client_context.hpp" #include "duckdb/main/database.hpp" +#include "duckdb/main/settings.hpp" #include "duckdb/storage/block_allocator.hpp" #ifndef DUCKDB_NO_THREADS #include "concurrentqueue.h" @@ -226,9 +227,9 @@ ProducerToken::~ProducerToken() { TaskScheduler::TaskScheduler(DatabaseInstance &db) : db(db), queue(make_uniq()), allocator_flush_threshold(db.config.options.allocator_flush_threshold), - allocator_background_threads(db.config.options.allocator_background_threads), requested_thread_count(0), + allocator_background_threads(Settings::Get(db)), requested_thread_count(0), current_thread_count(1) { - SetAllocatorBackgroundThreads(db.config.options.allocator_background_threads); + SetAllocatorBackgroundThreads(allocator_background_threads); } TaskScheduler::~TaskScheduler() { @@ -299,8 +300,10 @@ void TaskScheduler::ExecuteForever(atomic *marker) { } } if (queue->Dequeue(task)) { - auto process_mode = config.options.scheduler_process_partial ? TaskExecutionMode::PROCESS_PARTIAL - : TaskExecutionMode::PROCESS_ALL; + auto process_mode = TaskExecutionMode::PROCESS_ALL; + if (Settings::Get(config)) { + process_mode = TaskExecutionMode::PROCESS_PARTIAL; + } auto execute_result = task->Execute(process_mode); switch (execute_result) { @@ -519,7 +522,8 @@ void TaskScheduler::RelaunchThreadsInternal(int32_t n) { auto &config = DBConfig::GetConfig(db); auto new_thread_count = NumericCast(n); if (threads.size() == new_thread_count) { - current_thread_count = NumericCast(threads.size() + config.options.external_threads); + auto external_threads = Settings::Get(config); + current_thread_count = NumericCast(threads.size() + external_threads); return; } if (threads.size() > new_thread_count) { @@ -542,9 +546,10 @@ void TaskScheduler::RelaunchThreadsInternal(int32_t n) { // Whether to pin threads to cores static constexpr idx_t THREAD_PIN_THRESHOLD = 64; - const auto pin_threads = db.config.options.pin_threads == ThreadPinMode::ON || - (db.config.options.pin_threads == ThreadPinMode::AUTO && - std::thread::hardware_concurrency() > THREAD_PIN_THRESHOLD); + auto pin_thread_mode = Settings::Get(db); + const auto pin_threads = + pin_thread_mode == ThreadPinMode::ON || + (pin_thread_mode == ThreadPinMode::AUTO && std::thread::hardware_concurrency() > THREAD_PIN_THRESHOLD); for (idx_t i = 0; i < create_new_threads; i++) { // launch a thread and assign it a cancellation marker auto marker = unique_ptr>(new atomic(true)); @@ -565,7 +570,8 @@ void TaskScheduler::RelaunchThreadsInternal(int32_t n) { markers.push_back(std::move(marker)); } } - current_thread_count = NumericCast(threads.size() + config.options.external_threads); + auto external_threads = Settings::Get(config); + current_thread_count = NumericCast(threads.size() + external_threads); BlockAllocator::Get(db).FlushAll(); #endif } diff --git a/src/duckdb/src/parser/parsed_data/create_table_info.cpp b/src/duckdb/src/parser/parsed_data/create_table_info.cpp index 539f08ba6..68a5ee6d8 100644 --- a/src/duckdb/src/parser/parsed_data/create_table_info.cpp +++ b/src/duckdb/src/parser/parsed_data/create_table_info.cpp @@ -23,6 +23,15 @@ unique_ptr CreateTableInfo::Copy() const { for (auto &constraint : constraints) { result->constraints.push_back(constraint->Copy()); } + for (auto &partition : partition_keys) { + result->partition_keys.push_back(partition->Copy()); + } + for (auto &order : sort_keys) { + result->sort_keys.push_back(order->Copy()); + } + for (auto &option : options) { + result->options.emplace(option.first, option.second->Copy()); + } if (query) { result->query = unique_ptr_cast(query->Copy()); } @@ -37,8 +46,34 @@ string CreateTableInfo::ToString() const { ret += TableCatalogEntry::ColumnNamesToSQL(columns); ret += " AS " + query->ToString(); } else { - ret += TableCatalogEntry::ColumnsToSQL(columns, constraints) + ";"; + ret += TableCatalogEntry::ColumnsToSQL(columns, constraints); + if (!partition_keys.empty()) { + ret += " PARTITIONED BY ("; + for (auto &partition : partition_keys) { + ret += partition->ToString() + ","; + } + ret.pop_back(); + ret += ")"; + } + if (!sort_keys.empty()) { + ret += " SORTED BY ("; + for (auto &order : sort_keys) { + ret += order->ToString() + ","; + } + ret.pop_back(); + ret += ")"; + } + if (!options.empty()) { + ret += " WITH ("; + for (auto &entry : options) { + ret += "'" + entry.first + "'=" + entry.second->ToString() + ","; + } + ret.pop_back(); + ret += ")"; + } + ret += ";"; } + return ret; } diff --git a/src/duckdb/src/parser/parser.cpp b/src/duckdb/src/parser/parser.cpp index 36b977c6a..d69bf5ceb 100644 --- a/src/duckdb/src/parser/parser.cpp +++ b/src/duckdb/src/parser/parser.cpp @@ -229,7 +229,6 @@ void Parser::ParseQuery(const string &query) { Transformer transformer(options); string parser_error; optional_idx parser_error_location; - string parser_override_option = StringUtil::Lower(options.parser_override_setting); { // check if there are any unicode spaces in the string string new_query; @@ -245,7 +244,7 @@ void Parser::ParseQuery(const string &query) { if (!ext.parser_override) { continue; } - if (StringUtil::CIEquals(parser_override_option, "default")) { + if (options.parser_override_setting == AllowParserOverride::DEFAULT_OVERRIDE) { continue; } auto result = ext.parser_override(ext.parser_info.get(), query); @@ -253,10 +252,10 @@ void Parser::ParseQuery(const string &query) { statements = std::move(result.statements); return; } - if (StringUtil::CIEquals(parser_override_option, "strict")) { + if (options.parser_override_setting == AllowParserOverride::STRICT_OVERRIDE) { ThrowParserOverrideError(result); } - if (StringUtil::CIEquals(parser_override_option, "strict_when_supported")) { + if (options.parser_override_setting == AllowParserOverride::STRICT_WHEN_SUPPORTED) { auto statement = GetStatement(query); if (!statement) { break; @@ -299,7 +298,7 @@ void Parser::ParseQuery(const string &query) { if (is_supported) { ThrowParserOverrideError(result); } - } else if (StringUtil::CIEquals(parser_override_option, "fallback")) { + } else if (options.parser_override_setting == AllowParserOverride::FALLBACK_OVERRIDE) { continue; } } diff --git a/src/duckdb/src/parser/query_node/set_operation_node.cpp b/src/duckdb/src/parser/query_node/set_operation_node.cpp index 30d36defc..9ab492ed5 100644 --- a/src/duckdb/src/parser/query_node/set_operation_node.cpp +++ b/src/duckdb/src/parser/query_node/set_operation_node.cpp @@ -127,7 +127,7 @@ unique_ptr SetOperationNode::SerializeChildNode(Serializer &serialize } bool SetOperationNode::SerializeChildList(Serializer &serializer) const { - return serializer.ShouldSerialize(6); + return serializer.ShouldSerialize(7); } } // namespace duckdb diff --git a/src/duckdb/src/parser/transform/constraint/transform_constraint.cpp b/src/duckdb/src/parser/transform/constraint/transform_constraint.cpp index 256a10200..886114480 100644 --- a/src/duckdb/src/parser/transform/constraint/transform_constraint.cpp +++ b/src/duckdb/src/parser/transform/constraint/transform_constraint.cpp @@ -124,13 +124,19 @@ unique_ptr Transformer::TransformConstraint(duckdb_libpgquery::PGCon case duckdb_libpgquery::PG_CONSTR_DEFAULT: column.SetDefaultValue(TransformExpression(constraint.raw_expr)); return nullptr; - case duckdb_libpgquery::PG_CONSTR_COMPRESSION: - column.SetCompressionType(CompressionTypeFromString(constraint.compression_name)); - if (column.CompressionType() == CompressionType::COMPRESSION_AUTO) { - throw ParserException("Unrecognized option for column compression, expected none, uncompressed, rle, " - "dictionary, pfor, bitpacking, fsst, chimp, patas, zstd, alp, alprd or roaring"); + case duckdb_libpgquery::PG_CONSTR_COMPRESSION: { + auto compression_type = EnumUtil::FromString(constraint.compression_name); + switch (compression_type) { + case CompressionType::COMPRESSION_AUTO: + case CompressionType::COMPRESSION_CONSTANT: + case CompressionType::COMPRESSION_EMPTY: + throw InvalidInputException("Compression method %d cannot be forced", constraint.compression_name); + default: + break; } + column.SetCompressionType(compression_type); return nullptr; + } case duckdb_libpgquery::PG_CONSTR_FOREIGN: return TransformForeignKeyConstraint(constraint, &column.Name()); default: diff --git a/src/duckdb/src/parser/transform/expression/transform_expression.cpp b/src/duckdb/src/parser/transform/expression/transform_expression.cpp index 73b42c9dd..0ab5a1f02 100644 --- a/src/duckdb/src/parser/transform/expression/transform_expression.cpp +++ b/src/duckdb/src/parser/transform/expression/transform_expression.cpp @@ -1,5 +1,6 @@ #include "duckdb/common/exception.hpp" #include "duckdb/parser/expression/default_expression.hpp" +#include "duckdb/parser/expression/constant_expression.hpp" #include "duckdb/parser/transformer.hpp" namespace duckdb { @@ -77,6 +78,8 @@ unique_ptr Transformer::TransformExpression(duckdb_libpgquery: return TransformBooleanTest(PGCast(node)); case duckdb_libpgquery::T_PGMultiAssignRef: return TransformMultiAssignRef(PGCast(node)); + case duckdb_libpgquery::T_PGString: + return TransformValue(PGCast(node)); default: throw NotImplementedException("Expression type %s (%d)", NodetypeToString(node.type), (int)node.type); } diff --git a/src/duckdb/src/parser/transform/statement/transform_create_index.cpp b/src/duckdb/src/parser/transform/statement/transform_create_index.cpp index 3b13d53ce..47ce484dc 100644 --- a/src/duckdb/src/parser/transform/statement/transform_create_index.cpp +++ b/src/duckdb/src/parser/transform/statement/transform_create_index.cpp @@ -66,7 +66,12 @@ unique_ptr Transformer::TransformCreateIndex(duckdb_libpgquery: auto def_elem = PGPointerCast(cell->data.ptr_value); Value val; if (def_elem->arg) { - val = TransformValue(*PGPointerCast(def_elem->arg))->value; + auto expr = TransformExpression(def_elem->arg); + if (expr->expression_class != ExpressionClass::CONSTANT) { + throw InvalidInputException("Create index option must be a constant value"); + } + auto &const_expr = expr->Cast(); + val = const_expr.value; } else { val = Value::BOOLEAN(true); } diff --git a/src/duckdb/src/parser/transform/statement/transform_create_table.cpp b/src/duckdb/src/parser/transform/statement/transform_create_table.cpp index 412a73cd3..19f2cd351 100644 --- a/src/duckdb/src/parser/transform/statement/transform_create_table.cpp +++ b/src/duckdb/src/parser/transform/statement/transform_create_table.cpp @@ -134,6 +134,22 @@ unique_ptr Transformer::TransformCreateTable(duckdb_libpgquery: } } + vector> partition_keys; + if (stmt.partition_list) { + TransformExpressionList(*stmt.partition_list, partition_keys); + } + info->partition_keys = std::move(partition_keys); + + vector> order_keys; + if (stmt.sort_list) { + TransformExpressionList(*stmt.sort_list, order_keys); + } + info->sort_keys = std::move(order_keys); + + if (stmt.options) { + TransformTableOptions(info->options, stmt.options); + } + if (!column_count) { throw ParserException("Table must have at least one column!"); } diff --git a/src/duckdb/src/parser/transform/statement/transform_show.cpp b/src/duckdb/src/parser/transform/statement/transform_show.cpp index ebd0ebd8d..cc6afe780 100644 --- a/src/duckdb/src/parser/transform/statement/transform_show.cpp +++ b/src/duckdb/src/parser/transform/statement/transform_show.cpp @@ -31,12 +31,15 @@ unique_ptr Transformer::TransformShow(duckdb_libpgquery::PGVariableSh } else { // describing a set (e.g. SHOW ALL TABLES) - push it in the table name showref->table_name = stmt.set; + showref->show_type = ShowType::SHOW_UNQUALIFIED; } } else if (!stmt.relation->schemaname) { // describing an unqualified relation - check if this is a "special" relation string table_name = StringUtil::Lower(stmt.relation->relname); - if (table_name == "databases" || table_name == "tables" || table_name == "variables") { + if (table_name == "databases" || table_name == "schemas" || table_name == "tables" || + table_name == "variables") { showref->table_name = "\"" + std::move(table_name) + "\""; + showref->show_type = ShowType::SHOW_UNQUALIFIED; } } if (showref->table_name.empty() && showref->show_type != ShowType::SHOW_FROM) { diff --git a/src/duckdb/src/parser/transformer.cpp b/src/duckdb/src/parser/transformer.cpp index f3f058899..c277578de 100644 --- a/src/duckdb/src/parser/transformer.cpp +++ b/src/duckdb/src/parser/transformer.cpp @@ -244,4 +244,26 @@ void Transformer::SetQueryLocation(TableRef &ref, int query_location) { ref.query_location = optional_idx(static_cast(query_location)); } +void Transformer::TransformTableOptions(case_insensitive_map_t> &options, + optional_ptr pg_options) { + if (!pg_options) { + return; + } + + duckdb_libpgquery::PGListCell *cell; + for_each_cell(cell, pg_options->head) { + auto def_elem = PGPointerCast(cell->data.ptr_value); + auto lower_name = StringUtil::Lower(def_elem->defname); + if (options.find(lower_name) != options.end()) { + throw ParserException("Duplicate table property \"%s\"", lower_name); + } + if (!def_elem->arg) { + options.emplace(lower_name, make_uniq(Value::BOOLEAN(true))); + continue; + } + auto expr = TransformExpression(def_elem->arg); + options.emplace(lower_name, std::move(expr)); + } +} + } // namespace duckdb diff --git a/src/duckdb/src/planner/binder.cpp b/src/duckdb/src/planner/binder.cpp index fe1b59cf3..5d5be868e 100644 --- a/src/duckdb/src/planner/binder.cpp +++ b/src/duckdb/src/planner/binder.cpp @@ -7,6 +7,7 @@ #include "duckdb/common/helper.hpp" #include "duckdb/main/config.hpp" #include "duckdb/main/database.hpp" +#include "duckdb/main/settings.hpp" #include "duckdb/optimizer/optimizer.hpp" #include "duckdb/parser/expression/function_expression.hpp" #include "duckdb/parser/expression/subquery_expression.hpp" @@ -34,10 +35,11 @@ idx_t Binder::GetBinderDepth() const { void Binder::IncreaseDepth() { depth++; - if (depth > context.config.max_expression_depth) { + auto max_expression_depth = Settings::Get(context); + if (depth > max_expression_depth) { throw BinderException("Max expression depth limit of %lld exceeded. Use \"SET max_expression_depth TO x\" to " "increase the maximum expression depth.", - context.config.max_expression_depth); + max_expression_depth); } } diff --git a/src/duckdb/src/planner/binder/expression/bind_aggregate_expression.cpp b/src/duckdb/src/planner/binder/expression/bind_aggregate_expression.cpp index 053576294..9441c419c 100644 --- a/src/duckdb/src/planner/binder/expression/bind_aggregate_expression.cpp +++ b/src/duckdb/src/planner/binder/expression/bind_aggregate_expression.cpp @@ -160,7 +160,7 @@ BindResult BaseSelectBinder::BindAggregate(FunctionExpression &aggr, AggregateFu if (order.expression->GetExpressionType() == ExpressionType::VALUE_CONSTANT) { auto &const_expr = order.expression->Cast(); if (!const_expr.value.type().IsIntegral()) { - auto order_by_non_integer_literal = DBConfig::GetSetting(context); + auto order_by_non_integer_literal = Settings::Get(context); if (!order_by_non_integer_literal) { throw BinderException( *order.expression, diff --git a/src/duckdb/src/planner/binder/expression/bind_function_expression.cpp b/src/duckdb/src/planner/binder/expression/bind_function_expression.cpp index 92a5d0757..43dd22135 100644 --- a/src/duckdb/src/planner/binder/expression/bind_function_expression.cpp +++ b/src/duckdb/src/planner/binder/expression/bind_function_expression.cpp @@ -13,6 +13,7 @@ #include "duckdb/planner/expression/bound_lambda_expression.hpp" #include "duckdb/planner/expression/bound_reference_expression.hpp" #include "duckdb/planner/expression_binder.hpp" +#include "duckdb/main/settings.hpp" namespace duckdb { @@ -23,8 +24,7 @@ BindResult ExpressionBinder::TryBindLambdaOrJson(FunctionExpression &function, i return BindLambdaFunction(function, func.Cast(), depth); } - auto &config = ClientConfig::GetConfig(context); - auto setting = config.lambda_syntax; + auto setting = Settings::Get(context); bool invalid_syntax = setting == LambdaSyntax::DISABLE_SINGLE_ARROW && syntax_type == LambdaSyntaxType::SINGLE_ARROW; bool warn_deprecated_syntax = setting == LambdaSyntax::DEFAULT && syntax_type == LambdaSyntaxType::SINGLE_ARROW; @@ -220,12 +220,22 @@ BindResult ExpressionBinder::BindLambdaFunction(FunctionExpression &function, Sc } // the first child is the list, the second child is the lambda expression - constexpr idx_t list_idx = 0; - constexpr idx_t lambda_expr_idx = 1; - D_ASSERT(function.children[lambda_expr_idx]->GetExpressionClass() == ExpressionClass::LAMBDA); + // constexpr idx_t list_ix = 0; + idx_t lambda_expr_idx = 0; + bool found_lambda = false; + for (idx_t i = 0; i < function.children.size(); i++) { + if (function.children[i]->GetExpressionClass() == ExpressionClass::LAMBDA) { + if (found_lambda) { + return BindResult("Only one lambda expression is supported per lambda function!"); + } + lambda_expr_idx = i; + found_lambda = true; + break; + } + } + // Get lambda expr idx vector function_child_types; - // bind the list ErrorData error; for (idx_t i = 0; i < function.children.size(); i++) { @@ -248,14 +258,6 @@ BindResult ExpressionBinder::BindLambdaFunction(FunctionExpression &function, Sc function_child_types.push_back(child->return_type); } - // get the logical type of the children of the list - auto &list_child = BoundExpression::GetExpression(*function.children[list_idx]); - if (list_child->return_type.id() != LogicalTypeId::LIST && list_child->return_type.id() != LogicalTypeId::ARRAY && - list_child->return_type.id() != LogicalTypeId::SQLNULL && - list_child->return_type.id() != LogicalTypeId::UNKNOWN) { - return BindResult("Invalid LIST argument during lambda function binding!"); - } - // bind the lambda parameter auto &lambda_expr = function.children[lambda_expr_idx]->Cast(); BindResult bind_lambda_result = BindExpression(lambda_expr, depth, function_child_types, &bind_lambda_function); @@ -265,11 +267,7 @@ BindResult ExpressionBinder::BindLambdaFunction(FunctionExpression &function, Sc } // successfully bound: replace the node with a BoundExpression - auto alias = function.children[lambda_expr_idx]->GetAlias(); - bind_lambda_result.expression->SetAlias(alias); - if (!alias.empty()) { - bind_lambda_result.expression->SetAlias(alias); - } + bind_lambda_result.expression->SetAlias(lambda_expr.GetAlias()); function.children[lambda_expr_idx] = make_uniq(std::move(bind_lambda_result.expression)); if (binder.GetBindingMode() == BindingMode::EXTRACT_NAMES) { @@ -306,18 +304,22 @@ BindResult ExpressionBinder::BindLambdaFunction(FunctionExpression &function, Sc // push back (in reverse order) any nested lambda parameters so that we can later use them in the lambda // expression (rhs). This happens after we bound the lambda expression of this depth. So it is relevant for // correctly binding lambdas one level 'out'. Therefore, the current parameter count does not matter here. - idx_t offset = 0; if (lambda_bindings) { + idx_t offset = 0; + for (idx_t i = lambda_bindings->size(); i > 0; i--) { auto &binding = (*lambda_bindings)[i - 1]; auto &column_names = binding.GetColumnNames(); auto &column_types = binding.GetColumnTypes(); D_ASSERT(column_names.size() == column_types.size()); - for (idx_t column_idx = column_names.size(); column_idx > 0; column_idx--) { - auto bound_lambda_param = make_uniq(column_names[column_idx - 1], - column_types[column_idx - 1], offset); - offset++; + // However, the parameters are ordered within the level + for (idx_t col_idx = 0; col_idx < column_names.size(); col_idx++) { + auto ¶m_name = column_names[col_idx]; + auto ¶m_type = column_types[col_idx]; + + auto bound_lambda_param = make_uniq(param_name, param_type, offset++); + bound_function_expr.children.push_back(std::move(bound_lambda_param)); } } diff --git a/src/duckdb/src/planner/binder/expression/bind_lambda.cpp b/src/duckdb/src/planner/binder/expression/bind_lambda.cpp index 0d6334fc4..c13200473 100644 --- a/src/duckdb/src/planner/binder/expression/bind_lambda.cpp +++ b/src/duckdb/src/planner/binder/expression/bind_lambda.cpp @@ -12,7 +12,7 @@ namespace duckdb { -idx_t GetLambdaParamCount(vector &lambda_bindings) { +static idx_t GetLambdaParamCount(vector &lambda_bindings) { idx_t count = 0; for (auto &binding : lambda_bindings) { count += binding.GetColumnCount(); @@ -20,8 +20,8 @@ idx_t GetLambdaParamCount(vector &lambda_bindings) { return count; } -idx_t GetLambdaParamIndex(vector &lambda_bindings, const BoundLambdaExpression &bound_lambda_expr, - const BoundLambdaRefExpression &bound_lambda_ref_expr) { +static idx_t GetLambdaParamIndex(vector &lambda_bindings, const BoundLambdaExpression &bound_lambda_expr, + const BoundLambdaRefExpression &bound_lambda_ref_expr) { D_ASSERT(bound_lambda_ref_expr.lambda_idx < lambda_bindings.size()); idx_t offset = 0; // count the remaining lambda parameters BEFORE the current lambda parameter, @@ -29,13 +29,13 @@ idx_t GetLambdaParamIndex(vector &lambda_bindings, const BoundLamb for (idx_t i = bound_lambda_ref_expr.lambda_idx + 1; i < lambda_bindings.size(); i++) { offset += lambda_bindings[i].GetColumnCount(); } - offset += lambda_bindings[bound_lambda_ref_expr.lambda_idx].GetColumnCount() - - bound_lambda_ref_expr.binding.column_index - 1; + offset += bound_lambda_ref_expr.binding.column_index; offset += bound_lambda_expr.parameter_count; return offset; } -void ExtractParameter(const ParsedExpression &expr, vector &column_names, vector &column_aliases) { +static void ExtractParameter(const ParsedExpression &expr, vector &column_names, + vector &column_aliases) { auto &column_ref = expr.Cast(); if (column_ref.IsQualified()) { throw BinderException(LambdaExpression::InvalidParametersErrorMessage()); @@ -45,7 +45,7 @@ void ExtractParameter(const ParsedExpression &expr, vector &column_names column_aliases.push_back(column_ref.ToString()); } -void ExtractParameters(LambdaExpression &expr, vector &column_names, vector &column_aliases) { +static void ExtractParameters(LambdaExpression &expr, vector &column_names, vector &column_aliases) { // extract the lambda parameters, which are a single column // reference, or a list of column references (ROW function) string error_message; @@ -164,7 +164,9 @@ void ExpressionBinder::TransformCapturedLambdaColumn(unique_ptr &ori // refers to a lambda parameter inside the current lambda function auto logical_type = (*bind_lambda_function)(context, function_child_types, bound_lambda_ref.binding.column_index); - auto index = bound_lambda_expr.parameter_count - bound_lambda_ref.binding.column_index - 1; + + const auto index = bound_lambda_ref.binding.column_index; + replacement = make_uniq(alias, logical_type, index); return; } diff --git a/src/duckdb/src/planner/binder/query_node/plan_subquery.cpp b/src/duckdb/src/planner/binder/query_node/plan_subquery.cpp index ab162808e..40aad85bb 100644 --- a/src/duckdb/src/planner/binder/query_node/plan_subquery.cpp +++ b/src/duckdb/src/planner/binder/query_node/plan_subquery.cpp @@ -80,7 +80,7 @@ static unique_ptr PlanUncorrelatedSubquery(Binder &binder, BoundSubq D_ASSERT(bindings.size() == 1); idx_t table_idx = bindings[0].table_index; - bool error_on_multiple_rows = DBConfig::GetSetting(binder.context); + bool error_on_multiple_rows = Settings::Get(binder.context); // we push an aggregate that returns the FIRST element vector> expressions; diff --git a/src/duckdb/src/planner/binder/statement/bind_create.cpp b/src/duckdb/src/planner/binder/statement/bind_create.cpp index 01467054f..735f5de49 100644 --- a/src/duckdb/src/planner/binder/statement/bind_create.cpp +++ b/src/duckdb/src/planner/binder/statement/bind_create.cpp @@ -166,7 +166,7 @@ void Binder::BindCreateViewInfo(CreateViewInfo &base) { auto &dependencies = base.dependencies; auto &catalog = Catalog::GetCatalog(context, base.catalog); - bool should_create_dependencies = DBConfig::GetSetting(context); + bool should_create_dependencies = Settings::Get(context); if (should_create_dependencies) { view_binder->SetCatalogLookupCallback([&dependencies, &catalog](CatalogEntry &entry) { if (&catalog != &entry.ParentCatalog()) { @@ -304,7 +304,7 @@ SchemaCatalogEntry &Binder::BindCreateFunctionInfo(CreateInfo &info) { macro_binding = this_macro_binding.get(); auto &dependencies = base.dependencies; - const auto should_create_dependencies = DBConfig::GetSetting(context); + const auto should_create_dependencies = Settings::Get(context); const auto binder_callback = [&dependencies, &catalog](CatalogEntry &entry) { if (&catalog != &entry.ParentCatalog()) { // Don't register any cross-catalog dependencies diff --git a/src/duckdb/src/planner/binder/statement/bind_delete.cpp b/src/duckdb/src/planner/binder/statement/bind_delete.cpp index 6d00816d2..e38cb7669 100644 --- a/src/duckdb/src/planner/binder/statement/bind_delete.cpp +++ b/src/duckdb/src/planner/binder/statement/bind_delete.cpp @@ -64,29 +64,38 @@ BoundStatement Binder::Bind(DeleteStatement &stmt) { auto del = make_uniq(table, GenerateTableIndex()); del->bound_constraints = BindConstraints(table); - // If RETURNING is present, add all table columns to the scan so we can pass them through - // instead of having to fetch them by row ID in PhysicalDelete - // Skip this optimization if the table has generated columns, as they need to be computed - // rather than scanned - if (!stmt.returning_list.empty() && !table.HasGeneratedColumns()) { + // If RETURNING is present, add all physical table columns to the scan so we can pass them through + // instead of having to fetch them by row ID in PhysicalDelete. + // Generated columns will be computed in the RETURNING projection by the binder. + if (!stmt.returning_list.empty()) { auto &column_ids = get.GetColumnIds(); - auto column_count = table.GetColumns().LogicalColumnCount(); + auto &columns = table.GetColumns(); + auto physical_count = columns.PhysicalColumnCount(); + + // Build a map from storage index -> input chunk index + // return_columns[storage_idx] = input_chunk_idx + del->return_columns.resize(physical_count, DConstants::INVALID_INDEX); - // Build a map of which table columns are already in the scan - // and track their indices in the input chunk - del->return_columns.resize(column_count, DConstants::INVALID_INDEX); + // First, map columns already in the scan to their storage indices for (idx_t chunk_idx = 0; chunk_idx < column_ids.size(); chunk_idx++) { auto &col_id = column_ids[chunk_idx]; - if (!col_id.IsVirtualColumn() && col_id.GetPrimaryIndex() < column_count) { - del->return_columns[col_id.GetPrimaryIndex()] = chunk_idx; + if (col_id.IsVirtualColumn()) { + continue; + } + // Get the column by logical index, then get its storage index + auto logical_idx = col_id.GetPrimaryIndex(); + if (!columns.GetColumn(LogicalIndex(logical_idx)).Generated()) { + auto storage_idx = columns.GetColumn(LogicalIndex(logical_idx)).StorageOid(); + del->return_columns[storage_idx] = chunk_idx; } } - // Add any missing columns to the scan - for (idx_t col_idx = 0; col_idx < column_count; col_idx++) { - if (del->return_columns[col_idx] == DConstants::INVALID_INDEX) { - del->return_columns[col_idx] = column_ids.size(); - get.AddColumnId(col_idx); + // Add any missing physical columns to the scan + for (auto &col : columns.Physical()) { + auto storage_idx = col.StorageOid(); + if (del->return_columns[storage_idx] == DConstants::INVALID_INDEX) { + del->return_columns[storage_idx] = column_ids.size(); + get.AddColumnId(col.Logical().index); } } } diff --git a/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp b/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp index 6ff5d36f6..f2ad149a3 100644 --- a/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp +++ b/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp @@ -23,9 +23,7 @@ namespace duckdb { static bool TryLoadExtensionForReplacementScan(ClientContext &context, const string &table_name) { auto lower_name = StringUtil::Lower(table_name); - auto &dbconfig = DBConfig::GetConfig(context); - - if (!dbconfig.options.autoload_known_extensions) { + if (!Settings::Get(context)) { return false; } @@ -205,7 +203,7 @@ BoundStatement Binder::Bind(BaseTableRef &ref) { } } auto &config = DBConfig::GetConfig(context); - if (context.config.use_replacement_scans && config.options.enable_external_access && + if (context.config.use_replacement_scans && Settings::Get(config) && ExtensionHelper::IsFullPath(full_path)) { auto &fs = FileSystem::GetFileSystem(context); if (!fs.IsDisabledForPath(full_path) && fs.FileExists(full_path)) { diff --git a/src/duckdb/src/planner/binder/tableref/bind_pivot.cpp b/src/duckdb/src/planner/binder/tableref/bind_pivot.cpp index 99c131a89..50773f06a 100644 --- a/src/duckdb/src/planner/binder/tableref/bind_pivot.cpp +++ b/src/duckdb/src/planner/binder/tableref/bind_pivot.cpp @@ -581,7 +581,7 @@ unique_ptr Binder::BindPivot(PivotRef &ref, vector(context); + auto pivot_limit = Settings::Get(context); if (total_pivots >= pivot_limit) { throw BinderException(ref, "Pivot column limit of %llu exceeded. Use SET pivot_limit=X to increase the limit.", pivot_limit); @@ -603,7 +603,7 @@ unique_ptr Binder::BindPivot(PivotRef &ref, vector filtered aggregates are faster when there are FEW pivot values // -> LIST is faster when there are MANY pivot values // we switch dynamically based on the number of pivots to compute - auto pivot_filter_threshold = DBConfig::GetSetting(context); + auto pivot_filter_threshold = Settings::Get(context); if (pivot_values.size() <= pivot_filter_threshold) { // use a set of filtered aggregates pivot_node = diff --git a/src/duckdb/src/planner/binder/tableref/bind_showref.cpp b/src/duckdb/src/planner/binder/tableref/bind_showref.cpp index d2d91c3af..3b68d6bd8 100644 --- a/src/duckdb/src/planner/binder/tableref/bind_showref.cpp +++ b/src/duckdb/src/planner/binder/tableref/bind_showref.cpp @@ -156,6 +156,16 @@ BoundStatement Binder::BindShowTable(ShowRef &ref) { string sql; if (lname == "\"databases\"") { sql = PragmaShowDatabases(); + } else if (lname == "\"schemas\"") { + sql = "SELECT " + " schema.database_name, " + " schema.schema_name, " + " ((select current_schema() = schema.schema_name) " + " and (select current_database() = schema.database_name)) \"current\" " + "FROM duckdb_schemas() schema " + "JOIN duckdb_databases dbs USING (database_oid) " + "WHERE dbs.internal = false " + "ORDER BY all;"; } else if (lname == "\"tables\"") { sql = PragmaShowTables(); } else if (ref.show_type == ShowType::SHOW_FROM) { diff --git a/src/duckdb/src/planner/collation_binding.cpp b/src/duckdb/src/planner/collation_binding.cpp index dd371bbc4..ea70f0194 100644 --- a/src/duckdb/src/planner/collation_binding.cpp +++ b/src/duckdb/src/planner/collation_binding.cpp @@ -20,7 +20,7 @@ bool PushVarcharCollation(ClientContext &context, unique_ptr &source auto str_collation = StringType::GetCollation(sql_type); string collation; if (str_collation.empty()) { - collation = DBConfig::GetSetting(context); + collation = Settings::Get(context); } else { collation = str_collation; } diff --git a/src/duckdb/src/planner/expression/bound_function_expression.cpp b/src/duckdb/src/planner/expression/bound_function_expression.cpp index dc6332531..1871951c4 100644 --- a/src/duckdb/src/planner/expression/bound_function_expression.cpp +++ b/src/duckdb/src/planner/expression/bound_function_expression.cpp @@ -31,10 +31,10 @@ bool BoundFunctionExpression::IsFoldable() const { if (function.HasBindLambdaCallback()) { // This is a lambda function D_ASSERT(bind_info); - auto &lambda_bind_data = bind_info->Cast(); - if (lambda_bind_data.lambda_expr) { - auto &expr = *lambda_bind_data.lambda_expr; - if (expr.IsVolatile()) { + auto &lambda_bind_data = bind_info->Cast(); + auto &lambda_expr = lambda_bind_data.GetLambdaExpression(); + if (lambda_expr) { + if (lambda_expr->IsVolatile()) { return false; } } diff --git a/src/duckdb/src/planner/expression_binder.cpp b/src/duckdb/src/planner/expression_binder.cpp index de1019753..86b131ed4 100644 --- a/src/duckdb/src/planner/expression_binder.cpp +++ b/src/duckdb/src/planner/expression_binder.cpp @@ -7,6 +7,7 @@ #include "duckdb/planner/expression_iterator.hpp" #include "duckdb/common/operator/cast_operators.hpp" #include "duckdb/main/client_config.hpp" +#include "duckdb/main/settings.hpp" #include "duckdb/common/string_util.hpp" namespace duckdb { @@ -47,11 +48,11 @@ void ExpressionBinder::InitializeStackCheck() { StackChecker ExpressionBinder::StackCheck(const ParsedExpression &expr, idx_t extra_stack) { D_ASSERT(stack_depth != DConstants::INVALID_INDEX); - auto &options = ClientConfig::GetConfig(context); - if (stack_depth + extra_stack >= options.max_expression_depth) { + auto max_expression_depth = Settings::Get(context); + if (stack_depth + extra_stack >= max_expression_depth) { throw BinderException("Max expression depth limit of %lld exceeded. Use \"SET max_expression_depth TO x\" to " "increase the maximum expression depth.", - options.max_expression_depth); + max_expression_depth); } return StackChecker(*this, extra_stack); } diff --git a/src/duckdb/src/planner/expression_binder/having_binder.cpp b/src/duckdb/src/planner/expression_binder/having_binder.cpp index ab0f11af5..c6a7ad3af 100644 --- a/src/duckdb/src/planner/expression_binder/having_binder.cpp +++ b/src/duckdb/src/planner/expression_binder/having_binder.cpp @@ -15,6 +15,10 @@ HavingBinder::HavingBinder(Binder &binder, ClientContext &context, BoundSelectNo target_type = LogicalType(LogicalTypeId::BOOLEAN); } +bool HavingBinder::DoesColumnAliasExist(const ColumnRefExpression &colref) { + return column_alias_binder.DoesColumnAliasExist(colref); +} + BindResult HavingBinder::BindLambdaReference(LambdaRefExpression &expr, idx_t depth) { D_ASSERT(lambda_bindings && expr.lambda_idx < lambda_bindings->size()); auto &lambda_ref = expr.Cast(); diff --git a/src/duckdb/src/planner/expression_binder/order_binder.cpp b/src/duckdb/src/planner/expression_binder/order_binder.cpp index 3923129fb..28ff24ca2 100644 --- a/src/duckdb/src/planner/expression_binder/order_binder.cpp +++ b/src/duckdb/src/planner/expression_binder/order_binder.cpp @@ -61,7 +61,7 @@ optional_idx OrderBinder::TryGetProjectionReference(ParsedExpression &expr) cons // ORDER BY has no effect // this is disabled by default (matching Postgres) - but we can control this with a setting auto order_by_non_integer_literal = - DBConfig::GetSetting(binders[0].get().context); + Settings::Get(binders[0].get().context); if (!order_by_non_integer_literal) { throw BinderException(expr, "%s non-integer literal has no effect.\n* SET " diff --git a/src/duckdb/src/planner/planner.cpp b/src/duckdb/src/planner/planner.cpp index e6794dcfc..0ec34789c 100644 --- a/src/duckdb/src/planner/planner.cpp +++ b/src/duckdb/src/planner/planner.cpp @@ -9,6 +9,7 @@ #include "duckdb/main/database.hpp" #include "duckdb/main/prepared_statement_data.hpp" #include "duckdb/main/query_profiler.hpp" +#include "duckdb/main/settings.hpp" #include "duckdb/planner/binder.hpp" #include "duckdb/planner/expression/bound_parameter_expression.hpp" #include "duckdb/transaction/meta_transaction.hpp" @@ -77,7 +78,7 @@ void Planner::CreatePlan(SQLStatement &statement) { } } if (this->plan) { - auto max_tree_depth = ClientConfig::GetConfig(context).max_expression_depth; + auto max_tree_depth = Settings::Get(context); CheckTreeDepth(*plan, max_tree_depth); this->plan = FlattenDependentJoins::DecorrelateIndependent(*this->binder, std::move(this->plan)); diff --git a/src/duckdb/src/storage/caching_file_system.cpp b/src/duckdb/src/storage/caching_file_system.cpp index 1d979377e..2d7a0aa90 100644 --- a/src/duckdb/src/storage/caching_file_system.cpp +++ b/src/duckdb/src/storage/caching_file_system.cpp @@ -49,7 +49,7 @@ bool ShouldExpandToFillGap(const idx_t current_length, const idx_t added_length) } // namespace CachingFileSystem::CachingFileSystem(FileSystem &file_system_p, DatabaseInstance &db_p) - : file_system(file_system_p), external_file_cache(ExternalFileCache::Get(db_p)), db(db_p) { + : file_system(file_system_p), db(db_p), external_file_cache(ExternalFileCache::Get(db)) { } CachingFileSystem::~CachingFileSystem() { diff --git a/src/duckdb/src/storage/caching_file_system_wrapper.cpp b/src/duckdb/src/storage/caching_file_system_wrapper.cpp index a6c8278b4..dd29b7e39 100644 --- a/src/duckdb/src/storage/caching_file_system_wrapper.cpp +++ b/src/duckdb/src/storage/caching_file_system_wrapper.cpp @@ -312,10 +312,6 @@ void CachingFileSystemWrapper::RegisterSubSystem(FileCompressionType compression underlying_file_system.RegisterSubSystem(compression_type, std::move(fs)); } -void CachingFileSystemWrapper::UnregisterSubSystem(const string &name) { - underlying_file_system.UnregisterSubSystem(name); -} - unique_ptr CachingFileSystemWrapper::ExtractSubSystem(const string &name) { return underlying_file_system.ExtractSubSystem(name); } diff --git a/src/duckdb/src/storage/checkpoint/table_data_writer.cpp b/src/duckdb/src/storage/checkpoint/table_data_writer.cpp index b6b18ead7..a2299437e 100644 --- a/src/duckdb/src/storage/checkpoint/table_data_writer.cpp +++ b/src/duckdb/src/storage/checkpoint/table_data_writer.cpp @@ -78,7 +78,7 @@ void SingleFileTableDataWriter::FinalizeTable(const TableStatistics &global_stat RowGroupCollection &collection, Serializer &serializer) { MetaBlockPointer pointer; idx_t total_rows; - auto debug_verify_blocks = DBConfig::GetSetting(GetDatabase()); + auto debug_verify_blocks = Settings::Get(GetDatabase()); if (!existing_pointer.IsValid()) { // write the metadata // store the current position in the metadata writer diff --git a/src/duckdb/src/storage/checkpoint_manager.cpp b/src/duckdb/src/storage/checkpoint_manager.cpp index c1d7a721e..316c50cf9 100644 --- a/src/duckdb/src/storage/checkpoint_manager.cpp +++ b/src/duckdb/src/storage/checkpoint_manager.cpp @@ -9,13 +9,13 @@ #include "duckdb/catalog/catalog_entry/type_catalog_entry.hpp" #include "duckdb/catalog/catalog_entry/view_catalog_entry.hpp" #include "duckdb/catalog/duck_catalog.hpp" +#include "duckdb/common/enums/checkpoint_abort.hpp" #include "duckdb/common/serializer/binary_deserializer.hpp" #include "duckdb/common/serializer/binary_serializer.hpp" #include "duckdb/execution/index/art/art.hpp" #include "duckdb/execution/index/unbound_index.hpp" #include "duckdb/main/attached_database.hpp" #include "duckdb/main/client_context.hpp" -#include "duckdb/main/config.hpp" #include "duckdb/main/connection.hpp" #include "duckdb/transaction/duck_transaction_manager.hpp" #include "duckdb/parser/parsed_data/create_schema_info.hpp" @@ -158,7 +158,7 @@ void SingleFileCheckpointWriter::CreateCheckpoint() { ActiveCheckpointWrapper active_checkpoint(transaction_manager); auto has_wal = storage_manager.WALStartCheckpoint(meta_block, options); - auto checkpoint_sleep_ms = DBConfig::GetSetting(db.GetDatabase()); + auto checkpoint_sleep_ms = Settings::Get(db.GetDatabase()); if (checkpoint_sleep_ms > 0) { ThreadUtil::SleepMs(checkpoint_sleep_ms); } @@ -206,7 +206,7 @@ void SingleFileCheckpointWriter::CreateCheckpoint() { metadata_writer->Flush(); table_metadata_writer->Flush(); - auto debug_checkpoint_abort = DBConfig::GetSetting(db.GetDatabase()); + auto debug_checkpoint_abort = Settings::Get(db.GetDatabase()); if (debug_checkpoint_abort == CheckpointAbort::DEBUG_ABORT_BEFORE_HEADER) { throw FatalException("Checkpoint aborted before header write because of PRAGMA checkpoint_abort flag"); } @@ -218,7 +218,7 @@ void SingleFileCheckpointWriter::CreateCheckpoint() { header.vector_size = STANDARD_VECTOR_SIZE; block_manager.WriteHeader(context, header); - auto debug_verify_blocks = DBConfig::GetSetting(db.GetDatabase()); + auto debug_verify_blocks = Settings::Get(db.GetDatabase()); if (debug_verify_blocks) { // extend verify_block_usage_count auto metadata_info = storage_manager.GetMetadataInfo(); diff --git a/src/duckdb/src/storage/compression/bitpacking.cpp b/src/duckdb/src/storage/compression/bitpacking.cpp index a5f3ccc35..156c9db35 100644 --- a/src/duckdb/src/storage/compression/bitpacking.cpp +++ b/src/duckdb/src/storage/compression/bitpacking.cpp @@ -9,6 +9,7 @@ #include "duckdb/function/compression/compression.hpp" #include "duckdb/function/compression_function.hpp" #include "duckdb/main/config.hpp" +#include "duckdb/main/settings.hpp" #include "duckdb/storage/buffer_manager.hpp" #include "duckdb/storage/compression/bitpacking.hpp" #include "duckdb/storage/table/column_data_checkpointer.hpp" @@ -22,40 +23,6 @@ namespace duckdb { constexpr const idx_t BitpackingPrimitives::BITPACKING_ALGORITHM_GROUP_SIZE; static constexpr const idx_t BITPACKING_METADATA_GROUP_SIZE = STANDARD_VECTOR_SIZE > 512 ? STANDARD_VECTOR_SIZE : 2048; -BitpackingMode BitpackingModeFromString(const string &str) { - auto mode = StringUtil::Lower(str); - if (mode == "auto" || mode == "none") { - return BitpackingMode::AUTO; - } else if (mode == "constant") { - return BitpackingMode::CONSTANT; - } else if (mode == "constant_delta") { - return BitpackingMode::CONSTANT_DELTA; - } else if (mode == "delta_for") { - return BitpackingMode::DELTA_FOR; - } else if (mode == "for") { - return BitpackingMode::FOR; - } else { - return BitpackingMode::INVALID; - } -} - -string BitpackingModeToString(const BitpackingMode &mode) { - switch (mode) { - case BitpackingMode::AUTO: - return "auto"; - case BitpackingMode::CONSTANT: - return "constant"; - case BitpackingMode::CONSTANT_DELTA: - return "constant_delta"; - case BitpackingMode::DELTA_FOR: - return "delta_for"; - case BitpackingMode::FOR: - return "for"; - default: - throw NotImplementedException("Unknown bitpacking mode: " + to_string((uint8_t)mode) + "\n"); - } -} - typedef struct { BitpackingMode mode; uint32_t offset; @@ -338,11 +305,9 @@ struct BitpackingAnalyzeState : public AnalyzeState { template unique_ptr BitpackingInitAnalyze(ColumnData &col_data, PhysicalType type) { - auto &config = DBConfig::GetConfig(col_data.GetDatabase()); - CompressionInfo info(col_data.GetBlockManager()); auto state = make_uniq>(info); - state->state.mode = config.options.force_bitpacking_mode; + state->state.mode = Settings::Get(col_data.GetDatabase()); return std::move(state); } @@ -393,9 +358,7 @@ struct BitpackingCompressionState : public CompressionState { CreateEmptySegment(); state.data_ptr = reinterpret_cast(this); - - auto &config = DBConfig::GetConfig(checkpoint_data.GetDatabase()); - state.mode = config.options.force_bitpacking_mode; + state.mode = Settings::Get(checkpoint_data.GetDatabase()); } ColumnDataCheckpointData &checkpoint_data; diff --git a/src/duckdb/src/storage/compression/fsst.cpp b/src/duckdb/src/storage/compression/fsst.cpp index faf9c5f93..eba399754 100644 --- a/src/duckdb/src/storage/compression/fsst.cpp +++ b/src/duckdb/src/storage/compression/fsst.cpp @@ -649,7 +649,7 @@ void FSSTStorage::StringScanPartial(ColumnSegment &segment, ColumnScanState &sta bool enable_fsst_vectors; if (ALLOW_FSST_VECTORS) { - enable_fsst_vectors = DBConfig::GetSetting(segment.db); + enable_fsst_vectors = Settings::Get(segment.db); } else { enable_fsst_vectors = false; } diff --git a/src/duckdb/src/storage/compression/zstd.cpp b/src/duckdb/src/storage/compression/zstd.cpp index d727cf1ea..32309bcbd 100644 --- a/src/duckdb/src/storage/compression/zstd.cpp +++ b/src/duckdb/src/storage/compression/zstd.cpp @@ -3,6 +3,7 @@ #include "duckdb/storage/table/column_data_checkpointer.hpp" #include "duckdb/storage/block_manager.hpp" #include "duckdb/main/config.hpp" +#include "duckdb/main/settings.hpp" #include "duckdb/common/constants.hpp" #include "duckdb/common/allocator.hpp" #include "duckdb/common/serializer/deserializer.hpp" @@ -203,7 +204,7 @@ idx_t ZSTDStorage::StringFinalAnalyze(AnalyzeState &state_p) { double penalty; idx_t average_length = state.total_size / state.count; - auto threshold = state.config.options.zstd_min_string_length; + auto threshold = Settings::Get(state.config); if (average_length >= threshold) { penalty = 1.0; } else { diff --git a/src/duckdb/src/storage/external_file_cache_util.cpp b/src/duckdb/src/storage/external_file_cache_util.cpp index 08da502f9..deae15af2 100644 --- a/src/duckdb/src/storage/external_file_cache_util.cpp +++ b/src/duckdb/src/storage/external_file_cache_util.cpp @@ -34,12 +34,11 @@ CacheValidationMode ExternalFileCacheUtil::GetCacheValidationMode(const OpenFile // If client context is available, check client-local settings first, then fall back to database config. if (client_context) { - return DBConfig::GetSetting(*client_context); + return Settings::Get(*client_context); } // No client context, fall back to database config. - auto &config = DBConfig::GetConfig(db); - return config.options.validate_external_file_cache; + return Settings::Get(db); } } // namespace duckdb diff --git a/src/duckdb/src/storage/optimistic_data_writer.cpp b/src/duckdb/src/storage/optimistic_data_writer.cpp index 78976ac1c..186c6013d 100644 --- a/src/duckdb/src/storage/optimistic_data_writer.cpp +++ b/src/duckdb/src/storage/optimistic_data_writer.cpp @@ -65,7 +65,7 @@ void OptimisticDataWriter::WriteNewRowGroup(OptimisticWriteCollection &row_group row_groups.complete_row_groups++; auto unflushed_row_groups = row_groups.complete_row_groups - row_groups.last_flushed; - if (unflushed_row_groups >= DBConfig::GetSetting(context)) { + if (unflushed_row_groups >= Settings::Get(context)) { // we have crossed our flush threshold - flush any unwritten row groups to disk vector> to_flush; vector segment_indexes; diff --git a/src/duckdb/src/storage/serialization/serialize_create_info.cpp b/src/duckdb/src/storage/serialization/serialize_create_info.cpp index 4e0d48806..8469f606c 100644 --- a/src/duckdb/src/storage/serialization/serialize_create_info.cpp +++ b/src/duckdb/src/storage/serialization/serialize_create_info.cpp @@ -168,6 +168,9 @@ void CreateTableInfo::Serialize(Serializer &serializer) const { serializer.WriteProperty(201, "columns", columns); serializer.WritePropertyWithDefault>>(202, "constraints", constraints); serializer.WritePropertyWithDefault>(203, "query", query); + serializer.WritePropertyWithDefault>>(204, "partition_keys", partition_keys); + serializer.WritePropertyWithDefault>>(205, "sort_keys", sort_keys); + serializer.WritePropertyWithDefault>>(206, "options", options); } unique_ptr CreateTableInfo::Deserialize(Deserializer &deserializer) { @@ -176,6 +179,9 @@ unique_ptr CreateTableInfo::Deserialize(Deserializer &deserializer) deserializer.ReadProperty(201, "columns", result->columns); deserializer.ReadPropertyWithDefault>>(202, "constraints", result->constraints); deserializer.ReadPropertyWithDefault>(203, "query", result->query); + deserializer.ReadPropertyWithDefault>>(204, "partition_keys", result->partition_keys); + deserializer.ReadPropertyWithDefault>>(205, "sort_keys", result->sort_keys); + deserializer.ReadPropertyWithDefault>>(206, "options", result->options); return std::move(result); } diff --git a/src/duckdb/src/storage/serialization/serialize_nodes.cpp b/src/duckdb/src/storage/serialization/serialize_nodes.cpp index 55a64a14f..06dfe3eaf 100644 --- a/src/duckdb/src/storage/serialization/serialize_nodes.cpp +++ b/src/duckdb/src/storage/serialization/serialize_nodes.cpp @@ -220,6 +220,8 @@ void ColumnIndex::Serialize(Serializer &serializer) const { serializer.WritePropertyWithDefault>(2, "child_indexes", child_indexes); serializer.WritePropertyWithDefault(3, "index_type", index_type, ColumnIndexType::FULL_READ); serializer.WritePropertyWithDefault(4, "type", type, LogicalType::INVALID); + serializer.WritePropertyWithDefault(5, "field", field, ""); + serializer.WritePropertyWithDefault(6, "has_index", has_index, true); } ColumnIndex ColumnIndex::Deserialize(Deserializer &deserializer) { @@ -228,6 +230,8 @@ ColumnIndex ColumnIndex::Deserialize(Deserializer &deserializer) { deserializer.ReadPropertyWithDefault>(2, "child_indexes", result.child_indexes); deserializer.ReadPropertyWithExplicitDefault(3, "index_type", result.index_type, ColumnIndexType::FULL_READ); deserializer.ReadPropertyWithExplicitDefault(4, "type", result.type, LogicalType::INVALID); + deserializer.ReadPropertyWithExplicitDefault(5, "field", result.field, ""); + deserializer.ReadPropertyWithExplicitDefault(6, "has_index", result.has_index, true); return result; } diff --git a/src/duckdb/src/storage/single_file_block_manager.cpp b/src/duckdb/src/storage/single_file_block_manager.cpp index aeba13f51..0244c7d22 100644 --- a/src/duckdb/src/storage/single_file_block_manager.cpp +++ b/src/duckdb/src/storage/single_file_block_manager.cpp @@ -8,6 +8,8 @@ #include "duckdb/common/encryption_state.hpp" #include "duckdb/common/exception.hpp" #include "duckdb/common/serializer/memory_stream.hpp" +#include "duckdb/common/enums/checkpoint_abort.hpp" +#include "duckdb/common/enums/storage_block_prefetch.hpp" #include "duckdb/main/attached_database.hpp" #include "duckdb/main/config.hpp" #include "duckdb/main/database.hpp" @@ -26,6 +28,7 @@ namespace duckdb { const char MainHeader::MAGIC_BYTES[] = "DUCK"; const char MainHeader::CANARY[] = "DUCKKEY"; +static constexpr idx_t ENCRYPTION_METADATA_LEN = 8; void SerializeVersionNumber(WriteStream &ser, const string &version_str) { data_t version[MainHeader::MAX_VERSION_SIZE]; @@ -53,6 +56,30 @@ void SerializeEncryptionMetadata(WriteStream &ser, data_ptr_t metadata_p, const ser.WriteData(metadata, MainHeader::ENCRYPTION_METADATA_LEN); } +void SerializeIV(WriteStream &ser, data_ptr_t metadata_p, const bool encrypted) { + // Zero-initialize. + data_t iv[MainHeader::AES_IV_LEN]; + memset(iv, 0, MainHeader::AES_IV_LEN); + + // Write metadata, if encrypted. + if (encrypted) { + memcpy(iv, metadata_p, MainHeader::AES_IV_LEN); + } + ser.WriteData(iv, MainHeader::AES_IV_LEN); +} + +void SerializeTag(WriteStream &ser, data_ptr_t metadata_p, const bool encrypted) { + // Zero-initialize. + data_t tag[MainHeader::AES_TAG_LEN]; + memset(tag, 0, MainHeader::AES_TAG_LEN); + + // Write metadata, if encrypted. + if (encrypted) { + memcpy(tag, metadata_p, MainHeader::AES_TAG_LEN); + } + ser.WriteData(tag, MainHeader::AES_TAG_LEN); +} + void DeserializeVersionNumber(ReadStream &stream, data_t *dest) { memset(dest, 0, MainHeader::MAX_VERSION_SIZE); stream.ReadData(dest, MainHeader::MAX_VERSION_SIZE); @@ -72,16 +99,34 @@ void GenerateDBIdentifier(uint8_t *db_identifier) { void EncryptCanary(MainHeader &main_header, const shared_ptr &encryption_state, const_data_ptr_t derived_key) { uint8_t canary_buffer[MainHeader::CANARY_BYTE_SIZE]; + memset(canary_buffer, 0, MainHeader::CANARY_BYTE_SIZE); - // we zero-out the iv and the (not yet) encrypted canary uint8_t iv[MainHeader::AES_IV_LEN]; - memset(iv, 0, MainHeader::AES_IV_LEN); - memset(canary_buffer, 0, MainHeader::CANARY_BYTE_SIZE); - encryption_state->InitializeEncryption(iv, MainHeader::AES_IV_LEN, derived_key, - MainHeader::DEFAULT_ENCRYPTION_KEY_LENGTH); - encryption_state->Process(reinterpret_cast(MainHeader::CANARY), MainHeader::CANARY_BYTE_SIZE, - canary_buffer, MainHeader::CANARY_BYTE_SIZE); + switch (main_header.GetEncryptionVersion()) { + case 0: + memset(iv, 0, MainHeader::AES_IV_LEN); + encryption_state->InitializeEncryption(iv, MainHeader::AES_IV_LEN, derived_key, + MainHeader::DEFAULT_ENCRYPTION_KEY_LENGTH); + encryption_state->Process(reinterpret_cast(MainHeader::CANARY), MainHeader::CANARY_BYTE_SIZE, + canary_buffer, MainHeader::CANARY_BYTE_SIZE); + break; + + case 1: + uint8_t tag[MainHeader::AES_TAG_LEN]; + encryption_state->GenerateRandomData(iv, MainHeader::AES_IV_LEN); + main_header.SetCanaryIV(iv); + encryption_state->InitializeEncryption(iv, MainHeader::AES_IV_LEN, derived_key, + MainHeader::DEFAULT_ENCRYPTION_KEY_LENGTH); + encryption_state->Process(reinterpret_cast(MainHeader::CANARY), MainHeader::CANARY_BYTE_SIZE, + canary_buffer, MainHeader::CANARY_BYTE_SIZE); + encryption_state->Finalize(canary_buffer, MainHeader::CANARY_BYTE_SIZE, tag, MainHeader::AES_TAG_LEN); + main_header.SetCanaryTag(tag); + break; + + default: + throw InvalidInputException("No valid encryption version found!"); + } main_header.SetEncryptedCanary(canary_buffer); } @@ -96,11 +141,36 @@ bool DecryptCanary(MainHeader &main_header, const shared_ptr &e data_t decrypted_canary[MainHeader::CANARY_BYTE_SIZE]; memset(decrypted_canary, 0, MainHeader::CANARY_BYTE_SIZE); - //! Decrypt the canary - encryption_state->InitializeDecryption(iv, MainHeader::AES_IV_LEN, derived_key, - MainHeader::DEFAULT_ENCRYPTION_KEY_LENGTH); - encryption_state->Process(main_header.GetEncryptedCanary(), MainHeader::CANARY_BYTE_SIZE, decrypted_canary, - MainHeader::CANARY_BYTE_SIZE); + switch (main_header.GetEncryptionVersion()) { + case 0: + // zero-out the IV + memset(iv, 0, MainHeader::AES_IV_LEN); + //! Decrypt the canary + encryption_state->InitializeDecryption(iv, MainHeader::AES_IV_LEN, derived_key, + MainHeader::DEFAULT_ENCRYPTION_KEY_LENGTH); + encryption_state->Process(main_header.GetEncryptedCanary(), MainHeader::CANARY_BYTE_SIZE, decrypted_canary, + MainHeader::CANARY_BYTE_SIZE); + break; + case 1: + uint8_t tag[MainHeader::AES_TAG_LEN]; + // get the IV and the Tag + memcpy(iv, main_header.GetIV(), MainHeader::AES_IV_LEN); + memcpy(tag, main_header.GetTag(), MainHeader::AES_TAG_LEN); + + //! Decrypt the canary + encryption_state->InitializeDecryption(iv, MainHeader::AES_IV_LEN, derived_key, + MainHeader::DEFAULT_ENCRYPTION_KEY_LENGTH); + encryption_state->Process(main_header.GetEncryptedCanary(), MainHeader::CANARY_BYTE_SIZE, decrypted_canary, + MainHeader::CANARY_BYTE_SIZE); + try { + encryption_state->Finalize(decrypted_canary, MainHeader::CANARY_BYTE_SIZE, tag, MainHeader::AES_TAG_LEN); + } catch (const std::exception &e) { + throw InvalidInputException("Wrong encryption key used to open the database file"); + } + break; + default: + throw InvalidInputException("No valid encryption version found!"); + } //! compare if the decrypted canary is correct if (memcmp(decrypted_canary, MainHeader::CANARY, MainHeader::CANARY_BYTE_SIZE) != 0) { @@ -125,6 +195,8 @@ void MainHeader::Write(WriteStream &ser) { SerializeEncryptionMetadata(ser, encryption_metadata, encryption_enabled); SerializeDBIdentifier(ser, db_identifier); SerializeEncryptionMetadata(ser, encrypted_canary, encryption_enabled); + SerializeIV(ser, canary_iv, encryption_enabled); + SerializeTag(ser, canary_tag, encryption_enabled); } void MainHeader::CheckMagicBytes(QueryContext context, FileHandle &handle) { @@ -175,7 +247,6 @@ MainHeader MainHeader::Read(ReadStream &source) { for (idx_t i = 0; i < FLAG_COUNT; i++) { header.flags[i] = source.Read(); } - DeserializeVersionNumber(source, header.library_git_desc); DeserializeVersionNumber(source, header.library_git_hash); @@ -183,6 +254,8 @@ MainHeader MainHeader::Read(ReadStream &source) { DeserializeEncryptionData(source, header.encryption_metadata, MainHeader::ENCRYPTION_METADATA_LEN); DeserializeEncryptionData(source, header.db_identifier, MainHeader::DB_IDENTIFIER_LEN); DeserializeEncryptionData(source, header.encrypted_canary, MainHeader::CANARY_BYTE_SIZE); + DeserializeEncryptionData(source, header.canary_iv, MainHeader::AES_IV_LEN); + DeserializeEncryptionData(source, header.canary_tag, MainHeader::AES_TAG_LEN); return header; } @@ -301,8 +374,15 @@ MainHeader ConstructMainHeader(idx_t version_number) { void SingleFileBlockManager::StoreEncryptedCanary(AttachedDatabase &db, MainHeader &main_header, const string &key_id) { const_data_ptr_t key = EncryptionEngine::GetKeyFromCache(db.GetDatabase(), key_id); // Encrypt canary with the derived key - auto encryption_state = db.GetDatabase().GetEncryptionUtil()->CreateEncryptionState( - main_header.GetEncryptionCipher(), MainHeader::DEFAULT_ENCRYPTION_KEY_LENGTH); + shared_ptr encryption_state; + if (main_header.GetEncryptionVersion() > 0) { + // From Encryption Version 1+, always encrypt canary with GCM + encryption_state = db.GetDatabase().GetEncryptionUtil()->CreateEncryptionState( + EncryptionTypes::GCM, MainHeader::DEFAULT_ENCRYPTION_KEY_LENGTH); + } else { + encryption_state = db.GetDatabase().GetEncryptionUtil()->CreateEncryptionState( + main_header.GetEncryptionCipher(), MainHeader::DEFAULT_ENCRYPTION_KEY_LENGTH); + } EncryptCanary(main_header, encryption_state, key); } @@ -310,26 +390,26 @@ void SingleFileBlockManager::StoreDBIdentifier(MainHeader &main_header, data_ptr main_header.SetDBIdentifier(db_identifier); } +template +void SingleFileBlockManager::WriteEncryptionData(MemoryStream &stream, const T &val) { + stream.WriteData(reinterpret_cast(&val), sizeof(val)); +} + void SingleFileBlockManager::StoreEncryptionMetadata(MainHeader &main_header) const { // The first byte is the key derivation function (kdf). // The second byte is for the usage of AAD. // The third byte is for the cipher. // The subsequent byte is empty. // The last 4 bytes are the key length. + auto metadata_stream = make_uniq(ENCRYPTION_METADATA_LEN); - uint8_t metadata[MainHeader::ENCRYPTION_METADATA_LEN]; - memset(metadata, 0, MainHeader::ENCRYPTION_METADATA_LEN); - data_ptr_t offset = metadata; - - Store(options.encryption_options.kdf, offset); - offset++; - Store(options.encryption_options.additional_authenticated_data, offset); - offset++; - Store(db.GetStorageManager().GetCipher(), offset); - offset += 2; - Store(options.encryption_options.key_length, offset); + WriteEncryptionData(*metadata_stream, options.encryption_options.kdf); + WriteEncryptionData(*metadata_stream, options.encryption_options.additional_authenticated_data); + WriteEncryptionData(*metadata_stream, db.GetStorageManager().GetCipher()); + WriteEncryptionData(*metadata_stream, options.encryption_options.encryption_version); + WriteEncryptionData(*metadata_stream, options.encryption_options.key_length); - main_header.SetEncryptionMetadata(metadata); + main_header.SetEncryptionMetadata(metadata_stream->GetData()); } void SingleFileBlockManager::CheckAndAddEncryptionKey(MainHeader &main_header, string &user_key) { @@ -343,10 +423,18 @@ void SingleFileBlockManager::CheckAndAddEncryptionKey(MainHeader &main_header, s data_t derived_key[MainHeader::DEFAULT_ENCRYPTION_KEY_LENGTH]; EncryptionKeyManager::DeriveKey(user_key, db_identifier, derived_key); - auto encryption_state = db.GetDatabase().GetEncryptionUtil()->CreateEncryptionState( - main_header.GetEncryptionCipher(), MainHeader::DEFAULT_ENCRYPTION_KEY_LENGTH); + shared_ptr encryption_state; + if (main_header.GetEncryptionVersion() > 0) { + // From Encryption Version 1+, always encrypt canary with GCM + encryption_state = db.GetDatabase().GetEncryptionUtil()->CreateEncryptionState( + EncryptionTypes::GCM, MainHeader::DEFAULT_ENCRYPTION_KEY_LENGTH); + } else { + encryption_state = db.GetDatabase().GetEncryptionUtil()->CreateEncryptionState( + main_header.GetEncryptionCipher(), MainHeader::DEFAULT_ENCRYPTION_KEY_LENGTH); + } + if (!DecryptCanary(main_header, encryption_state, derived_key)) { - throw IOException("Wrong encryption key used to open the database file"); + throw InvalidInputException("Wrong encryption key used to open the database file"); } options.encryption_options.derived_key_id = EncryptionEngine::AddKeyToCache(db.GetDatabase(), derived_key); @@ -409,6 +497,12 @@ void SingleFileBlockManager::CreateNewDatabase(QueryContext context) { // Set the encrypted DB bit to 1. main_header.SetEncrypted(); + if (options.encryption_options.encryption_version == EncryptionTypes::NONE) { + throw InvalidConfigurationException("No Encryption type set"); + } + + main_header.SetEncryptionVersion(options.encryption_options.encryption_version); + // The derived key is wiped in AddKeyToCache. options.encryption_options.derived_key_id = EncryptionEngine::AddKeyToCache(db.GetDatabase(), derived_key); auto &catalog = db.GetCatalog().Cast(); @@ -490,6 +584,9 @@ void SingleFileBlockManager::LoadExistingDatabase(QueryContext context) { MainHeader main_header = DeserializeMainHeader(header_buffer.buffer - delta); memcpy(options.db_identifier, main_header.GetDBIdentifier(), MainHeader::DB_IDENTIFIER_LEN); + // encryption version can be overridden by the real encryption version + options.encryption_options.encryption_version = main_header.GetEncryptionVersion(); + if (!main_header.IsEncrypted() && options.encryption_options.encryption_enabled) { throw CatalogException("A key is explicitly specified, but database \"%s\" is not encrypted", path); // database is not encrypted, but is tried to be opened with a key @@ -961,7 +1058,7 @@ bool SingleFileBlockManager::IsRemote() { } bool SingleFileBlockManager::Prefetch() { - switch (DBConfig::GetSetting(db.GetDatabase())) { + switch (Settings::Get(db.GetDatabase())) { case StorageBlockPrefetch::NEVER: return false; case StorageBlockPrefetch::DEBUG_FORCE_ALWAYS: @@ -1190,7 +1287,7 @@ void SingleFileBlockManager::WriteHeader(QueryContext context, DatabaseHeader he header.serialization_compatibility = options.storage_version.GetIndex(); - auto debug_checkpoint_abort = DBConfig::GetSetting(db.GetDatabase()); + auto debug_checkpoint_abort = Settings::Get(db.GetDatabase()); if (debug_checkpoint_abort == CheckpointAbort::DEBUG_ABORT_AFTER_FREE_LIST_WRITE) { throw FatalException("Checkpoint aborted after free list write because of PRAGMA checkpoint_abort flag"); } diff --git a/src/duckdb/src/storage/standard_buffer_manager.cpp b/src/duckdb/src/storage/standard_buffer_manager.cpp index a90ba37f0..691f5912c 100644 --- a/src/duckdb/src/storage/standard_buffer_manager.cpp +++ b/src/duckdb/src/storage/standard_buffer_manager.cpp @@ -2,6 +2,7 @@ #include "duckdb/common/allocator.hpp" #include "duckdb/common/enums/memory_tag.hpp" +#include "duckdb/common/enums/storage_block_prefetch.hpp" #include "duckdb/common/exception.hpp" #include "duckdb/common/set.hpp" #include "duckdb/main/attached_database.hpp" @@ -247,7 +248,7 @@ void StandardBufferManager::BatchRead(vector> &handles, auto &block_manager = handles[0]->block_manager; idx_t block_count = NumericCast(last_block - first_block + 1); if (block_count == 1) { - if (DBConfig::GetSetting(db) != StorageBlockPrefetch::DEBUG_FORCE_ALWAYS) { + if (Settings::Get(db) != StorageBlockPrefetch::DEBUG_FORCE_ALWAYS) { // prefetching with block_count == 1 has no performance impact since we can't batch reads // skip the prefetch in this case // we do it anyway if alternative_verify is on for extra testing @@ -494,6 +495,10 @@ void StandardBufferManager::RequireTemporaryDirectory() { } } +bool StandardBufferManager::EncryptTemporaryFiles() { + return Settings::Get(db); +} + void StandardBufferManager::WriteTemporaryBuffer(MemoryTag tag, block_id_t block_id, FileBuffer &buffer) { // WriteTemporaryBuffer assumes that we never write a buffer below DEFAULT_BLOCK_ALLOC_SIZE. RequireTemporaryDirectory(); @@ -510,7 +515,7 @@ void StandardBufferManager::WriteTemporaryBuffer(MemoryTag tag, block_id_t block auto path = GetTemporaryPath(block_id); idx_t header_size = sizeof(idx_t) * 2; - if (db.config.options.temp_file_encryption) { + if (EncryptTemporaryFiles()) { header_size += DEFAULT_ENCRYPTED_BUFFER_HEADER_SIZE; } @@ -527,7 +532,7 @@ void StandardBufferManager::WriteTemporaryBuffer(MemoryTag tag, block_id_t block idx_t offset = sizeof(idx_t) * 2; - if (db.config.options.temp_file_encryption) { + if (EncryptTemporaryFiles()) { uint8_t encryption_metadata[DEFAULT_ENCRYPTED_BUFFER_HEADER_SIZE]; EncryptionEngine::EncryptTemporaryBuffer(db, buffer.InternalBuffer(), buffer.AllocSize(), encryption_metadata); //! Write the nonce (and tag for GCM). @@ -565,7 +570,7 @@ unique_ptr StandardBufferManager::ReadTemporaryBuffer(QueryContext c // Allocate a buffer of the file's size and read the data into that buffer. auto buffer = ConstructManagedBuffer(block_size, block_header_size, std::move(reusable_buffer)); - if (db.config.options.temp_file_encryption) { + if (EncryptTemporaryFiles()) { // encrypted //! Read nonce and tag from file. uint8_t encryption_metadata[DEFAULT_ENCRYPTED_BUFFER_HEADER_SIZE]; @@ -588,6 +593,9 @@ unique_ptr StandardBufferManager::ReadTemporaryBuffer(QueryContext c } void StandardBufferManager::DeleteTemporaryFile(BlockHandle &block) { + if (!block.IsUnloaded()) { + return; + } auto id = block.BlockId(); if (temporary_directory.path.empty()) { // no temporary directory specified: nothing to delete diff --git a/src/duckdb/src/storage/statistics/base_statistics.cpp b/src/duckdb/src/storage/statistics/base_statistics.cpp index 176045148..54c3a7b11 100644 --- a/src/duckdb/src/storage/statistics/base_statistics.cpp +++ b/src/duckdb/src/storage/statistics/base_statistics.cpp @@ -269,6 +269,8 @@ unique_ptr BaseStatistics::PushdownExtract(const StorageIndex &i switch (stats_type) { case StatisticsType::STRUCT_STATS: return StructStats::PushdownExtract(*this, index); + case StatisticsType::VARIANT_STATS: + return VariantStats::PushdownExtract(*this, index); default: throw InternalException("PushdownExtract not supported for StatisticsType::%s", EnumUtil::ToString(stats_type)); } @@ -346,7 +348,7 @@ void BaseStatistics::CombineValidity(const BaseStatistics &left, const BaseStati has_no_null = left.has_no_null || right.has_no_null; } -void BaseStatistics::CopyValidity(BaseStatistics &stats) { +void BaseStatistics::CopyValidity(const BaseStatistics &stats) { has_null = stats.has_null; has_no_null = stats.has_no_null; } diff --git a/src/duckdb/src/storage/statistics/geometry_stats.cpp b/src/duckdb/src/storage/statistics/geometry_stats.cpp index 91ebeaa5f..f2f7fae6b 100644 --- a/src/duckdb/src/storage/statistics/geometry_stats.cpp +++ b/src/duckdb/src/storage/statistics/geometry_stats.cpp @@ -98,6 +98,9 @@ void GeometryStats::Serialize(const BaseStatistics &stats, Serializer &serialize types.WriteProperty(103, "types_xym", data.types.sets[2]); types.WriteProperty(104, "types_xyzm", data.types.sets[3]); }); + + // Write flags + serializer.WritePropertyWithDefault(202, "flags", data.flags.flags); } void GeometryStats::Deserialize(Deserializer &deserializer, BaseStatistics &base) { @@ -122,6 +125,9 @@ void GeometryStats::Deserialize(Deserializer &deserializer, BaseStatistics &base types.ReadProperty(103, "types_xym", data.types.sets[2]); types.ReadProperty(104, "types_xyzm", data.types.sets[3]); }); + + // Read flags + deserializer.ReadPropertyWithDefault(202, "flags", data.flags.flags); } string GeometryStats::ToString(const BaseStatistics &stats) { @@ -129,10 +135,14 @@ string GeometryStats::ToString(const BaseStatistics &stats) { string result; result += "["; - result += StringUtil::Format("Extent: [X: [%f, %f], Y: [%f, %f], Z: [%f, %f], M: [%f, %f]", data.extent.x_min, + result += StringUtil::Format("Extent: [X: [%f, %f], Y: [%f, %f], Z: [%f, %f], M: [%f, %f]]", data.extent.x_min, data.extent.x_max, data.extent.y_min, data.extent.y_max, data.extent.z_min, data.extent.z_max, data.extent.m_min, data.extent.m_max); - result += StringUtil::Format("], Types: [%s]", StringUtil::Join(data.types.ToString(true), ", ")); + result += StringUtil::Format(", Types: [%s]", StringUtil::Join(data.types.ToString(true), ", ")); + result += StringUtil::Format( + ", Flags: [Has Empty Geom: %s, Has No Empty Geom: %s, Has Empty Part: %s, Has No Empty Part: %s]", + data.flags.HasEmptyGeometry() ? "true" : "false", data.flags.HasNonEmptyGeometry() ? "true" : "false", + data.flags.HasEmptyPart() ? "true" : "false", data.flags.HasNonEmptyPart() ? "true" : "false"); result += "]"; return result; @@ -178,6 +188,10 @@ GeometryTypeSet &GeometryStats::GetTypes(BaseStatistics &stats) { return GetDataUnsafe(stats).types; } +GeometryStatsFlags &GeometryStats::GetFlags(BaseStatistics &stats) { + return GetDataUnsafe(stats).flags; +} + const GeometryExtent &GeometryStats::GetExtent(const BaseStatistics &stats) { return GetDataUnsafe(stats).extent; } @@ -186,6 +200,10 @@ const GeometryTypeSet &GeometryStats::GetTypes(const BaseStatistics &stats) { return GetDataUnsafe(stats).types; } +const GeometryStatsFlags &GeometryStats::GetFlags(const BaseStatistics &stats) { + return GetDataUnsafe(stats).flags; +} + // Expression comparison pruning static FilterPropagateResult CheckIntersectionFilter(const GeometryStatsData &data, const Value &constant) { if (constant.IsNull() || constant.type().id() != LogicalTypeId::GEOMETRY) { diff --git a/src/duckdb/src/storage/statistics/variant_stats.cpp b/src/duckdb/src/storage/statistics/variant_stats.cpp index d36f2573f..ca93aa608 100644 --- a/src/duckdb/src/storage/statistics/variant_stats.cpp +++ b/src/duckdb/src/storage/statistics/variant_stats.cpp @@ -105,6 +105,39 @@ static void AssertShreddedStats(const BaseStatistics &stats) { } } +optional_ptr VariantShreddedStats::FindChildStats(const BaseStatistics &stats, + const VariantPathComponent &component) { + AssertShreddedStats(stats); + + auto &typed_value_stats = StructStats::GetChildStats(stats, 1); + auto &typed_value_type = typed_value_stats.GetType(); + switch (component.lookup_mode) { + case VariantChildLookupMode::BY_INDEX: { + if (typed_value_type.id() != LogicalTypeId::LIST) { + return nullptr; + } + auto &child_stats = ListStats::GetChildStats(typed_value_stats); + return child_stats; + } + case VariantChildLookupMode::BY_KEY: { + if (typed_value_type.id() != LogicalTypeId::STRUCT) { + return nullptr; + } + auto &object_fields = StructType::GetChildTypes(typed_value_type); + for (idx_t i = 0; i < object_fields.size(); i++) { + auto &object_field = object_fields[i]; + if (StringUtil::CIEquals(object_field.first, component.key)) { + return StructStats::GetChildStats(typed_value_stats, i); + } + } + return nullptr; + } + default: + throw InternalException("VariantChildLookupMode::%s not implemented for FindShreddedStats", + EnumUtil::ToString(component.lookup_mode)); + } +} + bool VariantShreddedStats::IsFullyShredded(const BaseStatistics &stats) { AssertShreddedStats(stats); @@ -309,6 +342,18 @@ static BaseStatistics WrapTypedValue(BaseStatistics &untyped_value_index, BaseSt return shredded; } +unique_ptr VariantStats::WrapExtractedFieldAsVariant(const BaseStatistics &base_variant, + const BaseStatistics &extracted_field) { + D_ASSERT(base_variant.type.id() == LogicalTypeId::VARIANT); + AssertShreddedStats(extracted_field); + + BaseStatistics copy = BaseStatistics::CreateUnknown(base_variant.GetType()); + copy.Copy(base_variant); + copy.child_stats[1] = BaseStatistics::CreateUnknown(extracted_field.GetType()); + copy.child_stats[1].Copy(extracted_field); + return copy.ToUnique(); +} + bool VariantStats::MergeShredding(BaseStatistics &stats, const BaseStatistics &other, BaseStatistics &new_stats) { //! shredded_type: //! STRUCT(untyped_value_index UINTEGER, typed_value ) @@ -522,4 +567,58 @@ VariantStatsData &VariantStats::GetDataUnsafe(BaseStatistics &stats) { return stats.stats_union.variant_data; } +static bool CanUseShreddedStats(optional_ptr shredded_stats) { + return shredded_stats && VariantShreddedStats::IsFullyShredded(*shredded_stats); +} + +unique_ptr VariantStats::PushdownExtract(const BaseStatistics &stats, const StorageIndex &index) { + if (!VariantStats::IsShredded(stats)) { + //! Not shredded at all, no stats available + return nullptr; + } + + optional_ptr res(VariantStats::GetShreddedStats(stats)); + if (!CanUseShreddedStats(res)) { + //! Not fully shredded, can't say anything meaningful about the stats + return nullptr; + } + + reference index_iter(index); + while (true) { + auto ¤t = index_iter.get(); + D_ASSERT(!current.HasPrimaryIndex()); + auto &field_name = current.GetFieldName(); + VariantPathComponent path(field_name); + res = VariantShreddedStats::FindChildStats(*res, path); + if (!CanUseShreddedStats(res)) { + //! Not fully shredded, can't say anything meaningful about the stats + return nullptr; + } + if (!index_iter.get().HasChildren()) { + break; + } + } + auto &shredded_child_stats = *res; + + auto &typed_value_stats = StructStats::GetChildStats(shredded_child_stats, 1); + auto &last_index = index_iter.get(); + auto &child_type = typed_value_stats.type; + if (!last_index.HasType() || last_index.GetType().id() == LogicalTypeId::VARIANT) { + //! Return the variant stats, not the 'typed_value' (non-variant) stats, since there's no cast pushed down + return WrapExtractedFieldAsVariant(stats, shredded_child_stats); + } + if (!VariantShreddedStats::IsFullyShredded(shredded_child_stats)) { + //! Not all data is shredded, so there are values in the column that are not of the shredded type + return nullptr; + } + + auto &cast_type = last_index.GetType(); + if (child_type != cast_type) { + //! FIXME: support try_cast + return StatisticsPropagator::TryPropagateCast(typed_value_stats, child_type, cast_type); + } + auto result = typed_value_stats.ToUnique(); + return result; +} + } // namespace duckdb diff --git a/src/duckdb/src/storage/storage_manager.cpp b/src/duckdb/src/storage/storage_manager.cpp index 29d42ec7f..ce07cc706 100644 --- a/src/duckdb/src/storage/storage_manager.cpp +++ b/src/duckdb/src/storage/storage_manager.cpp @@ -5,6 +5,7 @@ #include "duckdb/main/attached_database.hpp" #include "duckdb/main/client_context.hpp" #include "duckdb/main/client_data.hpp" +#include "duckdb/main/settings.hpp" #include "duckdb/main/database.hpp" #include "duckdb/storage/checkpoint_manager.hpp" #include "duckdb/storage/in_memory_block_manager.hpp" @@ -20,9 +21,66 @@ #include "mbedtls_wrapper.hpp" namespace duckdb { - using SHA256State = duckdb_mbedtls::MbedTlsWrapper::SHA256State; +void StorageOptions::SetEncryptionVersion(string &storage_version_user_provided) { + // storage version < v1.4.0 + if (!storage_version.IsValid() || + storage_version.GetIndex() < SerializationCompatibility::FromString("v1.4.0").serialization_version) { + if (!storage_version_user_provided.empty()) { + throw InvalidInputException("Explicit provided STORAGE_VERSION (\"%s\") and ENCRYPTION_KEY (storage >= " + "v1.4.0) are not compatible", + storage_version_user_provided); + } + } + + auto target_encryption_version = encryption_version; + + if (target_encryption_version == EncryptionTypes::NONE) { + target_encryption_version = EncryptionTypes::V0_1; + } + + switch (target_encryption_version) { + case EncryptionTypes::V0_1: + // storage version not explicitly set + if (!storage_version.IsValid() && storage_version_user_provided.empty()) { + storage_version = SerializationCompatibility::FromString("v1.5.0").serialization_version; + break; + } + // storage version set, but v1.4.0 =< storage < v1.5.0 + if (storage_version.GetIndex() < SerializationCompatibility::FromString("v1.5.0").serialization_version) { + if (!storage_version_user_provided.empty()) { + if (encryption_version == target_encryption_version) { + // encryption version is explicitly given, but not compatible with < v1.5.0 + throw InvalidInputException("Explicit provided STORAGE_VERSION (\"%s\") is not compatible with " + "'debug_encryption_version = v1' (storage >= " + "v1.5.0)", + storage_version_user_provided); + } + } else { + // encryption version needs to be lowered, because storage version < v1.5.0 + target_encryption_version = EncryptionTypes::V0_0; + break; + } + } + + break; + + case EncryptionTypes::V0_0: + // we set this to V0 to V1.5.0 if no explicit storage version provided + if (!storage_version.IsValid() && storage_version_user_provided.empty()) { + storage_version = SerializationCompatibility::FromString("v1.5.0").serialization_version; + break; + } + // if storage version is provided, we do nothing + break; + default: + throw InvalidConfigurationException("Encryption version is not set"); + } + + encryption_version = target_encryption_version; +} + void StorageOptions::Initialize(const unordered_map &options) { string storage_version_user_provided = ""; for (auto &entry : options) { @@ -61,20 +119,14 @@ void StorageOptions::Initialize(const unordered_map &options) { } else { compress_in_memory = CompressInMemory::DO_NOT_COMPRESS; } + } else if (entry.first == "debug_encryption_version") { + encryption_version = EncryptionTypes::StringToVersion(entry.second.ToString()); } else { throw BinderException("Unrecognized option for attach \"%s\"", entry.first); } } - if (encryption && - (!storage_version.IsValid() || - storage_version.GetIndex() < SerializationCompatibility::FromString("v1.4.0").serialization_version)) { - if (!storage_version_user_provided.empty()) { - throw InvalidInputException( - "Explicit provided STORAGE_VERSION (\"%s\") and ENCRYPTION_KEY (storage >= v1.4.0) are not compatible", - storage_version_user_provided); - } - // set storage version to v1.4.0 - storage_version = SerializationCompatibility::FromString("v1.4.0").serialization_version; + if (encryption) { + SetEncryptionVersion(storage_version_user_provided); } } @@ -323,6 +375,7 @@ void SingleFileStorageManager::LoadDatabase(QueryContext context) { D_ASSERT(storage_options.block_header_size == DEFAULT_ENCRYPTION_BLOCK_HEADER_SIZE); options.encryption_options.encryption_enabled = true; options.encryption_options.user_key = std::move(storage_options.user_key); + options.encryption_options.encryption_version = storage_options.encryption_version; } idx_t row_group_size = DEFAULT_ROW_GROUP_SIZE; @@ -355,7 +408,7 @@ void SingleFileStorageManager::LoadDatabase(QueryContext context) { options.block_alloc_size = storage_options.block_alloc_size; } else { // No explicit option provided: use the default option. - options.block_alloc_size = config.options.default_block_alloc_size; + options.block_alloc_size = Settings::Get(config); } //! set the block header size for the encrypted database files //! set the database to encrypted diff --git a/src/duckdb/src/storage/table/array_column_data.cpp b/src/duckdb/src/storage/table/array_column_data.cpp index ad6618674..4fc2c0d4a 100644 --- a/src/duckdb/src/storage/table/array_column_data.cpp +++ b/src/duckdb/src/storage/table/array_column_data.cpp @@ -268,6 +268,14 @@ void ArrayColumnData::VisitBlockIds(BlockIdVisitor &visitor) const { child_column->VisitBlockIds(visitor); } +const BaseStatistics &ArrayColumnData::GetChildStats(const ColumnData &child) const { + if (!RefersToSameObject(child, *child_column)) { + throw InternalException("ArrayColumnData::GetChildStats provided column data is not a child of this array"); + } + auto &stats = GetStatisticsRef(); + return ArrayStats::GetChildStats(stats); +} + void ArrayColumnData::SetValidityData(shared_ptr validity_p) { if (validity) { throw InternalException("ArrayColumnData::SetValidityData cannot be used to overwrite existing validity"); @@ -333,11 +341,13 @@ unique_ptr ArrayColumnData::CreateCheckpointState(const R } unique_ptr ArrayColumnData::Checkpoint(const RowGroup &row_group, - ColumnCheckpointInfo &checkpoint_info) { + ColumnCheckpointInfo &checkpoint_info, + const BaseStatistics &old_stats) { auto &partial_block_manager = checkpoint_info.GetPartialBlockManager(); auto checkpoint_state = make_uniq(row_group, *this, partial_block_manager); - checkpoint_state->validity_state = validity->Checkpoint(row_group, checkpoint_info); - checkpoint_state->child_state = child_column->Checkpoint(row_group, checkpoint_info); + checkpoint_state->validity_state = validity->Checkpoint(row_group, checkpoint_info, old_stats); + checkpoint_state->child_state = + child_column->Checkpoint(row_group, checkpoint_info, ArrayStats::GetChildStats(old_stats)); return std::move(checkpoint_state); } diff --git a/src/duckdb/src/storage/table/column_data.cpp b/src/duckdb/src/storage/table/column_data.cpp index d3cb69da4..60261cf28 100644 --- a/src/duckdb/src/storage/table/column_data.cpp +++ b/src/duckdb/src/storage/table/column_data.cpp @@ -17,6 +17,7 @@ #include "duckdb/common/serializer/binary_deserializer.hpp" #include "duckdb/common/serializer/serializer.hpp" #include "duckdb/function/variant/variant_shredding.hpp" +#include "duckdb/storage/table/geo_column_data.hpp" namespace duckdb { @@ -416,12 +417,26 @@ FilterPropagateResult ColumnData::CheckZonemap(const StorageIndex &index, TableF lock_guard l(stats_lock); if (index.IsPushdownExtract()) { auto child_stats = stats->statistics.PushdownExtract(index.GetChildIndex(0)); - D_ASSERT(child_stats); + if (!child_stats) { + return FilterPropagateResult::NO_PRUNING_POSSIBLE; + } return filter.CheckStatistics(*child_stats); } return filter.CheckStatistics(stats->statistics); } +const BaseStatistics &ColumnData::GetStatisticsRef() const { + if (stats) { + return stats->statistics; + } + D_ASSERT(HasParent()); + return parent->GetChildStats(*this); +} + +const BaseStatistics &ColumnData::GetChildStats(const ColumnData &child) const { + throw InternalException("GetChildStats not implemented for ColumnData of type %s", type.ToString()); +} + unique_ptr ColumnData::GetStatistics() const { if (!stats) { throw InternalException("ColumnData::GetStatistics called on a column without stats"); @@ -665,6 +680,14 @@ void ColumnData::CheckpointScan(ColumnSegment &segment, ColumnScanState &state, unique_ptr ColumnData::Checkpoint(const RowGroup &row_group, ColumnCheckpointInfo &checkpoint_info) { + if (!stats) { + throw InternalException("ColumnData::Checkpoint called without stats on a nested column"); + } + return Checkpoint(row_group, checkpoint_info, this->stats->statistics); +} + +unique_ptr +ColumnData::Checkpoint(const RowGroup &row_group, ColumnCheckpointInfo &checkpoint_info, const BaseStatistics &stats) { // scan the segments of the column data // set up the checkpoint state auto &partial_block_manager = checkpoint_info.GetPartialBlockManager(); @@ -688,7 +711,7 @@ void ColumnData::InitializeColumn(PersistentColumnData &column_data) { } void ColumnData::InitializeColumn(PersistentColumnData &column_data, BaseStatistics &target_stats) { - D_ASSERT(type.InternalType() == column_data.physical_type); + D_ASSERT(type.InternalType() == column_data.logical_type.InternalType()); // construct the segments based on the data pointers this->count = 0; for (auto &data_pointer : column_data.pointers) { @@ -731,12 +754,11 @@ vector ColumnData::GetDataPointers() { return pointers; } -PersistentColumnData::PersistentColumnData(const LogicalType &logical_type) - : physical_type(logical_type.InternalType()), logical_type_id(logical_type.id()) { +PersistentColumnData::PersistentColumnData(const LogicalType &logical_type_p) : logical_type(logical_type_p) { } -PersistentColumnData::PersistentColumnData(const LogicalType &logical_type, vector pointers_p) - : physical_type(logical_type.InternalType()), logical_type_id(logical_type.id()), pointers(std::move(pointers_p)) { +PersistentColumnData::PersistentColumnData(const LogicalType &logical_type_p, vector pointers_p) + : logical_type(logical_type_p), pointers(std::move(pointers_p)) { D_ASSERT(!pointers.empty()); } @@ -747,35 +769,42 @@ void PersistentColumnData::Serialize(Serializer &serializer) const { if (has_updates) { throw InternalException("Column data with updates cannot be serialized"); } - serializer.WritePropertyWithDefault(100, "data_pointers", pointers); - if (child_columns.empty()) { - // validity column - D_ASSERT(physical_type == PhysicalType::BIT); - return; - } - serializer.WriteProperty(101, "validity", child_columns[0]); - - if (logical_type_id == LogicalTypeId::VARIANT) { - D_ASSERT(physical_type == PhysicalType::STRUCT); - D_ASSERT(child_columns.size() == 2 || child_columns.size() == 3); - auto unshredded_type = VariantShredding::GetUnshreddedType(); - serializer.WriteProperty(102, "unshredded", child_columns[1]); + // Serialize the extra data + serializer.WritePropertyWithDefault(99, "extra_data", extra_data); - if (child_columns.size() == 3) { - D_ASSERT(variant_shredded_type.id() == LogicalTypeId::STRUCT); - serializer.WriteProperty(115, "shredded_type", variant_shredded_type); - serializer.WriteProperty(120, "shredded", child_columns[2]); + // TODO: Dont special-case this + if (logical_type.id() == LogicalTypeId::VARIANT) { + serializer.WritePropertyWithDefault(100, "data_pointers", pointers); + serializer.WriteProperty(101, "validity", child_columns[0]); + serializer.WriteProperty(102, "unshredded", child_columns[1]); + if (child_columns.size() > 2) { + serializer.WriteProperty(103, "shredded", child_columns[2]); } return; } - if (physical_type == PhysicalType::ARRAY || physical_type == PhysicalType::LIST) { + switch (logical_type.InternalType()) { + case PhysicalType::BIT: { + serializer.WritePropertyWithDefault(100, "data_pointers", pointers); + } break; + case PhysicalType::ARRAY: + case PhysicalType::LIST: { D_ASSERT(child_columns.size() == 2); + serializer.WritePropertyWithDefault(100, "data_pointers", pointers); + serializer.WriteProperty(101, "validity", child_columns[0]); serializer.WriteProperty(102, "child_column", child_columns[1]); - } else if (physical_type == PhysicalType::STRUCT) { + } break; + case PhysicalType::STRUCT: { + serializer.WritePropertyWithDefault(100, "data_pointers", pointers); + serializer.WriteProperty(101, "validity", child_columns[0]); serializer.WriteList(102, "sub_columns", child_columns.size() - 1, [&](Serializer::List &list, idx_t i) { list.WriteElement(child_columns[i + 1]); }); + } break; + default: { + serializer.WritePropertyWithDefault(100, "data_pointers", pointers); + serializer.WriteProperty(101, "validity", child_columns[0]); + } break; } } @@ -786,53 +815,123 @@ void PersistentColumnData::DeserializeField(Deserializer &deserializer, field_id deserializer.Unset(); } -PersistentColumnData PersistentColumnData::Deserialize(Deserializer &deserializer) { - auto &type = deserializer.Get(); - auto physical_type = type.InternalType(); - PersistentColumnData result(type); - deserializer.ReadPropertyWithDefault(100, "data_pointers", static_cast &>(result.pointers)); - if (result.physical_type == PhysicalType::BIT) { - // validity: return +static PersistentColumnData GetPersistentColumnDataType(Deserializer &deserializer) { + auto extra_data = + deserializer.ReadPropertyWithExplicitDefault>(99, "extra_data", nullptr); + + if (!extra_data) { + // Get the type from the parent scope + auto &type = deserializer.Get(); + return PersistentColumnData(type); + } + + // Otherwise, the type of this segment may depend on extra data + switch (extra_data->GetType()) { + case ExtraPersistentColumnDataType::VARIANT: { + auto unshredded_type = VariantShredding::GetUnshreddedType(); + PersistentColumnData result(LogicalType::VARIANT()); + result.extra_data = std::move(extra_data); return result; } - result.DeserializeField(deserializer, 101, "validity", LogicalTypeId::VALIDITY); + case ExtraPersistentColumnDataType::GEOMETRY: { + const auto &geometry_data = extra_data->Cast(); + PersistentColumnData result(Geometry::GetVectorizedType(geometry_data.geom_type, geometry_data.vert_type)); + result.extra_data = std::move(extra_data); + return result; + } + default: + throw InternalException(""); + } +} +PersistentColumnData PersistentColumnData::Deserialize(Deserializer &deserializer) { + auto result = GetPersistentColumnDataType(deserializer); + const auto &type = result.logical_type; + + // TODO: Dont special-case this if (type.id() == LogicalTypeId::VARIANT) { - auto unshredded_type = VariantShredding::GetUnshreddedType(); + deserializer.ReadPropertyWithDefault(100, "data_pointers", result.pointers); + result.DeserializeField(deserializer, 101, "validity", LogicalTypeId::VALIDITY); + result.DeserializeField(deserializer, 102, "unshredded", VariantShredding::GetUnshreddedType()); + if (result.extra_data) { + auto &variant_data = result.extra_data->Cast(); + result.DeserializeField(deserializer, 103, "shredded", variant_data.logical_type); + } + return result; + } + + // TODO: This is ugly + if (result.extra_data && result.extra_data->GetType() == ExtraPersistentColumnDataType::GEOMETRY) { + auto &geo_data = result.extra_data->Cast(); + auto actual_type = Geometry::GetVectorizedType(geo_data.geom_type, geo_data.vert_type); + + // We need to set the actual type in scope, as when we deserialize "data_pointers" we use it to detect + // the type of the statistics. + deserializer.Set(actual_type); + + switch (actual_type.InternalType()) { + case PhysicalType::BIT: { + deserializer.ReadPropertyWithDefault(100, "data_pointers", result.pointers); + } break; + case PhysicalType::ARRAY: { + deserializer.ReadPropertyWithDefault(100, "data_pointers", result.pointers); + result.DeserializeField(deserializer, 101, "validity", LogicalTypeId::VALIDITY); + result.DeserializeField(deserializer, 102, "child_column", ArrayType::GetChildType(type)); + } break; + case PhysicalType::LIST: { + deserializer.ReadPropertyWithDefault(100, "data_pointers", result.pointers); + result.DeserializeField(deserializer, 101, "validity", LogicalTypeId::VALIDITY); + result.DeserializeField(deserializer, 102, "child_column", ListType::GetChildType(type)); + } break; + case PhysicalType::STRUCT: { + deserializer.ReadPropertyWithDefault(100, "data_pointers", result.pointers); + result.DeserializeField(deserializer, 101, "validity", LogicalTypeId::VALIDITY); + const auto &child_types = StructType::GetChildTypes(type); + deserializer.ReadList(102, "sub_columns", [&](Deserializer::List &list, idx_t i) { + deserializer.Set(child_types[i].second); + result.child_columns.push_back(list.ReadElement()); + deserializer.Unset(); + }); + } break; + default: { + deserializer.ReadPropertyWithDefault(100, "data_pointers", result.pointers); + result.DeserializeField(deserializer, 101, "validity", LogicalTypeId::VALIDITY); + } break; + } - deserializer.Set(unshredded_type); - result.child_columns.push_back(deserializer.ReadProperty(102, "unshredded")); deserializer.Unset(); - auto shredded_type = - deserializer.ReadPropertyWithExplicitDefault(115, "shredded_type", LogicalType()); - if (shredded_type.id() == LogicalTypeId::STRUCT) { - deserializer.Set(shredded_type); - result.child_columns.push_back(deserializer.ReadProperty(120, "shredded")); - deserializer.Unset(); - result.SetVariantShreddedType(shredded_type); - } return result; } - switch (physical_type) { - case PhysicalType::ARRAY: + switch (type.InternalType()) { + case PhysicalType::BIT: { + deserializer.ReadPropertyWithDefault(100, "data_pointers", result.pointers); + } break; + case PhysicalType::ARRAY: { + deserializer.ReadPropertyWithDefault(100, "data_pointers", result.pointers); + result.DeserializeField(deserializer, 101, "validity", LogicalTypeId::VALIDITY); result.DeserializeField(deserializer, 102, "child_column", ArrayType::GetChildType(type)); - break; - case PhysicalType::LIST: + } break; + case PhysicalType::LIST: { + deserializer.ReadPropertyWithDefault(100, "data_pointers", result.pointers); + result.DeserializeField(deserializer, 101, "validity", LogicalTypeId::VALIDITY); result.DeserializeField(deserializer, 102, "child_column", ListType::GetChildType(type)); - break; + } break; case PhysicalType::STRUCT: { - auto &child_types = StructType::GetChildTypes(type); + deserializer.ReadPropertyWithDefault(100, "data_pointers", result.pointers); + result.DeserializeField(deserializer, 101, "validity", LogicalTypeId::VALIDITY); + const auto &child_types = StructType::GetChildTypes(type); deserializer.ReadList(102, "sub_columns", [&](Deserializer::List &list, idx_t i) { deserializer.Set(child_types[i].second); result.child_columns.push_back(list.ReadElement()); deserializer.Unset(); }); - break; - } - default: - break; + } break; + default: { + deserializer.ReadPropertyWithDefault(100, "data_pointers", result.pointers); + result.DeserializeField(deserializer, 101, "validity", LogicalTypeId::VALIDITY); + } break; } return result; } @@ -849,12 +948,6 @@ bool PersistentColumnData::HasUpdates() const { return false; } -void PersistentColumnData::SetVariantShreddedType(const LogicalType &shredded_type) { - D_ASSERT(physical_type == PhysicalType::STRUCT); - D_ASSERT(logical_type_id == LogicalTypeId::VARIANT); - variant_shredded_type = shredded_type; -} - PersistentRowGroupData::PersistentRowGroupData(vector types_p) : types(std::move(types_p)) { } @@ -906,6 +999,42 @@ bool PersistentCollectionData::HasUpdates() const { return false; } +void ExtraPersistentColumnData::Serialize(Serializer &serializer) const { + serializer.WritePropertyWithDefault(100, "type", type, ExtraPersistentColumnDataType::INVALID); + switch (GetType()) { + case ExtraPersistentColumnDataType::VARIANT: { + const auto &variant_data = Cast(); + serializer.WriteProperty(101, "storage_type", variant_data.logical_type); + } break; + case ExtraPersistentColumnDataType::GEOMETRY: { + const auto &geometry_data = Cast(); + serializer.WritePropertyWithDefault(101, "geom_type", geometry_data.geom_type, GeometryType::INVALID); + serializer.WritePropertyWithDefault(102, "vert_type", geometry_data.vert_type, VertexType::XY); + } break; + default: + throw InternalException("Unknown PersistentColumnData type"); + } +} +unique_ptr ExtraPersistentColumnData::Deserialize(Deserializer &deserializer) { + auto type = deserializer.ReadPropertyWithExplicitDefault( + 100, "type", ExtraPersistentColumnDataType::INVALID); + switch (type) { + case ExtraPersistentColumnDataType::VARIANT: { + auto storage_type = + deserializer.ReadPropertyWithExplicitDefault(101, "storage_type", LogicalType()); + return make_uniq(storage_type); + } + case ExtraPersistentColumnDataType::GEOMETRY: { + auto geom_type = + deserializer.ReadPropertyWithExplicitDefault(101, "geom_type", GeometryType::INVALID); + auto vert_type = deserializer.ReadPropertyWithExplicitDefault(102, "vert_type", VertexType::XY); + return make_uniq(geom_type, vert_type); + } + default: + throw InternalException("Unknown PersistentColumnData type"); + } +} + PersistentColumnData ColumnData::Serialize() { auto result = count ? PersistentColumnData(type, GetDataPointers()) : PersistentColumnData(type); result.has_updates = HasUpdates(); @@ -1017,11 +1146,20 @@ void ColumnData::GetColumnSegmentInfo(const QueryContext &context, idx_t row_gro void ColumnData::Verify(RowGroup &parent) { #ifdef DEBUG data.Verify(); - if (type.InternalType() == PhysicalType::STRUCT || type.InternalType() == PhysicalType::ARRAY) { + + bool is_geometry_child_column = false; + if (type.id() == LogicalTypeId::GEOMETRY && this->parent && this->parent->type.id() == LogicalTypeId::GEOMETRY) { + // Geometry child column + is_geometry_child_column = true; + } + + if (type.InternalType() == PhysicalType::STRUCT || type.InternalType() == PhysicalType::ARRAY || + (type.id() == LogicalTypeId::GEOMETRY && !is_geometry_child_column)) { // structs and fixed size lists don't have segments D_ASSERT(!data.GetRootSegment()); return; } + idx_t current_index = 0; idx_t current_start = 0; idx_t total_count = 0; @@ -1039,16 +1177,22 @@ void ColumnData::Verify(RowGroup &parent) { shared_ptr ColumnData::CreateColumn(BlockManager &block_manager, DataTableInfo &info, idx_t column_index, const LogicalType &type, ColumnDataType data_type, optional_ptr parent) { + if (type.id() == LogicalTypeId::GEOMETRY) { + return make_shared_ptr(block_manager, info, column_index, type, data_type, parent); + } if (type.id() == LogicalTypeId::VARIANT) { return make_shared_ptr(block_manager, info, column_index, type, data_type, parent); } if (type.InternalType() == PhysicalType::STRUCT) { return make_shared_ptr(block_manager, info, column_index, type, data_type, parent); - } else if (type.InternalType() == PhysicalType::LIST) { + } + if (type.InternalType() == PhysicalType::LIST) { return make_shared_ptr(block_manager, info, column_index, type, data_type, parent); - } else if (type.InternalType() == PhysicalType::ARRAY) { + } + if (type.InternalType() == PhysicalType::ARRAY) { return make_shared_ptr(block_manager, info, column_index, type, data_type, parent); - } else if (type.id() == LogicalTypeId::VALIDITY) { + } + if (type.id() == LogicalTypeId::VALIDITY) { return make_shared_ptr(block_manager, info, column_index, data_type, parent); } return make_shared_ptr(block_manager, info, column_index, type, data_type, parent); diff --git a/src/duckdb/src/storage/table/column_data_checkpointer.cpp b/src/duckdb/src/storage/table/column_data_checkpointer.cpp index 281457cbf..8ad72f825 100644 --- a/src/duckdb/src/storage/table/column_data_checkpointer.cpp +++ b/src/duckdb/src/storage/table/column_data_checkpointer.cpp @@ -1,5 +1,7 @@ #include "duckdb/storage/table/column_data_checkpointer.hpp" + #include "duckdb/main/config.hpp" +#include "duckdb/main/settings.hpp" #include "duckdb/storage/table/update_segment.hpp" #include "duckdb/storage/data_table.hpp" #include "duckdb/parser/column_definition.hpp" @@ -168,9 +170,11 @@ vector ColumnDataCheckpointer::DetectBestCompressionMet if (compression_type != CompressionType::COMPRESSION_AUTO) { forced_methods[i] = ForceCompression(storage_manager, functions, compression_type); } - if (compression_type == CompressionType::COMPRESSION_AUTO && - config.options.force_compression != CompressionType::COMPRESSION_AUTO) { - forced_methods[i] = ForceCompression(storage_manager, functions, config.options.force_compression); + if (compression_type == CompressionType::COMPRESSION_AUTO) { + auto force_compression = Settings::Get(config); + if (force_compression != CompressionType::COMPRESSION_AUTO) { + forced_methods[i] = ForceCompression(storage_manager, functions, force_compression); + } } } diff --git a/src/duckdb/src/storage/table/geo_column_data.cpp b/src/duckdb/src/storage/table/geo_column_data.cpp new file mode 100644 index 000000000..d1c67a57e --- /dev/null +++ b/src/duckdb/src/storage/table/geo_column_data.cpp @@ -0,0 +1,531 @@ +#include "duckdb/storage/table/geo_column_data.hpp" +#include "duckdb/storage/table/standard_column_data.hpp" + +#include "duckdb/storage/statistics/struct_stats.hpp" +#include "duckdb/common/serializer/serializer.hpp" +#include "duckdb/common/serializer/deserializer.hpp" +#include "duckdb/common/vector_operations/generic_executor.hpp" +#include "duckdb/storage/statistics/list_stats.hpp" +#include "duckdb/storage/table/append_state.hpp" +#include "duckdb/storage/table/scan_state.hpp" +#include "duckdb/storage/table/column_checkpoint_state.hpp" +#include "duckdb/main/settings.hpp" + +namespace duckdb { + +//---------------------------------------------------------------------------------------------------------------------- +// GeoColumnData +//---------------------------------------------------------------------------------------------------------------------- +// TODO: Override ::Filter to push down bounding box filters. + +GeoColumnData::GeoColumnData(BlockManager &block_manager, DataTableInfo &info, idx_t column_index, LogicalType type_p, + ColumnDataType data_type, optional_ptr parent) + : ColumnData(block_manager, info, column_index, std::move(type_p), data_type, parent) { + if (data_type != ColumnDataType::CHECKPOINT_TARGET) { + base_column = make_shared_ptr(block_manager, info, column_index, type, data_type, this); + } +} + +//---------------------------------------------------------------------------------------------------------------------- +// Scan +//---------------------------------------------------------------------------------------------------------------------- + +void GeoColumnData::InitializePrefetch(PrefetchState &prefetch_state, ColumnScanState &scan_state, idx_t rows) { + return base_column->InitializePrefetch(prefetch_state, scan_state, rows); +} + +void GeoColumnData::InitializeChildScanStates(ColumnScanState &state) { + // Reset, inner layout might be different + state.child_states.clear(); + + // Initialize using the type of the base column + state.Initialize(state.context, base_column->type, state.scan_options); +} + +void GeoColumnData::InitializeScan(ColumnScanState &state) { + InitializeChildScanStates(state); + return base_column->InitializeScan(state); +} + +void GeoColumnData::InitializeScanWithOffset(ColumnScanState &state, idx_t row_idx) { + InitializeChildScanStates(state); + return base_column->InitializeScanWithOffset(state, row_idx); +} + +idx_t GeoColumnData::Scan(TransactionData transaction, idx_t vector_index, ColumnScanState &state, Vector &result, + idx_t target_count) { + auto &layout_type = base_column->GetType(); + + // Not a shredded column, so just emit the binary format immediately + if (layout_type.id() == LogicalTypeId::GEOMETRY) { + return base_column->Scan(transaction, vector_index, state, result, target_count); + } + + // Setup an intermediate chunk to scan the actual data, based on how much we actually scanned + // TODO: Put this in a scan state? + DataChunk scan_chunk; + scan_chunk.Initialize(Allocator::DefaultAllocator(), {layout_type}, target_count); + + const auto scan_count = base_column->Scan(transaction, vector_index, state, scan_chunk.data[0], target_count); + + // Now reassemble + Reassemble(scan_chunk.data[0], result, scan_count, geom_type, vert_type, 0); + return scan_count; +} + +idx_t GeoColumnData::ScanCount(ColumnScanState &state, Vector &result, idx_t target_count, idx_t result_offset) { + auto &layout_type = base_column->GetType(); + + // Not a shredded column, so just emit the binary format immediately + if (layout_type.id() == LogicalTypeId::GEOMETRY) { + return base_column->ScanCount(state, result, target_count, result_offset); + } + + // Setup an intermediate chunk to scan the actual data, based on how much we actually scanned + // TODO: Put this in a scan state + DataChunk scan_chunk; + scan_chunk.Initialize(Allocator::DefaultAllocator(), {layout_type}, target_count); + + const auto scan_count = base_column->ScanCount(state, scan_chunk.data[0], target_count, 0); + + // Now reassemble + Reassemble(scan_chunk.data[0], result, scan_count, geom_type, vert_type, result_offset); + return scan_count; +} + +void GeoColumnData::Skip(ColumnScanState &state, idx_t count) { + return base_column->Skip(state, count); +} + +//---------------------------------------------------------------------------------------------------------------------- +// Append +//---------------------------------------------------------------------------------------------------------------------- + +void GeoColumnData::InitializeAppend(ColumnAppendState &state) { + base_column->InitializeAppend(state); +} +void GeoColumnData::Append(BaseStatistics &stats, ColumnAppendState &state, Vector &vector, idx_t add_count) { + base_column->Append(stats, state, vector, add_count); + count += add_count; +} +void GeoColumnData::RevertAppend(row_t new_count) { + base_column->RevertAppend(new_count); + count = UnsafeNumericCast(new_count); +} + +//---------------------------------------------------------------------------------------------------------------------- +// Fetch +//---------------------------------------------------------------------------------------------------------------------- + +idx_t GeoColumnData::Fetch(ColumnScanState &state, row_t row_id, Vector &result) { + auto &layout_type = base_column->GetType(); + + // Not a shredded column, so just emit the binary format immediately + if (layout_type.id() == LogicalTypeId::GEOMETRY) { + return base_column->Fetch(state, row_id, result); + } + + // Otherwise, we need to fetch and reassemble + DataChunk chunk; + chunk.Initialize(Allocator::DefaultAllocator(), {layout_type}, 1); + + const auto fetch_count = base_column->Fetch(state, row_id, chunk.data[0]); + + Reassemble(chunk.data[0], result, fetch_count, geom_type, vert_type, 0); + + return fetch_count; +} + +void GeoColumnData::FetchRow(TransactionData transaction, ColumnFetchState &state, const StorageIndex &storage_index, + row_t row_id, Vector &result, idx_t result_idx) { + auto &layout_type = base_column->GetType(); + + // Not a shredded column, so just emit the binary format immediately + if (layout_type.id() == LogicalTypeId::GEOMETRY) { + return base_column->FetchRow(transaction, state, storage_index, row_id, result, result_idx); + } + + // Otherwise, we need to fetch and reassemble + DataChunk chunk; + chunk.Initialize(Allocator::DefaultAllocator(), {layout_type}, 1); + + base_column->FetchRow(transaction, state, storage_index, row_id, chunk.data[0], 0); + + Reassemble(chunk.data[0], result, 1, geom_type, vert_type, result_idx); +} + +//---------------------------------------------------------------------------------------------------------------------- +// Update +//---------------------------------------------------------------------------------------------------------------------- + +void GeoColumnData::Update(TransactionData transaction, DataTable &data_table, idx_t column_index, + Vector &update_vector, row_t *row_ids, idx_t update_count, idx_t row_group_start) { + return base_column->Update(transaction, data_table, column_index, update_vector, row_ids, update_count, + row_group_start); +} +void GeoColumnData::UpdateColumn(TransactionData transaction, DataTable &data_table, + const vector &column_path, Vector &update_vector, row_t *row_ids, + idx_t update_count, idx_t depth, idx_t row_group_start) { + return base_column->UpdateColumn(transaction, data_table, column_path, update_vector, row_ids, update_count, depth, + row_group_start); +} + +unique_ptr GeoColumnData::GetUpdateStatistics() { + return base_column->GetUpdateStatistics(); +} + +//---------------------------------------------------------------------------------------------------------------------- +// Checkpoint +//---------------------------------------------------------------------------------------------------------------------- + +class GeoColumnCheckpointState final : public ColumnCheckpointState { +public: + GeoColumnCheckpointState(const RowGroup &row_group, ColumnData &column_data, + PartialBlockManager &partial_block_manager) + : ColumnCheckpointState(row_group, column_data, partial_block_manager) { + // Make stats + global_stats = GeometryStats::CreateEmpty(column_data.type).ToUnique(); + + // Also pass on the shredding state + const auto &geo_column = column_data.Cast(); + geom_type = geo_column.geom_type; + vert_type = geo_column.vert_type; + } + + // Shared pointer to the new/old inner column. + // This is never actually used here, but needs to stay alive + // for as long as the checkpoint state, hence the shared_ptr. + shared_ptr inner_column; + + // The checkpoint state for the inner column. + unique_ptr inner_column_state; + + GeometryType geom_type = GeometryType::INVALID; + VertexType vert_type = VertexType::XY; + + shared_ptr CreateEmptyColumnData() override { + auto new_column = make_shared_ptr( + original_column.GetBlockManager(), original_column.GetTableInfo(), original_column.column_index, + original_column.type, ColumnDataType::CHECKPOINT_TARGET, nullptr); + return std::move(new_column); + } + + shared_ptr GetFinalResult() override { + if (!result_column) { + result_column = CreateEmptyColumnData(); + } + + auto &column_data = result_column->Cast(); + + auto new_inner = inner_column_state->GetFinalResult(); + new_inner->SetParent(column_data); + column_data.base_column = std::move(new_inner); + + // Pass on the shredding state too + column_data.geom_type = geom_type; + column_data.vert_type = vert_type; + + return ColumnCheckpointState::GetFinalResult(); + } + + unique_ptr GetStatistics() override { + D_ASSERT(global_stats); + return std::move(global_stats); + } + + PersistentColumnData ToPersistentData() override { + auto inner_data = inner_column_state->ToPersistentData(); + + // If this is a shredded column, record it in the persistent data! + if (geom_type != GeometryType::INVALID) { + auto extra_data = make_uniq(); + extra_data->geom_type = geom_type; + extra_data->vert_type = vert_type; + inner_data.extra_data = std::move(extra_data); + } + + return inner_data; + } +}; + +unique_ptr GeoColumnData::CreateCheckpointState(const RowGroup &row_group, + PartialBlockManager &partial_block_manager) { + return make_uniq(row_group, *this, partial_block_manager); +} + +unique_ptr GeoColumnData::Checkpoint(const RowGroup &row_group, ColumnCheckpointInfo &info, + const BaseStatistics &old_stats) { + auto &partial_block_manager = info.GetPartialBlockManager(); + auto checkpoint_state = make_uniq(row_group, *this, partial_block_manager); + + auto &old_column_stats = + base_column->GetType().id() == LogicalTypeId::GEOMETRY ? old_stats : base_column->GetStatisticsRef(); + + // Are there any changes? + if (!HasAnyChanges()) { + // No changes, keep column + checkpoint_state->inner_column = base_column; + checkpoint_state->inner_column_state = + checkpoint_state->inner_column->Checkpoint(row_group, info, old_column_stats); + return std::move(checkpoint_state); + } + + // Do we have enough rows to consider shredding? + auto &table_info = row_group.GetTableInfo(); + auto &db = table_info.GetDB(); + + const auto shredding_threshold = Settings::Get(DBConfig::Get(db)); + const auto current_row_count = count.load(); + + auto should_shred = shredding_threshold >= 0 && current_row_count >= static_cast(shredding_threshold); + if (!should_shred) { + // Keep column + checkpoint_state->inner_column = base_column; + checkpoint_state->inner_column_state = + checkpoint_state->inner_column->Checkpoint(row_group, info, old_column_stats); + checkpoint_state->global_stats = checkpoint_state->inner_column_state->GetStatistics(); + return std::move(checkpoint_state); + } + + // Figure out if this segment can use an alternative type layout + auto new_geom_type = GeometryType::POINT; + auto new_vert_type = VertexType::XY; + + const auto &types = GeometryStats::GetTypes(old_stats); + const auto &flags = GeometryStats::GetFlags(old_stats); + + auto has_mixed_type = !types.TryGetSingleType(new_geom_type, new_vert_type); + auto has_only_geometry_collection = new_geom_type == GeometryType::GEOMETRYCOLLECTION; + auto has_only_invalid = new_geom_type == GeometryType::INVALID; + + // We cant specialize empty geometries, because we cant represent zero-vertex geometries in those layouts + const auto has_empty = flags.HasEmptyGeometry() || flags.HasEmptyPart(); + + if (has_mixed_type || has_only_geometry_collection || has_only_invalid || has_empty) { + // Cant specialize, keep column + checkpoint_state->inner_column = base_column; + checkpoint_state->inner_column_state = + checkpoint_state->inner_column->Checkpoint(row_group, info, old_column_stats); + checkpoint_state->global_stats = checkpoint_state->inner_column_state->GetStatistics(); + return std::move(checkpoint_state); + } + + auto new_type = Geometry::GetVectorizedType(new_geom_type, new_vert_type); + + auto new_column = CreateColumn(block_manager, this->info, base_column->column_index, new_type, GetDataType(), this); + + // Setup scan from the old column + DataChunk scan_chunk; + ColumnScanState scan_state(nullptr); + scan_chunk.Initialize(Allocator::DefaultAllocator(), {base_column->type}, STANDARD_VECTOR_SIZE); + InitializeScan(scan_state); + + // Setup append to the new column + DataChunk append_chunk; + ColumnAppendState append_state; + append_chunk.Initialize(Allocator::DefaultAllocator(), {new_column->type}, STANDARD_VECTOR_SIZE); + new_column->InitializeAppend(append_state); + + idx_t total_count = count.load(); + idx_t vector_index = 0; + + for (idx_t scanned = 0; scanned < total_count; scanned += STANDARD_VECTOR_SIZE) { + scan_chunk.Reset(); + + auto to_scan = MinValue(total_count - scanned, static_cast(STANDARD_VECTOR_SIZE)); + Scan(TransactionData::Committed(), vector_index++, scan_state, scan_chunk.data[0], to_scan); + + // Verify the scan chunk + scan_chunk.Verify(); + + append_chunk.Reset(); + append_chunk.SetCardinality(to_scan); + + // Make the split + Specialize(scan_chunk.data[0], append_chunk.data[0], to_scan, new_geom_type, new_vert_type); + + // Append into the new specialized column + auto dummy_stats = BaseStatistics::CreateEmpty(new_column->GetType()); + new_column->Append(dummy_stats, append_state, append_chunk.data[0], to_scan); + + // Merge the stats into the checkpoint state's global stats + InterpretStats(dummy_stats, *checkpoint_state->global_stats, new_geom_type, new_vert_type); + } + + // Move then new column into our checkpoint state + auto empty_stats = BaseStatistics::CreateEmpty(new_column->GetType()); + checkpoint_state->inner_column = new_column; + checkpoint_state->inner_column_state = checkpoint_state->inner_column->Checkpoint(row_group, info, empty_stats); + + // Also set the shredding state + checkpoint_state->geom_type = new_geom_type; + checkpoint_state->vert_type = new_vert_type; + + return std::move(checkpoint_state); +} + +bool GeoColumnData::IsPersistent() { + return base_column->IsPersistent(); +} + +bool GeoColumnData::HasAnyChanges() const { + return base_column->HasAnyChanges(); +} + +PersistentColumnData GeoColumnData::Serialize() { + // Serialize the inner column + auto inner_data = base_column->Serialize(); + + // If this is a shredded column, record it in the persistent data! + if (geom_type != GeometryType::INVALID) { + auto extra_data = make_uniq(); + extra_data->geom_type = geom_type; + extra_data->vert_type = vert_type; + inner_data.extra_data = std::move(extra_data); + } + + return inner_data; +} + +void GeoColumnData::InitializeColumn(PersistentColumnData &column_data, BaseStatistics &target_stats) { + if (!column_data.extra_data) { + // No shredding, just initialize normally + base_column->InitializeColumn(column_data, target_stats); + count = base_column->count.load(); + return; + } + + auto &geom_data = column_data.extra_data->Cast(); + + // Set the shredding state + vert_type = geom_data.vert_type; + geom_type = geom_data.geom_type; + + // Else, this is a shredded point + const auto layout_type = Geometry::GetVectorizedType(geom_type, vert_type); + base_column = CreateColumn(block_manager, info, base_column->column_index, layout_type, GetDataType(), this); + D_ASSERT(base_column != nullptr); + + auto dummy_stats = BaseStatistics::CreateEmpty(layout_type); + base_column->InitializeColumn(column_data, dummy_stats); + count = base_column->count.load(); + + // Interpret the stats + InterpretStats(dummy_stats, target_stats, geom_type, vert_type); +} + +//---------------------------------------------------------------------------------------------------------------------- +// Misc +//---------------------------------------------------------------------------------------------------------------------- + +idx_t GeoColumnData::GetMaxEntry() { + return base_column->GetMaxEntry(); +} + +void GeoColumnData::GetColumnSegmentInfo(const QueryContext &context, idx_t row_group_index, vector col_path, + vector &result) { + return base_column->GetColumnSegmentInfo(context, row_group_index, col_path, result); +} + +void GeoColumnData::Verify(RowGroup &parent) { + return base_column->Verify(parent); +} + +void GeoColumnData::VisitBlockIds(BlockIdVisitor &visitor) const { + return base_column->VisitBlockIds(visitor); +} + +//---------------------------------------------------------------------------------------------------------------------- +// Specialize +//---------------------------------------------------------------------------------------------------------------------- +void GeoColumnData::Specialize(Vector &source, Vector &target, idx_t count, GeometryType geom_type, + VertexType vert_type) { + Geometry::ToVectorizedFormat(source, target, count, geom_type, vert_type); +} + +void GeoColumnData::Reassemble(Vector &source, Vector &target, idx_t count, GeometryType geom_type, + VertexType vert_type, idx_t result_offset) { + Geometry::FromVectorizedFormat(source, target, count, geom_type, vert_type, result_offset); +} + +static const BaseStatistics *GetVertexStats(BaseStatistics &stats, GeometryType geom_type) { + switch (geom_type) { + case GeometryType::POINT: { + return StructStats::GetChildStats(stats); + } + case GeometryType::LINESTRING: { + const auto &line_stats = ListStats::GetChildStats(stats); + return StructStats::GetChildStats(line_stats); + } + case GeometryType::POLYGON: { + const auto &poly_stats = ListStats::GetChildStats(stats); + const auto &ring_stats = ListStats::GetChildStats(poly_stats); + return StructStats::GetChildStats(ring_stats); + } + case GeometryType::MULTIPOINT: { + const auto &mpoint_stats = ListStats::GetChildStats(stats); + return StructStats::GetChildStats(mpoint_stats); + } + case GeometryType::MULTILINESTRING: { + const auto &mline_stats = ListStats::GetChildStats(stats); + const auto &line_stats = ListStats::GetChildStats(mline_stats); + return StructStats::GetChildStats(line_stats); + } + case GeometryType::MULTIPOLYGON: { + const auto &mpoly_stats = ListStats::GetChildStats(stats); + const auto &poly_stats = ListStats::GetChildStats(mpoly_stats); + const auto &ring_stats = ListStats::GetChildStats(poly_stats); + return StructStats::GetChildStats(ring_stats); + } + default: + throw NotImplementedException("Unsupported geometry type %d for interpreting stats", + static_cast(geom_type)); + } +} + +void GeoColumnData::InterpretStats(BaseStatistics &source, BaseStatistics &target, GeometryType geom_type, + VertexType vert_type) { + // Copy base stats + target.CopyBase(source); + + // Extract vertex stats + const auto vert_stats = GetVertexStats(source, geom_type); + auto &extent = GeometryStats::GetExtent(target); + extent.x_min = NumericStats::GetMin(vert_stats[0]); + extent.x_max = NumericStats::GetMax(vert_stats[0]); + extent.y_min = NumericStats::GetMin(vert_stats[1]); + extent.y_max = NumericStats::GetMax(vert_stats[1]); + + switch (vert_type) { + case VertexType::XYZ: + extent.z_min = NumericStats::GetMin(vert_stats[2]); + extent.z_max = NumericStats::GetMax(vert_stats[2]); + break; + case VertexType::XYM: + extent.m_min = NumericStats::GetMin(vert_stats[2]); + extent.m_max = NumericStats::GetMax(vert_stats[2]); + break; + case VertexType::XYZM: + extent.z_min = NumericStats::GetMin(vert_stats[2]); + extent.z_max = NumericStats::GetMax(vert_stats[2]); + extent.m_min = NumericStats::GetMin(vert_stats[3]); + extent.m_max = NumericStats::GetMax(vert_stats[3]); + break; + default: + // Nothing to do + break; + } + + // Set types + auto &types = GeometryStats::GetTypes(target); + types.Clear(); + types.Add(geom_type, vert_type); + + // Also set non-empty flag + auto &geo_flags = GeometryStats::GetFlags(target); + geo_flags.Clear(); + geo_flags.SetHasNonEmptyGeometry(); + geo_flags.SetHasNonEmptyPart(); +} + +} // namespace duckdb diff --git a/src/duckdb/src/storage/table/list_column_data.cpp b/src/duckdb/src/storage/table/list_column_data.cpp index cbf65a0f4..13b0fa691 100644 --- a/src/duckdb/src/storage/table/list_column_data.cpp +++ b/src/duckdb/src/storage/table/list_column_data.cpp @@ -326,6 +326,14 @@ void ListColumnData::VisitBlockIds(BlockIdVisitor &visitor) const { child_column->VisitBlockIds(visitor); } +const BaseStatistics &ListColumnData::GetChildStats(const ColumnData &child) const { + if (!RefersToSameObject(child, *child_column)) { + throw InternalException("ListColumnData::GetChildStats provided column data is not a child of this list"); + } + auto &stats = GetStatisticsRef(); + return ListStats::GetChildStats(stats); +} + void ListColumnData::SetValidityData(shared_ptr validity_p) { if (validity) { throw InternalException("ListColumnData::SetValidityData cannot be used to overwrite existing validity"); @@ -390,10 +398,11 @@ unique_ptr ListColumnData::CreateCheckpointState(const Ro } unique_ptr ListColumnData::Checkpoint(const RowGroup &row_group, - ColumnCheckpointInfo &checkpoint_info) { - auto base_state = ColumnData::Checkpoint(row_group, checkpoint_info); - auto validity_state = validity->Checkpoint(row_group, checkpoint_info); - auto child_state = child_column->Checkpoint(row_group, checkpoint_info); + ColumnCheckpointInfo &checkpoint_info, + const BaseStatistics &old_stats) { + auto base_state = ColumnData::Checkpoint(row_group, checkpoint_info, old_stats); + auto validity_state = validity->Checkpoint(row_group, checkpoint_info, old_stats); + auto child_state = child_column->Checkpoint(row_group, checkpoint_info, ListStats::GetChildStats(old_stats)); auto &checkpoint_state = base_state->Cast(); checkpoint_state.validity_state = std::move(validity_state); diff --git a/src/duckdb/src/storage/table/row_group.cpp b/src/duckdb/src/storage/table/row_group.cpp index b0650b994..2ce3bfe9f 100644 --- a/src/duckdb/src/storage/table/row_group.cpp +++ b/src/duckdb/src/storage/table/row_group.cpp @@ -187,16 +187,18 @@ void RowGroup::InitializeEmpty(const vector &types, ColumnDataType } } -static unique_ptr CreateCast(ClientContext &context, const LogicalType &original_type, - const LogicalType &cast_type) { - auto input = make_uniq(original_type, 0U); - auto cast_expression = BoundCastExpression::AddCastToType(context, std::move(input), cast_type); - auto res = make_uniq(context); - res->target.Initialize(context, {cast_type}); - res->input.Initialize(context, {original_type}); - res->executor.AddExpression(*cast_expression); - res->expression = std::move(cast_expression); - return res; +void ColumnScanState::PushDownCast(const LogicalType &original_type, const LogicalType &cast_type) { + D_ASSERT(context.Valid()); + D_ASSERT(!expression_state); + auto &client_context = *context.GetClientContext(); + + auto input = make_uniq(original_type, 0); + auto cast_expression = BoundCastExpression::AddCastToType(client_context, std::move(input), cast_type); + expression_state = make_uniq(client_context); + expression_state->target.Initialize(client_context, {cast_type}); + expression_state->input.Initialize(client_context, {original_type}); + expression_state->executor.AddExpression(*cast_expression); + expression_state->expression = std::move(cast_expression); } void ColumnScanState::Initialize(const QueryContext &context_p, const LogicalType &type, const StorageIndex &column_id, @@ -217,6 +219,13 @@ void ColumnScanState::Initialize(const QueryContext &context_p, const LogicalTyp // variant - column scan states are created later // this is done because the internal shape of the VARIANT is different per rowgroup scan_child_column.resize(2, true); + if (!storage_index.IsPushdownExtract()) { + return; + } + auto &scan_type = storage_index.GetScanType(); + if (scan_type.id() != LogicalTypeId::VARIANT) { + PushDownCast(type, scan_type); + } return; } @@ -244,7 +253,7 @@ void ColumnScanState::Initialize(const QueryContext &context_p, const LogicalTyp auto child_index = child.GetPrimaryIndex(); auto &child_type = StructType::GetChildTypes(type)[child_index].second; if (!child.HasChildren() && child_type != child.GetType()) { - expression_state = CreateCast(*context.GetClientContext(), child_type, child.GetType()); + PushDownCast(child_type, child.GetType()); } child_states[1].Initialize(context, struct_children[child_index].second, child, options); } else { @@ -1178,7 +1187,7 @@ const vector &RowGroup::GetColumnStartPointers() const { } RowGroupWriteData RowGroup::WriteToDisk(RowGroupWriter &writer) { - if (DBConfig::GetSetting(writer.GetDatabase()) && !column_pointers.empty() && + if (Settings::Get(writer.GetDatabase()) && !column_pointers.empty() && !HasChanges()) { // we have existing metadata and the row group has not been changed // re-use previous metadata diff --git a/src/duckdb/src/storage/table/row_group_collection.cpp b/src/duckdb/src/storage/table/row_group_collection.cpp index 66f6d3fec..9716711d5 100644 --- a/src/duckdb/src/storage/table/row_group_collection.cpp +++ b/src/duckdb/src/storage/table/row_group_collection.cpp @@ -227,7 +227,7 @@ void RowGroupCollection::InitializeScanWithOffset(const QueryContext &context, C } } -bool RowGroupCollection::InitializeScanInRowGroup(const QueryContext &context, CollectionScanState &state, +bool RowGroupCollection::InitializeScanInRowGroup(ClientContext &context, CollectionScanState &state, RowGroupCollection &collection, SegmentNode &row_group, idx_t vector_index, idx_t max_row) { state.max_row = max_row; @@ -1394,7 +1394,7 @@ void RowGroupCollection::Checkpoint(TableDataWriter &writer, TableStatistics &gl try { // schedule tasks idx_t total_vacuum_tasks = 0; - auto max_vacuum_tasks = DBConfig::GetSetting(writer.GetDatabase()); + auto max_vacuum_tasks = Settings::Get(writer.GetDatabase()); for (idx_t segment_idx = 0; segment_idx < checkpoint_state.SegmentCount(); segment_idx++) { auto vacuum_tasks = ScheduleVacuumTasks(checkpoint_state, vacuum_state, segment_idx, total_vacuum_tasks < max_vacuum_tasks); @@ -1432,7 +1432,7 @@ void RowGroupCollection::Checkpoint(TableDataWriter &writer, TableStatistics &gl // no errors - finalize the row groups // if the table already exists on disk - check if all row groups have stayed the same - if (DBConfig::GetSetting(writer.GetDatabase()) && metadata_pointer.IsValid()) { + if (Settings::Get(writer.GetDatabase()) && metadata_pointer.IsValid()) { bool table_has_changes = false; for (idx_t segment_idx = 0; segment_idx < checkpoint_state.SegmentCount(); segment_idx++) { if (checkpoint_state.SegmentIsDropped(segment_idx)) { @@ -1511,7 +1511,7 @@ void RowGroupCollection::Checkpoint(TableDataWriter &writer, TableStatistics &gl new_row_group = entry->ReferenceNode(); } RowGroupPointer pointer_copy; - auto debug_verify_blocks = DBConfig::GetSetting(GetAttached().GetDatabase()) && + auto debug_verify_blocks = Settings::Get(GetAttached().GetDatabase()) && dynamic_cast(&checkpoint_state.writer) != nullptr; // check if we should write this row group to the persistent storage diff --git a/src/duckdb/src/storage/table/row_id_column_data.cpp b/src/duckdb/src/storage/table/row_id_column_data.cpp index 235244c19..0c648892b 100644 --- a/src/duckdb/src/storage/table/row_id_column_data.cpp +++ b/src/duckdb/src/storage/table/row_id_column_data.cpp @@ -155,7 +155,8 @@ unique_ptr RowIdColumnData::CreateCheckpointState(const R throw InternalException("RowIdColumnData cannot be checkpointed"); } -unique_ptr RowIdColumnData::Checkpoint(const RowGroup &row_group, ColumnCheckpointInfo &info) { +unique_ptr RowIdColumnData::Checkpoint(const RowGroup &row_group, ColumnCheckpointInfo &info, + const BaseStatistics &old_stats) { throw InternalException("RowIdColumnData cannot be checkpointed"); } diff --git a/src/duckdb/src/storage/table/standard_column_data.cpp b/src/duckdb/src/storage/table/standard_column_data.cpp index 0f84aa0b8..6fb6312c1 100644 --- a/src/duckdb/src/storage/table/standard_column_data.cpp +++ b/src/duckdb/src/storage/table/standard_column_data.cpp @@ -260,7 +260,8 @@ StandardColumnData::CreateCheckpointState(const RowGroup &row_group, PartialBloc } unique_ptr StandardColumnData::Checkpoint(const RowGroup &row_group, - ColumnCheckpointInfo &checkpoint_info) { + ColumnCheckpointInfo &checkpoint_info, + const BaseStatistics &stats) { // we need to checkpoint the main column data first // that is because the checkpointing of the main column data ALSO scans the validity data // to prevent reading the validity data immediately after it is checkpointed we first checkpoint the main column diff --git a/src/duckdb/src/storage/table/struct_column_data.cpp b/src/duckdb/src/storage/table/struct_column_data.cpp index 7d134f60c..0ab6ab90e 100644 --- a/src/duckdb/src/storage/table/struct_column_data.cpp +++ b/src/duckdb/src/storage/table/struct_column_data.cpp @@ -48,9 +48,8 @@ idx_t StructColumnData::GetMaxEntry() { return sub_columns[0]->GetMaxEntry(); } -void StructColumnData::IterateFields( - ColumnScanState &state, - const std::function &callback) { +vector StructColumnData::GetStructChildren(ColumnScanState &state) const { + vector res; if (state.storage_index.IsPushdownExtract()) { auto &index_children = state.storage_index.GetChildIndexes(); D_ASSERT(index_children.size() == 1); @@ -58,25 +57,25 @@ void StructColumnData::IterateFields( auto child_index = child_storage_index.GetPrimaryIndex(); auto &field_state = state.child_states[1]; D_ASSERT(state.scan_child_column[0]); - callback(child_index, optional_idx(), field_state, true); + res.emplace_back(*sub_columns[child_index], optional_idx(), field_state, true); } else { for (idx_t i = 0; i < sub_columns.size(); i++) { auto &field_state = state.child_states[1 + i]; - callback(i, i, field_state, state.scan_child_column[i]); + res.emplace_back(*sub_columns[i], i, field_state, state.scan_child_column[i]); } } + return res; } void StructColumnData::InitializePrefetch(PrefetchState &prefetch_state, ColumnScanState &scan_state, idx_t rows) { validity->InitializePrefetch(prefetch_state, scan_state.child_states[0], rows); - IterateFields(scan_state, [&](idx_t child_index, optional_idx field_vector_index, ColumnScanState &field_state, - bool should_scan) { - if (!should_scan) { - return; + auto struct_children = GetStructChildren(scan_state); + for (auto &child : struct_children) { + if (!child.should_scan) { + continue; } - auto &field = *sub_columns[child_index]; - field.InitializePrefetch(prefetch_state, field_state, rows); - }); + child.col.InitializePrefetch(prefetch_state, child.state, rows); + } } void StructColumnData::InitializeScan(ColumnScanState &state) { @@ -87,14 +86,13 @@ void StructColumnData::InitializeScan(ColumnScanState &state) { validity->InitializeScan(state.child_states[0]); // initialize the sub-columns - IterateFields( - state, [&](idx_t child_index, optional_idx field_vector_index, ColumnScanState &field_state, bool should_scan) { - if (!should_scan) { - return; - } - auto &field = *sub_columns[child_index]; - field.InitializeScan(field_state); - }); + auto struct_children = GetStructChildren(state); + for (auto &child : struct_children) { + if (!child.should_scan) { + continue; + } + child.col.InitializeScan(child.state); + } } void StructColumnData::InitializeScanWithOffset(ColumnScanState &state, idx_t row_idx) { @@ -106,14 +104,13 @@ void StructColumnData::InitializeScanWithOffset(ColumnScanState &state, idx_t ro validity->InitializeScanWithOffset(state.child_states[0], row_idx); // initialize the sub-columns - IterateFields( - state, [&](idx_t child_index, optional_idx field_vector_index, ColumnScanState &field_state, bool should_scan) { - if (!should_scan) { - return; - } - auto &field = *sub_columns[child_index]; - field.InitializeScanWithOffset(field_state, row_idx); - }); + auto struct_children = GetStructChildren(state); + for (auto &child : struct_children) { + if (!child.should_scan) { + continue; + } + child.col.InitializeScanWithOffset(child.state, row_idx); + } } static Vector &GetFieldVectorForScan(Vector &result, optional_idx field_index) { @@ -148,39 +145,38 @@ static void ScanChild(ColumnScanState &state, Vector &result, const std::functio idx_t StructColumnData::Scan(TransactionData transaction, idx_t vector_index, ColumnScanState &state, Vector &result, idx_t target_count) { auto scan_count = validity->Scan(transaction, vector_index, state.child_states[0], result, target_count); - IterateFields( - state, [&](idx_t child_index, optional_idx field_vector_index, ColumnScanState &field_state, bool should_scan) { - auto &target_vector = GetFieldVectorForScan(result, field_vector_index); - if (!should_scan) { - // if we are not scanning this vector - set it to NULL - target_vector.SetVectorType(VectorType::CONSTANT_VECTOR); - ConstantVector::SetNull(target_vector, true); - return; - } - auto &field = *sub_columns[child_index]; - ScanChild(state, target_vector, [&](Vector &child_result) { - return field.Scan(transaction, vector_index, field_state, child_result, target_count); - }); - }); + auto struct_children = GetStructChildren(state); + for (auto &child : struct_children) { + auto &target_vector = GetFieldVectorForScan(result, child.vector_index); + if (!child.should_scan) { + // if we are not scanning this vector - set it to NULL + target_vector.SetVectorType(VectorType::CONSTANT_VECTOR); + ConstantVector::SetNull(target_vector, true); + continue; + } + ScanChild(state, target_vector, [&](Vector &child_result) { + return child.col.Scan(transaction, vector_index, child.state, child_result, target_count); + }); + } return scan_count; } idx_t StructColumnData::ScanCount(ColumnScanState &state, Vector &result, idx_t count, idx_t result_offset) { auto scan_count = validity->ScanCount(state.child_states[0], result, count); - IterateFields( - state, [&](idx_t child_index, optional_idx field_vector_index, ColumnScanState &field_state, bool should_scan) { - auto &target_vector = GetFieldVectorForScan(result, field_vector_index); - if (!should_scan) { - // if we are not scanning this vector - set it to NULL - target_vector.SetVectorType(VectorType::CONSTANT_VECTOR); - ConstantVector::SetNull(target_vector, true); - return; - } - auto &field = *sub_columns[child_index]; - ScanChild(state, target_vector, [&](Vector &child_result) { - return field.ScanCount(field_state, child_result, count, result_offset); - }); - }); + + auto struct_children = GetStructChildren(state); + for (auto &child : struct_children) { + auto &target_vector = GetFieldVectorForScan(result, child.vector_index); + if (!child.should_scan) { + // if we are not scanning this vector - set it to NULL + target_vector.SetVectorType(VectorType::CONSTANT_VECTOR); + ConstantVector::SetNull(target_vector, true); + continue; + } + ScanChild(state, target_vector, [&](Vector &child_result) { + return child.col.ScanCount(child.state, child_result, count, result_offset); + }); + } return scan_count; } @@ -188,14 +184,13 @@ void StructColumnData::Skip(ColumnScanState &state, idx_t count) { validity->Skip(state.child_states[0], count); // skip inside the sub-columns - IterateFields( - state, [&](idx_t child_index, optional_idx field_vector_index, ColumnScanState &field_state, bool should_scan) { - if (!should_scan) { - return; - } - auto &field = *sub_columns[child_index]; - field.Skip(field_state, count); - }); + auto struct_children = GetStructChildren(state); + for (auto &child : struct_children) { + if (!child.should_scan) { + continue; + } + child.col.Skip(child.state, count); + } } void StructColumnData::InitializeAppend(ColumnAppendState &state) { @@ -357,6 +352,29 @@ void StructColumnData::SetChildData(idx_t i, shared_ptr child_column this->sub_columns[i] = std::move(child_column_p); } +const ColumnData &StructColumnData::GetChildColumn(idx_t index) const { + D_ASSERT(index < sub_columns.size()); + return *sub_columns[index]; +} + +const BaseStatistics &StructColumnData::GetChildStats(const ColumnData &child) const { + optional_idx index; + for (idx_t i = 0; i < sub_columns.size(); i++) { + if (RefersToSameObject(child, *sub_columns[i])) { + index = i; + break; + } + } + if (!index.IsValid()) { + throw InternalException("StructColumnData::GetChildStats: Could not find a matching child index for the " + "provided child (of type %s)", + child.type.ToString()); + } + auto idx = index.GetIndex(); + auto &stats = GetStatisticsRef(); + return StructStats::GetChildStats(stats, idx); +} + struct StructColumnCheckpointState : public ColumnCheckpointState { StructColumnCheckpointState(const RowGroup &row_group, ColumnData &column_data, PartialBlockManager &partial_block_manager) @@ -411,12 +429,16 @@ unique_ptr StructColumnData::CreateCheckpointState(const } unique_ptr StructColumnData::Checkpoint(const RowGroup &row_group, - ColumnCheckpointInfo &checkpoint_info) { + ColumnCheckpointInfo &checkpoint_info, + const BaseStatistics &old_stats) { auto &partial_block_manager = checkpoint_info.GetPartialBlockManager(); auto checkpoint_state = make_uniq(row_group, *this, partial_block_manager); - checkpoint_state->validity_state = validity->Checkpoint(row_group, checkpoint_info); - for (auto &sub_column : sub_columns) { - checkpoint_state->child_states.push_back(sub_column->Checkpoint(row_group, checkpoint_info)); + checkpoint_state->validity_state = validity->Checkpoint(row_group, checkpoint_info, old_stats); + + for (idx_t col_idx = 0; col_idx < sub_columns.size(); col_idx++) { + const auto &sub_column = sub_columns[col_idx]; + const auto &old_child_stats = StructStats::GetChildStats(old_stats, col_idx); + checkpoint_state->child_states.push_back(sub_column->Checkpoint(row_group, checkpoint_info, old_child_stats)); } return std::move(checkpoint_state); } diff --git a/src/duckdb/src/storage/table/variant_column_data.cpp b/src/duckdb/src/storage/table/variant_column_data.cpp index cf168902a..1befb2685 100644 --- a/src/duckdb/src/storage/table/variant_column_data.cpp +++ b/src/duckdb/src/storage/table/variant_column_data.cpp @@ -1,10 +1,14 @@ #include "duckdb/storage/table/variant_column_data.hpp" +#include "duckdb/storage/table/struct_column_data.hpp" #include "duckdb/common/serializer/deserializer.hpp" #include "duckdb/storage/table/column_checkpoint_state.hpp" #include "duckdb/storage/table/append_state.hpp" #include "duckdb/storage/table/scan_state.hpp" #include "duckdb/storage/statistics/variant_stats.hpp" +#include "duckdb/storage/statistics/struct_stats.hpp" #include "duckdb/function/variant/variant_shredding.hpp" +#include "duckdb/main/settings.hpp" +#include "duckdb/transaction/duck_transaction.hpp" namespace duckdb { @@ -27,6 +31,106 @@ VariantColumnData::VariantColumnData(BlockManager &block_manager, DataTableInfo } } +bool FindShreddedColumnInternal(const StructColumnData &shredded, reference &stats, + reference &path_iter, ColumnIndex &out) { + auto &path = path_iter.get(); + D_ASSERT(!path.HasPrimaryIndex()); + auto &field_name = path.GetFieldName(); + + D_ASSERT(shredded.type.id() == LogicalTypeId::STRUCT); + auto &typed_value = shredded.GetChildColumn(1); + auto &parent_stats = stats.get(); + + stats = StructStats::GetChildStats(parent_stats, 1); + if (typed_value.type.id() != LogicalTypeId::STRUCT) { + //! Not shredded on an OBJECT, but we're looking for a specific OBJECT field + return false; + } + if (!VariantShreddedStats::IsFullyShredded(parent_stats)) { + //! Can't push down to the shredded data, stats are inconsistent + return false; + } + //! shredded.typed_value + out.AddChildIndex(ColumnIndex(1)); + auto &typed_value_index = out.GetChildIndex(0); + + auto &object_children = StructType::GetChildTypes(typed_value.type); + optional_idx opt_index; + for (idx_t i = 0; i < object_children.size(); i++) { + if (StringUtil::CIEquals(field_name, object_children[i].first)) { + opt_index = i; + break; + } + } + if (!opt_index.IsValid()) { + //! OBJECT doesn't contain a field with this name + return false; + } + + auto child_index = opt_index.GetIndex(); + auto &typed_value_struct = typed_value.Cast(); + auto &object_field = typed_value_struct.GetChildColumn(child_index); + stats = StructStats::GetChildStats(stats.get(), child_index); + + //! typed_value. + typed_value_index.AddChildIndex(ColumnIndex(child_index)); + auto &child_column = typed_value_index.GetChildIndex(0); + + if (!path.HasChildren()) { + if (!VariantShreddedStats::IsFullyShredded(stats.get())) { + //! Child isn't fully shredded, can't use it + return false; + } + //! We're done, we've found the field referenced by the path! + //! typed_value_index..typed_value + child_column.AddChildIndex(ColumnIndex(1)); + stats = StructStats::GetChildStats(stats.get(), 1); + return true; + } + path_iter = path.GetChildIndex(0); + + //! Child of object is always a STRUCT(untyped_value_index UINTEGER, typed_value <...>) + D_ASSERT(object_field.type.id() == LogicalTypeId::STRUCT); + auto &struct_field = object_field.Cast(); + + return FindShreddedColumnInternal(struct_field, stats, path_iter, child_column); +} + +bool VariantColumnData::PushdownShreddedFieldExtract(const StorageIndex &variant_extract, + StorageIndex &out_struct_extract) const { + D_ASSERT(IsShredded()); + auto &shredded = *sub_columns[1]; + D_ASSERT(shredded.type.id() == LogicalTypeId::STRUCT); + D_ASSERT(StructType::GetChildCount(shredded.type) == 2); + D_ASSERT(StructType::GetChildTypes(shredded.type)[0].second.id() == LogicalTypeId::UINTEGER); + auto &variant_stats = GetStatisticsRef(); + + if (!VariantStats::IsShredded(variant_stats)) { + //! FIXME: this happens when we Checkpoint but don't restart, the stats of the ColumnData aren't updated by + //! Checkpoint The variant is shredded, but there are no stats / the stats are cluttered (?) + return false; + } + + //! shredded.typed_value + ColumnIndex column_index(0); + auto &struct_column = shredded.Cast(); + + reference shredded_stats(VariantStats::GetShreddedStats(variant_stats)); + reference path_iter(variant_extract); + if (!FindShreddedColumnInternal(struct_column, shredded_stats, path_iter, column_index)) { + return false; + } + if (shredded_stats.get().GetType().IsNested()) { + //! Can't push down an extract if the leaf we're extracting is not a primitive + //! (Since the shredded representation for OBJECT/ARRAY is interleaved with 'untyped_value_index' fields) + return false; + } + + column_index.SetPushdownExtractType(shredded.type, path_iter.get().GetType()); + out_struct_extract = StorageIndex::FromColumnIndex(column_index); + return true; +} + void VariantColumnData::CreateScanStates(ColumnScanState &state) { //! Re-initialize the scan state, since VARIANT can have a different shape for every RowGroup state.child_states.clear(); @@ -37,9 +141,22 @@ void VariantColumnData::CreateScanStates(ColumnScanState &state) { auto unshredded_type = VariantShredding::GetUnshreddedType(); state.child_states.emplace_back(state.parent); state.child_states[1].Initialize(state.context, unshredded_type, state.scan_options); + + const bool is_pushed_down_cast = + state.storage_index.HasType() && state.storage_index.GetScanType().id() != LogicalTypeId::VARIANT; if (IsShredded()) { auto &shredded_column = sub_columns[1]; state.child_states.emplace_back(state.parent); + if (state.storage_index.IsPushdownExtract() && is_pushed_down_cast) { + StorageIndex struct_extract; + if (PushdownShreddedFieldExtract(state.storage_index.GetChildIndex(0), struct_extract)) { + //! Shredded field exists and is fully shredded, + //! add the storage index to create a pushed-down 'struct_extract' to get the leaf + state.child_states[2].Initialize(state.context, shredded_column->type, struct_extract, + state.scan_options); + return; + } + } state.child_states[2].Initialize(state.context, shredded_column->type, state.scan_options); } } @@ -49,6 +166,7 @@ idx_t VariantColumnData::GetMaxEntry() { } void VariantColumnData::InitializePrefetch(PrefetchState &prefetch_state, ColumnScanState &scan_state, idx_t rows) { + //! FIXME: does this also need CreateScanStates ?? validity->InitializePrefetch(prefetch_state, scan_state.child_states[0], rows); for (idx_t i = 0; i < sub_columns.size(); i++) { sub_columns[i]->InitializePrefetch(prefetch_state, scan_state.child_states[i + 1], rows); @@ -81,7 +199,7 @@ void VariantColumnData::InitializeScanWithOffset(ColumnScanState &state, idx_t r } } -Vector VariantColumnData::CreateUnshreddingIntermediate(idx_t count) { +Vector VariantColumnData::CreateUnshreddingIntermediate(idx_t count) const { D_ASSERT(IsShredded()); D_ASSERT(sub_columns.size() == 2); @@ -93,26 +211,119 @@ Vector VariantColumnData::CreateUnshreddingIntermediate(idx_t count) { return intermediate; } -idx_t VariantColumnData::Scan(TransactionData transaction, idx_t vector_index, ColumnScanState &state, Vector &result, - idx_t target_count) { - if (IsShredded()) { - auto intermediate = CreateUnshreddingIntermediate(target_count); - auto &child_vectors = StructVector::GetEntries(intermediate); - sub_columns[0]->Scan(transaction, vector_index, state.child_states[1], *child_vectors[0], target_count); - sub_columns[1]->Scan(transaction, vector_index, state.child_states[2], *child_vectors[1], target_count); - auto scan_count = validity->Scan(transaction, vector_index, state.child_states[0], intermediate, target_count); +idx_t VariantColumnData::ScanWithCallback( + ColumnScanState &state, Vector &result, idx_t target_count, + const std::function + &callback) const { + if (state.storage_index.IsPushdownExtract()) { + if (IsShredded() && state.child_states[2].storage_index.IsPushdownExtract()) { + //! FIXME: We could also push down the extract if we're returning VARIANT + //! Then we can do the unshredding on the extracted data, rather than falling back to unshredding+extracting + //! This invariant is ensured by CreateScanStates + D_ASSERT(result.GetType().id() != LogicalTypeId::VARIANT); + + //! In the initialize we have verified that the field exists and the data is fully shredded (for this + //! rowgroup) We have created a scan state that performs a 'struct_extract' in the shredded data, to extract + //! the requested field.s + auto res = callback(*sub_columns[1], state.child_states[2], result, target_count); + if (result.GetType().id() == LogicalTypeId::LIST) { + //! Shredded ARRAY Variant looks like: + //! LIST(STRUCT(untyped_value_index UINTEGER, typed_value )) + //! We need to transform this to: + //! LIST() + + auto &list_child = ListVector::GetEntry(result); + D_ASSERT(list_child.GetType().id() == LogicalTypeId::STRUCT); + D_ASSERT(StructType::GetChildCount(list_child.GetType()) == 2); + + auto &typed_value = *StructVector::GetEntries(list_child)[1]; + auto list_res = Vector(LogicalType::LIST(typed_value.GetType())); + ListVector::SetListSize(list_res, ListVector::GetListSize(result)); + list_res.CopyBuffer(result); + ListVector::GetEntry(list_res).Reference(typed_value); + return res; + } + return res; + } + //! Fall back to unshredding + Vector intermediate(LogicalType::VARIANT(), target_count); + idx_t scan_count; + if (IsShredded()) { + auto unshredding_intermediate = CreateUnshreddingIntermediate(target_count); + auto &child_vectors = StructVector::GetEntries(unshredding_intermediate); + + callback(*sub_columns[0], state.child_states[1], *child_vectors[0], target_count); + callback(*sub_columns[1], state.child_states[2], *child_vectors[1], target_count); + scan_count = callback(*validity, state.child_states[0], unshredding_intermediate, target_count); + + VariantColumnData::UnshredVariantData(unshredding_intermediate, intermediate, target_count); + } else { + scan_count = callback(*validity, state.child_states[0], intermediate, target_count); + callback(*sub_columns[0], state.child_states[1], intermediate, target_count); + } + + Vector extract_intermediate(LogicalType::VARIANT(), target_count); + vector components; + reference path_iter(state.storage_index.GetChildIndex(0)); + + while (true) { + auto ¤t = path_iter.get(); + auto &field_name = current.GetFieldName(); + components.emplace_back(field_name); + if (!current.HasChildren()) { + break; + } + path_iter = current.GetChildIndex(0); + } + VariantUtils::VariantExtract(intermediate, components, extract_intermediate, target_count); + + if (state.expression_state) { + auto &expression_state = *state.expression_state; + auto &executor = expression_state.executor; + + auto &input = expression_state.input; + auto &target = expression_state.target; + input.Reset(); + target.Reset(); + input.data[0].Reference(extract_intermediate); + input.SetCardinality(scan_count); + executor.Execute(input, target); + result.Reference(target.data[0]); + } else { + result.Reference(extract_intermediate); + } + return scan_count; + } else { + if (IsShredded()) { + auto intermediate = CreateUnshreddingIntermediate(target_count); + auto &child_vectors = StructVector::GetEntries(intermediate); - VariantColumnData::UnshredVariantData(intermediate, result, target_count); + callback(*sub_columns[0], state.child_states[1], *child_vectors[0], target_count); + callback(*sub_columns[1], state.child_states[2], *child_vectors[1], target_count); + auto scan_count = callback(*validity, state.child_states[0], intermediate, target_count); + + VariantColumnData::UnshredVariantData(intermediate, result, target_count); + return scan_count; + } + auto scan_count = callback(*validity, state.child_states[0], result, target_count); + callback(*sub_columns[0], state.child_states[1], result, target_count); return scan_count; } - auto scan_count = validity->Scan(transaction, vector_index, state.child_states[0], result, target_count); - sub_columns[0]->Scan(transaction, vector_index, state.child_states[1], result, target_count); - return scan_count; +} + +idx_t VariantColumnData::Scan(TransactionData transaction, idx_t vector_index, ColumnScanState &state, Vector &result, + idx_t target_count) { + return ScanWithCallback(state, result, target_count, + [&](ColumnData &col, ColumnScanState &child_state, Vector &target_vector, idx_t count) { + return col.Scan(transaction, vector_index, child_state, target_vector, count); + }); } idx_t VariantColumnData::ScanCount(ColumnScanState &state, Vector &result, idx_t count, idx_t result_offset) { - auto scan_count = sub_columns[0]->ScanCount(state.child_states[1], result, count, result_offset); - return scan_count; + return ScanWithCallback(state, result, count, + [&](ColumnData &col, ColumnScanState &child_state, Vector &target_vector, idx_t count) { + return col.ScanCount(child_state, target_vector, count, result_offset); + }); } void VariantColumnData::Skip(ColumnScanState &state, idx_t count) { @@ -242,35 +453,73 @@ unique_ptr VariantColumnData::GetUpdateStatistics() { void VariantColumnData::FetchRow(TransactionData transaction, ColumnFetchState &state, const StorageIndex &storage_index, row_t row_id, Vector &result, idx_t result_idx) { - // insert any child states that are required - for (idx_t i = state.child_states.size(); i < sub_columns.size() + 1; i++) { - auto child_state = make_uniq(); - state.child_states.push_back(std::move(child_state)); + if (storage_index.IsPushdownExtract() && IsShredded()) { + StorageIndex struct_extract; + if (PushdownShreddedFieldExtract(storage_index.GetChildIndex(0), struct_extract)) { + //! Shredded field exists and is fully shredded, + //! add the storage index to create a pushed-down 'struct_extract' to get the leaf + sub_columns[1]->FetchRow(transaction, state, struct_extract, row_id, result, result_idx); + return; + } } - + Vector variant_vec(LogicalType::VARIANT(), result_idx + 1); + validity->FetchRow(transaction, state, storage_index, row_id, variant_vec, result_idx); if (IsShredded()) { auto intermediate = CreateUnshreddingIntermediate(result_idx + 1); auto &child_vectors = StructVector::GetEntries(intermediate); // fetch the validity state - validity->FetchRow(transaction, *state.child_states[0], storage_index, row_id, result, result_idx); // fetch the sub-column states + StorageIndex empty(0); for (idx_t i = 0; i < sub_columns.size(); i++) { - sub_columns[i]->FetchRow(transaction, *state.child_states[i + 1], storage_index, row_id, *child_vectors[i], - result_idx); + sub_columns[i]->FetchRow(transaction, state, empty, row_id, *child_vectors[i], result_idx); } if (result_idx) { intermediate.SetValue(0, intermediate.GetValue(result_idx)); } - //! FIXME: adjust UnshredVariantData so we can write the value in place into 'result' directly. - Vector unshredded(result.GetType(), 1); + //! FIXME: adjust UnshredVariantData so we can write the value in place directly. + Vector unshredded(variant_vec.GetType(), 1); VariantColumnData::UnshredVariantData(intermediate, unshredded, 1); - result.SetValue(result_idx, unshredded.GetValue(0)); + variant_vec.SetValue(0, unshredded.GetValue(0)); + } else { + sub_columns[0]->FetchRow(transaction, state, storage_index, row_id, variant_vec, result_idx); + if (result_idx) { + variant_vec.SetValue(0, variant_vec.GetValue(result_idx)); + } + } + + if (!storage_index.IsPushdownExtract()) { + //! No extract required + D_ASSERT(result.GetType().id() == LogicalTypeId::VARIANT); + result.SetValue(result_idx, variant_vec.GetValue(0)); return; } - validity->FetchRow(transaction, *state.child_states[0], storage_index, row_id, result, result_idx); - sub_columns[0]->FetchRow(transaction, *state.child_states[1], storage_index, row_id, result, result_idx); + Vector extracted_variant(variant_vec.GetType(), 1); + vector components; + reference path_iter(storage_index.GetChildIndex(0)); + + while (true) { + auto ¤t = path_iter.get(); + auto &field_name = current.GetFieldName(); + components.emplace_back(field_name); + if (!current.HasChildren()) { + break; + } + path_iter = current.GetChildIndex(0); + } + VariantUtils::VariantExtract(variant_vec, components, extracted_variant, 1); + + if (result.GetType().id() == LogicalTypeId::VARIANT) { + //! No cast required + result.SetValue(result_idx, extracted_variant.GetValue(0)); + return; + } + + //! Need to perform the cast here as well + auto context = transaction.transaction->context.lock(); + auto fetched_row = extracted_variant.GetValue(0).CastAs(*context, result.GetType()); + result.SetValue(result_idx, fetched_row); } void VariantColumnData::VisitBlockIds(BlockIdVisitor &visitor) const { @@ -345,11 +594,13 @@ struct VariantColumnCheckpointState : public ColumnCheckpointState { PersistentColumnData ToPersistentData() override { PersistentColumnData data(original_column.type); - auto &variant_column_data = GetResultColumn().Cast(); if (child_states.size() == 2) { - D_ASSERT(variant_column_data.sub_columns.size() == 2); - D_ASSERT(variant_column_data.sub_columns[1]->type.id() == LogicalTypeId::STRUCT); - data.SetVariantShreddedType(variant_column_data.sub_columns[1]->type); + //! Use the type of the column data we used to create the Checkpoint + //! This will either be a pointer to shredded_data[1] if we decided to shred + //! Or to the existing shredded column data if we didn't decide to reshred + auto &shredded_state = child_states[1]; + D_ASSERT(shredded_state->original_column.type.id() == LogicalTypeId::STRUCT); + data.extra_data = make_uniq(shredded_state->original_column.type); } data.child_columns.push_back(validity_state->ToPersistentData()); for (auto &child_state : child_states) { @@ -452,27 +703,28 @@ static bool EnableShredding(int64_t minimum_size, idx_t current_size) { } unique_ptr VariantColumnData::Checkpoint(const RowGroup &row_group, - ColumnCheckpointInfo &checkpoint_info) { + ColumnCheckpointInfo &checkpoint_info, + const BaseStatistics &old_stats) { auto &partial_block_manager = checkpoint_info.GetPartialBlockManager(); auto checkpoint_state = make_uniq(row_group, *this, partial_block_manager); - checkpoint_state->validity_state = validity->Checkpoint(row_group, checkpoint_info); + checkpoint_state->validity_state = validity->Checkpoint(row_group, checkpoint_info, old_stats); auto &table_info = row_group.GetTableInfo(); auto &db = table_info.GetDB(); - auto &config_options = DBConfig::Get(db).options; + auto &config = DBConfig::Get(db); bool should_shred = true; if (!HasAnyChanges()) { should_shred = false; } - if (!EnableShredding(config_options.variant_minimum_shredding_size, row_group.count.load())) { + if (!EnableShredding(Settings::Get(config), row_group.count.load())) { should_shred = false; } LogicalType shredded_type; if (should_shred) { - if (config_options.force_variant_shredding.id() != LogicalTypeId::INVALID) { - shredded_type = config_options.force_variant_shredding; + if (config.options.force_variant_shredding.id() != LogicalTypeId::INVALID) { + shredded_type = config.options.force_variant_shredding; } else { shredded_type = GetShreddedType(); } @@ -485,8 +737,11 @@ unique_ptr VariantColumnData::Checkpoint(const RowGroup & } if (!should_shred) { - for (idx_t i = 0; i < sub_columns.size(); i++) { - checkpoint_state->child_states.push_back(sub_columns[i]->Checkpoint(row_group, checkpoint_info)); + checkpoint_state->child_states.push_back( + sub_columns[0]->Checkpoint(row_group, checkpoint_info, VariantStats::GetUnshreddedStats(old_stats))); + if (sub_columns.size() > 1) { + checkpoint_state->child_states.push_back( + sub_columns[1]->Checkpoint(row_group, checkpoint_info, VariantStats::GetShreddedStats(old_stats))); } return std::move(checkpoint_state); } @@ -499,8 +754,10 @@ unique_ptr VariantColumnData::Checkpoint(const RowGroup & auto &shredded = checkpoint_state->shredded_data[1]; //! Now checkpoint the shredded data - checkpoint_state->child_states.push_back(unshredded->Checkpoint(row_group, checkpoint_info)); - checkpoint_state->child_states.push_back(shredded->Checkpoint(row_group, checkpoint_info)); + checkpoint_state->child_states.push_back( + unshredded->Checkpoint(row_group, checkpoint_info, VariantStats::GetUnshreddedStats(column_stats))); + checkpoint_state->child_states.push_back( + shredded->Checkpoint(row_group, checkpoint_info, VariantStats::GetShreddedStats(column_stats))); return std::move(checkpoint_state); } @@ -534,7 +791,8 @@ bool VariantColumnData::HasAnyChanges() const { PersistentColumnData VariantColumnData::Serialize() { PersistentColumnData persistent_data(type); if (IsShredded()) { - persistent_data.SetVariantShreddedType(sub_columns[1]->type); + // Set the extra data to indicate that this is shredded data + persistent_data.extra_data = make_uniq(sub_columns[1]->type); } persistent_data.child_columns.push_back(validity->Serialize()); for (idx_t i = 0; i < sub_columns.size(); i++) { @@ -552,7 +810,10 @@ void VariantColumnData::InitializeColumn(PersistentColumnData &column_data, Base auto &unshredded_stats = VariantStats::GetUnshreddedStats(target_stats); sub_columns[0]->InitializeColumn(column_data.child_columns[1], unshredded_stats); - auto &shredded_type = column_data.variant_shredded_type; + // TODO: + D_ASSERT(column_data.extra_data); + auto &variant_extra_data = column_data.extra_data->Cast(); + auto &shredded_type = variant_extra_data.logical_type; if (!IsShredded()) { VariantStats::SetShreddedStats(target_stats, BaseStatistics::CreateEmpty(shredded_type)); sub_columns.push_back(ColumnData::CreateColumn(block_manager, info, 2, shredded_type, GetDataType(), this)); diff --git a/src/duckdb/src/storage/temporary_file_manager.cpp b/src/duckdb/src/storage/temporary_file_manager.cpp index 057f6db29..d62ab728c 100644 --- a/src/duckdb/src/storage/temporary_file_manager.cpp +++ b/src/duckdb/src/storage/temporary_file_manager.cpp @@ -4,6 +4,7 @@ #include "duckdb/parallel/task_scheduler.hpp" #include "duckdb/storage/buffer/temporary_file_information.hpp" #include "duckdb/main/database.hpp" +#include "duckdb/main/settings.hpp" #include "duckdb/common/encryption_functions.hpp" #include "zstd.h" @@ -639,7 +640,7 @@ void TemporaryFileManager::DecreaseSizeOnDisk(idx_t bytes) { } bool TemporaryFileManager::IsEncrypted() const { - return db.config.options.temp_file_encryption; + return Settings::Get(db); } unique_ptr TemporaryFileManager::ReadTemporaryBuffer(QueryContext context, block_id_t id, diff --git a/src/duckdb/src/storage/wal_replay.cpp b/src/duckdb/src/storage/wal_replay.cpp index b972882b4..a1c0523fb 100644 --- a/src/duckdb/src/storage/wal_replay.cpp +++ b/src/duckdb/src/storage/wal_replay.cpp @@ -7,6 +7,7 @@ #include "duckdb/common/serializer/binary_deserializer.hpp" #include "duckdb/common/serializer/buffered_file_reader.hpp" #include "duckdb/common/serializer/memory_stream.hpp" +#include "duckdb/common/enums/checkpoint_abort.hpp" #include "duckdb/execution/index/art/art.hpp" #include "duckdb/execution/index/index_type_set.hpp" #include "duckdb/main/attached_database.hpp" @@ -417,8 +418,7 @@ unique_ptr WriteAheadLog::ReplayInternal(QueryContext context, St checkpoint_reader.FileSize()); } - auto debug_checkpoint_abort = - DBConfig::GetSetting(storage_manager.GetDatabase()); + auto debug_checkpoint_abort = Settings::Get(storage_manager.GetDatabase()); // move over the recovery WAL over the main WAL recovery_handle->Sync(); diff --git a/src/duckdb/src/transaction/duck_transaction_manager.cpp b/src/duckdb/src/transaction/duck_transaction_manager.cpp index 29d2fbde3..b8b005988 100644 --- a/src/duckdb/src/transaction/duck_transaction_manager.cpp +++ b/src/duckdb/src/transaction/duck_transaction_manager.cpp @@ -155,7 +155,7 @@ DuckTransactionManager::CanCheckpoint(DuckTransaction &transaction, unique_ptr(db.GetDatabase())) { + if (Settings::Get(db.GetDatabase())) { return CheckpointDecision("checkpointing on commit disabled through configuration"); } // try to lock the checkpoint lock diff --git a/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp b/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp index bfdc6ca20..4730bd0cc 100644 --- a/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp +++ b/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp @@ -1616,6 +1616,8 @@ typedef struct PGCreateStmt { PGTypeName *ofTypename; /* OF typename */ PGList *constraints; /* constraints (list of PGConstraint nodes) */ PGList *options; /* options from WITH clause */ + PGList *partition_list; /* e.g. expression list for partitioned by */ + PGList *sort_list; /* e.g. expression list for sort by */ PGOnCommitAction oncommit; /* what do we do at COMMIT? */ char *tablespacename; /* table space to use, or NULL */ PGOnCreateConflict onconflict; /* what to do on create conflict */ diff --git a/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp b/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp index f222526b5..eca8859fe 100644 --- a/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +++ b/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp @@ -1647,16 +1647,16 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 889 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 77384 +#define YYLAST 77783 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 538 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 510 +#define YYNNTS 512 /* YYNRULES -- Number of rules. */ -#define YYNRULES 2257 +#define YYNRULES 2262 /* YYNRULES -- Number of states. */ -#define YYNSTATES 3815 +#define YYNSTATES 3832 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 @@ -1782,309 +1782,310 @@ static const yytype_uint16 yyprhs[] = 972, 975, 978, 981, 985, 989, 993, 995, 999, 1001, 1002, 1004, 1007, 1010, 1017, 1026, 1032, 1040, 1041, 1044, 1047, 1051, 1055, 1058, 1061, 1064, 1066, 1068, 1069, 1072, - 1075, 1076, 1079, 1089, 1102, 1114, 1115, 1118, 1120, 1122, - 1124, 1126, 1128, 1130, 1134, 1135, 1137, 1140, 1142, 1144, - 1147, 1150, 1154, 1156, 1158, 1161, 1164, 1166, 1169, 1173, - 1179, 1183, 1186, 1192, 1194, 1196, 1198, 1199, 1205, 1213, - 1219, 1222, 1226, 1228, 1230, 1233, 1236, 1237, 1241, 1246, - 1251, 1252, 1256, 1259, 1260, 1264, 1266, 1268, 1270, 1272, - 1274, 1276, 1278, 1280, 1282, 1284, 1288, 1292, 1294, 1297, - 1300, 1303, 1306, 1309, 1312, 1313, 1317, 1321, 1325, 1326, - 1328, 1331, 1333, 1336, 1339, 1342, 1345, 1348, 1352, 1355, - 1358, 1360, 1364, 1366, 1368, 1370, 1372, 1376, 1378, 1381, - 1382, 1384, 1387, 1388, 1390, 1394, 1395, 1398, 1399, 1403, - 1407, 1409, 1415, 1419, 1421, 1425, 1427, 1430, 1432, 1437, - 1443, 1449, 1456, 1460, 1468, 1473, 1485, 1487, 1491, 1494, - 1497, 1500, 1501, 1505, 1507, 1509, 1512, 1515, 1518, 1521, - 1523, 1524, 1526, 1529, 1536, 1541, 1548, 1553, 1560, 1569, - 1571, 1573, 1575, 1577, 1580, 1582, 1585, 1587, 1590, 1592, - 1594, 1596, 1598, 1602, 1606, 1610, 1614, 1616, 1619, 1622, - 1624, 1628, 1630, 1632, 1634, 1638, 1640, 1642, 1643, 1645, - 1647, 1649, 1659, 1662, 1663, 1667, 1668, 1670, 1671, 1675, - 1679, 1682, 1684, 1691, 1695, 1699, 1702, 1705, 1707, 1708, - 1714, 1717, 1720, 1721, 1729, 1731, 1733, 1735, 1738, 1744, - 1753, 1761, 1767, 1776, 1784, 1789, 1794, 1796, 1800, 1802, - 1804, 1808, 1810, 1814, 1816, 1818, 1821, 1826, 1830, 1832, - 1836, 1839, 1844, 1849, 1858, 1870, 1880, 1888, 1889, 1893, - 1897, 1899, 1901, 1905, 1906, 1908, 1909, 1911, 1912, 1914, - 1915, 1917, 1921, 1924, 1925, 1928, 1929, 1931, 1932, 1934, - 1936, 1938, 1942, 1946, 1948, 1950, 1954, 1958, 1962, 1966, - 1970, 1974, 1979, 1983, 1986, 1988, 1990, 1992, 1996, 1998, - 2002, 2004, 2006, 2008, 2012, 2016, 2020, 2022, 2025, 2030, - 2035, 2038, 2042, 2048, 2054, 2056, 2058, 2062, 2063, 2075, - 2087, 2098, 2111, 2113, 2116, 2122, 2127, 2132, 2137, 2142, - 2150, 2156, 2161, 2169, 2176, 2186, 2196, 2201, 2203, 2205, - 2207, 2209, 2211, 2213, 2215, 2221, 2223, 2225, 2229, 2231, - 2234, 2237, 2240, 2244, 2246, 2250, 2259, 2265, 2266, 2268, - 2271, 2273, 2277, 2279, 2282, 2283, 2286, 2287, 2291, 2295, - 2300, 2305, 2310, 2315, 2319, 2322, 2324, 2326, 2327, 2329, - 2331, 2332, 2335, 2337, 2343, 2345, 2346, 2349, 2352, 2353, - 2355, 2356, 2360, 2366, 2368, 2372, 2377, 2381, 2383, 2385, - 2386, 2389, 2392, 2393, 2396, 2399, 2401, 2403, 2405, 2406, - 2409, 2414, 2420, 2425, 2428, 2432, 2434, 2436, 2438, 2441, - 2444, 2446, 2449, 2453, 2454, 2456, 2457, 2463, 2465, 2470, - 2477, 2480, 2482, 2483, 2488, 2489, 2491, 2493, 2497, 2502, - 2503, 2505, 2507, 2510, 2513, 2516, 2518, 2520, 2523, 2526, - 2528, 2530, 2532, 2534, 2536, 2538, 2542, 2546, 2547, 2549, - 2553, 2555, 2558, 2560, 2562, 2564, 2566, 2568, 2571, 2576, - 2581, 2587, 2589, 2591, 2594, 2595, 2598, 2599, 2601, 2605, - 2607, 2608, 2610, 2613, 2617, 2620, 2625, 2628, 2632, 2635, - 2636, 2638, 2641, 2642, 2647, 2653, 2655, 2658, 2661, 2662, - 2664, 2668, 2670, 2673, 2676, 2681, 2686, 2690, 2694, 2698, - 2702, 2706, 2710, 2714, 2716, 2721, 2726, 2736, 2746, 2750, - 2751, 2754, 2757, 2758, 2764, 2768, 2770, 2772, 2776, 2782, - 2786, 2788, 2791, 2793, 2797, 2803, 2805, 2808, 2812, 2817, - 2823, 2828, 2834, 2839, 2846, 2852, 2857, 2863, 2869, 2875, - 2878, 2883, 2885, 2887, 2888, 2890, 2895, 2901, 2906, 2907, - 2910, 2913, 2916, 2918, 2920, 2922, 2924, 2925, 2930, 2933, - 2935, 2938, 2941, 2946, 2949, 2956, 2959, 2961, 2965, 2970, - 2971, 2974, 2975, 2978, 2979, 2981, 2985, 2989, 2992, 2993, - 2996, 3001, 3003, 3005, 3007, 3008, 3011, 3015, 3021, 3028, - 3031, 3035, 3038, 3044, 3050, 3056, 3060, 3064, 3068, 3073, - 3074, 3076, 3078, 3080, 3082, 3084, 3087, 3092, 3094, 3096, - 3098, 3100, 3103, 3107, 3108, 3110, 3112, 3114, 3116, 3118, - 3121, 3124, 3127, 3130, 3133, 3135, 3139, 3140, 3142, 3144, - 3146, 3148, 3154, 3157, 3159, 3161, 3163, 3165, 3170, 3172, - 3175, 3178, 3180, 3184, 3188, 3191, 3193, 3194, 3200, 3203, - 3209, 3212, 3214, 3218, 3222, 3223, 3225, 3227, 3229, 3231, - 3233, 3235, 3237, 3239, 3241, 3243, 3245, 3247, 3249, 3251, - 3253, 3255, 3257, 3259, 3261, 3263, 3265, 3267, 3269, 3271, - 3273, 3275, 3277, 3279, 3281, 3283, 3285, 3287, 3289, 3291, - 3293, 3295, 3297, 3299, 3301, 3305, 3309, 3313, 3317, 3321, - 3325, 3329, 3330, 3332, 3336, 3340, 3346, 3349, 3352, 3356, - 3360, 3364, 3368, 3372, 3376, 3380, 3384, 3388, 3392, 3396, - 3400, 3404, 3408, 3412, 3415, 3418, 3422, 3426, 3429, 3432, - 3436, 3440, 3446, 3451, 3458, 3462, 3468, 3473, 3480, 3485, - 3492, 3498, 3506, 3510, 3513, 3518, 3522, 3525, 3530, 3534, - 3538, 3542, 3546, 3551, 3555, 3560, 3564, 3569, 3575, 3582, - 3589, 3597, 3604, 3612, 3619, 3627, 3631, 3636, 3641, 3648, - 3650, 3655, 3660, 3666, 3671, 3678, 3680, 3684, 3687, 3690, - 3694, 3698, 3702, 3706, 3710, 3714, 3718, 3722, 3726, 3730, - 3734, 3738, 3742, 3746, 3750, 3753, 3756, 3762, 3769, 3776, - 3784, 3786, 3789, 3791, 3793, 3795, 3798, 3801, 3806, 3810, - 3812, 3814, 3816, 3818, 3821, 3823, 3825, 3827, 3829, 3831, - 3833, 3835, 3838, 3843, 3846, 3850, 3854, 3859, 3863, 3869, - 3876, 3884, 3894, 3902, 3910, 3916, 3918, 3920, 3922, 3928, - 3935, 3942, 3947, 3952, 3957, 3962, 3969, 3975, 3981, 3987, - 3992, 3999, 4004, 4012, 4022, 4028, 4029, 4035, 4040, 4041, - 4043, 4044, 4047, 4048, 4050, 4054, 4058, 4061, 4064, 4065, - 4072, 4074, 4075, 4079, 4080, 4084, 4088, 4092, 4093, 4095, - 4100, 4103, 4106, 4109, 4112, 4115, 4119, 4122, 4125, 4129, - 4130, 4135, 4139, 4141, 4147, 4151, 4153, 4157, 4159, 4162, - 4166, 4168, 4172, 4174, 4177, 4179, 4180, 4182, 4184, 4186, - 4188, 4190, 4192, 4194, 4196, 4198, 4200, 4202, 4204, 4206, - 4208, 4210, 4212, 4214, 4216, 4218, 4220, 4225, 4227, 4232, - 4234, 4239, 4241, 4244, 4246, 4249, 4251, 4254, 4256, 4260, - 4262, 4266, 4268, 4271, 4273, 4277, 4279, 4282, 4284, 4285, - 4287, 4291, 4293, 4297, 4301, 4303, 4307, 4311, 4312, 4314, - 4316, 4318, 4320, 4322, 4324, 4326, 4328, 4330, 4332, 4334, - 4336, 4338, 4340, 4342, 4347, 4351, 4354, 4358, 4359, 4363, - 4367, 4370, 4373, 4375, 4376, 4379, 4382, 4386, 4389, 4391, - 4393, 4397, 4399, 4401, 4407, 4409, 4412, 4417, 4420, 4421, - 4423, 4424, 4426, 4428, 4431, 4435, 4441, 4449, 4457, 4459, - 4460, 4461, 4464, 4465, 4468, 4472, 4476, 4480, 4486, 4494, - 4502, 4503, 4506, 4508, 4509, 4511, 4512, 4514, 4518, 4520, - 4523, 4527, 4530, 4532, 4536, 4541, 4544, 4546, 4550, 4552, - 4556, 4558, 4561, 4563, 4564, 4568, 4570, 4574, 4576, 4579, - 4584, 4587, 4588, 4592, 4594, 4598, 4600, 4603, 4608, 4611, - 4612, 4614, 4618, 4620, 4624, 4626, 4629, 4631, 4635, 4637, - 4639, 4642, 4644, 4646, 4649, 4651, 4653, 4656, 4664, 4667, - 4673, 4677, 4681, 4683, 4685, 4687, 4689, 4691, 4693, 4695, - 4697, 4699, 4701, 4703, 4705, 4707, 4709, 4712, 4715, 4719, - 4723, 4724, 4726, 4728, 4730, 4736, 4740, 4741, 4743, 4745, - 4747, 4749, 4751, 4753, 4758, 4766, 4773, 4776, 4777, 4779, - 4781, 4783, 4785, 4799, 4816, 4818, 4821, 4822, 4824, 4825, - 4827, 4828, 4831, 4832, 4834, 4835, 4842, 4851, 4858, 4867, - 4874, 4883, 4887, 4890, 4892, 4893, 4900, 4907, 4909, 4911, - 4913, 4915, 4917, 4919, 4922, 4924, 4926, 4928, 4930, 4932, - 4937, 4944, 4948, 4951, 4956, 4960, 4966, 4968, 4969, 4971, - 4973, 4974, 4976, 4978, 4980, 4982, 4984, 4986, 4988, 4990, - 4992, 4994, 4996, 4998, 5000, 5002, 5004, 5006, 5008, 5010, - 5012, 5014, 5016, 5018, 5020, 5022, 5024, 5026, 5028, 5030, - 5032, 5034, 5036, 5038, 5040, 5042, 5044, 5046, 5048, 5050, - 5054, 5056, 5058, 5060, 5062, 5064, 5066, 5069, 5071, 5073, - 5076, 5080, 5084, 5088, 5092, 5094, 5098, 5102, 5105, 5109, - 5113, 5115, 5117, 5119, 5123, 5129, 5131, 5133, 5135, 5137, - 5141, 5144, 5149, 5156, 5163, 5164, 5166, 5168, 5170, 5171, - 5174, 5177, 5182, 5189, 5195, 5200, 5207, 5209, 5211, 5213, - 5215, 5217, 5219, 5220, 5222, 5226, 5228, 5229, 5237, 5241, - 5243, 5246, 5250, 5253, 5254, 5257, 5258, 5261, 5266, 5272, - 5281, 5289, 5292, 5296, 5302, 5304, 5305, 5308, 5309, 5311, - 5312, 5315, 5317, 5321, 5325, 5326, 5329, 5333, 5337, 5341, - 5345, 5347, 5349, 5351, 5354, 5358, 5361, 5364, 5367, 5372, - 5375, 5379, 5384, 5388, 5390, 5392, 5394, 5396, 5398, 5400, - 5401, 5403, 5407, 5410, 5420, 5433, 5445, 5458, 5473, 5477, - 5482, 5487, 5488, 5496, 5507, 5517, 5520, 5524, 5525, 5530, - 5532, 5534, 5536, 5538, 5540, 5542, 5544, 5546, 5548, 5550, - 5552, 5554, 5556, 5558, 5560, 5562, 5564, 5566, 5568, 5570, - 5572, 5574, 5576, 5578, 5580, 5582, 5584, 5586, 5588, 5590, - 5592, 5594, 5596, 5598, 5600, 5602, 5604, 5606, 5608, 5610, - 5612, 5614, 5616, 5618, 5620, 5622, 5624, 5626, 5628, 5630, - 5632, 5634, 5636, 5638, 5640, 5642, 5644, 5646, 5648, 5650, - 5652, 5654, 5656, 5658, 5660, 5662, 5664, 5666, 5668, 5670, - 5672, 5674, 5676, 5678, 5680, 5682, 5684, 5686, 5688, 5690, - 5692, 5694, 5696, 5698, 5700, 5702, 5704, 5706, 5708, 5710, - 5712, 5714, 5716, 5718, 5720, 5722, 5724, 5726, 5728, 5730, - 5732, 5734, 5736, 5738, 5740, 5742, 5744, 5746, 5748, 5750, - 5752, 5754, 5756, 5758, 5760, 5762, 5764, 5766, 5768, 5770, - 5772, 5774, 5776, 5778, 5780, 5782, 5784, 5786, 5788, 5790, - 5792, 5794, 5796, 5798, 5800, 5802, 5804, 5806, 5808, 5810, - 5812, 5814, 5816, 5818, 5820, 5822, 5824, 5826, 5828, 5830, - 5832, 5834, 5836, 5838, 5840, 5842, 5844, 5846, 5848, 5850, - 5852, 5854, 5856, 5858, 5860, 5862, 5864, 5866, 5868, 5870, - 5872, 5874, 5876, 5878, 5880, 5882, 5884, 5886, 5888, 5890, - 5892, 5894, 5896, 5898, 5900, 5902, 5904, 5906, 5908, 5910, - 5912, 5914, 5916, 5918, 5920, 5922, 5924, 5926, 5928, 5930, - 5932, 5934, 5936, 5938, 5940, 5942, 5944, 5946, 5948, 5950, - 5952, 5954, 5956, 5958, 5960, 5962, 5964, 5966, 5968, 5970, - 5972, 5974, 5976, 5978, 5980, 5982, 5984, 5986, 5988, 5990, - 5992, 5994, 5996, 5998, 6000, 6002, 6004, 6006, 6008, 6010, - 6012, 6014, 6016, 6018, 6020, 6022, 6024, 6026, 6028, 6030, - 6032, 6034, 6036, 6038, 6040, 6042, 6044, 6046, 6048, 6050, - 6052, 6054, 6056, 6058, 6060, 6062, 6064, 6066, 6068, 6070, - 6072, 6074, 6076, 6078, 6080, 6082, 6084, 6086, 6088, 6090, - 6092, 6094, 6096, 6098, 6100, 6102, 6104, 6106, 6108, 6110, - 6112, 6114, 6116, 6118, 6120, 6122, 6124, 6126, 6128, 6130, - 6132, 6134, 6136, 6138, 6140, 6142, 6144, 6146, 6148, 6150, - 6152, 6154, 6156, 6158, 6160, 6162, 6164, 6166, 6168, 6170, - 6172, 6174, 6176, 6178, 6180, 6182, 6184, 6186, 6188, 6190, - 6192, 6194, 6196, 6198, 6200, 6202, 6204, 6206, 6208, 6210, - 6212, 6214, 6216, 6218, 6220, 6222, 6224, 6226, 6228, 6230, - 6232, 6234, 6236, 6238, 6240, 6242, 6244, 6246, 6248, 6250, - 6252, 6254, 6256, 6258, 6260, 6262, 6264, 6266, 6268, 6270, - 6272, 6274, 6276, 6278, 6280, 6282, 6284, 6286, 6288, 6290, - 6292, 6294, 6296, 6298, 6300, 6302, 6304, 6306, 6308, 6310, - 6312, 6314, 6316, 6318, 6320, 6322, 6324, 6326, 6328, 6330, - 6332, 6334, 6336, 6338, 6340, 6342, 6344, 6346, 6348, 6350, - 6352, 6354, 6356, 6358, 6360, 6362, 6364, 6366, 6368, 6370, - 6372, 6374, 6376, 6378, 6380, 6382, 6384, 6386, 6388, 6390, - 6392, 6394, 6396, 6398, 6400, 6402, 6404, 6406, 6408, 6410, - 6412, 6414, 6416, 6418, 6420, 6422, 6424, 6426, 6428, 6430, - 6432, 6434, 6436, 6438, 6440, 6442, 6444, 6446, 6448, 6450, - 6452, 6454, 6456, 6458, 6460, 6462, 6464, 6466, 6468, 6470, - 6472, 6474, 6476, 6478, 6480, 6482, 6484, 6486, 6488, 6490, - 6492, 6494, 6496, 6498, 6500, 6502, 6504, 6506, 6508, 6510, - 6512, 6514, 6516, 6518, 6520, 6522, 6524, 6526, 6528, 6530, - 6532, 6534, 6536, 6538, 6540, 6542, 6544, 6546, 6548, 6550, - 6552, 6554, 6556, 6558, 6560, 6562, 6564, 6566, 6568, 6570, - 6572, 6574, 6576, 6578, 6580, 6582, 6584, 6586, 6588, 6590, - 6592, 6594, 6596, 6598, 6600, 6602, 6604, 6606, 6608, 6610, - 6612, 6614, 6616, 6618, 6620, 6622, 6624, 6626, 6628, 6630, - 6632, 6634, 6636, 6638, 6640, 6642, 6644, 6646, 6648, 6650, - 6652, 6654, 6656, 6658, 6660, 6662, 6664, 6666, 6668, 6670, - 6672, 6674, 6676, 6678, 6680, 6682, 6684, 6686, 6688, 6690, - 6692, 6694, 6696, 6698, 6700, 6702, 6704, 6706, 6708, 6710, - 6712, 6714, 6716, 6718, 6720, 6722, 6724, 6726, 6728, 6730, - 6732, 6734, 6736, 6738, 6740, 6742, 6744, 6746, 6748, 6750, - 6752, 6754, 6756, 6758, 6760, 6762, 6764, 6766, 6768, 6770, - 6772, 6774, 6776, 6778, 6780, 6782, 6784, 6786, 6788, 6790, - 6792, 6794, 6796, 6798, 6800, 6802, 6804, 6806 + 1075, 1076, 1079, 1090, 1104, 1117, 1118, 1121, 1123, 1125, + 1127, 1129, 1131, 1133, 1137, 1138, 1140, 1143, 1145, 1147, + 1150, 1153, 1157, 1159, 1161, 1164, 1167, 1169, 1172, 1176, + 1182, 1186, 1189, 1195, 1197, 1199, 1201, 1202, 1208, 1216, + 1222, 1225, 1229, 1231, 1233, 1236, 1239, 1240, 1244, 1249, + 1254, 1255, 1259, 1262, 1263, 1267, 1269, 1271, 1273, 1275, + 1277, 1279, 1281, 1283, 1285, 1287, 1291, 1295, 1297, 1300, + 1303, 1306, 1309, 1310, 1316, 1322, 1325, 1328, 1331, 1332, + 1336, 1340, 1344, 1345, 1347, 1350, 1352, 1355, 1358, 1361, + 1364, 1367, 1371, 1374, 1377, 1379, 1383, 1385, 1387, 1389, + 1391, 1395, 1397, 1400, 1401, 1403, 1406, 1407, 1409, 1413, + 1414, 1417, 1418, 1422, 1426, 1428, 1434, 1438, 1442, 1444, + 1448, 1450, 1453, 1455, 1460, 1466, 1472, 1479, 1483, 1491, + 1496, 1508, 1510, 1514, 1517, 1520, 1523, 1524, 1528, 1530, + 1532, 1535, 1538, 1541, 1544, 1546, 1547, 1549, 1552, 1559, + 1564, 1571, 1576, 1583, 1592, 1594, 1596, 1598, 1600, 1603, + 1605, 1608, 1610, 1613, 1615, 1617, 1619, 1621, 1625, 1629, + 1633, 1637, 1639, 1642, 1645, 1647, 1651, 1653, 1655, 1657, + 1661, 1663, 1665, 1666, 1668, 1670, 1672, 1682, 1685, 1686, + 1690, 1691, 1693, 1694, 1698, 1702, 1705, 1707, 1714, 1718, + 1722, 1725, 1728, 1730, 1731, 1737, 1740, 1743, 1744, 1752, + 1754, 1756, 1758, 1761, 1767, 1776, 1784, 1790, 1799, 1807, + 1812, 1817, 1819, 1823, 1825, 1827, 1831, 1833, 1837, 1839, + 1841, 1844, 1849, 1853, 1855, 1859, 1862, 1867, 1872, 1881, + 1893, 1903, 1911, 1912, 1916, 1920, 1922, 1924, 1928, 1929, + 1931, 1932, 1934, 1935, 1937, 1938, 1940, 1944, 1947, 1948, + 1951, 1952, 1954, 1955, 1957, 1959, 1961, 1965, 1969, 1971, + 1973, 1977, 1981, 1985, 1989, 1993, 1997, 2002, 2006, 2009, + 2011, 2013, 2015, 2019, 2021, 2025, 2027, 2029, 2031, 2035, + 2039, 2043, 2045, 2048, 2053, 2058, 2061, 2065, 2071, 2077, + 2079, 2081, 2085, 2086, 2098, 2110, 2121, 2134, 2136, 2139, + 2145, 2150, 2155, 2160, 2165, 2173, 2179, 2184, 2192, 2199, + 2209, 2219, 2224, 2226, 2228, 2230, 2232, 2234, 2236, 2238, + 2244, 2246, 2248, 2252, 2254, 2257, 2260, 2263, 2267, 2269, + 2273, 2282, 2288, 2289, 2291, 2294, 2296, 2300, 2302, 2305, + 2306, 2309, 2310, 2314, 2318, 2323, 2328, 2333, 2338, 2342, + 2345, 2347, 2349, 2350, 2352, 2354, 2355, 2358, 2360, 2366, + 2368, 2369, 2372, 2375, 2376, 2378, 2379, 2383, 2389, 2391, + 2395, 2400, 2404, 2406, 2408, 2409, 2412, 2415, 2416, 2419, + 2422, 2424, 2426, 2428, 2429, 2432, 2437, 2443, 2448, 2451, + 2455, 2457, 2459, 2461, 2464, 2467, 2469, 2472, 2476, 2477, + 2479, 2480, 2486, 2488, 2493, 2500, 2503, 2505, 2506, 2511, + 2512, 2514, 2516, 2520, 2525, 2526, 2528, 2530, 2533, 2536, + 2539, 2541, 2543, 2546, 2549, 2551, 2553, 2555, 2557, 2559, + 2561, 2565, 2569, 2570, 2572, 2576, 2578, 2581, 2583, 2585, + 2587, 2589, 2591, 2594, 2599, 2604, 2610, 2612, 2614, 2617, + 2618, 2621, 2622, 2624, 2628, 2630, 2631, 2633, 2636, 2640, + 2643, 2648, 2651, 2655, 2658, 2659, 2661, 2664, 2665, 2670, + 2676, 2678, 2681, 2684, 2685, 2687, 2691, 2693, 2696, 2699, + 2704, 2709, 2713, 2717, 2721, 2725, 2729, 2733, 2737, 2739, + 2744, 2749, 2759, 2769, 2773, 2774, 2777, 2780, 2781, 2787, + 2791, 2793, 2795, 2799, 2805, 2809, 2811, 2814, 2816, 2820, + 2826, 2828, 2831, 2835, 2840, 2846, 2851, 2857, 2862, 2869, + 2875, 2880, 2886, 2892, 2898, 2901, 2906, 2908, 2910, 2911, + 2913, 2918, 2924, 2929, 2930, 2933, 2936, 2939, 2941, 2943, + 2945, 2947, 2948, 2953, 2956, 2958, 2961, 2964, 2969, 2972, + 2979, 2982, 2984, 2988, 2993, 2994, 2997, 2998, 3001, 3002, + 3004, 3008, 3012, 3015, 3016, 3019, 3024, 3026, 3028, 3030, + 3031, 3034, 3038, 3044, 3051, 3054, 3058, 3061, 3067, 3073, + 3079, 3083, 3087, 3091, 3096, 3097, 3099, 3101, 3103, 3105, + 3107, 3110, 3115, 3117, 3119, 3121, 3123, 3126, 3130, 3131, + 3133, 3135, 3137, 3139, 3141, 3144, 3147, 3150, 3153, 3156, + 3158, 3162, 3163, 3165, 3167, 3169, 3171, 3177, 3180, 3182, + 3184, 3186, 3188, 3193, 3195, 3198, 3201, 3203, 3207, 3211, + 3214, 3216, 3217, 3223, 3226, 3232, 3235, 3237, 3241, 3245, + 3246, 3248, 3250, 3252, 3254, 3256, 3258, 3260, 3262, 3264, + 3266, 3268, 3270, 3272, 3274, 3276, 3278, 3280, 3282, 3284, + 3286, 3288, 3290, 3292, 3294, 3296, 3298, 3300, 3302, 3304, + 3306, 3308, 3310, 3312, 3314, 3316, 3318, 3320, 3322, 3324, + 3328, 3332, 3336, 3340, 3344, 3348, 3352, 3353, 3355, 3359, + 3363, 3369, 3372, 3375, 3379, 3383, 3387, 3391, 3395, 3399, + 3403, 3407, 3411, 3415, 3419, 3423, 3427, 3431, 3435, 3438, + 3441, 3445, 3449, 3452, 3455, 3459, 3463, 3469, 3474, 3481, + 3485, 3491, 3496, 3503, 3508, 3515, 3521, 3529, 3533, 3536, + 3541, 3545, 3548, 3553, 3557, 3561, 3565, 3569, 3574, 3578, + 3583, 3587, 3592, 3598, 3605, 3612, 3620, 3627, 3635, 3642, + 3650, 3654, 3659, 3664, 3671, 3673, 3678, 3683, 3689, 3694, + 3701, 3703, 3707, 3710, 3713, 3717, 3721, 3725, 3729, 3733, + 3737, 3741, 3745, 3749, 3753, 3757, 3761, 3765, 3769, 3773, + 3776, 3779, 3785, 3792, 3799, 3807, 3809, 3812, 3814, 3816, + 3818, 3821, 3824, 3829, 3833, 3835, 3837, 3839, 3841, 3844, + 3846, 3848, 3850, 3852, 3854, 3856, 3858, 3861, 3866, 3869, + 3873, 3877, 3882, 3886, 3892, 3899, 3907, 3917, 3925, 3933, + 3939, 3941, 3943, 3945, 3951, 3958, 3965, 3970, 3975, 3980, + 3985, 3992, 3998, 4004, 4010, 4015, 4022, 4027, 4035, 4045, + 4051, 4052, 4058, 4063, 4064, 4066, 4067, 4070, 4071, 4073, + 4077, 4081, 4084, 4087, 4088, 4095, 4097, 4098, 4102, 4103, + 4107, 4111, 4115, 4116, 4118, 4123, 4126, 4129, 4132, 4135, + 4138, 4142, 4145, 4148, 4152, 4153, 4158, 4162, 4164, 4170, + 4174, 4176, 4180, 4182, 4185, 4189, 4191, 4195, 4197, 4200, + 4202, 4203, 4205, 4207, 4209, 4211, 4213, 4215, 4217, 4219, + 4221, 4223, 4225, 4227, 4229, 4231, 4233, 4235, 4237, 4239, + 4241, 4243, 4248, 4250, 4255, 4257, 4262, 4264, 4267, 4269, + 4272, 4274, 4277, 4279, 4283, 4285, 4289, 4291, 4294, 4296, + 4300, 4302, 4305, 4307, 4308, 4310, 4314, 4316, 4320, 4324, + 4326, 4330, 4334, 4335, 4337, 4339, 4341, 4343, 4345, 4347, + 4349, 4351, 4353, 4355, 4357, 4359, 4361, 4363, 4365, 4370, + 4374, 4377, 4381, 4382, 4386, 4390, 4393, 4396, 4398, 4399, + 4402, 4405, 4409, 4412, 4414, 4416, 4420, 4422, 4424, 4430, + 4432, 4435, 4440, 4443, 4444, 4446, 4447, 4449, 4451, 4454, + 4458, 4464, 4472, 4480, 4482, 4483, 4484, 4487, 4488, 4491, + 4495, 4499, 4503, 4509, 4517, 4525, 4526, 4529, 4531, 4532, + 4534, 4535, 4537, 4541, 4543, 4546, 4550, 4553, 4555, 4559, + 4564, 4567, 4569, 4573, 4575, 4579, 4581, 4584, 4586, 4587, + 4591, 4593, 4597, 4599, 4602, 4607, 4610, 4611, 4615, 4617, + 4621, 4623, 4626, 4631, 4634, 4635, 4637, 4641, 4643, 4647, + 4649, 4652, 4654, 4658, 4660, 4662, 4665, 4667, 4669, 4672, + 4674, 4676, 4679, 4687, 4690, 4696, 4700, 4704, 4706, 4708, + 4710, 4712, 4714, 4716, 4718, 4720, 4722, 4724, 4726, 4728, + 4730, 4732, 4735, 4738, 4742, 4746, 4747, 4749, 4751, 4753, + 4759, 4763, 4764, 4766, 4768, 4770, 4772, 4774, 4776, 4781, + 4789, 4796, 4799, 4800, 4802, 4804, 4806, 4808, 4822, 4839, + 4841, 4844, 4845, 4847, 4848, 4850, 4851, 4854, 4855, 4857, + 4858, 4865, 4874, 4881, 4890, 4897, 4906, 4910, 4913, 4915, + 4916, 4923, 4930, 4932, 4934, 4936, 4938, 4940, 4942, 4945, + 4947, 4949, 4951, 4953, 4955, 4960, 4967, 4971, 4974, 4979, + 4983, 4989, 4991, 4992, 4994, 4996, 4997, 4999, 5001, 5003, + 5005, 5007, 5009, 5011, 5013, 5015, 5017, 5019, 5021, 5023, + 5025, 5027, 5029, 5031, 5033, 5035, 5037, 5039, 5041, 5043, + 5045, 5047, 5049, 5051, 5053, 5055, 5057, 5059, 5061, 5063, + 5065, 5067, 5069, 5071, 5073, 5077, 5079, 5081, 5083, 5085, + 5087, 5089, 5092, 5094, 5096, 5099, 5103, 5107, 5111, 5115, + 5117, 5121, 5125, 5128, 5132, 5136, 5138, 5140, 5142, 5146, + 5152, 5154, 5156, 5158, 5160, 5164, 5167, 5172, 5179, 5186, + 5187, 5189, 5191, 5193, 5194, 5197, 5200, 5205, 5212, 5218, + 5223, 5230, 5232, 5234, 5236, 5238, 5240, 5242, 5243, 5245, + 5249, 5251, 5252, 5260, 5264, 5266, 5269, 5273, 5276, 5277, + 5280, 5281, 5284, 5289, 5295, 5304, 5312, 5315, 5319, 5325, + 5327, 5328, 5331, 5332, 5334, 5335, 5338, 5340, 5344, 5348, + 5349, 5352, 5356, 5360, 5364, 5368, 5370, 5372, 5374, 5377, + 5381, 5384, 5387, 5390, 5395, 5398, 5402, 5407, 5411, 5413, + 5415, 5417, 5419, 5421, 5423, 5424, 5426, 5430, 5433, 5443, + 5456, 5468, 5481, 5496, 5500, 5505, 5510, 5511, 5519, 5530, + 5540, 5543, 5547, 5548, 5553, 5555, 5557, 5559, 5561, 5563, + 5565, 5567, 5569, 5571, 5573, 5575, 5577, 5579, 5581, 5583, + 5585, 5587, 5589, 5591, 5593, 5595, 5597, 5599, 5601, 5603, + 5605, 5607, 5609, 5611, 5613, 5615, 5617, 5619, 5621, 5623, + 5625, 5627, 5629, 5631, 5633, 5635, 5637, 5639, 5641, 5643, + 5645, 5647, 5649, 5651, 5653, 5655, 5657, 5659, 5661, 5663, + 5665, 5667, 5669, 5671, 5673, 5675, 5677, 5679, 5681, 5683, + 5685, 5687, 5689, 5691, 5693, 5695, 5697, 5699, 5701, 5703, + 5705, 5707, 5709, 5711, 5713, 5715, 5717, 5719, 5721, 5723, + 5725, 5727, 5729, 5731, 5733, 5735, 5737, 5739, 5741, 5743, + 5745, 5747, 5749, 5751, 5753, 5755, 5757, 5759, 5761, 5763, + 5765, 5767, 5769, 5771, 5773, 5775, 5777, 5779, 5781, 5783, + 5785, 5787, 5789, 5791, 5793, 5795, 5797, 5799, 5801, 5803, + 5805, 5807, 5809, 5811, 5813, 5815, 5817, 5819, 5821, 5823, + 5825, 5827, 5829, 5831, 5833, 5835, 5837, 5839, 5841, 5843, + 5845, 5847, 5849, 5851, 5853, 5855, 5857, 5859, 5861, 5863, + 5865, 5867, 5869, 5871, 5873, 5875, 5877, 5879, 5881, 5883, + 5885, 5887, 5889, 5891, 5893, 5895, 5897, 5899, 5901, 5903, + 5905, 5907, 5909, 5911, 5913, 5915, 5917, 5919, 5921, 5923, + 5925, 5927, 5929, 5931, 5933, 5935, 5937, 5939, 5941, 5943, + 5945, 5947, 5949, 5951, 5953, 5955, 5957, 5959, 5961, 5963, + 5965, 5967, 5969, 5971, 5973, 5975, 5977, 5979, 5981, 5983, + 5985, 5987, 5989, 5991, 5993, 5995, 5997, 5999, 6001, 6003, + 6005, 6007, 6009, 6011, 6013, 6015, 6017, 6019, 6021, 6023, + 6025, 6027, 6029, 6031, 6033, 6035, 6037, 6039, 6041, 6043, + 6045, 6047, 6049, 6051, 6053, 6055, 6057, 6059, 6061, 6063, + 6065, 6067, 6069, 6071, 6073, 6075, 6077, 6079, 6081, 6083, + 6085, 6087, 6089, 6091, 6093, 6095, 6097, 6099, 6101, 6103, + 6105, 6107, 6109, 6111, 6113, 6115, 6117, 6119, 6121, 6123, + 6125, 6127, 6129, 6131, 6133, 6135, 6137, 6139, 6141, 6143, + 6145, 6147, 6149, 6151, 6153, 6155, 6157, 6159, 6161, 6163, + 6165, 6167, 6169, 6171, 6173, 6175, 6177, 6179, 6181, 6183, + 6185, 6187, 6189, 6191, 6193, 6195, 6197, 6199, 6201, 6203, + 6205, 6207, 6209, 6211, 6213, 6215, 6217, 6219, 6221, 6223, + 6225, 6227, 6229, 6231, 6233, 6235, 6237, 6239, 6241, 6243, + 6245, 6247, 6249, 6251, 6253, 6255, 6257, 6259, 6261, 6263, + 6265, 6267, 6269, 6271, 6273, 6275, 6277, 6279, 6281, 6283, + 6285, 6287, 6289, 6291, 6293, 6295, 6297, 6299, 6301, 6303, + 6305, 6307, 6309, 6311, 6313, 6315, 6317, 6319, 6321, 6323, + 6325, 6327, 6329, 6331, 6333, 6335, 6337, 6339, 6341, 6343, + 6345, 6347, 6349, 6351, 6353, 6355, 6357, 6359, 6361, 6363, + 6365, 6367, 6369, 6371, 6373, 6375, 6377, 6379, 6381, 6383, + 6385, 6387, 6389, 6391, 6393, 6395, 6397, 6399, 6401, 6403, + 6405, 6407, 6409, 6411, 6413, 6415, 6417, 6419, 6421, 6423, + 6425, 6427, 6429, 6431, 6433, 6435, 6437, 6439, 6441, 6443, + 6445, 6447, 6449, 6451, 6453, 6455, 6457, 6459, 6461, 6463, + 6465, 6467, 6469, 6471, 6473, 6475, 6477, 6479, 6481, 6483, + 6485, 6487, 6489, 6491, 6493, 6495, 6497, 6499, 6501, 6503, + 6505, 6507, 6509, 6511, 6513, 6515, 6517, 6519, 6521, 6523, + 6525, 6527, 6529, 6531, 6533, 6535, 6537, 6539, 6541, 6543, + 6545, 6547, 6549, 6551, 6553, 6555, 6557, 6559, 6561, 6563, + 6565, 6567, 6569, 6571, 6573, 6575, 6577, 6579, 6581, 6583, + 6585, 6587, 6589, 6591, 6593, 6595, 6597, 6599, 6601, 6603, + 6605, 6607, 6609, 6611, 6613, 6615, 6617, 6619, 6621, 6623, + 6625, 6627, 6629, 6631, 6633, 6635, 6637, 6639, 6641, 6643, + 6645, 6647, 6649, 6651, 6653, 6655, 6657, 6659, 6661, 6663, + 6665, 6667, 6669, 6671, 6673, 6675, 6677, 6679, 6681, 6683, + 6685, 6687, 6689, 6691, 6693, 6695, 6697, 6699, 6701, 6703, + 6705, 6707, 6709, 6711, 6713, 6715, 6717, 6719, 6721, 6723, + 6725, 6727, 6729, 6731, 6733, 6735, 6737, 6739, 6741, 6743, + 6745, 6747, 6749, 6751, 6753, 6755, 6757, 6759, 6761, 6763, + 6765, 6767, 6769, 6771, 6773, 6775, 6777, 6779, 6781, 6783, + 6785, 6787, 6789, 6791, 6793, 6795, 6797, 6799, 6801, 6803, + 6805, 6807, 6809, 6811, 6813, 6815, 6817, 6819, 6821, 6823, + 6825, 6827, 6829 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int16 yyrhs[] = { 539, 0, -1, 540, -1, 540, 531, 541, -1, 541, - -1, 615, -1, 980, -1, 608, -1, 542, -1, 1018, - -1, 1019, -1, 1035, -1, 981, -1, 983, -1, 701, - -1, 1038, -1, 689, -1, 970, -1, 596, -1, 594, - -1, 622, -1, 589, -1, 557, -1, 1014, -1, 1020, - -1, 616, -1, 672, -1, 604, -1, 988, -1, 986, - -1, 987, -1, 973, -1, 568, -1, 1005, -1, 678, - -1, 593, -1, 967, -1, 566, -1, 714, -1, 618, - -1, 603, -1, 700, -1, 621, -1, 1009, -1, 1027, - -1, 999, -1, 1030, -1, 1036, -1, -1, 33, 427, - 809, 554, -1, 33, 427, 194, 154, 809, 554, -1, + -1, 615, -1, 982, -1, 608, -1, 542, -1, 1020, + -1, 1021, -1, 1037, -1, 983, -1, 985, -1, 703, + -1, 1040, -1, 691, -1, 972, -1, 596, -1, 594, + -1, 622, -1, 589, -1, 557, -1, 1016, -1, 1022, + -1, 616, -1, 674, -1, 604, -1, 990, -1, 988, + -1, 989, -1, 975, -1, 568, -1, 1007, -1, 680, + -1, 593, -1, 969, -1, 566, -1, 716, -1, 618, + -1, 603, -1, 702, -1, 621, -1, 1011, -1, 1029, + -1, 1001, -1, 1032, -1, 1038, -1, -1, 33, 427, + 811, 554, -1, 33, 427, 194, 154, 811, 554, -1, 33, 205, 558, 554, -1, 33, 205, 194, 154, 558, 554, -1, 33, 390, 558, 554, -1, 33, 390, 194, 154, 558, 554, -1, 33, 480, 558, 554, -1, 33, 480, 194, 154, 558, 554, -1, 545, -1, 543, 545, - -1, 395, 118, 858, -1, 138, 118, -1, 365, -1, - 365, 610, 611, -1, 395, 612, -1, 395, 178, 671, + -1, 395, 118, 860, -1, 138, 118, -1, 365, -1, + 365, 610, 611, -1, 395, 612, -1, 395, 178, 673, -1, 553, -1, 546, 532, 553, -1, 548, -1, 547, 548, -1, 530, 564, -1, 559, -1, 559, 547, -1, - 549, 649, -1, 549, 650, -1, 27, 550, -1, 27, + 549, 651, -1, 549, 652, -1, 27, 550, -1, 27, 194, 280, 154, 550, -1, 27, 83, 550, -1, 27, 83, 194, 280, 154, 550, -1, 395, 316, 60, 528, - 906, 529, -1, 363, 316, 60, -1, 395, 406, 60, - 528, 743, 529, -1, 363, 406, 60, -1, 33, 567, + 908, 529, -1, 363, 316, 60, -1, 395, 406, 60, + 528, 745, 529, -1, 363, 406, 60, -1, 33, 567, 559, 544, -1, 33, 567, 559, 138, 280, 285, -1, 33, 567, 559, 395, 280, 285, -1, 33, 567, 559, 395, 413, 614, -1, 33, 567, 559, 395, 637, -1, 33, 567, 559, 363, 637, -1, 33, 567, 559, 395, - 416, 559, -1, 33, 567, 559, 27, 178, 671, 41, + 416, 559, -1, 33, 567, 559, 27, 178, 673, 41, 193, 625, -1, 33, 567, 559, 543, -1, 33, 567, 559, 138, 193, -1, 33, 567, 559, 138, 193, 194, - 154, -1, 138, 567, 194, 154, 549, 676, -1, 138, - 567, 549, 676, -1, 33, 567, 559, 556, 451, 821, - 818, 552, -1, 33, 567, 559, 555, -1, 27, 639, - -1, 33, 94, 955, 623, -1, 470, 94, 955, -1, - 138, 94, 194, 154, 955, 676, -1, 138, 94, 955, - 676, -1, 395, 248, -1, 395, 460, -1, 395, 637, - -1, 363, 637, -1, 555, -1, 467, 858, -1, -1, - 633, -1, 395, 633, -1, 27, 633, -1, 138, 647, + 154, -1, 138, 567, 194, 154, 549, 678, -1, 138, + 567, 549, 678, -1, 33, 567, 559, 556, 451, 823, + 820, 552, -1, 33, 567, 559, 555, -1, 27, 639, + -1, 33, 94, 957, 623, -1, 470, 94, 957, -1, + 138, 94, 194, 154, 957, 678, -1, 138, 94, 957, + 678, -1, 395, 248, -1, 395, 460, -1, 395, 637, + -1, 363, 637, -1, 555, -1, 467, 860, -1, -1, + 633, -1, 395, 633, -1, 27, 633, -1, 138, 649, -1, 551, -1, 554, 532, 551, -1, 299, 528, 546, - 529, -1, 395, 108, -1, 395, -1, -1, 112, 955, - -1, 112, 332, 955, -1, 112, 31, -1, 112, 332, - 31, -1, 560, -1, 559, 562, -1, 3, -1, 1041, - -1, 1042, -1, 559, -1, 5, -1, 5, -1, 563, + 529, -1, 395, 108, -1, 395, -1, -1, 112, 957, + -1, 112, 332, 957, -1, 112, 31, -1, 112, 332, + 31, -1, 560, -1, 559, 562, -1, 3, -1, 1043, + -1, 1044, -1, 559, -1, 5, -1, 5, -1, 563, -1, 562, 563, -1, 530, 564, -1, 565, -1, 3, - -1, 1045, -1, 1041, -1, 1047, -1, 33, 379, 955, - 359, 440, 955, -1, 33, 427, 809, 359, 440, 955, - -1, 33, 427, 194, 154, 809, 359, 440, 955, -1, - 33, 390, 558, 359, 440, 955, -1, 33, 390, 194, - 154, 558, 359, 440, 955, -1, 33, 480, 558, 359, - 440, 955, -1, 33, 480, 194, 154, 558, 359, 440, - 955, -1, 33, 205, 558, 359, 440, 955, -1, 33, - 205, 194, 154, 558, 359, 440, 955, -1, 33, 427, - 809, 359, 567, 549, 440, 955, -1, 33, 427, 194, - 154, 809, 359, 567, 549, 440, 955, -1, 33, 427, - 809, 359, 94, 955, 440, 955, -1, 33, 427, 194, - 154, 809, 359, 94, 955, 440, 955, -1, 83, -1, + -1, 1047, -1, 1043, -1, 1049, -1, 33, 379, 957, + 359, 440, 957, -1, 33, 427, 811, 359, 440, 957, + -1, 33, 427, 194, 154, 811, 359, 440, 957, -1, + 33, 390, 558, 359, 440, 957, -1, 33, 390, 194, + 154, 558, 359, 440, 957, -1, 33, 480, 558, 359, + 440, 957, -1, 33, 480, 194, 154, 558, 359, 440, + 957, -1, 33, 205, 558, 359, 440, 957, -1, 33, + 205, 194, 154, 558, 359, 440, 957, -1, 33, 427, + 811, 359, 567, 549, 440, 957, -1, 33, 427, 194, + 154, 811, 359, 567, 549, 440, 957, -1, 33, 427, + 811, 359, 94, 957, 440, 957, -1, 33, 427, 194, + 154, 811, 359, 94, 957, 440, 957, -1, 83, -1, -1, 573, 215, 576, 222, 570, 571, 569, 577, 579, - -1, 714, -1, 309, 580, 472, 714, -1, 528, 584, - 529, 714, -1, 528, 584, 529, 309, 580, 472, 714, + -1, 716, -1, 309, 580, 472, 716, -1, 528, 584, + 529, 716, -1, 528, 584, 529, 309, 580, 472, 716, -1, 118, 473, -1, 558, -1, 558, 41, 559, -1, 60, 271, -1, 60, 327, -1, -1, 528, 587, 529, - 815, -1, 295, 94, 955, -1, -1, 726, -1, -1, - 559, 929, -1, 588, 517, 858, -1, 528, 581, 529, - 517, 858, -1, 300, 361, -1, 300, 195, -1, -1, - 295, 92, 572, 134, 464, 395, 586, 815, -1, 295, - 92, 572, 134, 281, -1, -1, 559, 582, 583, 745, - 746, -1, 870, 582, 583, 745, 746, -1, 528, 858, - 529, 582, 583, 745, 746, -1, 367, 935, -1, -1, + 817, -1, 295, 94, 957, -1, -1, 728, -1, -1, + 559, 931, -1, 588, 517, 860, -1, 528, 581, 529, + 517, 860, -1, 300, 361, -1, 300, 195, -1, -1, + 295, 92, 572, 134, 464, 395, 586, 817, -1, 295, + 92, 572, 134, 281, -1, -1, 559, 582, 583, 747, + 748, -1, 872, 582, 583, 747, 748, -1, 528, 860, + 529, 582, 583, 747, 748, -1, 367, 937, -1, -1, 466, -1, 426, -1, 588, -1, 581, 532, 588, -1, - 81, 962, -1, -1, 962, -1, -1, 574, -1, 584, + 81, 964, -1, -1, 964, -1, -1, 574, -1, 584, 532, 574, -1, 575, -1, 585, 532, 575, -1, 585, -1, 585, 532, -1, 578, -1, 587, 532, 578, -1, - 559, 929, -1, 101, 670, 451, 558, 41, 590, -1, - 101, 670, 451, 194, 280, 154, 558, 41, 590, -1, - 101, 300, 361, 670, 451, 558, 41, 590, -1, 145, - 715, -1, 145, 528, 591, 529, -1, 822, -1, 592, + 559, 931, -1, 101, 672, 451, 558, 41, 590, -1, + 101, 672, 451, 194, 280, 154, 558, 41, 590, -1, + 101, 300, 361, 672, 451, 558, 41, 590, -1, 145, + 717, -1, 145, 528, 591, 529, -1, 824, -1, 592, -1, -1, 561, -1, 592, 532, 561, -1, 329, 559, - -1, 329, 559, 517, 1004, -1, 329, 559, 528, 908, - 529, -1, 101, 670, 390, 558, 595, -1, 101, 670, + -1, 329, 559, 517, 1006, -1, 329, 559, 528, 910, + 529, -1, 101, 672, 390, 558, 595, -1, 101, 672, 390, 194, 280, 154, 558, 595, -1, 101, 300, 361, - 670, 390, 558, 595, -1, 609, -1, -1, 101, 598, + 672, 390, 558, 595, -1, 609, -1, -1, 101, 598, 386, 597, 599, 528, 602, 529, -1, 101, 598, 386, 194, 280, 154, 597, 599, 528, 602, 529, -1, 101, 300, 361, 598, 386, 597, 599, 528, 602, 529, -1, -1, 559, -1, -1, 434, -1, 320, -1, -1, 201, - 3, -1, 858, -1, 565, 600, -1, 601, -1, 602, - 532, 601, -1, 573, 464, 159, 659, -1, 153, 955, - 607, -1, 101, 670, 427, 1040, 41, 153, 955, 607, - 1039, -1, 101, 670, 427, 194, 280, 154, 1040, 41, - 153, 955, 607, 1039, -1, 858, -1, 965, 13, 858, + 3, -1, 860, -1, 565, 600, -1, 601, -1, 602, + 532, 601, -1, 573, 464, 159, 661, -1, 153, 957, + 607, -1, 101, 672, 427, 1042, 41, 153, 957, 607, + 1041, -1, 101, 672, 427, 194, 280, 154, 1042, 41, + 153, 957, 607, 1041, -1, 860, -1, 967, 13, 860, -1, 605, -1, 606, 532, 605, -1, 528, 606, 529, -1, -1, 33, 390, 558, 609, -1, 33, 390, 194, 154, 558, 609, -1, 612, -1, 609, 612, -1, 490, -1, 514, -1, -1, 4, -1, 519, 4, -1, 520, - 4, -1, 614, -1, 41, 825, -1, 61, 611, -1, + 4, -1, 614, -1, 41, 827, -1, 61, 611, -1, 107, -1, 278, 107, -1, 204, 613, 611, -1, 255, 611, -1, 266, 611, -1, 278, 255, -1, 278, 266, - -1, 310, 60, 962, -1, 390, 271, 962, -1, 411, + -1, 310, 60, 964, -1, 390, 271, 964, -1, 411, 610, 611, -1, 365, -1, 365, 610, 611, -1, 60, - -1, -1, 958, -1, 519, 958, -1, 520, 958, -1, + -1, -1, 960, -1, 519, 960, -1, 520, 960, -1, 33, 109, 559, 359, 440, 559, -1, 33, 109, 194, 154, 559, 359, 440, 559, -1, 138, 598, 386, 559, 617, -1, 138, 598, 386, 194, 154, 559, 617, -1, @@ -2092,589 +2093,592 @@ static const yytype_int16 yyrhs[] = -1, 411, 619, 620, -1, 87, 619, -1, 144, 619, -1, 372, 619, -1, 493, -1, 442, -1, -1, 347, 296, -1, 347, 495, -1, -1, 465, 558, -1, 101, - 670, 427, 558, 528, 657, 529, 644, 636, -1, 101, - 670, 427, 194, 280, 154, 558, 528, 657, 529, 644, - 636, -1, 101, 300, 361, 670, 427, 558, 528, 657, - 529, 644, 636, -1, -1, 623, 648, -1, 665, -1, - 1047, -1, 900, -1, 611, -1, 561, -1, 279, -1, - 528, 609, 529, -1, -1, 561, -1, 278, 26, -1, - 366, -1, 64, -1, 395, 285, -1, 395, 118, -1, - 94, 955, 629, -1, 629, -1, 643, -1, 81, 962, - -1, 280, 285, -1, 285, -1, 457, 656, -1, 335, - 229, 656, -1, 75, 528, 858, 529, 638, -1, 467, - 89, 955, -1, 118, 859, -1, 353, 558, 659, 668, - 635, -1, 482, -1, 417, -1, 630, -1, -1, 178, - 671, 41, 193, 625, -1, 178, 671, 41, 528, 858, - 529, 631, -1, 41, 528, 858, 529, 631, -1, 647, - 626, -1, 295, 464, 627, -1, 634, -1, 661, -1, - 634, 661, -1, 661, 634, -1, -1, 295, 87, 138, - -1, 295, 87, 123, 375, -1, 295, 87, 334, 375, - -1, -1, 528, 641, 529, -1, 278, 207, -1, -1, - 94, 955, 666, -1, 666, -1, 86, -1, 95, -1, - 119, -1, 193, -1, 206, -1, 413, -1, 416, -1, - 31, -1, 662, -1, 641, 532, 662, -1, 467, 205, - 653, -1, 120, -1, 280, 120, -1, 209, 121, -1, - 209, 197, -1, 490, 637, -1, 490, 293, -1, 492, - 293, -1, -1, 528, 652, 529, -1, 646, 203, 640, - -1, 646, 151, 640, -1, -1, 565, -1, 280, 120, - -1, 120, -1, 209, 197, -1, 209, 121, -1, 280, - 469, -1, 278, 207, -1, 822, 660, -1, 821, 632, - 660, -1, 559, 649, -1, 559, 650, -1, 655, -1, - 652, 532, 655, -1, 559, -1, 651, -1, 669, -1, - 639, -1, 565, 517, 624, -1, 565, -1, 490, 645, - -1, -1, 667, -1, 667, 532, -1, -1, 559, -1, - 528, 663, 529, -1, -1, 660, 628, -1, -1, 295, - 123, 627, -1, 565, 517, 624, -1, 565, -1, 565, - 530, 565, 517, 624, -1, 565, 530, 565, -1, 658, - -1, 663, 532, 658, -1, 663, -1, 663, 532, -1, - 822, -1, 959, 963, 523, 451, -1, 396, 959, 963, - 523, 451, -1, 75, 528, 858, 529, 623, -1, 457, - 528, 664, 529, 656, 623, -1, 457, 642, 623, -1, - 335, 229, 528, 664, 529, 656, 623, -1, 335, 229, - 642, 623, -1, 171, 229, 528, 664, 529, 353, 558, - 659, 668, 635, 623, -1, 654, -1, 667, 532, 654, - -1, 252, 175, -1, 252, 314, -1, 252, 401, -1, - -1, 240, 558, 646, -1, 434, -1, 432, -1, 244, - 434, -1, 244, 432, -1, 180, 434, -1, 180, 432, - -1, 460, -1, -1, 34, -1, 60, 118, -1, 138, - 673, 194, 154, 675, 676, -1, 138, 673, 675, 676, - -1, 138, 674, 194, 154, 952, 676, -1, 138, 674, - 952, 676, -1, 138, 677, 955, 295, 962, 676, -1, - 138, 677, 194, 154, 955, 295, 962, 676, -1, 427, - -1, 390, -1, 176, -1, 249, -1, 249, 427, -1, - 480, -1, 254, 480, -1, 205, -1, 171, 427, -1, - 82, -1, 98, -1, 379, -1, 413, -1, 435, 383, - 313, -1, 435, 383, 130, -1, 435, 383, 433, -1, - 435, 383, 91, -1, 451, -1, 25, 257, -1, 148, - 445, -1, 158, -1, 171, 108, 494, -1, 341, -1, - 393, -1, 962, -1, 675, 532, 962, -1, 64, -1, - 366, -1, -1, 326, -1, 376, -1, 445, -1, 573, - 256, 222, 1015, 467, 792, 808, 688, 579, -1, 37, - 858, -1, -1, 528, 584, 529, -1, -1, 521, -1, - -1, 464, 395, 586, -1, 464, 395, 521, -1, 464, - 571, -1, 123, -1, 215, 680, 473, 528, 906, 529, - -1, 215, 571, 681, -1, 215, 118, 473, -1, 134, - 281, -1, 146, 683, -1, 858, -1, -1, 486, 253, - 679, 436, 682, -1, 60, 407, -1, 60, 431, -1, - -1, 486, 280, 253, 685, 679, 436, 682, -1, 684, - -1, 686, -1, 687, -1, 687, 688, -1, 101, 670, - 696, 558, 693, -1, 101, 670, 696, 194, 280, 154, - 558, 693, -1, 101, 300, 361, 670, 696, 558, 693, - -1, 101, 670, 696, 558, 695, -1, 101, 670, 696, - 194, 280, 154, 558, 695, -1, 101, 300, 361, 670, - 696, 558, 695, -1, 697, 41, 427, 716, -1, 697, - 41, 427, 715, -1, 691, -1, 692, 532, 691, -1, - 690, -1, 692, -1, 697, 41, 858, -1, 694, -1, - 695, 532, 694, -1, 176, -1, 249, -1, 528, 529, - -1, 528, 698, 532, 529, -1, 528, 698, 529, -1, - 699, -1, 698, 532, 699, -1, 965, 821, -1, 965, - 821, 13, 858, -1, 965, 821, 14, 858, -1, 573, - 464, 1015, 395, 586, 788, 1016, 579, -1, 99, 711, - 558, 659, 709, 703, 707, 713, 704, 610, 708, -1, - 99, 528, 714, 529, 440, 707, 713, 610, 708, -1, - 99, 174, 109, 559, 440, 559, 702, -1, -1, 528, - 379, 529, -1, 528, 108, 529, -1, 174, -1, 440, - -1, 705, 125, 561, -1, -1, 467, -1, -1, 41, - -1, -1, 340, -1, -1, 710, -1, 528, 1025, 529, - -1, 490, 293, -1, -1, 710, 712, -1, -1, 56, - -1, -1, 56, -1, 293, -1, 173, -1, 124, 706, - 561, -1, 285, 706, 561, -1, 103, -1, 189, -1, - 345, 706, 561, -1, 147, 706, 561, -1, 170, 345, - 663, -1, 170, 345, 521, -1, 315, 60, 663, -1, - 315, 60, 521, -1, 170, 280, 285, 663, -1, 170, - 285, 663, -1, 142, 561, -1, 561, -1, 414, -1, - 415, -1, 3, 530, 559, -1, 3, -1, 528, 858, - 529, -1, 863, -1, 716, -1, 715, -1, 528, 716, - 529, -1, 528, 715, 529, -1, 528, 1030, 529, -1, - 719, -1, 717, 742, -1, 717, 741, 779, 748, -1, - 717, 741, 747, 780, -1, 726, 717, -1, 726, 717, - 742, -1, 726, 717, 741, 779, 748, -1, 726, 717, - 741, 747, 780, -1, 719, -1, 715, -1, 388, 739, - 934, -1, -1, 388, 739, 934, 733, 788, 815, 768, - 777, 876, 778, 753, -1, 388, 738, 936, 733, 788, - 815, 768, 777, 876, 778, 753, -1, 174, 789, 718, - 733, 815, 768, 777, 876, 778, 753, -1, 174, 789, - 388, 738, 936, 733, 815, 768, 777, 876, 778, 753, - -1, 787, -1, 427, 809, -1, 717, 456, 736, 737, - 717, -1, 717, 456, 736, 717, -1, 717, 220, 736, - 717, -1, 717, 149, 736, 717, -1, 721, 792, 467, - 936, -1, 721, 792, 467, 936, 183, 60, 954, -1, - 721, 792, 183, 60, 954, -1, 721, 792, 295, 725, - -1, 721, 792, 295, 725, 183, 60, 954, -1, 721, - 792, 295, 725, 467, 936, -1, 721, 792, 295, 725, - 467, 936, 183, 60, 954, -1, 722, 792, 295, 936, - 222, 271, 955, 720, 954, -1, 722, 792, 295, 936, - -1, 472, -1, 473, -1, 321, -1, 323, -1, 462, - -1, 322, -1, 859, -1, 859, 201, 528, 716, 529, - -1, 795, -1, 723, -1, 724, 532, 723, -1, 724, - -1, 724, 532, -1, 490, 727, -1, 514, 727, -1, - 490, 351, 727, -1, 728, -1, 727, 532, 728, -1, - 955, 964, 729, 41, 732, 528, 969, 529, -1, 467, - 229, 528, 730, 529, -1, -1, 731, -1, 731, 532, - -1, 926, -1, 731, 532, 926, -1, 254, -1, 280, - 254, -1, -1, 222, 734, -1, -1, 434, 735, 558, - -1, 432, 735, 558, -1, 244, 434, 735, 558, -1, - 244, 432, 735, 558, -1, 180, 434, 735, 558, -1, - 180, 432, 735, 558, -1, 460, 735, 558, -1, 427, - 558, -1, 558, -1, 427, -1, -1, 31, -1, 133, - -1, -1, 60, 271, -1, 133, -1, 133, 295, 528, - 906, 529, -1, 31, -1, -1, 195, 287, -1, 364, - 287, -1, -1, 742, -1, -1, 301, 60, 743, -1, - 301, 60, 31, 745, 746, -1, 744, -1, 743, 532, - 744, -1, 858, 467, 900, 746, -1, 858, 745, 746, - -1, 42, -1, 127, -1, -1, 513, 166, -1, 513, - 234, -1, -1, 749, 750, -1, 750, 749, -1, 749, - -1, 750, -1, 747, -1, -1, 241, 762, -1, 241, - 762, 532, 763, -1, 164, 767, 764, 766, 296, -1, - 164, 767, 766, 296, -1, 292, 763, -1, 292, 764, - 766, -1, 4, -1, 9, -1, 863, -1, 751, 523, - -1, 751, 319, -1, 751, -1, 751, 375, -1, 467, - 377, 755, -1, -1, 559, -1, -1, 754, 528, 752, - 529, 758, -1, 752, -1, 752, 528, 559, 529, -1, - 752, 528, 559, 532, 9, 529, -1, 429, 755, -1, - 756, -1, -1, 360, 528, 9, 529, -1, -1, 439, - -1, 479, -1, 759, 14, 858, -1, 47, 528, 760, - 529, -1, -1, 858, -1, 31, -1, 858, 523, -1, - 4, 319, -1, 9, 319, -1, 858, -1, 860, -1, - 519, 765, -1, 520, 765, -1, 958, -1, 4, -1, - 374, -1, 375, -1, 166, -1, 277, -1, 183, 60, - 770, -1, 183, 60, 31, -1, -1, 771, -1, 769, - 532, 771, -1, 769, -1, 769, 532, -1, 858, -1, - 772, -1, 774, -1, 773, -1, 775, -1, 528, 529, - -1, 373, 528, 906, 529, -1, 104, 528, 906, 529, - -1, 184, 397, 528, 770, 529, -1, 184, -1, 185, - -1, 188, 858, -1, -1, 342, 858, -1, -1, 781, - -1, 169, 347, 296, -1, 779, -1, -1, 782, -1, - 781, 782, -1, 783, 784, 785, -1, 169, 464, -1, - 169, 278, 229, 464, -1, 169, 398, -1, 169, 229, - 398, -1, 290, 951, -1, -1, 284, -1, 402, 247, - -1, -1, 473, 528, 906, 529, -1, 786, 532, 528, - 906, 529, -1, 786, -1, 786, 532, -1, 174, 790, - -1, -1, 792, -1, 789, 532, 792, -1, 789, -1, - 789, 532, -1, 560, 19, -1, 809, 804, 761, 757, - -1, 791, 809, 761, 757, -1, 810, 805, 757, -1, - 791, 810, 757, -1, 787, 803, 757, -1, 235, 810, - 805, -1, 715, 804, 757, -1, 791, 715, 757, -1, - 235, 715, 804, -1, 802, -1, 528, 802, 529, 803, - -1, 791, 528, 802, 529, -1, 792, 321, 528, 936, - 169, 798, 793, 529, 804, -1, 792, 462, 794, 528, - 799, 169, 801, 529, 804, -1, 183, 60, 953, -1, - -1, 202, 287, -1, 150, 287, -1, -1, 859, 201, - 528, 936, 529, -1, 859, 201, 560, -1, 861, -1, - 864, -1, 528, 904, 529, -1, 796, 201, 528, 936, - 529, -1, 796, 201, 560, -1, 797, -1, 798, 797, - -1, 560, -1, 528, 953, 529, -1, 799, 201, 528, - 936, 529, -1, 800, -1, 801, 800, -1, 528, 802, - 529, -1, 792, 102, 227, 792, -1, 792, 806, 227, - 792, 808, -1, 792, 227, 792, 808, -1, 792, 274, - 806, 227, 792, -1, 792, 274, 227, 792, -1, 792, - 43, 806, 227, 792, 808, -1, 792, 43, 227, 792, - 808, -1, 792, 328, 227, 792, -1, 792, 38, 227, - 792, 808, -1, 792, 389, 227, 792, 808, -1, 41, - 560, 528, 953, 529, -1, 41, 560, -1, 559, 528, - 953, 529, -1, 559, -1, 803, -1, -1, 803, -1, - 41, 528, 816, 529, -1, 41, 560, 528, 816, 529, - -1, 559, 528, 816, 529, -1, -1, 175, 807, -1, - 238, 807, -1, 370, 807, -1, 389, -1, 38, -1, - 211, -1, 305, -1, -1, 467, 528, 953, 529, -1, - 295, 858, -1, 558, -1, 558, 521, -1, 296, 558, - -1, 296, 528, 558, 529, -1, 870, 814, -1, 375, - 174, 528, 812, 529, 814, -1, 870, 813, -1, 811, - -1, 812, 532, 811, -1, 41, 528, 816, 529, -1, - -1, 514, 302, -1, -1, 487, 858, -1, -1, 817, - -1, 816, 532, 817, -1, 560, 822, 818, -1, 81, - 962, -1, -1, 559, 822, -1, 819, 532, 559, 822, - -1, 374, -1, 420, -1, 822, -1, -1, 825, 824, - -1, 396, 825, 824, -1, 825, 40, 526, 958, 527, - -1, 396, 825, 40, 526, 958, 527, -1, 825, 40, - -1, 396, 825, 40, -1, 823, 824, -1, 820, 528, - 819, 529, 824, -1, 250, 528, 910, 529, 824, -1, - 456, 528, 819, 529, 824, -1, 3, 530, 3, -1, - 823, 530, 3, -1, 824, 526, 527, -1, 824, 526, - 958, 527, -1, -1, 827, -1, 829, -1, 831, -1, - 835, -1, 841, -1, 842, 857, -1, 842, 528, 958, - 529, -1, 829, -1, 832, -1, 836, -1, 841, -1, - 961, 828, -1, 528, 907, 529, -1, -1, 218, -1, - 219, -1, 403, -1, 55, -1, 348, -1, 167, 830, - -1, 137, 331, -1, 116, 828, -1, 113, 828, -1, - 288, 828, -1, 58, -1, 528, 958, 529, -1, -1, - 833, -1, 834, -1, 833, -1, 834, -1, 57, 840, - 528, 906, 529, -1, 57, 840, -1, 837, -1, 838, - -1, 837, -1, 838, -1, 839, 528, 958, 529, -1, - 839, -1, 73, 840, -1, 72, 840, -1, 474, -1, - 273, 73, 840, -1, 273, 72, 840, -1, 275, 840, - -1, 477, -1, -1, 439, 528, 958, 529, 843, -1, - 439, 843, -1, 438, 528, 958, 529, 843, -1, 438, - 843, -1, 221, -1, 514, 438, 511, -1, 492, 438, - 511, -1, -1, 508, -1, 509, -1, 268, -1, 269, - -1, 110, -1, 111, -1, 191, -1, 192, -1, 264, - -1, 265, -1, 384, -1, 385, -1, 262, -1, 263, - -1, 258, -1, 259, -1, 484, -1, 485, -1, 343, - -1, 344, -1, 114, -1, 115, -1, 70, -1, 69, - -1, 261, -1, 260, -1, 844, -1, 845, -1, 846, - -1, 847, -1, 848, -1, 849, -1, 850, -1, 851, - -1, 852, -1, 853, -1, 854, -1, 855, -1, 856, - -1, 844, 440, 845, -1, 846, 440, 847, -1, 846, - 440, 848, -1, 846, 440, 849, -1, 847, 440, 848, - -1, 847, 440, 849, -1, 848, 440, 849, -1, -1, - 860, -1, 858, 11, 822, -1, 858, 81, 962, -1, - 858, 47, 438, 511, 858, -1, 519, 858, -1, 520, - 858, -1, 858, 519, 858, -1, 858, 520, 858, -1, - 858, 521, 858, -1, 858, 522, 858, -1, 858, 15, - 858, -1, 858, 523, 858, -1, 858, 524, 858, -1, - 858, 16, 858, -1, 858, 515, 858, -1, 858, 516, - 858, -1, 858, 517, 858, -1, 858, 20, 858, -1, - 858, 21, 858, -1, 858, 22, 858, -1, 858, 899, - 858, -1, 899, 858, -1, 858, 899, -1, 858, 37, - 858, -1, 858, 300, 858, -1, 280, 858, -1, 512, - 858, -1, 858, 179, 858, -1, 858, 240, 858, -1, - 858, 240, 858, 147, 858, -1, 858, 512, 240, 858, - -1, 858, 512, 240, 858, 147, 858, -1, 858, 196, - 858, -1, 858, 196, 858, 147, 858, -1, 858, 512, - 196, 858, -1, 858, 512, 196, 858, 147, 858, -1, - 858, 400, 440, 858, -1, 858, 400, 440, 858, 147, - 858, -1, 858, 512, 400, 440, 858, -1, 858, 512, - 400, 440, 858, 147, 858, -1, 858, 224, 285, -1, - 858, 225, -1, 858, 224, 280, 285, -1, 858, 280, - 285, -1, 858, 283, -1, 231, 952, 19, 858, -1, - 858, 17, 858, -1, 858, 18, 858, -1, 888, 307, - 888, -1, 858, 224, 447, -1, 858, 224, 280, 447, - -1, 858, 224, 162, -1, 858, 224, 280, 162, -1, - 858, 224, 458, -1, 858, 224, 280, 458, -1, 858, - 224, 133, 174, 858, -1, 858, 224, 280, 133, 174, - 858, -1, 858, 224, 290, 528, 910, 529, -1, 858, - 224, 280, 290, 528, 910, 529, -1, 858, 54, 933, - 859, 37, 858, -1, 858, 512, 54, 933, 859, 37, - 858, -1, 858, 54, 424, 859, 37, 858, -1, 858, - 512, 54, 424, 859, 37, 858, -1, 858, 201, 920, - -1, 858, 512, 201, 920, -1, 858, 901, 896, 715, - -1, 858, 901, 896, 528, 858, 529, -1, 118, -1, - 84, 528, 858, 529, -1, 461, 528, 858, 529, -1, - 521, 84, 528, 858, 529, -1, 521, 942, 946, 950, - -1, 559, 530, 521, 942, 946, 950, -1, 860, -1, - 859, 11, 822, -1, 519, 859, -1, 520, 859, -1, - 859, 519, 859, -1, 859, 520, 859, -1, 859, 521, - 859, -1, 859, 522, 859, -1, 859, 15, 859, -1, - 859, 523, 859, -1, 859, 524, 859, -1, 859, 16, - 859, -1, 859, 515, 859, -1, 859, 516, 859, -1, - 859, 517, 859, -1, 859, 20, 859, -1, 859, 21, - 859, -1, 859, 22, 859, -1, 859, 899, 859, -1, - 899, 859, -1, 859, 899, -1, 859, 224, 133, 174, - 859, -1, 859, 224, 280, 133, 174, 859, -1, 859, - 224, 290, 528, 910, 529, -1, 859, 224, 280, 290, - 528, 910, 529, -1, 861, -1, 862, 932, -1, 927, - -1, 957, -1, 715, -1, 715, 562, -1, 154, 715, - -1, 776, 528, 906, 529, -1, 528, 858, 529, -1, - 864, -1, 888, -1, 533, -1, 10, -1, 534, 565, - -1, 863, -1, 866, -1, 867, -1, 869, -1, 921, - -1, 865, -1, 872, -1, 40, 715, -1, 40, 526, - 907, 527, -1, 535, 9, -1, 526, 907, 527, -1, - 536, 891, 537, -1, 250, 536, 895, 537, -1, 956, - 528, 529, -1, 956, 528, 742, 740, 529, -1, 956, - 528, 908, 741, 740, 529, -1, 956, 528, 476, 909, - 741, 740, 529, -1, 956, 528, 908, 532, 476, 909, - 741, 740, 529, -1, 956, 528, 31, 908, 741, 740, - 529, -1, 956, 528, 133, 908, 741, 740, 529, -1, - 868, 873, 874, 875, 879, -1, 871, -1, 868, -1, - 871, -1, 82, 169, 528, 858, 529, -1, 67, 528, - 858, 41, 822, 529, -1, 450, 528, 858, 41, 822, - 529, -1, 161, 528, 911, 529, -1, 308, 528, 913, - 529, -1, 327, 528, 915, 529, -1, 422, 528, 916, - 529, -1, 444, 528, 858, 41, 822, 529, -1, 446, - 528, 59, 919, 529, -1, 446, 528, 236, 919, 529, - -1, 446, 528, 441, 919, 529, -1, 446, 528, 919, - 529, -1, 286, 528, 858, 532, 858, 529, -1, 80, - 528, 906, 529, -1, 526, 858, 169, 952, 201, 858, - 527, -1, 526, 858, 169, 952, 201, 860, 194, 858, - 527, -1, 491, 183, 528, 742, 529, -1, -1, 165, - 528, 487, 858, 529, -1, 165, 528, 858, 529, -1, - -1, 157, -1, -1, 489, 877, -1, -1, 878, -1, - 877, 532, 878, -1, 559, 41, 880, -1, 306, 880, - -1, 306, 559, -1, -1, 528, 881, 882, 741, 883, - 529, -1, 559, -1, -1, 315, 60, 905, -1, -1, - 346, 884, 886, -1, 375, 884, 886, -1, 186, 884, - 886, -1, -1, 885, -1, 54, 885, 37, 885, -1, - 453, 330, -1, 453, 168, -1, 105, 374, -1, 858, - 330, -1, 858, 168, -1, 150, 105, 374, -1, 150, - 183, -1, 150, 437, -1, 150, 278, 303, -1, -1, - 374, 528, 906, 529, -1, 374, 528, 529, -1, 887, - -1, 528, 905, 532, 858, 529, -1, 560, 19, 858, - -1, 889, -1, 890, 532, 889, -1, 890, -1, 890, - 532, -1, 858, 19, 858, -1, 892, -1, 893, 532, - 892, -1, 893, -1, 893, 532, -1, 894, -1, -1, - 39, -1, 405, -1, 31, -1, 8, -1, 898, -1, - 519, -1, 520, -1, 521, -1, 522, -1, 15, -1, - 523, -1, 524, -1, 16, -1, 515, -1, 516, -1, - 517, -1, 20, -1, 21, -1, 22, -1, 8, -1, - 297, 528, 902, 529, -1, 897, -1, 297, 528, 902, - 529, -1, 897, -1, 297, 528, 902, 529, -1, 240, - -1, 512, 240, -1, 179, -1, 512, 179, -1, 196, - -1, 512, 196, -1, 897, -1, 559, 530, 902, -1, - 860, -1, 903, 532, 860, -1, 903, -1, 903, 532, - -1, 858, -1, 905, 532, 858, -1, 905, -1, 905, - 532, -1, 906, -1, -1, 909, -1, 908, 532, 909, - -1, 858, -1, 965, 13, 858, -1, 965, 14, 858, - -1, 822, -1, 910, 532, 822, -1, 912, 174, 858, - -1, -1, 3, -1, 844, -1, 845, -1, 846, -1, + 672, 427, 558, 528, 659, 529, 644, 646, 636, -1, + 101, 672, 427, 194, 280, 154, 558, 528, 659, 529, + 644, 646, 636, -1, 101, 300, 361, 672, 427, 558, + 528, 659, 529, 644, 646, 636, -1, -1, 623, 650, + -1, 667, -1, 1049, -1, 902, -1, 611, -1, 561, + -1, 279, -1, 528, 609, 529, -1, -1, 561, -1, + 278, 26, -1, 366, -1, 64, -1, 395, 285, -1, + 395, 118, -1, 94, 957, 629, -1, 629, -1, 643, + -1, 81, 964, -1, 280, 285, -1, 285, -1, 457, + 658, -1, 335, 229, 658, -1, 75, 528, 860, 529, + 638, -1, 467, 89, 957, -1, 118, 861, -1, 353, + 558, 661, 670, 635, -1, 482, -1, 417, -1, 630, + -1, -1, 178, 673, 41, 193, 625, -1, 178, 673, + 41, 528, 860, 529, 631, -1, 41, 528, 860, 529, + 631, -1, 649, 626, -1, 295, 464, 627, -1, 634, + -1, 663, -1, 634, 663, -1, 663, 634, -1, -1, + 295, 87, 138, -1, 295, 87, 123, 375, -1, 295, + 87, 334, 375, -1, -1, 528, 641, 529, -1, 278, + 207, -1, -1, 94, 957, 668, -1, 668, -1, 86, + -1, 95, -1, 119, -1, 193, -1, 206, -1, 413, + -1, 416, -1, 31, -1, 664, -1, 641, 532, 664, + -1, 467, 205, 655, -1, 120, -1, 280, 120, -1, + 209, 121, -1, 209, 197, -1, 644, 645, -1, -1, + 316, 60, 528, 908, 529, -1, 406, 60, 528, 908, + 529, -1, 490, 637, -1, 490, 293, -1, 492, 293, + -1, -1, 528, 654, 529, -1, 648, 203, 640, -1, + 648, 151, 640, -1, -1, 565, -1, 280, 120, -1, + 120, -1, 209, 197, -1, 209, 121, -1, 280, 469, + -1, 278, 207, -1, 824, 662, -1, 823, 632, 662, + -1, 559, 651, -1, 559, 652, -1, 657, -1, 654, + 532, 657, -1, 559, -1, 653, -1, 671, -1, 639, + -1, 565, 517, 624, -1, 565, -1, 490, 647, -1, + -1, 669, -1, 669, 532, -1, -1, 559, -1, 528, + 665, 529, -1, -1, 662, 628, -1, -1, 295, 123, + 627, -1, 565, 517, 860, -1, 565, -1, 565, 530, + 565, 517, 624, -1, 565, 530, 565, -1, 561, 517, + 860, -1, 660, -1, 665, 532, 660, -1, 665, -1, + 665, 532, -1, 824, -1, 961, 965, 523, 451, -1, + 396, 961, 965, 523, 451, -1, 75, 528, 860, 529, + 623, -1, 457, 528, 666, 529, 658, 623, -1, 457, + 642, 623, -1, 335, 229, 528, 666, 529, 658, 623, + -1, 335, 229, 642, 623, -1, 171, 229, 528, 666, + 529, 353, 558, 661, 670, 635, 623, -1, 656, -1, + 669, 532, 656, -1, 252, 175, -1, 252, 314, -1, + 252, 401, -1, -1, 240, 558, 648, -1, 434, -1, + 432, -1, 244, 434, -1, 244, 432, -1, 180, 434, + -1, 180, 432, -1, 460, -1, -1, 34, -1, 60, + 118, -1, 138, 675, 194, 154, 677, 678, -1, 138, + 675, 677, 678, -1, 138, 676, 194, 154, 954, 678, + -1, 138, 676, 954, 678, -1, 138, 679, 957, 295, + 964, 678, -1, 138, 679, 194, 154, 957, 295, 964, + 678, -1, 427, -1, 390, -1, 176, -1, 249, -1, + 249, 427, -1, 480, -1, 254, 480, -1, 205, -1, + 171, 427, -1, 82, -1, 98, -1, 379, -1, 413, + -1, 435, 383, 313, -1, 435, 383, 130, -1, 435, + 383, 433, -1, 435, 383, 91, -1, 451, -1, 25, + 257, -1, 148, 445, -1, 158, -1, 171, 108, 494, + -1, 341, -1, 393, -1, 964, -1, 677, 532, 964, + -1, 64, -1, 366, -1, -1, 326, -1, 376, -1, + 445, -1, 573, 256, 222, 1017, 467, 794, 810, 690, + 579, -1, 37, 860, -1, -1, 528, 584, 529, -1, + -1, 521, -1, -1, 464, 395, 586, -1, 464, 395, + 521, -1, 464, 571, -1, 123, -1, 215, 682, 473, + 528, 908, 529, -1, 215, 571, 683, -1, 215, 118, + 473, -1, 134, 281, -1, 146, 685, -1, 860, -1, + -1, 486, 253, 681, 436, 684, -1, 60, 407, -1, + 60, 431, -1, -1, 486, 280, 253, 687, 681, 436, + 684, -1, 686, -1, 688, -1, 689, -1, 689, 690, + -1, 101, 672, 698, 558, 695, -1, 101, 672, 698, + 194, 280, 154, 558, 695, -1, 101, 300, 361, 672, + 698, 558, 695, -1, 101, 672, 698, 558, 697, -1, + 101, 672, 698, 194, 280, 154, 558, 697, -1, 101, + 300, 361, 672, 698, 558, 697, -1, 699, 41, 427, + 718, -1, 699, 41, 427, 717, -1, 693, -1, 694, + 532, 693, -1, 692, -1, 694, -1, 699, 41, 860, + -1, 696, -1, 697, 532, 696, -1, 176, -1, 249, + -1, 528, 529, -1, 528, 700, 532, 529, -1, 528, + 700, 529, -1, 701, -1, 700, 532, 701, -1, 967, + 823, -1, 967, 823, 13, 860, -1, 967, 823, 14, + 860, -1, 573, 464, 1017, 395, 586, 790, 1018, 579, + -1, 99, 713, 558, 661, 711, 705, 709, 715, 706, + 610, 710, -1, 99, 528, 716, 529, 440, 709, 715, + 610, 710, -1, 99, 174, 109, 559, 440, 559, 704, + -1, -1, 528, 379, 529, -1, 528, 108, 529, -1, + 174, -1, 440, -1, 707, 125, 561, -1, -1, 467, + -1, -1, 41, -1, -1, 340, -1, -1, 712, -1, + 528, 1027, 529, -1, 490, 293, -1, -1, 712, 714, + -1, -1, 56, -1, -1, 56, -1, 293, -1, 173, + -1, 124, 708, 561, -1, 285, 708, 561, -1, 103, + -1, 189, -1, 345, 708, 561, -1, 147, 708, 561, + -1, 170, 345, 665, -1, 170, 345, 521, -1, 315, + 60, 665, -1, 315, 60, 521, -1, 170, 280, 285, + 665, -1, 170, 285, 665, -1, 142, 561, -1, 561, + -1, 414, -1, 415, -1, 3, 530, 559, -1, 3, + -1, 528, 860, 529, -1, 865, -1, 718, -1, 717, + -1, 528, 718, 529, -1, 528, 717, 529, -1, 528, + 1032, 529, -1, 721, -1, 719, 744, -1, 719, 743, + 781, 750, -1, 719, 743, 749, 782, -1, 728, 719, + -1, 728, 719, 744, -1, 728, 719, 743, 781, 750, + -1, 728, 719, 743, 749, 782, -1, 721, -1, 717, + -1, 388, 741, 936, -1, -1, 388, 741, 936, 735, + 790, 817, 770, 779, 878, 780, 755, -1, 388, 740, + 938, 735, 790, 817, 770, 779, 878, 780, 755, -1, + 174, 791, 720, 735, 817, 770, 779, 878, 780, 755, + -1, 174, 791, 388, 740, 938, 735, 817, 770, 779, + 878, 780, 755, -1, 789, -1, 427, 811, -1, 719, + 456, 738, 739, 719, -1, 719, 456, 738, 719, -1, + 719, 220, 738, 719, -1, 719, 149, 738, 719, -1, + 723, 794, 467, 938, -1, 723, 794, 467, 938, 183, + 60, 956, -1, 723, 794, 183, 60, 956, -1, 723, + 794, 295, 727, -1, 723, 794, 295, 727, 183, 60, + 956, -1, 723, 794, 295, 727, 467, 938, -1, 723, + 794, 295, 727, 467, 938, 183, 60, 956, -1, 724, + 794, 295, 938, 222, 271, 957, 722, 956, -1, 724, + 794, 295, 938, -1, 472, -1, 473, -1, 321, -1, + 323, -1, 462, -1, 322, -1, 861, -1, 861, 201, + 528, 718, 529, -1, 797, -1, 725, -1, 726, 532, + 725, -1, 726, -1, 726, 532, -1, 490, 729, -1, + 514, 729, -1, 490, 351, 729, -1, 730, -1, 729, + 532, 730, -1, 957, 966, 731, 41, 734, 528, 971, + 529, -1, 467, 229, 528, 732, 529, -1, -1, 733, + -1, 733, 532, -1, 928, -1, 733, 532, 928, -1, + 254, -1, 280, 254, -1, -1, 222, 736, -1, -1, + 434, 737, 558, -1, 432, 737, 558, -1, 244, 434, + 737, 558, -1, 244, 432, 737, 558, -1, 180, 434, + 737, 558, -1, 180, 432, 737, 558, -1, 460, 737, + 558, -1, 427, 558, -1, 558, -1, 427, -1, -1, + 31, -1, 133, -1, -1, 60, 271, -1, 133, -1, + 133, 295, 528, 908, 529, -1, 31, -1, -1, 195, + 287, -1, 364, 287, -1, -1, 744, -1, -1, 301, + 60, 745, -1, 301, 60, 31, 747, 748, -1, 746, + -1, 745, 532, 746, -1, 860, 467, 902, 748, -1, + 860, 747, 748, -1, 42, -1, 127, -1, -1, 513, + 166, -1, 513, 234, -1, -1, 751, 752, -1, 752, + 751, -1, 751, -1, 752, -1, 749, -1, -1, 241, + 764, -1, 241, 764, 532, 765, -1, 164, 769, 766, + 768, 296, -1, 164, 769, 768, 296, -1, 292, 765, + -1, 292, 766, 768, -1, 4, -1, 9, -1, 865, + -1, 753, 523, -1, 753, 319, -1, 753, -1, 753, + 375, -1, 467, 377, 757, -1, -1, 559, -1, -1, + 756, 528, 754, 529, 760, -1, 754, -1, 754, 528, + 559, 529, -1, 754, 528, 559, 532, 9, 529, -1, + 429, 757, -1, 758, -1, -1, 360, 528, 9, 529, + -1, -1, 439, -1, 479, -1, 761, 14, 860, -1, + 47, 528, 762, 529, -1, -1, 860, -1, 31, -1, + 860, 523, -1, 4, 319, -1, 9, 319, -1, 860, + -1, 862, -1, 519, 767, -1, 520, 767, -1, 960, + -1, 4, -1, 374, -1, 375, -1, 166, -1, 277, + -1, 183, 60, 772, -1, 183, 60, 31, -1, -1, + 773, -1, 771, 532, 773, -1, 771, -1, 771, 532, + -1, 860, -1, 774, -1, 776, -1, 775, -1, 777, + -1, 528, 529, -1, 373, 528, 908, 529, -1, 104, + 528, 908, 529, -1, 184, 397, 528, 772, 529, -1, + 184, -1, 185, -1, 188, 860, -1, -1, 342, 860, + -1, -1, 783, -1, 169, 347, 296, -1, 781, -1, + -1, 784, -1, 783, 784, -1, 785, 786, 787, -1, + 169, 464, -1, 169, 278, 229, 464, -1, 169, 398, + -1, 169, 229, 398, -1, 290, 953, -1, -1, 284, + -1, 402, 247, -1, -1, 473, 528, 908, 529, -1, + 788, 532, 528, 908, 529, -1, 788, -1, 788, 532, + -1, 174, 792, -1, -1, 794, -1, 791, 532, 794, + -1, 791, -1, 791, 532, -1, 560, 19, -1, 811, + 806, 763, 759, -1, 793, 811, 763, 759, -1, 812, + 807, 759, -1, 793, 812, 759, -1, 789, 805, 759, + -1, 235, 812, 807, -1, 717, 806, 759, -1, 793, + 717, 759, -1, 235, 717, 806, -1, 804, -1, 528, + 804, 529, 805, -1, 793, 528, 804, 529, -1, 794, + 321, 528, 938, 169, 800, 795, 529, 806, -1, 794, + 462, 796, 528, 801, 169, 803, 529, 806, -1, 183, + 60, 955, -1, -1, 202, 287, -1, 150, 287, -1, + -1, 861, 201, 528, 938, 529, -1, 861, 201, 560, + -1, 863, -1, 866, -1, 528, 906, 529, -1, 798, + 201, 528, 938, 529, -1, 798, 201, 560, -1, 799, + -1, 800, 799, -1, 560, -1, 528, 955, 529, -1, + 801, 201, 528, 938, 529, -1, 802, -1, 803, 802, + -1, 528, 804, 529, -1, 794, 102, 227, 794, -1, + 794, 808, 227, 794, 810, -1, 794, 227, 794, 810, + -1, 794, 274, 808, 227, 794, -1, 794, 274, 227, + 794, -1, 794, 43, 808, 227, 794, 810, -1, 794, + 43, 227, 794, 810, -1, 794, 328, 227, 794, -1, + 794, 38, 227, 794, 810, -1, 794, 389, 227, 794, + 810, -1, 41, 560, 528, 955, 529, -1, 41, 560, + -1, 559, 528, 955, 529, -1, 559, -1, 805, -1, + -1, 805, -1, 41, 528, 818, 529, -1, 41, 560, + 528, 818, 529, -1, 559, 528, 818, 529, -1, -1, + 175, 809, -1, 238, 809, -1, 370, 809, -1, 389, + -1, 38, -1, 211, -1, 305, -1, -1, 467, 528, + 955, 529, -1, 295, 860, -1, 558, -1, 558, 521, + -1, 296, 558, -1, 296, 528, 558, 529, -1, 872, + 816, -1, 375, 174, 528, 814, 529, 816, -1, 872, + 815, -1, 813, -1, 814, 532, 813, -1, 41, 528, + 818, 529, -1, -1, 514, 302, -1, -1, 487, 860, + -1, -1, 819, -1, 818, 532, 819, -1, 560, 824, + 820, -1, 81, 964, -1, -1, 559, 824, -1, 821, + 532, 559, 824, -1, 374, -1, 420, -1, 824, -1, + -1, 827, 826, -1, 396, 827, 826, -1, 827, 40, + 526, 960, 527, -1, 396, 827, 40, 526, 960, 527, + -1, 827, 40, -1, 396, 827, 40, -1, 825, 826, + -1, 822, 528, 821, 529, 826, -1, 250, 528, 912, + 529, 826, -1, 456, 528, 821, 529, 826, -1, 3, + 530, 3, -1, 825, 530, 3, -1, 826, 526, 527, + -1, 826, 526, 960, 527, -1, -1, 829, -1, 831, + -1, 833, -1, 837, -1, 843, -1, 844, 859, -1, + 844, 528, 960, 529, -1, 831, -1, 834, -1, 838, + -1, 843, -1, 963, 830, -1, 528, 909, 529, -1, + -1, 218, -1, 219, -1, 403, -1, 55, -1, 348, + -1, 167, 832, -1, 137, 331, -1, 116, 830, -1, + 113, 830, -1, 288, 830, -1, 58, -1, 528, 960, + 529, -1, -1, 835, -1, 836, -1, 835, -1, 836, + -1, 57, 842, 528, 908, 529, -1, 57, 842, -1, + 839, -1, 840, -1, 839, -1, 840, -1, 841, 528, + 960, 529, -1, 841, -1, 73, 842, -1, 72, 842, + -1, 474, -1, 273, 73, 842, -1, 273, 72, 842, + -1, 275, 842, -1, 477, -1, -1, 439, 528, 960, + 529, 845, -1, 439, 845, -1, 438, 528, 960, 529, + 845, -1, 438, 845, -1, 221, -1, 514, 438, 511, + -1, 492, 438, 511, -1, -1, 508, -1, 509, -1, + 268, -1, 269, -1, 110, -1, 111, -1, 191, -1, + 192, -1, 264, -1, 265, -1, 384, -1, 385, -1, + 262, -1, 263, -1, 258, -1, 259, -1, 484, -1, + 485, -1, 343, -1, 344, -1, 114, -1, 115, -1, + 70, -1, 69, -1, 261, -1, 260, -1, 846, -1, 847, -1, 848, -1, 849, -1, 850, -1, 851, -1, 852, -1, 853, -1, 854, -1, 855, -1, 856, -1, - 561, -1, 858, 914, 917, 918, -1, 858, 914, 917, - -1, 324, 858, -1, 859, 201, 859, -1, -1, 858, - 917, 918, -1, 858, 918, 917, -1, 858, 917, -1, - 858, 918, -1, 905, -1, -1, 174, 858, -1, 169, - 858, -1, 858, 174, 906, -1, 174, 906, -1, 906, - -1, 715, -1, 528, 906, 529, -1, 927, -1, 864, - -1, 66, 925, 922, 924, 144, -1, 923, -1, 922, - 923, -1, 486, 858, 436, 858, -1, 140, 858, -1, - -1, 858, -1, -1, 559, -1, 559, -1, 559, 562, - -1, 526, 858, 527, -1, 526, 928, 19, 928, 527, - -1, 526, 928, 19, 928, 19, 928, 527, -1, 526, - 928, 19, 520, 19, 928, 527, -1, 858, -1, -1, - -1, 929, 563, -1, -1, 528, 529, -1, 528, 908, - 529, -1, 530, 564, 930, -1, 526, 858, 527, -1, - 526, 928, 19, 928, 527, -1, 526, 928, 19, 928, - 19, 928, 527, -1, 526, 928, 19, 520, 19, 928, - 527, -1, -1, 932, 931, -1, 46, -1, -1, 936, - -1, -1, 937, -1, 935, 532, 937, -1, 935, -1, - 935, 532, -1, 858, 41, 966, -1, 858, 3, -1, - 858, -1, 559, 19, 858, -1, 150, 528, 941, 529, - -1, 150, 939, -1, 560, -1, 939, 530, 560, -1, - 939, -1, 940, 532, 939, -1, 940, -1, 940, 532, - -1, 938, -1, -1, 858, 41, 559, -1, 943, -1, - 944, 532, 943, -1, 944, -1, 944, 532, -1, 361, - 528, 945, 529, -1, 361, 943, -1, -1, 939, 41, - 559, -1, 947, -1, 948, 532, 947, -1, 948, -1, - 948, 532, -1, 359, 528, 949, 529, -1, 359, 947, - -1, -1, 558, -1, 951, 532, 558, -1, 955, -1, - 952, 532, 955, -1, 952, -1, 952, 532, -1, 953, - -1, 528, 953, 529, -1, 560, -1, 960, -1, 559, - 562, -1, 958, -1, 4, -1, 561, 929, -1, 6, - -1, 7, -1, 956, 561, -1, 956, 528, 908, 741, - 740, 529, 561, -1, 826, 561, -1, 842, 528, 858, - 529, 857, -1, 842, 958, 857, -1, 842, 561, 857, - -1, 447, -1, 162, -1, 285, -1, 9, -1, 3, - -1, 1041, -1, 1046, -1, 3, -1, 1041, -1, 1043, - -1, 3, -1, 1041, -1, 1044, -1, 559, -1, 559, - 963, -1, 530, 564, -1, 963, 530, 564, -1, 528, - 953, 529, -1, -1, 959, -1, 565, -1, 5, -1, - 332, 955, 968, 41, 969, -1, 528, 910, 529, -1, - -1, 714, -1, 568, -1, 700, -1, 701, -1, 1014, - -1, 1030, -1, 101, 379, 558, 971, -1, 101, 379, - 194, 280, 154, 558, 971, -1, 101, 300, 361, 379, - 558, 971, -1, 971, 972, -1, -1, 622, -1, 973, - -1, 594, -1, 1036, -1, 101, 979, 205, 976, 977, - 295, 558, 975, 528, 587, 529, 978, 815, -1, 101, - 979, 205, 976, 194, 280, 154, 653, 295, 558, 975, - 528, 587, 529, 978, 815, -1, 559, -1, 467, 974, - -1, -1, 90, -1, -1, 653, -1, -1, 490, 637, - -1, -1, 457, -1, -1, 33, 427, 809, 395, 379, - 955, -1, 33, 427, 194, 154, 809, 395, 379, 955, - -1, 33, 390, 558, 395, 379, 955, -1, 33, 390, - 194, 154, 558, 395, 379, 955, -1, 33, 480, 558, - 395, 379, 955, -1, 33, 480, 194, 154, 558, 395, - 379, 955, -1, 170, 76, 982, -1, 76, 982, -1, - 559, -1, -1, 85, 295, 985, 558, 224, 984, -1, - 85, 295, 83, 858, 224, 984, -1, 561, -1, 285, - -1, 427, -1, 390, -1, 176, -1, 249, -1, 249, - 427, -1, 480, -1, 109, -1, 205, -1, 379, -1, - 451, -1, 156, 109, 561, 708, -1, 156, 109, 559, - 440, 561, 708, -1, 200, 109, 561, -1, 155, 991, - -1, 155, 995, 989, 991, -1, 155, 478, 991, -1, - 155, 528, 994, 529, 991, -1, 478, -1, -1, 996, - -1, 611, -1, -1, 980, -1, 608, -1, 542, -1, - 1035, -1, 981, -1, 701, -1, 1038, -1, 689, -1, - 970, -1, 594, -1, 622, -1, 589, -1, 557, -1, - 1014, -1, 672, -1, 604, -1, 973, -1, 568, -1, - 1005, -1, 678, -1, 593, -1, 967, -1, 566, -1, - 714, -1, 618, -1, 700, -1, 603, -1, 1009, -1, - 1027, -1, 999, -1, 1030, -1, 1036, -1, 3, -1, - 1041, -1, 1045, -1, 992, -1, 561, -1, 997, -1, - 994, 532, 997, -1, 36, -1, 35, -1, 447, -1, - 162, -1, 295, -1, 993, -1, 998, 990, -1, 992, - -1, 995, -1, 395, 1000, -1, 395, 244, 1000, -1, - 395, 394, 1000, -1, 395, 180, 1000, -1, 395, 475, - 1000, -1, 1001, -1, 1034, 174, 105, -1, 438, 511, - 1003, -1, 379, 561, -1, 1034, 440, 1004, -1, 1034, - 517, 1004, -1, 858, -1, 561, -1, 3, -1, 842, - 561, 857, -1, 842, 528, 958, 529, 561, -1, 611, - -1, 118, -1, 244, -1, 1002, -1, 1004, 532, 1002, - -1, 243, 1007, -1, 1006, 216, 1007, 1008, -1, 1006, - 216, 1007, 174, 559, 1008, -1, 1006, 216, 1007, 174, - 561, 1008, -1, -1, 170, -1, 561, -1, 559, -1, - -1, 479, 561, -1, 479, 559, -1, 468, 1011, 1013, - 989, -1, 468, 1011, 1013, 989, 558, 964, -1, 468, - 1011, 1013, 989, 1018, -1, 468, 528, 1012, 529, -1, - 468, 528, 1012, 529, 558, 964, -1, 995, -1, 478, - -1, 173, -1, 175, -1, 3, -1, 175, -1, -1, - 1010, -1, 1012, 532, 1010, -1, 173, -1, -1, 573, - 123, 174, 1015, 1017, 1016, 579, -1, 448, 735, 1015, - -1, 809, -1, 809, 559, -1, 809, 41, 559, -1, - 487, 858, -1, -1, 467, 790, -1, -1, 995, 989, - -1, 995, 989, 558, 964, -1, 48, 1021, 561, 1022, - 1026, -1, 48, 194, 280, 154, 1021, 561, 1022, 1026, - -1, 48, 300, 361, 1021, 561, 1022, 1026, -1, 129, - 565, -1, 129, 109, 565, -1, 129, 109, 194, 154, - 565, -1, 109, -1, -1, 41, 559, -1, -1, 858, - -1, -1, 565, 1023, -1, 1024, -1, 1025, 532, 1024, - -1, 528, 1025, 529, -1, -1, 363, 1029, -1, 363, - 244, 1029, -1, 363, 394, 1029, -1, 363, 180, 1029, - -1, 363, 475, 1029, -1, 1034, -1, 31, -1, 1028, - -1, 438, 511, -1, 442, 226, 239, -1, 1032, 714, - -1, 423, 714, -1, 423, 558, -1, 1032, 428, 174, - 558, -1, 1032, 558, -1, 1032, 438, 511, -1, 1032, - 442, 226, 239, -1, 1032, 31, 1033, -1, 1032, -1, - 128, -1, 127, -1, 399, -1, 1031, -1, 428, -1, - -1, 559, -1, 1034, 530, 559, -1, 62, 868, -1, - 101, 670, 480, 558, 659, 978, 41, 714, 1037, -1, - 101, 670, 480, 194, 280, 154, 558, 659, 978, 41, - 714, 1037, -1, 101, 300, 361, 670, 480, 558, 659, - 978, 41, 714, 1037, -1, 101, 670, 351, 480, 558, - 528, 663, 529, 978, 41, 714, 1037, -1, 101, 300, - 361, 670, 351, 480, 558, 528, 663, 529, 978, 41, - 714, 1037, -1, 490, 75, 298, -1, 490, 65, 75, - 298, -1, 490, 244, 75, 298, -1, -1, 101, 670, - 427, 1040, 41, 714, 1039, -1, 101, 670, 427, 194, - 280, 154, 1040, 41, 714, 1039, -1, 101, 300, 361, - 670, 427, 1040, 41, 714, 1039, -1, 490, 108, -1, - 490, 278, 108, -1, -1, 558, 659, 644, 636, -1, - 23, -1, 24, -1, 25, -1, 26, -1, 27, -1, - 28, -1, 29, -1, 30, -1, 32, -1, 33, -1, - 34, -1, 44, -1, 45, -1, 48, -1, 49, -1, - 51, -1, 52, -1, 53, -1, 61, -1, 62, -1, - 63, -1, 64, -1, 65, -1, 68, -1, 69, -1, - 70, -1, 71, -1, 74, -1, 76, -1, 77, -1, - 78, -1, 79, -1, 85, -1, 86, -1, 87, -1, - 88, -1, 89, -1, 91, -1, 92, -1, 93, -1, - 95, -1, 96, -1, 97, -1, 98, -1, 99, -1, - 100, -1, 103, -1, 104, -1, 105, -1, 106, -1, - 107, -1, 108, -1, 109, -1, 110, -1, 111, -1, - 112, -1, 114, -1, 115, -1, 117, -1, 119, -1, - 121, -1, 122, -1, 123, -1, 124, -1, 125, -1, - 126, -1, 129, -1, 130, -1, 131, -1, 132, -1, - 135, -1, 136, -1, 137, -1, 138, -1, 139, -1, - 141, -1, 142, -1, 143, -1, 145, -1, 146, -1, - 147, -1, 148, -1, 150, -1, 151, -1, 152, -1, - 153, -1, 155, -1, 156, -1, 157, -1, 158, -1, - 159, -1, 160, -1, 163, -1, 165, -1, 166, -1, - 168, -1, 170, -1, 172, -1, 176, -1, 177, -1, - 180, -1, 181, -1, 182, -1, 186, -1, 187, -1, - 189, -1, 190, -1, 191, -1, 192, -1, 193, -1, - 194, -1, 195, -1, 197, -1, 198, -1, 199, -1, - 200, -1, 202, -1, 203, -1, 204, -1, 205, -1, - 206, -1, 207, -1, 208, -1, 210, -1, 213, -1, - 214, -1, 215, -1, 216, -1, 217, -1, 223, -1, - 226, -1, 228, -1, 229, -1, 230, -1, 232, -1, - 233, -1, 234, -1, 237, -1, 239, -1, 242, -1, - 243, -1, 244, -1, 245, -1, 246, -1, 247, -1, - 248, -1, 249, -1, 251, -1, 252, -1, 253, -1, - 254, -1, 255, -1, 256, -1, 257, -1, 258, -1, - 259, -1, 260, -1, 261, -1, 262, -1, 263, -1, - 264, -1, 265, -1, 266, -1, 267, -1, 268, -1, - 269, -1, 270, -1, 271, -1, 272, -1, 276, -1, - 277, -1, 278, -1, 281, -1, 282, -1, 284, -1, - 287, -1, 289, -1, 290, -1, 291, -1, 293, -1, - 294, -1, 297, -1, 298, -1, 299, -1, 302, -1, - 303, -1, 306, -1, 309, -1, 310, -1, 311, -1, - 312, -1, 313, -1, 314, -1, 315, -1, 316, -1, - 317, -1, 318, -1, 319, -1, 320, -1, 325, -1, - 326, -1, 329, -1, 330, -1, 332, -1, 333, -1, - 334, -1, 336, -1, 337, -1, 338, -1, 339, -1, - 340, -1, 341, -1, 343, -1, 344, -1, 345, -1, - 346, -1, 347, -1, 349, -1, 350, -1, 351, -1, - 352, -1, 354, -1, 355, -1, 356, -1, 357, -1, - 358, -1, 359, -1, 360, -1, 361, -1, 362, -1, - 363, -1, 364, -1, 365, -1, 366, -1, 368, -1, - 369, -1, 371, -1, 372, -1, 373, -1, 375, -1, - 376, -1, 377, -1, 378, -1, 379, -1, 380, -1, - 381, -1, 382, -1, 383, -1, 384, -1, 385, -1, - 386, -1, 387, -1, 390, -1, 391, -1, 392, -1, - 393, -1, 394, -1, 395, -1, 397, -1, 398, -1, - 401, -1, 402, -1, 404, -1, 406, -1, 407, -1, - 408, -1, 409, -1, 410, -1, 411, -1, 412, -1, - 413, -1, 414, -1, 415, -1, 416, -1, 417, -1, - 418, -1, 419, -1, 421, -1, 425, -1, 426, -1, - 428, -1, 430, -1, 431, -1, 432, -1, 433, -1, - 434, -1, 435, -1, 437, -1, 442, -1, 443, -1, - 445, -1, 448, -1, 449, -1, 451, -1, 452, -1, - 453, -1, 454, -1, 455, -1, 458, -1, 459, -1, - 460, -1, 463, -1, 464, -1, 465, -1, 466, -1, - 468, -1, 469, -1, 470, -1, 471, -1, 472, -1, - 475, -1, 477, -1, 479, -1, 480, -1, 481, -1, - 482, -1, 483, -1, 484, -1, 485, -1, 488, -1, - 491, -1, 492, -1, 493, -1, 494, -1, 495, -1, - 496, -1, 508, -1, 509, -1, 510, -1, 511, -1, - 54, -1, 55, -1, 57, -1, 58, -1, 72, -1, - 73, -1, 80, -1, 84, -1, 113, -1, 116, -1, - 154, -1, 161, -1, 167, -1, 178, -1, 184, -1, - 185, -1, 212, -1, 218, -1, 219, -1, 221, -1, - 250, -1, 273, -1, 275, -1, 279, -1, 286, -1, - 288, -1, 304, -1, 308, -1, 327, -1, 331, -1, - 348, -1, 374, -1, 396, -1, 403, -1, 420, -1, - 422, -1, 438, -1, 439, -1, 444, -1, 446, -1, - 450, -1, 473, -1, 474, -1, 497, -1, 498, -1, - 499, -1, 500, -1, 501, -1, 502, -1, 503, -1, - 504, -1, 505, -1, 506, -1, 507, -1, 43, -1, - 47, -1, 50, -1, 56, -1, 82, -1, 90, -1, - 102, -1, 173, -1, 175, -1, 178, -1, 179, -1, - 196, -1, 211, -1, 224, -1, 225, -1, 227, -1, - 238, -1, 240, -1, 250, -1, 274, -1, 283, -1, - 305, -1, 307, -1, 328, -1, 370, -1, 400, -1, - 420, -1, 429, -1, 478, -1, 38, -1, 43, -1, - 47, -1, 50, -1, 56, -1, 60, -1, 82, -1, - 84, -1, 90, -1, 102, -1, 173, -1, 175, -1, - 179, -1, 196, -1, 211, -1, 224, -1, 225, -1, - 227, -1, 238, -1, 240, -1, 274, -1, 283, -1, - 305, -1, 307, -1, 328, -1, 370, -1, 389, -1, - 400, -1, 429, -1, 450, -1, 461, -1, 478, -1, - 38, -1, 43, -1, 47, -1, 50, -1, 54, -1, - 55, -1, 56, -1, 57, -1, 58, -1, 60, -1, - 73, -1, 72, -1, 80, -1, 82, -1, 84, -1, - 90, -1, 102, -1, 113, -1, 116, -1, 154, -1, - 161, -1, 167, -1, 173, -1, 175, -1, 178, -1, - 179, -1, 184, -1, 185, -1, 196, -1, 211, -1, - 212, -1, 219, -1, 221, -1, 218, -1, 224, -1, - 225, -1, 227, -1, 238, -1, 240, -1, 250, -1, - 273, -1, 274, -1, 275, -1, 279, -1, 283, -1, - 286, -1, 288, -1, 305, -1, 304, -1, 307, -1, - 308, -1, 327, -1, 328, -1, 331, -1, 348, -1, - 370, -1, 374, -1, 389, -1, 396, -1, 400, -1, - 403, -1, 420, -1, 422, -1, 429, -1, 438, -1, - 439, -1, 444, -1, 446, -1, 450, -1, 461, -1, - 473, -1, 474, -1, 478, -1, 497, -1, 498, -1, - 499, -1, 500, -1, 501, -1, 502, -1, 503, -1, - 504, -1, 505, -1, 506, -1, 507, -1, 38, -1, - 43, -1, 47, -1, 50, -1, 56, -1, 60, -1, - 82, -1, 84, -1, 90, -1, 102, -1, 173, -1, - 175, -1, 178, -1, 179, -1, 196, -1, 211, -1, - 224, -1, 225, -1, 227, -1, 238, -1, 240, -1, - 250, -1, 274, -1, 283, -1, 305, -1, 307, -1, - 328, -1, 370, -1, 389, -1, 400, -1, 420, -1, - 429, -1, 450, -1, 461, -1, 478, -1, 31, -1, - 35, -1, 36, -1, 37, -1, 39, -1, 40, -1, - 41, -1, 42, -1, 46, -1, 59, -1, 66, -1, - 67, -1, 75, -1, 81, -1, 83, -1, 94, -1, - 101, -1, 118, -1, 120, -1, 127, -1, 128, -1, - 133, -1, 134, -1, 140, -1, 144, -1, 149, -1, - 162, -1, 164, -1, 169, -1, 171, -1, 174, -1, - 183, -1, 188, -1, 201, -1, 209, -1, 220, -1, - 222, -1, 231, -1, 235, -1, 236, -1, 241, -1, - 280, -1, 285, -1, 292, -1, 295, -1, 296, -1, - 300, -1, 301, -1, 321, -1, 322, -1, 323, -1, - 324, -1, 335, -1, 342, -1, 353, -1, 367, -1, - 388, -1, 399, -1, 405, -1, 423, -1, 424, -1, - 427, -1, 436, -1, 440, -1, 441, -1, 447, -1, - 456, -1, 457, -1, 462, -1, 467, -1, 476, -1, - 486, -1, 487, -1, 489, -1, 490, -1 + 857, -1, 858, -1, 846, 440, 847, -1, 848, 440, + 849, -1, 848, 440, 850, -1, 848, 440, 851, -1, + 849, 440, 850, -1, 849, 440, 851, -1, 850, 440, + 851, -1, -1, 862, -1, 860, 11, 824, -1, 860, + 81, 964, -1, 860, 47, 438, 511, 860, -1, 519, + 860, -1, 520, 860, -1, 860, 519, 860, -1, 860, + 520, 860, -1, 860, 521, 860, -1, 860, 522, 860, + -1, 860, 15, 860, -1, 860, 523, 860, -1, 860, + 524, 860, -1, 860, 16, 860, -1, 860, 515, 860, + -1, 860, 516, 860, -1, 860, 517, 860, -1, 860, + 20, 860, -1, 860, 21, 860, -1, 860, 22, 860, + -1, 860, 901, 860, -1, 901, 860, -1, 860, 901, + -1, 860, 37, 860, -1, 860, 300, 860, -1, 280, + 860, -1, 512, 860, -1, 860, 179, 860, -1, 860, + 240, 860, -1, 860, 240, 860, 147, 860, -1, 860, + 512, 240, 860, -1, 860, 512, 240, 860, 147, 860, + -1, 860, 196, 860, -1, 860, 196, 860, 147, 860, + -1, 860, 512, 196, 860, -1, 860, 512, 196, 860, + 147, 860, -1, 860, 400, 440, 860, -1, 860, 400, + 440, 860, 147, 860, -1, 860, 512, 400, 440, 860, + -1, 860, 512, 400, 440, 860, 147, 860, -1, 860, + 224, 285, -1, 860, 225, -1, 860, 224, 280, 285, + -1, 860, 280, 285, -1, 860, 283, -1, 231, 954, + 19, 860, -1, 860, 17, 860, -1, 860, 18, 860, + -1, 890, 307, 890, -1, 860, 224, 447, -1, 860, + 224, 280, 447, -1, 860, 224, 162, -1, 860, 224, + 280, 162, -1, 860, 224, 458, -1, 860, 224, 280, + 458, -1, 860, 224, 133, 174, 860, -1, 860, 224, + 280, 133, 174, 860, -1, 860, 224, 290, 528, 912, + 529, -1, 860, 224, 280, 290, 528, 912, 529, -1, + 860, 54, 935, 861, 37, 860, -1, 860, 512, 54, + 935, 861, 37, 860, -1, 860, 54, 424, 861, 37, + 860, -1, 860, 512, 54, 424, 861, 37, 860, -1, + 860, 201, 922, -1, 860, 512, 201, 922, -1, 860, + 903, 898, 717, -1, 860, 903, 898, 528, 860, 529, + -1, 118, -1, 84, 528, 860, 529, -1, 461, 528, + 860, 529, -1, 521, 84, 528, 860, 529, -1, 521, + 944, 948, 952, -1, 559, 530, 521, 944, 948, 952, + -1, 862, -1, 861, 11, 824, -1, 519, 861, -1, + 520, 861, -1, 861, 519, 861, -1, 861, 520, 861, + -1, 861, 521, 861, -1, 861, 522, 861, -1, 861, + 15, 861, -1, 861, 523, 861, -1, 861, 524, 861, + -1, 861, 16, 861, -1, 861, 515, 861, -1, 861, + 516, 861, -1, 861, 517, 861, -1, 861, 20, 861, + -1, 861, 21, 861, -1, 861, 22, 861, -1, 861, + 901, 861, -1, 901, 861, -1, 861, 901, -1, 861, + 224, 133, 174, 861, -1, 861, 224, 280, 133, 174, + 861, -1, 861, 224, 290, 528, 912, 529, -1, 861, + 224, 280, 290, 528, 912, 529, -1, 863, -1, 864, + 934, -1, 929, -1, 959, -1, 717, -1, 717, 562, + -1, 154, 717, -1, 778, 528, 908, 529, -1, 528, + 860, 529, -1, 866, -1, 890, -1, 533, -1, 10, + -1, 534, 565, -1, 865, -1, 868, -1, 869, -1, + 871, -1, 923, -1, 867, -1, 874, -1, 40, 717, + -1, 40, 526, 909, 527, -1, 535, 9, -1, 526, + 909, 527, -1, 536, 893, 537, -1, 250, 536, 897, + 537, -1, 958, 528, 529, -1, 958, 528, 744, 742, + 529, -1, 958, 528, 910, 743, 742, 529, -1, 958, + 528, 476, 911, 743, 742, 529, -1, 958, 528, 910, + 532, 476, 911, 743, 742, 529, -1, 958, 528, 31, + 910, 743, 742, 529, -1, 958, 528, 133, 910, 743, + 742, 529, -1, 870, 875, 876, 877, 881, -1, 873, + -1, 870, -1, 873, -1, 82, 169, 528, 860, 529, + -1, 67, 528, 860, 41, 824, 529, -1, 450, 528, + 860, 41, 824, 529, -1, 161, 528, 913, 529, -1, + 308, 528, 915, 529, -1, 327, 528, 917, 529, -1, + 422, 528, 918, 529, -1, 444, 528, 860, 41, 824, + 529, -1, 446, 528, 59, 921, 529, -1, 446, 528, + 236, 921, 529, -1, 446, 528, 441, 921, 529, -1, + 446, 528, 921, 529, -1, 286, 528, 860, 532, 860, + 529, -1, 80, 528, 908, 529, -1, 526, 860, 169, + 954, 201, 860, 527, -1, 526, 860, 169, 954, 201, + 862, 194, 860, 527, -1, 491, 183, 528, 744, 529, + -1, -1, 165, 528, 487, 860, 529, -1, 165, 528, + 860, 529, -1, -1, 157, -1, -1, 489, 879, -1, + -1, 880, -1, 879, 532, 880, -1, 559, 41, 882, + -1, 306, 882, -1, 306, 559, -1, -1, 528, 883, + 884, 743, 885, 529, -1, 559, -1, -1, 315, 60, + 907, -1, -1, 346, 886, 888, -1, 375, 886, 888, + -1, 186, 886, 888, -1, -1, 887, -1, 54, 887, + 37, 887, -1, 453, 330, -1, 453, 168, -1, 105, + 374, -1, 860, 330, -1, 860, 168, -1, 150, 105, + 374, -1, 150, 183, -1, 150, 437, -1, 150, 278, + 303, -1, -1, 374, 528, 908, 529, -1, 374, 528, + 529, -1, 889, -1, 528, 907, 532, 860, 529, -1, + 560, 19, 860, -1, 891, -1, 892, 532, 891, -1, + 892, -1, 892, 532, -1, 860, 19, 860, -1, 894, + -1, 895, 532, 894, -1, 895, -1, 895, 532, -1, + 896, -1, -1, 39, -1, 405, -1, 31, -1, 8, + -1, 900, -1, 519, -1, 520, -1, 521, -1, 522, + -1, 15, -1, 523, -1, 524, -1, 16, -1, 515, + -1, 516, -1, 517, -1, 20, -1, 21, -1, 22, + -1, 8, -1, 297, 528, 904, 529, -1, 899, -1, + 297, 528, 904, 529, -1, 899, -1, 297, 528, 904, + 529, -1, 240, -1, 512, 240, -1, 179, -1, 512, + 179, -1, 196, -1, 512, 196, -1, 899, -1, 559, + 530, 904, -1, 862, -1, 905, 532, 862, -1, 905, + -1, 905, 532, -1, 860, -1, 907, 532, 860, -1, + 907, -1, 907, 532, -1, 908, -1, -1, 911, -1, + 910, 532, 911, -1, 860, -1, 967, 13, 860, -1, + 967, 14, 860, -1, 824, -1, 912, 532, 824, -1, + 914, 174, 860, -1, -1, 3, -1, 846, -1, 847, + -1, 848, -1, 849, -1, 850, -1, 851, -1, 852, + -1, 853, -1, 854, -1, 855, -1, 856, -1, 857, + -1, 858, -1, 561, -1, 860, 916, 919, 920, -1, + 860, 916, 919, -1, 324, 860, -1, 861, 201, 861, + -1, -1, 860, 919, 920, -1, 860, 920, 919, -1, + 860, 919, -1, 860, 920, -1, 907, -1, -1, 174, + 860, -1, 169, 860, -1, 860, 174, 908, -1, 174, + 908, -1, 908, -1, 717, -1, 528, 908, 529, -1, + 929, -1, 866, -1, 66, 927, 924, 926, 144, -1, + 925, -1, 924, 925, -1, 486, 860, 436, 860, -1, + 140, 860, -1, -1, 860, -1, -1, 559, -1, 559, + -1, 559, 562, -1, 526, 860, 527, -1, 526, 930, + 19, 930, 527, -1, 526, 930, 19, 930, 19, 930, + 527, -1, 526, 930, 19, 520, 19, 930, 527, -1, + 860, -1, -1, -1, 931, 563, -1, -1, 528, 529, + -1, 528, 910, 529, -1, 530, 564, 932, -1, 526, + 860, 527, -1, 526, 930, 19, 930, 527, -1, 526, + 930, 19, 930, 19, 930, 527, -1, 526, 930, 19, + 520, 19, 930, 527, -1, -1, 934, 933, -1, 46, + -1, -1, 938, -1, -1, 939, -1, 937, 532, 939, + -1, 937, -1, 937, 532, -1, 860, 41, 968, -1, + 860, 3, -1, 860, -1, 559, 19, 860, -1, 150, + 528, 943, 529, -1, 150, 941, -1, 560, -1, 941, + 530, 560, -1, 941, -1, 942, 532, 941, -1, 942, + -1, 942, 532, -1, 940, -1, -1, 860, 41, 559, + -1, 945, -1, 946, 532, 945, -1, 946, -1, 946, + 532, -1, 361, 528, 947, 529, -1, 361, 945, -1, + -1, 941, 41, 559, -1, 949, -1, 950, 532, 949, + -1, 950, -1, 950, 532, -1, 359, 528, 951, 529, + -1, 359, 949, -1, -1, 558, -1, 953, 532, 558, + -1, 957, -1, 954, 532, 957, -1, 954, -1, 954, + 532, -1, 955, -1, 528, 955, 529, -1, 560, -1, + 962, -1, 559, 562, -1, 960, -1, 4, -1, 561, + 931, -1, 6, -1, 7, -1, 958, 561, -1, 958, + 528, 910, 743, 742, 529, 561, -1, 828, 561, -1, + 844, 528, 860, 529, 859, -1, 844, 960, 859, -1, + 844, 561, 859, -1, 447, -1, 162, -1, 285, -1, + 9, -1, 3, -1, 1043, -1, 1048, -1, 3, -1, + 1043, -1, 1045, -1, 3, -1, 1043, -1, 1046, -1, + 559, -1, 559, 965, -1, 530, 564, -1, 965, 530, + 564, -1, 528, 955, 529, -1, -1, 961, -1, 565, + -1, 5, -1, 332, 957, 970, 41, 971, -1, 528, + 912, 529, -1, -1, 716, -1, 568, -1, 702, -1, + 703, -1, 1016, -1, 1032, -1, 101, 379, 558, 973, + -1, 101, 379, 194, 280, 154, 558, 973, -1, 101, + 300, 361, 379, 558, 973, -1, 973, 974, -1, -1, + 622, -1, 975, -1, 594, -1, 1038, -1, 101, 981, + 205, 978, 979, 295, 558, 977, 528, 587, 529, 980, + 817, -1, 101, 981, 205, 978, 194, 280, 154, 655, + 295, 558, 977, 528, 587, 529, 980, 817, -1, 559, + -1, 467, 976, -1, -1, 90, -1, -1, 655, -1, + -1, 490, 637, -1, -1, 457, -1, -1, 33, 427, + 811, 395, 379, 957, -1, 33, 427, 194, 154, 811, + 395, 379, 957, -1, 33, 390, 558, 395, 379, 957, + -1, 33, 390, 194, 154, 558, 395, 379, 957, -1, + 33, 480, 558, 395, 379, 957, -1, 33, 480, 194, + 154, 558, 395, 379, 957, -1, 170, 76, 984, -1, + 76, 984, -1, 559, -1, -1, 85, 295, 987, 558, + 224, 986, -1, 85, 295, 83, 860, 224, 986, -1, + 561, -1, 285, -1, 427, -1, 390, -1, 176, -1, + 249, -1, 249, 427, -1, 480, -1, 109, -1, 205, + -1, 379, -1, 451, -1, 156, 109, 561, 710, -1, + 156, 109, 559, 440, 561, 710, -1, 200, 109, 561, + -1, 155, 993, -1, 155, 997, 991, 993, -1, 155, + 478, 993, -1, 155, 528, 996, 529, 993, -1, 478, + -1, -1, 998, -1, 611, -1, -1, 982, -1, 608, + -1, 542, -1, 1037, -1, 983, -1, 703, -1, 1040, + -1, 691, -1, 972, -1, 594, -1, 622, -1, 589, + -1, 557, -1, 1016, -1, 674, -1, 604, -1, 975, + -1, 568, -1, 1007, -1, 680, -1, 593, -1, 969, + -1, 566, -1, 716, -1, 618, -1, 702, -1, 603, + -1, 1011, -1, 1029, -1, 1001, -1, 1032, -1, 1038, + -1, 3, -1, 1043, -1, 1047, -1, 994, -1, 561, + -1, 999, -1, 996, 532, 999, -1, 36, -1, 35, + -1, 447, -1, 162, -1, 295, -1, 995, -1, 1000, + 992, -1, 994, -1, 997, -1, 395, 1002, -1, 395, + 244, 1002, -1, 395, 394, 1002, -1, 395, 180, 1002, + -1, 395, 475, 1002, -1, 1003, -1, 1036, 174, 105, + -1, 438, 511, 1005, -1, 379, 561, -1, 1036, 440, + 1006, -1, 1036, 517, 1006, -1, 860, -1, 561, -1, + 3, -1, 844, 561, 859, -1, 844, 528, 960, 529, + 561, -1, 611, -1, 118, -1, 244, -1, 1004, -1, + 1006, 532, 1004, -1, 243, 1009, -1, 1008, 216, 1009, + 1010, -1, 1008, 216, 1009, 174, 559, 1010, -1, 1008, + 216, 1009, 174, 561, 1010, -1, -1, 170, -1, 561, + -1, 559, -1, -1, 479, 561, -1, 479, 559, -1, + 468, 1013, 1015, 991, -1, 468, 1013, 1015, 991, 558, + 966, -1, 468, 1013, 1015, 991, 1020, -1, 468, 528, + 1014, 529, -1, 468, 528, 1014, 529, 558, 966, -1, + 997, -1, 478, -1, 173, -1, 175, -1, 3, -1, + 175, -1, -1, 1012, -1, 1014, 532, 1012, -1, 173, + -1, -1, 573, 123, 174, 1017, 1019, 1018, 579, -1, + 448, 737, 1017, -1, 811, -1, 811, 559, -1, 811, + 41, 559, -1, 487, 860, -1, -1, 467, 792, -1, + -1, 997, 991, -1, 997, 991, 558, 966, -1, 48, + 1023, 561, 1024, 1028, -1, 48, 194, 280, 154, 1023, + 561, 1024, 1028, -1, 48, 300, 361, 1023, 561, 1024, + 1028, -1, 129, 565, -1, 129, 109, 565, -1, 129, + 109, 194, 154, 565, -1, 109, -1, -1, 41, 559, + -1, -1, 860, -1, -1, 565, 1025, -1, 1026, -1, + 1027, 532, 1026, -1, 528, 1027, 529, -1, -1, 363, + 1031, -1, 363, 244, 1031, -1, 363, 394, 1031, -1, + 363, 180, 1031, -1, 363, 475, 1031, -1, 1036, -1, + 31, -1, 1030, -1, 438, 511, -1, 442, 226, 239, + -1, 1034, 716, -1, 423, 716, -1, 423, 558, -1, + 1034, 428, 174, 558, -1, 1034, 558, -1, 1034, 438, + 511, -1, 1034, 442, 226, 239, -1, 1034, 31, 1035, + -1, 1034, -1, 128, -1, 127, -1, 399, -1, 1033, + -1, 428, -1, -1, 559, -1, 1036, 530, 559, -1, + 62, 870, -1, 101, 672, 480, 558, 661, 980, 41, + 716, 1039, -1, 101, 672, 480, 194, 280, 154, 558, + 661, 980, 41, 716, 1039, -1, 101, 300, 361, 672, + 480, 558, 661, 980, 41, 716, 1039, -1, 101, 672, + 351, 480, 558, 528, 665, 529, 980, 41, 716, 1039, + -1, 101, 300, 361, 672, 351, 480, 558, 528, 665, + 529, 980, 41, 716, 1039, -1, 490, 75, 298, -1, + 490, 65, 75, 298, -1, 490, 244, 75, 298, -1, + -1, 101, 672, 427, 1042, 41, 716, 1041, -1, 101, + 672, 427, 194, 280, 154, 1042, 41, 716, 1041, -1, + 101, 300, 361, 672, 427, 1042, 41, 716, 1041, -1, + 490, 108, -1, 490, 278, 108, -1, -1, 558, 661, + 646, 636, -1, 23, -1, 24, -1, 25, -1, 26, + -1, 27, -1, 28, -1, 29, -1, 30, -1, 32, + -1, 33, -1, 34, -1, 44, -1, 45, -1, 48, + -1, 49, -1, 51, -1, 52, -1, 53, -1, 61, + -1, 62, -1, 63, -1, 64, -1, 65, -1, 68, + -1, 69, -1, 70, -1, 71, -1, 74, -1, 76, + -1, 77, -1, 78, -1, 79, -1, 85, -1, 86, + -1, 87, -1, 88, -1, 89, -1, 91, -1, 92, + -1, 93, -1, 95, -1, 96, -1, 97, -1, 98, + -1, 99, -1, 100, -1, 103, -1, 104, -1, 105, + -1, 106, -1, 107, -1, 108, -1, 109, -1, 110, + -1, 111, -1, 112, -1, 114, -1, 115, -1, 117, + -1, 119, -1, 121, -1, 122, -1, 123, -1, 124, + -1, 125, -1, 126, -1, 129, -1, 130, -1, 131, + -1, 132, -1, 135, -1, 136, -1, 137, -1, 138, + -1, 139, -1, 141, -1, 142, -1, 143, -1, 145, + -1, 146, -1, 147, -1, 148, -1, 150, -1, 151, + -1, 152, -1, 153, -1, 155, -1, 156, -1, 157, + -1, 158, -1, 159, -1, 160, -1, 163, -1, 165, + -1, 166, -1, 168, -1, 170, -1, 172, -1, 176, + -1, 177, -1, 180, -1, 181, -1, 182, -1, 186, + -1, 187, -1, 189, -1, 190, -1, 191, -1, 192, + -1, 193, -1, 194, -1, 195, -1, 197, -1, 198, + -1, 199, -1, 200, -1, 202, -1, 203, -1, 204, + -1, 205, -1, 206, -1, 207, -1, 208, -1, 210, + -1, 213, -1, 214, -1, 215, -1, 216, -1, 217, + -1, 223, -1, 226, -1, 228, -1, 229, -1, 230, + -1, 232, -1, 233, -1, 234, -1, 237, -1, 239, + -1, 242, -1, 243, -1, 244, -1, 245, -1, 246, + -1, 247, -1, 248, -1, 249, -1, 251, -1, 252, + -1, 253, -1, 254, -1, 255, -1, 256, -1, 257, + -1, 258, -1, 259, -1, 260, -1, 261, -1, 262, + -1, 263, -1, 264, -1, 265, -1, 266, -1, 267, + -1, 268, -1, 269, -1, 270, -1, 271, -1, 272, + -1, 276, -1, 277, -1, 278, -1, 281, -1, 282, + -1, 284, -1, 287, -1, 289, -1, 290, -1, 291, + -1, 293, -1, 294, -1, 297, -1, 298, -1, 299, + -1, 302, -1, 303, -1, 306, -1, 309, -1, 310, + -1, 311, -1, 312, -1, 313, -1, 314, -1, 315, + -1, 316, -1, 317, -1, 318, -1, 319, -1, 320, + -1, 325, -1, 326, -1, 329, -1, 330, -1, 332, + -1, 333, -1, 334, -1, 336, -1, 337, -1, 338, + -1, 339, -1, 340, -1, 341, -1, 343, -1, 344, + -1, 345, -1, 346, -1, 347, -1, 349, -1, 350, + -1, 351, -1, 352, -1, 354, -1, 355, -1, 356, + -1, 357, -1, 358, -1, 359, -1, 360, -1, 361, + -1, 362, -1, 363, -1, 364, -1, 365, -1, 366, + -1, 368, -1, 369, -1, 371, -1, 372, -1, 373, + -1, 375, -1, 376, -1, 377, -1, 378, -1, 379, + -1, 380, -1, 381, -1, 382, -1, 383, -1, 384, + -1, 385, -1, 386, -1, 387, -1, 390, -1, 391, + -1, 392, -1, 393, -1, 394, -1, 395, -1, 397, + -1, 398, -1, 401, -1, 402, -1, 404, -1, 406, + -1, 407, -1, 408, -1, 409, -1, 410, -1, 411, + -1, 412, -1, 413, -1, 414, -1, 415, -1, 416, + -1, 417, -1, 418, -1, 419, -1, 421, -1, 425, + -1, 426, -1, 428, -1, 430, -1, 431, -1, 432, + -1, 433, -1, 434, -1, 435, -1, 437, -1, 442, + -1, 443, -1, 445, -1, 448, -1, 449, -1, 451, + -1, 452, -1, 453, -1, 454, -1, 455, -1, 458, + -1, 459, -1, 460, -1, 463, -1, 464, -1, 465, + -1, 466, -1, 468, -1, 469, -1, 470, -1, 471, + -1, 472, -1, 475, -1, 477, -1, 479, -1, 480, + -1, 481, -1, 482, -1, 483, -1, 484, -1, 485, + -1, 488, -1, 491, -1, 492, -1, 493, -1, 494, + -1, 495, -1, 496, -1, 508, -1, 509, -1, 510, + -1, 511, -1, 54, -1, 55, -1, 57, -1, 58, + -1, 72, -1, 73, -1, 80, -1, 84, -1, 113, + -1, 116, -1, 154, -1, 161, -1, 167, -1, 178, + -1, 184, -1, 185, -1, 212, -1, 218, -1, 219, + -1, 221, -1, 250, -1, 273, -1, 275, -1, 279, + -1, 286, -1, 288, -1, 304, -1, 308, -1, 327, + -1, 331, -1, 348, -1, 374, -1, 396, -1, 403, + -1, 420, -1, 422, -1, 438, -1, 439, -1, 444, + -1, 446, -1, 450, -1, 473, -1, 474, -1, 497, + -1, 498, -1, 499, -1, 500, -1, 501, -1, 502, + -1, 503, -1, 504, -1, 505, -1, 506, -1, 507, + -1, 43, -1, 47, -1, 50, -1, 56, -1, 82, + -1, 90, -1, 102, -1, 173, -1, 175, -1, 178, + -1, 179, -1, 196, -1, 211, -1, 224, -1, 225, + -1, 227, -1, 238, -1, 240, -1, 250, -1, 274, + -1, 283, -1, 305, -1, 307, -1, 328, -1, 370, + -1, 400, -1, 420, -1, 429, -1, 478, -1, 38, + -1, 43, -1, 47, -1, 50, -1, 56, -1, 60, + -1, 82, -1, 84, -1, 90, -1, 102, -1, 173, + -1, 175, -1, 179, -1, 196, -1, 211, -1, 224, + -1, 225, -1, 227, -1, 238, -1, 240, -1, 274, + -1, 283, -1, 305, -1, 307, -1, 328, -1, 370, + -1, 389, -1, 400, -1, 429, -1, 450, -1, 461, + -1, 478, -1, 38, -1, 43, -1, 47, -1, 50, + -1, 54, -1, 55, -1, 56, -1, 57, -1, 58, + -1, 60, -1, 73, -1, 72, -1, 80, -1, 82, + -1, 84, -1, 90, -1, 102, -1, 113, -1, 116, + -1, 154, -1, 161, -1, 167, -1, 173, -1, 175, + -1, 178, -1, 179, -1, 184, -1, 185, -1, 196, + -1, 211, -1, 212, -1, 219, -1, 221, -1, 218, + -1, 224, -1, 225, -1, 227, -1, 238, -1, 240, + -1, 250, -1, 273, -1, 274, -1, 275, -1, 279, + -1, 283, -1, 286, -1, 288, -1, 305, -1, 304, + -1, 307, -1, 308, -1, 327, -1, 328, -1, 331, + -1, 348, -1, 370, -1, 374, -1, 389, -1, 396, + -1, 400, -1, 403, -1, 420, -1, 422, -1, 429, + -1, 438, -1, 439, -1, 444, -1, 446, -1, 450, + -1, 461, -1, 473, -1, 474, -1, 478, -1, 497, + -1, 498, -1, 499, -1, 500, -1, 501, -1, 502, + -1, 503, -1, 504, -1, 505, -1, 506, -1, 507, + -1, 38, -1, 43, -1, 47, -1, 50, -1, 56, + -1, 60, -1, 82, -1, 84, -1, 90, -1, 102, + -1, 173, -1, 175, -1, 178, -1, 179, -1, 196, + -1, 211, -1, 224, -1, 225, -1, 227, -1, 238, + -1, 240, -1, 250, -1, 274, -1, 283, -1, 305, + -1, 307, -1, 328, -1, 370, -1, 389, -1, 400, + -1, 420, -1, 429, -1, 450, -1, 461, -1, 478, + -1, 31, -1, 35, -1, 36, -1, 37, -1, 39, + -1, 40, -1, 41, -1, 42, -1, 46, -1, 59, + -1, 66, -1, 67, -1, 75, -1, 81, -1, 83, + -1, 94, -1, 101, -1, 118, -1, 120, -1, 127, + -1, 128, -1, 133, -1, 134, -1, 140, -1, 144, + -1, 149, -1, 162, -1, 164, -1, 169, -1, 171, + -1, 174, -1, 183, -1, 188, -1, 201, -1, 209, + -1, 220, -1, 222, -1, 231, -1, 235, -1, 236, + -1, 241, -1, 280, -1, 285, -1, 292, -1, 295, + -1, 296, -1, 300, -1, 301, -1, 321, -1, 322, + -1, 323, -1, 324, -1, 335, -1, 342, -1, 353, + -1, 367, -1, 388, -1, 399, -1, 405, -1, 423, + -1, 424, -1, 427, -1, 436, -1, 440, -1, 441, + -1, 447, -1, 456, -1, 457, -1, 462, -1, 467, + -1, 476, -1, 486, -1, 487, -1, 489, -1, 490, + -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 522, 522, 538, 550, 559, 560, 561, 562, 563, - 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, - 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, - 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, - 594, 595, 596, 597, 598, 599, 600, 601, 603, 9, + 0, 524, 524, 540, 552, 561, 562, 563, 564, 565, + 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, + 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, + 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, + 596, 597, 598, 599, 600, 601, 602, 603, 605, 9, 18, 27, 36, 45, 54, 63, 72, 85, 87, 93, 94, 99, 103, 107, 118, 126, 130, 138, 139, 143, 150, 151, 156, 163, 173, 182, 191, 200, 209, 217, @@ -2699,139 +2703,140 @@ static const yytype_uint16 yyrline[] = 76, 80, 84, 88, 92, 97, 101, 105, 112, 113, 117, 118, 119, 7, 16, 7, 16, 28, 29, 2, 10, 17, 24, 32, 40, 51, 52, 53, 57, 58, - 59, 2, 7, 21, 36, 56, 57, 84, 85, 86, - 87, 88, 89, 93, 94, 99, 104, 105, 106, 107, - 108, 113, 120, 121, 122, 139, 146, 153, 163, 173, - 185, 193, 202, 220, 221, 225, 226, 230, 239, 262, - 276, 283, 288, 290, 292, 294, 297, 300, 301, 302, - 303, 308, 312, 313, 318, 325, 330, 331, 332, 333, - 334, 335, 336, 337, 343, 344, 348, 353, 360, 367, - 374, 386, 387, 388, 389, 393, 398, 399, 400, 405, - 410, 411, 412, 413, 414, 415, 420, 440, 466, 474, - 484, 485, 489, 493, 494, 495, 499, 503, 511, 512, - 517, 518, 519, 523, 531, 532, 537, 538, 542, 547, - 551, 555, 560, 568, 569, 573, 574, 578, 579, 585, - 596, 609, 623, 637, 651, 665, 688, 692, 699, 703, - 711, 716, 723, 733, 734, 735, 736, 737, 744, 751, - 752, 757, 758, 9, 19, 29, 39, 49, 59, 73, - 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, - 84, 85, 86, 87, 88, 89, 90, 95, 96, 97, - 98, 99, 100, 105, 106, 111, 112, 113, 118, 119, - 120, 7, 29, 30, 34, 35, 39, 39, 43, 51, - 58, 65, 71, 80, 87, 95, 101, 111, 112, 116, - 126, 127, 128, 132, 142, 142, 146, 147, 7, 16, - 25, 34, 43, 52, 64, 74, 84, 88, 95, 99, - 103, 113, 117, 124, 125, 130, 134, 138, 145, 149, - 156, 164, 172, 7, 1, 30, 49, 61, 62, 63, - 67, 68, 73, 77, 94, 95, 99, 100, 105, 106, - 110, 111, 115, 119, 124, 125, 130, 134, 139, 143, - 147, 151, 155, 159, 163, 167, 171, 175, 179, 183, - 187, 191, 195, 199, 211, 212, 213, 214, 215, 216, - 217, 47, 48, 52, 53, 54, 72, 73, 80, 88, - 96, 104, 112, 120, 131, 132, 159, 164, 172, 188, - 205, 223, 241, 242, 261, 265, 269, 273, 277, 287, - 298, 308, 317, 328, 339, 351, 366, 384, 384, 388, - 388, 392, 392, 396, 402, 409, 413, 414, 418, 419, - 433, 440, 447, 457, 458, 461, 475, 476, 480, 481, - 485, 486, 490, 491, 492, 496, 507, 515, 520, 525, - 530, 535, 543, 551, 556, 561, 568, 569, 573, 574, - 575, 579, 586, 587, 591, 592, 596, 597, 598, 602, - 603, 607, 608, 624, 625, 628, 637, 648, 649, 650, - 653, 654, 655, 659, 660, 661, 662, 666, 667, 671, - 673, 689, 691, 696, 699, 704, 708, 712, 719, 723, - 727, 731, 738, 743, 750, 751, 755, 760, 764, 768, - 776, 783, 784, 789, 790, 795, 796, 800, 810, 811, - 816, 817, 822, 824, 826, 831, 851, 852, 854, 859, - 860, 864, 865, 868, 869, 894, 895, 900, 904, 905, - 909, 910, 914, 915, 916, 917, 918, 922, 935, 942, - 949, 956, 957, 961, 962, 966, 967, 971, 972, 976, - 977, 981, 982, 986, 997, 998, 999, 1000, 1004, 1005, - 1010, 1011, 1012, 1021, 1027, 1036, 1037, 1050, 1051, 1055, - 1056, 1060, 1061, 1065, 1076, 1083, 1090, 1098, 1106, 1116, - 1124, 1133, 1142, 1151, 1155, 1160, 1165, 1176, 1190, 1191, - 1194, 1195, 1196, 1199, 1207, 1217, 1218, 1219, 1222, 1230, - 1239, 1243, 1250, 1251, 1255, 1264, 1268, 1293, 1297, 1310, - 1324, 1339, 1351, 1364, 1378, 1392, 1405, 1420, 1439, 1445, - 1450, 1456, 1463, 1464, 1472, 1476, 1480, 1486, 1493, 1498, - 1499, 1500, 1501, 1502, 1503, 1507, 1508, 1520, 1521, 1526, - 1533, 1540, 1547, 1579, 1590, 1603, 1608, 1609, 1612, 1613, - 1616, 1617, 1622, 1623, 1628, 1632, 1638, 1659, 1667, 1681, - 1684, 1688, 1688, 1691, 1692, 1694, 1699, 1706, 1711, 1717, - 1722, 1728, 1733, 1740, 1747, 1757, 1758, 1762, 1764, 1767, - 1771, 1772, 1773, 1774, 1775, 1776, 1781, 1801, 1802, 1803, - 1804, 1815, 1829, 1830, 1836, 1841, 1846, 1851, 1856, 1861, - 1866, 1871, 1877, 1883, 1889, 1896, 1918, 1927, 1931, 1939, - 1943, 1951, 1963, 1984, 1988, 1994, 1998, 2011, 2019, 2029, - 2031, 2033, 2035, 2037, 2039, 2044, 2045, 2052, 2061, 2069, - 2078, 2089, 2097, 2098, 2099, 2103, 2103, 2106, 2106, 2109, - 2109, 2112, 2112, 2115, 2115, 2118, 2118, 2121, 2121, 2124, - 2124, 2127, 2127, 2130, 2130, 2133, 2133, 2136, 2136, 2139, - 2139, 2142, 2144, 2146, 2148, 2150, 2152, 2154, 2156, 2158, - 2160, 2162, 2164, 2166, 2168, 2173, 2178, 2184, 2191, 2196, - 2202, 2208, 2239, 2241, 2243, 2251, 2266, 2268, 2270, 2272, - 2274, 2276, 2278, 2280, 2282, 2284, 2286, 2288, 2290, 2292, - 2294, 2296, 2299, 2301, 2303, 2306, 2308, 2310, 2312, 2314, - 2319, 2324, 2331, 2336, 2343, 2348, 2355, 2360, 2368, 2376, - 2384, 2392, 2410, 2418, 2426, 2434, 2442, 2450, 2458, 2466, - 2470, 2486, 2494, 2502, 2510, 2518, 2526, 2534, 2538, 2542, - 2546, 2550, 2558, 2566, 2574, 2582, 2602, 2624, 2635, 2642, - 2656, 2664, 2669, 2679, 2688, 2709, 2711, 2713, 2715, 2717, - 2719, 2721, 2723, 2725, 2727, 2729, 2731, 2733, 2735, 2737, - 2739, 2741, 2743, 2745, 2747, 2749, 2751, 2755, 2759, 2763, - 2777, 2778, 2792, 2793, 2794, 2805, 2829, 2840, 2850, 2854, - 2858, 2865, 2869, 2876, 2883, 2884, 2885, 2886, 2887, 2888, - 2889, 2890, 2901, 2906, 2915, 2921, 2928, 2948, 2952, 2959, - 2966, 2974, 2982, 2993, 3013, 3049, 3060, 3061, 3068, 3074, - 3076, 3078, 3082, 3091, 3096, 3103, 3118, 3125, 3129, 3133, - 3137, 3141, 3151, 3160, 3182, 3183, 3187, 3188, 3189, 3193, - 3194, 3201, 3202, 3206, 3207, 3212, 3220, 3222, 3236, 3239, - 3266, 3267, 3270, 3271, 3279, 3287, 3295, 3304, 3314, 3332, - 3378, 3387, 3396, 3405, 3414, 3426, 3427, 3428, 3429, 3430, - 3444, 3445, 3448, 3449, 3453, 3463, 3464, 3468, 3469, 3473, - 3480, 3481, 3486, 3487, 3492, 3493, 3496, 3497, 3498, 3501, - 3502, 3505, 3506, 3507, 3508, 3509, 3510, 3511, 3512, 3513, - 3514, 3515, 3516, 3517, 3518, 3521, 3523, 3528, 3530, 3535, - 3537, 3539, 3541, 3543, 3545, 3547, 3549, 3563, 3565, 3570, - 3574, 3581, 3586, 3592, 3596, 3603, 3608, 3615, 3620, 3628, - 3632, 3638, 3642, 3651, 3662, 3663, 3667, 3671, 3678, 3679, - 3680, 3681, 3682, 3683, 3684, 3685, 3686, 3687, 3688, 3689, - 3690, 3691, 3692, 3702, 3706, 3713, 3720, 3721, 3737, 3741, - 3746, 3750, 3765, 3770, 3774, 3777, 3780, 3781, 3782, 3785, - 3792, 3793, 3794, 3804, 3818, 3819, 3823, 3834, 3835, 3838, - 3839, 3847, 3853, 3857, 3864, 3872, 3880, 3888, 3898, 3899, - 3904, 3905, 3909, 3910, 3911, 3915, 3924, 3932, 3940, 3949, - 3964, 3965, 3970, 3971, 3981, 3982, 3986, 3987, 3991, 3992, - 3995, 4011, 4019, 4027, 4037, 4038, 4042, 4046, 4052, 4054, - 4059, 4060, 4064, 4065, 4068, 4072, 4073, 4077, 4078, 4081, - 4082, 4083, 4086, 4090, 4091, 4095, 4096, 4098, 4099, 4100, - 4110, 4111, 4115, 4117, 4123, 4124, 4128, 4129, 4132, 4143, - 4146, 4157, 4161, 4165, 4177, 4181, 4190, 4197, 4235, 4239, - 4243, 4247, 4251, 4255, 4259, 4265, 4282, 4283, 4284, 4287, - 4288, 4289, 4292, 4293, 4294, 4297, 4298, 4301, 4303, 4308, - 4309, 4312, 4316, 4317, 7, 18, 19, 23, 24, 25, - 26, 27, 28, 7, 26, 50, 73, 80, 85, 86, - 87, 88, 8, 33, 62, 66, 67, 72, 73, 78, - 79, 83, 84, 89, 90, 7, 16, 25, 34, 43, - 52, 5, 12, 22, 23, 7, 15, 26, 27, 30, - 31, 32, 33, 34, 35, 36, 37, 38, 39, 7, - 19, 33, 9, 16, 26, 33, 44, 45, 50, 51, - 52, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - 86, 87, 88, 92, 93, 94, 99, 100, 105, 109, - 117, 118, 123, 124, 125, 131, 136, 144, 145, 10, - 16, 22, 28, 34, 44, 45, 53, 64, 76, 84, - 95, 101, 105, 109, 124, 131, 132, 133, 137, 138, - 7, 17, 26, 35, 46, 47, 49, 50, 53, 54, - 55, 8, 22, 36, 48, 56, 70, 71, 72, 73, - 74, 87, 88, 93, 94, 98, 99, 7, 18, 31, - 35, 42, 53, 54, 60, 61, 9, 19, 7, 16, - 25, 37, 44, 51, 60, 61, 65, 66, 77, 78, - 82, 89, 93, 100, 105, 2, 7, 12, 17, 22, - 31, 38, 48, 49, 56, 3, 10, 17, 24, 32, - 39, 46, 53, 60, 69, 69, 71, 71, 73, 73, - 75, 76, 6, 8, 21, 34, 47, 65, 87, 88, - 89, 90, 11, 24, 37, 54, 55, 56, 61, 74, + 59, 2, 7, 31, 56, 86, 87, 114, 115, 116, + 117, 118, 119, 123, 124, 128, 133, 134, 135, 136, + 137, 142, 149, 150, 151, 168, 175, 182, 192, 202, + 214, 222, 231, 249, 250, 254, 255, 259, 268, 291, + 305, 312, 317, 319, 321, 323, 326, 329, 330, 331, + 332, 337, 340, 341, 346, 353, 358, 359, 360, 361, + 362, 363, 364, 365, 371, 372, 375, 380, 387, 394, + 401, 412, 413, 417, 421, 428, 429, 430, 431, 434, + 439, 440, 441, 446, 451, 452, 453, 454, 455, 456, + 461, 481, 507, 515, 525, 526, 530, 534, 535, 536, + 540, 544, 552, 553, 558, 559, 560, 564, 572, 573, + 578, 579, 583, 588, 592, 596, 601, 605, 612, 613, + 617, 618, 622, 623, 629, 640, 653, 667, 681, 695, + 709, 732, 736, 743, 747, 755, 760, 767, 777, 778, + 779, 780, 781, 788, 795, 796, 800, 801, 9, 19, + 29, 39, 49, 59, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 95, 96, 97, 98, 99, 100, 105, 106, + 111, 112, 113, 118, 119, 120, 7, 29, 30, 34, + 35, 39, 39, 43, 51, 58, 65, 71, 80, 87, + 95, 101, 111, 112, 116, 126, 127, 128, 132, 142, + 142, 146, 147, 7, 16, 25, 34, 43, 52, 64, + 74, 84, 88, 95, 99, 103, 113, 117, 124, 125, + 130, 134, 138, 145, 149, 156, 164, 172, 7, 1, + 30, 49, 61, 62, 63, 67, 68, 73, 77, 94, + 95, 99, 100, 105, 106, 110, 111, 115, 119, 124, + 125, 130, 134, 139, 143, 147, 151, 155, 159, 163, + 167, 171, 175, 179, 183, 187, 191, 195, 199, 211, + 212, 213, 214, 215, 216, 217, 47, 48, 52, 53, + 54, 72, 73, 80, 88, 96, 104, 112, 120, 131, + 132, 159, 164, 172, 188, 205, 223, 241, 242, 261, + 265, 269, 273, 277, 287, 298, 308, 317, 328, 339, + 351, 366, 384, 384, 388, 388, 392, 392, 396, 402, + 409, 413, 414, 418, 419, 433, 440, 447, 457, 458, + 461, 475, 476, 480, 481, 485, 486, 490, 491, 492, + 496, 507, 515, 520, 525, 530, 535, 543, 551, 556, + 561, 568, 569, 573, 574, 575, 579, 586, 587, 591, + 592, 596, 597, 598, 602, 603, 607, 608, 624, 625, + 628, 637, 648, 649, 650, 653, 654, 655, 659, 660, + 661, 662, 666, 667, 671, 673, 689, 691, 696, 699, + 704, 708, 712, 719, 723, 727, 731, 738, 743, 750, + 751, 755, 760, 764, 768, 776, 783, 784, 789, 790, + 795, 796, 800, 810, 811, 816, 817, 822, 824, 826, + 831, 851, 852, 854, 859, 860, 864, 865, 868, 869, + 894, 895, 900, 904, 905, 909, 910, 914, 915, 916, + 917, 918, 922, 935, 942, 949, 956, 957, 961, 962, + 966, 967, 971, 972, 976, 977, 981, 982, 986, 997, + 998, 999, 1000, 1004, 1005, 1010, 1011, 1012, 1021, 1027, + 1036, 1037, 1050, 1051, 1055, 1056, 1060, 1061, 1065, 1076, + 1083, 1090, 1098, 1106, 1116, 1124, 1133, 1142, 1151, 1155, + 1160, 1165, 1176, 1190, 1191, 1194, 1195, 1196, 1199, 1207, + 1217, 1218, 1219, 1222, 1230, 1239, 1243, 1250, 1251, 1255, + 1264, 1268, 1293, 1297, 1310, 1324, 1339, 1351, 1364, 1378, + 1392, 1405, 1420, 1439, 1445, 1450, 1456, 1463, 1464, 1472, + 1476, 1480, 1486, 1493, 1498, 1499, 1500, 1501, 1502, 1503, + 1507, 1508, 1520, 1521, 1526, 1533, 1540, 1547, 1579, 1590, + 1603, 1608, 1609, 1612, 1613, 1616, 1617, 1622, 1623, 1628, + 1632, 1638, 1659, 1667, 1681, 1684, 1688, 1688, 1691, 1692, + 1694, 1699, 1706, 1711, 1717, 1722, 1728, 1733, 1740, 1747, + 1757, 1758, 1762, 1764, 1767, 1771, 1772, 1773, 1774, 1775, + 1776, 1781, 1801, 1802, 1803, 1804, 1815, 1829, 1830, 1836, + 1841, 1846, 1851, 1856, 1861, 1866, 1871, 1877, 1883, 1889, + 1896, 1918, 1927, 1931, 1939, 1943, 1951, 1963, 1984, 1988, + 1994, 1998, 2011, 2019, 2029, 2031, 2033, 2035, 2037, 2039, + 2044, 2045, 2052, 2061, 2069, 2078, 2089, 2097, 2098, 2099, + 2103, 2103, 2106, 2106, 2109, 2109, 2112, 2112, 2115, 2115, + 2118, 2118, 2121, 2121, 2124, 2124, 2127, 2127, 2130, 2130, + 2133, 2133, 2136, 2136, 2139, 2139, 2142, 2144, 2146, 2148, + 2150, 2152, 2154, 2156, 2158, 2160, 2162, 2164, 2166, 2168, + 2173, 2178, 2184, 2191, 2196, 2202, 2208, 2239, 2241, 2243, + 2251, 2266, 2268, 2270, 2272, 2274, 2276, 2278, 2280, 2282, + 2284, 2286, 2288, 2290, 2292, 2294, 2296, 2299, 2301, 2303, + 2306, 2308, 2310, 2312, 2314, 2319, 2324, 2331, 2336, 2343, + 2348, 2355, 2360, 2368, 2376, 2384, 2392, 2410, 2418, 2426, + 2434, 2442, 2450, 2458, 2466, 2470, 2486, 2494, 2502, 2510, + 2518, 2526, 2534, 2538, 2542, 2546, 2550, 2558, 2566, 2574, + 2582, 2602, 2624, 2635, 2642, 2656, 2664, 2669, 2679, 2688, + 2709, 2711, 2713, 2715, 2717, 2719, 2721, 2723, 2725, 2727, + 2729, 2731, 2733, 2735, 2737, 2739, 2741, 2743, 2745, 2747, + 2749, 2751, 2755, 2759, 2763, 2777, 2778, 2792, 2793, 2794, + 2805, 2829, 2840, 2850, 2854, 2858, 2865, 2869, 2876, 2883, + 2884, 2885, 2886, 2887, 2888, 2889, 2890, 2901, 2906, 2915, + 2921, 2928, 2948, 2952, 2959, 2966, 2974, 2982, 2993, 3013, + 3049, 3060, 3061, 3068, 3074, 3076, 3078, 3082, 3091, 3096, + 3103, 3118, 3125, 3129, 3133, 3137, 3141, 3151, 3160, 3182, + 3183, 3187, 3188, 3189, 3193, 3194, 3201, 3202, 3206, 3207, + 3212, 3220, 3222, 3236, 3239, 3266, 3267, 3270, 3271, 3279, + 3287, 3295, 3304, 3314, 3332, 3378, 3387, 3396, 3405, 3414, + 3426, 3427, 3428, 3429, 3430, 3444, 3445, 3448, 3449, 3453, + 3463, 3464, 3468, 3469, 3473, 3480, 3481, 3486, 3487, 3492, + 3493, 3496, 3497, 3498, 3501, 3502, 3505, 3506, 3507, 3508, + 3509, 3510, 3511, 3512, 3513, 3514, 3515, 3516, 3517, 3518, + 3521, 3523, 3528, 3530, 3535, 3537, 3539, 3541, 3543, 3545, + 3547, 3549, 3563, 3565, 3570, 3574, 3581, 3586, 3592, 3596, + 3603, 3608, 3615, 3620, 3628, 3632, 3638, 3642, 3651, 3662, + 3663, 3667, 3671, 3678, 3679, 3680, 3681, 3682, 3683, 3684, + 3685, 3686, 3687, 3688, 3689, 3690, 3691, 3692, 3702, 3706, + 3713, 3720, 3721, 3737, 3741, 3746, 3750, 3765, 3770, 3774, + 3777, 3780, 3781, 3782, 3785, 3792, 3793, 3794, 3804, 3818, + 3819, 3823, 3834, 3835, 3838, 3839, 3847, 3853, 3857, 3864, + 3872, 3880, 3888, 3898, 3899, 3904, 3905, 3909, 3910, 3911, + 3915, 3924, 3932, 3940, 3949, 3964, 3965, 3970, 3971, 3981, + 3982, 3986, 3987, 3991, 3992, 3995, 4011, 4019, 4027, 4037, + 4038, 4042, 4046, 4052, 4054, 4059, 4060, 4064, 4065, 4068, + 4072, 4073, 4077, 4078, 4081, 4082, 4083, 4086, 4090, 4091, + 4095, 4096, 4098, 4099, 4100, 4110, 4111, 4115, 4117, 4123, + 4124, 4128, 4129, 4132, 4143, 4146, 4157, 4161, 4165, 4177, + 4181, 4190, 4197, 4235, 4239, 4243, 4247, 4251, 4255, 4259, + 4265, 4282, 4283, 4284, 4287, 4288, 4289, 4292, 4293, 4294, + 4297, 4298, 4301, 4303, 4308, 4309, 4312, 4316, 4317, 7, + 18, 19, 23, 24, 25, 26, 27, 28, 7, 26, + 50, 73, 80, 85, 86, 87, 88, 8, 33, 62, + 66, 67, 72, 73, 78, 79, 83, 84, 89, 90, + 7, 16, 25, 34, 43, 52, 5, 12, 22, 23, + 7, 15, 26, 27, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 7, 19, 33, 9, 16, 26, + 33, 44, 45, 50, 51, 52, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, + 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, + 81, 82, 83, 84, 85, 86, 87, 88, 92, 93, + 94, 99, 100, 105, 109, 117, 118, 123, 124, 125, + 131, 136, 144, 145, 10, 16, 22, 28, 34, 44, + 45, 53, 64, 76, 84, 95, 101, 105, 109, 124, + 131, 132, 133, 137, 138, 7, 17, 26, 35, 46, + 47, 49, 50, 53, 54, 55, 8, 22, 36, 48, + 56, 70, 71, 72, 73, 74, 87, 88, 93, 94, + 98, 99, 7, 18, 31, 35, 42, 53, 54, 60, + 61, 9, 19, 7, 16, 25, 37, 44, 51, 60, + 61, 65, 66, 77, 78, 82, 89, 93, 100, 105, + 2, 7, 12, 17, 22, 31, 38, 48, 49, 56, + 3, 10, 17, 24, 32, 39, 46, 53, 60, 69, + 69, 71, 71, 73, 73, 75, 76, 6, 8, 21, + 34, 47, 65, 87, 88, 89, 90, 11, 24, 37, + 54, 55, 56, 61, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, @@ -2864,19 +2869,18 @@ static const yytype_uint16 yyrline[] = 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, - 74, 74, 74, 74, 74, 74, 74, 74, 74, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 74, 74, 74, 74, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 76, 76, 76, 76, 76, 76, 76, + 75, 75, 75, 75, 75, 75, 75, 75, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, - 76, 76, 77, 77, 77, 77, 77, 77, 77, 77, + 76, 76, 76, 76, 76, 76, 76, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 77, 78, 78, 78, 78, 78, 78, + 77, 77, 77, 77, 77, 77, 77, 77, 77, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, @@ -2884,18 +2888,19 @@ static const yytype_uint16 yyrline[] = 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, - 78, 78, 78, 78, 78, 78, 78, 78, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, + 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, + 78, 78, 78, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 80, 80, 80, 80, 80, 80, 80, + 79, 79, 79, 79, 79, 79, 79, 79, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80 + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80 }; #endif @@ -3020,20 +3025,22 @@ static const char *const yytname[] = "GeneratedConstraintElem", "generic_option_elem", "key_update", "key_actions", "OnCommitOption", "reloptions", "opt_no_inherit", "TableConstraint", "TableLikeOption", "reloption_list", "ExistingIndex", - "ConstraintAttr", "OptWith", "definition", "TableLikeOptionList", - "generic_option_name", "ConstraintAttributeElem", "regularColumnDef", - "generatedColumnDef", "columnDef", "def_list", "index_name", - "TableElement", "def_elem", "opt_definition", "OptTableElementList", - "columnElem", "opt_column_list", "ColQualList", "key_delete", - "reloption_elem", "columnList", "columnList_opt_comma", "func_type", - "ConstraintElem", "TableElementList", "key_match", "TableLikeClause", - "OptTemp", "generated_when", "DropStmt", "drop_type_any_name", - "drop_type_name", "any_name_list", "opt_drop_behavior", - "drop_type_name_on_any_name", "MergeIntoStmt", "opt_and_clause", - "opt_insert_column_list", "opt_star_expr", "matched_clause_action", - "opt_error_message", "matched_clause", "opt_source_or_target", - "not_matched_clause", "matched_or_not_matched_clause", - "merge_match_list", "CreateFunctionStmt", "table_macro_definition", + "ConstraintAttr", "OptPartitionSortedOptions", + "OptPartitionSortedOption", "OptWith", "definition", + "TableLikeOptionList", "generic_option_name", "ConstraintAttributeElem", + "regularColumnDef", "generatedColumnDef", "columnDef", "def_list", + "index_name", "TableElement", "def_elem", "opt_definition", + "OptTableElementList", "columnElem", "opt_column_list", "ColQualList", + "key_delete", "reloption_elem", "columnList", "columnList_opt_comma", + "func_type", "ConstraintElem", "TableElementList", "key_match", + "TableLikeClause", "OptTemp", "generated_when", "DropStmt", + "drop_type_any_name", "drop_type_name", "any_name_list", + "opt_drop_behavior", "drop_type_name_on_any_name", "MergeIntoStmt", + "opt_and_clause", "opt_insert_column_list", "opt_star_expr", + "matched_clause_action", "opt_error_message", "matched_clause", + "opt_source_or_target", "not_matched_clause", + "matched_or_not_matched_clause", "merge_match_list", + "CreateFunctionStmt", "table_macro_definition", "table_macro_definition_parens", "table_macro_list_internal", "table_macro_list", "macro_definition", "macro_definition_list", "macro_alias", "param_list", "MacroParameterList", "MacroParameter", @@ -3239,196 +3246,197 @@ static const yytype_uint16 yyr1[] = 633, 634, 635, 635, 635, 635, 635, 636, 636, 636, 636, 637, 638, 638, 639, 639, 640, 640, 640, 640, 640, 640, 640, 640, 641, 641, 642, 643, 643, 643, - 643, 644, 644, 644, 644, 645, 646, 646, 646, 647, - 648, 648, 648, 648, 648, 648, 649, 650, 651, 651, - 652, 652, 653, 654, 654, 654, 655, 655, 656, 656, - 657, 657, 657, 658, 659, 659, 660, 660, 661, 662, - 662, 662, 662, 663, 663, 664, 664, 665, 665, 665, - 666, 666, 666, 666, 666, 666, 667, 667, 668, 668, - 668, 668, 669, 670, 670, 670, 670, 670, 670, 670, - 670, 671, 671, 672, 672, 672, 672, 672, 672, 673, - 673, 673, 673, 673, 673, 673, 673, 673, 673, 673, - 673, 673, 673, 673, 673, 673, 673, 674, 674, 674, - 674, 674, 674, 675, 675, 676, 676, 676, 677, 677, - 677, 678, 679, 679, 680, 680, 681, 681, 682, 682, - 682, 682, 682, 682, 682, 682, 682, 683, 683, 684, - 685, 685, 685, 686, 687, 687, 688, 688, 689, 689, - 689, 689, 689, 689, 690, 691, 692, 692, 693, 693, - 694, 695, 695, 696, 696, 697, 697, 697, 698, 698, - 699, 699, 699, 700, 701, 701, 701, 702, 702, 702, - 703, 703, 704, 704, 705, 705, 706, 706, 707, 707, - 708, 708, 709, 709, 710, 710, 711, 711, 712, 712, - 712, 712, 712, 712, 712, 712, 712, 712, 712, 712, - 712, 712, 712, 712, 713, 713, 713, 713, 713, 713, - 713, 714, 714, 715, 715, 715, 716, 716, 716, 716, - 716, 716, 716, 716, 717, 717, 718, 718, 719, 719, - 719, 719, 719, 719, 719, 719, 719, 719, 719, 719, - 719, 719, 719, 719, 719, 719, 719, 720, 720, 721, - 721, 722, 722, 723, 723, 723, 724, 724, 725, 725, - 726, 726, 726, 727, 727, 728, 729, 729, 730, 730, - 731, 731, 732, 732, 732, 733, 733, 734, 734, 734, - 734, 734, 734, 734, 734, 734, 735, 735, 736, 736, - 736, 737, 738, 738, 739, 739, 740, 740, 740, 741, - 741, 742, 742, 743, 743, 744, 744, 745, 745, 745, - 746, 746, 746, 747, 747, 747, 747, 748, 748, 749, - 749, 749, 749, 750, 750, 751, 751, 751, 752, 752, - 752, 752, 753, 753, 754, 754, 755, 755, 755, 755, - 756, 757, 757, 758, 758, 759, 759, 760, 761, 761, - 762, 762, 762, 762, 762, 763, 764, 764, 764, 765, - 765, 766, 766, 767, 767, 768, 768, 768, 769, 769, - 770, 770, 771, 771, 771, 771, 771, 772, 773, 774, - 775, 776, 776, 777, 777, 778, 778, 779, 779, 780, - 780, 781, 781, 782, 783, 783, 783, 783, 784, 784, - 785, 785, 785, 786, 786, 787, 787, 788, 788, 789, - 789, 790, 790, 791, 792, 792, 792, 792, 792, 792, - 792, 792, 792, 792, 792, 792, 792, 792, 793, 793, + 643, 644, 644, 645, 645, 646, 646, 646, 646, 647, + 648, 648, 648, 649, 650, 650, 650, 650, 650, 650, + 651, 652, 653, 653, 654, 654, 655, 656, 656, 656, + 657, 657, 658, 658, 659, 659, 659, 660, 661, 661, + 662, 662, 663, 664, 664, 664, 664, 664, 665, 665, + 666, 666, 667, 667, 667, 668, 668, 668, 668, 668, + 668, 669, 669, 670, 670, 670, 670, 671, 672, 672, + 672, 672, 672, 672, 672, 672, 673, 673, 674, 674, + 674, 674, 674, 674, 675, 675, 675, 675, 675, 675, + 675, 675, 675, 675, 675, 675, 675, 675, 675, 675, + 675, 675, 676, 676, 676, 676, 676, 676, 677, 677, + 678, 678, 678, 679, 679, 679, 680, 681, 681, 682, + 682, 683, 683, 684, 684, 684, 684, 684, 684, 684, + 684, 684, 685, 685, 686, 687, 687, 687, 688, 689, + 689, 690, 690, 691, 691, 691, 691, 691, 691, 692, + 693, 694, 694, 695, 695, 696, 697, 697, 698, 698, + 699, 699, 699, 700, 700, 701, 701, 701, 702, 703, + 703, 703, 704, 704, 704, 705, 705, 706, 706, 707, + 707, 708, 708, 709, 709, 710, 710, 711, 711, 712, + 712, 713, 713, 714, 714, 714, 714, 714, 714, 714, + 714, 714, 714, 714, 714, 714, 714, 714, 714, 715, + 715, 715, 715, 715, 715, 715, 716, 716, 717, 717, + 717, 718, 718, 718, 718, 718, 718, 718, 718, 719, + 719, 720, 720, 721, 721, 721, 721, 721, 721, 721, + 721, 721, 721, 721, 721, 721, 721, 721, 721, 721, + 721, 721, 722, 722, 723, 723, 724, 724, 725, 725, + 725, 726, 726, 727, 727, 728, 728, 728, 729, 729, + 730, 731, 731, 732, 732, 733, 733, 734, 734, 734, + 735, 735, 736, 736, 736, 736, 736, 736, 736, 736, + 736, 737, 737, 738, 738, 738, 739, 740, 740, 741, + 741, 742, 742, 742, 743, 743, 744, 744, 745, 745, + 746, 746, 747, 747, 747, 748, 748, 748, 749, 749, + 749, 749, 750, 750, 751, 751, 751, 751, 752, 752, + 753, 753, 753, 754, 754, 754, 754, 755, 755, 756, + 756, 757, 757, 757, 757, 758, 759, 759, 760, 760, + 761, 761, 762, 763, 763, 764, 764, 764, 764, 764, + 765, 766, 766, 766, 767, 767, 768, 768, 769, 769, + 770, 770, 770, 771, 771, 772, 772, 773, 773, 773, + 773, 773, 774, 775, 776, 777, 778, 778, 779, 779, + 780, 780, 781, 781, 782, 782, 783, 783, 784, 785, + 785, 785, 785, 786, 786, 787, 787, 787, 788, 788, + 789, 789, 790, 790, 791, 791, 792, 792, 793, 794, + 794, 794, 794, 794, 794, 794, 794, 794, 794, 794, 794, 794, 794, 795, 795, 796, 796, 796, 797, 797, - 798, 798, 799, 799, 800, 801, 801, 802, 802, 802, - 802, 802, 802, 802, 802, 802, 802, 802, 803, 803, - 803, 803, 804, 804, 805, 805, 805, 805, 805, 806, - 806, 806, 806, 806, 806, 807, 807, 808, 808, 809, - 809, 809, 809, 810, 810, 811, 812, 812, 813, 813, - 814, 814, 815, 815, 816, 816, 817, 818, 818, 819, - 819, 820, 820, 821, 821, 822, 822, 822, 822, 822, - 822, 822, 822, 822, 822, 823, 823, 824, 824, 824, - 825, 825, 825, 825, 825, 825, 825, 826, 826, 826, - 826, 827, 828, 828, 829, 829, 829, 829, 829, 829, - 829, 829, 829, 829, 829, 830, 830, 831, 831, 832, - 832, 833, 834, 835, 835, 836, 836, 837, 838, 839, - 839, 839, 839, 839, 839, 840, 840, 841, 841, 841, - 841, 842, 843, 843, 843, 844, 844, 845, 845, 846, - 846, 847, 847, 848, 848, 849, 849, 850, 850, 851, - 851, 852, 852, 853, 853, 854, 854, 855, 855, 856, - 856, 857, 857, 857, 857, 857, 857, 857, 857, 857, - 857, 857, 857, 857, 857, 857, 857, 857, 857, 857, - 857, 857, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 858, 858, 858, 858, 859, 859, 859, 859, 859, - 859, 859, 859, 859, 859, 859, 859, 859, 859, 859, + 798, 798, 798, 799, 799, 800, 800, 801, 801, 802, + 803, 803, 804, 804, 804, 804, 804, 804, 804, 804, + 804, 804, 804, 805, 805, 805, 805, 806, 806, 807, + 807, 807, 807, 807, 808, 808, 808, 808, 808, 808, + 809, 809, 810, 810, 811, 811, 811, 811, 812, 812, + 813, 814, 814, 815, 815, 816, 816, 817, 817, 818, + 818, 819, 820, 820, 821, 821, 822, 822, 823, 823, + 824, 824, 824, 824, 824, 824, 824, 824, 824, 824, + 825, 825, 826, 826, 826, 827, 827, 827, 827, 827, + 827, 827, 828, 828, 828, 828, 829, 830, 830, 831, + 831, 831, 831, 831, 831, 831, 831, 831, 831, 831, + 832, 832, 833, 833, 834, 834, 835, 836, 837, 837, + 838, 838, 839, 840, 841, 841, 841, 841, 841, 841, + 842, 842, 843, 843, 843, 843, 844, 845, 845, 845, + 846, 846, 847, 847, 848, 848, 849, 849, 850, 850, + 851, 851, 852, 852, 853, 853, 854, 854, 855, 855, + 856, 856, 857, 857, 858, 858, 859, 859, 859, 859, 859, 859, 859, 859, 859, 859, 859, 859, 859, 859, - 860, 860, 861, 861, 861, 861, 861, 861, 862, 862, - 862, 863, 863, 863, 864, 864, 864, 864, 864, 864, - 864, 864, 864, 864, 865, 866, 867, 868, 868, 868, - 868, 868, 868, 868, 869, 869, 870, 870, 871, 871, - 871, 871, 871, 871, 871, 871, 871, 871, 871, 871, - 871, 871, 872, 872, 873, 873, 874, 874, 874, 875, - 875, 876, 876, 877, 877, 878, 879, 879, 879, 880, - 881, 881, 882, 882, 883, 883, 883, 883, 884, 884, - 885, 885, 885, 885, 885, 886, 886, 886, 886, 886, - 887, 887, 888, 888, 889, 890, 890, 891, 891, 892, - 893, 893, 894, 894, 895, 895, 896, 896, 896, 897, - 897, 898, 898, 898, 898, 898, 898, 898, 898, 898, - 898, 898, 898, 898, 898, 899, 899, 900, 900, 901, - 901, 901, 901, 901, 901, 901, 901, 902, 902, 903, - 903, 904, 904, 905, 905, 906, 906, 907, 907, 908, - 908, 909, 909, 909, 910, 910, 911, 911, 912, 912, - 912, 912, 912, 912, 912, 912, 912, 912, 912, 912, - 912, 912, 912, 913, 913, 914, 915, 915, 916, 916, - 916, 916, 916, 916, 917, 918, 919, 919, 919, 920, - 920, 920, 920, 921, 922, 922, 923, 924, 924, 925, - 925, 926, 927, 927, 563, 563, 563, 563, 928, 928, - 929, 929, 930, 930, 930, 931, 931, 931, 931, 931, - 932, 932, 933, 933, 934, 934, 935, 935, 936, 936, - 937, 937, 937, 937, 938, 938, 939, 939, 940, 940, - 941, 941, 942, 942, 943, 944, 944, 945, 945, 946, - 946, 946, 947, 948, 948, 949, 949, 950, 950, 950, - 951, 951, 952, 952, 953, 953, 954, 954, 955, 956, - 956, 957, 957, 957, 957, 957, 957, 957, 957, 957, - 957, 957, 957, 957, 957, 958, 959, 959, 959, 960, - 960, 960, 961, 961, 961, 962, 962, 963, 963, 964, - 964, 965, 966, 966, 967, 968, 968, 969, 969, 969, - 969, 969, 969, 970, 970, 970, 971, 971, 972, 972, - 972, 972, 973, 973, 974, 975, 975, 976, 976, 977, - 977, 978, 978, 979, 979, 980, 980, 980, 980, 980, - 980, 981, 981, 982, 982, 983, 983, 984, 984, 985, - 985, 985, 985, 985, 985, 985, 985, 985, 985, 986, - 986, 987, 988, 988, 988, 988, 989, 989, 990, 990, - 990, 991, 991, 991, 991, 991, 991, 991, 991, 991, - 991, 991, 991, 991, 991, 991, 991, 991, 991, 991, - 991, 991, 991, 991, 991, 991, 991, 991, 991, 991, - 991, 991, 991, 992, 992, 992, 993, 993, 994, 994, - 995, 995, 996, 996, 996, 996, 997, 998, 998, 999, - 999, 999, 999, 999, 1000, 1000, 1000, 1000, 1001, 1001, - 1002, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1004, 1004, - 1005, 1005, 1005, 1005, 1006, 1006, 1007, 1007, 1008, 1008, - 1008, 1009, 1009, 1009, 1009, 1009, 1010, 1010, 1010, 1010, - 1010, 1011, 1011, 1012, 1012, 1013, 1013, 1014, 1014, 1015, - 1015, 1015, 1016, 1016, 1017, 1017, 1018, 1018, 1019, 1019, - 1019, 1020, 1020, 1020, 1021, 1021, 1022, 1022, 1023, 1023, - 1024, 1025, 1025, 1026, 1026, 1027, 1027, 1027, 1027, 1027, - 1028, 1028, 1029, 1029, 1029, 1030, 1030, 1030, 1030, 1030, - 1030, 1030, 1030, 1030, 1031, 1031, 1032, 1032, 1033, 1033, - 1034, 1034, 1035, 1036, 1036, 1036, 1036, 1036, 1037, 1037, - 1037, 1037, 1038, 1038, 1038, 1039, 1039, 1039, 1040, 1041, - 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, - 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, - 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, - 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, - 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, - 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, - 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, - 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, - 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, - 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, - 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, - 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, - 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, - 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, - 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, - 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, - 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, - 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, - 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, - 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, - 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, - 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, - 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, - 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, - 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, - 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, - 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, - 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, - 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, - 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, - 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, - 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, - 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1042, - 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, - 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, - 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, - 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, - 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, 1042, - 1042, 1042, 1042, 1043, 1043, 1043, 1043, 1043, 1043, 1043, + 859, 859, 859, 859, 859, 859, 859, 860, 860, 860, + 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, + 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, + 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, + 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, + 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, + 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, + 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, + 861, 861, 861, 861, 861, 861, 861, 861, 861, 861, + 861, 861, 861, 861, 861, 861, 861, 861, 861, 861, + 861, 861, 861, 861, 861, 862, 862, 863, 863, 863, + 863, 863, 863, 864, 864, 864, 865, 865, 865, 866, + 866, 866, 866, 866, 866, 866, 866, 866, 866, 867, + 868, 869, 870, 870, 870, 870, 870, 870, 870, 871, + 871, 872, 872, 873, 873, 873, 873, 873, 873, 873, + 873, 873, 873, 873, 873, 873, 873, 874, 874, 875, + 875, 876, 876, 876, 877, 877, 878, 878, 879, 879, + 880, 881, 881, 881, 882, 883, 883, 884, 884, 885, + 885, 885, 885, 886, 886, 887, 887, 887, 887, 887, + 888, 888, 888, 888, 888, 889, 889, 890, 890, 891, + 892, 892, 893, 893, 894, 895, 895, 896, 896, 897, + 897, 898, 898, 898, 899, 899, 900, 900, 900, 900, + 900, 900, 900, 900, 900, 900, 900, 900, 900, 900, + 901, 901, 902, 902, 903, 903, 903, 903, 903, 903, + 903, 903, 904, 904, 905, 905, 906, 906, 907, 907, + 908, 908, 909, 909, 910, 910, 911, 911, 911, 912, + 912, 913, 913, 914, 914, 914, 914, 914, 914, 914, + 914, 914, 914, 914, 914, 914, 914, 914, 915, 915, + 916, 917, 917, 918, 918, 918, 918, 918, 918, 919, + 920, 921, 921, 921, 922, 922, 922, 922, 923, 924, + 924, 925, 926, 926, 927, 927, 928, 929, 929, 563, + 563, 563, 563, 930, 930, 931, 931, 932, 932, 932, + 933, 933, 933, 933, 933, 934, 934, 935, 935, 936, + 936, 937, 937, 938, 938, 939, 939, 939, 939, 940, + 940, 941, 941, 942, 942, 943, 943, 944, 944, 945, + 946, 946, 947, 947, 948, 948, 948, 949, 950, 950, + 951, 951, 952, 952, 952, 953, 953, 954, 954, 955, + 955, 956, 956, 957, 958, 958, 959, 959, 959, 959, + 959, 959, 959, 959, 959, 959, 959, 959, 959, 959, + 960, 961, 961, 961, 962, 962, 962, 963, 963, 963, + 964, 964, 965, 965, 966, 966, 967, 968, 968, 969, + 970, 970, 971, 971, 971, 971, 971, 971, 972, 972, + 972, 973, 973, 974, 974, 974, 974, 975, 975, 976, + 977, 977, 978, 978, 979, 979, 980, 980, 981, 981, + 982, 982, 982, 982, 982, 982, 983, 983, 984, 984, + 985, 985, 986, 986, 987, 987, 987, 987, 987, 987, + 987, 987, 987, 987, 988, 988, 989, 990, 990, 990, + 990, 991, 991, 992, 992, 992, 993, 993, 993, 993, + 993, 993, 993, 993, 993, 993, 993, 993, 993, 993, + 993, 993, 993, 993, 993, 993, 993, 993, 993, 993, + 993, 993, 993, 993, 993, 993, 993, 993, 994, 994, + 994, 995, 995, 996, 996, 997, 997, 998, 998, 998, + 998, 999, 1000, 1000, 1001, 1001, 1001, 1001, 1001, 1002, + 1002, 1002, 1002, 1003, 1003, 1004, 1005, 1005, 1005, 1005, + 1005, 1005, 1005, 1006, 1006, 1007, 1007, 1007, 1007, 1008, + 1008, 1009, 1009, 1010, 1010, 1010, 1011, 1011, 1011, 1011, + 1011, 1012, 1012, 1012, 1012, 1012, 1013, 1013, 1014, 1014, + 1015, 1015, 1016, 1016, 1017, 1017, 1017, 1018, 1018, 1019, + 1019, 1020, 1020, 1021, 1021, 1021, 1022, 1022, 1022, 1023, + 1023, 1024, 1024, 1025, 1025, 1026, 1027, 1027, 1028, 1028, + 1029, 1029, 1029, 1029, 1029, 1030, 1030, 1031, 1031, 1031, + 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1033, + 1033, 1034, 1034, 1035, 1035, 1036, 1036, 1037, 1038, 1038, + 1038, 1038, 1038, 1039, 1039, 1039, 1039, 1040, 1040, 1040, + 1041, 1041, 1041, 1042, 1043, 1043, 1043, 1043, 1043, 1043, + 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, + 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, + 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, + 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, + 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, + 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, + 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, + 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, + 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, + 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, + 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, + 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, + 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, + 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, + 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, + 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, + 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, + 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, + 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, + 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, + 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, + 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, - 1043, 1043, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, + 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, + 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, + 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, + 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, + 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, + 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, + 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, + 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, + 1043, 1043, 1043, 1043, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, - 1044, 1044, 1044, 1044, 1045, 1045, 1045, 1045, 1045, 1045, - 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, - 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, - 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, - 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, - 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, + 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, + 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, + 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, - 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1046, 1046, - 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, + 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, - 1046, 1046, 1046, 1047, 1047, 1047, 1047, 1047, 1047, 1047, + 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, - 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047 + 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, + 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, + 1047, 1047, 1047, 1048, 1048, 1048, 1048, 1048, 1048, 1048, + 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, + 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, + 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1049, 1049, + 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, + 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, + 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, + 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, + 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, + 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, + 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, + 1049, 1049, 1049 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -3463,139 +3471,140 @@ static const yytype_uint8 yyr2[] = 2, 2, 2, 3, 3, 3, 1, 3, 1, 0, 1, 2, 2, 6, 8, 5, 7, 0, 2, 2, 3, 3, 2, 2, 2, 1, 1, 0, 2, 2, - 0, 2, 9, 12, 11, 0, 2, 1, 1, 1, + 0, 2, 10, 13, 12, 0, 2, 1, 1, 1, 1, 1, 1, 3, 0, 1, 2, 1, 1, 2, 2, 3, 1, 1, 2, 2, 1, 2, 3, 5, 3, 2, 5, 1, 1, 1, 0, 5, 7, 5, 2, 3, 1, 1, 2, 2, 0, 3, 4, 4, 0, 3, 2, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 1, 2, 2, - 2, 2, 2, 2, 0, 3, 3, 3, 0, 1, - 2, 1, 2, 2, 2, 2, 2, 3, 2, 2, - 1, 3, 1, 1, 1, 1, 3, 1, 2, 0, - 1, 2, 0, 1, 3, 0, 2, 0, 3, 3, - 1, 5, 3, 1, 3, 1, 2, 1, 4, 5, - 5, 6, 3, 7, 4, 11, 1, 3, 2, 2, - 2, 0, 3, 1, 1, 2, 2, 2, 2, 1, - 0, 1, 2, 6, 4, 6, 4, 6, 8, 1, - 1, 1, 1, 2, 1, 2, 1, 2, 1, 1, - 1, 1, 3, 3, 3, 3, 1, 2, 2, 1, - 3, 1, 1, 1, 3, 1, 1, 0, 1, 1, - 1, 9, 2, 0, 3, 0, 1, 0, 3, 3, - 2, 1, 6, 3, 3, 2, 2, 1, 0, 5, - 2, 2, 0, 7, 1, 1, 1, 2, 5, 8, - 7, 5, 8, 7, 4, 4, 1, 3, 1, 1, - 3, 1, 3, 1, 1, 2, 4, 3, 1, 3, - 2, 4, 4, 8, 11, 9, 7, 0, 3, 3, - 1, 1, 3, 0, 1, 0, 1, 0, 1, 0, - 1, 3, 2, 0, 2, 0, 1, 0, 1, 1, - 1, 3, 3, 1, 1, 3, 3, 3, 3, 3, - 3, 4, 3, 2, 1, 1, 1, 3, 1, 3, - 1, 1, 1, 3, 3, 3, 1, 2, 4, 4, - 2, 3, 5, 5, 1, 1, 3, 0, 11, 11, - 10, 12, 1, 2, 5, 4, 4, 4, 4, 7, - 5, 4, 7, 6, 9, 9, 4, 1, 1, 1, - 1, 1, 1, 1, 5, 1, 1, 3, 1, 2, - 2, 2, 3, 1, 3, 8, 5, 0, 1, 2, - 1, 3, 1, 2, 0, 2, 0, 3, 3, 4, - 4, 4, 4, 3, 2, 1, 1, 0, 1, 1, - 0, 2, 1, 5, 1, 0, 2, 2, 0, 1, - 0, 3, 5, 1, 3, 4, 3, 1, 1, 0, - 2, 2, 0, 2, 2, 1, 1, 1, 0, 2, - 4, 5, 4, 2, 3, 1, 1, 1, 2, 2, - 1, 2, 3, 0, 1, 0, 5, 1, 4, 6, - 2, 1, 0, 4, 0, 1, 1, 3, 4, 0, - 1, 1, 2, 2, 2, 1, 1, 2, 2, 1, - 1, 1, 1, 1, 1, 3, 3, 0, 1, 3, - 1, 2, 1, 1, 1, 1, 1, 2, 4, 4, - 5, 1, 1, 2, 0, 2, 0, 1, 3, 1, - 0, 1, 2, 3, 2, 4, 2, 3, 2, 0, - 1, 2, 0, 4, 5, 1, 2, 2, 0, 1, - 3, 1, 2, 2, 4, 4, 3, 3, 3, 3, - 3, 3, 3, 1, 4, 4, 9, 9, 3, 0, - 2, 2, 0, 5, 3, 1, 1, 3, 5, 3, - 1, 2, 1, 3, 5, 1, 2, 3, 4, 5, - 4, 5, 4, 6, 5, 4, 5, 5, 5, 2, - 4, 1, 1, 0, 1, 4, 5, 4, 0, 2, - 2, 2, 1, 1, 1, 1, 0, 4, 2, 1, - 2, 2, 4, 2, 6, 2, 1, 3, 4, 0, - 2, 0, 2, 0, 1, 3, 3, 2, 0, 2, - 4, 1, 1, 1, 0, 2, 3, 5, 6, 2, - 3, 2, 5, 5, 5, 3, 3, 3, 4, 0, - 1, 1, 1, 1, 1, 2, 4, 1, 1, 1, - 1, 2, 3, 0, 1, 1, 1, 1, 1, 2, - 2, 2, 2, 2, 1, 3, 0, 1, 1, 1, - 1, 5, 2, 1, 1, 1, 1, 4, 1, 2, - 2, 1, 3, 3, 2, 1, 0, 5, 2, 5, - 2, 1, 3, 3, 0, 1, 1, 1, 1, 1, + 2, 2, 0, 5, 5, 2, 2, 2, 0, 3, + 3, 3, 0, 1, 2, 1, 2, 2, 2, 2, + 2, 3, 2, 2, 1, 3, 1, 1, 1, 1, + 3, 1, 2, 0, 1, 2, 0, 1, 3, 0, + 2, 0, 3, 3, 1, 5, 3, 3, 1, 3, + 1, 2, 1, 4, 5, 5, 6, 3, 7, 4, + 11, 1, 3, 2, 2, 2, 0, 3, 1, 1, + 2, 2, 2, 2, 1, 0, 1, 2, 6, 4, + 6, 4, 6, 8, 1, 1, 1, 1, 2, 1, + 2, 1, 2, 1, 1, 1, 1, 3, 3, 3, + 3, 1, 2, 2, 1, 3, 1, 1, 1, 3, + 1, 1, 0, 1, 1, 1, 9, 2, 0, 3, + 0, 1, 0, 3, 3, 2, 1, 6, 3, 3, + 2, 2, 1, 0, 5, 2, 2, 0, 7, 1, + 1, 1, 2, 5, 8, 7, 5, 8, 7, 4, + 4, 1, 3, 1, 1, 3, 1, 3, 1, 1, + 2, 4, 3, 1, 3, 2, 4, 4, 8, 11, + 9, 7, 0, 3, 3, 1, 1, 3, 0, 1, + 0, 1, 0, 1, 0, 1, 3, 2, 0, 2, + 0, 1, 0, 1, 1, 1, 3, 3, 1, 1, + 3, 3, 3, 3, 3, 3, 4, 3, 2, 1, + 1, 1, 3, 1, 3, 1, 1, 1, 3, 3, + 3, 1, 2, 4, 4, 2, 3, 5, 5, 1, + 1, 3, 0, 11, 11, 10, 12, 1, 2, 5, + 4, 4, 4, 4, 7, 5, 4, 7, 6, 9, + 9, 4, 1, 1, 1, 1, 1, 1, 1, 5, + 1, 1, 3, 1, 2, 2, 2, 3, 1, 3, + 8, 5, 0, 1, 2, 1, 3, 1, 2, 0, + 2, 0, 3, 3, 4, 4, 4, 4, 3, 2, + 1, 1, 0, 1, 1, 0, 2, 1, 5, 1, + 0, 2, 2, 0, 1, 0, 3, 5, 1, 3, + 4, 3, 1, 1, 0, 2, 2, 0, 2, 2, + 1, 1, 1, 0, 2, 4, 5, 4, 2, 3, + 1, 1, 1, 2, 2, 1, 2, 3, 0, 1, + 0, 5, 1, 4, 6, 2, 1, 0, 4, 0, + 1, 1, 3, 4, 0, 1, 1, 2, 2, 2, + 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, + 3, 3, 0, 1, 3, 1, 2, 1, 1, 1, + 1, 1, 2, 4, 4, 5, 1, 1, 2, 0, + 2, 0, 1, 3, 1, 0, 1, 2, 3, 2, + 4, 2, 3, 2, 0, 1, 2, 0, 4, 5, + 1, 2, 2, 0, 1, 3, 1, 2, 2, 4, + 4, 3, 3, 3, 3, 3, 3, 3, 1, 4, + 4, 9, 9, 3, 0, 2, 2, 0, 5, 3, + 1, 1, 3, 5, 3, 1, 2, 1, 3, 5, + 1, 2, 3, 4, 5, 4, 5, 4, 6, 5, + 4, 5, 5, 5, 2, 4, 1, 1, 0, 1, + 4, 5, 4, 0, 2, 2, 2, 1, 1, 1, + 1, 0, 4, 2, 1, 2, 2, 4, 2, 6, + 2, 1, 3, 4, 0, 2, 0, 2, 0, 1, + 3, 3, 2, 0, 2, 4, 1, 1, 1, 0, + 2, 3, 5, 6, 2, 3, 2, 5, 5, 5, + 3, 3, 3, 4, 0, 1, 1, 1, 1, 1, + 2, 4, 1, 1, 1, 1, 2, 3, 0, 1, + 1, 1, 1, 1, 2, 2, 2, 2, 2, 1, + 3, 0, 1, 1, 1, 1, 5, 2, 1, 1, + 1, 1, 4, 1, 2, 2, 1, 3, 3, 2, + 1, 0, 5, 2, 5, 2, 1, 3, 3, 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, 3, 3, 3, 3, 3, 3, - 3, 0, 1, 3, 3, 5, 2, 2, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 2, 2, 3, 3, 2, 2, 3, - 3, 5, 4, 6, 3, 5, 4, 6, 4, 6, - 5, 7, 3, 2, 4, 3, 2, 4, 3, 3, - 3, 3, 4, 3, 4, 3, 4, 5, 6, 6, - 7, 6, 7, 6, 7, 3, 4, 4, 6, 1, - 4, 4, 5, 4, 6, 1, 3, 2, 2, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 2, 2, 5, 6, 6, 7, - 1, 2, 1, 1, 1, 2, 2, 4, 3, 1, - 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, - 1, 2, 4, 2, 3, 3, 4, 3, 5, 6, - 7, 9, 7, 7, 5, 1, 1, 1, 5, 6, - 6, 4, 4, 4, 4, 6, 5, 5, 5, 4, - 6, 4, 7, 9, 5, 0, 5, 4, 0, 1, - 0, 2, 0, 1, 3, 3, 2, 2, 0, 6, - 1, 0, 3, 0, 3, 3, 3, 0, 1, 4, - 2, 2, 2, 2, 2, 3, 2, 2, 3, 0, - 4, 3, 1, 5, 3, 1, 3, 1, 2, 3, - 1, 3, 1, 2, 1, 0, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, + 3, 3, 3, 3, 3, 3, 0, 1, 3, 3, + 5, 2, 2, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, + 3, 3, 2, 2, 3, 3, 5, 4, 6, 3, + 5, 4, 6, 4, 6, 5, 7, 3, 2, 4, + 3, 2, 4, 3, 3, 3, 3, 4, 3, 4, + 3, 4, 5, 6, 6, 7, 6, 7, 6, 7, + 3, 4, 4, 6, 1, 4, 4, 5, 4, 6, + 1, 3, 2, 2, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, + 2, 5, 6, 6, 7, 1, 2, 1, 1, 1, + 2, 2, 4, 3, 1, 1, 1, 1, 2, 1, + 1, 1, 1, 1, 1, 1, 2, 4, 2, 3, + 3, 4, 3, 5, 6, 7, 9, 7, 7, 5, + 1, 1, 1, 5, 6, 6, 4, 4, 4, 4, + 6, 5, 5, 5, 4, 6, 4, 7, 9, 5, + 0, 5, 4, 0, 1, 0, 2, 0, 1, 3, + 3, 2, 2, 0, 6, 1, 0, 3, 0, 3, + 3, 3, 0, 1, 4, 2, 2, 2, 2, 2, + 3, 2, 2, 3, 0, 4, 3, 1, 5, 3, + 1, 3, 1, 2, 3, 1, 3, 1, 2, 1, + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 4, 1, 4, 1, 4, 1, 2, 1, 2, + 1, 2, 1, 3, 1, 3, 1, 2, 1, 3, + 1, 2, 1, 0, 1, 3, 1, 3, 3, 1, + 3, 3, 0, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 4, 3, + 2, 3, 0, 3, 3, 2, 2, 1, 0, 2, + 2, 3, 2, 1, 1, 3, 1, 1, 5, 1, + 2, 4, 2, 0, 1, 0, 1, 1, 2, 3, + 5, 7, 7, 1, 0, 0, 2, 0, 2, 3, + 3, 3, 5, 7, 7, 0, 2, 1, 0, 1, + 0, 1, 3, 1, 2, 3, 2, 1, 3, 4, + 2, 1, 3, 1, 3, 1, 2, 1, 0, 3, + 1, 3, 1, 2, 4, 2, 0, 3, 1, 3, + 1, 2, 4, 2, 0, 1, 3, 1, 3, 1, + 2, 1, 3, 1, 1, 2, 1, 1, 2, 1, + 1, 2, 7, 2, 5, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 4, 1, 4, 1, - 4, 1, 2, 1, 2, 1, 2, 1, 3, 1, - 3, 1, 2, 1, 3, 1, 2, 1, 0, 1, - 3, 1, 3, 3, 1, 3, 3, 0, 1, 1, + 1, 2, 2, 3, 3, 0, 1, 1, 1, 5, + 3, 0, 1, 1, 1, 1, 1, 1, 4, 7, + 6, 2, 0, 1, 1, 1, 1, 13, 16, 1, + 2, 0, 1, 0, 1, 0, 2, 0, 1, 0, + 6, 8, 6, 8, 6, 8, 3, 2, 1, 0, + 6, 6, 1, 1, 1, 1, 1, 1, 2, 1, + 1, 1, 1, 1, 4, 6, 3, 2, 4, 3, + 5, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 4, 3, 2, 3, 0, 3, 3, - 2, 2, 1, 0, 2, 2, 3, 2, 1, 1, - 3, 1, 1, 5, 1, 2, 4, 2, 0, 1, - 0, 1, 1, 2, 3, 5, 7, 7, 1, 0, - 0, 2, 0, 2, 3, 3, 3, 5, 7, 7, - 0, 2, 1, 0, 1, 0, 1, 3, 1, 2, - 3, 2, 1, 3, 4, 2, 1, 3, 1, 3, - 1, 2, 1, 0, 3, 1, 3, 1, 2, 4, - 2, 0, 3, 1, 3, 1, 2, 4, 2, 0, - 1, 3, 1, 3, 1, 2, 1, 3, 1, 1, - 2, 1, 1, 2, 1, 1, 2, 7, 2, 5, - 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 2, 2, 3, 3, - 0, 1, 1, 1, 5, 3, 0, 1, 1, 1, - 1, 1, 1, 4, 7, 6, 2, 0, 1, 1, - 1, 1, 13, 16, 1, 2, 0, 1, 0, 1, - 0, 2, 0, 1, 0, 6, 8, 6, 8, 6, - 8, 3, 2, 1, 0, 6, 6, 1, 1, 1, - 1, 1, 1, 2, 1, 1, 1, 1, 1, 4, - 6, 3, 2, 4, 3, 5, 1, 0, 1, 1, - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, - 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, - 3, 3, 3, 3, 1, 3, 3, 2, 3, 3, - 1, 1, 1, 3, 5, 1, 1, 1, 1, 3, - 2, 4, 6, 6, 0, 1, 1, 1, 0, 2, - 2, 4, 6, 5, 4, 6, 1, 1, 1, 1, - 1, 1, 0, 1, 3, 1, 0, 7, 3, 1, - 2, 3, 2, 0, 2, 0, 2, 4, 5, 8, - 7, 2, 3, 5, 1, 0, 2, 0, 1, 0, - 2, 1, 3, 3, 0, 2, 3, 3, 3, 3, - 1, 1, 1, 2, 3, 2, 2, 2, 4, 2, - 3, 4, 3, 1, 1, 1, 1, 1, 1, 0, - 1, 3, 2, 9, 12, 11, 12, 14, 3, 4, - 4, 0, 7, 10, 9, 2, 3, 0, 4, 1, + 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, + 1, 2, 1, 1, 2, 3, 3, 3, 3, 1, + 3, 3, 2, 3, 3, 1, 1, 1, 3, 5, + 1, 1, 1, 1, 3, 2, 4, 6, 6, 0, + 1, 1, 1, 0, 2, 2, 4, 6, 5, 4, + 6, 1, 1, 1, 1, 1, 1, 0, 1, 3, + 1, 0, 7, 3, 1, 2, 3, 2, 0, 2, + 0, 2, 4, 5, 8, 7, 2, 3, 5, 1, + 0, 2, 0, 1, 0, 2, 1, 3, 3, 0, + 2, 3, 3, 3, 3, 1, 1, 1, 2, 3, + 2, 2, 2, 4, 2, 3, 4, 3, 1, 1, + 1, 1, 1, 1, 0, 1, 3, 2, 9, 12, + 11, 12, 14, 3, 4, 4, 0, 7, 10, 9, + 2, 3, 0, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -3659,7 +3668,7 @@ static const yytype_uint8 yyr2[] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1 + 1, 1, 1 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -3667,2106 +3676,1937 @@ static const yytype_uint8 yyr2[] = means the default is an error. */ static const yytype_uint16 yydefact[] = { - 169, 287, 0, 1491, 1490, 1565, 287, 0, 1424, 0, - 287, 547, 430, 0, 1595, 1594, 0, 224, 287, 0, - 169, 0, 1525, 0, 0, 0, 609, 612, 610, 0, - 0, 0, 287, 655, 0, 1596, 287, 0, 0, 647, - 611, 0, 1542, 0, 0, 0, 0, 0, 2, 4, + 169, 287, 0, 1496, 1495, 1570, 287, 0, 1429, 0, + 287, 552, 435, 0, 1600, 1599, 0, 224, 287, 0, + 169, 0, 1530, 0, 0, 0, 614, 617, 615, 0, + 0, 0, 287, 660, 0, 1601, 287, 0, 0, 652, + 616, 0, 1547, 0, 0, 0, 0, 0, 2, 4, 8, 22, 37, 32, 0, 21, 35, 19, 18, 40, 27, 7, 5, 25, 39, 42, 20, 26, 34, 16, - 41, 14, 38, 585, 571, 660, 584, 0, 0, 168, - 765, 592, 36, 17, 31, 6, 12, 13, 29, 30, - 28, 1447, 45, 33, 0, 43, 23, 9, 10, 24, - 44, 46, 1597, 1593, 11, 47, 15, 286, 285, 279, - 0, 0, 0, 0, 0, 0, 1564, 0, 0, 0, - 290, 125, 1619, 1620, 1621, 1622, 1623, 1624, 1625, 1626, - 1627, 1628, 1629, 2003, 1630, 1631, 2004, 1632, 1633, 2005, - 1634, 1635, 1636, 1949, 1950, 2006, 1951, 1952, 1637, 1638, - 1639, 1640, 1641, 1642, 1643, 1644, 1645, 1953, 1954, 1646, - 1647, 1648, 1649, 1650, 1955, 2007, 1956, 1651, 1652, 1653, - 1654, 1655, 2008, 1656, 1657, 1658, 1659, 1660, 1661, 1662, - 1663, 1664, 2009, 1665, 1666, 1667, 1668, 1669, 1670, 1671, - 1672, 1673, 1674, 1957, 1675, 1676, 1958, 1677, 1678, 1679, - 1680, 1681, 1682, 1683, 1684, 1685, 1686, 1687, 1688, 1689, - 1690, 1691, 1692, 1693, 1694, 1695, 1696, 1697, 1698, 1699, - 1700, 1701, 1702, 1703, 1704, 1959, 1705, 1706, 1707, 1708, - 1709, 1710, 1960, 1711, 1712, 1713, 1961, 1714, 1715, 1716, - 2010, 2011, 1717, 1718, 1962, 2013, 1719, 1720, 1721, 1963, - 1964, 1722, 1723, 1724, 1725, 1726, 1727, 1728, 1729, 1730, - 2014, 1731, 1732, 1733, 1734, 1735, 1736, 1737, 1738, 1739, - 1740, 1741, 1742, 2015, 1965, 1743, 1744, 1745, 1746, 1747, - 1966, 1967, 1968, 1748, 2016, 2017, 1749, 2018, 1750, 1751, - 1752, 1753, 1754, 1755, 1756, 2019, 1757, 2020, 1758, 1759, - 1760, 1761, 1762, 1763, 1764, 1765, 1969, 1766, 1767, 1768, - 1769, 1770, 1771, 1772, 1773, 1774, 1775, 1776, 1777, 1778, - 1779, 1780, 1781, 1782, 1783, 1784, 1785, 1786, 1787, 1970, - 2022, 1971, 1788, 1789, 1790, 1972, 1791, 1792, 2023, 1793, - 1973, 1794, 1974, 1795, 1796, 1797, 1798, 1799, 1800, 1801, - 1802, 1803, 1804, 1975, 2024, 1805, 2025, 1976, 1806, 1807, - 1808, 1809, 1810, 1811, 1812, 1813, 1814, 1815, 1816, 1817, - 1818, 1819, 1977, 2026, 1820, 1821, 1978, 1822, 1823, 1824, - 1825, 1826, 1827, 1828, 1829, 1830, 1831, 1832, 1833, 1834, - 1835, 1979, 1836, 1837, 1838, 1839, 1840, 1841, 1842, 1843, - 1844, 1845, 1846, 1847, 1848, 1849, 1850, 1851, 1852, 1853, - 1854, 2027, 1855, 1856, 1857, 1980, 1858, 1859, 1860, 1861, - 1862, 1863, 1864, 1865, 1866, 1867, 1868, 1869, 1870, 1871, - 1872, 1873, 1874, 1875, 1876, 1981, 1877, 1878, 2028, 1879, - 1880, 1982, 1881, 1882, 1883, 1884, 1885, 1886, 1887, 1888, - 1889, 1890, 1891, 1892, 1893, 1894, 1895, 1983, 1896, 1984, - 1897, 1898, 1899, 2030, 1900, 1901, 1902, 1903, 1904, 1905, - 1906, 1985, 1986, 1907, 1908, 1987, 1909, 1988, 1910, 1911, - 1989, 1912, 1913, 1914, 1915, 1916, 1917, 1918, 1919, 1920, - 1921, 1922, 1923, 1924, 1925, 1926, 1927, 1928, 1990, 1991, - 1929, 1930, 2031, 1931, 1932, 1933, 1934, 1935, 1936, 1937, - 1938, 1939, 1940, 1941, 1942, 1943, 1944, 1992, 1993, 1994, - 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 1945, 1946, - 1947, 1948, 0, 1602, 0, 1349, 126, 127, 1371, 125, - 1962, 1969, 1983, 1423, 1422, 126, 0, 282, 546, 0, - 0, 0, 0, 0, 0, 226, 0, 424, 423, 1413, - 429, 0, 0, 0, 129, 121, 1822, 128, 1348, 119, - 135, 2183, 2184, 2185, 2186, 2064, 2187, 2188, 2189, 2190, - 2065, 2191, 2066, 2067, 2068, 2069, 2070, 2071, 2072, 2192, - 2073, 2193, 2194, 2075, 2074, 2195, 2076, 2196, 2077, 2197, - 2078, 2079, 2198, 2199, 2080, 1671, 2081, 2082, 2200, 2201, - 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2083, 2084, 2209, - 2210, 2085, 2211, 2212, 2086, 2213, 2087, 2088, 2089, 2214, - 2090, 2091, 2215, 2092, 2216, 2217, 2093, 2094, 2097, 2095, - 2218, 2096, 2219, 2098, 2099, 2100, 2220, 2221, 2222, 2101, - 2102, 2223, 2103, 2104, 2105, 2106, 2107, 2224, 2108, 2225, - 2109, 2110, 2226, 2227, 2228, 2229, 2230, 2112, 2111, 2113, - 2114, 2231, 2232, 2233, 2234, 2115, 2116, 2117, 2235, 2236, - 2118, 2237, 2238, 2119, 2120, 2239, 2121, 2122, 2240, 2123, - 2124, 2241, 2125, 2126, 2242, 2243, 2244, 2127, 2245, 2128, - 2129, 2246, 2247, 2130, 2131, 2248, 2132, 2249, 2250, 2133, - 2251, 2252, 2134, 2135, 2253, 2136, 2254, 2255, 2256, 2257, - 2137, 2138, 2139, 2140, 2141, 2142, 2143, 2144, 2145, 2146, - 2147, 1561, 137, 136, 138, 0, 448, 449, 0, 459, - 0, 441, 446, 442, 0, 468, 461, 469, 450, 440, - 462, 451, 439, 225, 0, 470, 456, 444, 0, 0, - 0, 0, 283, 242, 0, 430, 0, 169, 0, 1453, - 1463, 1473, 1468, 1462, 1471, 1460, 1477, 1466, 1452, 1475, - 1461, 1465, 1470, 1458, 1476, 1456, 1474, 1472, 1459, 1467, - 1451, 1455, 1442, 1447, 1480, 1469, 1478, 1464, 1479, 1481, - 1454, 1482, 1457, 0, 1424, 0, 1955, 2007, 1960, 0, - 1973, 0, 1976, 1977, 1858, 1984, 1987, 1988, 1989, 1990, - 0, 839, 128, 123, 823, 0, 587, 0, 769, 783, - 823, 828, 1116, 851, 1117, 0, 130, 1527, 1526, 1520, - 211, 1386, 1581, 1719, 1760, 1875, 1985, 1907, 1929, 1600, - 1582, 1575, 1580, 284, 654, 652, 0, 1305, 1719, 1760, - 1862, 1875, 1985, 1929, 1499, 1504, 0, 290, 1587, 128, - 123, 1586, 0, 593, 646, 0, 291, 1541, 0, 1546, - 0, 1838, 620, 623, 1380, 621, 585, 0, 0, 1, - 169, 0, 175, 0, 0, 650, 650, 0, 650, 0, - 577, 0, 0, 585, 580, 584, 766, 1446, 1556, 0, - 1599, 1899, 1985, 1907, 1589, 1585, 1729, 0, 1729, 0, - 0, 1729, 0, 1729, 0, 1729, 0, 0, 1565, 1567, - 0, 280, 1289, 0, 1350, 131, 0, 0, 1435, 1431, - 1436, 1432, 1437, 1430, 1429, 1438, 1434, 0, 0, 0, - 395, 428, 427, 426, 425, 430, 1729, 1397, 222, 513, - 514, 0, 0, 0, 0, 0, 0, 1408, 122, 120, - 1729, 1562, 457, 458, 0, 447, 443, 445, 0, 0, - 1729, 1375, 467, 463, 1729, 467, 1342, 1729, 0, 0, - 234, 0, 423, 1444, 1483, 2134, 1497, 0, 1498, 1488, - 1450, 1484, 1485, 169, 0, 545, 1421, 0, 0, 0, - 1237, 823, 828, 0, 0, 841, 0, 1257, 0, 1263, - 0, 0, 0, 823, 592, 0, 783, 840, 124, 773, - 0, 821, 822, 702, 702, 655, 0, 636, 0, 702, - 709, 702, 833, 0, 0, 836, 834, 0, 836, 0, - 0, 0, 836, 832, 792, 0, 709, 0, 821, 824, - 702, 0, 843, 1441, 0, 0, 0, 0, 1578, 1576, - 1577, 1583, 0, 1579, 0, 0, 1352, 1354, 1355, 1205, - 1365, 1092, 0, 1950, 1951, 1952, 1280, 1953, 1954, 1956, - 1957, 1958, 1049, 1691, 1959, 1363, 1961, 1963, 1964, 1966, - 1967, 1968, 0, 1969, 1970, 1971, 0, 1364, 1974, 1800, - 1979, 1980, 1982, 1985, 1986, 1362, 0, 1991, 0, 0, - 0, 1323, 1228, 0, 1091, 0, 0, 0, 1282, 1290, - 1084, 0, 0, 887, 888, 909, 910, 889, 915, 916, - 918, 890, 0, 1312, 982, 1080, 1300, 1094, 1089, 1099, - 1095, 1096, 1135, 1097, 1115, 1100, 1172, 1090, 0, 1098, - 1082, 1308, 636, 1306, 0, 1083, 1351, 636, 1304, 1502, - 1500, 1507, 1501, 0, 1503, 0, 0, 0, 281, 124, - 1549, 1548, 1540, 1538, 1539, 1537, 1536, 1543, 0, 1545, - 1447, 1282, 1223, 1225, 0, 622, 0, 0, 627, 574, - 573, 575, 3, 0, 0, 0, 0, 1709, 0, 648, - 649, 0, 0, 0, 0, 0, 0, 0, 0, 750, - 675, 676, 678, 747, 751, 759, 0, 0, 0, 0, - 0, 581, 0, 1380, 1528, 1598, 1592, 0, 1590, 0, + 41, 14, 38, 590, 576, 665, 589, 0, 0, 168, + 770, 597, 36, 17, 31, 6, 12, 13, 29, 30, + 28, 1452, 45, 33, 0, 43, 23, 9, 10, 24, + 44, 46, 1602, 1598, 11, 47, 15, 286, 285, 279, + 0, 0, 0, 0, 0, 0, 1569, 0, 0, 0, + 290, 125, 1624, 1625, 1626, 1627, 1628, 1629, 1630, 1631, + 1632, 1633, 1634, 2008, 1635, 1636, 2009, 1637, 1638, 2010, + 1639, 1640, 1641, 1954, 1955, 2011, 1956, 1957, 1642, 1643, + 1644, 1645, 1646, 1647, 1648, 1649, 1650, 1958, 1959, 1651, + 1652, 1653, 1654, 1655, 1960, 2012, 1961, 1656, 1657, 1658, + 1659, 1660, 2013, 1661, 1662, 1663, 1664, 1665, 1666, 1667, + 1668, 1669, 2014, 1670, 1671, 1672, 1673, 1674, 1675, 1676, + 1677, 1678, 1679, 1962, 1680, 1681, 1963, 1682, 1683, 1684, + 1685, 1686, 1687, 1688, 1689, 1690, 1691, 1692, 1693, 1694, + 1695, 1696, 1697, 1698, 1699, 1700, 1701, 1702, 1703, 1704, + 1705, 1706, 1707, 1708, 1709, 1964, 1710, 1711, 1712, 1713, + 1714, 1715, 1965, 1716, 1717, 1718, 1966, 1719, 1720, 1721, + 2015, 2016, 1722, 1723, 1967, 2018, 1724, 1725, 1726, 1968, + 1969, 1727, 1728, 1729, 1730, 1731, 1732, 1733, 1734, 1735, + 2019, 1736, 1737, 1738, 1739, 1740, 1741, 1742, 1743, 1744, + 1745, 1746, 1747, 2020, 1970, 1748, 1749, 1750, 1751, 1752, + 1971, 1972, 1973, 1753, 2021, 2022, 1754, 2023, 1755, 1756, + 1757, 1758, 1759, 1760, 1761, 2024, 1762, 2025, 1763, 1764, + 1765, 1766, 1767, 1768, 1769, 1770, 1974, 1771, 1772, 1773, + 1774, 1775, 1776, 1777, 1778, 1779, 1780, 1781, 1782, 1783, + 1784, 1785, 1786, 1787, 1788, 1789, 1790, 1791, 1792, 1975, + 2027, 1976, 1793, 1794, 1795, 1977, 1796, 1797, 2028, 1798, + 1978, 1799, 1979, 1800, 1801, 1802, 1803, 1804, 1805, 1806, + 1807, 1808, 1809, 1980, 2029, 1810, 2030, 1981, 1811, 1812, + 1813, 1814, 1815, 1816, 1817, 1818, 1819, 1820, 1821, 1822, + 1823, 1824, 1982, 2031, 1825, 1826, 1983, 1827, 1828, 1829, + 1830, 1831, 1832, 1833, 1834, 1835, 1836, 1837, 1838, 1839, + 1840, 1984, 1841, 1842, 1843, 1844, 1845, 1846, 1847, 1848, + 1849, 1850, 1851, 1852, 1853, 1854, 1855, 1856, 1857, 1858, + 1859, 2032, 1860, 1861, 1862, 1985, 1863, 1864, 1865, 1866, + 1867, 1868, 1869, 1870, 1871, 1872, 1873, 1874, 1875, 1876, + 1877, 1878, 1879, 1880, 1881, 1986, 1882, 1883, 2033, 1884, + 1885, 1987, 1886, 1887, 1888, 1889, 1890, 1891, 1892, 1893, + 1894, 1895, 1896, 1897, 1898, 1899, 1900, 1988, 1901, 1989, + 1902, 1903, 1904, 2035, 1905, 1906, 1907, 1908, 1909, 1910, + 1911, 1990, 1991, 1912, 1913, 1992, 1914, 1993, 1915, 1916, + 1994, 1917, 1918, 1919, 1920, 1921, 1922, 1923, 1924, 1925, + 1926, 1927, 1928, 1929, 1930, 1931, 1932, 1933, 1995, 1996, + 1934, 1935, 2036, 1936, 1937, 1938, 1939, 1940, 1941, 1942, + 1943, 1944, 1945, 1946, 1947, 1948, 1949, 1997, 1998, 1999, + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 1950, 1951, + 1952, 1953, 0, 1607, 0, 1354, 126, 127, 1376, 125, + 1967, 1974, 1988, 1428, 1427, 126, 0, 282, 551, 0, + 0, 0, 0, 0, 0, 226, 0, 429, 428, 1418, + 434, 0, 0, 0, 129, 121, 1827, 128, 1353, 119, + 135, 2188, 2189, 2190, 2191, 2069, 2192, 2193, 2194, 2195, + 2070, 2196, 2071, 2072, 2073, 2074, 2075, 2076, 2077, 2197, + 2078, 2198, 2199, 2080, 2079, 2200, 2081, 2201, 2082, 2202, + 2083, 2084, 2203, 2204, 2085, 1676, 2086, 2087, 2205, 2206, + 2207, 2208, 2209, 2210, 2211, 2212, 2213, 2088, 2089, 2214, + 2215, 2090, 2216, 2217, 2091, 2218, 2092, 2093, 2094, 2219, + 2095, 2096, 2220, 2097, 2221, 2222, 2098, 2099, 2102, 2100, + 2223, 2101, 2224, 2103, 2104, 2105, 2225, 2226, 2227, 2106, + 2107, 2228, 2108, 2109, 2110, 2111, 2112, 2229, 2113, 2230, + 2114, 2115, 2231, 2232, 2233, 2234, 2235, 2117, 2116, 2118, + 2119, 2236, 2237, 2238, 2239, 2120, 2121, 2122, 2240, 2241, + 2123, 2242, 2243, 2124, 2125, 2244, 2126, 2127, 2245, 2128, + 2129, 2246, 2130, 2131, 2247, 2248, 2249, 2132, 2250, 2133, + 2134, 2251, 2252, 2135, 2136, 2253, 2137, 2254, 2255, 2138, + 2256, 2257, 2139, 2140, 2258, 2141, 2259, 2260, 2261, 2262, + 2142, 2143, 2144, 2145, 2146, 2147, 2148, 2149, 2150, 2151, + 2152, 1566, 137, 136, 138, 0, 453, 454, 0, 464, + 0, 446, 451, 447, 0, 473, 466, 474, 455, 445, + 467, 456, 444, 225, 0, 475, 461, 449, 0, 0, + 0, 0, 283, 242, 0, 435, 0, 169, 0, 1458, + 1468, 1478, 1473, 1467, 1476, 1465, 1482, 1471, 1457, 1480, + 1466, 1470, 1475, 1463, 1481, 1461, 1479, 1477, 1464, 1472, + 1456, 1460, 1447, 1452, 1485, 1474, 1483, 1469, 1484, 1486, + 1459, 1487, 1462, 0, 1429, 0, 1960, 2012, 1965, 0, + 1978, 0, 1981, 1982, 1863, 1989, 1992, 1993, 1994, 1995, + 0, 844, 128, 123, 828, 0, 592, 0, 774, 788, + 828, 833, 1121, 856, 1122, 0, 130, 1532, 1531, 1525, + 211, 1391, 1586, 1724, 1765, 1880, 1990, 1912, 1934, 1605, + 1587, 1580, 1585, 284, 659, 657, 0, 1310, 1724, 1765, + 1867, 1880, 1990, 1934, 1504, 1509, 0, 290, 1592, 128, + 123, 1591, 0, 598, 651, 0, 291, 1546, 0, 1551, + 0, 1843, 625, 628, 1385, 626, 590, 0, 0, 1, + 169, 0, 175, 0, 0, 655, 655, 0, 655, 0, + 582, 0, 0, 590, 585, 589, 771, 1451, 1561, 0, + 1604, 1904, 1990, 1912, 1594, 1590, 1734, 0, 1734, 0, + 0, 1734, 0, 1734, 0, 1734, 0, 0, 1570, 1572, + 0, 280, 1294, 0, 1355, 131, 0, 0, 1440, 1436, + 1441, 1437, 1442, 1435, 1434, 1443, 1439, 0, 0, 0, + 399, 433, 432, 431, 430, 435, 1734, 1402, 222, 518, + 519, 0, 0, 0, 0, 0, 0, 1413, 122, 120, + 1734, 1567, 462, 463, 0, 452, 448, 450, 0, 0, + 1734, 1380, 472, 468, 1734, 472, 1347, 1734, 0, 0, + 234, 0, 428, 1449, 1488, 2139, 1502, 0, 1503, 1493, + 1455, 1489, 1490, 169, 0, 550, 1426, 0, 0, 0, + 1242, 828, 833, 0, 0, 846, 0, 1262, 0, 1268, + 0, 0, 0, 828, 597, 0, 788, 845, 124, 778, + 0, 826, 827, 707, 707, 660, 0, 641, 0, 707, + 714, 707, 838, 0, 0, 841, 839, 0, 841, 0, + 0, 0, 841, 837, 797, 0, 714, 0, 826, 829, + 707, 0, 848, 1446, 0, 0, 0, 0, 1583, 1581, + 1582, 1588, 0, 1584, 0, 0, 1357, 1359, 1360, 1210, + 1370, 1097, 0, 1955, 1956, 1957, 1285, 1958, 1959, 1961, + 1962, 1963, 1054, 1696, 1964, 1368, 1966, 1968, 1969, 1971, + 1972, 1973, 0, 1974, 1975, 1976, 0, 1369, 1979, 1805, + 1984, 1985, 1987, 1990, 1991, 1367, 0, 1996, 0, 0, + 0, 1328, 1233, 0, 1096, 0, 0, 0, 1287, 1295, + 1089, 0, 0, 892, 893, 914, 915, 894, 920, 921, + 923, 895, 0, 1317, 987, 1085, 1305, 1099, 1094, 1104, + 1100, 1101, 1140, 1102, 1120, 1105, 1177, 1095, 0, 1103, + 1087, 1313, 641, 1311, 0, 1088, 1356, 641, 1309, 1507, + 1505, 1512, 1506, 0, 1508, 0, 0, 0, 281, 124, + 1554, 1553, 1545, 1543, 1544, 1542, 1541, 1548, 0, 1550, + 1452, 1287, 1228, 1230, 0, 627, 0, 0, 632, 579, + 578, 580, 3, 0, 0, 0, 0, 1714, 0, 653, + 654, 0, 0, 0, 0, 0, 0, 0, 0, 755, + 680, 681, 683, 752, 756, 764, 0, 0, 0, 0, + 0, 586, 0, 1385, 1533, 1603, 1597, 0, 1595, 0, 0, 0, 0, 0, 153, 153, 0, 0, 0, 0, 0, 113, 51, 106, 0, 0, 0, 0, 256, 269, 0, 0, 0, 0, 0, 266, 0, 0, 249, 53, 243, 245, 0, 153, 0, 49, 0, 0, 0, 55, - 1565, 0, 0, 1574, 288, 289, 1288, 0, 133, 134, - 132, 125, 0, 2148, 2003, 2004, 2005, 2006, 2153, 2007, - 1956, 2008, 2009, 0, 2010, 2011, 1962, 2013, 2014, 2015, - 2016, 2017, 2018, 2019, 2020, 1969, 2022, 2023, 2024, 2025, - 2026, 2027, 2176, 2028, 1983, 2030, 1989, 2181, 0, 2031, - 1107, 658, 1231, 660, 1229, 1381, 0, 126, 1368, 0, - 1433, 0, 0, 0, 0, 543, 0, 0, 0, 0, - 1393, 1729, 223, 227, 0, 1729, 218, 1729, 395, 0, - 1729, 0, 1729, 395, 1729, 0, 1407, 1410, 0, 460, - 455, 453, 452, 454, 1729, 277, 0, 0, 1376, 465, - 466, 0, 434, 0, 0, 436, 0, 0, 239, 0, - 237, 0, 430, 169, 0, 250, 1493, 1494, 1492, 0, - 0, 1487, 1449, 253, 270, 1496, 1486, 1495, 1448, 1443, - 0, 0, 1439, 540, 0, 0, 0, 1238, 958, 957, - 939, 940, 955, 956, 941, 942, 949, 950, 960, 959, - 947, 948, 943, 944, 937, 938, 953, 954, 945, 946, - 951, 952, 935, 936, 1252, 1239, 1240, 1241, 1242, 1243, - 1244, 1245, 1246, 1247, 1248, 1249, 1250, 1251, 0, 0, - 782, 779, 0, 0, 0, 0, 0, 0, 1282, 0, - 1055, 1090, 0, 0, 0, 1223, 1262, 0, 0, 0, - 0, 0, 0, 1223, 1268, 0, 0, 807, 819, 0, - 695, 701, 780, 778, 0, 1305, 770, 0, 853, 783, - 781, 0, 702, 777, 0, 833, 0, 832, 0, 0, - 835, 829, 0, 830, 0, 0, 0, 0, 831, 0, - 0, 0, 0, 0, 702, 0, 819, 0, 776, 850, - 1510, 1518, 212, 0, 1372, 2032, 2033, 2034, 2035, 897, - 2036, 926, 904, 2037, 926, 926, 2038, 2039, 2040, 2041, - 893, 893, 906, 2042, 2043, 2044, 2045, 2046, 894, 895, - 931, 2047, 2048, 2049, 2050, 2051, 0, 0, 2052, 926, - 2053, 893, 2054, 2055, 2056, 898, 2057, 861, 2058, 0, - 2059, 896, 862, 2060, 934, 934, 2061, 0, 2062, 921, - 2063, 0, 1234, 879, 879, 880, 881, 882, 907, 908, - 883, 913, 914, 884, 981, 0, 893, 1373, 1374, 169, - 1584, 1601, 0, 1228, 1101, 925, 912, 1279, 0, 920, - 919, 0, 1228, 902, 901, 900, 1086, 0, 899, 0, - 1185, 926, 926, 924, 1007, 903, 0, 0, 0, 0, - 0, 930, 0, 928, 0, 1008, 986, 987, 0, 0, - 1322, 1331, 1223, 1227, 0, 1084, 1223, 0, 1093, 1103, - 0, 1175, 1177, 0, 0, 0, 1283, 1353, 1085, 0, - 1358, 0, 0, 981, 981, 1311, 1205, 0, 1195, 1198, - 0, 0, 1202, 1203, 1204, 0, 0, 0, 1303, 0, - 1213, 1215, 0, 0, 1023, 1211, 0, 1026, 0, 0, - 0, 0, 1199, 1200, 1201, 1191, 1192, 1193, 1194, 1196, - 1197, 1209, 1190, 1004, 0, 1081, 0, 1138, 0, 1003, - 1309, 768, 0, 1356, 768, 1512, 1516, 1517, 1511, 1515, - 0, 1506, 1505, 1508, 1509, 0, 1550, 1534, 0, 1531, - 1226, 763, 624, 1344, 0, 0, 0, 1555, 174, 173, - 0, 0, 233, 0, 597, 596, 669, 661, 663, 669, - 0, 595, 0, 723, 724, 0, 0, 0, 0, 756, - 754, 1352, 1365, 711, 679, 710, 0, 0, 683, 0, - 715, 982, 749, 579, 673, 674, 677, 578, 0, 752, - 0, 762, 0, 616, 618, 601, 615, 613, 598, 606, - 750, 678, 0, 1557, 0, 0, 1521, 1588, 1591, 0, - 0, 0, 0, 0, 0, 0, 1729, 0, 0, 864, + 1570, 0, 0, 1579, 288, 289, 1293, 0, 133, 134, + 132, 125, 0, 2153, 2008, 2009, 2010, 2011, 2158, 2012, + 1961, 2013, 2014, 0, 2015, 2016, 1967, 2018, 2019, 2020, + 2021, 2022, 2023, 2024, 2025, 1974, 2027, 2028, 2029, 2030, + 2031, 2032, 2181, 2033, 1988, 2035, 1994, 2186, 0, 2036, + 1112, 663, 1236, 665, 1234, 1386, 0, 126, 1373, 0, + 1438, 0, 0, 0, 0, 548, 0, 0, 0, 0, + 1398, 1734, 223, 227, 0, 1734, 218, 1734, 399, 0, + 1734, 0, 1734, 399, 1734, 0, 1412, 1415, 0, 465, + 460, 458, 457, 459, 1734, 277, 0, 0, 1381, 470, + 471, 0, 439, 0, 0, 441, 0, 0, 239, 0, + 237, 0, 435, 169, 0, 250, 1498, 1499, 1497, 0, + 0, 1492, 1454, 253, 270, 1501, 1491, 1500, 1453, 1448, + 0, 0, 1444, 545, 0, 0, 0, 1243, 963, 962, + 944, 945, 960, 961, 946, 947, 954, 955, 965, 964, + 952, 953, 948, 949, 942, 943, 958, 959, 950, 951, + 956, 957, 940, 941, 1257, 1244, 1245, 1246, 1247, 1248, + 1249, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 0, 0, + 787, 784, 0, 0, 0, 0, 0, 0, 1287, 0, + 1060, 1095, 0, 0, 0, 1228, 1267, 0, 0, 0, + 0, 0, 0, 1228, 1273, 0, 0, 812, 824, 0, + 700, 706, 785, 783, 0, 1310, 775, 0, 858, 788, + 786, 0, 707, 782, 0, 838, 0, 837, 0, 0, + 840, 834, 0, 835, 0, 0, 0, 0, 836, 0, + 0, 0, 0, 0, 707, 0, 824, 0, 781, 855, + 1515, 1523, 212, 0, 1377, 2037, 2038, 2039, 2040, 902, + 2041, 931, 909, 2042, 931, 931, 2043, 2044, 2045, 2046, + 898, 898, 911, 2047, 2048, 2049, 2050, 2051, 899, 900, + 936, 2052, 2053, 2054, 2055, 2056, 0, 0, 2057, 931, + 2058, 898, 2059, 2060, 2061, 903, 2062, 866, 2063, 0, + 2064, 901, 867, 2065, 939, 939, 2066, 0, 2067, 926, + 2068, 0, 1239, 884, 884, 885, 886, 887, 912, 913, + 888, 918, 919, 889, 986, 0, 898, 1378, 1379, 169, + 1589, 1606, 0, 1233, 1106, 930, 917, 1284, 0, 925, + 924, 0, 1233, 907, 906, 905, 1091, 0, 904, 0, + 1190, 931, 931, 929, 1012, 908, 0, 0, 0, 0, + 0, 935, 0, 933, 0, 1013, 991, 992, 0, 0, + 1327, 1336, 1228, 1232, 0, 1089, 1228, 0, 1098, 1108, + 0, 1180, 1182, 0, 0, 0, 1288, 1358, 1090, 0, + 1363, 0, 0, 986, 986, 1316, 1210, 0, 1200, 1203, + 0, 0, 1207, 1208, 1209, 0, 0, 0, 1308, 0, + 1218, 1220, 0, 0, 1028, 1216, 0, 1031, 0, 0, + 0, 0, 1204, 1205, 1206, 1196, 1197, 1198, 1199, 1201, + 1202, 1214, 1195, 1009, 0, 1086, 0, 1143, 0, 1008, + 1314, 773, 0, 1361, 773, 1517, 1521, 1522, 1516, 1520, + 0, 1511, 1510, 1513, 1514, 0, 1555, 1539, 0, 1536, + 1231, 768, 629, 1349, 0, 0, 0, 1560, 174, 173, + 0, 0, 233, 0, 602, 601, 674, 666, 668, 674, + 0, 600, 0, 728, 729, 0, 0, 0, 0, 761, + 759, 1357, 1370, 716, 684, 715, 0, 0, 688, 0, + 720, 987, 754, 584, 678, 679, 682, 583, 0, 757, + 0, 767, 0, 621, 623, 606, 620, 618, 603, 611, + 755, 683, 0, 1562, 0, 0, 1526, 1593, 1596, 0, + 0, 0, 0, 0, 0, 0, 1734, 0, 0, 869, 74, 70, 97, 345, 152, 0, 0, 0, 0, 0, 0, 0, 0, 0, 105, 102, 0, 0, 103, 104, - 0, 0, 0, 0, 1372, 254, 255, 268, 0, 259, + 0, 0, 0, 0, 1377, 254, 255, 268, 0, 259, 260, 257, 261, 262, 0, 0, 247, 248, 0, 0, 0, 0, 246, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1567, 1566, 0, 1558, 1284, 1289, 660, 660, - 660, 0, 0, 0, 0, 658, 659, 0, 0, 0, - 0, 0, 539, 393, 403, 0, 0, 0, 1397, 222, - 0, 0, 0, 0, 0, 0, 0, 430, 1400, 1398, - 1396, 1399, 1401, 0, 0, 0, 0, 0, 214, 217, - 0, 392, 364, 0, 0, 0, 0, 1412, 0, 0, - 508, 506, 509, 498, 511, 501, 0, 1729, 382, 1409, - 0, 1563, 0, 0, 275, 467, 1377, 0, 464, 467, - 1343, 0, 467, 241, 0, 0, 1445, 1489, 251, 271, - 252, 272, 545, 1569, 1571, 0, 548, 553, 537, 0, - 537, 0, 550, 554, 537, 549, 0, 537, 544, 0, - 1131, 0, 1121, 0, 0, 842, 0, 0, 1122, 1057, - 1058, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1075, - 1074, 1123, 846, 0, 849, 0, 0, 1260, 1261, 0, - 1124, 0, 0, 1267, 0, 0, 0, 1129, 0, 784, - 0, 0, 685, 686, 694, 690, 697, 0, 700, 687, - 636, 586, 1719, 1760, 0, 647, 647, 647, 645, 635, - 0, 727, 785, 0, 775, 0, 0, 0, 808, 0, - 0, 810, 812, 0, 0, 815, 0, 791, 790, 0, - 0, 774, 0, 0, 854, 0, 1348, 0, 0, 213, - 0, 0, 0, 879, 0, 0, 0, 871, 869, 865, - 0, 961, 962, 963, 964, 965, 966, 967, 968, 969, - 970, 971, 972, 973, 885, 1385, 0, 891, 1388, 0, - 1389, 1390, 1387, 1384, 1391, 1392, 0, 0, 0, 0, - 1278, 1274, 0, 0, 0, 0, 0, 1180, 1182, 1184, - 0, 923, 922, 1189, 1195, 1198, 1202, 1203, 1204, 1199, - 1200, 1201, 1191, 1192, 1193, 1194, 1196, 1197, 0, 1217, - 0, 1171, 0, 0, 0, 0, 0, 0, 0, 0, - 1316, 1315, 0, 1339, 0, 1104, 1088, 0, 0, 1178, - 1105, 1313, 1323, 1291, 0, 0, 0, 1361, 1360, 983, - 992, 995, 1028, 1029, 999, 1000, 1001, 1005, 1383, 1382, - 1310, 0, 1302, 0, 0, 984, 1009, 1014, 0, 1269, - 1272, 1045, 1271, 0, 1033, 0, 1022, 0, 1031, 1035, - 1010, 1025, 0, 1006, 0, 1303, 1214, 1216, 0, 1212, - 0, 996, 997, 998, 988, 989, 990, 991, 993, 994, - 1002, 1188, 1186, 1187, 0, 1289, 0, 1301, 0, 0, - 1140, 0, 0, 1030, 1307, 0, 853, 660, 853, 0, - 981, 1551, 1380, 1544, 1380, 1533, 1224, 1345, 1379, 0, - 634, 0, 1553, 160, 164, 0, 0, 1290, 194, 196, - 768, 0, 667, 668, 672, 0, 0, 672, 651, 594, - 1980, 1858, 0, 0, 0, 0, 716, 757, 0, 748, - 713, 714, 0, 712, 1352, 717, 1351, 718, 721, 722, - 684, 1340, 758, 760, 0, 753, 0, 1346, 600, 619, - 0, 0, 0, 0, 0, 583, 582, 764, 1528, 1528, - 1530, 1529, 0, 273, 0, 52, 0, 1729, 76, 0, - 0, 0, 0, 0, 0, 295, 72, 73, 0, 397, - 0, 71, 67, 295, 118, 1729, 467, 1729, 467, 1623, - 1692, 1876, 0, 65, 369, 109, 0, 146, 79, 81, - 400, 0, 354, 0, 0, 99, 114, 139, 0, 0, - 54, 244, 258, 263, 142, 267, 264, 1417, 265, 153, - 0, 50, 0, 140, 0, 1415, 0, 0, 56, 144, - 1419, 1567, 1574, 0, 0, 1288, 0, 658, 658, 658, - 656, 657, 1108, 0, 1230, 0, 1232, 1233, 1022, 1427, - 1426, 1428, 1425, 527, 538, 0, 394, 0, 542, 530, - 531, 539, 1395, 227, 0, 218, 395, 0, 0, 395, - 0, 1397, 0, 0, 222, 228, 0, 0, 0, 0, - 0, 393, 385, 383, 416, 0, 390, 384, 0, 0, - 340, 0, 1617, 0, 1697, 201, 206, 0, 0, 0, - 0, 1366, 2149, 2150, 2151, 2152, 2154, 2155, 2156, 2157, - 2158, 2159, 2160, 2161, 2162, 2163, 2164, 2165, 2166, 2167, - 2168, 2169, 2170, 2171, 2172, 2173, 2174, 2175, 2177, 2178, - 2179, 2180, 2181, 2182, 515, 0, 518, 864, 1367, 0, - 0, 0, 0, 0, 277, 278, 433, 1378, 435, 0, - 437, 240, 238, 1440, 1568, 1570, 541, 0, 536, 0, - 563, 0, 0, 0, 0, 0, 0, 0, 0, 1118, - 1236, 0, 1255, 1254, 1056, 1063, 1066, 1070, 1071, 1072, - 1256, 0, 0, 0, 1067, 1068, 1069, 1059, 1060, 1061, - 1062, 1064, 1065, 1073, 851, 0, 0, 845, 1265, 1264, - 1258, 1259, 0, 1126, 1127, 1128, 1266, 0, 0, 820, - 689, 691, 688, 0, 0, 853, 647, 647, 647, 647, - 644, 0, 0, 0, 852, 0, 744, 705, 706, 0, - 0, 816, 814, 0, 838, 0, 811, 0, 817, 0, - 802, 0, 809, 858, 825, 0, 0, 827, 1519, 875, - 0, 870, 866, 0, 0, 0, 876, 0, 0, 0, - 0, 0, 0, 0, 1235, 0, 653, 1102, 0, 0, - 0, 1275, 0, 1050, 892, 905, 1027, 0, 1183, 1106, - 0, 1206, 1170, 933, 932, 934, 934, 1051, 0, 1318, - 1320, 0, 0, 0, 0, 1330, 0, 1053, 0, 1224, - 1174, 1176, 1331, 1087, 917, 981, 0, 0, 0, 0, - 0, 0, 0, 1034, 1024, 0, 1032, 1036, 0, 0, - 0, 1018, 0, 0, 1016, 1046, 1012, 0, 0, 1047, - 1288, 0, 1292, 0, 0, 1139, 1148, 771, 767, 727, - 658, 727, 0, 1513, 1535, 1532, 0, 632, 0, 0, - 1554, 0, 183, 0, 0, 0, 0, 0, 186, 200, - 197, 1553, 0, 0, 662, 664, 0, 1207, 672, 666, - 720, 719, 0, 682, 755, 680, 0, 761, 0, 617, - 0, 603, 0, 794, 0, 0, 1522, 1523, 0, 0, - 0, 0, 344, 0, 0, 0, 295, 0, 405, 0, - 412, 0, 0, 397, 376, 69, 68, 98, 0, 0, - 0, 61, 117, 90, 82, 57, 96, 0, 0, 101, - 0, 94, 111, 112, 110, 115, 0, 305, 330, 0, - 0, 341, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1574, 1560, 1573, 1289, 1289, - 1285, 0, 0, 0, 660, 1109, 0, 526, 568, 565, - 566, 0, 564, 249, 570, 404, 0, 0, 0, 216, - 392, 0, 0, 1412, 500, 503, 1394, 430, 0, 227, - 0, 231, 0, 0, 218, 395, 0, 368, 378, 379, - 364, 391, 362, 361, 363, 0, 1618, 242, 0, 1612, - 0, 208, 204, 395, 1411, 0, 0, 517, 0, 520, - 863, 507, 0, 512, 0, 0, 510, 0, 1406, 276, - 467, 1572, 551, 556, 0, 562, 558, 557, 552, 560, - 559, 555, 1119, 1130, 1253, 0, 0, 0, 0, 844, - 847, 0, 1125, 1120, 818, 0, 0, 727, 0, 0, - 0, 0, 638, 637, 643, 0, 0, 1142, 0, 708, - 813, 0, 0, 0, 800, 789, 795, 796, 0, 0, - 0, 856, 855, 826, 879, 0, 859, 879, 0, 879, - 877, 0, 0, 886, 974, 975, 976, 977, 978, 979, - 980, 911, 0, 1277, 1273, 1179, 1181, 1218, 929, 927, - 1052, 1321, 1314, 1317, 1223, 1325, 1327, 0, 0, 0, - 0, 1338, 0, 1173, 1339, 1359, 985, 0, 0, 1015, - 1270, 1037, 0, 0, 0, 1011, 1206, 0, 0, 0, - 0, 0, 1020, 0, 1296, 1289, 0, 1295, 0, 0, - 0, 0, 1114, 772, 744, 0, 744, 0, 1281, 0, - 628, 630, 633, 169, 1552, 0, 1547, 161, 162, 163, - 0, 0, 0, 178, 155, 0, 0, 0, 195, 183, - 171, 670, 671, 0, 665, 681, 1341, 1347, 602, 0, - 1084, 0, 0, 599, 0, 274, 147, 295, 0, 0, - 75, 0, 414, 356, 406, 389, 371, 0, 0, 0, - 296, 0, 431, 0, 0, 377, 0, 0, 0, 0, - 357, 0, 0, 316, 0, 0, 389, 0, 396, 312, - 313, 0, 60, 91, 0, 87, 0, 116, 0, 0, - 0, 0, 0, 63, 86, 0, 58, 864, 467, 467, - 66, 1372, 2032, 2033, 2034, 2035, 2036, 2037, 2038, 2039, - 2040, 2041, 2042, 2043, 2044, 2045, 2046, 2047, 2048, 2049, - 2050, 2051, 2169, 2052, 302, 2053, 1800, 2054, 2055, 2056, - 2057, 2058, 0, 2059, 862, 2060, 2061, 2249, 2062, 2063, - 1191, 1192, 301, 300, 399, 297, 407, 299, 0, 1373, - 298, 402, 355, 0, 0, 143, 1418, 0, 141, 0, - 1416, 150, 148, 145, 1420, 1559, 0, 0, 1112, 1113, - 1110, 658, 0, 0, 0, 0, 545, 533, 0, 0, - 0, 1617, 203, 0, 0, 1729, 0, 0, 230, 229, - 219, 0, 1412, 215, 392, 0, 422, 340, 864, 417, - 0, 1617, 1615, 0, 0, 209, 0, 207, 1412, 1611, - 499, 502, 516, 519, 0, 0, 0, 0, 585, 504, - 0, 0, 0, 438, 561, 1076, 0, 0, 0, 0, - 698, 0, 704, 744, 642, 641, 640, 639, 726, 1666, - 1963, 1857, 0, 730, 725, 728, 733, 735, 734, 736, - 732, 743, 0, 746, 707, 837, 1219, 1221, 0, 0, - 0, 0, 801, 803, 0, 805, 0, 857, 873, 0, - 874, 0, 872, 878, 867, 1276, 1319, 1328, 1329, 1324, - 1333, 1335, 0, 0, 0, 982, 1054, 1043, 1041, 1038, - 0, 1039, 1019, 0, 0, 1017, 1013, 0, 1048, 0, - 0, 1293, 0, 1134, 0, 1137, 1151, 1147, 1146, 1142, - 1109, 1142, 1514, 626, 629, 0, 182, 159, 185, 184, - 0, 1290, 192, 0, 0, 183, 0, 494, 495, 496, - 183, 0, 187, 523, 0, 0, 614, 793, 607, 608, - 0, 410, 77, 0, 389, 0, 295, 373, 372, 375, - 370, 374, 0, 432, 0, 0, 314, 0, 321, 359, - 360, 358, 315, 389, 395, 317, 0, 0, 0, 83, - 62, 59, 64, 84, 0, 0, 85, 88, 858, 100, - 93, 1372, 0, 0, 0, 78, 80, 0, 0, 1287, - 1286, 0, 529, 528, 567, 569, 525, 534, 249, 0, - 0, 0, 364, 1614, 0, 0, 0, 392, 0, 232, - 0, 0, 0, 1617, 0, 0, 292, 0, 337, 0, - 235, 1616, 202, 205, 0, 0, 0, 1603, 521, 522, - 0, 0, 1404, 1405, 0, 1077, 0, 1078, 848, 0, - 0, 696, 1142, 0, 0, 0, 737, 731, 0, 1141, - 1143, 0, 693, 1222, 797, 0, 799, 0, 823, 0, - 823, 806, 868, 860, 1326, 1336, 1337, 1332, 1132, 0, - 1040, 1044, 1042, 1021, 1289, 1289, 1297, 1294, 1136, 1150, - 1153, 746, 1357, 746, 631, 625, 0, 0, 170, 0, - 0, 167, 154, 473, 0, 497, 471, 172, 1208, 604, - 605, 0, 295, 0, 388, 411, 326, 304, 0, 0, - 0, 311, 318, 421, 320, 0, 92, 108, 0, 0, - 401, 151, 149, 1111, 545, 0, 221, 1412, 340, 1611, - 0, 0, 0, 0, 364, 242, 1613, 353, 346, 347, - 348, 349, 350, 351, 352, 367, 366, 338, 339, 210, - 0, 0, 0, 0, 505, 1406, 0, 189, 198, 0, - 189, 1079, 699, 0, 746, 0, 0, 0, 729, 0, - 0, 745, 0, 590, 1220, 0, 788, 786, 0, 787, - 1334, 0, 0, 0, 0, 660, 693, 693, 156, 0, - 157, 193, 0, 0, 0, 0, 0, 492, 395, 413, - 387, 0, 380, 324, 323, 325, 329, 0, 327, 0, - 343, 0, 336, 304, 0, 95, 0, 408, 524, 532, - 0, 294, 1605, 392, 0, 220, 1611, 340, 1617, 1611, - 0, 1608, 0, 0, 0, 0, 191, 1412, 0, 191, - 0, 693, 739, 0, 738, 1145, 1144, 695, 798, 0, - 1133, 1299, 1298, 0, 1157, 589, 588, 0, 0, 0, - 0, 472, 0, 0, 473, 421, 0, 365, 0, 0, - 326, 0, 319, 418, 419, 420, 0, 332, 322, 333, - 89, 107, 409, 0, 392, 1606, 293, 236, 1604, 1609, - 1610, 0, 189, 188, 669, 190, 853, 199, 669, 703, - 591, 740, 692, 804, 1152, 0, 0, 0, 0, 0, - 166, 853, 177, 0, 481, 0, 488, 164, 164, 489, - 490, 491, 0, 336, 386, 381, 303, 328, 342, 0, - 0, 0, 334, 0, 335, 1611, 0, 191, 672, 1402, - 672, 1949, 1667, 1914, 0, 1169, 1158, 1169, 1169, 1149, - 158, 165, 0, 485, 486, 487, 0, 0, 477, 0, - 0, 480, 0, 295, 308, 0, 307, 0, 398, 331, - 1607, 1412, 669, 179, 180, 0, 1162, 1161, 1160, 1164, - 1163, 0, 1156, 1154, 1155, 853, 484, 0, 476, 483, - 0, 479, 478, 493, 415, 306, 310, 309, 853, 672, - 0, 0, 1166, 0, 1167, 176, 474, 0, 1403, 181, - 1159, 1165, 1168, 0, 482 + 0, 0, 1572, 1571, 0, 1563, 1289, 1294, 665, 665, + 665, 0, 0, 0, 0, 663, 664, 0, 0, 0, + 0, 0, 544, 397, 408, 0, 0, 0, 1402, 222, + 0, 0, 0, 0, 0, 0, 0, 435, 1405, 1403, + 1401, 1404, 1406, 0, 0, 0, 0, 0, 214, 217, + 0, 396, 368, 0, 0, 0, 0, 1417, 0, 0, + 513, 511, 514, 503, 516, 506, 0, 1734, 386, 1414, + 0, 1568, 0, 0, 275, 472, 1382, 0, 469, 472, + 1348, 0, 472, 241, 0, 0, 1450, 1494, 251, 271, + 252, 272, 550, 1574, 1576, 0, 553, 558, 542, 0, + 542, 0, 555, 559, 542, 554, 0, 542, 549, 0, + 1136, 0, 1126, 0, 0, 847, 0, 0, 1127, 1062, + 1063, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1080, + 1079, 1128, 851, 0, 854, 0, 0, 1265, 1266, 0, + 1129, 0, 0, 1272, 0, 0, 0, 1134, 0, 789, + 0, 0, 690, 691, 699, 695, 702, 0, 705, 692, + 641, 591, 1724, 1765, 0, 652, 652, 652, 650, 640, + 0, 732, 790, 0, 780, 0, 0, 0, 813, 0, + 0, 815, 817, 0, 0, 820, 0, 796, 795, 0, + 0, 779, 0, 0, 859, 0, 1353, 0, 0, 213, + 0, 0, 0, 884, 0, 0, 0, 876, 874, 870, + 0, 966, 967, 968, 969, 970, 971, 972, 973, 974, + 975, 976, 977, 978, 890, 1390, 0, 896, 1393, 0, + 1394, 1395, 1392, 1389, 1396, 1397, 0, 0, 0, 0, + 1283, 1279, 0, 0, 0, 0, 0, 1185, 1187, 1189, + 0, 928, 927, 1194, 1200, 1203, 1207, 1208, 1209, 1204, + 1205, 1206, 1196, 1197, 1198, 1199, 1201, 1202, 0, 1222, + 0, 1176, 0, 0, 0, 0, 0, 0, 0, 0, + 1321, 1320, 0, 1344, 0, 1109, 1093, 0, 0, 1183, + 1110, 1318, 1328, 1296, 0, 0, 0, 1366, 1365, 988, + 997, 1000, 1033, 1034, 1004, 1005, 1006, 1010, 1388, 1387, + 1315, 0, 1307, 0, 0, 989, 1014, 1019, 0, 1274, + 1277, 1050, 1276, 0, 1038, 0, 1027, 0, 1036, 1040, + 1015, 1030, 0, 1011, 0, 1308, 1219, 1221, 0, 1217, + 0, 1001, 1002, 1003, 993, 994, 995, 996, 998, 999, + 1007, 1193, 1191, 1192, 0, 1294, 0, 1306, 0, 0, + 1145, 0, 0, 1035, 1312, 0, 858, 665, 858, 0, + 986, 1556, 1385, 1549, 1385, 1538, 1229, 1350, 1384, 0, + 639, 0, 1558, 160, 164, 0, 0, 1295, 194, 196, + 773, 0, 672, 673, 677, 0, 0, 677, 656, 599, + 1985, 1863, 0, 0, 0, 0, 721, 762, 0, 753, + 718, 719, 0, 717, 1357, 722, 1356, 723, 726, 727, + 689, 1345, 763, 765, 0, 758, 0, 1351, 605, 624, + 0, 0, 0, 0, 0, 588, 587, 769, 1533, 1533, + 1535, 1534, 0, 273, 0, 52, 0, 1734, 76, 0, + 0, 0, 0, 0, 0, 295, 72, 73, 0, 401, + 0, 71, 67, 295, 118, 1734, 472, 1734, 472, 1628, + 1697, 1881, 0, 65, 373, 109, 0, 146, 79, 81, + 0, 404, 0, 354, 0, 0, 99, 114, 139, 0, + 0, 54, 244, 258, 263, 142, 267, 264, 1422, 265, + 153, 0, 50, 0, 140, 0, 1420, 0, 0, 56, + 144, 1424, 1572, 1579, 0, 0, 1293, 0, 663, 663, + 663, 661, 662, 1113, 0, 1235, 0, 1237, 1238, 1027, + 1432, 1431, 1433, 1430, 532, 543, 0, 398, 0, 547, + 535, 536, 544, 1400, 227, 0, 218, 399, 0, 0, + 399, 0, 1402, 0, 0, 222, 228, 0, 0, 0, + 0, 0, 397, 389, 387, 421, 0, 394, 388, 0, + 0, 340, 0, 1622, 0, 1702, 201, 206, 0, 0, + 0, 0, 1371, 2154, 2155, 2156, 2157, 2159, 2160, 2161, + 2162, 2163, 2164, 2165, 2166, 2167, 2168, 2169, 2170, 2171, + 2172, 2173, 2174, 2175, 2176, 2177, 2178, 2179, 2180, 2182, + 2183, 2184, 2185, 2186, 2187, 520, 0, 523, 869, 1372, + 0, 0, 0, 0, 0, 277, 278, 438, 1383, 440, + 0, 442, 240, 238, 1445, 1573, 1575, 546, 0, 541, + 0, 568, 0, 0, 0, 0, 0, 0, 0, 0, + 1123, 1241, 0, 1260, 1259, 1061, 1068, 1071, 1075, 1076, + 1077, 1261, 0, 0, 0, 1072, 1073, 1074, 1064, 1065, + 1066, 1067, 1069, 1070, 1078, 856, 0, 0, 850, 1270, + 1269, 1263, 1264, 0, 1131, 1132, 1133, 1271, 0, 0, + 825, 694, 696, 693, 0, 0, 858, 652, 652, 652, + 652, 649, 0, 0, 0, 857, 0, 749, 710, 711, + 0, 0, 821, 819, 0, 843, 0, 816, 0, 822, + 0, 807, 0, 814, 863, 830, 0, 0, 832, 1524, + 880, 0, 875, 871, 0, 0, 0, 881, 0, 0, + 0, 0, 0, 0, 0, 1240, 0, 658, 1107, 0, + 0, 0, 1280, 0, 1055, 897, 910, 1032, 0, 1188, + 1111, 0, 1211, 1175, 938, 937, 939, 939, 1056, 0, + 1323, 1325, 0, 0, 0, 0, 1335, 0, 1058, 0, + 1229, 1179, 1181, 1336, 1092, 922, 986, 0, 0, 0, + 0, 0, 0, 0, 1039, 1029, 0, 1037, 1041, 0, + 0, 0, 1023, 0, 0, 1021, 1051, 1017, 0, 0, + 1052, 1293, 0, 1297, 0, 0, 1144, 1153, 776, 772, + 732, 663, 732, 0, 1518, 1540, 1537, 0, 637, 0, + 0, 1559, 0, 183, 0, 0, 0, 0, 0, 186, + 200, 197, 1558, 0, 0, 667, 669, 0, 1212, 677, + 671, 725, 724, 0, 687, 760, 685, 0, 766, 0, + 622, 0, 608, 0, 799, 0, 0, 1527, 1528, 0, + 0, 0, 0, 344, 0, 0, 0, 295, 0, 410, + 0, 417, 0, 0, 401, 380, 69, 68, 98, 0, + 0, 0, 61, 117, 90, 82, 57, 96, 0, 0, + 101, 0, 94, 111, 112, 110, 115, 0, 305, 330, + 0, 0, 0, 341, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1579, 1565, 1578, + 1294, 1294, 1290, 0, 0, 0, 665, 1114, 0, 531, + 573, 570, 571, 0, 569, 249, 575, 409, 0, 0, + 0, 216, 396, 0, 0, 1417, 505, 508, 1399, 435, + 0, 227, 0, 231, 0, 0, 218, 399, 0, 372, + 382, 383, 362, 395, 366, 365, 367, 0, 1623, 242, + 0, 1617, 0, 208, 204, 399, 1416, 0, 0, 522, + 0, 525, 868, 512, 0, 517, 0, 0, 515, 0, + 1411, 276, 472, 1577, 556, 561, 0, 567, 563, 562, + 557, 565, 564, 560, 1124, 1135, 1258, 0, 0, 0, + 0, 849, 852, 0, 1130, 1125, 823, 0, 0, 732, + 0, 0, 0, 0, 643, 642, 648, 0, 0, 1147, + 0, 713, 818, 0, 0, 0, 805, 794, 800, 801, + 0, 0, 0, 861, 860, 831, 884, 0, 864, 884, + 0, 884, 882, 0, 0, 891, 979, 980, 981, 982, + 983, 984, 985, 916, 0, 1282, 1278, 1184, 1186, 1223, + 934, 932, 1057, 1326, 1319, 1322, 1228, 1330, 1332, 0, + 0, 0, 0, 1343, 0, 1178, 1344, 1364, 990, 0, + 0, 1020, 1275, 1042, 0, 0, 0, 1016, 1211, 0, + 0, 0, 0, 0, 1025, 0, 1301, 1294, 0, 1300, + 0, 0, 0, 0, 1119, 777, 749, 0, 749, 0, + 1286, 0, 633, 635, 638, 169, 1557, 0, 1552, 161, + 162, 163, 0, 0, 0, 178, 155, 0, 0, 0, + 195, 183, 171, 675, 676, 0, 670, 686, 1346, 1352, + 607, 0, 1089, 0, 0, 604, 0, 274, 147, 295, + 0, 0, 75, 0, 419, 356, 411, 393, 375, 0, + 0, 0, 296, 0, 436, 0, 0, 381, 0, 0, + 0, 0, 357, 0, 0, 316, 0, 0, 393, 0, + 400, 312, 313, 0, 60, 91, 0, 87, 0, 116, + 0, 0, 0, 0, 0, 63, 86, 0, 58, 869, + 472, 472, 66, 407, 403, 406, 355, 0, 0, 143, + 1423, 0, 141, 0, 1421, 150, 148, 145, 1425, 1564, + 0, 0, 1117, 1118, 1115, 663, 0, 0, 0, 0, + 550, 538, 0, 0, 0, 1622, 203, 0, 0, 1734, + 0, 0, 230, 229, 219, 0, 1417, 215, 396, 0, + 427, 368, 869, 422, 0, 1622, 1620, 0, 0, 209, + 0, 207, 1417, 1616, 504, 507, 521, 524, 0, 0, + 0, 0, 590, 509, 0, 0, 0, 443, 566, 1081, + 0, 0, 0, 0, 703, 0, 709, 749, 647, 646, + 645, 644, 731, 1671, 1968, 1862, 0, 735, 730, 733, + 738, 740, 739, 741, 737, 748, 0, 751, 712, 842, + 1224, 1226, 0, 0, 0, 0, 806, 808, 0, 810, + 0, 862, 878, 0, 879, 0, 877, 883, 872, 1281, + 1324, 1333, 1334, 1329, 1338, 1340, 0, 0, 0, 987, + 1059, 1048, 1046, 1043, 0, 1044, 1024, 0, 0, 1022, + 1018, 0, 1053, 0, 0, 1298, 0, 1139, 0, 1142, + 1156, 1152, 1151, 1147, 1114, 1147, 1519, 631, 634, 0, + 182, 159, 185, 184, 0, 1295, 192, 0, 0, 183, + 0, 499, 500, 501, 183, 0, 187, 528, 0, 0, + 619, 798, 612, 613, 0, 415, 77, 0, 393, 0, + 295, 377, 376, 379, 374, 378, 0, 437, 0, 0, + 314, 0, 321, 359, 360, 358, 315, 393, 399, 317, + 0, 0, 0, 83, 62, 59, 64, 84, 0, 0, + 85, 88, 863, 100, 93, 0, 78, 80, 0, 0, + 1292, 1291, 0, 534, 533, 572, 574, 530, 539, 249, + 0, 0, 0, 362, 1619, 0, 0, 0, 396, 0, + 232, 0, 0, 0, 1622, 0, 0, 0, 0, 361, + 340, 0, 337, 0, 235, 1621, 202, 205, 0, 0, + 0, 1608, 526, 527, 0, 0, 1409, 1410, 0, 1082, + 0, 1083, 853, 0, 0, 701, 1147, 0, 0, 0, + 742, 736, 0, 1146, 1148, 0, 698, 1227, 802, 0, + 804, 0, 828, 0, 828, 811, 873, 865, 1331, 1341, + 1342, 1337, 1137, 0, 1045, 1049, 1047, 1026, 1294, 1294, + 1302, 1299, 1141, 1155, 1158, 751, 1362, 751, 636, 630, + 0, 0, 170, 0, 0, 167, 154, 478, 0, 502, + 476, 172, 1213, 609, 610, 0, 295, 0, 392, 416, + 326, 304, 0, 0, 0, 311, 318, 426, 320, 0, + 92, 108, 1377, 2037, 2038, 2039, 2040, 2041, 2042, 2043, + 2044, 2045, 2046, 2047, 2048, 2049, 2050, 2051, 2052, 2053, + 2054, 2055, 2056, 2174, 2057, 302, 2058, 1805, 2059, 2060, + 2061, 2062, 2063, 0, 2064, 867, 2065, 2066, 2254, 2067, + 2068, 1196, 1197, 301, 300, 405, 297, 412, 299, 0, + 1378, 298, 151, 149, 1116, 550, 0, 221, 1417, 368, + 1616, 0, 0, 0, 0, 362, 242, 1618, 353, 346, + 347, 348, 349, 350, 351, 352, 371, 370, 0, 0, + 292, 338, 339, 210, 0, 0, 0, 0, 510, 1411, + 0, 189, 198, 0, 189, 1084, 704, 0, 751, 0, + 0, 0, 734, 0, 0, 750, 0, 595, 1225, 0, + 793, 791, 0, 792, 1339, 0, 0, 0, 0, 665, + 698, 698, 156, 0, 157, 193, 0, 0, 0, 0, + 0, 497, 399, 418, 391, 0, 384, 324, 323, 325, + 329, 0, 327, 0, 343, 0, 336, 304, 0, 95, + 1377, 0, 0, 529, 537, 0, 340, 1610, 396, 0, + 220, 1616, 368, 1622, 0, 0, 1616, 0, 1613, 0, + 0, 0, 0, 191, 1417, 0, 191, 0, 698, 744, + 0, 743, 1150, 1149, 700, 803, 0, 1138, 1304, 1303, + 0, 1162, 594, 593, 0, 0, 0, 0, 477, 0, + 0, 478, 426, 0, 369, 0, 0, 326, 0, 319, + 423, 424, 425, 0, 332, 322, 333, 89, 107, 0, + 0, 0, 294, 396, 1611, 340, 236, 0, 0, 1609, + 1614, 1615, 0, 189, 188, 674, 190, 858, 199, 674, + 708, 596, 745, 697, 809, 1157, 0, 0, 0, 0, + 0, 166, 858, 177, 0, 486, 0, 493, 164, 164, + 494, 495, 496, 0, 336, 390, 385, 303, 328, 342, + 0, 0, 0, 334, 0, 335, 0, 413, 1616, 293, + 363, 364, 0, 191, 677, 1407, 677, 1954, 1672, 1919, + 0, 1174, 1163, 1174, 1174, 1154, 158, 165, 0, 490, + 491, 492, 0, 0, 482, 0, 0, 485, 0, 295, + 308, 0, 307, 0, 402, 331, 414, 1612, 1417, 674, + 179, 180, 0, 1167, 1166, 1165, 1169, 1168, 0, 1161, + 1159, 1160, 858, 489, 0, 481, 488, 0, 484, 483, + 498, 420, 306, 310, 309, 858, 677, 0, 0, 1171, + 0, 1172, 176, 479, 0, 1408, 181, 1164, 1170, 1173, + 0, 487 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 47, 48, 49, 769, 2773, 2774, 2775, 2352, 2341, - 2342, 1819, 1820, 1251, 3615, 2353, 1252, 1253, 2777, 770, + -1, 47, 48, 49, 769, 2774, 2775, 2776, 2352, 2341, + 2342, 1819, 1820, 1251, 3619, 2353, 1252, 1253, 2778, 770, 821, 1191, 870, 1129, 1666, 935, 1288, 1289, 771, 1826, - 772, 3023, 2264, 2715, 3594, 54, 3322, 2268, 1205, 3325, - 3558, 3016, 3320, 2717, 3636, 3694, 3323, 2269, 2270, 3559, - 2271, 773, 2455, 3206, 3207, 774, 775, 1918, 58, 1353, - 561, 1915, 3188, 2841, 2842, 776, 777, 1388, 1389, 990, - 778, 1919, 1858, 3143, 1271, 1848, 1403, 62, 63, 1944, - 779, 109, 931, 65, 780, 2760, 3144, 3608, 2788, 3768, - 3078, 3079, 3605, 3606, 2763, 2355, 3677, 3678, 2856, 1839, - 3672, 2442, 3545, 2361, 2335, 3080, 2450, 3504, 3196, 2356, - 3060, 2848, 2849, 2443, 3601, 1939, 2444, 3602, 3346, 2445, - 1894, 1922, 2764, 3679, 2362, 1895, 2759, 3145, 1823, 2446, - 3612, 2447, 562, 3064, 781, 759, 760, 982, 1382, 761, - 782, 3596, 3759, 3789, 3719, 3754, 3327, 3664, 3328, 3329, - 3330, 783, 1930, 1931, 1932, 1933, 1934, 1935, 966, 1936, - 2495, 2496, 784, 785, 2817, 2421, 3398, 3399, 2519, 2415, - 1412, 1897, 1413, 551, 1978, 2823, 786, 1130, 74, 75, - 1037, 76, 3340, 77, 78, 1793, 1794, 1795, 872, 882, - 883, 1746, 3009, 3010, 2709, 1498, 2049, 875, 1211, 1762, - 856, 857, 1883, 899, 1886, 1757, 1758, 2274, 2724, 1786, - 1787, 1220, 1221, 2035, 2036, 3573, 2037, 2038, 1491, 1492, - 3441, 2589, 2590, 1502, 1774, 1778, 1779, 2295, 2285, 1765, - 2586, 3243, 3244, 3245, 3246, 3247, 3248, 3249, 1131, 2917, - 3452, 1782, 1783, 1223, 1224, 1225, 1791, 2305, 80, 81, - 2246, 2697, 2698, 827, 828, 3261, 1522, 1796, 2923, 2924, - 2925, 3264, 3265, 3266, 829, 1032, 1033, 1060, 1055, 1511, - 2061, 830, 831, 2012, 2013, 2557, 1062, 2051, 2073, 2074, - 2931, 2614, 1591, 2338, 1592, 1593, 2087, 1594, 1132, 1595, - 1623, 1133, 1628, 1597, 1134, 1135, 1136, 1600, 1137, 1138, - 1139, 1140, 1616, 1141, 1142, 1641, 2091, 2092, 2093, 2094, - 2095, 2096, 2097, 2098, 2099, 2100, 2101, 2102, 2103, 2104, - 1192, 1797, 1144, 1145, 1146, 1147, 1148, 1149, 1150, 1151, - 1152, 1153, 833, 1154, 1155, 1717, 2240, 2696, 3253, 3449, - 3450, 3002, 3308, 3480, 3585, 3708, 3745, 3746, 3782, 1156, - 1157, 1661, 1662, 1663, 2127, 2128, 2129, 2130, 2234, 1711, - 1712, 1158, 3147, 1714, 2150, 3257, 3258, 1193, 1484, 1654, - 1333, 1334, 1605, 1458, 1459, 1465, 1987, 1473, 1477, 2017, - 2018, 1485, 2201, 1159, 2120, 2121, 2632, 1618, 3011, 1160, - 1287, 1667, 2997, 2237, 1715, 2194, 1167, 1161, 1168, 1163, - 1650, 2970, 2650, 2651, 1651, 2655, 2966, 2967, 2163, 2971, - 3281, 3282, 2657, 2302, 1743, 2307, 2308, 986, 1164, 1165, - 1166, 1335, 535, 1606, 3695, 1378, 1198, 1336, 2190, 787, - 1067, 2113, 788, 1350, 1910, 789, 3433, 3222, 1367, 1940, - 2459, 563, 790, 791, 544, 87, 2410, 947, 88, 89, - 90, 908, 1405, 792, 996, 1407, 997, 91, 1408, 999, - 1000, 794, 864, 865, 1531, 1731, 1532, 795, 94, 839, - 1806, 796, 1187, 879, 1188, 1190, 797, 1208, 2712, 2262, - 97, 98, 99, 119, 1283, 2515, 1964, 1965, 1875, 798, - 850, 851, 888, 102, 103, 1236, 852, 800, 801, 3427, - 802, 2859, 1359, 545, 537, 538, 1608, 733, 1338, 734 + 772, 3025, 2264, 2716, 3598, 54, 3276, 2268, 1205, 3279, + 3562, 3018, 3274, 2718, 3643, 3705, 3277, 2269, 2270, 3563, + 2271, 773, 2456, 3160, 3161, 774, 775, 1918, 58, 1353, + 561, 1915, 3142, 2843, 2844, 776, 777, 1388, 1389, 990, + 778, 1919, 1858, 3514, 1271, 1848, 1403, 62, 63, 1944, + 779, 109, 931, 65, 780, 2761, 3515, 3612, 2789, 3784, + 3080, 3081, 3609, 3610, 2764, 2355, 3684, 3685, 2858, 1839, + 3679, 2443, 3546, 2362, 2335, 3082, 3151, 3369, 2451, 3458, + 3150, 2356, 3062, 2850, 2851, 2444, 3605, 1939, 2445, 3606, + 3300, 2446, 1894, 1922, 2765, 3686, 2363, 1895, 2760, 3516, + 1823, 2447, 3616, 2448, 562, 3066, 781, 759, 760, 982, + 1382, 761, 782, 3600, 3775, 3806, 3730, 3770, 3281, 3671, + 3282, 3283, 3284, 783, 1930, 1931, 1932, 1933, 1934, 1935, + 966, 1936, 2496, 2497, 784, 785, 2819, 2422, 3349, 3350, + 2520, 2416, 1412, 1897, 1413, 551, 1978, 2825, 786, 1130, + 74, 75, 1037, 76, 3294, 77, 78, 1793, 1794, 1795, + 872, 882, 883, 1746, 3011, 3012, 2710, 1498, 2049, 875, + 1211, 1762, 856, 857, 1883, 899, 1886, 1757, 1758, 2274, + 2725, 1786, 1787, 1220, 1221, 2035, 2036, 3577, 2037, 2038, + 1491, 1492, 3395, 2590, 2591, 1502, 1774, 1778, 1779, 2295, + 2285, 1765, 2587, 3197, 3198, 3199, 3200, 3201, 3202, 3203, + 1131, 2919, 3406, 1782, 1783, 1223, 1224, 1225, 1791, 2305, + 80, 81, 2246, 2698, 2699, 827, 828, 3215, 1522, 1796, + 2925, 2926, 2927, 3218, 3219, 3220, 829, 1032, 1033, 1060, + 1055, 1511, 2061, 830, 831, 2012, 2013, 2558, 1062, 2051, + 2073, 2074, 2933, 2615, 1591, 2338, 1592, 1593, 2087, 1594, + 1132, 1595, 1623, 1133, 1628, 1597, 1134, 1135, 1136, 1600, + 1137, 1138, 1139, 1140, 1616, 1141, 1142, 1641, 2091, 2092, + 2093, 2094, 2095, 2096, 2097, 2098, 2099, 2100, 2101, 2102, + 2103, 2104, 1192, 1797, 1144, 1145, 1146, 1147, 1148, 1149, + 1150, 1151, 1152, 1153, 833, 1154, 1155, 1717, 2240, 2697, + 3207, 3403, 3404, 3004, 3262, 3434, 3589, 3719, 3761, 3762, + 3799, 1156, 1157, 1661, 1662, 1663, 2127, 2128, 2129, 2130, + 2234, 1711, 1712, 1158, 3518, 1714, 2150, 3211, 3212, 1193, + 1484, 1654, 1333, 1334, 1605, 1458, 1459, 1465, 1987, 1473, + 1477, 2017, 2018, 1485, 2201, 1159, 2120, 2121, 2633, 1618, + 3013, 1160, 1287, 1667, 2999, 2237, 1715, 2194, 1167, 1161, + 1168, 1163, 1650, 2972, 2651, 2652, 1651, 2656, 2968, 2969, + 2163, 2973, 3235, 3236, 2658, 2302, 1743, 2307, 2308, 986, + 1164, 1165, 1166, 1335, 535, 1606, 3706, 1378, 1198, 1336, + 2190, 787, 1067, 2113, 788, 1350, 1910, 789, 3387, 3176, + 1367, 1940, 2460, 563, 790, 791, 544, 87, 2411, 947, + 88, 89, 90, 908, 1405, 792, 996, 1407, 997, 91, + 1408, 999, 1000, 794, 864, 865, 1531, 1731, 1532, 795, + 94, 839, 1806, 796, 1187, 879, 1188, 1190, 797, 1208, + 2713, 2262, 97, 98, 99, 119, 1283, 2516, 1964, 1965, + 1875, 798, 850, 851, 888, 102, 103, 1236, 852, 800, + 801, 3381, 802, 2861, 1359, 545, 537, 538, 1608, 733, + 1338, 734 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -3295 +#define YYPACT_NINF -3343 static const int yypact[] = { - 7837, 387, 787, -3295, -3295, 708, 387, 53010, 69762, 148, - 387, 124, 3023, 55540, -3295, -3295, 49956, 3804, 387, 59582, - 76838, 461, 467, 34057, 552, 60091, -3295, -3295, -3295, 69762, - 59582, 60600, 387, 353, 70271, -3295, 387, 37113, 56049, 525, - -3295, 59582, 92, 297, 61109, 59582, 4028, 888, 445, -3295, - -3295, -3295, -3295, -3295, 323, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, 185, -3295, 134, 214, 34057, 34057, 955, - 449, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, 546, -3295, -3295, 838, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, 36603, -3295, -3295, -3295, -3295, -3295, -3295, - 70780, 61618, 59582, 62127, 56558, 62636, -3295, 827, 707, 1115, - 841, 181, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, 201, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, 634, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, 225, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, 565, -3295, 665, -3295, 226, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, 145, -3295, -3295, 1091, - 2223, 59582, 411, 519, 885, -3295, 63145, -3295, 880, -3295, - -3295, 898, 963, 1049, -3295, -3295, 57067, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, 50465, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, 1013, -3295, -3295, 829, -3295, - 270, -3295, -3295, 866, 819, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, 922, -3295, -3295, -3295, 925, 71289, - 63654, 64163, -3295, 812, 711, 987, 6452, 76856, 33037, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, 546, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, 60091, 69762, 824, 836, 1189, 840, 35075, - 844, 37623, 857, 863, 1241, 899, 914, 927, 941, 297, - 33547, 950, 565, 1472, 64672, 64672, -36, 34566, 2495, -3295, - 64672, 65181, -3295, 980, -3295, 1115, -3295, -3295, -3295, -3295, - 395, 968, -3295, 65690, 65690, 65690, 1000, 1287, 65690, -3295, - -3295, -3295, 1007, -3295, -3295, 1236, 21003, 21003, 71798, 71798, - 1115, 71798, 1031, 71798, -3295, -3295, 374, 841, -3295, 565, - -3295, -3295, 955, -3295, -3295, 56049, -3295, -3295, 292, 1375, - 21003, 59582, 1014, -3295, 1035, 1014, 1041, 1061, 1066, -3295, - 7837, 1404, 1299, 1381, 57576, 370, 370, 1537, 370, 786, - 923, 4316, 2204, -3295, 1297, -3295, 1098, -3295, 59582, 60091, - 1200, 1460, 1129, 1417, -3295, -3295, 1491, 1331, 1502, 773, - 1346, 1560, 6505, 1565, 1090, 1567, 1123, 1598, 1552, 1713, - 41, -3295, 21003, 50974, 565, -3295, 12479, 21003, -3295, -3295, - -3295, 1333, -3295, -3295, -3295, -3295, -3295, 59582, 69762, 1246, - 1237, -3295, -3295, -3295, -3295, 1709, 1497, -3295, 72307, -3295, - -3295, 1309, 66199, 66708, 67217, 67726, 68235, 1702, -3295, -3295, - 1650, -3295, -3295, -3295, 1301, -3295, -3295, -3295, 199, 72816, - 1653, 1306, 123, -3295, 1684, 245, -3295, 1686, 1536, 15129, - -3295, 1489, -3295, -3295, -3295, 297, -3295, 626, -3295, -3295, - 46910, -3295, -3295, 76856, 1419, 1350, -3295, 21003, 21003, 1356, - 5835, 64672, 65181, 21003, 59582, -3295, 21003, 26343, 1357, 21003, - 21003, 13013, 21003, 31027, 64672, 2495, 1358, -3295, 710, -3295, - 59582, 1363, -3295, 1464, 1464, 353, 34057, 1675, 33547, 1464, - 1848, 1464, -3295, 919, 1672, 1595, -3295, 34057, 1595, 1138, - 1376, 1678, 1595, -3295, 281, 1681, 1848, 38132, 1379, -3295, - 1464, 1610, -3295, -3295, 21003, 15129, 58085, 1883, -3295, -3295, - -3295, -3295, 1691, -3295, 69762, 1403, -3295, -3295, -3295, -3295, - -3295, -3295, 772, 1920, 174, 1927, 21003, 174, 174, 1407, - 228, 228, -3295, 1607, 1414, -3295, 232, 1418, 1423, 1947, - 1949, 189, 59582, 167, 1008, 174, 21003, -3295, 228, 1427, - 1953, 1431, 1960, 204, 216, -3295, 1438, 234, 21003, 21003, - 21003, 312, 21003, 11411, -3295, 50974, 1961, 59582, 263, -3295, - 565, 1441, 1115, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - 1447, -3295, 227, 7043, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, 1483, -3295, -3295, -3295, -3295, 1671, 21003, -3295, - -3295, 1448, 1675, -3295, 237, -3295, -3295, 1675, -3295, -3295, - -3295, -3295, -3295, 255, -3295, 1876, 21003, 21003, -3295, 565, - 73325, -3295, -3295, -3295, -3295, -3295, -3295, -3295, 675, -3295, - 546, 655, 48616, 1450, 1454, 1014, 59582, 59582, 1525, -3295, - -3295, -3295, -3295, 56049, 200, 1781, 56049, 182, 1611, -3295, - -3295, 955, 955, 16197, 1843, 309, 83, 16731, 21537, 1838, - 1719, 236, 913, 1841, -3295, 1723, 1955, 26343, 21003, 21003, - 786, 923, 21003, 1035, 104, -3295, -3295, 59582, -3295, 1779, - 69762, 1580, 59582, 53519, 855, 886, 1494, 1583, 54, 897, - 1930, -3295, 1493, -3295, 1586, 59582, 75855, 252, -3295, 1968, - 252, 252, 264, 1970, 1592, 290, 1765, 1302, -85, 1493, - 2981, -3295, 56049, 161, 1477, 1493, 59582, 1597, 1503, 1493, - 1552, 1115, 69762, 1514, -3295, -3295, 9937, 2016, -3295, -3295, - -3295, 194, 15129, -3295, 1128, 1203, 1492, 1507, -3295, 426, - 209, 1569, 1596, 15129, 1608, 1641, 198, 1646, 1673, 1680, - 1697, 1718, 1724, 1726, 1728, 179, 1730, 1732, 1743, 1750, - 1770, 1772, -3295, 1774, 205, 1786, 239, 1438, 15129, 1788, - -3295, 150, 48616, 32, -3295, -3295, 1801, 221, -3295, 48867, - -3295, 1815, 1605, 1621, 69762, 1557, 59582, 1662, 1202, 1897, - 1966, 1782, -3295, 1867, 59582, 1790, 2981, 1797, 1551, 2031, - 1800, 2041, 1804, 1237, 1805, 1559, -3295, 73834, 50974, -3295, - -3295, -3295, -3295, -3295, 1936, 1918, 69762, 50974, 1561, -3295, - -3295, 69762, -3295, 59582, 59582, -3295, 59582, 69762, -3295, 694, - 48616, 2081, 131, 76856, 51992, -3295, -3295, -3295, -3295, 444, - 562, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - 1115, 50974, -3295, 3327, 47487, 1571, 21003, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, 1572, 1922, - -3295, -3295, 6933, 1577, 47564, 1588, 26343, 26343, 565, 1833, - -3295, -3295, 26343, 1591, 52501, 47434, 1566, 1593, 47821, 17265, - 21003, 17265, 17265, 47958, -3295, 1599, 48010, 64672, 1581, 59582, - 30515, -3295, -3295, -3295, 21003, 21003, 2495, 58579, 1628, 1603, - -3295, 1606, 1464, -3295, 34057, -3295, 34057, -3295, 1899, 34057, - -3295, -3295, 4506, -3295, 34057, 1913, 21003, 34057, -3295, 34057, - 1846, 1859, 1619, 34057, 1464, 59582, 1620, 59582, -3295, -3295, - 48616, -3295, 1622, 727, 1623, -3295, -3295, -3295, -3295, -3295, - -3295, 1679, -3295, -3295, 1679, 1679, -3295, -3295, -3295, -3295, - 1624, 1624, 1634, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, 1639, 1008, -3295, 1679, - -3295, 1624, -3295, -3295, -3295, -3295, -3295, -3295, -3295, 75855, - -3295, -3295, -3295, -3295, 350, 645, -3295, 1640, -3295, -3295, - -3295, 1642, -3295, 1643, 2132, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, 8165, 739, 1624, -3295, -3295, 1975, - -3295, -3295, 21003, 21003, -3295, -3295, 1648, 48616, 1688, -3295, - -3295, 21003, 21003, -3295, -3295, -3295, -3295, 2168, -3295, 196, - 21003, 1679, 1679, -3295, 2991, -3295, 43732, 17799, 1744, 1751, - 2168, -3295, 2168, -3295, 21003, 2991, 2170, 2170, 1660, 38641, - -3295, 1831, 48091, -3295, 1666, 2242, 7772, 1663, -3295, -3295, - 2175, -3295, 1664, 1665, 21003, 45383, 195, 565, 565, 21003, - -3295, 2168, 21003, 6176, 6176, -3295, 210, 58085, 21003, 21003, - 21003, 21003, 21003, 21003, 21003, 21003, 49447, 1761, 223, 69762, - 21003, 21003, 30001, 1677, -3295, 21003, 1916, -3295, 1685, 21003, - 1763, 1079, 21003, 21003, 21003, 21003, 21003, 21003, 21003, 21003, - 21003, -3295, -3295, 29487, 265, 669, 2023, 2049, -31, 421, - 21003, 2042, 12479, -3295, 2042, -3295, -3295, -3295, -3295, -3295, - 238, -3295, -3295, 1622, 1622, 69762, -3295, 59582, 292, 55031, - 21003, -3295, -3295, 1683, 1690, 1988, 2179, 1754, -3295, -3295, - 59582, 1755, -3295, 42204, 2003, -3295, 351, 1692, -3295, 47416, - 1954, 2003, 955, -3295, -3295, 26877, 1828, 1998, 1934, -3295, - -3295, 1914, 1921, -3295, 1700, 48945, 22071, 22071, -3295, 1373, - 48616, 1397, -3295, -3295, -3295, -3295, -3295, -3295, 632, -3295, - 59582, 119, 39150, -3295, 1711, 133, -3295, 2038, 2058, 2024, - 1838, 913, 1716, -3295, 60091, 60091, -3295, -3295, -3295, 1889, - 69762, 1734, 1722, 74343, 59582, 2026, 1976, 2028, -43, 58085, - -3295, 1729, -3295, -3295, -3295, 59582, 69762, 68744, 74852, 51483, - 59582, 2212, 2216, 50974, -3295, -3295, 2224, 2228, -3295, -3295, - 59582, 495, 59582, 6962, -3295, -3295, -3295, -3295, 252, -3295, - -3295, -3295, -3295, -3295, 69762, 59582, -3295, -3295, 252, 69762, - 59582, 252, -3295, 1764, 59582, 59582, 69762, 59582, 1906, 59582, - 59582, 1115, 1713, -3295, 50974, -3295, -3295, 22605, 52, 52, - 1963, 1996, 2002, 1771, 13547, 150, -3295, 21003, 21003, 354, - 336, 69762, 1950, -3295, -3295, 750, 1999, 118, -3295, 69762, - 1813, 59582, 59582, 59582, 59582, 59582, 59582, 1511, -3295, -3295, - -3295, -3295, -3295, 2154, 2306, 1784, 1785, 2156, -3295, 2981, - 2163, 54028, 826, 3313, 2164, 59088, 2167, 1832, 2171, 32045, - -3295, -3295, 1794, -3295, -3295, 1796, 2283, 2050, -3295, -3295, - 2034, -3295, 69762, 2328, -3295, 123, -3295, 50974, -3295, 245, - -3295, 2043, 424, -3295, 15129, 21003, -3295, -3295, -3295, -3295, - -3295, -3295, 1350, 21003, -3295, 778, -3295, -3295, 2295, 1115, - 2295, 536, -3295, -3295, 2295, -3295, 2279, 2295, -3295, 58085, - -3295, 8363, -3295, 21003, 21003, -3295, 21003, 2166, -3295, 2334, - 2334, 58085, 26343, 26343, 26343, 26343, 26343, 26343, 813, 1427, - 26343, 26343, 26343, 26343, 26343, 26343, 26343, 26343, 26343, 27411, - 440, -3295, -3295, 780, 2305, 21003, 21003, 2182, 2166, 21003, - -3295, 58085, 1829, -3295, 1830, 1835, 21003, -3295, 58085, -3295, - 59582, 1836, -3295, -3295, -3295, 27, 1834, 1842, -3295, -3295, - 1675, -3295, 949, 1006, 59582, 1649, 2236, 3005, -3295, -3295, - 21003, 2177, -3295, -22, -3295, 4506, 4506, 34057, -3295, 21003, - 1847, -3295, -3295, 34057, 2192, -3295, 4506, -3295, -3295, 39659, - 4506, -3295, 58085, 788, -3295, 59582, 58085, 810, 21003, -3295, - 15129, 2363, 58085, 2337, 69762, 69762, 2377, 1857, 1860, 1857, - 2168, 1959, -3295, 1964, 1967, 1969, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, 58085, -3295, -3295, 327, - -3295, -3295, -3295, -3295, -3295, -3295, 1861, 1862, 21003, 21003, - 122, -3295, 8444, 1864, 1865, 21003, 48345, -3295, 1869, -3295, - 1866, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, 1878, -3295, - 1884, -3295, 1885, 1901, 1905, 1888, 1891, 8557, 21003, 59582, - -3295, 1900, 23139, 2059, 59582, -3295, -3295, 21003, 21003, 59582, - -3295, 48616, 2277, -3295, 1907, 1909, 8961, -3295, -3295, -3295, - 254, 412, 3909, 421, 4000, 4000, 4000, 2991, -3295, -3295, - -3295, 1924, -3295, 26343, 26343, -3295, 2417, 3326, 11411, -3295, - -3295, -3295, -3295, 2270, -3295, 1056, -3295, 1923, -3295, -3295, - 3371, -3295, 43732, 8191, 21003, 229, -3295, 21003, 30001, 21003, - 2009, 4000, 4000, 4000, 398, 398, 254, 254, 254, 412, - 421, -3295, -3295, -3295, 1925, 21003, 50974, -3295, 1929, 1931, - 2298, 1431, 21003, -3295, -3295, 34057, 1628, 32, 1628, 2168, - 6176, -3295, 1035, -3295, 1035, -3295, 48616, 59582, -3295, 1932, - 583, 34057, 1965, 2420, 2398, 34057, 69762, -3295, -3295, 1937, - 2042, 1956, -3295, -3295, 1957, 21003, 1758, 1957, -3295, 2003, - 34, 2176, 962, 962, 1373, 2178, -3295, -3295, 2011, -3295, - -3295, -3295, 21003, 15663, 1442, -3295, 1446, -3295, -3295, -3295, - -3295, -3295, 1944, -3295, 2219, -3295, 59582, -3295, -3295, 26343, - 2407, 21003, 40168, 2419, 2209, -3295, -3295, -3295, 2005, 2005, - -3295, -3295, 2045, -3295, 2046, 1493, 21003, 2202, -3295, 329, - 1973, 2338, 341, 2286, 69762, -3295, -3295, -3295, 316, 342, - 50974, 1729, -3295, -3295, 224, 2339, 424, 2341, 424, 50974, - 50974, 50974, 815, -3295, -3295, -3295, 1115, -3295, -3295, -3295, - 317, 816, -3295, 1974, 1977, -3295, -3295, -3295, 2056, 1725, - 1493, 2981, -3295, -3295, -3295, -3295, -3295, -3295, -3295, 190, - 1792, 1493, 2064, -3295, 2068, -3295, 2071, 1935, 1493, -3295, - -3295, 1713, 1514, 830, 18333, 48616, 208, 150, 150, 150, - -3295, -3295, -3295, 15129, -3295, 1983, 48616, 48616, 146, -3295, - -3295, -3295, -3295, 1985, -3295, 178, -3295, 69762, -3295, -3295, - -3295, 1950, 1966, 1867, 59582, 2981, 1986, 2474, 2475, 1237, - 1559, -3295, 2157, 37, 69762, -3295, 50974, 69762, 59582, 59582, - 59582, 54537, -3295, -3295, -3295, 1990, 1991, -3295, 47, 2229, - 2222, 59582, 2037, 59582, 2001, -3295, -3295, 59582, 2008, 2489, - 59582, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, 831, -3295, 58085, -3295, 1559, - 1559, 18867, 2385, 59582, 1918, -3295, -3295, -3295, -3295, 69762, - -3295, -3295, 48616, -3295, 48616, -3295, -3295, 50974, -3295, 1115, - -3295, 1115, 2255, 69762, 45892, 1115, 46401, 1115, 2012, -3295, - 48616, 9074, 48616, 2182, -3295, 260, 2334, 811, 811, 811, - 3261, 2368, 249, 2019, 811, 811, 811, 333, 333, 260, - 260, 260, 2334, 440, 980, 52501, 2021, -3295, 48616, 48616, - -3295, -3295, 2022, -3295, -3295, -3295, -3295, 2027, 2036, -3295, - -3295, -3295, -3295, 69762, 186, 1628, 525, 525, 525, 525, - -3295, 59582, 59582, 59582, 48616, 2490, 2364, -3295, -3295, 2549, - 2039, -3295, -3295, 4506, 48616, 59582, -3295, 28459, -3295, 59582, - -3295, 2397, -3295, 2486, -3295, 59582, 848, -3295, -3295, -3295, - 867, 2044, 1857, 58085, 868, 869, -3295, 152, 2168, 2047, - 1556, 1544, 938, 1443, -3295, 56049, -3295, -3295, 2048, 48422, - 21003, -3295, 2429, -3295, -3295, -3295, 48616, 21003, 21003, -3295, - 43732, -3295, -3295, -3295, -3295, -81, -81, -3295, 9493, 1900, - 2051, 2053, 59582, 11411, 48536, -3295, 40677, -3295, 73, 9629, - 48616, -3295, 1831, -3295, -3295, 6176, 21003, 3078, 5169, 21003, - 2055, 21003, 2405, -3295, -3295, 2052, -3295, -3295, 58085, 21003, - 2062, 3889, 26343, 26343, 4426, -3295, 4459, 21003, 11411, -3295, - 44397, 2566, 2066, 1963, 19401, -3295, 2289, 2060, -3295, 2177, - 150, 2177, 2069, -3295, -3295, -3295, 69762, -3295, 2345, 2072, - -3295, 21003, 2234, 69762, 557, 2266, 4506, 873, -3295, 565, - 42204, 1965, 21003, 250, -3295, -3295, 2074, -3295, 1957, -3295, - -3295, -3295, 2308, -3295, -3295, -3295, 59582, -3295, 2079, -3295, - 39150, 2426, 11945, -3295, 39150, 59582, -3295, -3295, 69762, 59582, - 9796, 2456, -3295, 69762, 69762, 69762, -3295, 69762, 2082, 2088, - 1024, 2091, 814, -3295, 2406, -3295, -3295, 1024, 2442, 279, - 2008, 290, 3000, 473, -3295, -3295, -3295, 2173, 59582, -3295, - 69762, -3295, -3295, -3295, -3295, -3295, 51483, -3295, -3295, 43222, - 50974, -3295, 50974, 21003, 21003, 59582, 59582, 59582, 59582, 69762, - 59582, 59582, 59582, 59582, 59582, 1514, -3295, -3295, 21003, 21003, - -3295, 2092, 2093, 2096, 1963, -3295, 206, -3295, 2097, -3295, - -3295, 21003, -3295, -85, -3295, -3295, 178, 2098, 2100, -3295, - 54028, 2223, 59088, 1832, -3295, 1796, 1966, 1044, 69253, 1867, - 21003, -3295, 874, 884, 2981, 2101, 2591, -3295, -3295, -3295, - 826, 54028, -3295, -3295, -3295, 2546, -3295, 812, 259, -3295, - 2593, 1406, -3295, 1237, -3295, 2223, 1559, -3295, 32539, 1821, - -3295, -3295, 2594, -3295, 2595, 2223, 48616, 69762, 2172, -3295, - 424, -3295, -3295, -3295, 69762, 2105, -3295, 2105, -3295, -3295, - 2105, -3295, -3295, -3295, -3295, 26343, 2464, 2112, 58085, -3295, - -3295, 59582, -3295, -3295, -3295, 894, 2113, 2177, 59582, 59582, - 59582, 59582, -3295, -3295, -3295, 19935, 21003, 2152, 21003, -3295, - -3295, 2114, 14081, 2443, -3295, 27945, -3295, -3295, 2116, 39659, - 69762, -3295, -3295, -3295, -3295, 2168, -3295, -3295, 69762, -3295, - -3295, 2125, 2126, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - -3295, -3295, 21003, 48616, -3295, 48616, -3295, -3295, -3295, -3295, - -3295, 59582, -3295, -3295, 7617, -3295, 2124, 2129, 69762, 59582, - 128, -3295, 21003, -3295, 2059, -3295, 452, 21003, 21003, 2417, - -3295, 10249, 21003, 58085, 902, 2417, 293, 21003, 5189, 5219, - 21003, 21003, 5372, 9902, -3295, 23673, 14595, -3295, 2136, 21003, - 10043, 42713, -3295, 34057, 2364, 2138, 2364, 1115, -3295, 2139, - 2137, -3295, -3295, 1975, 48616, 21003, -3295, -3295, -3295, -3295, - 2188, -5, 36093, 2378, -3295, 2191, 2161, 69762, -3295, 2234, - 48616, -3295, -3295, 43732, -3295, -3295, -3295, -3295, -3295, 2614, - 1917, 2150, 2159, -3295, 1370, -3295, -3295, -3295, 69762, 2160, - -3295, 2180, 1024, -3295, 69762, 2193, -3295, 269, 2483, 157, - -3295, 21003, -3295, 2577, 2658, 2406, 2174, 69762, 59582, 26343, - -3295, 285, 272, -3295, 2471, 59582, 2193, 2616, -3295, -3295, - -3295, 814, -3295, 2513, 2423, -3295, 252, -3295, 21003, 814, - 2425, 153, 69762, -3295, -3295, 2770, -3295, 58085, 424, 424, - -3295, 1623, 2181, 2186, 2187, 2190, 2194, 2197, 2199, 2201, - 2206, 2208, 2210, 2213, 2214, 2215, 2217, 2220, 2225, 2227, - 2230, 2240, 1639, 2243, -3295, 2244, 2074, 2245, 2246, 2247, - 2248, 2251, 75361, 2254, 2258, 2259, 2260, 1640, 2263, 2267, - 444, 562, -3295, -3295, -3295, -3295, -3295, -3295, 1306, 2268, - -3295, 2195, -3295, 2189, 904, -3295, -3295, 2281, -3295, 2292, - -3295, -3295, -3295, -3295, -3295, -3295, 2207, 2231, -3295, -3295, - -3295, 150, 2235, 2271, 69762, 10346, 1350, 121, 50974, 69762, - 2274, 2037, -3295, 2701, 771, 2466, 2221, 2278, -3295, 48616, - -3295, 50974, 1832, -3295, 54028, 3636, 664, 2222, 58085, -3295, - 737, 2037, -3295, 2644, 59088, -3295, 2276, 2264, 1832, 2309, - -3295, 1796, -3295, -3295, 21003, 21003, 2380, 21003, 160, -3295, - 2514, 69762, 2284, -3295, 2105, 4604, 26343, 58085, 952, 960, - -3295, 2804, 2455, 2364, -3295, -3295, -3295, -3295, -3295, 2290, - 439, 2291, 10877, 2294, -3295, -3295, -3295, -3295, -3295, -3295, - 48616, 48616, 69762, 2479, 48616, -3295, -3295, 2296, 2293, 41186, - 2767, 2300, -3295, -3295, 2629, -3295, 31536, -3295, 1857, 2310, - 1857, 58085, 1857, -3295, -3295, 48616, 1900, 21003, -3295, -3295, - -3295, 2304, 2303, 69762, 44667, 2645, -3295, 2417, 2417, 10249, - 961, -3295, 2417, 21003, 21003, 2417, 2417, 21003, -3295, 20469, - 231, -3295, 969, -3295, 44249, -3295, 76349, -3295, -3295, 2152, - 1115, 2152, -3295, -3295, 69762, 2311, 2313, -3295, -3295, -3295, - 2366, -3295, -3295, 990, 2759, 2234, 191, -3295, -3295, 2191, - 2234, 21003, -3295, -3295, 2323, 39150, -3295, -3295, -3295, -3295, - 39150, 1024, -3295, 2501, 2193, 2330, -3295, -3295, -3295, -3295, - -3295, -3295, 44267, -3295, 79, 21003, -3295, 1001, 3261, -3295, - -3295, -3295, -3295, 2193, 1237, -3295, 59582, 2823, 2712, -3295, - -3295, 48616, -3295, -3295, 2168, 2168, -3295, -3295, 2486, -3295, - -3295, 2340, 1306, 401, 43222, -3295, -3295, 59582, 59582, -3295, - -3295, 2342, -3295, -3295, -3295, -3295, -3295, -3295, -85, 2742, - 996, 1015, 826, -3295, 2223, 59582, 2721, 54028, 50974, -3295, - 2835, 2353, 59582, 2037, 1178, 1178, -3295, 2510, -3295, 2517, - -3295, -3295, -3295, -3295, 1115, 2848, 301, -3295, 48616, 48616, - 1414, 59582, -3295, -3295, 35584, 4604, 1023, -3295, -3295, 2367, - 2371, -3295, 2152, 21003, 2372, 21003, -3295, 24207, 2860, 2373, - -3295, 21003, 2436, 28973, -3295, 21003, -3295, 59582, 64672, 2376, - 64672, -3295, -3295, -3295, -3295, 59582, -3295, -3295, -3295, 21003, - -3295, 2417, 2417, 2417, 21003, 21003, -3295, -3295, -3295, -3295, - 2592, 2479, -3295, 2479, -3295, -3295, 21003, 2223, 565, 3646, - 69762, 12, -3295, 2869, 2657, -3295, -3295, 48616, -3295, -3295, - -3295, 59582, -3295, 50974, -3295, 1024, 8, 2384, 21003, 44302, - 2628, -3295, -3295, 2662, -3295, 2723, -3295, 2450, 630, 2468, - -3295, -3295, -3295, -3295, 1350, 1115, -3295, 1832, 2222, 2309, - 2392, 59582, 1029, 2223, 826, 812, -3295, -3295, -3295, -3295, - -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, -3295, - 2223, 2846, 2624, 2850, -3295, 2172, 21003, 110, -3295, 1033, - 2842, -3295, -3295, 2915, 2479, 2399, 24207, 2401, -3295, 2403, - 69762, 48616, 2555, -3295, -3295, 2413, -3295, -3295, 21003, -3295, - -3295, 44878, 2408, 2416, 2874, 1963, 2436, 2436, -3295, -5, - -3295, -3295, 2852, 35584, 2810, 21003, 2511, 2889, 1237, 1024, - 2433, 1045, -3295, -3295, -3295, -3295, -3295, 2981, -3295, 44320, - 2673, 601, 2659, 2384, 21003, -3295, 2502, -3295, -3295, -3295, - 2914, -3295, -3295, 54028, 2428, -3295, 2309, 2222, 2037, 2309, - 2660, -3295, 2668, 2439, 44355, 69762, 69762, 1832, 35584, 69762, - 2448, 2436, -3295, 2449, -3295, -3295, -3295, 30515, -3295, 2457, - -3295, -3295, -3295, 21003, 169, -3295, -3295, 2496, 59582, 1075, - 82, 48616, 276, 434, 2869, 2662, 43222, -3295, 50974, 1028, - 8, 2765, -3295, -3295, -3295, -3295, 241, 2690, -3295, 2692, - -3295, 48616, -3295, 2223, 54028, -3295, -3295, -3295, -3295, -3295, - -3295, 35584, 2842, -3295, 351, -3295, 1628, -3295, 351, -3295, - -3295, -3295, -3295, -3295, 1566, 24741, 24741, 24741, 2461, 2223, - -3295, 1628, -3295, 2596, -3295, 2713, 21003, 129, 246, -3295, - -3295, -3295, 2557, 2659, -3295, -3295, -3295, -3295, -3295, 533, - 533, 2872, -3295, 2533, -3295, 2309, 1103, 69762, 1957, -3295, - 1957, 25809, 2626, 211, 47469, 2853, -3295, 2853, 2853, -3295, - -3295, -3295, 42204, -3295, -3295, 48616, 2525, 69762, 2488, 2531, - 41695, -3295, 276, -3295, -3295, 2984, -3295, 268, -3295, -3295, - -3295, 1832, 351, -3295, -3295, 2977, -3295, -3295, -3295, -3295, - -3295, 951, -3295, -3295, -3295, 1628, -3295, 1110, -3295, -3295, - 2491, -3295, -3295, -3295, 1024, -3295, -3295, -3295, 1628, 1957, - 25275, 2647, -3295, 2715, -3295, -3295, -3295, 21003, -3295, -3295, - -3295, -3295, -3295, 2498, -3295 + 7366, 651, 750, -3343, -3343, 195, 651, 53409, 70161, 95, + 651, 98, 2090, 55939, -3343, -3343, 50355, 6484, 651, 59981, + 77237, 361, 490, 33375, 540, 60490, -3343, -3343, -3343, 70161, + 59981, 60999, 651, 785, 70670, -3343, 651, 36431, 56448, 351, + -3343, 59981, 9, 294, 61508, 59981, 119, 885, 320, -3343, + -3343, -3343, -3343, -3343, 244, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, 181, -3343, 725, 182, 33375, 33375, 1988, + 389, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, 473, -3343, -3343, 745, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, 35921, -3343, -3343, -3343, -3343, -3343, -3343, + 71179, 62017, 59981, 62526, 56957, 63035, -3343, 724, 720, 1156, + 824, 186, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, 197, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, 658, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, 202, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, 815, -3343, 686, -3343, 225, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, 1067, -3343, -3343, 1117, + 2837, 59981, 942, 969, 871, -3343, 63544, -3343, 875, -3343, + -3343, 909, 1578, 1095, -3343, -3343, 57466, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, 50864, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, 1083, -3343, -3343, 912, -3343, + 278, -3343, -3343, 958, 922, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, 1006, -3343, -3343, -3343, 1021, 71688, + 64053, 64562, -3343, 883, 74, 2109, 7381, 77255, 32355, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, 473, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, 60490, 70161, 887, 891, 1274, 895, 34393, + 921, 36941, 934, 941, 1310, 968, 975, 980, 999, 294, + 32865, 1028, 815, 1543, 65071, 65071, -28, 33884, 3514, -3343, + 65071, 65580, -3343, 1053, -3343, 1156, -3343, -3343, -3343, -3343, + -55, 1045, -3343, 66089, 66089, 66089, 1069, 1356, 66089, -3343, + -3343, -3343, 1062, -3343, -3343, 1317, 20321, 20321, 72197, 72197, + 1156, 72197, 1107, 72197, -3343, -3343, 53, 824, -3343, 815, + -3343, -3343, 1988, -3343, -3343, 56448, -3343, -3343, 312, 1458, + 20321, 59981, 1104, -3343, 1113, 1104, 1118, 1123, 1131, -3343, + 7366, 1495, 1409, 1492, 57975, 944, 944, 1656, 944, 654, + 925, 1063, 3988, -3343, 648, -3343, 1190, -3343, 59981, 60490, + 1301, 1562, 1229, 1529, -3343, -3343, 1613, 1404, 1622, 1081, + 1431, 1638, 2156, 1640, 1127, 1665, 1212, 1677, 1693, 1780, + 69, -3343, 20321, 51373, 815, -3343, 11797, 20321, -3343, -3343, + -3343, 1397, -3343, -3343, -3343, -3343, -3343, 59981, 70161, 1304, + 1307, -3343, -3343, -3343, -3343, 2377, 1557, -3343, 72706, -3343, + -3343, 1361, 66598, 67107, 67616, 68125, 68634, 1753, -3343, -3343, + 1695, -3343, -3343, -3343, 1357, -3343, -3343, -3343, 273, 73215, + 1702, 1331, 92, -3343, 1712, 102, -3343, 1717, 1579, 14447, + -3343, 1515, -3343, -3343, -3343, 294, -3343, 571, -3343, -3343, + 46672, -3343, -3343, 77255, 1443, 1359, -3343, 20321, 20321, 1367, + 6946, 65071, 65580, 20321, 59981, -3343, 20321, 25661, 1374, 20321, + 20321, 12331, 20321, 30345, 65071, 3514, 1360, -3343, 825, -3343, + 59981, 1380, -3343, 1496, 1496, 785, 33375, 1699, 32865, 1496, + 1870, 1496, -3343, 989, 1703, 1630, -3343, 33375, 1630, 1048, + 1414, 1735, 1630, -3343, 653, 1738, 1870, 37450, 1439, -3343, + 1496, 1669, -3343, -3343, 20321, 14447, 58484, 1928, -3343, -3343, + -3343, -3343, 1734, -3343, 70161, 1447, -3343, -3343, -3343, -3343, + -3343, -3343, 910, 1973, 227, 2006, 20321, 227, 227, 1485, + 228, 228, -3343, 1697, 1506, -3343, 229, 1509, 1513, 2019, + 2041, 168, 59981, 166, 362, 227, 20321, -3343, 228, 1520, + 2046, 1525, 2050, 223, 240, -3343, 1536, 230, 20321, 20321, + 20321, 333, 20321, 10729, -3343, 51373, 2048, 59981, 217, -3343, + 815, 1542, 1156, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + 1544, -3343, 220, 6752, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, 1583, -3343, -3343, -3343, -3343, 1771, 20321, -3343, + -3343, 1548, 1699, -3343, 234, -3343, -3343, 1699, -3343, -3343, + -3343, -3343, -3343, 261, -3343, 1978, 20321, 20321, -3343, 815, + 73724, -3343, -3343, -3343, -3343, -3343, -3343, -3343, 780, -3343, + 473, 839, 48378, 1553, 1559, 1104, 59981, 59981, 1637, -3343, + -3343, -3343, -3343, 56448, 158, 1875, 56448, 167, 1711, -3343, + -3343, 1988, 1988, 15515, 769, 215, 926, 16049, 20855, 1946, + 1837, 250, 964, 1961, -3343, 1843, 2071, 25661, 20321, 20321, + 654, 925, 20321, 1113, 254, -3343, -3343, 59981, -3343, 1893, + 70161, 1694, 59981, 53918, 1079, 1208, 1607, 1696, 1, 1033, + 2043, -3343, 1612, -3343, 1701, 59981, 76254, 269, -3343, 2083, + 269, 269, 719, 2085, 1713, 280, 1885, 1098, -53, 1612, + 3591, -3343, 56448, 300, 1345, 1612, 59981, 1714, 1463, 1612, + 1693, 1156, 70161, 1631, -3343, -3343, 44334, 2139, -3343, -3343, + -3343, 192, 14447, -3343, 1320, 1441, 1574, 1582, -3343, 955, + 175, 1667, 1680, 14447, 1691, 1709, 196, 1721, 1732, 1761, + 1816, 1826, 1832, 1834, 1841, 190, 1846, 1872, 1879, 1898, + 1900, 1920, -3343, 1931, 206, 1937, 239, 1536, 14447, 1941, + -3343, 157, 48378, -10, -3343, -3343, 1944, 210, -3343, 48629, + -3343, 1942, 1725, 1728, 70161, 1682, 59981, 1784, 1689, 2020, + 2072, 1895, -3343, 1980, 59981, 1899, 3591, 1904, 1662, 2144, + 1912, 2153, 1916, 1307, 1921, 1675, -3343, 74233, 51373, -3343, + -3343, -3343, -3343, -3343, 2059, 2030, 70161, 51373, 1685, -3343, + -3343, 70161, -3343, 59981, 59981, -3343, 59981, 70161, -3343, 791, + 48378, 2203, 1365, 77255, 52391, -3343, -3343, -3343, -3343, 462, + 1254, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + 1156, 51373, -3343, 3341, 47249, 1690, 20321, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, 1704, 2044, + -3343, -3343, 6422, 1707, 47326, 1708, 25661, 25661, 815, 2851, + -3343, -3343, 25661, 1710, 52900, 47196, 1688, 1718, 47583, 16583, + 20321, 16583, 16583, 47720, -3343, 1719, 47772, 65071, 1698, 59981, + 29833, -3343, -3343, -3343, 20321, 20321, 3514, 58978, 1736, 1720, + -3343, 1722, 1496, -3343, 33375, -3343, 33375, -3343, 1994, 33375, + -3343, -3343, 3010, -3343, 33375, 1997, 20321, 33375, -3343, 33375, + 1938, 1943, 1723, 33375, 1496, 59981, 1729, 59981, -3343, -3343, + 48378, -3343, 1700, 866, 1716, -3343, -3343, -3343, -3343, -3343, + -3343, 1754, -3343, -3343, 1754, 1754, -3343, -3343, -3343, -3343, + 1731, 1731, 1739, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, 1743, 362, -3343, 1754, + -3343, 1731, -3343, -3343, -3343, -3343, -3343, -3343, -3343, 76254, + -3343, -3343, -3343, -3343, 726, 736, -3343, 1745, -3343, -3343, + -3343, 1746, -3343, 1726, 2200, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, 7064, 868, 1731, -3343, -3343, 1779, + -3343, -3343, 20321, 20321, -3343, -3343, 1748, 48378, 1756, -3343, + -3343, 20321, 20321, -3343, -3343, -3343, -3343, 2251, -3343, 156, + 20321, 1754, 1754, -3343, 48835, -3343, 43050, 17117, 1824, 1828, + 2251, -3343, 2251, -3343, 20321, 48835, 2266, 2266, 1751, 37959, + -3343, 1919, 47853, -3343, 1757, 1797, 8264, 1749, -3343, -3343, + 2264, -3343, 1755, 1762, 20321, 45145, 171, 815, 815, 20321, + -3343, 2251, 20321, 7993, 7993, -3343, 211, 58484, 20321, 20321, + 20321, 20321, 20321, 20321, 20321, 20321, 49337, 1853, 205, 70161, + 20321, 20321, 29319, 977, -3343, 20321, 2013, -3343, 1772, 20321, + 1861, 1143, 20321, 20321, 20321, 20321, 20321, 20321, 20321, 20321, + 20321, -3343, -3343, 28805, 249, 851, 2120, 2141, -13, 311, + 20321, 2134, 11797, -3343, 2134, -3343, -3343, -3343, -3343, -3343, + 235, -3343, -3343, 1700, 1700, 70161, -3343, 59981, 312, 55430, + 20321, -3343, -3343, 1781, 1787, 2089, 2279, 1857, -3343, -3343, + 59981, 1862, -3343, 41522, 2102, -3343, 330, 1796, -3343, 47178, + 2060, 2102, 1988, -3343, -3343, 26195, 1939, 2106, 2040, -3343, + -3343, 2021, 2022, -3343, 1806, 48707, 21389, 21389, -3343, 1585, + 48378, 1608, -3343, -3343, -3343, -3343, -3343, -3343, 855, -3343, + 59981, 139, 38468, -3343, 1807, 140, -3343, 5721, 2162, 2125, + 1946, 964, 1819, -3343, 60490, 60490, -3343, -3343, -3343, 1990, + 70161, 1418, 1823, 74742, 59981, 2123, 2092, 2140, 391, 58484, + -3343, 1840, -3343, -3343, -3343, 59981, 70161, 69143, 75251, 51882, + 59981, 2311, 2313, 49846, -3343, -3343, 2314, 2315, -3343, -3343, + 59981, 1261, 59981, 7552, -3343, -3343, -3343, -3343, 269, -3343, + -3343, -3343, -3343, -3343, 70161, 59981, -3343, -3343, 269, 70161, + 59981, 269, -3343, 1473, 59981, 59981, 70161, 59981, 1611, 59981, + 59981, 1156, 1780, -3343, 51373, -3343, -3343, 21923, 37, 37, + 2076, 2094, 2095, 1849, 12865, 157, -3343, 20321, 20321, 363, + 270, 70161, 2039, -3343, -3343, 888, 2098, 336, -3343, 70161, + 1905, 59981, 59981, 59981, 59981, 59981, 59981, 1692, -3343, -3343, + -3343, -3343, -3343, 2230, 2384, 1864, 1865, 2240, -3343, 3591, + 2241, 54427, 971, 2091, 2254, 59487, 2262, 1930, 2265, 31363, + -3343, -3343, 1889, -3343, -3343, 1891, 2385, 2145, -3343, -3343, + 2137, -3343, 70161, 2435, -3343, 92, -3343, 51373, -3343, 102, + -3343, 2146, 222, -3343, 14447, 20321, -3343, -3343, -3343, -3343, + -3343, -3343, 1359, 20321, -3343, 898, -3343, -3343, 2402, 1156, + 2402, 572, -3343, -3343, 2402, -3343, 2387, 2402, -3343, 58484, + -3343, 8571, -3343, 20321, 20321, -3343, 20321, 2270, -3343, 2434, + 2434, 58484, 25661, 25661, 25661, 25661, 25661, 25661, 668, 1520, + 25661, 25661, 25661, 25661, 25661, 25661, 25661, 25661, 25661, 26729, + 318, -3343, -3343, 902, 2407, 20321, 20321, 2283, 2270, 20321, + -3343, 58484, 1924, -3343, 1925, 1927, 20321, -3343, 58484, -3343, + 59981, 1934, -3343, -3343, -3343, 38, 1932, 1936, -3343, -3343, + 1699, -3343, 1051, 1057, 59981, 2590, 4012, 4979, -3343, -3343, + 20321, 2275, -3343, -1, -3343, 3010, 3010, 33375, -3343, 20321, + 1940, -3343, -3343, 33375, 2296, -3343, 3010, -3343, -3343, 38977, + 3010, -3343, 58484, 918, -3343, 59981, 58484, 924, 20321, -3343, + 14447, 2464, 58484, 2430, 70161, 70161, 2468, 1947, 1949, 1947, + 2251, 2037, -3343, 2042, 2045, 2049, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, 58484, -3343, -3343, 103, + -3343, -3343, -3343, -3343, -3343, -3343, 1951, 1954, 20321, 20321, + 160, -3343, 8932, 1955, 1957, 20321, 48107, -3343, 1958, -3343, + 1956, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, 1953, -3343, + 1971, -3343, 1974, 1993, 1995, 1976, 1979, 9129, 20321, 59981, + -3343, 1983, 22457, 2150, 59981, -3343, -3343, 20321, 20321, 59981, + -3343, 48378, 2360, -3343, 1985, 1991, 9262, -3343, -3343, -3343, + 247, 371, 48726, 311, 4046, 4046, 4046, 48835, -3343, -3343, + -3343, 2014, -3343, 25661, 25661, -3343, 5015, 3279, 10729, -3343, + -3343, -3343, -3343, 2343, -3343, 1263, -3343, 1999, -3343, -3343, + 3307, -3343, 43050, 6787, 20321, 214, -3343, 20321, 29319, 20321, + 2088, 4046, 4046, 4046, 355, 355, 247, 247, 247, 371, + 311, -3343, -3343, -3343, 2001, 20321, 51373, -3343, 2002, 2007, + 2381, 1525, 20321, -3343, -3343, 33375, 1736, -10, 1736, 2251, + 7993, -3343, 1113, -3343, 1113, -3343, 48378, 59981, -3343, 2016, + 822, 33375, 2055, 2504, 2488, 33375, 70161, -3343, -3343, 2023, + 2134, 2051, -3343, -3343, 2047, 20321, 2678, 2047, -3343, 2102, + 16, 2263, 1273, 1273, 1585, 2267, -3343, -3343, 2097, -3343, + -3343, -3343, 20321, 14981, 1657, -3343, 1670, -3343, -3343, -3343, + -3343, -3343, 2026, -3343, 2318, -3343, 59981, -3343, -3343, 25661, + 2502, 20321, 39486, 2510, 2300, -3343, -3343, -3343, 2093, 2093, + -3343, -3343, 2135, -3343, 2136, 1612, 20321, 2294, -3343, 125, + 2052, 2423, 448, 2373, 70161, -3343, -3343, -3343, 381, 666, + 51373, 1840, -3343, -3343, 967, 2428, 222, 2431, 222, 51373, + 51373, 51373, 939, -3343, -3343, -3343, 1156, -3343, -3343, -3343, + 2067, 628, 949, -3343, 2058, 2061, -3343, -3343, -3343, 2147, + 1636, 1612, 3591, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + 337, 1648, 1612, 2152, -3343, 2154, -3343, 2155, 1855, 1612, + -3343, -3343, 1780, 1631, 950, 17651, 48378, 219, 157, 157, + 157, -3343, -3343, -3343, 14447, -3343, 2064, 48378, 48378, 148, + -3343, -3343, -3343, -3343, 2068, -3343, 189, -3343, 70161, -3343, + -3343, -3343, 2039, 2072, 1980, 59981, 3591, 2074, 2547, 2562, + 1307, 1675, -3343, 2245, 474, 70161, -3343, 51373, 70161, 59981, + 59981, 59981, 54936, -3343, -3343, -3343, 2079, 2077, -3343, 15, + 2317, 2316, 59981, 2122, 59981, 2105, -3343, -3343, 59981, 2107, + 2576, 59981, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, 966, -3343, 58484, -3343, + 1675, 1675, 18185, 2466, 59981, 2030, -3343, -3343, -3343, -3343, + 70161, -3343, -3343, 48378, -3343, 48378, -3343, -3343, 51373, -3343, + 1156, -3343, 1156, 2340, 70161, 45654, 1156, 46163, 1156, 2101, + -3343, 48378, 9340, 48378, 2283, -3343, 274, 2434, 2607, 2607, + 2607, 1842, 2460, 207, 2108, 2607, 2607, 2607, 369, 369, + 274, 274, 274, 2434, 318, 1053, 52900, 2110, -3343, 48378, + 48378, -3343, -3343, 2111, -3343, -3343, -3343, -3343, 2114, 2115, + -3343, -3343, -3343, -3343, 70161, 208, 1736, 351, 351, 351, + 351, -3343, 59981, 59981, 59981, 48378, 2577, 2451, -3343, -3343, + 2631, 2117, -3343, -3343, 3010, 48378, 59981, -3343, 27777, -3343, + 59981, -3343, 2480, -3343, 2569, -3343, 59981, 1000, -3343, -3343, + -3343, 1010, 2127, 1947, 58484, 1036, 1049, -3343, 159, 2251, + 2128, 1791, 1250, 983, 1678, -3343, 56448, -3343, -3343, 2129, + 48184, 20321, -3343, 2507, -3343, -3343, -3343, 48378, 20321, 20321, + -3343, 43050, -3343, -3343, -3343, -3343, 452, 452, -3343, 9649, + 1983, 2130, 2138, 59981, 10729, 48298, -3343, 39995, -3343, 43, + 43567, 48378, -3343, 1919, -3343, -3343, 7993, 20321, 1883, 5617, + 20321, 2142, 20321, 2485, -3343, -3343, 2151, -3343, -3343, 58484, + 20321, 2158, 3843, 25661, 25661, 4784, -3343, 5082, 20321, 10729, + -3343, 44388, 2647, 2157, 2076, 18719, -3343, 2364, 2164, -3343, + 2275, 157, 2275, 2172, -3343, -3343, -3343, 70161, -3343, 2426, + 2175, -3343, 20321, 2337, 70161, 604, 2333, 3010, 1093, -3343, + 815, 41522, 2055, 20321, 246, -3343, -3343, 2178, -3343, 2047, + -3343, -3343, -3343, 2388, -3343, -3343, -3343, 59981, -3343, 2179, + -3343, 38468, 2500, 11263, -3343, 38468, 59981, -3343, -3343, 70161, + 59981, 43585, 2553, -3343, 70161, 70161, 70161, -3343, 70161, 2177, + 2181, 869, 2183, 1086, -3343, 1929, -3343, -3343, 869, 2534, + 293, 2107, 280, 5893, 84, -3343, -3343, -3343, 2268, 59981, + -3343, 70161, -3343, -3343, -3343, -3343, -3343, 51882, -3343, -3343, + 20321, 20321, 51373, -3343, 49846, 20321, 20321, 59981, 59981, 59981, + 59981, 70161, 59981, 59981, 59981, 59981, 59981, 1631, -3343, -3343, + 20321, 20321, -3343, 2184, 2186, 2188, 2076, -3343, 412, -3343, + 2190, -3343, -3343, 20321, -3343, -53, -3343, -3343, 189, 2194, + 2195, -3343, 54427, 2837, 59487, 1930, -3343, 1891, 2072, 748, + 69652, 1980, 20321, -3343, 1119, 1157, 3591, 2197, 2677, -3343, + -3343, -3343, -3343, 54427, -3343, -3343, -3343, 2639, -3343, 883, + 287, -3343, 2686, 814, -3343, 1307, -3343, 2837, 1675, -3343, + 31857, 2054, -3343, -3343, 2687, -3343, 2689, 2837, 48378, 70161, + 2273, -3343, 222, -3343, -3343, -3343, 70161, 2199, -3343, 2199, + -3343, -3343, 2199, -3343, -3343, -3343, -3343, 25661, 2558, 2205, + 58484, -3343, -3343, 59981, -3343, -3343, -3343, 1158, 2206, 2275, + 59981, 59981, 59981, 59981, -3343, -3343, -3343, 19253, 20321, 2248, + 20321, -3343, -3343, 2209, 13399, 2540, -3343, 27263, -3343, -3343, + 2213, 38977, 70161, -3343, -3343, -3343, -3343, 2251, -3343, -3343, + 70161, -3343, -3343, 2216, 2218, -3343, -3343, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, 20321, 48378, -3343, 48378, -3343, -3343, + -3343, -3343, -3343, 59981, -3343, -3343, 7913, -3343, 2215, 2219, + 70161, 59981, 112, -3343, 20321, -3343, 2150, -3343, 388, 20321, + 20321, 5015, -3343, 7832, 20321, 58484, 1233, 5015, 323, 20321, + 5852, 5882, 20321, 20321, 5283, 43620, -3343, 22991, 13913, -3343, + 2220, 20321, 43638, 42031, -3343, 33375, 2451, 2222, 2451, 1156, + -3343, 2223, 2221, -3343, -3343, 1779, 48378, 20321, -3343, -3343, + -3343, -3343, 2282, 401, 35411, 2463, -3343, 2280, 2250, 70161, + -3343, 2337, 48378, -3343, -3343, 43050, -3343, -3343, -3343, -3343, + -3343, 2705, 2148, 2239, 2246, -3343, 1604, -3343, -3343, -3343, + 70161, 2247, -3343, 2253, 869, -3343, 70161, 2289, -3343, 284, + 2563, 161, -3343, 20321, -3343, 2668, 2749, 1929, 2272, 70161, + 59981, 25661, -3343, 687, 199, -3343, 2564, 59981, 2289, 2702, + -3343, -3343, -3343, 1086, -3343, 2600, 2511, -3343, 269, -3343, + 20321, 1086, 2513, 138, 70161, -3343, -3343, 2491, -3343, 58484, + 222, 222, -3343, 48378, 48378, 2285, -3343, 2278, 1239, -3343, + -3343, 2368, -3343, 2372, -3343, -3343, -3343, -3343, -3343, -3343, + 2286, 2287, -3343, -3343, -3343, 157, 2288, 2290, 70161, 43673, + 1359, 124, 51373, 70161, 2291, 2122, -3343, 2774, 729, 2538, + 2293, 2297, -3343, 48378, -3343, 51373, 1930, -3343, 54427, 3433, + 781, 862, 58484, -3343, 193, 2122, -3343, 2716, 59487, -3343, + 2301, 2302, 1930, 2336, -3343, 1891, -3343, -3343, 20321, 20321, + 2405, 20321, 150, -3343, 2543, 70161, 2305, -3343, 2199, 6031, + 25661, 58484, 1251, 1253, -3343, 2820, 2482, 2451, -3343, -3343, + -3343, -3343, -3343, 2321, 407, 2322, 10195, 2323, -3343, -3343, + -3343, -3343, -3343, -3343, 48378, 48378, 70161, 2501, 48378, -3343, + -3343, 2325, 2324, 40504, 2785, 2329, -3343, -3343, 2645, -3343, + 30854, -3343, 1947, 2327, 1947, 58484, 1947, -3343, -3343, 48378, + 1983, 20321, -3343, -3343, -3343, 2328, 2335, 70161, 44589, 2674, + -3343, 5015, 5015, 7832, 1255, -3343, 5015, 20321, 20321, 5015, + 5015, 20321, -3343, 19787, 242, -3343, 1257, -3343, 43715, -3343, + 76748, -3343, -3343, 2248, 1156, 2248, -3343, -3343, 70161, 2347, + 2346, -3343, -3343, -3343, 2397, -3343, -3343, 1259, 2787, 2337, + 685, -3343, -3343, 2280, 2337, 20321, -3343, -3343, 2351, 38468, + -3343, -3343, -3343, -3343, 38468, 869, -3343, 2531, 2289, 2358, + -3343, -3343, -3343, -3343, -3343, -3343, 43985, -3343, 83, 20321, + -3343, 1013, 1842, -3343, -3343, -3343, -3343, 2289, 1307, -3343, + 59981, 2846, 2734, -3343, -3343, 48378, -3343, -3343, 2251, 2251, + -3343, -3343, 2569, -3343, -3343, 42540, -3343, -3343, 59981, 59981, + -3343, -3343, 2363, -3343, -3343, -3343, -3343, -3343, -3343, -53, + 2769, 1264, 1266, -3343, -3343, 2837, 59981, 2741, 54427, 51373, + -3343, 2855, 2369, 59981, 2122, 379, 379, 2839, 2840, -3343, + 2316, 2522, -3343, 2526, -3343, -3343, -3343, -3343, 1156, 2862, + 313, -3343, 48378, 48378, 1506, 59981, -3343, -3343, 34902, 6031, + 1271, -3343, -3343, 2378, 2380, -3343, 2248, 20321, 2386, 20321, + -3343, 23525, 2865, 2383, -3343, 20321, 2442, 28291, -3343, 20321, + -3343, 59981, 65071, 2390, 65071, -3343, -3343, -3343, -3343, 59981, + -3343, -3343, -3343, 20321, -3343, 5015, 5015, 5015, 20321, 20321, + -3343, -3343, -3343, -3343, 2597, 2501, -3343, 2501, -3343, -3343, + 20321, 2837, 815, 2792, 70161, 3, -3343, 2879, 2666, -3343, + -3343, 48378, -3343, -3343, -3343, 59981, -3343, 51373, -3343, 869, + 390, 2396, 20321, 44196, 2641, -3343, -3343, 2675, -3343, 2736, + -3343, 2469, 1716, 2400, 2403, 2409, 2411, 2412, 2413, 2418, + 2420, 2421, 2424, 2432, 2438, 2439, 2440, 2444, 2446, 2449, + 2450, 2454, 2457, 1743, 2458, -3343, 2459, 2178, 2465, 2467, + 2470, 2471, 2472, 75760, 2473, 2474, 2475, 2476, 1745, 2477, + 2478, 462, 1254, -3343, -3343, -3343, -3343, -3343, -3343, 1331, + 2479, -3343, -3343, -3343, -3343, 1359, 1156, -3343, 1930, 862, + 2336, 2436, 59981, 1272, 2837, -3343, 883, -3343, -3343, -3343, + -3343, -3343, -3343, -3343, -3343, -3343, -3343, -3343, 2437, 2453, + -3343, -3343, -3343, -3343, 2837, 2860, 2660, 2921, -3343, 2273, + 20321, 88, -3343, 1277, 2856, -3343, -3343, 2990, 2501, 2483, + 23525, 2484, -3343, 2486, 70161, 48378, 2638, -3343, -3343, 2487, + -3343, -3343, 20321, -3343, -3343, 44640, 2492, 2494, 2964, 2076, + 2442, 2442, -3343, 401, -3343, -3343, 2942, 34902, 2903, 20321, + 2604, 2981, 1307, 869, 2525, 1278, -3343, -3343, -3343, -3343, + -3343, 3591, -3343, 44237, 2765, 188, 2750, 2396, 20321, -3343, + 2514, 1331, 721, -3343, -3343, 3006, 2316, -3343, 54427, 2521, + -3343, 2336, 862, 2122, 20321, 20321, 2336, 2752, -3343, 2753, + 2530, 44286, 70161, 70161, 1930, 34902, 70161, 2532, 2442, -3343, + 2533, -3343, -3343, -3343, 29833, -3343, 2537, -3343, -3343, -3343, + 20321, 201, -3343, -3343, 2582, 59981, 1279, 110, 48378, 191, + 378, 2879, 2675, 42540, -3343, 51373, 1671, 390, 2848, -3343, + -3343, -3343, -3343, 144, 2764, -3343, 2768, -3343, 48378, 783, + 2609, 2837, -3343, 54427, -3343, 2316, -3343, 2539, 2541, -3343, + -3343, -3343, 34902, 2856, -3343, 330, -3343, 1736, -3343, 330, + -3343, -3343, -3343, -3343, -3343, 1688, 24059, 24059, 24059, 2542, + 2837, -3343, 1736, -3343, 2679, -3343, 2788, 20321, 104, 341, + -3343, -3343, -3343, 2636, 2750, -3343, -3343, -3343, -3343, -3343, + 504, 504, 2950, -3343, 2612, -3343, 2627, -3343, 2336, -3343, + -3343, -3343, 1285, 70161, 2047, -3343, 2047, 25127, 2707, 173, + 47231, 2932, -3343, 2932, 2932, -3343, -3343, -3343, 41522, -3343, + -3343, 48378, 2613, 70161, 2566, 2615, 41013, -3343, 191, -3343, + -3343, 3059, -3343, 226, -3343, -3343, -3343, -3343, 1930, 330, + -3343, -3343, 3052, -3343, -3343, -3343, -3343, -3343, 272, -3343, + -3343, -3343, 1736, -3343, 1291, -3343, -3343, 2565, -3343, -3343, + -3343, 869, -3343, -3343, -3343, 1736, 2047, 24593, 2717, -3343, + 2791, -3343, -3343, -3343, 20321, -3343, -3343, -3343, -3343, -3343, + 2567, -3343 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -3295, -3295, -3295, 2140, 84, -3295, -3295, 258, -3295, -3295, - 692, -1729, -1733, 1193, -3295, 251, -758, 691, -3295, 87, - 4693, 2849, 4942, 617, -531, -916, -1266, 18, 89, -1171, - 3, -3295, -3295, -1872, -3295, -1556, -451, 320, -3295, -3295, - -595, -2703, -545, -3295, -3200, -3232, -711, -3295, -2677, -3165, - -2165, 100, -2587, -3295, -3295, 106, 17, -2228, -3295, -1768, - 64, -2183, -3295, -144, -2859, 109, 114, 1095, -3295, -2738, - 117, -910, -1248, -972, -1243, -3295, -40, -3295, -3295, 548, - 126, 1319, 2183, -3295, 19, -2283, -3037, -557, -3295, -673, - -3295, -299, -3295, -611, -3295, -901, -619, -660, -2977, -1186, - -3295, 1823, -351, -3295, 736, -3295, -2742, -3295, -3295, 719, - -3295, 1251, 1252, -3295, -3295, -2366, 222, -594, -2789, -2736, - -2297, -914, 313, -602, 286, -2221, -1299, -3295, 753, -3295, - -586, -3295, -923, -1975, 130, -3295, -3295, 1707, -954, -3295, - 132, -580, -3295, -3295, -677, -3295, -3295, -3295, -3295, -3295, - -242, 135, -3295, 592, -3295, -2263, 595, -2217, 1748, -642, - -3295, 233, 7, 10, -3295, -3295, -3295, -3295, -799, 671, - -1916, -3295, -3295, -3295, -3295, 277, 4, 3275, -41, -32, - -3295, -28, -3295, -3295, -3295, 793, -3295, -3295, 2, 51, - 1915, -3295, -3295, -3295, -3295, -1046, -3295, -1893, 566, -3295, - 2070, 2075, -1821, -891, -33, 315, 837, -1734, -2199, -620, - 1312, 1895, 1902, -3295, 543, -2735, -3295, -528, -3295, -721, - -3295, -3295, -3295, 2065, -3295, 828, 1359, -1552, -1550, -3295, - -2327, -3295, -443, -321, -3295, -3295, -3295, -3295, -3295, -2437, - -3063, -599, 1327, -3295, 1908, -3295, -3295, -3295, -3295, 62, - -1599, 3105, 871, -3295, 203, -3295, -3295, -3295, -3295, 212, - -3295, 1060, -133, -3295, -478, -702, -809, 2122, 147, 217, - -1911, -9, -375, 584, -3295, -3295, 586, -2160, -1466, 538, - -237, 1062, -3295, -2373, -1602, -3295, -1527, -1211, -3295, -3295, - -783, 1498, -3295, -3295, -3295, 2882, 2887, -3295, -3295, 3069, - 3471, -3295, -931, 3592, 1076, -1058, 2135, -973, 2141, -941, - -958, -955, 2143, 2145, 2146, 2147, 2149, 2151, 2153, -1581, - 5816, -959, 3798, -2280, -3295, -1447, -1624, -3295, -3295, -3295, - 50, -3295, -1430, 127, -3295, -3295, -3295, -3295, -2924, -3295, - -424, -3295, -420, -3295, -3295, -3295, -1845, -3294, -1884, -3295, - 4395, 981, -3295, -3295, 524, -3295, -3295, -3295, -3295, -1588, - -3295, 7216, 889, -3295, -2115, -3295, -3295, -1005, -874, -473, - -1035, -1256, -2000, -3295, -3295, -3295, -3295, -3295, -3295, -1188, - -1839, -234, 946, -3295, -3295, 1046, -3295, -3295, -147, -1519, - -1823, -2190, -3295, -3295, -3295, 953, 1682, 158, -848, -1680, - -3295, -1586, -3295, -3295, 1004, -2531, -3295, -3295, 510, -2806, - -3295, -3295, 215, -3295, -694, -1158, -2593, 46, 26, -3295, - 1121, -2691, -3295, -3295, -733, -2851, -1150, -951, -3295, 136, - -3295, 173, 138, -1757, -3295, 23, -3295, -372, -3295, -3295, - -2754, -3295, 142, 149, 2386, -3295, 1290, -3295, -3295, -3295, - -3295, -555, -3295, -652, 2198, -3295, -3295, 30, -3295, 1806, - -3295, 165, 394, -3295, 1116, -3295, 689, 170, -3295, 2312, - -444, 171, 1457, -3295, -3295, -3295, 11, -541, 481, -3295, - 1466, -3295, -3295, -662, -1724, -3295, 695, 1339, -2168, 175, - -3295, 447, 15, -3295, -3295, -3295, 76, 176, 24, -3131, - 177, -2845, -1759, -7, -3295, -3295, -3295, -635, -3295, -2694 + -3343, -3343, -3343, 2207, 82, -3343, -3343, 321, -3343, -3343, + 757, -1714, -1739, 1258, -3343, 315, -838, 756, -3343, 87, + 4288, 2915, 4447, 11, -530, -902, -1279, 5, 91, -1179, + 7, -3343, -3343, -1636, -3343, -1551, -341, 383, -3343, -3343, + -540, -2744, -487, -3343, -3191, -3290, -666, -3343, -2748, -3146, + -2173, 96, -2527, -3343, -3343, 100, 6, -2233, -3343, -1755, + 64, -2226, -3343, -37, -2831, 106, 109, 1155, -3343, -2752, + 117, -921, -1235, -925, -1245, -3343, 17, -3343, -3343, 606, + 127, 1197, 2269, -3343, 10, -2244, -556, -499, -3343, -609, + -3343, -178, -3343, -543, -3343, -828, -551, -595, -3075, -1170, + -3343, 1901, -226, -3343, 810, -3343, -3029, -3343, -2996, -3343, + -3343, 793, -3343, 1327, 1328, -3343, -3343, -2362, 296, -523, + -2772, -2740, -2321, -938, 392, -521, 360, -2222, -1216, -3343, + 837, -3343, -505, -3343, -920, -1813, 128, -3343, -3343, 1792, + -954, -3343, 134, -502, -3343, -3343, -607, -3343, -3343, -3343, + -3343, -3343, -111, 143, -3343, 675, -3343, -2245, 676, -2241, + 1830, -406, -3343, 306, 18, 23, -3343, -3343, -3343, -3343, + -667, 759, -1906, -3343, -3343, -3343, -3343, 354, 8, 516, + -41, -24, -3343, -19, -3343, -3343, -3343, 870, -3343, -3343, + 19, 58, 1987, -3343, -3343, -3343, -3343, -1077, -3343, -1887, + 659, -3343, 2149, 2161, -1820, -900, -2, 394, 911, -1702, + -2230, -478, 1386, 1970, 1972, -3343, 629, -2449, -3343, -451, + -3343, -641, -3343, -3343, -3343, 2159, -3343, 914, 1442, -1631, + -1618, -3343, -1857, -3343, -362, -192, -3343, -3343, -3343, -3343, + -3343, -2582, -3005, -455, 1410, -3343, 1989, -3343, -3343, -3343, + -3343, 233, -1600, 3188, 952, -3343, 136, -3343, -3343, -3343, + -3343, 289, -3343, 1145, -3, -3343, -500, -715, -815, 2208, + 265, 334, -1934, -12, 325, 667, -3343, -3343, 671, -2202, + -1474, 616, -105, 1144, -3343, -2378, -1582, -3343, -1531, -1228, + -3343, -3343, -778, 849, -3343, -3343, -3343, 1609, 1897, -3343, + -3343, 2527, 2777, -3343, -948, 2876, 1488, -1062, 2224, -972, + 2225, -968, -959, -956, 2226, 2229, 2232, 2233, 2235, 2237, + 2242, -1594, 5407, -958, 2271, -2343, -3343, -1449, -1628, -3343, + -3343, -3343, 60, -3343, -1447, 85, -3343, -3343, -3343, -3343, + -2809, -3343, -346, -3343, -343, -3343, -3343, -3343, -1608, -3342, + -1644, -3343, 4225, 1064, -3343, -3343, 592, -3343, -3343, -3343, + -3343, -1587, -3343, 6518, 973, -3343, -2111, -3343, -3343, -1008, + -863, -454, -1035, -1256, -2014, -3343, -3343, -3343, -3343, -3343, + -3343, -1571, -1875, -164, 1032, -3343, -3343, 1133, -3343, -3343, + -17, -1543, -1808, -2190, -3343, -3343, -3343, 1040, 1763, 243, + -853, -1683, -3343, -1588, -3343, -3343, 1084, -2531, -3343, -3343, + 594, -2784, -3343, -3343, 285, -3343, -698, -1168, -2616, 632, + 27, -3343, -911, -3036, -3343, -3343, -737, -2436, -1157, -946, + -3343, 151, -3343, 248, 165, -1765, -3343, 13, -3343, -297, + -3343, -3343, -2717, -3343, 170, 172, 2462, -3343, 1377, -3343, + -3343, -3343, -3343, -550, -3343, -648, 2274, -3343, -3343, 28, + -3343, 1874, -3343, 174, 468, -3343, 1191, -3343, 945, 178, + -3343, 2361, -191, 179, 1533, -3343, -3343, -3343, 24, -604, + 550, -3343, 1534, -3343, -3343, -674, -1731, -3343, 758, 1403, + -2185, 180, -3343, 916, 20, -3343, -3343, -3343, 101, 183, + 14, -3188, 185, -2914, -1771, -7, -3343, -3343, -3343, -655, + -3343, -3061 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -2183 +#define YYTABLE_NINF -2188 static const yytype_int16 yytable[] = { - 536, 934, 79, 53, 72, 887, 1194, 70, 1162, 732, - 71, 96, 1270, 1230, 1476, 101, 536, 57, 1290, 66, - 1861, 1056, 79, 84, 105, 2277, 983, 1862, 1402, 873, - 1533, 1385, 1348, 534, 731, 799, 1345, 1446, 1391, 1744, - 2244, 871, 900, 2039, 2014, 1845, 2513, 904, 2149, 534, - 793, 905, 1449, 2109, 2396, 1450, 1643, 533, 1469, 569, - 2767, 2077, 1834, 2161, 2405, 763, 985, 2089, 2200, 1448, - 536, 536, 1880, 832, 1828, 2179, 841, 2719, 2729, 3183, - 2328, 758, 2610, 1803, 50, 825, 2699, 51, 2701, 52, - 884, 884, 2177, 2178, 3180, 3150, 885, 2680, 3148, 2348, - 55, 2718, 1866, 534, 534, 924, 56, 915, 3197, 59, - 866, 1946, 1290, 2758, 60, 993, 1721, 61, 1657, 3201, - 2825, 1724, 2965, 1034, 2869, 2248, 64, 832, 832, 1059, - 67, 2423, 68, 1002, 1415, 69, 82, 2384, 83, 825, - 825, 2422, 85, 2427, 2591, 2592, -1428, 3038, 2392, 86, - 834, 3043, 2581, 2582, 2583, 2598, 1619, 1620, 920, 2602, - -505, 1080, 1080, 3280, 1269, 92, 1275, 2834, 1279, 3283, - 93, 95, -2021, 2202, 1633, 100, 104, 106, 2560, -926, - 548, 2818, -395, 836, -2021, -572, -1369, 1379, 1081, 2714, - 2032, 3635, -2169, -2169, -931, 2033, 1081, 2829, -931, -1369, - -1350, 1729, 1460, -2012, 834, 834, -2012, -1366, -1366, -934, - -2029, -2160, -2160, 2835, -576, 2125, 2843, 2339, -2178, -2178, - 3416, -934, -2155, -2155, 2806, 2297, -1370, 2809, 937, 2300, - -2029, -1370, 836, -893, -1367, -1367, 1080, -906, 1003, -921, - 2827, -1189, 836, 836, 1824, 3182, -535, 3756, 1653, -1189, - 3475, 2768, -2180, -2180, 938, 1864, 1395, 1878, 1725, 1395, - 836, 1080, 2630, 1290, 1080, 1677, 1281, 877, 1879, 2192, - 1679, 1991, 3507, 1824, 2972, 2192, 1993, 3350, 1804, 1219, - 901, 902, 1664, 895, 2797, 1846, -572, 3365, 1849, 1850, - 1370, 1028, 2419, 1752, -249, 1182, 2231, 3383, 549, -249, - 1222, 1687, 2885, 2887, 2232, 2890, 2714, 3592, 1624, 1379, - 1059, 552, 1766, 1493, 3172, -576, 2310, 2926, 1500, 3400, - 1503, 939, 1034, 2456, -1210, 1635, 3333, 3, 4, 1371, - -721, 2031, -1210, 897, 1181, 1689, 3403, 1284, 1179, 1528, - 2852, 836, 1026, 2241, 1991, 1881, 2570, 3520, 1992, 1993, - 940, 1409, 1035, 897, 896, 3705, 3420, 2761, 1802, 836, - 3639, 1767, 2769, 3712, 3729, 1002, 3551, 3202, 2083, 2031, - 1831, 1851, 3004, 1726, 3006, 553, 3552, 2528, 974, 3777, - 1798, 1799, 2896, -863, 854, 3481, 3796, 3483, 961, 2534, - 3347, 3053, 3361, 2272, 941, 1748, 1648, 3082, 3622, 3714, - 1215, 1209, 2571, 2303, 1812, 1856, 3359, 3698, 1629, 1677, - 3715, 1638, 2691, 1678, 1679, 2907, 3031, 2587, 3586, 2562, - 3587, 3318, 3716, 1677, 2333, 3603, 2567, 962, 3659, 1857, - 1768, 1520, 1677, 1639, 1012, 897, 1678, 1679, 3410, -2154, - -2154, 3382, 1885, 546, 3493, 1687, 891, 3775, 1958, 1927, - 891, 1991, 1041, 1080, 3425, 1992, 1993, 2588, 3411, 1687, - 1832, 3319, 1649, 1677, 2838, 1183, 3348, 1184, 1687, 1348, - 2603, 3494, 3083, 3052, 2603, 1763, 1560, 1217, 2273, 1689, - -572, 1769, 3360, 1521, 3032, 2334, 855, 2203, 1379, 1380, - 3604, 3717, 3737, 1689, 2762, 3685, 1036, 2242, 3688, 1727, - 1815, 3641, 1689, 1210, 2624, 3772, 3810, 1989, 1990, -576, - 1346, 3220, 1372, 2010, 1882, 3706, 2204, 965, 3564, 1852, - -863, 2304, 1243, 1246, 942, 2957, 3736, 1643, 1244, 3034, - 1853, 3518, 2758, 1689, 2758, 943, 1285, 3203, 892, 2897, - 3593, 3778, 892, 804, 3707, 3553, 3713, 1770, 1175, 3532, - 2572, 3621, -572, 3797, 949, 3502, 2612, 3362, 2420, 3084, - 1499, 1749, 1637, 557, 1884, 992, 1960, 3309, 3536, 3311, - 803, 1080, 944, 2649, 3512, 1833, 2811, 2812, 2813, 893, - 3233, -576, 1833, 1805, 2080, 3173, 1764, 2770, 3397, 2771, - 898, 560, 2819, 2820, 2200, 1009, 945, 3764, 732, 1668, - 2311, 1865, -475, 3210, 3770, 1384, 2023, 3508, 2119, 2606, - 1800, 1380, 969, 1619, 1620, -1189, 3193, 3422, 1871, 2772, - 878, 2411, 3492, 971, 2149, 946, 3351, 3496, 2404, 3724, - 2798, 1801, 1373, 1245, 2205, 1739, 932, 3165, 1633, 2408, - 933, 3760, 838, 983, 2207, 2926, 2040, 2193, 1948, 3211, - 3686, 1615, 550, 2682, 1952, 1381, 3187, 3757, 2652, 3580, - 3528, 835, 1747, 3224, 1817, 1751, 2839, 2805, 2064, 2703, - 2233, 2721, 3374, 3375, 2836, -572, 1862, -1428, 2984, 2940, - 2846, 2507, 2920, 2908, 2909, 2910, 2911, 2247, 2727, 1949, - 3150, -505, -505, 3148, 2894, -2021, 1638, 975, -1210, 2202, - 2131, 2132, -926, 1630, -576, 3730, 2821, -2021, 1638, -1369, - 1344, 1124, 1125, -395, -572, 1630, -572, -931, 1639, 1124, - 1125, 932, -1369, -1350, 3378, 933, -2012, 887, 1384, -2012, - 1639, 2297, 1640, -2029, 2732, 2810, 929, 1621, 2116, 1653, - 3718, 1956, 3499, -576, 1642, -576, 3464, 3500, 1653, -1370, - 1290, 2173, 1290, -2029, -1370, 1672, 1622, 2825, 3476, 1002, - 1627, 1001, -921, 2152, 3341, 1722, 2249, 1022, 1624, 79, - 1185, 1399, 1400, 3620, 1399, 1400, 3673, 1384, 1710, 887, - 1856, 2054, 799, 3687, 2008, 2029, 1818, 894, 1635, 932, - 1380, 2625, 3627, 1665, 1246, 2174, 3442, 3628, 998, 2533, - 1243, 2208, 536, 2071, 1857, 3025, 1244, 988, 2333, -249, - -249, 3765, 2209, 536, 1176, 3414, 2522, 116, 1040, 1079, - 536, 2523, 1991, 2107, 2404, 880, 1992, 1993, 3018, 107, - 2561, -2183, -2183, -2183, 2789, 534, 3444, 2707, 2771, 2339, - 904, 3720, 1638, 951, 905, 952, 534, 2790, 3062, 536, - 536, 3655, 3656, 534, 2005, 2006, 2007, 2008, 1248, 832, - 3417, 1766, 3332, 2708, 1639, 3721, 1180, 3415, 3095, 2755, - 832, 1231, 2568, 536, 3063, 3418, 2372, 832, 1640, 3005, - 108, 2524, 1024, 3696, 3019, 1180, 2375, 3180, 889, 2378, - 1249, 1177, 79, 53, 72, 2870, 110, 70, 3228, 3766, - 71, 96, 117, 1331, 1074, 101, 3700, 57, 1186, 66, - 1767, 1245, 1064, 84, 105, 3674, 111, 2568, 3334, 1707, - 1708, 1709, 1710, 1065, 3519, 536, 732, 884, 3767, 1337, - 536, 1947, 1195, 2371, 866, 866, 834, 866, 1824, 866, - 1705, 1706, 1707, 1708, 1709, 1710, 2541, 834, 3411, 1825, - 1215, 953, 874, 954, 834, 1216, 2195, 1505, 3401, 2003, - 2004, 2005, 2006, 2007, 2008, 1250, 2730, -741, 2824, 1824, - 2692, 1080, 3150, 2927, 50, 3148, 890, 51, 2497, 52, - 1827, 906, 1337, 3290, 2433, 3166, 3167, 2397, 2398, 2399, - 55, 2506, 111, 1001, 2575, 2508, 56, 887, 2510, 59, - 536, 536, 3675, 1391, 60, 79, 536, 61, 118, 536, - 536, 2936, 536, 536, 536, 536, 64, 3798, 799, 1347, - 67, 3050, 68, 1025, 907, 69, 82, 1217, 83, 536, - 1769, 536, 85, 2535, 2536, 2537, 2538, 2539, 2540, 86, - 536, 2544, 2545, 2546, 2547, 2548, 2549, 2550, 2551, 2552, - 2553, 3099, 2149, 2325, 909, 92, 3801, 536, 1337, 1607, - 93, 95, 534, 3505, 534, 100, 104, 106, 928, 1256, - 3159, 3419, 1246, 534, 2765, 3785, 3066, 1215, 1218, 536, - 1631, 1632, 887, 3792, 2975, 2370, 832, -659, 832, 1257, - 112, 932, -659, 2542, 1045, 933, 1770, 832, 825, 536, - 1024, 113, 2704, 2543, 2705, 2381, 3367, 927, 1999, 825, - 2388, 536, 536, 536, 3372, 536, 536, 1243, 732, 3069, - 836, 2373, 1900, 1244, 1668, 2014, 2376, 2039, 1862, 23, - 1046, 3488, 1247, 2215, 3802, 1258, 1248, 1638, 114, 959, - 2117, -2149, -2149, 1658, 3056, 1835, 1506, 2814, 2738, 2123, - 1243, 536, 2566, 3616, 1217, 1393, 1244, 1048, 1394, 1639, - 1947, 1901, -2021, 834, -659, 834, 112, 552, 1249, 536, - 536, 2521, 3300, 1642, 834, 2525, 1505, 113, 2527, 1754, - 1755, 932, 1761, 905, 905, 1665, 905, 3146, 930, 2672, - 1508, 115, -1414, 936, 1180, 2235, 1515, 1180, 3405, 2236, - 948, 2727, 1432, 1433, 1737, 1218, 536, 1738, 2799, 3537, - 536, 536, 960, 1836, 114, -659, -2150, -2150, 2673, 3599, - 536, 536, 536, 1953, 552, 536, 1954, 3436, 1245, 3803, - 2456, 553, 1259, 3057, 2667, 2668, 932, 1657, -1350, 1496, - 933, 1025, 884, 1250, 2628, 2022, 955, 2024, 2025, 1607, - 1512, 1904, 1169, 1170, 967, 1172, 2079, 1174, 2216, 2080, - 3396, 1245, 2853, 1863, 3538, 1513, -225, 115, 2105, 1518, - 972, 2106, 2864, 3539, 973, 2217, 26, 27, 28, 2416, - 2218, 3510, 2417, 1260, 958, 1337, 3073, 991, 553, 1052, - 1068, 1069, 1070, 976, 1261, 1073, 1337, 3540, 1613, 977, - 46, 2927, 3058, 1837, 3059, 978, 1262, 2516, 1507, 2554, - 2517, 979, 2555, 1045, 961, 3342, 2448, 2604, 2449, 2219, - 2605, 1337, 1438, 1439, 2670, 120, -2183, -2183, -2183, 547, - 2003, 2004, 2005, 2006, 2007, 2008, 3074, 762, 1263, 2607, - 989, 2674, 2605, 33, 2785, 2791, 2675, 2786, 2792, 1046, - 3391, 853, 1007, 962, 3075, 867, 2700, 1838, 1009, 2807, - 2867, 732, 2517, 2868, 1008, 1514, 556, 1908, 1010, 1909, - 732, 3541, 1013, 1911, 1912, 3276, 1048, 2933, 959, 2824, - 2605, 2576, 38, 2577, 3542, 1016, 1941, 1001, 3804, 1246, - 963, 1017, 2779, 1265, 2781, 79, 2934, 2937, 2939, 2106, - 2938, 2938, 3026, 3190, 732, 3027, 3191, 3268, 799, 536, - 3270, 836, 3272, 3192, 964, 1018, 2417, 40, 1266, 557, - 1005, 992, 1246, 3230, 998, 1833, 3231, 1019, 43, 1963, - 1950, 3291, 1951, 3386, 2106, 3229, 2275, 2921, 2578, 1268, - 2579, 2928, 1020, 965, 559, 2149, 895, 560, 2782, 1273, - 2784, 960, 1063, 1248, 3049, 1021, 3051, 2109, 3076, 536, - 536, -660, 1212, 2741, 1214, 536, -660, 536, 3077, 1022, - 2658, 1027, 536, 536, 536, 536, 557, 1171, 992, 2220, - 3794, 3437, 1277, 46, 2106, 1274, 1248, 536, 536, 3438, - 3470, 1029, 2605, 2106, 1061, 2870, 1066, 536, 3477, 536, - 534, 2080, 536, 2676, 560, -2151, -2151, 536, 1052, 536, - 536, 1071, 536, 1072, 2677, 2833, 536, 896, 1278, 3489, - -2152, -2152, 3490, 3086, 832, 3526, 838, 1507, 3191, 3093, - 534, 1075, 534, 14, 15, 534, 3739, 1074, -660, 3773, - 534, 3774, 1173, 534, 3527, 534, 1196, 2417, 1189, 534, - 1835, 3751, 3561, 1900, 832, 2106, 832, 3726, 3625, 832, - 1250, 3191, 3637, 1197, 832, 3638, 825, 832, 825, 832, - 1199, 825, 1607, 832, 3667, 3176, 825, 3668, 1203, 825, - 23, 825, -2156, -2156, 3085, 825, 3094, 2958, 2959, -660, - 1200, 3543, 1901, 1250, 3544, 1201, 2339, 1213, 897, 1204, - 3809, 834, 2456, 1206, 3711, 536, 536, 3638, 3618, -2157, - -2157, 79, 2108, 2112, 536, 536, 2110, 1401, 1836, 2111, - 2114, -2158, -2158, 536, 2115, 3805, 1232, 1444, 1235, 1902, - 536, 834, 3771, 834, 1237, 3638, 834, 536, 3808, 3806, - 1238, 834, 3490, 1239, 834, 1240, 834, 2944, 1657, -1902, - 834, 3582, 3583, 1903, -2159, -2159, 1242, 536, 732, -2161, - -2161, 116, 536, 2946, 2948, 536, 2947, 2949, 2950, 3463, + 536, 1270, 934, 1162, 1230, 887, 57, 53, 72, 732, + 66, 1476, 1345, 84, 105, 1056, 536, 1194, 70, 79, + 101, 731, 983, 71, 96, 1862, 873, 2014, 1845, 1744, + 1533, 1385, 1290, 1861, 534, 1348, 838, 2244, 1446, 79, + 799, 2039, 1448, 1391, 2700, 871, 2702, 2730, 793, 2149, + 534, 1449, 1643, 2077, 1450, 904, 2514, 2277, 2109, 1469, + 905, 2161, 985, 2089, 2200, 2406, 1828, 533, 2611, 2397, + 536, 536, 1880, 900, 2328, 1402, 1803, 2720, 1834, 2177, + 2178, 758, 50, 832, 1269, 1721, 1275, 51, 1279, 1404, + 1724, 52, 3134, 2719, 1866, 2179, 55, 2827, 1946, 2768, + 56, 2681, 924, 885, 534, 534, 59, 3155, 834, 60, + 1034, 915, 2759, 1002, 2348, 1657, 1059, 61, 3137, 993, + 2871, 2592, 2593, 2967, 2248, 3040, 1290, 64, 67, 3045, + 929, 2428, 2599, 2423, 68, 866, 2603, 832, 832, 1619, + 1620, 2393, 2561, 69, 2424, 1415, 2297, 1080, -1433, 2202, + -510, 82, 2385, 3237, 548, 3370, 1379, 1633, 2582, 2583, + 2584, 2300, 834, 834, 2715, 83, 1379, -399, 1080, 3642, + 85, -2026, 86, -936, 92, 2125, -1355, -936, 93, 95, + 100, -577, -581, 104, 877, 106, 2836, 3234, -2160, -2160, + 2837, -1374, 2820, 2831, 836, -2026, 1460, -1374, 2829, 1081, + 1812, -2017, -2017, -2174, -2174, -1371, -1371, -2034, 2808, -2165, + -2165, -2034, 2032, 901, 902, -1375, 2845, 2033, 1081, -2183, + -2183, 3354, 3772, -1372, -1372, 836, 891, 1175, -939, 1080, + -1375, 1674, -931, -898, -911, -926, 1664, 2339, 2811, 836, + 836, 3374, -1194, 1003, 2974, -939, 14, 15, 1729, -540, + -1194, 2192, -2185, -2185, 1281, 2928, 825, 1878, 1677, 1653, + 2192, 3429, 1404, 1679, 1725, 1395, 836, 3740, 1879, 1752, + 1080, 1181, 549, 1395, 3521, 836, 3461, 1290, 1080, 111, + 2231, 3304, -577, -581, -249, 1991, 1379, 3287, 2232, -249, + 1993, 897, 1028, 23, 1687, 3550, 1815, 1059, 3596, 3519, + 2631, 3351, 2887, 2889, 116, 2892, 3319, 3136, 2854, 1034, + 825, 825, -726, 1624, 3725, 1182, 3371, 1831, 892, 3315, + 1026, 2031, 1677, 2310, 3529, 3726, 1678, 1679, 1689, 1991, + 1635, 3372, 1846, 1992, 1993, 1849, 1850, 3727, 897, 1179, + 2898, 3794, 3627, 2457, 3813, 1002, 1404, 3, 4, 1404, + 1404, 2083, 1881, 1748, -1215, 1409, 3709, 2571, 1687, 2031, + 1035, 2241, -1215, 3680, 1370, 1284, 1677, 891, 836, 1802, + 1678, 1679, 2272, 3646, 2909, 1798, 1799, 3818, 3555, 1726, + 1991, 1763, 1677, 1824, 1992, 1993, 974, 3716, 3556, 117, + 546, 3723, 1689, 1493, 1864, 3156, 3055, 2529, 1500, 1677, + 1503, 2715, 1687, 1371, 1629, 3301, 3728, 1832, 3362, 2535, + 3538, 3084, 3033, 2572, 1215, 3792, 2534, 1648, 1687, 1528, + 1824, 1219, 2762, 2303, 3263, 1927, 3265, 2692, 1804, 3361, + 3590, 2799, 3591, 1885, 1631, 1632, 1689, 1856, 2588, 2563, + 26, 27, 28, 3694, 1222, 3379, 2568, 2562, 3699, 2772, + 3537, 3666, 1689, 112, 3435, 3819, 3437, 2273, 1380, 892, + 1817, 1857, 1064, 3789, 113, 3539, 1958, 3621, 1380, 1689, + 803, 1080, 1348, 1065, 3540, 3827, -577, -581, 2589, 3097, + 3034, 3302, 1560, 1649, 3316, 1183, 3085, 1184, 1959, 1961, + 2604, 1217, 1764, 1176, 2604, 118, 2203, 2899, 3541, 3036, + 893, 114, 3681, 3795, 1036, 1727, 3632, 33, 1989, 1990, + 2420, 3814, 3753, 3054, 2010, 2242, 73, 3174, 35, 1749, + 3126, 1882, 1884, 1643, 2625, 2204, 3456, 3373, 3533, 1833, + 2959, 3597, 2759, 3626, 2759, 3446, 73, 878, 1499, 824, + 3450, 2304, 37, 1833, 1637, 3466, 38, 3717, -577, -581, + 3820, 3692, 2613, 73, 115, 2412, 3752, 3557, 949, 2763, + 3787, 2573, 886, 3648, 1285, 3157, 804, 2626, 3780, 2080, + 1177, 2650, 3542, 3086, 3724, 1384, 3718, -480, 2813, 2814, + 2815, 40, 1818, 1074, 2928, 3543, 1372, 3568, 1380, 3682, + 2200, 3348, 43, 824, 824, 903, 1619, 1620, 732, 1747, + 1668, 2607, 1751, 2821, 2822, 3396, 1871, 2311, 3741, 44, + 971, 3462, 3521, 3147, 932, 3141, -1194, 2023, 933, 73, + 3749, 1633, 3119, 3164, 1381, 2149, 550, 3165, 2405, 2193, + 3305, 3376, 3773, 45, 1384, 3584, 3695, 3519, 2683, 983, + 1739, 2040, 2653, 2205, 1948, 569, 2119, 46, 2409, 835, + 1952, 763, 2297, 2207, 2233, 3729, 2704, 3328, 3329, 2896, + 2922, 2807, 841, 2064, 3178, 2986, 2733, 2838, 2508, 2848, + 2722, -577, -581, 3453, 1862, 2202, 884, 884, 3454, -1433, + 2841, -510, -510, 2131, 2132, 1949, 2942, 2247, 1384, 2728, + 2910, 2911, 2912, 2913, -2026, 1344, -936, 932, -399, -1355, + 3418, 933, 1630, 1621, 1615, 975, 1373, -868, 894, 3821, + -577, -581, -577, -581, -1374, 1638, 2124, 2823, -2026, 3696, + -1374, 3332, 1124, 1125, -2017, -2017, 1630, 887, -1215, 2155, + -2034, 2156, 1638, 1805, -2034, 2827, 3776, 1639, -1375, 1002, + 1865, 1124, 1125, 932, 920, 1956, 2812, 1665, 1672, 2116, + 1653, 1640, 1800, -1375, 1639, -931, 1622, 1627, -926, 1653, + 2175, 1001, 1722, 2249, 1290, 2173, 1290, 1022, 1642, 3430, + 1856, 1710, 2029, 1624, 2152, 1801, 2421, 2800, 874, 887, + 1399, 1400, 3781, 3027, 3633, 3731, 79, 799, 1399, 1400, + 1185, 3127, 3544, 1635, 1857, 3545, 998, 895, 2008, -249, + -249, 2542, 536, 1520, 3398, 3295, 2174, 3607, 3313, 3732, + 2208, 3625, -665, 536, 1005, 1040, 854, -665, 1215, 836, + 536, 2209, 880, 1216, 2405, 961, 1851, 3272, 2107, 1760, + 1705, 1706, 1707, 1708, 1709, 1710, 534, 2003, 2004, 2005, + 2006, 2007, 2008, 3006, -868, 3008, 1063, 534, 904, 536, + 536, 890, 2523, 905, 534, 1521, 3286, 2524, 2333, 110, + 2339, 2054, 2569, 1180, 962, 2296, 2296, 3273, 896, 832, + 3782, 1171, 3608, 536, 895, 3020, 1707, 1708, 1709, 1710, + 832, 3007, 1180, 2071, 3314, 889, 3182, 832, 3134, -665, + 2005, 2006, 2007, 2008, 834, 1217, 57, 53, 72, 3783, + 66, 2840, 1231, 84, 105, 834, 1186, 2569, 70, 79, + 101, 3352, 834, 71, 96, 2333, 2872, 2525, 855, 2334, + 838, 906, 2372, 2373, 3288, 536, 732, 3707, 552, 1337, + 536, 3021, 3365, 2376, 1331, -746, 2379, 1404, 3447, 1195, + -665, 14, 15, 23, 1638, 896, 1218, 1404, 2543, 897, + 1404, 907, 2195, 3362, 965, 111, 1025, 2693, 2544, 866, + 866, 909, 866, 2576, 866, 3448, 1639, 2826, -2159, -2159, + 2929, 3244, 50, 2325, 1852, 1209, 2756, 51, 2398, 2399, + 2400, 52, 1337, 2498, 3366, 1853, 55, 2434, 23, 3058, + 56, 2507, 553, 1001, 2769, 2509, 59, 887, 2511, 60, + 536, 536, 3120, 3121, 927, 2371, 536, 61, 1391, 536, + 536, 1401, 536, 536, 536, 536, 3052, 64, 67, 1347, + 3802, 1444, 79, 799, 68, 2382, 897, 1505, 3809, 536, + 2389, 536, 2938, 69, 2536, 2537, 2538, 2539, 2540, 2541, + 536, 82, 2545, 2546, 2547, 2548, 2549, 2550, 2551, 2552, + 2553, 2554, 3187, 1024, 2149, 83, 3459, 536, 1337, 1607, + 85, 2766, 86, 534, 92, 534, 73, 3101, 93, 95, + 100, 3815, 2977, 104, 534, 106, 2708, 1210, 3059, 536, + 1900, 928, 887, 3622, 1766, 3442, 1505, 3113, 3068, -664, + 26, 27, 28, 107, -664, 2705, 832, 2706, 832, 536, + 1393, 1042, 2709, 1394, 898, 2770, 1043, 832, 1243, 2014, + 2203, 536, 536, 536, 1244, 536, 536, 2374, 732, 1901, + 3064, 834, 2377, 834, 1009, 1668, 2039, 1862, 1215, 112, + 1658, 3071, 834, 1767, 1012, 26, 27, 28, 2739, 2204, + 113, 3662, 3663, 1670, 108, 2791, 3065, 3060, 2816, 3061, + 937, 536, 1041, 1673, 1243, 1766, 3356, 33, 2792, 2117, + 1244, 836, 1824, 2567, 1045, 1044, -664, 3390, 2123, 536, + 536, 930, 1496, 1825, 1025, 1723, 938, 114, 3367, 2620, + 557, 898, 992, 1512, 1728, 3689, -2026, 1754, 1755, 3254, + 1761, 1180, 905, 905, 1180, 905, 38, 2215, 969, 3711, + 1046, 2801, 33, 120, 1767, 1217, 536, 547, 560, 1904, + 536, 536, 3603, 35, 936, 762, 1506, -664, 1638, 1245, + 536, 536, 536, 1045, 3347, 536, 948, 1048, 1638, 853, + 115, 40, 955, 867, 1657, 2668, 2669, 37, 1045, 1243, + 1639, 38, 43, 939, 3690, 1244, 1226, 1432, 1433, 1607, + 1639, 1947, 2457, 1769, 1640, 2629, 1218, 2205, 1960, 1046, + 1863, -225, 2206, 1080, 1642, 1245, 1246, 2207, 3368, 825, + 3321, 1024, 940, 1768, 1046, 1514, 40, 2731, 3326, 2855, + 825, 1835, 1080, 73, 886, 1337, 1048, 43, 1243, 2866, + 1047, 1824, 1872, 3464, 1244, 958, 1337, 46, 3075, 2929, + 967, 1048, 1827, 2522, 44, 3342, 3746, 2526, 1508, 1737, + 2528, 3296, 1738, 1947, 1515, 2022, 941, 2024, 2025, 1770, + 1953, 1337, 2216, 1954, 1769, 1011, 1169, 1170, 45, 1172, + 2771, 1174, 2772, -2154, -2154, 2671, 1023, 1049, 2703, 2217, + 972, 932, 46, 1039, 2218, 933, 1835, 2701, 3076, 1836, + 1245, 932, 2449, -1355, 2450, 933, 1908, 973, 1227, 1052, + 1909, 732, 2773, 1911, 1912, 932, 3077, 1438, 1439, 1665, + 732, 2732, 2732, 1941, 951, 3230, 952, 2235, 1507, 2826, + 1246, 2236, 1513, 2219, 1050, 976, 1518, 1001, 903, 978, + 1770, 1051, 2780, 988, 2782, 2079, 2673, 2105, 2080, 1245, + 2106, 953, 977, 954, 732, 3222, 73, 979, 3224, 536, + 3226, 989, 79, 799, 1836, 1007, 1963, 2417, 1052, 1008, + 2418, 1962, 998, 1010, 2208, 2674, 1246, 2517, 2923, 3183, + 2518, 2555, 2930, 1052, 2556, 2209, 1613, 1507, 46, 1837, + 1247, 1424, 1425, 1009, 1248, 1243, 942, 2605, 2149, 1013, + 2606, 1244, 1053, 2608, -2155, -2155, 2606, 943, 2742, 536, + 536, 2449, 1016, 2450, 2109, 536, 2659, 536, 2786, 1017, + 3078, 2787, 536, 536, 536, 536, 1249, 1860, 2793, 2809, + 3079, 2794, 2518, 2577, 1018, 2578, 1273, 536, 536, 2579, + 1248, 2580, 2835, 1838, 944, 2869, 1019, 536, 2870, 536, + 1243, 534, 536, 1020, 1837, 3755, 1244, 536, 1021, 536, + 536, 1246, 536, 884, 1432, 1433, 536, 2872, 945, 73, + 3767, 2783, 1274, 2785, 3790, 1054, 3791, 1022, 3095, 2935, + 1228, 534, 2606, 534, 832, 3811, 534, 3088, 3051, 2936, + 3053, 534, 2106, 2220, 534, 552, 534, 946, 2675, 1027, + 534, 1250, 824, 2676, 1023, 1212, 1245, 1214, 1838, 834, + 1246, 1833, 1029, 824, 832, 2939, 832, 1061, 2940, 832, + 2339, 1277, 1607, 1066, 832, 1248, 2457, 832, 2941, 832, + 1071, 2940, 1072, 832, 2960, 2961, 3826, -2156, -2156, 834, + 3130, 834, 1074, 1835, 834, -2157, -2157, 1250, 1614, 834, + 3822, 3087, 834, 3096, 834, 536, 536, 1278, 834, 553, + 1626, 1245, 1075, 3825, 536, 536, 2108, 2112, 1173, 3623, + 3586, 3587, 3028, 536, 1248, 3029, 1833, 2110, 79, 2115, + 536, 1189, 2111, 2114, 1438, 1439, 1196, 536, 1243, 1655, + 2055, 1197, 2056, 3417, 1244, 2058, 1657, 1199, 3144, 2946, + 2062, 3145, 1200, 2065, 2947, 2066, 1249, 536, 732, 2070, + 1201, 1836, 536, 2948, 2950, 536, 2949, 2951, 2952, 1203, 1607, 536, 536, 536, 536, 536, 536, 536, 536, 732, - 2945, 1860, 1904, 536, 536, 536, -2162, -2162, 536, 1331, - 1241, 552, 536, -2163, -2163, 536, 536, 536, 536, 536, - 536, 536, 536, 536, 2189, 1254, 536, 2055, 1837, 2056, - -2164, -2164, 2058, 536, 1255, 1337, -1414, 2062, 534, 1272, - 2065, 1276, 2066, 2988, 2989, 1835, 2070, 26, 27, 28, - 2279, -2165, -2165, 536, 905, 1424, 1425, -2166, -2166, -2167, - -2167, -2168, -2168, -2170, -2170, -2171, -2171, 2298, 2299, 1670, - -1902, 1835, 1280, 898, 1282, 553, -2172, -2172, 536, 1673, - 1340, 1243, 1838, -2173, -2173, 1344, 2133, 1244, 1186, 536, - 536, -716, -716, 2134, 2135, 1343, 2880, 1349, 2136, 2137, - 2138, 1723, 3146, -2174, -2174, -2175, -2175, -2177, -2177, 1354, - 1728, 1243, 1366, 1836, 33, 1369, 2727, 1244, -1902, -2179, - -2179, -2182, -2182, 2173, 1368, 35, 2244, 1376, 1432, 1433, - 2203, 2432, 1607, -1902, 1887, 1888, -720, -720, -1902, 1836, - -719, -719, 732, -1902, 1434, 1435, 732, 1438, 1439, 37, - 1833, 1387, -1902, 38, 3214, 3215, 1377, -1902, 1383, 2204, - 1386, 1079, 3338, 3339, 1991, 3758, 3761, 2354, 1992, 1993, - 1392, 2360, 3093, 1994, 1995, 1996, 1867, 2872, 2874, 1410, - 2329, 3747, 3748, 3783, 3784, 1733, 1734, 732, 40, -1902, - 536, 2343, 1245, 2346, 2746, 2747, 2357, 1337, 1411, 43, - 536, 536, 1870, 1837, 1416, 1474, 2365, 1487, 2367, 552, - -1902, 1489, 1963, 1490, 3042, 1501, 44, 1497, 1872, 1509, - 1510, 2374, 1245, 1760, 1516, 1517, 2377, 1527, 1523, 1837, - 2382, 2383, 1529, 2385, 3184, 2389, 2390, 2497, 1607, 3153, - 45, 2083, 2498, 3171, 1609, -897, 3223, 2452, 1438, 1439, - 1610, 1612, -904, 1243, 46, 1621, 3225, 1838, 1625, 1244, - 732, -1902, 46, 557, -1902, 992, -741, 1337, 536, 3208, - -1902, -742, -894, 553, -895, 1636, 536, 2205, -898, 1637, - 3738, 3302, 2206, 1838, 3740, -896, 1644, 2207, 559, 1669, - 1659, 560, 1607, 1835, 1716, 1671, 536, 536, 1718, 536, - 1720, 1732, 1740, 1741, 1607, 536, 536, 536, 536, 536, - 536, -1902, 1745, 536, 536, 536, 536, 536, 536, 536, - 536, 536, 536, 1750, 3560, 1833, 1753, 1216, 536, 536, - 1788, 1218, 536, 1790, 1607, 1792, -1902, 23, 1808, 536, - 1810, 1607, 1829, 1830, 1840, 1841, 1842, 1962, 1847, 555, - 1854, 1833, 1855, 1246, 1997, 1877, 1859, 1869, 3799, 1890, - 1835, 1836, 1874, 536, 1245, 1891, 1079, 1896, 1899, 1991, - 536, 1906, 536, 1992, 1993, 2726, 536, 1998, 1994, 1995, - 1996, 1892, 1913, 1246, 3146, 1607, -585, 1907, 1914, 1607, - 1917, 536, 1923, 1337, 11, 1607, 874, 1920, 2727, 1921, - 1924, -585, 1925, 534, 1926, 1928, -585, 1929, 1346, 534, - 1942, 1947, 1943, 2324, 1955, -224, 1983, 1248, 2019, 1607, - 1980, 1982, 14, 15, 2796, -1902, 1985, 832, 1836, 2030, - 3358, 536, 536, 832, 3370, 2050, -1902, 1988, 536, 825, - 2011, 1404, 2020, 2379, 2208, 825, 2057, 1248, 2027, 1249, - 1999, 1837, 2052, 2067, 2053, 2209, -1902, -585, -1902, -1902, - 2063, 557, 1604, 558, 3379, 3380, 2068, 2069, 2075, 23, - 3524, 536, 1622, 2081, 2078, 536, 1615, 887, -585, 2380, - 536, 536, 1627, 3560, 26, 27, 28, 2082, 2084, 560, - 2085, 2800, 2088, 2086, 2119, -1902, 2118, 1080, -1902, -1902, - -1902, 1677, 2153, 1835, 834, 1838, 536, 536, 2158, 2154, - 834, 536, 2162, 2165, 2168, 2167, 2169, 3267, 1837, 2191, - 2039, 2211, 2170, 2214, 1250, 1246, 2238, 536, 3560, -585, - 536, 536, 536, 2212, 2239, 2257, 2245, 2259, -585, 2258, - 2260, 2261, 2265, 896, 2275, 2278, 2287, 2288, 536, 732, - 2289, 33, 2292, 2290, 1250, 536, -1904, 1657, 536, 2312, - 2291, 2313, 1042, 2309, 534, 2317, 2314, 1043, 2322, 1730, - 2326, 1836, 1838, 1833, 536, 2330, 2331, 2332, 536, 2340, - 2593, 3560, 1998, 1674, 897, 2386, 2596, 3435, 536, 1248, - 38, 534, 2358, 2139, 2140, 2141, 2359, 2142, 2143, 2144, - 2145, 2146, 2147, 2400, 2363, 536, 536, 534, 2364, 2401, - 2414, 534, 2418, 2424, 1404, 832, 26, 27, 28, 3576, - 2402, 2387, 536, 1950, 536, 40, 1044, 825, 2434, 2435, - 2438, 832, 2436, 2437, 2804, 832, 43, 2439, 2453, 536, - 1833, 2457, 2458, 825, 2501, 2460, 2499, 825, 2500, 2503, - 2502, 2505, 1604, 732, 3356, 1999, 2518, -1904, 2509, 2526, - 2016, 1837, 732, 732, 732, 1991, 2556, 2250, 2000, 2001, - 2002, 2015, 2003, 2004, 2005, 2006, 2007, 2008, 2563, 2564, - 2585, 2597, 2573, 33, 2565, 2569, 2609, 2354, 2354, 2354, - 2574, 46, 834, -585, 35, 2595, 1250, 2611, 1404, 1045, - 2616, 1404, 1404, 2617, 3020, -1904, 2618, 536, 834, 2627, - 2626, -585, 834, 2634, 2635, 1838, 1337, 23, 37, 2620, - -1904, 2638, 38, 2639, 2621, -1904, -585, 2622, 2640, 2623, - -1904, -585, 2643, 2641, 2642, 1046, 2644, 2645, 2656, -1904, - 2646, 2319, 2321, 39, -1904, 1676, 1862, 1649, 1677, 732, - 2652, 1047, 1678, 1679, 1607, 2666, 2663, 40, 2664, 1908, - 23, 1909, 1048, 932, 2671, 1911, 1912, 933, 43, 2687, - 3513, 2678, 2711, 2688, 2840, 2695, -1904, 2693, 2714, 2694, - 2706, 2713, -585, 1833, 1687, 44, 2737, 2740, 2716, 2720, - 2723, -2183, -722, 2722, 2733, 2734, 2736, -1904, 1049, 2744, - 2745, 3066, 2751, -585, 1805, 2748, 2749, 3067, 2391, 45, - 1607, 2757, 2754, 2778, 536, 2780, 2795, 2857, 1689, 1229, - 3068, 2753, 2793, 46, 2801, 2794, 2409, 2409, 2802, 1668, - 732, 2803, 2815, 2816, 2830, 2831, 2832, 2855, 2837, 2850, - 1959, 1961, 2854, 2851, 3069, 1050, 3070, 2858, -1904, 2861, - 2865, -1904, 1051, 1042, -585, 1963, 1833, -1904, 1043, 2877, - 2884, 2892, 2895, -585, 26, 27, 28, 2898, 536, 2901, - 2915, 2902, 2916, 2000, 2001, 2002, 2903, 2003, 2004, 2005, - 2006, 2007, 2008, 2918, 1596, 2904, 2929, 2930, 2919, 3565, - 2935, 3567, 2173, 2954, 1052, 3021, 2943, 2951, -1904, 2982, - 2983, 534, 2962, 2961, 2980, 2995, 2520, 26, 27, 28, - 536, 2986, 3003, 1053, 2996, 3001, -2183, 1044, 3007, 3012, - 3013, 3015, 3033, -1904, 3035, 832, 1607, 3575, 3037, 3039, - 3048, 33, 887, -2183, 3054, 3071, 1180, 3055, -2183, 3061, - 3081, 3168, 3169, 536, 3097, 3170, 3178, 3174, 3179, 3194, - 536, 536, 3195, 3200, 3204, 3216, 3217, 2417, 3226, 3221, - 3227, 3252, 3232, 3255, 3259, 3263, 536, 887, 3704, 3577, - 38, 3579, 3273, 3274, 33, 1604, 3277, -2183, 3278, 536, - 2998, 3317, 536, 874, 536, 3303, 1054, 3310, 3313, 3314, - 1045, 1607, 536, 3324, 3335, 536, 536, 3326, 3331, 3336, - 536, 536, 834, 3345, 3665, 40, 3072, 536, 3337, 3343, - 3349, 3073, -1904, 38, 3654, 3353, 43, 3669, -585, 3354, - 3363, 3041, 3355, -1904, 536, 3366, 1046, 3368, 3369, 3344, - 3373, -2148, 3384, 44, 1698, 536, -2149, -2150, 3385, 3024, - -2151, 3387, 1047, -1904, -2152, -1904, -1904, -2153, 40, -2154, - 3649, -2155, 3388, 1048, 3389, 536, -2156, 45, -2157, 43, - -2158, 3074, 3404, -2159, -2161, -2162, 3406, -2163, 2124, 3407, - -2164, 46, 3421, 1604, 1596, -2165, 44, -2166, 3390, 3075, - -2167, 2155, -1904, 2156, 3392, -1904, -1904, -1904, 932, 1049, - -2168, 1199, 933, -2170, -2171, -2172, -2173, -2174, -2175, 732, - 45, -2176, 3149, 732, -2177, 732, 536, 536, -2178, -2179, - -2180, 3044, 2175, -2181, 3022, 3046, 3424, -2182, -1367, 3426, - 3393, 536, 536, 3402, 2354, 3423, 3408, 3430, 3151, 3431, - 2360, 1256, 3434, 3439, 536, 3440, 1050, -2183, 3443, 3445, - 887, 3451, 3454, 1051, 3098, 1607, 3447, 3457, 3453, 3458, - 3459, 1257, 3466, 536, 3219, 3181, 3465, 3462, 3487, 3469, - 3485, 3155, 3156, 3157, 3158, 3486, 3160, 3161, 3162, 3163, - 3164, 3491, 3498, 1908, 3501, 1909, 532, 543, 3503, 1911, - 1912, 2498, 567, 3076, 3515, 1052, 3516, 3525, 567, 3209, - -1366, 3523, 822, 3077, 837, 3531, 3533, 1258, 840, 567, - 849, 887, 3534, 849, 1053, 3547, 869, 869, 536, 3550, - 869, 1607, 3548, 567, 567, 1604, 3562, 2296, 2296, 3563, - 3566, 3569, 3693, 3572, 3578, 3570, 3595, 3584, 536, 536, - 3597, 536, 3607, 3362, 3611, 536, 3613, 3614, 536, 3617, - 3623, 3630, 3631, 3635, 3640, 3632, 822, 822, 3642, -2183, - 3644, 3306, 3647, 3813, 3653, 3651, 1705, 1706, 1707, 1708, - 1709, 1710, 3648, 3652, 3660, 536, 3658, 3662, 3089, 3663, - 3666, 3671, 869, 3682, 3676, 3683, 3684, 1054, 3689, 917, - 869, 567, 869, 869, 869, 536, 3690, 3691, 3709, 1404, - 536, 536, 3728, 2787, 1259, 536, 1607, 3699, 3701, 1404, - 536, 887, 1404, 536, 536, 3731, 3703, 3733, 536, 1337, - 3749, 3752, 536, 3762, 3753, 3729, 536, 3730, 3786, 1676, - 3776, 1604, 1677, 3781, 3790, -1919, 1678, 1679, 536, 3788, - 3795, 1682, 1683, 1684, 3800, 79, 2108, 2112, 3812, 3807, - 2110, 3811, 1256, 2111, 2114, 1260, 934, 3814, 2115, 534, - 1202, 3096, 2822, 2766, 2366, 2776, 1261, 3100, 1687, 3591, - 3028, 1256, 1257, 3697, 3657, 1688, 3787, 3409, 1262, 2511, - 1178, 3376, 2879, 832, 536, 1604, 3680, 3769, 3511, 3727, - 3734, 1257, 536, 3763, 3546, 825, 1822, 1604, 2756, 2783, - 2336, 2337, 1689, 3199, 3725, 3732, 3065, 1596, 3152, 3723, - 1263, 536, 2752, 1945, 3722, 3793, 1079, 3495, 1258, 1991, - 1607, 2871, 2826, 1992, 1993, 2873, 1905, 1604, 1994, 1995, - 1996, 3213, 2739, 3177, 1604, 1494, -1919, 1258, 3087, 3154, - 1495, 1742, 2725, 2316, 3357, 2977, 1785, 2906, 3088, 3702, - 2735, 1524, 1784, 3643, 2284, 3149, 3568, 2315, 826, 2601, - 834, 1789, 2710, 3461, 1461, 1265, 2882, 3262, 2883, 2900, - 2899, 3517, 2888, 2932, 2891, 1445, 3646, 2615, 1604, 3645, - 2661, 1447, 1604, 1451, -1919, 1452, 1453, 1454, 1604, 1455, - 1266, 1456, 2956, 1457, 2685, 2728, 2631, 3484, 2683, -1919, - 1690, 732, 2974, 3316, -1919, 1596, 2662, 2041, 3089, -1919, - 2412, 1268, 1604, 3633, 732, 1259, 3315, 1691, -1919, 3286, - 1006, 1607, 1692, -1919, 2608, 2253, 2840, 1607, 1406, 3413, - 1957, 887, 3029, 552, 1259, 2255, 1496, 536, 536, 2840, - 536, 2619, 2881, 2393, 0, 1693, 1694, 0, 0, 536, - 1607, 1234, 0, 0, 0, -1919, 0, 0, -1414, 0, - 0, 1695, 0, 0, 0, 536, 1260, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -1919, 1261, 0, 0, - 0, 0, 0, 0, 0, 1260, 0, 0, 0, 1262, - 0, 0, 0, 0, 1607, 0, 1261, 553, 0, 1079, - 536, 1696, 1991, 0, 1697, 73, 1992, 1993, 1262, 0, - 3090, 1994, 1995, 1996, 0, 0, 536, 536, 1698, 0, - 536, 1263, 536, 0, 0, 73, 0, -1919, 824, 0, - -1919, 0, 1998, 0, 0, 0, -1919, 0, 0, 0, - 1263, 0, 73, 0, 0, 0, 0, 1596, 0, 0, - 0, 886, 0, 554, 536, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1676, 0, 0, 1677, 0, 0, - 0, 1678, 1679, 555, 0, 0, 1265, -1919, 536, 0, - 0, 0, 824, 824, 903, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1265, 0, 0, 0, 0, - 2702, 1266, -1919, 1687, 0, 1999, 0, 3149, 73, 1676, - -2183, 0, 1677, 1966, 0, 0, 1678, 1679, 0, 0, - 1266, 1700, 1268, 0, 0, 0, 0, 0, 0, 0, - 869, 732, 556, 2731, 2731, 869, 3142, 1689, 3529, -224, - 0, 1268, 3514, 3091, 0, 567, 3092, 0, 1687, 0, - 0, 0, 0, 1596, 0, -2183, 2840, 536, 0, 0, - 1967, 0, 874, 3521, 3522, 0, 536, 0, 536, 0, - 536, 0, 0, 2822, 536, 0, 536, 0, 536, 0, - 0, 1968, 1689, 0, 0, 557, 0, 558, 3535, 0, - 534, -1919, 536, 0, 0, 0, 2451, 536, 536, 1969, - 0, 0, -1919, 2669, 1970, 0, 0, 1596, 3205, 536, - 559, 0, 0, 560, 832, 1998, 0, 23, 0, 1596, - 0, 3588, -1919, 3590, -1919, -1919, 732, 1971, 0, 0, - 1972, 536, 0, 1701, 0, -2183, 1702, 1703, 1704, 0, - 1705, 1706, 1707, 1708, 1709, 1710, 1973, 1604, 2679, 1596, - 0, 3600, -2183, 0, 0, 0, 1596, -2183, 1833, 0, - 0, -1919, 0, 0, -1919, -1919, -1919, 3626, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 536, - -2183, 0, 0, 0, 3629, 0, 0, 0, 1999, 536, - 0, 834, 0, 0, 0, 0, -2183, -2183, 0, 0, - 1596, 536, -2183, 1604, 1596, 0, 0, 0, 0, 0, - 1596, 0, 0, 0, 0, 0, 536, 0, 536, 0, - 0, 0, 0, 2000, 2001, 2002, 0, 2003, 2004, 2005, - 2006, 2007, 2008, 0, 1596, 0, 0, 536, 981, 567, - 567, -2183, 1974, 0, 0, 0, 0, 0, 0, 534, - 1975, 0, 0, 1698, 3312, 0, 0, 0, 0, 0, - 0, 536, 0, 0, 26, 27, 28, 0, 0, 0, - 0, 0, 1976, 832, 0, 0, 536, 0, 0, 0, - 0, 0, 1004, 543, 0, 0, 0, 0, 532, 3149, - 869, 732, 0, 0, 534, 0, 0, 0, 1698, 822, - 0, 0, 1977, 1031, 1031, 0, 822, 0, 0, 1031, - 1058, 0, 0, 0, 536, 0, 3600, 3735, 832, 1604, - 0, 0, 849, 849, 849, 0, 0, 849, 536, 536, - 536, 33, 0, 0, 3710, 1128, 1128, 849, 849, 536, - 849, 0, 849, 3750, 0, 0, 0, 534, 0, 0, - 834, 0, 0, 0, 869, 0, -2183, 0, 0, 0, - 567, 0, 0, 0, 536, 0, 0, 0, 2941, 2942, - 38, 832, 0, 869, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1604, 0, 0, 869, 837, 0, - 0, 0, 0, 0, 0, 834, 0, 0, 0, 0, - 0, -2183, 0, 0, 0, 40, 2000, 2001, 2002, 0, - 2003, 2004, 2005, 2006, 2007, 2008, 43, 0, 0, 3412, - 0, 0, 0, 536, 0, 0, 869, 1342, 0, 0, - 536, 0, 0, 44, 0, 0, 0, 1352, 0, 0, - 23, 869, 869, 869, 869, 869, 0, 0, 834, 0, - 23, 0, 0, 0, 0, 73, 0, 45, 1375, 735, - 0, 0, 0, 0, 0, 0, 0, 0, -2183, 0, - 0, 46, 0, 0, 0, 1705, 1706, 1707, 1708, 1709, - 1710, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1031, 1058, 0, 869, 0, 1604, 1468, 0, 0, 0, - 0, 0, 1031, 1031, 0, 0, 0, 0, 0, 567, - 0, 0, 0, -2183, 0, 822, 736, 822, 0, 0, - 1705, 1706, 1707, 1708, 1709, 1710, 822, 1676, 0, 0, - 1677, 0, 737, 0, 1678, 1679, 567, 0, 1604, 0, - 1404, 0, 0, 0, 0, 0, 0, 1676, 0, 0, - 1677, 0, 0, 1611, 1678, 1679, 0, 3482, 0, 1682, - 1683, 1684, 0, 0, 0, 0, 1687, 0, 0, 1596, - 0, 0, 0, -2183, 0, 0, 1685, 0, 1598, 0, - 0, 567, 738, 1599, 0, 3589, 1687, 26, 27, 28, - 0, 0, 739, 1688, 0, 0, 0, 26, 27, 28, - 1689, 0, 0, 0, 1604, 740, 567, 0, 0, 0, - 741, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1689, 0, 0, 0, 0, 1596, 0, 0, 0, 0, - 0, 3142, 0, 0, 0, 0, 0, 0, 1676, 742, - 0, 1677, 0, 0, 0, 1678, 1679, 0, 0, 0, - -2183, -2183, -2183, 0, 33, 0, 0, 0, 0, 1736, - 0, 0, 0, 0, 33, 0, 2987, 0, 0, 0, - 0, 3549, 73, 886, 0, 567, 567, 1687, 0, 0, - 0, 0, 869, 743, 1688, 869, 3269, 0, 744, 1604, - 0, 0, 0, 38, 0, 0, 0, 0, -2183, 0, - 0, 0, 0, 38, 0, 0, 1468, 1128, 1128, 0, - 0, 1689, 0, 0, 1011, -2183, 869, 0, 1690, 1809, - -2183, 869, 1821, 0, 0, 1023, 0, 0, 40, 0, - 0, 0, 1039, 0, 869, 1691, 0, 0, 40, 43, - 1692, 1596, 0, 0, 0, 0, 0, 0, 0, 43, - 0, 869, 0, 0, 555, 869, 44, 0, 0, -2183, - 745, 1873, 0, 1693, 1694, 1601, 44, 0, 1598, 0, - 0, 0, 3619, 1599, 0, 746, 0, 903, 0, 1695, - 45, 0, 0, 0, 0, 14, 15, 0, 0, 0, - 45, 0, 0, 0, 46, 73, 0, 0, 0, 0, - 0, 0, 0, 1604, 46, 0, 1596, 0, 0, 1690, - 747, 0, 0, 748, 0, 0, 1698, 0, 0, 1696, - 0, 0, 1697, 1893, 749, 869, 1691, 750, 0, 0, - 0, 1692, 23, 869, 0, 0, 1698, 1404, 1604, 1699, - 0, 0, 1404, 0, 0, 0, 1938, 751, 0, 0, - 0, 0, 0, 0, 0, 981, 0, 0, 0, 0, - 981, 752, 567, 567, 0, 567, 981, 0, 753, 754, - 1695, 0, 0, 0, 0, 0, 0, 0, 0, 755, - 0, 0, 0, 0, 0, 756, 0, 0, 0, 0, - 0, 1959, 1961, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1604, 0, 0, 0, 73, 0, - 1604, 0, 0, 3142, 757, 0, 0, 1596, 0, -2183, - 0, 0, 0, 0, 0, 0, 0, 1698, 0, 0, - 0, 0, 0, 1604, 0, 0, 0, 0, 0, 1700, - 0, 824, 0, 1023, 0, 1468, 1468, 0, 0, 0, - 0, 1468, 824, 532, 0, 1601, 0, 0, 0, 0, - 1596, 0, 0, 0, 0, 0, 1031, 0, 567, 2034, - 0, 0, 0, 1128, 1128, 0, 869, 1604, 0, 26, - 27, 28, 0, 822, 1042, 822, 0, 1614, 822, 1043, - 0, 0, 0, 822, 0, 1128, 822, 0, 822, 1626, - 0, 0, 822, 0, 567, 0, 567, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1596, 0, 1655, 0, - 1700, -2183, 0, 0, 0, 0, 0, 0, 1705, 1706, - 1707, 1708, 1709, 1710, 0, 0, 33, 0, 1044, 0, - 0, 1701, 0, 0, 1702, 1703, 1704, 35, 1705, 1706, - 1707, 1708, 1709, 1710, 1676, 0, 0, 1677, 0, 0, - 0, 1678, 1679, 0, 0, 0, 0, 0, 0, 0, - 0, 37, 0, 0, 0, 38, 0, 0, 0, 0, - 1604, 1598, 0, 0, 0, 0, 1599, 1676, 0, 0, - 1677, 0, 0, 1687, 1678, 1679, 0, 0, 0, 0, - -2183, 1596, 0, 0, 0, 2148, 903, 903, 0, 903, - 40, 1045, 0, 0, 0, 1959, 1961, 0, 567, 1226, - 0, 43, 0, 0, 0, 1404, 1687, 1689, 0, 0, - 0, 0, 1701, -2183, 0, -2183, -2183, -2183, 44, 1705, - 1706, 1707, 1708, 1709, 1710, 0, 0, 1046, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1602, 981, 0, - 1689, 1468, 45, 1047, 1042, 0, 0, 0, 0, 1043, - 0, 0, 0, 0, 1048, 0, 46, 0, 0, 1598, - 0, 0, 0, 0, 1599, 0, 0, 0, 0, 1128, - 0, 0, 0, 2990, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 2251, 0, 869, 0, 869, 0, - 1049, 0, 0, 0, 0, 1596, 0, 0, 0, 869, - 0, 0, 2267, 0, 0, -2183, 2991, 0, 1044, 0, - 0, 1227, 1079, 0, 1468, 1991, 0, 0, 0, 1992, - 1993, 0, -2183, 0, 1994, 1995, 1996, -2183, 0, 0, - 1596, 0, 0, 0, 0, 0, 0, 1050, -2183, 869, - 0, 567, 0, 0, 1051, 0, 0, 0, 1601, 0, - 0, 0, 0, 2318, 2320, -2183, 0, 0, 1603, 2323, - -2183, 0, 1821, 567, 0, 0, -2183, 0, 73, 0, - 0, 0, 0, 0, 567, 2344, 567, 1821, 0, 567, - 0, 1045, 0, 0, 0, 0, 1052, 0, 0, 567, - 0, 567, 0, 0, 0, 0, 1596, 0, 0, -2183, - 0, 1598, 1596, 981, 567, 1053, 1599, 0, 981, 567, - 0, 0, 0, 567, 567, 1821, 567, 1046, 567, 567, - 0, 0, 0, 1698, 0, 1596, 0, 1602, 0, 0, - 868, 0, 0, 1047, 876, 0, 0, 0, 0, 0, - 2413, 0, 1604, 0, 1048, 0, 1601, 0, 1352, 0, - 869, 869, 869, 869, 869, 869, 1698, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1596, - 2441, 0, 0, 0, 0, 0, 0, 0, 1054, 824, - 1049, 824, 0, 1228, 824, 0, 0, 1404, 0, 824, - 0, 2504, 824, 0, 824, 0, 914, 0, 824, 0, - 0, 2059, 0, 0, 919, 0, 922, 1598, 926, 0, - 0, 0, 1599, 0, 0, 1470, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -2183, 1050, -2183, 0, - 0, 0, 0, 0, 1051, 0, 0, 0, 0, 0, - 0, 1468, 1468, 1468, 1468, 1468, 1468, 0, 1603, 1468, - 1468, 1468, 1468, 1468, 1468, 1468, 1468, 1468, 1468, -2183, - 0, 1598, 0, 0, 0, 0, 1599, 0, 0, 0, - 0, 0, 0, 1598, 0, 0, 1052, 0, 1599, 567, - 0, 0, 1596, 0, 73, 0, 0, 0, 1601, 0, - 0, 0, 0, 869, 0, 1053, 0, 0, 0, 0, - 0, 1999, 0, 1598, 0, 0, 822, 0, 1599, 0, - 1598, 0, 822, 0, 0, 1599, 0, 0, 567, 0, - 0, 0, 0, 0, 567, 0, 0, 0, 0, 0, - 0, 0, 0, 2613, 2613, 0, 0, 0, -2183, 0, - 0, 0, 0, 0, 0, 1705, 1706, 1707, 1708, 1709, - 1710, 0, 0, 0, 1598, 568, 0, 0, 1598, 1599, - 0, 568, 0, 1599, 1598, 823, 0, 2199, 1054, 1599, - 0, -2183, 568, 2060, 0, 0, 0, 0, 1705, 1706, - 1707, 1708, 1709, 1710, 0, 0, 568, 568, 1598, 0, - 0, 0, 0, 1599, 1601, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 567, 0, - 0, 0, 0, 567, 0, 0, 1781, 0, 567, 823, - 823, 0, 0, 0, 0, 1470, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 903, 0, 0, - 0, 0, 1468, 1468, 0, 0, 0, 0, 1601, 0, - 1602, 0, 0, 0, 568, 0, 0, 0, 0, 0, - 1601, 2148, 0, 0, 0, 0, 0, 1468, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -2161, -2161, 1250, 536, 536, 536, 3146, 3184, 536, 2418, + 3185, 2189, 536, -2162, -2162, 536, 536, 536, 536, 536, + 536, 536, 536, 536, -2163, -2163, 536, 2943, 2944, 1204, + 2677, 1835, 1256, 536, 1206, 1337, 1213, 1246, 1232, 534, + 1331, 2678, -2164, -2164, 1867, 2990, 2991, 903, 903, 1235, + 903, 1250, 1257, 536, -2166, -2166, 1237, 825, 2279, 825, + 1238, 2250, 825, 905, 1346, -2167, -2167, 825, 2728, 1245, + 825, 1837, 825, 3517, 959, 1239, 825, 2244, 536, 1068, + 1069, 1070, 3245, 1241, 1073, 2106, 1186, 1240, 3337, 536, + 536, 2275, 1246, 2882, -2168, -2168, 1242, 2324, 1258, 1836, + 3391, 1248, 3392, 2106, 3424, 2606, 3431, 2106, 3443, 2080, + 1254, 3444, 1255, 3527, 1272, 3528, 3145, 557, 2418, 992, + 3565, 3630, 116, 2106, 3145, 1838, 3644, 3674, 3722, 3645, + 3675, 3645, 1607, 1249, 3788, 2319, 2321, 3645, 2173, 1276, + 3823, 1282, 732, 3444, 1340, 560, 732, 960, 884, -2169, + -2169, 1280, 2380, 1343, 2354, 1344, 1248, 1349, 2361, -2170, + -2170, 1354, 1870, 1366, 2360, -2171, -2171, -2172, -2172, 1368, + 1079, 1369, 3095, 1991, -2173, -2173, 1376, 1992, 1993, -2175, + -2175, 1377, 1994, 1995, 1996, 959, 1383, 732, 2381, 1837, + 536, 1386, 552, 1833, 1387, 1259, 1392, 1337, 11, 1963, + 536, 536, 2392, 1410, 1835, -2176, -2176, 1411, 1250, 1487, + 3044, 1079, -2177, -2177, 1991, 1416, 1835, -1419, 1992, 1993, + 2410, 2410, 1474, 1994, 1995, 1996, 14, 15, 1489, 73, + 1246, -2178, -2178, -2179, -2179, 1596, 3125, 1501, 1607, 3138, + 2979, 1497, 2499, 1838, 2498, 1490, 1260, 3162, 3177, 961, + 1509, 2453, 3107, -2180, -2180, 1510, 553, 1261, 960, 3179, + 732, 3564, 1516, 1250, -2182, -2182, -590, 1337, 536, 1262, + -2184, -2184, 1836, 23, -2187, -2187, 536, 1887, 1888, 2298, + 2299, -590, 1517, 3256, 1836, 1523, -590, 1527, 962, 1609, + 2387, 1529, 1607, 1610, 1248, 1612, 536, 536, -902, 536, + 2521, 1263, -721, -721, 1607, 536, 536, 536, 536, 536, + 536, 1833, 2433, 536, 536, 536, 536, 536, 536, 536, + 536, 536, 536, 3754, 3068, 963, 2388, 3756, 536, 536, + 3069, -909, 536, 1621, 1607, 2798, 1950, -590, 1951, 536, + 824, 1607, 824, 3070, -899, 824, 3223, 2802, 1625, 964, + 824, -725, -725, 824, 46, 824, 1265, -746, -590, 824, + 1900, -747, 1837, 536, -724, -724, -900, 3071, 1636, 3072, + 536, -903, 536, 1637, 1837, -901, 536, 1659, 965, 1434, + 1435, 1266, 1438, 1439, 1644, 1607, 1998, 3168, 3169, 1607, + 1669, 536, 1671, 1337, 1716, 1607, 3292, 3293, 1718, 1901, + 1720, 1250, 1268, 1732, 534, 1740, 2728, 3816, 1741, -590, + 534, 3517, 3774, 3777, 2874, 2876, 1838, 1750, -590, 1607, + 26, 27, 28, 1835, 1745, 1596, 1753, 1998, 1838, 3763, + 3764, 536, 536, 3312, 3525, 1216, 1902, 832, 536, 3800, + 3801, 1733, 1734, 832, 557, 73, 992, 2747, 2748, 1218, + 1788, 1792, 1808, 1790, 1810, 1829, 1830, 1840, 3073, 1999, + 1903, 1842, 834, 1847, 1841, 1854, 3333, 3334, 834, 559, + 3564, 536, 560, 1855, 1869, 536, 1859, 887, 1877, 1874, + 536, 536, 23, 3324, 1833, 1891, 1890, 33, 1892, 1904, + 1899, 1836, 1896, 1907, 1906, 1913, 1833, 1404, 35, 1917, + 1999, 1914, 1404, 1243, 1920, 1923, 536, 536, 1657, 1244, + 1921, 536, 1924, 2594, 1925, 3221, 1926, 1256, 3564, 2597, + 3737, 1928, 37, 1929, 1943, 2039, 38, 536, 2199, 3074, + 536, 536, 536, 1942, 3075, 1947, 1955, 1257, 1983, 1980, + 2019, 2057, 3389, 2050, 2063, 2067, 2030, 39, 536, 732, + 2068, 1615, 2078, 1982, 2806, 536, 1985, 1988, 536, 2011, + 2088, 40, 2119, 3580, 2452, 534, 2081, 2020, 2027, 2052, + 2053, 2069, 43, -590, 536, 3564, 2086, 2075, 536, 1622, + 1080, 1837, 2153, 1258, 3076, 23, 2154, 1627, 536, 44, + 552, 2082, 534, 2084, 2085, 2083, 2118, 1677, 903, 2158, + 2162, 2167, 3077, 2168, 2165, 536, 536, 2169, 534, 552, + 825, 2191, 534, 45, 1245, -1419, 825, -590, 2211, 2170, + 2212, 2214, 536, 2238, 536, 832, 2239, 46, 2245, 26, + 27, 28, -590, 2257, -1419, 1838, 2258, -590, 2259, 536, + 2260, 832, 896, 932, 2261, 832, 1199, 933, 2275, 2265, + 834, 2278, 3310, 732, 553, 2288, 2289, 2287, 2292, 2309, + 2290, 2291, 732, 732, 732, 2313, 834, 2314, 2317, 2322, + 834, 2326, 2330, 553, 2354, 2354, 2354, 2000, 2001, 2002, + 1259, 2003, 2004, 2005, 2006, 2007, 2008, 2788, -590, 2332, + 2340, 2358, 2331, 2359, 2364, 2365, 33, 897, 2403, 2415, + 3467, 2401, 2402, 1833, 2435, 2425, 3078, 2436, 536, -590, + 554, 2419, 2437, 2438, 2439, 2440, 3079, 1337, 2000, 2001, + 2002, 2717, 2003, 2004, 2005, 2006, 2007, 2008, 2454, 991, + 555, 1260, 26, 27, 28, 38, 2458, 1959, 1961, 2461, + 2459, 2500, 1261, 2501, 1404, 2503, 2502, 2824, 1596, 1908, + 732, 1862, 2504, 1909, 1262, 1607, 1911, 1912, 2506, 73, + -590, 2510, 2842, 2519, 2016, 1991, 2329, 2527, 2557, -590, + 40, 3022, 2015, 2564, 2565, 1246, 2566, 2343, 2586, 2346, + 2574, 43, 2357, 2570, 2575, 2598, 1263, 2610, 2596, 556, + 2612, 2617, 2366, 2618, 2368, 2619, -224, 2621, 825, 33, + 2627, 2628, 2622, 2641, 2635, 2623, 2636, 2375, 556, 2624, + 2639, 1607, 2378, 2640, 825, 536, 2383, 2384, 825, 2386, + 2642, 2390, 2391, 2643, 2644, 2646, 2645, 23, 2647, 2657, + 1649, 732, 1668, 2653, 2664, 1264, 46, 2672, 38, 1248, + 2665, 1265, 557, 1963, 558, 2667, 1596, 2679, 2688, 2689, + 2694, 2884, 1256, 2885, 3569, 2695, 3571, 2890, 2696, 2893, + 2173, 557, 2712, 992, 2707, 2714, 1266, 559, 2715, 536, + 560, 1267, 1257, 40, 1604, 2721, 3579, 552, 2737, -727, + 2724, 2735, 2741, 2734, 43, 2738, 559, 1268, 2723, 560, + 2745, 2746, 1805, 824, 2752, 2749, 2750, 2755, 2758, 824, + 2754, 44, 2779, 534, 2790, 2781, 2795, 2797, 2833, 2796, + -1907, 536, 2803, 2817, 2804, 2805, 2818, 3581, 1258, 3583, + 1959, 1961, 2832, 2834, -590, 45, 2839, 1607, 2852, 2853, + 2856, 2857, 2860, 887, 1180, 1079, 832, 2867, 1991, 46, + 2879, 553, 1992, 1993, 536, 2886, 1250, -2188, -2188, -2188, + 2894, 536, 536, 2863, 2897, 1833, 2900, 2917, 2903, 2918, + 2904, 834, 3023, 2905, 2906, 2920, 2921, 536, 887, 2931, + 2932, 2956, 3715, 2937, 26, 27, 28, 2945, 2953, 2984, + 536, 1730, 2963, 536, 3672, 536, 2997, 2964, 1596, 3091, + 3003, 2982, 1607, 536, 932, 1598, 536, 536, 933, 2985, + 3014, 536, 536, 3041, 3037, 2998, 2133, 2988, 536, 3661, + 3676, -1907, 3000, 2134, 2135, 1259, 3005, 555, 2136, 2137, + 2138, 3009, 3043, 3015, 3017, 536, 3035, 3050, 3039, 3056, + 3057, 3063, 3083, 3122, 1655, 3123, 536, 3124, 3149, 3099, + 3128, 33, 3132, 3133, 3026, 3148, 3154, 3158, 3170, 3656, + 3171, 2418, 3180, 3181, 2199, 3186, 536, 3206, 3209, -1907, + 3175, 3213, 3217, 3227, 1604, 3228, 1260, 3231, 3232, 3257, + 2690, 3264, 3267, 3268, -1907, 3271, 1346, 1261, 3278, -1907, + 38, 824, 1404, -224, -1907, 3289, 3280, 3285, 3290, 1262, + 3303, 3697, 3698, -1907, 1596, 3291, 3297, 824, -1907, 3299, + 732, 824, 3298, 536, 536, 732, 3307, 732, 536, 536, + 3308, 3320, 2354, 3317, 3322, 40, 3323, 3105, 3327, 2361, + 3309, 1263, 3335, 536, 536, 2360, 43, 3336, 3338, 557, + -1907, 558, 3339, 3340, 3341, 3355, 536, 3343, 3357, 3344, + 3353, 3358, 887, 44, 3375, 3359, 3380, 1607, 1596, 3393, + 3377, -1907, 3384, 3388, 3378, 536, 3173, 560, 3385, 2824, + 1596, 3135, 3394, 3405, 1908, 3411, 3413, 45, 1909, 3397, + 3399, 1911, 1912, 3408, 3416, 3401, 1265, 3407, 3412, 1079, + 3419, 3024, 1991, 2499, 3420, 1598, 1992, 1993, 3423, 3441, + 1596, 1994, 1995, 1996, 3159, 3163, 3439, 1596, 3440, 3445, + 3452, 1266, -1907, 887, 3455, -1907, 3457, 3469, 3470, 1950, + 536, -1907, 3524, 1607, 3526, 3532, 3534, 3551, 3535, 3548, + 3549, 3552, 1268, 3554, 1999, 3704, 3573, 3566, 3567, 3576, + 536, 536, 3588, 536, 3570, 3574, 3599, 536, 3582, 3601, + 536, 1596, 532, 543, 3611, 1596, 3316, 3615, 567, 3617, + -2153, 1596, -1907, -2154, 567, 3637, 3618, 3642, 822, -2155, + 837, -2156, -2157, -2158, 840, 567, 849, 536, -2159, 849, + -2160, -2161, 869, 869, -2162, 1596, 869, -1907, 3638, 567, + 567, 3830, -2163, 1599, 3628, 3634, 23, 536, -2164, -2166, + -2167, 2864, 536, 536, -2168, 2727, -2169, 536, 1607, -2170, + -2171, 3635, 536, 887, -2172, 536, 536, -2173, -2175, -2176, + 536, 1337, 822, 822, 536, -2177, 3639, -2178, 536, 3647, + -2179, -2180, -2181, -2182, -2183, -2184, -2185, -2186, -2187, -1372, + 536, 23, 3649, 3651, 3260, 3654, 3655, 874, 869, 3658, + 3266, 3659, 2108, 2112, 3660, 917, 869, 567, 869, 869, + 869, 934, 534, 2110, 79, 2115, 3665, 3667, 2111, 2114, + 3669, 3670, 3673, 3678, -1371, 3683, -1907, 3691, 1042, 3693, + 3700, 3701, 1997, 1043, 3720, 3739, 536, -1907, 3702, 3742, + 3747, 3710, 3712, 3744, 536, 832, 3714, 1604, 3750, 3769, + 3751, 3765, 3778, 3740, 3768, 1998, 3741, -1907, 3786, -1907, + -1907, 3793, 3798, 536, 2859, 3812, 3803, 3805, 3807, 3817, + 834, 3828, 1607, 3824, 3829, 3098, 3831, 1202, 2767, 2367, + 2777, 3593, 3102, 3595, 3030, 3708, 3664, 3804, 3360, 2512, + 3330, 2881, 1044, 26, 27, 28, -1907, 3735, 3687, -1907, + -1907, -1907, -2188, -2188, -2188, 732, 2003, 2004, 2005, 2006, + 2007, 2008, 3785, 3465, 3738, 3745, 1178, 2842, 732, 3779, + 3547, 1496, 2757, 2784, 1822, 1607, 2336, 2337, 1999, 3153, + 2842, 1607, 3736, 1599, 3106, 887, 3067, 3364, 26, 27, + 28, 536, 536, 3743, 536, 1604, 2753, 3734, 1945, 3733, + 1655, 3810, 3449, 536, 1607, 2873, 3167, 2875, 1905, 2740, + 33, 2828, 3131, 1742, 1494, 1045, 2726, 2316, 1598, 536, + 3108, 1785, 1784, 2139, 2140, 2141, 1495, 2142, 2143, 2144, + 2145, 2146, 2147, 3713, 2908, 1655, 2736, 2284, 3650, 3572, + 2315, 826, 1789, 2711, 2602, 1524, 3216, 3415, 1607, 38, + 1461, 1046, 2934, 2902, 536, 33, 2901, 3471, 3653, 2616, + 3652, 2958, 73, 2662, 1445, 1447, 1451, 1047, 825, 1452, + 536, 536, 1453, 1454, 536, 1455, 536, 1456, 1048, 2729, + 2686, 3438, 1457, 2632, 40, 2684, 2663, 2976, 2041, 3042, + 3270, 3240, 3640, 3269, 38, 43, 1006, 2413, 1957, 2609, + 1234, 2253, 3031, 2255, 1406, 3436, 2883, 2394, 536, 0, + 0, 0, 44, 0, 1049, 0, 1598, 1676, 1470, 0, + 1677, 1596, 0, 0, 1678, 1679, 0, 0, 0, 40, + 0, 0, 536, 0, 0, 2059, 45, 1604, 0, 0, + 43, 0, 0, 0, 0, 1676, 0, 0, 1677, 0, + 46, 0, 1678, 1679, 0, 0, 1687, 44, 3520, 0, + 0, 1050, 0, -2188, 0, 0, 0, 0, 1051, 0, + 0, 0, 0, 0, 0, 0, 3513, 1596, 0, 73, + 0, 45, 732, 0, 1687, 0, 0, 0, 0, 0, + 1689, -2188, 0, 3530, 2842, 46, 2000, 2001, 2002, 0, + 2003, 2004, 2005, 2006, 2007, 2008, 0, 0, 3046, 886, + 1052, 536, 3048, 73, 0, 0, 0, 0, 1689, 3553, + 536, 0, 536, 3172, 536, 0, 0, 1966, 536, 1053, + 536, 0, 536, 0, 0, 0, 0, 0, 0, 0, + 0, 3100, 0, 1604, 0, 534, 536, 0, 0, 0, + 0, 536, 536, 0, 0, 0, 2670, 0, 1598, 3109, + 3110, 3111, 3112, 536, 3114, 3115, 3116, 3117, 3118, 0, + 1655, 0, 0, 0, 1967, 0, 0, 0, 832, 3592, + 732, 3594, 0, 0, 2680, 536, 0, 0, -2188, 0, + 0, 0, 3604, 1596, 0, 1968, 869, 1604, 0, 0, + 0, 869, 1054, 834, 0, -2188, 1599, 2060, 0, 1604, + -2188, 567, 0, 1969, 0, 0, -2188, 0, 1970, 1781, + 0, 0, 0, 0, 0, 0, 3520, 0, 1470, 0, + 0, 0, 0, -2188, 0, 0, 0, 0, -2188, 1604, + 0, 1971, 0, 0, 1972, 0, 1604, 0, 0, -2188, + 0, 824, 0, 0, 0, 0, 0, 0, 1596, 0, + 1973, 73, 0, 0, 1598, 0, 0, 3624, 0, 0, + 886, 0, 3631, 0, 0, 0, 0, -2188, 0, 0, + 0, 0, 1042, 536, 0, 0, 0, 1043, 0, 0, + 1604, 0, 3636, 536, 1604, 0, 0, 0, 0, 0, + 1604, 0, 0, 0, 1599, 536, 1698, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 3363, 0, 1598, 0, + 536, 0, 536, 1601, 1604, 0, 0, 0, 0, 0, + 1598, 0, 0, 0, 1698, 0, 0, 23, 0, 0, + 0, 536, 0, 0, 0, 0, 1044, 0, 0, 0, + 0, 0, 0, 0, 534, 0, 1974, 536, 536, 0, + 1598, 0, 1256, 0, 1975, 0, 0, 1598, 536, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1601, 0, 0, 0, 822, 0, 0, 1601, 0, 0, - 0, 0, 0, 0, 0, 0, 567, 0, 0, 0, - 822, 0, 0, 0, 822, 2267, 0, 0, 0, 2000, - 2001, 2002, 0, 2003, 2004, 2005, 2006, 2007, 2008, 0, + 0, 0, 1257, 536, 0, 0, 1976, 832, 0, 0, + 0, 0, 0, 0, 0, 73, 3520, 0, 732, 0, + 0, 0, 534, 0, 981, 567, 567, 0, 0, -2188, + 3604, 1598, 834, 1596, 3513, 1598, 1977, 0, 0, 1045, + 0, 1598, 0, 0, 0, 536, 0, 0, 1258, 3748, + 0, 0, 3311, 0, 0, 832, 0, -2188, 0, 536, + 536, 536, 1655, 0, 0, 1598, 1599, 0, 1004, 543, + 536, 0, 0, 0, 532, 1046, 869, 0, 3766, 534, + 834, 0, 0, 0, 0, 822, 0, 1470, 1470, 1031, + 1031, 1047, 822, 1470, 0, 1031, 1058, 0, 0, 1596, + 536, 0, 1048, 0, 26, 27, 28, 0, 849, 849, + 849, 0, 832, 849, 0, 0, 0, 0, 0, 0, + 0, 1128, 1128, 849, 849, 0, 849, 0, 849, 0, + 0, 0, 0, 1601, 0, 0, 0, 834, 1049, 0, + 869, -2188, 0, 0, 0, 1259, 567, 0, 1705, 1706, + 1707, 1708, 1709, 1710, 0, 0, 0, 0, 0, 869, + 536, 0, 0, 0, 0, 0, 0, 536, 0, -2188, + 0, 33, 1599, 869, 837, 0, 1705, 1706, 1707, 1708, + 1709, 1710, 0, 0, 1596, 1050, 0, 0, 0, 0, + 0, 0, 1051, 1602, 0, 0, 1260, 0, 0, 0, + 0, 1676, 0, 0, 1677, 0, 0, 1261, 1678, 1679, + 38, 0, 869, 1342, 0, 0, 0, 0, 0, 1262, + 0, 73, 0, 1352, 0, 0, 1599, 869, 869, 869, + 869, 869, 0, 0, 1052, 0, 0, 0, 1599, 0, + 1687, 0, 0, 0, 1375, 40, 0, -2188, 0, 0, + 3558, 1263, 0, 1053, 0, 0, 43, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1599, 0, + 0, 0, 0, 44, 1689, 1599, 1031, 1058, 0, 869, + 1604, 0, 1468, 0, 0, 0, 0, 0, 1031, 1031, + 0, 0, 1603, 0, 0, 567, 0, 45, 1596, 0, + 0, 822, 3468, 822, 0, 0, 1265, 73, 0, 73, + 0, 46, 822, 0, 0, 0, 0, 0, 0, 1599, + 3522, 3523, 567, 1599, 0, 0, 1054, 0, 0, 1599, + 0, 1266, 0, 0, 0, 0, 1604, 0, 0, 1611, + 2989, 0, 0, 0, 0, 3536, 0, 0, 0, 0, + 0, 1596, 1268, 1599, 0, 0, 0, 1596, 0, 0, + 0, 0, -1909, 0, 0, 0, 0, 567, 0, 0, + 0, 0, -2188, 0, 0, 0, 1042, 0, 0, 0, + 1596, 1043, 0, 1602, 0, 0, 2286, 0, 0, -2188, + 0, 0, 567, 0, -2188, 0, 0, 0, 0, 0, + 73, 1598, 0, 0, 1676, 0, 0, 1677, 0, 0, + 0, 1678, 1679, 0, 0, 0, -2188, -2188, -2188, 0, + 73, 0, 0, 0, 1596, 0, 0, 0, 0, 0, + 0, 0, 0, -2188, 0, 0, 0, 0, 0, 0, + 1044, 0, 0, 1687, 0, 1736, 0, 0, 0, 0, + 1688, 0, 1604, 0, 0, 0, 1601, 1598, 0, 0, + 0, 567, 567, -1909, 0, 0, 0, 0, 869, 0, + 0, 869, 0, 0, 0, 0, 0, 1689, 0, 0, + 0, 0, 1603, 0, 0, 0, 0, 0, 0, 0, + 1698, 0, 1468, 1128, 1128, 0, 0, 0, 0, 0, + 0, 0, 869, 0, 0, 1809, 0, 869, 1821, 0, + 0, -1909, 0, 1045, 0, 0, 0, 1604, 0, 0, + 869, 0, 0, 0, 0, 0, -1909, 0, 0, 0, + 0, -1909, 0, 0, 1596, 0, -1909, 869, 0, 0, + 0, 869, 0, 0, 0, -1909, 0, 1873, 0, 1046, + -1909, 0, 0, 0, 1601, 0, 0, 73, 0, 0, + 0, 0, 0, 0, 0, 1047, 0, 0, 0, 0, + 0, 0, 0, 1598, 0, 1690, 1048, 0, 0, 0, + 0, 0, -1909, 0, 0, 0, 73, 0, 0, 0, + 0, 0, 1691, -2188, 0, 0, 0, 1692, 0, 0, + 0, 0, 0, -1909, 0, 0, 0, 0, 0, 1893, + 0, 869, 1049, 1470, 1470, 1470, 1470, 1470, 1470, 869, + 0, 1470, 1470, 1470, 1470, 1470, 1470, 1470, 1470, 1470, + 1470, 0, 1938, 1229, 0, 0, 1695, 0, 1598, 0, + 0, 981, 0, 0, 0, 0, 981, 3721, 567, 567, + 0, 567, 981, 0, -1909, 0, 0, -1909, 0, 1050, + 0, 0, 0, -1909, 0, 0, 1051, 0, 0, 0, + 0, 0, 1604, 0, 0, 868, 0, 0, 0, 876, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1599, + 0, 0, 0, 1698, 0, 0, 1601, 0, 0, 0, + 0, 0, 1596, 0, -1909, -2188, 1602, 0, 1052, 0, + 0, 0, 1705, 1706, 1707, 1708, 1709, 1710, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1053, 0, -1909, + 0, 1468, 1468, 0, 0, 0, 0, 1468, 1604, 532, + 0, 914, 0, 0, 0, 1599, 0, 0, 0, 919, + 0, 922, 1031, 926, 567, 2034, 0, 0, 0, 1128, + 1128, 0, 869, 0, 0, 0, 0, 0, 0, 822, + 0, 822, 0, 0, 822, 0, 0, 0, 0, 822, + 0, 1128, 822, 0, 822, 0, 0, 0, 822, 874, + 567, 0, 567, 1598, 0, 0, 1700, 0, 0, 0, + 1054, 0, 1601, 0, 1602, 1603, 0, 0, 0, 0, + 568, 0, 0, 0, 1470, 1470, 568, 0, -1909, 0, + 823, 0, 0, 1604, 0, 0, 0, 568, 0, -1909, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1601, 0, 0, 0, 1601, 0, 0, 1602, 0, - 0, 1601, 0, 0, 0, 567, 0, 0, 1468, 0, - 1128, 567, 0, 0, 1596, 0, 0, 0, 0, 0, - 0, 1603, 0, 0, 0, 1601, 0, 1079, 0, 0, - 1991, 0, 0, 1893, 1992, 1993, 0, 0, 0, 1994, - 1995, 1996, 0, 0, 0, 0, 0, 1079, 73, 0, - 1991, 0, 0, 0, 1992, 1993, 2978, 0, 0, 1994, - 1995, 1996, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 3293, 1079, 0, 0, - 1991, 0, 0, 0, 1992, 1993, 0, 0, 0, 1994, - 1995, 1996, 0, 0, 950, 0, 0, 0, 0, 957, - 0, 0, 0, 0, 0, 0, 3294, 0, 0, 0, - 0, 0, 0, 0, 1470, 1470, 1893, 0, 0, 1603, - 1470, 0, 0, 869, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1352, 0, 0, 1893, 869, 869, 869, - 1602, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 567, 0, 869, 0, 0, 0, 869, 0, 0, 869, + 0, 568, 568, 0, 0, 0, 0, 0, 0, -1909, + 0, -1909, -1909, 0, 0, 0, 1601, 0, 0, 1598, + 0, 1599, 0, 0, 0, 0, 0, 0, 1601, 0, + 0, 0, 1596, 0, 823, 823, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, -1909, 0, + 0, -1909, -1909, -1909, 0, 0, 0, 0, 1601, 0, + 0, 2148, 0, 1603, 0, 1601, 0, 0, 1701, 568, + 0, -2188, -2188, -2188, 567, 1705, 1706, 1707, 1708, 1709, + 1710, 0, 0, 0, 0, 0, 1599, 0, 0, 0, + 1470, 0, 0, 0, 0, 0, 0, 1604, 0, 0, + 0, 0, 0, 0, 1598, 0, 1602, 0, 0, 1601, + 0, 0, 0, 1601, 981, 0, 0, 1468, 0, 1601, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1598, 0, 0, 0, 0, 1599, 0, - 0, 0, 824, 0, 0, 0, 0, 0, 824, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 869, 0, 0, 0, 0, 0, 981, 0, + 0, 0, 0, 1601, 0, 1128, 0, 0, 0, 0, + 1604, 0, 0, 0, 0, 0, 1604, 0, 0, 0, + 2251, 0, 869, 0, 869, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 869, 0, 0, 2267, 1604, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1893, 1893, 0, 1893, 0, 0, 0, 1598, - 1676, 0, 0, 1677, 1599, 0, 0, 1678, 1679, 0, - 0, 0, 0, 1998, 0, 0, 1602, 0, 0, 0, - 0, 0, 0, 0, 532, 0, 0, 0, 0, 0, - 0, 1603, 1471, 1998, 0, 0, 0, 0, 0, 1687, - 0, 0, 2905, 0, 0, 0, -2183, 0, 0, 0, - 869, 869, 869, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1998, 567, 0, 1468, 0, 567, 0, - 1602, 0, 0, 1689, 567, 0, 0, 0, 0, 0, - 0, 0, 1602, 0, 0, 0, 1999, 0, 0, 0, - 0, 0, 0, 1655, 869, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1999, 0, 0, 2148, - 0, 0, 1602, 2199, 0, 1598, 0, 0, 0, 1602, - 1599, 567, 0, 0, 1015, 567, 0, 0, 568, 2689, - 1601, 0, 0, 0, 0, 0, 1999, 1603, 0, 3297, - 824, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1468, 1468, 0, 0, 0, 824, 0, 0, 0, - 824, 0, 0, 1602, 0, 0, 0, 1602, 0, 0, - 0, -2183, 0, 1602, 0, 3008, 0, 0, 0, 0, - 1598, 0, 3017, 2286, 0, 1599, 1601, 0, -2183, 2267, - 0, 1603, 0, -2183, 0, 0, 0, 1602, 0, 0, - 0, 0, 0, 1603, 0, 869, 0, 0, 0, 567, - 0, 1128, 0, 567, 567, 0, 0, 3045, 567, 0, - 0, 1233, 1893, 1821, 1893, 0, 1938, 0, 0, 0, - 0, 0, -2183, 1603, 0, 0, 0, 0, 0, 0, - 1603, 0, 1471, 0, 0, 0, 0, 567, 0, 1821, + 1468, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1603, 0, 0, 0, 0, + 0, 0, 1602, 0, 0, 869, 0, 567, 1598, 0, + 0, 0, 0, 1604, 0, 0, 0, 0, 0, 2318, + 2320, 0, 0, 0, 0, 2323, 0, 0, 1821, 567, + 0, 1599, 0, 0, 0, 0, 0, 0, 0, 0, + 567, 2344, 567, 1821, 0, 567, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 567, 1602, 567, 0, 0, + 0, 1598, 0, 0, 0, 0, 0, 1598, 1602, 981, + 567, 0, 0, 0, 981, 567, 0, 0, 0, 567, + 567, 1821, 567, 0, 567, 567, 0, 0, 0, 0, + 1598, 0, 1676, 0, 0, 1677, 0, 1599, 1602, 1678, + 1679, 1603, 0, 0, 0, 1602, 2414, 0, 0, 0, + 0, 0, 0, 0, 1352, 0, 869, 869, 869, 869, + 869, 869, 0, 1604, 0, 0, 0, 0, 0, 0, + 0, 1687, 0, 0, 1598, 0, 2442, 0, -2188, 950, + 0, 0, 0, 0, 957, 0, 0, 0, 0, 1602, + 0, 0, 0, 1602, 0, 1603, 0, 2505, 0, 1602, + 0, 0, 0, 0, 0, 1689, 0, 1603, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1341, 0, 0, 0, 567, 567, 567, 567, 1821, 567, - 567, 567, 567, 567, 0, 1356, 1358, 1361, 1363, 1365, - 0, 0, 0, 0, 1603, 0, 0, 0, 1603, 1698, - 0, 1598, 0, 0, 1603, 0, 1599, 0, 0, 2441, - 0, 0, 1601, 0, 2000, 2001, 2002, 869, 2003, 2004, - 2005, 2006, 2007, 2008, 0, 0, 0, 0, 1603, 0, - 3198, 0, 568, 568, 2000, 2001, 2002, 1463, 2003, 2004, - 2005, 2006, 2007, 2008, 1598, 0, 0, 0, 0, 1599, - 0, 0, 0, 0, 0, 0, 1938, 0, 0, 2862, - 0, 0, 0, 1893, 2000, 2001, 2002, 0, 2003, 2004, - 2005, 2006, 2007, 2008, 1468, 0, 0, 1601, 0, 0, - 567, 0, 0, 0, 0, 0, 0, 869, 869, 869, - 869, 0, 823, 0, 0, 0, 0, 0, 0, 0, - 0, 1468, -2183, 0, 1468, 0, 0, 0, 567, 981, - 1598, 0, 0, 0, 0, 1599, 0, 3271, 0, 0, - 1470, 1470, 1470, 1470, 1470, 1470, 0, 0, 1470, 1470, - 1470, 1470, 1470, 1470, 1470, 1470, 1470, 1470, 0, 0, - 567, 0, 0, 0, 0, 0, 0, 3279, 567, 0, + 0, 0, 1599, 1602, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1603, 0, 0, + 0, 0, 0, 0, 1603, 0, 0, 1468, 1468, 1468, + 1468, 1468, 1468, 0, 0, 1468, 1468, 1468, 1468, 1468, + 1468, 1468, 1468, 1468, 1468, 0, 0, 0, 0, 0, + 0, 2992, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1598, 567, 0, 0, 1603, 0, + 0, 0, 1603, 0, 1470, 1470, 0, 0, 1603, 869, + 0, 0, 0, -2188, 0, 0, 0, 0, 0, 1601, + 0, 0, 822, 0, 0, 0, 0, 0, 822, -1924, + -2188, 0, 1603, 0, 567, -2188, 0, 0, 0, 0, + 567, 1604, 0, 0, 0, 0, 1599, 0, 0, 2614, + 2614, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 568, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1417, 0, - 836, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 3307, 0, 822, 0, 0, 0, 0, 0, 1601, 0, - 0, 1471, 1471, 0, 1128, 1598, 0, 1471, 0, 0, - 1599, 3321, 0, 0, 0, 0, 2267, 0, 0, 0, - 0, 0, 2148, 0, -2183, 0, 0, 0, 0, 0, - 0, 1705, 1706, 1707, 1708, 1709, 1710, 1821, 0, 0, - 0, 1601, 0, 1893, 1418, 1419, 0, 0, 0, 0, - 0, 0, 1602, 0, 0, 0, 981, 567, 1468, 0, - 0, 0, 0, 0, 869, 0, 0, 0, 1655, 0, - 1807, 0, 0, 0, 0, 1811, 0, 0, 0, 0, - 0, 3377, 0, 0, 0, 1420, 1421, 0, 1843, 1422, - 1423, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1655, 0, 0, 0, 1601, 1602, 1868, - 0, 0, 1488, 0, 0, 0, 0, 0, 823, 1598, - 823, 0, 0, 0, 1599, 0, 0, 0, 0, 823, - 73, 1470, 1470, 0, 0, 0, 0, 0, 0, 1526, + 0, 0, 0, 1676, -2188, 1601, 1677, 0, 0, 0, + 1678, 1679, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1599, + 0, 0, 0, 0, 0, 1599, 0, 0, 0, 0, + 0, 0, 1687, 0, 0, 0, 0, 0, 0, -2188, + 0, 0, 0, 0, 567, 0, 0, 0, 1599, 567, + -1924, 1698, 0, 0, 567, 0, 0, 0, 0, 0, + 1676, 0, 0, 1677, 0, 0, 1689, 1678, 1679, 1015, + 0, 0, 0, 0, 0, 0, 0, 0, 1468, 1468, + 0, 0, 1598, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1599, 0, 0, 0, 0, 2148, -1924, 1687, + 0, 0, 0, 1468, 0, 0, -2188, 0, 0, 0, + 0, 1601, 0, -1924, 0, 0, 0, 0, -1924, 0, + 0, 0, 0, -1924, 0, 0, 0, 0, 0, 0, + 822, 1604, -1924, 1689, 0, 0, 0, -1924, 1470, 0, + 0, 0, 567, 0, 0, 0, 822, 0, 0, 0, + 822, 2267, 0, 0, -2188, 0, 0, 0, 0, 0, + 0, 0, 0, 0, -2188, 3210, 1233, 0, 0, -1924, + 0, 0, 0, 0, 0, 0, 1601, 568, 568, 0, + 0, -2188, 0, 0, 0, 0, -2188, 0, 0, 1602, + -1924, 567, 0, 0, 1468, 0, 1128, 567, 0, 2993, + 0, 0, 1599, 0, 0, 1341, 0, 0, 0, 0, + 0, 0, 1471, 0, 0, 3239, 0, 0, 0, 1893, + 1356, 1358, 1361, 1363, 1365, -2188, 0, 0, 0, 0, + 0, -2188, 0, 0, 0, 0, 0, 823, 0, 0, + 0, -1924, 0, 0, -1924, 1602, 0, 0, -2188, 0, + -1924, 0, 1598, -2188, 0, 0, 0, 0, 0, 0, + 0, 1676, 0, 0, 1677, 0, -2188, 0, 1678, 1679, + 0, 0, 1463, 1705, 1706, 1707, 1708, 1709, 1710, 0, + 0, 0, 1698, 0, 0, 0, 0, 0, 1603, 0, + 0, -1924, -2188, 0, 0, 0, 0, 0, 568, 0, + 1687, 0, 0, 1893, 0, 0, 0, -2188, 0, 0, + 869, 0, 1470, 0, 0, 0, -1924, 0, 0, 0, + 1352, 0, 0, 1893, 869, 869, 869, 0, 0, 0, + 0, 1601, 0, 0, 1689, 0, 0, 567, 0, 869, + 0, 0, 0, 869, 1603, 0, 869, 0, 0, 1698, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1598, 0, 0, 3040, 0, 1599, - 0, 0, 0, 3394, 0, 0, 1424, 1425, 1893, 0, - 0, 0, 0, 1603, 0, 0, 0, 0, 0, 1898, - 0, 0, 0, 2441, 568, 0, 0, 1916, 0, 0, - 0, 0, 1601, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1660, - 3432, 0, 0, 0, 0, 1468, 0, 0, 0, 0, - 1598, 0, 0, 0, 1602, 1599, 1598, 0, 0, 1603, - 0, 1599, 0, 1426, 1427, 1428, 1429, 1430, 1431, 1432, - 1433, 3448, 0, 1434, 1435, 0, 73, 1470, 567, 1598, - 0, 0, 0, 2243, 1599, 567, 0, 0, 0, 0, + 0, 1602, 0, 0, 0, 0, 0, 0, 0, 0, + 1599, 0, 0, 0, 0, 0, 874, 0, 0, 0, + 0, 0, 0, 0, 0, -2188, 0, 0, 0, 869, + 0, 0, 0, 0, 0, 981, 0, 1601, 0, 0, + 3251, 0, 0, 0, 0, -1924, 0, 0, 0, 1893, + 1893, 0, 1893, 0, 0, 0, -1924, 0, 0, 0, + 0, 1470, 1471, 0, 0, 0, 1602, 0, 0, 0, + 0, 0, -2188, 0, 0, 0, -1924, 0, -1924, -1924, + 0, 532, 0, 0, 0, 0, 0, 1488, 0, -2188, + 0, 0, -2188, 823, -2188, 823, 0, 0, 0, 2907, + 1603, 0, 0, 0, 823, 0, 0, 869, 869, 869, + 0, 0, 0, 0, 1526, -1924, 0, 0, -1924, -1924, + -1924, 567, 1601, 1468, 0, 567, 0, 0, 0, 0, + 0, 567, 0, -2188, 0, 1807, 0, -2188, 0, 0, + 1811, 0, 0, 0, 1705, 1706, 1707, 1708, 1709, 1710, + 0, 869, 0, 1843, 0, 0, 0, 0, 0, 568, + 0, 0, 0, 0, 0, 1603, 2148, 0, 0, 0, + 0, 0, 0, 0, 1868, 0, 0, 0, 567, 0, + 1599, 0, 567, 0, 1660, 0, 0, 0, 0, 0, + 1698, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, -2188, 0, 0, 0, 1468, 1468, + 0, 1705, 1706, 1707, 1708, 1709, 1710, 0, 0, 0, + 0, 1602, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 3010, 0, 0, 1079, 1601, 0, 1991, 3019, + 0, 0, 1992, 1993, 1898, 0, 2267, 1994, 1995, 1996, + 0, 0, 1916, 568, 568, 0, 0, 0, 0, 0, + 0, 0, 869, 0, 2980, 0, 567, 0, 1128, 0, + 567, 567, 0, 0, 3047, 567, 0, 0, 0, 1893, + 1821, 1893, 0, 1938, 0, 0, 0, 1602, 3578, 1601, + 0, 0, 0, -2188, 0, 1601, 0, 0, 0, 0, + 0, 1471, 1471, 0, 567, 0, 1821, 1471, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1601, 0, + 1603, 0, 567, 567, 567, 567, 1821, 567, 567, 567, + 567, 567, 0, 0, 0, 0, 0, 0, 0, 1079, + 0, 0, 1991, 0, 0, 0, 1992, 1993, 0, 0, + 0, 1994, 1995, 1996, 0, 0, 0, 2442, 0, 0, + 0, 0, 1601, 0, 0, 869, 0, 0, 0, 0, + 0, 0, 1602, 0, 0, 0, 0, 0, 3152, 0, + 0, 0, 0, 0, 0, 0, 1603, 0, 0, 0, + 0, 0, 0, 0, 0, 2048, 0, 0, 0, 0, + 0, 0, 0, 0, 1938, -2188, 0, 0, 0, 0, + 0, 1893, 1705, 1706, 1707, 1708, 1709, 1710, 0, 0, + 0, 0, 1468, 0, 0, 0, 0, 0, 567, 0, + 0, 0, 0, 0, 0, 869, 869, 869, 869, 0, + 568, 568, 0, 568, 0, 0, 0, 0, 0, 1468, + 0, 1998, 1468, 0, 0, 0, 567, 981, 0, 0, + 0, 0, 0, 0, 0, 3225, 0, 0, 0, 0, + 1079, 1603, 1601, 1991, 0, 0, 0, 1992, 1993, 0, + 0, 0, 1994, 1995, 1996, 0, 1602, 0, 567, 0, + 0, 0, 0, 0, 0, 3233, 567, 0, 0, 3247, + 1079, 0, 0, 1991, 0, 0, 0, 1992, 1993, 0, + 0, 0, 1994, 1995, 1996, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1999, 0, 0, 0, 3261, 3248, + 822, 0, 2312, 0, 0, 0, 0, 0, 0, 1602, + 0, 0, 1128, 0, 1256, 1602, 568, 0, 0, 3275, + 0, 0, 0, 2243, 2267, 1998, 0, 0, 0, 0, + 2148, 823, 0, 823, 1257, 0, 823, 0, 1602, 0, + 0, 823, 0, 0, 823, 1821, 823, 0, 0, 0, + 823, 1893, 2072, 0, 2076, 1603, 0, 0, 0, 0, + 0, 0, 0, 0, 981, 567, 1468, 0, 0, 0, + 1471, 0, 869, 0, 0, 0, 0, 0, 0, 0, + 1258, 3089, 1602, 0, 0, 0, 0, 0, 0, 3331, + 0, 3090, 0, 0, 0, 0, 0, 0, 1999, 0, + 0, 0, 0, 0, 0, 2252, 0, 2254, 1603, 0, + 1601, 0, 0, 0, 1603, 0, 0, 0, 2263, 1079, + 0, 0, 1991, 3345, 0, 0, 1992, 1993, 1893, 0, + 0, 1994, 1995, 1996, 0, 0, 0, 1603, 0, 0, + 0, 0, 0, 2442, 0, 0, 0, 0, 0, 0, + 0, 3091, 0, 0, 0, 0, 1998, 0, 2301, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 3467, 0, 0, 0, 886, 0, 568, 568, - 73, 0, 0, 0, 0, 0, 0, 0, 0, 1602, - 3218, 0, 0, 1598, 0, 3479, 0, 0, 1599, 0, - 1471, 0, 0, 3008, 0, 0, 1601, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1436, 1437, - 0, 0, 0, 0, 567, 0, 0, 0, 0, 567, - 2048, 0, 0, 0, 0, 0, 0, 1655, 0, 0, - 0, 1601, 0, 0, 0, 1603, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 567, 0, 0, 0, 1438, - 1439, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 567, 567, 0, 0, - 0, 0, 0, 0, 0, 1418, 1419, 0, 0, 0, - 0, 0, 0, 0, 869, 0, 3198, 0, 0, 0, - 1602, 567, 0, 0, 0, 0, 1598, 1601, 0, 0, - 1603, 1599, 0, 1601, 0, 0, 0, 0, 824, 0, - 869, 0, 0, 3557, 0, 0, 1420, 1421, 73, 0, - 1422, 1423, 0, 0, 0, 0, 1601, 886, 0, 0, - 0, 0, 1468, 1602, 1128, 0, 567, 1031, 0, 1031, - 0, 0, 0, 0, 567, 0, 0, 0, 0, 1440, - 1441, 0, 0, 0, 0, 568, 568, 0, 568, 0, - 0, 0, 0, 0, 0, 1128, 0, 0, 0, 3321, - 1601, 0, 0, 1442, 1443, 0, 0, 0, 0, 0, - 869, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1424, 1425, 1602, + 3386, 0, 0, 0, 0, 1468, 2160, 1259, 0, 0, + 0, 1603, 0, 0, 0, 0, 1998, 0, 0, 0, + 0, 0, 1602, 0, 0, 0, 0, 0, 0, 0, + 0, 3402, 0, 0, 0, 0, 0, 0, 567, 0, + 0, 0, 2000, 2001, 2002, 567, 2003, 2004, 2005, 2006, + 2007, 2008, 0, 0, 0, 0, 0, 0, 1260, 1999, + 0, 0, 3421, 0, 0, 0, 0, 0, 0, 1261, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 869, 1603, 0, 0, 0, 0, 0, 1471, 1471, 1471, + 0, 1262, 0, 3092, 0, 3433, 0, 0, 0, 1999, + 0, 0, 0, 3010, 0, 0, 0, 0, 0, 2426, + 2427, 2429, 2430, 2431, 2432, 0, 0, 0, 0, 0, + 1601, 0, 0, 1263, 567, 0, 0, 0, 0, 567, + 0, 1603, 0, 0, 0, 0, 0, 1471, 1471, 1471, 1471, 1471, 1471, 0, 0, 1471, 1471, 1471, 1471, 1471, - 1471, 1471, 1471, 1471, 1471, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 3448, - 0, 0, 0, 0, 1603, 0, 0, 1128, 0, 0, - 2252, 568, 2254, 0, 1426, 1427, 1428, 1429, 1430, 1431, - 1432, 1433, 3557, 2263, 1434, 1435, 823, 0, 823, 0, - 0, 823, 0, 1601, 1602, 0, 823, 0, 0, 823, - 0, 823, 0, 0, 0, 823, 0, 2072, 0, 2076, - 73, 0, 3198, 0, 0, 0, 0, 735, 0, 0, - 1470, 1470, 0, 2301, 981, 981, 0, 3557, 981, 0, - 1603, 0, 0, 0, 0, 0, 2034, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 567, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1655, 0, 1436, - 1437, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1243, 3198, 736, 0, 0, 0, 1244, 0, - 3557, 0, 0, 0, 0, 0, 1256, 0, 1598, 0, - 737, 0, 0, 1599, 0, 0, 0, 0, 0, 0, - 1438, 1439, 0, 0, 0, 0, 1257, 0, 1602, 0, - 0, 0, 0, 0, 0, 1603, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 981, 0, 1471, 1471, - 0, 2160, 0, 0, 2425, 2426, 2428, 2429, 2430, 2431, - 738, 2267, 0, 1602, 0, 0, 3321, 0, 0, 2267, - 739, 0, 1258, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 740, 0, 0, 0, 0, 741, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1245, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 742, 0, 0, - 1440, 1441, 0, 0, 0, 0, 0, 0, 0, 1602, - 0, 0, 1143, 1143, 0, 1602, 0, 0, 0, 73, - 0, 0, 0, 0, 1442, 1443, 0, 0, 0, 1603, - 0, 0, 0, 1470, 0, 0, 0, 0, 1602, 0, - 0, 743, 0, 0, 1471, 3554, 744, 0, 0, 1259, + 1471, 1471, 1471, 1471, 1471, 567, 2000, 2001, 2002, 568, + 2003, 2004, 2005, 2006, 2007, 2008, 0, 0, 0, 0, + 0, 0, 0, 567, 567, -2188, 0, 0, 1265, 0, + 0, 568, 0, 1143, 1143, 0, 0, 0, 0, 0, + 0, 869, 568, 3152, 568, 0, 0, 568, 567, 0, + 1602, 0, 0, 1266, 0, 0, 0, 568, 0, 568, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 3256, 0, 0, 0, 1603, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 568, 1601, 0, 2580, 0, 0, - 0, 0, 1602, 0, 0, 0, 0, 0, 1286, 0, - 0, 0, 1332, 1339, 0, 0, 568, 0, 0, 0, - 1260, 0, 73, 0, 73, 0, 0, 568, 0, 568, - 3285, 1261, 568, 0, 0, 0, 0, 0, 745, 0, - 0, 0, 568, 1262, 568, 0, 0, 0, 0, 0, - 1603, 0, 0, 746, 0, 0, 1603, 568, 0, 0, - 0, 0, 568, 0, 1246, 1390, 568, 568, 73, 568, - 0, 568, 568, 0, 0, 1263, 0, 0, 0, 1603, - 0, 0, 0, 1414, 0, 73, 0, 0, 747, 1462, - 0, 748, 1464, 0, 0, 1475, 1478, 1483, 1486, 0, - 0, 0, 749, 0, 0, 750, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1602, 0, 0, 0, 0, - 0, 0, 0, 1603, 1264, 751, 0, 1470, 1248, 0, - 1265, 0, 0, 0, 0, 0, 0, 0, 0, 752, - 1530, 1332, 0, 0, 0, 0, 0, 754, 0, 0, - 0, 0, 0, 0, 0, 1266, 0, 755, 0, 0, - 1267, 0, 1617, 756, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1268, 0, 0, 0, - 0, 0, 1634, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 757, 0, 1645, 1646, 1647, 0, 1652, 1656, - 0, 1676, 0, 0, 1677, 0, 0, 0, 1678, 1679, - 1680, 1681, 0, 1682, 1683, 1684, 0, 0, 73, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1685, 0, 568, 0, 1719, 1250, 1603, 0, 0, 0, - 1687, 0, 0, 0, 73, 0, 0, 1688, 0, 1243, - 0, 0, 1530, 1530, 0, 1244, 0, 0, 0, 823, - 0, 0, 0, 1256, 0, 823, 0, 0, 0, 0, - 0, 2600, 0, 0, 1689, 0, 0, 2076, 0, 0, - 0, 0, 0, 1257, 1470, 0, 0, 0, 0, 1759, - 0, 0, 0, 1775, 1780, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1143, 1143, 1675, 0, 0, 0, - 0, 1676, 0, 0, 1677, 0, 0, 0, 1678, 1679, - 1680, 1681, 0, 1682, 1683, 1684, 0, 0, 0, 1258, - 0, 0, 0, 0, 0, 0, 0, 1471, 1471, 0, - 1685, 0, 0, 0, 1686, 0, 0, 0, 0, 0, - 1687, 0, 0, 0, 0, 0, 0, 1688, 0, 0, - 1245, 2160, 0, 0, 0, 0, 568, 0, 1332, 0, - 0, 1660, 1690, 0, 0, 0, 0, 2828, 0, 1332, - 0, 0, 0, 0, 1689, 0, 0, 0, 0, 1691, - 0, 2844, 2845, 2847, 1692, 0, 0, 1602, 0, 0, - 0, 0, 0, 0, 1332, 0, 2860, 0, 0, 0, - 2863, 0, 0, 2866, 0, 0, 0, 1693, 1694, 0, - 0, 0, 0, 0, 0, 0, 1259, 0, 0, 0, - 0, 0, 0, 1695, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 823, 0, 0, - 0, 0, 0, 0, 0, 0, 2878, 0, 0, 568, - 0, 0, 0, 823, 0, 0, 0, 823, 0, 0, - 0, 0, 0, 1696, 0, 0, 1697, 1260, 0, 0, - 0, 0, 1690, 0, 0, 0, 0, 0, 1261, 0, - 1698, 0, 1981, 1699, 0, 0, 0, 0, 0, 1691, - 1262, 0, 0, 0, 1692, 0, 0, 0, 568, 0, - 0, 3574, 0, 0, 2743, 0, 0, 0, 1603, 0, - 0, 1246, 0, 0, 0, 0, 0, 1693, 1694, 0, - 0, 0, 1263, 0, 2912, 2913, 2914, 0, 0, 0, - 0, 0, 0, 1695, 0, 0, 0, 0, 0, 0, - 1471, 0, 0, 0, 0, 1483, 0, 1483, 1483, 0, + 869, 0, 568, 3561, 1268, 0, 3093, 568, 0, 3094, + 0, 568, 568, 0, 568, 0, 568, 568, 0, 0, + 0, 0, 1468, 0, 1128, 0, 567, 1031, 1999, 1031, + 0, 0, 2581, 0, 567, 0, 0, 0, 0, 1286, + 0, 0, 0, 1332, 1339, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1128, 0, 0, 0, 3275, + 0, 0, 0, 0, 0, 0, 0, 2000, 2001, 2002, + 869, 2003, 2004, 2005, 2006, 2007, 2008, 0, 0, 1603, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1143, 1143, 0, 0, 0, 0, 0, 1471, 0, 0, - 0, 2368, 0, 1696, 0, 1248, 1697, 1265, 0, 0, - 0, 0, 1143, 1700, 0, 0, 0, 0, 0, 0, - 1698, 0, 0, 1699, 0, 0, 0, 0, 0, 0, - 0, 0, 1266, 0, 0, 0, 0, 2369, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1268, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 568, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1390, 2000, 2001, 2002, + 0, 2003, 2004, 2005, 2006, 2007, 2008, 0, 0, 0, + 0, 0, 0, 0, 1414, 0, 0, 0, 1471, 1471, + 1462, 1833, 0, 1464, 0, 0, 1475, 1478, 1483, 1486, + 1676, 0, 0, 1677, 0, 0, 0, 1678, 1679, 1680, + 1681, 0, 1682, 1683, 1684, 0, 0, 869, 0, 0, + 1602, 0, 0, 0, 0, 0, 0, 0, 0, 1685, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1687, + 0, 1530, 1332, 0, 0, 0, 1688, 568, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 3402, + 0, 0, 0, 1617, 0, 0, 0, 1128, 0, 0, + 0, 0, 0, 1689, 823, 0, 0, 0, 0, 735, + 823, 0, 3561, 1634, 0, 0, 2601, 0, 0, 0, + 0, 0, 2076, 0, 0, 1645, 1646, 1647, 0, 1652, + 1656, 0, 0, 0, 1471, 0, 0, 0, 0, 0, + 0, 0, 0, 3152, 0, 0, 2000, 2001, 2002, 1603, + 2003, 2004, 2005, 2006, 2007, 2008, 0, 981, 981, 0, + 3561, 981, 0, 0, 0, 1719, 736, 0, 0, 2034, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 567, 0, 737, 1530, 1530, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 3036, - 0, 0, 1250, 0, 0, 0, 0, 2122, 0, 0, - 0, 0, 0, 1700, 0, 1701, 2126, 0, 1702, 1703, - 1704, 0, 1705, 1706, 1707, 1708, 1709, 1710, 0, 0, - 2157, 0, 0, 0, 1471, 1984, 0, 0, 0, 0, + 0, 1690, 0, 0, 0, 0, 2160, 0, 3152, 0, + 0, 568, 0, 0, 0, 0, 1660, 3561, 1691, 0, + 1759, 0, 0, 1692, 1775, 1780, 0, 0, 0, 0, + 0, 0, 738, 0, 0, 1143, 1143, 0, 0, 0, + 0, 0, 739, 0, 0, 0, 1693, 1694, 0, 0, + 0, 0, 0, 0, 0, 740, 0, 0, 0, 0, + 741, 0, 1695, 0, 0, 0, 0, 0, 981, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2171, 0, 0, 0, 0, 0, 0, 0, 2176, 0, - 0, 0, 0, 0, 2180, 2181, 2182, 2183, 2184, 2185, - 2186, 2187, 0, 0, 0, 0, 2196, 2197, 0, 0, - 0, 2210, 0, 0, 0, 2213, 0, 0, 2221, 2222, - 2223, 2224, 2225, 2226, 2227, 2228, 2229, 0, 0, 2230, - 0, 3186, 0, 0, 0, 0, 1143, 568, 1332, 0, - 0, 568, 0, 0, 0, 0, 0, 2072, 0, 0, - 0, 0, 0, 0, 0, 1701, 2256, 0, 1702, 1703, - 1704, 0, 1705, 1706, 1707, 1708, 1709, 1710, 0, 0, + 0, 0, 0, 2267, 0, 0, 0, 0, 3275, 742, + 0, 2267, 823, 0, 0, 0, 0, 0, 0, 1332, + 0, 0, 1696, 0, 568, 1697, 0, 0, 823, 0, + 1332, 0, 823, 2830, 0, 0, 0, 0, 0, 1698, + 0, 0, 1699, 0, 0, 0, 0, 2846, 2847, 2849, + 0, 0, 0, 743, 0, 1332, 0, 0, 744, 0, + 0, 0, 2862, 0, 0, 0, 2865, 0, 0, 2868, + 0, 0, 0, 568, 0, 1675, 0, 0, 0, 2744, + 1676, 0, 0, 1677, 0, 0, 0, 1678, 1679, 1680, + 1681, 0, 1682, 1683, 1684, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1685, + 0, 0, 2880, 1686, 0, 1676, 0, 0, 1677, 1687, + 0, 0, 1678, 1679, 555, 0, 1688, 1682, 1683, 1684, + 745, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1700, 1981, 1685, 746, 0, 0, 0, 0, + 0, 0, 0, 1689, 1687, 0, 0, 0, 0, 0, + 0, 1688, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 747, 0, 0, 748, 0, 0, 0, 0, 1689, 0, + 2914, 2915, 2916, 0, 749, 0, 0, 750, 0, 0, + 0, 0, 0, 0, 0, 0, 1483, 0, 1483, 1483, + 0, 0, 0, 0, 0, 0, 0, 751, 0, 568, + 0, 1143, 1143, 0, 0, 0, 0, 0, 1471, 1471, + 0, 752, 0, 0, 0, 0, 0, 0, 753, 754, + 0, 0, 0, 1143, 0, 0, 0, 0, 0, 755, + 0, 1690, 0, 0, 1701, 756, 0, 1702, 1703, 1704, + 0, 1705, 1706, 1707, 1708, 1709, 1710, 0, 1691, 1417, + 0, 836, 0, 1692, 1984, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 757, 0, 1690, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1693, 1694, 0, 0, + 0, 0, 0, 1691, 0, 0, 0, 0, 1692, 0, + 0, 0, 1695, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1646, 1647, 2963, 0, 0, 0, 2160, 0, - 0, 3234, 3235, 3236, 3237, 0, 0, 0, 0, 0, + 0, 1693, 1694, 0, 0, 1418, 1419, 0, 0, 0, + 0, 0, 0, 0, 0, 3038, 0, 1695, 2122, 0, + 0, 0, 1696, 0, 0, 1697, 0, 2126, 0, 0, + 0, 0, 0, 568, 0, 0, 0, 568, 0, 1698, + 0, 2157, 1699, 2072, 0, 0, 1420, 1421, 0, 0, + 1422, 1423, 0, 0, 0, 0, 0, 1696, 0, 0, + 1697, 2171, 0, 0, 0, 0, 0, 0, 0, 2176, + 0, 0, 0, 0, 1698, 2180, 2181, 2182, 2183, 2184, + 2185, 2186, 2187, 0, 0, 0, 0, 2196, 2197, 0, + 2965, 0, 2210, 0, 2160, 0, 2213, 0, 0, 2221, + 2222, 2223, 2224, 2225, 2226, 2227, 2228, 2229, 0, 0, + 2230, 0, 1471, 0, 0, 0, 0, 1143, 3140, 1332, + 0, 0, 0, 1418, 1419, 0, 0, 1424, 1425, 0, + 0, 0, 0, 0, 0, 0, 0, 2256, 0, 1471, + 0, 0, 1700, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1471, 0, 0, 0, 1676, 0, 0, 1677, 0, - 0, 0, 1678, 1679, 1680, 1681, 0, 1682, 1683, 1684, + 0, 0, 0, 0, 1420, 1421, 0, 0, 1422, 1423, + 0, 0, 0, 1646, 1647, 0, 0, 1700, 568, 0, + 0, 0, 568, 568, 0, 0, 0, 568, 3188, 3189, + 3190, 3191, 0, 0, 1426, 1427, 1428, 1429, 1430, 1431, + 1432, 1433, 0, 0, 1434, 1435, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 568, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1685, 0, 0, 0, 2968, 0, - 0, 0, 0, 0, 1687, 0, 0, 0, 0, 0, - 0, 1688, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 568, 0, 0, 0, 568, 568, 0, 0, - 0, 568, 0, 2395, 0, 0, 0, 0, 1689, 0, - 1332, 0, 0, 2406, 2407, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 568, 568, 568, 568, 0, 568, + 568, 568, 568, 568, 0, 1424, 1425, 0, 0, 0, + 0, 0, 0, 0, 1701, 0, 0, 1702, 1703, 1704, + 0, 1705, 1706, 1707, 1708, 1709, 1710, 0, 0, 0, + 0, 0, 0, 0, 2396, 0, 0, 0, 0, 1436, + 1437, 1332, 0, 0, 2407, 2408, 1471, 0, 0, 1701, + 0, 0, 1702, 1703, 1704, 0, 1705, 1706, 1707, 1708, + 1709, 1710, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1426, 1427, 1428, 1429, 1430, 1431, 1432, 1433, + 1438, 1439, 1434, 1435, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 568, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 568, 568, 568, - 568, 0, 568, 568, 568, 568, 568, 0, 0, 0, + 2072, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1390, 2513, 0, 0, 3318, -48, 0, 0, 0, + 2515, 0, 0, 0, 0, 0, 0, 0, 2601, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, + 2531, 2532, 0, 2533, 0, 0, 0, 0, 0, 2, + 0, 3, 4, 0, 0, 1471, 735, 1436, 1437, 0, + 2160, 0, 0, 0, 5, 0, 0, 0, 2160, 6, + 0, 0, 2559, 2560, 0, 0, 2256, 0, 7, 0, + 1440, 1441, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 8, 0, 0, 0, 0, 0, 1438, 1439, + 0, 9, 823, 10, 1442, 1443, 0, 2585, 0, 0, + 0, 0, 0, 736, 0, 11, 2595, 12, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 13, 737, + 0, 0, 0, 0, 0, 1530, 0, 1332, 0, 0, + 0, 0, 0, 14, 15, 16, 0, 0, 0, 0, + 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, + 18, 0, 0, 0, 0, 0, 0, 568, 0, 19, + 0, 20, 21, 0, 0, 0, 2630, 0, 0, 738, + 0, 0, 2637, 0, 0, 1472, 22, 0, 0, 739, + 23, 0, 0, 0, 0, 0, 0, 0, 1440, 1441, + 0, 0, 740, 0, 0, 0, 0, 741, 0, 0, + 0, 0, 0, 0, 0, 2649, 24, 0, 0, 2655, + 0, 0, 1442, 1443, 2660, 2661, 0, 0, 0, 1243, + 0, 0, -1529, 0, 0, 1244, 742, 0, 0, 0, + 0, 0, 2090, 1256, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, + 0, 0, 0, 1257, 0, 0, 0, 0, 0, 0, + 0, 2682, 0, 0, 2685, 0, 2687, 0, 0, 0, + 743, 0, 1471, 0, 0, 744, 0, 0, 0, 0, + 0, 0, 2691, 0, 3531, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1258, + 3410, 1713, 0, 0, 0, 0, 0, 2601, 0, 0, + 0, 0, 0, 3559, 0, 0, 0, 0, 0, 0, + 0, 0, 1759, 0, 0, 0, 0, 26, 27, 28, + 1245, 0, 0, 0, 0, 29, 0, 0, 30, 1780, + 2228, 0, 0, 0, 0, 0, 0, 745, 0, 0, + 1713, 0, 0, 0, 0, 0, 0, 0, 1143, 0, + 0, 0, 746, 0, 0, 0, 0, 0, 0, 31, + 0, 0, 0, 2751, 0, 0, 568, 0, 32, 0, + 0, 568, 0, 3602, 0, 1472, 0, 0, 0, 0, + 0, 0, 0, 0, 33, 0, 1259, 747, 0, 0, + 748, 34, 0, 0, 0, 35, 0, 568, 0, 0, + 0, 749, 0, 0, 750, 0, 0, 36, 0, 0, + 0, 0, 0, 0, 0, 568, 568, 0, 0, 37, + 0, 0, 0, 38, 751, 0, 0, 0, 0, 0, + 0, 0, 1647, 0, 1713, 0, 0, 1260, 752, 0, + 568, 1332, 0, 0, 39, 0, 754, 0, 1261, 0, + 3629, 0, 0, 0, 0, 0, 755, 0, 40, 0, + 1262, 41, 756, 0, 42, 0, 0, 0, 0, 43, + 1676, 0, 0, 1677, 0, 0, 0, 1678, 1679, 0, + 1713, 1246, 1682, 1683, 1684, 0, 44, 1713, 568, 0, + 0, 757, 1263, 0, 0, 0, 2160, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1687, + 45, 0, 0, 0, 0, 0, 1688, 0, 0, 0, + 0, 0, 0, 0, 46, 0, 0, -48, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1713, 2878, + 0, 2369, 0, 1689, 0, 1248, 0, 1265, 0, 0, + 0, 1676, 0, 0, 1677, 0, 0, 0, 1678, 1679, + 1680, 1681, 1713, 1682, 1683, 1684, 0, 0, 0, 0, + 0, 0, 1266, 0, 0, 0, 0, 2370, 0, 0, + 1685, 0, 0, 0, 2970, 0, 0, 0, 0, 0, + 1687, 0, 0, 1268, 0, 0, 0, 1688, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 3364, 0, - 1390, 2512, 0, 0, 0, 0, 0, 0, 0, 2514, - 1676, 0, 0, 1677, 0, 0, 0, 1678, 1679, 1680, - 1681, 0, 1682, 1683, 1684, 0, 1690, 0, 0, 2530, - 2531, 0, 2532, 0, 0, 0, 0, 0, 0, 1685, - 0, 0, 0, 1691, 0, 0, 0, 0, 1692, 1687, - 0, 0, 0, 0, 0, 0, 1688, 0, 0, 0, - 0, 2558, 2559, 0, 0, 2256, 0, -48, 0, 0, - 0, 1693, 1694, 2072, 0, 0, 0, 0, 1471, 0, - 0, 0, 0, 1689, 0, 0, 0, 1695, 0, 0, - 1, 0, 0, 0, 0, 0, 2584, 0, 0, 0, - 2, 2600, 3, 4, 0, 2594, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, - 6, 0, 0, 0, 1530, 0, 1332, 1696, 0, 7, - 1697, 0, 0, 2160, 0, 0, 0, 0, 0, 0, - 0, 2160, 0, 8, 1698, 0, 0, 1699, 0, 0, - 0, 0, 9, 0, 10, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 2629, 11, 0, 12, 0, - 0, 2636, 0, 0, 0, 823, 0, 0, 0, 13, + 1713, 0, 1713, 0, 1472, 1472, 0, 2009, 0, 0, + 1472, 0, 0, 1713, 1689, 0, 1713, 0, 0, 0, + 0, 1713, 0, 0, 1713, 0, 0, 0, 0, 0, 0, 1690, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 14, 15, 16, 0, 1691, 0, - 0, 0, 0, 1692, 2648, 17, 0, 0, 2654, 0, - 0, 18, 0, 2659, 2660, 0, 0, 0, 0, 0, - 19, 0, 20, 21, 0, 0, 1693, 1694, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 22, 0, 0, - 568, 23, 1695, 0, 0, 0, 0, 1700, 0, 0, + 0, 0, 1250, 0, 0, 0, 0, 0, 1691, 0, + 0, 0, 0, 1692, 0, 0, 0, 0, 2955, 0, + 0, 0, 0, 0, 0, 2957, 2126, 0, 1713, 0, + 0, 0, 0, 0, 0, 0, -2188, -2188, 0, 0, + 0, 2966, 1418, 1419, 0, 0, 0, 0, 0, 0, + 0, 0, 1695, 0, 2978, 0, 0, 2981, 0, 2983, + 0, 0, 0, 0, 0, 0, 0, 2987, 0, 0, + 0, 0, 1690, 0, 0, 2994, 2995, 0, 0, 0, + 0, 0, 3002, 1420, 1421, 0, 0, 1422, 1423, 1691, + 0, 0, 568, 0, 1692, -2188, 0, 0, 0, 3016, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1698, + 3032, 0, 0, 0, 0, 1713, 0, 1693, 1694, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2681, 0, 0, 2684, 0, 2686, 0, 24, 0, 0, + 1143, 0, 1713, 1695, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1713, 1713, 1713, 0, 0, 0, 0, + 1713, 0, 0, 0, 1713, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1424, 1425, 0, 0, 0, 0, + 0, 0, 0, 1696, 0, 0, 1697, 3103, 3104, 0, + 0, 0, 0, 1759, 0, 0, 0, 0, 0, 0, + 1698, 0, 0, 1699, 0, 0, 0, 2396, 2396, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 2690, 1696, -1524, 0, 1697, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1698, - 0, 0, 1699, 0, 0, 0, 0, 0, 0, 0, - 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1759, 0, 0, 0, 0, 0, 0, 3530, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1780, 2228, + 3129, 0, 1700, 0, 0, 0, 0, 1713, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 3143, + 0, 1426, 1427, 1428, 1429, 1430, 1431, 1432, 1433, 0, + 0, 1434, 1435, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1676, 0, 0, 1677, 0, 1713, 0, 1678, + 1679, 1680, 1681, 0, 1682, 1683, 1684, 0, 0, 0, + 0, 0, 0, 1713, 0, 0, 0, 0, 1713, 0, + 0, 1685, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1687, 0, 1700, 0, 2009, 0, 0, 1688, 0, + 0, 0, 0, 0, 3204, 3205, 0, 3208, 0, 0, + 0, 0, 0, 0, 0, 0, 1436, 1437, 0, 0, + 0, 0, 0, 0, 1701, 1689, 0, 1702, 1703, 1704, + 0, 1705, 1706, 1707, 1708, 1709, 1710, 0, 0, 0, + 0, 3229, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1438, 1439, 0, + 0, 3238, 0, 0, 0, 0, 3241, 3242, 0, 0, + 0, 3243, 0, 0, 0, 0, 3246, 0, 0, 3249, + 3250, 0, 0, 0, 2396, 1332, 0, 0, 3258, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3555, 0, 0, 1143, 0, 1701, - 0, 0, 1702, 1703, 1704, 0, 1705, 1706, 1707, 1708, - 1709, 1710, 2750, 0, 0, 0, 2166, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 26, 27, - 28, 0, 0, 0, 0, 0, 29, 0, 0, 30, - 0, 0, 1700, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1143, 1701, 0, 0, 1702, 1703, + 1704, 0, 1705, 1706, 1707, 1708, 1709, 1710, 0, 0, + 0, 0, 2166, 1690, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3598, 0, 0, 0, 0, 1676, - 31, 3456, 1677, 0, 0, 0, 1678, 1679, 2600, 32, - 1647, 1682, 1683, 1684, 0, 0, 0, 0, 0, 1332, - 0, 0, 0, 0, 3624, 33, 0, 0, 1685, 0, - 0, 0, 34, 1472, 1418, 1419, 35, 0, 1687, 0, - 0, 0, 0, 0, 0, 1688, 0, 0, 36, 0, + 1691, 0, 0, 0, 0, 1692, 0, 0, 0, 0, + 3306, 0, 0, 0, 0, 0, 0, 1440, 1441, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1693, 1694, + 0, 0, 0, 0, 0, 0, 0, 3325, 0, 1713, + 0, 1442, 1443, 0, 1695, 0, 0, 2009, 2009, 0, + 1472, 1472, 1472, 1472, 1472, 1472, 0, 0, 1472, 1472, + 1472, 1472, 1472, 1472, 1472, 1472, 1472, 1472, 2009, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 37, 0, 0, 0, 38, 0, 0, 0, 0, 0, - 0, 0, 1689, 0, 0, 1420, 1421, 568, 0, 1422, - 1423, 0, 568, 0, 1701, 39, 0, 1702, 1703, 1704, - 0, 1705, 1706, 1707, 1708, 1709, 1710, 0, 0, 40, - 0, 2166, 41, 0, 0, 42, 0, 0, 568, 0, - 43, 0, 0, 0, 0, 0, 0, 2876, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 44, 0, 568, - 568, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1696, 0, 0, 1697, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 45, 0, 0, 568, 0, 1424, 1425, 0, 1713, - 0, 0, 0, 0, 0, 46, 0, 0, -48, 0, - 1690, 1676, 0, 0, 1677, 0, 0, 0, 1678, 1679, - 1680, 1681, 0, 1682, 1683, 1684, 0, 1691, 0, 0, - 0, 0, 1692, 0, 0, 0, 0, 0, 0, 568, - 1685, 0, 0, 0, 0, 0, 0, 2160, 1713, 0, - 1687, 0, 0, 0, 0, 1693, 1694, 1688, 0, 0, - 0, 0, 0, 1426, 1427, 1428, 1429, 1430, 1431, 1432, - 1433, 1695, 0, 1434, 1435, 0, 0, 0, 0, 0, - 0, 0, 0, 1472, 1689, 0, 2953, 0, 0, 0, - 0, 0, 1676, 2955, 2126, 1677, 0, 0, 0, 1678, - 1679, 1680, 1681, 0, 1682, 1683, 1684, 0, 0, 2964, + 0, 1698, 0, 0, 1699, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 3382, 3383, 0, 2878, 1676, + 0, 0, 1677, 0, 0, 0, 1678, 1679, 1680, 1681, + 0, 1682, 1683, 1684, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1656, 0, 0, 0, 0, 1685, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1687, 0, + 0, 0, 0, 0, 0, 1688, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 2655, 0, + 1713, 0, 0, 0, 1713, 0, 0, 0, 0, 0, + 0, 0, 1689, 0, 3425, 3426, 0, 0, 3427, 0, + 1647, 0, 0, 0, 1700, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1713, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1713, + 0, 0, 3451, 0, 1713, 0, 0, 0, 1713, 1713, + 1713, 1713, 1713, 1713, 1713, 1713, 0, 0, 0, 0, + 0, 1472, 1472, 0, 1713, 1713, 3463, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1713, 0, + 0, 1713, 0, 0, 0, 0, 0, 0, 0, 1713, + 1713, 1713, 1713, 1713, 1713, 1713, 1713, 1713, 1713, 0, + 1690, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1691, 0, 0, + 0, 0, 1692, 0, 1713, 0, 1701, 0, 0, 1702, + 1703, 1704, 0, 1705, 1706, 1707, 1708, 1709, 1710, 0, + 0, 0, 0, 2166, 0, 1693, 1694, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 3204, 0, + 0, 1695, 3575, 0, 0, 0, 1143, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1472, 0, 0, + 3585, 0, 0, 0, 0, 2396, 2396, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1143, 0, 0, 0, 1696, 0, 0, 1697, 0, 0, 0, 0, 0, - 0, 1685, 2976, 0, 0, 2979, 0, 2981, 1698, 0, - 0, 1687, 0, 0, 0, 2985, 0, 0, 1688, 0, - 0, 0, 1713, 2992, 2993, 0, 0, 0, 1436, 1437, - 3000, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1689, 0, 3014, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 3030, 0, - 0, 0, 1690, 0, 0, 0, 0, 0, 1713, 1438, - 1439, 0, 0, 0, 0, 1713, 0, 0, 1143, 1691, - 0, 0, 0, 0, 1692, 1676, 0, 0, 1677, 0, - 0, 0, 1678, 1679, 1680, 1681, 0, 1682, 1683, 1684, - 0, 0, 0, 0, 0, 0, 0, 1693, 1694, 0, - 0, 1700, 0, 0, 1685, 0, 0, 0, 0, 0, - 568, 0, 0, 1695, 1687, 0, 1713, 0, 0, 0, - 1759, 1688, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1690, 2395, 2395, 0, 0, 0, 0, - 1713, 0, 0, 0, 0, 0, 0, 3175, 1689, 0, - 1691, 0, 0, 1696, 0, 1692, 1697, 0, 0, 1440, - 1441, 0, 0, 0, 0, 0, 3189, 0, 0, 0, - 1698, 0, 0, 1699, 0, 0, 0, 0, 1693, 1694, - 0, 0, 0, 1442, 1443, 0, 0, 0, 1713, 0, - 1713, 0, 1472, 1472, 1695, 2009, 0, 0, 1472, 0, - 0, 1713, 0, 2090, 1713, 0, 0, 0, 0, 1713, - 0, 0, 1713, 1701, 0, 0, 1702, 1703, 1704, 0, - 1705, 1706, 1707, 1708, 1709, 1710, 0, 0, 0, 0, - 0, 0, 0, 0, 1696, 0, 0, 1697, 0, 0, - 0, 3250, 3251, 0, 3254, 0, 1690, 0, 0, 0, - 0, 1698, 0, 0, 1699, 0, 1713, 0, 0, 0, - 0, 0, 0, 1691, 0, 0, 0, 0, 1692, 0, - 0, 0, 0, 1700, 0, 0, 0, 0, 3275, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1698, 3613, + 0, 1699, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1693, 1694, 0, 0, 0, 0, 0, 3284, 0, - 0, 0, 0, 3287, 3288, 0, 0, 1695, 3289, 0, - 0, 0, 0, 3292, 0, 0, 3295, 3296, 0, 0, - 0, 2395, 1332, 0, 0, 3304, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1143, 0, 1713, 0, 0, 0, 1696, 0, 0, - 1697, 0, 0, 0, 1700, 0, 0, 0, 0, 0, - 1713, 0, 0, 0, 1698, 0, 0, 1699, 0, 0, - 0, 1713, 1713, 1713, 0, 0, 0, 0, 1713, 0, - 0, 0, 1713, 0, 0, 1701, 0, 3352, 1702, 1703, - 1704, 0, 1705, 1706, 1707, 1708, 1709, 1710, 0, 0, - 0, 0, 2529, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3371, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1713, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1713, 1713, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1713, 0, 0, 0, 0, + 1676, 0, 0, 1677, 0, 0, 0, 1678, 1679, 1680, + 1681, 0, 1682, 1683, 1684, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 3641, 0, 1685, + 0, 1700, 0, 0, 0, 0, 0, 3204, 0, 1687, + 0, 0, 0, 0, 0, 0, 1688, 0, 0, 1143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1701, 1700, 0, 1702, - 1703, 1704, 0, 1705, 1706, 1707, 1708, 1709, 1710, 1676, - 0, 0, 1677, 2633, 0, 1713, 1678, 1679, 1680, 1681, - 0, 1682, 1683, 1684, 0, 0, 0, 0, 0, 0, - 0, 1713, 0, 0, 0, 0, 1713, 0, 1685, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1687, 0, - 0, 0, 0, 2009, 0, 1688, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 3668, 0, 0, 0, + 0, 0, 0, 1689, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 3688, 0, 0, 0, 0, + 0, 1713, 0, 1713, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1713, + 1713, 1713, 0, 0, 2009, 2009, 2009, 2009, 2009, 2009, + 0, 0, 0, 2009, 2009, 2009, 2009, 2009, 2009, 2009, + 2009, 2009, 2009, 0, 0, 0, 0, 1713, 1713, 0, + 0, 0, 0, 1701, 0, 0, 1702, 1703, 1704, 0, + 1705, 1706, 1707, 1708, 1709, 1710, 0, 0, 0, 0, + 2530, 0, 0, 1713, 0, 0, 0, 0, 0, 0, + 0, 1690, 0, 1713, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 3760, 3760, 3760, 0, 0, 1691, 0, + 0, 0, 0, 1692, 3771, 0, 0, 1676, 0, 0, + 1677, 0, 0, 0, 1678, 1679, 1680, 1681, 1713, 1682, + 1683, 1684, 0, 0, 0, 1713, 1693, 1694, 0, 0, + 0, 0, 0, 0, 3760, 0, 1685, 1713, 0, 0, + 0, 0, 1695, 1713, 0, 0, 1687, 0, 1713, 1713, + 0, 0, 0, 1688, 0, 0, 2009, 2009, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 3428, 3429, 0, 2876, 0, 0, 0, 0, 0, 0, - 0, 0, 1689, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1656, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1701, - 0, 0, 1702, 1703, 1704, 0, 1705, 1706, 1707, 1708, - 1709, 1710, 1676, 0, 0, 1677, 2647, 0, 0, 1678, - 1679, 1680, 1681, 2654, 1682, 1683, 1684, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 3471, - 3472, 1685, 0, 3473, 0, 1647, 0, 0, 0, 0, - 0, 1687, 0, 0, 0, 0, 0, 0, 1688, 0, + 1713, 1472, 1472, 1713, 0, 1713, 0, 0, 0, 1713, + 1689, 0, 1696, 0, 0, 1697, 0, 0, 0, 0, + 0, 0, 0, 0, 3760, 0, 0, 0, 0, 1698, + 0, 0, 1699, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1690, 0, 0, 0, 0, 0, 0, 3497, 0, 0, - 0, 0, 0, 0, 0, 1689, 0, 1691, 0, 0, - 0, 0, 1692, 0, 0, 0, 0, 0, 0, 0, - 0, 3509, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1693, 1694, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1713, 0, 0, - 0, 1695, 0, 0, 0, 2009, 2009, 0, 1472, 1472, - 1472, 1472, 1472, 1472, 0, 0, 1472, 1472, 1472, 1472, - 1472, 1472, 1472, 1472, 1472, 1472, 2009, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1696, 0, 0, 1697, 0, 0, 0, 0, 0, - 0, 0, 0, 1690, 0, 0, 0, 0, 1698, 0, - 0, 1699, 0, 3250, 0, 0, 0, 3571, 0, 0, - 1691, 1143, 0, 0, 0, 1692, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 3581, 0, 0, 0, 0, - 2395, 2395, 0, 0, 0, 0, 0, 0, 1693, 1694, - 0, 0, 1143, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1695, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3609, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1713, 0, - 0, 0, 1713, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1696, 0, 0, 1697, 0, 0, - 0, 1700, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1698, 3634, 1713, 1699, 0, 0, 0, 0, 0, - 0, 0, 3250, 0, 0, 0, 0, 1713, 0, 0, - 0, 0, 1713, 0, 1143, 0, 1713, 1713, 1713, 1713, - 1713, 1713, 1713, 1713, 0, 0, 0, 0, 0, 1472, - 1472, 3661, 1713, 1713, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1713, + 1676, 0, 0, 1677, 0, 0, 0, 1678, 1679, 1680, + 1681, 0, 1682, 1683, 1684, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1685, + 0, 0, 0, 0, 0, 0, 0, 0, 1690, 1687, + 0, 0, 0, 0, 0, 0, 1688, 0, 0, 0, + 0, 0, 0, 0, 0, 1691, 0, 0, 0, 0, + 1692, 0, 1700, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1689, 0, 0, 0, 0, 1676, 0, + 0, 1677, 0, 1693, 1694, 1678, 1679, 1680, 1681, 0, + 1682, 1683, 1684, 0, 0, 0, 0, 0, 0, 1695, + 0, 0, 0, 0, 0, 0, 0, 1685, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1687, 0, 0, + 0, 0, 0, 0, 1688, 0, 1713, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1696, + 0, 0, 1697, 0, 0, 1472, 0, 0, 0, 0, + 0, 1689, 0, 0, 0, 0, 1698, 0, 0, 1699, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1690, 0, 0, 1701, 0, 0, 1702, 1703, 1704, + 0, 1705, 1706, 1707, 1708, 1709, 1710, 0, 1691, 0, + 0, 2634, 0, 1692, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1713, 0, 1713, 0, 0, 0, 0, + 0, 0, 0, 0, 1713, 0, 1693, 1694, 0, 0, 0, 0, 0, 0, 0, 0, 1713, 0, 0, 1713, - 3681, 0, 0, 0, 0, 0, 0, 1713, 1713, 1713, - 1713, 1713, 1713, 1713, 1713, 1713, 1713, 0, 0, 0, + 0, 1713, 1695, 0, 0, 1713, 0, 0, 2009, 2009, + 0, 0, 1713, 1713, 0, 0, 0, 0, 0, 1690, + 1713, 0, 0, 0, 0, 0, 0, 0, 0, 1700, + 0, 0, 0, 0, 1713, 0, 1691, 0, 0, 0, + 0, 1692, 1696, 0, 0, 1697, 0, 0, 0, 0, + 1713, 0, 0, 0, 0, 0, 0, 0, 0, 1698, + 0, 0, 1699, 0, 1693, 1694, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1695, 0, 0, 0, 0, 0, 0, 0, 0, 1472, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1713, 1701, 1700, 0, 1702, 1703, 1704, 0, - 1705, 1706, 1707, 1708, 1709, 1710, 0, 0, 0, 0, - 2665, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1676, 0, 0, 1677, 0, 0, 0, 1678, 1679, - 1680, 1681, 0, 1682, 1683, 1684, 0, 0, 0, 0, - 0, 3744, 3744, 3744, 0, 1472, 0, 0, 0, 0, - 1685, 0, 3755, 0, 0, 0, 0, 0, 0, 0, - 1687, 0, 0, 0, 0, 0, 0, 1688, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 3744, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1689, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1701, 0, 0, 1702, - 1703, 1704, 0, 1705, 1706, 1707, 1708, 1709, 1710, 0, - 0, 0, 0, 2893, 0, 0, 0, 0, 0, 0, - 0, 1713, 0, 0, 0, 0, 3744, 0, 0, 0, - 0, 0, 1713, 1713, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1676, 0, 0, - 1677, 0, 0, 0, 1678, 1679, 1680, 1681, 0, 1682, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1696, 1713, 1713, 1697, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1698, 0, 0, + 1699, 1701, 0, 0, 1702, 1703, 1704, 1713, 1705, 1706, + 1707, 1708, 1709, 1710, 0, 0, 0, 1676, 2648, 0, + 1677, 1713, 1700, 0, 1678, 1679, 1680, 1681, 0, 1682, 1683, 1684, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1685, 0, 0, 0, - 0, 0, 1690, 0, 0, 0, 1687, 0, 0, 0, - 0, 0, 0, 1688, 0, 0, 0, 0, 0, 1691, - 0, 0, 0, 0, 1692, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1689, 0, 0, 0, 0, 0, 0, 1693, 1694, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1713, 0, - 1713, 0, 0, 1695, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1713, 1713, 1713, 0, - 0, 2009, 2009, 2009, 2009, 2009, 2009, 0, 0, 0, - 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, - 0, 0, 0, 1696, 1713, 1713, 1697, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1687, 2009, 1472, 0, + 0, 0, 0, 1688, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1698, 0, 0, 1699, 0, 0, 0, 0, 0, 0, - 1713, 0, 0, 0, 1676, 0, 0, 1677, 1690, 0, - 1713, 1678, 1679, 1680, 1681, 0, 1682, 1683, 1684, 0, - 0, 0, 0, 0, 0, 1691, 0, 0, 0, 0, - 1692, 0, 0, 1685, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1687, 0, 1713, 0, 0, 0, 0, - 1688, 0, 1713, 1693, 1694, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1713, 0, 0, 0, 0, 1695, - 1713, 0, 0, 0, 0, 1713, 1713, 1689, 0, 0, - 0, 0, 0, 2009, 2009, 0, 0, 0, 0, 0, - 0, 0, 0, 1700, 0, 0, 0, 1713, 1472, 1472, - 1713, 0, 1713, 0, 0, 0, 1713, 0, 0, 1696, - 1676, 0, 1697, 1677, 0, 0, 0, 1678, 1679, 1680, - 1681, 0, 1682, 1683, 1684, 0, 1698, 0, 0, 1699, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1685, - 0, 0, 0, 0, 0, 1676, 0, 0, 1677, 1687, - 0, 0, 1678, 1679, 1680, 1681, 1688, 1682, 1683, 1684, - 0, 0, 0, 0, 0, 0, 1713, 0, 0, 0, - 0, 0, 0, 0, 1685, 1690, 0, 0, 0, 0, - 0, 0, 0, 1689, 1687, 0, 0, 0, 0, 0, - 0, 1688, 1691, 0, 0, 0, 0, 1692, 0, 0, - 0, 0, 0, 0, 0, 1701, 0, 0, 1702, 1703, - 1704, 0, 1705, 1706, 1707, 1708, 1709, 1710, 1689, 0, - 1693, 1694, 2960, 0, 0, 0, 0, 0, 0, 1700, - 0, 0, 0, 0, 0, 0, 1695, 0, 0, 0, + 0, 0, 1713, 1713, 0, 0, 1713, 0, 0, 0, + 1689, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1700, 0, 0, 0, 0, 0, 0, 1713, 0, 0, + 0, 0, 0, 0, 0, 0, 1713, 0, 0, 1713, + 1713, 1713, 0, 0, 1713, 0, 0, 1713, 1713, 0, + 0, 0, 0, 0, 1701, 0, 1713, 1702, 1703, 1704, + 0, 1705, 1706, 1707, 1708, 1709, 1710, 0, 0, 0, + 0, 2666, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1676, 0, 0, 1677, 0, 0, 0, 1678, 1679, - 1680, 1681, 0, 1682, 1683, 1684, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1696, 0, 0, 1697, - 1685, 1690, 0, 0, 0, 0, 0, 0, 0, 0, - 1687, 0, 1713, 1698, 0, 0, 1699, 1688, 1691, 0, - 0, 0, 0, 1692, 0, 0, 0, 0, 0, 0, - 0, 1472, 0, 0, 0, 0, 1690, 0, 0, 0, - 0, 0, 0, 0, 1689, 0, 1693, 1694, 0, 0, - 0, 0, 0, 1691, 0, 0, 0, 0, 1692, 0, - 0, 1701, 1695, 0, 1702, 1703, 1704, 0, 1705, 1706, - 1707, 1708, 1709, 1710, 0, 0, 0, 0, 2973, 0, - 0, 1693, 1694, 0, 0, 0, 0, 0, 0, 1713, - 0, 1713, 0, 0, 0, 0, 0, 1695, 0, 0, - 1713, 0, 1696, 0, 0, 1697, 0, 0, 0, 0, - 0, 0, 1713, 0, 0, 1713, 1700, 1713, 0, 1698, - 0, 1713, 1699, 0, 2009, 2009, 0, 0, 1713, 1713, - 0, 0, 0, 0, 0, 0, 1713, 1696, 0, 0, - 1697, 0, 1690, 0, 0, 0, 0, 0, 0, 0, - 1713, 0, 0, 0, 1698, 0, 0, 1699, 0, 1691, - 0, 0, 0, 0, 1692, 0, 1713, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1676, 0, 0, - 1677, 0, 0, 0, 1678, 1679, 0, 1693, 1694, 1682, - 1683, 1684, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1695, 0, 1472, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1687, 0, 0, 0, - 0, 0, 1700, 1688, 0, 0, 0, 0, 1701, 0, - 0, 1702, 1703, 1704, 0, 1705, 1706, 1707, 1708, 1709, - 1710, 0, 0, 1696, 0, 3047, 1697, 0, 0, 0, - 1689, 0, 0, 0, 0, 0, 0, 1700, 0, 0, - 1698, 0, 0, 1699, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1676, 0, 0, 1677, 0, 0, - 0, 1678, 1679, 1680, 1681, 0, 1682, 1683, 1684, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1685, 0, 0, 0, 0, 0, 0, - 0, 1713, 0, 1687, 0, 0, 0, 0, 0, 0, - 1688, 0, 0, 0, 0, 1713, 0, 0, 0, 0, - 0, 0, 0, 0, 1701, 0, 0, 1702, 1703, 1704, - 0, 1705, 1706, 1707, 1708, 1709, 1710, 1689, 1690, 0, - 0, 3298, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 2009, 1472, 1700, 0, 1691, 0, 0, 0, 1701, - 1692, 0, 1702, 1703, 1704, 0, 1705, 1706, 1707, 1708, - 1709, 1710, 0, 0, 1876, 0, 1713, 1713, 0, 0, - 1713, 0, 0, -2183, -2183, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1713, 0, 0, 0, 1690, 0, + 2009, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1713, 0, 1691, 0, 0, 0, 0, + 1692, 0, 1701, 0, 0, 1702, 1703, 1704, 0, 1705, + 1706, 1707, 1708, 1709, 1710, 0, 0, 0, 0, 2895, + 0, 0, 0, 1693, 1694, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1695, - 0, 1713, 0, 0, 0, 0, 0, 0, 0, 0, - 1713, 0, 0, 1713, 1713, 1713, 0, 0, 1713, 0, - 0, 1713, 1713, 0, 0, 0, 0, 0, 0, 0, - 1713, 0, 0, 0, 0, 1690, 0, 0, 0, 0, - 0, 0, -2183, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1691, 0, 0, 0, 1698, 1692, 0, 0, - 0, 0, 0, 0, 0, 1701, 0, 0, 1702, 1703, - 1704, 0, 1705, 1706, 1707, 1708, 1709, 1710, 1713, 0, - 1693, 1694, 3305, 0, 2009, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1695, 1713, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1713, 1713, 0, 0, 0, 0, 0, 2009, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1696, + 0, 0, 1697, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1713, 1713, 1713, 1698, 0, 0, 1699, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1696, 0, 0, 1697, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1713, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1698, 1713, 1713, 1699, 0, 0, 1700, - 0, 2009, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1713, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1713, 1713, 1713, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1713, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1713, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1700, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1700, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1701, 0, 0, 1702, 1703, 1704, 0, 1705, 1706, - 1707, 1708, 1709, 1710, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1713, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1713, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1713, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1713, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1713, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1713, 0, 0, 0, 0, 0, 0, 0, 1701, 0, - 0, 1702, 1703, 1704, 0, 1705, 1706, 1707, 1708, 1709, - 1710, 0, 0, 0, 0, 3395, 0, 1713, 0, 0, - 121, 1076, 836, 1077, 1078, 1079, 1080, 1081, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1713, 0, 0, - 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, - 131, 132, 0, 0, 0, 0, 0, 1082, 0, 0, - 133, 134, 135, 0, 136, 137, 138, 139, 140, 141, - 142, 143, 1083, 145, 1084, 1085, 0, 0, 148, 149, - 150, 151, 152, 1086, 805, 153, 154, 155, 156, 1087, - 1088, 159, 0, 160, 161, 162, 163, 806, 0, 807, - 1713, 1089, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 1713, 176, 177, 178, 179, 180, 181, 0, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 1090, 194, 195, 1091, 197, 1092, 198, 0, 199, 200, - 201, 202, 203, 204, 14, 15, 205, 206, 207, 208, - 0, 0, 209, 210, 1093, 212, 213, 0, 214, 215, - 216, 0, 217, 218, 219, 220, 0, 221, 222, 223, - 224, 1094, 226, 227, 228, 229, 230, 231, 808, 1095, - 233, 0, 234, 235, 1096, 237, 0, 238, 0, 239, - 240, 23, 241, 242, 243, 244, 245, 246, 247, 248, - 0, 1097, 1098, 251, 252, 0, 253, 254, 255, 256, - 257, 258, 259, 260, 261, 262, 263, 264, 0, 265, - 266, 267, 268, 269, 270, 271, 0, 272, 273, 274, - 275, 276, 277, 278, 279, 1099, 1100, 0, 1101, 0, - 283, 284, 285, 286, 287, 288, 289, 290, 1102, 291, - 292, 293, 0, 0, 294, 295, 296, 297, 0, 298, - 299, 300, 301, 302, 303, 304, 305, 1103, 307, 308, - 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, - 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, - 1104, 330, 1105, 332, 333, 334, 335, 1106, 336, 337, - 338, 339, 1107, 810, 341, 1108, 343, 344, 345, 0, - 346, 347, 0, 0, 1109, 349, 350, 0, 0, 351, - 352, 353, 354, 355, 356, 812, 358, 359, 360, 361, - 362, 363, 364, 365, 366, 367, 368, 369, 26, 27, - 28, 0, 370, 371, 813, 373, 374, 375, 376, 377, - 378, 379, 0, 380, 381, 382, 383, 384, 385, 0, - 386, 387, 388, 389, 390, 1110, 392, 393, 394, 395, - 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, - 405, 406, 407, 408, 0, 409, 410, 411, 412, 413, - 414, 1111, 416, 417, 418, 419, 420, 421, 422, 423, - 424, 425, 426, 427, 428, 33, 0, 429, 430, 431, - 432, 433, 434, 435, 436, 437, 35, 438, 439, 440, - 1112, 442, 0, 443, 444, 445, 446, 447, 448, 449, - 450, 451, 452, 453, 454, 455, 456, 457, 458, 815, - 37, 0, 460, 461, 38, 462, 463, 464, 465, 466, - 467, 468, 469, 0, 470, 1113, 1114, 0, 0, 473, - 474, 816, 476, 817, 1115, 478, 479, 818, 481, 482, - 483, 484, 485, 0, 0, 486, 487, 488, 1116, 40, - 489, 490, 491, 492, 0, 493, 494, 495, 496, 497, - 819, 1117, 500, 0, 501, 502, 503, 504, 505, 506, - 507, 508, 509, 0, 0, 510, 0, 44, 511, 512, - 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, - 523, 524, 525, 526, 527, 528, 529, 530, 531, 1118, - 0, 45, 0, 0, 0, 0, 1119, 1120, 1121, 0, - 0, 0, 0, 1122, 0, 1123, 3446, 0, 0, 0, - 1124, 1125, 1126, 1127, 121, 1076, 836, 1077, 1078, 1079, - 1080, 1081, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, - 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, - 0, 1082, 0, 0, 133, 134, 135, 0, 136, 137, - 138, 139, 140, 141, 142, 143, 1083, 145, 1084, 1085, - 0, 0, 148, 149, 150, 151, 152, 1086, 805, 153, - 154, 155, 156, 1087, 1088, 159, 0, 160, 161, 162, - 163, 806, 0, 807, 0, 1089, 167, 168, 169, 170, - 171, 172, 173, 174, 175, 0, 176, 177, 178, 179, - 180, 181, 0, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 1090, 194, 195, 1091, 197, 1092, - 198, 0, 199, 200, 201, 202, 203, 204, 14, 15, - 205, 206, 207, 208, 0, 0, 209, 210, 1093, 212, - 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, - 0, 221, 222, 223, 224, 1094, 226, 227, 228, 229, - 230, 231, 808, 1095, 233, 0, 234, 235, 1096, 237, - 0, 238, 0, 239, 240, 23, 241, 242, 243, 244, - 245, 246, 247, 248, 0, 1097, 1098, 251, 252, 0, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, - 0, 272, 273, 274, 275, 276, 277, 278, 279, 1099, - 1100, 0, 1101, 0, 283, 284, 285, 286, 287, 288, - 289, 290, 1102, 291, 292, 293, 0, 0, 294, 295, - 296, 297, 0, 298, 299, 300, 301, 302, 303, 304, - 305, 1103, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 1104, 330, 1105, 332, 333, 334, - 335, 1106, 336, 337, 338, 339, 1107, 810, 341, 1108, - 343, 344, 345, 0, 346, 347, 0, 0, 1109, 349, - 350, 0, 0, 351, 352, 353, 354, 355, 356, 812, - 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, - 368, 369, 26, 27, 28, 0, 370, 371, 813, 373, - 374, 375, 376, 377, 378, 379, 0, 380, 381, 382, - 383, 384, 385, 0, 386, 387, 388, 389, 390, 1110, - 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, - 401, 402, 403, 404, 405, 406, 407, 408, 0, 409, - 410, 411, 412, 413, 414, 1111, 416, 417, 418, 419, - 420, 421, 422, 423, 424, 425, 426, 427, 428, 33, - 0, 429, 430, 431, 432, 433, 434, 435, 436, 437, - 35, 438, 439, 440, 1112, 442, 0, 443, 444, 445, - 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, - 456, 457, 458, 815, 37, 0, 460, 461, 38, 462, - 463, 464, 465, 466, 467, 468, 469, 0, 470, 1113, - 1114, 0, 0, 473, 474, 816, 476, 817, 1115, 478, - 479, 818, 481, 482, 483, 484, 485, 0, 0, 486, - 487, 488, 1116, 40, 489, 490, 491, 492, 0, 493, - 494, 495, 496, 497, 819, 1117, 500, 0, 501, 502, - 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, - 0, 44, 511, 512, 513, 514, 515, 516, 517, 518, - 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, - 529, 530, 531, 1118, 0, 45, 0, 0, 0, 0, - 1119, 1120, 1121, 0, 0, 0, 0, 1122, 0, 1123, - 0, 0, 0, 0, 1124, 1125, 1126, 1127, 121, 1076, - 836, 1077, 1078, 1079, 1080, 1081, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1713, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1713, + 0, 1701, 0, 0, 1702, 1703, 1704, 0, 1705, 1706, + 1707, 1708, 1709, 1710, 0, 0, 0, 0, 2962, 0, + 0, 0, 0, 0, 0, 0, 1713, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 121, 1076, + 836, 1077, 1078, 1079, 1080, 1081, 1713, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, 1082, 0, 0, 133, 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, 143, 1083, 145, 1084, 1085, 0, 0, 148, 149, 150, 151, 152, 1086, 805, 153, 154, 155, 156, 1087, 1088, 159, - 0, 160, 161, 162, 163, 806, 0, 807, 0, 1089, - 167, 168, 169, 170, 171, 172, 173, 174, 175, 0, + 0, 160, 161, 162, 163, 806, 0, 807, 1713, 1089, + 167, 168, 169, 170, 171, 172, 173, 174, 175, 1713, 176, 177, 178, 179, 180, 181, 0, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 1090, 194, 195, 1091, 197, 1092, 198, 0, 199, 200, 201, 202, - 203, 204, 0, 0, 205, 206, 207, 208, 0, 0, + 203, 204, 14, 15, 205, 206, 207, 208, 0, 0, 209, 210, 1093, 212, 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, 0, 221, 222, 223, 224, 1094, 226, 227, 228, 229, 230, 231, 808, 1095, 233, 0, @@ -5793,9 +5633,9 @@ static const yytype_int16 yytable[] = 407, 408, 0, 409, 410, 411, 412, 413, 414, 1111, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 33, 0, 429, 430, 431, 432, 433, - 434, 435, 436, 437, 0, 438, 439, 440, 1112, 442, + 434, 435, 436, 437, 35, 438, 439, 440, 1112, 442, 0, 443, 444, 445, 446, 447, 448, 449, 450, 451, - 452, 453, 454, 455, 456, 457, 458, 815, 0, 0, + 452, 453, 454, 455, 456, 457, 458, 815, 37, 0, 460, 461, 38, 462, 463, 464, 465, 466, 467, 468, 469, 0, 470, 1113, 1114, 0, 0, 473, 474, 816, 476, 817, 1115, 478, 479, 818, 481, 482, 483, 484, @@ -5806,67 +5646,67 @@ static const yytype_int16 yytable[] = 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 1118, 0, 45, 0, 0, 0, 0, 1119, 1120, 1121, 0, 0, 0, - 0, 1122, 0, 1123, 0, 0, 0, 0, 1124, 1125, - 1126, 1127, 1291, 1076, 836, 1077, 1078, 1079, 1080, 1081, + 0, 1122, 0, 1123, 3400, 0, 0, 0, 1124, 1125, + 1126, 1127, 121, 1076, 836, 1077, 1078, 1079, 1080, 1081, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, - 1292, 130, 131, 132, 0, 0, 0, 1293, 0, 1082, - 0, 0, 1294, 134, 135, 0, 1295, 137, 138, 1296, - 140, 141, 142, 143, 1083, 1297, 1084, 1085, 0, 1298, + 0, 130, 131, 132, 0, 0, 0, 0, 0, 1082, + 0, 0, 133, 134, 135, 0, 136, 137, 138, 139, + 140, 141, 142, 143, 1083, 145, 1084, 1085, 0, 0, 148, 149, 150, 151, 152, 1086, 805, 153, 154, 155, 156, 1087, 1088, 159, 0, 160, 161, 162, 163, 806, - 0, 1299, 0, 1300, 167, 168, 169, 170, 171, 1301, + 0, 807, 0, 1089, 167, 168, 169, 170, 171, 172, 173, 174, 175, 0, 176, 177, 178, 179, 180, 181, - 0, 1302, 183, 184, 185, 186, 187, 188, 189, 190, + 0, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 1090, 194, 195, 1091, 197, 1092, 198, 0, - 199, 200, 201, 202, 203, 204, 0, 0, 205, 206, - 207, 208, 1303, 0, 209, 210, 1093, 212, 213, 0, + 199, 200, 201, 202, 203, 204, 14, 15, 205, 206, + 207, 208, 0, 0, 209, 210, 1093, 212, 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, 0, 221, 222, 223, 224, 1094, 226, 227, 228, 229, 230, 231, 808, 1095, 233, 0, 234, 235, 1096, 237, 0, 238, - 0, 239, 1304, 0, 1305, 242, 243, 1306, 1307, 246, + 0, 239, 240, 23, 241, 242, 243, 244, 245, 246, 247, 248, 0, 1097, 1098, 251, 252, 0, 253, 254, - 255, 256, 257, 258, 259, 1308, 261, 262, 263, 264, + 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, - 1309, 274, 275, 276, 277, 278, 279, 1099, 1100, 0, - 1101, 0, 283, 1310, 1311, 286, 1312, 288, 289, 290, - 1102, 291, 292, 293, 0, 0, 294, 1313, 296, 1314, - 0, 298, 299, 300, 301, 302, 303, 304, 305, 1315, + 273, 274, 275, 276, 277, 278, 279, 1099, 1100, 0, + 1101, 0, 283, 284, 285, 286, 287, 288, 289, 290, + 1102, 291, 292, 293, 0, 0, 294, 295, 296, 297, + 0, 298, 299, 300, 301, 302, 303, 304, 305, 1103, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, - 327, 328, 1104, 1316, 1105, 332, 333, 334, 335, 1106, - 336, 337, 1317, 339, 1107, 810, 341, 1108, 343, 344, + 327, 328, 1104, 330, 1105, 332, 333, 334, 335, 1106, + 336, 337, 338, 339, 1107, 810, 341, 1108, 343, 344, 345, 0, 346, 347, 0, 0, 1109, 349, 350, 0, - 897, 351, 352, 353, 1318, 355, 1319, 812, 358, 359, + 0, 351, 352, 353, 354, 355, 356, 812, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, - 0, 0, 0, 0, 370, 371, 813, 1320, 374, 375, + 26, 27, 28, 0, 370, 371, 813, 373, 374, 375, 376, 377, 378, 379, 0, 380, 381, 382, 383, 384, 385, 0, 386, 387, 388, 389, 390, 1110, 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, - 403, 404, 405, 406, 407, 408, 0, 409, 410, 1321, + 403, 404, 405, 406, 407, 408, 0, 409, 410, 411, 412, 413, 414, 1111, 416, 417, 418, 419, 420, 421, - 422, 423, 424, 425, 426, 427, 428, 0, 1322, 429, - 430, 431, 432, 433, 434, 435, 436, 437, 0, 1323, + 422, 423, 424, 425, 426, 427, 428, 33, 0, 429, + 430, 431, 432, 433, 434, 435, 436, 437, 35, 438, 439, 440, 1112, 442, 0, 443, 444, 445, 446, 447, - 448, 449, 450, 451, 452, 453, 454, 455, 456, 1324, - 458, 815, 0, 0, 460, 461, 0, 462, 1325, 464, + 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, + 458, 815, 37, 0, 460, 461, 38, 462, 463, 464, 465, 466, 467, 468, 469, 0, 470, 1113, 1114, 0, - 0, 473, 474, 816, 476, 817, 1115, 478, 479, 1326, + 0, 473, 474, 816, 476, 817, 1115, 478, 479, 818, 481, 482, 483, 484, 485, 0, 0, 486, 487, 488, - 1327, 0, 489, 490, 491, 492, 0, 493, 494, 495, - 496, 497, 498, 1117, 500, 1328, 501, 1329, 503, 504, - 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, + 1116, 40, 489, 490, 491, 492, 0, 493, 494, 495, + 496, 497, 819, 1117, 500, 0, 501, 502, 503, 504, + 505, 506, 507, 508, 509, 0, 0, 510, 0, 44, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, - 531, 1118, 0, 0, 0, 0, 0, 0, 1119, 1120, - 1121, 0, 0, 0, 0, 1122, 0, 1123, 1330, 0, + 531, 1118, 0, 45, 0, 0, 0, 0, 1119, 1120, + 1121, 0, 0, 0, 0, 1122, 0, 1123, 0, 0, 0, 0, 1124, 1125, 1126, 1127, 121, 1076, 836, 1077, 1078, 1079, 1080, 1081, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, 1082, 0, 0, 133, 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, 143, 1083, 145, - 1084, 1085, 1479, 0, 148, 149, 150, 151, 152, 1086, + 1084, 1085, 0, 0, 148, 149, 150, 151, 152, 1086, 805, 153, 154, 155, 156, 1087, 1088, 159, 0, 160, 161, 162, 163, 806, 0, 807, 0, 1089, 167, 168, 169, 170, 171, 172, 173, 174, 175, 0, 176, 177, @@ -5877,13 +5717,13 @@ static const yytype_int16 yytable[] = 1093, 212, 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, 0, 221, 222, 223, 224, 1094, 226, 227, 228, 229, 230, 231, 808, 1095, 233, 0, 234, 235, - 1096, 237, 0, 238, 0, 239, 240, 1480, 241, 242, + 1096, 237, 0, 238, 0, 239, 240, 23, 241, 242, 243, 244, 245, 246, 247, 248, 0, 1097, 1098, 251, 252, 0, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 273, 274, 275, 276, 277, 278, 279, 1099, 1100, 0, 1101, 0, 283, 284, 285, 286, - 287, 288, 289, 290, 1102, 291, 292, 293, 0, 1481, + 287, 288, 289, 290, 1102, 291, 292, 293, 0, 0, 294, 295, 296, 297, 0, 298, 299, 300, 301, 302, 303, 304, 305, 1103, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, @@ -5892,31 +5732,31 @@ static const yytype_int16 yytable[] = 341, 1108, 343, 344, 345, 0, 346, 347, 0, 0, 1109, 349, 350, 0, 0, 351, 352, 353, 354, 355, 356, 812, 358, 359, 360, 361, 362, 363, 364, 365, - 366, 367, 368, 369, 0, 0, 0, 0, 370, 371, + 366, 367, 368, 369, 26, 27, 28, 0, 370, 371, 813, 373, 374, 375, 376, 377, 378, 379, 0, 380, 381, 382, 383, 384, 385, 0, 386, 387, 388, 389, 390, 1110, 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 0, 409, 410, 411, 412, 413, 414, 1111, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, - 428, 0, 0, 429, 430, 431, 432, 433, 434, 435, + 428, 33, 0, 429, 430, 431, 432, 433, 434, 435, 436, 437, 0, 438, 439, 440, 1112, 442, 0, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 815, 0, 0, 460, 461, - 0, 462, 463, 464, 465, 466, 467, 468, 469, 0, - 470, 1113, 1114, 0, 1482, 473, 474, 816, 476, 817, + 38, 462, 463, 464, 465, 466, 467, 468, 469, 0, + 470, 1113, 1114, 0, 0, 473, 474, 816, 476, 817, 1115, 478, 479, 818, 481, 482, 483, 484, 485, 0, - 0, 486, 487, 488, 1116, 0, 489, 490, 491, 492, - 0, 493, 494, 495, 496, 497, 498, 1117, 500, 0, + 0, 486, 487, 488, 1116, 40, 489, 490, 491, 492, + 0, 493, 494, 495, 496, 497, 819, 1117, 500, 0, 501, 502, 503, 504, 505, 506, 507, 508, 509, 0, - 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, + 0, 510, 0, 44, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, - 527, 528, 529, 530, 531, 1118, 0, 0, 0, 0, + 527, 528, 529, 530, 531, 1118, 0, 45, 0, 0, 0, 0, 1119, 1120, 1121, 0, 0, 0, 0, 1122, 0, 1123, 0, 0, 0, 0, 1124, 1125, 1126, 1127, 1291, 1076, 836, 1077, 1078, 1079, 1080, 1081, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, + 122, 123, 124, 125, 126, 127, 128, 129, 1292, 130, 131, 132, 0, 0, 0, 1293, 0, 1082, 0, 0, 1294, 134, 135, 0, 1295, 137, 138, 1296, 140, 141, 142, 143, 1083, 1297, 1084, 1085, 0, 1298, 148, 149, @@ -5927,7 +5767,7 @@ static const yytype_int16 yytable[] = 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 1090, 194, 195, 1091, 197, 1092, 198, 0, 199, 200, 201, 202, 203, 204, 0, 0, 205, 206, 207, 208, - 0, 0, 209, 210, 1093, 212, 213, 0, 214, 215, + 1303, 0, 209, 210, 1093, 212, 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, 0, 221, 222, 223, 224, 1094, 226, 227, 228, 229, 230, 231, 808, 1095, 233, 0, 234, 235, 1096, 237, 0, 238, 0, 239, @@ -5943,7 +5783,7 @@ static const yytype_int16 yytable[] = 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 1104, 1316, 1105, 332, 333, 334, 335, 1106, 336, 337, 1317, 339, 1107, 810, 341, 1108, 343, 344, 345, 0, - 346, 347, 0, 0, 1109, 349, 350, 0, 0, 351, + 346, 347, 0, 0, 1109, 349, 350, 0, 897, 351, 352, 353, 1318, 355, 1319, 812, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 0, 0, 0, 0, 370, 371, 813, 1320, 374, 375, 376, 377, @@ -5961,66 +5801,68 @@ static const yytype_int16 yytable[] = 474, 816, 476, 817, 1115, 478, 479, 1326, 481, 482, 483, 484, 485, 0, 0, 486, 487, 488, 1327, 0, 489, 490, 491, 492, 0, 493, 494, 495, 496, 497, - 498, 1117, 500, 2403, 501, 1329, 503, 504, 505, 506, + 498, 1117, 500, 1328, 501, 1329, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 1118, 0, 0, 0, 0, 0, 0, 1119, 1120, 1121, 0, - 0, 0, 0, 1122, 0, 1123, 0, 0, 0, 0, - 1124, 1125, 1126, 1127, 121, 1076, 836, 1077, 1078, 0, + 0, 0, 0, 1122, 0, 1123, 1330, 0, 0, 0, + 1124, 1125, 1126, 1127, 121, 1076, 836, 1077, 1078, 1079, 1080, 1081, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, 1082, 0, 0, 133, 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, 143, 1083, 145, 1084, 1085, - 0, 0, 148, 149, 150, 151, 152, 1086, 805, 153, + 1479, 0, 148, 149, 150, 151, 152, 1086, 805, 153, 154, 155, 156, 1087, 1088, 159, 0, 160, 161, 162, - 163, 806, 0, 807, 0, 166, 167, 168, 169, 170, + 163, 806, 0, 807, 0, 1089, 167, 168, 169, 170, 171, 172, 173, 174, 175, 0, 176, 177, 178, 179, 180, 181, 0, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 1090, 194, 195, 1091, 197, 0, - 198, 0, 199, 200, 201, 202, 203, 204, 14, 15, + 189, 190, 191, 192, 1090, 194, 195, 1091, 197, 1092, + 198, 0, 199, 200, 201, 202, 203, 204, 0, 0, 205, 206, 207, 208, 0, 0, 209, 210, 1093, 212, 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, 0, 221, 222, 223, 224, 1094, 226, 227, 228, 229, 230, 231, 808, 1095, 233, 0, 234, 235, 1096, 237, - 0, 238, 0, 239, 240, 23, 241, 242, 243, 244, + 0, 238, 0, 239, 240, 1480, 241, 242, 243, 244, 245, 246, 247, 248, 0, 1097, 1098, 251, 252, 0, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 273, 274, 275, 276, 277, 278, 279, 1099, 1100, 0, 1101, 0, 283, 284, 285, 286, 287, 288, - 289, 290, 0, 291, 292, 293, 0, 0, 294, 295, + 289, 290, 1102, 291, 292, 293, 0, 1481, 294, 295, 296, 297, 0, 298, 299, 300, 301, 302, 303, 304, 305, 1103, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 1104, 330, 1105, 332, 333, 334, - 335, 0, 336, 337, 338, 339, 1107, 810, 341, 1108, - 343, 344, 345, 0, 346, 347, 0, 0, 348, 349, + 335, 1106, 336, 337, 338, 339, 1107, 810, 341, 1108, + 343, 344, 345, 0, 346, 347, 0, 0, 1109, 349, 350, 0, 0, 351, 352, 353, 354, 355, 356, 812, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, - 368, 369, 26, 27, 28, 0, 370, 371, 813, 373, + 368, 369, 0, 0, 0, 0, 370, 371, 813, 373, 374, 375, 376, 377, 378, 379, 0, 380, 381, 382, 383, 384, 385, 0, 386, 387, 388, 389, 390, 1110, 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 0, 409, 410, 411, 412, 413, 414, 1111, 416, 417, 418, 419, - 420, 421, 422, 423, 424, 425, 426, 427, 428, 33, + 420, 421, 422, 423, 424, 425, 426, 427, 428, 0, 0, 429, 430, 431, 432, 433, 434, 435, 436, 437, - 35, 438, 439, 440, 1112, 442, 0, 443, 444, 445, + 0, 438, 439, 440, 1112, 442, 0, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, - 456, 457, 458, 815, 37, 0, 460, 461, 38, 462, + 456, 457, 458, 815, 0, 0, 460, 461, 0, 462, 463, 464, 465, 466, 467, 468, 469, 0, 470, 1113, - 1114, 0, 0, 473, 474, 816, 476, 817, 1115, 478, + 1114, 0, 1482, 473, 474, 816, 476, 817, 1115, 478, 479, 818, 481, 482, 483, 484, 485, 0, 0, 486, - 487, 488, 0, 40, 489, 490, 491, 492, 0, 493, - 494, 495, 496, 497, 819, 1117, 500, 0, 501, 502, + 487, 488, 1116, 0, 489, 490, 491, 492, 0, 493, + 494, 495, 496, 497, 498, 1117, 500, 0, 501, 502, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, - 0, 44, 511, 512, 513, 514, 515, 516, 517, 518, + 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, - 529, 530, 531, 0, 0, 45, 0, 0, 1291, 1076, - 836, 1077, 1078, 1079, 1080, 1081, 0, 1122, 0, 1123, - 0, 0, 0, 0, 1124, 1125, 1126, 1127, 122, 123, + 529, 530, 531, 1118, 0, 0, 0, 0, 0, 0, + 1119, 1120, 1121, 0, 0, 0, 0, 1122, 0, 1123, + 0, 0, 0, 0, 1124, 1125, 1126, 1127, 1291, 1076, + 836, 1077, 1078, 1079, 1080, 1081, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 1293, 0, 1082, 0, 0, 1294, 134, 135, 0, 1295, 137, 138, 1296, 140, 141, 142, 143, @@ -6066,129 +5908,127 @@ static const yytype_int16 yytable[] = 476, 817, 1115, 478, 479, 1326, 481, 482, 483, 484, 485, 0, 0, 486, 487, 488, 1327, 0, 489, 490, 491, 492, 0, 493, 494, 495, 496, 497, 498, 1117, - 500, 0, 501, 1329, 503, 504, 505, 506, 507, 508, + 500, 2404, 501, 1329, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 1118, 0, 0, 0, 0, 0, 0, 1119, 1120, 1121, 0, 0, 0, - 0, 1122, 0, 1123, 3301, 0, 0, 0, 1124, 1125, - 1126, 1127, 1291, 1076, 836, 1077, 1078, 1079, 1080, 1081, + 0, 1122, 0, 1123, 0, 0, 0, 0, 1124, 1125, + 1126, 1127, 121, 1076, 836, 1077, 1078, 0, 1080, 1081, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, - 0, 130, 131, 132, 0, 0, 0, 1293, 0, 1082, - 0, 0, 1294, 134, 135, 0, 1295, 137, 138, 1296, - 140, 141, 142, 143, 1083, 1297, 1084, 1085, 0, 1298, + 0, 130, 131, 132, 0, 0, 0, 0, 0, 1082, + 0, 0, 133, 134, 135, 0, 136, 137, 138, 139, + 140, 141, 142, 143, 1083, 145, 1084, 1085, 0, 0, 148, 149, 150, 151, 152, 1086, 805, 153, 154, 155, 156, 1087, 1088, 159, 0, 160, 161, 162, 163, 806, - 0, 1299, 0, 1300, 167, 168, 169, 170, 171, 1301, + 0, 807, 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 0, 176, 177, 178, 179, 180, 181, - 0, 1302, 183, 184, 185, 186, 187, 188, 189, 190, - 191, 192, 1090, 194, 195, 1091, 197, 1092, 198, 0, - 199, 200, 201, 202, 203, 204, 0, 0, 205, 206, + 0, 182, 183, 184, 185, 186, 187, 188, 189, 190, + 191, 192, 1090, 194, 195, 1091, 197, 0, 198, 0, + 199, 200, 201, 202, 203, 204, 14, 15, 205, 206, 207, 208, 0, 0, 209, 210, 1093, 212, 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, 0, 221, 222, 223, 224, 1094, 226, 227, 228, 229, 230, 231, 808, 1095, 233, 0, 234, 235, 1096, 237, 0, 238, - 0, 239, 1304, 0, 1305, 242, 243, 1306, 1307, 246, + 0, 239, 240, 23, 241, 242, 243, 244, 245, 246, 247, 248, 0, 1097, 1098, 251, 252, 0, 253, 254, - 255, 256, 257, 258, 259, 1308, 261, 262, 263, 264, + 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, - 1309, 274, 275, 276, 277, 278, 279, 1099, 1100, 0, - 1101, 0, 283, 1310, 1311, 286, 1312, 288, 289, 290, - 1102, 291, 292, 293, 0, 0, 294, 1313, 296, 1314, - 0, 298, 299, 300, 301, 302, 303, 304, 305, 1315, + 273, 274, 275, 276, 277, 278, 279, 1099, 1100, 0, + 1101, 0, 283, 284, 285, 286, 287, 288, 289, 290, + 0, 291, 292, 293, 0, 0, 294, 295, 296, 297, + 0, 298, 299, 300, 301, 302, 303, 304, 305, 1103, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, - 327, 328, 1104, 1316, 1105, 332, 333, 334, 335, 1106, - 336, 337, 1317, 339, 1107, 810, 341, 1108, 343, 344, - 345, 0, 346, 347, 0, 0, 1109, 349, 350, 0, - 0, 351, 352, 353, 1318, 355, 1319, 812, 358, 359, + 327, 328, 1104, 330, 1105, 332, 333, 334, 335, 0, + 336, 337, 338, 339, 1107, 810, 341, 1108, 343, 344, + 345, 0, 346, 347, 0, 0, 348, 349, 350, 0, + 0, 351, 352, 353, 354, 355, 356, 812, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, - 0, 0, 0, 0, 370, 371, 813, 1320, 374, 375, + 26, 27, 28, 0, 370, 371, 813, 373, 374, 375, 376, 377, 378, 379, 0, 380, 381, 382, 383, 384, 385, 0, 386, 387, 388, 389, 390, 1110, 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, - 403, 404, 405, 406, 407, 408, 0, 409, 410, 1321, + 403, 404, 405, 406, 407, 408, 0, 409, 410, 411, 412, 413, 414, 1111, 416, 417, 418, 419, 420, 421, - 422, 423, 424, 425, 426, 427, 428, 0, 1322, 429, - 430, 431, 432, 433, 434, 435, 436, 437, 0, 1323, + 422, 423, 424, 425, 426, 427, 428, 33, 0, 429, + 430, 431, 432, 433, 434, 435, 436, 437, 35, 438, 439, 440, 1112, 442, 0, 443, 444, 445, 446, 447, - 448, 449, 450, 451, 452, 453, 454, 455, 456, 1324, - 458, 815, 0, 0, 460, 461, 0, 462, 1325, 464, + 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, + 458, 815, 37, 0, 460, 461, 38, 462, 463, 464, 465, 466, 467, 468, 469, 0, 470, 1113, 1114, 0, - 0, 473, 474, 816, 476, 817, 1115, 478, 479, 1326, + 0, 473, 474, 816, 476, 817, 1115, 478, 479, 818, 481, 482, 483, 484, 485, 0, 0, 486, 487, 488, - 1327, 0, 489, 490, 491, 492, 0, 493, 494, 495, - 496, 497, 498, 1117, 500, 0, 501, 1329, 503, 504, - 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, + 0, 40, 489, 490, 491, 492, 0, 493, 494, 495, + 496, 497, 819, 1117, 500, 0, 501, 502, 503, 504, + 505, 506, 507, 508, 509, 0, 0, 510, 0, 44, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, - 531, 1118, 0, 0, 0, 0, 0, 0, 1119, 1120, - 1121, 0, 0, 0, 0, 1122, 0, 1123, 0, 0, - 0, 0, 1124, 1125, 1126, 1127, 121, 1076, 836, 1077, - 1078, 1079, 1080, 1081, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, - 126, 127, 128, 129, -1196, 130, 131, 132, 0, 0, - 0, 0, -1196, 1082, 0, 0, 133, 134, 135, 0, - 136, 137, 138, 139, 140, 141, 142, 143, 1083, 145, - 1084, 1085, 0, 0, 148, 149, 150, 151, 152, 1086, + 531, 0, 0, 45, 0, 0, 1291, 1076, 836, 1077, + 1078, 1079, 1080, 1081, 0, 1122, 0, 1123, 0, 0, + 0, 0, 1124, 1125, 1126, 1127, 122, 123, 124, 125, + 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, + 0, 1293, 0, 1082, 0, 0, 1294, 134, 135, 0, + 1295, 137, 138, 1296, 140, 141, 142, 143, 1083, 1297, + 1084, 1085, 0, 1298, 148, 149, 150, 151, 152, 1086, 805, 153, 154, 155, 156, 1087, 1088, 159, 0, 160, - 161, 162, 163, 806, 0, 807, 0, 1089, 167, 168, - 169, 170, 171, 172, 173, 174, 175, 0, 176, 177, - 178, 179, 180, 181, 0, 182, 183, 184, 185, 186, + 161, 162, 163, 806, 0, 1299, 0, 1300, 167, 168, + 169, 170, 171, 1301, 173, 174, 175, 0, 176, 177, + 178, 179, 180, 181, 0, 1302, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 1090, 194, 195, 1091, 197, 1092, 198, 0, 199, 200, 201, 202, 203, 204, 0, 0, 205, 206, 207, 208, 0, 0, 209, 210, 1093, 212, 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, 0, 221, 222, 223, 224, 1094, 226, 227, 228, 229, 230, 231, 808, 1095, 233, 0, 234, 235, - 1096, 237, 0, 238, 0, 239, 240, 0, 241, 242, - 243, 244, 245, 246, 247, 248, 0, 1097, 1098, 251, - 252, 0, 253, 254, 255, 256, 257, 258, 259, 260, + 1096, 237, 0, 238, 0, 239, 1304, 0, 1305, 242, + 243, 1306, 1307, 246, 247, 248, 0, 1097, 1098, 251, + 252, 0, 253, 254, 255, 256, 257, 258, 259, 1308, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, - 270, 271, 0, 272, 273, 274, 275, 276, 277, 278, - 279, 1099, 1100, 0, 1101, 0, 283, 284, 285, 286, - 287, 288, 289, 290, 1102, 291, 292, 293, 0, 0, - 294, 295, 296, 297, 0, 298, 299, 300, 301, 302, - 303, 304, 305, 1103, 307, 308, 309, 310, 311, 312, + 270, 271, 0, 272, 1309, 274, 275, 276, 277, 278, + 279, 1099, 1100, 0, 1101, 0, 283, 1310, 1311, 286, + 1312, 288, 289, 290, 1102, 291, 292, 293, 0, 0, + 294, 1313, 296, 1314, 0, 298, 299, 300, 301, 302, + 303, 304, 305, 1315, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 325, 326, 327, 328, 1104, 330, 1105, 332, - 333, 334, 335, 1106, 336, 337, 338, 339, 1107, 810, + 323, 324, 325, 326, 327, 328, 1104, 1316, 1105, 332, + 333, 334, 335, 1106, 336, 337, 1317, 339, 1107, 810, 341, 1108, 343, 344, 345, 0, 346, 347, 0, 0, - 1109, 349, 350, 0, 0, 351, 352, 353, 354, 355, - 356, 812, 358, 359, 360, 361, 362, 363, 364, 365, + 1109, 349, 350, 0, 0, 351, 352, 353, 1318, 355, + 1319, 812, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 0, 0, 0, 0, 370, 371, - 813, 373, 374, 375, 376, 377, 378, 379, 0, 380, + 813, 1320, 374, 375, 376, 377, 378, 379, 0, 380, 381, 382, 383, 384, 385, 0, 386, 387, 388, 389, 390, 1110, 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, - 0, 409, 410, 411, 412, 413, 414, 1111, 416, 417, + 0, 409, 410, 1321, 412, 413, 414, 1111, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, - 428, 0, 0, 429, 430, 431, 432, 433, 434, 435, - 436, 437, 0, 438, 439, 440, 1112, 442, -1196, 443, + 428, 0, 1322, 429, 430, 431, 432, 433, 434, 435, + 436, 437, 0, 1323, 439, 440, 1112, 442, 0, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, - 454, 455, 456, 457, 458, 815, 0, 0, 460, 461, - 0, 462, 463, 464, 465, 466, 467, 468, 469, 0, + 454, 455, 456, 1324, 458, 815, 0, 0, 460, 461, + 0, 462, 1325, 464, 465, 466, 467, 468, 469, 0, 470, 1113, 1114, 0, 0, 473, 474, 816, 476, 817, - 1115, 478, 479, 818, 481, 482, 483, 484, 485, 0, - 0, 486, 487, 488, 1116, 0, 489, 490, 491, 492, + 1115, 478, 479, 1326, 481, 482, 483, 484, 485, 0, + 0, 486, 487, 488, 1327, 0, 489, 490, 491, 492, 0, 493, 494, 495, 496, 497, 498, 1117, 500, 0, - 501, 502, 503, 504, 505, 506, 507, 508, 509, 0, + 501, 1329, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 1118, 0, 0, 0, 0, 0, 0, 1119, 1120, 1121, 0, 0, 0, 0, 1122, - 0, 1123, 0, 0, 0, 0, 1124, 1125, 1126, 1127, - 121, 1076, 836, 1077, 1078, 1079, 1080, 1081, 0, 0, + 0, 1123, 3255, 0, 0, 0, 1124, 1125, 1126, 1127, + 1291, 1076, 836, 1077, 1078, 1079, 1080, 1081, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 122, 123, 124, 125, 126, 127, 128, 129, 1756, 130, - 131, 132, 0, 0, 0, 0, 0, 1082, 0, 0, - 133, 134, 135, 0, 136, 137, 138, 139, 140, 141, - 142, 143, 1083, 145, 1084, 1085, 0, 0, 148, 149, + 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, + 131, 132, 0, 0, 0, 1293, 0, 1082, 0, 0, + 1294, 134, 135, 0, 1295, 137, 138, 1296, 140, 141, + 142, 143, 1083, 1297, 1084, 1085, 0, 1298, 148, 149, 150, 151, 152, 1086, 805, 153, 154, 155, 156, 1087, - 1088, 159, 0, 160, 161, 162, 163, 806, 0, 807, - 0, 1089, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 0, 176, 177, 178, 179, 180, 181, 0, 182, + 1088, 159, 0, 160, 161, 162, 163, 806, 0, 1299, + 0, 1300, 167, 168, 169, 170, 171, 1301, 173, 174, + 175, 0, 176, 177, 178, 179, 180, 181, 0, 1302, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 1090, 194, 195, 1091, 197, 1092, 198, 0, 199, 200, 201, 202, 203, 204, 0, 0, 205, 206, 207, 208, @@ -6196,47 +6036,47 @@ static const yytype_int16 yytable[] = 216, 0, 217, 218, 219, 220, 0, 221, 222, 223, 224, 1094, 226, 227, 228, 229, 230, 231, 808, 1095, 233, 0, 234, 235, 1096, 237, 0, 238, 0, 239, - 240, 0, 241, 242, 243, 244, 245, 246, 247, 248, + 1304, 0, 1305, 242, 243, 1306, 1307, 246, 247, 248, 0, 1097, 1098, 251, 252, 0, 253, 254, 255, 256, - 257, 258, 259, 260, 261, 262, 263, 264, 0, 265, - 266, 267, 268, 269, 270, 271, 0, 272, 273, 274, + 257, 258, 259, 1308, 261, 262, 263, 264, 0, 265, + 266, 267, 268, 269, 270, 271, 0, 272, 1309, 274, 275, 276, 277, 278, 279, 1099, 1100, 0, 1101, 0, - 283, 284, 285, 286, 287, 288, 289, 290, 1102, 291, - 292, 293, 0, 0, 294, 295, 296, 297, 0, 298, - 299, 300, 301, 302, 303, 304, 305, 1103, 307, 308, + 283, 1310, 1311, 286, 1312, 288, 289, 290, 1102, 291, + 292, 293, 0, 0, 294, 1313, 296, 1314, 0, 298, + 299, 300, 301, 302, 303, 304, 305, 1315, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, - 1104, 330, 1105, 332, 333, 334, 335, 1106, 336, 337, - 338, 339, 1107, 810, 341, 1108, 343, 344, 345, 0, + 1104, 1316, 1105, 332, 333, 334, 335, 1106, 336, 337, + 1317, 339, 1107, 810, 341, 1108, 343, 344, 345, 0, 346, 347, 0, 0, 1109, 349, 350, 0, 0, 351, - 352, 353, 354, 355, 356, 812, 358, 359, 360, 361, + 352, 353, 1318, 355, 1319, 812, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 0, 0, - 0, 0, 370, 371, 813, 373, 374, 375, 376, 377, + 0, 0, 370, 371, 813, 1320, 374, 375, 376, 377, 378, 379, 0, 380, 381, 382, 383, 384, 385, 0, 386, 387, 388, 389, 390, 1110, 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, - 405, 406, 407, 408, 0, 409, 410, 411, 412, 413, + 405, 406, 407, 408, 0, 409, 410, 1321, 412, 413, 414, 1111, 416, 417, 418, 419, 420, 421, 422, 423, - 424, 425, 426, 427, 428, 0, 0, 429, 430, 431, - 432, 433, 434, 435, 436, 437, 0, 438, 439, 440, + 424, 425, 426, 427, 428, 0, 1322, 429, 430, 431, + 432, 433, 434, 435, 436, 437, 0, 1323, 439, 440, 1112, 442, 0, 443, 444, 445, 446, 447, 448, 449, - 450, 451, 452, 453, 454, 455, 456, 457, 458, 815, - 0, 0, 460, 461, 0, 462, 463, 464, 465, 466, + 450, 451, 452, 453, 454, 455, 456, 1324, 458, 815, + 0, 0, 460, 461, 0, 462, 1325, 464, 465, 466, 467, 468, 469, 0, 470, 1113, 1114, 0, 0, 473, - 474, 816, 476, 817, 1115, 478, 479, 818, 481, 482, - 483, 484, 485, 0, 0, 486, 487, 488, 1116, 0, + 474, 816, 476, 817, 1115, 478, 479, 1326, 481, 482, + 483, 484, 485, 0, 0, 486, 487, 488, 1327, 0, 489, 490, 491, 492, 0, 493, 494, 495, 496, 497, - 498, 1117, 500, 0, 501, 502, 503, 504, 505, 506, + 498, 1117, 500, 0, 501, 1329, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 1118, 0, 0, 0, 0, 0, 0, 1119, 1120, 1121, 0, 0, 0, 0, 1122, 0, 1123, 0, 0, 0, 0, - 1124, 1125, 1126, 1127, 121, 1771, 836, 1077, 1078, 1079, - 1772, 1081, 0, 0, 0, 0, 0, 0, 0, 0, + 1124, 1125, 1126, 1127, 121, 1076, 836, 1077, 1078, 1079, + 1080, 1081, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, - 128, 129, 1773, 130, 131, 132, 0, 0, 0, 0, - 0, 1082, 0, 0, 133, 134, 135, 0, 136, 137, + 128, 129, -1201, 130, 131, 132, 0, 0, 0, 0, + -1201, 1082, 0, 0, 133, 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, 143, 1083, 145, 1084, 1085, 0, 0, 148, 149, 150, 151, 152, 1086, 805, 153, 154, 155, 156, 1087, 1088, 159, 0, 160, 161, 162, @@ -6272,7 +6112,7 @@ static const yytype_int16 yytable[] = 410, 411, 412, 413, 414, 1111, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 0, 0, 429, 430, 431, 432, 433, 434, 435, 436, 437, - 0, 438, 439, 440, 1112, 442, 0, 443, 444, 445, + 0, 438, 439, 440, 1112, 442, -1201, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 815, 0, 0, 460, 461, 0, 462, 463, 464, 465, 466, 467, 468, 469, 0, 470, 1113, @@ -6288,7 +6128,7 @@ static const yytype_int16 yytable[] = 0, 0, 0, 0, 1124, 1125, 1126, 1127, 121, 1076, 836, 1077, 1078, 1079, 1080, 1081, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, - 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, + 124, 125, 126, 127, 128, 129, 1756, 130, 131, 132, 0, 0, 0, 0, 0, 1082, 0, 0, 133, 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, 143, 1083, 145, 1084, 1085, 0, 0, 148, 149, 150, 151, @@ -6302,7 +6142,7 @@ static const yytype_int16 yytable[] = 209, 210, 1093, 212, 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, 0, 221, 222, 223, 224, 1094, 226, 227, 228, 229, 230, 231, 808, 1095, 233, 0, - 234, 235, 1096, 237, 0, 238, 0, 239, 240, 1480, + 234, 235, 1096, 237, 0, 238, 0, 239, 240, 0, 241, 242, 243, 244, 245, 246, 247, 248, 0, 1097, 1098, 251, 252, 0, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 0, 265, 266, 267, @@ -6339,10 +6179,10 @@ static const yytype_int16 yytable[] = 525, 526, 527, 528, 529, 530, 531, 1118, 0, 0, 0, 0, 0, 0, 1119, 1120, 1121, 0, 0, 0, 0, 1122, 0, 1123, 0, 0, 0, 0, 1124, 1125, - 1126, 1127, 121, 1076, 836, 1077, 1078, 1079, 1080, 1081, + 1126, 1127, 121, 1771, 836, 1077, 1078, 1079, 1772, 1081, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, - 0, 130, 131, 132, 0, 0, 0, 0, 0, 1082, + 1773, 130, 131, 132, 0, 0, 0, 0, 0, 1082, 0, 0, 133, 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, 143, 1083, 145, 1084, 1085, 0, 0, 148, 149, 150, 151, 152, 1086, 805, 153, 154, 155, @@ -6391,10 +6231,10 @@ static const yytype_int16 yytable[] = 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 1118, 0, 0, 0, 0, 0, 0, 1119, 1120, - 1121, 0, 0, 0, 0, 1122, 0, 1123, 2151, 0, + 1121, 0, 0, 0, 0, 1122, 0, 1123, 0, 0, 0, 0, 1124, 1125, 1126, 1127, 121, 1076, 836, 1077, 1078, 1079, 1080, 1081, 0, 0, 0, 0, 0, 0, - 0, 0, 2808, 0, 0, 0, 122, 123, 124, 125, + 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, 1082, 0, 0, 133, 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, 143, 1083, 145, @@ -6409,7 +6249,7 @@ static const yytype_int16 yytable[] = 1093, 212, 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, 0, 221, 222, 223, 224, 1094, 226, 227, 228, 229, 230, 231, 808, 1095, 233, 0, 234, 235, - 1096, 237, 0, 238, 0, 239, 240, 0, 241, 242, + 1096, 237, 0, 238, 0, 239, 240, 1480, 241, 242, 243, 244, 245, 246, 247, 248, 0, 1097, 1098, 251, 252, 0, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, @@ -6488,7 +6328,7 @@ static const yytype_int16 yytable[] = 432, 433, 434, 435, 436, 437, 0, 438, 439, 440, 1112, 442, 0, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 815, - 0, 0, 460, 461, 2875, 462, 463, 464, 465, 466, + 0, 0, 460, 461, 0, 462, 463, 464, 465, 466, 467, 468, 469, 0, 470, 1113, 1114, 0, 0, 473, 474, 816, 476, 817, 1115, 478, 479, 818, 481, 482, 483, 484, 485, 0, 0, 486, 487, 488, 1116, 0, @@ -6498,10 +6338,10 @@ static const yytype_int16 yytable[] = 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 1118, 0, 0, 0, 0, 0, 0, 1119, 1120, 1121, 0, - 0, 0, 0, 1122, 0, 1123, 0, 0, 0, 0, + 0, 0, 0, 1122, 0, 1123, 2151, 0, 0, 0, 1124, 1125, 1126, 1127, 121, 1076, 836, 1077, 1078, 1079, 1080, 1081, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, + 2810, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, 1082, 0, 0, 133, 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, 143, 1083, 145, 1084, 1085, @@ -6547,7 +6387,7 @@ static const yytype_int16 yytable[] = 479, 818, 481, 482, 483, 484, 485, 0, 0, 486, 487, 488, 1116, 0, 489, 490, 491, 492, 0, 493, 494, 495, 496, 497, 498, 1117, 500, 0, 501, 502, - 503, 504, 505, 506, 507, 508, 509, 0, 2999, 510, + 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 1118, 0, 0, 0, 0, 0, 0, @@ -6555,14 +6395,14 @@ static const yytype_int16 yytable[] = 0, 0, 0, 0, 1124, 1125, 1126, 1127, 121, 1076, 836, 1077, 1078, 1079, 1080, 1081, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, - 124, 125, 126, 127, 128, 129, 3238, 130, 131, 132, + 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, 1082, 0, 0, 133, 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, 143, 1083, 145, 1084, 1085, 0, 0, 148, 149, 150, 151, 152, 1086, 805, 153, 154, 155, 156, 1087, 1088, 159, 0, 160, 161, 162, 163, 806, 0, 807, 0, 1089, 167, 168, 169, 170, 171, 172, 173, 174, 175, 0, - 176, 177, 178, 179, 180, 181, 0, 182, 183, 3239, + 176, 177, 178, 179, 180, 181, 0, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 1090, 194, 195, 1091, 197, 1092, 198, 0, 199, 200, 201, 202, 203, 204, 0, 0, 205, 206, 207, 208, 0, 0, @@ -6570,7 +6410,7 @@ static const yytype_int16 yytable[] = 217, 218, 219, 220, 0, 221, 222, 223, 224, 1094, 226, 227, 228, 229, 230, 231, 808, 1095, 233, 0, 234, 235, 1096, 237, 0, 238, 0, 239, 240, 0, - 241, 242, 243, 244, 245, 246, 247, 248, 0, 3240, + 241, 242, 243, 244, 245, 246, 247, 248, 0, 1097, 1098, 251, 252, 0, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 273, 274, 275, 276, @@ -6589,13 +6429,13 @@ static const yytype_int16 yytable[] = 0, 380, 381, 382, 383, 384, 385, 0, 386, 387, 388, 389, 390, 1110, 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, - 407, 408, 0, 409, 410, 411, 412, 413, 3241, 1111, + 407, 408, 0, 409, 410, 411, 412, 413, 414, 1111, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 0, 0, 429, 430, 431, 432, 433, 434, 435, 436, 437, 0, 438, 439, 440, 1112, 442, 0, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 815, 0, 0, - 460, 461, 0, 462, 463, 464, 465, 466, 467, 468, + 460, 461, 2877, 462, 463, 464, 465, 466, 467, 468, 469, 0, 470, 1113, 1114, 0, 0, 473, 474, 816, 476, 817, 1115, 478, 479, 818, 481, 482, 483, 484, 485, 0, 0, 486, 487, 488, 1116, 0, 489, 490, @@ -6605,9 +6445,9 @@ static const yytype_int16 yytable[] = 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 1118, 0, 0, 0, 0, 0, 0, 1119, 1120, 1121, 0, 0, 0, - 0, 1122, 0, 3242, 0, 0, 0, 0, 1124, 1125, + 0, 1122, 0, 1123, 0, 0, 0, 0, 1124, 1125, 1126, 1127, 121, 1076, 836, 1077, 1078, 1079, 1080, 1081, - 0, 0, 0, 0, 0, 0, 0, 0, 3474, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, 1082, 0, 0, 133, 134, 135, 0, 136, 137, 138, 139, @@ -6654,7 +6494,7 @@ static const yytype_int16 yytable[] = 481, 482, 483, 484, 485, 0, 0, 486, 487, 488, 1116, 0, 489, 490, 491, 492, 0, 493, 494, 495, 496, 497, 498, 1117, 500, 0, 501, 502, 503, 504, - 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, + 505, 506, 507, 508, 509, 0, 3001, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 1118, 0, 0, 0, 0, 0, 0, 1119, 1120, @@ -6662,14 +6502,14 @@ static const yytype_int16 yytable[] = 0, 0, 1124, 1125, 1126, 1127, 121, 1076, 836, 1077, 1078, 1079, 1080, 1081, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, - 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, + 126, 127, 128, 129, 3192, 130, 131, 132, 0, 0, 0, 0, 0, 1082, 0, 0, 133, 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, 143, 1083, 145, 1084, 1085, 0, 0, 148, 149, 150, 151, 152, 1086, 805, 153, 154, 155, 156, 1087, 1088, 159, 0, 160, 161, 162, 163, 806, 0, 807, 0, 1089, 167, 168, 169, 170, 171, 172, 173, 174, 175, 0, 176, 177, - 178, 179, 180, 181, 0, 182, 183, 184, 185, 186, + 178, 179, 180, 181, 0, 182, 183, 3193, 185, 186, 187, 188, 189, 190, 191, 192, 1090, 194, 195, 1091, 197, 1092, 198, 0, 199, 200, 201, 202, 203, 204, 0, 0, 205, 206, 207, 208, 0, 0, 209, 210, @@ -6677,7 +6517,7 @@ static const yytype_int16 yytable[] = 219, 220, 0, 221, 222, 223, 224, 1094, 226, 227, 228, 229, 230, 231, 808, 1095, 233, 0, 234, 235, 1096, 237, 0, 238, 0, 239, 240, 0, 241, 242, - 243, 244, 245, 246, 247, 248, 0, 1097, 1098, 251, + 243, 244, 245, 246, 247, 248, 0, 3194, 1098, 251, 252, 0, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 273, 274, 275, 276, 277, 278, @@ -6696,7 +6536,7 @@ static const yytype_int16 yytable[] = 381, 382, 383, 384, 385, 0, 386, 387, 388, 389, 390, 1110, 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, - 0, 409, 410, 411, 412, 413, 414, 1111, 416, 417, + 0, 409, 410, 411, 412, 413, 3195, 1111, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 0, 0, 429, 430, 431, 432, 433, 434, 435, 436, 437, 0, 438, 439, 440, 1112, 442, 0, 443, @@ -6712,9 +6552,9 @@ static const yytype_int16 yytable[] = 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 1118, 0, 0, 0, 0, 0, 0, 1119, 1120, 1121, 0, 0, 0, 0, 1122, - 0, 1123, 0, 0, 0, 0, 1124, 1125, 1126, 1127, + 0, 3196, 0, 0, 0, 0, 1124, 1125, 1126, 1127, 121, 1076, 836, 1077, 1078, 1079, 1080, 1081, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 3428, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, 1082, 0, 0, 133, 134, 135, 0, 136, 137, 138, 139, 140, 141, @@ -6764,9 +6604,9 @@ static const yytype_int16 yytable[] = 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 1118, - 0, 0, 0, 0, 0, 0, 1776, 1777, 1121, 0, + 0, 0, 0, 0, 0, 0, 1119, 1120, 1121, 0, 0, 0, 0, 1122, 0, 1123, 0, 0, 0, 0, - 1124, 1125, 1126, 1127, 121, 2294, 836, 1077, 1078, 1079, + 1124, 1125, 1126, 1127, 121, 1076, 836, 1077, 1078, 1079, 1080, 1081, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, @@ -6871,9 +6711,9 @@ static const yytype_int16 yytable[] = 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 1118, 0, 0, - 0, 0, 0, 0, 1119, 2394, 1121, 0, 0, 0, + 0, 0, 0, 0, 1776, 1777, 1121, 0, 0, 0, 0, 1122, 0, 1123, 0, 0, 0, 0, 1124, 1125, - 1126, 1127, 121, 1076, 836, 1077, 1078, 1079, 1080, 1081, + 1126, 1127, 121, 2294, 836, 1077, 1078, 1079, 1080, 1081, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, 1082, @@ -6925,7 +6765,7 @@ static const yytype_int16 yytable[] = 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 1118, 0, 0, 0, 0, 0, 0, 1119, 1120, - 1121, 0, 0, 0, 0, 1122, 0, 2653, 0, 0, + 1121, 0, 0, 0, 0, 1122, 0, 1123, 0, 0, 0, 0, 1124, 1125, 1126, 1127, 121, 1076, 836, 1077, 1078, 1079, 1080, 1081, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, @@ -6978,7 +6818,7 @@ static const yytype_int16 yytable[] = 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 1118, 0, 0, 0, 0, - 0, 0, 1119, 3299, 1121, 0, 0, 0, 0, 1122, + 0, 0, 1119, 2395, 1121, 0, 0, 0, 0, 1122, 0, 1123, 0, 0, 0, 0, 1124, 1125, 1126, 1127, 121, 1076, 836, 1077, 1078, 1079, 1080, 1081, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -6990,7 +6830,7 @@ static const yytype_int16 yytable[] = 1088, 159, 0, 160, 161, 162, 163, 806, 0, 807, 0, 1089, 167, 168, 169, 170, 171, 172, 173, 174, 175, 0, 176, 177, 178, 179, 180, 181, 0, 182, - 183, 3239, 185, 186, 187, 188, 189, 190, 191, 192, + 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 1090, 194, 195, 1091, 197, 1092, 198, 0, 199, 200, 201, 202, 203, 204, 0, 0, 205, 206, 207, 208, 0, 0, 209, 210, 1093, 212, 213, 0, 214, 215, @@ -6998,7 +6838,7 @@ static const yytype_int16 yytable[] = 224, 1094, 226, 227, 228, 229, 230, 231, 808, 1095, 233, 0, 234, 235, 1096, 237, 0, 238, 0, 239, 240, 0, 241, 242, 243, 244, 245, 246, 247, 248, - 0, 3240, 1098, 251, 252, 0, 253, 254, 255, 256, + 0, 1097, 1098, 251, 252, 0, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 273, 274, 275, 276, 277, 278, 279, 1099, 1100, 0, 1101, 0, @@ -7017,7 +6857,7 @@ static const yytype_int16 yytable[] = 386, 387, 388, 389, 390, 1110, 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 0, 409, 410, 411, 412, 413, - 3241, 1111, 416, 417, 418, 419, 420, 421, 422, 423, + 414, 1111, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 0, 0, 429, 430, 431, 432, 433, 434, 435, 436, 437, 0, 438, 439, 440, 1112, 442, 0, 443, 444, 445, 446, 447, 448, 449, @@ -7032,18 +6872,18 @@ static const yytype_int16 yytable[] = 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 1118, 0, 0, 0, 0, 0, 0, 1119, 1120, 1121, 0, - 0, 0, 0, 1122, 0, 3242, 0, 0, 0, 0, + 0, 0, 0, 1122, 0, 2654, 0, 0, 0, 0, 1124, 1125, 1126, 1127, 121, 1076, 836, 1077, 1078, 1079, 1080, 1081, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, 1082, 0, 0, 133, 134, 135, 0, 136, 137, - 138, 139, 140, 141, 142, 3741, 1083, 145, 1084, 1085, + 138, 139, 140, 141, 142, 143, 1083, 145, 1084, 1085, 0, 0, 148, 149, 150, 151, 152, 1086, 805, 153, 154, 155, 156, 1087, 1088, 159, 0, 160, 161, 162, 163, 806, 0, 807, 0, 1089, 167, 168, 169, 170, 171, 172, 173, 174, 175, 0, 176, 177, 178, 179, - 180, 181, 0, 182, 183, 184, 3742, 186, 187, 188, + 180, 181, 0, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 1090, 194, 195, 1091, 197, 1092, 198, 0, 199, 200, 201, 202, 203, 204, 0, 0, 205, 206, 207, 208, 0, 0, 209, 210, 1093, 212, @@ -7078,14 +6918,14 @@ static const yytype_int16 yytable[] = 456, 457, 458, 815, 0, 0, 460, 461, 0, 462, 463, 464, 465, 466, 467, 468, 469, 0, 470, 1113, 1114, 0, 0, 473, 474, 816, 476, 817, 1115, 478, - 479, 818, 481, 482, 3743, 484, 485, 0, 0, 486, + 479, 818, 481, 482, 483, 484, 485, 0, 0, 486, 487, 488, 1116, 0, 489, 490, 491, 492, 0, 493, 494, 495, 496, 497, 498, 1117, 500, 0, 501, 502, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 1118, 0, 0, 0, 0, 0, 0, - 1119, 1120, 1121, 0, 0, 0, 0, 1122, 0, 1123, + 1119, 3253, 1121, 0, 0, 0, 0, 1122, 0, 1123, 0, 0, 0, 0, 1124, 1125, 1126, 1127, 121, 1076, 836, 1077, 1078, 1079, 1080, 1081, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, @@ -7096,15 +6936,15 @@ static const yytype_int16 yytable[] = 152, 1086, 805, 153, 154, 155, 156, 1087, 1088, 159, 0, 160, 161, 162, 163, 806, 0, 807, 0, 1089, 167, 168, 169, 170, 171, 172, 173, 174, 175, 0, - 176, 177, 178, 179, 180, 181, 0, 182, 183, 184, - 3742, 186, 187, 188, 189, 190, 191, 192, 1090, 194, + 176, 177, 178, 179, 180, 181, 0, 182, 183, 3193, + 185, 186, 187, 188, 189, 190, 191, 192, 1090, 194, 195, 1091, 197, 1092, 198, 0, 199, 200, 201, 202, 203, 204, 0, 0, 205, 206, 207, 208, 0, 0, 209, 210, 1093, 212, 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, 0, 221, 222, 223, 224, 1094, 226, 227, 228, 229, 230, 231, 808, 1095, 233, 0, 234, 235, 1096, 237, 0, 238, 0, 239, 240, 0, - 241, 242, 243, 244, 245, 246, 247, 248, 0, 1097, + 241, 242, 243, 244, 245, 246, 247, 248, 0, 3194, 1098, 251, 252, 0, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 273, 274, 275, 276, @@ -7123,7 +6963,7 @@ static const yytype_int16 yytable[] = 0, 380, 381, 382, 383, 384, 385, 0, 386, 387, 388, 389, 390, 1110, 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, - 407, 408, 0, 409, 410, 411, 412, 413, 414, 1111, + 407, 408, 0, 409, 410, 411, 412, 413, 3195, 1111, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 0, 0, 429, 430, 431, 432, 433, 434, 435, 436, 437, 0, 438, 439, 440, 1112, 442, @@ -7131,7 +6971,7 @@ static const yytype_int16 yytable[] = 452, 453, 454, 455, 456, 457, 458, 815, 0, 0, 460, 461, 0, 462, 463, 464, 465, 466, 467, 468, 469, 0, 470, 1113, 1114, 0, 0, 473, 474, 816, - 476, 817, 1115, 478, 479, 818, 481, 482, 3743, 484, + 476, 817, 1115, 478, 479, 818, 481, 482, 483, 484, 485, 0, 0, 486, 487, 488, 1116, 0, 489, 490, 491, 492, 0, 493, 494, 495, 496, 497, 498, 1117, 500, 0, 501, 502, 503, 504, 505, 506, 507, 508, @@ -7139,36 +6979,36 @@ static const yytype_int16 yytable[] = 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 1118, 0, 0, 0, 0, 0, 0, 1119, 1120, 1121, 0, 0, 0, - 0, 1122, 0, 1123, 0, 0, 0, 0, 1124, 1125, + 0, 1122, 0, 3196, 0, 0, 0, 0, 1124, 1125, 1126, 1127, 121, 1076, 836, 1077, 1078, 1079, 1080, 1081, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, 1082, 0, 0, 133, 134, 135, 0, 136, 137, 138, 139, - 140, 141, 142, -2183, 1083, 145, 1084, 1085, 0, 0, + 140, 141, 142, 3757, 1083, 145, 1084, 1085, 0, 0, 148, 149, 150, 151, 152, 1086, 805, 153, 154, 155, 156, 1087, 1088, 159, 0, 160, 161, 162, 163, 806, 0, 807, 0, 1089, 167, 168, 169, 170, 171, 172, 173, 174, 175, 0, 176, 177, 178, 179, 180, 181, - 0, 182, 183, 184, 3742, 186, 187, 188, 189, 190, + 0, 182, 183, 184, 3758, 186, 187, 188, 189, 190, 191, 192, 1090, 194, 195, 1091, 197, 1092, 198, 0, 199, 200, 201, 202, 203, 204, 0, 0, 205, 206, 207, 208, 0, 0, 209, 210, 1093, 212, 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, 0, 221, 222, 223, 224, 1094, 226, 227, 228, 229, 230, 231, 808, 1095, 233, 0, 234, 235, 1096, 237, 0, 238, - 0, 239, 240, 0, 241, 242, 243, 244, -2183, 246, + 0, 239, 240, 0, 241, 242, 243, 244, 245, 246, 247, 248, 0, 1097, 1098, 251, 252, 0, 253, 254, - 255, 256, 257, 258, 259, -2183, 261, 262, 263, 264, + 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 273, 274, 275, 276, 277, 278, 279, 1099, 1100, 0, - 1101, 0, 283, 0, 0, 286, 287, 288, 289, 290, - 1102, 291, 292, 293, 0, 0, 294, 295, 296, -2183, + 1101, 0, 283, 284, 285, 286, 287, 288, 289, 290, + 1102, 291, 292, 293, 0, 0, 294, 295, 296, 297, 0, 298, 299, 300, 301, 302, 303, 304, 305, 1103, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, - 327, 328, 1104, 330, 1105, 332, 333, 334, 335, 0, - 336, 337, 0, 339, 1107, 810, 341, 1108, 343, 344, + 327, 328, 1104, 330, 1105, 332, 333, 334, 335, 1106, + 336, 337, 338, 339, 1107, 810, 341, 1108, 343, 344, 345, 0, 346, 347, 0, 0, 1109, 349, 350, 0, 0, 351, 352, 353, 354, 355, 356, 812, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, @@ -7179,19 +7019,19 @@ static const yytype_int16 yytable[] = 403, 404, 405, 406, 407, 408, 0, 409, 410, 411, 412, 413, 414, 1111, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 0, 0, 429, - 430, 431, 432, 433, 434, 435, 436, 437, 0, -2183, + 430, 431, 432, 433, 434, 435, 436, 437, 0, 438, 439, 440, 1112, 442, 0, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 815, 0, 0, 460, 461, 0, 462, 463, 464, 465, 466, 467, 468, 469, 0, 470, 1113, 1114, 0, 0, 473, 474, 816, 476, 817, 1115, 478, 479, 818, - 481, 482, 3743, 484, 485, 0, 0, 486, 487, 488, + 481, 482, 3759, 484, 485, 0, 0, 486, 487, 488, 1116, 0, 489, 490, 491, 492, 0, 493, 494, 495, 496, 497, 498, 1117, 500, 0, 501, 502, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, - 531, -2183, 0, 0, 0, 0, 0, 0, 1119, 1120, + 531, 1118, 0, 0, 0, 0, 0, 0, 1119, 1120, 1121, 0, 0, 0, 0, 1122, 0, 1123, 0, 0, 0, 0, 1124, 1125, 1126, 1127, 121, 1076, 836, 1077, 1078, 1079, 1080, 1081, 0, 0, 0, 0, 0, 0, @@ -7201,11 +7041,11 @@ static const yytype_int16 yytable[] = 136, 137, 138, 139, 140, 141, 142, 143, 1083, 145, 1084, 1085, 0, 0, 148, 149, 150, 151, 152, 1086, 805, 153, 154, 155, 156, 1087, 1088, 159, 0, 160, - 161, 162, 163, 806, 0, 807, 0, 166, 167, 168, + 161, 162, 163, 806, 0, 807, 0, 1089, 167, 168, 169, 170, 171, 172, 173, 174, 175, 0, 176, 177, - 178, 179, 180, 181, 0, 182, 183, 184, 185, 186, + 178, 179, 180, 181, 0, 182, 183, 184, 3758, 186, 187, 188, 189, 190, 191, 192, 1090, 194, 195, 1091, - 197, 0, 198, 0, 199, 200, 201, 202, 203, 204, + 197, 1092, 198, 0, 199, 200, 201, 202, 203, 204, 0, 0, 205, 206, 207, 208, 0, 0, 209, 210, 1093, 212, 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, 0, 221, 222, 223, 224, 1094, 226, 227, @@ -7216,12 +7056,12 @@ static const yytype_int16 yytable[] = 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 273, 274, 275, 276, 277, 278, 279, 1099, 1100, 0, 1101, 0, 283, 284, 285, 286, - 287, 288, 289, 290, 0, 291, 292, 293, 0, 0, + 287, 288, 289, 290, 1102, 291, 292, 293, 0, 0, 294, 295, 296, 297, 0, 298, 299, 300, 301, 302, 303, 304, 305, 1103, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 1104, 330, 1105, 332, - 333, 334, 335, 0, 336, 337, 338, 339, 1107, 810, + 333, 334, 335, 1106, 336, 337, 338, 339, 1107, 810, 341, 1108, 343, 344, 345, 0, 346, 347, 0, 0, 1109, 349, 350, 0, 0, 351, 352, 353, 354, 355, 356, 812, 358, 359, 360, 361, 362, 363, 364, 365, @@ -7238,45 +7078,45 @@ static const yytype_int16 yytable[] = 454, 455, 456, 457, 458, 815, 0, 0, 460, 461, 0, 462, 463, 464, 465, 466, 467, 468, 469, 0, 470, 1113, 1114, 0, 0, 473, 474, 816, 476, 817, - 1115, 478, 479, 818, 481, 482, 483, 484, 485, 0, - 0, 486, 487, 488, 0, 0, 489, 490, 491, 492, + 1115, 478, 479, 818, 481, 482, 3759, 484, 485, 0, + 0, 486, 487, 488, 1116, 0, 489, 490, 491, 492, 0, 493, 494, 495, 496, 497, 498, 1117, 500, 0, 501, 502, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, - 527, 528, 529, 530, 531, 0, 0, 0, 0, 0, - 0, 0, 1466, 1467, 0, 0, 0, 0, 0, 1122, + 527, 528, 529, 530, 531, 1118, 0, 0, 0, 0, + 0, 0, 1119, 1120, 1121, 0, 0, 0, 0, 1122, 0, 1123, 0, 0, 0, 0, 1124, 1125, 1126, 1127, - 121, 1076, 836, 1077, 1078, 0, 1080, 1081, 0, 0, + 121, 1076, 836, 1077, 1078, 1079, 1080, 1081, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, 1082, 0, 0, 133, 134, 135, 0, 136, 137, 138, 139, 140, 141, - 142, 143, 1083, 145, 1084, 1085, 0, 0, 148, 149, + 142, -2188, 1083, 145, 1084, 1085, 0, 0, 148, 149, 150, 151, 152, 1086, 805, 153, 154, 155, 156, 1087, 1088, 159, 0, 160, 161, 162, 163, 806, 0, 807, - 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, + 0, 1089, 167, 168, 169, 170, 171, 172, 173, 174, 175, 0, 176, 177, 178, 179, 180, 181, 0, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 1090, 194, 195, 1091, 197, 0, 198, 0, 199, 200, + 183, 184, 3758, 186, 187, 188, 189, 190, 191, 192, + 1090, 194, 195, 1091, 197, 1092, 198, 0, 199, 200, 201, 202, 203, 204, 0, 0, 205, 206, 207, 208, 0, 0, 209, 210, 1093, 212, 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, 0, 221, 222, 223, 224, 1094, 226, 227, 228, 229, 230, 231, 808, 1095, 233, 0, 234, 235, 1096, 237, 0, 238, 0, 239, - 240, 0, 241, 242, 243, 244, 245, 246, 247, 248, + 240, 0, 241, 242, 243, 244, -2188, 246, 247, 248, 0, 1097, 1098, 251, 252, 0, 253, 254, 255, 256, - 257, 258, 259, 260, 261, 262, 263, 264, 0, 265, + 257, 258, 259, -2188, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 273, 274, 275, 276, 277, 278, 279, 1099, 1100, 0, 1101, 0, - 283, 284, 285, 286, 287, 288, 289, 290, 0, 291, - 292, 293, 0, 0, 294, 295, 296, 297, 0, 298, + 283, 0, 0, 286, 287, 288, 289, 290, 1102, 291, + 292, 293, 0, 0, 294, 295, 296, -2188, 0, 298, 299, 300, 301, 302, 303, 304, 305, 1103, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 1104, 330, 1105, 332, 333, 334, 335, 0, 336, 337, - 338, 339, 1107, 810, 341, 1108, 343, 344, 345, 0, - 346, 347, 0, 0, 348, 349, 350, 0, 0, 351, + 0, 339, 1107, 810, 341, 1108, 343, 344, 345, 0, + 346, 347, 0, 0, 1109, 349, 350, 0, 0, 351, 352, 353, 354, 355, 356, 812, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 0, 0, 0, 0, 370, 371, 813, 373, 374, 375, 376, 377, @@ -7284,21 +7124,21 @@ static const yytype_int16 yytable[] = 386, 387, 388, 389, 390, 1110, 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 0, 409, 410, 411, 412, 413, - 414, 2280, 2281, 417, 418, 419, 420, 421, 422, 423, + 414, 1111, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 0, 0, 429, 430, 431, - 432, 433, 434, 435, 436, 437, 0, 438, 439, 440, + 432, 433, 434, 435, 436, 437, 0, -2188, 439, 440, 1112, 442, 0, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 815, 0, 0, 460, 461, 0, 462, 463, 464, 465, 466, 467, 468, 469, 0, 470, 1113, 1114, 0, 0, 473, 474, 816, 476, 817, 1115, 478, 479, 818, 481, 482, - 483, 484, 485, 0, 0, 486, 487, 488, 0, 0, + 3759, 484, 485, 0, 0, 486, 487, 488, 1116, 0, 489, 490, 491, 492, 0, 493, 494, 495, 496, 497, 498, 1117, 500, 0, 501, 502, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, - 523, 524, 525, 526, 527, 528, 529, 530, 531, 0, - 0, 0, 0, 0, 0, 0, 2282, 2283, 0, 0, + 523, 524, 525, 526, 527, 528, 529, 530, 531, -2188, + 0, 0, 0, 0, 0, 0, 1119, 1120, 1121, 0, 0, 0, 0, 1122, 0, 1123, 0, 0, 0, 0, 1124, 1125, 1126, 1127, 121, 1076, 836, 1077, 1078, 1079, 1080, 1081, 0, 0, 0, 0, 0, 0, 0, 0, @@ -7322,7 +7162,7 @@ static const yytype_int16 yytable[] = 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 273, 274, 275, 276, 277, 278, 279, 1099, - 1100, 0, 1101, 0, 283, 0, 285, 286, 287, 288, + 1100, 0, 1101, 0, 283, 284, 285, 286, 287, 288, 289, 290, 0, 291, 292, 293, 0, 0, 294, 295, 296, 297, 0, 298, 299, 300, 301, 302, 303, 304, 305, 1103, 307, 308, 309, 310, 311, 312, 313, 314, @@ -7371,7 +7211,7 @@ static const yytype_int16 yytable[] = 217, 218, 219, 220, 0, 221, 222, 223, 224, 1094, 226, 227, 228, 229, 230, 231, 808, 1095, 233, 0, 234, 235, 1096, 237, 0, 238, 0, 239, 240, 0, - 241, 242, 243, 244, 245, 246, 247, 248, 3260, 1097, + 241, 242, 243, 244, 245, 246, 247, 248, 0, 1097, 1098, 251, 252, 0, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 273, 274, 275, 276, @@ -7390,8 +7230,8 @@ static const yytype_int16 yytable[] = 0, 380, 381, 382, 383, 384, 385, 0, 386, 387, 388, 389, 390, 1110, 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, - 407, 408, 0, 409, 410, 411, 412, 413, 414, 415, - 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, + 407, 408, 0, 409, 410, 411, 412, 413, 414, 2280, + 2281, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 0, 0, 429, 430, 431, 432, 433, 434, 435, 436, 437, 0, 438, 439, 440, 1112, 442, 0, 443, 444, 445, 446, 447, 448, 449, 450, 451, @@ -7405,9 +7245,11 @@ static const yytype_int16 yytable[] = 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 0, 0, 0, - 0, 0, 121, 1076, 836, 1077, 1078, 0, 1080, 1081, - 0, 1122, 0, 2922, 0, 0, 0, 0, 1124, 1125, - 1126, 1127, 122, 123, 124, 125, 126, 127, 128, 129, + 0, 0, 0, 0, 2282, 2283, 0, 0, 0, 0, + 0, 1122, 0, 1123, 0, 0, 0, 0, 1124, 1125, + 1126, 1127, 121, 1076, 836, 1077, 1078, 1079, 1080, 1081, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, 1082, 0, 0, 133, 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, 143, 1083, 145, 1084, 1085, 0, 0, @@ -7427,14 +7269,14 @@ static const yytype_int16 yytable[] = 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 273, 274, 275, 276, 277, 278, 279, 1099, 1100, 0, - 1101, 0, 283, 284, 285, 286, 287, 288, 289, 290, + 1101, 0, 283, 0, 285, 286, 287, 288, 289, 290, 0, 291, 292, 293, 0, 0, 294, 295, 296, 297, 0, 298, 299, 300, 301, 302, 303, 304, 305, 1103, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 1104, 330, 1105, 332, 333, 334, 335, 0, 336, 337, 338, 339, 1107, 810, 341, 1108, 343, 344, - 345, 0, 346, 347, 0, 0, 348, 349, 350, 0, + 345, 0, 346, 347, 0, 0, 1109, 349, 350, 0, 0, 351, 352, 353, 354, 355, 356, 812, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 0, 0, 0, 0, 370, 371, 813, 373, 374, 375, @@ -7442,7 +7284,7 @@ static const yytype_int16 yytable[] = 385, 0, 386, 387, 388, 389, 390, 1110, 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 0, 409, 410, 411, - 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, + 412, 413, 414, 1111, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 0, 0, 429, 430, 431, 432, 433, 434, 435, 436, 437, 0, 438, 439, 440, 1112, 442, 0, 443, 444, 445, 446, 447, @@ -7456,9 +7298,11 @@ static const yytype_int16 yytable[] = 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, - 531, 0, 0, 0, 0, 0, 121, 1076, 836, 1077, - 1078, 0, 1080, 1081, 0, 1122, 0, 2922, 0, 0, - 0, 0, 1124, 1125, 1126, 1127, 122, 123, 124, 125, + 531, 0, 0, 0, 0, 0, 0, 0, 1466, 1467, + 0, 0, 0, 0, 0, 1122, 0, 1123, 0, 0, + 0, 0, 1124, 1125, 1126, 1127, 121, 1076, 836, 1077, + 1078, 0, 1080, 1081, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, 1082, 0, 0, 133, 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, 143, 1083, 145, @@ -7474,7 +7318,7 @@ static const yytype_int16 yytable[] = 219, 220, 0, 221, 222, 223, 224, 1094, 226, 227, 228, 229, 230, 231, 808, 1095, 233, 0, 234, 235, 1096, 237, 0, 238, 0, 239, 240, 0, 241, 242, - 243, 244, 245, 246, 247, 248, 0, 1097, 1098, 251, + 243, 244, 245, 246, 247, 248, 3214, 1097, 1098, 251, 252, 0, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 273, 274, 275, 276, 277, 278, @@ -7493,7 +7337,7 @@ static const yytype_int16 yytable[] = 381, 382, 383, 384, 385, 0, 386, 387, 388, 389, 390, 1110, 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, - 0, 409, 410, 411, 412, 413, 414, 1111, 416, 417, + 0, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 0, 0, 429, 430, 431, 432, 433, 434, 435, 436, 437, 0, 438, 439, 440, 1112, 442, 0, 443, @@ -7508,36 +7352,36 @@ static const yytype_int16 yytable[] = 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 0, 0, 0, 0, 0, - 121, 1076, 836, 1077, 1078, 1079, 1080, 1081, 0, 1122, - 0, 1123, 0, 0, 0, 0, 1124, 1125, 1126, 1127, + 121, 1076, 836, 1077, 1078, 0, 1080, 1081, 0, 1122, + 0, 2924, 0, 0, 0, 0, 1124, 1125, 1126, 1127, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, 1082, 0, 0, 133, 134, 135, 0, 136, 137, 138, 139, 140, 141, - 142, 0, 1083, 145, 1084, 1085, 0, 0, 148, 149, + 142, 143, 1083, 145, 1084, 1085, 0, 0, 148, 149, 150, 151, 152, 1086, 805, 153, 154, 155, 156, 1087, 1088, 159, 0, 160, 161, 162, 163, 806, 0, 807, - 0, 1089, 167, 168, 169, 170, 171, 172, 173, 174, + 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 0, 176, 177, 178, 179, 180, 181, 0, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 1090, 194, 195, 1091, 197, 1092, 198, 0, 199, 200, + 1090, 194, 195, 1091, 197, 0, 198, 0, 199, 200, 201, 202, 203, 204, 0, 0, 205, 206, 207, 208, 0, 0, 209, 210, 1093, 212, 213, 0, 214, 215, - 216, 0, 217, 218, 0, 220, 0, 221, 222, 223, + 216, 0, 217, 218, 219, 220, 0, 221, 222, 223, 224, 1094, 226, 227, 228, 229, 230, 231, 808, 1095, 233, 0, 234, 235, 1096, 237, 0, 238, 0, 239, - 240, 0, 241, 242, 243, 244, 0, 246, 247, 248, + 240, 0, 241, 242, 243, 244, 245, 246, 247, 248, 0, 1097, 1098, 251, 252, 0, 253, 254, 255, 256, - 257, 258, 259, 0, 261, 262, 263, 264, 0, 265, + 257, 258, 259, 260, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 273, 274, 275, 276, 277, 278, 279, 1099, 1100, 0, 1101, 0, - 283, 0, 0, 286, 287, 288, 289, 290, 1102, 291, - 292, 293, 0, 0, 294, 295, 296, 0, 0, 298, + 283, 284, 285, 286, 287, 288, 289, 290, 0, 291, + 292, 293, 0, 0, 294, 295, 296, 297, 0, 298, 299, 300, 301, 302, 303, 304, 305, 1103, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 1104, 330, 1105, 332, 333, 334, 335, 0, 336, 337, - 0, 339, 1107, 810, 341, 1108, 343, 344, 345, 0, - 346, 347, 0, 0, 1109, 349, 350, 0, 0, 351, + 338, 339, 1107, 810, 341, 1108, 343, 344, 345, 0, + 346, 347, 0, 0, 348, 349, 350, 0, 0, 351, 352, 353, 354, 355, 356, 812, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 0, 0, 0, 0, 370, 371, 813, 373, 374, 375, 376, 377, @@ -7545,76 +7389,230 @@ static const yytype_int16 yytable[] = 386, 387, 388, 389, 390, 1110, 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 0, 409, 410, 411, 412, 413, - 414, 1111, 416, 417, 418, 419, 420, 421, 422, 423, + 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 0, 0, 429, 430, 431, - 432, 433, 434, 435, 436, 437, 0, 0, 439, 440, + 432, 433, 434, 435, 436, 437, 0, 438, 439, 440, 1112, 442, 0, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 815, 0, 0, 460, 461, 0, 462, 463, 464, 465, 466, 467, 468, 469, 0, 470, 1113, 1114, 0, 0, 473, 474, 816, 476, 817, 1115, 478, 479, 818, 481, 482, - 483, 484, 485, 0, 0, 486, 487, 488, 1116, 0, + 483, 484, 485, 0, 0, 486, 487, 488, 0, 0, 489, 490, 491, 492, 0, 493, 494, 495, 496, 497, 498, 1117, 500, 0, 501, 502, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 0, - 0, 0, 0, 0, 121, 0, 1119, 1120, 1121, 0, - 0, 1081, 0, 1122, 0, 1123, 0, 0, 0, 0, + 0, 0, 0, 0, 121, 1076, 836, 1077, 1078, 0, + 1080, 1081, 0, 1122, 0, 2924, 0, 0, 0, 0, 1124, 1125, 1126, 1127, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, 1082, 0, 0, 133, 134, 135, 0, 136, 137, - 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, + 138, 139, 140, 141, 142, 143, 1083, 145, 1084, 1085, 0, 0, 148, 149, 150, 151, 152, 1086, 805, 153, - 154, 155, 156, 157, 158, 159, 0, 160, 161, 162, + 154, 155, 156, 1087, 1088, 159, 0, 160, 161, 162, 163, 806, 0, 807, 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 0, 176, 177, 178, 179, 180, 181, 0, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 193, 194, 195, 196, 197, 0, + 189, 190, 191, 192, 1090, 194, 195, 1091, 197, 0, 198, 0, 199, 200, 201, 202, 203, 204, 0, 0, - 205, 206, 207, 208, 0, 0, 209, 210, 211, 212, + 205, 206, 207, 208, 0, 0, 209, 210, 1093, 212, 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, - 0, 221, 222, 223, 224, 225, 226, 227, 228, 229, - 230, 231, 808, 0, 233, 0, 234, 235, 236, 237, + 0, 221, 222, 223, 224, 1094, 226, 227, 228, 229, + 230, 231, 808, 1095, 233, 0, 234, 235, 1096, 237, 0, 238, 0, 239, 240, 0, 241, 242, 243, 244, - 245, 246, 247, 248, 0, 249, 250, 251, 252, 0, + 245, 246, 247, 248, 0, 1097, 1098, 251, 252, 0, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, - 0, 272, 273, 274, 275, 276, 277, 278, 279, 280, - 281, 0, 282, 0, 283, 284, 285, 286, 287, 288, + 0, 272, 273, 274, 275, 276, 277, 278, 279, 1099, + 1100, 0, 1101, 0, 283, 284, 285, 286, 287, 288, 289, 290, 0, 291, 292, 293, 0, 0, 294, 295, 296, 297, 0, 298, 299, 300, 301, 302, 303, 304, 305, 1103, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, - 335, 0, 336, 337, 338, 339, 0, 810, 341, 342, + 325, 326, 327, 328, 1104, 330, 1105, 332, 333, 334, + 335, 0, 336, 337, 338, 339, 1107, 810, 341, 1108, 343, 344, 345, 0, 346, 347, 0, 0, 348, 349, 350, 0, 0, 351, 352, 353, 354, 355, 356, 812, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 0, 0, 0, 0, 370, 371, 813, 373, 374, 375, 376, 377, 378, 379, 0, 380, 381, 382, - 383, 384, 385, 0, 386, 387, 388, 389, 390, 391, + 383, 384, 385, 0, 386, 387, 388, 389, 390, 1110, 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 0, 409, - 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, + 410, 411, 412, 413, 414, 1111, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 0, 0, 429, 430, 431, 432, 433, 434, 435, 436, 437, - 0, 438, 439, 440, 441, 442, 0, 443, 444, 445, + 0, 438, 439, 440, 1112, 442, 0, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 815, 0, 0, 460, 461, 0, 462, - 463, 464, 465, 466, 467, 468, 469, 0, 470, 471, - 472, 0, 0, 473, 474, 816, 476, 817, 0, 478, + 463, 464, 465, 466, 467, 468, 469, 0, 470, 1113, + 1114, 0, 0, 473, 474, 816, 476, 817, 1115, 478, 479, 818, 481, 482, 483, 484, 485, 0, 0, 486, 487, 488, 0, 0, 489, 490, 491, 492, 0, 493, - 494, 495, 496, 497, 498, 499, 500, 0, 501, 502, + 494, 495, 496, 497, 498, 1117, 500, 0, 501, 502, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, - 529, 530, 531, 0, 0, 0, 0, 0, 539, 2032, - 0, 0, 0, 0, 2033, 1081, 0, 1122, 0, 2198, + 529, 530, 531, 0, 0, 0, 0, 0, 121, 1076, + 836, 1077, 1078, 1079, 1080, 1081, 0, 1122, 0, 1123, 0, 0, 0, 0, 1124, 1125, 1126, 1127, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 134, + 0, 0, 0, 0, 0, 1082, 0, 0, 133, 134, + 135, 0, 136, 137, 138, 139, 140, 141, 142, 0, + 1083, 145, 1084, 1085, 0, 0, 148, 149, 150, 151, + 152, 1086, 805, 153, 154, 155, 156, 1087, 1088, 159, + 0, 160, 161, 162, 163, 806, 0, 807, 0, 1089, + 167, 168, 169, 170, 171, 172, 173, 174, 175, 0, + 176, 177, 178, 179, 180, 181, 0, 182, 183, 184, + 185, 186, 187, 188, 189, 190, 191, 192, 1090, 194, + 195, 1091, 197, 1092, 198, 0, 199, 200, 201, 202, + 203, 204, 0, 0, 205, 206, 207, 208, 0, 0, + 209, 210, 1093, 212, 213, 0, 214, 215, 216, 0, + 217, 218, 0, 220, 0, 221, 222, 223, 224, 1094, + 226, 227, 228, 229, 230, 231, 808, 1095, 233, 0, + 234, 235, 1096, 237, 0, 238, 0, 239, 240, 0, + 241, 242, 243, 244, 0, 246, 247, 248, 0, 1097, + 1098, 251, 252, 0, 253, 254, 255, 256, 257, 258, + 259, 0, 261, 262, 263, 264, 0, 265, 266, 267, + 268, 269, 270, 271, 0, 272, 273, 274, 275, 276, + 277, 278, 279, 1099, 1100, 0, 1101, 0, 283, 0, + 0, 286, 287, 288, 289, 290, 1102, 291, 292, 293, + 0, 0, 294, 295, 296, 0, 0, 298, 299, 300, + 301, 302, 303, 304, 305, 1103, 307, 308, 309, 310, + 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, + 321, 322, 323, 324, 325, 326, 327, 328, 1104, 330, + 1105, 332, 333, 334, 335, 0, 336, 337, 0, 339, + 1107, 810, 341, 1108, 343, 344, 345, 0, 346, 347, + 0, 0, 1109, 349, 350, 0, 0, 351, 352, 353, + 354, 355, 356, 812, 358, 359, 360, 361, 362, 363, + 364, 365, 366, 367, 368, 369, 0, 0, 0, 0, + 370, 371, 813, 373, 374, 375, 376, 377, 378, 379, + 0, 380, 381, 382, 383, 384, 385, 0, 386, 387, + 388, 389, 390, 1110, 392, 393, 394, 395, 0, 396, + 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, + 407, 408, 0, 409, 410, 411, 412, 413, 414, 1111, + 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, + 426, 427, 428, 0, 0, 429, 430, 431, 432, 433, + 434, 435, 436, 437, 0, 0, 439, 440, 1112, 442, + 0, 443, 444, 445, 446, 447, 448, 449, 450, 451, + 452, 453, 454, 455, 456, 457, 458, 815, 0, 0, + 460, 461, 0, 462, 463, 464, 465, 466, 467, 468, + 469, 0, 470, 1113, 1114, 0, 0, 473, 474, 816, + 476, 817, 1115, 478, 479, 818, 481, 482, 483, 484, + 485, 0, 0, 486, 487, 488, 1116, 0, 489, 490, + 491, 492, 0, 493, 494, 495, 496, 497, 498, 1117, + 500, 0, 501, 502, 503, 504, 505, 506, 507, 508, + 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, + 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, + 525, 526, 527, 528, 529, 530, 531, 0, 0, 0, + 0, 0, 121, 0, 1119, 1120, 1121, 0, 0, 1081, + 0, 1122, 0, 1123, 0, 0, 0, 0, 1124, 1125, + 1126, 1127, 122, 123, 124, 125, 126, 127, 128, 129, + 0, 130, 131, 132, 0, 0, 0, 0, 0, 1082, + 0, 0, 133, 134, 135, 0, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 147, 0, 0, + 148, 149, 150, 151, 152, 1086, 805, 153, 154, 155, + 156, 157, 158, 159, 0, 160, 161, 162, 163, 806, + 0, 807, 0, 166, 167, 168, 169, 170, 171, 172, + 173, 174, 175, 0, 176, 177, 178, 179, 180, 181, + 0, 182, 183, 184, 185, 186, 187, 188, 189, 190, + 191, 192, 193, 194, 195, 196, 197, 0, 198, 0, + 199, 200, 201, 202, 203, 204, 0, 0, 205, 206, + 207, 208, 0, 0, 209, 210, 211, 212, 213, 0, + 214, 215, 216, 0, 217, 218, 219, 220, 0, 221, + 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + 808, 0, 233, 0, 234, 235, 236, 237, 0, 238, + 0, 239, 240, 0, 241, 242, 243, 244, 245, 246, + 247, 248, 0, 249, 250, 251, 252, 0, 253, 254, + 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, + 273, 274, 275, 276, 277, 278, 279, 280, 281, 0, + 282, 0, 283, 284, 285, 286, 287, 288, 289, 290, + 0, 291, 292, 293, 0, 0, 294, 295, 296, 297, + 0, 298, 299, 300, 301, 302, 303, 304, 305, 1103, + 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, + 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, + 327, 328, 329, 330, 331, 332, 333, 334, 335, 0, + 336, 337, 338, 339, 0, 810, 341, 342, 343, 344, + 345, 0, 346, 347, 0, 0, 348, 349, 350, 0, + 0, 351, 352, 353, 354, 355, 356, 812, 358, 359, + 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, + 0, 0, 0, 0, 370, 371, 813, 373, 374, 375, + 376, 377, 378, 379, 0, 380, 381, 382, 383, 384, + 385, 0, 386, 387, 388, 389, 390, 391, 392, 393, + 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, + 403, 404, 405, 406, 407, 408, 0, 409, 410, 411, + 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, + 422, 423, 424, 425, 426, 427, 428, 0, 0, 429, + 430, 431, 432, 433, 434, 435, 436, 437, 0, 438, + 439, 440, 441, 442, 0, 443, 444, 445, 446, 447, + 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, + 458, 815, 0, 0, 460, 461, 0, 462, 463, 464, + 465, 466, 467, 468, 469, 0, 470, 471, 472, 0, + 0, 473, 474, 816, 476, 817, 0, 478, 479, 818, + 481, 482, 483, 484, 485, 0, 0, 486, 487, 488, + 0, 0, 489, 490, 491, 492, 0, 493, 494, 495, + 496, 497, 498, 499, 500, 0, 501, 502, 503, 504, + 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, + 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, + 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, + 531, 0, 0, 0, 0, 0, 539, 2032, 0, 0, + 0, 0, 2033, 1081, 0, 1122, 0, 2198, 0, 0, + 0, 0, 1124, 1125, 1126, 1127, 122, 123, 124, 125, + 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 134, 135, 0, + 0, 137, 138, 0, 140, 141, 142, 143, 144, 0, + 146, 147, 0, 0, 148, 149, 150, 151, 152, 0, + 0, 153, 154, 155, 156, 157, 158, 159, 0, 160, + 161, 162, 163, 164, 0, 0, 0, 166, 167, 168, + 169, 170, 171, 0, 173, 174, 175, 0, 176, 177, + 178, 179, 180, 181, 0, 0, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 0, 198, 0, 199, 200, 201, 202, 203, 204, + 0, 0, 205, 206, 207, 208, 0, 0, 209, 210, + 211, 212, 213, 0, 214, 215, 216, 0, 217, 218, + 219, 220, 0, 221, 222, 223, 224, 225, 226, 227, + 228, 229, 230, 231, 232, 0, 233, 0, 234, 235, + 236, 237, 0, 238, 0, 239, 0, 0, 0, 242, + 243, 540, 0, 246, 247, 248, 0, 249, 250, 251, + 252, 0, 253, 254, 255, 256, 257, 258, 259, 0, + 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, + 270, 271, 0, 272, 0, 274, 275, 276, 277, 278, + 279, 280, 281, 0, 282, 0, 283, 0, 0, 286, + 0, 288, 289, 290, 0, 291, 292, 293, 0, 0, + 294, 0, 296, 0, 0, 298, 299, 300, 301, 302, + 303, 304, 305, 541, 307, 308, 309, 310, 311, 312, + 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, + 323, 324, 325, 326, 327, 328, 329, 0, 331, 332, + 333, 334, 335, 0, 336, 337, 0, 339, 0, 340, + 341, 342, 343, 344, 345, 0, 346, 347, 0, 0, + 348, 349, 350, 0, 0, 351, 352, 353, 0, 355, + 0, 357, 358, 359, 360, 361, 362, 363, 364, 365, + 366, 367, 368, 369, 0, 0, 0, 0, 370, 371, + 372, 0, 374, 375, 376, 377, 378, 379, 0, 380, + 381, 382, 383, 384, 385, 0, 386, 387, 388, 389, + 390, 391, 392, 393, 394, 395, 0, 396, 397, 398, + 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, + 0, 409, 410, 0, 412, 413, 414, 415, 416, 417, + 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, + 428, 0, 0, 429, 430, 431, 432, 433, 434, 435, + 436, 437, 0, 0, 439, 440, 441, 442, 0, 443, + 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, + 454, 455, 456, 542, 458, 459, 0, 0, 460, 461, + 0, 462, 0, 464, 465, 466, 467, 468, 469, 0, + 470, 471, 472, 0, 0, 473, 474, 475, 476, 477, + 0, 478, 479, 480, 481, 482, 483, 484, 485, 0, + 0, 486, 487, 488, 0, 0, 489, 490, 491, 492, + 0, 493, 494, 495, 496, 497, 498, 499, 500, 0, + 501, 0, 503, 504, 505, 506, 507, 508, 509, 0, + 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, + 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, + 527, 528, 529, 530, 531, 0, 0, 0, 539, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1124, 1125, 122, 123, + 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, + 0, 0, 0, 0, 0, 0, 1030, 0, 0, 134, 135, 0, 0, 137, 138, 0, 140, 141, 142, 143, 144, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 0, 0, 153, 154, 155, 156, 157, 158, 159, @@ -7625,22 +7623,22 @@ static const yytype_int16 yytable[] = 195, 196, 197, 0, 198, 0, 199, 200, 201, 202, 203, 204, 0, 0, 205, 206, 207, 208, 0, 0, 209, 210, 211, 212, 213, 0, 214, 215, 216, 0, - 217, 218, 219, 220, 0, 221, 222, 223, 224, 225, - 226, 227, 228, 229, 230, 231, 232, 0, 233, 0, - 234, 235, 236, 237, 0, 238, 0, 239, 0, 0, + 217, 218, 219, 220, -590, 221, 222, 223, 224, 225, + 226, 227, 228, 229, 230, 231, 232, 0, 233, -590, + 234, 235, 236, 237, -590, 238, 0, 239, 0, 0, 0, 242, 243, 540, 0, 246, 247, 248, 0, 249, 250, 251, 252, 0, 253, 254, 255, 256, 257, 258, 259, 0, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 0, 274, 275, 276, - 277, 278, 279, 280, 281, 0, 282, 0, 283, 0, + 277, 278, 279, 280, 281, -590, 282, 0, 283, 0, 0, 286, 0, 288, 289, 290, 0, 291, 292, 293, - 0, 0, 294, 0, 296, 0, 0, 298, 299, 300, + 0, 0, 294, 0, 296, 0, -590, 298, 299, 300, 301, 302, 303, 304, 305, 541, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 0, 331, 332, 333, 334, 335, 0, 336, 337, 0, 339, - 0, 340, 341, 342, 343, 344, 345, 0, 346, 347, - 0, 0, 348, 349, 350, 0, 0, 351, 352, 353, + 0, 340, 341, 342, 343, 344, 345, -590, 346, 347, + 0, 0, 348, 349, 350, 0, -590, 351, 352, 353, 0, 355, 0, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 0, 0, 0, 0, 370, 371, 372, 0, 374, 375, 376, 377, 378, 379, @@ -7656,470 +7654,317 @@ static const yytype_int16 yytable[] = 460, 461, 0, 462, 0, 464, 465, 466, 467, 468, 469, 0, 470, 471, 472, 0, 0, 473, 474, 475, 476, 477, 0, 478, 479, 480, 481, 482, 483, 484, - 485, 0, 0, 486, 487, 488, 0, 0, 489, 490, + 485, -590, 0, 486, 487, 488, 0, 0, 489, 490, 491, 492, 0, 493, 494, 495, 496, 497, 498, 499, 500, 0, 501, 0, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, - 525, 526, 527, 528, 529, 530, 531, 0, 0, 0, - 539, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1124, 1125, - 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, - 131, 132, 0, 0, 0, 0, 0, 0, 1030, 0, - 0, 134, 135, 0, 0, 137, 138, 0, 140, 141, - 142, 143, 144, 0, 146, 147, 0, 0, 148, 149, - 150, 151, 152, 0, 0, 153, 154, 155, 156, 157, - 158, 159, 0, 160, 161, 162, 163, 164, 0, 0, - 0, 166, 167, 168, 169, 170, 171, 0, 173, 174, - 175, 0, 176, 177, 178, 179, 180, 181, 0, 0, + 525, 526, 527, 528, 529, 530, 531, 539, 0, 564, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1199, 0, 0, 122, 123, 124, + 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 134, 135, + 0, 0, 137, 138, 0, 140, 141, 142, 143, 144, + 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, + 0, 0, 153, 154, 155, 156, 157, 158, 159, 0, + 160, 161, 162, 163, 164, 0, 0, 0, 166, 167, + 168, 169, 170, 171, 0, 173, 174, 175, 0, 176, + 177, 178, 179, 180, 181, 0, 0, 183, 184, 185, + 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, + 196, 197, 0, 198, 0, 199, 200, 201, 202, 203, + 204, 0, 0, 205, 206, 207, 208, 0, 0, 209, + 210, 211, 212, 213, 0, 214, 215, 216, 0, 217, + 218, 219, 220, 0, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 0, 233, 0, 234, + 235, 236, 237, 0, 238, 0, 239, 0, 0, 0, + 242, 243, 540, 0, 246, 247, 248, 0, 249, 250, + 251, 252, 0, 253, 254, 255, 256, 257, 258, 259, + 0, 261, 262, 263, 264, 0, 265, 266, 267, 268, + 269, 270, 271, 0, 272, 0, 274, 275, 276, 277, + 278, 279, 280, 281, 0, 282, 0, 283, 0, 0, + 286, 0, 288, 289, 290, 0, 291, 292, 293, 0, + 0, 294, 0, 296, 0, 0, 298, 299, 300, 301, + 302, 303, 304, 305, 541, 307, 308, 309, 310, 311, + 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, + 322, 323, 324, 325, 326, 327, 328, 329, 0, 331, + 332, 333, 334, 335, 0, 336, 337, 0, 339, 0, + 340, 341, 342, 343, 344, 345, 0, 346, 347, 0, + 0, 348, 349, 350, 0, 0, 351, 352, 353, 0, + 355, 0, 357, 358, 359, 360, 361, 362, 363, 364, + 365, 366, 367, 368, 369, 0, 0, 0, 0, 370, + 371, 372, 0, 374, 375, 376, 377, 378, 379, 0, + 380, 381, 382, 383, 384, 385, 0, 386, 387, 388, + 389, 390, 391, 392, 393, 394, 395, 0, 396, 397, + 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, + 408, 0, 409, 410, 0, 412, 413, 414, 415, 416, + 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, + 427, 428, 0, 0, 429, 430, 431, 432, 433, 434, + 435, 436, 437, 0, 0, 439, 440, 441, 442, 0, + 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, + 453, 454, 455, 456, 542, 458, 459, 0, 0, 460, + 461, 0, 462, 0, 464, 465, 466, 467, 468, 469, + 0, 470, 471, 472, 0, 0, 473, 474, 475, 476, + 477, 0, 478, 479, 480, 481, 482, 483, 484, 485, + 0, 0, 486, 487, 488, 0, 0, 489, 490, 491, + 492, 0, 493, 494, 495, 496, 497, 498, 499, 500, + 0, 501, 0, 503, 504, 505, 506, 507, 508, 509, + 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, + 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, + 526, 527, 528, 529, 530, 531, 2462, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 2600, 3414, 0, 0, 122, 123, 124, 125, + 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, + 0, 1293, 0, 0, 0, 0, 2463, 134, 135, 0, + 2464, 137, 138, 2465, 140, 141, 142, 0, 0, 2466, + 0, 0, 0, 1298, 148, 149, 150, 151, 152, 0, + 0, 153, 154, 155, 156, 0, 0, 159, 0, 160, + 161, 162, 163, 0, 0, 2467, 0, 2468, 167, 168, + 169, 170, 171, 2469, 173, 174, 175, 0, 176, 177, + 178, 179, 180, 181, 0, 2470, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 0, 194, 195, 0, + 197, 0, 198, 0, 199, 200, 201, 202, 203, 204, + 0, 0, 205, 206, 207, 208, 0, 0, 209, 210, + 211, 212, 213, 0, 214, 215, 216, 0, 217, 218, + 219, 220, 0, 221, 222, 223, 224, 0, 226, 227, + 228, 229, 230, 231, 0, 0, 233, 0, 234, 235, + 0, 237, 0, 238, 0, 239, 2471, 0, 2472, 242, + 243, 2473, 2474, 246, 247, 248, 0, 0, 0, 251, + 252, 0, 253, 254, 255, 256, 257, 258, 259, 2475, + 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, + 270, 271, 0, 272, 2476, 0, 275, 276, 277, 278, + 279, 0, 0, 0, 0, 0, 283, 2477, 2478, 286, + 2479, 288, 289, 290, 0, 291, 292, 293, 0, 0, + 294, 2480, 296, 2481, 0, 298, 299, 300, 301, 302, + 303, 304, 305, 2482, 307, 308, 309, 310, 311, 312, + 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, + 323, 324, 325, 326, 327, 328, 0, 2483, 0, 332, + 333, 334, 0, 0, 336, 337, 2484, 339, 0, 0, + 341, 0, 343, 344, 345, 0, 346, 347, 0, 0, + 348, 349, 350, 0, 0, 351, 352, 0, 2485, 355, + 2486, 0, 358, 359, 360, 361, 362, 363, 364, 365, + 366, 367, 368, 369, 0, 0, 0, 0, 370, 371, + 0, 2487, 374, 375, 0, 377, 378, 379, 0, 380, + 381, 382, 383, 384, 385, 0, 386, 387, 388, 389, + 390, 0, 392, 393, 394, 395, 0, 396, 397, 398, + 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, + 0, 409, 410, 2488, 412, 413, 414, 0, 416, 417, + 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, + 428, 0, 1322, 429, 430, 431, 432, 433, 434, 0, + 436, 437, 0, 2489, 439, 440, 0, 442, 0, 443, + 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, + 454, 455, 456, 2490, 458, 0, 0, 0, 460, 461, + 0, 462, 2491, 464, 465, 466, 467, 468, 469, 0, + 470, 0, 0, 0, 0, 473, 474, 0, 476, 0, + 0, 478, 479, 2492, 481, 482, 483, 484, 485, 0, + 0, 486, 487, 488, 2493, 0, 489, 490, 491, 492, + 0, 493, 494, 495, 496, 497, 0, 0, 500, 0, + 501, 2494, 503, 504, 505, 506, 507, 508, 509, 0, + 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, + 2462, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 528, 529, 530, 531, 0, 0, 0, 0, 0, + 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, + 131, 132, 2495, 0, 0, 1293, 0, 0, 0, 0, + 2463, 134, 135, 0, 2464, 137, 138, 2465, 140, 141, + 142, 0, 0, 2466, 0, 0, 0, 1298, 148, 149, + 150, 151, 152, 0, 0, 153, 154, 155, 156, 0, + 0, 159, 0, 160, 161, 162, 163, 0, 0, 2467, + 0, 2468, 167, 168, 169, 170, 171, 2469, 173, 174, + 175, 0, 176, 177, 178, 179, 180, 181, 0, 2470, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 0, 198, 0, 199, 200, + 0, 194, 195, 0, 197, 0, 198, 0, 199, 200, 201, 202, 203, 204, 0, 0, 205, 206, 207, 208, 0, 0, 209, 210, 211, 212, 213, 0, 214, 215, - 216, 0, 217, 218, 219, 220, -585, 221, 222, 223, - 224, 225, 226, 227, 228, 229, 230, 231, 232, 0, - 233, -585, 234, 235, 236, 237, -585, 238, 0, 239, - 0, 0, 0, 242, 243, 540, 0, 246, 247, 248, - 0, 249, 250, 251, 252, 0, 253, 254, 255, 256, - 257, 258, 259, 0, 261, 262, 263, 264, 0, 265, - 266, 267, 268, 269, 270, 271, 0, 272, 0, 274, - 275, 276, 277, 278, 279, 280, 281, -585, 282, 0, - 283, 0, 0, 286, 0, 288, 289, 290, 0, 291, - 292, 293, 0, 0, 294, 0, 296, 0, -585, 298, - 299, 300, 301, 302, 303, 304, 305, 541, 307, 308, + 216, 0, 217, 218, 219, 220, 0, 221, 222, 223, + 224, 0, 226, 227, 228, 229, 230, 231, 0, 0, + 233, 0, 234, 235, 0, 237, 0, 238, 0, 239, + 2471, 0, 2472, 242, 243, 2473, 2474, 246, 247, 248, + 0, 0, 0, 251, 252, 0, 253, 254, 255, 256, + 257, 258, 259, 2475, 261, 262, 263, 264, 0, 265, + 266, 267, 268, 269, 270, 271, 0, 272, 2476, 0, + 275, 276, 277, 278, 279, 0, 0, 0, 0, 0, + 283, 2477, 2478, 286, 2479, 288, 289, 290, 0, 291, + 292, 293, 0, 0, 294, 2480, 296, 2481, 0, 298, + 299, 300, 301, 302, 303, 304, 305, 2482, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, - 329, 0, 331, 332, 333, 334, 335, 0, 336, 337, - 0, 339, 0, 340, 341, 342, 343, 344, 345, -585, - 346, 347, 0, 0, 348, 349, 350, 0, -585, 351, - 352, 353, 0, 355, 0, 357, 358, 359, 360, 361, + 0, 2483, 0, 332, 333, 334, 0, 0, 336, 337, + 2484, 339, 0, 0, 341, 0, 343, 344, 345, 0, + 346, 347, 0, 0, 348, 349, 350, 0, 0, 351, + 352, 0, 2485, 355, 2486, 0, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 0, 0, - 0, 0, 370, 371, 372, 0, 374, 375, 376, 377, + 0, 0, 370, 371, 0, 2487, 374, 375, 0, 377, 378, 379, 0, 380, 381, 382, 383, 384, 385, 0, - 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, + 386, 387, 388, 389, 390, 0, 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, - 405, 406, 407, 408, 0, 409, 410, 0, 412, 413, - 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, - 424, 425, 426, 427, 428, 0, 0, 429, 430, 431, - 432, 433, 434, 435, 436, 437, 0, 0, 439, 440, - 441, 442, 0, 443, 444, 445, 446, 447, 448, 449, - 450, 451, 452, 453, 454, 455, 456, 542, 458, 459, - 0, 0, 460, 461, 0, 462, 0, 464, 465, 466, - 467, 468, 469, 0, 470, 471, 472, 0, 0, 473, - 474, 475, 476, 477, 0, 478, 479, 480, 481, 482, - 483, 484, 485, -585, 0, 486, 487, 488, 0, 0, + 405, 406, 407, 408, 0, 409, 410, 2488, 412, 413, + 414, 0, 416, 417, 418, 419, 420, 421, 422, 423, + 424, 425, 426, 427, 428, 0, 1322, 429, 430, 431, + 432, 433, 434, 0, 436, 437, 0, 2489, 439, 440, + 0, 442, 0, 443, 444, 445, 446, 447, 448, 449, + 450, 451, 452, 453, 454, 455, 456, 2490, 458, 0, + 0, 0, 460, 461, 0, 462, 2491, 464, 465, 466, + 467, 468, 469, 0, 470, 0, 0, 0, 0, 473, + 474, 0, 476, 0, 0, 478, 479, 2492, 481, 482, + 483, 484, 485, 0, 0, 486, 487, 488, 2493, 0, 489, 490, 491, 492, 0, 493, 494, 495, 496, 497, - 498, 499, 500, 0, 501, 0, 503, 504, 505, 506, + 0, 0, 500, 0, 501, 2494, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, - 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, - 523, 524, 525, 526, 527, 528, 529, 530, 531, 539, - 0, 564, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1199, 0, 0, 122, - 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, - 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 134, 135, 0, 0, 137, 138, 0, 140, 141, 142, - 143, 144, 0, 146, 147, 0, 0, 148, 149, 150, - 151, 152, 0, 0, 153, 154, 155, 156, 157, 158, - 159, 0, 160, 161, 162, 163, 164, 0, 0, 0, - 166, 167, 168, 169, 170, 171, 0, 173, 174, 175, - 0, 176, 177, 178, 179, 180, 181, 0, 0, 183, - 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, - 194, 195, 196, 197, 0, 198, 0, 199, 200, 201, - 202, 203, 204, 0, 0, 205, 206, 207, 208, 0, - 0, 209, 210, 211, 212, 213, 0, 214, 215, 216, - 0, 217, 218, 219, 220, 0, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 232, 0, 233, - 0, 234, 235, 236, 237, 0, 238, 0, 239, 0, - 0, 0, 242, 243, 540, 0, 246, 247, 248, 0, - 249, 250, 251, 252, 0, 253, 254, 255, 256, 257, - 258, 259, 0, 261, 262, 263, 264, 0, 265, 266, - 267, 268, 269, 270, 271, 0, 272, 0, 274, 275, - 276, 277, 278, 279, 280, 281, 0, 282, 0, 283, - 0, 0, 286, 0, 288, 289, 290, 0, 291, 292, - 293, 0, 0, 294, 0, 296, 0, 0, 298, 299, - 300, 301, 302, 303, 304, 305, 541, 307, 308, 309, - 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, - 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, - 0, 331, 332, 333, 334, 335, 0, 336, 337, 0, - 339, 0, 340, 341, 342, 343, 344, 345, 0, 346, - 347, 0, 0, 348, 349, 350, 0, 0, 351, 352, - 353, 0, 355, 0, 357, 358, 359, 360, 361, 362, - 363, 364, 365, 366, 367, 368, 369, 0, 0, 0, - 0, 370, 371, 372, 0, 374, 375, 376, 377, 378, - 379, 0, 380, 381, 382, 383, 384, 385, 0, 386, - 387, 388, 389, 390, 391, 392, 393, 394, 395, 0, - 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, - 406, 407, 408, 0, 409, 410, 0, 412, 413, 414, - 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, - 425, 426, 427, 428, 0, 0, 429, 430, 431, 432, - 433, 434, 435, 436, 437, 0, 0, 439, 440, 441, - 442, 0, 443, 444, 445, 446, 447, 448, 449, 450, - 451, 452, 453, 454, 455, 456, 542, 458, 459, 0, - 0, 460, 461, 0, 462, 0, 464, 465, 466, 467, - 468, 469, 0, 470, 471, 472, 0, 0, 473, 474, - 475, 476, 477, 0, 478, 479, 480, 481, 482, 483, - 484, 485, 0, 0, 486, 487, 488, 0, 0, 489, - 490, 491, 492, 0, 493, 494, 495, 496, 497, 498, - 499, 500, 0, 501, 0, 503, 504, 505, 506, 507, - 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, - 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, - 524, 525, 526, 527, 528, 529, 530, 531, 2461, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 2599, 3460, 0, 0, 122, 123, + 513, 514, 515, 516, 0, 0, 0, 0, 994, 0, + 0, 0, 0, 0, 0, 528, 529, 530, 531, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, + 124, 125, 126, 127, 128, 129, 3166, 130, 131, 132, + 3, 4, 0, 575, 0, 0, 0, 0, 580, 134, + 135, 0, 582, 137, 138, 583, 140, 141, 142, 584, + 585, 586, 587, 588, 0, 590, 148, 149, 150, 151, + 152, 0, 0, 153, 154, 155, 156, 593, 594, 159, + 0, 160, 161, 162, 163, 596, 0, 598, 0, 600, + 167, 168, 169, 170, 171, 601, 173, 174, 175, 0, + 176, 177, 178, 179, 180, 181, 0, 604, 183, 184, + 185, 186, 187, 188, 189, 190, 191, 192, 606, 194, + 195, 607, 197, 0, 198, 0, 199, 200, 201, 202, + 203, 204, 14, 15, 205, 206, 207, 208, 0, 0, + 209, 210, 211, 212, 213, 0, 214, 215, 216, 0, + 217, 218, 219, 220, 0, 221, 222, 223, 224, 617, + 226, 227, 228, 229, 230, 231, 618, 0, 233, 0, + 234, 235, 621, 237, 0, 238, 0, 239, 624, 23, + 626, 242, 243, 627, 628, 246, 247, 248, 0, 630, + 631, 251, 252, 0, 253, 254, 255, 256, 257, 258, + 259, 633, 261, 262, 263, 264, 0, 265, 266, 267, + 268, 269, 270, 271, 0, 272, 636, 637, 275, 276, + 277, 278, 279, 638, 639, 0, 641, 0, 283, 643, + 644, 286, 645, 288, 289, 290, 0, 291, 292, 293, + 0, 0, 294, 649, 296, 650, 0, 298, 299, 300, + 301, 302, 303, 304, 305, 652, 307, 308, 309, 310, + 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, + 321, 322, 323, 324, 325, 326, 327, 328, 653, 654, + 655, 332, 333, 334, 656, 0, 336, 337, 658, 339, + 0, 660, 341, 661, 343, 344, 345, 0, 346, 347, + 0, 0, 348, 349, 350, 0, 0, 351, 352, 667, + 668, 355, 669, 670, 358, 359, 360, 361, 362, 363, + 364, 365, 366, 367, 368, 369, 26, 27, 28, 0, + 370, 371, 675, 676, 374, 375, 677, 377, 378, 379, + 0, 380, 381, 382, 383, 384, 385, 0, 386, 387, + 388, 389, 390, 680, 392, 393, 394, 395, 0, 396, + 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, + 407, 408, 0, 409, 410, 683, 412, 413, 414, 684, + 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, + 426, 427, 428, 33, 686, 429, 430, 431, 432, 433, + 434, 687, 436, 437, 35, 689, 439, 440, 690, 442, + 0, 443, 444, 445, 446, 447, 448, 449, 450, 451, + 452, 453, 454, 455, 456, 692, 458, 693, 37, 0, + 460, 461, 38, 462, 697, 464, 465, 466, 467, 468, + 469, 0, 470, 699, 700, 0, 0, 473, 474, 703, + 476, 704, 0, 478, 479, 706, 481, 482, 483, 484, + 485, 0, 0, 486, 487, 488, 709, 40, 489, 490, + 491, 492, 0, 493, 494, 495, 496, 497, 995, 713, + 500, 0, 501, 715, 503, 504, 505, 506, 507, 508, + 509, 0, 0, 510, 0, 44, 511, 512, 513, 514, + 515, 516, 720, 721, 722, 723, 724, 725, 726, 727, + 728, 729, 730, 528, 529, 530, 531, 0, 121, 45, + 564, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 46, 0, 0, 0, 0, 122, 123, + 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, + 0, 0, 0, 0, 0, 0, 0, 0, 133, 134, + 135, 0, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 0, 0, 148, 149, 150, 151, + 152, 0, 805, 153, 154, 155, 156, 157, 158, 159, + 0, 160, 161, 162, 163, 806, 0, 807, 0, 166, + 167, 168, 169, 170, 171, 172, 173, 174, 175, 0, + 176, 177, 178, 179, 180, 181, 0, 182, 183, 184, + 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, + 195, 196, 197, 0, 198, 0, 199, 200, 201, 202, + 203, 204, 14, 15, 205, 206, 207, 208, 0, 0, + 209, 210, 211, 212, 213, 0, 214, 215, 216, 0, + 217, 218, 219, 220, 0, 221, 222, 223, 224, 225, + 226, 227, 228, 229, 230, 231, 808, 0, 233, 0, + 234, 235, 236, 237, 0, 238, 0, 239, 240, 23, + 241, 242, 243, 244, 245, 246, 247, 248, 0, 249, + 250, 251, 252, 0, 253, 254, 255, 256, 257, 258, + 259, 260, 261, 262, 263, 264, 0, 265, 266, 267, + 268, 269, 270, 271, 0, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 0, 282, 0, 283, 284, + 285, 286, 287, 288, 289, 290, 0, 291, 292, 293, + 809, 0, 294, 295, 296, 297, 0, 298, 299, 300, + 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, + 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, + 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, + 331, 332, 333, 334, 335, 0, 336, 337, 338, 339, + 0, 810, 341, 342, 343, 344, 345, 0, 346, 347, + 0, 811, 348, 349, 350, 0, 0, 351, 352, 353, + 354, 355, 356, 812, 358, 359, 360, 361, 362, 363, + 364, 365, 366, 367, 368, 369, 26, 27, 28, 0, + 370, 371, 813, 373, 374, 375, 376, 377, 378, 379, + 0, 380, 381, 382, 383, 384, 385, 0, 386, 387, + 388, 389, 390, 391, 392, 393, 394, 395, 0, 396, + 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, + 407, 408, 0, 409, 410, 411, 412, 413, 414, 415, + 814, 417, 418, 419, 420, 421, 422, 423, 424, 425, + 426, 427, 428, 33, 0, 429, 430, 431, 432, 433, + 434, 435, 436, 437, 35, 438, 439, 440, 441, 442, + 0, 443, 444, 445, 446, 447, 448, 449, 450, 451, + 452, 453, 454, 455, 456, 457, 458, 815, 37, 0, + 460, 461, 38, 462, 463, 464, 465, 466, 467, 468, + 469, 0, 470, 471, 472, 0, 0, 473, 474, 816, + 476, 817, 0, 478, 479, 818, 481, 482, 483, 484, + 485, 0, 0, 486, 487, 488, 0, 40, 489, 490, + 491, 492, 0, 493, 494, 495, 496, 497, 819, 499, + 500, 0, 501, 502, 503, 504, 505, 506, 507, 508, + 509, 0, 0, 510, 0, 44, 511, 512, 513, 514, + 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, + 525, 526, 527, 528, 529, 530, 531, 0, 121, 45, + 564, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 820, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, - 0, 0, 0, 1293, 0, 0, 0, 0, 2462, 134, - 135, 0, 2463, 137, 138, 2464, 140, 141, 142, 0, - 0, 2465, 0, 0, 0, 1298, 148, 149, 150, 151, - 152, 0, 0, 153, 154, 155, 156, 0, 0, 159, - 0, 160, 161, 162, 163, 0, 0, 2466, 0, 2467, - 167, 168, 169, 170, 171, 2468, 173, 174, 175, 0, - 176, 177, 178, 179, 180, 181, 0, 2469, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 0, 194, - 195, 0, 197, 0, 198, 0, 199, 200, 201, 202, + 0, 0, 0, 0, 0, 0, 0, 0, 133, 134, + 135, 0, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 0, 0, 148, 149, 150, 151, + 152, 0, 805, 153, 154, 155, 156, 157, 158, 159, + 0, 160, 161, 162, 163, 806, 0, 807, 0, 166, + 167, 168, 169, 170, 171, 172, 173, 174, 175, 0, + 176, 177, 178, 179, 180, 181, 0, 182, 183, 184, + 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, + 195, 196, 197, 0, 198, 0, 199, 200, 201, 202, 203, 204, 0, 0, 205, 206, 207, 208, 0, 0, 209, 210, 211, 212, 213, 0, 214, 215, 216, 0, - 217, 218, 219, 220, 0, 221, 222, 223, 224, 0, - 226, 227, 228, 229, 230, 231, 0, 0, 233, 0, - 234, 235, 0, 237, 0, 238, 0, 239, 2470, 0, - 2471, 242, 243, 2472, 2473, 246, 247, 248, 0, 0, - 0, 251, 252, 0, 253, 254, 255, 256, 257, 258, - 259, 2474, 261, 262, 263, 264, 0, 265, 266, 267, - 268, 269, 270, 271, 0, 272, 2475, 0, 275, 276, - 277, 278, 279, 0, 0, 0, 0, 0, 283, 2476, - 2477, 286, 2478, 288, 289, 290, 0, 291, 292, 293, - 0, 0, 294, 2479, 296, 2480, 0, 298, 299, 300, - 301, 302, 303, 304, 305, 2481, 307, 308, 309, 310, + 217, 218, 219, 220, 0, 221, 222, 223, 224, 225, + 226, 227, 228, 229, 230, 231, 808, 0, 233, 0, + 234, 235, 236, 237, 0, 238, 0, 239, 240, 0, + 241, 242, 243, 244, 245, 246, 247, 248, 0, 249, + 250, 251, 252, 0, 253, 254, 255, 256, 257, 258, + 259, 260, 261, 262, 263, 264, 0, 265, 266, 267, + 268, 269, 270, 271, 0, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 0, 282, 0, 283, 284, + 285, 286, 287, 288, 289, 290, 0, 291, 292, 293, + 809, 0, 294, 295, 296, 297, 0, 298, 299, 300, + 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, - 321, 322, 323, 324, 325, 326, 327, 328, 0, 2482, - 0, 332, 333, 334, 0, 0, 336, 337, 2483, 339, - 0, 0, 341, 0, 343, 344, 345, 0, 346, 347, - 0, 0, 348, 349, 350, 0, 0, 351, 352, 0, - 2484, 355, 2485, 0, 358, 359, 360, 361, 362, 363, + 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, + 331, 332, 333, 334, 335, 0, 336, 337, 338, 339, + 0, 810, 341, 342, 343, 344, 345, 0, 346, 347, + 0, 811, 348, 349, 350, 0, 0, 351, 352, 353, + 354, 355, 356, 812, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 0, 0, 0, 0, - 370, 371, 0, 2486, 374, 375, 0, 377, 378, 379, + 370, 371, 813, 373, 374, 375, 376, 377, 378, 379, 0, 380, 381, 382, 383, 384, 385, 0, 386, 387, - 388, 389, 390, 0, 392, 393, 394, 395, 0, 396, + 388, 389, 390, 391, 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, - 407, 408, 0, 409, 410, 2487, 412, 413, 414, 0, - 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, - 426, 427, 428, 0, 1322, 429, 430, 431, 432, 433, - 434, 0, 436, 437, 0, 2488, 439, 440, 0, 442, + 407, 408, 0, 409, 410, 411, 412, 413, 414, 415, + 814, 417, 418, 419, 420, 421, 422, 423, 424, 425, + 426, 427, 428, 0, 0, 429, 430, 431, 432, 433, + 434, 435, 436, 437, 0, 438, 439, 440, 441, 442, 0, 443, 444, 445, 446, 447, 448, 449, 450, 451, - 452, 453, 454, 455, 456, 2489, 458, 0, 0, 0, - 460, 461, 0, 462, 2490, 464, 465, 466, 467, 468, - 469, 0, 470, 0, 0, 0, 0, 473, 474, 0, - 476, 0, 0, 478, 479, 2491, 481, 482, 483, 484, - 485, 0, 0, 486, 487, 488, 2492, 0, 489, 490, - 491, 492, 0, 493, 494, 495, 496, 497, 0, 0, - 500, 0, 501, 2493, 503, 504, 505, 506, 507, 508, - 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, - 515, 516, 2461, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 528, 529, 530, 531, 0, 0, 0, - 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, - 0, 130, 131, 132, 2494, 0, 0, 1293, 0, 0, - 0, 0, 2462, 134, 135, 0, 2463, 137, 138, 2464, - 140, 141, 142, 0, 0, 2465, 0, 0, 0, 1298, - 148, 149, 150, 151, 152, 0, 0, 153, 154, 155, - 156, 0, 0, 159, 0, 160, 161, 162, 163, 0, - 0, 2466, 0, 2467, 167, 168, 169, 170, 171, 2468, - 173, 174, 175, 0, 176, 177, 178, 179, 180, 181, - 0, 2469, 183, 184, 185, 186, 187, 188, 189, 190, - 191, 192, 0, 194, 195, 0, 197, 0, 198, 0, - 199, 200, 201, 202, 203, 204, 0, 0, 205, 206, - 207, 208, 0, 0, 209, 210, 211, 212, 213, 0, - 214, 215, 216, 0, 217, 218, 219, 220, 0, 221, - 222, 223, 224, 0, 226, 227, 228, 229, 230, 231, - 0, 0, 233, 0, 234, 235, 0, 237, 0, 238, - 0, 239, 2470, 0, 2471, 242, 243, 2472, 2473, 246, - 247, 248, 0, 0, 0, 251, 252, 0, 253, 254, - 255, 256, 257, 258, 259, 2474, 261, 262, 263, 264, - 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, - 2475, 0, 275, 276, 277, 278, 279, 0, 0, 0, - 0, 0, 283, 2476, 2477, 286, 2478, 288, 289, 290, - 0, 291, 292, 293, 0, 0, 294, 2479, 296, 2480, - 0, 298, 299, 300, 301, 302, 303, 304, 305, 2481, - 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, - 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, - 327, 328, 0, 2482, 0, 332, 333, 334, 0, 0, - 336, 337, 2483, 339, 0, 0, 341, 0, 343, 344, - 345, 0, 346, 347, 0, 0, 348, 349, 350, 0, - 0, 351, 352, 0, 2484, 355, 2485, 0, 358, 359, - 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, - 0, 0, 0, 0, 370, 371, 0, 2486, 374, 375, - 0, 377, 378, 379, 0, 380, 381, 382, 383, 384, - 385, 0, 386, 387, 388, 389, 390, 0, 392, 393, - 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, - 403, 404, 405, 406, 407, 408, 0, 409, 410, 2487, - 412, 413, 414, 0, 416, 417, 418, 419, 420, 421, - 422, 423, 424, 425, 426, 427, 428, 0, 1322, 429, - 430, 431, 432, 433, 434, 0, 436, 437, 0, 2488, - 439, 440, 0, 442, 0, 443, 444, 445, 446, 447, - 448, 449, 450, 451, 452, 453, 454, 455, 456, 2489, - 458, 0, 0, 0, 460, 461, 0, 462, 2490, 464, - 465, 466, 467, 468, 469, 0, 470, 0, 0, 0, - 0, 473, 474, 0, 476, 0, 0, 478, 479, 2491, - 481, 482, 483, 484, 485, 0, 0, 486, 487, 488, - 2492, 0, 489, 490, 491, 492, 0, 493, 494, 495, - 496, 497, 0, 0, 500, 0, 501, 2493, 503, 504, - 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, - 511, 512, 513, 514, 515, 516, 0, 0, 0, 0, - 994, 0, 0, 0, 0, 0, 0, 528, 529, 530, - 531, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 122, 123, 124, 125, 126, 127, 128, 129, 3212, 130, - 131, 132, 3, 4, 0, 575, 0, 0, 0, 0, - 580, 134, 135, 0, 582, 137, 138, 583, 140, 141, - 142, 584, 585, 586, 587, 588, 0, 590, 148, 149, - 150, 151, 152, 0, 0, 153, 154, 155, 156, 593, - 594, 159, 0, 160, 161, 162, 163, 596, 0, 598, - 0, 600, 167, 168, 169, 170, 171, 601, 173, 174, - 175, 0, 176, 177, 178, 179, 180, 181, 0, 604, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 606, 194, 195, 607, 197, 0, 198, 0, 199, 200, - 201, 202, 203, 204, 14, 15, 205, 206, 207, 208, - 0, 0, 209, 210, 211, 212, 213, 0, 214, 215, - 216, 0, 217, 218, 219, 220, 0, 221, 222, 223, - 224, 617, 226, 227, 228, 229, 230, 231, 618, 0, - 233, 0, 234, 235, 621, 237, 0, 238, 0, 239, - 624, 23, 626, 242, 243, 627, 628, 246, 247, 248, - 0, 630, 631, 251, 252, 0, 253, 254, 255, 256, - 257, 258, 259, 633, 261, 262, 263, 264, 0, 265, - 266, 267, 268, 269, 270, 271, 0, 272, 636, 637, - 275, 276, 277, 278, 279, 638, 639, 0, 641, 0, - 283, 643, 644, 286, 645, 288, 289, 290, 0, 291, - 292, 293, 0, 0, 294, 649, 296, 650, 0, 298, - 299, 300, 301, 302, 303, 304, 305, 652, 307, 308, - 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, - 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, - 653, 654, 655, 332, 333, 334, 656, 0, 336, 337, - 658, 339, 0, 660, 341, 661, 343, 344, 345, 0, - 346, 347, 0, 0, 348, 349, 350, 0, 0, 351, - 352, 667, 668, 355, 669, 670, 358, 359, 360, 361, - 362, 363, 364, 365, 366, 367, 368, 369, 26, 27, - 28, 0, 370, 371, 675, 676, 374, 375, 677, 377, - 378, 379, 0, 380, 381, 382, 383, 384, 385, 0, - 386, 387, 388, 389, 390, 680, 392, 393, 394, 395, - 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, - 405, 406, 407, 408, 0, 409, 410, 683, 412, 413, - 414, 684, 416, 417, 418, 419, 420, 421, 422, 423, - 424, 425, 426, 427, 428, 33, 686, 429, 430, 431, - 432, 433, 434, 687, 436, 437, 35, 689, 439, 440, - 690, 442, 0, 443, 444, 445, 446, 447, 448, 449, - 450, 451, 452, 453, 454, 455, 456, 692, 458, 693, - 37, 0, 460, 461, 38, 462, 697, 464, 465, 466, - 467, 468, 469, 0, 470, 699, 700, 0, 0, 473, - 474, 703, 476, 704, 0, 478, 479, 706, 481, 482, - 483, 484, 485, 0, 0, 486, 487, 488, 709, 40, - 489, 490, 491, 492, 0, 493, 494, 495, 496, 497, - 995, 713, 500, 0, 501, 715, 503, 504, 505, 506, - 507, 508, 509, 0, 0, 510, 0, 44, 511, 512, - 513, 514, 515, 516, 720, 721, 722, 723, 724, 725, - 726, 727, 728, 729, 730, 528, 529, 530, 531, 0, - 121, 45, 564, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 46, 0, 0, 0, 0, - 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, - 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, - 133, 134, 135, 0, 136, 137, 138, 139, 140, 141, - 142, 143, 144, 145, 146, 147, 0, 0, 148, 149, - 150, 151, 152, 0, 805, 153, 154, 155, 156, 157, - 158, 159, 0, 160, 161, 162, 163, 806, 0, 807, - 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 0, 176, 177, 178, 179, 180, 181, 0, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 0, 198, 0, 199, 200, - 201, 202, 203, 204, 14, 15, 205, 206, 207, 208, - 0, 0, 209, 210, 211, 212, 213, 0, 214, 215, - 216, 0, 217, 218, 219, 220, 0, 221, 222, 223, - 224, 225, 226, 227, 228, 229, 230, 231, 808, 0, - 233, 0, 234, 235, 236, 237, 0, 238, 0, 239, - 240, 23, 241, 242, 243, 244, 245, 246, 247, 248, - 0, 249, 250, 251, 252, 0, 253, 254, 255, 256, - 257, 258, 259, 260, 261, 262, 263, 264, 0, 265, - 266, 267, 268, 269, 270, 271, 0, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 0, 282, 0, - 283, 284, 285, 286, 287, 288, 289, 290, 0, 291, - 292, 293, 809, 0, 294, 295, 296, 297, 0, 298, - 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, - 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, - 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, - 329, 330, 331, 332, 333, 334, 335, 0, 336, 337, - 338, 339, 0, 810, 341, 342, 343, 344, 345, 0, - 346, 347, 0, 811, 348, 349, 350, 0, 0, 351, - 352, 353, 354, 355, 356, 812, 358, 359, 360, 361, - 362, 363, 364, 365, 366, 367, 368, 369, 26, 27, - 28, 0, 370, 371, 813, 373, 374, 375, 376, 377, - 378, 379, 0, 380, 381, 382, 383, 384, 385, 0, - 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, - 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, - 405, 406, 407, 408, 0, 409, 410, 411, 412, 413, - 414, 415, 814, 417, 418, 419, 420, 421, 422, 423, - 424, 425, 426, 427, 428, 33, 0, 429, 430, 431, - 432, 433, 434, 435, 436, 437, 35, 438, 439, 440, - 441, 442, 0, 443, 444, 445, 446, 447, 448, 449, - 450, 451, 452, 453, 454, 455, 456, 457, 458, 815, - 37, 0, 460, 461, 38, 462, 463, 464, 465, 466, - 467, 468, 469, 0, 470, 471, 472, 0, 0, 473, - 474, 816, 476, 817, 0, 478, 479, 818, 481, 482, - 483, 484, 485, 0, 0, 486, 487, 488, 0, 40, - 489, 490, 491, 492, 0, 493, 494, 495, 496, 497, - 819, 499, 500, 0, 501, 502, 503, 504, 505, 506, - 507, 508, 509, 0, 0, 510, 0, 44, 511, 512, - 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, - 523, 524, 525, 526, 527, 528, 529, 530, 531, 0, - 121, 45, 564, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 820, 0, 0, 0, 0, - 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, - 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, - 133, 134, 135, 0, 136, 137, 138, 139, 140, 141, - 142, 143, 144, 145, 146, 147, 0, 0, 148, 149, - 150, 151, 152, 0, 805, 153, 154, 155, 156, 157, - 158, 159, 0, 160, 161, 162, 163, 806, 0, 807, - 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175, 0, 176, 177, 178, 179, 180, 181, 0, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 0, 198, 0, 199, 200, - 201, 202, 203, 204, 0, 0, 205, 206, 207, 208, - 0, 0, 209, 210, 211, 212, 213, 0, 214, 215, - 216, 0, 217, 218, 219, 220, 0, 221, 222, 223, - 224, 225, 226, 227, 228, 229, 230, 231, 808, 0, - 233, 0, 234, 235, 236, 237, 0, 238, 0, 239, - 240, 0, 241, 242, 243, 244, 245, 246, 247, 248, - 0, 249, 250, 251, 252, 0, 253, 254, 255, 256, - 257, 258, 259, 260, 261, 262, 263, 264, 0, 265, - 266, 267, 268, 269, 270, 271, 0, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 0, 282, 0, - 283, 284, 285, 286, 287, 288, 289, 290, 0, 291, - 292, 293, 809, 0, 294, 295, 296, 297, 0, 298, - 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, - 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, - 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, - 329, 330, 331, 332, 333, 334, 335, 0, 336, 337, - 338, 339, 0, 810, 341, 342, 343, 344, 345, 0, - 346, 347, 0, 811, 348, 349, 350, 0, 0, 351, - 352, 353, 354, 355, 356, 812, 358, 359, 360, 361, - 362, 363, 364, 365, 366, 367, 368, 369, 0, 0, - 0, 0, 370, 371, 813, 373, 374, 375, 376, 377, - 378, 379, 0, 380, 381, 382, 383, 384, 385, 0, - 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, - 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, - 405, 406, 407, 408, 0, 409, 410, 411, 412, 413, - 414, 415, 814, 417, 418, 419, 420, 421, 422, 423, - 424, 425, 426, 427, 428, 0, 0, 429, 430, 431, - 432, 433, 434, 435, 436, 437, 0, 438, 439, 440, - 441, 442, 0, 443, 444, 445, 446, 447, 448, 449, - 450, 451, 452, 453, 454, 455, 456, 457, 458, 815, - 0, 0, 460, 461, 0, 462, 463, 464, 465, 466, - 467, 468, 469, 0, 470, 471, 472, 0, 0, 473, - 474, 816, 476, 817, 0, 478, 479, 818, 481, 482, - 483, 484, 485, 0, 0, 486, 487, 488, 0, 0, - 489, 490, 491, 492, 0, 493, 494, 495, 496, 497, - 819, 499, 500, 0, 501, 502, 503, 504, 505, 506, - 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, - 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, - 523, 524, 525, 526, 527, 528, 529, 530, 531, 121, - 0, 564, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 820, 0, 0, 0, 122, - 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, - 132, 0, 0, 0, 0, 0, 0, 0, 0, 133, - 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 0, 0, 148, 149, 150, - 151, 152, 0, 805, 153, 154, 155, 156, 157, 158, - 159, 0, 160, 161, 162, 163, 806, 0, 807, 0, - 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, - 0, 176, 177, 178, 179, 180, 181, 0, 182, 183, - 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, - 194, 195, 196, 197, 0, 198, 0, 199, 200, 201, - 202, 203, 204, 0, 0, 205, 206, 207, 208, 0, - 0, 209, 210, 211, 212, 213, 0, 214, 215, 216, - 0, 217, 218, 219, 220, 0, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 230, 231, 808, 0, 233, - 0, 234, 235, 236, 237, 0, 238, 0, 239, 240, - 0, 241, 242, 243, 244, 245, 246, 247, 248, 0, - 249, 250, 251, 252, 0, 253, 254, 255, 256, 257, - 258, 259, 260, 261, 262, 263, 264, 0, 265, 266, - 267, 268, 269, 270, 271, 0, 272, 273, 274, 275, - 276, 277, 278, 279, 280, 281, 0, 282, 0, 283, - 284, 285, 286, 287, 288, 289, 290, 0, 291, 292, - 293, 0, 0, 294, 295, 296, 297, 0, 298, 299, - 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, - 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, - 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, - 330, 331, 332, 333, 334, 335, 0, 336, 337, 338, - 339, 0, 810, 341, 342, 343, 344, 345, 0, 346, - 347, 0, 811, 348, 349, 350, 0, 0, 351, 352, - 353, 354, 355, 356, 812, 358, 359, 360, 361, 362, - 363, 364, 365, 366, 367, 368, 369, 0, 0, 0, - 0, 370, 371, 813, 373, 374, 375, 376, 377, 378, - 379, 0, 380, 381, 382, 383, 384, 385, 0, 386, - 387, 388, 389, 390, 391, 392, 393, 394, 395, 0, - 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, - 406, 407, 408, 0, 409, 410, 411, 412, 413, 414, - 415, 814, 417, 418, 419, 420, 421, 422, 423, 424, - 425, 426, 427, 428, 0, 0, 429, 430, 431, 432, - 433, 434, 435, 436, 437, 0, 438, 439, 440, 441, - 442, 0, 443, 444, 445, 446, 447, 448, 449, 450, - 451, 452, 453, 454, 455, 456, 457, 458, 815, 0, - 0, 460, 461, 0, 462, 463, 464, 465, 466, 467, - 468, 469, 0, 470, 471, 472, 0, 0, 473, 474, - 816, 476, 817, 0, 478, 479, 818, 481, 482, 483, - 484, 485, 0, 0, 486, 487, 488, 0, 0, 489, - 490, 491, 492, 0, 493, 494, 495, 496, 497, 498, - 499, 500, 0, 501, 502, 503, 504, 505, 506, 507, - 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, - 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, - 524, 525, 526, 527, 528, 529, 530, 531, 121, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1038, 0, 0, 0, 122, 123, - 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, - 0, 0, 0, 0, 0, 0, 0, 0, 133, 134, - 135, 0, 136, 137, 138, 139, 140, 141, 142, 143, - 144, 145, 146, 147, 0, 0, 148, 149, 150, 151, - 152, 0, 805, 153, 154, 155, 156, 157, 158, 159, - 0, 160, 161, 162, 163, 806, 0, 807, 0, 166, - 167, 168, 169, 170, 171, 172, 173, 174, 175, 0, - 176, 177, 178, 179, 180, 181, 0, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 0, 198, 0, 199, 200, 201, 202, - 203, 204, 0, 0, 205, 206, 207, 208, 0, 0, - 209, 210, 211, 212, 213, 0, 214, 215, 216, 0, - 217, 218, 219, 220, 0, 221, 222, 223, 224, 225, - 226, 227, 228, 229, 230, 231, 808, 0, 233, 0, - 234, 235, 236, 237, 0, 238, 0, 239, 240, 0, - 241, 242, 243, 244, 245, 246, 247, 248, 0, 249, - 250, 251, 252, 0, 253, 254, 255, 256, 257, 258, - 259, 260, 261, 262, 263, 264, 0, 265, 266, 267, - 268, 269, 270, 271, 0, 272, 273, 274, 275, 276, - 277, 278, 279, 280, 281, 0, 282, 0, 283, 284, - 285, 286, 287, 288, 289, 290, 0, 291, 292, 293, - 0, 0, 294, 295, 296, 297, 0, 298, 299, 300, - 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, - 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, - 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, - 331, 332, 333, 334, 335, 0, 336, 337, 338, 339, - 0, 810, 341, 342, 343, 344, 345, 0, 346, 347, - 0, 0, 348, 349, 350, 0, 0, 351, 352, 353, - 354, 355, 356, 812, 358, 359, 360, 361, 362, 363, - 364, 365, 366, 367, 368, 369, 0, 0, 0, 0, - 370, 371, 813, 373, 374, 375, 376, 377, 378, 379, - 0, 380, 381, 382, 383, 384, 385, 0, 386, 387, - 388, 389, 390, 391, 392, 393, 394, 395, 0, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, - 407, 408, 0, 409, 410, 411, 412, 413, 414, 415, - 814, 417, 418, 419, 420, 421, 422, 423, 424, 425, - 426, 427, 428, 0, 0, 429, 430, 431, 432, 433, - 434, 435, 436, 437, 0, 438, 439, 440, 441, 442, - 0, 443, 444, 445, 446, 447, 448, 449, 450, 451, - 452, 453, 454, 455, 456, 457, 458, 815, 0, 0, - 460, 461, 0, 462, 463, 464, 465, 466, 467, 468, - 469, 0, 470, 471, 472, 0, 0, 473, 474, 816, - 476, 817, 0, 478, 479, 818, 481, 482, 483, 484, - 485, 0, 0, 486, 487, 488, 0, 0, 489, 490, - 491, 492, 0, 493, 494, 495, 496, 497, 498, 499, - 500, 0, 501, 502, 503, 504, 505, 506, 507, 508, + 452, 453, 454, 455, 456, 457, 458, 815, 0, 0, + 460, 461, 0, 462, 463, 464, 465, 466, 467, 468, + 469, 0, 470, 471, 472, 0, 0, 473, 474, 816, + 476, 817, 0, 478, 479, 818, 481, 482, 483, 484, + 485, 0, 0, 486, 487, 488, 0, 0, 489, 490, + 491, 492, 0, 493, 494, 495, 496, 497, 819, 499, + 500, 0, 501, 502, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, - 525, 526, 527, 528, 529, 530, 531, 121, 0, 0, + 525, 526, 527, 528, 529, 530, 531, 121, 0, 564, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 46, 0, 0, 0, 122, 123, 124, + 0, 0, 0, 820, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 133, 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, 143, 144, @@ -8147,14 +7992,14 @@ static const yytype_int16 yytable[] = 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 0, 336, 337, 338, 339, 0, 810, 341, 342, 343, 344, 345, 0, 346, 347, 0, - 0, 348, 349, 350, 0, 0, 351, 352, 353, 354, + 811, 348, 349, 350, 0, 0, 351, 352, 353, 354, 355, 356, 812, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 0, 0, 0, 0, 370, 371, 813, 373, 374, 375, 376, 377, 378, 379, 0, 380, 381, 382, 383, 384, 385, 0, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, - 408, 0, 409, 410, 411, 412, 413, 414, 415, 416, + 408, 0, 409, 410, 411, 412, 413, 414, 415, 814, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 0, 0, 429, 430, 431, 432, 433, 434, 435, 436, 437, 0, 438, 439, 440, 441, 442, 0, @@ -8168,264 +8013,264 @@ static const yytype_int16 yytable[] = 0, 501, 502, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, - 526, 527, 528, 529, 530, 531, 539, 0, 0, 0, + 526, 527, 528, 529, 530, 531, 121, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 3556, 0, 0, 0, 122, 123, 124, 125, + 0, 0, 1038, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 134, 135, 0, - 0, 137, 138, 0, 140, 141, 142, 143, 144, 0, - 146, 147, 0, 0, 148, 149, 150, 151, 152, 0, - 0, 153, 154, 155, 156, 157, 158, 159, 0, 160, - 161, 162, 163, 164, 0, 0, 0, 166, 167, 168, - 169, 170, 171, 0, 173, 174, 175, 0, 176, 177, - 178, 179, 180, 181, 0, 0, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, - 197, 0, 198, 0, 199, 200, 201, 202, 203, 204, - 14, 15, 205, 206, 207, 208, 0, 0, 209, 210, - 211, 212, 213, 0, 214, 215, 216, 0, 217, 218, - 219, 220, 0, 221, 222, 223, 224, 225, 226, 227, - 228, 229, 230, 231, 232, 0, 233, 0, 234, 235, - 236, 237, 0, 238, 0, 239, 0, 23, 0, 242, - 243, 540, 0, 246, 247, 248, 0, 249, 250, 251, - 252, 0, 253, 254, 255, 256, 257, 258, 259, 0, - 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, - 270, 271, 0, 272, 0, 274, 275, 276, 277, 278, - 279, 280, 281, 0, 282, 0, 283, 0, 0, 286, - 0, 288, 289, 290, 0, 291, 292, 293, 0, 0, - 294, 0, 296, 0, 0, 298, 299, 300, 301, 302, - 303, 304, 305, 541, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 325, 326, 327, 328, 329, 0, 331, 332, - 333, 334, 335, 0, 336, 337, 0, 339, 0, 340, - 341, 342, 343, 344, 345, 0, 346, 347, 0, 0, - 348, 349, 350, 0, 0, 351, 352, 353, 0, 355, - 0, 357, 358, 359, 360, 361, 362, 363, 364, 365, - 366, 367, 368, 369, 26, 27, 28, 0, 370, 371, - 372, 0, 374, 375, 376, 377, 378, 379, 0, 380, - 381, 382, 383, 384, 385, 0, 386, 387, 388, 389, - 390, 391, 392, 393, 394, 395, 0, 396, 397, 398, - 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, - 0, 409, 410, 0, 412, 413, 414, 415, 416, 417, - 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, - 428, 33, 0, 429, 430, 431, 432, 433, 434, 435, - 436, 437, 35, 0, 439, 440, 441, 442, 0, 443, - 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, - 454, 455, 456, 542, 458, 459, 37, 0, 460, 461, - 38, 462, 0, 464, 465, 466, 467, 468, 469, 0, - 470, 471, 472, 0, 0, 473, 474, 475, 476, 477, - 0, 478, 479, 480, 481, 482, 483, 484, 485, 0, - 0, 486, 487, 488, 0, 40, 489, 490, 491, 492, - 0, 493, 494, 495, 496, 497, 819, 499, 500, 0, - 501, 0, 503, 504, 505, 506, 507, 508, 509, 0, - 0, 510, 0, 44, 511, 512, 513, 514, 515, 516, - 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, - 527, 528, 529, 530, 531, 0, 539, 45, 564, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 46, 0, 0, 0, 0, 122, 123, 124, 125, - 126, 127, 128, 129, 910, 130, 131, 132, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 134, 135, 0, - 0, 137, 138, 0, 140, 141, 142, 143, 144, 0, + 0, 0, 0, 0, 0, 0, 133, 134, 135, 0, + 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 0, 0, 148, 149, 150, 151, 152, 0, - 0, 153, 154, 155, 156, 157, 158, 159, 0, 160, - 161, 162, 163, 164, 0, 0, 0, 166, 167, 168, - 169, 170, 171, 0, 173, 174, 175, 0, 176, 177, - 178, 179, 180, 181, 0, 0, 183, 184, 185, 186, + 805, 153, 154, 155, 156, 157, 158, 159, 0, 160, + 161, 162, 163, 806, 0, 807, 0, 166, 167, 168, + 169, 170, 171, 172, 173, 174, 175, 0, 176, 177, + 178, 179, 180, 181, 0, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 0, 198, 0, 199, 200, 201, 202, 203, 204, 0, 0, 205, 206, 207, 208, 0, 0, 209, 210, 211, 212, 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, 0, 221, 222, 223, 224, 225, 226, 227, - 228, 229, 230, 231, 232, 0, 233, 0, 234, 235, - 236, 237, 0, 238, 0, 239, 0, 23, 0, 242, - 243, 540, 0, 246, 247, 248, 0, 249, 250, 251, - 252, 0, 253, 254, 255, 256, 257, 258, 259, 0, + 228, 229, 230, 231, 808, 0, 233, 0, 234, 235, + 236, 237, 0, 238, 0, 239, 240, 0, 241, 242, + 243, 244, 245, 246, 247, 248, 0, 249, 250, 251, + 252, 0, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, - 270, 271, 0, 272, 0, 274, 275, 276, 277, 278, - 279, 280, 281, 0, 282, 0, 283, 0, 0, 286, - 0, 288, 289, 290, 0, 291, 292, 293, 0, 0, - 294, 0, 296, 0, 0, 298, 299, 300, 301, 302, - 303, 304, 305, 541, 307, 308, 309, 310, 311, 312, + 270, 271, 0, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 0, 282, 0, 283, 284, 285, 286, + 287, 288, 289, 290, 0, 291, 292, 293, 0, 0, + 294, 295, 296, 297, 0, 298, 299, 300, 301, 302, + 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 325, 326, 327, 328, 329, 0, 331, 332, - 333, 334, 335, 0, 336, 337, 0, 339, 0, 340, + 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, + 333, 334, 335, 0, 336, 337, 338, 339, 0, 810, 341, 342, 343, 344, 345, 0, 346, 347, 0, 0, - 348, 349, 350, 0, 0, 351, 352, 353, 0, 355, - 0, 357, 358, 359, 360, 361, 362, 363, 364, 365, - 366, 367, 368, 369, 26, 27, 28, 0, 370, 371, - 372, 0, 374, 375, 376, 377, 378, 379, 0, 380, + 348, 349, 350, 0, 0, 351, 352, 353, 354, 355, + 356, 812, 358, 359, 360, 361, 362, 363, 364, 365, + 366, 367, 368, 369, 0, 0, 0, 0, 370, 371, + 813, 373, 374, 375, 376, 377, 378, 379, 0, 380, 381, 382, 383, 384, 385, 0, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, - 0, 409, 410, 0, 412, 413, 414, 415, 416, 417, + 0, 409, 410, 411, 412, 413, 414, 415, 814, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, - 428, 33, 0, 429, 430, 431, 432, 433, 434, 435, - 436, 437, 0, 0, 439, 440, 441, 442, 0, 443, + 428, 0, 0, 429, 430, 431, 432, 433, 434, 435, + 436, 437, 0, 438, 439, 440, 441, 442, 0, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, - 454, 455, 456, 542, 458, 459, 0, 0, 460, 461, - 38, 911, 0, 464, 465, 466, 467, 468, 469, 0, - 470, 912, 472, 0, 0, 913, 474, 475, 476, 477, - 0, 478, 479, 480, 481, 482, 483, 484, 485, 0, - 0, 486, 487, 488, 0, 40, 489, 490, 491, 492, - 0, 493, 494, 495, 496, 497, 819, 499, 500, 0, - 501, 0, 503, 504, 505, 506, 507, 508, 509, 0, - 0, 510, 0, 44, 511, 512, 513, 514, 515, 516, + 454, 455, 456, 457, 458, 815, 0, 0, 460, 461, + 0, 462, 463, 464, 465, 466, 467, 468, 469, 0, + 470, 471, 472, 0, 0, 473, 474, 816, 476, 817, + 0, 478, 479, 818, 481, 482, 483, 484, 485, 0, + 0, 486, 487, 488, 0, 0, 489, 490, 491, 492, + 0, 493, 494, 495, 496, 497, 498, 499, 500, 0, + 501, 502, 503, 504, 505, 506, 507, 508, 509, 0, + 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, - 527, 528, 529, 530, 531, 0, 539, 45, 564, 0, + 527, 528, 529, 530, 531, 121, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 46, 0, 0, 0, 0, 122, 123, 124, 125, - 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 134, 135, 0, - 0, 137, 138, 0, 140, 141, 142, 143, 144, 0, - 146, 147, 0, 0, 148, 149, 150, 151, 152, 0, - 0, 153, 154, 155, 156, 157, 158, 159, 0, 160, - 161, 162, 163, 164, 0, 0, 0, 166, 167, 168, - 169, 170, 171, 0, 173, 174, 175, 0, 176, 177, - 178, 179, 180, 181, 0, 0, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, - 197, 0, 198, 0, 199, 200, 201, 202, 203, 204, - 0, 0, 205, 206, 207, 208, 0, 0, 209, 210, - 211, 212, 213, 0, 214, 215, 216, 0, 217, 218, - 219, 220, 0, 221, 222, 223, 224, 225, 226, 227, - 228, 229, 230, 231, 232, 0, 233, 0, 234, 235, - 236, 237, 0, 238, 0, 239, 0, 23, 0, 242, - 243, 540, 0, 246, 247, 248, 0, 249, 250, 251, - 252, 0, 253, 254, 255, 256, 257, 258, 259, 0, - 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, - 270, 271, 0, 272, 0, 274, 275, 276, 277, 278, - 279, 280, 281, 0, 282, 0, 283, 0, 0, 286, - 0, 288, 289, 290, 0, 291, 292, 293, 0, 0, - 294, 0, 296, 0, 0, 298, 299, 300, 301, 302, - 303, 304, 305, 541, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 325, 326, 327, 328, 329, 0, 331, 332, - 333, 334, 335, 0, 336, 337, 0, 339, 0, 340, - 341, 342, 343, 344, 345, 0, 346, 347, 0, 0, - 348, 349, 350, 0, 0, 351, 352, 353, 0, 355, - 0, 357, 358, 359, 360, 361, 362, 363, 364, 365, - 366, 367, 368, 369, 26, 27, 28, 0, 370, 371, - 372, 0, 374, 375, 376, 377, 378, 379, 0, 380, - 381, 382, 383, 384, 385, 0, 386, 387, 388, 389, - 390, 391, 392, 393, 394, 395, 0, 396, 397, 398, - 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, - 0, 409, 410, 0, 412, 413, 414, 415, 416, 417, - 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, - 428, 33, 0, 429, 430, 431, 432, 433, 434, 435, - 436, 437, 0, 0, 439, 440, 441, 442, 0, 443, - 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, - 454, 455, 456, 542, 458, 459, 0, 0, 460, 461, - 38, 462, 0, 464, 465, 466, 467, 468, 469, 0, - 470, 471, 472, 0, 0, 473, 474, 475, 476, 477, - 0, 478, 479, 480, 481, 482, 483, 484, 485, 0, - 0, 486, 487, 488, 0, 40, 489, 490, 491, 492, - 0, 493, 494, 495, 496, 497, 819, 499, 500, 0, - 501, 0, 503, 504, 505, 506, 507, 508, 509, 0, - 0, 510, 0, 44, 511, 512, 513, 514, 515, 516, - 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, - 527, 528, 529, 530, 531, 0, 539, 45, 564, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 46, 0, 0, 0, 0, 122, 123, 124, 125, - 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 134, 135, 0, - 0, 137, 138, 0, 140, 141, 142, 143, 144, 0, - 146, 147, 0, 0, 148, 149, 150, 151, 152, 0, - 0, 153, 154, 155, 156, 157, 158, 159, 0, 160, - 161, 162, 163, 164, 0, 0, 0, 166, 167, 168, - 169, 170, 171, 0, 173, 174, 175, 0, 176, 177, - 178, 179, 180, 181, 0, 0, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, - 197, 0, 198, 0, 199, 200, 201, 202, 203, 204, - 0, 0, 205, 206, 207, 208, 0, 0, 209, 210, - 211, 212, 213, 0, 214, 215, 216, 0, 217, 218, - 219, 220, 0, 221, 222, 223, 224, 225, 226, 227, - 228, 229, 230, 231, 232, 0, 233, 0, 234, 235, - 236, 237, 0, 238, 0, 239, 0, 0, 0, 242, - 243, 540, 0, 246, 247, 248, 0, 249, 250, 251, - 252, 0, 253, 254, 255, 256, 257, 258, 259, 0, - 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, - 270, 271, 0, 272, 0, 274, 275, 276, 277, 278, - 279, 280, 281, 0, 282, 0, 283, 0, 0, 286, - 0, 288, 289, 290, 0, 291, 292, 293, 0, 0, - 294, 0, 296, 0, 0, 298, 299, 300, 301, 302, - 303, 304, 305, 541, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 325, 326, 327, 328, 329, 0, 331, 332, - 333, 334, 335, 0, 336, 337, 0, 339, 0, 340, - 341, 342, 343, 344, 345, 0, 346, 347, 0, 0, - 348, 349, 350, 0, 0, 351, 352, 353, 0, 355, - 0, 357, 358, 359, 360, 361, 362, 363, 364, 365, - 366, 367, 368, 369, 0, 0, 0, 0, 370, 371, - 372, 0, 374, 375, 376, 377, 378, 379, 0, 380, - 381, 382, 383, 384, 385, 0, 386, 387, 388, 389, - 390, 391, 392, 393, 394, 395, 0, 396, 397, 398, - 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, - 0, 409, 410, 0, 412, 413, 414, 415, 416, 417, - 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, - 428, 0, 0, 429, 430, 431, 432, 433, 434, 435, - 436, 437, 0, 0, 439, 440, 441, 442, 0, 443, - 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, - 454, 455, 456, 542, 458, 459, 0, 0, 460, 461, - 0, 462, 0, 464, 465, 466, 467, 468, 469, 0, - 470, 471, 472, 0, 0, 473, 474, 475, 476, 477, - 0, 478, 479, 480, 481, 482, 483, 484, 485, 0, - 0, 486, 487, 488, 0, 0, 489, 490, 491, 492, - 0, 493, 494, 495, 496, 497, 498, 499, 500, 0, - 501, 0, 503, 504, 505, 506, 507, 508, 509, 0, - 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, - 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, - 527, 528, 529, 530, 531, 539, 0, 564, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1014, 0, 0, 0, 122, 123, 124, 125, 126, + 0, 46, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 134, 135, 0, 0, - 137, 138, 0, 140, 141, 142, 143, 144, 0, 146, - 147, 0, 0, 148, 149, 150, 151, 152, 0, 0, + 0, 0, 0, 0, 0, 133, 134, 135, 0, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 147, 0, 0, 148, 149, 150, 151, 152, 0, 805, 153, 154, 155, 156, 157, 158, 159, 0, 160, 161, - 162, 163, 164, 0, 0, 0, 166, 167, 168, 169, - 170, 171, 0, 173, 174, 175, 0, 176, 177, 178, - 179, 180, 181, 0, 0, 183, 184, 185, 186, 187, + 162, 163, 806, 0, 807, 0, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 175, 0, 176, 177, 178, + 179, 180, 181, 0, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 0, 198, 0, 199, 200, 201, 202, 203, 204, 0, 0, 205, 206, 207, 208, 0, 0, 209, 210, 211, 212, 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, 0, 221, 222, 223, 224, 225, 226, 227, 228, - 229, 230, 231, 232, 0, 233, 0, 234, 235, 236, - 237, 0, 238, 0, 239, 0, 0, 0, 242, 243, - 540, 0, 246, 247, 248, 0, 249, 250, 251, 252, - 0, 253, 254, 255, 256, 257, 258, 259, 0, 261, + 229, 230, 231, 808, 0, 233, 0, 234, 235, 236, + 237, 0, 238, 0, 239, 240, 0, 241, 242, 243, + 244, 245, 246, 247, 248, 0, 249, 250, 251, 252, + 0, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, - 271, 0, 272, 0, 274, 275, 276, 277, 278, 279, - 280, 281, 0, 282, 0, 283, 0, 0, 286, 0, + 271, 0, 272, 273, 274, 275, 276, 277, 278, 279, + 280, 281, 0, 282, 0, 283, 284, 285, 286, 287, 288, 289, 290, 0, 291, 292, 293, 0, 0, 294, - 0, 296, 0, 0, 298, 299, 300, 301, 302, 303, - 304, 305, 541, 307, 308, 309, 310, 311, 312, 313, + 295, 296, 297, 0, 298, 299, 300, 301, 302, 303, + 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, - 324, 325, 326, 327, 328, 329, 0, 331, 332, 333, - 334, 335, 0, 336, 337, 0, 339, 0, 340, 341, + 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, + 334, 335, 0, 336, 337, 338, 339, 0, 810, 341, 342, 343, 344, 345, 0, 346, 347, 0, 0, 348, - 349, 350, 0, 0, 351, 352, 353, 0, 355, 0, - 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, - 367, 368, 369, 0, 0, 0, 0, 370, 371, 372, - 0, 374, 375, 376, 377, 378, 379, 0, 380, 381, + 349, 350, 0, 0, 351, 352, 353, 354, 355, 356, + 812, 358, 359, 360, 361, 362, 363, 364, 365, 366, + 367, 368, 369, 0, 0, 0, 0, 370, 371, 813, + 373, 374, 375, 376, 377, 378, 379, 0, 380, 381, 382, 383, 384, 385, 0, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 0, - 409, 410, 0, 412, 413, 414, 415, 416, 417, 418, + 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 0, 0, 429, 430, 431, 432, 433, 434, 435, 436, - 437, 0, 0, 439, 440, 441, 442, 0, 443, 444, + 437, 0, 438, 439, 440, 441, 442, 0, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 542, 458, 459, 0, 0, 460, 461, 0, - 462, 0, 464, 465, 466, 467, 468, 469, 0, 470, - 471, 472, 0, 0, 473, 474, 475, 476, 477, 0, - 478, 479, 480, 481, 482, 483, 484, 485, 0, 0, + 455, 456, 457, 458, 815, 0, 0, 460, 461, 0, + 462, 463, 464, 465, 466, 467, 468, 469, 0, 470, + 471, 472, 0, 0, 473, 474, 816, 476, 817, 0, + 478, 479, 818, 481, 482, 483, 484, 485, 0, 0, 486, 487, 488, 0, 0, 489, 490, 491, 492, 0, 493, 494, 495, 496, 497, 498, 499, 500, 0, 501, - 0, 503, 504, 505, 506, 507, 508, 509, 0, 0, + 502, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, - 528, 529, 530, 531, 539, 0, 564, 0, 0, 0, + 528, 529, 530, 531, 539, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1525, 0, 0, 0, 122, 123, 124, 125, 126, 127, + 3560, 0, 0, 0, 122, 123, 124, 125, 126, 127, + 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 134, 135, 0, 0, 137, + 138, 0, 140, 141, 142, 143, 144, 0, 146, 147, + 0, 0, 148, 149, 150, 151, 152, 0, 0, 153, + 154, 155, 156, 157, 158, 159, 0, 160, 161, 162, + 163, 164, 0, 0, 0, 166, 167, 168, 169, 170, + 171, 0, 173, 174, 175, 0, 176, 177, 178, 179, + 180, 181, 0, 0, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 196, 197, 0, + 198, 0, 199, 200, 201, 202, 203, 204, 14, 15, + 205, 206, 207, 208, 0, 0, 209, 210, 211, 212, + 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, + 0, 221, 222, 223, 224, 225, 226, 227, 228, 229, + 230, 231, 232, 0, 233, 0, 234, 235, 236, 237, + 0, 238, 0, 239, 0, 23, 0, 242, 243, 540, + 0, 246, 247, 248, 0, 249, 250, 251, 252, 0, + 253, 254, 255, 256, 257, 258, 259, 0, 261, 262, + 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, + 0, 272, 0, 274, 275, 276, 277, 278, 279, 280, + 281, 0, 282, 0, 283, 0, 0, 286, 0, 288, + 289, 290, 0, 291, 292, 293, 0, 0, 294, 0, + 296, 0, 0, 298, 299, 300, 301, 302, 303, 304, + 305, 541, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 328, 329, 0, 331, 332, 333, 334, + 335, 0, 336, 337, 0, 339, 0, 340, 341, 342, + 343, 344, 345, 0, 346, 347, 0, 0, 348, 349, + 350, 0, 0, 351, 352, 353, 0, 355, 0, 357, + 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, + 368, 369, 26, 27, 28, 0, 370, 371, 372, 0, + 374, 375, 376, 377, 378, 379, 0, 380, 381, 382, + 383, 384, 385, 0, 386, 387, 388, 389, 390, 391, + 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, + 401, 402, 403, 404, 405, 406, 407, 408, 0, 409, + 410, 0, 412, 413, 414, 415, 416, 417, 418, 419, + 420, 421, 422, 423, 424, 425, 426, 427, 428, 33, + 0, 429, 430, 431, 432, 433, 434, 435, 436, 437, + 35, 0, 439, 440, 441, 442, 0, 443, 444, 445, + 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, + 456, 542, 458, 459, 37, 0, 460, 461, 38, 462, + 0, 464, 465, 466, 467, 468, 469, 0, 470, 471, + 472, 0, 0, 473, 474, 475, 476, 477, 0, 478, + 479, 480, 481, 482, 483, 484, 485, 0, 0, 486, + 487, 488, 0, 40, 489, 490, 491, 492, 0, 493, + 494, 495, 496, 497, 819, 499, 500, 0, 501, 0, + 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, + 0, 44, 511, 512, 513, 514, 515, 516, 517, 518, + 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, + 529, 530, 531, 0, 539, 45, 564, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 46, + 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, + 128, 129, 910, 130, 131, 132, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 134, 135, 0, 0, 137, + 138, 0, 140, 141, 142, 143, 144, 0, 146, 147, + 0, 0, 148, 149, 150, 151, 152, 0, 0, 153, + 154, 155, 156, 157, 158, 159, 0, 160, 161, 162, + 163, 164, 0, 0, 0, 166, 167, 168, 169, 170, + 171, 0, 173, 174, 175, 0, 176, 177, 178, 179, + 180, 181, 0, 0, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 196, 197, 0, + 198, 0, 199, 200, 201, 202, 203, 204, 0, 0, + 205, 206, 207, 208, 0, 0, 209, 210, 211, 212, + 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, + 0, 221, 222, 223, 224, 225, 226, 227, 228, 229, + 230, 231, 232, 0, 233, 0, 234, 235, 236, 237, + 0, 238, 0, 239, 0, 23, 0, 242, 243, 540, + 0, 246, 247, 248, 0, 249, 250, 251, 252, 0, + 253, 254, 255, 256, 257, 258, 259, 0, 261, 262, + 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, + 0, 272, 0, 274, 275, 276, 277, 278, 279, 280, + 281, 0, 282, 0, 283, 0, 0, 286, 0, 288, + 289, 290, 0, 291, 292, 293, 0, 0, 294, 0, + 296, 0, 0, 298, 299, 300, 301, 302, 303, 304, + 305, 541, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 328, 329, 0, 331, 332, 333, 334, + 335, 0, 336, 337, 0, 339, 0, 340, 341, 342, + 343, 344, 345, 0, 346, 347, 0, 0, 348, 349, + 350, 0, 0, 351, 352, 353, 0, 355, 0, 357, + 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, + 368, 369, 26, 27, 28, 0, 370, 371, 372, 0, + 374, 375, 376, 377, 378, 379, 0, 380, 381, 382, + 383, 384, 385, 0, 386, 387, 388, 389, 390, 391, + 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, + 401, 402, 403, 404, 405, 406, 407, 408, 0, 409, + 410, 0, 412, 413, 414, 415, 416, 417, 418, 419, + 420, 421, 422, 423, 424, 425, 426, 427, 428, 33, + 0, 429, 430, 431, 432, 433, 434, 435, 436, 437, + 0, 0, 439, 440, 441, 442, 0, 443, 444, 445, + 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, + 456, 542, 458, 459, 0, 0, 460, 461, 38, 911, + 0, 464, 465, 466, 467, 468, 469, 0, 470, 912, + 472, 0, 0, 913, 474, 475, 476, 477, 0, 478, + 479, 480, 481, 482, 483, 484, 485, 0, 0, 486, + 487, 488, 0, 40, 489, 490, 491, 492, 0, 493, + 494, 495, 496, 497, 819, 499, 500, 0, 501, 0, + 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, + 0, 44, 511, 512, 513, 514, 515, 516, 517, 518, + 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, + 529, 530, 531, 0, 539, 45, 564, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 46, + 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, + 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 134, 135, 0, 0, 137, + 138, 0, 140, 141, 142, 143, 144, 0, 146, 147, + 0, 0, 148, 149, 150, 151, 152, 0, 0, 153, + 154, 155, 156, 157, 158, 159, 0, 160, 161, 162, + 163, 164, 0, 0, 0, 166, 167, 168, 169, 170, + 171, 0, 173, 174, 175, 0, 176, 177, 178, 179, + 180, 181, 0, 0, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 196, 197, 0, + 198, 0, 199, 200, 201, 202, 203, 204, 0, 0, + 205, 206, 207, 208, 0, 0, 209, 210, 211, 212, + 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, + 0, 221, 222, 223, 224, 225, 226, 227, 228, 229, + 230, 231, 232, 0, 233, 0, 234, 235, 236, 237, + 0, 238, 0, 239, 0, 23, 0, 242, 243, 540, + 0, 246, 247, 248, 0, 249, 250, 251, 252, 0, + 253, 254, 255, 256, 257, 258, 259, 0, 261, 262, + 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, + 0, 272, 0, 274, 275, 276, 277, 278, 279, 280, + 281, 0, 282, 0, 283, 0, 0, 286, 0, 288, + 289, 290, 0, 291, 292, 293, 0, 0, 294, 0, + 296, 0, 0, 298, 299, 300, 301, 302, 303, 304, + 305, 541, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 328, 329, 0, 331, 332, 333, 334, + 335, 0, 336, 337, 0, 339, 0, 340, 341, 342, + 343, 344, 345, 0, 346, 347, 0, 0, 348, 349, + 350, 0, 0, 351, 352, 353, 0, 355, 0, 357, + 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, + 368, 369, 26, 27, 28, 0, 370, 371, 372, 0, + 374, 375, 376, 377, 378, 379, 0, 380, 381, 382, + 383, 384, 385, 0, 386, 387, 388, 389, 390, 391, + 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, + 401, 402, 403, 404, 405, 406, 407, 408, 0, 409, + 410, 0, 412, 413, 414, 415, 416, 417, 418, 419, + 420, 421, 422, 423, 424, 425, 426, 427, 428, 33, + 0, 429, 430, 431, 432, 433, 434, 435, 436, 437, + 0, 0, 439, 440, 441, 442, 0, 443, 444, 445, + 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, + 456, 542, 458, 459, 0, 0, 460, 461, 38, 462, + 0, 464, 465, 466, 467, 468, 469, 0, 470, 471, + 472, 0, 0, 473, 474, 475, 476, 477, 0, 478, + 479, 480, 481, 482, 483, 484, 485, 0, 0, 486, + 487, 488, 0, 40, 489, 490, 491, 492, 0, 493, + 494, 495, 496, 497, 819, 499, 500, 0, 501, 0, + 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, + 0, 44, 511, 512, 513, 514, 515, 516, 517, 518, + 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, + 529, 530, 531, 0, 539, 45, 564, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 46, + 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 134, 135, 0, 0, 137, 138, 0, 140, 141, 142, 143, 144, 0, 146, 147, @@ -8475,7 +8320,7 @@ static const yytype_int16 yytable[] = 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 539, 0, 564, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 2159, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1014, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 134, 135, 0, 0, 137, 138, @@ -8526,7 +8371,7 @@ static const yytype_int16 yytable[] = 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 539, 0, 564, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 2306, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1525, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 134, 135, 0, 0, 137, 138, 0, @@ -8577,7 +8422,7 @@ static const yytype_int16 yytable[] = 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 539, 0, 564, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 2599, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 2159, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 134, 135, 0, 0, 137, 138, 0, 140, @@ -8628,7 +8473,7 @@ static const yytype_int16 yytable[] = 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 539, 0, 564, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 2742, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 2306, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 134, 135, 0, 0, 137, 138, 0, 140, 141, @@ -8679,7 +8524,7 @@ static const yytype_int16 yytable[] = 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 539, 0, 564, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 2969, 0, 0, 0, 122, + 0, 0, 0, 0, 0, 2600, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 134, 135, 0, 0, 137, 138, 0, 140, 141, 142, @@ -8729,8 +8574,8 @@ static const yytype_int16 yytable[] = 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 539, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3455, 0, 0, 0, 122, 123, + 564, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 2743, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 134, 135, 0, 0, 137, 138, 0, 140, 141, 142, 143, @@ -8779,9 +8624,9 @@ static const yytype_int16 yytable[] = 500, 0, 501, 0, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, - 525, 526, 527, 528, 529, 530, 531, 539, 0, 0, - 0, 0, 0, 0, 0, 0, 3791, 0, 0, 0, - 0, 0, 0, 2266, 0, 0, 0, 122, 123, 124, + 525, 526, 527, 528, 529, 530, 531, 539, 0, 564, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 2971, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 134, 135, 0, 0, 137, 138, 0, 140, 141, 142, 143, 144, @@ -8832,7 +8677,7 @@ static const yytype_int16 yytable[] = 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 539, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 2266, 0, 0, 0, 122, 123, 124, 125, + 0, 0, 3409, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 134, 135, 0, 0, 137, 138, 0, 140, 141, 142, 143, 144, 0, @@ -8881,276 +8726,9 @@ static const yytype_int16 yytable[] = 501, 0, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, - 527, 528, 529, 530, 531, 3101, 1395, 836, 0, 0, - 2133, 1080, 0, 0, 0, 0, 0, 2134, 2135, 0, - 0, 3306, 2136, 2137, 2138, 122, 123, 124, 125, 126, - 127, 128, 129, 571, 130, 131, 132, 572, 573, 574, - 3102, 576, 577, 578, 579, 3103, 134, 135, 581, 3104, - 137, 138, 3105, 140, 141, 142, 0, 1539, 3106, 1541, - 1542, 589, 3107, 148, 149, 150, 151, 152, 591, 592, - 153, 154, 155, 156, 1544, 1545, 159, 595, 160, 161, - 162, 163, 0, 597, 3108, 599, 3109, 167, 168, 169, - 170, 171, 3110, 173, 174, 175, 602, 176, 177, 178, - 179, 180, 181, 603, 3111, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 192, 1550, 194, 195, 1551, 197, - 608, 198, 609, 199, 200, 201, 202, 203, 204, 610, - 611, 205, 206, 207, 208, 612, 613, 209, 210, 1093, - 212, 213, 614, 214, 215, 216, 615, 217, 218, 219, - 220, 616, 221, 222, 223, 224, 0, 226, 227, 228, - 229, 230, 231, 0, 619, 233, 620, 234, 235, 1552, - 237, 622, 238, 623, 239, 3112, 625, 3113, 242, 243, - 2472, 3114, 246, 247, 248, 629, 0, 0, 251, 252, - 632, 253, 254, 255, 256, 257, 258, 259, 3115, 261, - 262, 263, 264, 634, 265, 266, 267, 268, 269, 270, - 271, 635, 272, 3116, 0, 275, 276, 277, 278, 279, - 1558, 1559, 640, 1560, 642, 283, 3117, 3118, 286, 3119, - 288, 289, 290, 646, 291, 292, 293, 647, 648, 294, - 3120, 296, 3121, 651, 298, 299, 300, 301, 302, 303, - 304, 305, 3122, 307, 308, 309, 310, 311, 312, 313, - 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, - 324, 325, 326, 327, 328, 1567, 3123, 1569, 332, 333, - 334, 3124, 657, 336, 337, 3125, 339, 659, 0, 341, - 1571, 343, 344, 345, 662, 346, 347, 663, 664, 3126, - 349, 350, 665, 666, 351, 352, 0, 3127, 355, 3128, - 0, 358, 359, 360, 361, 362, 363, 364, 365, 366, - 367, 368, 369, 671, 672, 673, 674, 370, 371, 0, - 3129, 374, 375, 0, 377, 378, 379, 678, 380, 381, - 382, 383, 384, 385, 679, 386, 387, 388, 389, 390, - 1575, 392, 393, 394, 395, 681, 396, 397, 398, 399, - 400, 401, 402, 403, 404, 405, 406, 407, 408, 682, - 409, 410, 3130, 412, 413, 414, 1577, 416, 417, 418, - 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, - 685, 3131, 429, 430, 431, 432, 433, 434, 3132, 436, - 437, 688, 3133, 439, 440, 1581, 442, 691, 443, 444, - 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 3134, 458, 0, 694, 695, 460, 461, 696, - 462, 3135, 464, 465, 466, 467, 468, 469, 698, 470, - 1584, 1585, 701, 702, 473, 474, 0, 476, 0, 705, - 478, 479, 3136, 481, 482, 483, 484, 485, 3137, 708, - 486, 487, 488, 3138, 710, 489, 490, 491, 492, 711, - 493, 494, 495, 496, 497, 0, 1589, 500, 714, 501, - 3139, 503, 504, 505, 506, 507, 508, 509, 716, 717, - 510, 718, 719, 511, 512, 513, 514, 515, 516, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 528, 529, 530, 531, 0, 539, 0, 2139, 2140, 2141, - 2133, 3140, 3141, 2144, 2145, 2146, 2147, 2134, 2135, 0, - 0, 0, 2136, 2137, 2138, 122, 123, 124, 125, 126, - 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 134, 135, 0, 0, - 137, 138, 0, 140, 141, 142, 143, 144, 0, 146, - 147, 0, 0, 148, 149, 150, 151, 152, 0, 0, - 153, 154, 155, 156, 157, 158, 159, 0, 160, 161, - 162, 163, 164, 0, 0, 0, 166, 167, 168, 169, - 170, 171, 0, 173, 174, 175, 0, 176, 177, 178, - 179, 180, 181, 0, 0, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 0, 198, 0, 199, 200, 201, 202, 203, 204, 0, - 0, 205, 206, 207, 208, 0, 0, 209, 210, 211, - 212, 213, 0, 214, 215, 216, 0, 217, 218, 219, - 220, 0, 221, 222, 223, 224, 225, 226, 227, 228, - 229, 230, 231, 232, 0, 233, 0, 234, 235, 236, - 237, 0, 238, 0, 239, 0, 0, 0, 242, 243, - 540, 0, 246, 247, 248, 0, 249, 250, 251, 252, - 0, 253, 254, 255, 256, 257, 258, 259, 0, 261, - 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, - 271, 0, 272, 0, 274, 275, 276, 277, 278, 279, - 280, 281, 0, 282, 0, 283, 0, 0, 286, 0, - 288, 289, 290, 0, 291, 292, 293, 0, 0, 294, - 0, 296, 0, 0, 298, 299, 300, 301, 302, 303, - 304, 305, 541, 307, 308, 309, 310, 311, 312, 313, - 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, - 324, 325, 326, 327, 328, 329, 0, 331, 332, 333, - 334, 335, 0, 336, 337, 0, 339, 0, 340, 341, - 342, 343, 344, 345, 0, 346, 347, 0, 0, 348, - 349, 350, 0, 0, 351, 352, 353, 0, 355, 0, - 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, - 367, 368, 369, 0, 0, 0, 0, 370, 371, 372, - 0, 374, 375, 376, 377, 378, 379, 0, 380, 381, - 382, 383, 384, 385, 0, 386, 387, 388, 389, 390, - 391, 392, 393, 394, 395, 0, 396, 397, 398, 399, - 400, 401, 402, 403, 404, 405, 406, 407, 408, 0, - 409, 410, 0, 412, 413, 414, 415, 416, 417, 418, - 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, - 0, 0, 429, 430, 431, 432, 433, 434, 435, 436, - 437, 0, 0, 439, 440, 441, 442, 0, 443, 444, - 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 542, 458, 459, 0, 0, 460, 461, 0, - 462, 0, 464, 465, 466, 467, 468, 469, 0, 470, - 471, 472, 0, 0, 473, 474, 475, 476, 477, 0, - 478, 479, 480, 481, 482, 483, 484, 485, 0, 0, - 486, 487, 488, 0, 0, 489, 490, 491, 492, 0, - 493, 494, 495, 496, 497, 498, 499, 500, 0, 501, - 0, 503, 504, 505, 506, 507, 508, 509, 0, 0, - 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, - 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, - 528, 529, 530, 531, 0, 0, 0, 2139, 2140, 2141, - 0, 2142, 2143, 2144, 2145, 2146, 2147, 1676, 0, 0, - 1677, 0, 0, 0, 1678, 1679, 1680, 1681, 0, 1682, - 1683, 1684, 0, 0, 0, 1676, 0, 0, 1677, 0, - 0, 0, 1678, 1679, 1680, 1681, 1685, 1682, 1683, 1684, - 0, 0, 0, 0, 0, 0, 1687, 0, 0, 0, - 0, 0, 0, 1688, 1685, 0, 0, 0, 0, 0, - 1676, 0, 0, 1677, 1687, 0, 0, 1678, 1679, 1680, - 1681, 1688, 1682, 1683, 1684, 0, 0, 0, 1676, 0, - 1689, 1677, 0, 0, 0, 1678, 1679, 1680, 1681, 1685, - 1682, 1683, 1684, 0, 0, 0, 0, 0, 1689, 1687, - 0, 0, 0, 0, 0, 0, 1688, 1685, 0, 0, - 0, 0, 0, 1676, 0, 0, 1677, 1687, 0, 0, - 1678, 1679, 1680, 1681, 1688, 1682, 1683, 1684, 0, 0, - 0, 0, 0, 1689, 0, 0, 0, 0, 0, 0, - 0, 0, 1685, 0, 0, 0, 0, 0, 0, 0, - 0, 1689, 1687, 0, 0, 1676, 0, 0, 1677, 1688, - 0, 0, 1678, 1679, 1680, 1681, 0, 1682, 1683, 1684, - 0, 0, 0, 0, 0, 0, 0, 0, 1690, 0, - 0, 0, 0, 0, 1685, 0, 1689, 0, 0, 0, - 0, 0, 0, 0, 1687, 1691, 1690, 0, 0, 0, - 1692, 1688, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1691, 0, 0, 0, 0, 1692, 0, - 0, 0, 0, 1693, 1694, 0, 0, 0, 1689, 0, - 0, 1690, 0, 0, 0, 0, 0, 0, 0, 1695, - 0, 1693, 1694, 0, 0, 0, 0, 0, 1691, 1690, - 0, 0, 0, 1692, 0, 0, 0, 1695, 0, 0, - 0, 0, 0, 0, 0, 0, 1691, 0, 0, 0, - 0, 1692, 0, 0, 0, 0, 1693, 1694, 0, 1696, - 0, 0, 1697, 0, 1690, 0, 0, 0, 0, 0, - 0, 0, 1695, 0, 1693, 1694, 1698, 1696, 0, 1699, - 1697, 1691, 0, 0, 0, 0, 1692, 0, 0, 0, - 1695, 0, 0, 0, 1698, 0, 0, 1699, 0, 0, - 0, 0, 0, 0, 0, 0, 1690, 0, 0, 1693, - 1694, 0, 1696, 0, 0, 1697, 0, 0, 0, 0, - 0, 0, 0, 1691, 0, 1695, 0, 0, 1692, 1698, - 1696, 0, 1699, 1697, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1698, 0, 0, - 1699, 1693, 1694, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1696, 0, 1695, 1697, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1700, - 0, 0, 1698, 0, 0, 1699, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1700, 0, 0, - 0, 0, 0, 0, 0, 1676, 0, 1696, 1677, 0, - 1697, 0, 1678, 1679, 1680, 1681, 0, 1682, 1683, 1684, - 0, 0, 0, 0, 1698, 0, 0, 1699, 0, 0, - 0, 0, 1700, 0, 1685, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1687, 0, 0, 0, 0, 0, - 1700, 1688, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1689, 0, - 0, 0, 0, 0, 0, 1700, 0, 0, 0, 0, - 0, 1701, 0, 0, 1702, 1703, 1704, 0, 1705, 1706, - 1707, 1708, 1709, 1710, 0, 0, 0, 0, 3478, 1701, - 0, 0, 1702, 1703, 1704, 0, 1705, 1706, 1707, 1708, - 1709, 1710, 0, 0, 0, 0, 3506, 1700, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1701, 0, 0, 1702, 1703, 1704, - 0, 1705, 1706, 1707, 1708, 1709, 1710, 0, 0, 0, - 0, 3610, 1701, 0, 0, 1702, 1703, 1704, 0, 1705, - 1706, 1707, 1708, 1709, 1710, 0, 1690, 0, 0, 3670, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1691, 0, 0, 0, 1701, 1692, 0, - 1702, 1703, 1704, 0, 1705, 1706, 1707, 1708, 1709, 1710, - 0, 0, 0, 0, 3692, 0, 1676, 0, 0, 1677, - 0, 1693, 1694, 1678, 1679, 1680, 1681, 0, 1682, 1683, - 1684, 0, 0, 0, 0, 0, 0, 1695, 0, 1701, - 0, 0, 1702, 1703, 1704, 1685, 1705, 1706, 1707, 1708, - 1709, 1710, 0, 0, 2994, 1687, 0, 0, 0, 0, - 0, 0, 1688, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1696, 0, 0, - 1697, 0, 0, 0, 0, 0, 0, 0, 0, 1689, - 0, 0, 0, 0, 1698, 0, 0, 1699, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1690, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1700, 0, 0, - 0, 0, 0, 0, 1691, 0, 0, 0, 0, 1692, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1693, 1694, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1695, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1696, 0, - 0, 1697, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1698, 0, 0, 1699, 1701, - 0, 0, 1702, 1703, 1704, 0, 1705, 1706, 1707, 1708, - 1709, 1710, 0, 0, 3468, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1700, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 570, 0, 0, 0, - 1701, 0, 0, 1702, 1703, 1704, 0, 1705, 1706, 1707, - 1708, 1709, 1710, 0, 0, 3650, 122, 123, 124, 125, - 126, 127, 128, 129, 571, 130, 131, 132, 572, 573, - 574, 575, 576, 577, 578, 579, 580, 134, 135, 581, - 582, 137, 138, 583, 140, 141, 142, 584, 585, 586, - 587, 588, 589, 590, 148, 149, 150, 151, 152, 591, - 592, 153, 154, 155, 156, 593, 594, 159, 595, 160, - 161, 162, 163, 596, 597, 598, 599, 600, 167, 168, - 169, 170, 171, 601, 173, 174, 175, 602, 176, 177, - 178, 179, 180, 181, 603, 604, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 192, 606, 194, 195, 607, - 197, 608, 198, 609, 199, 200, 201, 202, 203, 204, - 610, 611, 205, 206, 207, 208, 612, 613, 209, 210, - 211, 212, 213, 614, 214, 215, 216, 615, 217, 218, - 219, 220, 616, 221, 222, 223, 224, 617, 226, 227, - 228, 229, 230, 231, 618, 619, 233, 620, 234, 235, - 621, 237, 622, 238, 623, 239, 624, 625, 626, 242, - 243, 627, 628, 246, 247, 248, 629, 630, 631, 251, - 252, 632, 253, 254, 255, 256, 257, 258, 259, 633, - 261, 262, 263, 264, 634, 265, 266, 267, 268, 269, - 270, 271, 635, 272, 636, 637, 275, 276, 277, 278, - 279, 638, 639, 640, 641, 642, 283, 643, 644, 286, - 645, 288, 289, 290, 646, 291, 292, 293, 647, 648, - 294, 649, 296, 650, 651, 298, 299, 300, 301, 302, - 303, 304, 305, 652, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 325, 326, 327, 328, 653, 654, 655, 332, - 333, 334, 656, 657, 336, 337, 658, 339, 659, 660, - 341, 661, 343, 344, 345, 662, 346, 347, 663, 664, - 348, 349, 350, 665, 666, 351, 352, 667, 668, 355, - 669, 670, 358, 359, 360, 361, 362, 363, 364, 365, - 366, 367, 368, 369, 671, 672, 673, 674, 370, 371, - 675, 676, 374, 375, 677, 377, 378, 379, 678, 380, - 381, 382, 383, 384, 385, 679, 386, 387, 388, 389, - 390, 680, 392, 393, 394, 395, 681, 396, 397, 398, - 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, - 682, 409, 410, 683, 412, 413, 414, 684, 416, 417, - 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, - 428, 685, 686, 429, 430, 431, 432, 433, 434, 687, - 436, 437, 688, 689, 439, 440, 690, 442, 691, 443, - 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, - 454, 455, 456, 692, 458, 693, 694, 695, 460, 461, - 696, 462, 697, 464, 465, 466, 467, 468, 469, 698, - 470, 699, 700, 701, 702, 473, 474, 703, 476, 704, - 705, 478, 479, 706, 481, 482, 483, 484, 485, 707, - 708, 486, 487, 488, 709, 710, 489, 490, 491, 492, - 711, 493, 494, 495, 496, 497, 712, 713, 500, 714, - 501, 715, 503, 504, 505, 506, 507, 508, 509, 716, - 717, 510, 718, 719, 511, 512, 513, 514, 515, 516, - 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, - 730, 528, 529, 530, 531, 539, 0, 0, 0, 0, - 0, 0, 0, 0, 2172, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, + 527, 528, 529, 530, 531, 539, 0, 0, 0, 0, + 0, 0, 0, 0, 3808, 0, 0, 0, 0, 0, + 0, 2266, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 134, 135, 0, 0, 137, 138, 0, 140, 141, 142, 143, 144, 0, 146, @@ -9200,8 +8778,8 @@ static const yytype_int16 yytable[] = 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 539, 0, 0, 0, 0, 0, - 0, 0, 0, 2886, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2266, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 134, 135, 0, 0, 137, 138, 0, 140, 141, 142, 143, 144, 0, 146, 147, @@ -9250,364 +8828,269 @@ static const yytype_int16 yytable[] = 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, - 529, 530, 531, 994, 1395, 836, 0, 0, 0, 1080, - 0, 0, 2889, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, - 129, 0, 130, 131, 132, 0, 0, 0, 575, 0, - 0, 0, 0, 580, 134, 135, 0, 582, 137, 138, - 583, 140, 141, 142, 584, 585, 586, 587, 588, 0, - 590, 148, 149, 150, 151, 152, 0, 0, 153, 154, - 155, 156, 593, 594, 159, 0, 160, 161, 162, 163, - 596, 0, 598, 0, 600, 167, 168, 169, 170, 171, - 601, 173, 174, 175, 0, 176, 177, 178, 179, 180, - 181, 0, 604, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 192, 606, 194, 195, 607, 197, 0, 198, + 529, 530, 531, 3472, 1395, 836, 0, 0, 2133, 1080, + 0, 0, 0, 0, 0, 2134, 2135, 0, 0, 3260, + 2136, 2137, 2138, 122, 123, 124, 125, 126, 127, 128, + 129, 571, 130, 131, 132, 572, 573, 574, 3473, 576, + 577, 578, 579, 3474, 134, 135, 581, 3475, 137, 138, + 3476, 140, 141, 142, 0, 1539, 3477, 1541, 1542, 589, + 3478, 148, 149, 150, 151, 152, 591, 592, 153, 154, + 155, 156, 1544, 1545, 159, 595, 160, 161, 162, 163, + 0, 597, 3479, 599, 3480, 167, 168, 169, 170, 171, + 3481, 173, 174, 175, 602, 176, 177, 178, 179, 180, + 181, 603, 3482, 183, 184, 185, 186, 187, 188, 189, + 190, 191, 192, 1550, 194, 195, 1551, 197, 608, 198, + 609, 199, 200, 201, 202, 203, 204, 610, 611, 205, + 206, 207, 208, 612, 613, 209, 210, 1093, 212, 213, + 614, 214, 215, 216, 615, 217, 218, 219, 220, 616, + 221, 222, 223, 224, 0, 226, 227, 228, 229, 230, + 231, 0, 619, 233, 620, 234, 235, 1552, 237, 622, + 238, 623, 239, 3483, 625, 3484, 242, 243, 2473, 3485, + 246, 247, 248, 629, 0, 0, 251, 252, 632, 253, + 254, 255, 256, 257, 258, 259, 3486, 261, 262, 263, + 264, 634, 265, 266, 267, 268, 269, 270, 271, 635, + 272, 3487, 0, 275, 276, 277, 278, 279, 1558, 1559, + 640, 1560, 642, 283, 3488, 3489, 286, 3490, 288, 289, + 290, 646, 291, 292, 293, 647, 648, 294, 3491, 296, + 3492, 651, 298, 299, 300, 301, 302, 303, 304, 305, + 3493, 307, 308, 309, 310, 311, 312, 313, 314, 315, + 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, + 326, 327, 328, 1567, 3494, 1569, 332, 333, 334, 3495, + 657, 336, 337, 3496, 339, 659, 0, 341, 1571, 343, + 344, 345, 662, 346, 347, 663, 664, 3497, 349, 350, + 665, 666, 351, 352, 0, 3498, 355, 3499, 0, 358, + 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, + 369, 671, 672, 673, 674, 370, 371, 0, 3500, 374, + 375, 0, 377, 378, 379, 678, 380, 381, 382, 383, + 384, 385, 679, 386, 387, 388, 389, 390, 1575, 392, + 393, 394, 395, 681, 396, 397, 398, 399, 400, 401, + 402, 403, 404, 405, 406, 407, 408, 682, 409, 410, + 3501, 412, 413, 414, 1577, 416, 417, 418, 419, 420, + 421, 422, 423, 424, 425, 426, 427, 428, 685, 3502, + 429, 430, 431, 432, 433, 434, 3503, 436, 437, 688, + 3504, 439, 440, 1581, 442, 691, 443, 444, 445, 446, + 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, + 3505, 458, 0, 694, 695, 460, 461, 696, 462, 3506, + 464, 465, 466, 467, 468, 469, 698, 470, 1584, 1585, + 701, 702, 473, 474, 0, 476, 0, 705, 478, 479, + 3507, 481, 482, 483, 484, 485, 3508, 708, 486, 487, + 488, 3509, 710, 489, 490, 491, 492, 711, 493, 494, + 495, 496, 497, 0, 1589, 500, 714, 501, 3510, 503, + 504, 505, 506, 507, 508, 509, 716, 717, 510, 718, + 719, 511, 512, 513, 514, 515, 516, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 528, 529, + 530, 531, 0, 539, 0, 2139, 2140, 2141, 2133, 3511, + 3512, 2144, 2145, 2146, 2147, 2134, 2135, 0, 0, 0, + 2136, 2137, 2138, 122, 123, 124, 125, 126, 127, 128, + 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 134, 135, 0, 0, 137, 138, + 0, 140, 141, 142, 143, 144, 0, 146, 147, 0, + 0, 148, 149, 150, 151, 152, 0, 0, 153, 154, + 155, 156, 157, 158, 159, 0, 160, 161, 162, 163, + 164, 0, 0, 0, 166, 167, 168, 169, 170, 171, + 0, 173, 174, 175, 0, 176, 177, 178, 179, 180, + 181, 0, 0, 183, 184, 185, 186, 187, 188, 189, + 190, 191, 192, 193, 194, 195, 196, 197, 0, 198, 0, 199, 200, 201, 202, 203, 204, 0, 0, 205, 206, 207, 208, 0, 0, 209, 210, 211, 212, 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, 0, - 221, 222, 223, 224, 617, 226, 227, 228, 229, 230, - 231, 618, 1396, 233, 0, 234, 235, 621, 237, 0, - 238, 0, 239, 624, 0, 626, 242, 243, 627, 628, - 246, 247, 248, 0, 630, 631, 251, 252, 0, 253, - 254, 255, 256, 257, 258, 259, 633, 261, 262, 263, + 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, + 231, 232, 0, 233, 0, 234, 235, 236, 237, 0, + 238, 0, 239, 0, 0, 0, 242, 243, 540, 0, + 246, 247, 248, 0, 249, 250, 251, 252, 0, 253, + 254, 255, 256, 257, 258, 259, 0, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, - 272, 636, 637, 275, 276, 277, 278, 279, 638, 639, - 0, 641, 0, 283, 643, 644, 286, 645, 288, 289, - 290, 0, 291, 292, 293, 0, 0, 294, 649, 296, - 650, 0, 298, 299, 300, 301, 302, 303, 304, 305, - 652, 307, 308, 309, 310, 311, 312, 313, 314, 315, + 272, 0, 274, 275, 276, 277, 278, 279, 280, 281, + 0, 282, 0, 283, 0, 0, 286, 0, 288, 289, + 290, 0, 291, 292, 293, 0, 0, 294, 0, 296, + 0, 0, 298, 299, 300, 301, 302, 303, 304, 305, + 541, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, - 326, 327, 328, 653, 654, 655, 332, 333, 334, 656, - 0, 336, 337, 658, 339, 0, 660, 341, 661, 343, - 344, 345, 0, 346, 347, 1397, 0, 348, 349, 350, - 0, 0, 351, 352, 667, 668, 355, 669, 670, 358, + 326, 327, 328, 329, 0, 331, 332, 333, 334, 335, + 0, 336, 337, 0, 339, 0, 340, 341, 342, 343, + 344, 345, 0, 346, 347, 0, 0, 348, 349, 350, + 0, 0, 351, 352, 353, 0, 355, 0, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, - 369, 0, 0, 0, 0, 370, 371, 675, 676, 374, - 375, 677, 377, 378, 379, 0, 380, 381, 382, 383, - 384, 385, 0, 386, 387, 388, 389, 390, 680, 392, + 369, 0, 0, 0, 0, 370, 371, 372, 0, 374, + 375, 376, 377, 378, 379, 0, 380, 381, 382, 383, + 384, 385, 0, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 0, 409, 410, - 683, 412, 413, 414, 684, 416, 417, 418, 419, 420, - 421, 422, 423, 424, 425, 426, 427, 428, 0, 686, - 429, 430, 431, 432, 433, 434, 687, 436, 437, 0, - 689, 439, 440, 690, 442, 0, 443, 444, 445, 446, + 0, 412, 413, 414, 415, 416, 417, 418, 419, 420, + 421, 422, 423, 424, 425, 426, 427, 428, 0, 0, + 429, 430, 431, 432, 433, 434, 435, 436, 437, 0, + 0, 439, 440, 441, 442, 0, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, - 692, 458, 693, 0, 0, 460, 461, 0, 462, 697, - 464, 465, 466, 467, 468, 469, 0, 470, 699, 700, - 0, 0, 473, 474, 703, 476, 704, 1398, 478, 479, - 706, 481, 482, 483, 484, 485, 0, 0, 486, 487, - 488, 709, 0, 489, 490, 491, 492, 0, 493, 494, - 495, 496, 497, 712, 713, 500, 0, 501, 715, 503, + 542, 458, 459, 0, 0, 460, 461, 0, 462, 0, + 464, 465, 466, 467, 468, 469, 0, 470, 471, 472, + 0, 0, 473, 474, 475, 476, 477, 0, 478, 479, + 480, 481, 482, 483, 484, 485, 0, 0, 486, 487, + 488, 0, 0, 489, 490, 491, 492, 0, 493, 494, + 495, 496, 497, 498, 499, 500, 0, 501, 0, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, - 0, 511, 512, 513, 514, 515, 516, 720, 721, 722, - 723, 724, 725, 726, 727, 728, 729, 730, 528, 529, - 530, 531, 0, 0, 1676, 0, 0, 1677, 0, 1399, - 1400, 1678, 1679, 1680, 1681, 0, 1682, 1683, 1684, 0, - 0, 0, 1676, 0, 0, 1677, 0, 0, 0, 1678, - 1679, 1680, 1681, 1685, 1682, 1683, 1684, 0, 2272, 0, - 0, 0, 0, 1687, 0, 0, 0, 0, 0, 0, - 1688, 1685, 0, 0, 0, 0, 0, 1676, 0, 0, - 1677, 1687, 0, 0, 1678, 1679, 1680, 1681, 1688, 1682, - 1683, 1684, 0, 0, 0, 1676, 0, 1689, 1677, 0, - 0, 0, 1678, 1679, 1680, 1681, 1685, 1682, 1683, 1684, - 0, 0, 0, 0, 0, 1689, 1687, 0, 0, 0, - 0, 0, 0, 1688, 1685, 0, 0, 0, 1979, 0, + 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, + 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, + 530, 531, 0, 0, 0, 2139, 2140, 2141, 0, 2142, + 2143, 2144, 2145, 2146, 2147, 1676, 0, 0, 1677, 0, + 0, 0, 1678, 1679, 1680, 1681, 0, 1682, 1683, 1684, + 0, 0, 0, 1676, 0, 0, 1677, 0, 0, 0, + 1678, 1679, 1680, 1681, 1685, 1682, 1683, 1684, 0, 0, 0, 0, 0, 0, 1687, 0, 0, 0, 0, 0, - 0, 1688, 0, 2273, 0, 0, 0, 0, 0, 0, - 1689, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1688, 1685, 0, 0, 0, 0, 0, 1676, 0, + 0, 1677, 1687, 0, 0, 1678, 1679, 1680, 1681, 1688, + 1682, 1683, 1684, 0, 0, 0, 1676, 0, 1689, 1677, + 0, 0, 0, 1678, 1679, 1680, 1681, 1685, 1682, 1683, + 1684, 0, 0, 0, 0, 0, 1689, 1687, 0, 0, + 0, 0, 0, 0, 1688, 1685, 0, 0, 0, 0, + 0, 1676, 0, 0, 1677, 1687, 0, 0, 1678, 1679, + 1680, 1681, 1688, 1682, 1683, 1684, 0, 0, 0, 0, + 0, 1689, 0, 0, 0, 0, 0, 0, 0, 0, + 1685, 0, 0, 0, 0, 0, 0, 0, 0, 1689, + 1687, 0, 0, 1676, 0, 0, 1677, 1688, 0, 0, + 1678, 1679, 1680, 1681, 0, 1682, 1683, 1684, 0, 0, + 0, 0, 0, 0, 0, 0, 1690, 0, 0, 0, + 0, 0, 1685, 0, 1689, 0, 0, 0, 0, 0, + 0, 0, 1687, 1691, 1690, 0, 0, 0, 1692, 1688, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1691, 0, 0, 0, 0, 1692, 0, 0, 0, + 0, 1693, 1694, 0, 0, 0, 1689, 0, 0, 1690, + 0, 0, 0, 0, 0, 0, 0, 1695, 0, 1693, + 1694, 0, 0, 0, 0, 0, 1691, 1690, 0, 0, + 0, 1692, 0, 0, 0, 1695, 0, 0, 0, 0, + 0, 0, 0, 0, 1691, 0, 0, 0, 0, 1692, + 0, 0, 0, 0, 1693, 1694, 0, 1696, 0, 0, + 1697, 0, 1690, 0, 0, 0, 0, 0, 0, 0, + 1695, 0, 1693, 1694, 1698, 1696, 0, 1699, 1697, 1691, + 0, 0, 0, 0, 1692, 0, 0, 0, 1695, 0, + 0, 0, 1698, 0, 0, 1699, 0, 0, 0, 0, + 0, 0, 0, 0, 1690, 0, 0, 1693, 1694, 0, + 1696, 0, 0, 1697, 0, 0, 0, 0, 0, 0, + 0, 1691, 0, 1695, 0, 0, 1692, 1698, 1696, 0, + 1699, 1697, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1698, 0, 0, 1699, 1693, + 1694, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1696, 0, 1695, 1697, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1700, 0, 0, + 1698, 0, 0, 1699, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1700, 0, 0, 0, 0, + 0, 0, 0, 1676, 0, 1696, 1677, 0, 1697, 0, + 1678, 1679, 1680, 1681, 0, 1682, 1683, 1684, 0, 0, + 0, 0, 1698, 0, 0, 1699, 0, 0, 0, 0, + 1700, 0, 1685, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1687, 0, 0, 0, 0, 0, 1700, 1688, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1689, 0, 0, 0, + 0, 0, 0, 1700, 0, 0, 0, 0, 0, 1701, + 0, 0, 1702, 1703, 1704, 0, 1705, 1706, 1707, 1708, + 1709, 1710, 0, 0, 0, 0, 2975, 1701, 0, 0, + 1702, 1703, 1704, 0, 1705, 1706, 1707, 1708, 1709, 1710, + 0, 0, 0, 0, 3049, 1700, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1701, 0, 0, 1702, 1703, 1704, 0, 1705, + 1706, 1707, 1708, 1709, 1710, 0, 0, 0, 0, 3252, + 1701, 0, 0, 1702, 1703, 1704, 0, 1705, 1706, 1707, + 1708, 1709, 1710, 0, 1690, 0, 0, 3259, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1691, 0, 0, 0, 1701, 1692, 0, 1702, 1703, + 1704, 0, 1705, 1706, 1707, 1708, 1709, 1710, 0, 0, + 0, 0, 3346, 0, 1676, 0, 0, 1677, 0, 1693, + 1694, 1678, 1679, 1680, 1681, 0, 1682, 1683, 1684, 0, + 0, 0, 0, 0, 0, 1695, 0, 1701, 0, 0, + 1702, 1703, 1704, 1685, 1705, 1706, 1707, 1708, 1709, 1710, + 0, 0, 0, 1687, 3432, 1676, 0, 0, 1677, 0, + 1688, 0, 1678, 1679, 1680, 1681, 0, 1682, 1683, 1684, + 0, 0, 0, 0, 0, 1696, 0, 0, 1697, 0, + 0, 0, 0, 0, 1685, 0, 0, 1689, 0, 0, + 0, 0, 1698, 0, 1687, 1699, 0, 0, 0, 0, + 0, 1688, 0, 0, 1676, 0, 0, 1677, 0, 0, + 0, 1678, 1679, 1680, 1681, 0, 1682, 1683, 1684, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1689, 0, - 0, 0, 1676, 0, 0, 1677, 0, 0, 0, 1678, + 0, 0, 0, 1685, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1687, 0, 0, 0, 0, 0, 0, + 1688, 0, 1676, 0, 0, 1677, 0, 0, 0, 1678, 1679, 1680, 1681, 0, 1682, 1683, 1684, 0, 0, 0, - 0, 0, 0, 0, 0, 1690, 0, 0, 0, 0, - 0, 1685, 0, 2015, 0, 0, 0, 0, 2016, 0, - 0, 1687, 1691, 1690, 0, 0, 0, 1692, 1688, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1691, 0, 0, 0, 0, 1692, 0, 3779, 0, 0, - 1693, 1694, 0, 0, 0, 1689, 0, 0, 1690, 0, - 0, 0, 0, 0, 0, 0, 1695, 0, 1693, 1694, - 0, 0, 0, 0, 0, 1691, 1690, 0, 0, 0, - 1692, 0, 0, 0, 1695, 0, 0, 0, 0, 0, - 0, 0, 0, 1691, 0, 0, 0, 0, 1692, 0, - 0, 0, 0, 1693, 1694, 0, 1696, 0, 0, 1697, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1695, - 0, 1693, 1694, 1698, 1696, 0, 1699, 1697, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1695, 0, 0, - 0, 1698, 0, 0, 1699, 0, 0, 0, 0, 0, - 0, 0, 0, 1690, 0, 0, 0, 0, 0, 1696, - 0, 0, 1697, 0, 0, 0, 0, 0, 0, 0, - 1691, 0, 0, 0, 0, 1692, 1698, 1696, 0, 1699, - 1697, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1698, 0, 0, 1699, 1693, 1694, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 3780, - 0, 0, 0, 0, 1695, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1700, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1676, - 0, 0, 1677, 0, 1700, 0, 1678, 1679, 1680, 1681, - 0, 1682, 1683, 1684, 1696, 0, 0, 1697, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1685, 0, - 0, 1698, 2021, 0, 1699, 0, 0, 0, 1687, 1700, - 0, 0, 0, 0, 0, 1688, 0, 0, 0, 0, - 0, 0, 0, 2276, 0, 0, 0, 1700, 1986, 0, + 0, 0, 0, 0, 0, 0, 0, 1689, 0, 0, + 0, 1685, 0, 0, 0, 1690, 0, 0, 0, 0, + 0, 1687, 0, 0, 0, 1700, 0, 0, 1688, 0, + 0, 0, 1691, 0, 0, 0, 1676, 1692, 0, 1677, + 0, 0, 0, 1678, 1679, 1680, 1681, 0, 1682, 1683, + 1684, 0, 0, 0, 0, 1689, 1690, 0, 0, 0, + 1693, 1694, 0, 0, 0, 1685, 0, 0, 0, 0, + 0, 0, 0, 1691, 0, 1687, 1695, 0, 1692, 0, + 0, 0, 1688, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1689, 0, 0, 0, 0, 0, 0, 0, + 0, 1693, 1694, 0, 0, 1690, 0, 0, 0, 1689, + 0, 0, 0, 0, 0, 0, 1696, 1695, 0, 1697, + 0, 0, 1691, 0, 0, 0, 0, 1692, 0, 0, + 0, 0, 0, 1698, 0, 0, 1699, 1701, 0, 0, + 1702, 1703, 1704, 0, 1705, 1706, 1707, 1708, 1709, 1710, + 1693, 1694, 0, 1690, 3460, 0, 0, 1696, 0, 0, + 1697, 0, 0, 0, 0, 0, 1695, 0, 0, 0, + 1691, 0, 0, 0, 1698, 1692, 0, 1699, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1693, 1694, + 0, 0, 0, 0, 0, 0, 1696, 1690, 0, 1697, + 0, 0, 0, 0, 1695, 0, 0, 0, 0, 0, + 0, 0, 0, 1698, 1691, 0, 1699, 0, 0, 1692, + 0, 0, 0, 0, 0, 0, 1700, 1676, 0, 0, + 1677, 0, 0, 0, 1678, 1679, 1680, 1681, 0, 1682, + 1683, 1684, 1693, 1694, 1696, 0, 0, 1697, 0, 0, + 0, 0, 0, 0, 0, 0, 1685, 0, 1695, 0, + 0, 1698, 0, 0, 1699, 0, 1687, 1700, 0, 0, + 0, 0, 0, 1688, 0, 0, 0, 0, 1676, 0, + 0, 1677, 0, 0, 0, 1678, 1679, 1680, 1681, 0, + 1682, 1683, 1684, 0, 0, 0, 0, 0, 1696, 0, + 1689, 1697, 0, 0, 0, 0, 0, 1685, 0, 0, + 0, 0, 0, 0, 0, 1698, 1700, 1687, 1699, 0, + 0, 0, 0, 0, 1688, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1701, 0, 0, 1702, 1703, 1704, 0, 1705, 1706, 1707, 1708, 1709, - 1710, 0, 0, 0, 0, 0, 1701, 0, 0, 1702, - 1703, 1704, 0, 1705, 1706, 1707, 1708, 1709, 1710, 0, - 0, 0, 0, 0, 1700, 0, 1676, 0, 0, 1677, - 0, 0, 0, 1678, 1679, 1680, 1681, 0, 1682, 1683, - 1684, 1701, 0, 0, 1702, 1703, 1704, 0, 1705, 1706, - 1707, 1708, 1709, 1710, 0, 1685, 0, 0, 0, 1701, - 1690, 0, 1702, 1703, 1704, 1687, 1705, 1706, 1707, 1708, - 1709, 1710, 1688, 0, 0, 0, 0, 1691, 1676, 0, - 0, 1677, 1692, 0, 0, 1678, 1679, 1680, 1681, 0, - 1682, 1683, 1684, 0, 0, 0, 0, 0, 0, 1689, - 0, 0, 0, 0, 0, 1693, 1694, 1685, 0, 0, - 0, 2028, 0, 0, 0, 0, 0, 1687, 0, 0, - 0, 1695, 0, 0, 1688, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1701, 0, 0, 1702, - 1703, 1704, 0, 1705, 1706, 1707, 1708, 1709, 1710, 0, - 0, 1689, 0, 0, 0, 0, 0, 0, 0, 1676, - 0, 1696, 1677, 0, 1697, 0, 1678, 1679, 1680, 1681, - 0, 1682, 1683, 1684, 0, 0, 0, 0, 1698, 0, - 0, 1699, 0, 0, 0, 0, 0, 0, 1685, 0, - 0, 0, 2026, 0, 0, 0, 0, 1690, 1687, 0, - 0, 0, 0, 0, 0, 1688, 0, 0, 0, 0, - 0, 0, 0, 0, 1691, 0, 0, 0, 0, 1692, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1689, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1693, 1694, 0, 0, 0, 0, 0, 1690, - 0, 0, 0, 0, 0, 0, 0, 0, 1695, 0, - 0, 0, 0, 0, 0, 0, 1691, 0, 0, 0, - 0, 1692, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1700, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1693, 1694, 0, 0, 1696, 0, - 0, 1697, 0, 0, 0, 0, 0, 0, 0, 0, - 1695, 0, 0, 0, 0, 1698, 0, 0, 1699, 0, - 2164, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1690, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1691, 0, 0, - 1696, 0, 1692, 1697, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1698, 0, 0, - 1699, 0, 0, 0, 0, 1693, 1694, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1695, 0, 1701, 0, 0, 1702, 1703, 1704, 0, - 1705, 1706, 1707, 1708, 1709, 1710, 0, 0, 0, 0, - 0, 0, 0, 1676, 0, 0, 1677, 0, 1700, 0, - 1678, 1679, 1680, 1681, 2637, 1682, 1683, 1684, 0, 0, - 0, 1696, 0, 0, 1697, 0, 0, 0, 0, 0, - 0, 0, 1685, 0, 0, 0, 0, 0, 1698, 0, - 0, 1699, 1687, 0, 0, 0, 0, 0, 0, 1688, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1700, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1689, 0, 0, 0, - 1676, 0, 0, 1677, 0, 0, 0, 1678, 1679, 1680, - 1681, 0, 1682, 1683, 1684, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1685, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1687, - 1701, 0, 0, 1702, 1703, 1704, 1688, 1705, 1706, 1707, - 1708, 1709, 1710, 0, 0, 0, 0, 0, 0, 0, - 0, 1700, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1689, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1701, 0, 1690, 1702, 1703, 1704, 0, 1705, - 1706, 1707, 1708, 1709, 1710, 0, 0, 0, 0, 0, - 0, 1691, 0, 0, 1676, 0, 1692, 1677, 0, 0, - 0, 1678, 1679, 1680, 1681, 0, 1682, 1683, 1684, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1693, - 1694, 0, 0, 1685, 0, 0, 0, 2968, 0, 0, - 0, 0, 0, 1687, 0, 1695, 0, 0, 0, 0, - 1688, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1690, 0, 1701, 0, 0, 1702, 1703, 1704, 0, - 1705, 1706, 1707, 1708, 1709, 1710, 0, 1689, 1691, 0, - 0, 0, 0, 1692, 1676, 1696, 0, 1677, 1697, 0, - 0, 1678, 1679, 1680, 1681, 0, 1682, 1683, 1684, 0, - 0, 0, 1698, 0, 0, 1699, 1693, 1694, 0, 0, - 0, 0, 0, 1685, 0, 0, 0, 0, 0, 0, - 0, 0, 1695, 1687, 0, 0, 0, 0, 0, 0, - 1688, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1689, 0, 0, - 0, 0, 1696, 0, 0, 1697, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1690, 0, 0, 0, 1698, - 0, 0, 1699, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1691, 0, 0, 0, 0, 1692, 0, 0, - 0, 0, 0, 0, 0, 1700, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1693, 1694, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1695, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1690, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1691, 0, 0, 0, 1696, 1692, 0, 1697, - 0, 0, 1700, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1698, 0, 0, 1699, 0, 0, 0, - 1693, 1694, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1695, 1701, 2952, 0, - 1702, 1703, 1704, 0, 1705, 1706, 1707, 1708, 1709, 1710, - 0, 0, 0, 0, 0, 1676, 0, 0, 1677, 0, - 0, 0, 1678, 1679, 1680, 1681, 0, 1682, 1683, 1684, - 0, 0, 0, 0, 0, 0, 1696, 0, 0, 1697, - 0, 0, 0, 0, 1685, 0, 0, 0, 0, 0, - 0, 0, 0, 1698, 1687, 0, 1699, 0, 0, 0, - 0, 1688, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1701, 0, 1700, 1702, 1703, 1704, - 0, 1705, 1706, 1707, 1708, 1709, 1710, 0, 1689, 0, - 0, 0, 0, 1676, 0, 0, 1677, 0, 0, 0, - 1678, 1679, 1680, 1681, 0, 1682, 1683, 1684, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1685, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1687, 0, 0, 0, 0, 0, 0, 1688, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1700, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1689, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1690, 0, 1701, 0, - 0, 1702, 1703, 1704, 0, 1705, 1706, 1707, 1708, 1709, - 1710, 0, 0, 1691, 0, 0, 0, 0, 1692, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1889, 1694, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1695, 0, 0, + 1710, 1689, 0, 0, 0, 3614, 0, 0, 0, 0, + 0, 0, 0, 0, 1700, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1701, + 0, 0, 1702, 1703, 1704, 0, 1705, 1706, 1707, 1708, + 1709, 1710, 0, 0, 0, 0, 3677, 0, 1690, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1690, 0, 0, 0, 1701, 0, + 0, 0, 0, 0, 0, 1691, 0, 0, 1700, 0, + 1692, 0, 0, 0, 0, 0, 0, 0, 1701, 0, 0, 1702, 1703, 1704, 0, 1705, 1706, 1707, 1708, 1709, - 1710, 1691, 0, 0, 0, 0, 1692, 1696, 0, 0, - 1697, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1698, 0, 0, 1699, 0, 1693, - 1694, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1695, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1696, 0, 0, 1697, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1698, 0, 0, 1699, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1700, 0, 0, + 1710, 0, 0, 1693, 1694, 3703, 0, 0, 0, 1690, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1695, + 0, 0, 0, 0, 0, 0, 1691, 0, 0, 0, + 0, 1692, 0, 0, 0, 0, 1701, 0, 0, 1702, + 1703, 1704, 0, 1705, 1706, 1707, 1708, 1709, 1710, 0, + 0, 1876, 0, 0, 1693, 1694, 0, 0, 0, 1696, + 0, 0, 1697, 0, 0, 0, 0, 0, 0, 0, + 1695, 0, 0, 0, 0, 0, 1698, 0, 0, 1699, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1701, 0, 0, 1702, 1703, 1704, 0, 1705, 1706, 1707, + 1708, 1709, 1710, 0, 0, 2996, 0, 0, 0, 0, + 1696, 0, 0, 1697, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1698, 0, 0, + 1699, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1700, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1700, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1701, - 0, 0, 1702, 1703, 1704, 0, 1705, 1706, 1707, 1708, - 1709, 1710, 0, 0, 0, 0, 0, 0, 0, 0, + 1700, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 570, 0, 2188, 0, 0, 0, 0, 1701, 0, 0, - 1702, 1703, 1704, 0, 1705, 1706, 1707, 1708, 2293, 1710, - 122, 123, 124, 125, 126, 127, 128, 129, 571, 130, - 131, 132, 572, 573, 574, 575, 576, 577, 578, 579, - 580, 134, 135, 581, 582, 137, 138, 583, 140, 141, - 142, 584, 585, 586, 587, 588, 589, 590, 148, 149, - 150, 151, 152, 591, 592, 153, 154, 155, 156, 593, - 594, 159, 595, 160, 161, 162, 163, 596, 597, 598, - 599, 600, 167, 168, 169, 170, 171, 601, 173, 174, - 175, 602, 176, 177, 178, 179, 180, 181, 603, 604, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 606, 194, 195, 607, 197, 608, 198, 609, 199, 200, - 201, 202, 203, 204, 610, 611, 205, 206, 207, 208, - 612, 613, 209, 210, 211, 212, 213, 614, 214, 215, - 216, 615, 217, 218, 219, 220, 616, 221, 222, 223, - 224, 617, 226, 227, 228, 229, 230, 231, 618, 619, - 233, 620, 234, 235, 621, 237, 622, 238, 623, 239, - 624, 625, 626, 242, 243, 627, 628, 246, 247, 248, - 629, 630, 631, 251, 252, 632, 253, 254, 255, 256, - 257, 258, 259, 633, 261, 262, 263, 264, 634, 265, - 266, 267, 268, 269, 270, 271, 635, 272, 636, 637, - 275, 276, 277, 278, 279, 638, 639, 640, 641, 642, - 283, 643, 644, 286, 645, 288, 289, 290, 646, 291, - 292, 293, 647, 648, 294, 649, 296, 650, 651, 298, - 299, 300, 301, 302, 303, 304, 305, 652, 307, 308, - 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, - 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, - 653, 654, 655, 332, 333, 334, 656, 657, 336, 337, - 658, 339, 659, 660, 341, 661, 343, 344, 345, 662, - 346, 347, 663, 664, 348, 349, 350, 665, 666, 351, - 352, 667, 668, 355, 669, 670, 358, 359, 360, 361, - 362, 363, 364, 365, 366, 367, 368, 369, 671, 672, - 673, 674, 370, 371, 675, 676, 374, 375, 677, 377, - 378, 379, 678, 380, 381, 382, 383, 384, 385, 679, - 386, 387, 388, 389, 390, 680, 392, 393, 394, 395, - 681, 396, 397, 398, 399, 400, 401, 402, 403, 404, - 405, 406, 407, 408, 682, 409, 410, 683, 412, 413, - 414, 684, 416, 417, 418, 419, 420, 421, 422, 423, - 424, 425, 426, 427, 428, 685, 686, 429, 430, 431, - 432, 433, 434, 687, 436, 437, 688, 689, 439, 440, - 690, 442, 691, 443, 444, 445, 446, 447, 448, 449, - 450, 451, 452, 453, 454, 455, 456, 692, 458, 693, - 694, 695, 460, 461, 696, 462, 697, 464, 465, 466, - 467, 468, 469, 698, 470, 699, 700, 701, 702, 473, - 474, 703, 476, 704, 705, 478, 479, 706, 481, 482, - 483, 484, 485, 707, 708, 486, 487, 488, 709, 710, - 489, 490, 491, 492, 711, 493, 494, 495, 496, 497, - 712, 713, 500, 714, 501, 715, 503, 504, 505, 506, - 507, 508, 509, 716, 717, 510, 718, 719, 511, 512, - 513, 514, 515, 516, 720, 721, 722, 723, 724, 725, - 726, 727, 728, 729, 730, 528, 529, 530, 531, 570, + 0, 1701, 0, 0, 1702, 1703, 1704, 0, 1705, 1706, + 1707, 1708, 1709, 1710, 0, 0, 3422, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, - 123, 124, 125, 126, 127, 128, 129, 571, 130, 131, - 132, 572, 573, 574, 575, 576, 577, 578, 579, 580, - 134, 135, 581, 582, 137, 138, 583, 140, 141, 142, - 584, 585, 586, 587, 588, 589, 590, 148, 149, 150, - 151, 152, 591, 592, 153, 154, 155, 156, 593, 594, - 159, 595, 160, 161, 162, 163, 596, 597, 598, 599, - 600, 167, 168, 169, 170, 171, 601, 173, 174, 175, - 602, 176, 177, 178, 179, 180, 181, 603, 604, 183, - 184, 185, 186, 187, 188, 605, 190, 191, 192, 606, - 194, 195, 607, 197, 608, 198, 609, 199, 200, 201, - 202, 203, 204, 610, 611, 205, 206, 207, 208, 612, - 613, 209, 210, 211, 212, 213, 614, 214, 215, 216, - 615, 217, 218, 219, 220, 616, 221, 222, 223, 224, - 617, 226, 227, 228, 229, 230, 231, 618, 619, 233, - 620, 234, 235, 621, 237, 622, 238, 623, 239, 624, - 625, 626, 242, 243, 627, 628, 246, 247, 248, 629, - 630, 631, 251, 252, 632, 253, 254, 255, 256, 257, - 258, 259, 633, 261, 262, 263, 264, 634, 265, 266, - 267, 268, 269, 270, 271, 635, 272, 636, 637, 275, - 276, 277, 278, 279, 638, 639, 640, 641, 642, 283, - 643, 644, 286, 645, 288, 289, 290, 646, 291, 292, - 293, 647, 648, 294, 649, 296, 650, 651, 298, 299, - 300, 301, 302, 303, 304, 305, 652, 307, 308, 309, - 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, - 320, 321, 322, 323, 324, 325, 326, 327, 328, 653, - 654, 655, 332, 333, 334, 656, 657, 336, 337, 658, - 339, 659, 660, 341, 661, 343, 344, 345, 662, 346, - 347, 663, 664, 348, 349, 350, 665, 666, 351, 352, - 667, 668, 355, 669, 670, 358, 359, 360, 361, 362, - 363, 364, 365, 366, 367, 368, 369, 671, 672, 673, - 674, 370, 371, 675, 676, 374, 375, 677, 377, 378, - 379, 678, 380, 381, 382, 383, 384, 385, 679, 386, - 387, 388, 389, 390, 680, 392, 393, 394, 395, 681, - 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, - 406, 407, 408, 682, 409, 410, 683, 412, 413, 414, - 684, 416, 417, 418, 419, 420, 421, 422, 423, 424, - 425, 426, 427, 428, 685, 686, 429, 430, 431, 432, - 433, 434, 687, 436, 437, 688, 689, 439, 440, 690, - 442, 691, 443, 444, 445, 446, 447, 448, 449, 450, - 451, 452, 453, 454, 455, 456, 692, 458, 693, 694, - 695, 460, 461, 696, 462, 697, 464, 465, 466, 467, - 468, 469, 698, 470, 699, 700, 701, 702, 473, 474, - 703, 476, 704, 705, 478, 479, 706, 481, 482, 483, - 484, 485, 707, 708, 486, 487, 488, 709, 710, 489, - 490, 491, 492, 711, 493, 494, 495, 496, 497, 712, - 713, 500, 714, 501, 715, 503, 504, 505, 506, 507, - 508, 509, 716, 717, 510, 718, 719, 511, 512, 513, - 514, 515, 516, 720, 721, 722, 723, 724, 725, 726, - 727, 728, 729, 730, 528, 529, 530, 531, 570, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, + 0, 0, 0, 0, 0, 0, 0, 0, 570, 0, + 0, 0, 1701, 0, 0, 1702, 1703, 1704, 0, 1705, + 1706, 1707, 1708, 1709, 1710, 0, 0, 3657, 122, 123, 124, 125, 126, 127, 128, 129, 571, 130, 131, 132, 572, 573, 574, 575, 576, 577, 578, 579, 580, 134, 135, 581, 582, 137, 138, 583, 140, 141, 142, 584, @@ -9624,7 +9107,7 @@ static const yytype_int16 yytable[] = 226, 227, 228, 229, 230, 231, 618, 619, 233, 620, 234, 235, 621, 237, 622, 238, 623, 239, 624, 625, 626, 242, 243, 627, 628, 246, 247, 248, 629, 630, - 631, 251, 252, 632, 253, 254, 255, 256, 257, 970, + 631, 251, 252, 632, 253, 254, 255, 256, 257, 258, 259, 633, 261, 262, 263, 264, 634, 265, 266, 267, 268, 269, 270, 271, 635, 272, 636, 637, 275, 276, 277, 278, 279, 638, 639, 640, 641, 642, 283, 643, @@ -9656,112 +9139,112 @@ static const yytype_int16 yytable[] = 500, 714, 501, 715, 503, 504, 505, 506, 507, 508, 509, 716, 717, 510, 718, 719, 511, 512, 513, 514, 515, 516, 720, 721, 722, 723, 724, 725, 726, 727, - 728, 729, 730, 528, 529, 530, 531, 570, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 728, 729, 730, 528, 529, 530, 531, 539, 0, 0, + 0, 0, 0, 0, 0, 0, 2172, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, - 125, 126, 127, 128, 129, 571, 130, 131, 132, 572, - 573, 574, 575, 576, 577, 578, 579, 580, 134, 135, - 581, 582, 137, 138, 583, 140, 141, 142, 584, 585, - 586, 587, 588, 589, 590, 148, 149, 150, 151, 152, - 591, 592, 153, 154, 155, 156, 593, 594, 159, 595, - 160, 161, 162, 163, 596, 597, 598, 599, 600, 167, - 168, 169, 170, 171, 601, 173, 174, 175, 602, 176, - 177, 178, 179, 180, 181, 603, 604, 183, 184, 185, - 186, 187, 188, 189, 190, 191, 192, 606, 194, 195, - 607, 197, 608, 198, 609, 199, 200, 201, 202, 203, - 204, 610, 611, 205, 206, 207, 208, 612, 613, 209, - 210, 211, 212, 213, 614, 214, 215, 216, 615, 217, - 218, 219, 220, 616, 221, 222, 223, 224, 617, 226, - 227, 228, 229, 230, 231, 618, 619, 233, 620, 234, - 235, 621, 237, 622, 238, 623, 239, 624, 625, 626, - 242, 243, 627, 628, 246, 247, 248, 629, 630, 631, - 251, 252, 632, 253, 254, 255, 256, 257, 258, 259, - 633, 261, 262, 263, 264, 634, 265, 266, 267, 268, - 269, 270, 271, 635, 272, 636, 637, 275, 276, 277, - 278, 279, 638, 639, 640, 641, 642, 283, 643, 644, - 286, 645, 288, 289, 290, 646, 291, 292, 293, 647, - 648, 294, 649, 296, 650, 651, 298, 299, 300, 301, - 302, 303, 304, 305, 652, 307, 308, 309, 310, 311, + 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 134, 135, + 0, 0, 137, 138, 0, 140, 141, 142, 143, 144, + 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, + 0, 0, 153, 154, 155, 156, 157, 158, 159, 0, + 160, 161, 162, 163, 164, 0, 0, 0, 166, 167, + 168, 169, 170, 171, 0, 173, 174, 175, 0, 176, + 177, 178, 179, 180, 181, 0, 0, 183, 184, 185, + 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, + 196, 197, 0, 198, 0, 199, 200, 201, 202, 203, + 204, 0, 0, 205, 206, 207, 208, 0, 0, 209, + 210, 211, 212, 213, 0, 214, 215, 216, 0, 217, + 218, 219, 220, 0, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 0, 233, 0, 234, + 235, 236, 237, 0, 238, 0, 239, 0, 0, 0, + 242, 243, 540, 0, 246, 247, 248, 0, 249, 250, + 251, 252, 0, 253, 254, 255, 256, 257, 258, 259, + 0, 261, 262, 263, 264, 0, 265, 266, 267, 268, + 269, 270, 271, 0, 272, 0, 274, 275, 276, 277, + 278, 279, 280, 281, 0, 282, 0, 283, 0, 0, + 286, 0, 288, 289, 290, 0, 291, 292, 293, 0, + 0, 294, 0, 296, 0, 0, 298, 299, 300, 301, + 302, 303, 304, 305, 541, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, - 322, 323, 324, 325, 326, 327, 328, 653, 654, 655, - 332, 333, 334, 656, 657, 336, 337, 658, 339, 659, - 660, 341, 661, 343, 344, 345, 662, 346, 347, 663, - 664, 348, 349, 350, 665, 666, 351, 352, 667, 668, - 355, 669, 670, 358, 359, 360, 361, 362, 363, 364, - 365, 366, 367, 368, 369, 671, 672, 673, 674, 370, - 371, 675, 676, 374, 375, 677, 377, 378, 379, 678, - 380, 381, 382, 383, 384, 385, 679, 386, 387, 388, - 389, 390, 680, 392, 393, 394, 395, 681, 396, 397, + 322, 323, 324, 325, 326, 327, 328, 329, 0, 331, + 332, 333, 334, 335, 0, 336, 337, 0, 339, 0, + 340, 341, 342, 343, 344, 345, 0, 346, 347, 0, + 0, 348, 349, 350, 0, 0, 351, 352, 353, 0, + 355, 0, 357, 358, 359, 360, 361, 362, 363, 364, + 365, 366, 367, 368, 369, 0, 0, 0, 0, 370, + 371, 372, 0, 374, 375, 376, 377, 378, 379, 0, + 380, 381, 382, 383, 384, 385, 0, 386, 387, 388, + 389, 390, 391, 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, - 408, 682, 409, 410, 683, 412, 413, 414, 684, 416, + 408, 0, 409, 410, 0, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, - 427, 428, 685, 686, 429, 430, 431, 432, 433, 434, - 687, 436, 437, 688, 689, 439, 440, 690, 442, 691, - 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, - 453, 454, 455, 456, 692, 458, 693, 694, 695, 460, - 461, 696, 462, 697, 464, 465, 466, 467, 468, 469, - 698, 470, 699, 700, 701, 702, 473, 474, 703, 476, - 704, 705, 478, 479, 706, 481, 482, 483, 484, 485, - 707, 708, 486, 487, 488, 709, 710, 489, 490, 491, - 492, 711, 493, 494, 495, 496, 497, 712, 713, 500, - 714, 501, 715, 503, 504, 505, 506, 507, 508, 509, - 716, 717, 510, 718, 719, 511, 512, 513, 514, 515, - 516, 720, 721, 722, 723, 724, 725, 726, 727, 728, - 729, 730, 528, 529, 530, 531, 570, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 427, 428, 0, 0, 429, 430, 431, 432, 433, 434, + 435, 436, 437, 0, 0, 439, 440, 441, 442, 0, + 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, + 453, 454, 455, 456, 542, 458, 459, 0, 0, 460, + 461, 0, 462, 0, 464, 465, 466, 467, 468, 469, + 0, 470, 471, 472, 0, 0, 473, 474, 475, 476, + 477, 0, 478, 479, 480, 481, 482, 483, 484, 485, + 0, 0, 486, 487, 488, 0, 0, 489, 490, 491, + 492, 0, 493, 494, 495, 496, 497, 498, 499, 500, + 0, 501, 0, 503, 504, 505, 506, 507, 508, 509, + 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, + 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, + 526, 527, 528, 529, 530, 531, 539, 0, 0, 0, + 0, 0, 0, 0, 0, 2888, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, - 2349, 127, 128, 129, 571, 130, 131, 132, 572, 573, - 574, 575, 576, 577, 578, 579, 580, 134, 135, 581, - 582, 137, 138, 583, 140, 141, 142, 584, 585, 586, - 587, 588, 589, 590, 148, 149, 150, 151, 152, 591, - 592, 153, 154, 155, 156, 593, 594, 159, 595, 160, - 161, 162, 163, 596, 597, 598, 599, 600, 167, 168, - 169, 170, 171, 601, 173, 174, 175, 602, 176, 177, - 178, 179, 180, 181, 603, 604, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 192, 606, 194, 195, 607, - 197, 608, 198, 609, 199, 200, 201, 202, 203, 204, - 610, 611, 205, 206, 207, 208, 612, 613, 209, 210, - 211, 2350, 213, 614, 214, 215, 216, 615, 217, 218, - 219, 220, 616, 221, 222, 223, 224, 617, 226, 227, - 228, 229, 230, 231, 618, 619, 233, 620, 234, 235, - 621, 237, 622, 238, 623, 239, 624, 625, 626, 242, - 243, 627, 628, 246, 247, 248, 629, 630, 631, 251, - 252, 632, 253, 254, 255, 256, 257, 258, 259, 633, - 261, 262, 263, 264, 634, 265, 266, 267, 268, 269, - 270, 271, 635, 272, 636, 637, 275, 276, 277, 278, - 279, 638, 639, 640, 641, 642, 283, 643, 644, 286, - 645, 288, 289, 290, 646, 291, 292, 293, 647, 648, - 294, 649, 296, 650, 651, 298, 299, 300, 301, 302, - 303, 304, 305, 652, 307, 308, 309, 310, 311, 312, + 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 134, 135, 0, + 0, 137, 138, 0, 140, 141, 142, 143, 144, 0, + 146, 147, 0, 0, 148, 149, 150, 151, 152, 0, + 0, 153, 154, 155, 156, 157, 158, 159, 0, 160, + 161, 162, 163, 164, 0, 0, 0, 166, 167, 168, + 169, 170, 171, 0, 173, 174, 175, 0, 176, 177, + 178, 179, 180, 181, 0, 0, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 0, 198, 0, 199, 200, 201, 202, 203, 204, + 0, 0, 205, 206, 207, 208, 0, 0, 209, 210, + 211, 212, 213, 0, 214, 215, 216, 0, 217, 218, + 219, 220, 0, 221, 222, 223, 224, 225, 226, 227, + 228, 229, 230, 231, 232, 0, 233, 0, 234, 235, + 236, 237, 0, 238, 0, 239, 0, 0, 0, 242, + 243, 540, 0, 246, 247, 248, 0, 249, 250, 251, + 252, 0, 253, 254, 255, 256, 257, 258, 259, 0, + 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, + 270, 271, 0, 272, 0, 274, 275, 276, 277, 278, + 279, 280, 281, 0, 282, 0, 283, 0, 0, 286, + 0, 288, 289, 290, 0, 291, 292, 293, 0, 0, + 294, 0, 296, 0, 0, 298, 299, 300, 301, 302, + 303, 304, 305, 541, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 325, 326, 327, 328, 653, 654, 655, 332, - 333, 334, 656, 657, 336, 337, 658, 339, 659, 660, - 341, 661, 343, 344, 345, 662, 346, 347, 663, 664, - 348, 349, 350, 665, 666, 351, 352, 667, 668, 355, - 669, 670, 358, 359, 360, 361, 362, 363, 364, 365, - 366, 367, 368, 369, 671, 672, 673, 674, 370, 371, - 675, 676, 374, 375, 677, 377, 378, 379, 678, 380, - 381, 382, 383, 384, 385, 679, 386, 387, 388, 389, - 390, 680, 392, 393, 394, 395, 681, 396, 397, 398, + 323, 324, 325, 326, 327, 328, 329, 0, 331, 332, + 333, 334, 335, 0, 336, 337, 0, 339, 0, 340, + 341, 342, 343, 344, 345, 0, 346, 347, 0, 0, + 348, 349, 350, 0, 0, 351, 352, 353, 0, 355, + 0, 357, 358, 359, 360, 361, 362, 363, 364, 365, + 366, 367, 368, 369, 0, 0, 0, 0, 370, 371, + 372, 0, 374, 375, 376, 377, 378, 379, 0, 380, + 381, 382, 383, 384, 385, 0, 386, 387, 388, 389, + 390, 391, 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, - 682, 409, 410, 683, 412, 413, 414, 684, 416, 417, + 0, 409, 410, 0, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, - 428, 685, 686, 429, 430, 431, 432, 433, 2351, 687, - 436, 437, 688, 689, 439, 440, 690, 442, 691, 443, + 428, 0, 0, 429, 430, 431, 432, 433, 434, 435, + 436, 437, 0, 0, 439, 440, 441, 442, 0, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, - 454, 455, 456, 692, 458, 693, 694, 695, 460, 461, - 696, 462, 697, 464, 465, 466, 467, 468, 469, 698, - 470, 699, 700, 701, 702, 473, 474, 703, 476, 704, - 705, 478, 479, 706, 481, 482, 483, 484, 485, 707, - 708, 486, 487, 488, 709, 710, 489, 490, 491, 492, - 711, 493, 494, 495, 496, 497, 712, 713, 500, 714, - 501, 715, 503, 504, 505, 506, 507, 508, 509, 716, - 717, 510, 718, 719, 511, 512, 513, 514, 515, 516, - 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, - 730, 528, 529, 530, 531, 994, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 454, 455, 456, 542, 458, 459, 0, 0, 460, 461, + 0, 462, 0, 464, 465, 466, 467, 468, 469, 0, + 470, 471, 472, 0, 0, 473, 474, 475, 476, 477, + 0, 478, 479, 480, 481, 482, 483, 484, 485, 0, + 0, 486, 487, 488, 0, 0, 489, 490, 491, 492, + 0, 493, 494, 495, 496, 497, 498, 499, 500, 0, + 501, 0, 503, 504, 505, 506, 507, 508, 509, 0, + 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, + 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, + 527, 528, 529, 530, 531, 994, 1395, 836, 0, 0, + 0, 1080, 0, 0, 2891, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, - 127, 128, 129, 0, 130, 131, 132, 3, 4, 0, + 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 575, 0, 0, 0, 0, 580, 134, 135, 0, 582, 137, 138, 583, 140, 141, 142, 584, 585, 586, 587, 588, 0, 590, 148, 149, 150, 151, 152, 0, 0, @@ -9774,7 +9257,7 @@ static const yytype_int16 yytable[] = 0, 205, 206, 207, 208, 0, 0, 209, 210, 211, 212, 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, 0, 221, 222, 223, 224, 617, 226, 227, 228, - 229, 230, 231, 618, 0, 233, 0, 234, 235, 621, + 229, 230, 231, 618, 1396, 233, 0, 234, 235, 621, 237, 0, 238, 0, 239, 624, 0, 626, 242, 243, 627, 628, 246, 247, 248, 0, 630, 631, 251, 252, 0, 253, 254, 255, 256, 257, 258, 259, 633, 261, @@ -9787,7 +9270,7 @@ static const yytype_int16 yytable[] = 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 653, 654, 655, 332, 333, 334, 656, 0, 336, 337, 658, 339, 0, 660, 341, - 661, 343, 344, 345, 0, 346, 347, 0, 0, 348, + 661, 343, 344, 345, 0, 346, 347, 1397, 0, 348, 349, 350, 0, 0, 351, 352, 667, 668, 355, 669, 670, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 0, 0, 0, 0, 370, 371, 675, @@ -9802,494 +9285,762 @@ static const yytype_int16 yytable[] = 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 692, 458, 693, 0, 0, 460, 461, 0, 462, 697, 464, 465, 466, 467, 468, 469, 0, 470, - 699, 700, 0, 0, 473, 474, 703, 476, 704, 0, + 699, 700, 0, 0, 473, 474, 703, 476, 704, 1398, 478, 479, 706, 481, 482, 483, 484, 485, 0, 0, 486, 487, 488, 709, 0, 489, 490, 491, 492, 0, 493, 494, 495, 496, 497, 712, 713, 500, 0, 501, 715, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, - 528, 529, 530, 531, 121, 0, 0, 0, 0, 0, + 528, 529, 530, 531, 0, 0, 1676, 0, 0, 1677, + 0, 1399, 1400, 1678, 1679, 1680, 1681, 0, 1682, 1683, + 1684, 0, 0, 0, 1676, 0, 0, 1677, 0, 0, + 0, 1678, 1679, 1680, 1681, 1685, 1682, 1683, 1684, 0, + 2272, 0, 0, 0, 0, 1687, 0, 0, 0, 0, + 0, 0, 1688, 1685, 0, 0, 0, 0, 0, 1676, + 0, 0, 1677, 1687, 0, 0, 1678, 1679, 1680, 1681, + 1688, 1682, 1683, 1684, 0, 0, 0, 1676, 0, 1689, + 1677, 0, 0, 0, 1678, 1679, 1680, 1681, 1685, 1682, + 1683, 1684, 0, 0, 0, 0, 0, 1689, 1687, 0, + 0, 0, 0, 0, 0, 1688, 1685, 0, 0, 0, + 1979, 0, 0, 0, 0, 0, 1687, 0, 0, 0, + 0, 0, 0, 1688, 0, 2273, 0, 0, 0, 0, + 0, 0, 1689, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, - 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, - 0, 0, 0, 0, 133, 134, 135, 0, 136, 137, - 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, - 0, 0, 148, 149, 150, 151, 152, 0, 805, 153, - 154, 155, 156, 157, 158, 159, 0, 160, 161, 162, - 163, 806, 0, 807, 0, 166, 167, 168, 169, 170, - 171, 172, 173, 174, 175, 0, 176, 177, 178, 179, - 180, 181, 0, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 193, 194, 195, 196, 197, 0, - 198, 0, 199, 200, 201, 202, 203, 204, 0, 0, - 205, 206, 207, 208, 0, 0, 209, 210, 211, 212, - 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, - 0, 221, 222, 223, 224, 225, 226, 227, 228, 229, - 230, 231, 808, 0, 233, 0, 234, 235, 236, 237, - 0, 238, 0, 239, 240, 0, 241, 242, 243, 244, - 245, 246, 247, 248, 0, 249, 250, 251, 252, 0, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, - 0, 272, 273, 274, 275, 276, 277, 278, 279, 280, - 281, 0, 282, 0, 283, 284, 285, 286, 287, 288, - 289, 290, 0, 291, 292, 293, 0, 0, 294, 295, - 296, 297, 0, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, - 335, 0, 336, 337, 338, 339, 0, 810, 341, 342, - 343, 344, 345, 0, 346, 347, 0, 0, 348, 349, - 350, 0, 0, 351, 352, 353, 354, 355, 356, 812, - 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, - 368, 369, 0, 0, 0, 0, 370, 371, 813, 373, - 374, 375, 376, 377, 378, 379, 0, 380, 381, 382, - 383, 384, 385, 0, 386, 387, 388, 389, 390, 391, - 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, - 401, 402, 403, 404, 405, 406, 407, 408, 0, 409, - 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, - 420, 421, 422, 423, 424, 425, 426, 427, 428, 0, - 0, 429, 430, 431, 432, 433, 434, 435, 436, 437, - 0, 438, 439, 440, 441, 442, 0, 443, 444, 445, - 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, - 456, 457, 458, 815, 0, 0, 460, 461, 0, 462, - 463, 464, 465, 466, 467, 468, 469, 0, 470, 471, - 472, 0, 0, 473, 474, 816, 476, 817, 0, 478, - 479, 818, 481, 482, 483, 484, 485, 0, 0, 486, - 487, 488, 0, 0, 489, 490, 491, 492, 0, 493, - 494, 495, 496, 497, 498, 499, 500, 0, 501, 502, - 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, - 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, - 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, - 529, 530, 531, 121, 0, 0, 0, 0, 0, 0, + 1689, 0, 0, 0, 1676, 0, 0, 1677, 0, 0, + 0, 1678, 1679, 1680, 1681, 0, 1682, 1683, 1684, 0, + 0, 0, 0, 0, 0, 0, 0, 1690, 0, 0, + 0, 0, 0, 1685, 0, 2015, 0, 0, 0, 0, + 2016, 0, 0, 1687, 1691, 1690, 0, 0, 0, 1692, + 1688, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1691, 0, 0, 0, 0, 1692, 0, 3796, + 0, 0, 1693, 1694, 0, 0, 0, 1689, 0, 0, + 1690, 0, 0, 0, 0, 0, 0, 0, 1695, 0, + 1693, 1694, 0, 0, 0, 0, 0, 1691, 1690, 0, + 0, 0, 1692, 0, 0, 0, 1695, 0, 0, 0, + 0, 0, 0, 0, 0, 1691, 0, 0, 0, 0, + 1692, 0, 0, 0, 0, 1693, 1694, 0, 1696, 0, + 0, 1697, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1695, 0, 1693, 1694, 1698, 1696, 0, 1699, 1697, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1695, + 0, 0, 0, 1698, 0, 0, 1699, 0, 0, 0, + 0, 0, 0, 0, 0, 1690, 0, 0, 0, 0, + 0, 1696, 0, 0, 1697, 0, 0, 0, 0, 0, + 0, 0, 1691, 0, 0, 0, 0, 1692, 1698, 1696, + 0, 1699, 1697, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1698, 0, 0, 1699, + 1693, 1694, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 3797, 0, 0, 0, 0, 1695, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1700, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, - 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, - 0, 0, 0, 133, 134, 135, 0, 136, 137, 138, - 139, 140, 141, 142, 143, 144, 145, 146, 147, 0, - 0, 148, 149, 150, 151, 152, 0, 0, 153, 154, - 155, 156, 157, 158, 159, 0, 160, 161, 162, 163, - 164, 0, 165, 0, 166, 167, 168, 169, 170, 171, - 172, 173, 174, 175, 0, 176, 177, 178, 179, 180, - 181, 0, 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 0, 198, - 0, 199, 200, 201, 202, 203, 204, 0, 0, 205, - 206, 207, 208, 0, 0, 209, 210, 211, 212, 213, - 0, 214, 215, 216, 0, 217, 218, 219, 220, 0, - 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, - 231, 232, 0, 233, 0, 234, 235, 236, 237, 0, - 238, 0, 239, 240, 0, 241, 242, 243, 244, 245, - 246, 247, 248, 0, 249, 250, 251, 252, 0, 253, - 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, - 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, - 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, - 0, 282, 0, 283, 284, 285, 286, 287, 288, 289, - 290, 0, 291, 292, 293, 0, 0, 294, 295, 296, - 297, 0, 298, 299, 300, 301, 302, 303, 304, 305, - 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, - 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, - 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, - 0, 336, 337, 338, 339, 0, 340, 341, 342, 343, - 344, 345, 0, 346, 347, 0, 0, 348, 349, 350, - 0, 0, 351, 352, 353, 354, 355, 356, 357, 358, - 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, - 369, 0, 0, 0, 0, 370, 371, 372, 373, 374, - 375, 376, 377, 378, 379, 0, 380, 381, 382, 383, - 384, 385, 0, 386, 387, 388, 389, 390, 391, 392, - 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, - 402, 403, 404, 405, 406, 407, 408, 0, 409, 410, - 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, - 421, 422, 423, 424, 425, 426, 427, 428, 0, 0, - 429, 430, 431, 432, 433, 434, 435, 436, 437, 0, - 438, 439, 440, 441, 442, 0, 443, 444, 445, 446, - 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, - 457, 458, 459, 0, 0, 460, 461, 0, 462, 463, - 464, 465, 466, 467, 468, 469, 0, 470, 471, 472, - 0, 0, 473, 474, 475, 476, 477, 0, 478, 479, - 480, 481, 482, 483, 484, 485, 0, 0, 486, 487, - 488, 0, 0, 489, 490, 491, 492, 0, 493, 494, - 495, 496, 497, 498, 499, 500, 0, 501, 502, 503, - 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, - 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, - 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, - 530, 531, 539, 0, 0, 0, 0, 0, 0, 0, + 0, 1676, 0, 0, 1677, 0, 1700, 0, 1678, 1679, + 1680, 1681, 0, 1682, 1683, 1684, 1696, 0, 0, 1697, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, - 0, 130, 131, 132, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 134, 135, 0, 0, 137, 138, 0, - 140, 141, 142, 143, 144, 0, 146, 147, 0, 0, - 148, 149, 150, 151, 152, 0, 0, 153, 154, 155, - 156, 157, 158, 159, 1812, 160, 161, 162, 163, 164, - 0, 0, 1813, 166, 167, 168, 169, 170, 171, 0, - 173, 174, 175, 1814, 176, 177, 178, 179, 180, 181, - 0, 0, 183, 184, 185, 186, 187, 188, 189, 190, - 191, 192, 193, 194, 195, 196, 197, 0, 198, 0, - 199, 200, 201, 202, 203, 204, 0, 0, 205, 206, - 207, 208, 0, 0, 209, 210, 211, 212, 213, 0, - 214, 215, 216, 0, 217, 218, 219, 220, 0, 221, - 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, - 232, 0, 233, 0, 234, 235, 236, 237, 0, 238, - 1815, 239, 0, 0, 0, 242, 243, 540, 0, 246, - 247, 248, 0, 249, 250, 251, 252, 0, 253, 254, - 255, 256, 257, 1816, 259, 0, 261, 262, 263, 264, - 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, - 0, 274, 275, 276, 277, 278, 279, 280, 281, 0, - 282, 0, 283, 0, 0, 286, 0, 288, 289, 290, - 0, 291, 292, 293, 0, 0, 294, 0, 296, 0, - 0, 298, 299, 300, 301, 302, 303, 304, 305, 541, - 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, - 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, - 327, 328, 329, 0, 331, 332, 333, 334, 335, 0, - 336, 337, 0, 339, 0, 340, 341, 342, 343, 344, - 345, 0, 346, 347, 0, 0, 348, 349, 350, 0, - 0, 351, 352, 353, 0, 355, 0, 357, 358, 359, - 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, - 0, 0, 0, 0, 370, 371, 372, 0, 374, 375, - 376, 377, 378, 379, 1817, 380, 381, 382, 383, 384, - 385, 0, 386, 387, 388, 389, 390, 391, 392, 393, - 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, - 403, 404, 405, 406, 407, 408, 0, 409, 410, 0, - 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, - 422, 423, 424, 425, 426, 427, 428, 0, 0, 429, - 430, 431, 432, 433, 434, 435, 436, 437, 0, 0, - 439, 440, 441, 442, 0, 443, 444, 445, 446, 447, - 448, 449, 450, 451, 452, 453, 454, 455, 456, 542, - 458, 459, 0, 0, 460, 461, 0, 462, 0, 464, - 465, 466, 467, 468, 469, 0, 470, 471, 472, 0, - 0, 473, 474, 475, 476, 477, 0, 478, 479, 480, - 481, 482, 483, 484, 485, 0, 1818, 486, 487, 488, - 0, 0, 489, 490, 491, 492, 0, 493, 494, 495, - 496, 497, 498, 499, 500, 0, 501, 0, 503, 504, - 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, - 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, - 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, - 531, 539, 0, 0, 0, 0, 0, 0, 0, 0, + 1685, 0, 0, 1698, 2021, 0, 1699, 0, 0, 0, + 1687, 1700, 0, 0, 0, 0, 0, 1688, 0, 0, + 0, 0, 0, 0, 0, 2276, 0, 0, 0, 1700, + 1986, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1689, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, - 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 134, 135, 0, 0, 137, 138, 0, 140, - 141, 142, 143, 144, 0, 146, 147, 0, 0, 148, - 149, 150, 151, 152, 0, 0, 153, 154, 155, 156, - 157, 158, 159, 1812, 160, 161, 162, 163, 164, 0, - 0, 0, 166, 167, 168, 169, 170, 171, 0, 173, - 174, 175, 1814, 176, 177, 178, 179, 180, 181, 0, - 0, 183, 184, 185, 186, 187, 188, 189, 190, 191, - 192, 193, 194, 195, 196, 197, 0, 198, 0, 199, - 200, 201, 202, 203, 204, 0, 0, 205, 206, 207, - 208, 0, 0, 209, 210, 211, 212, 213, 0, 214, - 215, 216, 0, 217, 218, 219, 220, 0, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 0, 233, 0, 234, 235, 236, 237, 0, 238, 1815, - 239, 0, 0, 0, 242, 243, 540, 0, 246, 247, - 248, 0, 249, 250, 251, 252, 0, 253, 254, 255, - 256, 257, 258, 259, 0, 261, 262, 263, 264, 0, - 265, 266, 267, 268, 269, 270, 271, 0, 272, 0, - 274, 275, 276, 277, 278, 279, 280, 281, 0, 282, - 0, 283, 0, 0, 286, 0, 288, 289, 290, 0, - 291, 292, 293, 0, 0, 294, 0, 296, 2440, 0, - 298, 299, 300, 301, 302, 303, 304, 305, 541, 307, - 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, - 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, - 328, 329, 0, 331, 332, 333, 334, 335, 0, 336, - 337, 0, 339, 0, 340, 341, 342, 343, 344, 345, - 0, 346, 347, 0, 0, 348, 349, 350, 0, 0, - 351, 352, 353, 0, 355, 0, 357, 358, 359, 360, - 361, 362, 363, 364, 365, 366, 367, 368, 369, 0, - 0, 0, 0, 370, 371, 372, 0, 374, 375, 376, - 377, 378, 379, 1817, 380, 381, 382, 383, 384, 385, - 0, 386, 387, 388, 389, 390, 391, 392, 393, 394, - 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, - 404, 405, 406, 407, 408, 0, 409, 410, 0, 412, - 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, - 423, 424, 425, 426, 427, 428, 0, 0, 429, 430, - 431, 432, 433, 434, 435, 436, 437, 0, 0, 439, - 440, 441, 442, 0, 443, 444, 445, 446, 447, 448, - 449, 450, 451, 452, 453, 454, 455, 456, 542, 458, - 459, 0, 0, 460, 461, 0, 462, 0, 464, 465, - 466, 467, 468, 469, 0, 470, 471, 472, 0, 0, - 473, 474, 475, 476, 477, 0, 478, 479, 480, 481, - 482, 483, 484, 485, 0, 1818, 486, 487, 488, 0, - 0, 489, 490, 491, 492, 0, 493, 494, 495, 496, - 497, 498, 499, 500, 0, 501, 0, 503, 504, 505, - 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, - 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, - 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, - 1534, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, - 131, 132, 0, 0, 0, 1535, 0, 0, -864, 0, - 1536, 134, 135, 0, 1537, 137, 138, 1538, 140, 141, - 142, 0, 1539, 1540, 1541, 1542, 0, 1543, 148, 149, - 150, 151, 152, 0, 0, 153, 154, 155, 156, 1544, - 1545, 159, 0, 160, 161, 162, 163, 0, 0, 1546, - 0, 1547, 167, 168, 169, 170, 171, 1548, 173, 174, - 175, 0, 176, 177, 178, 179, 180, 181, 0, 1549, + 1701, 0, 0, 1702, 1703, 1704, 0, 1705, 1706, 1707, + 1708, 1709, 1710, 0, 0, 0, 0, 0, 1701, 0, + 0, 1702, 1703, 1704, 0, 1705, 1706, 1707, 1708, 1709, + 1710, 0, 0, 0, 0, 0, 1700, 0, 1676, 0, + 0, 1677, 0, 0, 0, 1678, 1679, 1680, 1681, 0, + 1682, 1683, 1684, 1701, 0, 0, 1702, 1703, 1704, 0, + 1705, 1706, 1707, 1708, 1709, 1710, 0, 1685, 0, 0, + 0, 1701, 1690, 0, 1702, 1703, 1704, 1687, 1705, 1706, + 1707, 1708, 1709, 1710, 1688, 0, 0, 0, 0, 1691, + 1676, 0, 0, 1677, 1692, 0, 0, 1678, 1679, 1680, + 1681, 0, 1682, 1683, 1684, 0, 0, 0, 0, 0, + 0, 1689, 0, 0, 0, 0, 0, 1693, 1694, 1685, + 0, 0, 0, 2028, 0, 0, 0, 0, 0, 1687, + 0, 0, 0, 1695, 0, 0, 1688, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1701, 0, + 0, 1702, 1703, 1704, 0, 1705, 1706, 1707, 1708, 1709, + 1710, 0, 0, 1689, 0, 0, 0, 0, 0, 0, + 0, 1676, 0, 1696, 1677, 0, 1697, 0, 1678, 1679, + 1680, 1681, 0, 1682, 1683, 1684, 0, 0, 0, 0, + 1698, 0, 0, 1699, 0, 0, 0, 0, 0, 0, + 1685, 0, 0, 0, 2026, 0, 0, 0, 0, 1690, + 1687, 0, 0, 0, 0, 0, 0, 1688, 0, 0, + 0, 0, 0, 0, 0, 0, 1691, 0, 0, 0, + 0, 1692, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1689, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1693, 1694, 0, 0, 0, 0, + 0, 1690, 0, 0, 0, 0, 0, 0, 0, 0, + 1695, 0, 0, 0, 0, 0, 0, 0, 1691, 0, + 0, 0, 0, 1692, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1700, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1693, 1694, 0, 0, + 1696, 0, 0, 1697, 0, 0, 0, 0, 0, 0, + 0, 0, 1695, 0, 0, 0, 0, 1698, 0, 0, + 1699, 0, 2164, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1690, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1691, + 0, 0, 1696, 0, 1692, 1697, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1698, + 0, 0, 1699, 0, 0, 0, 0, 1693, 1694, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1695, 0, 1701, 0, 0, 1702, 1703, + 1704, 0, 1705, 1706, 1707, 1708, 1709, 1710, 0, 0, + 0, 0, 0, 0, 0, 1676, 0, 0, 1677, 0, + 1700, 0, 1678, 1679, 1680, 1681, 2638, 1682, 1683, 1684, + 0, 0, 0, 1696, 0, 0, 1697, 0, 0, 0, + 0, 0, 0, 0, 1685, 0, 0, 0, 0, 0, + 1698, 0, 0, 1699, 1687, 0, 0, 0, 0, 0, + 0, 1688, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1700, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1689, 0, + 0, 0, 1676, 0, 0, 1677, 0, 0, 0, 1678, + 1679, 1680, 1681, 0, 1682, 1683, 1684, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1685, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1687, 1701, 0, 0, 1702, 1703, 1704, 1688, 1705, + 1706, 1707, 1708, 1709, 1710, 0, 0, 0, 0, 0, + 0, 0, 0, 1700, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1689, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1701, 0, 1690, 1702, 1703, 1704, + 0, 1705, 1706, 1707, 1708, 1709, 1710, 0, 0, 0, + 0, 0, 0, 1691, 0, 0, 1676, 0, 1692, 1677, + 0, 0, 0, 1678, 1679, 1680, 1681, 0, 1682, 1683, + 1684, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1693, 1694, 0, 0, 1685, 0, 0, 0, 2970, + 0, 0, 0, 0, 0, 1687, 0, 1695, 0, 0, + 0, 0, 1688, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1690, 0, 1701, 0, 0, 1702, 1703, + 1704, 0, 1705, 1706, 1707, 1708, 1709, 1710, 0, 1689, + 1691, 0, 0, 0, 0, 1692, 1676, 1696, 0, 1677, + 1697, 0, 0, 1678, 1679, 1680, 1681, 0, 1682, 1683, + 1684, 0, 0, 0, 1698, 0, 0, 1699, 1693, 1694, + 0, 0, 0, 0, 0, 1685, 0, 0, 0, 0, + 0, 0, 0, 0, 1695, 1687, 0, 0, 0, 0, + 0, 0, 1688, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1689, + 0, 0, 0, 0, 1696, 0, 0, 1697, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1690, 0, 0, + 0, 1698, 0, 0, 1699, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1691, 0, 0, 0, 0, 1692, + 0, 0, 0, 0, 0, 0, 0, 1700, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1693, 1694, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1695, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1690, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1691, 0, 0, 0, 1696, 1692, + 0, 1697, 0, 0, 1700, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1698, 0, 0, 1699, 0, + 0, 0, 1693, 1694, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1695, 1701, + 2954, 0, 1702, 1703, 1704, 0, 1705, 1706, 1707, 1708, + 1709, 1710, 0, 0, 0, 0, 0, 1676, 0, 0, + 1677, 0, 0, 0, 1678, 1679, 1680, 1681, 0, 1682, + 1683, 1684, 0, 0, 0, 0, 0, 0, 1696, 0, + 0, 1697, 0, 0, 0, 0, 1685, 0, 0, 0, + 0, 0, 0, 0, 0, 1698, 1687, 0, 1699, 0, + 0, 0, 0, 1688, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1701, 0, 1700, 1702, + 1703, 1704, 0, 1705, 1706, 1707, 1708, 1709, 1710, 0, + 1689, 0, 0, 0, 0, 1676, 0, 0, 1677, 0, + 0, 0, 1678, 1679, 1680, 1681, 0, 1682, 1683, 1684, + 0, 0, 0, 0, 1676, 0, 0, 1677, 0, 0, + 0, 1678, 1679, 0, 1685, 0, 1682, 1683, 1684, 0, + 0, 0, 0, 0, 1687, 0, 0, 0, 0, 0, + 0, 1688, 0, 1685, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1687, 0, 0, 0, 0, 1700, 0, + 1688, 0, 0, 0, 0, 0, 0, 0, 1689, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1689, 1690, 0, + 1701, 0, 0, 1702, 1703, 1704, 0, 1705, 1706, 1707, + 1708, 1709, 1710, 0, 0, 1691, 0, 0, 0, 0, + 1692, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1676, 0, 0, 1677, 0, 0, 0, + 1678, 1679, 0, 1889, 1694, 1682, 1683, 1684, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1695, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1687, 0, 0, 0, 1690, 0, 0, 1688, + 1701, 0, 0, 1702, 1703, 1704, 0, 1705, 1706, 1707, + 1708, 1709, 1710, 1691, 0, 1690, 0, 0, 1692, 1696, + 0, 0, 1697, 0, 0, 0, 1689, 0, 0, 0, + 0, 0, 1691, 0, 0, 0, 1698, 1692, 0, 1699, + 0, 1693, 1694, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1695, 0, 0, + 1693, 1694, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1695, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1696, 0, 0, + 1697, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1698, 0, 1696, 1699, 0, 1697, + 0, 0, 0, 0, 1690, 0, 0, 0, 0, 0, + 0, 0, 0, 1698, 0, 0, 1699, 0, 0, 1700, + 0, 1691, 0, 0, 0, 0, 1692, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1693, + 1694, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1695, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1700, 0, 0, + 0, 0, 0, 0, 0, 1696, 0, 0, 1697, 0, + 0, 0, 0, 0, 0, 0, 1700, 0, 0, 0, + 0, 0, 1698, 0, 0, 0, 0, 0, 0, 0, + 0, 1701, 0, 0, 1702, 1703, 1704, 0, 1705, 1706, + 1707, 1708, 1709, 1710, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1701, + 0, 0, 1702, 1703, 1704, 0, 1705, 1706, 1707, 1708, + 2293, 1710, 0, 0, 0, 1700, 0, 0, 1701, 0, + 0, 1702, 1703, 1704, 0, 1705, 1706, 1707, 1708, 1709, + 1710, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 570, 0, 2188, 0, 0, 0, 0, 1701, 0, 0, + 1702, 1703, 1704, 0, 1705, 1706, 1707, 1708, 1709, 1710, + 122, 123, 124, 125, 126, 127, 128, 129, 571, 130, + 131, 132, 572, 573, 574, 575, 576, 577, 578, 579, + 580, 134, 135, 581, 582, 137, 138, 583, 140, 141, + 142, 584, 585, 586, 587, 588, 589, 590, 148, 149, + 150, 151, 152, 591, 592, 153, 154, 155, 156, 593, + 594, 159, 595, 160, 161, 162, 163, 596, 597, 598, + 599, 600, 167, 168, 169, 170, 171, 601, 173, 174, + 175, 602, 176, 177, 178, 179, 180, 181, 603, 604, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 1550, 194, 195, 1551, 197, 0, 198, 0, 199, 200, - 201, 202, 203, 204, 0, 0, 205, 206, 207, 208, - 0, 0, 209, 210, 1093, 212, 213, 0, 214, 215, - 216, 0, 217, 218, 219, 220, 0, 221, 222, 223, - 224, 0, 226, 227, 228, 229, 230, 231, 0, 0, - 233, 0, 234, 235, 1552, 237, 0, 238, 0, 239, - 1553, 0, 1554, 242, 243, -864, 1555, 246, 247, 248, - 0, 0, 0, 251, 252, 0, 253, 254, 255, 256, - 257, 258, 259, 1556, 261, 262, 263, 264, 0, 265, - 266, 267, 268, 269, 270, 271, 0, 272, 1557, 0, - 275, 276, 277, 278, 279, 1558, 1559, 0, 1560, 0, - 283, 1561, 1562, 286, 1563, 288, 289, 290, 0, 291, - 292, 293, 0, 0, 294, 1564, 296, 1565, 0, 298, - 299, 300, 301, 302, 303, 304, 305, 1566, 307, 308, + 606, 194, 195, 607, 197, 608, 198, 609, 199, 200, + 201, 202, 203, 204, 610, 611, 205, 206, 207, 208, + 612, 613, 209, 210, 211, 212, 213, 614, 214, 215, + 216, 615, 217, 218, 219, 220, 616, 221, 222, 223, + 224, 617, 226, 227, 228, 229, 230, 231, 618, 619, + 233, 620, 234, 235, 621, 237, 622, 238, 623, 239, + 624, 625, 626, 242, 243, 627, 628, 246, 247, 248, + 629, 630, 631, 251, 252, 632, 253, 254, 255, 256, + 257, 258, 259, 633, 261, 262, 263, 264, 634, 265, + 266, 267, 268, 269, 270, 271, 635, 272, 636, 637, + 275, 276, 277, 278, 279, 638, 639, 640, 641, 642, + 283, 643, 644, 286, 645, 288, 289, 290, 646, 291, + 292, 293, 647, 648, 294, 649, 296, 650, 651, 298, + 299, 300, 301, 302, 303, 304, 305, 652, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, - 1567, 1568, 1569, 332, 333, 334, 0, 0, 336, 337, - 1570, 339, 0, 0, 341, 1571, 343, 344, 345, 0, - 346, 347, 0, 0, 348, 349, 350, 0, 0, 351, - 352, 0, 1572, 355, 1573, 0, 358, 359, 360, 361, - 362, 363, 364, 365, 366, 367, 368, 369, 0, 0, - 0, 0, 370, 371, 0, 1574, 374, 375, 0, 377, - 378, 379, 0, 380, 381, 382, 383, 384, 385, 0, - 386, 387, 388, 389, 390, 1575, 392, 393, 394, 395, - 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, - 405, 406, 407, 408, 0, 409, 410, 1576, 412, 413, - 414, 1577, 416, 417, 418, 419, 420, 421, 422, 423, - 424, 425, 426, 427, 428, 0, 1578, 429, 430, 431, - 432, 433, 434, 1579, 436, 437, 0, 1580, 439, 440, - 1581, 442, 0, 443, 444, 445, 446, 447, 448, 449, - 450, 451, 452, 453, 454, 455, 456, 1582, 458, 0, - 0, 0, 460, 461, 0, 462, 1583, 464, 465, 466, - 467, 468, 469, 0, 470, 1584, 1585, 0, 0, 473, - 474, 0, 476, 0, 0, 478, 479, 1586, 481, 482, - 483, 484, 485, 1587, 0, 486, 487, 488, 1588, 0, - 489, 490, 491, 492, 0, 493, 494, 495, 496, 497, - 0, 1589, 500, 0, 501, 1590, 503, 504, 505, 506, - 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, - 513, 514, 515, 516, 539, 0, 564, 0, 0, 0, - 0, 0, 0, 0, 0, 528, 529, 530, 531, 0, - 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, - 128, 129, 0, 130, 131, 132, 3, 4, 0, 0, - 0, 0, 0, 0, 0, 134, 135, 0, 0, 137, - 138, 0, 140, 141, 142, 143, 144, 0, 146, 147, - 0, 0, 148, 149, 150, 151, 152, 0, 0, 153, - 154, 155, 156, 157, 158, 159, 0, 160, 161, 162, - 163, 164, 0, 0, 0, 166, 167, 168, 169, 170, - 171, 0, 173, 174, 175, 0, 176, 177, 178, 179, - 180, 181, 0, 0, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 193, 194, 195, 196, 197, 0, - 198, 0, 199, 200, 201, 202, 203, 204, 0, 0, - 205, 206, 207, 208, 0, 0, 209, 210, 211, 212, - 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, - 0, 221, 222, 223, 224, 225, 226, 227, 228, 229, - 230, 231, 232, 0, 233, 0, 234, 235, 236, 237, - 0, 238, 0, 239, 0, 0, 0, 242, 243, 540, - 0, 246, 247, 248, 0, 249, 250, 251, 252, 0, - 253, 254, 255, 256, 257, 258, 259, 0, 261, 262, - 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, - 0, 272, 0, 274, 275, 276, 277, 278, 279, 280, - 281, 0, 282, 0, 283, 0, 0, 286, 0, 288, - 289, 290, 0, 291, 292, 293, 0, 0, 294, 0, - 296, 0, 0, 298, 299, 300, 301, 302, 303, 304, - 305, 541, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 0, 331, 332, 333, 334, - 335, 0, 336, 337, 0, 339, 0, 340, 341, 342, - 343, 344, 345, 0, 346, 347, 0, 0, 348, 349, - 350, 0, 0, 351, 352, 353, 0, 355, 0, 357, - 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, - 368, 369, 0, 0, 0, 0, 370, 371, 372, 0, - 374, 375, 376, 377, 378, 379, 0, 380, 381, 382, - 383, 384, 385, 0, 386, 387, 388, 389, 390, 391, - 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, - 401, 402, 403, 404, 405, 406, 407, 408, 0, 409, - 410, 0, 412, 413, 414, 415, 416, 417, 418, 419, - 420, 421, 422, 423, 424, 425, 426, 427, 428, 0, - 0, 429, 430, 431, 432, 433, 434, 435, 436, 437, - 0, 0, 439, 440, 441, 442, 0, 443, 444, 445, - 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, - 456, 542, 458, 459, 0, 0, 460, 461, 0, 462, - 0, 464, 465, 466, 467, 468, 469, 0, 470, 471, - 472, 0, 0, 473, 474, 475, 476, 477, 0, 478, - 479, 480, 481, 482, 483, 484, 485, 0, 0, 486, - 487, 488, 0, 0, 489, 490, 491, 492, 0, 493, - 494, 495, 496, 497, 498, 499, 500, 0, 501, 0, - 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, - 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, - 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, - 529, 530, 531, 539, 0, 564, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, - 129, 565, 130, 131, 132, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 134, 135, 0, 0, 137, 138, - 0, 140, 141, 142, 143, 144, 0, 146, 147, 0, - 0, 148, 149, 150, 151, 152, 0, 0, 153, 154, - 155, 156, 157, 158, 159, 0, 160, 161, 162, 163, - 164, 0, 0, 0, 166, 167, 168, 169, 170, 171, - 0, 173, 174, 175, 0, 176, 177, 178, 179, 180, - 181, 0, 0, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 0, 198, - 0, 199, 200, 201, 202, 203, 204, 0, 0, 205, - 206, 207, 208, 0, 0, 209, 210, 211, 212, 213, - 0, 214, 215, 216, 0, 217, 218, 219, 220, 0, - 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, - 231, 232, 0, 233, 0, 234, 235, 236, 237, 0, - 238, 0, 239, 0, 0, 0, 242, 243, 540, 0, - 246, 247, 248, 0, 249, 250, 251, 252, 0, 253, - 254, 255, 256, 257, 258, 259, 0, 261, 262, 263, - 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, - 272, 0, 274, 275, 276, 277, 278, 279, 280, 281, - 0, 282, 0, 283, 0, 0, 286, 0, 288, 289, - 290, 0, 291, 292, 293, 0, 0, 294, 0, 296, - 0, 0, 298, 299, 300, 301, 302, 303, 304, 305, - 541, 307, 308, 309, 310, 311, 312, 313, 314, 315, - 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, - 326, 327, 328, 329, 0, 331, 332, 333, 334, 335, - 0, 336, 337, 0, 339, 0, 340, 341, 342, 343, - 344, 345, 0, 346, 347, 0, 0, 348, 349, 350, - 0, 0, 351, 352, 353, 0, 355, 0, 357, 358, - 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, - 369, 0, 0, 0, 0, 370, 371, 372, 0, 374, - 375, 376, 566, 378, 379, 0, 380, 381, 382, 383, - 384, 385, 0, 386, 387, 388, 389, 390, 391, 392, - 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, - 402, 403, 404, 405, 406, 407, 408, 0, 409, 410, - 0, 412, 413, 414, 415, 416, 417, 418, 419, 420, - 421, 422, 423, 424, 425, 426, 427, 428, 0, 0, - 429, 430, 431, 432, 433, 434, 435, 436, 437, 0, - 0, 439, 440, 441, 442, 0, 443, 444, 445, 446, - 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, - 542, 458, 459, 0, 0, 460, 461, 0, 462, 0, - 464, 465, 466, 467, 468, 469, 0, 470, 471, 472, - 0, 0, 473, 474, 475, 476, 477, 0, 478, 479, - 480, 481, 482, 483, 484, 485, 0, 0, 486, 487, - 488, 0, 0, 489, 490, 491, 492, 0, 493, 494, - 495, 496, 497, 498, 499, 500, 0, 501, 0, 503, - 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, - 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, - 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, - 530, 531, 539, 0, 564, 0, 0, 0, 0, 0, + 653, 654, 655, 332, 333, 334, 656, 657, 336, 337, + 658, 339, 659, 660, 341, 661, 343, 344, 345, 662, + 346, 347, 663, 664, 348, 349, 350, 665, 666, 351, + 352, 667, 668, 355, 669, 670, 358, 359, 360, 361, + 362, 363, 364, 365, 366, 367, 368, 369, 671, 672, + 673, 674, 370, 371, 675, 676, 374, 375, 677, 377, + 378, 379, 678, 380, 381, 382, 383, 384, 385, 679, + 386, 387, 388, 389, 390, 680, 392, 393, 394, 395, + 681, 396, 397, 398, 399, 400, 401, 402, 403, 404, + 405, 406, 407, 408, 682, 409, 410, 683, 412, 413, + 414, 684, 416, 417, 418, 419, 420, 421, 422, 423, + 424, 425, 426, 427, 428, 685, 686, 429, 430, 431, + 432, 433, 434, 687, 436, 437, 688, 689, 439, 440, + 690, 442, 691, 443, 444, 445, 446, 447, 448, 449, + 450, 451, 452, 453, 454, 455, 456, 692, 458, 693, + 694, 695, 460, 461, 696, 462, 697, 464, 465, 466, + 467, 468, 469, 698, 470, 699, 700, 701, 702, 473, + 474, 703, 476, 704, 705, 478, 479, 706, 481, 482, + 483, 484, 485, 707, 708, 486, 487, 488, 709, 710, + 489, 490, 491, 492, 711, 493, 494, 495, 496, 497, + 712, 713, 500, 714, 501, 715, 503, 504, 505, 506, + 507, 508, 509, 716, 717, 510, 718, 719, 511, 512, + 513, 514, 515, 516, 720, 721, 722, 723, 724, 725, + 726, 727, 728, 729, 730, 528, 529, 530, 531, 570, + 0, 836, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, + 123, 124, 125, 126, 127, 128, 129, 571, 130, 131, + 132, 572, 573, 574, 575, 576, 577, 578, 579, 580, + 134, 135, 581, 582, 137, 138, 583, 140, 141, 142, + 584, 585, 586, 587, 588, 589, 590, 148, 149, 150, + 151, 152, 591, 592, 153, 154, 155, 156, 593, 594, + 159, 595, 160, 161, 162, 163, 596, 597, 598, 599, + 600, 167, 168, 169, 170, 171, 601, 173, 174, 175, + 602, 176, 177, 178, 179, 180, 181, 603, 604, 183, + 184, 185, 186, 187, 188, 189, 190, 191, 192, 606, + 194, 195, 607, 197, 608, 198, 609, 199, 200, 201, + 202, 203, 204, 610, 611, 205, 206, 207, 208, 612, + 613, 209, 210, 211, 212, 213, 614, 214, 215, 216, + 615, 217, 218, 219, 220, 616, 221, 222, 223, 224, + 617, 226, 227, 228, 229, 230, 231, 618, 619, 233, + 620, 234, 235, 621, 237, 622, 238, 623, 239, 624, + 625, 626, 242, 243, 627, 628, 246, 247, 248, 629, + 630, 631, 251, 252, 632, 253, 254, 255, 256, 257, + 258, 259, 633, 261, 262, 263, 264, 634, 265, 266, + 267, 268, 269, 270, 271, 635, 272, 636, 637, 275, + 276, 277, 278, 279, 638, 639, 640, 641, 642, 283, + 643, 644, 286, 645, 288, 289, 290, 646, 291, 292, + 293, 647, 648, 294, 649, 296, 650, 651, 298, 299, + 300, 301, 302, 303, 304, 305, 652, 307, 308, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 328, 653, + 654, 655, 332, 333, 334, 656, 657, 336, 337, 658, + 339, 659, 660, 341, 661, 343, 344, 345, 662, 346, + 347, 663, 664, 348, 349, 350, 665, 666, 351, 352, + 667, 668, 355, 669, 670, 358, 359, 360, 361, 362, + 363, 364, 365, 366, 367, 368, 369, 671, 672, 673, + 674, 370, 371, 675, 676, 374, 375, 677, 377, 378, + 379, 678, 380, 381, 382, 383, 384, 385, 679, 386, + 387, 388, 389, 390, 680, 392, 393, 394, 395, 681, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 682, 409, 410, 683, 412, 413, 414, + 684, 416, 417, 418, 419, 420, 421, 422, 423, 424, + 425, 426, 427, 428, 685, 686, 429, 430, 431, 432, + 433, 434, 687, 436, 437, 688, 689, 439, 440, 690, + 442, 691, 443, 444, 445, 446, 447, 448, 449, 450, + 451, 452, 453, 454, 455, 456, 692, 458, 693, 694, + 695, 460, 461, 696, 462, 697, 464, 465, 466, 467, + 468, 469, 698, 470, 699, 700, 701, 702, 473, 474, + 703, 476, 704, 705, 478, 479, 706, 481, 482, 483, + 484, 485, 707, 708, 486, 487, 488, 709, 710, 489, + 490, 491, 492, 711, 493, 494, 495, 496, 497, 712, + 713, 500, 714, 501, 715, 503, 504, 505, 506, 507, + 508, 509, 716, 717, 510, 718, 719, 511, 512, 513, + 514, 515, 516, 720, 721, 722, 723, 724, 725, 726, + 727, 728, 729, 730, 528, 529, 530, 531, 570, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, - 0, 130, 131, 132, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 134, 135, 0, 0, 137, 138, 0, - 140, 141, 142, 143, 144, 0, 146, 147, 0, 0, - 148, 149, 150, 151, 152, 0, 0, 153, 154, 155, - 156, 157, 158, 159, 0, 160, 161, 162, 163, 164, - 0, 0, 0, 166, 167, 168, 169, 170, 171, 0, - 173, 174, 175, 0, 176, 177, 178, 179, 180, 181, - 0, 0, 183, 184, 185, 186, 187, 188, 189, 190, - 191, 192, 193, 194, 195, 196, 197, 0, 198, 0, - 199, 200, 201, 202, 203, 204, 0, 0, 205, 206, - 207, 208, 0, 0, 209, 210, 211, 212, 213, 0, - 214, 215, 216, 0, 217, 218, 219, 220, 0, 221, - 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, - 232, 0, 233, 0, 234, 235, 236, 237, 0, 238, - 0, 239, 0, 0, 0, 242, 243, 540, 0, 246, - 247, 248, 0, 249, 250, 251, 252, 0, 253, 254, - 255, 256, 257, 258, 259, 0, 261, 262, 263, 264, - 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, - 0, 274, 275, 276, 277, 278, 279, 280, 281, 0, - 282, 0, 283, 0, 0, 286, 0, 288, 289, 290, - 0, 291, 292, 293, 0, 0, 294, 0, 296, 0, - 0, 298, 299, 300, 301, 302, 303, 304, 305, 541, - 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, - 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, - 327, 328, 329, 0, 331, 332, 333, 334, 335, 0, - 336, 337, 0, 339, 0, 340, 341, 342, 343, 344, - 345, 0, 346, 347, 0, 811, 348, 349, 350, 0, - 0, 351, 352, 353, 0, 355, 0, 357, 358, 359, - 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, - 0, 0, 0, 0, 370, 371, 372, 0, 374, 375, - 376, 377, 378, 379, 0, 380, 381, 382, 383, 384, - 385, 0, 386, 387, 388, 389, 390, 391, 392, 393, - 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, - 403, 404, 405, 406, 407, 408, 0, 409, 410, 0, - 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, - 422, 423, 424, 425, 426, 427, 428, 0, 0, 429, - 430, 431, 432, 433, 434, 435, 436, 437, 0, 0, - 439, 440, 441, 442, 0, 443, 444, 445, 446, 447, - 448, 449, 450, 451, 452, 453, 454, 455, 456, 542, - 458, 459, 0, 0, 460, 461, 0, 462, 0, 464, - 465, 466, 467, 468, 469, 0, 470, 471, 472, 0, - 0, 473, 474, 475, 476, 477, 0, 478, 479, 480, - 481, 482, 483, 484, 485, 0, 0, 486, 487, 488, - 0, 0, 489, 490, 491, 492, 0, 493, 494, 495, - 496, 497, 498, 499, 500, 0, 501, 0, 503, 504, - 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, - 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, - 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, - 531, 539, 0, 564, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, + 124, 125, 126, 127, 128, 129, 571, 130, 131, 132, + 572, 573, 574, 575, 576, 577, 578, 579, 580, 134, + 135, 581, 582, 137, 138, 583, 140, 141, 142, 584, + 585, 586, 587, 588, 589, 590, 148, 149, 150, 151, + 152, 591, 592, 153, 154, 155, 156, 593, 594, 159, + 595, 160, 161, 162, 163, 596, 597, 598, 599, 600, + 167, 168, 169, 170, 171, 601, 173, 174, 175, 602, + 176, 177, 178, 179, 180, 181, 603, 604, 183, 184, + 185, 186, 187, 188, 605, 190, 191, 192, 606, 194, + 195, 607, 197, 608, 198, 609, 199, 200, 201, 202, + 203, 204, 610, 611, 205, 206, 207, 208, 612, 613, + 209, 210, 211, 212, 213, 614, 214, 215, 216, 615, + 217, 218, 219, 220, 616, 221, 222, 223, 224, 617, + 226, 227, 228, 229, 230, 231, 618, 619, 233, 620, + 234, 235, 621, 237, 622, 238, 623, 239, 624, 625, + 626, 242, 243, 627, 628, 246, 247, 248, 629, 630, + 631, 251, 252, 632, 253, 254, 255, 256, 257, 258, + 259, 633, 261, 262, 263, 264, 634, 265, 266, 267, + 268, 269, 270, 271, 635, 272, 636, 637, 275, 276, + 277, 278, 279, 638, 639, 640, 641, 642, 283, 643, + 644, 286, 645, 288, 289, 290, 646, 291, 292, 293, + 647, 648, 294, 649, 296, 650, 651, 298, 299, 300, + 301, 302, 303, 304, 305, 652, 307, 308, 309, 310, + 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, + 321, 322, 323, 324, 325, 326, 327, 328, 653, 654, + 655, 332, 333, 334, 656, 657, 336, 337, 658, 339, + 659, 660, 341, 661, 343, 344, 345, 662, 346, 347, + 663, 664, 348, 349, 350, 665, 666, 351, 352, 667, + 668, 355, 669, 670, 358, 359, 360, 361, 362, 363, + 364, 365, 366, 367, 368, 369, 671, 672, 673, 674, + 370, 371, 675, 676, 374, 375, 677, 377, 378, 379, + 678, 380, 381, 382, 383, 384, 385, 679, 386, 387, + 388, 389, 390, 680, 392, 393, 394, 395, 681, 396, + 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, + 407, 408, 682, 409, 410, 683, 412, 413, 414, 684, + 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, + 426, 427, 428, 685, 686, 429, 430, 431, 432, 433, + 434, 687, 436, 437, 688, 689, 439, 440, 690, 442, + 691, 443, 444, 445, 446, 447, 448, 449, 450, 451, + 452, 453, 454, 455, 456, 692, 458, 693, 694, 695, + 460, 461, 696, 462, 697, 464, 465, 466, 467, 468, + 469, 698, 470, 699, 700, 701, 702, 473, 474, 703, + 476, 704, 705, 478, 479, 706, 481, 482, 483, 484, + 485, 707, 708, 486, 487, 488, 709, 710, 489, 490, + 491, 492, 711, 493, 494, 495, 496, 497, 712, 713, + 500, 714, 501, 715, 503, 504, 505, 506, 507, 508, + 509, 716, 717, 510, 718, 719, 511, 512, 513, 514, + 515, 516, 720, 721, 722, 723, 724, 725, 726, 727, + 728, 729, 730, 528, 529, 530, 531, 570, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, - 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 134, 135, 0, 0, 137, 138, 0, 140, - 141, 142, 143, 144, 0, 146, 147, 0, 0, 148, - 149, 150, 151, 152, 0, 0, 153, 154, 155, 156, - 157, 158, 159, 0, 160, 161, 162, 163, 164, 0, - 0, 0, 166, 167, 168, 169, 170, 171, 0, 173, - 174, 175, 0, 176, 177, 178, 179, 180, 181, 0, - 0, 183, 184, 185, 186, 187, 188, 189, 190, 191, - 192, 193, 194, 195, 196, 197, 0, 198, 0, 199, - 200, 201, 202, 203, 204, 0, 0, 205, 206, 207, - 208, 0, 0, 209, 210, 211, 212, 213, 0, 214, - 215, 216, 0, 217, 218, 219, 220, 0, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 0, 233, 0, 234, 235, 236, 237, 0, 238, 0, - 239, 0, 0, 0, 242, 243, 540, 0, 246, 247, - 248, 0, 249, 250, 251, 252, 0, 253, 254, 255, - 256, 257, 923, 259, 0, 261, 262, 263, 264, 0, - 265, 266, 267, 268, 269, 270, 271, 0, 272, 0, - 274, 275, 276, 277, 278, 279, 280, 281, 0, 282, - 0, 283, 0, 0, 286, 0, 288, 289, 290, 0, - 291, 292, 293, 0, 0, 294, 0, 296, 0, 0, - 298, 299, 300, 301, 302, 303, 304, 305, 541, 307, - 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, - 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, - 328, 329, 0, 331, 332, 333, 334, 335, 0, 336, - 337, 0, 339, 0, 340, 341, 342, 343, 344, 345, - 0, 346, 347, 0, 811, 348, 349, 350, 0, 0, - 351, 352, 353, 0, 355, 0, 357, 358, 359, 360, - 361, 362, 363, 364, 365, 366, 367, 368, 369, 0, - 0, 0, 0, 370, 371, 372, 0, 374, 375, 376, - 377, 378, 379, 0, 380, 381, 382, 383, 384, 385, - 0, 386, 387, 388, 389, 390, 391, 392, 393, 394, - 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, - 404, 405, 406, 407, 408, 0, 409, 410, 0, 412, - 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, - 423, 424, 425, 426, 427, 428, 0, 0, 429, 430, - 431, 432, 433, 434, 435, 436, 437, 0, 0, 439, - 440, 441, 442, 0, 443, 444, 445, 446, 447, 448, - 449, 450, 451, 452, 453, 454, 455, 456, 542, 458, - 459, 0, 0, 460, 461, 0, 462, 0, 464, 465, - 466, 467, 468, 469, 0, 470, 471, 472, 0, 0, - 473, 474, 475, 476, 477, 0, 478, 479, 480, 481, - 482, 483, 484, 485, 0, 0, 486, 487, 488, 0, - 0, 489, 490, 491, 492, 0, 493, 494, 495, 496, + 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, + 125, 126, 127, 128, 129, 571, 130, 131, 132, 572, + 573, 574, 575, 576, 577, 578, 579, 580, 134, 135, + 581, 582, 137, 138, 583, 140, 141, 142, 584, 585, + 586, 587, 588, 589, 590, 148, 149, 150, 151, 152, + 591, 592, 153, 154, 155, 156, 593, 594, 159, 595, + 160, 161, 162, 163, 596, 597, 598, 599, 600, 167, + 168, 169, 170, 171, 601, 173, 174, 175, 602, 176, + 177, 178, 179, 180, 181, 603, 604, 183, 184, 185, + 186, 187, 188, 189, 190, 191, 192, 606, 194, 195, + 607, 197, 608, 198, 609, 199, 200, 201, 202, 203, + 204, 610, 611, 205, 206, 207, 208, 612, 613, 209, + 210, 211, 212, 213, 614, 214, 215, 216, 615, 217, + 218, 219, 220, 616, 221, 222, 223, 224, 617, 226, + 227, 228, 229, 230, 231, 618, 619, 233, 620, 234, + 235, 621, 237, 622, 238, 623, 239, 624, 625, 626, + 242, 243, 627, 628, 246, 247, 248, 629, 630, 631, + 251, 252, 632, 253, 254, 255, 256, 257, 970, 259, + 633, 261, 262, 263, 264, 634, 265, 266, 267, 268, + 269, 270, 271, 635, 272, 636, 637, 275, 276, 277, + 278, 279, 638, 639, 640, 641, 642, 283, 643, 644, + 286, 645, 288, 289, 290, 646, 291, 292, 293, 647, + 648, 294, 649, 296, 650, 651, 298, 299, 300, 301, + 302, 303, 304, 305, 652, 307, 308, 309, 310, 311, + 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, + 322, 323, 324, 325, 326, 327, 328, 653, 654, 655, + 332, 333, 334, 656, 657, 336, 337, 658, 339, 659, + 660, 341, 661, 343, 344, 345, 662, 346, 347, 663, + 664, 348, 349, 350, 665, 666, 351, 352, 667, 668, + 355, 669, 670, 358, 359, 360, 361, 362, 363, 364, + 365, 366, 367, 368, 369, 671, 672, 673, 674, 370, + 371, 675, 676, 374, 375, 677, 377, 378, 379, 678, + 380, 381, 382, 383, 384, 385, 679, 386, 387, 388, + 389, 390, 680, 392, 393, 394, 395, 681, 396, 397, + 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, + 408, 682, 409, 410, 683, 412, 413, 414, 684, 416, + 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, + 427, 428, 685, 686, 429, 430, 431, 432, 433, 434, + 687, 436, 437, 688, 689, 439, 440, 690, 442, 691, + 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, + 453, 454, 455, 456, 692, 458, 693, 694, 695, 460, + 461, 696, 462, 697, 464, 465, 466, 467, 468, 469, + 698, 470, 699, 700, 701, 702, 473, 474, 703, 476, + 704, 705, 478, 479, 706, 481, 482, 483, 484, 485, + 707, 708, 486, 487, 488, 709, 710, 489, 490, 491, + 492, 711, 493, 494, 495, 496, 497, 712, 713, 500, + 714, 501, 715, 503, 504, 505, 506, 507, 508, 509, + 716, 717, 510, 718, 719, 511, 512, 513, 514, 515, + 516, 720, 721, 722, 723, 724, 725, 726, 727, 728, + 729, 730, 528, 529, 530, 531, 570, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, + 126, 127, 128, 129, 571, 130, 131, 132, 572, 573, + 574, 575, 576, 577, 578, 579, 580, 134, 135, 581, + 582, 137, 138, 583, 140, 141, 142, 584, 585, 586, + 587, 588, 589, 590, 148, 149, 150, 151, 152, 591, + 592, 153, 154, 155, 156, 593, 594, 159, 595, 160, + 161, 162, 163, 596, 597, 598, 599, 600, 167, 168, + 169, 170, 171, 601, 173, 174, 175, 602, 176, 177, + 178, 179, 180, 181, 603, 604, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 606, 194, 195, 607, + 197, 608, 198, 609, 199, 200, 201, 202, 203, 204, + 610, 611, 205, 206, 207, 208, 612, 613, 209, 210, + 211, 212, 213, 614, 214, 215, 216, 615, 217, 218, + 219, 220, 616, 221, 222, 223, 224, 617, 226, 227, + 228, 229, 230, 231, 618, 619, 233, 620, 234, 235, + 621, 237, 622, 238, 623, 239, 624, 625, 626, 242, + 243, 627, 628, 246, 247, 248, 629, 630, 631, 251, + 252, 632, 253, 254, 255, 256, 257, 258, 259, 633, + 261, 262, 263, 264, 634, 265, 266, 267, 268, 269, + 270, 271, 635, 272, 636, 637, 275, 276, 277, 278, + 279, 638, 639, 640, 641, 642, 283, 643, 644, 286, + 645, 288, 289, 290, 646, 291, 292, 293, 647, 648, + 294, 649, 296, 650, 651, 298, 299, 300, 301, 302, + 303, 304, 305, 652, 307, 308, 309, 310, 311, 312, + 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, + 323, 324, 325, 326, 327, 328, 653, 654, 655, 332, + 333, 334, 656, 657, 336, 337, 658, 339, 659, 660, + 341, 661, 343, 344, 345, 662, 346, 347, 663, 664, + 348, 349, 350, 665, 666, 351, 352, 667, 668, 355, + 669, 670, 358, 359, 360, 361, 362, 363, 364, 365, + 366, 367, 368, 369, 671, 672, 673, 674, 370, 371, + 675, 676, 374, 375, 677, 377, 378, 379, 678, 380, + 381, 382, 383, 384, 385, 679, 386, 387, 388, 389, + 390, 680, 392, 393, 394, 395, 681, 396, 397, 398, + 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, + 682, 409, 410, 683, 412, 413, 414, 684, 416, 417, + 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, + 428, 685, 686, 429, 430, 431, 432, 433, 434, 687, + 436, 437, 688, 689, 439, 440, 690, 442, 691, 443, + 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, + 454, 455, 456, 692, 458, 693, 694, 695, 460, 461, + 696, 462, 697, 464, 465, 466, 467, 468, 469, 698, + 470, 699, 700, 701, 702, 473, 474, 703, 476, 704, + 705, 478, 479, 706, 481, 482, 483, 484, 485, 707, + 708, 486, 487, 488, 709, 710, 489, 490, 491, 492, + 711, 493, 494, 495, 496, 497, 712, 713, 500, 714, + 501, 715, 503, 504, 505, 506, 507, 508, 509, 716, + 717, 510, 718, 719, 511, 512, 513, 514, 515, 516, + 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, + 730, 528, 529, 530, 531, 570, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 122, 123, 124, 125, 2349, + 127, 128, 129, 571, 130, 131, 132, 572, 573, 574, + 575, 576, 577, 578, 579, 580, 134, 135, 581, 582, + 137, 138, 583, 140, 141, 142, 584, 585, 586, 587, + 588, 589, 590, 148, 149, 150, 151, 152, 591, 592, + 153, 154, 155, 156, 593, 594, 159, 595, 160, 161, + 162, 163, 596, 597, 598, 599, 600, 167, 168, 169, + 170, 171, 601, 173, 174, 175, 602, 176, 177, 178, + 179, 180, 181, 603, 604, 183, 184, 185, 186, 187, + 188, 189, 190, 191, 192, 606, 194, 195, 607, 197, + 608, 198, 609, 199, 200, 201, 202, 203, 204, 610, + 611, 205, 206, 207, 208, 612, 613, 209, 210, 211, + 2350, 213, 614, 214, 215, 216, 615, 217, 218, 219, + 220, 616, 221, 222, 223, 224, 617, 226, 227, 228, + 229, 230, 231, 618, 619, 233, 620, 234, 235, 621, + 237, 622, 238, 623, 239, 624, 625, 626, 242, 243, + 627, 628, 246, 247, 248, 629, 630, 631, 251, 252, + 632, 253, 254, 255, 256, 257, 258, 259, 633, 261, + 262, 263, 264, 634, 265, 266, 267, 268, 269, 270, + 271, 635, 272, 636, 637, 275, 276, 277, 278, 279, + 638, 639, 640, 641, 642, 283, 643, 644, 286, 645, + 288, 289, 290, 646, 291, 292, 293, 647, 648, 294, + 649, 296, 650, 651, 298, 299, 300, 301, 302, 303, + 304, 305, 652, 307, 308, 309, 310, 311, 312, 313, + 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, + 324, 325, 326, 327, 328, 653, 654, 655, 332, 333, + 334, 656, 657, 336, 337, 658, 339, 659, 660, 341, + 661, 343, 344, 345, 662, 346, 347, 663, 664, 348, + 349, 350, 665, 666, 351, 352, 667, 668, 355, 669, + 670, 358, 359, 360, 361, 362, 363, 364, 365, 366, + 367, 368, 369, 671, 672, 673, 674, 370, 371, 675, + 676, 374, 375, 677, 377, 378, 379, 678, 380, 381, + 382, 383, 384, 385, 679, 386, 387, 388, 389, 390, + 680, 392, 393, 394, 395, 681, 396, 397, 398, 399, + 400, 401, 402, 403, 404, 405, 406, 407, 408, 682, + 409, 410, 683, 412, 413, 414, 684, 416, 417, 418, + 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, + 685, 686, 429, 430, 431, 432, 433, 2351, 687, 436, + 437, 688, 689, 439, 440, 690, 442, 691, 443, 444, + 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, + 455, 456, 692, 458, 693, 694, 695, 460, 461, 696, + 462, 697, 464, 465, 466, 467, 468, 469, 698, 470, + 699, 700, 701, 702, 473, 474, 703, 476, 704, 705, + 478, 479, 706, 481, 482, 483, 484, 485, 707, 708, + 486, 487, 488, 709, 710, 489, 490, 491, 492, 711, + 493, 494, 495, 496, 497, 712, 713, 500, 714, 501, + 715, 503, 504, 505, 506, 507, 508, 509, 716, 717, + 510, 718, 719, 511, 512, 513, 514, 515, 516, 720, + 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, + 528, 529, 530, 531, 994, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, + 128, 129, 0, 130, 131, 132, 3, 4, 0, 575, + 0, 0, 0, 0, 580, 134, 135, 0, 582, 137, + 138, 583, 140, 141, 142, 584, 585, 586, 587, 588, + 0, 590, 148, 149, 150, 151, 152, 0, 0, 153, + 154, 155, 156, 593, 594, 159, 0, 160, 161, 162, + 163, 596, 0, 598, 0, 600, 167, 168, 169, 170, + 171, 601, 173, 174, 175, 0, 176, 177, 178, 179, + 180, 181, 0, 604, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 606, 194, 195, 607, 197, 0, + 198, 0, 199, 200, 201, 202, 203, 204, 0, 0, + 205, 206, 207, 208, 0, 0, 209, 210, 211, 212, + 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, + 0, 221, 222, 223, 224, 617, 226, 227, 228, 229, + 230, 231, 618, 0, 233, 0, 234, 235, 621, 237, + 0, 238, 0, 239, 624, 0, 626, 242, 243, 627, + 628, 246, 247, 248, 0, 630, 631, 251, 252, 0, + 253, 254, 255, 256, 257, 258, 259, 633, 261, 262, + 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, + 0, 272, 636, 637, 275, 276, 277, 278, 279, 638, + 639, 0, 641, 0, 283, 643, 644, 286, 645, 288, + 289, 290, 0, 291, 292, 293, 0, 0, 294, 649, + 296, 650, 0, 298, 299, 300, 301, 302, 303, 304, + 305, 652, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 328, 653, 654, 655, 332, 333, 334, + 656, 0, 336, 337, 658, 339, 0, 660, 341, 661, + 343, 344, 345, 0, 346, 347, 0, 0, 348, 349, + 350, 0, 0, 351, 352, 667, 668, 355, 669, 670, + 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, + 368, 369, 0, 0, 0, 0, 370, 371, 675, 676, + 374, 375, 677, 377, 378, 379, 0, 380, 381, 382, + 383, 384, 385, 0, 386, 387, 388, 389, 390, 680, + 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, + 401, 402, 403, 404, 405, 406, 407, 408, 0, 409, + 410, 683, 412, 413, 414, 684, 416, 417, 418, 419, + 420, 421, 422, 423, 424, 425, 426, 427, 428, 0, + 686, 429, 430, 431, 432, 433, 434, 687, 436, 437, + 0, 689, 439, 440, 690, 442, 0, 443, 444, 445, + 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, + 456, 692, 458, 693, 0, 0, 460, 461, 0, 462, + 697, 464, 465, 466, 467, 468, 469, 0, 470, 699, + 700, 0, 0, 473, 474, 703, 476, 704, 0, 478, + 479, 706, 481, 482, 483, 484, 485, 0, 0, 486, + 487, 488, 709, 0, 489, 490, 491, 492, 0, 493, + 494, 495, 496, 497, 712, 713, 500, 0, 501, 715, + 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, + 0, 0, 511, 512, 513, 514, 515, 516, 720, 721, + 722, 723, 724, 725, 726, 727, 728, 729, 730, 528, + 529, 530, 531, 121, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, + 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, + 0, 0, 0, 133, 134, 135, 0, 136, 137, 138, + 139, 140, 141, 142, 143, 144, 145, 146, 147, 0, + 0, 148, 149, 150, 151, 152, 0, 805, 153, 154, + 155, 156, 157, 158, 159, 0, 160, 161, 162, 163, + 806, 0, 807, 0, 166, 167, 168, 169, 170, 171, + 172, 173, 174, 175, 0, 176, 177, 178, 179, 180, + 181, 0, 182, 183, 184, 185, 186, 187, 188, 189, + 190, 191, 192, 193, 194, 195, 196, 197, 0, 198, + 0, 199, 200, 201, 202, 203, 204, 0, 0, 205, + 206, 207, 208, 0, 0, 209, 210, 211, 212, 213, + 0, 214, 215, 216, 0, 217, 218, 219, 220, 0, + 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, + 231, 808, 0, 233, 0, 234, 235, 236, 237, 0, + 238, 0, 239, 240, 0, 241, 242, 243, 244, 245, + 246, 247, 248, 0, 249, 250, 251, 252, 0, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, + 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, + 0, 282, 0, 283, 284, 285, 286, 287, 288, 289, + 290, 0, 291, 292, 293, 0, 0, 294, 295, 296, + 297, 0, 298, 299, 300, 301, 302, 303, 304, 305, + 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, + 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, + 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, + 0, 336, 337, 338, 339, 0, 810, 341, 342, 343, + 344, 345, 0, 346, 347, 0, 0, 348, 349, 350, + 0, 0, 351, 352, 353, 354, 355, 356, 812, 358, + 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, + 369, 0, 0, 0, 0, 370, 371, 813, 373, 374, + 375, 376, 377, 378, 379, 0, 380, 381, 382, 383, + 384, 385, 0, 386, 387, 388, 389, 390, 391, 392, + 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, + 402, 403, 404, 405, 406, 407, 408, 0, 409, 410, + 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, + 421, 422, 423, 424, 425, 426, 427, 428, 0, 0, + 429, 430, 431, 432, 433, 434, 435, 436, 437, 0, + 438, 439, 440, 441, 442, 0, 443, 444, 445, 446, + 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, + 457, 458, 815, 0, 0, 460, 461, 0, 462, 463, + 464, 465, 466, 467, 468, 469, 0, 470, 471, 472, + 0, 0, 473, 474, 816, 476, 817, 0, 478, 479, + 818, 481, 482, 483, 484, 485, 0, 0, 486, 487, + 488, 0, 0, 489, 490, 491, 492, 0, 493, 494, + 495, 496, 497, 498, 499, 500, 0, 501, 502, 503, + 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, + 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, + 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, + 530, 531, 121, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, + 0, 130, 131, 132, 0, 0, 0, 0, 0, 0, + 0, 0, 133, 134, 135, 0, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 147, 0, 0, + 148, 149, 150, 151, 152, 0, 0, 153, 154, 155, + 156, 157, 158, 159, 0, 160, 161, 162, 163, 164, + 0, 165, 0, 166, 167, 168, 169, 170, 171, 172, + 173, 174, 175, 0, 176, 177, 178, 179, 180, 181, + 0, 182, 183, 184, 185, 186, 187, 188, 189, 190, + 191, 192, 193, 194, 195, 196, 197, 0, 198, 0, + 199, 200, 201, 202, 203, 204, 0, 0, 205, 206, + 207, 208, 0, 0, 209, 210, 211, 212, 213, 0, + 214, 215, 216, 0, 217, 218, 219, 220, 0, 221, + 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, + 232, 0, 233, 0, 234, 235, 236, 237, 0, 238, + 0, 239, 240, 0, 241, 242, 243, 244, 245, 246, + 247, 248, 0, 249, 250, 251, 252, 0, 253, 254, + 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, + 273, 274, 275, 276, 277, 278, 279, 280, 281, 0, + 282, 0, 283, 284, 285, 286, 287, 288, 289, 290, + 0, 291, 292, 293, 0, 0, 294, 295, 296, 297, + 0, 298, 299, 300, 301, 302, 303, 304, 305, 306, + 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, + 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, + 327, 328, 329, 330, 331, 332, 333, 334, 335, 0, + 336, 337, 338, 339, 0, 340, 341, 342, 343, 344, + 345, 0, 346, 347, 0, 0, 348, 349, 350, 0, + 0, 351, 352, 353, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, + 0, 0, 0, 0, 370, 371, 372, 373, 374, 375, + 376, 377, 378, 379, 0, 380, 381, 382, 383, 384, + 385, 0, 386, 387, 388, 389, 390, 391, 392, 393, + 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, + 403, 404, 405, 406, 407, 408, 0, 409, 410, 411, + 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, + 422, 423, 424, 425, 426, 427, 428, 0, 0, 429, + 430, 431, 432, 433, 434, 435, 436, 437, 0, 438, + 439, 440, 441, 442, 0, 443, 444, 445, 446, 447, + 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, + 458, 459, 0, 0, 460, 461, 0, 462, 463, 464, + 465, 466, 467, 468, 469, 0, 470, 471, 472, 0, + 0, 473, 474, 475, 476, 477, 0, 478, 479, 480, + 481, 482, 483, 484, 485, 0, 0, 486, 487, 488, + 0, 0, 489, 490, 491, 492, 0, 493, 494, 495, + 496, 497, 498, 499, 500, 0, 501, 502, 503, 504, + 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, + 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, + 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, + 531, 539, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, + 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 134, 135, 0, 0, 137, 138, 0, 140, + 141, 142, 143, 144, 0, 146, 147, 0, 0, 148, + 149, 150, 151, 152, 0, 0, 153, 154, 155, 156, + 157, 158, 159, 1812, 160, 161, 162, 163, 164, 0, + 0, 1813, 166, 167, 168, 169, 170, 171, 0, 173, + 174, 175, 1814, 176, 177, 178, 179, 180, 181, 0, + 0, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 0, 198, 0, 199, + 200, 201, 202, 203, 204, 0, 0, 205, 206, 207, + 208, 0, 0, 209, 210, 211, 212, 213, 0, 214, + 215, 216, 0, 217, 218, 219, 220, 0, 221, 222, + 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, + 0, 233, 0, 234, 235, 236, 237, 0, 238, 1815, + 239, 0, 0, 0, 242, 243, 540, 0, 246, 247, + 248, 0, 249, 250, 251, 252, 0, 253, 254, 255, + 256, 257, 1816, 259, 0, 261, 262, 263, 264, 0, + 265, 266, 267, 268, 269, 270, 271, 0, 272, 0, + 274, 275, 276, 277, 278, 279, 280, 281, 0, 282, + 0, 283, 0, 0, 286, 0, 288, 289, 290, 0, + 291, 292, 293, 0, 0, 294, 0, 296, 0, 0, + 298, 299, 300, 301, 302, 303, 304, 305, 541, 307, + 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, + 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, + 328, 329, 0, 331, 332, 333, 334, 335, 0, 336, + 337, 0, 339, 0, 340, 341, 342, 343, 344, 345, + 0, 346, 347, 0, 0, 348, 349, 350, 0, 0, + 351, 352, 353, 0, 355, 0, 357, 358, 359, 360, + 361, 362, 363, 364, 365, 366, 367, 368, 369, 0, + 0, 0, 0, 370, 371, 372, 0, 374, 375, 376, + 377, 378, 379, 1817, 380, 381, 382, 383, 384, 385, + 0, 386, 387, 388, 389, 390, 391, 392, 393, 394, + 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, + 404, 405, 406, 407, 408, 0, 409, 410, 0, 412, + 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, + 423, 424, 425, 426, 427, 428, 0, 0, 429, 430, + 431, 432, 433, 434, 435, 436, 437, 0, 0, 439, + 440, 441, 442, 0, 443, 444, 445, 446, 447, 448, + 449, 450, 451, 452, 453, 454, 455, 456, 542, 458, + 459, 0, 0, 460, 461, 0, 462, 0, 464, 465, + 466, 467, 468, 469, 0, 470, 471, 472, 0, 0, + 473, 474, 475, 476, 477, 0, 478, 479, 480, 481, + 482, 483, 484, 485, 0, 1818, 486, 487, 488, 0, + 0, 489, 490, 491, 492, 0, 493, 494, 495, 496, 497, 498, 499, 500, 0, 501, 0, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, - 539, 0, 564, 0, 0, 0, 0, 0, 0, 0, + 539, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 122, 123, 124, 125, 126, 127, 128, 129, 968, 130, + 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 134, 135, 0, 0, 137, 138, 0, 140, 141, 142, 143, 144, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 0, 0, 153, 154, 155, 156, 157, - 158, 159, 0, 160, 161, 162, 163, 164, 0, 0, + 158, 159, 1812, 160, 161, 162, 163, 164, 0, 0, 0, 166, 167, 168, 169, 170, 171, 0, 173, 174, - 175, 0, 176, 177, 178, 179, 180, 181, 0, 0, + 175, 1814, 176, 177, 178, 179, 180, 181, 0, 0, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 0, 198, 0, 199, 200, 201, 202, 203, 204, 0, 0, 205, 206, 207, 208, 0, 0, 209, 210, 211, 212, 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, 0, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 0, - 233, 0, 234, 235, 236, 237, 0, 238, 0, 239, + 233, 0, 234, 235, 236, 237, 0, 238, 1815, 239, 0, 0, 0, 242, 243, 540, 0, 246, 247, 248, 0, 249, 250, 251, 252, 0, 253, 254, 255, 256, 257, 258, 259, 0, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 0, 274, 275, 276, 277, 278, 279, 280, 281, 0, 282, 0, 283, 0, 0, 286, 0, 288, 289, 290, 0, 291, - 292, 293, 0, 0, 294, 0, 296, 0, 0, 298, + 292, 293, 0, 0, 294, 0, 296, 2441, 0, 298, 299, 300, 301, 302, 303, 304, 305, 541, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, @@ -10299,7 +10050,7 @@ static const yytype_int16 yytable[] = 352, 353, 0, 355, 0, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 0, 0, 0, 0, 370, 371, 372, 0, 374, 375, 376, 377, - 378, 379, 0, 380, 381, 382, 383, 384, 385, 0, + 378, 379, 1817, 380, 381, 382, 383, 384, 385, 0, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 0, 409, 410, 0, 412, 413, @@ -10311,318 +10062,65 @@ static const yytype_int16 yytable[] = 0, 0, 460, 461, 0, 462, 0, 464, 465, 466, 467, 468, 469, 0, 470, 471, 472, 0, 0, 473, 474, 475, 476, 477, 0, 478, 479, 480, 481, 482, - 483, 484, 485, 0, 0, 486, 487, 488, 0, 0, + 483, 484, 485, 0, 1818, 486, 487, 488, 0, 0, 489, 490, 491, 492, 0, 493, 494, 495, 496, 497, 498, 499, 500, 0, 501, 0, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, - 523, 524, 525, 526, 527, 528, 529, 530, 531, 539, - 0, 564, 0, 0, 0, 0, 0, 0, 0, 0, + 523, 524, 525, 526, 527, 528, 529, 530, 531, 1534, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, - 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 134, 135, 0, 0, 137, 138, 0, 140, 141, 142, - 143, 144, 0, 146, 147, 0, 0, 148, 149, 150, - 151, 152, 0, 0, 153, 154, 155, 156, 157, 158, - 159, 0, 160, 161, 162, 163, 164, 0, 0, 0, - 166, 167, 168, 169, 170, 171, 0, 173, 174, 175, - 0, 176, 177, 178, 179, 180, 181, 0, 0, 183, - 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, - 194, 195, 196, 197, 0, 198, 0, 199, 200, 201, + 132, 0, 0, 0, 1535, 0, 0, -869, 0, 1536, + 134, 135, 0, 1537, 137, 138, 1538, 140, 141, 142, + 0, 1539, 1540, 1541, 1542, 0, 1543, 148, 149, 150, + 151, 152, 0, 0, 153, 154, 155, 156, 1544, 1545, + 159, 0, 160, 161, 162, 163, 0, 0, 1546, 0, + 1547, 167, 168, 169, 170, 171, 1548, 173, 174, 175, + 0, 176, 177, 178, 179, 180, 181, 0, 1549, 183, + 184, 185, 186, 187, 188, 189, 190, 191, 192, 1550, + 194, 195, 1551, 197, 0, 198, 0, 199, 200, 201, 202, 203, 204, 0, 0, 205, 206, 207, 208, 0, - 0, 209, 210, 211, 212, 213, 0, 214, 215, 216, + 0, 209, 210, 1093, 212, 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, 0, 221, 222, 223, 224, - 225, 226, 227, 228, 229, 1207, 231, 232, 0, 233, - 0, 234, 235, 236, 237, 0, 238, 0, 239, 0, - 0, 0, 242, 243, 540, 0, 246, 247, 248, 0, - 249, 250, 251, 252, 0, 253, 254, 255, 256, 257, - 258, 259, 0, 261, 262, 263, 264, 0, 265, 266, - 267, 268, 269, 270, 271, 0, 272, 0, 274, 275, - 276, 277, 278, 279, 280, 281, 0, 282, 0, 283, - 0, 0, 286, 0, 288, 289, 290, 0, 291, 292, - 293, 0, 0, 294, 0, 296, 0, 0, 298, 299, - 300, 301, 302, 303, 304, 305, 541, 307, 308, 309, + 0, 226, 227, 228, 229, 230, 231, 0, 0, 233, + 0, 234, 235, 1552, 237, 0, 238, 0, 239, 1553, + 0, 1554, 242, 243, -869, 1555, 246, 247, 248, 0, + 0, 0, 251, 252, 0, 253, 254, 255, 256, 257, + 258, 259, 1556, 261, 262, 263, 264, 0, 265, 266, + 267, 268, 269, 270, 271, 0, 272, 1557, 0, 275, + 276, 277, 278, 279, 1558, 1559, 0, 1560, 0, 283, + 1561, 1562, 286, 1563, 288, 289, 290, 0, 291, 292, + 293, 0, 0, 294, 1564, 296, 1565, 0, 298, 299, + 300, 301, 302, 303, 304, 305, 1566, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, - 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, - 0, 331, 332, 333, 334, 335, 0, 336, 337, 0, - 339, 0, 340, 341, 342, 343, 344, 345, 0, 346, - 347, 0, 811, 348, 349, 350, 0, 0, 351, 352, - 353, 0, 355, 0, 357, 358, 359, 360, 361, 362, + 320, 321, 322, 323, 324, 325, 326, 327, 328, 1567, + 1568, 1569, 332, 333, 334, 0, 0, 336, 337, 1570, + 339, 0, 0, 341, 1571, 343, 344, 345, 0, 346, + 347, 0, 0, 348, 349, 350, 0, 0, 351, 352, + 0, 1572, 355, 1573, 0, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 0, 0, 0, - 0, 370, 371, 372, 0, 374, 375, 376, 377, 378, + 0, 370, 371, 0, 1574, 374, 375, 0, 377, 378, 379, 0, 380, 381, 382, 383, 384, 385, 0, 386, - 387, 388, 389, 390, 391, 392, 393, 394, 395, 0, + 387, 388, 389, 390, 1575, 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, - 406, 407, 408, 0, 409, 410, 0, 412, 413, 414, - 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, - 425, 426, 427, 428, 0, 0, 429, 430, 431, 432, - 433, 434, 435, 436, 437, 0, 0, 439, 440, 441, + 406, 407, 408, 0, 409, 410, 1576, 412, 413, 414, + 1577, 416, 417, 418, 419, 420, 421, 422, 423, 424, + 425, 426, 427, 428, 0, 1578, 429, 430, 431, 432, + 433, 434, 1579, 436, 437, 0, 1580, 439, 440, 1581, 442, 0, 443, 444, 445, 446, 447, 448, 449, 450, - 451, 452, 453, 454, 455, 456, 542, 458, 459, 0, - 0, 460, 461, 0, 462, 0, 464, 465, 466, 467, - 468, 469, 0, 470, 471, 472, 0, 0, 473, 474, - 475, 476, 477, 0, 478, 479, 480, 481, 482, 483, - 484, 485, 0, 0, 486, 487, 488, 0, 0, 489, - 490, 491, 492, 0, 493, 494, 495, 496, 497, 498, - 499, 500, 0, 501, 0, 503, 504, 505, 506, 507, + 451, 452, 453, 454, 455, 456, 1582, 458, 0, 0, + 0, 460, 461, 0, 462, 1583, 464, 465, 466, 467, + 468, 469, 0, 470, 1584, 1585, 0, 0, 473, 474, + 0, 476, 0, 0, 478, 479, 1586, 481, 482, 483, + 484, 485, 1587, 0, 486, 487, 488, 1588, 0, 489, + 490, 491, 492, 0, 493, 494, 495, 496, 497, 0, + 1589, 500, 0, 501, 1590, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, - 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, - 524, 525, 526, 527, 528, 529, 530, 531, 1534, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, - 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, - 0, 0, 0, 1535, 0, 0, 0, 0, 1536, 134, - 135, 0, 1537, 137, 138, 1538, 140, 141, 142, 0, - 1539, 1540, 1541, 1542, 0, 1543, 148, 149, 150, 151, - 152, 0, 0, 153, 154, 155, 156, 1544, 1545, 159, - 0, 160, 161, 162, 163, 0, 0, 1546, 0, 1547, - 167, 168, 169, 170, 171, 1548, 173, 174, 175, 0, - 176, 177, 178, 179, 180, 181, 0, 1549, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 1550, 194, - 195, 1551, 197, 0, 198, 0, 199, 200, 201, 202, - 203, 204, 0, 0, 205, 206, 207, 208, 0, 0, - 209, 210, 1093, 212, 213, 0, 214, 215, 216, 0, - 217, 218, 219, 220, 0, 221, 222, 223, 224, 0, - 226, 227, 228, 229, 230, 231, 0, 0, 233, 0, - 234, 235, 1552, 237, 0, 238, 0, 239, 1553, 0, - 1554, 242, 243, 0, 1555, 246, 247, 248, 0, 0, - 0, 251, 252, 0, 253, 254, 255, 256, 257, 258, - 259, 1556, 261, 262, 263, 264, 0, 265, 266, 267, - 268, 269, 270, 271, 0, 272, 1557, 0, 275, 276, - 277, 278, 279, 1558, 1559, 0, 1560, 0, 283, 1561, - 1562, 286, 1563, 288, 289, 290, 0, 291, 292, 293, - 0, 0, 294, 1564, 296, 1565, 0, 298, 299, 300, - 301, 302, 303, 304, 305, 1566, 307, 308, 309, 310, - 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, - 321, 322, 323, 324, 325, 326, 327, 328, 1567, 1568, - 1569, 332, 333, 334, 0, 0, 336, 337, 1570, 339, - 0, 0, 341, 1571, 343, 344, 345, 0, 346, 347, - 0, 0, 348, 349, 350, 0, 0, 351, 352, 0, - 1572, 355, 1573, 0, 358, 359, 360, 361, 362, 363, - 364, 365, 366, 367, 368, 369, 0, 0, 0, 0, - 370, 371, 0, 1574, 374, 375, 0, 377, 378, 379, - 0, 380, 381, 382, 383, 384, 385, 0, 386, 387, - 388, 389, 390, 1575, 392, 393, 394, 395, 0, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, - 407, 408, 0, 409, 410, 1576, 412, 413, 414, 1577, - 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, - 426, 427, 428, 0, 1578, 429, 430, 431, 432, 433, - 434, 1579, 436, 437, 0, 1580, 439, 440, 1581, 442, - 0, 443, 444, 445, 446, 447, 448, 449, 450, 451, - 452, 453, 454, 455, 456, 1582, 458, 0, 0, 0, - 460, 461, 0, 462, 1583, 464, 465, 466, 467, 468, - 469, 0, 470, 1584, 1585, 0, 0, 473, 474, 0, - 476, 0, 0, 478, 479, 1586, 481, 482, 483, 484, - 485, 1587, 0, 486, 487, 488, 1588, 0, 489, 490, - 491, 492, 0, 493, 494, 495, 496, 497, 0, 1589, - 500, 0, 501, 1590, 503, 504, 505, 506, 507, 508, - 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, - 515, 516, 539, 0, 564, 0, 0, 0, 0, 0, - 0, 0, 0, 528, 529, 530, 531, 0, 0, 0, - 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, - 0, 130, 131, 132, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 134, 135, 0, 0, 137, 138, 0, - 140, 141, 142, 143, 144, 0, 146, 147, 0, 0, - 148, 149, 150, 151, 152, 0, 0, 153, 154, 155, - 156, 157, 158, 159, 0, 160, 161, 162, 163, 164, - 0, 0, 0, 166, 167, 168, 169, 170, 171, 0, - 173, 174, 175, 0, 176, 177, 178, 179, 180, 181, - 0, 0, 183, 184, 185, 186, 187, 188, 189, 190, - 191, 192, 193, 194, 195, 196, 197, 0, 198, 0, - 199, 200, 201, 202, 203, 204, 0, 0, 205, 206, - 207, 208, 0, 0, 209, 210, 211, 212, 213, 0, - 214, 215, 216, 0, 217, 218, 219, 220, 0, 221, - 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, - 232, 0, 233, 0, 234, 235, 236, 237, 0, 238, - 0, 239, 0, 0, 0, 242, 243, 540, 0, 2042, - 247, 248, 0, 249, 250, 251, 252, 0, 253, 254, - 255, 256, 257, 258, 259, 0, 261, 262, 263, 264, - 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, - 0, 274, 275, 276, 277, 278, 279, 280, 281, 0, - 282, 0, 283, 0, 0, 286, 0, 288, 289, 290, - 0, 291, 292, 293, 0, 0, 294, 0, 296, 0, - 0, 298, 299, 2043, 301, 302, 303, 304, 305, 541, - 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, - 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, - 327, 328, 329, 0, 331, 332, 333, 334, 335, 0, - 336, 337, 0, 339, 0, 340, 341, 342, 343, 344, - 345, 0, 346, 347, 0, 0, 348, 349, 350, 0, - 0, 351, 352, 353, 0, 355, 0, 357, 358, 359, - 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, - 0, 0, 0, 0, 370, 371, 372, 0, 374, 375, - 376, 377, 378, 379, 0, 380, 381, 382, 383, 384, - 385, 0, 386, 387, 388, 389, 390, 391, 392, 393, - 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, - 403, 404, 405, 406, 407, 408, 0, 409, 410, 0, - 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, - 422, 423, 424, 425, 426, 427, 428, 0, 0, 429, - 430, 431, 432, 433, 434, 435, 436, 437, 0, 0, - 439, 440, 441, 442, 0, 443, 444, 445, 446, 447, - 448, 449, 450, 451, 452, 453, 454, 455, 456, 542, - 458, 459, 0, 0, 460, 461, 2044, 462, 0, 464, - 465, 2045, 467, 2046, 469, 0, 470, 471, 472, 0, - 0, 473, 474, 475, 476, 477, 0, 478, 479, 480, - 481, 482, 483, 484, 485, 0, 0, 486, 487, 2047, - 0, 0, 489, 490, 491, 492, 0, 493, 494, 495, - 496, 497, 498, 499, 500, 0, 501, 0, 503, 504, - 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, - 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, - 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, - 531, 1534, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, - 130, 131, 132, 0, 0, 0, 1535, 0, 0, 0, - 0, 1536, 134, 135, 0, 1537, 137, 138, 1538, 140, - 141, 142, 0, 1539, 1540, 1541, 1542, 0, 1543, 148, - 149, 150, 151, 152, 0, 0, 153, 154, 155, 156, - 1544, 1545, 159, 0, 160, 161, 162, 163, 0, 0, - 1546, 0, 1547, 167, 168, 169, 170, 171, 1548, 173, - 174, 175, 0, 176, 177, 178, 179, 180, 181, 0, - 1549, 183, 184, 185, 186, 187, 188, 189, 190, 191, - 192, 1550, 194, 195, 1551, 197, 0, 198, 0, 199, - 200, 201, 202, 203, 204, 0, 0, 205, 206, 207, - 208, 0, 0, 209, 210, 1093, 212, 213, 0, 214, - 215, 216, 0, 2454, 218, 219, 220, 0, 221, 222, - 223, 224, 0, 226, 227, 228, 229, 230, 231, 0, - 0, 233, 0, 234, 235, 1552, 237, 0, 238, 0, - 239, 1553, 0, 1554, 242, 243, 0, 1555, 246, 247, - 248, 0, 0, 0, 251, 252, 0, 253, 254, 255, - 256, 257, 258, 259, 1556, 261, 262, 263, 264, 0, - 265, 266, 267, 268, 269, 270, 271, 0, 272, 1557, - 0, 275, 276, 277, 278, 279, 1558, 1559, 0, 1560, - 0, 283, 1561, 1562, 286, 1563, 288, 289, 290, 0, - 291, 292, 293, 0, 0, 294, 1564, 296, 1565, 0, - 298, 299, 300, 301, 302, 303, 304, 305, 1566, 307, - 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, - 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, - 328, 1567, 1568, 1569, 332, 333, 334, 0, 0, 336, - 337, 1570, 339, 0, 0, 341, 1571, 343, 344, 345, - 0, 346, 347, 0, 0, 348, 349, 350, 0, 0, - 351, 352, 0, 1572, 355, 1573, 0, 358, 359, 360, - 361, 362, 363, 364, 365, 366, 367, 368, 369, 0, - 0, 0, 0, 370, 371, 0, 1574, 374, 375, 0, - 377, 378, 379, 0, 380, 381, 382, 383, 384, 385, - 0, 386, 387, 388, 389, 390, 1575, 392, 393, 394, - 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, - 404, 405, 406, 407, 408, 0, 409, 410, 1576, 412, - 413, 414, 1577, 416, 417, 418, 419, 420, 421, 422, - 423, 424, 425, 426, 427, 428, 0, 1578, 429, 430, - 431, 432, 433, 434, 1579, 436, 437, 0, 1580, 439, - 440, 1581, 442, 0, 443, 444, 445, 446, 447, 448, - 449, 450, 451, 452, 453, 454, 455, 456, 1582, 458, - 0, 0, 0, 460, 461, 0, 462, 1583, 464, 465, - 466, 467, 468, 469, 0, 470, 1584, 1585, 0, 0, - 473, 474, 0, 476, 0, 0, 478, 479, 1586, 481, - 482, 483, 484, 485, 1587, 0, 486, 487, 488, 1588, - 0, 489, 490, 491, 492, 0, 493, 494, 495, 496, - 497, 0, 1589, 500, 0, 501, 1590, 503, 504, 505, - 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, - 512, 513, 514, 515, 516, 539, 0, 564, 0, 0, - 0, 0, 0, 0, 0, 0, 528, 529, 530, 531, - 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, - 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 134, 135, 0, 0, - 137, 138, 0, 140, 141, 142, 143, 144, 0, 146, - 147, 0, 0, 148, 149, 150, 151, 152, 0, 0, - 153, 154, 155, 156, 157, 158, 159, 0, 160, 161, - 162, 163, 164, 0, 0, 0, 166, 167, 168, 169, - 170, 171, 0, 173, 174, 175, 0, 176, 177, 178, - 179, 180, 181, 0, 0, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 0, 198, 0, 199, 200, 201, 202, 203, 204, 0, - 0, 205, 206, 207, 208, 0, 0, 209, 210, 211, - 212, 213, 0, 214, 215, 216, 0, 217, 218, 219, - 220, 0, 221, 222, 223, 224, 225, 226, 227, 228, - 229, 230, 231, 232, 0, 233, 0, 234, 235, 236, - 237, 0, 238, 0, 239, 0, 0, 0, 242, 243, - 540, 0, 246, 247, 248, 0, 249, 250, 251, 252, - 0, 253, 254, 255, 256, 257, 258, 259, 0, 261, - 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, - 271, 0, 272, 0, 274, 275, 276, 277, 278, 279, - 280, 281, 0, 282, 0, 283, 0, 0, 286, 0, - 288, 289, 290, 0, 291, 292, 293, 0, 0, 294, - 0, 296, 0, 0, 298, 299, 300, 301, 302, 303, - 304, 305, 541, 307, 308, 309, 310, 311, 312, 313, - 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, - 324, 325, 326, 327, 328, 329, 0, 331, 332, 333, - 334, 335, 0, 336, 337, 0, 339, 0, 340, 341, - 342, 343, 344, 345, 0, 346, 347, 0, 0, 348, - 349, 350, 0, 0, 351, 352, 353, 0, 355, 0, - 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, - 367, 368, 369, 0, 0, 0, 0, 370, 371, 372, - 0, 374, 375, 376, 377, 378, 379, 0, 380, 381, - 382, 383, 384, 385, 0, 386, 387, 388, 389, 390, - 391, 392, 393, 394, 395, 0, 396, 397, 398, 399, - 400, 401, 402, 403, 404, 405, 406, 407, 408, 0, - 409, 410, 0, 412, 413, 414, 415, 416, 417, 418, - 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, - 0, 0, 429, 430, 431, 432, 433, 434, 435, 436, - 437, 0, 0, 439, 440, 441, 442, 0, 443, 444, - 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 542, 458, 459, 0, 0, 460, 461, 0, - 462, 0, 464, 465, 466, 467, 468, 469, 0, 470, - 471, 472, 0, 0, 473, 474, 475, 476, 477, 0, - 478, 479, 480, 481, 482, 483, 484, 485, 0, 0, - 486, 487, 488, 0, 0, 489, 490, 491, 492, 0, - 493, 494, 495, 496, 497, 498, 499, 500, 0, 501, - 0, 503, 504, 505, 506, 507, 508, 509, 0, 0, - 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, - 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, - 528, 529, 530, 531, 539, 0, 836, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, - 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 134, 135, 0, 0, 137, - 138, 0, 140, 141, 142, 143, 144, 0, 146, 147, - 0, 0, 148, 149, 150, 151, 152, 0, 0, 153, - 154, 155, 156, 157, 158, 159, 0, 160, 161, 162, - 163, 164, 0, 0, 0, 166, 167, 168, 169, 170, - 171, 0, 173, 174, 175, 0, 176, 177, 178, 179, - 180, 181, 0, 0, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 193, 194, 195, 196, 197, 0, - 198, 0, 199, 200, 201, 202, 203, 204, 0, 0, - 205, 206, 207, 208, 0, 0, 209, 210, 211, 212, - 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, - 0, 221, 222, 223, 224, 225, 226, 227, 228, 229, - 230, 231, 232, 0, 233, 0, 234, 235, 236, 237, - 0, 238, 0, 239, 0, 0, 0, 242, 243, 540, - 0, 246, 247, 248, 0, 249, 250, 251, 252, 0, - 253, 254, 255, 256, 257, 258, 259, 0, 261, 262, - 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, - 0, 272, 0, 274, 275, 276, 277, 278, 279, 280, - 281, 0, 282, 0, 283, 0, 0, 286, 0, 288, - 289, 290, 0, 291, 292, 293, 0, 0, 294, 0, - 296, 0, 0, 298, 299, 300, 301, 302, 303, 304, - 305, 541, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 0, 331, 332, 333, 334, - 335, 0, 336, 337, 0, 339, 0, 340, 341, 342, - 343, 344, 345, 0, 346, 347, 0, 0, 348, 349, - 350, 0, 0, 351, 352, 353, 0, 355, 0, 357, - 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, - 368, 369, 0, 0, 0, 0, 370, 371, 372, 0, - 374, 375, 376, 377, 378, 379, 0, 380, 381, 382, - 383, 384, 385, 0, 386, 387, 388, 389, 390, 391, - 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, - 401, 402, 403, 404, 405, 406, 407, 408, 0, 409, - 410, 0, 412, 413, 414, 415, 416, 417, 418, 419, - 420, 421, 422, 423, 424, 425, 426, 427, 428, 0, - 0, 429, 430, 431, 432, 433, 434, 435, 436, 437, - 0, 0, 439, 440, 441, 442, 0, 443, 444, 445, - 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, - 456, 542, 458, 459, 0, 0, 460, 461, 0, 462, - 0, 464, 465, 466, 467, 468, 469, 0, 470, 471, - 472, 0, 0, 473, 474, 475, 476, 477, 0, 478, - 479, 480, 481, 482, 483, 484, 485, 0, 0, 486, - 487, 488, 0, 0, 489, 490, 491, 492, 0, 493, - 494, 495, 496, 497, 498, 499, 500, 0, 501, 0, - 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, - 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, - 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, - 529, 530, 531, 539, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 514, 515, 516, 539, 0, 564, 0, 0, 0, 0, + 0, 0, 0, 0, 528, 529, 530, 531, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, - 129, 842, 130, 131, 132, 0, 0, 0, 0, 0, + 129, 0, 130, 131, 132, 3, 4, 0, 0, 0, 0, 0, 0, 0, 134, 135, 0, 0, 137, 138, 0, 140, 141, 142, 143, 144, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 0, 0, 153, 154, @@ -10637,13 +10135,13 @@ static const yytype_int16 yytable[] = 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 0, 233, 0, 234, 235, 236, 237, 0, 238, 0, 239, 0, 0, 0, 242, 243, 540, 0, - 843, 247, 248, 0, 249, 250, 251, 252, 0, 253, + 246, 247, 248, 0, 249, 250, 251, 252, 0, 253, 254, 255, 256, 257, 258, 259, 0, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 0, 274, 275, 276, 277, 278, 279, 280, 281, 0, 282, 0, 283, 0, 0, 286, 0, 288, 289, 290, 0, 291, 292, 293, 0, 0, 294, 0, 296, - 0, 0, 298, 299, 844, 301, 302, 303, 304, 305, + 0, 0, 298, 299, 300, 301, 302, 303, 304, 305, 541, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 0, 331, 332, 333, 334, 335, @@ -10658,22 +10156,22 @@ static const yytype_int16 yytable[] = 402, 403, 404, 405, 406, 407, 408, 0, 409, 410, 0, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 0, 0, - 429, 430, 431, 432, 845, 434, 435, 436, 437, 0, + 429, 430, 431, 432, 433, 434, 435, 436, 437, 0, 0, 439, 440, 441, 442, 0, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 542, 458, 459, 0, 0, 460, 461, 0, 462, 0, - 464, 465, 466, 467, 468, 469, 0, 470, 846, 472, - 0, 0, 847, 474, 475, 476, 477, 0, 478, 479, + 464, 465, 466, 467, 468, 469, 0, 470, 471, 472, + 0, 0, 473, 474, 475, 476, 477, 0, 478, 479, 480, 481, 482, 483, 484, 485, 0, 0, 486, 487, 488, 0, 0, 489, 490, 491, 492, 0, 493, 494, - 495, 496, 497, 498, 499, 848, 0, 501, 0, 503, + 495, 496, 497, 498, 499, 500, 0, 501, 0, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 539, 0, 564, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, - 0, 130, 131, 132, 0, 0, 0, 0, 0, 0, + 565, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 134, 135, 0, 0, 137, 138, 0, 140, 141, 142, 143, 144, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 0, 0, 153, 154, 155, @@ -10703,9 +10201,9 @@ static const yytype_int16 yytable[] = 0, 351, 352, 353, 0, 355, 0, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 0, 0, 0, 0, 370, 371, 372, 0, 374, 375, - 376, 377, 378, 379, 0, 380, 381, 382, 383, 384, + 376, 566, 378, 379, 0, 380, 381, 382, 383, 384, 385, 0, 386, 387, 388, 389, 390, 391, 392, 393, - 881, 395, 0, 396, 397, 398, 399, 400, 401, 402, + 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 0, 409, 410, 0, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 0, 0, 429, @@ -10740,7 +10238,7 @@ static const yytype_int16 yytable[] = 0, 233, 0, 234, 235, 236, 237, 0, 238, 0, 239, 0, 0, 0, 242, 243, 540, 0, 246, 247, 248, 0, 249, 250, 251, 252, 0, 253, 254, 255, - 256, 257, 918, 259, 0, 261, 262, 263, 264, 0, + 256, 257, 258, 259, 0, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 0, 274, 275, 276, 277, 278, 279, 280, 281, 0, 282, 0, 283, 0, 0, 286, 0, 288, 289, 290, 0, @@ -10750,7 +10248,7 @@ static const yytype_int16 yytable[] = 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 0, 331, 332, 333, 334, 335, 0, 336, 337, 0, 339, 0, 340, 341, 342, 343, 344, 345, - 0, 346, 347, 0, 0, 348, 349, 350, 0, 0, + 0, 346, 347, 0, 811, 348, 349, 350, 0, 0, 351, 352, 353, 0, 355, 0, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 0, 0, 0, 0, 370, 371, 372, 0, 374, 375, 376, @@ -10791,7 +10289,7 @@ static const yytype_int16 yytable[] = 233, 0, 234, 235, 236, 237, 0, 238, 0, 239, 0, 0, 0, 242, 243, 540, 0, 246, 247, 248, 0, 249, 250, 251, 252, 0, 253, 254, 255, 256, - 257, 921, 259, 0, 261, 262, 263, 264, 0, 265, + 257, 923, 259, 0, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 0, 274, 275, 276, 277, 278, 279, 280, 281, 0, 282, 0, 283, 0, 0, 286, 0, 288, 289, 290, 0, 291, @@ -10801,7 +10299,7 @@ static const yytype_int16 yytable[] = 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 0, 331, 332, 333, 334, 335, 0, 336, 337, 0, 339, 0, 340, 341, 342, 343, 344, 345, 0, - 346, 347, 0, 0, 348, 349, 350, 0, 0, 351, + 346, 347, 0, 811, 348, 349, 350, 0, 0, 351, 352, 353, 0, 355, 0, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 0, 0, 0, 0, 370, 371, 372, 0, 374, 375, 376, 377, @@ -10825,7 +10323,7 @@ static const yytype_int16 yytable[] = 523, 524, 525, 526, 527, 528, 529, 530, 531, 539, 0, 564, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, - 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, + 123, 124, 125, 126, 127, 128, 129, 968, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 134, 135, 0, 0, 137, 138, 0, 140, 141, 142, 143, 144, 0, 146, 147, 0, 0, 148, 149, 150, @@ -10842,7 +10340,7 @@ static const yytype_int16 yytable[] = 0, 234, 235, 236, 237, 0, 238, 0, 239, 0, 0, 0, 242, 243, 540, 0, 246, 247, 248, 0, 249, 250, 251, 252, 0, 253, 254, 255, 256, 257, - 925, 259, 0, 261, 262, 263, 264, 0, 265, 266, + 258, 259, 0, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 0, 274, 275, 276, 277, 278, 279, 280, 281, 0, 282, 0, 283, 0, 0, 286, 0, 288, 289, 290, 0, 291, 292, @@ -10889,10 +10387,10 @@ static const yytype_int16 yytable[] = 203, 204, 0, 0, 205, 206, 207, 208, 0, 0, 209, 210, 211, 212, 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, 0, 221, 222, 223, 224, 225, - 226, 227, 228, 229, 230, 231, 232, 0, 233, 0, + 226, 227, 228, 229, 1207, 231, 232, 0, 233, 0, 234, 235, 236, 237, 0, 238, 0, 239, 0, 0, 0, 242, 243, 540, 0, 246, 247, 248, 0, 249, - 250, 251, 252, 0, 253, 254, 255, 256, 257, 956, + 250, 251, 252, 0, 253, 254, 255, 256, 257, 258, 259, 0, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 0, 274, 275, 276, 277, 278, 279, 280, 281, 0, 282, 0, 283, 0, @@ -10903,7 +10401,7 @@ static const yytype_int16 yytable[] = 321, 322, 323, 324, 325, 326, 327, 328, 329, 0, 331, 332, 333, 334, 335, 0, 336, 337, 0, 339, 0, 340, 341, 342, 343, 344, 345, 0, 346, 347, - 0, 0, 348, 349, 350, 0, 0, 351, 352, 353, + 0, 811, 348, 349, 350, 0, 0, 351, 352, 353, 0, 355, 0, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 0, 0, 0, 0, 370, 371, 372, 0, 374, 375, 376, 377, 378, 379, @@ -10924,164 +10422,161 @@ static const yytype_int16 yytable[] = 500, 0, 501, 0, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, - 525, 526, 527, 528, 529, 530, 531, 539, 0, 564, + 525, 526, 527, 528, 529, 530, 531, 1534, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 134, 135, - 0, 0, 137, 138, 0, 140, 141, 142, 143, 144, - 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, - 0, 0, 153, 154, 155, 156, 157, 158, 159, 0, - 160, 161, 162, 163, 164, 0, 0, 0, 166, 167, - 168, 169, 170, 171, 0, 173, 174, 175, 0, 176, - 177, 178, 179, 180, 181, 0, 0, 183, 184, 185, - 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, - 196, 197, 0, 198, 0, 199, 200, 201, 202, 203, + 0, 0, 1535, 0, 0, 0, 0, 1536, 134, 135, + 0, 1537, 137, 138, 1538, 140, 141, 142, 0, 1539, + 1540, 1541, 1542, 0, 1543, 148, 149, 150, 151, 152, + 0, 0, 153, 154, 155, 156, 1544, 1545, 159, 0, + 160, 161, 162, 163, 0, 0, 1546, 0, 1547, 167, + 168, 169, 170, 171, 1548, 173, 174, 175, 0, 176, + 177, 178, 179, 180, 181, 0, 1549, 183, 184, 185, + 186, 187, 188, 189, 190, 191, 192, 1550, 194, 195, + 1551, 197, 0, 198, 0, 199, 200, 201, 202, 203, 204, 0, 0, 205, 206, 207, 208, 0, 0, 209, - 210, 211, 212, 213, 0, 214, 215, 216, 0, 217, - 218, 219, 220, 0, 221, 222, 223, 224, 225, 226, - 227, 228, 229, 230, 231, 232, 0, 233, 0, 234, - 235, 236, 237, 0, 238, 0, 239, 0, 0, 0, - 242, 243, 540, 0, 246, 247, 248, 0, 249, 250, - 251, 252, 0, 253, 254, 255, 256, 257, 984, 259, - 0, 261, 262, 263, 264, 0, 265, 266, 267, 268, - 269, 270, 271, 0, 272, 0, 274, 275, 276, 277, - 278, 279, 280, 281, 0, 282, 0, 283, 0, 0, - 286, 0, 288, 289, 290, 0, 291, 292, 293, 0, - 0, 294, 0, 296, 0, 0, 298, 299, 300, 301, - 302, 303, 304, 305, 541, 307, 308, 309, 310, 311, + 210, 1093, 212, 213, 0, 214, 215, 216, 0, 217, + 218, 219, 220, 0, 221, 222, 223, 224, 0, 226, + 227, 228, 229, 230, 231, 0, 0, 233, 0, 234, + 235, 1552, 237, 0, 238, 0, 239, 1553, 0, 1554, + 242, 243, 0, 1555, 246, 247, 248, 0, 0, 0, + 251, 252, 0, 253, 254, 255, 256, 257, 258, 259, + 1556, 261, 262, 263, 264, 0, 265, 266, 267, 268, + 269, 270, 271, 0, 272, 1557, 0, 275, 276, 277, + 278, 279, 1558, 1559, 0, 1560, 0, 283, 1561, 1562, + 286, 1563, 288, 289, 290, 0, 291, 292, 293, 0, + 0, 294, 1564, 296, 1565, 0, 298, 299, 300, 301, + 302, 303, 304, 305, 1566, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, - 322, 323, 324, 325, 326, 327, 328, 329, 0, 331, - 332, 333, 334, 335, 0, 336, 337, 0, 339, 0, - 340, 341, 342, 343, 344, 345, 0, 346, 347, 0, - 0, 348, 349, 350, 0, 0, 351, 352, 353, 0, - 355, 0, 357, 358, 359, 360, 361, 362, 363, 364, + 322, 323, 324, 325, 326, 327, 328, 1567, 1568, 1569, + 332, 333, 334, 0, 0, 336, 337, 1570, 339, 0, + 0, 341, 1571, 343, 344, 345, 0, 346, 347, 0, + 0, 348, 349, 350, 0, 0, 351, 352, 0, 1572, + 355, 1573, 0, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 0, 0, 0, 0, 370, - 371, 372, 0, 374, 375, 376, 377, 378, 379, 0, + 371, 0, 1574, 374, 375, 0, 377, 378, 379, 0, 380, 381, 382, 383, 384, 385, 0, 386, 387, 388, - 389, 390, 391, 392, 393, 394, 395, 0, 396, 397, + 389, 390, 1575, 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, - 408, 0, 409, 410, 0, 412, 413, 414, 415, 416, + 408, 0, 409, 410, 1576, 412, 413, 414, 1577, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, - 427, 428, 0, 0, 429, 430, 431, 432, 433, 434, - 435, 436, 437, 0, 0, 439, 440, 441, 442, 0, + 427, 428, 0, 1578, 429, 430, 431, 432, 433, 434, + 1579, 436, 437, 0, 1580, 439, 440, 1581, 442, 0, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, - 453, 454, 455, 456, 542, 458, 459, 0, 0, 460, - 461, 0, 462, 0, 464, 465, 466, 467, 468, 469, - 0, 470, 471, 472, 0, 0, 473, 474, 475, 476, - 477, 0, 478, 479, 480, 481, 482, 483, 484, 485, - 0, 0, 486, 487, 488, 0, 0, 489, 490, 491, - 492, 0, 493, 494, 495, 496, 497, 498, 499, 500, - 0, 501, 0, 503, 504, 505, 506, 507, 508, 509, + 453, 454, 455, 456, 1582, 458, 0, 0, 0, 460, + 461, 0, 462, 1583, 464, 465, 466, 467, 468, 469, + 0, 470, 1584, 1585, 0, 0, 473, 474, 0, 476, + 0, 0, 478, 479, 1586, 481, 482, 483, 484, 485, + 1587, 0, 486, 487, 488, 1588, 0, 489, 490, 491, + 492, 0, 493, 494, 495, 496, 497, 0, 1589, 500, + 0, 501, 1590, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, - 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, - 526, 527, 528, 529, 530, 531, 539, 0, 564, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, - 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 134, 135, 0, - 0, 137, 138, 0, 140, 141, 142, 143, 144, 0, - 146, 147, 0, 0, 148, 149, 150, 151, 152, 0, - 0, 153, 154, 155, 156, 157, 158, 159, 0, 160, - 161, 162, 163, 164, 0, 0, 0, 166, 167, 168, - 169, 170, 171, 0, 173, 174, 175, 0, 176, 177, - 178, 179, 180, 181, 0, 0, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, - 197, 0, 198, 0, 199, 200, 201, 202, 203, 204, - 0, 0, 205, 206, 207, 208, 0, 0, 209, 210, - 211, 212, 213, 0, 214, 215, 216, 0, 217, 218, - 219, 220, 0, 221, 222, 223, 224, 225, 226, 227, - 228, 229, 230, 231, 232, 0, 233, 0, 234, 235, - 236, 237, 0, 238, 0, 239, 0, 0, 0, 242, - 243, 540, 0, 246, 247, 248, 0, 249, 250, 251, - 252, 0, 253, 254, 255, 256, 257, 987, 259, 0, - 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, - 270, 271, 0, 272, 0, 274, 275, 276, 277, 278, - 279, 280, 281, 0, 282, 0, 283, 0, 0, 286, - 0, 288, 289, 290, 0, 291, 292, 293, 0, 0, - 294, 0, 296, 0, 0, 298, 299, 300, 301, 302, - 303, 304, 305, 541, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 325, 326, 327, 328, 329, 0, 331, 332, - 333, 334, 335, 0, 336, 337, 0, 339, 0, 340, - 341, 342, 343, 344, 345, 0, 346, 347, 0, 0, - 348, 349, 350, 0, 0, 351, 352, 353, 0, 355, - 0, 357, 358, 359, 360, 361, 362, 363, 364, 365, - 366, 367, 368, 369, 0, 0, 0, 0, 370, 371, - 372, 0, 374, 375, 376, 377, 378, 379, 0, 380, - 381, 382, 383, 384, 385, 0, 386, 387, 388, 389, - 390, 391, 392, 393, 394, 395, 0, 396, 397, 398, - 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, - 0, 409, 410, 0, 412, 413, 414, 415, 416, 417, - 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, - 428, 0, 0, 429, 430, 431, 432, 433, 434, 435, - 436, 437, 0, 0, 439, 440, 441, 442, 0, 443, - 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, - 454, 455, 456, 542, 458, 459, 0, 0, 460, 461, - 0, 462, 0, 464, 465, 466, 467, 468, 469, 0, - 470, 471, 472, 0, 0, 473, 474, 475, 476, 477, - 0, 478, 479, 480, 481, 482, 483, 484, 485, 0, - 0, 486, 487, 488, 0, 0, 489, 490, 491, 492, - 0, 493, 494, 495, 496, 497, 498, 499, 500, 0, - 501, 0, 503, 504, 505, 506, 507, 508, 509, 0, - 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, - 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, - 527, 528, 529, 530, 531, 539, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, - 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, - 0, 0, 0, 1030, 0, 0, 134, 135, 0, 0, - 137, 138, 0, 140, 141, 142, 143, 144, 0, 146, - 147, 0, 0, 148, 149, 150, 151, 152, 0, 0, - 153, 154, 155, 156, 157, 158, 159, 0, 160, 161, - 162, 163, 164, 0, 0, 0, 166, 167, 168, 169, - 170, 171, 0, 173, 174, 175, 0, 176, 177, 178, - 179, 180, 181, 0, 0, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 0, 198, 0, 199, 200, 201, 202, 203, 204, 0, - 0, 205, 206, 207, 208, 0, 0, 209, 210, 211, - 212, 213, 0, 214, 215, 216, 0, 217, 218, 219, - 220, 0, 221, 222, 223, 224, 225, 226, 227, 228, - 229, 230, 231, 232, 0, 233, 0, 234, 235, 236, - 237, 0, 238, 0, 239, 0, 0, 0, 242, 243, - 540, 0, 246, 247, 248, 0, 249, 250, 251, 252, - 0, 253, 254, 255, 256, 257, 258, 259, 0, 261, - 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, - 271, 0, 272, 0, 274, 275, 276, 277, 278, 279, - 280, 281, 0, 282, 0, 283, 0, 0, 286, 0, - 288, 289, 290, 0, 291, 292, 293, 0, 0, 294, - 0, 296, 0, 0, 298, 299, 300, 301, 302, 303, - 304, 305, 541, 307, 308, 309, 310, 311, 312, 313, - 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, - 324, 325, 326, 327, 328, 329, 0, 331, 332, 333, - 334, 335, 0, 336, 337, 0, 339, 0, 340, 341, - 342, 343, 344, 345, 0, 346, 347, 0, 0, 348, - 349, 350, 0, 0, 351, 352, 353, 0, 355, 0, - 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, - 367, 368, 369, 0, 0, 0, 0, 370, 371, 372, - 0, 374, 375, 376, 377, 378, 379, 0, 380, 381, - 382, 383, 384, 385, 0, 386, 387, 388, 389, 390, - 391, 392, 393, 394, 395, 0, 396, 397, 398, 399, - 400, 401, 402, 403, 404, 405, 406, 407, 408, 0, - 409, 410, 0, 412, 413, 414, 415, 416, 417, 418, - 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, - 0, 0, 429, 430, 431, 432, 433, 434, 435, 436, - 437, 0, 0, 439, 440, 441, 442, 0, 443, 444, - 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 542, 458, 459, 0, 0, 460, 461, 0, - 462, 0, 464, 465, 466, 467, 468, 469, 0, 470, - 471, 472, 0, 0, 473, 474, 475, 476, 477, 0, - 478, 479, 480, 481, 482, 483, 484, 485, 0, 0, - 486, 487, 488, 0, 0, 489, 490, 491, 492, 0, - 493, 494, 495, 496, 497, 498, 499, 500, 0, 501, - 0, 503, 504, 505, 506, 507, 508, 509, 0, 0, - 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, - 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, - 528, 529, 530, 531, 539, 0, 0, 0, 0, 0, + 516, 539, 0, 564, 0, 0, 0, 0, 0, 0, + 0, 0, 528, 529, 530, 531, 0, 0, 0, 0, + 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, + 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 134, 135, 0, 0, 137, 138, 0, 140, + 141, 142, 143, 144, 0, 146, 147, 0, 0, 148, + 149, 150, 151, 152, 0, 0, 153, 154, 155, 156, + 157, 158, 159, 0, 160, 161, 162, 163, 164, 0, + 0, 0, 166, 167, 168, 169, 170, 171, 0, 173, + 174, 175, 0, 176, 177, 178, 179, 180, 181, 0, + 0, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 0, 198, 0, 199, + 200, 201, 202, 203, 204, 0, 0, 205, 206, 207, + 208, 0, 0, 209, 210, 211, 212, 213, 0, 214, + 215, 216, 0, 217, 218, 219, 220, 0, 221, 222, + 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, + 0, 233, 0, 234, 235, 236, 237, 0, 238, 0, + 239, 0, 0, 0, 242, 243, 540, 0, 2042, 247, + 248, 0, 249, 250, 251, 252, 0, 253, 254, 255, + 256, 257, 258, 259, 0, 261, 262, 263, 264, 0, + 265, 266, 267, 268, 269, 270, 271, 0, 272, 0, + 274, 275, 276, 277, 278, 279, 280, 281, 0, 282, + 0, 283, 0, 0, 286, 0, 288, 289, 290, 0, + 291, 292, 293, 0, 0, 294, 0, 296, 0, 0, + 298, 299, 2043, 301, 302, 303, 304, 305, 541, 307, + 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, + 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, + 328, 329, 0, 331, 332, 333, 334, 335, 0, 336, + 337, 0, 339, 0, 340, 341, 342, 343, 344, 345, + 0, 346, 347, 0, 0, 348, 349, 350, 0, 0, + 351, 352, 353, 0, 355, 0, 357, 358, 359, 360, + 361, 362, 363, 364, 365, 366, 367, 368, 369, 0, + 0, 0, 0, 370, 371, 372, 0, 374, 375, 376, + 377, 378, 379, 0, 380, 381, 382, 383, 384, 385, + 0, 386, 387, 388, 389, 390, 391, 392, 393, 394, + 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, + 404, 405, 406, 407, 408, 0, 409, 410, 0, 412, + 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, + 423, 424, 425, 426, 427, 428, 0, 0, 429, 430, + 431, 432, 433, 434, 435, 436, 437, 0, 0, 439, + 440, 441, 442, 0, 443, 444, 445, 446, 447, 448, + 449, 450, 451, 452, 453, 454, 455, 456, 542, 458, + 459, 0, 0, 460, 461, 2044, 462, 0, 464, 465, + 2045, 467, 2046, 469, 0, 470, 471, 472, 0, 0, + 473, 474, 475, 476, 477, 0, 478, 479, 480, 481, + 482, 483, 484, 485, 0, 0, 486, 487, 2047, 0, + 0, 489, 490, 491, 492, 0, 493, 494, 495, 496, + 497, 498, 499, 500, 0, 501, 0, 503, 504, 505, + 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, + 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, + 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, + 1534, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, + 131, 132, 0, 0, 0, 1535, 0, 0, 0, 0, + 1536, 134, 135, 0, 1537, 137, 138, 1538, 140, 141, + 142, 0, 1539, 1540, 1541, 1542, 0, 1543, 148, 149, + 150, 151, 152, 0, 0, 153, 154, 155, 156, 1544, + 1545, 159, 0, 160, 161, 162, 163, 0, 0, 1546, + 0, 1547, 167, 168, 169, 170, 171, 1548, 173, 174, + 175, 0, 176, 177, 178, 179, 180, 181, 0, 1549, + 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, + 1550, 194, 195, 1551, 197, 0, 198, 0, 199, 200, + 201, 202, 203, 204, 0, 0, 205, 206, 207, 208, + 0, 0, 209, 210, 1093, 212, 213, 0, 214, 215, + 216, 0, 2455, 218, 219, 220, 0, 221, 222, 223, + 224, 0, 226, 227, 228, 229, 230, 231, 0, 0, + 233, 0, 234, 235, 1552, 237, 0, 238, 0, 239, + 1553, 0, 1554, 242, 243, 0, 1555, 246, 247, 248, + 0, 0, 0, 251, 252, 0, 253, 254, 255, 256, + 257, 258, 259, 1556, 261, 262, 263, 264, 0, 265, + 266, 267, 268, 269, 270, 271, 0, 272, 1557, 0, + 275, 276, 277, 278, 279, 1558, 1559, 0, 1560, 0, + 283, 1561, 1562, 286, 1563, 288, 289, 290, 0, 291, + 292, 293, 0, 0, 294, 1564, 296, 1565, 0, 298, + 299, 300, 301, 302, 303, 304, 305, 1566, 307, 308, + 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, + 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, + 1567, 1568, 1569, 332, 333, 334, 0, 0, 336, 337, + 1570, 339, 0, 0, 341, 1571, 343, 344, 345, 0, + 346, 347, 0, 0, 348, 349, 350, 0, 0, 351, + 352, 0, 1572, 355, 1573, 0, 358, 359, 360, 361, + 362, 363, 364, 365, 366, 367, 368, 369, 0, 0, + 0, 0, 370, 371, 0, 1574, 374, 375, 0, 377, + 378, 379, 0, 380, 381, 382, 383, 384, 385, 0, + 386, 387, 388, 389, 390, 1575, 392, 393, 394, 395, + 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, + 405, 406, 407, 408, 0, 409, 410, 1576, 412, 413, + 414, 1577, 416, 417, 418, 419, 420, 421, 422, 423, + 424, 425, 426, 427, 428, 0, 1578, 429, 430, 431, + 432, 433, 434, 1579, 436, 437, 0, 1580, 439, 440, + 1581, 442, 0, 443, 444, 445, 446, 447, 448, 449, + 450, 451, 452, 453, 454, 455, 456, 1582, 458, 0, + 0, 0, 460, 461, 0, 462, 1583, 464, 465, 466, + 467, 468, 469, 0, 470, 1584, 1585, 0, 0, 473, + 474, 0, 476, 0, 0, 478, 479, 1586, 481, 482, + 483, 484, 485, 1587, 0, 486, 487, 488, 1588, 0, + 489, 490, 491, 492, 0, 493, 494, 495, 496, 497, + 0, 1589, 500, 0, 501, 1590, 503, 504, 505, 506, + 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, + 513, 514, 515, 516, 539, 0, 564, 0, 0, 0, + 0, 0, 0, 0, 0, 528, 529, 530, 531, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, - 0, 0, 1057, 0, 0, 134, 135, 0, 0, 137, + 0, 0, 0, 0, 0, 134, 135, 0, 0, 137, 138, 0, 140, 141, 142, 143, 144, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 0, 0, 153, 154, 155, 156, 157, 158, 159, 0, 160, 161, 162, @@ -11128,10 +10623,10 @@ static const yytype_int16 yytable[] = 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, - 529, 530, 531, 539, 0, 0, 0, 0, 0, 0, + 529, 530, 531, 539, 0, 836, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, - 129, 842, 130, 131, 132, 0, 0, 0, 0, 0, + 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 134, 135, 0, 0, 137, 138, 0, 140, 141, 142, 143, 144, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 0, 0, 153, 154, @@ -11171,18 +10666,18 @@ static const yytype_int16 yytable[] = 0, 439, 440, 441, 442, 0, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 542, 458, 459, 0, 0, 460, 461, 0, 462, 0, - 464, 465, 466, 467, 468, 469, 0, 470, 846, 472, - 0, 0, 847, 474, 475, 476, 477, 0, 478, 479, + 464, 465, 466, 467, 468, 469, 0, 470, 471, 472, + 0, 0, 473, 474, 475, 476, 477, 0, 478, 479, 480, 481, 482, 483, 484, 485, 0, 0, 486, 487, 488, 0, 0, 489, 490, 491, 492, 0, 493, 494, 495, 496, 497, 498, 499, 500, 0, 501, 0, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, - 530, 531, 539, 0, 564, 0, 0, 0, 0, 0, + 530, 531, 539, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, - 0, 130, 131, 132, 0, 0, 0, 0, 0, 0, + 842, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 134, 135, 0, 0, 137, 138, 0, 140, 141, 142, 143, 144, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 0, 0, 153, 154, 155, @@ -11196,14 +10691,14 @@ static const yytype_int16 yytable[] = 214, 215, 216, 0, 217, 218, 219, 220, 0, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 0, 233, 0, 234, 235, 236, 237, 0, 238, - 0, 239, 0, 0, 0, 242, 243, 540, 0, 246, + 0, 239, 0, 0, 0, 242, 243, 540, 0, 843, 247, 248, 0, 249, 250, 251, 252, 0, 253, 254, - 255, 256, 257, 1355, 259, 0, 261, 262, 263, 264, + 255, 256, 257, 258, 259, 0, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 0, 274, 275, 276, 277, 278, 279, 280, 281, 0, 282, 0, 283, 0, 0, 286, 0, 288, 289, 290, 0, 291, 292, 293, 0, 0, 294, 0, 296, 0, - 0, 298, 299, 300, 301, 302, 303, 304, 305, 541, + 0, 298, 299, 844, 301, 302, 303, 304, 305, 541, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 0, 331, 332, 333, 334, 335, 0, @@ -11218,15 +10713,15 @@ static const yytype_int16 yytable[] = 403, 404, 405, 406, 407, 408, 0, 409, 410, 0, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 0, 0, 429, - 430, 431, 432, 433, 434, 435, 436, 437, 0, 0, + 430, 431, 432, 845, 434, 435, 436, 437, 0, 0, 439, 440, 441, 442, 0, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 542, 458, 459, 0, 0, 460, 461, 0, 462, 0, 464, - 465, 466, 467, 468, 469, 0, 470, 471, 472, 0, - 0, 473, 474, 475, 476, 477, 0, 478, 479, 480, + 465, 466, 467, 468, 469, 0, 470, 846, 472, 0, + 0, 847, 474, 475, 476, 477, 0, 478, 479, 480, 481, 482, 483, 484, 485, 0, 0, 486, 487, 488, 0, 0, 489, 490, 491, 492, 0, 493, 494, 495, - 496, 497, 498, 499, 500, 0, 501, 0, 503, 504, + 496, 497, 498, 499, 848, 0, 501, 0, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, @@ -11249,7 +10744,7 @@ static const yytype_int16 yytable[] = 0, 233, 0, 234, 235, 236, 237, 0, 238, 0, 239, 0, 0, 0, 242, 243, 540, 0, 246, 247, 248, 0, 249, 250, 251, 252, 0, 253, 254, 255, - 256, 257, 1357, 259, 0, 261, 262, 263, 264, 0, + 256, 257, 258, 259, 0, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 0, 274, 275, 276, 277, 278, 279, 280, 281, 0, 282, 0, 283, 0, 0, 286, 0, 288, 289, 290, 0, @@ -11264,7 +10759,7 @@ static const yytype_int16 yytable[] = 361, 362, 363, 364, 365, 366, 367, 368, 369, 0, 0, 0, 0, 370, 371, 372, 0, 374, 375, 376, 377, 378, 379, 0, 380, 381, 382, 383, 384, 385, - 0, 386, 387, 388, 389, 390, 391, 392, 393, 394, + 0, 386, 387, 388, 389, 390, 391, 392, 393, 881, 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 0, 409, 410, 0, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, @@ -11300,7 +10795,7 @@ static const yytype_int16 yytable[] = 233, 0, 234, 235, 236, 237, 0, 238, 0, 239, 0, 0, 0, 242, 243, 540, 0, 246, 247, 248, 0, 249, 250, 251, 252, 0, 253, 254, 255, 256, - 257, 1360, 259, 0, 261, 262, 263, 264, 0, 265, + 257, 918, 259, 0, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 0, 274, 275, 276, 277, 278, 279, 280, 281, 0, 282, 0, 283, 0, 0, 286, 0, 288, 289, 290, 0, 291, @@ -11351,7 +10846,7 @@ static const yytype_int16 yytable[] = 0, 234, 235, 236, 237, 0, 238, 0, 239, 0, 0, 0, 242, 243, 540, 0, 246, 247, 248, 0, 249, 250, 251, 252, 0, 253, 254, 255, 256, 257, - 1362, 259, 0, 261, 262, 263, 264, 0, 265, 266, + 921, 259, 0, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 0, 274, 275, 276, 277, 278, 279, 280, 281, 0, 282, 0, 283, 0, 0, 286, 0, 288, 289, 290, 0, 291, 292, @@ -11401,7 +10896,7 @@ static const yytype_int16 yytable[] = 226, 227, 228, 229, 230, 231, 232, 0, 233, 0, 234, 235, 236, 237, 0, 238, 0, 239, 0, 0, 0, 242, 243, 540, 0, 246, 247, 248, 0, 249, - 250, 251, 252, 0, 253, 254, 255, 256, 257, 1364, + 250, 251, 252, 0, 253, 254, 255, 256, 257, 925, 259, 0, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 0, 274, 275, 276, 277, 278, 279, 280, 281, 0, 282, 0, 283, 0, @@ -11452,7 +10947,7 @@ static const yytype_int16 yytable[] = 227, 228, 229, 230, 231, 232, 0, 233, 0, 234, 235, 236, 237, 0, 238, 0, 239, 0, 0, 0, 242, 243, 540, 0, 246, 247, 248, 0, 249, 250, - 251, 252, 0, 253, 254, 255, 256, 257, 2345, 259, + 251, 252, 0, 253, 254, 255, 256, 257, 956, 259, 0, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 0, 274, 275, 276, 277, 278, 279, 280, 281, 0, 282, 0, 283, 0, 0, @@ -11503,7 +10998,7 @@ static const yytype_int16 yytable[] = 228, 229, 230, 231, 232, 0, 233, 0, 234, 235, 236, 237, 0, 238, 0, 239, 0, 0, 0, 242, 243, 540, 0, 246, 247, 248, 0, 249, 250, 251, - 252, 0, 253, 254, 255, 256, 257, 3185, 259, 0, + 252, 0, 253, 254, 255, 256, 257, 984, 259, 0, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 0, 274, 275, 276, 277, 278, 279, 280, 281, 0, 282, 0, 283, 0, 0, 286, @@ -11535,7 +11030,7 @@ static const yytype_int16 yytable[] = 501, 0, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, - 527, 528, 529, 530, 531, 539, 0, 0, 0, 0, + 527, 528, 529, 530, 531, 539, 0, 564, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, @@ -11554,7 +11049,7 @@ static const yytype_int16 yytable[] = 229, 230, 231, 232, 0, 233, 0, 234, 235, 236, 237, 0, 238, 0, 239, 0, 0, 0, 242, 243, 540, 0, 246, 247, 248, 0, 249, 250, 251, 252, - 0, 253, 254, 255, 256, 257, 258, 259, 0, 261, + 0, 253, 254, 255, 256, 257, 987, 259, 0, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 0, 274, 275, 276, 277, 278, 279, 280, 281, 0, 282, 0, 283, 0, 0, 286, 0, @@ -11590,7 +11085,7 @@ static const yytype_int16 yytable[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 134, 135, 0, 0, 137, + 0, 0, 1030, 0, 0, 134, 135, 0, 0, 137, 138, 0, 140, 141, 142, 143, 144, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 0, 0, 153, 154, 155, 156, 157, 158, 159, 0, 160, 161, 162, @@ -11604,13 +11099,13 @@ static const yytype_int16 yytable[] = 0, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 0, 233, 0, 234, 235, 236, 237, 0, 238, 0, 239, 0, 0, 0, 242, 243, 540, - 0, 858, 247, 248, 0, 249, 250, 251, 252, 0, + 0, 246, 247, 248, 0, 249, 250, 251, 252, 0, 253, 254, 255, 256, 257, 258, 259, 0, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 0, 274, 275, 276, 277, 278, 279, 280, 281, 0, 282, 0, 283, 0, 0, 286, 0, 288, 289, 290, 0, 291, 292, 293, 0, 0, 294, 0, - 296, 0, 0, 298, 299, 859, 301, 302, 303, 304, + 296, 0, 0, 298, 299, 300, 301, 302, 303, 304, 305, 541, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 0, 331, 332, 333, 334, @@ -11624,16 +11119,16 @@ static const yytype_int16 yytable[] = 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 0, 409, 410, 0, 412, 413, 414, 415, 416, 417, 418, 419, - 860, 421, 422, 423, 424, 425, 426, 427, 428, 0, - 0, 429, 430, 431, 432, 861, 434, 435, 436, 437, + 420, 421, 422, 423, 424, 425, 426, 427, 428, 0, + 0, 429, 430, 431, 432, 433, 434, 435, 436, 437, 0, 0, 439, 440, 441, 442, 0, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 542, 458, 459, 0, 0, 460, 461, 0, 462, - 0, 464, 465, 466, 467, 468, 469, 0, 470, 862, + 0, 464, 465, 466, 467, 468, 469, 0, 470, 471, 472, 0, 0, 473, 474, 475, 476, 477, 0, 478, 479, 480, 481, 482, 483, 484, 485, 0, 0, 486, 487, 488, 0, 0, 489, 490, 491, 492, 0, 493, - 494, 495, 496, 497, 498, 499, 863, 0, 501, 0, + 494, 495, 496, 497, 498, 499, 500, 0, 501, 0, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, @@ -11641,7 +11136,7 @@ static const yytype_int16 yytable[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 134, 135, 0, 0, 137, 138, + 0, 1057, 0, 0, 134, 135, 0, 0, 137, 138, 0, 140, 141, 142, 143, 144, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 0, 0, 153, 154, 155, 156, 157, 158, 159, 0, 160, 161, 162, 163, @@ -11656,7 +11151,7 @@ static const yytype_int16 yytable[] = 231, 232, 0, 233, 0, 234, 235, 236, 237, 0, 238, 0, 239, 0, 0, 0, 242, 243, 540, 0, 246, 247, 248, 0, 249, 250, 251, 252, 0, 253, - 254, 255, 256, 257, 916, 259, 0, 261, 262, 263, + 254, 255, 256, 257, 258, 259, 0, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 0, 274, 275, 276, 277, 278, 279, 280, 281, 0, 282, 0, 283, 0, 0, 286, 0, 288, 289, @@ -11691,7 +11186,7 @@ static const yytype_int16 yytable[] = 530, 531, 539, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, - 0, 130, 131, 132, 0, 0, 0, 0, 0, 0, + 842, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 134, 135, 0, 0, 137, 138, 0, 140, 141, 142, 143, 144, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 0, 0, 153, 154, 155, @@ -11707,7 +11202,7 @@ static const yytype_int16 yytable[] = 232, 0, 233, 0, 234, 235, 236, 237, 0, 238, 0, 239, 0, 0, 0, 242, 243, 540, 0, 246, 247, 248, 0, 249, 250, 251, 252, 0, 253, 254, - 255, 256, 257, 980, 259, 0, 261, 262, 263, 264, + 255, 256, 257, 258, 259, 0, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 0, 274, 275, 276, 277, 278, 279, 280, 281, 0, 282, 0, 283, 0, 0, 286, 0, 288, 289, 290, @@ -11731,15 +11226,15 @@ static const yytype_int16 yytable[] = 439, 440, 441, 442, 0, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 542, 458, 459, 0, 0, 460, 461, 0, 462, 0, 464, - 465, 466, 467, 468, 469, 0, 470, 471, 472, 0, - 0, 473, 474, 475, 476, 477, 0, 478, 479, 480, + 465, 466, 467, 468, 469, 0, 470, 846, 472, 0, + 0, 847, 474, 475, 476, 477, 0, 478, 479, 480, 481, 482, 483, 484, 485, 0, 0, 486, 487, 488, 0, 0, 489, 490, 491, 492, 0, 493, 494, 495, 496, 497, 498, 499, 500, 0, 501, 0, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, - 531, 539, 0, 0, 0, 0, 0, 0, 0, 0, + 531, 539, 0, 564, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, @@ -11758,7 +11253,7 @@ static const yytype_int16 yytable[] = 0, 233, 0, 234, 235, 236, 237, 0, 238, 0, 239, 0, 0, 0, 242, 243, 540, 0, 246, 247, 248, 0, 249, 250, 251, 252, 0, 253, 254, 255, - 256, 257, 258, 259, 0, 261, 262, 263, 264, 0, + 256, 257, 1355, 259, 0, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 0, 274, 275, 276, 277, 278, 279, 280, 281, 0, 282, 0, 283, 0, 0, 286, 0, 288, 289, 290, 0, @@ -11776,13 +11271,13 @@ static const yytype_int16 yytable[] = 0, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 0, 409, 410, 0, 412, - 413, 414, 415, 416, 417, 418, 419, 860, 421, 422, + 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 0, 0, 429, 430, 431, 432, 433, 434, 435, 436, 437, 0, 0, 439, 440, 441, 442, 0, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 542, 458, 459, 0, 0, 460, 461, 0, 462, 0, 464, 465, - 466, 467, 468, 469, 0, 470, 862, 472, 0, 0, + 466, 467, 468, 469, 0, 470, 471, 472, 0, 0, 473, 474, 475, 476, 477, 0, 478, 479, 480, 481, 482, 483, 484, 485, 0, 0, 486, 487, 488, 0, 0, 489, 490, 491, 492, 0, 493, 494, 495, 496, @@ -11790,7 +11285,7 @@ static const yytype_int16 yytable[] = 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, - 539, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 539, 0, 564, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, @@ -11809,7 +11304,7 @@ static const yytype_int16 yytable[] = 233, 0, 234, 235, 236, 237, 0, 238, 0, 239, 0, 0, 0, 242, 243, 540, 0, 246, 247, 248, 0, 249, 250, 251, 252, 0, 253, 254, 255, 256, - 257, 1351, 259, 0, 261, 262, 263, 264, 0, 265, + 257, 1357, 259, 0, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 0, 274, 275, 276, 277, 278, 279, 280, 281, 0, 282, 0, 283, 0, 0, 286, 0, 288, 289, 290, 0, 291, @@ -11841,7 +11336,7 @@ static const yytype_int16 yytable[] = 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 539, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 564, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -11860,7 +11355,7 @@ static const yytype_int16 yytable[] = 0, 234, 235, 236, 237, 0, 238, 0, 239, 0, 0, 0, 242, 243, 540, 0, 246, 247, 248, 0, 249, 250, 251, 252, 0, 253, 254, 255, 256, 257, - 1374, 259, 0, 261, 262, 263, 264, 0, 265, 266, + 1360, 259, 0, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 0, 274, 275, 276, 277, 278, 279, 280, 281, 0, 282, 0, 283, 0, 0, 286, 0, 288, 289, 290, 0, 291, 292, @@ -11892,10 +11387,10 @@ static const yytype_int16 yytable[] = 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 539, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 564, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, - 0, 0, 0, 0, 0, 0, 1735, 0, 0, 134, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 134, 135, 0, 0, 137, 138, 0, 140, 141, 142, 143, 144, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 0, 0, 153, 154, 155, 156, 157, 158, 159, @@ -11910,7 +11405,7 @@ static const yytype_int16 yytable[] = 226, 227, 228, 229, 230, 231, 232, 0, 233, 0, 234, 235, 236, 237, 0, 238, 0, 239, 0, 0, 0, 242, 243, 540, 0, 246, 247, 248, 0, 249, - 250, 251, 252, 0, 253, 254, 255, 256, 257, 258, + 250, 251, 252, 0, 253, 254, 255, 256, 257, 1362, 259, 0, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 0, 274, 275, 276, 277, 278, 279, 280, 281, 0, 282, 0, 283, 0, @@ -11931,7 +11426,7 @@ static const yytype_int16 yytable[] = 407, 408, 0, 409, 410, 0, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 0, 0, 429, 430, 431, 432, 433, - 0, 435, 436, 437, 0, 0, 439, 440, 441, 442, + 434, 435, 436, 437, 0, 0, 439, 440, 441, 442, 0, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 542, 458, 459, 0, 0, 460, 461, 0, 462, 0, 464, 465, 466, 467, 468, @@ -11942,7 +11437,7 @@ static const yytype_int16 yytable[] = 500, 0, 501, 0, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, - 525, 526, 527, 528, 529, 530, 531, 539, 0, 0, + 525, 526, 527, 528, 529, 530, 531, 539, 0, 564, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, @@ -11961,7 +11456,7 @@ static const yytype_int16 yytable[] = 227, 228, 229, 230, 231, 232, 0, 233, 0, 234, 235, 236, 237, 0, 238, 0, 239, 0, 0, 0, 242, 243, 540, 0, 246, 247, 248, 0, 249, 250, - 251, 252, 0, 253, 254, 255, 256, 257, 1937, 259, + 251, 252, 0, 253, 254, 255, 256, 257, 1364, 259, 0, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 0, 274, 275, 276, 277, 278, 279, 280, 281, 0, 282, 0, 283, 0, 0, @@ -11993,7 +11488,7 @@ static const yytype_int16 yytable[] = 0, 501, 0, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, - 526, 527, 528, 529, 530, 531, 539, 0, 0, 0, + 526, 527, 528, 529, 530, 531, 539, 0, 564, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, @@ -12012,7 +11507,7 @@ static const yytype_int16 yytable[] = 228, 229, 230, 231, 232, 0, 233, 0, 234, 235, 236, 237, 0, 238, 0, 239, 0, 0, 0, 242, 243, 540, 0, 246, 247, 248, 0, 249, 250, 251, - 252, 0, 253, 254, 255, 256, 257, 2327, 259, 0, + 252, 0, 253, 254, 255, 256, 257, 2345, 259, 0, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 0, 274, 275, 276, 277, 278, 279, 280, 281, 0, 282, 0, 283, 0, 0, 286, @@ -12044,7 +11539,7 @@ static const yytype_int16 yytable[] = 501, 0, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, - 527, 528, 529, 530, 531, 539, 0, 0, 0, 0, + 527, 528, 529, 530, 531, 539, 0, 564, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, @@ -12063,7 +11558,7 @@ static const yytype_int16 yytable[] = 229, 230, 231, 232, 0, 233, 0, 234, 235, 236, 237, 0, 238, 0, 239, 0, 0, 0, 242, 243, 540, 0, 246, 247, 248, 0, 249, 250, 251, 252, - 0, 253, 254, 255, 256, 257, 2347, 259, 0, 261, + 0, 253, 254, 255, 256, 257, 3139, 259, 0, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 0, 274, 275, 276, 277, 278, 279, 280, 281, 0, 282, 0, 283, 0, 0, 286, 0, @@ -12095,107 +11590,110 @@ static const yytype_int16 yytable[] = 0, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, - 528, 529, 530, 531, 3381, 0, 0, 0, 0, 0, + 528, 529, 530, 531, 539, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, - 128, 129, 0, 130, 131, 132, 0, 0, 0, 3102, - 0, 0, 0, 0, 3103, 134, 135, 0, 3104, 137, - 138, 3105, 140, 141, 142, 0, 1539, 3106, 1541, 1542, - 0, 3107, 148, 149, 150, 151, 152, 0, 0, 153, - 154, 155, 156, 1544, 1545, 159, 0, 160, 161, 162, - 163, 0, 0, 3108, 0, 3109, 167, 168, 169, 170, - 171, 3110, 173, 174, 175, 0, 176, 177, 178, 179, - 180, 181, 0, 3111, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 1550, 194, 195, 1551, 197, 0, + 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 134, 135, 0, 0, 137, + 138, 0, 140, 141, 142, 143, 144, 0, 146, 147, + 0, 0, 148, 149, 150, 151, 152, 0, 0, 153, + 154, 155, 156, 157, 158, 159, 0, 160, 161, 162, + 163, 164, 0, 0, 0, 166, 167, 168, 169, 170, + 171, 0, 173, 174, 175, 0, 176, 177, 178, 179, + 180, 181, 0, 0, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 196, 197, 0, 198, 0, 199, 200, 201, 202, 203, 204, 0, 0, - 205, 206, 207, 208, 0, 0, 209, 210, 1093, 212, + 205, 206, 207, 208, 0, 0, 209, 210, 211, 212, 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, - 0, 221, 222, 223, 224, 0, 226, 227, 228, 229, - 230, 231, 0, 0, 233, 0, 234, 235, 1552, 237, - 0, 238, 0, 239, 3112, 0, 3113, 242, 243, 2472, - 3114, 246, 247, 248, 0, 0, 0, 251, 252, 0, - 253, 254, 255, 256, 257, 258, 259, 3115, 261, 262, + 0, 221, 222, 223, 224, 225, 226, 227, 228, 229, + 230, 231, 232, 0, 233, 0, 234, 235, 236, 237, + 0, 238, 0, 239, 0, 0, 0, 242, 243, 540, + 0, 246, 247, 248, 0, 249, 250, 251, 252, 0, + 253, 254, 255, 256, 257, 258, 259, 0, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, - 0, 272, 3116, 0, 275, 276, 277, 278, 279, 1558, - 1559, 0, 1560, 0, 283, 3117, 3118, 286, 3119, 288, - 289, 290, 0, 291, 292, 293, 0, 0, 294, 3120, - 296, 3121, 0, 298, 299, 300, 301, 302, 303, 304, - 305, 2481, 307, 308, 309, 310, 311, 312, 313, 314, + 0, 272, 0, 274, 275, 276, 277, 278, 279, 280, + 281, 0, 282, 0, 283, 0, 0, 286, 0, 288, + 289, 290, 0, 291, 292, 293, 0, 0, 294, 0, + 296, 0, 0, 298, 299, 300, 301, 302, 303, 304, + 305, 541, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 1567, 3123, 1569, 332, 333, 334, - 0, 0, 336, 337, 3125, 339, 0, 0, 341, 1571, + 325, 326, 327, 328, 329, 0, 331, 332, 333, 334, + 335, 0, 336, 337, 0, 339, 0, 340, 341, 342, 343, 344, 345, 0, 346, 347, 0, 0, 348, 349, - 350, 0, 0, 351, 352, 0, 3127, 355, 3128, 0, + 350, 0, 0, 351, 352, 353, 0, 355, 0, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, - 368, 369, 0, 0, 0, 0, 370, 371, 0, 3129, - 374, 375, 0, 377, 378, 379, 0, 380, 381, 382, - 383, 384, 385, 0, 386, 387, 388, 389, 390, 1575, + 368, 369, 0, 0, 0, 0, 370, 371, 372, 0, + 374, 375, 376, 377, 378, 379, 0, 380, 381, 382, + 383, 384, 385, 0, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 0, 409, - 410, 3130, 412, 413, 414, 0, 416, 417, 418, 419, + 410, 0, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 0, - 3131, 429, 430, 431, 432, 433, 434, 0, 436, 437, - 0, 3133, 439, 440, 1581, 442, 0, 443, 444, 445, + 0, 429, 430, 431, 432, 433, 434, 435, 436, 437, + 0, 0, 439, 440, 441, 442, 0, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, - 456, 2489, 458, 0, 0, 0, 460, 461, 0, 462, - 3135, 464, 465, 466, 467, 468, 469, 0, 470, 1584, - 1585, 0, 0, 473, 474, 0, 476, 0, 0, 478, - 479, 3136, 481, 482, 483, 484, 485, 0, 0, 486, - 487, 488, 3138, 0, 489, 490, 491, 492, 0, 493, - 494, 495, 496, 497, 0, 1589, 500, 0, 501, 3139, + 456, 542, 458, 459, 0, 0, 460, 461, 0, 462, + 0, 464, 465, 466, 467, 468, 469, 0, 470, 471, + 472, 0, 0, 473, 474, 475, 476, 477, 0, 478, + 479, 480, 481, 482, 483, 484, 485, 0, 0, 486, + 487, 488, 0, 0, 489, 490, 491, 492, 0, 493, + 494, 495, 496, 497, 498, 499, 500, 0, 501, 0, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, - 0, 0, 511, 512, 513, 514, 515, 516, 1844, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 528, - 529, 530, 531, 0, 0, 0, 0, 0, 122, 123, - 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, - 0, 0, 0, 1535, 0, 0, 0, 0, 1536, 134, - 135, 0, 1537, 137, 138, 1538, 140, 141, 142, 0, - 1539, 1540, 1541, 1542, 0, 1543, 148, 149, 150, 151, - 152, 0, 0, 153, 154, 155, 156, 1544, 1545, 159, - 0, 160, 161, 162, 163, 0, 0, 1546, 0, 1547, - 167, 168, 169, 170, 171, 1548, 173, 174, 175, 0, - 176, 177, 178, 179, 180, 181, 0, 1549, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 1550, 194, - 195, 1551, 197, 0, 198, 0, 199, 200, 201, 202, - 203, 204, 0, 0, 205, 206, 207, 208, 0, 0, - 209, 210, 1093, 212, 213, 0, 214, 215, 216, 0, - 217, 218, 219, 220, 0, 221, 222, 223, 224, 0, - 226, 227, 228, 229, 230, 231, 0, 0, 233, 0, - 234, 235, 1552, 237, 0, 238, 0, 239, 1553, 0, - 1554, 242, 243, 0, 1555, 246, 247, 248, 0, 0, - 0, 251, 252, 0, 253, 254, 255, 256, 257, 258, - 259, 1556, 261, 262, 263, 264, 0, 265, 266, 267, - 268, 269, 270, 271, 0, 272, 1557, 0, 275, 276, - 277, 278, 279, 1558, 1559, 0, 1560, 0, 283, 1561, - 1562, 286, 1563, 288, 289, 290, 0, 291, 292, 293, - 0, 0, 294, 1564, 296, 1565, 0, 298, 299, 300, - 301, 302, 303, 304, 305, 0, 307, 308, 309, 310, - 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, - 321, 322, 323, 324, 325, 326, 327, 328, 1567, 1568, - 1569, 332, 333, 334, 0, 0, 336, 337, 1570, 339, - 0, 0, 341, 1571, 343, 344, 345, 0, 346, 347, - 0, 0, 348, 349, 350, 0, 0, 351, 352, 0, - 1572, 355, 1573, 0, 358, 359, 360, 361, 362, 363, - 364, 365, 366, 367, 368, 369, 0, 0, 0, 0, - 370, 371, 0, 1574, 374, 375, 0, 377, 378, 379, - 0, 380, 381, 382, 383, 384, 385, 0, 386, 387, - 388, 389, 390, 1575, 392, 393, 394, 395, 0, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, - 407, 408, 0, 409, 410, 1576, 412, 413, 414, 0, - 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, - 426, 427, 428, 0, 1578, 429, 430, 431, 432, 433, - 434, 0, 436, 437, 0, 1580, 439, 440, 1581, 442, - 0, 443, 444, 445, 446, 447, 448, 449, 450, 451, - 452, 453, 454, 455, 456, 0, 458, 0, 0, 0, - 460, 461, 0, 462, 1583, 464, 465, 466, 467, 468, - 469, 0, 470, 1584, 1585, 0, 0, 473, 474, 0, - 476, 0, 0, 478, 479, 1586, 481, 482, 483, 484, - 485, 0, 0, 486, 487, 488, 1588, 0, 489, 490, - 491, 492, 0, 493, 494, 495, 496, 497, 0, 1589, - 500, 0, 501, 1590, 503, 504, 505, 506, 507, 508, - 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, - 515, 516, 539, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 528, 529, 530, 531, 0, 0, 0, + 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, + 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, + 529, 530, 531, 539, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, + 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 134, 135, 0, 0, 137, 138, + 0, 140, 141, 142, 143, 144, 0, 146, 147, 0, + 0, 148, 149, 150, 151, 152, 0, 0, 153, 154, + 155, 156, 157, 158, 159, 0, 160, 161, 162, 163, + 164, 0, 0, 0, 166, 167, 168, 169, 170, 171, + 0, 173, 174, 175, 0, 176, 177, 178, 179, 180, + 181, 0, 0, 183, 184, 185, 186, 187, 188, 189, + 190, 191, 192, 193, 194, 195, 196, 197, 0, 198, + 0, 199, 200, 201, 202, 203, 204, 0, 0, 205, + 206, 207, 208, 0, 0, 209, 210, 211, 212, 213, + 0, 214, 215, 216, 0, 217, 218, 219, 220, 0, + 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, + 231, 232, 0, 233, 0, 234, 235, 236, 237, 0, + 238, 0, 239, 0, 0, 0, 242, 243, 540, 0, + 858, 247, 248, 0, 249, 250, 251, 252, 0, 253, + 254, 255, 256, 257, 258, 259, 0, 261, 262, 263, + 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, + 272, 0, 274, 275, 276, 277, 278, 279, 280, 281, + 0, 282, 0, 283, 0, 0, 286, 0, 288, 289, + 290, 0, 291, 292, 293, 0, 0, 294, 0, 296, + 0, 0, 298, 299, 859, 301, 302, 303, 304, 305, + 541, 307, 308, 309, 310, 311, 312, 313, 314, 315, + 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, + 326, 327, 328, 329, 0, 331, 332, 333, 334, 335, + 0, 336, 337, 0, 339, 0, 340, 341, 342, 343, + 344, 345, 0, 346, 347, 0, 0, 348, 349, 350, + 0, 0, 351, 352, 353, 0, 355, 0, 357, 358, + 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, + 369, 0, 0, 0, 0, 370, 371, 372, 0, 374, + 375, 376, 377, 378, 379, 0, 380, 381, 382, 383, + 384, 385, 0, 386, 387, 388, 389, 390, 391, 392, + 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, + 402, 403, 404, 405, 406, 407, 408, 0, 409, 410, + 0, 412, 413, 414, 415, 416, 417, 418, 419, 860, + 421, 422, 423, 424, 425, 426, 427, 428, 0, 0, + 429, 430, 431, 432, 861, 434, 435, 436, 437, 0, + 0, 439, 440, 441, 442, 0, 443, 444, 445, 446, + 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, + 542, 458, 459, 0, 0, 460, 461, 0, 462, 0, + 464, 465, 466, 467, 468, 469, 0, 470, 862, 472, + 0, 0, 473, 474, 475, 476, 477, 0, 478, 479, + 480, 481, 482, 483, 484, 485, 0, 0, 486, 487, + 488, 0, 0, 489, 490, 491, 492, 0, 493, 494, + 495, 496, 497, 498, 499, 863, 0, 501, 0, 503, + 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, + 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, + 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, + 530, 531, 539, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 134, 135, 0, 0, 137, 138, 0, @@ -12212,8 +11710,8 @@ static const yytype_int16 yytable[] = 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 0, 233, 0, 234, 235, 236, 237, 0, 238, 0, 239, 0, 0, 0, 242, 243, 540, 0, 246, - 247, 248, 0, 249, 250, 0, 252, 0, 253, 254, - 255, 256, 257, 258, 259, 0, 261, 262, 263, 264, + 247, 248, 0, 249, 250, 251, 252, 0, 253, 254, + 255, 256, 257, 916, 259, 0, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 0, 274, 275, 276, 277, 278, 279, 280, 281, 0, 282, 0, 283, 0, 0, 286, 0, 288, 289, 290, @@ -12225,13 +11723,13 @@ static const yytype_int16 yytable[] = 336, 337, 0, 339, 0, 340, 341, 342, 343, 344, 345, 0, 346, 347, 0, 0, 348, 349, 350, 0, 0, 351, 352, 353, 0, 355, 0, 357, 358, 359, - 360, 361, 362, 363, 0, 365, 366, 367, 368, 369, + 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 0, 0, 0, 0, 370, 371, 372, 0, 374, 375, 376, 377, 378, 379, 0, 380, 381, 382, 383, 384, - 385, 0, 386, 387, 388, 0, 390, 391, 392, 393, + 385, 0, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 0, 409, 410, 0, - 412, 413, 414, 415, 0, 417, 418, 419, 420, 421, + 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 0, 0, 429, 430, 431, 432, 433, 434, 435, 436, 437, 0, 0, 439, 440, 441, 442, 0, 443, 444, 445, 446, 447, @@ -12245,1271 +11743,1653 @@ static const yytype_int16 yytable[] = 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, - 531, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 764, 0, 3, 4, 0, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 764, - 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, - 7, 0, 0, 0, 0, 0, 0, 0, 0, 6, - 0, 0, 0, 0, 8, 0, 0, 0, 7, 0, - 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, - 0, 0, 8, 0, 0, 0, 0, 11, 0, 765, - 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, - 13, 0, 0, 0, 0, 11, 0, 765, 0, 0, - 0, 0, 0, 0, 0, 14, 15, 0, 13, 0, - 0, 0, 0, 0, 0, 0, 766, 0, 0, 0, - 0, 0, 18, 14, 15, 0, 0, 0, 0, 0, - 0, 19, 0, 0, 766, 0, 0, 0, 0, 0, - 18, 0, 0, 0, 0, 0, 0, 0, 22, 19, - 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 22, 0, 0, 0, - 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, -1524, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, -1524, 0, 0, 0, 0, 0, 0, 0, - 0, 25, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, - 27, 28, 0, 0, 0, 0, 0, 29, 0, 0, - 30, 0, 0, 0, 0, 0, 0, 26, 27, 28, - 0, 0, 0, 0, 0, 29, 0, 0, 30, 0, + 531, 539, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 31, 0, 0, 0, 0, 0, 0, 0, 0, - 32, 0, 0, 0, 0, 0, 0, 0, 0, 31, - 0, 0, 0, 0, 0, 0, 33, 0, 32, 0, - 0, 0, 0, 34, 0, 0, 0, 35, 0, 0, - 0, 0, 0, 0, 33, 0, 0, 0, 0, 36, - 0, 34, 0, 0, 0, 35, 0, 0, 0, 0, - 0, 37, 0, 0, 0, 38, 0, 36, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 37, - 0, 0, 0, 38, 0, 0, 39, 0, 0, 0, + 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, + 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 134, 135, 0, 0, 137, 138, 0, 140, + 141, 142, 143, 144, 0, 146, 147, 0, 0, 148, + 149, 150, 151, 152, 0, 0, 153, 154, 155, 156, + 157, 158, 159, 0, 160, 161, 162, 163, 164, 0, + 0, 0, 166, 167, 168, 169, 170, 171, 0, 173, + 174, 175, 0, 176, 177, 178, 179, 180, 181, 0, + 0, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 0, 198, 0, 199, + 200, 201, 202, 203, 204, 0, 0, 205, 206, 207, + 208, 0, 0, 209, 210, 211, 212, 213, 0, 214, + 215, 216, 0, 217, 218, 219, 220, 0, 221, 222, + 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, + 0, 233, 0, 234, 235, 236, 237, 0, 238, 0, + 239, 0, 0, 0, 242, 243, 540, 0, 246, 247, + 248, 0, 249, 250, 251, 252, 0, 253, 254, 255, + 256, 257, 980, 259, 0, 261, 262, 263, 264, 0, + 265, 266, 267, 268, 269, 270, 271, 0, 272, 0, + 274, 275, 276, 277, 278, 279, 280, 281, 0, 282, + 0, 283, 0, 0, 286, 0, 288, 289, 290, 0, + 291, 292, 293, 0, 0, 294, 0, 296, 0, 0, + 298, 299, 300, 301, 302, 303, 304, 305, 541, 307, + 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, + 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, + 328, 329, 0, 331, 332, 333, 334, 335, 0, 336, + 337, 0, 339, 0, 340, 341, 342, 343, 344, 345, + 0, 346, 347, 0, 0, 348, 349, 350, 0, 0, + 351, 352, 353, 0, 355, 0, 357, 358, 359, 360, + 361, 362, 363, 364, 365, 366, 367, 368, 369, 0, + 0, 0, 0, 370, 371, 372, 0, 374, 375, 376, + 377, 378, 379, 0, 380, 381, 382, 383, 384, 385, + 0, 386, 387, 388, 389, 390, 391, 392, 393, 394, + 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, + 404, 405, 406, 407, 408, 0, 409, 410, 0, 412, + 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, + 423, 424, 425, 426, 427, 428, 0, 0, 429, 430, + 431, 432, 433, 434, 435, 436, 437, 0, 0, 439, + 440, 441, 442, 0, 443, 444, 445, 446, 447, 448, + 449, 450, 451, 452, 453, 454, 455, 456, 542, 458, + 459, 0, 0, 460, 461, 0, 462, 0, 464, 465, + 466, 467, 468, 469, 0, 470, 471, 472, 0, 0, + 473, 474, 475, 476, 477, 0, 478, 479, 480, 481, + 482, 483, 484, 485, 0, 0, 486, 487, 488, 0, + 0, 489, 490, 491, 492, 0, 493, 494, 495, 496, + 497, 498, 499, 500, 0, 501, 0, 503, 504, 505, + 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, + 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, + 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, + 539, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 40, 0, 0, 0, 39, 0, 42, 0, 0, 0, - 0, 43, 0, 0, 0, 0, 767, 0, 40, 0, - 0, 0, 0, 0, 42, 0, 0, 0, 44, 43, + 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, + 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 134, 135, 0, 0, 137, 138, 0, 140, 141, + 142, 143, 144, 0, 146, 147, 0, 0, 148, 149, + 150, 151, 152, 0, 0, 153, 154, 155, 156, 157, + 158, 159, 0, 160, 161, 162, 163, 164, 0, 0, + 0, 166, 167, 168, 169, 170, 171, 0, 173, 174, + 175, 0, 176, 177, 178, 179, 180, 181, 0, 0, + 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, + 193, 194, 195, 196, 197, 0, 198, 0, 199, 200, + 201, 202, 203, 204, 0, 0, 205, 206, 207, 208, + 0, 0, 209, 210, 211, 212, 213, 0, 214, 215, + 216, 0, 217, 218, 219, 220, 0, 221, 222, 223, + 224, 225, 226, 227, 228, 229, 230, 231, 232, 0, + 233, 0, 234, 235, 236, 237, 0, 238, 0, 239, + 0, 0, 0, 242, 243, 540, 0, 246, 247, 248, + 0, 249, 250, 251, 252, 0, 253, 254, 255, 256, + 257, 258, 259, 0, 261, 262, 263, 264, 0, 265, + 266, 267, 268, 269, 270, 271, 0, 272, 0, 274, + 275, 276, 277, 278, 279, 280, 281, 0, 282, 0, + 283, 0, 0, 286, 0, 288, 289, 290, 0, 291, + 292, 293, 0, 0, 294, 0, 296, 0, 0, 298, + 299, 300, 301, 302, 303, 304, 305, 541, 307, 308, + 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, + 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, + 329, 0, 331, 332, 333, 334, 335, 0, 336, 337, + 0, 339, 0, 340, 341, 342, 343, 344, 345, 0, + 346, 347, 0, 0, 348, 349, 350, 0, 0, 351, + 352, 353, 0, 355, 0, 357, 358, 359, 360, 361, + 362, 363, 364, 365, 366, 367, 368, 369, 0, 0, + 0, 0, 370, 371, 372, 0, 374, 375, 376, 377, + 378, 379, 0, 380, 381, 382, 383, 384, 385, 0, + 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, + 0, 396, 397, 398, 399, 400, 401, 402, 403, 404, + 405, 406, 407, 408, 0, 409, 410, 0, 412, 413, + 414, 415, 416, 417, 418, 419, 860, 421, 422, 423, + 424, 425, 426, 427, 428, 0, 0, 429, 430, 431, + 432, 433, 434, 435, 436, 437, 0, 0, 439, 440, + 441, 442, 0, 443, 444, 445, 446, 447, 448, 449, + 450, 451, 452, 453, 454, 455, 456, 542, 458, 459, + 0, 0, 460, 461, 0, 462, 0, 464, 465, 466, + 467, 468, 469, 0, 470, 862, 472, 0, 0, 473, + 474, 475, 476, 477, 0, 478, 479, 480, 481, 482, + 483, 484, 485, 0, 0, 486, 487, 488, 0, 0, + 489, 490, 491, 492, 0, 493, 494, 495, 496, 497, + 498, 499, 500, 0, 501, 0, 503, 504, 505, 506, + 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, + 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, + 523, 524, 525, 526, 527, 528, 529, 530, 531, 539, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 44, 0, 0, 0, - 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 768, 0, 0, 0, - 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 46 -}; - -static const yytype_int16 yycheck[] = -{ - 7, 532, 0, 0, 0, 46, 880, 0, 856, 16, - 0, 0, 922, 904, 1019, 0, 23, 0, 934, 0, - 1268, 830, 20, 0, 0, 1759, 759, 1270, 1000, 38, - 1065, 985, 955, 7, 16, 20, 950, 1010, 989, 1197, - 1720, 37, 75, 1490, 1474, 1256, 1962, 79, 1636, 23, - 20, 79, 1010, 1609, 1877, 1010, 1114, 7, 1017, 13, - 2343, 1527, 1248, 1649, 1885, 19, 760, 1594, 1692, 1010, - 77, 78, 1328, 23, 1245, 1677, 30, 2267, 2277, 2833, - 1813, 17, 2082, 1233, 0, 23, 2246, 0, 2248, 0, - 44, 45, 1673, 1674, 2830, 2789, 45, 2212, 2789, 1828, - 0, 2266, 1273, 77, 78, 114, 0, 103, 2850, 0, - 34, 1377, 1028, 2334, 0, 767, 1162, 0, 1123, 2857, - 2417, 1167, 2653, 825, 2497, 1724, 0, 77, 78, 831, - 0, 1899, 0, 768, 1008, 0, 0, 1866, 0, 77, - 78, 1898, 0, 1902, 2055, 2056, 0, 2740, 1872, 0, - 23, 2744, 2045, 2046, 2047, 2066, 1087, 1088, 112, 2070, - 0, 9, 9, 2969, 922, 0, 924, 2430, 926, 41, - 0, 0, 5, 1692, 1105, 0, 0, 0, 2017, 5, - 56, 3, 0, 5, 5, 0, 5, 64, 10, 60, - 4, 81, 13, 14, 5, 9, 10, 2425, 9, 5, - 5, 1173, 1011, 5, 77, 78, 5, 13, 14, 5, - 5, 13, 14, 2430, 0, 19, 2437, 1819, 13, 14, - 3197, 5, 13, 14, 2392, 1777, 5, 19, 83, 1779, - 5, 5, 5, 5, 13, 14, 9, 5, 793, 5, - 2423, 31, 5, 5, 83, 2832, 125, 118, 1122, 39, - 19, 27, 13, 14, 109, 94, 4, 1292, 3, 4, - 5, 9, 140, 1179, 9, 11, 928, 175, 1303, 46, - 16, 11, 193, 83, 201, 46, 16, 120, 174, 899, - 77, 78, 19, 149, 94, 1257, 101, 3076, 1260, 1261, - 91, 822, 174, 1207, 4, 3, 31, 3148, 174, 9, - 899, 47, 2523, 2524, 39, 2526, 60, 295, 1091, 64, - 1012, 180, 229, 1034, 108, 101, 183, 2597, 1039, 3178, - 1041, 176, 1024, 1925, 31, 1108, 3029, 35, 36, 130, - 296, 1489, 39, 301, 875, 81, 3181, 296, 869, 1060, - 293, 5, 820, 374, 11, 195, 319, 3384, 15, 16, - 205, 1003, 388, 301, 220, 186, 3201, 41, 1232, 5, - 3560, 278, 138, 281, 123, 1000, 65, 108, 1579, 1527, - 316, 107, 2699, 118, 2701, 244, 75, 1979, 108, 168, - 1228, 1229, 133, 41, 31, 3309, 118, 3311, 351, 1991, - 121, 2757, 120, 42, 249, 195, 84, 118, 3529, 123, - 164, 31, 375, 284, 75, 490, 121, 3639, 1102, 11, - 134, 492, 2235, 15, 16, 2575, 166, 439, 3481, 2021, - 3483, 426, 146, 11, 467, 417, 2028, 390, 3593, 514, - 347, 150, 11, 514, 809, 301, 15, 16, 3192, 13, - 14, 3132, 1333, 295, 253, 47, 123, 3741, 4, 1363, - 123, 11, 827, 9, 3208, 15, 16, 479, 3194, 47, - 406, 466, 150, 11, 427, 173, 197, 175, 47, 1392, - 2072, 280, 193, 2756, 2076, 166, 221, 241, 127, 81, - 295, 398, 197, 202, 234, 528, 133, 133, 64, 366, - 482, 215, 3692, 81, 178, 3626, 532, 528, 3629, 244, - 171, 3564, 81, 133, 2106, 3737, 3800, 1466, 1467, 295, - 379, 2877, 313, 1472, 364, 346, 162, 480, 3442, 255, - 178, 402, 27, 299, 379, 2640, 3691, 1585, 33, 2728, - 266, 3382, 2753, 81, 2755, 390, 495, 278, 215, 290, - 528, 330, 215, 76, 375, 244, 464, 464, 174, 3408, - 523, 3528, 367, 285, 550, 3344, 2083, 285, 440, 280, - 1038, 361, 528, 432, 532, 434, 4, 3004, 3413, 3006, - 109, 9, 427, 2159, 3363, 528, 2397, 2398, 2399, 256, - 2907, 367, 528, 479, 532, 379, 277, 363, 467, 365, - 456, 460, 414, 415, 2218, 169, 451, 64, 605, 1130, - 467, 440, 473, 2866, 3735, 532, 1480, 528, 486, 2075, - 1230, 366, 566, 1544, 1545, 405, 2844, 3204, 1280, 395, - 528, 285, 3325, 605, 2212, 480, 469, 3330, 1884, 3666, - 440, 1230, 433, 138, 280, 1190, 526, 2805, 1569, 285, - 530, 395, 25, 1376, 290, 2925, 1494, 424, 1381, 2866, - 3627, 477, 528, 424, 1387, 532, 2839, 528, 530, 3465, - 3402, 109, 1203, 2884, 335, 1206, 2434, 2391, 1516, 2250, - 405, 2270, 519, 520, 2431, 490, 1919, 531, 2678, 527, - 2439, 1947, 2593, 2576, 2577, 2578, 2579, 1722, 2276, 1383, - 3384, 531, 532, 3384, 2533, 528, 492, 427, 405, 2218, - 1631, 1632, 528, 536, 490, 464, 528, 528, 492, 528, - 528, 533, 534, 531, 529, 536, 531, 528, 514, 533, - 534, 526, 528, 528, 3097, 530, 528, 768, 532, 528, - 514, 2283, 528, 528, 2284, 527, 119, 528, 1612, 1613, - 464, 1393, 3335, 529, 528, 531, 3277, 3340, 1622, 528, - 1666, 1667, 1668, 528, 528, 528, 528, 3054, 527, 1394, - 528, 768, 528, 1637, 3047, 528, 528, 528, 1551, 767, - 478, 519, 520, 3527, 519, 520, 175, 532, 524, 820, - 490, 1502, 767, 3628, 524, 1487, 457, 464, 1571, 526, - 366, 464, 3534, 530, 299, 1669, 3233, 3535, 768, 1987, - 27, 447, 809, 1524, 514, 2716, 33, 761, 467, 519, - 520, 278, 458, 820, 440, 151, 280, 109, 827, 8, - 827, 285, 11, 1606, 2080, 528, 15, 16, 271, 442, - 2018, 20, 21, 22, 517, 809, 397, 254, 365, 2441, - 872, 407, 492, 432, 872, 434, 820, 530, 34, 856, - 857, 3586, 3587, 827, 521, 522, 523, 524, 363, 809, - 123, 229, 3027, 280, 514, 431, 875, 203, 395, 528, - 820, 904, 2030, 880, 60, 138, 1848, 827, 528, 2700, - 493, 345, 820, 3637, 327, 894, 1858, 3623, 0, 1861, - 395, 517, 890, 890, 890, 2497, 109, 890, 2898, 366, - 890, 890, 194, 936, 530, 890, 3641, 890, 878, 890, - 278, 138, 517, 890, 890, 314, 205, 2075, 3033, 521, - 522, 523, 524, 528, 523, 932, 933, 881, 395, 936, - 937, 530, 881, 1843, 858, 859, 809, 861, 83, 863, - 519, 520, 521, 522, 523, 524, 133, 820, 3684, 94, - 164, 432, 427, 434, 827, 169, 1689, 38, 3179, 519, - 520, 521, 522, 523, 524, 470, 4, 528, 2415, 83, - 2236, 9, 3666, 2597, 890, 3666, 531, 890, 1929, 890, - 94, 532, 989, 2983, 1907, 2808, 2809, 1878, 1879, 1880, - 890, 1945, 205, 1000, 2040, 1949, 890, 1038, 1952, 890, - 1007, 1008, 401, 1954, 890, 1003, 1013, 890, 300, 1016, - 1017, 2613, 1019, 1020, 1021, 1022, 890, 3771, 1003, 955, - 890, 2754, 890, 820, 478, 890, 890, 241, 890, 1036, - 398, 1038, 890, 1992, 1993, 1994, 1995, 1996, 1997, 890, - 1047, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - 2009, 2780, 2640, 1811, 216, 890, 105, 1064, 1065, 1066, - 890, 890, 1036, 3346, 1038, 890, 890, 890, 361, 41, - 2799, 334, 299, 1047, 2340, 3752, 75, 164, 292, 1086, - 72, 73, 1123, 3760, 2665, 1843, 1036, 164, 1038, 61, - 379, 526, 169, 280, 175, 530, 464, 1047, 1036, 1106, - 1038, 390, 2252, 290, 2254, 1863, 3081, 280, 297, 1047, - 1868, 1118, 1119, 1120, 3089, 1122, 1123, 27, 1125, 118, - 5, 1854, 351, 33, 1655, 2555, 1859, 2574, 2371, 174, - 211, 3321, 359, 54, 183, 107, 363, 492, 427, 176, - 1613, 13, 14, 1125, 120, 248, 227, 2403, 2306, 1622, - 27, 1158, 2026, 523, 241, 529, 33, 238, 532, 514, - 530, 390, 528, 1036, 241, 1038, 379, 180, 395, 1176, - 1177, 1970, 2995, 528, 1047, 1974, 38, 390, 1977, 1211, - 1212, 526, 1214, 1211, 1212, 530, 1214, 2789, 347, 133, - 1043, 480, 205, 528, 1203, 526, 1049, 1206, 427, 530, - 109, 2789, 264, 265, 529, 292, 1213, 532, 2379, 31, - 1217, 1218, 249, 316, 427, 292, 13, 14, 162, 3502, - 1227, 1228, 1229, 529, 180, 1232, 532, 3227, 138, 278, - 2832, 244, 204, 209, 2193, 2194, 526, 2242, 528, 1036, - 530, 1038, 1196, 470, 2118, 1479, 361, 1481, 1482, 1256, - 1047, 480, 858, 859, 205, 861, 529, 863, 179, 532, - 3176, 138, 2448, 1272, 86, 1048, 386, 480, 529, 1052, - 257, 532, 2458, 95, 445, 196, 321, 322, 323, 529, - 201, 280, 532, 255, 386, 1292, 285, 300, 244, 370, - 843, 844, 845, 427, 266, 848, 1303, 119, 526, 480, - 528, 2925, 278, 406, 280, 383, 278, 529, 389, 529, - 532, 386, 532, 175, 351, 3048, 490, 529, 492, 240, - 532, 1328, 384, 385, 2198, 6, 515, 516, 517, 10, - 519, 520, 521, 522, 523, 524, 335, 18, 310, 529, - 528, 285, 532, 388, 529, 529, 290, 532, 532, 211, - 3171, 32, 528, 390, 353, 36, 2247, 460, 169, 529, - 529, 1368, 532, 532, 528, 227, 379, 1350, 528, 1350, - 1377, 193, 528, 1350, 1350, 2961, 238, 529, 176, 2826, - 532, 432, 427, 434, 206, 528, 1368, 1394, 437, 299, - 427, 528, 2346, 365, 2348, 1393, 529, 529, 529, 532, - 532, 532, 529, 529, 1411, 532, 532, 2934, 1393, 1416, - 2937, 5, 2939, 529, 451, 174, 532, 462, 390, 432, - 803, 434, 299, 529, 1394, 528, 532, 528, 473, 1411, - 1384, 529, 1386, 529, 532, 2901, 532, 2595, 432, 411, - 434, 2599, 528, 480, 457, 3033, 149, 460, 2349, 359, - 2351, 249, 835, 363, 2753, 528, 2755, 3013, 457, 1466, - 1467, 164, 896, 2311, 898, 1472, 169, 1474, 467, 528, - 2164, 521, 1479, 1480, 1481, 1482, 432, 860, 434, 400, - 3763, 529, 359, 528, 532, 395, 363, 1494, 1495, 529, - 529, 19, 532, 532, 514, 3097, 528, 1504, 529, 1506, - 1474, 532, 1509, 447, 460, 13, 14, 1514, 370, 1516, - 1517, 511, 1519, 226, 458, 2429, 1523, 220, 395, 529, - 13, 14, 532, 2771, 1474, 529, 909, 389, 532, 2772, - 1504, 295, 1506, 127, 128, 1509, 3696, 530, 241, 3738, - 1514, 3740, 511, 1517, 529, 1519, 532, 532, 173, 1523, - 248, 3711, 529, 351, 1504, 532, 1506, 529, 529, 1509, - 470, 532, 529, 528, 1514, 532, 1504, 1517, 1506, 1519, - 529, 1509, 1579, 1523, 529, 2823, 1514, 532, 174, 1517, - 174, 1519, 13, 14, 2770, 1523, 2772, 2645, 2646, 292, - 529, 413, 390, 470, 416, 529, 3198, 60, 301, 300, - 3799, 1474, 3204, 222, 529, 1612, 1613, 532, 3524, 13, - 14, 1609, 1609, 1609, 1621, 1622, 1609, 1000, 316, 1609, - 1609, 13, 14, 1630, 1609, 3785, 528, 1010, 428, 427, - 1637, 1504, 529, 1506, 174, 532, 1509, 1644, 3798, 529, - 511, 1514, 532, 226, 1517, 154, 1519, 2620, 2653, 0, - 1523, 3474, 3475, 451, 13, 14, 154, 1664, 1665, 13, - 14, 109, 1669, 2621, 2622, 1672, 2621, 2622, 2623, 3271, - 1677, 1678, 1679, 1680, 1681, 1682, 1683, 1684, 1685, 1686, - 2621, 379, 480, 1690, 1691, 1692, 13, 14, 1695, 1722, - 359, 180, 1699, 13, 14, 1702, 1703, 1704, 1705, 1706, - 1707, 1708, 1709, 1710, 1686, 359, 1713, 1504, 406, 1506, - 13, 14, 1509, 1720, 154, 1722, 205, 1514, 1692, 154, - 1517, 154, 1519, 2682, 2683, 248, 1523, 321, 322, 323, - 1762, 13, 14, 1740, 1762, 191, 192, 13, 14, 13, - 14, 13, 14, 13, 14, 13, 14, 374, 375, 1132, - 101, 248, 154, 456, 41, 244, 13, 14, 1765, 1142, - 427, 27, 460, 13, 14, 528, 8, 33, 1738, 1776, - 1777, 374, 375, 15, 16, 529, 2509, 280, 20, 21, - 22, 1164, 3384, 13, 14, 13, 14, 13, 14, 480, - 1173, 27, 90, 316, 388, 494, 3384, 33, 149, 13, - 14, 13, 14, 2719, 154, 399, 3486, 154, 264, 265, - 133, 300, 1819, 164, 13, 14, 374, 375, 169, 316, - 374, 375, 1829, 174, 268, 269, 1833, 384, 385, 423, - 528, 295, 183, 427, 13, 14, 530, 188, 154, 162, - 154, 8, 472, 473, 11, 3717, 3718, 1829, 15, 16, - 361, 1833, 3095, 20, 21, 22, 379, 2499, 2500, 440, - 1814, 3706, 3707, 3747, 3748, 1176, 1177, 1874, 462, 220, - 1877, 1825, 138, 1827, 2318, 2319, 1830, 1884, 528, 473, - 1887, 1888, 379, 406, 528, 528, 1840, 529, 1842, 180, - 241, 528, 1874, 429, 2742, 47, 490, 222, 1281, 227, - 305, 1855, 138, 60, 528, 227, 1860, 528, 227, 406, - 1864, 1865, 302, 1867, 2837, 1869, 1870, 2868, 1925, 2793, - 514, 3132, 1929, 2814, 41, 5, 2880, 1923, 384, 385, - 239, 528, 5, 27, 528, 528, 2895, 460, 331, 33, - 1947, 292, 528, 432, 295, 434, 528, 1954, 1955, 2863, - 301, 528, 5, 244, 5, 528, 1963, 280, 5, 528, - 3694, 2996, 285, 460, 3698, 5, 528, 290, 457, 528, - 9, 460, 1979, 248, 491, 528, 1983, 1984, 307, 1986, - 532, 105, 532, 529, 1991, 1992, 1993, 1994, 1995, 1996, - 1997, 342, 467, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 222, 3434, 528, 395, 169, 2015, 2016, - 169, 292, 2019, 290, 2021, 60, 367, 174, 239, 2026, - 440, 2028, 528, 440, 94, 532, 440, 1410, 60, 320, - 60, 528, 440, 299, 201, 19, 271, 440, 3772, 224, - 248, 316, 528, 2050, 138, 440, 8, 490, 386, 11, - 2057, 154, 2059, 15, 16, 297, 2063, 224, 20, 21, - 22, 440, 280, 299, 3666, 2072, 149, 101, 201, 2076, - 280, 2078, 41, 2080, 99, 2082, 427, 280, 3666, 528, - 280, 164, 41, 2057, 280, 280, 169, 528, 379, 2063, - 154, 530, 174, 359, 13, 386, 174, 363, 532, 2106, - 529, 529, 127, 128, 379, 456, 529, 2057, 316, 528, - 3069, 2118, 2119, 2063, 3086, 487, 467, 529, 2125, 2057, - 529, 1000, 529, 359, 447, 2063, 227, 363, 529, 395, - 297, 406, 529, 287, 528, 458, 487, 220, 489, 490, - 227, 432, 1066, 434, 3098, 3099, 287, 528, 528, 174, - 3398, 2158, 528, 530, 532, 2162, 477, 2198, 241, 395, - 2167, 2168, 528, 3593, 321, 322, 323, 528, 528, 460, - 528, 379, 40, 530, 486, 526, 528, 9, 529, 530, - 531, 11, 438, 248, 2057, 460, 2193, 2194, 528, 438, - 2063, 2198, 361, 527, 19, 532, 532, 2930, 406, 438, - 3647, 285, 537, 440, 470, 299, 183, 2214, 3638, 292, - 2217, 2218, 2219, 528, 165, 532, 174, 229, 301, 529, - 41, 467, 467, 220, 532, 271, 398, 229, 2235, 2236, - 296, 388, 532, 319, 470, 2242, 0, 3242, 2245, 201, - 319, 183, 38, 532, 2218, 529, 222, 43, 359, 1173, - 528, 316, 460, 528, 2261, 229, 280, 229, 2265, 530, - 2057, 3691, 224, 1142, 301, 359, 2063, 3226, 2275, 363, - 427, 2245, 60, 515, 516, 517, 60, 519, 520, 521, - 522, 523, 524, 287, 60, 2292, 2293, 2261, 60, 287, - 340, 2265, 293, 480, 1173, 2245, 321, 322, 323, 3457, - 529, 395, 2309, 2257, 2311, 462, 102, 2245, 154, 3, - 154, 2261, 528, 528, 379, 2265, 473, 154, 154, 2326, - 528, 154, 490, 2261, 41, 154, 532, 2265, 532, 295, - 280, 3, 1256, 2340, 3067, 297, 41, 101, 295, 60, - 174, 406, 2349, 2350, 2351, 11, 41, 1730, 515, 516, - 517, 169, 519, 520, 521, 522, 523, 524, 529, 529, - 183, 169, 528, 388, 529, 529, 3, 2349, 2350, 2351, - 528, 528, 2245, 456, 399, 528, 470, 40, 1257, 175, - 3, 1260, 1261, 526, 118, 149, 526, 2394, 2261, 527, - 529, 149, 2265, 529, 529, 460, 2403, 174, 423, 440, - 164, 532, 427, 537, 440, 169, 164, 440, 530, 440, - 174, 169, 511, 529, 529, 211, 511, 529, 359, 183, - 529, 1804, 1805, 448, 188, 8, 3669, 150, 11, 2436, - 530, 227, 15, 16, 2441, 511, 529, 462, 529, 2422, - 174, 2422, 238, 526, 174, 2422, 2422, 530, 473, 440, - 3364, 528, 487, 528, 2436, 157, 220, 528, 60, 528, - 528, 41, 220, 528, 47, 490, 247, 60, 2265, 532, - 513, 54, 296, 517, 296, 464, 532, 241, 274, 60, - 271, 75, 280, 241, 479, 440, 440, 81, 1871, 514, - 2497, 205, 154, 154, 2501, 154, 440, 2451, 81, 295, - 94, 528, 528, 528, 440, 528, 1889, 1890, 440, 3040, - 2517, 440, 529, 528, 528, 41, 41, 295, 361, 529, - 1399, 1400, 293, 532, 118, 321, 120, 490, 292, 528, - 41, 295, 328, 38, 292, 2517, 528, 301, 43, 154, - 285, 529, 174, 301, 321, 322, 323, 528, 2555, 528, - 60, 529, 188, 515, 516, 517, 529, 519, 520, 521, - 522, 523, 524, 14, 1066, 529, 169, 81, 529, 3443, - 526, 3445, 3488, 144, 370, 309, 529, 529, 342, 174, - 528, 2555, 529, 532, 529, 19, 1969, 321, 322, 323, - 2597, 529, 532, 389, 528, 306, 179, 102, 529, 254, - 528, 367, 528, 367, 296, 2555, 2613, 3455, 529, 183, - 154, 388, 2653, 196, 532, 209, 2625, 529, 201, 528, - 178, 529, 529, 2630, 451, 529, 528, 530, 528, 528, - 2637, 2638, 41, 87, 41, 41, 41, 532, 174, 467, - 528, 489, 529, 529, 201, 529, 2653, 2688, 3653, 3458, - 427, 3460, 527, 527, 388, 1579, 532, 240, 529, 2666, - 2693, 473, 2669, 427, 2671, 529, 462, 529, 529, 532, - 175, 2678, 2679, 295, 60, 2682, 2683, 486, 517, 529, - 2687, 2688, 2555, 490, 3598, 462, 280, 2694, 529, 529, - 207, 285, 456, 427, 3585, 118, 473, 3607, 456, 41, - 229, 2742, 528, 467, 2711, 89, 211, 194, 285, 529, - 285, 530, 517, 490, 297, 2722, 530, 530, 529, 2715, - 530, 440, 227, 487, 530, 489, 490, 530, 462, 530, - 3578, 530, 440, 238, 527, 2742, 530, 514, 530, 473, - 530, 335, 41, 530, 530, 530, 280, 530, 1627, 528, - 530, 528, 108, 1677, 1256, 530, 490, 530, 527, 353, - 530, 1640, 526, 1642, 529, 529, 530, 531, 526, 274, - 530, 529, 530, 530, 530, 530, 530, 530, 530, 2786, - 514, 530, 2789, 2790, 530, 2792, 2793, 2794, 530, 530, - 530, 2745, 1671, 530, 528, 2749, 532, 530, 530, 490, - 529, 2808, 2809, 529, 2786, 529, 528, 427, 2790, 295, - 2792, 41, 528, 9, 2821, 360, 321, 400, 528, 528, - 2861, 342, 529, 328, 2778, 2832, 532, 60, 532, 529, - 201, 61, 529, 2840, 2875, 2831, 532, 527, 472, 194, - 529, 2795, 2796, 2797, 2798, 532, 2800, 2801, 2802, 2803, - 2804, 92, 529, 2836, 353, 2836, 7, 8, 528, 2836, - 2836, 2868, 13, 457, 41, 370, 154, 125, 19, 2865, - 530, 529, 23, 467, 25, 154, 41, 107, 29, 30, - 31, 2922, 529, 34, 389, 375, 37, 38, 2895, 41, - 41, 2898, 375, 44, 45, 1819, 529, 1776, 1777, 528, - 528, 41, 3635, 467, 528, 532, 37, 315, 2915, 2916, - 253, 2918, 528, 285, 252, 2922, 193, 467, 2925, 451, - 528, 75, 298, 81, 9, 75, 77, 78, 529, 512, - 529, 528, 377, 3807, 60, 527, 519, 520, 521, 522, - 523, 524, 529, 527, 134, 2952, 94, 436, 178, 60, - 517, 278, 103, 451, 295, 41, 528, 462, 298, 110, - 111, 112, 113, 114, 115, 2972, 298, 528, 472, 1848, - 2977, 2978, 207, 2356, 204, 2982, 2983, 529, 529, 1858, - 2987, 3022, 1861, 2990, 2991, 295, 529, 295, 2995, 2996, - 529, 395, 2999, 436, 281, 123, 3003, 464, 473, 8, - 374, 1925, 11, 150, 473, 0, 15, 16, 3015, 521, - 26, 20, 21, 22, 37, 3013, 3013, 3013, 303, 528, - 3013, 374, 41, 3013, 3013, 255, 3557, 529, 3013, 3003, - 890, 2773, 2415, 2341, 1841, 2344, 266, 2786, 47, 3490, - 2720, 41, 61, 3638, 3589, 54, 3757, 3191, 278, 1954, - 867, 3091, 2504, 3003, 3061, 1979, 3613, 3730, 3357, 3670, - 3679, 61, 3069, 3723, 3415, 3003, 1243, 1991, 2332, 2350, - 1819, 1819, 81, 2851, 3668, 3677, 2763, 1579, 2792, 3665, - 310, 3088, 2329, 1376, 3664, 3762, 8, 3329, 107, 11, - 3097, 2499, 2421, 15, 16, 2500, 1348, 2021, 20, 21, - 22, 2868, 2309, 2826, 2028, 1035, 101, 107, 108, 2794, - 1035, 1196, 2275, 1801, 3068, 37, 1221, 2574, 118, 3647, - 2292, 1056, 1220, 3566, 1765, 3132, 3447, 1800, 23, 2069, - 3003, 1223, 2261, 3266, 1012, 365, 2519, 2925, 2521, 2555, - 2554, 3378, 2525, 2605, 2527, 1010, 3570, 2085, 2072, 3569, - 2169, 1010, 2076, 1010, 149, 1010, 1010, 1010, 2082, 1010, - 390, 1010, 2638, 1010, 2218, 2276, 2120, 3314, 2215, 164, - 179, 3178, 2662, 3015, 169, 1677, 2172, 1495, 178, 174, - 1890, 411, 2106, 3555, 3191, 204, 3013, 196, 183, 2974, - 804, 3198, 201, 188, 2078, 1738, 3178, 3204, 1000, 3195, - 1394, 3242, 2721, 180, 204, 1739, 3003, 3214, 3215, 3191, - 3217, 2090, 2517, 1874, -1, 224, 225, -1, -1, 3226, - 3227, 909, -1, -1, -1, 220, -1, -1, 205, -1, - -1, 240, -1, -1, -1, 3242, 255, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 241, 266, -1, -1, - -1, -1, -1, -1, -1, 255, -1, -1, -1, 278, - -1, -1, -1, -1, 3271, -1, 266, 244, -1, 8, - 3277, 280, 11, -1, 283, 0, 15, 16, 278, -1, - 280, 20, 21, 22, -1, -1, 3293, 3294, 297, -1, - 3297, 310, 3299, -1, -1, 20, -1, 292, 23, -1, - 295, -1, 224, -1, -1, -1, 301, -1, -1, -1, - 310, -1, 37, -1, -1, -1, -1, 1819, -1, -1, - -1, 46, -1, 300, 3331, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 8, -1, -1, 11, -1, -1, - -1, 15, 16, 320, -1, -1, 365, 342, 3355, -1, - -1, -1, 77, 78, 79, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 365, -1, -1, -1, -1, - 2249, 390, 367, 47, -1, 297, -1, 3384, 103, 8, - 54, -1, 11, 56, -1, -1, 15, 16, -1, -1, - 390, 400, 411, -1, -1, -1, -1, -1, -1, -1, - 551, 3408, 379, 2282, 2283, 556, 2789, 81, 3404, 386, - -1, 411, 3366, 413, -1, 566, 416, -1, 47, -1, - -1, -1, -1, 1925, -1, 54, 3408, 3434, -1, -1, - 103, -1, 427, 3387, 3388, -1, 3443, -1, 3445, -1, - 3447, -1, -1, 2826, 3451, -1, 3453, -1, 3455, -1, - -1, 124, 81, -1, -1, 432, -1, 434, 3412, -1, - 3434, 456, 3469, -1, -1, -1, 153, 3474, 3475, 142, - -1, -1, 467, 147, 147, -1, -1, 1979, 2861, 3486, - 457, -1, -1, 460, 3434, 224, -1, 174, -1, 1991, - -1, 3487, 487, 3489, 489, 490, 3503, 170, -1, -1, - 173, 3508, -1, 512, -1, 179, 515, 516, 517, -1, - 519, 520, 521, 522, 523, 524, 189, 2441, 147, 2021, - -1, 3503, 196, -1, -1, -1, 2028, 201, 528, -1, - -1, 526, -1, -1, 529, 530, 531, 3533, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 3556, - 179, -1, -1, -1, 3550, -1, -1, -1, 297, 3566, - -1, 3434, -1, -1, -1, -1, 240, 196, -1, -1, - 2072, 3578, 201, 2497, 2076, -1, -1, -1, -1, -1, - 2082, -1, -1, -1, -1, -1, 3593, -1, 3595, -1, - -1, -1, -1, 515, 516, 517, -1, 519, 520, 521, - 522, 523, 524, -1, 2106, -1, -1, 3614, 759, 760, - 761, 240, 285, -1, -1, -1, -1, -1, -1, 3593, - 293, -1, -1, 297, 3007, -1, -1, -1, -1, -1, - -1, 3638, -1, -1, 321, 322, 323, -1, -1, -1, - -1, -1, 315, 3593, -1, -1, 3653, -1, -1, -1, - -1, -1, 803, 804, -1, -1, -1, -1, 809, 3666, - 811, 3668, -1, -1, 3638, -1, -1, -1, 297, 820, - -1, -1, 345, 824, 825, -1, 827, -1, -1, 830, - 831, -1, -1, -1, 3691, -1, 3668, 3683, 3638, 2613, - -1, -1, 843, 844, 845, -1, -1, 848, 3705, 3706, - 3707, 388, -1, -1, 3658, 856, 857, 858, 859, 3716, - 861, -1, 863, 3709, -1, -1, -1, 3691, -1, -1, - 3593, -1, -1, -1, 875, -1, 400, -1, -1, -1, - 881, -1, -1, -1, 3741, -1, -1, -1, 2617, 2618, - 427, 3691, -1, 894, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 2678, -1, -1, 908, 909, -1, - -1, -1, -1, -1, -1, 3638, -1, -1, -1, -1, - -1, 400, -1, -1, -1, 462, 515, 516, 517, -1, - 519, 520, 521, 522, 523, 524, 473, -1, -1, 153, - -1, -1, -1, 3800, -1, -1, 947, 948, -1, -1, - 3807, -1, -1, 490, -1, -1, -1, 958, -1, -1, - 174, 962, 963, 964, 965, 966, -1, -1, 3691, -1, - 174, -1, -1, -1, -1, 550, -1, 514, 979, 25, - -1, -1, -1, -1, -1, -1, -1, -1, 512, -1, - -1, 528, -1, -1, -1, 519, 520, 521, 522, 523, - 524, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 1011, 1012, -1, 1014, -1, 2789, 1017, -1, -1, -1, - -1, -1, 1023, 1024, -1, -1, -1, -1, -1, 1030, - -1, -1, -1, 512, -1, 1036, 82, 1038, -1, -1, - 519, 520, 521, 522, 523, 524, 1047, 8, -1, -1, - 11, -1, 98, -1, 15, 16, 1057, -1, 2832, -1, - 2789, -1, -1, -1, -1, -1, -1, 8, -1, -1, - 11, -1, -1, 1074, 15, 16, -1, 3310, -1, 20, - 21, 22, -1, -1, -1, -1, 47, -1, -1, 2441, - -1, -1, -1, 54, -1, -1, 37, -1, 1066, -1, - -1, 1102, 148, 1066, -1, 309, 47, 321, 322, 323, - -1, -1, 158, 54, -1, -1, -1, 321, 322, 323, - 81, -1, -1, -1, 2898, 171, 1127, -1, -1, -1, - 176, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 81, -1, -1, -1, -1, 2497, -1, -1, -1, -1, - -1, 3384, -1, -1, -1, -1, -1, -1, 8, 205, - -1, 11, -1, -1, -1, 15, 16, -1, -1, -1, - 20, 21, 22, -1, 388, -1, -1, -1, -1, 1180, - -1, -1, -1, -1, 388, -1, 147, -1, -1, -1, - -1, 3424, 767, 768, -1, 1196, 1197, 47, -1, -1, - -1, -1, 1203, 249, 54, 1206, 2935, -1, 254, 2983, - -1, -1, -1, 427, -1, -1, -1, -1, 179, -1, - -1, -1, -1, 427, -1, -1, 1227, 1228, 1229, -1, - -1, 81, -1, -1, 809, 196, 1237, -1, 179, 1240, - 201, 1242, 1243, -1, -1, 820, -1, -1, 462, -1, - -1, -1, 827, -1, 1255, 196, -1, -1, 462, 473, - 201, 2613, -1, -1, -1, -1, -1, -1, -1, 473, - -1, 1272, -1, -1, 320, 1276, 490, -1, -1, 240, - 326, 1282, -1, 224, 225, 1066, 490, -1, 1256, -1, - -1, -1, 3525, 1256, -1, 341, -1, 872, -1, 240, - 514, -1, -1, -1, -1, 127, 128, -1, -1, -1, - 514, -1, -1, -1, 528, 890, -1, -1, -1, -1, - -1, -1, -1, 3097, 528, -1, 2678, -1, -1, 179, - 376, -1, -1, 379, -1, -1, 297, -1, -1, 280, - -1, -1, 283, 1344, 390, 1346, 196, 393, -1, -1, - -1, 201, 174, 1354, -1, -1, 297, 3086, 3132, 300, - -1, -1, 3091, -1, -1, -1, 1367, 413, -1, -1, - -1, -1, -1, -1, -1, 1376, -1, -1, -1, -1, - 1381, 427, 1383, 1384, -1, 1386, 1387, -1, 434, 435, - 240, -1, -1, -1, -1, -1, -1, -1, -1, 445, - -1, -1, -1, -1, -1, 451, -1, -1, -1, -1, - -1, 3140, 3141, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 3198, -1, -1, -1, 1003, -1, - 3204, -1, -1, 3666, 480, -1, -1, 2789, -1, 400, - -1, -1, -1, -1, -1, -1, -1, 297, -1, -1, - -1, -1, -1, 3227, -1, -1, -1, -1, -1, 400, - -1, 1036, -1, 1038, -1, 1466, 1467, -1, -1, -1, - -1, 1472, 1047, 1474, -1, 1256, -1, -1, -1, -1, - 2832, -1, -1, -1, -1, -1, 1487, -1, 1489, 1490, - -1, -1, -1, 1494, 1495, -1, 1497, 3271, -1, 321, - 322, 323, -1, 1504, 38, 1506, -1, 1082, 1509, 43, - -1, -1, -1, 1514, -1, 1516, 1517, -1, 1519, 1094, - -1, -1, 1523, -1, 1525, -1, 1527, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 2898, -1, 1123, -1, - 400, 512, -1, -1, -1, -1, -1, -1, 519, 520, - 521, 522, 523, 524, -1, -1, 388, -1, 102, -1, - -1, 512, -1, -1, 515, 516, 517, 399, 519, 520, - 521, 522, 523, 524, 8, -1, -1, 11, -1, -1, - -1, 15, 16, -1, -1, -1, -1, -1, -1, -1, - -1, 423, -1, -1, -1, 427, -1, -1, -1, -1, - 3384, 1579, -1, -1, -1, -1, 1579, 8, -1, -1, - 11, -1, -1, 47, 15, 16, -1, -1, -1, -1, - 54, 2983, -1, -1, -1, 1636, 1211, 1212, -1, 1214, - 462, 175, -1, -1, -1, 3374, 3375, -1, 1649, 183, - -1, 473, -1, -1, -1, 3384, 47, 81, -1, -1, - -1, -1, 512, 54, -1, 515, 516, 517, 490, 519, - 520, 521, 522, 523, 524, -1, -1, 211, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 1066, 1689, -1, - 81, 1692, 514, 227, 38, -1, -1, -1, -1, 43, - -1, -1, -1, -1, 238, -1, 528, -1, -1, 1677, - -1, -1, -1, -1, 1677, -1, -1, -1, -1, 1720, - -1, -1, -1, 147, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 1735, -1, 1737, -1, 1739, -1, - 274, -1, -1, -1, -1, 3097, -1, -1, -1, 1750, - -1, -1, 1753, -1, -1, 179, 147, -1, 102, -1, - -1, 295, 8, -1, 1765, 11, -1, -1, -1, 15, - 16, -1, 196, -1, 20, 21, 22, 201, -1, -1, - 3132, -1, -1, -1, -1, -1, -1, 321, 179, 1790, - -1, 1792, -1, -1, 328, -1, -1, -1, 1579, -1, - -1, -1, -1, 1804, 1805, 196, -1, -1, 1066, 1810, - 201, -1, 1813, 1814, -1, -1, 240, -1, 1393, -1, - -1, -1, -1, -1, 1825, 1826, 1827, 1828, -1, 1830, - -1, 175, -1, -1, -1, -1, 370, -1, -1, 1840, - -1, 1842, -1, -1, -1, -1, 3198, -1, -1, 240, - -1, 1819, 3204, 1854, 1855, 389, 1819, -1, 1859, 1860, - -1, -1, -1, 1864, 1865, 1866, 1867, 211, 1869, 1870, - -1, -1, -1, 297, -1, 3227, -1, 1256, -1, -1, - 37, -1, -1, 227, 41, -1, -1, -1, -1, -1, - 1891, -1, 3666, -1, 238, -1, 1677, -1, 1899, -1, - 1901, 1902, 1903, 1904, 1905, 1906, 297, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 3271, - 1921, -1, -1, -1, -1, -1, -1, -1, 462, 1504, - 274, 1506, -1, 467, 1509, -1, -1, 3666, -1, 1514, - -1, 1942, 1517, -1, 1519, -1, 103, -1, 1523, -1, - -1, 295, -1, -1, 111, -1, 113, 1925, 115, -1, - -1, -1, 1925, -1, -1, 1017, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 400, 321, 224, -1, - -1, -1, -1, -1, 328, -1, -1, -1, -1, -1, - -1, 1992, 1993, 1994, 1995, 1996, 1997, -1, 1256, 2000, - 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 400, - -1, 1979, -1, -1, -1, -1, 1979, -1, -1, -1, - -1, -1, -1, 1991, -1, -1, 370, -1, 1991, 2030, - -1, -1, 3384, -1, 1609, -1, -1, -1, 1819, -1, - -1, -1, -1, 2044, -1, 389, -1, -1, -1, -1, - -1, 297, -1, 2021, -1, -1, 2057, -1, 2021, -1, - 2028, -1, 2063, -1, -1, 2028, -1, -1, 2069, -1, - -1, -1, -1, -1, 2075, -1, -1, -1, -1, -1, - -1, -1, -1, 2084, 2085, -1, -1, -1, 512, -1, - -1, -1, -1, -1, -1, 519, 520, 521, 522, 523, - 524, -1, -1, -1, 2072, 13, -1, -1, 2076, 2072, - -1, 19, -1, 2076, 2082, 23, -1, 1692, 462, 2082, - -1, 512, 30, 467, -1, -1, -1, -1, 519, 520, - 521, 522, 523, 524, -1, -1, 44, 45, 2106, -1, - -1, -1, -1, 2106, 1925, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 2159, -1, - -1, -1, -1, 2164, -1, -1, 1218, -1, 2169, 77, - 78, -1, -1, -1, -1, 1227, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 1762, -1, -1, - -1, -1, 2193, 2194, -1, -1, -1, -1, 1979, -1, - 1579, -1, -1, -1, 112, -1, -1, -1, -1, -1, - 1991, 2212, -1, -1, -1, -1, -1, 2218, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 2021, -1, -1, -1, 2245, -1, -1, 2028, -1, -1, - -1, -1, -1, -1, -1, -1, 2257, -1, -1, -1, - 2261, -1, -1, -1, 2265, 2266, -1, -1, -1, 515, - 516, 517, -1, 519, 520, 521, 522, 523, 524, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 2072, -1, -1, -1, 2076, -1, -1, 1677, -1, - -1, 2082, -1, -1, -1, 2306, -1, -1, 2309, -1, - 2311, 2312, -1, -1, 3666, -1, -1, -1, -1, -1, - -1, 1579, -1, -1, -1, 2106, -1, 8, -1, -1, - 11, -1, -1, 2334, 15, 16, -1, -1, -1, 20, - 21, 22, -1, -1, -1, -1, -1, 8, 1923, -1, - 11, -1, -1, -1, 15, 16, 37, -1, -1, 20, - 21, 22, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 37, 8, -1, -1, - 11, -1, -1, -1, 15, 16, -1, -1, -1, 20, - 21, 22, -1, -1, 551, -1, -1, -1, -1, 556, - -1, -1, -1, -1, -1, -1, 37, -1, -1, -1, - -1, -1, -1, -1, 1466, 1467, 2417, -1, -1, 1677, - 1472, -1, -1, 2424, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 2434, -1, -1, 2437, 2438, 2439, 2440, - 1819, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 2451, -1, 2453, -1, -1, -1, 2457, -1, -1, 2460, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 2441, -1, -1, -1, -1, 2441, -1, - -1, -1, 2057, -1, -1, -1, -1, -1, 2063, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 2503, -1, -1, -1, -1, -1, 2509, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 2523, 2524, -1, 2526, -1, -1, -1, 2497, - 8, -1, -1, 11, 2497, -1, -1, 15, 16, -1, - -1, -1, -1, 224, -1, -1, 1925, -1, -1, -1, - -1, -1, -1, -1, 2555, -1, -1, -1, -1, -1, - -1, 1819, 1017, 224, -1, -1, -1, -1, -1, 47, - -1, -1, 2573, -1, -1, -1, 54, -1, -1, -1, - 2581, 2582, 2583, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 224, 2595, -1, 2597, -1, 2599, -1, - 1979, -1, -1, 81, 2605, -1, -1, -1, -1, -1, - -1, -1, 1991, -1, -1, -1, 297, -1, -1, -1, - -1, -1, -1, 2198, 2625, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 297, -1, -1, 2640, - -1, -1, 2021, 2218, -1, 2613, -1, -1, -1, 2028, - 2613, 2652, -1, -1, 811, 2656, -1, -1, 566, 2234, - 2441, -1, -1, -1, -1, -1, 297, 1925, -1, 147, - 2245, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 2682, 2683, -1, -1, -1, 2261, -1, -1, -1, - 2265, -1, -1, 2072, -1, -1, -1, 2076, -1, -1, - -1, 179, -1, 2082, -1, 2706, -1, -1, -1, -1, - 2678, -1, 2713, 1765, -1, 2678, 2497, -1, 196, 2720, - -1, 1979, -1, 201, -1, -1, -1, 2106, -1, -1, - -1, -1, -1, 1991, -1, 2736, -1, -1, -1, 2740, - -1, 2742, -1, 2744, 2745, -1, -1, 2748, 2749, -1, - -1, 908, 2753, 2754, 2755, -1, 2757, -1, -1, -1, - -1, -1, 240, 2021, -1, -1, -1, -1, -1, -1, - 2028, -1, 1227, -1, -1, -1, -1, 2778, -1, 2780, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 947, -1, -1, -1, 2795, 2796, 2797, 2798, 2799, 2800, - 2801, 2802, 2803, 2804, -1, 962, 963, 964, 965, 966, - -1, -1, -1, -1, 2072, -1, -1, -1, 2076, 297, - -1, 2789, -1, -1, 2082, -1, 2789, -1, -1, 2830, - -1, -1, 2613, -1, 515, 516, 517, 2838, 519, 520, - 521, 522, 523, 524, -1, -1, -1, -1, 2106, -1, - 2851, -1, 760, 761, 515, 516, 517, 1014, 519, 520, - 521, 522, 523, 524, 2832, -1, -1, -1, -1, 2832, - -1, -1, -1, -1, -1, -1, 2877, -1, -1, 2454, - -1, -1, -1, 2884, 515, 516, 517, -1, 519, 520, - 521, 522, 523, 524, 2895, -1, -1, 2678, -1, -1, - 2901, -1, -1, -1, -1, -1, -1, 2908, 2909, 2910, - 2911, -1, 820, -1, -1, -1, -1, -1, -1, -1, - -1, 2922, 400, -1, 2925, -1, -1, -1, 2929, 2930, - 2898, -1, -1, -1, -1, 2898, -1, 2938, -1, -1, - 1992, 1993, 1994, 1995, 1996, 1997, -1, -1, 2000, 2001, - 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, -1, -1, - 2961, -1, -1, -1, -1, -1, -1, 2968, 2969, -1, - -1, -1, -1, 881, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 3, -1, - 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 3001, -1, 3003, -1, -1, -1, -1, -1, 2789, -1, - -1, 1466, 1467, -1, 3015, 2983, -1, 1472, -1, -1, - 2983, 3022, -1, -1, -1, -1, 3027, -1, -1, -1, - -1, -1, 3033, -1, 512, -1, -1, -1, -1, -1, - -1, 519, 520, 521, 522, 523, 524, 3048, -1, -1, - -1, 2832, -1, 3054, 69, 70, -1, -1, -1, -1, - -1, -1, 2441, -1, -1, -1, 3067, 3068, 3069, -1, - -1, -1, -1, -1, 3075, -1, -1, -1, 2653, -1, - 1237, -1, -1, -1, -1, 1242, -1, -1, -1, -1, - -1, 3092, -1, -1, -1, 110, 111, -1, 1255, 114, - 115, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 2688, -1, -1, -1, 2898, 2497, 1276, - -1, -1, 1030, -1, -1, -1, -1, -1, 1036, 3097, - 1038, -1, -1, -1, 3097, -1, -1, -1, -1, 1047, - 2715, 2193, 2194, -1, -1, -1, -1, -1, -1, 1057, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 3132, -1, -1, 2742, -1, 3132, - -1, -1, -1, 3174, -1, -1, 191, 192, 3179, -1, - -1, -1, -1, 2441, -1, -1, -1, -1, -1, 1346, - -1, -1, -1, 3194, 1102, -1, -1, 1354, -1, -1, - -1, -1, 2983, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 1127, - 3221, -1, -1, -1, -1, 3226, -1, -1, -1, -1, - 3198, -1, -1, -1, 2613, 3198, 3204, -1, -1, 2497, - -1, 3204, -1, 258, 259, 260, 261, 262, 263, 264, - 265, 3252, -1, 268, 269, -1, 2831, 2309, 3259, 3227, - -1, -1, -1, 1718, 3227, 3266, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 3283, -1, -1, -1, 2861, -1, 1196, 1197, - 2865, -1, -1, -1, -1, -1, -1, -1, -1, 2678, - 2875, -1, -1, 3271, -1, 3306, -1, -1, 3271, -1, - 1765, -1, -1, 3314, -1, -1, 3097, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 343, 344, - -1, -1, -1, -1, 3335, -1, -1, -1, -1, 3340, - 1497, -1, -1, -1, -1, -1, -1, 2922, -1, -1, - -1, 3132, -1, -1, -1, 2613, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 3366, -1, -1, -1, 384, - 385, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 3387, 3388, -1, -1, - -1, -1, -1, -1, -1, 69, 70, -1, -1, -1, - -1, -1, -1, -1, 3405, -1, 3407, -1, -1, -1, - 2789, 3412, -1, -1, -1, -1, 3384, 3198, -1, -1, - 2678, 3384, -1, 3204, -1, -1, -1, -1, 3003, -1, - 3431, -1, -1, 3434, -1, -1, 110, 111, 3013, -1, - 114, 115, -1, -1, -1, -1, 3227, 3022, -1, -1, - -1, -1, 3453, 2832, 3455, -1, 3457, 3458, -1, 3460, - -1, -1, -1, -1, 3465, -1, -1, -1, -1, 484, - 485, -1, -1, -1, -1, 1383, 1384, -1, 1386, -1, - -1, -1, -1, -1, -1, 3486, -1, -1, -1, 3490, - 3271, -1, -1, 508, 509, -1, -1, -1, -1, -1, - 3501, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 191, 192, 2898, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 3531, 2789, -1, -1, -1, -1, -1, 1992, 1993, 1994, - 1995, 1996, 1997, -1, -1, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008, 2009, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 3570, - -1, -1, -1, -1, 2832, -1, -1, 3578, -1, -1, - 1737, 1489, 1739, -1, 258, 259, 260, 261, 262, 263, - 264, 265, 3593, 1750, 268, 269, 1504, -1, 1506, -1, - -1, 1509, -1, 3384, 2983, -1, 1514, -1, -1, 1517, - -1, 1519, -1, -1, -1, 1523, -1, 1525, -1, 1527, - 3195, -1, 3623, -1, -1, -1, -1, 25, -1, -1, - 2682, 2683, -1, 1790, 3635, 3636, -1, 3638, 3639, -1, - 2898, -1, -1, -1, -1, -1, 3647, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 3658, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 3242, -1, 343, - 344, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 27, 3684, 82, -1, -1, -1, 33, -1, - 3691, -1, -1, -1, -1, -1, 41, -1, 3666, -1, - 98, -1, -1, 3666, -1, -1, -1, -1, -1, -1, - 384, 385, -1, -1, -1, -1, 61, -1, 3097, -1, - -1, -1, -1, -1, -1, 2983, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 3737, -1, 2193, 2194, - -1, 1649, -1, -1, 1901, 1902, 1903, 1904, 1905, 1906, - 148, 3752, -1, 3132, -1, -1, 3757, -1, -1, 3760, - 158, -1, 107, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 171, -1, -1, -1, -1, 176, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 138, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 205, -1, -1, - 484, 485, -1, -1, -1, -1, -1, -1, -1, 3198, - -1, -1, 856, 857, -1, 3204, -1, -1, -1, 3404, - -1, -1, -1, -1, 508, 509, -1, -1, -1, 3097, - -1, -1, -1, 2895, -1, -1, -1, -1, 3227, -1, - -1, 249, -1, -1, 2309, 3430, 254, -1, -1, 204, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 2922, -1, -1, -1, 3132, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 1792, 3666, -1, 2044, -1, -1, - -1, -1, 3271, -1, -1, -1, -1, -1, 932, -1, - -1, -1, 936, 937, -1, -1, 1814, -1, -1, -1, - 255, -1, 3487, -1, 3489, -1, -1, 1825, -1, 1827, - 2972, 266, 1830, -1, -1, -1, -1, -1, 326, -1, - -1, -1, 1840, 278, 1842, -1, -1, -1, -1, -1, - 3198, -1, -1, 341, -1, -1, 3204, 1855, -1, -1, - -1, -1, 1860, -1, 299, 989, 1864, 1865, 3533, 1867, - -1, 1869, 1870, -1, -1, 310, -1, -1, -1, 3227, - -1, -1, -1, 1007, -1, 3550, -1, -1, 376, 1013, - -1, 379, 1016, -1, -1, 1019, 1020, 1021, 1022, -1, - -1, -1, 390, -1, -1, 393, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 3384, -1, -1, -1, -1, - -1, -1, -1, 3271, 359, 413, -1, 3069, 363, -1, - 365, -1, -1, -1, -1, -1, -1, -1, -1, 427, - 1064, 1065, -1, -1, -1, -1, -1, 435, -1, -1, - -1, -1, -1, -1, -1, 390, -1, 445, -1, -1, - 395, -1, 1086, 451, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 411, -1, -1, -1, - -1, -1, 1106, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 480, -1, 1118, 1119, 1120, -1, 1122, 1123, - -1, 8, -1, -1, 11, -1, -1, -1, 15, 16, - 17, 18, -1, 20, 21, 22, -1, -1, 3683, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 37, -1, 2030, -1, 1158, 470, 3384, -1, -1, -1, - 47, -1, -1, -1, 3709, -1, -1, 54, -1, 27, - -1, -1, 1176, 1177, -1, 33, -1, -1, -1, 2057, - -1, -1, -1, 41, -1, 2063, -1, -1, -1, -1, - -1, 2069, -1, -1, 81, -1, -1, 2075, -1, -1, - -1, -1, -1, 61, 3226, -1, -1, -1, -1, 1213, - -1, -1, -1, 1217, 1218, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 1228, 1229, 3, -1, -1, -1, - -1, 8, -1, -1, 11, -1, -1, -1, 15, 16, - 17, 18, -1, 20, 21, 22, -1, -1, -1, 107, - -1, -1, -1, -1, -1, -1, -1, 2682, 2683, -1, - 37, -1, -1, -1, 41, -1, -1, -1, -1, -1, - 47, -1, -1, -1, -1, -1, -1, 54, -1, -1, - 138, 2159, -1, -1, -1, -1, 2164, -1, 1292, -1, - -1, 2169, 179, -1, -1, -1, -1, 2424, -1, 1303, - -1, -1, -1, -1, 81, -1, -1, -1, -1, 196, - -1, 2438, 2439, 2440, 201, -1, -1, 3666, -1, -1, - -1, -1, -1, -1, 1328, -1, 2453, -1, -1, -1, - 2457, -1, -1, 2460, -1, -1, -1, 224, 225, -1, - -1, -1, -1, -1, -1, -1, 204, -1, -1, -1, - -1, -1, -1, 240, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 2245, -1, -1, - -1, -1, -1, -1, -1, -1, 2503, -1, -1, 2257, - -1, -1, -1, 2261, -1, -1, -1, 2265, -1, -1, - -1, -1, -1, 280, -1, -1, 283, 255, -1, -1, - -1, -1, 179, -1, -1, -1, -1, -1, 266, -1, - 297, -1, 1416, 300, -1, -1, -1, -1, -1, 196, - 278, -1, -1, -1, 201, -1, -1, -1, 2306, -1, - -1, 3453, -1, -1, 2312, -1, -1, -1, 3666, -1, - -1, 299, -1, -1, -1, -1, -1, 224, 225, -1, - -1, -1, 310, -1, 2581, 2582, 2583, -1, -1, -1, - -1, -1, -1, 240, -1, -1, -1, -1, -1, -1, - 2895, -1, -1, -1, -1, 1479, -1, 1481, 1482, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 1494, 1495, -1, -1, -1, -1, -1, 2922, -1, -1, - -1, 359, -1, 280, -1, 363, 283, 365, -1, -1, - -1, -1, 1516, 400, -1, -1, -1, -1, -1, -1, - 297, -1, -1, 300, -1, -1, -1, -1, -1, -1, - -1, -1, 390, -1, -1, -1, -1, 395, -1, -1, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, + 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, + 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 134, 135, 0, 0, 137, 138, 0, 140, 141, 142, + 143, 144, 0, 146, 147, 0, 0, 148, 149, 150, + 151, 152, 0, 0, 153, 154, 155, 156, 157, 158, + 159, 0, 160, 161, 162, 163, 164, 0, 0, 0, + 166, 167, 168, 169, 170, 171, 0, 173, 174, 175, + 0, 176, 177, 178, 179, 180, 181, 0, 0, 183, + 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, + 194, 195, 196, 197, 0, 198, 0, 199, 200, 201, + 202, 203, 204, 0, 0, 205, 206, 207, 208, 0, + 0, 209, 210, 211, 212, 213, 0, 214, 215, 216, + 0, 217, 218, 219, 220, 0, 221, 222, 223, 224, + 225, 226, 227, 228, 229, 230, 231, 232, 0, 233, + 0, 234, 235, 236, 237, 0, 238, 0, 239, 0, + 0, 0, 242, 243, 540, 0, 246, 247, 248, 0, + 249, 250, 251, 252, 0, 253, 254, 255, 256, 257, + 1351, 259, 0, 261, 262, 263, 264, 0, 265, 266, + 267, 268, 269, 270, 271, 0, 272, 0, 274, 275, + 276, 277, 278, 279, 280, 281, 0, 282, 0, 283, + 0, 0, 286, 0, 288, 289, 290, 0, 291, 292, + 293, 0, 0, 294, 0, 296, 0, 0, 298, 299, + 300, 301, 302, 303, 304, 305, 541, 307, 308, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, + 0, 331, 332, 333, 334, 335, 0, 336, 337, 0, + 339, 0, 340, 341, 342, 343, 344, 345, 0, 346, + 347, 0, 0, 348, 349, 350, 0, 0, 351, 352, + 353, 0, 355, 0, 357, 358, 359, 360, 361, 362, + 363, 364, 365, 366, 367, 368, 369, 0, 0, 0, + 0, 370, 371, 372, 0, 374, 375, 376, 377, 378, + 379, 0, 380, 381, 382, 383, 384, 385, 0, 386, + 387, 388, 389, 390, 391, 392, 393, 394, 395, 0, + 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 0, 409, 410, 0, 412, 413, 414, + 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, + 425, 426, 427, 428, 0, 0, 429, 430, 431, 432, + 433, 434, 435, 436, 437, 0, 0, 439, 440, 441, + 442, 0, 443, 444, 445, 446, 447, 448, 449, 450, + 451, 452, 453, 454, 455, 456, 542, 458, 459, 0, + 0, 460, 461, 0, 462, 0, 464, 465, 466, 467, + 468, 469, 0, 470, 471, 472, 0, 0, 473, 474, + 475, 476, 477, 0, 478, 479, 480, 481, 482, 483, + 484, 485, 0, 0, 486, 487, 488, 0, 0, 489, + 490, 491, 492, 0, 493, 494, 495, 496, 497, 498, + 499, 500, 0, 501, 0, 503, 504, 505, 506, 507, + 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, + 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, + 524, 525, 526, 527, 528, 529, 530, 531, 539, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, + 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 134, + 135, 0, 0, 137, 138, 0, 140, 141, 142, 143, + 144, 0, 146, 147, 0, 0, 148, 149, 150, 151, + 152, 0, 0, 153, 154, 155, 156, 157, 158, 159, + 0, 160, 161, 162, 163, 164, 0, 0, 0, 166, + 167, 168, 169, 170, 171, 0, 173, 174, 175, 0, + 176, 177, 178, 179, 180, 181, 0, 0, 183, 184, + 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, + 195, 196, 197, 0, 198, 0, 199, 200, 201, 202, + 203, 204, 0, 0, 205, 206, 207, 208, 0, 0, + 209, 210, 211, 212, 213, 0, 214, 215, 216, 0, + 217, 218, 219, 220, 0, 221, 222, 223, 224, 225, + 226, 227, 228, 229, 230, 231, 232, 0, 233, 0, + 234, 235, 236, 237, 0, 238, 0, 239, 0, 0, + 0, 242, 243, 540, 0, 246, 247, 248, 0, 249, + 250, 251, 252, 0, 253, 254, 255, 256, 257, 1374, + 259, 0, 261, 262, 263, 264, 0, 265, 266, 267, + 268, 269, 270, 271, 0, 272, 0, 274, 275, 276, + 277, 278, 279, 280, 281, 0, 282, 0, 283, 0, + 0, 286, 0, 288, 289, 290, 0, 291, 292, 293, + 0, 0, 294, 0, 296, 0, 0, 298, 299, 300, + 301, 302, 303, 304, 305, 541, 307, 308, 309, 310, + 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, + 321, 322, 323, 324, 325, 326, 327, 328, 329, 0, + 331, 332, 333, 334, 335, 0, 336, 337, 0, 339, + 0, 340, 341, 342, 343, 344, 345, 0, 346, 347, + 0, 0, 348, 349, 350, 0, 0, 351, 352, 353, + 0, 355, 0, 357, 358, 359, 360, 361, 362, 363, + 364, 365, 366, 367, 368, 369, 0, 0, 0, 0, + 370, 371, 372, 0, 374, 375, 376, 377, 378, 379, + 0, 380, 381, 382, 383, 384, 385, 0, 386, 387, + 388, 389, 390, 391, 392, 393, 394, 395, 0, 396, + 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, + 407, 408, 0, 409, 410, 0, 412, 413, 414, 415, + 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, + 426, 427, 428, 0, 0, 429, 430, 431, 432, 433, + 434, 435, 436, 437, 0, 0, 439, 440, 441, 442, + 0, 443, 444, 445, 446, 447, 448, 449, 450, 451, + 452, 453, 454, 455, 456, 542, 458, 459, 0, 0, + 460, 461, 0, 462, 0, 464, 465, 466, 467, 468, + 469, 0, 470, 471, 472, 0, 0, 473, 474, 475, + 476, 477, 0, 478, 479, 480, 481, 482, 483, 484, + 485, 0, 0, 486, 487, 488, 0, 0, 489, 490, + 491, 492, 0, 493, 494, 495, 496, 497, 498, 499, + 500, 0, 501, 0, 503, 504, 505, 506, 507, 508, + 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, + 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, + 525, 526, 527, 528, 529, 530, 531, 539, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, + 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, + 0, 0, 0, 0, 0, 1735, 0, 0, 134, 135, + 0, 0, 137, 138, 0, 140, 141, 142, 143, 144, + 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, + 0, 0, 153, 154, 155, 156, 157, 158, 159, 0, + 160, 161, 162, 163, 164, 0, 0, 0, 166, 167, + 168, 169, 170, 171, 0, 173, 174, 175, 0, 176, + 177, 178, 179, 180, 181, 0, 0, 183, 184, 185, + 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, + 196, 197, 0, 198, 0, 199, 200, 201, 202, 203, + 204, 0, 0, 205, 206, 207, 208, 0, 0, 209, + 210, 211, 212, 213, 0, 214, 215, 216, 0, 217, + 218, 219, 220, 0, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 0, 233, 0, 234, + 235, 236, 237, 0, 238, 0, 239, 0, 0, 0, + 242, 243, 540, 0, 246, 247, 248, 0, 249, 250, + 251, 252, 0, 253, 254, 255, 256, 257, 258, 259, + 0, 261, 262, 263, 264, 0, 265, 266, 267, 268, + 269, 270, 271, 0, 272, 0, 274, 275, 276, 277, + 278, 279, 280, 281, 0, 282, 0, 283, 0, 0, + 286, 0, 288, 289, 290, 0, 291, 292, 293, 0, + 0, 294, 0, 296, 0, 0, 298, 299, 300, 301, + 302, 303, 304, 305, 541, 307, 308, 309, 310, 311, + 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, + 322, 323, 324, 325, 326, 327, 328, 329, 0, 331, + 332, 333, 334, 335, 0, 336, 337, 0, 339, 0, + 340, 341, 342, 343, 344, 345, 0, 346, 347, 0, + 0, 348, 349, 350, 0, 0, 351, 352, 353, 0, + 355, 0, 357, 358, 359, 360, 361, 362, 363, 364, + 365, 366, 367, 368, 369, 0, 0, 0, 0, 370, + 371, 372, 0, 374, 375, 376, 377, 378, 379, 0, + 380, 381, 382, 383, 384, 385, 0, 386, 387, 388, + 389, 390, 391, 392, 393, 394, 395, 0, 396, 397, + 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, + 408, 0, 409, 410, 0, 412, 413, 414, 415, 416, + 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, + 427, 428, 0, 0, 429, 430, 431, 432, 433, 0, + 435, 436, 437, 0, 0, 439, 440, 441, 442, 0, + 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, + 453, 454, 455, 456, 542, 458, 459, 0, 0, 460, + 461, 0, 462, 0, 464, 465, 466, 467, 468, 469, + 0, 470, 471, 472, 0, 0, 473, 474, 475, 476, + 477, 0, 478, 479, 480, 481, 482, 483, 484, 485, + 0, 0, 486, 487, 488, 0, 0, 489, 490, 491, + 492, 0, 493, 494, 495, 496, 497, 498, 499, 500, + 0, 501, 0, 503, 504, 505, 506, 507, 508, 509, + 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, + 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, + 526, 527, 528, 529, 530, 531, 539, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, + 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 134, 135, 0, + 0, 137, 138, 0, 140, 141, 142, 143, 144, 0, + 146, 147, 0, 0, 148, 149, 150, 151, 152, 0, + 0, 153, 154, 155, 156, 157, 158, 159, 0, 160, + 161, 162, 163, 164, 0, 0, 0, 166, 167, 168, + 169, 170, 171, 0, 173, 174, 175, 0, 176, 177, + 178, 179, 180, 181, 0, 0, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 0, 198, 0, 199, 200, 201, 202, 203, 204, + 0, 0, 205, 206, 207, 208, 0, 0, 209, 210, + 211, 212, 213, 0, 214, 215, 216, 0, 217, 218, + 219, 220, 0, 221, 222, 223, 224, 225, 226, 227, + 228, 229, 230, 231, 232, 0, 233, 0, 234, 235, + 236, 237, 0, 238, 0, 239, 0, 0, 0, 242, + 243, 540, 0, 246, 247, 248, 0, 249, 250, 251, + 252, 0, 253, 254, 255, 256, 257, 1937, 259, 0, + 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, + 270, 271, 0, 272, 0, 274, 275, 276, 277, 278, + 279, 280, 281, 0, 282, 0, 283, 0, 0, 286, + 0, 288, 289, 290, 0, 291, 292, 293, 0, 0, + 294, 0, 296, 0, 0, 298, 299, 300, 301, 302, + 303, 304, 305, 541, 307, 308, 309, 310, 311, 312, + 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, + 323, 324, 325, 326, 327, 328, 329, 0, 331, 332, + 333, 334, 335, 0, 336, 337, 0, 339, 0, 340, + 341, 342, 343, 344, 345, 0, 346, 347, 0, 0, + 348, 349, 350, 0, 0, 351, 352, 353, 0, 355, + 0, 357, 358, 359, 360, 361, 362, 363, 364, 365, + 366, 367, 368, 369, 0, 0, 0, 0, 370, 371, + 372, 0, 374, 375, 376, 377, 378, 379, 0, 380, + 381, 382, 383, 384, 385, 0, 386, 387, 388, 389, + 390, 391, 392, 393, 394, 395, 0, 396, 397, 398, + 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, + 0, 409, 410, 0, 412, 413, 414, 415, 416, 417, + 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, + 428, 0, 0, 429, 430, 431, 432, 433, 434, 435, + 436, 437, 0, 0, 439, 440, 441, 442, 0, 443, + 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, + 454, 455, 456, 542, 458, 459, 0, 0, 460, 461, + 0, 462, 0, 464, 465, 466, 467, 468, 469, 0, + 470, 471, 472, 0, 0, 473, 474, 475, 476, 477, + 0, 478, 479, 480, 481, 482, 483, 484, 485, 0, + 0, 486, 487, 488, 0, 0, 489, 490, 491, 492, + 0, 493, 494, 495, 496, 497, 498, 499, 500, 0, + 501, 0, 503, 504, 505, 506, 507, 508, 509, 0, + 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, + 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, + 527, 528, 529, 530, 531, 539, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, + 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 134, 135, 0, 0, + 137, 138, 0, 140, 141, 142, 143, 144, 0, 146, + 147, 0, 0, 148, 149, 150, 151, 152, 0, 0, + 153, 154, 155, 156, 157, 158, 159, 0, 160, 161, + 162, 163, 164, 0, 0, 0, 166, 167, 168, 169, + 170, 171, 0, 173, 174, 175, 0, 176, 177, 178, + 179, 180, 181, 0, 0, 183, 184, 185, 186, 187, + 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, + 0, 198, 0, 199, 200, 201, 202, 203, 204, 0, + 0, 205, 206, 207, 208, 0, 0, 209, 210, 211, + 212, 213, 0, 214, 215, 216, 0, 217, 218, 219, + 220, 0, 221, 222, 223, 224, 225, 226, 227, 228, + 229, 230, 231, 232, 0, 233, 0, 234, 235, 236, + 237, 0, 238, 0, 239, 0, 0, 0, 242, 243, + 540, 0, 246, 247, 248, 0, 249, 250, 251, 252, + 0, 253, 254, 255, 256, 257, 2327, 259, 0, 261, + 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, + 271, 0, 272, 0, 274, 275, 276, 277, 278, 279, + 280, 281, 0, 282, 0, 283, 0, 0, 286, 0, + 288, 289, 290, 0, 291, 292, 293, 0, 0, 294, + 0, 296, 0, 0, 298, 299, 300, 301, 302, 303, + 304, 305, 541, 307, 308, 309, 310, 311, 312, 313, + 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, + 324, 325, 326, 327, 328, 329, 0, 331, 332, 333, + 334, 335, 0, 336, 337, 0, 339, 0, 340, 341, + 342, 343, 344, 345, 0, 346, 347, 0, 0, 348, + 349, 350, 0, 0, 351, 352, 353, 0, 355, 0, + 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, + 367, 368, 369, 0, 0, 0, 0, 370, 371, 372, + 0, 374, 375, 376, 377, 378, 379, 0, 380, 381, + 382, 383, 384, 385, 0, 386, 387, 388, 389, 390, + 391, 392, 393, 394, 395, 0, 396, 397, 398, 399, + 400, 401, 402, 403, 404, 405, 406, 407, 408, 0, + 409, 410, 0, 412, 413, 414, 415, 416, 417, 418, + 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, + 0, 0, 429, 430, 431, 432, 433, 434, 435, 436, + 437, 0, 0, 439, 440, 441, 442, 0, 443, 444, + 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, + 455, 456, 542, 458, 459, 0, 0, 460, 461, 0, + 462, 0, 464, 465, 466, 467, 468, 469, 0, 470, + 471, 472, 0, 0, 473, 474, 475, 476, 477, 0, + 478, 479, 480, 481, 482, 483, 484, 485, 0, 0, + 486, 487, 488, 0, 0, 489, 490, 491, 492, 0, + 493, 494, 495, 496, 497, 498, 499, 500, 0, 501, + 0, 503, 504, 505, 506, 507, 508, 509, 0, 0, + 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, + 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, + 528, 529, 530, 531, 539, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, + 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 134, 135, 0, 0, 137, + 138, 0, 140, 141, 142, 143, 144, 0, 146, 147, + 0, 0, 148, 149, 150, 151, 152, 0, 0, 153, + 154, 155, 156, 157, 158, 159, 0, 160, 161, 162, + 163, 164, 0, 0, 0, 166, 167, 168, 169, 170, + 171, 0, 173, 174, 175, 0, 176, 177, 178, 179, + 180, 181, 0, 0, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 196, 197, 0, + 198, 0, 199, 200, 201, 202, 203, 204, 0, 0, + 205, 206, 207, 208, 0, 0, 209, 210, 211, 212, + 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, + 0, 221, 222, 223, 224, 225, 226, 227, 228, 229, + 230, 231, 232, 0, 233, 0, 234, 235, 236, 237, + 0, 238, 0, 239, 0, 0, 0, 242, 243, 540, + 0, 246, 247, 248, 0, 249, 250, 251, 252, 0, + 253, 254, 255, 256, 257, 2347, 259, 0, 261, 262, + 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, + 0, 272, 0, 274, 275, 276, 277, 278, 279, 280, + 281, 0, 282, 0, 283, 0, 0, 286, 0, 288, + 289, 290, 0, 291, 292, 293, 0, 0, 294, 0, + 296, 0, 0, 298, 299, 300, 301, 302, 303, 304, + 305, 541, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 328, 329, 0, 331, 332, 333, 334, + 335, 0, 336, 337, 0, 339, 0, 340, 341, 342, + 343, 344, 345, 0, 346, 347, 0, 0, 348, 349, + 350, 0, 0, 351, 352, 353, 0, 355, 0, 357, + 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, + 368, 369, 0, 0, 0, 0, 370, 371, 372, 0, + 374, 375, 376, 377, 378, 379, 0, 380, 381, 382, + 383, 384, 385, 0, 386, 387, 388, 389, 390, 391, + 392, 393, 394, 395, 0, 396, 397, 398, 399, 400, + 401, 402, 403, 404, 405, 406, 407, 408, 0, 409, + 410, 0, 412, 413, 414, 415, 416, 417, 418, 419, + 420, 421, 422, 423, 424, 425, 426, 427, 428, 0, + 0, 429, 430, 431, 432, 433, 434, 435, 436, 437, + 0, 0, 439, 440, 441, 442, 0, 443, 444, 445, + 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, + 456, 542, 458, 459, 0, 0, 460, 461, 0, 462, + 0, 464, 465, 466, 467, 468, 469, 0, 470, 471, + 472, 0, 0, 473, 474, 475, 476, 477, 0, 478, + 479, 480, 481, 482, 483, 484, 485, 0, 0, 486, + 487, 488, 0, 0, 489, 490, 491, 492, 0, 493, + 494, 495, 496, 497, 498, 499, 500, 0, 501, 0, + 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, + 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, + 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, + 529, 530, 531, 3620, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, + 129, 0, 130, 131, 132, 0, 0, 0, 3473, 0, + 0, 0, 0, 3474, 134, 135, 0, 3475, 137, 138, + 3476, 140, 141, 142, 0, 1539, 3477, 1541, 1542, 0, + 3478, 148, 149, 150, 151, 152, 0, 0, 153, 154, + 155, 156, 1544, 1545, 159, 0, 160, 161, 162, 163, + 0, 0, 3479, 0, 3480, 167, 168, 169, 170, 171, + 3481, 173, 174, 175, 0, 176, 177, 178, 179, 180, + 181, 0, 3482, 183, 184, 185, 186, 187, 188, 189, + 190, 191, 192, 1550, 194, 195, 1551, 197, 0, 198, + 0, 199, 200, 201, 202, 203, 204, 0, 0, 205, + 206, 207, 208, 0, 0, 209, 210, 1093, 212, 213, + 0, 214, 215, 216, 0, 217, 218, 219, 220, 0, + 221, 222, 223, 224, 0, 226, 227, 228, 229, 230, + 231, 0, 0, 233, 0, 234, 235, 1552, 237, 0, + 238, 0, 239, 3483, 0, 3484, 242, 243, 2473, 3485, + 246, 247, 248, 0, 0, 0, 251, 252, 0, 253, + 254, 255, 256, 257, 258, 259, 3486, 261, 262, 263, + 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, + 272, 3487, 0, 275, 276, 277, 278, 279, 1558, 1559, + 0, 1560, 0, 283, 3488, 3489, 286, 3490, 288, 289, + 290, 0, 291, 292, 293, 0, 0, 294, 3491, 296, + 3492, 0, 298, 299, 300, 301, 302, 303, 304, 305, + 2482, 307, 308, 309, 310, 311, 312, 313, 314, 315, + 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, + 326, 327, 328, 1567, 3494, 1569, 332, 333, 334, 0, + 0, 336, 337, 3496, 339, 0, 0, 341, 1571, 343, + 344, 345, 0, 346, 347, 0, 0, 348, 349, 350, + 0, 0, 351, 352, 0, 3498, 355, 3499, 0, 358, + 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, + 369, 0, 0, 0, 0, 370, 371, 0, 3500, 374, + 375, 0, 377, 378, 379, 0, 380, 381, 382, 383, + 384, 385, 0, 386, 387, 388, 389, 390, 1575, 392, + 393, 394, 395, 0, 396, 397, 398, 399, 400, 401, + 402, 403, 404, 405, 406, 407, 408, 0, 409, 410, + 3501, 412, 413, 414, 0, 416, 417, 418, 419, 420, + 421, 422, 423, 424, 425, 426, 427, 428, 0, 3502, + 429, 430, 431, 432, 433, 434, 0, 436, 437, 0, + 3504, 439, 440, 1581, 442, 0, 443, 444, 445, 446, + 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, + 2490, 458, 0, 0, 0, 460, 461, 0, 462, 3506, + 464, 465, 466, 467, 468, 469, 0, 470, 1584, 1585, + 0, 0, 473, 474, 0, 476, 0, 0, 478, 479, + 3507, 481, 482, 483, 484, 485, 0, 0, 486, 487, + 488, 3509, 0, 489, 490, 491, 492, 0, 493, 494, + 495, 496, 497, 0, 1589, 500, 0, 501, 3510, 503, + 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, + 0, 511, 512, 513, 514, 515, 516, 1844, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 528, 529, + 530, 531, 0, 0, 0, 0, 0, 122, 123, 124, + 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, + 0, 0, 1535, 0, 0, 0, 0, 1536, 134, 135, + 0, 1537, 137, 138, 1538, 140, 141, 142, 0, 1539, + 1540, 1541, 1542, 0, 1543, 148, 149, 150, 151, 152, + 0, 0, 153, 154, 155, 156, 1544, 1545, 159, 0, + 160, 161, 162, 163, 0, 0, 1546, 0, 1547, 167, + 168, 169, 170, 171, 1548, 173, 174, 175, 0, 176, + 177, 178, 179, 180, 181, 0, 1549, 183, 184, 185, + 186, 187, 188, 189, 190, 191, 192, 1550, 194, 195, + 1551, 197, 0, 198, 0, 199, 200, 201, 202, 203, + 204, 0, 0, 205, 206, 207, 208, 0, 0, 209, + 210, 1093, 212, 213, 0, 214, 215, 216, 0, 217, + 218, 219, 220, 0, 221, 222, 223, 224, 0, 226, + 227, 228, 229, 230, 231, 0, 0, 233, 0, 234, + 235, 1552, 237, 0, 238, 0, 239, 1553, 0, 1554, + 242, 243, 0, 1555, 246, 247, 248, 0, 0, 0, + 251, 252, 0, 253, 254, 255, 256, 257, 258, 259, + 1556, 261, 262, 263, 264, 0, 265, 266, 267, 268, + 269, 270, 271, 0, 272, 1557, 0, 275, 276, 277, + 278, 279, 1558, 1559, 0, 1560, 0, 283, 1561, 1562, + 286, 1563, 288, 289, 290, 0, 291, 292, 293, 0, + 0, 294, 1564, 296, 1565, 0, 298, 299, 300, 301, + 302, 303, 304, 305, 0, 307, 308, 309, 310, 311, + 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, + 322, 323, 324, 325, 326, 327, 328, 1567, 1568, 1569, + 332, 333, 334, 0, 0, 336, 337, 1570, 339, 0, + 0, 341, 1571, 343, 344, 345, 0, 346, 347, 0, + 0, 348, 349, 350, 0, 0, 351, 352, 0, 1572, + 355, 1573, 0, 358, 359, 360, 361, 362, 363, 364, + 365, 366, 367, 368, 369, 0, 0, 0, 0, 370, + 371, 0, 1574, 374, 375, 0, 377, 378, 379, 0, + 380, 381, 382, 383, 384, 385, 0, 386, 387, 388, + 389, 390, 1575, 392, 393, 394, 395, 0, 396, 397, + 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, + 408, 0, 409, 410, 1576, 412, 413, 414, 0, 416, + 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, + 427, 428, 0, 1578, 429, 430, 431, 432, 433, 434, + 0, 436, 437, 0, 1580, 439, 440, 1581, 442, 0, + 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, + 453, 454, 455, 456, 0, 458, 0, 0, 0, 460, + 461, 0, 462, 1583, 464, 465, 466, 467, 468, 469, + 0, 470, 1584, 1585, 0, 0, 473, 474, 0, 476, + 0, 0, 478, 479, 1586, 481, 482, 483, 484, 485, + 0, 0, 486, 487, 488, 1588, 0, 489, 490, 491, + 492, 0, 493, 494, 495, 496, 497, 0, 1589, 500, + 0, 501, 1590, 503, 504, 505, 506, 507, 508, 509, + 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, + 516, 539, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 528, 529, 530, 531, 0, 0, 0, 0, + 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, + 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 134, 135, 0, 0, 137, 138, 0, 140, + 141, 142, 143, 144, 0, 146, 147, 0, 0, 148, + 149, 150, 151, 152, 0, 0, 153, 154, 155, 156, + 157, 158, 159, 0, 160, 161, 162, 163, 164, 0, + 0, 0, 166, 167, 168, 169, 170, 171, 0, 173, + 174, 175, 0, 176, 177, 178, 179, 180, 181, 0, + 0, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 0, 198, 0, 199, + 200, 201, 202, 203, 204, 0, 0, 205, 206, 207, + 208, 0, 0, 209, 210, 211, 212, 213, 0, 214, + 215, 216, 0, 217, 218, 219, 220, 0, 221, 222, + 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, + 0, 233, 0, 234, 235, 236, 237, 0, 238, 0, + 239, 0, 0, 0, 242, 243, 540, 0, 246, 247, + 248, 0, 249, 250, 0, 252, 0, 253, 254, 255, + 256, 257, 258, 259, 0, 261, 262, 263, 264, 0, + 265, 266, 267, 268, 269, 270, 271, 0, 272, 0, + 274, 275, 276, 277, 278, 279, 280, 281, 0, 282, + 0, 283, 0, 0, 286, 0, 288, 289, 290, 0, + 291, 292, 293, 0, 0, 294, 0, 296, 0, 0, + 298, 299, 300, 301, 302, 303, 304, 305, 541, 307, + 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, + 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, + 328, 329, 0, 331, 332, 333, 334, 335, 0, 336, + 337, 0, 339, 0, 340, 341, 342, 343, 344, 345, + 0, 346, 347, 0, 0, 348, 349, 350, 0, 0, + 351, 352, 353, 0, 355, 0, 357, 358, 359, 360, + 361, 362, 363, 0, 365, 366, 367, 368, 369, 0, + 0, 0, 0, 370, 371, 372, 0, 374, 375, 376, + 377, 378, 379, 0, 380, 381, 382, 383, 384, 385, + 0, 386, 387, 388, 0, 390, 391, 392, 393, 394, + 395, 0, 396, 397, 398, 399, 400, 401, 402, 403, + 404, 405, 406, 407, 408, 0, 409, 410, 0, 412, + 413, 414, 415, 0, 417, 418, 419, 420, 421, 422, + 423, 424, 425, 426, 427, 428, 0, 0, 429, 430, + 431, 432, 433, 434, 435, 436, 437, 0, 0, 439, + 440, 441, 442, 0, 443, 444, 445, 446, 447, 448, + 449, 450, 451, 452, 453, 454, 455, 456, 542, 458, + 459, 0, 0, 460, 461, 0, 462, 0, 464, 465, + 466, 467, 468, 469, 0, 470, 471, 472, 0, 0, + 473, 474, 475, 476, 477, 0, 478, 479, 480, 481, + 482, 483, 484, 485, 0, 0, 486, 487, 488, 0, + 0, 489, 490, 491, 492, 0, 493, 494, 495, 496, + 497, 498, 499, 500, 0, 501, 0, 503, 504, 505, + 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, + 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, + 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 764, 0, 3, 4, 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 764, 0, + 6, 0, 0, 0, 0, 0, 0, 0, 0, 7, + 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, + 0, 0, 0, 8, 0, 0, 0, 7, 0, 0, + 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, + 0, 8, 0, 0, 0, 0, 11, 0, 765, 0, + 0, 0, 10, 0, 0, 0, 0, 0, 0, 13, + 0, 0, 0, 0, 11, 0, 765, 0, 0, 0, + 0, 0, 0, 0, 14, 15, 0, 13, 0, 0, + 0, 0, 0, 0, 0, 766, 0, 0, 0, 0, + 0, 18, 14, 15, 0, 0, 0, 0, 0, 0, + 19, 0, 0, 766, 0, 0, 0, 0, 0, 18, + 0, 0, 0, 0, 0, 0, 0, 22, 19, 0, + 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 22, 0, 0, 0, 23, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, -1529, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, -1529, 0, 0, 0, 0, 0, 0, 0, 0, + 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 25, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 26, 27, + 28, 0, 0, 0, 0, 0, 29, 0, 0, 30, + 0, 0, 0, 0, 0, 0, 26, 27, 28, 0, + 0, 0, 0, 0, 29, 0, 0, 30, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 31, 0, 0, 0, 0, 0, 0, 0, 0, 32, + 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, + 0, 0, 0, 0, 0, 33, 0, 32, 0, 0, + 0, 0, 34, 0, 0, 0, 35, 0, 0, 0, + 0, 0, 0, 33, 0, 0, 0, 0, 36, 0, + 34, 0, 0, 0, 35, 0, 0, 0, 0, 0, + 37, 0, 0, 0, 38, 0, 36, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 37, 0, + 0, 0, 38, 0, 0, 39, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, + 0, 0, 0, 39, 0, 42, 0, 0, 0, 0, + 43, 0, 0, 0, 0, 767, 0, 40, 0, 0, + 0, 0, 0, 42, 0, 0, 0, 44, 43, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 44, 0, 0, 0, 0, + 0, 45, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 768, 0, 0, 0, 45, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 46 +}; + +static const yytype_int16 yycheck[] = +{ + 7, 922, 532, 856, 904, 46, 0, 0, 0, 16, + 0, 1019, 950, 0, 0, 830, 23, 880, 0, 0, + 0, 16, 759, 0, 0, 1270, 38, 1474, 1256, 1197, + 1065, 985, 934, 1268, 7, 955, 25, 1720, 1010, 20, + 20, 1490, 1010, 989, 2246, 37, 2248, 2277, 20, 1636, + 23, 1010, 1114, 1527, 1010, 79, 1962, 1759, 1609, 1017, + 79, 1649, 760, 1594, 1692, 1885, 1245, 7, 2082, 1877, + 77, 78, 1328, 75, 1813, 1000, 1233, 2267, 1248, 1673, + 1674, 17, 0, 23, 922, 1162, 924, 0, 926, 1000, + 1167, 0, 2832, 2266, 1273, 1677, 0, 2418, 1377, 2343, + 0, 2212, 114, 45, 77, 78, 0, 2859, 23, 0, + 825, 103, 2334, 768, 1828, 1123, 831, 0, 2835, 767, + 2498, 2055, 2056, 2654, 1724, 2741, 1028, 0, 0, 2745, + 119, 1902, 2066, 1898, 0, 34, 2070, 77, 78, 1087, + 1088, 1872, 2017, 0, 1899, 1008, 1777, 9, 0, 1692, + 0, 0, 1866, 41, 56, 3151, 64, 1105, 2045, 2046, + 2047, 1779, 77, 78, 60, 0, 64, 0, 9, 81, + 0, 5, 0, 5, 0, 19, 5, 9, 0, 0, + 0, 0, 0, 0, 175, 0, 2431, 2971, 13, 14, + 2431, 5, 3, 2426, 5, 5, 1011, 5, 2424, 10, + 75, 5, 5, 13, 14, 13, 14, 5, 2393, 13, + 14, 5, 4, 77, 78, 5, 2438, 9, 10, 13, + 14, 3135, 118, 13, 14, 5, 123, 174, 5, 9, + 5, 1142, 5, 5, 5, 5, 19, 1819, 19, 5, + 5, 3155, 31, 793, 201, 5, 127, 128, 1173, 125, + 39, 46, 13, 14, 928, 2598, 23, 1292, 11, 1122, + 46, 19, 1173, 16, 3, 4, 5, 123, 1303, 1207, + 9, 875, 174, 4, 3335, 5, 193, 1179, 9, 205, + 31, 120, 101, 101, 4, 11, 64, 3031, 39, 9, + 16, 301, 822, 174, 47, 3370, 171, 1012, 295, 3335, + 140, 3132, 2524, 2525, 109, 2527, 3078, 2834, 293, 1024, + 77, 78, 296, 1091, 123, 3, 123, 316, 215, 120, + 820, 1489, 11, 183, 3353, 134, 15, 16, 81, 11, + 1108, 138, 1257, 15, 16, 1260, 1261, 146, 301, 869, + 133, 168, 3530, 1925, 118, 1000, 1257, 35, 36, 1260, + 1261, 1579, 195, 195, 31, 1003, 3646, 319, 47, 1527, + 388, 374, 39, 175, 91, 296, 11, 123, 5, 1232, + 15, 16, 42, 3564, 2576, 1228, 1229, 105, 65, 118, + 11, 166, 11, 83, 15, 16, 108, 186, 75, 194, + 295, 281, 81, 1034, 94, 108, 2758, 1979, 1039, 11, + 1041, 60, 47, 130, 1102, 121, 215, 406, 3148, 1991, + 31, 118, 166, 375, 164, 3757, 1987, 84, 47, 1060, + 83, 899, 41, 284, 3006, 1363, 3008, 2235, 174, 3146, + 3435, 94, 3437, 1333, 72, 73, 81, 490, 439, 2021, + 321, 322, 323, 3631, 899, 3162, 2028, 2018, 3636, 365, + 3364, 3597, 81, 379, 3263, 183, 3265, 127, 366, 215, + 335, 514, 517, 3753, 390, 86, 4, 3503, 366, 81, + 109, 9, 1392, 528, 95, 3817, 295, 295, 479, 395, + 234, 197, 221, 150, 285, 173, 193, 175, 1399, 1400, + 2072, 241, 277, 440, 2076, 300, 133, 290, 119, 2729, + 256, 427, 314, 330, 532, 244, 3535, 388, 1466, 1467, + 174, 285, 3703, 2757, 1472, 528, 0, 2879, 399, 361, + 108, 364, 532, 1585, 2106, 162, 3298, 334, 3359, 528, + 2641, 528, 2754, 3529, 2756, 3279, 20, 528, 1038, 23, + 3284, 402, 423, 528, 528, 3317, 427, 346, 367, 367, + 278, 3626, 2083, 37, 480, 285, 3702, 244, 550, 178, + 3748, 523, 46, 3568, 495, 278, 76, 464, 64, 532, + 517, 2159, 193, 280, 464, 532, 375, 473, 2398, 2399, + 2400, 462, 457, 530, 2927, 206, 313, 3396, 366, 401, + 2218, 467, 473, 77, 78, 79, 1544, 1545, 605, 1203, + 1130, 2075, 1206, 414, 415, 3187, 1280, 467, 464, 490, + 605, 528, 3673, 2846, 526, 2841, 405, 1480, 530, 103, + 3695, 1569, 2807, 2868, 532, 2212, 528, 2868, 1884, 424, + 469, 3158, 528, 514, 532, 3419, 3632, 3673, 424, 1376, + 1190, 1494, 530, 280, 1381, 13, 486, 528, 285, 109, + 1387, 19, 2283, 290, 405, 464, 2250, 519, 520, 2534, + 2594, 2392, 30, 1516, 2886, 2679, 2284, 2432, 1947, 2440, + 2270, 490, 490, 3289, 1919, 2218, 44, 45, 3294, 531, + 2435, 531, 532, 1631, 1632, 1383, 527, 1722, 532, 2276, + 2577, 2578, 2579, 2580, 528, 528, 528, 526, 531, 528, + 3231, 530, 536, 528, 477, 427, 433, 41, 464, 437, + 529, 529, 531, 531, 528, 492, 1627, 528, 528, 3633, + 528, 3099, 533, 534, 528, 528, 536, 768, 405, 1640, + 528, 1642, 492, 479, 528, 3056, 395, 514, 528, 1394, + 440, 533, 534, 526, 112, 1393, 527, 530, 528, 1612, + 1613, 528, 1230, 528, 514, 528, 528, 528, 528, 1622, + 1671, 768, 528, 528, 1666, 1667, 1668, 528, 528, 527, + 490, 524, 1487, 1551, 1637, 1230, 440, 440, 427, 820, + 519, 520, 278, 2717, 3536, 407, 767, 767, 519, 520, + 478, 379, 413, 1571, 514, 416, 768, 149, 524, 519, + 520, 133, 809, 150, 397, 3049, 1669, 417, 121, 431, + 447, 3528, 164, 820, 803, 827, 31, 169, 164, 5, + 827, 458, 528, 169, 2080, 351, 107, 426, 1606, 60, + 519, 520, 521, 522, 523, 524, 809, 519, 520, 521, + 522, 523, 524, 2700, 178, 2702, 835, 820, 872, 856, + 857, 531, 280, 872, 827, 202, 3029, 285, 467, 109, + 2442, 1502, 2030, 875, 390, 1776, 1777, 466, 220, 809, + 366, 860, 482, 880, 149, 271, 521, 522, 523, 524, + 820, 2701, 894, 1524, 197, 0, 2900, 827, 3628, 241, + 521, 522, 523, 524, 809, 241, 890, 890, 890, 395, + 890, 427, 904, 890, 890, 820, 878, 2075, 890, 890, + 890, 3133, 827, 890, 890, 467, 2498, 345, 133, 528, + 909, 532, 1843, 1848, 3035, 932, 933, 3644, 180, 936, + 937, 327, 151, 1858, 936, 528, 1861, 1848, 253, 881, + 292, 127, 128, 174, 492, 220, 292, 1858, 280, 301, + 1861, 478, 1689, 3693, 480, 205, 820, 2236, 290, 858, + 859, 216, 861, 2040, 863, 280, 514, 2416, 13, 14, + 2598, 2985, 890, 1811, 255, 31, 528, 890, 1878, 1879, + 1880, 890, 989, 1929, 203, 266, 890, 1907, 174, 120, + 890, 1945, 244, 1000, 27, 1949, 890, 1038, 1952, 890, + 1007, 1008, 2810, 2811, 280, 1843, 1013, 890, 1954, 1016, + 1017, 1000, 1019, 1020, 1021, 1022, 2755, 890, 890, 955, + 3768, 1010, 1003, 1003, 890, 1863, 301, 38, 3776, 1036, + 1868, 1038, 2614, 890, 1992, 1993, 1994, 1995, 1996, 1997, + 1047, 890, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, + 2008, 2009, 2909, 820, 2641, 890, 3300, 1064, 1065, 1066, + 890, 2340, 890, 1036, 890, 1038, 550, 2781, 890, 890, + 890, 3788, 2666, 890, 1047, 890, 254, 133, 209, 1086, + 351, 361, 1123, 3519, 229, 3275, 38, 2801, 75, 164, + 321, 322, 323, 442, 169, 2252, 1036, 2254, 1038, 1106, + 529, 38, 280, 532, 456, 138, 43, 1047, 27, 2556, + 133, 1118, 1119, 1120, 33, 1122, 1123, 1854, 1125, 390, + 34, 1036, 1859, 1038, 169, 1655, 2575, 2372, 164, 379, + 1125, 118, 1047, 278, 809, 321, 322, 323, 2306, 162, + 390, 3590, 3591, 1132, 493, 517, 60, 278, 2404, 280, + 83, 1158, 827, 1142, 27, 229, 427, 388, 530, 1613, + 33, 5, 83, 2026, 175, 102, 241, 3181, 1622, 1176, + 1177, 347, 1036, 94, 1038, 1164, 109, 427, 316, 2090, + 432, 456, 434, 1047, 1173, 3621, 528, 1211, 1212, 2997, + 1214, 1203, 1211, 1212, 1206, 1214, 427, 54, 566, 3648, + 211, 2380, 388, 6, 278, 241, 1213, 10, 460, 480, + 1217, 1218, 3456, 399, 528, 18, 227, 292, 492, 138, + 1227, 1228, 1229, 175, 3130, 1232, 109, 238, 492, 32, + 480, 462, 361, 36, 2242, 2193, 2194, 423, 175, 27, + 514, 427, 473, 176, 523, 33, 183, 264, 265, 1256, + 514, 530, 2834, 398, 528, 2118, 292, 280, 4, 211, + 1272, 386, 285, 9, 528, 138, 299, 290, 406, 1036, + 3083, 1038, 205, 347, 211, 227, 462, 4, 3091, 2449, + 1047, 248, 9, 767, 768, 1292, 238, 473, 27, 2459, + 227, 83, 1281, 280, 33, 386, 1303, 528, 285, 2927, + 205, 238, 94, 1970, 490, 3125, 523, 1974, 1043, 529, + 1977, 3050, 532, 530, 1049, 1479, 249, 1481, 1482, 464, + 529, 1328, 179, 532, 398, 809, 858, 859, 514, 861, + 363, 863, 365, 13, 14, 2198, 820, 274, 2249, 196, + 257, 526, 528, 827, 201, 530, 248, 2247, 335, 316, + 138, 526, 490, 528, 492, 530, 1350, 445, 295, 370, + 1350, 1368, 395, 1350, 1350, 526, 353, 384, 385, 530, + 1377, 2282, 2283, 1368, 432, 2963, 434, 526, 389, 2828, + 299, 530, 1048, 240, 321, 427, 1052, 1394, 872, 383, + 464, 328, 2346, 761, 2348, 529, 133, 529, 532, 138, + 532, 432, 480, 434, 1411, 2936, 890, 386, 2939, 1416, + 2941, 528, 1393, 1393, 316, 528, 1411, 529, 370, 528, + 532, 1410, 1394, 528, 447, 162, 299, 529, 2596, 2903, + 532, 529, 2600, 370, 532, 458, 526, 389, 528, 406, + 359, 191, 192, 169, 363, 27, 379, 529, 3035, 528, + 532, 33, 389, 529, 13, 14, 532, 390, 2311, 1466, + 1467, 490, 528, 492, 3015, 1472, 2164, 1474, 529, 528, + 457, 532, 1479, 1480, 1481, 1482, 395, 379, 529, 529, + 467, 532, 532, 432, 174, 434, 359, 1494, 1495, 432, + 363, 434, 2430, 460, 427, 529, 528, 1504, 532, 1506, + 27, 1474, 1509, 528, 406, 3707, 33, 1514, 528, 1516, + 1517, 299, 1519, 881, 264, 265, 1523, 3099, 451, 1003, + 3722, 2349, 395, 2351, 3754, 462, 3756, 528, 2773, 529, + 467, 1504, 532, 1506, 1474, 3779, 1509, 2772, 2754, 529, + 2756, 1514, 532, 400, 1517, 180, 1519, 480, 285, 521, + 1523, 470, 1036, 290, 1038, 896, 138, 898, 460, 1474, + 299, 528, 19, 1047, 1504, 529, 1506, 514, 532, 1509, + 3152, 359, 1579, 528, 1514, 363, 3158, 1517, 529, 1519, + 511, 532, 226, 1523, 2646, 2647, 3816, 13, 14, 1504, + 2825, 1506, 530, 248, 1509, 13, 14, 470, 1082, 1514, + 3802, 2771, 1517, 2773, 1519, 1612, 1613, 395, 1523, 244, + 1094, 138, 295, 3815, 1621, 1622, 1609, 1609, 511, 3525, + 3428, 3429, 529, 1630, 363, 532, 528, 1609, 1609, 1609, + 1637, 173, 1609, 1609, 384, 385, 532, 1644, 27, 1123, + 1504, 528, 1506, 3225, 33, 1509, 2654, 529, 529, 2621, + 1514, 532, 529, 1517, 2622, 1519, 395, 1664, 1665, 1523, + 529, 316, 1669, 2622, 2623, 1672, 2622, 2623, 2624, 174, + 1677, 1678, 1679, 1680, 1681, 1682, 1683, 1684, 1685, 1686, + 13, 14, 470, 1690, 1691, 1692, 529, 529, 1695, 532, + 532, 1686, 1699, 13, 14, 1702, 1703, 1704, 1705, 1706, + 1707, 1708, 1709, 1710, 13, 14, 1713, 2618, 2619, 300, + 447, 248, 41, 1720, 222, 1722, 60, 299, 528, 1692, + 1722, 458, 13, 14, 379, 2683, 2684, 1211, 1212, 428, + 1214, 470, 61, 1740, 13, 14, 174, 1504, 1762, 1506, + 511, 1730, 1509, 1762, 379, 13, 14, 1514, 3335, 138, + 1517, 406, 1519, 3335, 176, 226, 1523, 3440, 1765, 843, + 844, 845, 529, 359, 848, 532, 1738, 154, 529, 1776, + 1777, 532, 299, 2510, 13, 14, 154, 359, 107, 316, + 529, 363, 529, 532, 529, 532, 529, 532, 529, 532, + 359, 532, 154, 529, 154, 529, 532, 432, 532, 434, + 529, 529, 109, 532, 532, 460, 529, 529, 529, 532, + 532, 532, 1819, 395, 529, 1804, 1805, 532, 2720, 154, + 529, 41, 1829, 532, 427, 460, 1833, 249, 1196, 13, + 14, 154, 359, 529, 1829, 528, 363, 280, 1833, 13, + 14, 480, 379, 90, 1833, 13, 14, 13, 14, 154, + 8, 494, 3097, 11, 13, 14, 154, 15, 16, 13, + 14, 530, 20, 21, 22, 176, 154, 1874, 395, 406, + 1877, 154, 180, 528, 295, 204, 361, 1884, 99, 1874, + 1887, 1888, 1871, 440, 248, 13, 14, 528, 470, 529, + 2743, 8, 13, 14, 11, 528, 248, 205, 15, 16, + 1889, 1890, 528, 20, 21, 22, 127, 128, 528, 1393, + 299, 13, 14, 13, 14, 1066, 2816, 47, 1925, 2839, + 37, 222, 1929, 460, 2870, 429, 255, 2865, 2882, 351, + 227, 1923, 2795, 13, 14, 305, 244, 266, 249, 2897, + 1947, 3388, 528, 470, 13, 14, 149, 1954, 1955, 278, + 13, 14, 316, 174, 13, 14, 1963, 13, 14, 374, + 375, 164, 227, 2998, 316, 227, 169, 528, 390, 41, + 359, 302, 1979, 239, 363, 528, 1983, 1984, 5, 1986, + 1969, 310, 374, 375, 1991, 1992, 1993, 1994, 1995, 1996, + 1997, 528, 300, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 3705, 75, 427, 395, 3709, 2015, 2016, + 81, 5, 2019, 528, 2021, 379, 1384, 220, 1386, 2026, + 1504, 2028, 1506, 94, 5, 1509, 2937, 379, 331, 451, + 1514, 374, 375, 1517, 528, 1519, 365, 528, 241, 1523, + 351, 528, 406, 2050, 374, 375, 5, 118, 528, 120, + 2057, 5, 2059, 528, 406, 5, 2063, 9, 480, 268, + 269, 390, 384, 385, 528, 2072, 224, 13, 14, 2076, + 528, 2078, 528, 2080, 491, 2082, 472, 473, 307, 390, + 532, 470, 411, 105, 2057, 532, 3673, 3789, 529, 292, + 2063, 3673, 3728, 3729, 2500, 2501, 460, 222, 301, 2106, + 321, 322, 323, 248, 467, 1256, 395, 224, 460, 3717, + 3718, 2118, 2119, 3071, 3349, 169, 427, 2057, 2125, 3763, + 3764, 1176, 1177, 2063, 432, 1609, 434, 2318, 2319, 292, + 169, 60, 239, 290, 440, 528, 440, 94, 209, 297, + 451, 440, 2057, 60, 532, 60, 3100, 3101, 2063, 457, + 3597, 2158, 460, 440, 440, 2162, 271, 2198, 19, 528, + 2167, 2168, 174, 3088, 528, 440, 224, 388, 440, 480, + 386, 316, 490, 101, 154, 280, 528, 3088, 399, 280, + 297, 201, 3093, 27, 280, 41, 2193, 2194, 3196, 33, + 528, 2198, 280, 2057, 41, 2932, 280, 41, 3645, 2063, + 529, 280, 423, 528, 174, 3654, 427, 2214, 1692, 280, + 2217, 2218, 2219, 154, 285, 530, 13, 61, 174, 529, + 532, 227, 3180, 487, 227, 287, 528, 448, 2235, 2236, + 287, 477, 532, 529, 379, 2242, 529, 529, 2245, 529, + 40, 462, 486, 3411, 153, 2218, 530, 529, 529, 529, + 528, 528, 473, 456, 2261, 3702, 530, 528, 2265, 528, + 9, 406, 438, 107, 335, 174, 438, 528, 2275, 490, + 180, 528, 2245, 528, 528, 3503, 528, 11, 1762, 528, + 361, 532, 353, 19, 527, 2292, 2293, 532, 2261, 180, + 2057, 438, 2265, 514, 138, 205, 2063, 149, 285, 537, + 528, 440, 2309, 183, 2311, 2245, 165, 528, 174, 321, + 322, 323, 164, 532, 205, 460, 529, 169, 229, 2326, + 41, 2261, 220, 526, 467, 2265, 529, 530, 532, 467, + 2245, 271, 3069, 2340, 244, 229, 296, 398, 532, 532, + 319, 319, 2349, 2350, 2351, 183, 2261, 222, 529, 359, + 2265, 528, 229, 244, 2349, 2350, 2351, 515, 516, 517, + 204, 519, 520, 521, 522, 523, 524, 2356, 220, 229, + 530, 60, 280, 60, 60, 60, 388, 301, 529, 340, + 3318, 287, 287, 528, 154, 480, 457, 3, 2395, 241, + 300, 293, 528, 528, 154, 154, 467, 2404, 515, 516, + 517, 2265, 519, 520, 521, 522, 523, 524, 154, 300, + 320, 255, 321, 322, 323, 427, 154, 3328, 3329, 154, + 490, 532, 266, 532, 3335, 280, 41, 2416, 1579, 2423, + 2437, 3676, 295, 2423, 278, 2442, 2423, 2423, 3, 1923, + 292, 295, 2437, 41, 174, 11, 1814, 60, 41, 301, + 462, 118, 169, 529, 529, 299, 529, 1825, 183, 1827, + 528, 473, 1830, 529, 528, 169, 310, 3, 528, 379, + 40, 3, 1840, 526, 1842, 526, 386, 440, 2245, 388, + 529, 527, 440, 530, 529, 440, 529, 1855, 379, 440, + 532, 2498, 1860, 537, 2261, 2502, 1864, 1865, 2265, 1867, + 529, 1869, 1870, 529, 511, 529, 511, 174, 529, 359, + 150, 2518, 3042, 530, 529, 359, 528, 174, 427, 363, + 529, 365, 432, 2518, 434, 511, 1677, 528, 440, 528, + 528, 2520, 41, 2522, 3397, 528, 3399, 2526, 157, 2528, + 3442, 432, 487, 434, 528, 41, 390, 457, 60, 2556, + 460, 395, 61, 462, 1066, 532, 3409, 180, 532, 296, + 513, 464, 60, 296, 473, 247, 457, 411, 517, 460, + 60, 271, 479, 2057, 280, 440, 440, 154, 205, 2063, + 528, 490, 154, 2556, 517, 154, 528, 440, 41, 528, + 0, 2598, 440, 529, 440, 440, 528, 3412, 107, 3414, + 3511, 3512, 528, 41, 456, 514, 361, 2614, 529, 532, + 293, 295, 490, 2654, 2626, 8, 2556, 41, 11, 528, + 154, 244, 15, 16, 2631, 285, 470, 20, 21, 22, + 529, 2638, 2639, 528, 174, 528, 528, 60, 528, 188, + 529, 2556, 309, 529, 529, 14, 529, 2654, 2689, 169, + 81, 144, 3660, 526, 321, 322, 323, 529, 529, 174, + 2667, 1173, 532, 2670, 3602, 2672, 19, 529, 1819, 178, + 306, 529, 2679, 2680, 526, 1066, 2683, 2684, 530, 528, + 254, 2688, 2689, 183, 296, 528, 8, 529, 2695, 3589, + 3611, 101, 2694, 15, 16, 204, 532, 320, 20, 21, + 22, 529, 2743, 528, 367, 2712, 528, 154, 529, 532, + 529, 528, 178, 529, 2198, 529, 2723, 529, 41, 451, + 530, 388, 528, 528, 2716, 528, 87, 41, 41, 3582, + 41, 532, 174, 528, 2218, 529, 2743, 489, 529, 149, + 467, 201, 529, 527, 1256, 527, 255, 532, 529, 529, + 2234, 529, 529, 532, 164, 473, 379, 266, 295, 169, + 427, 2245, 3673, 386, 174, 60, 486, 517, 529, 278, + 207, 3634, 3635, 183, 1925, 529, 529, 2261, 188, 490, + 2787, 2265, 529, 2790, 2791, 2792, 118, 2794, 2795, 2796, + 41, 89, 2787, 229, 194, 462, 285, 2792, 285, 2794, + 528, 310, 517, 2810, 2811, 2794, 473, 529, 440, 432, + 220, 434, 440, 527, 527, 41, 2823, 529, 280, 529, + 529, 528, 2863, 490, 108, 528, 490, 2834, 1979, 9, + 529, 241, 427, 528, 532, 2842, 2877, 460, 295, 2828, + 1991, 2833, 360, 342, 2838, 60, 201, 514, 2838, 528, + 528, 2838, 2838, 529, 527, 532, 365, 532, 529, 8, + 532, 528, 11, 2870, 529, 1256, 15, 16, 194, 472, + 2021, 20, 21, 22, 2863, 2867, 529, 2028, 532, 92, + 529, 390, 292, 2924, 353, 295, 528, 41, 154, 2257, + 2897, 301, 529, 2900, 125, 154, 41, 375, 529, 60, + 60, 375, 411, 41, 297, 3642, 41, 529, 528, 467, + 2917, 2918, 315, 2920, 528, 532, 37, 2924, 528, 253, + 2927, 2072, 7, 8, 528, 2076, 285, 252, 13, 193, + 530, 2082, 342, 530, 19, 75, 467, 81, 23, 530, + 25, 530, 530, 530, 29, 30, 31, 2954, 530, 34, + 530, 530, 37, 38, 530, 2106, 41, 367, 298, 44, + 45, 3824, 530, 1066, 528, 528, 174, 2974, 530, 530, + 530, 2455, 2979, 2980, 530, 297, 530, 2984, 2985, 530, + 530, 528, 2989, 3024, 530, 2992, 2993, 530, 530, 530, + 2997, 2998, 77, 78, 3001, 530, 75, 530, 3005, 9, + 530, 530, 530, 530, 530, 530, 530, 530, 530, 530, + 3017, 174, 529, 529, 528, 377, 529, 427, 103, 527, + 3009, 527, 3015, 3015, 60, 110, 111, 112, 113, 114, + 115, 3561, 3005, 3015, 3015, 3015, 94, 134, 3015, 3015, + 436, 60, 517, 278, 530, 295, 456, 41, 38, 528, + 298, 298, 201, 43, 472, 207, 3063, 467, 528, 295, + 451, 529, 529, 295, 3071, 3005, 529, 1579, 529, 281, + 529, 529, 436, 123, 395, 224, 464, 487, 451, 489, + 490, 374, 150, 3090, 2452, 26, 473, 521, 473, 37, + 3005, 374, 3099, 528, 303, 2774, 529, 890, 2341, 1841, + 2344, 309, 2787, 3444, 2721, 3645, 3593, 3773, 3145, 1954, + 3093, 2505, 102, 321, 322, 323, 526, 3673, 3617, 529, + 530, 531, 515, 516, 517, 3132, 519, 520, 521, 522, + 523, 524, 3741, 3311, 3677, 3686, 867, 3132, 3145, 3734, + 3366, 3005, 2332, 2350, 1243, 3152, 1819, 1819, 297, 2853, + 3145, 3158, 3675, 1256, 2794, 3196, 2764, 3149, 321, 322, + 323, 3168, 3169, 3684, 3171, 1677, 2329, 3672, 1376, 3671, + 2654, 3778, 3283, 3180, 3181, 2500, 2870, 2501, 1348, 2309, + 388, 2422, 2828, 1196, 1035, 175, 2275, 1801, 1579, 3196, + 2796, 1221, 1220, 515, 516, 517, 1035, 519, 520, 521, + 522, 523, 524, 3654, 2575, 2689, 2292, 1765, 3570, 3401, + 1800, 23, 1223, 2261, 2069, 1056, 2927, 3220, 3225, 427, + 1012, 211, 2606, 2556, 3231, 388, 2555, 3332, 3574, 2085, + 3573, 2639, 2716, 2169, 1010, 1010, 1010, 227, 3005, 1010, + 3247, 3248, 1010, 1010, 3251, 1010, 3253, 1010, 238, 2276, + 2218, 3268, 1010, 2120, 462, 2215, 2172, 2663, 1495, 2743, + 3017, 2976, 3559, 3015, 427, 473, 804, 1890, 1394, 2078, + 909, 1738, 2722, 1739, 1000, 3264, 2518, 1874, 3285, -1, + -1, -1, 490, -1, 274, -1, 1677, 8, 1017, -1, + 11, 2442, -1, -1, 15, 16, -1, -1, -1, 462, + -1, -1, 3309, -1, -1, 295, 514, 1819, -1, -1, + 473, -1, -1, -1, -1, 8, -1, -1, 11, -1, + 528, -1, 15, 16, -1, -1, 47, 490, 3335, -1, + -1, 321, -1, 54, -1, -1, -1, -1, 328, -1, + -1, -1, -1, -1, -1, -1, 3335, 2498, -1, 2833, + -1, 514, 3359, -1, 47, -1, -1, -1, -1, -1, + 81, 54, -1, 3355, 3359, 528, 515, 516, 517, -1, + 519, 520, 521, 522, 523, 524, -1, -1, 2746, 2863, + 370, 3388, 2750, 2867, -1, -1, -1, -1, 81, 3378, + 3397, -1, 3399, 2877, 3401, -1, -1, 56, 3405, 389, + 3407, -1, 3409, -1, -1, -1, -1, -1, -1, -1, + -1, 2779, -1, 1925, -1, 3388, 3423, -1, -1, -1, + -1, 3428, 3429, -1, -1, -1, 147, -1, 1819, 2797, + 2798, 2799, 2800, 3440, 2802, 2803, 2804, 2805, 2806, -1, + 2924, -1, -1, -1, 103, -1, -1, -1, 3388, 3441, + 3457, 3443, -1, -1, 147, 3462, -1, -1, 179, -1, + -1, -1, 3457, 2614, -1, 124, 551, 1979, -1, -1, + -1, 556, 462, 3388, -1, 196, 1579, 467, -1, 1991, + 201, 566, -1, 142, -1, -1, 179, -1, 147, 1218, + -1, -1, -1, -1, -1, -1, 3503, -1, 1227, -1, + -1, -1, -1, 196, -1, -1, -1, -1, 201, 2021, + -1, 170, -1, -1, 173, -1, 2028, -1, -1, 240, + -1, 3005, -1, -1, -1, -1, -1, -1, 2679, -1, + 189, 3015, -1, -1, 1925, -1, -1, 3526, -1, -1, + 3024, -1, 3534, -1, -1, -1, -1, 240, -1, -1, + -1, -1, 38, 3560, -1, -1, -1, 43, -1, -1, + 2072, -1, 3554, 3570, 2076, -1, -1, -1, -1, -1, + 2082, -1, -1, -1, 1677, 3582, 297, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 153, -1, 1979, -1, + 3597, -1, 3599, 1066, 2106, -1, -1, -1, -1, -1, + 1991, -1, -1, -1, 297, -1, -1, 174, -1, -1, + -1, 3618, -1, -1, -1, -1, 102, -1, -1, -1, + -1, -1, -1, -1, 3597, -1, 285, 3634, 3635, -1, + 2021, -1, 41, -1, 293, -1, -1, 2028, 3645, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 411, -1, -1, -1, -1, -1, -1, + -1, -1, 61, 3660, -1, -1, 315, 3597, -1, -1, + -1, -1, -1, -1, -1, 3149, 3673, -1, 3675, -1, + -1, -1, 3645, -1, 759, 760, 761, -1, -1, 400, + 3675, 2072, 3597, 2834, 3673, 2076, 345, -1, -1, 175, + -1, 2082, -1, -1, -1, 3702, -1, -1, 107, 3691, + -1, -1, 3070, -1, -1, 3645, -1, 400, -1, 3716, + 3717, 3718, 3196, -1, -1, 2106, 1819, -1, 803, 804, + 3727, -1, -1, -1, 809, 211, 811, -1, 3720, 3702, + 3645, -1, -1, -1, -1, 820, -1, 1466, 1467, 824, + 825, 227, 827, 1472, -1, 830, 831, -1, -1, 2900, + 3757, -1, 238, -1, 321, 322, 323, -1, 843, 844, + 845, -1, 3702, 848, -1, -1, -1, -1, -1, -1, + -1, 856, 857, 858, 859, -1, 861, -1, 863, -1, + -1, -1, -1, 1256, -1, -1, -1, 3702, 274, -1, + 875, 512, -1, -1, -1, 204, 881, -1, 519, 520, + 521, 522, 523, 524, -1, -1, -1, -1, -1, 894, + 3817, -1, -1, -1, -1, -1, -1, 3824, -1, 512, + -1, 388, 1925, 908, 909, -1, 519, 520, 521, 522, + 523, 524, -1, -1, 2985, 321, -1, -1, -1, -1, + -1, -1, 328, 1066, -1, -1, 255, -1, -1, -1, + -1, 8, -1, -1, 11, -1, -1, 266, 15, 16, + 427, -1, 947, 948, -1, -1, -1, -1, -1, 278, + -1, 3355, -1, 958, -1, -1, 1979, 962, 963, 964, + 965, 966, -1, -1, 370, -1, -1, -1, 1991, -1, + 47, -1, -1, -1, 979, 462, -1, 54, -1, -1, + 3384, 310, -1, 389, -1, -1, 473, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 2021, -1, + -1, -1, -1, 490, 81, 2028, 1011, 1012, -1, 1014, + 2442, -1, 1017, -1, -1, -1, -1, -1, 1023, 1024, + -1, -1, 1066, -1, -1, 1030, -1, 514, 3099, -1, + -1, 1036, 3320, 1038, -1, -1, 365, 3441, -1, 3443, + -1, 528, 1047, -1, -1, -1, -1, -1, -1, 2072, + 3338, 3339, 1057, 2076, -1, -1, 462, -1, -1, 2082, + -1, 390, -1, -1, -1, -1, 2498, -1, -1, 1074, + 147, -1, -1, -1, -1, 3363, -1, -1, -1, -1, + -1, 3152, 411, 2106, -1, -1, -1, 3158, -1, -1, + -1, -1, 0, -1, -1, -1, -1, 1102, -1, -1, + -1, -1, 179, -1, -1, -1, 38, -1, -1, -1, + 3181, 43, -1, 1256, -1, -1, 1765, -1, -1, 196, + -1, -1, 1127, -1, 201, -1, -1, -1, -1, -1, + 3534, 2442, -1, -1, 8, -1, -1, 11, -1, -1, + -1, 15, 16, -1, -1, -1, 20, 21, 22, -1, + 3554, -1, -1, -1, 3225, -1, -1, -1, -1, -1, + -1, -1, -1, 240, -1, -1, -1, -1, -1, -1, + 102, -1, -1, 47, -1, 1180, -1, -1, -1, -1, + 54, -1, 2614, -1, -1, -1, 1579, 2498, -1, -1, + -1, 1196, 1197, 101, -1, -1, -1, -1, 1203, -1, + -1, 1206, -1, -1, -1, -1, -1, 81, -1, -1, + -1, -1, 1256, -1, -1, -1, -1, -1, -1, -1, + 297, -1, 1227, 1228, 1229, -1, -1, -1, -1, -1, + -1, -1, 1237, -1, -1, 1240, -1, 1242, 1243, -1, + -1, 149, -1, 175, -1, -1, -1, 2679, -1, -1, + 1255, -1, -1, -1, -1, -1, 164, -1, -1, -1, + -1, 169, -1, -1, 3335, -1, 174, 1272, -1, -1, + -1, 1276, -1, -1, -1, 183, -1, 1282, -1, 211, + 188, -1, -1, -1, 1677, -1, -1, 3691, -1, -1, + -1, -1, -1, -1, -1, 227, -1, -1, -1, -1, + -1, -1, -1, 2614, -1, 179, 238, -1, -1, -1, + -1, -1, 220, -1, -1, -1, 3720, -1, -1, -1, + -1, -1, 196, 400, -1, -1, -1, 201, -1, -1, + -1, -1, -1, 241, -1, -1, -1, -1, -1, 1344, + -1, 1346, 274, 1992, 1993, 1994, 1995, 1996, 1997, 1354, + -1, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, + 2009, -1, 1367, 295, -1, -1, 240, -1, 2679, -1, + -1, 1376, -1, -1, -1, -1, 1381, 3665, 1383, 1384, + -1, 1386, 1387, -1, 292, -1, -1, 295, -1, 321, + -1, -1, -1, 301, -1, -1, 328, -1, -1, -1, + -1, -1, 2834, -1, -1, 37, -1, -1, -1, 41, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 2442, + -1, -1, -1, 297, -1, -1, 1819, -1, -1, -1, + -1, -1, 3503, -1, 342, 512, 1579, -1, 370, -1, + -1, -1, 519, 520, 521, 522, 523, 524, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 389, -1, 367, + -1, 1466, 1467, -1, -1, -1, -1, 1472, 2900, 1474, + -1, 103, -1, -1, -1, 2498, -1, -1, -1, 111, + -1, 113, 1487, 115, 1489, 1490, -1, -1, -1, 1494, + 1495, -1, 1497, -1, -1, -1, -1, -1, -1, 1504, + -1, 1506, -1, -1, 1509, -1, -1, -1, -1, 1514, + -1, 1516, 1517, -1, 1519, -1, -1, -1, 1523, 427, + 1525, -1, 1527, 2834, -1, -1, 400, -1, -1, -1, + 462, -1, 1925, -1, 1677, 1579, -1, -1, -1, -1, + 13, -1, -1, -1, 2193, 2194, 19, -1, 456, -1, + 23, -1, -1, 2985, -1, -1, -1, 30, -1, 467, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 2451, -1, -1, -1, -1, -1, -1, + -1, 44, 45, -1, -1, -1, -1, -1, -1, 487, + -1, 489, 490, -1, -1, -1, 1979, -1, -1, 2900, + -1, 2614, -1, -1, -1, -1, -1, -1, 1991, -1, + -1, -1, 3673, -1, 77, 78, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 526, -1, + -1, 529, 530, 531, -1, -1, -1, -1, 2021, -1, + -1, 1636, -1, 1677, -1, 2028, -1, -1, 512, 112, + -1, 515, 516, 517, 1649, 519, 520, 521, 522, 523, + 524, -1, -1, -1, -1, -1, 2679, -1, -1, -1, + 2309, -1, -1, -1, -1, -1, -1, 3099, -1, -1, + -1, -1, -1, -1, 2985, -1, 1819, -1, -1, 2072, + -1, -1, -1, 2076, 1689, -1, -1, 1692, -1, 2082, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 2736, - -1, -1, 470, -1, -1, -1, -1, 1621, -1, -1, - -1, -1, -1, 400, -1, 512, 1630, -1, 515, 516, - 517, -1, 519, 520, 521, 522, 523, 524, -1, -1, - 1644, -1, -1, -1, 3069, 532, -1, -1, -1, -1, + -1, -1, -1, 2106, -1, 1720, -1, -1, -1, -1, + 3152, -1, -1, -1, -1, -1, 3158, -1, -1, -1, + 1735, -1, 1737, -1, 1739, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 1750, -1, -1, 1753, 3181, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 1664, -1, -1, -1, -1, -1, -1, -1, 1672, -1, - -1, -1, -1, -1, 1678, 1679, 1680, 1681, 1682, 1683, - 1684, 1685, -1, -1, -1, -1, 1690, 1691, -1, -1, - -1, 1695, -1, -1, -1, 1699, -1, -1, 1702, 1703, - 1704, 1705, 1706, 1707, 1708, 1709, 1710, -1, -1, 1713, - -1, 2838, -1, -1, -1, -1, 1720, 2595, 1722, -1, - -1, 2599, -1, -1, -1, -1, -1, 2605, -1, -1, - -1, -1, -1, -1, -1, 512, 1740, -1, 515, 516, - 517, -1, 519, 520, 521, 522, 523, 524, -1, -1, + 1765, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 1819, -1, -1, -1, -1, + -1, -1, 1925, -1, -1, 1790, -1, 1792, 3099, -1, + -1, -1, -1, 3225, -1, -1, -1, -1, -1, 1804, + 1805, -1, -1, -1, -1, 1810, -1, -1, 1813, 1814, + -1, 2834, -1, -1, -1, -1, -1, -1, -1, -1, + 1825, 1826, 1827, 1828, -1, 1830, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 1840, 1979, 1842, -1, -1, + -1, 3152, -1, -1, -1, -1, -1, 3158, 1991, 1854, + 1855, -1, -1, -1, 1859, 1860, -1, -1, -1, 1864, + 1865, 1866, 1867, -1, 1869, 1870, -1, -1, -1, -1, + 3181, -1, 8, -1, -1, 11, -1, 2900, 2021, 15, + 16, 1925, -1, -1, -1, 2028, 1891, -1, -1, -1, + -1, -1, -1, -1, 1899, -1, 1901, 1902, 1903, 1904, + 1905, 1906, -1, 3335, -1, -1, -1, -1, -1, -1, + -1, 47, -1, -1, 3225, -1, 1921, -1, 54, 551, + -1, -1, -1, -1, 556, -1, -1, -1, -1, 2072, + -1, -1, -1, 2076, -1, 1979, -1, 1942, -1, 2082, + -1, -1, -1, -1, -1, 81, -1, 1991, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 2985, 2106, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 2021, -1, -1, + -1, -1, -1, -1, 2028, -1, -1, 1992, 1993, 1994, + 1995, 1996, 1997, -1, -1, 2000, 2001, 2002, 2003, 2004, + 2005, 2006, 2007, 2008, 2009, -1, -1, -1, -1, -1, + -1, 147, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 3335, 2030, -1, -1, 2072, -1, + -1, -1, 2076, -1, 2683, 2684, -1, -1, 2082, 2044, + -1, -1, -1, 179, -1, -1, -1, -1, -1, 2442, + -1, -1, 2057, -1, -1, -1, -1, -1, 2063, 0, + 196, -1, 2106, -1, 2069, 201, -1, -1, -1, -1, + 2075, 3503, -1, -1, -1, -1, 3099, -1, -1, 2084, + 2085, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 566, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 8, 240, 2498, 11, -1, -1, -1, + 15, 16, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 3152, + -1, -1, -1, -1, -1, 3158, -1, -1, -1, -1, + -1, -1, 47, -1, -1, -1, -1, -1, -1, 54, + -1, -1, -1, -1, 2159, -1, -1, -1, 3181, 2164, + 101, 297, -1, -1, 2169, -1, -1, -1, -1, -1, + 8, -1, -1, 11, -1, -1, 81, 15, 16, 811, + -1, -1, -1, -1, -1, -1, -1, -1, 2193, 2194, + -1, -1, 3503, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 3225, -1, -1, -1, -1, 2212, 149, 47, + -1, -1, -1, 2218, -1, -1, 54, -1, -1, -1, + -1, 2614, -1, 164, -1, -1, -1, -1, 169, -1, + -1, -1, -1, 174, -1, -1, -1, -1, -1, -1, + 2245, 3673, 183, 81, -1, -1, -1, 188, 2897, -1, + -1, -1, 2257, -1, -1, -1, 2261, -1, -1, -1, + 2265, 2266, -1, -1, 400, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 179, 2924, 908, -1, -1, 220, + -1, -1, -1, -1, -1, -1, 2679, 760, 761, -1, + -1, 196, -1, -1, -1, -1, 201, -1, -1, 2442, + 241, 2306, -1, -1, 2309, -1, 2311, 2312, -1, 147, + -1, -1, 3335, -1, -1, 947, -1, -1, -1, -1, + -1, -1, 1017, -1, -1, 2974, -1, -1, -1, 2334, + 962, 963, 964, 965, 966, 240, -1, -1, -1, -1, + -1, 179, -1, -1, -1, -1, -1, 820, -1, -1, + -1, 292, -1, -1, 295, 2498, -1, -1, 196, -1, + 301, -1, 3673, 201, -1, -1, -1, -1, -1, -1, + -1, 8, -1, -1, 11, -1, 512, -1, 15, 16, + -1, -1, 1014, 519, 520, 521, 522, 523, 524, -1, + -1, -1, 297, -1, -1, -1, -1, -1, 2442, -1, + -1, 342, 240, -1, -1, -1, -1, -1, 881, -1, + 47, -1, -1, 2418, -1, -1, -1, 54, -1, -1, + 2425, -1, 3071, -1, -1, -1, 367, -1, -1, -1, + 2435, -1, -1, 2438, 2439, 2440, 2441, -1, -1, -1, + -1, 2834, -1, -1, 81, -1, -1, 2452, -1, 2454, + -1, -1, -1, 2458, 2498, -1, 2461, -1, -1, 297, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 1776, 1777, 2652, -1, -1, -1, 2656, -1, - -1, 2908, 2909, 2910, 2911, -1, -1, -1, -1, -1, + -1, 2614, -1, -1, -1, -1, -1, -1, -1, -1, + 3503, -1, -1, -1, -1, -1, 427, -1, -1, -1, + -1, -1, -1, -1, -1, 400, -1, -1, -1, 2504, + -1, -1, -1, -1, -1, 2510, -1, 2900, -1, -1, + 147, -1, -1, -1, -1, 456, -1, -1, -1, 2524, + 2525, -1, 2527, -1, -1, -1, 467, -1, -1, -1, + -1, 3180, 1227, -1, -1, -1, 2679, -1, -1, -1, + -1, -1, 179, -1, -1, -1, 487, -1, 489, 490, + -1, 2556, -1, -1, -1, -1, -1, 1030, -1, 196, + -1, -1, 400, 1036, 201, 1038, -1, -1, -1, 2574, + 2614, -1, -1, -1, 1047, -1, -1, 2582, 2583, 2584, + -1, -1, -1, -1, 1057, 526, -1, -1, 529, 530, + 531, 2596, 2985, 2598, -1, 2600, -1, -1, -1, -1, + -1, 2606, -1, 240, -1, 1237, -1, 512, -1, -1, + 1242, -1, -1, -1, 519, 520, 521, 522, 523, 524, + -1, 2626, -1, 1255, -1, -1, -1, -1, -1, 1102, + -1, -1, -1, -1, -1, 2679, 2641, -1, -1, -1, + -1, -1, -1, -1, 1276, -1, -1, -1, 2653, -1, + 3673, -1, 2657, -1, 1127, -1, -1, -1, -1, -1, + 297, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 512, -1, -1, -1, 2683, 2684, + -1, 519, 520, 521, 522, 523, 524, -1, -1, -1, + -1, 2834, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 2707, -1, -1, 8, 3099, -1, 11, 2714, + -1, -1, 15, 16, 1346, -1, 2721, 20, 21, 22, + -1, -1, 1354, 1196, 1197, -1, -1, -1, -1, -1, + -1, -1, 2737, -1, 37, -1, 2741, -1, 2743, -1, + 2745, 2746, -1, -1, 2749, 2750, -1, -1, -1, 2754, + 2755, 2756, -1, 2758, -1, -1, -1, 2900, 3407, 3152, + -1, -1, -1, 400, -1, 3158, -1, -1, -1, -1, + -1, 1466, 1467, -1, 2779, -1, 2781, 1472, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 3181, -1, + 2834, -1, 2797, 2798, 2799, 2800, 2801, 2802, 2803, 2804, + 2805, 2806, -1, -1, -1, -1, -1, -1, -1, 8, + -1, -1, 11, -1, -1, -1, 15, 16, -1, -1, + -1, 20, 21, 22, -1, -1, -1, 2832, -1, -1, + -1, -1, 3225, -1, -1, 2840, -1, -1, -1, -1, + -1, -1, 2985, -1, -1, -1, -1, -1, 2853, -1, + -1, -1, -1, -1, -1, -1, 2900, -1, -1, -1, + -1, -1, -1, -1, -1, 1497, -1, -1, -1, -1, + -1, -1, -1, -1, 2879, 512, -1, -1, -1, -1, + -1, 2886, 519, 520, 521, 522, 523, 524, -1, -1, + -1, -1, 2897, -1, -1, -1, -1, -1, 2903, -1, + -1, -1, -1, -1, -1, 2910, 2911, 2912, 2913, -1, + 1383, 1384, -1, 1386, -1, -1, -1, -1, -1, 2924, + -1, 224, 2927, -1, -1, -1, 2931, 2932, -1, -1, + -1, -1, -1, -1, -1, 2940, -1, -1, -1, -1, + 8, 2985, 3335, 11, -1, -1, -1, 15, 16, -1, + -1, -1, 20, 21, 22, -1, 3099, -1, 2963, -1, + -1, -1, -1, -1, -1, 2970, 2971, -1, -1, 37, + 8, -1, -1, 11, -1, -1, -1, 15, 16, -1, + -1, -1, 20, 21, 22, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 297, -1, -1, -1, 3003, 37, + 3005, -1, 201, -1, -1, -1, -1, -1, -1, 3152, + -1, -1, 3017, -1, 41, 3158, 1489, -1, -1, 3024, + -1, -1, -1, 1718, 3029, 224, -1, -1, -1, -1, + 3035, 1504, -1, 1506, 61, -1, 1509, -1, 3181, -1, + -1, 1514, -1, -1, 1517, 3050, 1519, -1, -1, -1, + 1523, 3056, 1525, -1, 1527, 3099, -1, -1, -1, -1, + -1, -1, -1, -1, 3069, 3070, 3071, -1, -1, -1, + 1765, -1, 3077, -1, -1, -1, -1, -1, -1, -1, + 107, 108, 3225, -1, -1, -1, -1, -1, -1, 3094, + -1, 118, -1, -1, -1, -1, -1, -1, 297, -1, + -1, -1, -1, -1, -1, 1737, -1, 1739, 3152, -1, + 3503, -1, -1, -1, 3158, -1, -1, -1, 1750, 8, + -1, -1, 11, 3128, -1, -1, 15, 16, 3133, -1, + -1, 20, 21, 22, -1, -1, -1, 3181, -1, -1, + -1, -1, -1, 3148, -1, -1, -1, -1, -1, -1, + -1, 178, -1, -1, -1, -1, 224, -1, 1790, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 3226, -1, -1, -1, 8, -1, -1, 11, -1, - -1, -1, 15, 16, 17, 18, -1, 20, 21, 22, + 3175, -1, -1, -1, -1, 3180, 1649, 204, -1, -1, + -1, 3225, -1, -1, -1, -1, 224, -1, -1, -1, + -1, -1, 3335, -1, -1, -1, -1, -1, -1, -1, + -1, 3206, -1, -1, -1, -1, -1, -1, 3213, -1, + -1, -1, 515, 516, 517, 3220, 519, 520, 521, 522, + 523, 524, -1, -1, -1, -1, -1, -1, 255, 297, + -1, -1, 3237, -1, -1, -1, -1, -1, -1, 266, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 37, -1, -1, -1, 41, -1, - -1, -1, -1, -1, 47, -1, -1, -1, -1, -1, - -1, 54, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 2740, -1, -1, -1, 2744, 2745, -1, -1, - -1, 2749, -1, 1877, -1, -1, -1, -1, 81, -1, - 1884, -1, -1, 1887, 1888, -1, -1, -1, -1, -1, + -1, 278, -1, 280, -1, 3260, -1, -1, -1, 297, + -1, -1, -1, 3268, -1, -1, -1, -1, -1, 1901, + 1902, 1903, 1904, 1905, 1906, -1, -1, -1, -1, -1, + 3673, -1, -1, 310, 3289, -1, -1, -1, -1, 3294, + -1, 3335, -1, -1, -1, -1, -1, 1992, 1993, 1994, + 1995, 1996, 1997, -1, -1, 2000, 2001, 2002, 2003, 2004, + 2005, 2006, 2007, 2008, 2009, 3320, 515, 516, 517, 1792, + 519, 520, 521, 522, 523, 524, -1, -1, -1, -1, + -1, -1, -1, 3338, 3339, 224, -1, -1, 365, -1, + -1, 1814, -1, 856, 857, -1, -1, -1, -1, -1, + -1, 3356, 1825, 3358, 1827, -1, -1, 1830, 3363, -1, + 3503, -1, -1, 390, -1, -1, -1, 1840, -1, 1842, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 2778, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 2795, 2796, 2797, - 2798, -1, 2800, 2801, 2802, 2803, 2804, -1, -1, -1, + 3385, -1, 1855, 3388, 411, -1, 413, 1860, -1, 416, + -1, 1864, 1865, -1, 1867, -1, 1869, 1870, -1, -1, + -1, -1, 3407, -1, 3409, -1, 3411, 3412, 297, 3414, + -1, -1, 2044, -1, 3419, -1, -1, -1, -1, 932, + -1, -1, -1, 936, 937, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 3440, -1, -1, -1, 3444, + -1, -1, -1, -1, -1, -1, -1, 515, 516, 517, + 3455, 519, 520, 521, 522, 523, 524, -1, -1, 3503, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 3075, -1, - 1954, 1955, -1, -1, -1, -1, -1, -1, -1, 1963, + -1, -1, -1, -1, -1, -1, 989, 515, 516, 517, + -1, 519, 520, 521, 522, 523, 524, -1, -1, -1, + -1, -1, -1, -1, 1007, -1, -1, -1, 2193, 2194, + 1013, 528, -1, 1016, -1, -1, 1019, 1020, 1021, 1022, 8, -1, -1, 11, -1, -1, -1, 15, 16, 17, - 18, -1, 20, 21, 22, -1, 179, -1, -1, 1983, - 1984, -1, 1986, -1, -1, -1, -1, -1, -1, 37, - -1, -1, -1, 196, -1, -1, -1, -1, 201, 47, - -1, -1, -1, -1, -1, -1, 54, -1, -1, -1, - -1, 2015, 2016, -1, -1, 2019, -1, 0, -1, -1, - -1, 224, 225, 2901, -1, -1, -1, -1, 3453, -1, - -1, -1, -1, 81, -1, -1, -1, 240, -1, -1, - 23, -1, -1, -1, -1, -1, 2050, -1, -1, -1, - 33, 2929, 35, 36, -1, 2059, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 48, -1, -1, -1, -1, - 53, -1, -1, -1, 2078, -1, 2080, 280, -1, 62, - 283, -1, -1, 2961, -1, -1, -1, -1, -1, -1, - -1, 2969, -1, 76, 297, -1, -1, 300, -1, -1, - -1, -1, 85, -1, 87, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 2119, 99, -1, 101, -1, - -1, 2125, -1, -1, -1, 3003, -1, -1, -1, 112, - -1, 179, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 127, 128, 129, -1, 196, -1, - -1, -1, -1, 201, 2158, 138, -1, -1, 2162, -1, - -1, 144, -1, 2167, 2168, -1, -1, -1, -1, -1, - 153, -1, 155, 156, -1, -1, 224, 225, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 170, -1, -1, - 3068, 174, 240, -1, -1, -1, -1, 400, -1, -1, + 18, -1, 20, 21, 22, -1, -1, 3532, -1, -1, + 3673, -1, -1, -1, -1, -1, -1, -1, -1, 37, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 47, + -1, 1064, 1065, -1, -1, -1, 54, 2030, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 3574, + -1, -1, -1, 1086, -1, -1, -1, 3582, -1, -1, + -1, -1, -1, 81, 2057, -1, -1, -1, -1, 25, + 2063, -1, 3597, 1106, -1, -1, 2069, -1, -1, -1, + -1, -1, 2075, -1, -1, 1118, 1119, 1120, -1, 1122, + 1123, -1, -1, -1, 2309, -1, -1, -1, -1, -1, + -1, -1, -1, 3628, -1, -1, 515, 516, 517, 3673, + 519, 520, 521, 522, 523, 524, -1, 3642, 3643, -1, + 3645, 3646, -1, -1, -1, 1158, 82, -1, -1, 3654, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 2214, -1, -1, 2217, -1, 2219, -1, 200, -1, -1, + 3665, -1, 98, 1176, 1177, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 2235, 280, 216, -1, 283, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 297, - -1, -1, 300, -1, -1, -1, -1, -1, -1, -1, - 243, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 2275, -1, -1, -1, -1, -1, -1, 3405, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 2292, 2293, + -1, 179, -1, -1, -1, -1, 2159, -1, 3693, -1, + -1, 2164, -1, -1, -1, -1, 2169, 3702, 196, -1, + 1213, -1, -1, 201, 1217, 1218, -1, -1, -1, -1, + -1, -1, 148, -1, -1, 1228, 1229, -1, -1, -1, + -1, -1, 158, -1, -1, -1, 224, 225, -1, -1, + -1, -1, -1, -1, -1, 171, -1, -1, -1, -1, + 176, -1, 240, -1, -1, -1, -1, -1, 3753, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 3431, -1, -1, 2311, -1, 512, - -1, -1, 515, 516, 517, -1, 519, 520, 521, 522, - 523, 524, 2326, -1, -1, -1, 529, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 321, 322, - 323, -1, -1, -1, -1, -1, 329, -1, -1, 332, + -1, -1, -1, 3768, -1, -1, -1, -1, 3773, 205, + -1, 3776, 2245, -1, -1, -1, -1, -1, -1, 1292, + -1, -1, 280, -1, 2257, 283, -1, -1, 2261, -1, + 1303, -1, 2265, 2425, -1, -1, -1, -1, -1, 297, + -1, -1, 300, -1, -1, -1, -1, 2439, 2440, 2441, + -1, -1, -1, 249, -1, 1328, -1, -1, 254, -1, + -1, -1, 2454, -1, -1, -1, 2458, -1, -1, 2461, + -1, -1, -1, 2306, -1, 3, -1, -1, -1, 2312, + 8, -1, -1, 11, -1, -1, -1, 15, 16, 17, + 18, -1, 20, 21, 22, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 37, + -1, -1, 2504, 41, -1, 8, -1, -1, 11, 47, + -1, -1, 15, 16, 320, -1, 54, 20, 21, 22, + 326, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 400, 1416, 37, 341, -1, -1, -1, -1, + -1, -1, -1, 81, 47, -1, -1, -1, -1, -1, + -1, 54, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 376, -1, -1, 379, -1, -1, -1, -1, 81, -1, + 2582, 2583, 2584, -1, 390, -1, -1, 393, -1, -1, + -1, -1, -1, -1, -1, -1, 1479, -1, 1481, 1482, + -1, -1, -1, -1, -1, -1, -1, 413, -1, 2452, + -1, 1494, 1495, -1, -1, -1, -1, -1, 2683, 2684, + -1, 427, -1, -1, -1, -1, -1, -1, 434, 435, + -1, -1, -1, 1516, -1, -1, -1, -1, -1, 445, + -1, 179, -1, -1, 512, 451, -1, 515, 516, 517, + -1, 519, 520, 521, 522, 523, 524, -1, 196, 3, + -1, 5, -1, 201, 532, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 480, -1, 179, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 224, 225, -1, -1, + -1, -1, -1, 196, -1, -1, -1, -1, 201, -1, + -1, -1, 240, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 224, 225, -1, -1, 69, 70, -1, -1, -1, + -1, -1, -1, -1, -1, 2737, -1, 240, 1621, -1, + -1, -1, 280, -1, -1, 283, -1, 1630, -1, -1, + -1, -1, -1, 2596, -1, -1, -1, 2600, -1, 297, + -1, 1644, 300, 2606, -1, -1, 110, 111, -1, -1, + 114, 115, -1, -1, -1, -1, -1, 280, -1, -1, + 283, 1664, -1, -1, -1, -1, -1, -1, -1, 1672, + -1, -1, -1, -1, 297, 1678, 1679, 1680, 1681, 1682, + 1683, 1684, 1685, -1, -1, -1, -1, 1690, 1691, -1, + 2653, -1, 1695, -1, 2657, -1, 1699, -1, -1, 1702, + 1703, 1704, 1705, 1706, 1707, 1708, 1709, 1710, -1, -1, + 1713, -1, 2897, -1, -1, -1, -1, 1720, 2840, 1722, + -1, -1, -1, 69, 70, -1, -1, 191, 192, -1, + -1, -1, -1, -1, -1, -1, -1, 1740, -1, 2924, -1, -1, 400, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 3501, -1, -1, -1, -1, 8, - 363, 3259, 11, -1, -1, -1, 15, 16, 3266, 372, - 2394, 20, 21, 22, -1, -1, -1, -1, -1, 2403, - -1, -1, -1, -1, 3531, 388, -1, -1, 37, -1, - -1, -1, 395, 1017, 69, 70, 399, -1, 47, -1, - -1, -1, -1, -1, -1, 54, -1, -1, 411, -1, + -1, -1, -1, -1, 110, 111, -1, -1, 114, 115, + -1, -1, -1, 1776, 1777, -1, -1, 400, 2741, -1, + -1, -1, 2745, 2746, -1, -1, -1, 2750, 2910, 2911, + 2912, 2913, -1, -1, 258, 259, 260, 261, 262, 263, + 264, 265, -1, -1, 268, 269, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 2779, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 423, -1, -1, -1, 427, -1, -1, -1, -1, -1, - -1, -1, 81, -1, -1, 110, 111, 3335, -1, 114, - 115, -1, 3340, -1, 512, 448, -1, 515, 516, 517, - -1, 519, 520, 521, 522, 523, 524, -1, -1, 462, - -1, 529, 465, -1, -1, 468, -1, -1, 3366, -1, - 473, -1, -1, -1, -1, -1, -1, 2501, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 490, -1, 3387, - 3388, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 2797, 2798, 2799, 2800, -1, 2802, + 2803, 2804, 2805, 2806, -1, 191, 192, -1, -1, -1, + -1, -1, -1, -1, 512, -1, -1, 515, 516, 517, + -1, 519, 520, 521, 522, 523, 524, -1, -1, -1, + -1, -1, -1, -1, 1877, -1, -1, -1, -1, 343, + 344, 1884, -1, -1, 1887, 1888, 3071, -1, -1, 512, + -1, -1, 515, 516, 517, -1, 519, 520, 521, 522, + 523, 524, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 258, 259, 260, 261, 262, 263, 264, 265, + 384, 385, 268, 269, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 514, -1, -1, 3412, -1, 191, 192, -1, 1143, - -1, -1, -1, -1, -1, 528, -1, -1, 531, -1, - 179, 8, -1, -1, 11, -1, -1, -1, 15, 16, - 17, 18, -1, 20, 21, 22, -1, 196, -1, -1, - -1, -1, 201, -1, -1, -1, -1, -1, -1, 3457, - 37, -1, -1, -1, -1, -1, -1, 3465, 1192, -1, - 47, -1, -1, -1, -1, 224, 225, 54, -1, -1, - -1, -1, -1, 258, 259, 260, 261, 262, 263, 264, - 265, 240, -1, 268, 269, -1, -1, -1, -1, -1, - -1, -1, -1, 1227, 81, -1, 2630, -1, -1, -1, - -1, -1, 8, 2637, 2638, 11, -1, -1, -1, 15, - 16, 17, 18, -1, 20, 21, 22, -1, -1, 2653, - -1, 280, -1, -1, 283, -1, -1, -1, -1, -1, - -1, 37, 2666, -1, -1, 2669, -1, 2671, 297, -1, - -1, 47, -1, -1, -1, 2679, -1, -1, 54, -1, - -1, -1, 1286, 2687, 2688, -1, -1, -1, 343, 344, - 2694, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 81, -1, 2711, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 2722, -1, - -1, -1, 179, -1, -1, -1, -1, -1, 1332, 384, - 385, -1, -1, -1, -1, 1339, -1, -1, 2742, 196, - -1, -1, -1, -1, 201, 8, -1, -1, 11, -1, - -1, -1, 15, 16, 17, 18, -1, 20, 21, 22, - -1, -1, -1, -1, -1, -1, -1, 224, 225, -1, - -1, 400, -1, -1, 37, -1, -1, -1, -1, -1, - 3658, -1, -1, 240, 47, -1, 1390, -1, -1, -1, - 2794, 54, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 179, 2808, 2809, -1, -1, -1, -1, - 1414, -1, -1, -1, -1, -1, -1, 2821, 81, -1, - 196, -1, -1, 280, -1, 201, 283, -1, -1, 484, - 485, -1, -1, -1, -1, -1, 2840, -1, -1, -1, - 297, -1, -1, 300, -1, -1, -1, -1, 224, 225, - -1, -1, -1, 508, 509, -1, -1, -1, 1462, -1, - 1464, -1, 1466, 1467, 240, 1469, -1, -1, 1472, -1, - -1, 1475, -1, 528, 1478, -1, -1, -1, -1, 1483, - -1, -1, 1486, 512, -1, -1, 515, 516, 517, -1, - 519, 520, 521, 522, 523, 524, -1, -1, -1, -1, - -1, -1, -1, -1, 280, -1, -1, 283, -1, -1, - -1, 2915, 2916, -1, 2918, -1, 179, -1, -1, -1, - -1, 297, -1, -1, 300, -1, 1530, -1, -1, -1, - -1, -1, -1, 196, -1, -1, -1, -1, 201, -1, - -1, -1, -1, 400, -1, -1, -1, -1, 2952, -1, + 2903, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 1954, 1955, -1, -1, 3077, 0, -1, -1, -1, + 1963, -1, -1, -1, -1, -1, -1, -1, 2931, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, + 1983, 1984, -1, 1986, -1, -1, -1, -1, -1, 33, + -1, 35, 36, -1, -1, 3180, 25, 343, 344, -1, + 2963, -1, -1, -1, 48, -1, -1, -1, 2971, 53, + -1, -1, 2015, 2016, -1, -1, 2019, -1, 62, -1, + 484, 485, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 76, -1, -1, -1, -1, -1, 384, 385, + -1, 85, 3005, 87, 508, 509, -1, 2050, -1, -1, + -1, -1, -1, 82, -1, 99, 2059, 101, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 112, 98, + -1, -1, -1, -1, -1, 2078, -1, 2080, -1, -1, + -1, -1, -1, 127, 128, 129, -1, -1, -1, -1, + -1, -1, -1, -1, 138, -1, -1, -1, -1, -1, + 144, -1, -1, -1, -1, -1, -1, 3070, -1, 153, + -1, 155, 156, -1, -1, -1, 2119, -1, -1, 148, + -1, -1, 2125, -1, -1, 1017, 170, -1, -1, 158, + 174, -1, -1, -1, -1, -1, -1, -1, 484, 485, + -1, -1, 171, -1, -1, -1, -1, 176, -1, -1, + -1, -1, -1, -1, -1, 2158, 200, -1, -1, 2162, + -1, -1, 508, 509, 2167, 2168, -1, -1, -1, 27, + -1, -1, 216, -1, -1, 33, 205, -1, -1, -1, + -1, -1, 528, 41, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 243, + -1, -1, -1, 61, -1, -1, -1, -1, -1, -1, + -1, 2214, -1, -1, 2217, -1, 2219, -1, -1, -1, + 249, -1, 3407, -1, -1, 254, -1, -1, -1, -1, + -1, -1, 2235, -1, 3356, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 107, + 3213, 1143, -1, -1, -1, -1, -1, 3220, -1, -1, + -1, -1, -1, 3385, -1, -1, -1, -1, -1, -1, + -1, -1, 2275, -1, -1, -1, -1, 321, 322, 323, + 138, -1, -1, -1, -1, 329, -1, -1, 332, 2292, + 2293, -1, -1, -1, -1, -1, -1, 326, -1, -1, + 1192, -1, -1, -1, -1, -1, -1, -1, 2311, -1, + -1, -1, 341, -1, -1, -1, -1, -1, -1, 363, + -1, -1, -1, 2326, -1, -1, 3289, -1, 372, -1, + -1, 3294, -1, 3455, -1, 1227, -1, -1, -1, -1, + -1, -1, -1, -1, 388, -1, 204, 376, -1, -1, + 379, 395, -1, -1, -1, 399, -1, 3320, -1, -1, + -1, 390, -1, -1, 393, -1, -1, 411, -1, -1, + -1, -1, -1, -1, -1, 3338, 3339, -1, -1, 423, + -1, -1, -1, 427, 413, -1, -1, -1, -1, -1, + -1, -1, 2395, -1, 1286, -1, -1, 255, 427, -1, + 3363, 2404, -1, -1, 448, -1, 435, -1, 266, -1, + 3532, -1, -1, -1, -1, -1, 445, -1, 462, -1, + 278, 465, 451, -1, 468, -1, -1, -1, -1, 473, + 8, -1, -1, 11, -1, -1, -1, 15, 16, -1, + 1332, 299, 20, 21, 22, -1, 490, 1339, 3411, -1, + -1, 480, 310, -1, -1, -1, 3419, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 47, + 514, -1, -1, -1, -1, -1, 54, -1, -1, -1, + -1, -1, -1, -1, 528, -1, -1, 531, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 1390, 2502, + -1, 359, -1, 81, -1, 363, -1, 365, -1, -1, + -1, 8, -1, -1, 11, -1, -1, -1, 15, 16, + 17, 18, 1414, 20, 21, 22, -1, -1, -1, -1, + -1, -1, 390, -1, -1, -1, -1, 395, -1, -1, + 37, -1, -1, -1, 41, -1, -1, -1, -1, -1, + 47, -1, -1, 411, -1, -1, -1, 54, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 224, 225, -1, -1, -1, -1, -1, 2972, -1, - -1, -1, -1, 2977, 2978, -1, -1, 240, 2982, -1, - -1, -1, -1, 2987, -1, -1, 2990, 2991, -1, -1, - -1, 2995, 2996, -1, -1, 2999, -1, -1, -1, -1, + 1462, -1, 1464, -1, 1466, 1467, -1, 1469, -1, -1, + 1472, -1, -1, 1475, 81, -1, 1478, -1, -1, -1, + -1, 1483, -1, -1, 1486, -1, -1, -1, -1, -1, + -1, 179, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 470, -1, -1, -1, -1, -1, 196, -1, + -1, -1, -1, 201, -1, -1, -1, -1, 2631, -1, + -1, -1, -1, -1, -1, 2638, 2639, -1, 1530, -1, + -1, -1, -1, -1, -1, -1, 224, 225, -1, -1, + -1, 2654, 69, 70, -1, -1, -1, -1, -1, -1, + -1, -1, 240, -1, 2667, -1, -1, 2670, -1, 2672, + -1, -1, -1, -1, -1, -1, -1, 2680, -1, -1, + -1, -1, 179, -1, -1, 2688, 2689, -1, -1, -1, + -1, -1, 2695, 110, 111, -1, -1, 114, 115, 196, + -1, -1, 3665, -1, 201, 283, -1, -1, -1, 2712, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 297, + 2723, -1, -1, -1, -1, 1617, -1, 224, 225, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 2743, -1, 1634, 240, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 1645, 1646, 1647, -1, -1, -1, -1, + 1652, -1, -1, -1, 1656, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 191, 192, -1, -1, -1, -1, + -1, -1, -1, 280, -1, -1, 283, 2790, 2791, -1, + -1, -1, -1, 2796, -1, -1, -1, -1, -1, -1, + 297, -1, -1, 300, -1, -1, -1, 2810, 2811, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 3015, -1, 1617, -1, -1, -1, 280, -1, -1, - 283, -1, -1, -1, 400, -1, -1, -1, -1, -1, - 1634, -1, -1, -1, 297, -1, -1, 300, -1, -1, - -1, 1645, 1646, 1647, -1, -1, -1, -1, 1652, -1, - -1, -1, 1656, -1, -1, 512, -1, 3061, 515, 516, + 2823, -1, 400, -1, -1, -1, -1, 1719, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 2842, + -1, 258, 259, 260, 261, 262, 263, 264, 265, -1, + -1, 268, 269, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 8, -1, -1, 11, -1, 1759, -1, 15, + 16, 17, 18, -1, 20, 21, 22, -1, -1, -1, + -1, -1, -1, 1775, -1, -1, -1, -1, 1780, -1, + -1, 37, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 47, -1, 400, -1, 1797, -1, -1, 54, -1, + -1, -1, -1, -1, 2917, 2918, -1, 2920, -1, -1, + -1, -1, -1, -1, -1, -1, 343, 344, -1, -1, + -1, -1, -1, -1, 512, 81, -1, 515, 516, 517, + -1, 519, 520, 521, 522, 523, 524, -1, -1, -1, + -1, 2954, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 384, 385, -1, + -1, 2974, -1, -1, -1, -1, 2979, 2980, -1, -1, + -1, 2984, -1, -1, -1, -1, 2989, -1, -1, 2992, + 2993, -1, -1, -1, 2997, 2998, -1, -1, 3001, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 3017, 512, -1, -1, 515, 516, 517, -1, 519, 520, 521, 522, 523, 524, -1, -1, - -1, -1, 529, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 3088, -1, -1, -1, -1, -1, + -1, -1, 529, 179, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 196, -1, -1, -1, -1, 201, -1, -1, -1, -1, + 3063, -1, -1, -1, -1, -1, -1, 484, 485, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 224, 225, + -1, -1, -1, -1, -1, -1, -1, 3090, -1, 1981, + -1, 508, 509, -1, 240, -1, -1, 1989, 1990, -1, + 1992, 1993, 1994, 1995, 1996, 1997, -1, -1, 2000, 2001, + 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 1719, -1, -1, -1, -1, + -1, -1, -1, -1, 280, -1, -1, 283, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 512, 400, -1, 515, - 516, 517, -1, 519, 520, 521, 522, 523, 524, 8, - -1, -1, 11, 529, -1, 1759, 15, 16, 17, 18, + -1, 297, -1, -1, 300, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 3168, 3169, -1, 3171, 8, + -1, -1, 11, -1, -1, -1, 15, 16, 17, 18, -1, 20, 21, 22, -1, -1, -1, -1, -1, -1, - -1, 1775, -1, -1, -1, -1, 1780, -1, 37, -1, + -1, -1, -1, 3196, -1, -1, -1, -1, 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, 47, -1, - -1, -1, -1, 1797, -1, 54, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 54, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 3231, -1, + 2122, -1, -1, -1, 2126, -1, -1, -1, -1, -1, + -1, -1, 81, -1, 3247, 3248, -1, -1, 3251, -1, + 3253, -1, -1, -1, 400, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 2157, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 2171, + -1, -1, 3285, -1, 2176, -1, -1, -1, 2180, 2181, + 2182, 2183, 2184, 2185, 2186, 2187, -1, -1, -1, -1, + -1, 2193, 2194, -1, 2196, 2197, 3309, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 2210, -1, + -1, 2213, -1, -1, -1, -1, -1, -1, -1, 2221, + 2222, 2223, 2224, 2225, 2226, 2227, 2228, 2229, 2230, -1, + 179, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 196, -1, -1, + -1, -1, 201, -1, 2256, -1, 512, -1, -1, 515, + 516, 517, -1, 519, 520, 521, 522, 523, 524, -1, + -1, -1, -1, 529, -1, 224, 225, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 3401, -1, + -1, 240, 3405, -1, -1, -1, 3409, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 2309, -1, -1, + 3423, -1, -1, -1, -1, 3428, 3429, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 3440, -1, -1, + -1, 280, -1, -1, 283, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 297, 3462, + -1, 300, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 3214, 3215, -1, 3217, -1, -1, -1, -1, -1, -1, - -1, -1, 81, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 3242, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 512, - -1, -1, 515, 516, 517, -1, 519, 520, 521, 522, - 523, 524, 8, -1, -1, 11, 529, -1, -1, 15, - 16, 17, 18, 3277, 20, 21, 22, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 3293, - 3294, 37, -1, 3297, -1, 3299, -1, -1, -1, -1, - -1, 47, -1, -1, -1, -1, -1, -1, 54, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 179, -1, -1, -1, -1, -1, -1, 3331, -1, -1, - -1, -1, -1, -1, -1, 81, -1, 196, -1, -1, - -1, -1, 201, -1, -1, -1, -1, -1, -1, -1, - -1, 3355, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 224, 225, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 1981, -1, -1, - -1, 240, -1, -1, -1, 1989, 1990, -1, 1992, 1993, - 1994, 1995, 1996, 1997, -1, -1, 2000, 2001, 2002, 2003, - 2004, 2005, 2006, 2007, 2008, 2009, 2010, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 280, -1, -1, 283, -1, -1, -1, -1, -1, - -1, -1, -1, 179, -1, -1, -1, -1, 297, -1, - -1, 300, -1, 3447, -1, -1, -1, 3451, -1, -1, - 196, 3455, -1, -1, -1, 201, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 3469, -1, -1, -1, -1, - 3474, 3475, -1, -1, -1, -1, -1, -1, 224, 225, - -1, -1, 3486, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 240, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 3508, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 2122, -1, - -1, -1, 2126, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 280, -1, -1, 283, -1, -1, - -1, 400, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 297, 3556, 2157, 300, -1, -1, -1, -1, -1, - -1, -1, 3566, -1, -1, -1, -1, 2171, -1, -1, - -1, -1, 2176, -1, 3578, -1, 2180, 2181, 2182, 2183, - 2184, 2185, 2186, 2187, -1, -1, -1, -1, -1, 2193, - 2194, 3595, 2196, 2197, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 2210, -1, -1, 2213, - 3614, -1, -1, -1, -1, -1, -1, 2221, 2222, 2223, - 2224, 2225, 2226, 2227, 2228, 2229, 2230, -1, -1, -1, + -1, -1, -1, -1, 2396, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 2407, 2408, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 8, -1, -1, 11, -1, -1, -1, 15, 16, 17, + 18, -1, 20, 21, 22, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 3560, -1, 37, + -1, 400, -1, -1, -1, -1, -1, 3570, -1, 47, + -1, -1, -1, -1, -1, -1, 54, -1, -1, 3582, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 2256, 512, 400, -1, 515, 516, 517, -1, + -1, -1, -1, -1, -1, -1, 3599, -1, -1, -1, + -1, -1, -1, 81, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 3618, -1, -1, -1, -1, + -1, 2513, -1, 2515, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 2531, + 2532, 2533, -1, -1, 2536, 2537, 2538, 2539, 2540, 2541, + -1, -1, -1, 2545, 2546, 2547, 2548, 2549, 2550, 2551, + 2552, 2553, 2554, -1, -1, -1, -1, 2559, 2560, -1, + -1, -1, -1, 512, -1, -1, 515, 516, 517, -1, 519, 520, 521, 522, 523, 524, -1, -1, -1, -1, - 529, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 8, -1, -1, 11, -1, -1, -1, 15, 16, - 17, 18, -1, 20, 21, 22, -1, -1, -1, -1, - -1, 3705, 3706, 3707, -1, 2309, -1, -1, -1, -1, - 37, -1, 3716, -1, -1, -1, -1, -1, -1, -1, - 47, -1, -1, -1, -1, -1, -1, 54, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 3741, -1, -1, + 529, -1, -1, 2585, -1, -1, -1, -1, -1, -1, + -1, 179, -1, 2595, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 3716, 3717, 3718, -1, -1, 196, -1, + -1, -1, -1, 201, 3727, -1, -1, 8, -1, -1, + 11, -1, -1, -1, 15, 16, 17, 18, 2630, 20, + 21, 22, -1, -1, -1, 2637, 224, 225, -1, -1, + -1, -1, -1, -1, 3757, -1, 37, 2649, -1, -1, + -1, -1, 240, 2655, -1, -1, 47, -1, 2660, 2661, + -1, -1, -1, 54, -1, -1, 2668, 2669, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 81, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 512, -1, -1, 515, - 516, 517, -1, 519, 520, 521, 522, 523, 524, -1, - -1, -1, -1, 529, -1, -1, -1, -1, -1, -1, - -1, 2395, -1, -1, -1, -1, 3800, -1, -1, -1, - -1, -1, 2406, 2407, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 8, -1, -1, - 11, -1, -1, -1, 15, 16, 17, 18, -1, 20, - 21, 22, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 37, -1, -1, -1, - -1, -1, 179, -1, -1, -1, 47, -1, -1, -1, - -1, -1, -1, 54, -1, -1, -1, -1, -1, 196, - -1, -1, -1, -1, 201, -1, -1, -1, -1, -1, + 2682, 2683, 2684, 2685, -1, 2687, -1, -1, -1, 2691, + 81, -1, 280, -1, -1, 283, -1, -1, -1, -1, + -1, -1, -1, -1, 3817, -1, -1, -1, -1, 297, + -1, -1, 300, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 81, -1, -1, -1, -1, -1, -1, 224, 225, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 2512, -1, - 2514, -1, -1, 240, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 2530, 2531, 2532, -1, - -1, 2535, 2536, 2537, 2538, 2539, 2540, -1, -1, -1, - 2544, 2545, 2546, 2547, 2548, 2549, 2550, 2551, 2552, 2553, - -1, -1, -1, 280, 2558, 2559, 283, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 297, -1, -1, 300, -1, -1, -1, -1, -1, -1, - 2584, -1, -1, -1, 8, -1, -1, 11, 179, -1, - 2594, 15, 16, 17, 18, -1, 20, 21, 22, -1, - -1, -1, -1, -1, -1, 196, -1, -1, -1, -1, - 201, -1, -1, 37, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 47, -1, 2629, -1, -1, -1, -1, - 54, -1, 2636, 224, 225, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 2648, -1, -1, -1, -1, 240, - 2654, -1, -1, -1, -1, 2659, 2660, 81, -1, -1, - -1, -1, -1, 2667, 2668, -1, -1, -1, -1, -1, - -1, -1, -1, 400, -1, -1, -1, 2681, 2682, 2683, - 2684, -1, 2686, -1, -1, -1, 2690, -1, -1, 280, - 8, -1, 283, 11, -1, -1, -1, 15, 16, 17, - 18, -1, 20, 21, 22, -1, 297, -1, -1, 300, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 2751, + 8, -1, -1, 11, -1, -1, -1, 15, 16, 17, + 18, -1, 20, 21, 22, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 37, - -1, -1, -1, -1, -1, 8, -1, -1, 11, 47, - -1, -1, 15, 16, 17, 18, 54, 20, 21, 22, - -1, -1, -1, -1, -1, -1, 2750, -1, -1, -1, - -1, -1, -1, -1, 37, 179, -1, -1, -1, -1, - -1, -1, -1, 81, 47, -1, -1, -1, -1, -1, - -1, 54, 196, -1, -1, -1, -1, 201, -1, -1, - -1, -1, -1, -1, -1, 512, -1, -1, 515, 516, - 517, -1, 519, 520, 521, 522, 523, 524, 81, -1, - 224, 225, 529, -1, -1, -1, -1, -1, -1, 400, - -1, -1, -1, -1, -1, -1, 240, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 179, 47, + -1, -1, -1, -1, -1, -1, 54, -1, -1, -1, + -1, -1, -1, -1, -1, 196, -1, -1, -1, -1, + 201, -1, 400, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 81, -1, -1, -1, -1, 8, -1, + -1, 11, -1, 224, 225, 15, 16, 17, 18, -1, + 20, 21, 22, -1, -1, -1, -1, -1, -1, 240, + -1, -1, -1, -1, -1, -1, -1, 37, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 47, -1, -1, + -1, -1, -1, -1, 54, -1, 2878, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 280, + -1, -1, 283, -1, -1, 2897, -1, -1, -1, -1, + -1, 81, -1, -1, -1, -1, 297, -1, -1, 300, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 8, -1, -1, 11, -1, -1, -1, 15, 16, - 17, 18, -1, 20, 21, 22, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 280, -1, -1, 283, - 37, 179, -1, -1, -1, -1, -1, -1, -1, -1, - 47, -1, 2876, 297, -1, -1, 300, 54, 196, -1, - -1, -1, -1, 201, -1, -1, -1, -1, -1, -1, - -1, 2895, -1, -1, -1, -1, 179, -1, -1, -1, - -1, -1, -1, -1, 81, -1, 224, 225, -1, -1, - -1, -1, -1, 196, -1, -1, -1, -1, 201, -1, - -1, 512, 240, -1, 515, 516, 517, -1, 519, 520, - 521, 522, 523, 524, -1, -1, -1, -1, 529, -1, - -1, 224, 225, -1, -1, -1, -1, -1, -1, 2953, - -1, 2955, -1, -1, -1, -1, -1, 240, -1, -1, - 2964, -1, 280, -1, -1, 283, -1, -1, -1, -1, - -1, -1, 2976, -1, -1, 2979, 400, 2981, -1, 297, - -1, 2985, 300, -1, 2988, 2989, -1, -1, 2992, 2993, - -1, -1, -1, -1, -1, -1, 3000, 280, -1, -1, - 283, -1, 179, -1, -1, -1, -1, -1, -1, -1, - 3014, -1, -1, -1, 297, -1, -1, 300, -1, 196, - -1, -1, -1, -1, 201, -1, 3030, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 8, -1, -1, - 11, -1, -1, -1, 15, 16, -1, 224, 225, 20, + -1, 179, -1, -1, 512, -1, -1, 515, 516, 517, + -1, 519, 520, 521, 522, 523, 524, -1, 196, -1, + -1, 529, -1, 201, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 2955, -1, 2957, -1, -1, -1, -1, + -1, -1, -1, -1, 2966, -1, 224, 225, -1, -1, + -1, -1, -1, -1, -1, -1, 2978, -1, -1, 2981, + -1, 2983, 240, -1, -1, 2987, -1, -1, 2990, 2991, + -1, -1, 2994, 2995, -1, -1, -1, -1, -1, 179, + 3002, -1, -1, -1, -1, -1, -1, -1, -1, 400, + -1, -1, -1, -1, 3016, -1, 196, -1, -1, -1, + -1, 201, 280, -1, -1, 283, -1, -1, -1, -1, + 3032, -1, -1, -1, -1, -1, -1, -1, -1, 297, + -1, -1, 300, -1, 224, 225, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 240, -1, -1, -1, -1, -1, -1, -1, -1, 3071, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 280, 3103, 3104, 283, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 297, -1, -1, + 300, 512, -1, -1, 515, 516, 517, 3129, 519, 520, + 521, 522, 523, 524, -1, -1, -1, 8, 529, -1, + 11, 3143, 400, -1, 15, 16, 17, 18, -1, 20, 21, 22, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 240, -1, 3069, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 47, -1, -1, -1, - -1, -1, 400, 54, -1, -1, -1, -1, 512, -1, - -1, 515, 516, 517, -1, 519, 520, 521, 522, 523, - 524, -1, -1, 280, -1, 529, 283, -1, -1, -1, - 81, -1, -1, -1, -1, -1, -1, 400, -1, -1, - 297, -1, -1, 300, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 8, -1, -1, 11, -1, -1, - -1, 15, 16, 17, 18, -1, 20, 21, 22, -1, + -1, -1, -1, -1, -1, -1, 37, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 47, 3179, 3180, -1, + -1, -1, -1, 54, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 37, -1, -1, -1, -1, -1, -1, - -1, 3175, -1, 47, -1, -1, -1, -1, -1, -1, - 54, -1, -1, -1, -1, 3189, -1, -1, -1, -1, - -1, -1, -1, -1, 512, -1, -1, 515, 516, 517, - -1, 519, 520, 521, 522, 523, 524, 81, 179, -1, + -1, -1, 3204, 3205, -1, -1, 3208, -1, -1, -1, + 81, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 400, -1, -1, -1, -1, -1, -1, 3229, -1, -1, + -1, -1, -1, -1, -1, -1, 3238, -1, -1, 3241, + 3242, 3243, -1, -1, 3246, -1, -1, 3249, 3250, -1, + -1, -1, -1, -1, 512, -1, 3258, 515, 516, 517, + -1, 519, 520, 521, 522, 523, 524, -1, -1, -1, -1, 529, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 3225, 3226, 400, -1, 196, -1, -1, -1, 512, - 201, -1, 515, 516, 517, -1, 519, 520, 521, 522, - 523, 524, -1, -1, 527, -1, 3250, 3251, -1, -1, - 3254, -1, -1, 224, 225, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 3306, -1, -1, -1, 179, -1, + 3312, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 3325, -1, 196, -1, -1, -1, -1, + 201, -1, 512, -1, -1, 515, 516, 517, -1, 519, + 520, 521, 522, 523, 524, -1, -1, -1, -1, 529, + -1, -1, -1, 224, 225, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 240, - -1, 3275, -1, -1, -1, -1, -1, -1, -1, -1, - 3284, -1, -1, 3287, 3288, 3289, -1, -1, 3292, -1, - -1, 3295, 3296, -1, -1, -1, -1, -1, -1, -1, - 3304, -1, -1, -1, -1, 179, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 3382, 3383, -1, -1, -1, -1, -1, 3389, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 280, -1, -1, 283, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 196, -1, -1, -1, 297, 201, -1, -1, - -1, -1, -1, -1, -1, 512, -1, -1, 515, 516, - 517, -1, 519, 520, 521, 522, 523, 524, 3352, -1, - 224, 225, 529, -1, 3358, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 240, 3371, -1, -1, + -1, -1, -1, 3425, 3426, 3427, 297, -1, -1, 300, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 3451, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 3463, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 280, -1, -1, 283, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 297, 3428, 3429, 300, -1, -1, 400, - -1, 3435, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 3471, 3472, 3473, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 400, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 3497, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 3509, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 400, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 512, -1, -1, 515, 516, 517, -1, 519, 520, - 521, 522, 523, 524, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 3571, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 3581, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 3575, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 3585, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 3609, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 3613, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 3634, -1, -1, -1, -1, -1, -1, -1, 512, -1, - -1, 515, 516, 517, -1, 519, 520, 521, 522, 523, - 524, -1, -1, -1, -1, 529, -1, 3661, -1, -1, - 3, 4, 5, 6, 7, 8, 9, 10, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 3681, -1, -1, - 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, - 33, 34, -1, -1, -1, -1, -1, 40, -1, -1, - 43, 44, 45, -1, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, -1, -1, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, -1, 76, 77, 78, 79, 80, -1, 82, - 3744, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 3755, 95, 96, 97, 98, 99, 100, -1, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, -1, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - -1, -1, 135, 136, 137, 138, 139, -1, 141, 142, - 143, -1, 145, 146, 147, 148, -1, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, -1, 165, 166, 167, 168, -1, 170, -1, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - -1, 184, 185, 186, 187, -1, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, - 203, 204, 205, 206, 207, 208, -1, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, -1, 221, -1, - 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - 233, 234, -1, -1, 237, 238, 239, 240, -1, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, -1, - 293, 294, -1, -1, 297, 298, 299, -1, -1, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, -1, 325, 326, 327, 328, 329, 330, 331, 332, - 333, 334, -1, 336, 337, 338, 339, 340, 341, -1, - 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, - -1, 354, 355, 356, 357, 358, 359, 360, 361, 362, - 363, 364, 365, 366, -1, 368, 369, 370, 371, 372, - 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, - 383, 384, 385, 386, 387, 388, -1, 390, 391, 392, - 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, - 403, 404, -1, 406, 407, 408, 409, 410, 411, 412, - 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, - 423, -1, 425, 426, 427, 428, 429, 430, 431, 432, - 433, 434, 435, -1, 437, 438, 439, -1, -1, 442, - 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, - 453, 454, 455, -1, -1, 458, 459, 460, 461, 462, - 463, 464, 465, 466, -1, 468, 469, 470, 471, 472, - 473, 474, 475, -1, 477, 478, 479, 480, 481, 482, - 483, 484, 485, -1, -1, 488, -1, 490, 491, 492, - 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, - 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, - -1, 514, -1, -1, -1, -1, 519, 520, 521, -1, - -1, -1, -1, 526, -1, 528, 529, -1, -1, -1, - 533, 534, 535, 536, 3, 4, 5, 6, 7, 8, - 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, - 29, 30, -1, 32, 33, 34, -1, -1, -1, -1, - -1, 40, -1, -1, 43, 44, 45, -1, 47, 48, - 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - -1, -1, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 70, 71, 72, 73, 74, -1, 76, 77, 78, - 79, 80, -1, 82, -1, 84, 85, 86, 87, 88, - 89, 90, 91, 92, 93, -1, 95, 96, 97, 98, - 99, 100, -1, 102, 103, 104, 105, 106, 107, 108, - 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, - 119, -1, 121, 122, 123, 124, 125, 126, 127, 128, - 129, 130, 131, 132, -1, -1, 135, 136, 137, 138, - 139, -1, 141, 142, 143, -1, 145, 146, 147, 148, - -1, 150, 151, 152, 153, 154, 155, 156, 157, 158, - 159, 160, 161, 162, 163, -1, 165, 166, 167, 168, - -1, 170, -1, 172, 173, 174, 175, 176, 177, 178, - 179, 180, 181, 182, -1, 184, 185, 186, 187, -1, - 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, - 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, - -1, 210, 211, 212, 213, 214, 215, 216, 217, 218, - 219, -1, 221, -1, 223, 224, 225, 226, 227, 228, - 229, 230, 231, 232, 233, 234, -1, -1, 237, 238, - 239, 240, -1, 242, 243, 244, 245, 246, 247, 248, - 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, - 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, - 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, - 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, - 289, 290, 291, -1, 293, 294, -1, -1, 297, 298, - 299, -1, -1, 302, 303, 304, 305, 306, 307, 308, - 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, - 319, 320, 321, 322, 323, -1, 325, 326, 327, 328, - 329, 330, 331, 332, 333, 334, -1, 336, 337, 338, - 339, 340, 341, -1, 343, 344, 345, 346, 347, 348, - 349, 350, 351, 352, -1, 354, 355, 356, 357, 358, - 359, 360, 361, 362, 363, 364, 365, 366, -1, 368, - 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, - 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, - -1, 390, 391, 392, 393, 394, 395, 396, 397, 398, - 399, 400, 401, 402, 403, 404, -1, 406, 407, 408, - 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, - 419, 420, 421, 422, 423, -1, 425, 426, 427, 428, - 429, 430, 431, 432, 433, 434, 435, -1, 437, 438, - 439, -1, -1, 442, 443, 444, 445, 446, 447, 448, - 449, 450, 451, 452, 453, 454, 455, -1, -1, 458, - 459, 460, 461, 462, 463, 464, 465, 466, -1, 468, - 469, 470, 471, 472, 473, 474, 475, -1, 477, 478, - 479, 480, 481, 482, 483, 484, 485, -1, -1, 488, - -1, 490, 491, 492, 493, 494, 495, 496, 497, 498, - 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, - 509, 510, 511, 512, -1, 514, -1, -1, -1, -1, - 519, 520, 521, -1, -1, -1, -1, 526, -1, 528, - -1, -1, -1, -1, 533, 534, 535, 536, 3, 4, - 5, 6, 7, 8, 9, 10, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 3641, + -1, 512, -1, -1, 515, 516, 517, -1, 519, 520, + 521, 522, 523, 524, -1, -1, -1, -1, 529, -1, + -1, -1, -1, -1, -1, -1, 3668, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 3, 4, + 5, 6, 7, 8, 9, 10, 3688, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, -1, -1, -1, -1, -1, 40, -1, -1, 43, 44, 45, -1, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, -1, -1, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - -1, 76, 77, 78, 79, 80, -1, 82, -1, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, -1, + -1, 76, 77, 78, 79, 80, -1, 82, 3760, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 3771, 95, 96, 97, 98, 99, 100, -1, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, -1, 121, 122, 123, 124, - 125, 126, -1, -1, 129, 130, 131, 132, -1, -1, + 125, 126, 127, 128, 129, 130, 131, 132, -1, -1, 135, 136, 137, 138, 139, -1, 141, 142, 143, -1, 145, 146, 147, 148, -1, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, -1, @@ -13536,9 +13416,9 @@ static const yytype_int16 yycheck[] = 365, 366, -1, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, -1, 390, 391, 392, 393, 394, - 395, 396, 397, 398, -1, 400, 401, 402, 403, 404, + 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, -1, 406, 407, 408, 409, 410, 411, 412, 413, 414, - 415, 416, 417, 418, 419, 420, 421, 422, -1, -1, + 415, 416, 417, 418, 419, 420, 421, 422, 423, -1, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, -1, 437, 438, 439, -1, -1, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, @@ -13549,25 +13429,25 @@ static const yytype_int16 yycheck[] = 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, -1, 514, -1, -1, -1, -1, 519, 520, 521, -1, -1, -1, - -1, 526, -1, 528, -1, -1, -1, -1, 533, 534, + -1, 526, -1, 528, 529, -1, -1, -1, 533, 534, 535, 536, 3, 4, 5, 6, 7, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, -1, -1, -1, 38, -1, 40, + -1, 32, 33, 34, -1, -1, -1, -1, -1, 40, -1, -1, 43, 44, 45, -1, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, -1, 60, + 51, 52, 53, 54, 55, 56, 57, 58, -1, -1, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, -1, 76, 77, 78, 79, 80, -1, 82, -1, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, -1, 95, 96, 97, 98, 99, 100, -1, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, -1, - 121, 122, 123, 124, 125, 126, -1, -1, 129, 130, - 131, 132, 133, -1, 135, 136, 137, 138, 139, -1, + 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, + 131, 132, -1, -1, 135, 136, 137, 138, 139, -1, 141, 142, 143, -1, 145, 146, 147, 148, -1, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, -1, 165, 166, 167, 168, -1, 170, - -1, 172, 173, -1, 175, 176, 177, 178, 179, 180, + -1, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, -1, 184, 185, 186, 187, -1, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, -1, 210, @@ -13580,36 +13460,36 @@ static const yytype_int16 yycheck[] = 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, -1, 293, 294, -1, -1, 297, 298, 299, -1, - 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, + -1, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, - -1, -1, -1, -1, 325, 326, 327, 328, 329, 330, + 321, 322, 323, -1, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, -1, 336, 337, 338, 339, 340, 341, -1, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, -1, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, -1, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, - 381, 382, 383, 384, 385, 386, 387, -1, 389, 390, - 391, 392, 393, 394, 395, 396, 397, 398, -1, 400, + 381, 382, 383, 384, 385, 386, 387, 388, -1, 390, + 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, -1, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, - 421, 422, -1, -1, 425, 426, -1, 428, 429, 430, + 421, 422, 423, -1, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, -1, 437, 438, 439, -1, -1, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, -1, -1, 458, 459, 460, - 461, -1, 463, 464, 465, 466, -1, 468, 469, 470, - 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, - 481, 482, 483, 484, 485, -1, -1, 488, -1, -1, + 461, 462, 463, 464, 465, 466, -1, 468, 469, 470, + 471, 472, 473, 474, 475, -1, 477, 478, 479, 480, + 481, 482, 483, 484, 485, -1, -1, 488, -1, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, - 511, 512, -1, -1, -1, -1, -1, -1, 519, 520, - 521, -1, -1, -1, -1, 526, -1, 528, 529, -1, + 511, 512, -1, 514, -1, -1, -1, -1, 519, 520, + 521, -1, -1, -1, -1, 526, -1, 528, -1, -1, -1, -1, 533, 534, 535, 536, 3, 4, 5, 6, 7, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, -1, -1, -1, -1, -1, 40, -1, -1, 43, 44, 45, -1, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, -1, 61, 62, 63, 64, 65, 66, + 57, 58, -1, -1, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, -1, 76, 77, 78, 79, 80, -1, 82, -1, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, -1, 95, 96, @@ -13626,7 +13506,7 @@ static const yytype_int16 yycheck[] = 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, -1, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, -1, 221, -1, 223, 224, 225, 226, - 227, 228, 229, 230, 231, 232, 233, 234, -1, 236, + 227, 228, 229, 230, 231, 232, 233, 234, -1, -1, 237, 238, 239, 240, -1, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, @@ -13635,31 +13515,31 @@ static const yytype_int16 yycheck[] = 287, 288, 289, 290, 291, -1, 293, 294, -1, -1, 297, 298, 299, -1, -1, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, - 317, 318, 319, 320, -1, -1, -1, -1, 325, 326, + 317, 318, 319, 320, 321, 322, 323, -1, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, -1, 336, 337, 338, 339, 340, 341, -1, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, -1, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, -1, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, - 387, -1, -1, 390, 391, 392, 393, 394, 395, 396, + 387, 388, -1, 390, 391, 392, 393, 394, 395, 396, 397, 398, -1, 400, 401, 402, 403, 404, -1, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, -1, -1, 425, 426, - -1, 428, 429, 430, 431, 432, 433, 434, 435, -1, - 437, 438, 439, -1, 441, 442, 443, 444, 445, 446, + 427, 428, 429, 430, 431, 432, 433, 434, 435, -1, + 437, 438, 439, -1, -1, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, -1, - -1, 458, 459, 460, 461, -1, 463, 464, 465, 466, + -1, 458, 459, 460, 461, 462, 463, 464, 465, 466, -1, 468, 469, 470, 471, 472, 473, 474, 475, -1, 477, 478, 479, 480, 481, 482, 483, 484, 485, -1, - -1, 488, -1, -1, 491, 492, 493, 494, 495, 496, + -1, 488, -1, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, - 507, 508, 509, 510, 511, 512, -1, -1, -1, -1, + 507, 508, 509, 510, 511, 512, -1, 514, -1, -1, -1, -1, 519, 520, 521, -1, -1, -1, -1, 526, -1, 528, -1, -1, -1, -1, 533, 534, 535, 536, 3, 4, 5, 6, 7, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, -1, -1, -1, 38, -1, 40, -1, -1, 43, 44, 45, -1, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, -1, 60, 61, 62, @@ -13670,7 +13550,7 @@ static const yytype_int16 yycheck[] = 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, -1, 121, 122, 123, 124, 125, 126, -1, -1, 129, 130, 131, 132, - -1, -1, 135, 136, 137, 138, 139, -1, 141, 142, + 133, -1, 135, 136, 137, 138, 139, -1, 141, 142, 143, -1, 145, 146, 147, 148, -1, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, -1, 165, 166, 167, 168, -1, 170, -1, 172, @@ -13686,7 +13566,7 @@ static const yytype_int16 yycheck[] = 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, -1, - 293, 294, -1, -1, 297, 298, 299, -1, -1, 302, + 293, 294, -1, -1, 297, 298, 299, -1, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, -1, -1, -1, -1, 325, 326, 327, 328, 329, 330, 331, 332, @@ -13709,20 +13589,20 @@ static const yytype_int16 yycheck[] = 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, -1, -1, -1, -1, -1, -1, 519, 520, 521, -1, - -1, -1, -1, 526, -1, 528, -1, -1, -1, -1, - 533, 534, 535, 536, 3, 4, 5, 6, 7, -1, + -1, -1, -1, 526, -1, 528, 529, -1, -1, -1, + 533, 534, 535, 536, 3, 4, 5, 6, 7, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, -1, -1, -1, -1, -1, 40, -1, -1, 43, 44, 45, -1, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - -1, -1, 61, 62, 63, 64, 65, 66, 67, 68, + 59, -1, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, -1, 76, 77, 78, 79, 80, -1, 82, -1, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, -1, 95, 96, 97, 98, 99, 100, -1, 102, 103, 104, 105, 106, 107, 108, - 109, 110, 111, 112, 113, 114, 115, 116, 117, -1, - 119, -1, 121, 122, 123, 124, 125, 126, 127, 128, + 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, + 119, -1, 121, 122, 123, 124, 125, 126, -1, -1, 129, 130, 131, 132, -1, -1, 135, 136, 137, 138, 139, -1, 141, 142, 143, -1, 145, 146, 147, 148, -1, 150, 151, 152, 153, 154, 155, 156, 157, 158, @@ -13733,37 +13613,39 @@ static const yytype_int16 yycheck[] = 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, -1, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, -1, 221, -1, 223, 224, 225, 226, 227, 228, - 229, 230, -1, 232, 233, 234, -1, -1, 237, 238, + 229, 230, 231, 232, 233, 234, -1, 236, 237, 238, 239, 240, -1, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, - 279, -1, 281, 282, 283, 284, 285, 286, 287, 288, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, -1, 293, 294, -1, -1, 297, 298, 299, -1, -1, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, - 319, 320, 321, 322, 323, -1, 325, 326, 327, 328, + 319, 320, -1, -1, -1, -1, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, -1, 336, 337, 338, 339, 340, 341, -1, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, -1, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, -1, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, - 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, + 379, 380, 381, 382, 383, 384, 385, 386, 387, -1, -1, 390, 391, 392, 393, 394, 395, 396, 397, 398, - 399, 400, 401, 402, 403, 404, -1, 406, 407, 408, + -1, 400, 401, 402, 403, 404, -1, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, - 419, 420, 421, 422, 423, -1, 425, 426, 427, 428, + 419, 420, 421, 422, -1, -1, 425, 426, -1, 428, 429, 430, 431, 432, 433, 434, 435, -1, 437, 438, - 439, -1, -1, 442, 443, 444, 445, 446, 447, 448, + 439, -1, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, -1, -1, 458, - 459, 460, -1, 462, 463, 464, 465, 466, -1, 468, + 459, 460, 461, -1, 463, 464, 465, 466, -1, 468, 469, 470, 471, 472, 473, 474, 475, -1, 477, 478, 479, 480, 481, 482, 483, 484, 485, -1, -1, 488, - -1, 490, 491, 492, 493, 494, 495, 496, 497, 498, + -1, -1, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, - 509, 510, 511, -1, -1, 514, -1, -1, 3, 4, - 5, 6, 7, 8, 9, 10, -1, 526, -1, 528, - -1, -1, -1, -1, 533, 534, 535, 536, 23, 24, + 509, 510, 511, 512, -1, -1, -1, -1, -1, -1, + 519, 520, 521, -1, -1, -1, -1, 526, -1, 528, + -1, -1, -1, -1, 533, 534, 535, 536, 3, 4, + 5, 6, 7, 8, 9, 10, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, -1, -1, -1, 38, -1, 40, -1, -1, 43, 44, 45, -1, 47, 48, 49, 50, 51, 52, 53, 54, @@ -13809,72 +13691,70 @@ static const yytype_int16 yycheck[] = 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, -1, -1, 458, 459, 460, 461, -1, 463, 464, 465, 466, -1, 468, 469, 470, 471, 472, 473, 474, - 475, -1, 477, 478, 479, 480, 481, 482, 483, 484, + 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, -1, -1, 488, -1, -1, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, -1, -1, -1, -1, -1, -1, 519, 520, 521, -1, -1, -1, - -1, 526, -1, 528, 529, -1, -1, -1, 533, 534, - 535, 536, 3, 4, 5, 6, 7, 8, 9, 10, + -1, 526, -1, 528, -1, -1, -1, -1, 533, 534, + 535, 536, 3, 4, 5, 6, 7, -1, 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, - -1, 32, 33, 34, -1, -1, -1, 38, -1, 40, + -1, 32, 33, 34, -1, -1, -1, -1, -1, 40, -1, -1, 43, 44, 45, -1, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, -1, 60, + 51, 52, 53, 54, 55, 56, 57, 58, -1, -1, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, -1, 76, 77, 78, 79, 80, -1, 82, -1, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, -1, 95, 96, 97, 98, 99, 100, -1, 102, 103, 104, 105, 106, 107, 108, 109, 110, - 111, 112, 113, 114, 115, 116, 117, 118, 119, -1, - 121, 122, 123, 124, 125, 126, -1, -1, 129, 130, + 111, 112, 113, 114, 115, 116, 117, -1, 119, -1, + 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, -1, -1, 135, 136, 137, 138, 139, -1, 141, 142, 143, -1, 145, 146, 147, 148, -1, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, -1, 165, 166, 167, 168, -1, 170, - -1, 172, 173, -1, 175, 176, 177, 178, 179, 180, + -1, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, -1, 184, 185, 186, 187, -1, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, -1, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, -1, 221, -1, 223, 224, 225, 226, 227, 228, 229, 230, - 231, 232, 233, 234, -1, -1, 237, 238, 239, 240, + -1, 232, 233, 234, -1, -1, 237, 238, 239, 240, -1, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, - 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, + 271, 272, 273, 274, 275, 276, 277, 278, 279, -1, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, -1, 293, 294, -1, -1, 297, 298, 299, -1, -1, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, - -1, -1, -1, -1, 325, 326, 327, 328, 329, 330, + 321, 322, 323, -1, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, -1, 336, 337, 338, 339, 340, 341, -1, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, -1, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, -1, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, - 381, 382, 383, 384, 385, 386, 387, -1, 389, 390, - 391, 392, 393, 394, 395, 396, 397, 398, -1, 400, + 381, 382, 383, 384, 385, 386, 387, 388, -1, 390, + 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, -1, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, - 421, 422, -1, -1, 425, 426, -1, 428, 429, 430, + 421, 422, 423, -1, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, -1, 437, 438, 439, -1, -1, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, -1, -1, 458, 459, 460, - 461, -1, 463, 464, 465, 466, -1, 468, 469, 470, + -1, 462, 463, 464, 465, 466, -1, 468, 469, 470, 471, 472, 473, 474, 475, -1, 477, 478, 479, 480, - 481, 482, 483, 484, 485, -1, -1, 488, -1, -1, + 481, 482, 483, 484, 485, -1, -1, 488, -1, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, - 511, 512, -1, -1, -1, -1, -1, -1, 519, 520, - 521, -1, -1, -1, -1, 526, -1, 528, -1, -1, - -1, -1, 533, 534, 535, 536, 3, 4, 5, 6, - 7, 8, 9, 10, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, -1, -1, - -1, -1, 39, 40, -1, -1, 43, 44, 45, -1, + 511, -1, -1, 514, -1, -1, 3, 4, 5, 6, + 7, 8, 9, 10, -1, 526, -1, 528, -1, -1, + -1, -1, 533, 534, 535, 536, 23, 24, 25, 26, + 27, 28, 29, 30, -1, 32, 33, 34, -1, -1, + -1, 38, -1, 40, -1, -1, 43, 44, 45, -1, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, -1, -1, 61, 62, 63, 64, 65, 66, + 57, 58, -1, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, -1, 76, 77, 78, 79, 80, -1, 82, -1, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, -1, 95, 96, @@ -13907,8 +13787,8 @@ static const yytype_int16 yycheck[] = 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, -1, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, - 387, -1, -1, 390, 391, 392, 393, 394, 395, 396, - 397, 398, -1, 400, 401, 402, 403, 404, 405, 406, + 387, -1, 389, 390, 391, 392, 393, 394, 395, 396, + 397, 398, -1, 400, 401, 402, 403, 404, -1, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, -1, -1, 425, 426, -1, 428, 429, 430, 431, 432, 433, 434, 435, -1, @@ -13921,13 +13801,13 @@ static const yytype_int16 yycheck[] = 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, -1, -1, -1, -1, -1, -1, 519, 520, 521, -1, -1, -1, -1, 526, - -1, 528, -1, -1, -1, -1, 533, 534, 535, 536, + -1, 528, 529, -1, -1, -1, 533, 534, 535, 536, 3, 4, 5, 6, 7, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, -1, -1, -1, -1, -1, 40, -1, -1, + 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, + 33, 34, -1, -1, -1, 38, -1, 40, -1, -1, 43, 44, 45, -1, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, -1, -1, 61, 62, + 53, 54, 55, 56, 57, 58, -1, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, -1, 76, 77, 78, 79, 80, -1, 82, -1, 84, 85, 86, 87, 88, 89, 90, 91, 92, @@ -13960,7 +13840,7 @@ static const yytype_int16 yycheck[] = -1, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, -1, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, - 383, 384, 385, 386, 387, -1, -1, 390, 391, 392, + 383, 384, 385, 386, 387, -1, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, -1, 400, 401, 402, 403, 404, -1, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, @@ -13979,7 +13859,7 @@ static const yytype_int16 yycheck[] = 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, - -1, 40, -1, -1, 43, 44, 45, -1, 47, 48, + 39, 40, -1, -1, 43, 44, 45, -1, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, -1, -1, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, -1, 76, 77, 78, @@ -14015,7 +13895,7 @@ static const yytype_int16 yycheck[] = 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, -1, -1, 390, 391, 392, 393, 394, 395, 396, 397, 398, - -1, 400, 401, 402, 403, 404, -1, 406, 407, 408, + -1, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, -1, -1, 425, 426, -1, 428, 429, 430, 431, 432, 433, 434, 435, -1, 437, 438, @@ -14031,7 +13911,7 @@ static const yytype_int16 yycheck[] = -1, -1, -1, -1, 533, 534, 535, 536, 3, 4, 5, 6, 7, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, 24, - 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, 40, -1, -1, 43, 44, 45, -1, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, -1, -1, 61, 62, 63, 64, @@ -14045,7 +13925,7 @@ static const yytype_int16 yycheck[] = 135, 136, 137, 138, 139, -1, 141, 142, 143, -1, 145, 146, 147, 148, -1, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, -1, - 165, 166, 167, 168, -1, 170, -1, 172, 173, 174, + 165, 166, 167, 168, -1, 170, -1, 172, 173, -1, 175, 176, 177, 178, 179, 180, 181, 182, -1, 184, 185, 186, 187, -1, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, @@ -14085,7 +13965,7 @@ static const yytype_int16 yycheck[] = 535, 536, 3, 4, 5, 6, 7, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, - -1, 32, 33, 34, -1, -1, -1, -1, -1, 40, + 31, 32, 33, 34, -1, -1, -1, -1, -1, 40, -1, -1, 43, 44, 45, -1, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, -1, -1, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, @@ -14134,10 +14014,10 @@ static const yytype_int16 yycheck[] = 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, -1, -1, -1, -1, -1, -1, 519, 520, - 521, -1, -1, -1, -1, 526, -1, 528, 529, -1, + 521, -1, -1, -1, -1, 526, -1, 528, -1, -1, -1, -1, 533, 534, 535, 536, 3, 4, 5, 6, 7, 8, 9, 10, -1, -1, -1, -1, -1, -1, - -1, -1, 19, -1, -1, -1, 23, 24, 25, 26, + -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, -1, -1, -1, -1, -1, 40, -1, -1, 43, 44, 45, -1, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, @@ -14152,7 +14032,7 @@ static const yytype_int16 yycheck[] = 137, 138, 139, -1, 141, 142, 143, -1, 145, 146, 147, 148, -1, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, -1, 165, 166, - 167, 168, -1, 170, -1, 172, 173, -1, 175, 176, + 167, 168, -1, 170, -1, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, -1, 184, 185, 186, 187, -1, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, @@ -14231,7 +14111,7 @@ static const yytype_int16 yycheck[] = 393, 394, 395, 396, 397, 398, -1, 400, 401, 402, 403, 404, -1, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, - -1, -1, 425, 426, 427, 428, 429, 430, 431, 432, + -1, -1, 425, 426, -1, 428, 429, 430, 431, 432, 433, 434, 435, -1, 437, 438, 439, -1, -1, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, -1, -1, 458, 459, 460, 461, -1, @@ -14241,10 +14121,10 @@ static const yytype_int16 yycheck[] = 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, -1, -1, -1, -1, -1, -1, 519, 520, 521, -1, - -1, -1, -1, 526, -1, 528, -1, -1, -1, -1, + -1, -1, -1, 526, -1, 528, 529, -1, -1, -1, 533, 534, 535, 536, 3, 4, 5, 6, 7, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, + 19, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, -1, -1, -1, -1, -1, 40, -1, -1, 43, 44, 45, -1, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, @@ -14290,7 +14170,7 @@ static const yytype_int16 yycheck[] = 449, 450, 451, 452, 453, 454, 455, -1, -1, 458, 459, 460, 461, -1, 463, 464, 465, 466, -1, 468, 469, 470, 471, 472, 473, 474, 475, -1, 477, 478, - 479, 480, 481, 482, 483, 484, 485, -1, 487, 488, + 479, 480, 481, 482, 483, 484, 485, -1, -1, 488, -1, -1, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, -1, -1, -1, -1, -1, -1, @@ -14298,7 +14178,7 @@ static const yytype_int16 yycheck[] = -1, -1, -1, -1, 533, 534, 535, 536, 3, 4, 5, 6, 7, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, -1, -1, -1, -1, -1, 40, -1, -1, 43, 44, 45, -1, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, -1, -1, 61, 62, 63, 64, @@ -14338,7 +14218,7 @@ static const yytype_int16 yycheck[] = 395, 396, 397, 398, -1, 400, 401, 402, 403, 404, -1, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, -1, -1, - 425, 426, -1, 428, 429, 430, 431, 432, 433, 434, + 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, -1, 437, 438, 439, -1, -1, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, -1, -1, 458, 459, 460, 461, -1, 463, 464, @@ -14350,7 +14230,7 @@ static const yytype_int16 yycheck[] = -1, -1, -1, -1, 519, 520, 521, -1, -1, -1, -1, 526, -1, 528, -1, -1, -1, -1, 533, 534, 535, 536, 3, 4, 5, 6, 7, 8, 9, 10, - -1, -1, -1, -1, -1, -1, -1, -1, 19, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, -1, -1, -1, -1, -1, 40, -1, -1, 43, 44, 45, -1, 47, 48, 49, 50, @@ -14397,7 +14277,7 @@ static const yytype_int16 yycheck[] = 451, 452, 453, 454, 455, -1, -1, 458, 459, 460, 461, -1, 463, 464, 465, 466, -1, 468, 469, 470, 471, 472, 473, 474, 475, -1, 477, 478, 479, 480, - 481, 482, 483, 484, 485, -1, -1, 488, -1, -1, + 481, 482, 483, 484, 485, -1, 487, 488, -1, -1, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, -1, -1, -1, -1, -1, -1, 519, 520, @@ -14405,7 +14285,7 @@ static const yytype_int16 yycheck[] = -1, -1, 533, 534, 535, 536, 3, 4, 5, 6, 7, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, - 27, 28, 29, 30, -1, 32, 33, 34, -1, -1, + 27, 28, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, 40, -1, -1, 43, 44, 45, -1, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, -1, -1, 61, 62, 63, 64, 65, 66, @@ -14457,7 +14337,7 @@ static const yytype_int16 yycheck[] = -1, -1, 519, 520, 521, -1, -1, -1, -1, 526, -1, 528, -1, -1, -1, -1, 533, 534, 535, 536, 3, 4, 5, 6, 7, 8, 9, 10, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 19, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, -1, -1, -1, -1, -1, 40, -1, -1, 43, 44, 45, -1, 47, 48, 49, 50, 51, 52, @@ -14905,13 +14785,13 @@ static const yytype_int16 yycheck[] = 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, -1, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, -1, - 221, -1, 223, -1, -1, 226, 227, 228, 229, 230, + 221, -1, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, -1, -1, 237, 238, 239, 240, -1, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, - 271, 272, 273, 274, 275, 276, 277, 278, 279, -1, - 281, 282, -1, 284, 285, 286, 287, 288, 289, 290, + 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, + 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, -1, 293, 294, -1, -1, 297, 298, 299, -1, -1, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, @@ -14948,7 +14828,7 @@ static const yytype_int16 yycheck[] = 87, 88, 89, 90, 91, 92, 93, -1, 95, 96, 97, 98, 99, 100, -1, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, - 117, -1, 119, -1, 121, 122, 123, 124, 125, 126, + 117, 118, 119, -1, 121, 122, 123, 124, 125, 126, -1, -1, 129, 130, 131, 132, -1, -1, 135, 136, 137, 138, 139, -1, 141, 142, 143, -1, 145, 146, 147, 148, -1, 150, 151, 152, 153, 154, 155, 156, @@ -14959,12 +14839,12 @@ static const yytype_int16 yycheck[] = 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, -1, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, -1, 221, -1, 223, 224, 225, 226, - 227, 228, 229, 230, -1, 232, 233, 234, -1, -1, + 227, 228, 229, 230, 231, 232, 233, 234, -1, -1, 237, 238, 239, 240, -1, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, - 277, 278, 279, -1, 281, 282, 283, 284, 285, 286, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, -1, 293, 294, -1, -1, 297, 298, 299, -1, -1, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, @@ -14982,15 +14862,15 @@ static const yytype_int16 yycheck[] = -1, 428, 429, 430, 431, 432, 433, 434, 435, -1, 437, 438, 439, -1, -1, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, -1, - -1, 458, 459, 460, -1, -1, 463, 464, 465, 466, + -1, 458, 459, 460, 461, -1, 463, 464, 465, 466, -1, 468, 469, 470, 471, 472, 473, 474, 475, -1, 477, 478, 479, 480, 481, 482, 483, 484, 485, -1, -1, 488, -1, -1, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, - 507, 508, 509, 510, 511, -1, -1, -1, -1, -1, - -1, -1, 519, 520, -1, -1, -1, -1, -1, 526, + 507, 508, 509, 510, 511, 512, -1, -1, -1, -1, + -1, -1, 519, 520, 521, -1, -1, -1, -1, 526, -1, 528, -1, -1, -1, -1, 533, 534, 535, 536, - 3, 4, 5, 6, 7, -1, 9, 10, -1, -1, + 3, 4, 5, 6, 7, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, -1, -1, -1, -1, -1, 40, -1, -1, @@ -15001,7 +14881,7 @@ static const yytype_int16 yycheck[] = -1, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, -1, 95, 96, 97, 98, 99, 100, -1, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, -1, 119, -1, 121, 122, + 113, 114, 115, 116, 117, 118, 119, -1, 121, 122, 123, 124, 125, 126, -1, -1, 129, 130, 131, 132, -1, -1, 135, 136, 137, 138, 139, -1, 141, 142, 143, -1, 145, 146, 147, 148, -1, 150, 151, 152, @@ -15012,13 +14892,13 @@ static const yytype_int16 yycheck[] = 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, -1, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, -1, 221, -1, - 223, 224, 225, 226, 227, 228, 229, 230, -1, 232, + 223, -1, -1, 226, 227, 228, 229, 230, 231, 232, 233, 234, -1, -1, 237, 238, 239, 240, -1, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, -1, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, -1, + -1, 284, 285, 286, 287, 288, 289, 290, 291, -1, 293, 294, -1, -1, 297, 298, 299, -1, -1, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, -1, -1, @@ -15035,13 +14915,13 @@ static const yytype_int16 yycheck[] = -1, -1, 425, 426, -1, 428, 429, 430, 431, 432, 433, 434, 435, -1, 437, 438, 439, -1, -1, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, - 453, 454, 455, -1, -1, 458, 459, 460, -1, -1, + 453, 454, 455, -1, -1, 458, 459, 460, 461, -1, 463, 464, 465, 466, -1, 468, 469, 470, 471, 472, 473, 474, 475, -1, 477, 478, 479, 480, 481, 482, 483, 484, 485, -1, -1, 488, -1, -1, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, - 503, 504, 505, 506, 507, 508, 509, 510, 511, -1, - -1, -1, -1, -1, -1, -1, 519, 520, -1, -1, + 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, + -1, -1, -1, -1, -1, -1, 519, 520, 521, -1, -1, -1, -1, 526, -1, 528, -1, -1, -1, -1, 533, 534, 535, 536, 3, 4, 5, 6, 7, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, @@ -15065,7 +14945,7 @@ static const yytype_int16 yycheck[] = 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, -1, 210, 211, 212, 213, 214, 215, 216, 217, 218, - 219, -1, 221, -1, 223, -1, 225, 226, 227, 228, + 219, -1, 221, -1, 223, 224, 225, 226, 227, 228, 229, 230, -1, 232, 233, 234, -1, -1, 237, 238, 239, 240, -1, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, @@ -15114,7 +14994,7 @@ static const yytype_int16 yycheck[] = 145, 146, 147, 148, -1, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, -1, 165, 166, 167, 168, -1, 170, -1, 172, 173, -1, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, + 175, 176, 177, 178, 179, 180, 181, 182, -1, 184, 185, 186, 187, -1, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, -1, 210, 211, 212, 213, 214, @@ -15148,9 +15028,11 @@ static const yytype_int16 yycheck[] = 485, -1, -1, 488, -1, -1, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, -1, -1, -1, - -1, -1, 3, 4, 5, 6, 7, -1, 9, 10, + -1, -1, -1, -1, 519, 520, -1, -1, -1, -1, -1, 526, -1, 528, -1, -1, -1, -1, 533, 534, - 535, 536, 23, 24, 25, 26, 27, 28, 29, 30, + 535, 536, 3, 4, 5, 6, 7, 8, 9, 10, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, -1, -1, -1, -1, -1, 40, -1, -1, 43, 44, 45, -1, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, -1, -1, @@ -15170,7 +15052,7 @@ static const yytype_int16 yycheck[] = 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, -1, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, -1, - 221, -1, 223, 224, 225, 226, 227, 228, 229, 230, + 221, -1, 223, -1, 225, 226, 227, 228, 229, 230, -1, 232, 233, 234, -1, -1, 237, 238, 239, 240, -1, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, @@ -15199,9 +15081,11 @@ static const yytype_int16 yycheck[] = 481, 482, 483, 484, 485, -1, -1, 488, -1, -1, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, - 511, -1, -1, -1, -1, -1, 3, 4, 5, 6, - 7, -1, 9, 10, -1, 526, -1, 528, -1, -1, - -1, -1, 533, 534, 535, 536, 23, 24, 25, 26, + 511, -1, -1, -1, -1, -1, -1, -1, 519, 520, + -1, -1, -1, -1, -1, 526, -1, 528, -1, -1, + -1, -1, 533, 534, 535, 536, 3, 4, 5, 6, + 7, -1, 9, 10, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, -1, -1, -1, -1, -1, 40, -1, -1, 43, 44, 45, -1, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, @@ -15217,7 +15101,7 @@ static const yytype_int16 yycheck[] = 147, 148, -1, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, -1, 165, 166, 167, 168, -1, 170, -1, 172, 173, -1, 175, 176, - 177, 178, 179, 180, 181, 182, -1, 184, 185, 186, + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, -1, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, -1, 210, 211, 212, 213, 214, 215, 216, @@ -15251,35 +15135,35 @@ static const yytype_int16 yycheck[] = -1, 488, -1, -1, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, -1, -1, -1, -1, -1, - 3, 4, 5, 6, 7, 8, 9, 10, -1, 526, + 3, 4, 5, 6, 7, -1, 9, 10, -1, 526, -1, 528, -1, -1, -1, -1, 533, 534, 535, 536, 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, -1, -1, -1, -1, -1, 40, -1, -1, 43, 44, 45, -1, 47, 48, 49, 50, 51, 52, - 53, -1, 55, 56, 57, 58, -1, -1, 61, 62, + 53, 54, 55, 56, 57, 58, -1, -1, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, -1, 76, 77, 78, 79, 80, -1, 82, -1, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, -1, 95, 96, 97, 98, 99, 100, -1, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 119, -1, 121, 122, + 113, 114, 115, 116, 117, -1, 119, -1, 121, 122, 123, 124, 125, 126, -1, -1, 129, 130, 131, 132, -1, -1, 135, 136, 137, 138, 139, -1, 141, 142, - 143, -1, 145, 146, -1, 148, -1, 150, 151, 152, + 143, -1, 145, 146, 147, 148, -1, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, -1, 165, 166, 167, 168, -1, 170, -1, 172, - 173, -1, 175, 176, 177, 178, -1, 180, 181, 182, + 173, -1, 175, 176, 177, 178, 179, 180, 181, 182, -1, 184, 185, 186, 187, -1, 189, 190, 191, 192, - 193, 194, 195, -1, 197, 198, 199, 200, -1, 202, + 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, -1, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, -1, 221, -1, - 223, -1, -1, 226, 227, 228, 229, 230, 231, 232, - 233, 234, -1, -1, 237, 238, 239, -1, -1, 242, + 223, 224, 225, 226, 227, 228, 229, 230, -1, 232, + 233, 234, -1, -1, 237, 238, 239, 240, -1, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, -1, 281, 282, - -1, 284, 285, 286, 287, 288, 289, 290, 291, -1, + 283, 284, 285, 286, 287, 288, 289, 290, 291, -1, 293, 294, -1, -1, 297, 298, 299, -1, -1, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, -1, -1, @@ -15290,20 +15174,20 @@ static const yytype_int16 yycheck[] = 363, 364, 365, 366, -1, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, -1, -1, 390, 391, 392, - 393, 394, 395, 396, 397, 398, -1, -1, 401, 402, + 393, 394, 395, 396, 397, 398, -1, 400, 401, 402, 403, 404, -1, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, -1, -1, 425, 426, -1, 428, 429, 430, 431, 432, 433, 434, 435, -1, 437, 438, 439, -1, -1, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, - 453, 454, 455, -1, -1, 458, 459, 460, 461, -1, + 453, 454, 455, -1, -1, 458, 459, 460, -1, -1, 463, 464, 465, 466, -1, 468, 469, 470, 471, 472, 473, 474, 475, -1, 477, 478, 479, 480, 481, 482, 483, 484, 485, -1, -1, 488, -1, -1, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, -1, - -1, -1, -1, -1, 3, -1, 519, 520, 521, -1, - -1, 10, -1, 526, -1, 528, -1, -1, -1, -1, + -1, -1, -1, -1, 3, 4, 5, 6, 7, -1, + 9, 10, -1, 526, -1, 528, -1, -1, -1, -1, 533, 534, 535, 536, 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, -1, -1, -1, -1, -1, 40, -1, -1, 43, 44, 45, -1, 47, 48, @@ -15318,7 +15202,7 @@ static const yytype_int16 yycheck[] = 129, 130, 131, 132, -1, -1, 135, 136, 137, 138, 139, -1, 141, 142, 143, -1, 145, 146, 147, 148, -1, 150, 151, 152, 153, 154, 155, 156, 157, 158, - 159, 160, 161, -1, 163, -1, 165, 166, 167, 168, + 159, 160, 161, 162, 163, -1, 165, 166, 167, 168, -1, 170, -1, 172, 173, -1, 175, 176, 177, 178, 179, 180, 181, 182, -1, 184, 185, 186, 187, -1, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, @@ -15330,488 +15214,489 @@ static const yytype_int16 yycheck[] = 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, - 279, -1, 281, 282, 283, 284, -1, 286, 287, 288, + 279, -1, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, -1, 293, 294, -1, -1, 297, 298, - 299, -1, -1, 302, 303, 304, 305, 306, 307, 308, - 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, - 319, 320, -1, -1, -1, -1, 325, 326, 327, 328, - 329, 330, 331, 332, 333, 334, -1, 336, 337, 338, - 339, 340, 341, -1, 343, 344, 345, 346, 347, 348, - 349, 350, 351, 352, -1, 354, 355, 356, 357, 358, - 359, 360, 361, 362, 363, 364, 365, 366, -1, 368, - 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, - 379, 380, 381, 382, 383, 384, 385, 386, 387, -1, - -1, 390, 391, 392, 393, 394, 395, 396, 397, 398, - -1, 400, 401, 402, 403, 404, -1, 406, 407, 408, - 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, - 419, 420, 421, 422, -1, -1, 425, 426, -1, 428, - 429, 430, 431, 432, 433, 434, 435, -1, 437, 438, - 439, -1, -1, 442, 443, 444, 445, 446, -1, 448, - 449, 450, 451, 452, 453, 454, 455, -1, -1, 458, - 459, 460, -1, -1, 463, 464, 465, 466, -1, 468, - 469, 470, 471, 472, 473, 474, 475, -1, 477, 478, - 479, 480, 481, 482, 483, 484, 485, -1, -1, 488, - -1, -1, 491, 492, 493, 494, 495, 496, 497, 498, - 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, - 509, 510, 511, -1, -1, -1, -1, -1, 3, 4, - -1, -1, -1, -1, 9, 10, -1, 526, -1, 528, - -1, -1, -1, -1, 533, 534, 535, 536, 23, 24, - 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, - 45, -1, -1, 48, 49, -1, 51, 52, 53, 54, - 55, -1, 57, 58, -1, -1, 61, 62, 63, 64, - 65, -1, -1, 68, 69, 70, 71, 72, 73, 74, - -1, 76, 77, 78, 79, 80, -1, -1, -1, 84, - 85, 86, 87, 88, 89, -1, 91, 92, 93, -1, - 95, 96, 97, 98, 99, 100, -1, -1, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, -1, 119, -1, 121, 122, 123, 124, - 125, 126, -1, -1, 129, 130, 131, 132, -1, -1, - 135, 136, 137, 138, 139, -1, 141, 142, 143, -1, - 145, 146, 147, 148, -1, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, -1, 163, -1, - 165, 166, 167, 168, -1, 170, -1, 172, -1, -1, - -1, 176, 177, 178, -1, 180, 181, 182, -1, 184, - 185, 186, 187, -1, 189, 190, 191, 192, 193, 194, - 195, -1, 197, 198, 199, 200, -1, 202, 203, 204, - 205, 206, 207, 208, -1, 210, -1, 212, 213, 214, - 215, 216, 217, 218, 219, -1, 221, -1, 223, -1, - -1, 226, -1, 228, 229, 230, -1, 232, 233, 234, - -1, -1, 237, -1, 239, -1, -1, 242, 243, 244, - 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, -1, - 275, 276, 277, 278, 279, -1, 281, 282, -1, 284, - -1, 286, 287, 288, 289, 290, 291, -1, 293, 294, - -1, -1, 297, 298, 299, -1, -1, 302, 303, 304, - -1, 306, -1, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, -1, -1, -1, -1, - 325, 326, 327, -1, 329, 330, 331, 332, 333, 334, - -1, 336, 337, 338, 339, 340, 341, -1, 343, 344, - 345, 346, 347, 348, 349, 350, 351, 352, -1, 354, - 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, - 365, 366, -1, 368, 369, -1, 371, 372, 373, 374, - 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, - 385, 386, 387, -1, -1, 390, 391, 392, 393, 394, - 395, 396, 397, 398, -1, -1, 401, 402, 403, 404, - -1, 406, 407, 408, 409, 410, 411, 412, 413, 414, - 415, 416, 417, 418, 419, 420, 421, 422, -1, -1, - 425, 426, -1, 428, -1, 430, 431, 432, 433, 434, - 435, -1, 437, 438, 439, -1, -1, 442, 443, 444, - 445, 446, -1, 448, 449, 450, 451, 452, 453, 454, - 455, -1, -1, 458, 459, 460, -1, -1, 463, 464, - 465, 466, -1, 468, 469, 470, 471, 472, 473, 474, - 475, -1, 477, -1, 479, 480, 481, 482, 483, 484, - 485, -1, -1, 488, -1, -1, 491, 492, 493, 494, - 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, - 505, 506, 507, 508, 509, 510, 511, -1, -1, -1, - 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 533, 534, - 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, - 33, 34, -1, -1, -1, -1, -1, -1, 41, -1, - -1, 44, 45, -1, -1, 48, 49, -1, 51, 52, - 53, 54, 55, -1, 57, 58, -1, -1, 61, 62, - 63, 64, 65, -1, -1, 68, 69, 70, 71, 72, - 73, 74, -1, 76, 77, 78, 79, 80, -1, -1, - -1, 84, 85, 86, 87, 88, 89, -1, 91, 92, - 93, -1, 95, 96, 97, 98, 99, 100, -1, -1, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, -1, 119, -1, 121, 122, - 123, 124, 125, 126, -1, -1, 129, 130, 131, 132, - -1, -1, 135, 136, 137, 138, 139, -1, 141, 142, - 143, -1, 145, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, -1, - 163, 164, 165, 166, 167, 168, 169, 170, -1, 172, - -1, -1, -1, 176, 177, 178, -1, 180, 181, 182, - -1, 184, 185, 186, 187, -1, 189, 190, 191, 192, - 193, 194, 195, -1, 197, 198, 199, 200, -1, 202, - 203, 204, 205, 206, 207, 208, -1, 210, -1, 212, - 213, 214, 215, 216, 217, 218, 219, 220, 221, -1, - 223, -1, -1, 226, -1, 228, 229, 230, -1, 232, - 233, 234, -1, -1, 237, -1, 239, -1, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, -1, 275, 276, 277, 278, 279, -1, 281, 282, - -1, 284, -1, 286, 287, 288, 289, 290, 291, 292, - 293, 294, -1, -1, 297, 298, 299, -1, 301, 302, - 303, 304, -1, 306, -1, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, -1, -1, - -1, -1, 325, 326, 327, -1, 329, 330, 331, 332, - 333, 334, -1, 336, 337, 338, 339, 340, 341, -1, - 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, - -1, 354, 355, 356, 357, 358, 359, 360, 361, 362, - 363, 364, 365, 366, -1, 368, 369, -1, 371, 372, - 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, - 383, 384, 385, 386, 387, -1, -1, 390, 391, 392, - 393, 394, 395, 396, 397, 398, -1, -1, 401, 402, - 403, 404, -1, 406, 407, 408, 409, 410, 411, 412, - 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, - -1, -1, 425, 426, -1, 428, -1, 430, 431, 432, - 433, 434, 435, -1, 437, 438, 439, -1, -1, 442, - 443, 444, 445, 446, -1, 448, 449, 450, 451, 452, - 453, 454, 455, 456, -1, 458, 459, 460, -1, -1, - 463, 464, 465, 466, -1, 468, 469, 470, 471, 472, - 473, 474, 475, -1, 477, -1, 479, 480, 481, 482, - 483, 484, 485, -1, -1, 488, -1, -1, 491, 492, - 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, - 503, 504, 505, 506, 507, 508, 509, 510, 511, 3, - -1, 5, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 529, -1, -1, 23, - 24, 25, 26, 27, 28, 29, 30, -1, 32, 33, - 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 44, 45, -1, -1, 48, 49, -1, 51, 52, 53, - 54, 55, -1, 57, 58, -1, -1, 61, 62, 63, - 64, 65, -1, -1, 68, 69, 70, 71, 72, 73, - 74, -1, 76, 77, 78, 79, 80, -1, -1, -1, - 84, 85, 86, 87, 88, 89, -1, 91, 92, 93, - -1, 95, 96, 97, 98, 99, 100, -1, -1, 103, - 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, - 114, 115, 116, 117, -1, 119, -1, 121, 122, 123, - 124, 125, 126, -1, -1, 129, 130, 131, 132, -1, - -1, 135, 136, 137, 138, 139, -1, 141, 142, 143, - -1, 145, 146, 147, 148, -1, 150, 151, 152, 153, - 154, 155, 156, 157, 158, 159, 160, 161, -1, 163, - -1, 165, 166, 167, 168, -1, 170, -1, 172, -1, - -1, -1, 176, 177, 178, -1, 180, 181, 182, -1, - 184, 185, 186, 187, -1, 189, 190, 191, 192, 193, - 194, 195, -1, 197, 198, 199, 200, -1, 202, 203, - 204, 205, 206, 207, 208, -1, 210, -1, 212, 213, - 214, 215, 216, 217, 218, 219, -1, 221, -1, 223, - -1, -1, 226, -1, 228, 229, 230, -1, 232, 233, - 234, -1, -1, 237, -1, 239, -1, -1, 242, 243, - 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, - 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, - 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, - -1, 275, 276, 277, 278, 279, -1, 281, 282, -1, - 284, -1, 286, 287, 288, 289, 290, 291, -1, 293, - 294, -1, -1, 297, 298, 299, -1, -1, 302, 303, - 304, -1, 306, -1, 308, 309, 310, 311, 312, 313, - 314, 315, 316, 317, 318, 319, 320, -1, -1, -1, - -1, 325, 326, 327, -1, 329, 330, 331, 332, 333, - 334, -1, 336, 337, 338, 339, 340, 341, -1, 343, - 344, 345, 346, 347, 348, 349, 350, 351, 352, -1, - 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, - 364, 365, 366, -1, 368, 369, -1, 371, 372, 373, - 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, - 384, 385, 386, 387, -1, -1, 390, 391, 392, 393, - 394, 395, 396, 397, 398, -1, -1, 401, 402, 403, - 404, -1, 406, 407, 408, 409, 410, 411, 412, 413, - 414, 415, 416, 417, 418, 419, 420, 421, 422, -1, - -1, 425, 426, -1, 428, -1, 430, 431, 432, 433, - 434, 435, -1, 437, 438, 439, -1, -1, 442, 443, - 444, 445, 446, -1, 448, 449, 450, 451, 452, 453, - 454, 455, -1, -1, 458, 459, 460, -1, -1, 463, - 464, 465, 466, -1, 468, 469, 470, 471, 472, 473, - 474, 475, -1, 477, -1, 479, 480, 481, 482, 483, - 484, 485, -1, -1, 488, -1, -1, 491, 492, 493, - 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, - 504, 505, 506, 507, 508, 509, 510, 511, 3, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 528, 529, -1, -1, 23, 24, + 299, -1, -1, 302, 303, 304, 305, 306, 307, 308, + 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, + 319, 320, -1, -1, -1, -1, 325, 326, 327, 328, + 329, 330, 331, 332, 333, 334, -1, 336, 337, 338, + 339, 340, 341, -1, 343, 344, 345, 346, 347, 348, + 349, 350, 351, 352, -1, 354, 355, 356, 357, 358, + 359, 360, 361, 362, 363, 364, 365, 366, -1, 368, + 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, + 379, 380, 381, 382, 383, 384, 385, 386, 387, -1, + -1, 390, 391, 392, 393, 394, 395, 396, 397, 398, + -1, 400, 401, 402, 403, 404, -1, 406, 407, 408, + 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, + 419, 420, 421, 422, -1, -1, 425, 426, -1, 428, + 429, 430, 431, 432, 433, 434, 435, -1, 437, 438, + 439, -1, -1, 442, 443, 444, 445, 446, 447, 448, + 449, 450, 451, 452, 453, 454, 455, -1, -1, 458, + 459, 460, -1, -1, 463, 464, 465, 466, -1, 468, + 469, 470, 471, 472, 473, 474, 475, -1, 477, 478, + 479, 480, 481, 482, 483, 484, 485, -1, -1, 488, + -1, -1, 491, 492, 493, 494, 495, 496, 497, 498, + 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, + 509, 510, 511, -1, -1, -1, -1, -1, 3, 4, + 5, 6, 7, 8, 9, 10, -1, 526, -1, 528, + -1, -1, -1, -1, 533, 534, 535, 536, 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, - -1, -1, -1, 38, -1, -1, -1, -1, 43, 44, + -1, -1, -1, -1, -1, 40, -1, -1, 43, 44, 45, -1, 47, 48, 49, 50, 51, 52, 53, -1, - -1, 56, -1, -1, -1, 60, 61, 62, 63, 64, - 65, -1, -1, 68, 69, 70, 71, -1, -1, 74, - -1, 76, 77, 78, 79, -1, -1, 82, -1, 84, + 55, 56, 57, 58, -1, -1, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + -1, 76, 77, 78, 79, 80, -1, 82, -1, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, -1, 95, 96, 97, 98, 99, 100, -1, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, -1, 114, - 115, -1, 117, -1, 119, -1, 121, 122, 123, 124, + 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, + 115, 116, 117, 118, 119, -1, 121, 122, 123, 124, 125, 126, -1, -1, 129, 130, 131, 132, -1, -1, 135, 136, 137, 138, 139, -1, 141, 142, 143, -1, - 145, 146, 147, 148, -1, 150, 151, 152, 153, -1, - 155, 156, 157, 158, 159, 160, -1, -1, 163, -1, - 165, 166, -1, 168, -1, 170, -1, 172, 173, -1, - 175, 176, 177, 178, 179, 180, 181, 182, -1, -1, - -1, 186, 187, -1, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, - 205, 206, 207, 208, -1, 210, 211, -1, 213, 214, - 215, 216, 217, -1, -1, -1, -1, -1, 223, 224, - 225, 226, 227, 228, 229, 230, -1, 232, 233, 234, - -1, -1, 237, 238, 239, 240, -1, 242, 243, 244, + 145, 146, -1, 148, -1, 150, 151, 152, 153, 154, + 155, 156, 157, 158, 159, 160, 161, 162, 163, -1, + 165, 166, 167, 168, -1, 170, -1, 172, 173, -1, + 175, 176, 177, 178, -1, 180, 181, 182, -1, 184, + 185, 186, 187, -1, 189, 190, 191, 192, 193, 194, + 195, -1, 197, 198, 199, 200, -1, 202, 203, 204, + 205, 206, 207, 208, -1, 210, 211, 212, 213, 214, + 215, 216, 217, 218, 219, -1, 221, -1, 223, -1, + -1, 226, 227, 228, 229, 230, 231, 232, 233, 234, + -1, -1, 237, 238, 239, -1, -1, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, -1, 274, - -1, 276, 277, 278, -1, -1, 281, 282, 283, 284, - -1, -1, 287, -1, 289, 290, 291, -1, 293, 294, - -1, -1, 297, 298, 299, -1, -1, 302, 303, -1, - 305, 306, 307, -1, 309, 310, 311, 312, 313, 314, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, -1, 281, 282, -1, 284, + 285, 286, 287, 288, 289, 290, 291, -1, 293, 294, + -1, -1, 297, 298, 299, -1, -1, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, -1, -1, -1, -1, - 325, 326, -1, 328, 329, 330, -1, 332, 333, 334, + 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, -1, 336, 337, 338, 339, 340, 341, -1, 343, 344, - 345, 346, 347, -1, 349, 350, 351, 352, -1, 354, + 345, 346, 347, 348, 349, 350, 351, 352, -1, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, - 365, 366, -1, 368, 369, 370, 371, 372, 373, -1, + 365, 366, -1, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, - 385, 386, 387, -1, 389, 390, 391, 392, 393, 394, - 395, -1, 397, 398, -1, 400, 401, 402, -1, 404, + 385, 386, 387, -1, -1, 390, 391, 392, 393, 394, + 395, 396, 397, 398, -1, -1, 401, 402, 403, 404, -1, 406, 407, 408, 409, 410, 411, 412, 413, 414, - 415, 416, 417, 418, 419, 420, 421, -1, -1, -1, + 415, 416, 417, 418, 419, 420, 421, 422, -1, -1, 425, 426, -1, 428, 429, 430, 431, 432, 433, 434, - 435, -1, 437, -1, -1, -1, -1, 442, 443, -1, - 445, -1, -1, 448, 449, 450, 451, 452, 453, 454, + 435, -1, 437, 438, 439, -1, -1, 442, 443, 444, + 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, -1, -1, 458, 459, 460, 461, -1, 463, 464, - 465, 466, -1, 468, 469, 470, 471, 472, -1, -1, + 465, 466, -1, 468, 469, 470, 471, 472, 473, 474, 475, -1, 477, 478, 479, 480, 481, 482, 483, 484, 485, -1, -1, 488, -1, -1, 491, 492, 493, 494, - 495, 496, 3, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 508, 509, 510, 511, -1, -1, -1, - -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, - -1, 32, 33, 34, 529, -1, -1, 38, -1, -1, + 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, + 505, 506, 507, 508, 509, 510, 511, -1, -1, -1, + -1, -1, 3, -1, 519, 520, 521, -1, -1, 10, + -1, 526, -1, 528, -1, -1, -1, -1, 533, 534, + 535, 536, 23, 24, 25, 26, 27, 28, 29, 30, + -1, 32, 33, 34, -1, -1, -1, -1, -1, 40, -1, -1, 43, 44, 45, -1, 47, 48, 49, 50, - 51, 52, 53, -1, -1, 56, -1, -1, -1, 60, - 61, 62, 63, 64, 65, -1, -1, 68, 69, 70, - 71, -1, -1, 74, -1, 76, 77, 78, 79, -1, + 51, 52, 53, 54, 55, 56, 57, 58, -1, -1, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, + 71, 72, 73, 74, -1, 76, 77, 78, 79, 80, -1, 82, -1, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, -1, 95, 96, 97, 98, 99, 100, -1, 102, 103, 104, 105, 106, 107, 108, 109, 110, - 111, 112, -1, 114, 115, -1, 117, -1, 119, -1, + 111, 112, 113, 114, 115, 116, 117, -1, 119, -1, 121, 122, 123, 124, 125, 126, -1, -1, 129, 130, 131, 132, -1, -1, 135, 136, 137, 138, 139, -1, 141, 142, 143, -1, 145, 146, 147, 148, -1, 150, - 151, 152, 153, -1, 155, 156, 157, 158, 159, 160, - -1, -1, 163, -1, 165, 166, -1, 168, -1, 170, + 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, + 161, -1, 163, -1, 165, 166, 167, 168, -1, 170, -1, 172, 173, -1, 175, 176, 177, 178, 179, 180, - 181, 182, -1, -1, -1, 186, 187, -1, 189, 190, + 181, 182, -1, 184, 185, 186, 187, -1, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, -1, 210, - 211, -1, 213, 214, 215, 216, 217, -1, -1, -1, - -1, -1, 223, 224, 225, 226, 227, 228, 229, 230, + 211, 212, 213, 214, 215, 216, 217, 218, 219, -1, + 221, -1, 223, 224, 225, 226, 227, 228, 229, 230, -1, 232, 233, 234, -1, -1, 237, 238, 239, 240, -1, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, - 271, 272, -1, 274, -1, 276, 277, 278, -1, -1, - 281, 282, 283, 284, -1, -1, 287, -1, 289, 290, + 271, 272, 273, 274, 275, 276, 277, 278, 279, -1, + 281, 282, 283, 284, -1, 286, 287, 288, 289, 290, 291, -1, 293, 294, -1, -1, 297, 298, 299, -1, - -1, 302, 303, -1, 305, 306, 307, -1, 309, 310, + -1, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, - -1, -1, -1, -1, 325, 326, -1, 328, 329, 330, - -1, 332, 333, 334, -1, 336, 337, 338, 339, 340, - 341, -1, 343, 344, 345, 346, 347, -1, 349, 350, + -1, -1, -1, -1, 325, 326, 327, 328, 329, 330, + 331, 332, 333, 334, -1, 336, 337, 338, 339, 340, + 341, -1, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, -1, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, -1, 368, 369, 370, - 371, 372, 373, -1, 375, 376, 377, 378, 379, 380, - 381, 382, 383, 384, 385, 386, 387, -1, 389, 390, - 391, 392, 393, 394, 395, -1, 397, 398, -1, 400, - 401, 402, -1, 404, -1, 406, 407, 408, 409, 410, + 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, + 381, 382, 383, 384, 385, 386, 387, -1, -1, 390, + 391, 392, 393, 394, 395, 396, 397, 398, -1, 400, + 401, 402, 403, 404, -1, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, - 421, -1, -1, -1, 425, 426, -1, 428, 429, 430, - 431, 432, 433, 434, 435, -1, 437, -1, -1, -1, - -1, 442, 443, -1, 445, -1, -1, 448, 449, 450, + 421, 422, -1, -1, 425, 426, -1, 428, 429, 430, + 431, 432, 433, 434, 435, -1, 437, 438, 439, -1, + -1, 442, 443, 444, 445, 446, -1, 448, 449, 450, 451, 452, 453, 454, 455, -1, -1, 458, 459, 460, - 461, -1, 463, 464, 465, 466, -1, 468, 469, 470, - 471, 472, -1, -1, 475, -1, 477, 478, 479, 480, + -1, -1, 463, 464, 465, 466, -1, 468, 469, 470, + 471, 472, 473, 474, 475, -1, 477, 478, 479, 480, 481, 482, 483, 484, 485, -1, -1, 488, -1, -1, - 491, 492, 493, 494, 495, 496, -1, -1, -1, -1, - 3, -1, -1, -1, -1, -1, -1, 508, 509, 510, - 511, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 23, 24, 25, 26, 27, 28, 29, 30, 529, 32, - 33, 34, 35, 36, -1, 38, -1, -1, -1, -1, - 43, 44, 45, -1, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, -1, 60, 61, 62, - 63, 64, 65, -1, -1, 68, 69, 70, 71, 72, - 73, 74, -1, 76, 77, 78, 79, 80, -1, 82, - -1, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, -1, 95, 96, 97, 98, 99, 100, -1, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, -1, 119, -1, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - -1, -1, 135, 136, 137, 138, 139, -1, 141, 142, - 143, -1, 145, 146, 147, 148, -1, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, -1, - 163, -1, 165, 166, 167, 168, -1, 170, -1, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - -1, 184, 185, 186, 187, -1, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, - 203, 204, 205, 206, 207, 208, -1, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, -1, 221, -1, - 223, 224, 225, 226, 227, 228, 229, 230, -1, 232, - 233, 234, -1, -1, 237, 238, 239, 240, -1, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, -1, 281, 282, - 283, 284, -1, 286, 287, 288, 289, 290, 291, -1, - 293, 294, -1, -1, 297, 298, 299, -1, -1, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, -1, 325, 326, 327, 328, 329, 330, 331, 332, - 333, 334, -1, 336, 337, 338, 339, 340, 341, -1, - 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, - -1, 354, 355, 356, 357, 358, 359, 360, 361, 362, - 363, 364, 365, 366, -1, 368, 369, 370, 371, 372, - 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, - 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, - 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, - 403, 404, -1, 406, 407, 408, 409, 410, 411, 412, - 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, - 423, -1, 425, 426, 427, 428, 429, 430, 431, 432, - 433, 434, 435, -1, 437, 438, 439, -1, -1, 442, - 443, 444, 445, 446, -1, 448, 449, 450, 451, 452, - 453, 454, 455, -1, -1, 458, 459, 460, 461, 462, - 463, 464, 465, 466, -1, 468, 469, 470, 471, 472, - 473, 474, 475, -1, 477, 478, 479, 480, 481, 482, - 483, 484, 485, -1, -1, 488, -1, 490, 491, 492, - 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, - 503, 504, 505, 506, 507, 508, 509, 510, 511, -1, - 3, 514, 5, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 528, -1, -1, -1, -1, - 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, - 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, - 43, 44, 45, -1, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, -1, -1, 61, 62, - 63, 64, 65, -1, 67, 68, 69, 70, 71, 72, - 73, 74, -1, 76, 77, 78, 79, 80, -1, 82, - -1, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, -1, 95, 96, 97, 98, 99, 100, -1, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, -1, 119, -1, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, - -1, -1, 135, 136, 137, 138, 139, -1, 141, 142, - 143, -1, 145, 146, 147, 148, -1, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, -1, - 163, -1, 165, 166, 167, 168, -1, 170, -1, 172, - 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, - -1, 184, 185, 186, 187, -1, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, - 203, 204, 205, 206, 207, 208, -1, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, -1, 221, -1, - 223, 224, 225, 226, 227, 228, 229, 230, -1, 232, - 233, 234, 235, -1, 237, 238, 239, 240, -1, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, -1, 281, 282, - 283, 284, -1, 286, 287, 288, 289, 290, 291, -1, - 293, 294, -1, 296, 297, 298, 299, -1, -1, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, -1, 325, 326, 327, 328, 329, 330, 331, 332, - 333, 334, -1, 336, 337, 338, 339, 340, 341, -1, - 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, - -1, 354, 355, 356, 357, 358, 359, 360, 361, 362, - 363, 364, 365, 366, -1, 368, 369, 370, 371, 372, - 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, - 383, 384, 385, 386, 387, 388, -1, 390, 391, 392, - 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, - 403, 404, -1, 406, 407, 408, 409, 410, 411, 412, - 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, - 423, -1, 425, 426, 427, 428, 429, 430, 431, 432, - 433, 434, 435, -1, 437, 438, 439, -1, -1, 442, - 443, 444, 445, 446, -1, 448, 449, 450, 451, 452, - 453, 454, 455, -1, -1, 458, 459, 460, -1, 462, - 463, 464, 465, 466, -1, 468, 469, 470, 471, 472, - 473, 474, 475, -1, 477, 478, 479, 480, 481, 482, - 483, 484, 485, -1, -1, 488, -1, 490, 491, 492, - 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, - 503, 504, 505, 506, 507, 508, 509, 510, 511, -1, - 3, 514, 5, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 528, -1, -1, -1, -1, + 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, + 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, + 511, -1, -1, -1, -1, -1, 3, 4, -1, -1, + -1, -1, 9, 10, -1, 526, -1, 528, -1, -1, + -1, -1, 533, 534, 535, 536, 23, 24, 25, 26, + 27, 28, 29, 30, -1, 32, 33, 34, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 44, 45, -1, + -1, 48, 49, -1, 51, 52, 53, 54, 55, -1, + 57, 58, -1, -1, 61, 62, 63, 64, 65, -1, + -1, 68, 69, 70, 71, 72, 73, 74, -1, 76, + 77, 78, 79, 80, -1, -1, -1, 84, 85, 86, + 87, 88, 89, -1, 91, 92, 93, -1, 95, 96, + 97, 98, 99, 100, -1, -1, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 117, -1, 119, -1, 121, 122, 123, 124, 125, 126, + -1, -1, 129, 130, 131, 132, -1, -1, 135, 136, + 137, 138, 139, -1, 141, 142, 143, -1, 145, 146, + 147, 148, -1, 150, 151, 152, 153, 154, 155, 156, + 157, 158, 159, 160, 161, -1, 163, -1, 165, 166, + 167, 168, -1, 170, -1, 172, -1, -1, -1, 176, + 177, 178, -1, 180, 181, 182, -1, 184, 185, 186, + 187, -1, 189, 190, 191, 192, 193, 194, 195, -1, + 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, + 207, 208, -1, 210, -1, 212, 213, 214, 215, 216, + 217, 218, 219, -1, 221, -1, 223, -1, -1, 226, + -1, 228, 229, 230, -1, 232, 233, 234, -1, -1, + 237, -1, 239, -1, -1, 242, 243, 244, 245, 246, + 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, 273, -1, 275, 276, + 277, 278, 279, -1, 281, 282, -1, 284, -1, 286, + 287, 288, 289, 290, 291, -1, 293, 294, -1, -1, + 297, 298, 299, -1, -1, 302, 303, 304, -1, 306, + -1, 308, 309, 310, 311, 312, 313, 314, 315, 316, + 317, 318, 319, 320, -1, -1, -1, -1, 325, 326, + 327, -1, 329, 330, 331, 332, 333, 334, -1, 336, + 337, 338, 339, 340, 341, -1, 343, 344, 345, 346, + 347, 348, 349, 350, 351, 352, -1, 354, 355, 356, + 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, + -1, 368, 369, -1, 371, 372, 373, 374, 375, 376, + 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, + 387, -1, -1, 390, 391, 392, 393, 394, 395, 396, + 397, 398, -1, -1, 401, 402, 403, 404, -1, 406, + 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, + 417, 418, 419, 420, 421, 422, -1, -1, 425, 426, + -1, 428, -1, 430, 431, 432, 433, 434, 435, -1, + 437, 438, 439, -1, -1, 442, 443, 444, 445, 446, + -1, 448, 449, 450, 451, 452, 453, 454, 455, -1, + -1, 458, 459, 460, -1, -1, 463, 464, 465, 466, + -1, 468, 469, 470, 471, 472, 473, 474, 475, -1, + 477, -1, 479, 480, 481, 482, 483, 484, 485, -1, + -1, 488, -1, -1, 491, 492, 493, 494, 495, 496, + 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, + 507, 508, 509, 510, 511, -1, -1, -1, 3, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 533, 534, 23, 24, + 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, + -1, -1, -1, -1, -1, -1, 41, -1, -1, 44, + 45, -1, -1, 48, 49, -1, 51, 52, 53, 54, + 55, -1, 57, 58, -1, -1, 61, 62, 63, 64, + 65, -1, -1, 68, 69, 70, 71, 72, 73, 74, + -1, 76, 77, 78, 79, 80, -1, -1, -1, 84, + 85, 86, 87, 88, 89, -1, 91, 92, 93, -1, + 95, 96, 97, 98, 99, 100, -1, -1, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, + 115, 116, 117, -1, 119, -1, 121, 122, 123, 124, + 125, 126, -1, -1, 129, 130, 131, 132, -1, -1, + 135, 136, 137, 138, 139, -1, 141, 142, 143, -1, + 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, + 155, 156, 157, 158, 159, 160, 161, -1, 163, 164, + 165, 166, 167, 168, 169, 170, -1, 172, -1, -1, + -1, 176, 177, 178, -1, 180, 181, 182, -1, 184, + 185, 186, 187, -1, 189, 190, 191, 192, 193, 194, + 195, -1, 197, 198, 199, 200, -1, 202, 203, 204, + 205, 206, 207, 208, -1, 210, -1, 212, 213, 214, + 215, 216, 217, 218, 219, 220, 221, -1, 223, -1, + -1, 226, -1, 228, 229, 230, -1, 232, 233, 234, + -1, -1, 237, -1, 239, -1, 241, 242, 243, 244, + 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, + 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, -1, + 275, 276, 277, 278, 279, -1, 281, 282, -1, 284, + -1, 286, 287, 288, 289, 290, 291, 292, 293, 294, + -1, -1, 297, 298, 299, -1, 301, 302, 303, 304, + -1, 306, -1, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, -1, -1, -1, -1, + 325, 326, 327, -1, 329, 330, 331, 332, 333, 334, + -1, 336, 337, 338, 339, 340, 341, -1, 343, 344, + 345, 346, 347, 348, 349, 350, 351, 352, -1, 354, + 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, + 365, 366, -1, 368, 369, -1, 371, 372, 373, 374, + 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, + 385, 386, 387, -1, -1, 390, 391, 392, 393, 394, + 395, 396, 397, 398, -1, -1, 401, 402, 403, 404, + -1, 406, 407, 408, 409, 410, 411, 412, 413, 414, + 415, 416, 417, 418, 419, 420, 421, 422, -1, -1, + 425, 426, -1, 428, -1, 430, 431, 432, 433, 434, + 435, -1, 437, 438, 439, -1, -1, 442, 443, 444, + 445, 446, -1, 448, 449, 450, 451, 452, 453, 454, + 455, 456, -1, 458, 459, 460, -1, -1, 463, 464, + 465, 466, -1, 468, 469, 470, 471, 472, 473, 474, + 475, -1, 477, -1, 479, 480, 481, 482, 483, 484, + 485, -1, -1, 488, -1, -1, 491, 492, 493, 494, + 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, + 505, 506, 507, 508, 509, 510, 511, 3, -1, 5, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 529, -1, -1, 23, 24, 25, + 26, 27, 28, 29, 30, -1, 32, 33, 34, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 44, 45, + -1, -1, 48, 49, -1, 51, 52, 53, 54, 55, + -1, 57, 58, -1, -1, 61, 62, 63, 64, 65, + -1, -1, 68, 69, 70, 71, 72, 73, 74, -1, + 76, 77, 78, 79, 80, -1, -1, -1, 84, 85, + 86, 87, 88, 89, -1, 91, 92, 93, -1, 95, + 96, 97, 98, 99, 100, -1, -1, 103, 104, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, + 116, 117, -1, 119, -1, 121, 122, 123, 124, 125, + 126, -1, -1, 129, 130, 131, 132, -1, -1, 135, + 136, 137, 138, 139, -1, 141, 142, 143, -1, 145, + 146, 147, 148, -1, 150, 151, 152, 153, 154, 155, + 156, 157, 158, 159, 160, 161, -1, 163, -1, 165, + 166, 167, 168, -1, 170, -1, 172, -1, -1, -1, + 176, 177, 178, -1, 180, 181, 182, -1, 184, 185, + 186, 187, -1, 189, 190, 191, 192, 193, 194, 195, + -1, 197, 198, 199, 200, -1, 202, 203, 204, 205, + 206, 207, 208, -1, 210, -1, 212, 213, 214, 215, + 216, 217, 218, 219, -1, 221, -1, 223, -1, -1, + 226, -1, 228, 229, 230, -1, 232, 233, 234, -1, + -1, 237, -1, 239, -1, -1, 242, 243, 244, 245, + 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, + 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, + 266, 267, 268, 269, 270, 271, 272, 273, -1, 275, + 276, 277, 278, 279, -1, 281, 282, -1, 284, -1, + 286, 287, 288, 289, 290, 291, -1, 293, 294, -1, + -1, 297, 298, 299, -1, -1, 302, 303, 304, -1, + 306, -1, 308, 309, 310, 311, 312, 313, 314, 315, + 316, 317, 318, 319, 320, -1, -1, -1, -1, 325, + 326, 327, -1, 329, 330, 331, 332, 333, 334, -1, + 336, 337, 338, 339, 340, 341, -1, 343, 344, 345, + 346, 347, 348, 349, 350, 351, 352, -1, 354, 355, + 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, + 366, -1, 368, 369, -1, 371, 372, 373, 374, 375, + 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, + 386, 387, -1, -1, 390, 391, 392, 393, 394, 395, + 396, 397, 398, -1, -1, 401, 402, 403, 404, -1, + 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, + 416, 417, 418, 419, 420, 421, 422, -1, -1, 425, + 426, -1, 428, -1, 430, 431, 432, 433, 434, 435, + -1, 437, 438, 439, -1, -1, 442, 443, 444, 445, + 446, -1, 448, 449, 450, 451, 452, 453, 454, 455, + -1, -1, 458, 459, 460, -1, -1, 463, 464, 465, + 466, -1, 468, 469, 470, 471, 472, 473, 474, 475, + -1, 477, -1, 479, 480, 481, 482, 483, 484, 485, + -1, -1, 488, -1, -1, 491, 492, 493, 494, 495, + 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, + 506, 507, 508, 509, 510, 511, 3, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 528, 529, -1, -1, 23, 24, 25, 26, + 27, 28, 29, 30, -1, 32, 33, 34, -1, -1, + -1, 38, -1, -1, -1, -1, 43, 44, 45, -1, + 47, 48, 49, 50, 51, 52, 53, -1, -1, 56, + -1, -1, -1, 60, 61, 62, 63, 64, 65, -1, + -1, 68, 69, 70, 71, -1, -1, 74, -1, 76, + 77, 78, 79, -1, -1, 82, -1, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, -1, 95, 96, + 97, 98, 99, 100, -1, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, -1, 114, 115, -1, + 117, -1, 119, -1, 121, 122, 123, 124, 125, 126, + -1, -1, 129, 130, 131, 132, -1, -1, 135, 136, + 137, 138, 139, -1, 141, 142, 143, -1, 145, 146, + 147, 148, -1, 150, 151, 152, 153, -1, 155, 156, + 157, 158, 159, 160, -1, -1, 163, -1, 165, 166, + -1, 168, -1, 170, -1, 172, 173, -1, 175, 176, + 177, 178, 179, 180, 181, 182, -1, -1, -1, 186, + 187, -1, 189, 190, 191, 192, 193, 194, 195, 196, + 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, + 207, 208, -1, 210, 211, -1, 213, 214, 215, 216, + 217, -1, -1, -1, -1, -1, 223, 224, 225, 226, + 227, 228, 229, 230, -1, 232, 233, 234, -1, -1, + 237, 238, 239, 240, -1, 242, 243, 244, 245, 246, + 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, -1, 274, -1, 276, + 277, 278, -1, -1, 281, 282, 283, 284, -1, -1, + 287, -1, 289, 290, 291, -1, 293, 294, -1, -1, + 297, 298, 299, -1, -1, 302, 303, -1, 305, 306, + 307, -1, 309, 310, 311, 312, 313, 314, 315, 316, + 317, 318, 319, 320, -1, -1, -1, -1, 325, 326, + -1, 328, 329, 330, -1, 332, 333, 334, -1, 336, + 337, 338, 339, 340, 341, -1, 343, 344, 345, 346, + 347, -1, 349, 350, 351, 352, -1, 354, 355, 356, + 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, + -1, 368, 369, 370, 371, 372, 373, -1, 375, 376, + 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, + 387, -1, 389, 390, 391, 392, 393, 394, 395, -1, + 397, 398, -1, 400, 401, 402, -1, 404, -1, 406, + 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, + 417, 418, 419, 420, 421, -1, -1, -1, 425, 426, + -1, 428, 429, 430, 431, 432, 433, 434, 435, -1, + 437, -1, -1, -1, -1, 442, 443, -1, 445, -1, + -1, 448, 449, 450, 451, 452, 453, 454, 455, -1, + -1, 458, 459, 460, 461, -1, 463, 464, 465, 466, + -1, 468, 469, 470, 471, 472, -1, -1, 475, -1, + 477, 478, 479, 480, 481, 482, 483, 484, 485, -1, + -1, 488, -1, -1, 491, 492, 493, 494, 495, 496, + 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 508, 509, 510, 511, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, - 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, + 33, 34, 529, -1, -1, 38, -1, -1, -1, -1, 43, 44, 45, -1, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, -1, -1, 61, 62, - 63, 64, 65, -1, 67, 68, 69, 70, 71, 72, - 73, 74, -1, 76, 77, 78, 79, 80, -1, 82, + 53, -1, -1, 56, -1, -1, -1, 60, 61, 62, + 63, 64, 65, -1, -1, 68, 69, 70, 71, -1, + -1, 74, -1, 76, 77, 78, 79, -1, -1, 82, -1, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, -1, 95, 96, 97, 98, 99, 100, -1, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117, -1, 119, -1, 121, 122, + -1, 114, 115, -1, 117, -1, 119, -1, 121, 122, 123, 124, 125, 126, -1, -1, 129, 130, 131, 132, -1, -1, 135, 136, 137, 138, 139, -1, 141, 142, 143, -1, 145, 146, 147, 148, -1, 150, 151, 152, - 153, 154, 155, 156, 157, 158, 159, 160, 161, -1, - 163, -1, 165, 166, 167, 168, -1, 170, -1, 172, + 153, -1, 155, 156, 157, 158, 159, 160, -1, -1, + 163, -1, 165, 166, -1, 168, -1, 170, -1, 172, 173, -1, 175, 176, 177, 178, 179, 180, 181, 182, - -1, 184, 185, 186, 187, -1, 189, 190, 191, 192, + -1, -1, -1, 186, 187, -1, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, - 203, 204, 205, 206, 207, 208, -1, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 219, -1, 221, -1, + 203, 204, 205, 206, 207, 208, -1, 210, 211, -1, + 213, 214, 215, 216, 217, -1, -1, -1, -1, -1, 223, 224, 225, 226, 227, 228, 229, 230, -1, 232, - 233, 234, 235, -1, 237, 238, 239, 240, -1, 242, + 233, 234, -1, -1, 237, 238, 239, 240, -1, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, -1, 281, 282, - 283, 284, -1, 286, 287, 288, 289, 290, 291, -1, - 293, 294, -1, 296, 297, 298, 299, -1, -1, 302, - 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, + -1, 274, -1, 276, 277, 278, -1, -1, 281, 282, + 283, 284, -1, -1, 287, -1, 289, 290, 291, -1, + 293, 294, -1, -1, 297, 298, 299, -1, -1, 302, + 303, -1, 305, 306, 307, -1, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, -1, -1, - -1, -1, 325, 326, 327, 328, 329, 330, 331, 332, + -1, -1, 325, 326, -1, 328, 329, 330, -1, 332, 333, 334, -1, 336, 337, 338, 339, 340, 341, -1, - 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, + 343, 344, 345, 346, 347, -1, 349, 350, 351, 352, -1, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, -1, 368, 369, 370, 371, 372, - 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, - 383, 384, 385, 386, 387, -1, -1, 390, 391, 392, - 393, 394, 395, 396, 397, 398, -1, 400, 401, 402, - 403, 404, -1, 406, 407, 408, 409, 410, 411, 412, - 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, + 373, -1, 375, 376, 377, 378, 379, 380, 381, 382, + 383, 384, 385, 386, 387, -1, 389, 390, 391, 392, + 393, 394, 395, -1, 397, 398, -1, 400, 401, 402, + -1, 404, -1, 406, 407, 408, 409, 410, 411, 412, + 413, 414, 415, 416, 417, 418, 419, 420, 421, -1, -1, -1, 425, 426, -1, 428, 429, 430, 431, 432, - 433, 434, 435, -1, 437, 438, 439, -1, -1, 442, - 443, 444, 445, 446, -1, 448, 449, 450, 451, 452, - 453, 454, 455, -1, -1, 458, 459, 460, -1, -1, + 433, 434, 435, -1, 437, -1, -1, -1, -1, 442, + 443, -1, 445, -1, -1, 448, 449, 450, 451, 452, + 453, 454, 455, -1, -1, 458, 459, 460, 461, -1, 463, 464, 465, 466, -1, 468, 469, 470, 471, 472, - 473, 474, 475, -1, 477, 478, 479, 480, 481, 482, + -1, -1, 475, -1, 477, 478, 479, 480, 481, 482, 483, 484, 485, -1, -1, 488, -1, -1, 491, 492, - 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, - 503, 504, 505, 506, 507, 508, 509, 510, 511, 3, - -1, 5, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 528, -1, -1, -1, 23, - 24, 25, 26, 27, 28, 29, 30, -1, 32, 33, - 34, -1, -1, -1, -1, -1, -1, -1, -1, 43, - 44, 45, -1, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, -1, -1, 61, 62, 63, - 64, 65, -1, 67, 68, 69, 70, 71, 72, 73, - 74, -1, 76, 77, 78, 79, 80, -1, 82, -1, - 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - -1, 95, 96, 97, 98, 99, 100, -1, 102, 103, - 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, - 114, 115, 116, 117, -1, 119, -1, 121, 122, 123, - 124, 125, 126, -1, -1, 129, 130, 131, 132, -1, - -1, 135, 136, 137, 138, 139, -1, 141, 142, 143, - -1, 145, 146, 147, 148, -1, 150, 151, 152, 153, - 154, 155, 156, 157, 158, 159, 160, 161, -1, 163, - -1, 165, 166, 167, 168, -1, 170, -1, 172, 173, - -1, 175, 176, 177, 178, 179, 180, 181, 182, -1, - 184, 185, 186, 187, -1, 189, 190, 191, 192, 193, - 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, - 204, 205, 206, 207, 208, -1, 210, 211, 212, 213, - 214, 215, 216, 217, 218, 219, -1, 221, -1, 223, - 224, 225, 226, 227, 228, 229, 230, -1, 232, 233, - 234, -1, -1, 237, 238, 239, 240, -1, 242, 243, - 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, - 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, - 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, - 274, 275, 276, 277, 278, 279, -1, 281, 282, 283, - 284, -1, 286, 287, 288, 289, 290, 291, -1, 293, - 294, -1, 296, 297, 298, 299, -1, -1, 302, 303, - 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, - 314, 315, 316, 317, 318, 319, 320, -1, -1, -1, - -1, 325, 326, 327, 328, 329, 330, 331, 332, 333, - 334, -1, 336, 337, 338, 339, 340, 341, -1, 343, - 344, 345, 346, 347, 348, 349, 350, 351, 352, -1, - 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, - 364, 365, 366, -1, 368, 369, 370, 371, 372, 373, - 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, - 384, 385, 386, 387, -1, -1, 390, 391, 392, 393, - 394, 395, 396, 397, 398, -1, 400, 401, 402, 403, - 404, -1, 406, 407, 408, 409, 410, 411, 412, 413, - 414, 415, 416, 417, 418, 419, 420, 421, 422, -1, - -1, 425, 426, -1, 428, 429, 430, 431, 432, 433, - 434, 435, -1, 437, 438, 439, -1, -1, 442, 443, - 444, 445, 446, -1, 448, 449, 450, 451, 452, 453, - 454, 455, -1, -1, 458, 459, 460, -1, -1, 463, - 464, 465, 466, -1, 468, 469, 470, 471, 472, 473, - 474, 475, -1, 477, 478, 479, 480, 481, 482, 483, - 484, 485, -1, -1, 488, -1, -1, 491, 492, 493, - 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, - 504, 505, 506, 507, 508, 509, 510, 511, 3, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 528, -1, -1, -1, 23, 24, + 493, 494, 495, 496, -1, -1, -1, -1, 3, -1, + -1, -1, -1, -1, -1, 508, 509, 510, 511, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 23, 24, + 25, 26, 27, 28, 29, 30, 529, 32, 33, 34, + 35, 36, -1, 38, -1, -1, -1, -1, 43, 44, + 45, -1, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, -1, 60, 61, 62, 63, 64, + 65, -1, -1, 68, 69, 70, 71, 72, 73, 74, + -1, 76, 77, 78, 79, 80, -1, 82, -1, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, -1, + 95, 96, 97, 98, 99, 100, -1, 102, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, + 115, 116, 117, -1, 119, -1, 121, 122, 123, 124, + 125, 126, 127, 128, 129, 130, 131, 132, -1, -1, + 135, 136, 137, 138, 139, -1, 141, 142, 143, -1, + 145, 146, 147, 148, -1, 150, 151, 152, 153, 154, + 155, 156, 157, 158, 159, 160, 161, -1, 163, -1, + 165, 166, 167, 168, -1, 170, -1, 172, 173, 174, + 175, 176, 177, 178, 179, 180, 181, 182, -1, 184, + 185, 186, 187, -1, 189, 190, 191, 192, 193, 194, + 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, + 205, 206, 207, 208, -1, 210, 211, 212, 213, 214, + 215, 216, 217, 218, 219, -1, 221, -1, 223, 224, + 225, 226, 227, 228, 229, 230, -1, 232, 233, 234, + -1, -1, 237, 238, 239, 240, -1, 242, 243, 244, + 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, + 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, -1, 281, 282, 283, 284, + -1, 286, 287, 288, 289, 290, 291, -1, 293, 294, + -1, -1, 297, 298, 299, -1, -1, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, -1, + 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, + -1, 336, 337, 338, 339, 340, 341, -1, 343, 344, + 345, 346, 347, 348, 349, 350, 351, 352, -1, 354, + 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, + 365, 366, -1, 368, 369, 370, 371, 372, 373, 374, + 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, + 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, + 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, + -1, 406, 407, 408, 409, 410, 411, 412, 413, 414, + 415, 416, 417, 418, 419, 420, 421, 422, 423, -1, + 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, + 435, -1, 437, 438, 439, -1, -1, 442, 443, 444, + 445, 446, -1, 448, 449, 450, 451, 452, 453, 454, + 455, -1, -1, 458, 459, 460, 461, 462, 463, 464, + 465, 466, -1, 468, 469, 470, 471, 472, 473, 474, + 475, -1, 477, 478, 479, 480, 481, 482, 483, 484, + 485, -1, -1, 488, -1, 490, 491, 492, 493, 494, + 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, + 505, 506, 507, 508, 509, 510, 511, -1, 3, 514, + 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 528, -1, -1, -1, -1, 23, 24, + 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, + -1, -1, -1, -1, -1, -1, -1, -1, 43, 44, + 45, -1, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, -1, -1, 61, 62, 63, 64, + 65, -1, 67, 68, 69, 70, 71, 72, 73, 74, + -1, 76, 77, 78, 79, 80, -1, 82, -1, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, -1, + 95, 96, 97, 98, 99, 100, -1, 102, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, + 115, 116, 117, -1, 119, -1, 121, 122, 123, 124, + 125, 126, 127, 128, 129, 130, 131, 132, -1, -1, + 135, 136, 137, 138, 139, -1, 141, 142, 143, -1, + 145, 146, 147, 148, -1, 150, 151, 152, 153, 154, + 155, 156, 157, 158, 159, 160, 161, -1, 163, -1, + 165, 166, 167, 168, -1, 170, -1, 172, 173, 174, + 175, 176, 177, 178, 179, 180, 181, 182, -1, 184, + 185, 186, 187, -1, 189, 190, 191, 192, 193, 194, + 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, + 205, 206, 207, 208, -1, 210, 211, 212, 213, 214, + 215, 216, 217, 218, 219, -1, 221, -1, 223, 224, + 225, 226, 227, 228, 229, 230, -1, 232, 233, 234, + 235, -1, 237, 238, 239, 240, -1, 242, 243, 244, + 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, + 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, -1, 281, 282, 283, 284, + -1, 286, 287, 288, 289, 290, 291, -1, 293, 294, + -1, 296, 297, 298, 299, -1, -1, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, -1, + 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, + -1, 336, 337, 338, 339, 340, 341, -1, 343, 344, + 345, 346, 347, 348, 349, 350, 351, 352, -1, 354, + 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, + 365, 366, -1, 368, 369, 370, 371, 372, 373, 374, + 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, + 385, 386, 387, 388, -1, 390, 391, 392, 393, 394, + 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, + -1, 406, 407, 408, 409, 410, 411, 412, 413, 414, + 415, 416, 417, 418, 419, 420, 421, 422, 423, -1, + 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, + 435, -1, 437, 438, 439, -1, -1, 442, 443, 444, + 445, 446, -1, 448, 449, 450, 451, 452, 453, 454, + 455, -1, -1, 458, 459, 460, -1, 462, 463, 464, + 465, 466, -1, 468, 469, 470, 471, 472, 473, 474, + 475, -1, 477, 478, 479, 480, 481, 482, 483, 484, + 485, -1, -1, 488, -1, 490, 491, 492, 493, 494, + 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, + 505, 506, 507, 508, 509, 510, 511, -1, 3, 514, + 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 528, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, 43, 44, 45, -1, 47, 48, 49, 50, 51, 52, 53, 54, @@ -15833,13 +15718,13 @@ static const yytype_int16 yycheck[] = 205, 206, 207, 208, -1, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, -1, 221, -1, 223, 224, 225, 226, 227, 228, 229, 230, -1, 232, 233, 234, - -1, -1, 237, 238, 239, 240, -1, 242, 243, 244, + 235, -1, 237, 238, 239, 240, -1, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, -1, 281, 282, 283, 284, -1, 286, 287, 288, 289, 290, 291, -1, 293, 294, - -1, -1, 297, 298, 299, -1, -1, 302, 303, 304, + -1, 296, 297, 298, 299, -1, -1, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, -1, -1, -1, -1, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, @@ -15860,7 +15745,7 @@ static const yytype_int16 yycheck[] = 475, -1, 477, 478, 479, 480, 481, 482, 483, 484, 485, -1, -1, 488, -1, -1, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, - 505, 506, 507, 508, 509, 510, 511, 3, -1, -1, + 505, 506, 507, 508, 509, 510, 511, 3, -1, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 528, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, -1, @@ -15890,7 +15775,7 @@ static const yytype_int16 yycheck[] = 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, -1, 281, 282, 283, 284, -1, 286, 287, 288, 289, 290, 291, -1, 293, 294, -1, - -1, 297, 298, 299, -1, -1, 302, 303, 304, 305, + 296, 297, 298, 299, -1, -1, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, -1, -1, -1, -1, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, -1, @@ -15915,258 +15800,105 @@ static const yytype_int16 yycheck[] = -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 528, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 44, 45, -1, - -1, 48, 49, -1, 51, 52, 53, 54, 55, -1, - 57, 58, -1, -1, 61, 62, 63, 64, 65, -1, - -1, 68, 69, 70, 71, 72, 73, 74, -1, 76, - 77, 78, 79, 80, -1, -1, -1, 84, 85, 86, - 87, 88, 89, -1, 91, 92, 93, -1, 95, 96, - 97, 98, 99, 100, -1, -1, 103, 104, 105, 106, - 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, - 117, -1, 119, -1, 121, 122, 123, 124, 125, 126, - 127, 128, 129, 130, 131, 132, -1, -1, 135, 136, - 137, 138, 139, -1, 141, 142, 143, -1, 145, 146, - 147, 148, -1, 150, 151, 152, 153, 154, 155, 156, - 157, 158, 159, 160, 161, -1, 163, -1, 165, 166, - 167, 168, -1, 170, -1, 172, -1, 174, -1, 176, - 177, 178, -1, 180, 181, 182, -1, 184, 185, 186, - 187, -1, 189, 190, 191, 192, 193, 194, 195, -1, - 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, - 207, 208, -1, 210, -1, 212, 213, 214, 215, 216, - 217, 218, 219, -1, 221, -1, 223, -1, -1, 226, - -1, 228, 229, 230, -1, 232, 233, 234, -1, -1, - 237, -1, 239, -1, -1, 242, 243, 244, 245, 246, - 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, - 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, - 267, 268, 269, 270, 271, 272, 273, -1, 275, 276, - 277, 278, 279, -1, 281, 282, -1, 284, -1, 286, - 287, 288, 289, 290, 291, -1, 293, 294, -1, -1, - 297, 298, 299, -1, -1, 302, 303, 304, -1, 306, - -1, 308, 309, 310, 311, 312, 313, 314, 315, 316, - 317, 318, 319, 320, 321, 322, 323, -1, 325, 326, - 327, -1, 329, 330, 331, 332, 333, 334, -1, 336, - 337, 338, 339, 340, 341, -1, 343, 344, 345, 346, - 347, 348, 349, 350, 351, 352, -1, 354, 355, 356, - 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, - -1, 368, 369, -1, 371, 372, 373, 374, 375, 376, - 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, - 387, 388, -1, 390, 391, 392, 393, 394, 395, 396, - 397, 398, 399, -1, 401, 402, 403, 404, -1, 406, - 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, - 417, 418, 419, 420, 421, 422, 423, -1, 425, 426, - 427, 428, -1, 430, 431, 432, 433, 434, 435, -1, - 437, 438, 439, -1, -1, 442, 443, 444, 445, 446, - -1, 448, 449, 450, 451, 452, 453, 454, 455, -1, - -1, 458, 459, 460, -1, 462, 463, 464, 465, 466, - -1, 468, 469, 470, 471, 472, 473, 474, 475, -1, - 477, -1, 479, 480, 481, 482, 483, 484, 485, -1, - -1, 488, -1, 490, 491, 492, 493, 494, 495, 496, - 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, - 507, 508, 509, 510, 511, -1, 3, 514, 5, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 528, -1, -1, -1, -1, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 44, 45, -1, - -1, 48, 49, -1, 51, 52, 53, 54, 55, -1, - 57, 58, -1, -1, 61, 62, 63, 64, 65, -1, - -1, 68, 69, 70, 71, 72, 73, 74, -1, 76, - 77, 78, 79, 80, -1, -1, -1, 84, 85, 86, - 87, 88, 89, -1, 91, 92, 93, -1, 95, 96, - 97, 98, 99, 100, -1, -1, 103, 104, 105, 106, - 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, - 117, -1, 119, -1, 121, 122, 123, 124, 125, 126, - -1, -1, 129, 130, 131, 132, -1, -1, 135, 136, - 137, 138, 139, -1, 141, 142, 143, -1, 145, 146, - 147, 148, -1, 150, 151, 152, 153, 154, 155, 156, - 157, 158, 159, 160, 161, -1, 163, -1, 165, 166, - 167, 168, -1, 170, -1, 172, -1, 174, -1, 176, - 177, 178, -1, 180, 181, 182, -1, 184, 185, 186, - 187, -1, 189, 190, 191, 192, 193, 194, 195, -1, - 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, - 207, 208, -1, 210, -1, 212, 213, 214, 215, 216, - 217, 218, 219, -1, 221, -1, 223, -1, -1, 226, - -1, 228, 229, 230, -1, 232, 233, 234, -1, -1, - 237, -1, 239, -1, -1, 242, 243, 244, 245, 246, - 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, - 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, - 267, 268, 269, 270, 271, 272, 273, -1, 275, 276, - 277, 278, 279, -1, 281, 282, -1, 284, -1, 286, - 287, 288, 289, 290, 291, -1, 293, 294, -1, -1, - 297, 298, 299, -1, -1, 302, 303, 304, -1, 306, - -1, 308, 309, 310, 311, 312, 313, 314, 315, 316, - 317, 318, 319, 320, 321, 322, 323, -1, 325, 326, - 327, -1, 329, 330, 331, 332, 333, 334, -1, 336, - 337, 338, 339, 340, 341, -1, 343, 344, 345, 346, - 347, 348, 349, 350, 351, 352, -1, 354, 355, 356, - 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, - -1, 368, 369, -1, 371, 372, 373, 374, 375, 376, - 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, - 387, 388, -1, 390, 391, 392, 393, 394, 395, 396, - 397, 398, -1, -1, 401, 402, 403, 404, -1, 406, - 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, - 417, 418, 419, 420, 421, 422, -1, -1, 425, 426, - 427, 428, -1, 430, 431, 432, 433, 434, 435, -1, - 437, 438, 439, -1, -1, 442, 443, 444, 445, 446, - -1, 448, 449, 450, 451, 452, 453, 454, 455, -1, - -1, 458, 459, 460, -1, 462, 463, 464, 465, 466, - -1, 468, 469, 470, 471, 472, 473, 474, 475, -1, - 477, -1, 479, 480, 481, 482, 483, 484, 485, -1, - -1, 488, -1, 490, 491, 492, 493, 494, 495, 496, - 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, - 507, 508, 509, 510, 511, -1, 3, 514, 5, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 528, -1, -1, -1, -1, 23, 24, 25, 26, - 27, 28, 29, 30, -1, 32, 33, 34, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 44, 45, -1, - -1, 48, 49, -1, 51, 52, 53, 54, 55, -1, - 57, 58, -1, -1, 61, 62, 63, 64, 65, -1, - -1, 68, 69, 70, 71, 72, 73, 74, -1, 76, - 77, 78, 79, 80, -1, -1, -1, 84, 85, 86, - 87, 88, 89, -1, 91, 92, 93, -1, 95, 96, - 97, 98, 99, 100, -1, -1, 103, 104, 105, 106, - 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, - 117, -1, 119, -1, 121, 122, 123, 124, 125, 126, - -1, -1, 129, 130, 131, 132, -1, -1, 135, 136, - 137, 138, 139, -1, 141, 142, 143, -1, 145, 146, - 147, 148, -1, 150, 151, 152, 153, 154, 155, 156, - 157, 158, 159, 160, 161, -1, 163, -1, 165, 166, - 167, 168, -1, 170, -1, 172, -1, 174, -1, 176, - 177, 178, -1, 180, 181, 182, -1, 184, 185, 186, - 187, -1, 189, 190, 191, 192, 193, 194, 195, -1, - 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, - 207, 208, -1, 210, -1, 212, 213, 214, 215, 216, - 217, 218, 219, -1, 221, -1, 223, -1, -1, 226, - -1, 228, 229, 230, -1, 232, 233, 234, -1, -1, - 237, -1, 239, -1, -1, 242, 243, 244, 245, 246, - 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, - 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, - 267, 268, 269, 270, 271, 272, 273, -1, 275, 276, - 277, 278, 279, -1, 281, 282, -1, 284, -1, 286, - 287, 288, 289, 290, 291, -1, 293, 294, -1, -1, - 297, 298, 299, -1, -1, 302, 303, 304, -1, 306, - -1, 308, 309, 310, 311, 312, 313, 314, 315, 316, - 317, 318, 319, 320, 321, 322, 323, -1, 325, 326, - 327, -1, 329, 330, 331, 332, 333, 334, -1, 336, - 337, 338, 339, 340, 341, -1, 343, 344, 345, 346, - 347, 348, 349, 350, 351, 352, -1, 354, 355, 356, - 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, - -1, 368, 369, -1, 371, 372, 373, 374, 375, 376, - 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, - 387, 388, -1, 390, 391, 392, 393, 394, 395, 396, - 397, 398, -1, -1, 401, 402, 403, 404, -1, 406, - 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, - 417, 418, 419, 420, 421, 422, -1, -1, 425, 426, - 427, 428, -1, 430, 431, 432, 433, 434, 435, -1, - 437, 438, 439, -1, -1, 442, 443, 444, 445, 446, - -1, 448, 449, 450, 451, 452, 453, 454, 455, -1, - -1, 458, 459, 460, -1, 462, 463, 464, 465, 466, - -1, 468, 469, 470, 471, 472, 473, 474, 475, -1, - 477, -1, 479, 480, 481, 482, 483, 484, 485, -1, - -1, 488, -1, 490, 491, 492, 493, 494, 495, 496, - 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, - 507, 508, 509, 510, 511, -1, 3, 514, 5, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 528, -1, -1, -1, -1, 23, 24, 25, 26, - 27, 28, 29, 30, -1, 32, 33, 34, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 44, 45, -1, - -1, 48, 49, -1, 51, 52, 53, 54, 55, -1, + -1, -1, -1, -1, -1, -1, 43, 44, 45, -1, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, -1, -1, 61, 62, 63, 64, 65, -1, - -1, 68, 69, 70, 71, 72, 73, 74, -1, 76, - 77, 78, 79, 80, -1, -1, -1, 84, 85, 86, - 87, 88, 89, -1, 91, 92, 93, -1, 95, 96, - 97, 98, 99, 100, -1, -1, 103, 104, 105, 106, + 67, 68, 69, 70, 71, 72, 73, 74, -1, 76, + 77, 78, 79, 80, -1, 82, -1, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, -1, 95, 96, + 97, 98, 99, 100, -1, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, -1, 119, -1, 121, 122, 123, 124, 125, 126, -1, -1, 129, 130, 131, 132, -1, -1, 135, 136, 137, 138, 139, -1, 141, 142, 143, -1, 145, 146, 147, 148, -1, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, -1, 163, -1, 165, 166, - 167, 168, -1, 170, -1, 172, -1, -1, -1, 176, - 177, 178, -1, 180, 181, 182, -1, 184, 185, 186, - 187, -1, 189, 190, 191, 192, 193, 194, 195, -1, + 167, 168, -1, 170, -1, 172, 173, -1, 175, 176, + 177, 178, 179, 180, 181, 182, -1, 184, 185, 186, + 187, -1, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, - 207, 208, -1, 210, -1, 212, 213, 214, 215, 216, - 217, 218, 219, -1, 221, -1, 223, -1, -1, 226, - -1, 228, 229, 230, -1, 232, 233, 234, -1, -1, - 237, -1, 239, -1, -1, 242, 243, 244, 245, 246, + 207, 208, -1, 210, 211, 212, 213, 214, 215, 216, + 217, 218, 219, -1, 221, -1, 223, 224, 225, 226, + 227, 228, 229, 230, -1, 232, 233, 234, -1, -1, + 237, 238, 239, 240, -1, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, - 267, 268, 269, 270, 271, 272, 273, -1, 275, 276, - 277, 278, 279, -1, 281, 282, -1, 284, -1, 286, + 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 279, -1, 281, 282, 283, 284, -1, 286, 287, 288, 289, 290, 291, -1, 293, 294, -1, -1, - 297, 298, 299, -1, -1, 302, 303, 304, -1, 306, - -1, 308, 309, 310, 311, 312, 313, 314, 315, 316, + 297, 298, 299, -1, -1, 302, 303, 304, 305, 306, + 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, -1, -1, -1, -1, 325, 326, - 327, -1, 329, 330, 331, 332, 333, 334, -1, 336, + 327, 328, 329, 330, 331, 332, 333, 334, -1, 336, 337, 338, 339, 340, 341, -1, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, -1, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, - -1, 368, 369, -1, 371, 372, 373, 374, 375, 376, + -1, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, -1, -1, 390, 391, 392, 393, 394, 395, 396, - 397, 398, -1, -1, 401, 402, 403, 404, -1, 406, + 397, 398, -1, 400, 401, 402, 403, 404, -1, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, -1, -1, 425, 426, - -1, 428, -1, 430, 431, 432, 433, 434, 435, -1, + -1, 428, 429, 430, 431, 432, 433, 434, 435, -1, 437, 438, 439, -1, -1, 442, 443, 444, 445, 446, -1, 448, 449, 450, 451, 452, 453, 454, 455, -1, -1, 458, 459, 460, -1, -1, 463, 464, 465, 466, -1, 468, 469, 470, 471, 472, 473, 474, 475, -1, - 477, -1, 479, 480, 481, 482, 483, 484, 485, -1, + 477, 478, 479, 480, 481, 482, 483, 484, 485, -1, -1, 488, -1, -1, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, - 507, 508, 509, 510, 511, 3, -1, 5, -1, -1, + 507, 508, 509, 510, 511, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 528, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 44, 45, -1, -1, - 48, 49, -1, 51, 52, 53, 54, 55, -1, 57, - 58, -1, -1, 61, 62, 63, 64, 65, -1, -1, + -1, -1, -1, -1, -1, 43, 44, 45, -1, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, -1, -1, 61, 62, 63, 64, 65, -1, 67, 68, 69, 70, 71, 72, 73, 74, -1, 76, 77, - 78, 79, 80, -1, -1, -1, 84, 85, 86, 87, - 88, 89, -1, 91, 92, 93, -1, 95, 96, 97, - 98, 99, 100, -1, -1, 103, 104, 105, 106, 107, + 78, 79, 80, -1, 82, -1, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, -1, 95, 96, 97, + 98, 99, 100, -1, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, -1, 119, -1, 121, 122, 123, 124, 125, 126, -1, -1, 129, 130, 131, 132, -1, -1, 135, 136, 137, 138, 139, -1, 141, 142, 143, -1, 145, 146, 147, 148, -1, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, -1, 163, -1, 165, 166, 167, - 168, -1, 170, -1, 172, -1, -1, -1, 176, 177, - 178, -1, 180, 181, 182, -1, 184, 185, 186, 187, - -1, 189, 190, 191, 192, 193, 194, 195, -1, 197, + 168, -1, 170, -1, 172, 173, -1, 175, 176, 177, + 178, 179, 180, 181, 182, -1, 184, 185, 186, 187, + -1, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, - 208, -1, 210, -1, 212, 213, 214, 215, 216, 217, - 218, 219, -1, 221, -1, 223, -1, -1, 226, -1, + 208, -1, 210, 211, 212, 213, 214, 215, 216, 217, + 218, 219, -1, 221, -1, 223, 224, 225, 226, 227, 228, 229, 230, -1, 232, 233, 234, -1, -1, 237, - -1, 239, -1, -1, 242, 243, 244, 245, 246, 247, + 238, 239, 240, -1, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, - 268, 269, 270, 271, 272, 273, -1, 275, 276, 277, - 278, 279, -1, 281, 282, -1, 284, -1, 286, 287, + 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, + 278, 279, -1, 281, 282, 283, 284, -1, 286, 287, 288, 289, 290, 291, -1, 293, 294, -1, -1, 297, - 298, 299, -1, -1, 302, 303, 304, -1, 306, -1, + 298, 299, -1, -1, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, -1, -1, -1, -1, 325, 326, 327, - -1, 329, 330, 331, 332, 333, 334, -1, 336, 337, + 328, 329, 330, 331, 332, 333, 334, -1, 336, 337, 338, 339, 340, 341, -1, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, -1, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, -1, - 368, 369, -1, 371, 372, 373, 374, 375, 376, 377, + 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, -1, -1, 390, 391, 392, 393, 394, 395, 396, 397, - 398, -1, -1, 401, 402, 403, 404, -1, 406, 407, + 398, -1, 400, 401, 402, 403, 404, -1, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, -1, -1, 425, 426, -1, - 428, -1, 430, 431, 432, 433, 434, 435, -1, 437, + 428, 429, 430, 431, 432, 433, 434, 435, -1, 437, 438, 439, -1, -1, 442, 443, 444, 445, 446, -1, 448, 449, 450, 451, 452, 453, 454, 455, -1, -1, 458, 459, 460, -1, -1, 463, 464, 465, 466, -1, 468, 469, 470, 471, 472, 473, 474, 475, -1, 477, - -1, 479, 480, 481, 482, 483, 484, 485, -1, -1, + 478, 479, 480, 481, 482, 483, 484, 485, -1, -1, 488, -1, -1, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, - 508, 509, 510, 511, 3, -1, 5, -1, -1, -1, + 508, 509, 510, 511, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 528, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, -1, -1, -1, -1, @@ -16178,6 +15910,159 @@ static const yytype_int16 yycheck[] = 89, -1, 91, 92, 93, -1, 95, 96, 97, 98, 99, 100, -1, -1, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, -1, + 119, -1, 121, 122, 123, 124, 125, 126, 127, 128, + 129, 130, 131, 132, -1, -1, 135, 136, 137, 138, + 139, -1, 141, 142, 143, -1, 145, 146, 147, 148, + -1, 150, 151, 152, 153, 154, 155, 156, 157, 158, + 159, 160, 161, -1, 163, -1, 165, 166, 167, 168, + -1, 170, -1, 172, -1, 174, -1, 176, 177, 178, + -1, 180, 181, 182, -1, 184, 185, 186, 187, -1, + 189, 190, 191, 192, 193, 194, 195, -1, 197, 198, + 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, + -1, 210, -1, 212, 213, 214, 215, 216, 217, 218, + 219, -1, 221, -1, 223, -1, -1, 226, -1, 228, + 229, 230, -1, 232, 233, 234, -1, -1, 237, -1, + 239, -1, -1, 242, 243, 244, 245, 246, 247, 248, + 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, + 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, + 269, 270, 271, 272, 273, -1, 275, 276, 277, 278, + 279, -1, 281, 282, -1, 284, -1, 286, 287, 288, + 289, 290, 291, -1, 293, 294, -1, -1, 297, 298, + 299, -1, -1, 302, 303, 304, -1, 306, -1, 308, + 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, + 319, 320, 321, 322, 323, -1, 325, 326, 327, -1, + 329, 330, 331, 332, 333, 334, -1, 336, 337, 338, + 339, 340, 341, -1, 343, 344, 345, 346, 347, 348, + 349, 350, 351, 352, -1, 354, 355, 356, 357, 358, + 359, 360, 361, 362, 363, 364, 365, 366, -1, 368, + 369, -1, 371, 372, 373, 374, 375, 376, 377, 378, + 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, + -1, 390, 391, 392, 393, 394, 395, 396, 397, 398, + 399, -1, 401, 402, 403, 404, -1, 406, 407, 408, + 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, + 419, 420, 421, 422, 423, -1, 425, 426, 427, 428, + -1, 430, 431, 432, 433, 434, 435, -1, 437, 438, + 439, -1, -1, 442, 443, 444, 445, 446, -1, 448, + 449, 450, 451, 452, 453, 454, 455, -1, -1, 458, + 459, 460, -1, 462, 463, 464, 465, 466, -1, 468, + 469, 470, 471, 472, 473, 474, 475, -1, 477, -1, + 479, 480, 481, 482, 483, 484, 485, -1, -1, 488, + -1, 490, 491, 492, 493, 494, 495, 496, 497, 498, + 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, + 509, 510, 511, -1, 3, 514, 5, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 528, + -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 44, 45, -1, -1, 48, + 49, -1, 51, 52, 53, 54, 55, -1, 57, 58, + -1, -1, 61, 62, 63, 64, 65, -1, -1, 68, + 69, 70, 71, 72, 73, 74, -1, 76, 77, 78, + 79, 80, -1, -1, -1, 84, 85, 86, 87, 88, + 89, -1, 91, 92, 93, -1, 95, 96, 97, 98, + 99, 100, -1, -1, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, 113, 114, 115, 116, 117, -1, + 119, -1, 121, 122, 123, 124, 125, 126, -1, -1, + 129, 130, 131, 132, -1, -1, 135, 136, 137, 138, + 139, -1, 141, 142, 143, -1, 145, 146, 147, 148, + -1, 150, 151, 152, 153, 154, 155, 156, 157, 158, + 159, 160, 161, -1, 163, -1, 165, 166, 167, 168, + -1, 170, -1, 172, -1, 174, -1, 176, 177, 178, + -1, 180, 181, 182, -1, 184, 185, 186, 187, -1, + 189, 190, 191, 192, 193, 194, 195, -1, 197, 198, + 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, + -1, 210, -1, 212, 213, 214, 215, 216, 217, 218, + 219, -1, 221, -1, 223, -1, -1, 226, -1, 228, + 229, 230, -1, 232, 233, 234, -1, -1, 237, -1, + 239, -1, -1, 242, 243, 244, 245, 246, 247, 248, + 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, + 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, + 269, 270, 271, 272, 273, -1, 275, 276, 277, 278, + 279, -1, 281, 282, -1, 284, -1, 286, 287, 288, + 289, 290, 291, -1, 293, 294, -1, -1, 297, 298, + 299, -1, -1, 302, 303, 304, -1, 306, -1, 308, + 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, + 319, 320, 321, 322, 323, -1, 325, 326, 327, -1, + 329, 330, 331, 332, 333, 334, -1, 336, 337, 338, + 339, 340, 341, -1, 343, 344, 345, 346, 347, 348, + 349, 350, 351, 352, -1, 354, 355, 356, 357, 358, + 359, 360, 361, 362, 363, 364, 365, 366, -1, 368, + 369, -1, 371, 372, 373, 374, 375, 376, 377, 378, + 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, + -1, 390, 391, 392, 393, 394, 395, 396, 397, 398, + -1, -1, 401, 402, 403, 404, -1, 406, 407, 408, + 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, + 419, 420, 421, 422, -1, -1, 425, 426, 427, 428, + -1, 430, 431, 432, 433, 434, 435, -1, 437, 438, + 439, -1, -1, 442, 443, 444, 445, 446, -1, 448, + 449, 450, 451, 452, 453, 454, 455, -1, -1, 458, + 459, 460, -1, 462, 463, 464, 465, 466, -1, 468, + 469, 470, 471, 472, 473, 474, 475, -1, 477, -1, + 479, 480, 481, 482, 483, 484, 485, -1, -1, 488, + -1, 490, 491, 492, 493, 494, 495, 496, 497, 498, + 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, + 509, 510, 511, -1, 3, 514, 5, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 528, + -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, + 29, 30, -1, 32, 33, 34, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 44, 45, -1, -1, 48, + 49, -1, 51, 52, 53, 54, 55, -1, 57, 58, + -1, -1, 61, 62, 63, 64, 65, -1, -1, 68, + 69, 70, 71, 72, 73, 74, -1, 76, 77, 78, + 79, 80, -1, -1, -1, 84, 85, 86, 87, 88, + 89, -1, 91, 92, 93, -1, 95, 96, 97, 98, + 99, 100, -1, -1, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, 113, 114, 115, 116, 117, -1, + 119, -1, 121, 122, 123, 124, 125, 126, -1, -1, + 129, 130, 131, 132, -1, -1, 135, 136, 137, 138, + 139, -1, 141, 142, 143, -1, 145, 146, 147, 148, + -1, 150, 151, 152, 153, 154, 155, 156, 157, 158, + 159, 160, 161, -1, 163, -1, 165, 166, 167, 168, + -1, 170, -1, 172, -1, 174, -1, 176, 177, 178, + -1, 180, 181, 182, -1, 184, 185, 186, 187, -1, + 189, 190, 191, 192, 193, 194, 195, -1, 197, 198, + 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, + -1, 210, -1, 212, 213, 214, 215, 216, 217, 218, + 219, -1, 221, -1, 223, -1, -1, 226, -1, 228, + 229, 230, -1, 232, 233, 234, -1, -1, 237, -1, + 239, -1, -1, 242, 243, 244, 245, 246, 247, 248, + 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, + 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, + 269, 270, 271, 272, 273, -1, 275, 276, 277, 278, + 279, -1, 281, 282, -1, 284, -1, 286, 287, 288, + 289, 290, 291, -1, 293, 294, -1, -1, 297, 298, + 299, -1, -1, 302, 303, 304, -1, 306, -1, 308, + 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, + 319, 320, 321, 322, 323, -1, 325, 326, 327, -1, + 329, 330, 331, 332, 333, 334, -1, 336, 337, 338, + 339, 340, 341, -1, 343, 344, 345, 346, 347, 348, + 349, 350, 351, 352, -1, 354, 355, 356, 357, 358, + 359, 360, 361, 362, 363, 364, 365, 366, -1, 368, + 369, -1, 371, 372, 373, 374, 375, 376, 377, 378, + 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, + -1, 390, 391, 392, 393, 394, 395, 396, 397, 398, + -1, -1, 401, 402, 403, 404, -1, 406, 407, 408, + 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, + 419, 420, 421, 422, -1, -1, 425, 426, 427, 428, + -1, 430, 431, 432, 433, 434, 435, -1, 437, 438, + 439, -1, -1, 442, 443, 444, 445, 446, -1, 448, + 449, 450, 451, 452, 453, 454, 455, -1, -1, 458, + 459, 460, -1, 462, 463, 464, 465, 466, -1, 468, + 469, 470, 471, 472, 473, 474, 475, -1, 477, -1, + 479, 480, 481, 482, 483, 484, 485, -1, -1, 488, + -1, 490, 491, 492, 493, 494, 495, 496, 497, 498, + 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, + 509, 510, 511, -1, 3, 514, 5, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 528, + -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, + 29, 30, -1, 32, 33, 34, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 44, 45, -1, -1, 48, + 49, -1, 51, 52, 53, 54, 55, -1, 57, 58, + -1, -1, 61, 62, 63, 64, 65, -1, -1, 68, + 69, 70, 71, 72, 73, 74, -1, 76, 77, 78, + 79, 80, -1, -1, -1, 84, 85, 86, 87, 88, + 89, -1, 91, 92, 93, -1, 95, 96, 97, 98, + 99, 100, -1, -1, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, 113, 114, 115, 116, 117, -1, 119, -1, 121, 122, 123, 124, 125, 126, -1, -1, 129, 130, 131, 132, -1, -1, 135, 136, 137, 138, 139, -1, 141, 142, 143, -1, 145, 146, 147, 148, @@ -16472,59 +16357,574 @@ static const yytype_int16 yycheck[] = 484, 485, -1, -1, 488, -1, -1, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 3, -1, + 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 528, -1, -1, -1, 23, 24, + 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, + 45, -1, -1, 48, 49, -1, 51, 52, 53, 54, + 55, -1, 57, 58, -1, -1, 61, 62, 63, 64, + 65, -1, -1, 68, 69, 70, 71, 72, 73, 74, + -1, 76, 77, 78, 79, 80, -1, -1, -1, 84, + 85, 86, 87, 88, 89, -1, 91, 92, 93, -1, + 95, 96, 97, 98, 99, 100, -1, -1, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, + 115, 116, 117, -1, 119, -1, 121, 122, 123, 124, + 125, 126, -1, -1, 129, 130, 131, 132, -1, -1, + 135, 136, 137, 138, 139, -1, 141, 142, 143, -1, + 145, 146, 147, 148, -1, 150, 151, 152, 153, 154, + 155, 156, 157, 158, 159, 160, 161, -1, 163, -1, + 165, 166, 167, 168, -1, 170, -1, 172, -1, -1, + -1, 176, 177, 178, -1, 180, 181, 182, -1, 184, + 185, 186, 187, -1, 189, 190, 191, 192, 193, 194, + 195, -1, 197, 198, 199, 200, -1, 202, 203, 204, + 205, 206, 207, 208, -1, 210, -1, 212, 213, 214, + 215, 216, 217, 218, 219, -1, 221, -1, 223, -1, + -1, 226, -1, 228, 229, 230, -1, 232, 233, 234, + -1, -1, 237, -1, 239, -1, -1, 242, 243, 244, + 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, + 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, -1, + 275, 276, 277, 278, 279, -1, 281, 282, -1, 284, + -1, 286, 287, 288, 289, 290, 291, -1, 293, 294, + -1, -1, 297, 298, 299, -1, -1, 302, 303, 304, + -1, 306, -1, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, -1, -1, -1, -1, + 325, 326, 327, -1, 329, 330, 331, 332, 333, 334, + -1, 336, 337, 338, 339, 340, 341, -1, 343, 344, + 345, 346, 347, 348, 349, 350, 351, 352, -1, 354, + 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, + 365, 366, -1, 368, 369, -1, 371, 372, 373, 374, + 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, + 385, 386, 387, -1, -1, 390, 391, 392, 393, 394, + 395, 396, 397, 398, -1, -1, 401, 402, 403, 404, + -1, 406, 407, 408, 409, 410, 411, 412, 413, 414, + 415, 416, 417, 418, 419, 420, 421, 422, -1, -1, + 425, 426, -1, 428, -1, 430, 431, 432, 433, 434, + 435, -1, 437, 438, 439, -1, -1, 442, 443, 444, + 445, 446, -1, 448, 449, 450, 451, 452, 453, 454, + 455, -1, -1, 458, 459, 460, -1, -1, 463, 464, + 465, 466, -1, 468, 469, 470, 471, 472, 473, 474, + 475, -1, 477, -1, 479, 480, 481, 482, 483, 484, + 485, -1, -1, 488, -1, -1, 491, 492, 493, 494, + 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, + 505, 506, 507, 508, 509, 510, 511, 3, -1, 5, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 528, -1, -1, -1, 23, 24, 25, + 26, 27, 28, 29, 30, -1, 32, 33, 34, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 44, 45, + -1, -1, 48, 49, -1, 51, 52, 53, 54, 55, + -1, 57, 58, -1, -1, 61, 62, 63, 64, 65, + -1, -1, 68, 69, 70, 71, 72, 73, 74, -1, + 76, 77, 78, 79, 80, -1, -1, -1, 84, 85, + 86, 87, 88, 89, -1, 91, 92, 93, -1, 95, + 96, 97, 98, 99, 100, -1, -1, 103, 104, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, + 116, 117, -1, 119, -1, 121, 122, 123, 124, 125, + 126, -1, -1, 129, 130, 131, 132, -1, -1, 135, + 136, 137, 138, 139, -1, 141, 142, 143, -1, 145, + 146, 147, 148, -1, 150, 151, 152, 153, 154, 155, + 156, 157, 158, 159, 160, 161, -1, 163, -1, 165, + 166, 167, 168, -1, 170, -1, 172, -1, -1, -1, + 176, 177, 178, -1, 180, 181, 182, -1, 184, 185, + 186, 187, -1, 189, 190, 191, 192, 193, 194, 195, + -1, 197, 198, 199, 200, -1, 202, 203, 204, 205, + 206, 207, 208, -1, 210, -1, 212, 213, 214, 215, + 216, 217, 218, 219, -1, 221, -1, 223, -1, -1, + 226, -1, 228, 229, 230, -1, 232, 233, 234, -1, + -1, 237, -1, 239, -1, -1, 242, 243, 244, 245, + 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, + 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, + 266, 267, 268, 269, 270, 271, 272, 273, -1, 275, + 276, 277, 278, 279, -1, 281, 282, -1, 284, -1, + 286, 287, 288, 289, 290, 291, -1, 293, 294, -1, + -1, 297, 298, 299, -1, -1, 302, 303, 304, -1, + 306, -1, 308, 309, 310, 311, 312, 313, 314, 315, + 316, 317, 318, 319, 320, -1, -1, -1, -1, 325, + 326, 327, -1, 329, 330, 331, 332, 333, 334, -1, + 336, 337, 338, 339, 340, 341, -1, 343, 344, 345, + 346, 347, 348, 349, 350, 351, 352, -1, 354, 355, + 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, + 366, -1, 368, 369, -1, 371, 372, 373, 374, 375, + 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, + 386, 387, -1, -1, 390, 391, 392, 393, 394, 395, + 396, 397, 398, -1, -1, 401, 402, 403, 404, -1, + 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, + 416, 417, 418, 419, 420, 421, 422, -1, -1, 425, + 426, -1, 428, -1, 430, 431, 432, 433, 434, 435, + -1, 437, 438, 439, -1, -1, 442, 443, 444, 445, + 446, -1, 448, 449, 450, 451, 452, 453, 454, 455, + -1, -1, 458, 459, 460, -1, -1, 463, 464, 465, + 466, -1, 468, 469, 470, 471, 472, 473, 474, 475, + -1, 477, -1, 479, 480, 481, 482, 483, 484, 485, + -1, -1, 488, -1, -1, 491, 492, 493, 494, 495, + 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, + 506, 507, 508, 509, 510, 511, 3, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 528, -1, -1, -1, 23, 24, 25, 26, + 27, 28, 29, 30, -1, 32, 33, 34, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 44, 45, -1, + -1, 48, 49, -1, 51, 52, 53, 54, 55, -1, + 57, 58, -1, -1, 61, 62, 63, 64, 65, -1, + -1, 68, 69, 70, 71, 72, 73, 74, -1, 76, + 77, 78, 79, 80, -1, -1, -1, 84, 85, 86, + 87, 88, 89, -1, 91, 92, 93, -1, 95, 96, + 97, 98, 99, 100, -1, -1, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 117, -1, 119, -1, 121, 122, 123, 124, 125, 126, + -1, -1, 129, 130, 131, 132, -1, -1, 135, 136, + 137, 138, 139, -1, 141, 142, 143, -1, 145, 146, + 147, 148, -1, 150, 151, 152, 153, 154, 155, 156, + 157, 158, 159, 160, 161, -1, 163, -1, 165, 166, + 167, 168, -1, 170, -1, 172, -1, -1, -1, 176, + 177, 178, -1, 180, 181, 182, -1, 184, 185, 186, + 187, -1, 189, 190, 191, 192, 193, 194, 195, -1, + 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, + 207, 208, -1, 210, -1, 212, 213, 214, 215, 216, + 217, 218, 219, -1, 221, -1, 223, -1, -1, 226, + -1, 228, 229, 230, -1, 232, 233, 234, -1, -1, + 237, -1, 239, -1, -1, 242, 243, 244, 245, 246, + 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, 273, -1, 275, 276, + 277, 278, 279, -1, 281, 282, -1, 284, -1, 286, + 287, 288, 289, 290, 291, -1, 293, 294, -1, -1, + 297, 298, 299, -1, -1, 302, 303, 304, -1, 306, + -1, 308, 309, 310, 311, 312, 313, 314, 315, 316, + 317, 318, 319, 320, -1, -1, -1, -1, 325, 326, + 327, -1, 329, 330, 331, 332, 333, 334, -1, 336, + 337, 338, 339, 340, 341, -1, 343, 344, 345, 346, + 347, 348, 349, 350, 351, 352, -1, 354, 355, 356, + 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, + -1, 368, 369, -1, 371, 372, 373, 374, 375, 376, + 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, + 387, -1, -1, 390, 391, 392, 393, 394, 395, 396, + 397, 398, -1, -1, 401, 402, 403, 404, -1, 406, + 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, + 417, 418, 419, 420, 421, 422, -1, -1, 425, 426, + -1, 428, -1, 430, 431, 432, 433, 434, 435, -1, + 437, 438, 439, -1, -1, 442, 443, 444, 445, 446, + -1, 448, 449, 450, 451, 452, 453, 454, 455, -1, + -1, 458, 459, 460, -1, -1, 463, 464, 465, 466, + -1, 468, 469, 470, 471, 472, 473, 474, 475, -1, + 477, -1, 479, 480, 481, 482, 483, 484, 485, -1, + -1, 488, -1, -1, 491, 492, 493, 494, 495, 496, + 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, + 507, 508, 509, 510, 511, 3, -1, -1, -1, -1, + -1, -1, -1, -1, 521, -1, -1, -1, -1, -1, + -1, 528, -1, -1, -1, 23, 24, 25, 26, 27, + 28, 29, 30, -1, 32, 33, 34, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 44, 45, -1, -1, + 48, 49, -1, 51, 52, 53, 54, 55, -1, 57, + 58, -1, -1, 61, 62, 63, 64, 65, -1, -1, + 68, 69, 70, 71, 72, 73, 74, -1, 76, 77, + 78, 79, 80, -1, -1, -1, 84, 85, 86, 87, + 88, 89, -1, 91, 92, 93, -1, 95, 96, 97, + 98, 99, 100, -1, -1, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, + -1, 119, -1, 121, 122, 123, 124, 125, 126, -1, + -1, 129, 130, 131, 132, -1, -1, 135, 136, 137, + 138, 139, -1, 141, 142, 143, -1, 145, 146, 147, + 148, -1, 150, 151, 152, 153, 154, 155, 156, 157, + 158, 159, 160, 161, -1, 163, -1, 165, 166, 167, + 168, -1, 170, -1, 172, -1, -1, -1, 176, 177, + 178, -1, 180, 181, 182, -1, 184, 185, 186, 187, + -1, 189, 190, 191, 192, 193, 194, 195, -1, 197, + 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, + 208, -1, 210, -1, 212, 213, 214, 215, 216, 217, + 218, 219, -1, 221, -1, 223, -1, -1, 226, -1, + 228, 229, 230, -1, 232, 233, 234, -1, -1, 237, + -1, 239, -1, -1, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, + 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, + 268, 269, 270, 271, 272, 273, -1, 275, 276, 277, + 278, 279, -1, 281, 282, -1, 284, -1, 286, 287, + 288, 289, 290, 291, -1, 293, 294, -1, -1, 297, + 298, 299, -1, -1, 302, 303, 304, -1, 306, -1, + 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, + 318, 319, 320, -1, -1, -1, -1, 325, 326, 327, + -1, 329, 330, 331, 332, 333, 334, -1, 336, 337, + 338, 339, 340, 341, -1, 343, 344, 345, 346, 347, + 348, 349, 350, 351, 352, -1, 354, 355, 356, 357, + 358, 359, 360, 361, 362, 363, 364, 365, 366, -1, + 368, 369, -1, 371, 372, 373, 374, 375, 376, 377, + 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, + -1, -1, 390, 391, 392, 393, 394, 395, 396, 397, + 398, -1, -1, 401, 402, 403, 404, -1, 406, 407, + 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, + 418, 419, 420, 421, 422, -1, -1, 425, 426, -1, + 428, -1, 430, 431, 432, 433, 434, 435, -1, 437, + 438, 439, -1, -1, 442, 443, 444, 445, 446, -1, + 448, 449, 450, 451, 452, 453, 454, 455, -1, -1, + 458, 459, 460, -1, -1, 463, 464, 465, 466, -1, + 468, 469, 470, 471, 472, 473, 474, 475, -1, 477, + -1, 479, 480, 481, 482, 483, 484, 485, -1, -1, + 488, -1, -1, 491, 492, 493, 494, 495, 496, 497, + 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, + 508, 509, 510, 511, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 528, -1, -1, -1, 23, 24, - 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, - 45, -1, -1, 48, 49, -1, 51, 52, 53, 54, - 55, -1, 57, 58, -1, -1, 61, 62, 63, 64, - 65, -1, -1, 68, 69, 70, 71, 72, 73, 74, - -1, 76, 77, 78, 79, 80, -1, -1, -1, 84, - 85, 86, 87, 88, 89, -1, 91, 92, 93, -1, - 95, 96, 97, 98, 99, 100, -1, -1, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, -1, 119, -1, 121, 122, 123, 124, - 125, 126, -1, -1, 129, 130, 131, 132, -1, -1, - 135, 136, 137, 138, 139, -1, 141, 142, 143, -1, - 145, 146, 147, 148, -1, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, -1, 163, -1, - 165, 166, 167, 168, -1, 170, -1, 172, -1, -1, - -1, 176, 177, 178, -1, 180, 181, 182, -1, 184, - 185, 186, 187, -1, 189, 190, 191, 192, 193, 194, - 195, -1, 197, 198, 199, 200, -1, 202, 203, 204, - 205, 206, 207, 208, -1, 210, -1, 212, 213, 214, - 215, 216, 217, 218, 219, -1, 221, -1, 223, -1, - -1, 226, -1, 228, 229, 230, -1, 232, 233, 234, - -1, -1, 237, -1, 239, -1, -1, 242, 243, 244, + 528, -1, -1, -1, 23, 24, 25, 26, 27, 28, + 29, 30, -1, 32, 33, 34, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 44, 45, -1, -1, 48, + 49, -1, 51, 52, 53, 54, 55, -1, 57, 58, + -1, -1, 61, 62, 63, 64, 65, -1, -1, 68, + 69, 70, 71, 72, 73, 74, -1, 76, 77, 78, + 79, 80, -1, -1, -1, 84, 85, 86, 87, 88, + 89, -1, 91, 92, 93, -1, 95, 96, 97, 98, + 99, 100, -1, -1, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, 113, 114, 115, 116, 117, -1, + 119, -1, 121, 122, 123, 124, 125, 126, -1, -1, + 129, 130, 131, 132, -1, -1, 135, 136, 137, 138, + 139, -1, 141, 142, 143, -1, 145, 146, 147, 148, + -1, 150, 151, 152, 153, 154, 155, 156, 157, 158, + 159, 160, 161, -1, 163, -1, 165, 166, 167, 168, + -1, 170, -1, 172, -1, -1, -1, 176, 177, 178, + -1, 180, 181, 182, -1, 184, 185, 186, 187, -1, + 189, 190, 191, 192, 193, 194, 195, -1, 197, 198, + 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, + -1, 210, -1, 212, 213, 214, 215, 216, 217, 218, + 219, -1, 221, -1, 223, -1, -1, 226, -1, 228, + 229, 230, -1, 232, 233, 234, -1, -1, 237, -1, + 239, -1, -1, 242, 243, 244, 245, 246, 247, 248, + 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, + 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, + 269, 270, 271, 272, 273, -1, 275, 276, 277, 278, + 279, -1, 281, 282, -1, 284, -1, 286, 287, 288, + 289, 290, 291, -1, 293, 294, -1, -1, 297, 298, + 299, -1, -1, 302, 303, 304, -1, 306, -1, 308, + 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, + 319, 320, -1, -1, -1, -1, 325, 326, 327, -1, + 329, 330, 331, 332, 333, 334, -1, 336, 337, 338, + 339, 340, 341, -1, 343, 344, 345, 346, 347, 348, + 349, 350, 351, 352, -1, 354, 355, 356, 357, 358, + 359, 360, 361, 362, 363, 364, 365, 366, -1, 368, + 369, -1, 371, 372, 373, 374, 375, 376, 377, 378, + 379, 380, 381, 382, 383, 384, 385, 386, 387, -1, + -1, 390, 391, 392, 393, 394, 395, 396, 397, 398, + -1, -1, 401, 402, 403, 404, -1, 406, 407, 408, + 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, + 419, 420, 421, 422, -1, -1, 425, 426, -1, 428, + -1, 430, 431, 432, 433, 434, 435, -1, 437, 438, + 439, -1, -1, 442, 443, 444, 445, 446, -1, 448, + 449, 450, 451, 452, 453, 454, 455, -1, -1, 458, + 459, 460, -1, -1, 463, 464, 465, 466, -1, 468, + 469, 470, 471, 472, 473, 474, 475, -1, 477, -1, + 479, 480, 481, 482, 483, 484, 485, -1, -1, 488, + -1, -1, 491, 492, 493, 494, 495, 496, 497, 498, + 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, + 509, 510, 511, 3, 4, 5, -1, -1, 8, 9, + -1, -1, -1, -1, -1, 15, 16, -1, -1, 528, + 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, + 50, 51, 52, 53, -1, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + -1, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, + 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, + 150, 151, 152, 153, -1, 155, 156, 157, 158, 159, + 160, -1, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + 180, 181, 182, 183, -1, -1, 186, 187, 188, 189, + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, + 210, 211, -1, 213, 214, 215, 216, 217, 218, 219, + 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, + 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, + 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, + 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, + 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, + 280, 281, 282, 283, 284, 285, -1, 287, 288, 289, + 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, + 300, 301, 302, 303, -1, 305, 306, 307, -1, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, 321, 322, 323, 324, 325, 326, -1, 328, 329, + 330, -1, 332, 333, 334, 335, 336, 337, 338, 339, + 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, + 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, + 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, + 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, + 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, + 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, + 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, + 420, 421, -1, 423, 424, 425, 426, 427, 428, 429, + 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, + 440, 441, 442, 443, -1, 445, -1, 447, 448, 449, + 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, + 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, + 470, 471, 472, -1, 474, 475, 476, 477, 478, 479, + 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, + 490, 491, 492, 493, 494, 495, 496, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 508, 509, + 510, 511, -1, 3, -1, 515, 516, 517, 8, 519, + 520, 521, 522, 523, 524, 15, 16, -1, -1, -1, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, -1, 32, 33, 34, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 44, 45, -1, -1, 48, 49, + -1, 51, 52, 53, 54, 55, -1, 57, 58, -1, + -1, 61, 62, 63, 64, 65, -1, -1, 68, 69, + 70, 71, 72, 73, 74, -1, 76, 77, 78, 79, + 80, -1, -1, -1, 84, 85, 86, 87, 88, 89, + -1, 91, 92, 93, -1, 95, 96, 97, 98, 99, + 100, -1, -1, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 117, -1, 119, + -1, 121, 122, 123, 124, 125, 126, -1, -1, 129, + 130, 131, 132, -1, -1, 135, 136, 137, 138, 139, + -1, 141, 142, 143, -1, 145, 146, 147, 148, -1, + 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, + 160, 161, -1, 163, -1, 165, 166, 167, 168, -1, + 170, -1, 172, -1, -1, -1, 176, 177, 178, -1, + 180, 181, 182, -1, 184, 185, 186, 187, -1, 189, + 190, 191, 192, 193, 194, 195, -1, 197, 198, 199, + 200, -1, 202, 203, 204, 205, 206, 207, 208, -1, + 210, -1, 212, 213, 214, 215, 216, 217, 218, 219, + -1, 221, -1, 223, -1, -1, 226, -1, 228, 229, + 230, -1, 232, 233, 234, -1, -1, 237, -1, 239, + -1, -1, 242, 243, 244, 245, 246, 247, 248, 249, + 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, + 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, + 270, 271, 272, 273, -1, 275, 276, 277, 278, 279, + -1, 281, 282, -1, 284, -1, 286, 287, 288, 289, + 290, 291, -1, 293, 294, -1, -1, 297, 298, 299, + -1, -1, 302, 303, 304, -1, 306, -1, 308, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, -1, -1, -1, -1, 325, 326, 327, -1, 329, + 330, 331, 332, 333, 334, -1, 336, 337, 338, 339, + 340, 341, -1, 343, 344, 345, 346, 347, 348, 349, + 350, 351, 352, -1, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 364, 365, 366, -1, 368, 369, + -1, 371, 372, 373, 374, 375, 376, 377, 378, 379, + 380, 381, 382, 383, 384, 385, 386, 387, -1, -1, + 390, 391, 392, 393, 394, 395, 396, 397, 398, -1, + -1, 401, 402, 403, 404, -1, 406, 407, 408, 409, + 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, + 420, 421, 422, -1, -1, 425, 426, -1, 428, -1, + 430, 431, 432, 433, 434, 435, -1, 437, 438, 439, + -1, -1, 442, 443, 444, 445, 446, -1, 448, 449, + 450, 451, 452, 453, 454, 455, -1, -1, 458, 459, + 460, -1, -1, 463, 464, 465, 466, -1, 468, 469, + 470, 471, 472, 473, 474, 475, -1, 477, -1, 479, + 480, 481, 482, 483, 484, 485, -1, -1, 488, -1, + -1, 491, 492, 493, 494, 495, 496, 497, 498, 499, + 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, + 510, 511, -1, -1, -1, 515, 516, 517, -1, 519, + 520, 521, 522, 523, 524, 8, -1, -1, 11, -1, + -1, -1, 15, 16, 17, 18, -1, 20, 21, 22, + -1, -1, -1, 8, -1, -1, 11, -1, -1, -1, + 15, 16, 17, 18, 37, 20, 21, 22, -1, -1, + -1, -1, -1, -1, 47, -1, -1, -1, -1, -1, + -1, 54, 37, -1, -1, -1, -1, -1, 8, -1, + -1, 11, 47, -1, -1, 15, 16, 17, 18, 54, + 20, 21, 22, -1, -1, -1, 8, -1, 81, 11, + -1, -1, -1, 15, 16, 17, 18, 37, 20, 21, + 22, -1, -1, -1, -1, -1, 81, 47, -1, -1, + -1, -1, -1, -1, 54, 37, -1, -1, -1, -1, + -1, 8, -1, -1, 11, 47, -1, -1, 15, 16, + 17, 18, 54, 20, 21, 22, -1, -1, -1, -1, + -1, 81, -1, -1, -1, -1, -1, -1, -1, -1, + 37, -1, -1, -1, -1, -1, -1, -1, -1, 81, + 47, -1, -1, 8, -1, -1, 11, 54, -1, -1, + 15, 16, 17, 18, -1, 20, 21, 22, -1, -1, + -1, -1, -1, -1, -1, -1, 179, -1, -1, -1, + -1, -1, 37, -1, 81, -1, -1, -1, -1, -1, + -1, -1, 47, 196, 179, -1, -1, -1, 201, 54, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 196, -1, -1, -1, -1, 201, -1, -1, -1, + -1, 224, 225, -1, -1, -1, 81, -1, -1, 179, + -1, -1, -1, -1, -1, -1, -1, 240, -1, 224, + 225, -1, -1, -1, -1, -1, 196, 179, -1, -1, + -1, 201, -1, -1, -1, 240, -1, -1, -1, -1, + -1, -1, -1, -1, 196, -1, -1, -1, -1, 201, + -1, -1, -1, -1, 224, 225, -1, 280, -1, -1, + 283, -1, 179, -1, -1, -1, -1, -1, -1, -1, + 240, -1, 224, 225, 297, 280, -1, 300, 283, 196, + -1, -1, -1, -1, 201, -1, -1, -1, 240, -1, + -1, -1, 297, -1, -1, 300, -1, -1, -1, -1, + -1, -1, -1, -1, 179, -1, -1, 224, 225, -1, + 280, -1, -1, 283, -1, -1, -1, -1, -1, -1, + -1, 196, -1, 240, -1, -1, 201, 297, 280, -1, + 300, 283, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 297, -1, -1, 300, 224, + 225, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 280, -1, 240, 283, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 400, -1, -1, + 297, -1, -1, 300, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 400, -1, -1, -1, -1, + -1, -1, -1, 8, -1, 280, 11, -1, 283, -1, + 15, 16, 17, 18, -1, 20, 21, 22, -1, -1, + -1, -1, 297, -1, -1, 300, -1, -1, -1, -1, + 400, -1, 37, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 47, -1, -1, -1, -1, -1, 400, 54, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 81, -1, -1, -1, + -1, -1, -1, 400, -1, -1, -1, -1, -1, 512, + -1, -1, 515, 516, 517, -1, 519, 520, 521, 522, + 523, 524, -1, -1, -1, -1, 529, 512, -1, -1, + 515, 516, 517, -1, 519, 520, 521, 522, 523, 524, + -1, -1, -1, -1, 529, 400, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 512, -1, -1, 515, 516, 517, -1, 519, + 520, 521, 522, 523, 524, -1, -1, -1, -1, 529, + 512, -1, -1, 515, 516, 517, -1, 519, 520, 521, + 522, 523, 524, -1, 179, -1, -1, 529, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 196, -1, -1, -1, 512, 201, -1, 515, 516, + 517, -1, 519, 520, 521, 522, 523, 524, -1, -1, + -1, -1, 529, -1, 8, -1, -1, 11, -1, 224, + 225, 15, 16, 17, 18, -1, 20, 21, 22, -1, + -1, -1, -1, -1, -1, 240, -1, 512, -1, -1, + 515, 516, 517, 37, 519, 520, 521, 522, 523, 524, + -1, -1, -1, 47, 529, 8, -1, -1, 11, -1, + 54, -1, 15, 16, 17, 18, -1, 20, 21, 22, + -1, -1, -1, -1, -1, 280, -1, -1, 283, -1, + -1, -1, -1, -1, 37, -1, -1, 81, -1, -1, + -1, -1, 297, -1, 47, 300, -1, -1, -1, -1, + -1, 54, -1, -1, 8, -1, -1, 11, -1, -1, + -1, 15, 16, 17, 18, -1, 20, 21, 22, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 81, -1, + -1, -1, -1, 37, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 47, -1, -1, -1, -1, -1, -1, + 54, -1, 8, -1, -1, 11, -1, -1, -1, 15, + 16, 17, 18, -1, 20, 21, 22, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 81, -1, -1, + -1, 37, -1, -1, -1, 179, -1, -1, -1, -1, + -1, 47, -1, -1, -1, 400, -1, -1, 54, -1, + -1, -1, 196, -1, -1, -1, 8, 201, -1, 11, + -1, -1, -1, 15, 16, 17, 18, -1, 20, 21, + 22, -1, -1, -1, -1, 81, 179, -1, -1, -1, + 224, 225, -1, -1, -1, 37, -1, -1, -1, -1, + -1, -1, -1, 196, -1, 47, 240, -1, 201, -1, + -1, -1, 54, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 224, 225, -1, -1, 179, -1, -1, -1, 81, + -1, -1, -1, -1, -1, -1, 280, 240, -1, 283, + -1, -1, 196, -1, -1, -1, -1, 201, -1, -1, + -1, -1, -1, 297, -1, -1, 300, 512, -1, -1, + 515, 516, 517, -1, 519, 520, 521, 522, 523, 524, + 224, 225, -1, 179, 529, -1, -1, 280, -1, -1, + 283, -1, -1, -1, -1, -1, 240, -1, -1, -1, + 196, -1, -1, -1, 297, 201, -1, 300, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 224, 225, + -1, -1, -1, -1, -1, -1, 280, 179, -1, 283, + -1, -1, -1, -1, 240, -1, -1, -1, -1, -1, + -1, -1, -1, 297, 196, -1, 300, -1, -1, 201, + -1, -1, -1, -1, -1, -1, 400, 8, -1, -1, + 11, -1, -1, -1, 15, 16, 17, 18, -1, 20, + 21, 22, 224, 225, 280, -1, -1, 283, -1, -1, + -1, -1, -1, -1, -1, -1, 37, -1, 240, -1, + -1, 297, -1, -1, 300, -1, 47, 400, -1, -1, + -1, -1, -1, 54, -1, -1, -1, -1, 8, -1, + -1, 11, -1, -1, -1, 15, 16, 17, 18, -1, + 20, 21, 22, -1, -1, -1, -1, -1, 280, -1, + 81, 283, -1, -1, -1, -1, -1, 37, -1, -1, + -1, -1, -1, -1, -1, 297, 400, 47, 300, -1, + -1, -1, -1, -1, 54, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 512, -1, + -1, 515, 516, 517, -1, 519, 520, 521, 522, 523, + 524, 81, -1, -1, -1, 529, -1, -1, -1, -1, + -1, -1, -1, -1, 400, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 512, + -1, -1, 515, 516, 517, -1, 519, 520, 521, 522, + 523, 524, -1, -1, -1, -1, 529, -1, 179, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 196, -1, -1, 400, -1, + 201, -1, -1, -1, -1, -1, -1, -1, 512, -1, + -1, 515, 516, 517, -1, 519, 520, 521, 522, 523, + 524, -1, -1, 224, 225, 529, -1, -1, -1, 179, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 240, + -1, -1, -1, -1, -1, -1, 196, -1, -1, -1, + -1, 201, -1, -1, -1, -1, 512, -1, -1, 515, + 516, 517, -1, 519, 520, 521, 522, 523, 524, -1, + -1, 527, -1, -1, 224, 225, -1, -1, -1, 280, + -1, -1, 283, -1, -1, -1, -1, -1, -1, -1, + 240, -1, -1, -1, -1, -1, 297, -1, -1, 300, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 512, -1, -1, 515, 516, 517, -1, 519, 520, 521, + 522, 523, 524, -1, -1, 527, -1, -1, -1, -1, + 280, -1, -1, 283, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 297, -1, -1, + 300, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 400, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 400, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 512, -1, -1, 515, 516, 517, -1, 519, 520, + 521, 522, 523, 524, -1, -1, 527, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 3, -1, + -1, -1, 512, -1, -1, 515, 516, 517, -1, 519, + 520, 521, 522, 523, 524, -1, -1, 527, 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, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, + 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, + 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, + 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, + 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, + 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, + 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, + 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, + 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, + 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, + 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, + 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, + 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, + 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, -1, - 275, 276, 277, 278, 279, -1, 281, 282, -1, 284, - -1, 286, 287, 288, 289, 290, 291, -1, 293, 294, - -1, -1, 297, 298, 299, -1, -1, 302, 303, 304, - -1, 306, -1, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, -1, -1, -1, -1, - 325, 326, 327, -1, 329, 330, 331, 332, 333, 334, - -1, 336, 337, 338, 339, 340, 341, -1, 343, 344, - 345, 346, 347, 348, 349, 350, 351, 352, -1, 354, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, + 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, + 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, - 365, 366, -1, 368, 369, -1, 371, 372, 373, 374, + 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, - 385, 386, 387, -1, -1, 390, 391, 392, 393, 394, - 395, 396, 397, 398, -1, -1, 401, 402, 403, 404, - -1, 406, 407, 408, 409, 410, 411, 412, 413, 414, - 415, 416, 417, 418, 419, 420, 421, 422, -1, -1, - 425, 426, -1, 428, -1, 430, 431, 432, 433, 434, - 435, -1, 437, 438, 439, -1, -1, 442, 443, 444, - 445, 446, -1, 448, 449, 450, 451, 452, 453, 454, - 455, -1, -1, 458, 459, 460, -1, -1, 463, 464, - 465, 466, -1, 468, 469, 470, 471, 472, 473, 474, - 475, -1, 477, -1, 479, 480, 481, 482, 483, 484, - 485, -1, -1, 488, -1, -1, 491, 492, 493, 494, + 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, + 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, + 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, + 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, + 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, + 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, + 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, + 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, + 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, + 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, + 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 3, -1, -1, -1, -1, -1, -1, -1, -1, 521, -1, -1, -1, - -1, -1, -1, 528, -1, -1, -1, 23, 24, 25, + -1, -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, 45, -1, -1, 48, 49, -1, 51, 52, 53, 54, 55, @@ -16574,8 +16974,8 @@ static const yytype_int16 yycheck[] = -1, -1, 488, -1, -1, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 3, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 528, -1, -1, -1, 23, 24, 25, 26, + -1, -1, -1, -1, -1, 521, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, 45, -1, -1, 48, 49, -1, 51, 52, 53, 54, 55, -1, @@ -16623,625 +17023,269 @@ static const yytype_int16 yycheck[] = -1, 468, 469, 470, 471, 472, 473, 474, 475, -1, 477, -1, 479, 480, 481, 482, 483, 484, 485, -1, -1, 488, -1, -1, 491, 492, 493, 494, 495, 496, - 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, - 507, 508, 509, 510, 511, 3, 4, 5, -1, -1, - 8, 9, -1, -1, -1, -1, -1, 15, 16, -1, - -1, 528, 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, 50, 51, 52, 53, -1, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, -1, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, - 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, - 148, 149, 150, 151, 152, 153, -1, 155, 156, 157, - 158, 159, 160, -1, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 183, -1, -1, 186, 187, - 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 211, -1, 213, 214, 215, 216, 217, - 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, - 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, - 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, - 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, - 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, - 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, 280, 281, 282, 283, 284, 285, -1, 287, - 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, - 298, 299, 300, 301, 302, 303, -1, 305, 306, 307, - -1, 309, 310, 311, 312, 313, 314, 315, 316, 317, - 318, 319, 320, 321, 322, 323, 324, 325, 326, -1, - 328, 329, 330, -1, 332, 333, 334, 335, 336, 337, - 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, - 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, - 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, - 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, - 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, - 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, - 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, - 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, - 418, 419, 420, 421, -1, 423, 424, 425, 426, 427, - 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, - 438, 439, 440, 441, 442, 443, -1, 445, -1, 447, - 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, - 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, - 468, 469, 470, 471, 472, -1, 474, 475, 476, 477, - 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, - 488, 489, 490, 491, 492, 493, 494, 495, 496, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 508, 509, 510, 511, -1, 3, -1, 515, 516, 517, - 8, 519, 520, 521, 522, 523, 524, 15, 16, -1, - -1, -1, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, -1, 32, 33, 34, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 44, 45, -1, -1, - 48, 49, -1, 51, 52, 53, 54, 55, -1, 57, - 58, -1, -1, 61, 62, 63, 64, 65, -1, -1, - 68, 69, 70, 71, 72, 73, 74, -1, 76, 77, - 78, 79, 80, -1, -1, -1, 84, 85, 86, 87, - 88, 89, -1, 91, 92, 93, -1, 95, 96, 97, - 98, 99, 100, -1, -1, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - -1, 119, -1, 121, 122, 123, 124, 125, 126, -1, - -1, 129, 130, 131, 132, -1, -1, 135, 136, 137, - 138, 139, -1, 141, 142, 143, -1, 145, 146, 147, - 148, -1, 150, 151, 152, 153, 154, 155, 156, 157, - 158, 159, 160, 161, -1, 163, -1, 165, 166, 167, - 168, -1, 170, -1, 172, -1, -1, -1, 176, 177, - 178, -1, 180, 181, 182, -1, 184, 185, 186, 187, - -1, 189, 190, 191, 192, 193, 194, 195, -1, 197, - 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, - 208, -1, 210, -1, 212, 213, 214, 215, 216, 217, - 218, 219, -1, 221, -1, 223, -1, -1, 226, -1, - 228, 229, 230, -1, 232, 233, 234, -1, -1, 237, - -1, 239, -1, -1, 242, 243, 244, 245, 246, 247, - 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, - 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, - 268, 269, 270, 271, 272, 273, -1, 275, 276, 277, - 278, 279, -1, 281, 282, -1, 284, -1, 286, 287, - 288, 289, 290, 291, -1, 293, 294, -1, -1, 297, - 298, 299, -1, -1, 302, 303, 304, -1, 306, -1, - 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, - 318, 319, 320, -1, -1, -1, -1, 325, 326, 327, - -1, 329, 330, 331, 332, 333, 334, -1, 336, 337, - 338, 339, 340, 341, -1, 343, 344, 345, 346, 347, - 348, 349, 350, 351, 352, -1, 354, 355, 356, 357, - 358, 359, 360, 361, 362, 363, 364, 365, 366, -1, - 368, 369, -1, 371, 372, 373, 374, 375, 376, 377, - 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, - -1, -1, 390, 391, 392, 393, 394, 395, 396, 397, - 398, -1, -1, 401, 402, 403, 404, -1, 406, 407, - 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, - 418, 419, 420, 421, 422, -1, -1, 425, 426, -1, - 428, -1, 430, 431, 432, 433, 434, 435, -1, 437, - 438, 439, -1, -1, 442, 443, 444, 445, 446, -1, - 448, 449, 450, 451, 452, 453, 454, 455, -1, -1, - 458, 459, 460, -1, -1, 463, 464, 465, 466, -1, - 468, 469, 470, 471, 472, 473, 474, 475, -1, 477, - -1, 479, 480, 481, 482, 483, 484, 485, -1, -1, - 488, -1, -1, 491, 492, 493, 494, 495, 496, 497, - 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, - 508, 509, 510, 511, -1, -1, -1, 515, 516, 517, - -1, 519, 520, 521, 522, 523, 524, 8, -1, -1, - 11, -1, -1, -1, 15, 16, 17, 18, -1, 20, - 21, 22, -1, -1, -1, 8, -1, -1, 11, -1, - -1, -1, 15, 16, 17, 18, 37, 20, 21, 22, - -1, -1, -1, -1, -1, -1, 47, -1, -1, -1, - -1, -1, -1, 54, 37, -1, -1, -1, -1, -1, - 8, -1, -1, 11, 47, -1, -1, 15, 16, 17, - 18, 54, 20, 21, 22, -1, -1, -1, 8, -1, - 81, 11, -1, -1, -1, 15, 16, 17, 18, 37, - 20, 21, 22, -1, -1, -1, -1, -1, 81, 47, - -1, -1, -1, -1, -1, -1, 54, 37, -1, -1, - -1, -1, -1, 8, -1, -1, 11, 47, -1, -1, - 15, 16, 17, 18, 54, 20, 21, 22, -1, -1, - -1, -1, -1, 81, -1, -1, -1, -1, -1, -1, - -1, -1, 37, -1, -1, -1, -1, -1, -1, -1, - -1, 81, 47, -1, -1, 8, -1, -1, 11, 54, - -1, -1, 15, 16, 17, 18, -1, 20, 21, 22, - -1, -1, -1, -1, -1, -1, -1, -1, 179, -1, - -1, -1, -1, -1, 37, -1, 81, -1, -1, -1, - -1, -1, -1, -1, 47, 196, 179, -1, -1, -1, - 201, 54, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 196, -1, -1, -1, -1, 201, -1, - -1, -1, -1, 224, 225, -1, -1, -1, 81, -1, - -1, 179, -1, -1, -1, -1, -1, -1, -1, 240, - -1, 224, 225, -1, -1, -1, -1, -1, 196, 179, - -1, -1, -1, 201, -1, -1, -1, 240, -1, -1, - -1, -1, -1, -1, -1, -1, 196, -1, -1, -1, - -1, 201, -1, -1, -1, -1, 224, 225, -1, 280, - -1, -1, 283, -1, 179, -1, -1, -1, -1, -1, - -1, -1, 240, -1, 224, 225, 297, 280, -1, 300, - 283, 196, -1, -1, -1, -1, 201, -1, -1, -1, - 240, -1, -1, -1, 297, -1, -1, 300, -1, -1, - -1, -1, -1, -1, -1, -1, 179, -1, -1, 224, - 225, -1, 280, -1, -1, 283, -1, -1, -1, -1, - -1, -1, -1, 196, -1, 240, -1, -1, 201, 297, - 280, -1, 300, 283, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 297, -1, -1, - 300, 224, 225, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 280, -1, 240, 283, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 400, - -1, -1, 297, -1, -1, 300, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 400, -1, -1, - -1, -1, -1, -1, -1, 8, -1, 280, 11, -1, - 283, -1, 15, 16, 17, 18, -1, 20, 21, 22, - -1, -1, -1, -1, 297, -1, -1, 300, -1, -1, - -1, -1, 400, -1, 37, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 47, -1, -1, -1, -1, -1, - 400, 54, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 81, -1, - -1, -1, -1, -1, -1, 400, -1, -1, -1, -1, - -1, 512, -1, -1, 515, 516, 517, -1, 519, 520, - 521, 522, 523, 524, -1, -1, -1, -1, 529, 512, - -1, -1, 515, 516, 517, -1, 519, 520, 521, 522, - 523, 524, -1, -1, -1, -1, 529, 400, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 512, -1, -1, 515, 516, 517, - -1, 519, 520, 521, 522, 523, 524, -1, -1, -1, - -1, 529, 512, -1, -1, 515, 516, 517, -1, 519, - 520, 521, 522, 523, 524, -1, 179, -1, -1, 529, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 196, -1, -1, -1, 512, 201, -1, - 515, 516, 517, -1, 519, 520, 521, 522, 523, 524, - -1, -1, -1, -1, 529, -1, 8, -1, -1, 11, - -1, 224, 225, 15, 16, 17, 18, -1, 20, 21, - 22, -1, -1, -1, -1, -1, -1, 240, -1, 512, - -1, -1, 515, 516, 517, 37, 519, 520, 521, 522, - 523, 524, -1, -1, 527, 47, -1, -1, -1, -1, - -1, -1, 54, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 280, -1, -1, - 283, -1, -1, -1, -1, -1, -1, -1, -1, 81, - -1, -1, -1, -1, 297, -1, -1, 300, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 179, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 400, -1, -1, - -1, -1, -1, -1, 196, -1, -1, -1, -1, 201, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 224, 225, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 240, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 280, -1, - -1, 283, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 297, -1, -1, 300, 512, - -1, -1, 515, 516, 517, -1, 519, 520, 521, 522, - 523, 524, -1, -1, 527, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 400, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 3, -1, -1, -1, - 512, -1, -1, 515, 516, 517, -1, 519, 520, 521, - 522, 523, 524, -1, -1, 527, 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, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, - 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, - 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, - 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, - 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, - 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, - 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, - 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, - 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, - 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, - 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, - 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, - 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, - 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, - 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, - 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, - 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, - 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, - 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, - 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, - 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, - 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, - 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, - 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, - 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, - 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, - 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, - 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, - 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, - 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, - 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, - 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, - 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, - 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, - 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, - 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, - 507, 508, 509, 510, 511, 3, -1, -1, -1, -1, - -1, -1, -1, -1, 521, -1, -1, -1, -1, -1, + 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, + 507, 508, 509, 510, 511, 3, 4, 5, -1, -1, + -1, 9, -1, -1, 521, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 44, 45, -1, -1, - 48, 49, -1, 51, 52, 53, 54, 55, -1, 57, - 58, -1, -1, 61, 62, 63, 64, 65, -1, -1, + 38, -1, -1, -1, -1, 43, 44, 45, -1, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, -1, 60, 61, 62, 63, 64, 65, -1, -1, 68, 69, 70, 71, 72, 73, 74, -1, 76, 77, - 78, 79, 80, -1, -1, -1, 84, 85, 86, 87, - 88, 89, -1, 91, 92, 93, -1, 95, 96, 97, - 98, 99, 100, -1, -1, 103, 104, 105, 106, 107, + 78, 79, 80, -1, 82, -1, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, -1, 95, 96, 97, + 98, 99, 100, -1, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, -1, 119, -1, 121, 122, 123, 124, 125, 126, -1, -1, 129, 130, 131, 132, -1, -1, 135, 136, 137, 138, 139, -1, 141, 142, 143, -1, 145, 146, 147, 148, -1, 150, 151, 152, 153, 154, 155, 156, 157, - 158, 159, 160, 161, -1, 163, -1, 165, 166, 167, - 168, -1, 170, -1, 172, -1, -1, -1, 176, 177, - 178, -1, 180, 181, 182, -1, 184, 185, 186, 187, - -1, 189, 190, 191, 192, 193, 194, 195, -1, 197, + 158, 159, 160, 161, 162, 163, -1, 165, 166, 167, + 168, -1, 170, -1, 172, 173, -1, 175, 176, 177, + 178, 179, 180, 181, 182, -1, 184, 185, 186, 187, + -1, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, - 208, -1, 210, -1, 212, 213, 214, 215, 216, 217, - 218, 219, -1, 221, -1, 223, -1, -1, 226, -1, + 208, -1, 210, 211, 212, 213, 214, 215, 216, 217, + 218, 219, -1, 221, -1, 223, 224, 225, 226, 227, 228, 229, 230, -1, 232, 233, 234, -1, -1, 237, - -1, 239, -1, -1, 242, 243, 244, 245, 246, 247, + 238, 239, 240, -1, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, - 268, 269, 270, 271, 272, 273, -1, 275, 276, 277, - 278, 279, -1, 281, 282, -1, 284, -1, 286, 287, - 288, 289, 290, 291, -1, 293, 294, -1, -1, 297, - 298, 299, -1, -1, 302, 303, 304, -1, 306, -1, + 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, + 278, 279, -1, 281, 282, 283, 284, -1, 286, 287, + 288, 289, 290, 291, -1, 293, 294, 295, -1, 297, + 298, 299, -1, -1, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, -1, -1, -1, -1, 325, 326, 327, - -1, 329, 330, 331, 332, 333, 334, -1, 336, 337, + 328, 329, 330, 331, 332, 333, 334, -1, 336, 337, 338, 339, 340, 341, -1, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, -1, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, -1, - 368, 369, -1, 371, 372, 373, 374, 375, 376, 377, + 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, - -1, -1, 390, 391, 392, 393, 394, 395, 396, 397, - 398, -1, -1, 401, 402, 403, 404, -1, 406, 407, + -1, 389, 390, 391, 392, 393, 394, 395, 396, 397, + 398, -1, 400, 401, 402, 403, 404, -1, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, -1, -1, 425, 426, -1, - 428, -1, 430, 431, 432, 433, 434, 435, -1, 437, - 438, 439, -1, -1, 442, 443, 444, 445, 446, -1, + 428, 429, 430, 431, 432, 433, 434, 435, -1, 437, + 438, 439, -1, -1, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, -1, -1, - 458, 459, 460, -1, -1, 463, 464, 465, 466, -1, + 458, 459, 460, 461, -1, 463, 464, 465, 466, -1, 468, 469, 470, 471, 472, 473, 474, 475, -1, 477, - -1, 479, 480, 481, 482, 483, 484, 485, -1, -1, + 478, 479, 480, 481, 482, 483, 484, 485, -1, -1, 488, -1, -1, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, - 508, 509, 510, 511, 3, -1, -1, -1, -1, -1, - -1, -1, -1, 521, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, - 29, 30, -1, 32, 33, 34, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 44, 45, -1, -1, 48, - 49, -1, 51, 52, 53, 54, 55, -1, 57, 58, - -1, -1, 61, 62, 63, 64, 65, -1, -1, 68, - 69, 70, 71, 72, 73, 74, -1, 76, 77, 78, - 79, 80, -1, -1, -1, 84, 85, 86, 87, 88, - 89, -1, 91, 92, 93, -1, 95, 96, 97, 98, - 99, 100, -1, -1, 103, 104, 105, 106, 107, 108, - 109, 110, 111, 112, 113, 114, 115, 116, 117, -1, - 119, -1, 121, 122, 123, 124, 125, 126, -1, -1, - 129, 130, 131, 132, -1, -1, 135, 136, 137, 138, - 139, -1, 141, 142, 143, -1, 145, 146, 147, 148, - -1, 150, 151, 152, 153, 154, 155, 156, 157, 158, - 159, 160, 161, -1, 163, -1, 165, 166, 167, 168, - -1, 170, -1, 172, -1, -1, -1, 176, 177, 178, - -1, 180, 181, 182, -1, 184, 185, 186, 187, -1, - 189, 190, 191, 192, 193, 194, 195, -1, 197, 198, - 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, - -1, 210, -1, 212, 213, 214, 215, 216, 217, 218, - 219, -1, 221, -1, 223, -1, -1, 226, -1, 228, - 229, 230, -1, 232, 233, 234, -1, -1, 237, -1, - 239, -1, -1, 242, 243, 244, 245, 246, 247, 248, - 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, - 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, - 269, 270, 271, 272, 273, -1, 275, 276, 277, 278, - 279, -1, 281, 282, -1, 284, -1, 286, 287, 288, - 289, 290, 291, -1, 293, 294, -1, -1, 297, 298, - 299, -1, -1, 302, 303, 304, -1, 306, -1, 308, - 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, - 319, 320, -1, -1, -1, -1, 325, 326, 327, -1, - 329, 330, 331, 332, 333, 334, -1, 336, 337, 338, - 339, 340, 341, -1, 343, 344, 345, 346, 347, 348, - 349, 350, 351, 352, -1, 354, 355, 356, 357, 358, - 359, 360, 361, 362, 363, 364, 365, 366, -1, 368, - 369, -1, 371, 372, 373, 374, 375, 376, 377, 378, - 379, 380, 381, 382, 383, 384, 385, 386, 387, -1, - -1, 390, 391, 392, 393, 394, 395, 396, 397, 398, - -1, -1, 401, 402, 403, 404, -1, 406, 407, 408, - 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, - 419, 420, 421, 422, -1, -1, 425, 426, -1, 428, - -1, 430, 431, 432, 433, 434, 435, -1, 437, 438, - 439, -1, -1, 442, 443, 444, 445, 446, -1, 448, - 449, 450, 451, 452, 453, 454, 455, -1, -1, 458, - 459, 460, -1, -1, 463, 464, 465, 466, -1, 468, - 469, 470, 471, 472, 473, 474, 475, -1, 477, -1, - 479, 480, 481, 482, 483, 484, 485, -1, -1, 488, - -1, -1, 491, 492, 493, 494, 495, 496, 497, 498, - 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, - 509, 510, 511, 3, 4, 5, -1, -1, -1, 9, - -1, -1, 521, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, - 30, -1, 32, 33, 34, -1, -1, -1, 38, -1, - -1, -1, -1, 43, 44, 45, -1, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, -1, - 60, 61, 62, 63, 64, 65, -1, -1, 68, 69, - 70, 71, 72, 73, 74, -1, 76, 77, 78, 79, - 80, -1, 82, -1, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, -1, 95, 96, 97, 98, 99, - 100, -1, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, 115, 116, 117, -1, 119, - -1, 121, 122, 123, 124, 125, 126, -1, -1, 129, - 130, 131, 132, -1, -1, 135, 136, 137, 138, 139, - -1, 141, 142, 143, -1, 145, 146, 147, 148, -1, - 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, - 160, 161, 162, 163, -1, 165, 166, 167, 168, -1, - 170, -1, 172, 173, -1, 175, 176, 177, 178, 179, - 180, 181, 182, -1, 184, 185, 186, 187, -1, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, - 200, -1, 202, 203, 204, 205, 206, 207, 208, -1, - 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, - -1, 221, -1, 223, 224, 225, 226, 227, 228, 229, - 230, -1, 232, 233, 234, -1, -1, 237, 238, 239, - 240, -1, 242, 243, 244, 245, 246, 247, 248, 249, - 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, - 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, - 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - -1, 281, 282, 283, 284, -1, 286, 287, 288, 289, - 290, 291, -1, 293, 294, 295, -1, 297, 298, 299, - -1, -1, 302, 303, 304, 305, 306, 307, 308, 309, - 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, - 320, -1, -1, -1, -1, 325, 326, 327, 328, 329, - 330, 331, 332, 333, 334, -1, 336, 337, 338, 339, - 340, 341, -1, 343, 344, 345, 346, 347, 348, 349, - 350, 351, 352, -1, 354, 355, 356, 357, 358, 359, - 360, 361, 362, 363, 364, 365, 366, -1, 368, 369, - 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, - 380, 381, 382, 383, 384, 385, 386, 387, -1, 389, - 390, 391, 392, 393, 394, 395, 396, 397, 398, -1, - 400, 401, 402, 403, 404, -1, 406, 407, 408, 409, - 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, - 420, 421, 422, -1, -1, 425, 426, -1, 428, 429, - 430, 431, 432, 433, 434, 435, -1, 437, 438, 439, - -1, -1, 442, 443, 444, 445, 446, 447, 448, 449, - 450, 451, 452, 453, 454, 455, -1, -1, 458, 459, - 460, 461, -1, 463, 464, 465, 466, -1, 468, 469, - 470, 471, 472, 473, 474, 475, -1, 477, 478, 479, - 480, 481, 482, 483, 484, 485, -1, -1, 488, -1, - -1, 491, 492, 493, 494, 495, 496, 497, 498, 499, - 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, - 510, 511, -1, -1, 8, -1, -1, 11, -1, 519, - 520, 15, 16, 17, 18, -1, 20, 21, 22, -1, - -1, -1, 8, -1, -1, 11, -1, -1, -1, 15, - 16, 17, 18, 37, 20, 21, 22, -1, 42, -1, - -1, -1, -1, 47, -1, -1, -1, -1, -1, -1, - 54, 37, -1, -1, -1, -1, -1, 8, -1, -1, - 11, 47, -1, -1, 15, 16, 17, 18, 54, 20, - 21, 22, -1, -1, -1, 8, -1, 81, 11, -1, - -1, -1, 15, 16, 17, 18, 37, 20, 21, 22, - -1, -1, -1, -1, -1, 81, 47, -1, -1, -1, - -1, -1, -1, 54, 37, -1, -1, -1, 41, -1, - -1, -1, -1, -1, 47, -1, -1, -1, -1, -1, - -1, 54, -1, 127, -1, -1, -1, -1, -1, -1, - 81, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 81, -1, - -1, -1, 8, -1, -1, 11, -1, -1, -1, 15, - 16, 17, 18, -1, 20, 21, 22, -1, -1, -1, - -1, -1, -1, -1, -1, 179, -1, -1, -1, -1, - -1, 37, -1, 169, -1, -1, -1, -1, 174, -1, - -1, 47, 196, 179, -1, -1, -1, 201, 54, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 196, -1, -1, -1, -1, 201, -1, 168, -1, -1, - 224, 225, -1, -1, -1, 81, -1, -1, 179, -1, - -1, -1, -1, -1, -1, -1, 240, -1, 224, 225, - -1, -1, -1, -1, -1, 196, 179, -1, -1, -1, - 201, -1, -1, -1, 240, -1, -1, -1, -1, -1, - -1, -1, -1, 196, -1, -1, -1, -1, 201, -1, - -1, -1, -1, 224, 225, -1, 280, -1, -1, 283, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 240, - -1, 224, 225, 297, 280, -1, 300, 283, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 240, -1, -1, - -1, 297, -1, -1, 300, -1, -1, -1, -1, -1, - -1, -1, -1, 179, -1, -1, -1, -1, -1, 280, - -1, -1, 283, -1, -1, -1, -1, -1, -1, -1, - 196, -1, -1, -1, -1, 201, 297, 280, -1, 300, - 283, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 297, -1, -1, 300, 224, 225, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 330, - -1, -1, -1, -1, 240, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 400, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, - -1, -1, 11, -1, 400, -1, 15, 16, 17, 18, - -1, 20, 21, 22, 280, -1, -1, 283, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 37, -1, - -1, 297, 41, -1, 300, -1, -1, -1, 47, 400, - -1, -1, -1, -1, -1, 54, -1, -1, -1, -1, - -1, -1, -1, 467, -1, -1, -1, 400, 324, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 508, 509, 510, 511, -1, -1, 8, -1, -1, 11, + -1, 519, 520, 15, 16, 17, 18, -1, 20, 21, + 22, -1, -1, -1, 8, -1, -1, 11, -1, -1, + -1, 15, 16, 17, 18, 37, 20, 21, 22, -1, + 42, -1, -1, -1, -1, 47, -1, -1, -1, -1, + -1, -1, 54, 37, -1, -1, -1, -1, -1, 8, + -1, -1, 11, 47, -1, -1, 15, 16, 17, 18, + 54, 20, 21, 22, -1, -1, -1, 8, -1, 81, + 11, -1, -1, -1, 15, 16, 17, 18, 37, 20, + 21, 22, -1, -1, -1, -1, -1, 81, 47, -1, + -1, -1, -1, -1, -1, 54, 37, -1, -1, -1, + 41, -1, -1, -1, -1, -1, 47, -1, -1, -1, + -1, -1, -1, 54, -1, 127, -1, -1, -1, -1, -1, -1, 81, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 512, -1, - -1, 515, 516, 517, -1, 519, 520, 521, 522, 523, - 524, -1, -1, -1, -1, -1, 512, -1, -1, 515, - 516, 517, -1, 519, 520, 521, 522, 523, 524, -1, - -1, -1, -1, -1, 400, -1, 8, -1, -1, 11, - -1, -1, -1, 15, 16, 17, 18, -1, 20, 21, - 22, 512, -1, -1, 515, 516, 517, -1, 519, 520, - 521, 522, 523, 524, -1, 37, -1, -1, -1, 512, - 179, -1, 515, 516, 517, 47, 519, 520, 521, 522, - 523, 524, 54, -1, -1, -1, -1, 196, 8, -1, - -1, 11, 201, -1, -1, 15, 16, 17, 18, -1, - 20, 21, 22, -1, -1, -1, -1, -1, -1, 81, - -1, -1, -1, -1, -1, 224, 225, 37, -1, -1, - -1, 41, -1, -1, -1, -1, -1, 47, -1, -1, - -1, 240, -1, -1, 54, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 512, -1, -1, 515, - 516, 517, -1, 519, 520, 521, 522, 523, 524, -1, - -1, 81, -1, -1, -1, -1, -1, -1, -1, 8, - -1, 280, 11, -1, 283, -1, 15, 16, 17, 18, - -1, 20, 21, 22, -1, -1, -1, -1, 297, -1, - -1, 300, -1, -1, -1, -1, -1, -1, 37, -1, - -1, -1, 174, -1, -1, -1, -1, 179, 47, -1, - -1, -1, -1, -1, -1, 54, -1, -1, -1, -1, - -1, -1, -1, -1, 196, -1, -1, -1, -1, 201, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 81, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 224, 225, -1, -1, -1, -1, -1, 179, - -1, -1, -1, -1, -1, -1, -1, -1, 240, -1, - -1, -1, -1, -1, -1, -1, 196, -1, -1, -1, - -1, 201, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 400, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 224, 225, -1, -1, 280, -1, + 81, -1, -1, -1, 8, -1, -1, 11, -1, -1, + -1, 15, 16, 17, 18, -1, 20, 21, 22, -1, + -1, -1, -1, -1, -1, -1, -1, 179, -1, -1, + -1, -1, -1, 37, -1, 169, -1, -1, -1, -1, + 174, -1, -1, 47, 196, 179, -1, -1, -1, 201, + 54, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 196, -1, -1, -1, -1, 201, -1, 168, + -1, -1, 224, 225, -1, -1, -1, 81, -1, -1, + 179, -1, -1, -1, -1, -1, -1, -1, 240, -1, + 224, 225, -1, -1, -1, -1, -1, 196, 179, -1, + -1, -1, 201, -1, -1, -1, 240, -1, -1, -1, + -1, -1, -1, -1, -1, 196, -1, -1, -1, -1, + 201, -1, -1, -1, -1, 224, 225, -1, 280, -1, -1, 283, -1, -1, -1, -1, -1, -1, -1, -1, - 240, -1, -1, -1, -1, 297, -1, -1, 300, -1, - 169, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 179, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 196, -1, -1, - 280, -1, 201, 283, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 297, -1, -1, - 300, -1, -1, -1, -1, 224, 225, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 240, -1, 512, -1, -1, 515, 516, 517, -1, - 519, 520, 521, 522, 523, 524, -1, -1, -1, -1, - -1, -1, -1, 8, -1, -1, 11, -1, 400, -1, - 15, 16, 17, 18, 19, 20, 21, 22, -1, -1, + -1, 240, -1, 224, 225, 297, 280, -1, 300, 283, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 240, + -1, -1, -1, 297, -1, -1, 300, -1, -1, -1, + -1, -1, -1, -1, -1, 179, -1, -1, -1, -1, -1, 280, -1, -1, 283, -1, -1, -1, -1, -1, - -1, -1, 37, -1, -1, -1, -1, -1, 297, -1, - -1, 300, 47, -1, -1, -1, -1, -1, -1, 54, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 400, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 81, -1, -1, -1, - 8, -1, -1, 11, -1, -1, -1, 15, 16, 17, - 18, -1, 20, 21, 22, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 37, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 47, - 512, -1, -1, 515, 516, 517, 54, 519, 520, 521, - 522, 523, 524, -1, -1, -1, -1, -1, -1, -1, - -1, 400, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 81, -1, -1, -1, -1, -1, -1, + -1, -1, 196, -1, -1, -1, -1, 201, 297, 280, + -1, 300, 283, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 297, -1, -1, 300, + 224, 225, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 330, -1, -1, -1, -1, 240, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 400, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 512, -1, 179, 515, 516, 517, -1, 519, - 520, 521, 522, 523, 524, -1, -1, -1, -1, -1, - -1, 196, -1, -1, 8, -1, 201, 11, -1, -1, - -1, 15, 16, 17, 18, -1, 20, 21, 22, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 224, - 225, -1, -1, 37, -1, -1, -1, 41, -1, -1, - -1, -1, -1, 47, -1, 240, -1, -1, -1, -1, - 54, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 179, -1, 512, -1, -1, 515, 516, 517, -1, - 519, 520, 521, 522, 523, 524, -1, 81, 196, -1, - -1, -1, -1, 201, 8, 280, -1, 11, 283, -1, - -1, 15, 16, 17, 18, -1, 20, 21, 22, -1, - -1, -1, 297, -1, -1, 300, 224, 225, -1, -1, - -1, -1, -1, 37, -1, -1, -1, -1, -1, -1, - -1, -1, 240, 47, -1, -1, -1, -1, -1, -1, - 54, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 8, -1, -1, 11, -1, 400, -1, 15, 16, + 17, 18, -1, 20, 21, 22, 280, -1, -1, 283, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 81, -1, -1, - -1, -1, 280, -1, -1, 283, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 179, -1, -1, -1, 297, - -1, -1, 300, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 196, -1, -1, -1, -1, 201, -1, -1, - -1, -1, -1, -1, -1, 400, -1, -1, -1, -1, + 37, -1, -1, 297, 41, -1, 300, -1, -1, -1, + 47, 400, -1, -1, -1, -1, -1, 54, -1, -1, + -1, -1, -1, -1, -1, 467, -1, -1, -1, 400, + 324, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 81, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 224, 225, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 240, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 179, -1, -1, -1, -1, + 512, -1, -1, 515, 516, 517, -1, 519, 520, 521, + 522, 523, 524, -1, -1, -1, -1, -1, 512, -1, + -1, 515, 516, 517, -1, 519, 520, 521, 522, 523, + 524, -1, -1, -1, -1, -1, 400, -1, 8, -1, + -1, 11, -1, -1, -1, 15, 16, 17, 18, -1, + 20, 21, 22, 512, -1, -1, 515, 516, 517, -1, + 519, 520, 521, 522, 523, 524, -1, 37, -1, -1, + -1, 512, 179, -1, 515, 516, 517, 47, 519, 520, + 521, 522, 523, 524, 54, -1, -1, -1, -1, 196, + 8, -1, -1, 11, 201, -1, -1, 15, 16, 17, + 18, -1, 20, 21, 22, -1, -1, -1, -1, -1, + -1, 81, -1, -1, -1, -1, -1, 224, 225, 37, + -1, -1, -1, 41, -1, -1, -1, -1, -1, 47, + -1, -1, -1, 240, -1, -1, 54, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 512, -1, + -1, 515, 516, 517, -1, 519, 520, 521, 522, 523, + 524, -1, -1, 81, -1, -1, -1, -1, -1, -1, + -1, 8, -1, 280, 11, -1, 283, -1, 15, 16, + 17, 18, -1, 20, 21, 22, -1, -1, -1, -1, + 297, -1, -1, 300, -1, -1, -1, -1, -1, -1, + 37, -1, -1, -1, 174, -1, -1, -1, -1, 179, + 47, -1, -1, -1, -1, -1, -1, 54, -1, -1, + -1, -1, -1, -1, -1, -1, 196, -1, -1, -1, + -1, 201, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 81, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 224, 225, -1, -1, -1, -1, + -1, 179, -1, -1, -1, -1, -1, -1, -1, -1, + 240, -1, -1, -1, -1, -1, -1, -1, 196, -1, + -1, -1, -1, 201, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 400, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 224, 225, -1, -1, + 280, -1, -1, 283, -1, -1, -1, -1, -1, -1, + -1, -1, 240, -1, -1, -1, -1, 297, -1, -1, + 300, -1, 169, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 179, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 196, + -1, -1, 280, -1, 201, 283, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 297, + -1, -1, 300, -1, -1, -1, -1, 224, 225, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 196, -1, -1, -1, 280, 201, -1, 283, - -1, -1, 400, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 297, -1, -1, 300, -1, -1, -1, - 224, 225, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 240, 512, 436, -1, - 515, 516, 517, -1, 519, 520, 521, 522, 523, 524, + -1, -1, -1, 240, -1, 512, -1, -1, 515, 516, + 517, -1, 519, 520, 521, 522, 523, 524, -1, -1, -1, -1, -1, -1, -1, 8, -1, -1, 11, -1, - -1, -1, 15, 16, 17, 18, -1, 20, 21, 22, - -1, -1, -1, -1, -1, -1, 280, -1, -1, 283, + 400, -1, 15, 16, 17, 18, 19, 20, 21, 22, + -1, -1, -1, 280, -1, -1, 283, -1, -1, -1, -1, -1, -1, -1, 37, -1, -1, -1, -1, -1, - -1, -1, -1, 297, 47, -1, 300, -1, -1, -1, + 297, -1, -1, 300, 47, -1, -1, -1, -1, -1, -1, 54, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 512, -1, 400, 515, 516, 517, - -1, 519, 520, 521, 522, 523, 524, -1, 81, -1, - -1, -1, -1, 8, -1, -1, 11, -1, -1, -1, - 15, 16, 17, 18, -1, 20, 21, 22, -1, -1, + -1, -1, 400, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 81, -1, + -1, -1, 8, -1, -1, 11, -1, -1, -1, 15, + 16, 17, 18, -1, 20, 21, 22, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 37, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 47, -1, -1, -1, -1, -1, -1, 54, + -1, 37, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 47, 512, -1, -1, 515, 516, 517, 54, 519, + 520, 521, 522, 523, 524, -1, -1, -1, -1, -1, + -1, -1, -1, 400, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 81, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 400, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 81, -1, -1, -1, + -1, -1, -1, -1, 512, -1, 179, 515, 516, 517, + -1, 519, 520, 521, 522, 523, 524, -1, -1, -1, + -1, -1, -1, 196, -1, -1, 8, -1, 201, 11, + -1, -1, -1, 15, 16, 17, 18, -1, 20, 21, + 22, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 224, 225, -1, -1, 37, -1, -1, -1, 41, + -1, -1, -1, -1, -1, 47, -1, 240, -1, -1, + -1, -1, 54, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 179, -1, 512, -1, -1, 515, 516, + 517, -1, 519, 520, 521, 522, 523, 524, -1, 81, + 196, -1, -1, -1, -1, 201, 8, 280, -1, 11, + 283, -1, -1, 15, 16, 17, 18, -1, 20, 21, + 22, -1, -1, -1, 297, -1, -1, 300, 224, 225, + -1, -1, -1, -1, -1, 37, -1, -1, -1, -1, + -1, -1, -1, -1, 240, 47, -1, -1, -1, -1, + -1, -1, 54, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 81, + -1, -1, -1, -1, 280, -1, -1, 283, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 179, -1, -1, + -1, 297, -1, -1, 300, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 196, -1, -1, -1, -1, 201, + -1, -1, -1, -1, -1, -1, -1, 400, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 224, 225, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 240, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 179, -1, 512, -1, - -1, 515, 516, 517, -1, 519, 520, 521, 522, 523, - 524, -1, -1, 196, -1, -1, -1, -1, 201, -1, + -1, -1, -1, -1, -1, -1, -1, 179, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 196, -1, -1, -1, 280, 201, + -1, 283, -1, -1, 400, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 297, -1, -1, 300, -1, + -1, -1, 224, 225, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 240, 512, + 436, -1, 515, 516, 517, -1, 519, 520, 521, 522, + 523, 524, -1, -1, -1, -1, -1, 8, -1, -1, + 11, -1, -1, -1, 15, 16, 17, 18, -1, 20, + 21, 22, -1, -1, -1, -1, -1, -1, 280, -1, + -1, 283, -1, -1, -1, -1, 37, -1, -1, -1, + -1, -1, -1, -1, -1, 297, 47, -1, 300, -1, + -1, -1, -1, 54, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 512, -1, 400, 515, + 516, 517, -1, 519, 520, 521, 522, 523, 524, -1, + 81, -1, -1, -1, -1, 8, -1, -1, 11, -1, + -1, -1, 15, 16, 17, 18, -1, 20, 21, 22, + -1, -1, -1, -1, 8, -1, -1, 11, -1, -1, + -1, 15, 16, -1, 37, -1, 20, 21, 22, -1, + -1, -1, -1, -1, 47, -1, -1, -1, -1, -1, + -1, 54, -1, 37, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 47, -1, -1, -1, -1, 400, -1, + 54, -1, -1, -1, -1, -1, -1, -1, 81, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 81, 179, -1, + 512, -1, -1, 515, 516, 517, -1, 519, 520, 521, + 522, 523, 524, -1, -1, 196, -1, -1, -1, -1, + 201, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 8, -1, -1, 11, -1, -1, -1, + 15, 16, -1, 224, 225, 20, 21, 22, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 240, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 47, -1, -1, -1, 179, -1, -1, 54, + 512, -1, -1, 515, 516, 517, -1, 519, 520, 521, + 522, 523, 524, 196, -1, 179, -1, -1, 201, 280, + -1, -1, 283, -1, -1, -1, 81, -1, -1, -1, + -1, -1, 196, -1, -1, -1, 297, 201, -1, 300, -1, 224, 225, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 240, -1, -1, + 224, 225, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 240, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 179, -1, -1, -1, 512, -1, - -1, 515, 516, 517, -1, 519, 520, 521, 522, 523, - 524, 196, -1, -1, -1, -1, 201, 280, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 280, -1, -1, 283, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 297, -1, -1, 300, -1, 224, + -1, -1, -1, -1, 297, -1, 280, 300, -1, 283, + -1, -1, -1, -1, 179, -1, -1, -1, -1, -1, + -1, -1, -1, 297, -1, -1, 300, -1, -1, 400, + -1, 196, -1, -1, -1, -1, 201, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 224, 225, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 240, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 280, -1, -1, 283, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 297, -1, -1, 300, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 400, -1, -1, + -1, -1, -1, -1, -1, 280, -1, -1, 283, -1, + -1, -1, -1, -1, -1, -1, 400, -1, -1, -1, + -1, -1, 297, -1, -1, -1, -1, -1, -1, -1, + -1, 512, -1, -1, 515, 516, 517, -1, 519, 520, + 521, 522, 523, 524, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 512, + -1, -1, 515, 516, 517, -1, 519, 520, 521, 522, + 523, 524, -1, -1, -1, 400, -1, -1, 512, -1, + -1, 515, 516, 517, -1, 519, 520, 521, 522, 523, + 524, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 400, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 512, - -1, -1, 515, 516, 517, -1, 519, 520, 521, 522, - 523, 524, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -17298,7 +17342,7 @@ static const yytype_int16 yycheck[] = 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 3, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, @@ -17504,61 +17548,61 @@ static const yytype_int16 yycheck[] = 507, 508, 509, 510, 511, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, - 28, 29, 30, -1, 32, 33, 34, 35, 36, -1, - 38, -1, -1, -1, -1, 43, 44, 45, -1, 47, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, -1, 60, 61, 62, 63, 64, 65, -1, -1, - 68, 69, 70, 71, 72, 73, 74, -1, 76, 77, - 78, 79, 80, -1, 82, -1, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, -1, 95, 96, 97, - 98, 99, 100, -1, 102, 103, 104, 105, 106, 107, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - -1, 119, -1, 121, 122, 123, 124, 125, 126, -1, - -1, 129, 130, 131, 132, -1, -1, 135, 136, 137, - 138, 139, -1, 141, 142, 143, -1, 145, 146, 147, - 148, -1, 150, 151, 152, 153, 154, 155, 156, 157, - 158, 159, 160, 161, -1, 163, -1, 165, 166, 167, - 168, -1, 170, -1, 172, 173, -1, 175, 176, 177, - 178, 179, 180, 181, 182, -1, 184, 185, 186, 187, - -1, 189, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, - 208, -1, 210, 211, 212, 213, 214, 215, 216, 217, - 218, 219, -1, 221, -1, 223, 224, 225, 226, 227, - 228, 229, 230, -1, 232, 233, 234, -1, -1, 237, - 238, 239, 240, -1, 242, 243, 244, 245, 246, 247, + 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, + 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, + 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, + 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, + 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, + 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, + 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, -1, 281, 282, 283, 284, -1, 286, 287, - 288, 289, 290, 291, -1, 293, 294, -1, -1, 297, - 298, 299, -1, -1, 302, 303, 304, 305, 306, 307, + 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, + 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, + 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, - 318, 319, 320, -1, -1, -1, -1, 325, 326, 327, - 328, 329, 330, 331, 332, 333, 334, -1, 336, 337, - 338, 339, 340, 341, -1, 343, 344, 345, 346, 347, - 348, 349, 350, 351, 352, -1, 354, 355, 356, 357, - 358, 359, 360, 361, 362, 363, 364, 365, 366, -1, + 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, + 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, + 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, + 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, + 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, - -1, 389, 390, 391, 392, 393, 394, 395, 396, 397, - 398, -1, 400, 401, 402, 403, 404, -1, 406, 407, + 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, + 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, - 418, 419, 420, 421, 422, -1, -1, 425, 426, -1, - 428, 429, 430, 431, 432, 433, 434, 435, -1, 437, - 438, 439, -1, -1, 442, 443, 444, 445, 446, -1, - 448, 449, 450, 451, 452, 453, 454, 455, -1, -1, - 458, 459, 460, 461, -1, 463, 464, 465, 466, -1, - 468, 469, 470, 471, 472, 473, 474, 475, -1, 477, - 478, 479, 480, 481, 482, 483, 484, 485, -1, -1, - 488, -1, -1, 491, 492, 493, 494, 495, 496, 497, + 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, + 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, + 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, + 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, + 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, + 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, + 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, + 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, - 29, 30, -1, 32, 33, 34, -1, -1, -1, -1, + 29, 30, -1, 32, 33, 34, 35, 36, -1, 38, -1, -1, -1, -1, 43, 44, 45, -1, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - -1, -1, 61, 62, 63, 64, 65, -1, 67, 68, + -1, 60, 61, 62, 63, 64, 65, -1, -1, 68, 69, 70, 71, 72, 73, 74, -1, 76, 77, 78, 79, 80, -1, 82, -1, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, -1, 95, 96, 97, 98, @@ -17591,14 +17635,14 @@ static const yytype_int16 yycheck[] = 359, 360, 361, 362, 363, 364, 365, 366, -1, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, -1, - -1, 390, 391, 392, 393, 394, 395, 396, 397, 398, + 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, -1, 400, 401, 402, 403, 404, -1, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, -1, -1, 425, 426, -1, 428, 429, 430, 431, 432, 433, 434, 435, -1, 437, 438, 439, -1, -1, 442, 443, 444, 445, 446, -1, 448, 449, 450, 451, 452, 453, 454, 455, -1, -1, 458, - 459, 460, -1, -1, 463, 464, 465, 466, -1, 468, + 459, 460, 461, -1, 463, 464, 465, 466, -1, 468, 469, 470, 471, 472, 473, 474, 475, -1, 477, 478, 479, 480, 481, 482, 483, 484, 485, -1, -1, 488, -1, -1, 491, 492, 493, 494, 495, 496, 497, 498, @@ -17609,7 +17653,7 @@ static const yytype_int16 yycheck[] = 30, -1, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, 43, 44, 45, -1, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, -1, - -1, 61, 62, 63, 64, 65, -1, -1, 68, 69, + -1, 61, 62, 63, 64, 65, -1, 67, 68, 69, 70, 71, 72, 73, 74, -1, 76, 77, 78, 79, 80, -1, 82, -1, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, -1, 95, 96, 97, 98, 99, @@ -17658,50 +17702,50 @@ static const yytype_int16 yycheck[] = -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 44, 45, -1, -1, 48, 49, -1, - 51, 52, 53, 54, 55, -1, 57, 58, -1, -1, + -1, -1, 43, 44, 45, -1, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, -1, -1, 61, 62, 63, 64, 65, -1, -1, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - -1, -1, 83, 84, 85, 86, 87, 88, 89, -1, - 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - -1, -1, 103, 104, 105, 106, 107, 108, 109, 110, + 71, 72, 73, 74, -1, 76, 77, 78, 79, 80, + -1, 82, -1, 84, 85, 86, 87, 88, 89, 90, + 91, 92, 93, -1, 95, 96, 97, 98, 99, 100, + -1, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, -1, 119, -1, 121, 122, 123, 124, 125, 126, -1, -1, 129, 130, 131, 132, -1, -1, 135, 136, 137, 138, 139, -1, 141, 142, 143, -1, 145, 146, 147, 148, -1, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, -1, 163, -1, 165, 166, 167, 168, -1, 170, - 171, 172, -1, -1, -1, 176, 177, 178, -1, 180, + -1, 172, 173, -1, 175, 176, 177, 178, 179, 180, 181, 182, -1, 184, 185, 186, 187, -1, 189, 190, - 191, 192, 193, 194, 195, -1, 197, 198, 199, 200, + 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, -1, 210, - -1, 212, 213, 214, 215, 216, 217, 218, 219, -1, - 221, -1, 223, -1, -1, 226, -1, 228, 229, 230, - -1, 232, 233, 234, -1, -1, 237, -1, 239, -1, + 211, 212, 213, 214, 215, 216, 217, 218, 219, -1, + 221, -1, 223, 224, 225, 226, 227, 228, 229, 230, + -1, 232, 233, 234, -1, -1, 237, 238, 239, 240, -1, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, - 271, 272, 273, -1, 275, 276, 277, 278, 279, -1, - 281, 282, -1, 284, -1, 286, 287, 288, 289, 290, + 271, 272, 273, 274, 275, 276, 277, 278, 279, -1, + 281, 282, 283, 284, -1, 286, 287, 288, 289, 290, 291, -1, 293, 294, -1, -1, 297, 298, 299, -1, - -1, 302, 303, 304, -1, 306, -1, 308, 309, 310, + -1, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, - -1, -1, -1, -1, 325, 326, 327, -1, 329, 330, - 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, + -1, -1, -1, -1, 325, 326, 327, 328, 329, 330, + 331, 332, 333, 334, -1, 336, 337, 338, 339, 340, 341, -1, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, -1, 354, 355, 356, 357, 358, 359, 360, - 361, 362, 363, 364, 365, 366, -1, 368, 369, -1, + 361, 362, 363, 364, 365, 366, -1, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, -1, -1, 390, - 391, 392, 393, 394, 395, 396, 397, 398, -1, -1, + 391, 392, 393, 394, 395, 396, 397, 398, -1, 400, 401, 402, 403, 404, -1, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, - 421, 422, -1, -1, 425, 426, -1, 428, -1, 430, + 421, 422, -1, -1, 425, 426, -1, 428, 429, 430, 431, 432, 433, 434, 435, -1, 437, 438, 439, -1, -1, 442, 443, 444, 445, 446, -1, 448, 449, 450, - 451, 452, 453, 454, 455, -1, 457, 458, 459, 460, + 451, 452, 453, 454, 455, -1, -1, 458, 459, 460, -1, -1, 463, 464, 465, 466, -1, 468, 469, 470, - 471, 472, 473, 474, 475, -1, 477, -1, 479, 480, + 471, 472, 473, 474, 475, -1, 477, 478, 479, 480, 481, 482, 483, 484, 485, -1, -1, 488, -1, -1, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, @@ -17713,7 +17757,7 @@ static const yytype_int16 yycheck[] = 52, 53, 54, 55, -1, 57, 58, -1, -1, 61, 62, 63, 64, 65, -1, -1, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, -1, - -1, -1, 84, 85, 86, 87, 88, 89, -1, 91, + -1, 83, 84, 85, 86, 87, 88, 89, -1, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, -1, -1, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, -1, 119, -1, 121, @@ -17728,7 +17772,7 @@ static const yytype_int16 yycheck[] = 202, 203, 204, 205, 206, 207, 208, -1, 210, -1, 212, 213, 214, 215, 216, 217, 218, 219, -1, 221, -1, 223, -1, -1, 226, -1, 228, 229, 230, -1, - 232, 233, 234, -1, -1, 237, -1, 239, 240, -1, + 232, 233, 234, -1, -1, 237, -1, 239, -1, -1, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, @@ -17759,107 +17803,107 @@ static const yytype_int16 yycheck[] = 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, - 33, 34, -1, -1, -1, 38, -1, -1, 41, -1, - 43, 44, 45, -1, 47, 48, 49, 50, 51, 52, - 53, -1, 55, 56, 57, 58, -1, 60, 61, 62, + 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 44, 45, -1, -1, 48, 49, -1, 51, 52, + 53, 54, 55, -1, 57, 58, -1, -1, 61, 62, 63, 64, 65, -1, -1, 68, 69, 70, 71, 72, - 73, 74, -1, 76, 77, 78, 79, -1, -1, 82, - -1, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, -1, 95, 96, 97, 98, 99, 100, -1, 102, + 73, 74, 75, 76, 77, 78, 79, 80, -1, -1, + -1, 84, 85, 86, 87, 88, 89, -1, 91, 92, + 93, 94, 95, 96, 97, 98, 99, 100, -1, -1, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, -1, 119, -1, 121, 122, 123, 124, 125, 126, -1, -1, 129, 130, 131, 132, -1, -1, 135, 136, 137, 138, 139, -1, 141, 142, 143, -1, 145, 146, 147, 148, -1, 150, 151, 152, - 153, -1, 155, 156, 157, 158, 159, 160, -1, -1, - 163, -1, 165, 166, 167, 168, -1, 170, -1, 172, - 173, -1, 175, 176, 177, 178, 179, 180, 181, 182, - -1, -1, -1, 186, 187, -1, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, - 203, 204, 205, 206, 207, 208, -1, 210, 211, -1, + 153, 154, 155, 156, 157, 158, 159, 160, 161, -1, + 163, -1, 165, 166, 167, 168, -1, 170, 171, 172, + -1, -1, -1, 176, 177, 178, -1, 180, 181, 182, + -1, 184, 185, 186, 187, -1, 189, 190, 191, 192, + 193, 194, 195, -1, 197, 198, 199, 200, -1, 202, + 203, 204, 205, 206, 207, 208, -1, 210, -1, 212, 213, 214, 215, 216, 217, 218, 219, -1, 221, -1, - 223, 224, 225, 226, 227, 228, 229, 230, -1, 232, - 233, 234, -1, -1, 237, 238, 239, 240, -1, 242, + 223, -1, -1, 226, -1, 228, 229, 230, -1, 232, + 233, 234, -1, -1, 237, -1, 239, 240, -1, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, -1, -1, 281, 282, - 283, 284, -1, -1, 287, 288, 289, 290, 291, -1, + 273, -1, 275, 276, 277, 278, 279, -1, 281, 282, + -1, 284, -1, 286, 287, 288, 289, 290, 291, -1, 293, 294, -1, -1, 297, 298, 299, -1, -1, 302, - 303, -1, 305, 306, 307, -1, 309, 310, 311, 312, + 303, 304, -1, 306, -1, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, -1, -1, - -1, -1, 325, 326, -1, 328, 329, 330, -1, 332, - 333, 334, -1, 336, 337, 338, 339, 340, 341, -1, + -1, -1, 325, 326, 327, -1, 329, 330, 331, 332, + 333, 334, 335, 336, 337, 338, 339, 340, 341, -1, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, -1, 354, 355, 356, 357, 358, 359, 360, 361, 362, - 363, 364, 365, 366, -1, 368, 369, 370, 371, 372, + 363, 364, 365, 366, -1, 368, 369, -1, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, - 383, 384, 385, 386, 387, -1, 389, 390, 391, 392, - 393, 394, 395, 396, 397, 398, -1, 400, 401, 402, + 383, 384, 385, 386, 387, -1, -1, 390, 391, 392, + 393, 394, 395, 396, 397, 398, -1, -1, 401, 402, 403, 404, -1, 406, 407, 408, 409, 410, 411, 412, - 413, 414, 415, 416, 417, 418, 419, 420, 421, -1, - -1, -1, 425, 426, -1, 428, 429, 430, 431, 432, + 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, + -1, -1, 425, 426, -1, 428, -1, 430, 431, 432, 433, 434, 435, -1, 437, 438, 439, -1, -1, 442, - 443, -1, 445, -1, -1, 448, 449, 450, 451, 452, - 453, 454, 455, 456, -1, 458, 459, 460, 461, -1, + 443, 444, 445, 446, -1, 448, 449, 450, 451, 452, + 453, 454, 455, -1, 457, 458, 459, 460, -1, -1, 463, 464, 465, 466, -1, 468, 469, 470, 471, 472, - -1, 474, 475, -1, 477, 478, 479, 480, 481, 482, + 473, 474, 475, -1, 477, -1, 479, 480, 481, 482, 483, 484, 485, -1, -1, 488, -1, -1, 491, 492, - 493, 494, 495, 496, 3, -1, 5, -1, -1, -1, - -1, -1, -1, -1, -1, 508, 509, 510, 511, -1, - -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, - 29, 30, -1, 32, 33, 34, 35, 36, -1, -1, - -1, -1, -1, -1, -1, 44, 45, -1, -1, 48, - 49, -1, 51, 52, 53, 54, 55, -1, 57, 58, - -1, -1, 61, 62, 63, 64, 65, -1, -1, 68, - 69, 70, 71, 72, 73, 74, -1, 76, 77, 78, - 79, 80, -1, -1, -1, 84, 85, 86, 87, 88, - 89, -1, 91, 92, 93, -1, 95, 96, 97, 98, - 99, 100, -1, -1, 103, 104, 105, 106, 107, 108, - 109, 110, 111, 112, 113, 114, 115, 116, 117, -1, - 119, -1, 121, 122, 123, 124, 125, 126, -1, -1, - 129, 130, 131, 132, -1, -1, 135, 136, 137, 138, - 139, -1, 141, 142, 143, -1, 145, 146, 147, 148, - -1, 150, 151, 152, 153, 154, 155, 156, 157, 158, - 159, 160, 161, -1, 163, -1, 165, 166, 167, 168, - -1, 170, -1, 172, -1, -1, -1, 176, 177, 178, - -1, 180, 181, 182, -1, 184, 185, 186, 187, -1, - 189, 190, 191, 192, 193, 194, 195, -1, 197, 198, - 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, - -1, 210, -1, 212, 213, 214, 215, 216, 217, 218, - 219, -1, 221, -1, 223, -1, -1, 226, -1, 228, - 229, 230, -1, 232, 233, 234, -1, -1, 237, -1, - 239, -1, -1, 242, 243, 244, 245, 246, 247, 248, - 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, - 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, - 269, 270, 271, 272, 273, -1, 275, 276, 277, 278, - 279, -1, 281, 282, -1, 284, -1, 286, 287, 288, - 289, 290, 291, -1, 293, 294, -1, -1, 297, 298, - 299, -1, -1, 302, 303, 304, -1, 306, -1, 308, - 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, - 319, 320, -1, -1, -1, -1, 325, 326, 327, -1, - 329, 330, 331, 332, 333, 334, -1, 336, 337, 338, - 339, 340, 341, -1, 343, 344, 345, 346, 347, 348, - 349, 350, 351, 352, -1, 354, 355, 356, 357, 358, - 359, 360, 361, 362, 363, 364, 365, 366, -1, 368, - 369, -1, 371, 372, 373, 374, 375, 376, 377, 378, - 379, 380, 381, 382, 383, 384, 385, 386, 387, -1, - -1, 390, 391, 392, 393, 394, 395, 396, 397, 398, - -1, -1, 401, 402, 403, 404, -1, 406, 407, 408, - 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, - 419, 420, 421, 422, -1, -1, 425, 426, -1, 428, - -1, 430, 431, 432, 433, 434, 435, -1, 437, 438, - 439, -1, -1, 442, 443, 444, 445, 446, -1, 448, - 449, 450, 451, 452, 453, 454, 455, -1, -1, 458, - 459, 460, -1, -1, 463, 464, 465, 466, -1, 468, - 469, 470, 471, 472, 473, 474, 475, -1, 477, -1, - 479, 480, 481, 482, 483, 484, 485, -1, -1, 488, - -1, -1, 491, 492, 493, 494, 495, 496, 497, 498, - 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, - 509, 510, 511, 3, -1, 5, -1, -1, -1, -1, + 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, + 503, 504, 505, 506, 507, 508, 509, 510, 511, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, + 24, 25, 26, 27, 28, 29, 30, -1, 32, 33, + 34, -1, -1, -1, 38, -1, -1, 41, -1, 43, + 44, 45, -1, 47, 48, 49, 50, 51, 52, 53, + -1, 55, 56, 57, 58, -1, 60, 61, 62, 63, + 64, 65, -1, -1, 68, 69, 70, 71, 72, 73, + 74, -1, 76, 77, 78, 79, -1, -1, 82, -1, + 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, + -1, 95, 96, 97, 98, 99, 100, -1, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, 115, 116, 117, -1, 119, -1, 121, 122, 123, + 124, 125, 126, -1, -1, 129, 130, 131, 132, -1, + -1, 135, 136, 137, 138, 139, -1, 141, 142, 143, + -1, 145, 146, 147, 148, -1, 150, 151, 152, 153, + -1, 155, 156, 157, 158, 159, 160, -1, -1, 163, + -1, 165, 166, 167, 168, -1, 170, -1, 172, 173, + -1, 175, 176, 177, 178, 179, 180, 181, 182, -1, + -1, -1, 186, 187, -1, 189, 190, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, -1, 202, 203, + 204, 205, 206, 207, 208, -1, 210, 211, -1, 213, + 214, 215, 216, 217, 218, 219, -1, 221, -1, 223, + 224, 225, 226, 227, 228, 229, 230, -1, 232, 233, + 234, -1, -1, 237, 238, 239, 240, -1, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, + 274, 275, 276, 277, 278, -1, -1, 281, 282, 283, + 284, -1, -1, 287, 288, 289, 290, 291, -1, 293, + 294, -1, -1, 297, 298, 299, -1, -1, 302, 303, + -1, 305, 306, 307, -1, 309, 310, 311, 312, 313, + 314, 315, 316, 317, 318, 319, 320, -1, -1, -1, + -1, 325, 326, -1, 328, 329, 330, -1, 332, 333, + 334, -1, 336, 337, 338, 339, 340, 341, -1, 343, + 344, 345, 346, 347, 348, 349, 350, 351, 352, -1, + 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, + 364, 365, 366, -1, 368, 369, 370, 371, 372, 373, + 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, + 384, 385, 386, 387, -1, 389, 390, 391, 392, 393, + 394, 395, 396, 397, 398, -1, 400, 401, 402, 403, + 404, -1, 406, 407, 408, 409, 410, 411, 412, 413, + 414, 415, 416, 417, 418, 419, 420, 421, -1, -1, + -1, 425, 426, -1, 428, 429, 430, 431, 432, 433, + 434, 435, -1, 437, 438, 439, -1, -1, 442, 443, + -1, 445, -1, -1, 448, 449, 450, 451, 452, 453, + 454, 455, 456, -1, 458, 459, 460, 461, -1, 463, + 464, 465, 466, -1, 468, 469, 470, 471, 472, -1, + 474, 475, -1, 477, 478, 479, 480, 481, 482, 483, + 484, 485, -1, -1, 488, -1, -1, 491, 492, 493, + 494, 495, 496, 3, -1, 5, -1, -1, -1, -1, + -1, -1, -1, -1, 508, 509, 510, 511, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, + 30, -1, 32, 33, 34, 35, 36, -1, -1, -1, -1, -1, -1, -1, 44, 45, -1, -1, 48, 49, -1, 51, 52, 53, 54, 55, -1, 57, 58, -1, -1, 61, 62, 63, 64, 65, -1, -1, 68, 69, @@ -17910,7 +17954,7 @@ static const yytype_int16 yycheck[] = 510, 511, 3, -1, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, - -1, 32, 33, 34, -1, -1, -1, -1, -1, -1, + 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, 45, -1, -1, 48, 49, -1, 51, 52, 53, 54, 55, -1, 57, 58, -1, -1, 61, 62, 63, 64, 65, -1, -1, 68, 69, 70, @@ -17936,7 +17980,7 @@ static const yytype_int16 yycheck[] = 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, -1, 275, 276, 277, 278, 279, -1, 281, 282, -1, 284, -1, 286, 287, 288, 289, 290, - 291, -1, 293, 294, -1, 296, 297, 298, 299, -1, + 291, -1, 293, 294, -1, -1, 297, 298, 299, -1, -1, 302, 303, 304, -1, 306, -1, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, -1, -1, -1, -1, 325, 326, 327, -1, 329, 330, @@ -18011,7 +18055,7 @@ static const yytype_int16 yycheck[] = 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 3, -1, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, 45, -1, -1, 48, 49, -1, 51, 52, 53, 54, 55, -1, 57, 58, -1, -1, 61, 62, @@ -18038,7 +18082,7 @@ static const yytype_int16 yycheck[] = 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, -1, 275, 276, 277, 278, 279, -1, 281, 282, -1, 284, -1, 286, 287, 288, 289, 290, 291, -1, - 293, 294, -1, -1, 297, 298, 299, -1, -1, 302, + 293, 294, -1, 296, 297, 298, 299, -1, -1, 302, 303, 304, -1, 306, -1, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, -1, -1, -1, -1, 325, 326, 327, -1, 329, 330, 331, 332, @@ -18062,7 +18106,7 @@ static const yytype_int16 yycheck[] = 503, 504, 505, 506, 507, 508, 509, 510, 511, 3, -1, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, - 24, 25, 26, 27, 28, 29, 30, -1, 32, 33, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, 45, -1, -1, 48, 49, -1, 51, 52, 53, 54, 55, -1, 57, 58, -1, -1, 61, 62, 63, @@ -18089,7 +18133,7 @@ static const yytype_int16 yycheck[] = 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, -1, 275, 276, 277, 278, 279, -1, 281, 282, -1, 284, -1, 286, 287, 288, 289, 290, 291, -1, 293, - 294, -1, 296, 297, 298, 299, -1, -1, 302, 303, + 294, -1, -1, 297, 298, 299, -1, -1, 302, 303, 304, -1, 306, -1, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, -1, -1, -1, -1, 325, 326, 327, -1, 329, 330, 331, 332, 333, @@ -18111,208 +18155,208 @@ static const yytype_int16 yycheck[] = 484, 485, -1, -1, 488, -1, -1, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 3, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, - -1, -1, -1, 38, -1, -1, -1, -1, 43, 44, - 45, -1, 47, 48, 49, 50, 51, 52, 53, -1, - 55, 56, 57, 58, -1, 60, 61, 62, 63, 64, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, + 45, -1, -1, 48, 49, -1, 51, 52, 53, 54, + 55, -1, 57, 58, -1, -1, 61, 62, 63, 64, 65, -1, -1, 68, 69, 70, 71, 72, 73, 74, - -1, 76, 77, 78, 79, -1, -1, 82, -1, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, -1, - 95, 96, 97, 98, 99, 100, -1, 102, 103, 104, + -1, 76, 77, 78, 79, 80, -1, -1, -1, 84, + 85, 86, 87, 88, 89, -1, 91, 92, 93, -1, + 95, 96, 97, 98, 99, 100, -1, -1, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, -1, 119, -1, 121, 122, 123, 124, 125, 126, -1, -1, 129, 130, 131, 132, -1, -1, 135, 136, 137, 138, 139, -1, 141, 142, 143, -1, - 145, 146, 147, 148, -1, 150, 151, 152, 153, -1, - 155, 156, 157, 158, 159, 160, -1, -1, 163, -1, - 165, 166, 167, 168, -1, 170, -1, 172, 173, -1, - 175, 176, 177, -1, 179, 180, 181, 182, -1, -1, - -1, 186, 187, -1, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, - 205, 206, 207, 208, -1, 210, 211, -1, 213, 214, - 215, 216, 217, 218, 219, -1, 221, -1, 223, 224, - 225, 226, 227, 228, 229, 230, -1, 232, 233, 234, - -1, -1, 237, 238, 239, 240, -1, 242, 243, 244, + 145, 146, 147, 148, -1, 150, 151, 152, 153, 154, + 155, 156, 157, 158, 159, 160, 161, -1, 163, -1, + 165, 166, 167, 168, -1, 170, -1, 172, -1, -1, + -1, 176, 177, 178, -1, 180, 181, 182, -1, 184, + 185, 186, 187, -1, 189, 190, 191, 192, 193, 194, + 195, -1, 197, 198, 199, 200, -1, 202, 203, 204, + 205, 206, 207, 208, -1, 210, -1, 212, 213, 214, + 215, 216, 217, 218, 219, -1, 221, -1, 223, -1, + -1, 226, -1, 228, 229, 230, -1, 232, 233, 234, + -1, -1, 237, -1, 239, -1, -1, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, -1, -1, 281, 282, 283, 284, - -1, -1, 287, 288, 289, 290, 291, -1, 293, 294, - -1, -1, 297, 298, 299, -1, -1, 302, 303, -1, - 305, 306, 307, -1, 309, 310, 311, 312, 313, 314, + 265, 266, 267, 268, 269, 270, 271, 272, 273, -1, + 275, 276, 277, 278, 279, -1, 281, 282, -1, 284, + -1, 286, 287, 288, 289, 290, 291, -1, 293, 294, + -1, 296, 297, 298, 299, -1, -1, 302, 303, 304, + -1, 306, -1, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, -1, -1, -1, -1, - 325, 326, -1, 328, 329, 330, -1, 332, 333, 334, + 325, 326, 327, -1, 329, 330, 331, 332, 333, 334, -1, 336, 337, 338, 339, 340, 341, -1, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, -1, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, - 365, 366, -1, 368, 369, 370, 371, 372, 373, 374, + 365, 366, -1, 368, 369, -1, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, - 385, 386, 387, -1, 389, 390, 391, 392, 393, 394, - 395, 396, 397, 398, -1, 400, 401, 402, 403, 404, + 385, 386, 387, -1, -1, 390, 391, 392, 393, 394, + 395, 396, 397, 398, -1, -1, 401, 402, 403, 404, -1, 406, 407, 408, 409, 410, 411, 412, 413, 414, - 415, 416, 417, 418, 419, 420, 421, -1, -1, -1, - 425, 426, -1, 428, 429, 430, 431, 432, 433, 434, - 435, -1, 437, 438, 439, -1, -1, 442, 443, -1, - 445, -1, -1, 448, 449, 450, 451, 452, 453, 454, - 455, 456, -1, 458, 459, 460, 461, -1, 463, 464, - 465, 466, -1, 468, 469, 470, 471, 472, -1, 474, - 475, -1, 477, 478, 479, 480, 481, 482, 483, 484, + 415, 416, 417, 418, 419, 420, 421, 422, -1, -1, + 425, 426, -1, 428, -1, 430, 431, 432, 433, 434, + 435, -1, 437, 438, 439, -1, -1, 442, 443, 444, + 445, 446, -1, 448, 449, 450, 451, 452, 453, 454, + 455, -1, -1, 458, 459, 460, -1, -1, 463, 464, + 465, 466, -1, 468, 469, 470, 471, 472, 473, 474, + 475, -1, 477, -1, 479, 480, 481, 482, 483, 484, 485, -1, -1, 488, -1, -1, 491, 492, 493, 494, - 495, 496, 3, -1, 5, -1, -1, -1, -1, -1, - -1, -1, -1, 508, 509, 510, 511, -1, -1, -1, - -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, - -1, 32, 33, 34, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 44, 45, -1, -1, 48, 49, -1, - 51, 52, 53, 54, 55, -1, 57, 58, -1, -1, - 61, 62, 63, 64, 65, -1, -1, 68, 69, 70, - 71, 72, 73, 74, -1, 76, 77, 78, 79, 80, - -1, -1, -1, 84, 85, 86, 87, 88, 89, -1, - 91, 92, 93, -1, 95, 96, 97, 98, 99, 100, - -1, -1, 103, 104, 105, 106, 107, 108, 109, 110, - 111, 112, 113, 114, 115, 116, 117, -1, 119, -1, - 121, 122, 123, 124, 125, 126, -1, -1, 129, 130, - 131, 132, -1, -1, 135, 136, 137, 138, 139, -1, - 141, 142, 143, -1, 145, 146, 147, 148, -1, 150, - 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, - 161, -1, 163, -1, 165, 166, 167, 168, -1, 170, - -1, 172, -1, -1, -1, 176, 177, 178, -1, 180, - 181, 182, -1, 184, 185, 186, 187, -1, 189, 190, - 191, 192, 193, 194, 195, -1, 197, 198, 199, 200, - -1, 202, 203, 204, 205, 206, 207, 208, -1, 210, - -1, 212, 213, 214, 215, 216, 217, 218, 219, -1, - 221, -1, 223, -1, -1, 226, -1, 228, 229, 230, - -1, 232, 233, 234, -1, -1, 237, -1, 239, -1, - -1, 242, 243, 244, 245, 246, 247, 248, 249, 250, - 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, - 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, - 271, 272, 273, -1, 275, 276, 277, 278, 279, -1, - 281, 282, -1, 284, -1, 286, 287, 288, 289, 290, - 291, -1, 293, 294, -1, -1, 297, 298, 299, -1, - -1, 302, 303, 304, -1, 306, -1, 308, 309, 310, - 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, - -1, -1, -1, -1, 325, 326, 327, -1, 329, 330, - 331, 332, 333, 334, -1, 336, 337, 338, 339, 340, - 341, -1, 343, 344, 345, 346, 347, 348, 349, 350, - 351, 352, -1, 354, 355, 356, 357, 358, 359, 360, - 361, 362, 363, 364, 365, 366, -1, 368, 369, -1, - 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, - 381, 382, 383, 384, 385, 386, 387, -1, -1, 390, - 391, 392, 393, 394, 395, 396, 397, 398, -1, -1, - 401, 402, 403, 404, -1, 406, 407, 408, 409, 410, - 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, - 421, 422, -1, -1, 425, 426, 427, 428, -1, 430, - 431, 432, 433, 434, 435, -1, 437, 438, 439, -1, - -1, 442, 443, 444, 445, 446, -1, 448, 449, 450, - 451, 452, 453, 454, 455, -1, -1, 458, 459, 460, - -1, -1, 463, 464, 465, 466, -1, 468, 469, 470, - 471, 472, 473, 474, 475, -1, 477, -1, 479, 480, - 481, 482, 483, 484, 485, -1, -1, 488, -1, -1, - 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, - 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, - 511, 3, -1, -1, -1, -1, -1, -1, -1, -1, + 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, + 505, 506, 507, 508, 509, 510, 511, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 23, 24, 25, + 26, 27, 28, 29, 30, -1, 32, 33, 34, -1, + -1, -1, 38, -1, -1, -1, -1, 43, 44, 45, + -1, 47, 48, 49, 50, 51, 52, 53, -1, 55, + 56, 57, 58, -1, 60, 61, 62, 63, 64, 65, + -1, -1, 68, 69, 70, 71, 72, 73, 74, -1, + 76, 77, 78, 79, -1, -1, 82, -1, 84, 85, + 86, 87, 88, 89, 90, 91, 92, 93, -1, 95, + 96, 97, 98, 99, 100, -1, 102, 103, 104, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, + 116, 117, -1, 119, -1, 121, 122, 123, 124, 125, + 126, -1, -1, 129, 130, 131, 132, -1, -1, 135, + 136, 137, 138, 139, -1, 141, 142, 143, -1, 145, + 146, 147, 148, -1, 150, 151, 152, 153, -1, 155, + 156, 157, 158, 159, 160, -1, -1, 163, -1, 165, + 166, 167, 168, -1, 170, -1, 172, 173, -1, 175, + 176, 177, -1, 179, 180, 181, 182, -1, -1, -1, + 186, 187, -1, 189, 190, 191, 192, 193, 194, 195, + 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, + 206, 207, 208, -1, 210, 211, -1, 213, 214, 215, + 216, 217, 218, 219, -1, 221, -1, 223, 224, 225, + 226, 227, 228, 229, 230, -1, 232, 233, 234, -1, + -1, 237, 238, 239, 240, -1, 242, 243, 244, 245, + 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, + 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, + 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, + 276, 277, 278, -1, -1, 281, 282, 283, 284, -1, + -1, 287, 288, 289, 290, 291, -1, 293, 294, -1, + -1, 297, 298, 299, -1, -1, 302, 303, -1, 305, + 306, 307, -1, 309, 310, 311, 312, 313, 314, 315, + 316, 317, 318, 319, 320, -1, -1, -1, -1, 325, + 326, -1, 328, 329, 330, -1, 332, 333, 334, -1, + 336, 337, 338, 339, 340, 341, -1, 343, 344, 345, + 346, 347, 348, 349, 350, 351, 352, -1, 354, 355, + 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, + 366, -1, 368, 369, 370, 371, 372, 373, 374, 375, + 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, + 386, 387, -1, 389, 390, 391, 392, 393, 394, 395, + 396, 397, 398, -1, 400, 401, 402, 403, 404, -1, + 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, + 416, 417, 418, 419, 420, 421, -1, -1, -1, 425, + 426, -1, 428, 429, 430, 431, 432, 433, 434, 435, + -1, 437, 438, 439, -1, -1, 442, 443, -1, 445, + -1, -1, 448, 449, 450, 451, 452, 453, 454, 455, + 456, -1, 458, 459, 460, 461, -1, 463, 464, 465, + 466, -1, 468, 469, 470, 471, 472, -1, 474, 475, + -1, 477, 478, 479, 480, 481, 482, 483, 484, 485, + -1, -1, 488, -1, -1, 491, 492, 493, 494, 495, + 496, 3, -1, 5, -1, -1, -1, -1, -1, -1, + -1, -1, 508, 509, 510, 511, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, -1, - 32, 33, 34, -1, -1, -1, 38, -1, -1, -1, - -1, 43, 44, 45, -1, 47, 48, 49, 50, 51, - 52, 53, -1, 55, 56, 57, 58, -1, 60, 61, + 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 44, 45, -1, -1, 48, 49, -1, 51, + 52, 53, 54, 55, -1, 57, 58, -1, -1, 61, 62, 63, 64, 65, -1, -1, 68, 69, 70, 71, - 72, 73, 74, -1, 76, 77, 78, 79, -1, -1, - 82, -1, 84, 85, 86, 87, 88, 89, 90, 91, + 72, 73, 74, -1, 76, 77, 78, 79, 80, -1, + -1, -1, 84, 85, 86, 87, 88, 89, -1, 91, 92, 93, -1, 95, 96, 97, 98, 99, 100, -1, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + -1, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, -1, 119, -1, 121, 122, 123, 124, 125, 126, -1, -1, 129, 130, 131, 132, -1, -1, 135, 136, 137, 138, 139, -1, 141, 142, 143, -1, 145, 146, 147, 148, -1, 150, 151, - 152, 153, -1, 155, 156, 157, 158, 159, 160, -1, + 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, -1, 163, -1, 165, 166, 167, 168, -1, 170, -1, - 172, 173, -1, 175, 176, 177, -1, 179, 180, 181, - 182, -1, -1, -1, 186, 187, -1, 189, 190, 191, - 192, 193, 194, 195, 196, 197, 198, 199, 200, -1, - 202, 203, 204, 205, 206, 207, 208, -1, 210, 211, - -1, 213, 214, 215, 216, 217, 218, 219, -1, 221, - -1, 223, 224, 225, 226, 227, 228, 229, 230, -1, - 232, 233, 234, -1, -1, 237, 238, 239, 240, -1, + 172, -1, -1, -1, 176, 177, 178, -1, 180, 181, + 182, -1, 184, 185, 186, 187, -1, 189, 190, 191, + 192, 193, 194, 195, -1, 197, 198, 199, 200, -1, + 202, 203, 204, 205, 206, 207, 208, -1, 210, -1, + 212, 213, 214, 215, 216, 217, 218, 219, -1, 221, + -1, 223, -1, -1, 226, -1, 228, 229, 230, -1, + 232, 233, 234, -1, -1, 237, -1, 239, -1, -1, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, - 272, 273, 274, 275, 276, 277, 278, -1, -1, 281, - 282, 283, 284, -1, -1, 287, 288, 289, 290, 291, + 272, 273, -1, 275, 276, 277, 278, 279, -1, 281, + 282, -1, 284, -1, 286, 287, 288, 289, 290, 291, -1, 293, 294, -1, -1, 297, 298, 299, -1, -1, - 302, 303, -1, 305, 306, 307, -1, 309, 310, 311, + 302, 303, 304, -1, 306, -1, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, -1, - -1, -1, -1, 325, 326, -1, 328, 329, 330, -1, + -1, -1, -1, 325, 326, 327, -1, 329, 330, 331, 332, 333, 334, -1, 336, 337, 338, 339, 340, 341, -1, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, -1, 354, 355, 356, 357, 358, 359, 360, 361, - 362, 363, 364, 365, 366, -1, 368, 369, 370, 371, + 362, 363, 364, 365, 366, -1, 368, 369, -1, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, - 382, 383, 384, 385, 386, 387, -1, 389, 390, 391, - 392, 393, 394, 395, 396, 397, 398, -1, 400, 401, + 382, 383, 384, 385, 386, 387, -1, -1, 390, 391, + 392, 393, 394, 395, 396, 397, 398, -1, -1, 401, 402, 403, 404, -1, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, - -1, -1, -1, 425, 426, -1, 428, 429, 430, 431, + 422, -1, -1, 425, 426, 427, 428, -1, 430, 431, 432, 433, 434, 435, -1, 437, 438, 439, -1, -1, - 442, 443, -1, 445, -1, -1, 448, 449, 450, 451, - 452, 453, 454, 455, 456, -1, 458, 459, 460, 461, + 442, 443, 444, 445, 446, -1, 448, 449, 450, 451, + 452, 453, 454, 455, -1, -1, 458, 459, 460, -1, -1, 463, 464, 465, 466, -1, 468, 469, 470, 471, - 472, -1, 474, 475, -1, 477, 478, 479, 480, 481, + 472, 473, 474, 475, -1, 477, -1, 479, 480, 481, 482, 483, 484, 485, -1, -1, 488, -1, -1, 491, - 492, 493, 494, 495, 496, 3, -1, 5, -1, -1, - -1, -1, -1, -1, -1, -1, 508, 509, 510, 511, - -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, - 28, 29, 30, -1, 32, 33, 34, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 44, 45, -1, -1, - 48, 49, -1, 51, 52, 53, 54, 55, -1, 57, - 58, -1, -1, 61, 62, 63, 64, 65, -1, -1, - 68, 69, 70, 71, 72, 73, 74, -1, 76, 77, - 78, 79, 80, -1, -1, -1, 84, 85, 86, 87, - 88, 89, -1, 91, 92, 93, -1, 95, 96, 97, - 98, 99, 100, -1, -1, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - -1, 119, -1, 121, 122, 123, 124, 125, 126, -1, - -1, 129, 130, 131, 132, -1, -1, 135, 136, 137, - 138, 139, -1, 141, 142, 143, -1, 145, 146, 147, - 148, -1, 150, 151, 152, 153, 154, 155, 156, 157, - 158, 159, 160, 161, -1, 163, -1, 165, 166, 167, - 168, -1, 170, -1, 172, -1, -1, -1, 176, 177, - 178, -1, 180, 181, 182, -1, 184, 185, 186, 187, - -1, 189, 190, 191, 192, 193, 194, 195, -1, 197, - 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, - 208, -1, 210, -1, 212, 213, 214, 215, 216, 217, - 218, 219, -1, 221, -1, 223, -1, -1, 226, -1, - 228, 229, 230, -1, 232, 233, 234, -1, -1, 237, - -1, 239, -1, -1, 242, 243, 244, 245, 246, 247, - 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, - 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, - 268, 269, 270, 271, 272, 273, -1, 275, 276, 277, - 278, 279, -1, 281, 282, -1, 284, -1, 286, 287, - 288, 289, 290, 291, -1, 293, 294, -1, -1, 297, - 298, 299, -1, -1, 302, 303, 304, -1, 306, -1, - 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, - 318, 319, 320, -1, -1, -1, -1, 325, 326, 327, - -1, 329, 330, 331, 332, 333, 334, -1, 336, 337, - 338, 339, 340, 341, -1, 343, 344, 345, 346, 347, - 348, 349, 350, 351, 352, -1, 354, 355, 356, 357, - 358, 359, 360, 361, 362, 363, 364, 365, 366, -1, - 368, 369, -1, 371, 372, 373, 374, 375, 376, 377, - 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, - -1, -1, 390, 391, 392, 393, 394, 395, 396, 397, - 398, -1, -1, 401, 402, 403, 404, -1, 406, 407, - 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, - 418, 419, 420, 421, 422, -1, -1, 425, 426, -1, - 428, -1, 430, 431, 432, 433, 434, 435, -1, 437, - 438, 439, -1, -1, 442, 443, 444, 445, 446, -1, - 448, 449, 450, 451, 452, 453, 454, 455, -1, -1, - 458, 459, 460, -1, -1, 463, 464, 465, 466, -1, - 468, 469, 470, 471, 472, 473, 474, 475, -1, 477, - -1, 479, 480, 481, 482, 483, 484, 485, -1, -1, - 488, -1, -1, 491, 492, 493, 494, 495, 496, 497, - 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, - 508, 509, 510, 511, 3, -1, 5, -1, -1, -1, + 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, + 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, + 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, + 33, 34, -1, -1, -1, 38, -1, -1, -1, -1, + 43, 44, 45, -1, 47, 48, 49, 50, 51, 52, + 53, -1, 55, 56, 57, 58, -1, 60, 61, 62, + 63, 64, 65, -1, -1, 68, 69, 70, 71, 72, + 73, 74, -1, 76, 77, 78, 79, -1, -1, 82, + -1, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, -1, 95, 96, 97, 98, 99, 100, -1, 102, + 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, + 113, 114, 115, 116, 117, -1, 119, -1, 121, 122, + 123, 124, 125, 126, -1, -1, 129, 130, 131, 132, + -1, -1, 135, 136, 137, 138, 139, -1, 141, 142, + 143, -1, 145, 146, 147, 148, -1, 150, 151, 152, + 153, -1, 155, 156, 157, 158, 159, 160, -1, -1, + 163, -1, 165, 166, 167, 168, -1, 170, -1, 172, + 173, -1, 175, 176, 177, -1, 179, 180, 181, 182, + -1, -1, -1, 186, 187, -1, 189, 190, 191, 192, + 193, 194, 195, 196, 197, 198, 199, 200, -1, 202, + 203, 204, 205, 206, 207, 208, -1, 210, 211, -1, + 213, 214, 215, 216, 217, 218, 219, -1, 221, -1, + 223, 224, 225, 226, 227, 228, 229, 230, -1, 232, + 233, 234, -1, -1, 237, 238, 239, 240, -1, 242, + 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, + 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, + 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, + 273, 274, 275, 276, 277, 278, -1, -1, 281, 282, + 283, 284, -1, -1, 287, 288, 289, 290, 291, -1, + 293, 294, -1, -1, 297, 298, 299, -1, -1, 302, + 303, -1, 305, 306, 307, -1, 309, 310, 311, 312, + 313, 314, 315, 316, 317, 318, 319, 320, -1, -1, + -1, -1, 325, 326, -1, 328, 329, 330, -1, 332, + 333, 334, -1, 336, 337, 338, 339, 340, 341, -1, + 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, + -1, 354, 355, 356, 357, 358, 359, 360, 361, 362, + 363, 364, 365, 366, -1, 368, 369, 370, 371, 372, + 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, + 383, 384, 385, 386, 387, -1, 389, 390, 391, 392, + 393, 394, 395, 396, 397, 398, -1, 400, 401, 402, + 403, 404, -1, 406, 407, 408, 409, 410, 411, 412, + 413, 414, 415, 416, 417, 418, 419, 420, 421, -1, + -1, -1, 425, 426, -1, 428, 429, 430, 431, 432, + 433, 434, 435, -1, 437, 438, 439, -1, -1, 442, + 443, -1, 445, -1, -1, 448, 449, 450, 451, 452, + 453, 454, 455, 456, -1, 458, 459, 460, 461, -1, + 463, 464, 465, 466, -1, 468, 469, 470, 471, 472, + -1, 474, 475, -1, 477, 478, 479, 480, 481, 482, + 483, 484, 485, -1, -1, 488, -1, -1, 491, 492, + 493, 494, 495, 496, 3, -1, 5, -1, -1, -1, + -1, -1, -1, -1, -1, 508, 509, 510, 511, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, 45, -1, -1, 48, @@ -18362,10 +18406,10 @@ static const yytype_int16 yycheck[] = 479, 480, 481, 482, 483, 484, 485, -1, -1, 488, -1, -1, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, - 509, 510, 511, 3, -1, -1, -1, -1, -1, -1, + 509, 510, 511, 3, -1, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, + 30, -1, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, 45, -1, -1, 48, 49, -1, 51, 52, 53, 54, 55, -1, 57, 58, -1, -1, 61, 62, 63, 64, 65, -1, -1, 68, 69, @@ -18413,10 +18457,10 @@ static const yytype_int16 yycheck[] = 480, 481, 482, 483, 484, 485, -1, -1, 488, -1, -1, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, - 510, 511, 3, -1, 5, -1, -1, -1, -1, -1, + 510, 511, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, - -1, 32, 33, 34, -1, -1, -1, -1, -1, -1, + 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, 45, -1, -1, 48, 49, -1, 51, 52, 53, 54, 55, -1, 57, 58, -1, -1, 61, 62, 63, 64, 65, -1, -1, 68, 69, 70, @@ -18769,11 +18813,11 @@ static const yytype_int16 yycheck[] = 477, -1, 479, 480, 481, 482, 483, 484, 485, -1, -1, 488, -1, -1, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, - 507, 508, 509, 510, 511, 3, -1, -1, -1, -1, + 507, 508, 509, 510, 511, 3, -1, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, -1, -1, -1, - -1, -1, -1, 41, -1, -1, 44, 45, -1, -1, + -1, -1, -1, -1, -1, -1, 44, 45, -1, -1, 48, 49, -1, 51, 52, 53, 54, 55, -1, 57, 58, -1, -1, 61, 62, 63, 64, 65, -1, -1, 68, 69, 70, 71, 72, 73, 74, -1, 76, 77, @@ -18874,8 +18918,8 @@ static const yytype_int16 yycheck[] = 509, 510, 511, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 44, 45, -1, -1, 48, 49, + 30, -1, 32, 33, 34, -1, -1, -1, -1, -1, + -1, 41, -1, -1, 44, 45, -1, -1, 48, 49, -1, 51, 52, 53, 54, 55, -1, 57, 58, -1, -1, 61, 62, 63, 64, 65, -1, -1, 68, 69, 70, 71, 72, 73, 74, -1, 76, 77, 78, 79, @@ -18922,10 +18966,10 @@ static const yytype_int16 yycheck[] = 480, 481, 482, 483, 484, 485, -1, -1, 488, -1, -1, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, - 510, 511, 3, -1, 5, -1, -1, -1, -1, -1, + 510, 511, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, - -1, 32, 33, 34, -1, -1, -1, -1, -1, -1, + 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, 45, -1, -1, 48, 49, -1, 51, 52, 53, 54, 55, -1, 57, 58, -1, -1, 61, 62, 63, 64, 65, -1, -1, 68, 69, 70, @@ -19278,7 +19322,7 @@ static const yytype_int16 yycheck[] = 477, -1, 479, 480, 481, 482, 483, 484, 485, -1, -1, 488, -1, -1, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, - 507, 508, 509, 510, 511, 3, -1, -1, -1, -1, + 507, 508, 509, 510, 511, 3, -1, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, -1, -1, -1, @@ -19638,7 +19682,7 @@ static const yytype_int16 yycheck[] = -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, - -1, -1, -1, -1, -1, -1, 41, -1, -1, 44, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, 45, -1, -1, 48, 49, -1, 51, 52, 53, 54, 55, -1, 57, 58, -1, -1, 61, 62, 63, 64, 65, -1, -1, 68, 69, 70, 71, 72, 73, 74, @@ -19674,7 +19718,7 @@ static const yytype_int16 yycheck[] = 365, 366, -1, 368, 369, -1, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, -1, -1, 390, 391, 392, 393, 394, - -1, 396, 397, 398, -1, -1, 401, 402, 403, 404, + 395, 396, 397, 398, -1, -1, 401, 402, 403, 404, -1, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, -1, -1, 425, 426, -1, 428, -1, 430, 431, 432, 433, 434, @@ -19689,7 +19733,7 @@ static const yytype_int16 yycheck[] = -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 44, 45, + -1, -1, -1, -1, -1, 41, -1, -1, 44, 45, -1, -1, 48, 49, -1, 51, 52, 53, 54, 55, -1, 57, 58, -1, -1, 61, 62, 63, 64, 65, -1, -1, 68, 69, 70, 71, 72, 73, 74, -1, @@ -19724,7 +19768,7 @@ static const yytype_int16 yycheck[] = 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, -1, 368, 369, -1, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, - 386, 387, -1, -1, 390, 391, 392, 393, 394, 395, + 386, 387, -1, -1, 390, 391, 392, 393, 394, -1, 396, 397, 398, -1, -1, 401, 402, 403, 404, -1, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, -1, -1, 425, @@ -19841,206 +19885,257 @@ static const yytype_int16 yycheck[] = 508, 509, 510, 511, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, - 29, 30, -1, 32, 33, 34, -1, -1, -1, 38, - -1, -1, -1, -1, 43, 44, 45, -1, 47, 48, - 49, 50, 51, 52, 53, -1, 55, 56, 57, 58, - -1, 60, 61, 62, 63, 64, 65, -1, -1, 68, + 29, 30, -1, 32, 33, 34, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 44, 45, -1, -1, 48, + 49, -1, 51, 52, 53, 54, 55, -1, 57, 58, + -1, -1, 61, 62, 63, 64, 65, -1, -1, 68, 69, 70, 71, 72, 73, 74, -1, 76, 77, 78, - 79, -1, -1, 82, -1, 84, 85, 86, 87, 88, - 89, 90, 91, 92, 93, -1, 95, 96, 97, 98, - 99, 100, -1, 102, 103, 104, 105, 106, 107, 108, + 79, 80, -1, -1, -1, 84, 85, 86, 87, 88, + 89, -1, 91, 92, 93, -1, 95, 96, 97, 98, + 99, 100, -1, -1, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, -1, 119, -1, 121, 122, 123, 124, 125, 126, -1, -1, 129, 130, 131, 132, -1, -1, 135, 136, 137, 138, 139, -1, 141, 142, 143, -1, 145, 146, 147, 148, - -1, 150, 151, 152, 153, -1, 155, 156, 157, 158, - 159, 160, -1, -1, 163, -1, 165, 166, 167, 168, - -1, 170, -1, 172, 173, -1, 175, 176, 177, 178, - 179, 180, 181, 182, -1, -1, -1, 186, 187, -1, - 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, + -1, 150, 151, 152, 153, 154, 155, 156, 157, 158, + 159, 160, 161, -1, 163, -1, 165, 166, 167, 168, + -1, 170, -1, 172, -1, -1, -1, 176, 177, 178, + -1, 180, 181, 182, -1, 184, 185, 186, 187, -1, + 189, 190, 191, 192, 193, 194, 195, -1, 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, - -1, 210, 211, -1, 213, 214, 215, 216, 217, 218, - 219, -1, 221, -1, 223, 224, 225, 226, 227, 228, - 229, 230, -1, 232, 233, 234, -1, -1, 237, 238, - 239, 240, -1, 242, 243, 244, 245, 246, 247, 248, + -1, 210, -1, 212, 213, 214, 215, 216, 217, 218, + 219, -1, 221, -1, 223, -1, -1, 226, -1, 228, + 229, 230, -1, 232, 233, 234, -1, -1, 237, -1, + 239, -1, -1, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, - 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, - -1, -1, 281, 282, 283, 284, -1, -1, 287, 288, + 269, 270, 271, 272, 273, -1, 275, 276, 277, 278, + 279, -1, 281, 282, -1, 284, -1, 286, 287, 288, 289, 290, 291, -1, 293, 294, -1, -1, 297, 298, - 299, -1, -1, 302, 303, -1, 305, 306, 307, -1, + 299, -1, -1, 302, 303, 304, -1, 306, -1, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, - 319, 320, -1, -1, -1, -1, 325, 326, -1, 328, - 329, 330, -1, 332, 333, 334, -1, 336, 337, 338, + 319, 320, -1, -1, -1, -1, 325, 326, 327, -1, + 329, 330, 331, 332, 333, 334, -1, 336, 337, 338, 339, 340, 341, -1, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, -1, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, -1, 368, - 369, 370, 371, 372, 373, -1, 375, 376, 377, 378, + 369, -1, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, -1, - 389, 390, 391, 392, 393, 394, 395, -1, 397, 398, - -1, 400, 401, 402, 403, 404, -1, 406, 407, 408, + -1, 390, 391, 392, 393, 394, 395, 396, 397, 398, + -1, -1, 401, 402, 403, 404, -1, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, - 419, 420, 421, -1, -1, -1, 425, 426, -1, 428, - 429, 430, 431, 432, 433, 434, 435, -1, 437, 438, - 439, -1, -1, 442, 443, -1, 445, -1, -1, 448, + 419, 420, 421, 422, -1, -1, 425, 426, -1, 428, + -1, 430, 431, 432, 433, 434, 435, -1, 437, 438, + 439, -1, -1, 442, 443, 444, 445, 446, -1, 448, 449, 450, 451, 452, 453, 454, 455, -1, -1, 458, - 459, 460, 461, -1, 463, 464, 465, 466, -1, 468, - 469, 470, 471, 472, -1, 474, 475, -1, 477, 478, + 459, 460, -1, -1, 463, 464, 465, 466, -1, 468, + 469, 470, 471, 472, 473, 474, 475, -1, 477, -1, 479, 480, 481, 482, 483, 484, 485, -1, -1, 488, - -1, -1, 491, 492, 493, 494, 495, 496, 3, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 508, - 509, 510, 511, -1, -1, -1, -1, -1, 23, 24, - 25, 26, 27, 28, 29, 30, -1, 32, 33, 34, - -1, -1, -1, 38, -1, -1, -1, -1, 43, 44, - 45, -1, 47, 48, 49, 50, 51, 52, 53, -1, - 55, 56, 57, 58, -1, 60, 61, 62, 63, 64, - 65, -1, -1, 68, 69, 70, 71, 72, 73, 74, - -1, 76, 77, 78, 79, -1, -1, 82, -1, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, -1, - 95, 96, 97, 98, 99, 100, -1, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, -1, 119, -1, 121, 122, 123, 124, - 125, 126, -1, -1, 129, 130, 131, 132, -1, -1, - 135, 136, 137, 138, 139, -1, 141, 142, 143, -1, - 145, 146, 147, 148, -1, 150, 151, 152, 153, -1, - 155, 156, 157, 158, 159, 160, -1, -1, 163, -1, - 165, 166, 167, 168, -1, 170, -1, 172, 173, -1, - 175, 176, 177, -1, 179, 180, 181, 182, -1, -1, - -1, 186, 187, -1, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, - 205, 206, 207, 208, -1, 210, 211, -1, 213, 214, - 215, 216, 217, 218, 219, -1, 221, -1, 223, 224, - 225, 226, 227, 228, 229, 230, -1, 232, 233, 234, - -1, -1, 237, 238, 239, 240, -1, 242, 243, 244, - 245, 246, 247, 248, 249, -1, 251, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, -1, -1, 281, 282, 283, 284, - -1, -1, 287, 288, 289, 290, 291, -1, 293, 294, - -1, -1, 297, 298, 299, -1, -1, 302, 303, -1, - 305, 306, 307, -1, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, -1, -1, -1, -1, - 325, 326, -1, 328, 329, 330, -1, 332, 333, 334, - -1, 336, 337, 338, 339, 340, 341, -1, 343, 344, - 345, 346, 347, 348, 349, 350, 351, 352, -1, 354, - 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, - 365, 366, -1, 368, 369, 370, 371, 372, 373, -1, - 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, - 385, 386, 387, -1, 389, 390, 391, 392, 393, 394, - 395, -1, 397, 398, -1, 400, 401, 402, 403, 404, - -1, 406, 407, 408, 409, 410, 411, 412, 413, 414, - 415, 416, 417, 418, 419, -1, 421, -1, -1, -1, - 425, 426, -1, 428, 429, 430, 431, 432, 433, 434, - 435, -1, 437, 438, 439, -1, -1, 442, 443, -1, - 445, -1, -1, 448, 449, 450, 451, 452, 453, 454, - 455, -1, -1, 458, 459, 460, 461, -1, 463, 464, - 465, 466, -1, 468, 469, 470, 471, 472, -1, 474, - 475, -1, 477, 478, 479, 480, 481, 482, 483, 484, - 485, -1, -1, 488, -1, -1, 491, 492, 493, 494, - 495, 496, 3, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 508, 509, 510, 511, -1, -1, -1, - -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, - -1, 32, 33, 34, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 44, 45, -1, -1, 48, 49, -1, - 51, 52, 53, 54, 55, -1, 57, 58, -1, -1, - 61, 62, 63, 64, 65, -1, -1, 68, 69, 70, - 71, 72, 73, 74, -1, 76, 77, 78, 79, 80, - -1, -1, -1, 84, 85, 86, 87, 88, 89, -1, - 91, 92, 93, -1, 95, 96, 97, 98, 99, 100, - -1, -1, 103, 104, 105, 106, 107, 108, 109, 110, - 111, 112, 113, 114, 115, 116, 117, -1, 119, -1, - 121, 122, 123, 124, 125, 126, -1, -1, 129, 130, - 131, 132, -1, -1, 135, 136, 137, 138, 139, -1, - 141, 142, 143, -1, 145, 146, 147, 148, -1, 150, - 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, - 161, -1, 163, -1, 165, 166, 167, 168, -1, 170, - -1, 172, -1, -1, -1, 176, 177, 178, -1, 180, - 181, 182, -1, 184, 185, -1, 187, -1, 189, 190, - 191, 192, 193, 194, 195, -1, 197, 198, 199, 200, - -1, 202, 203, 204, 205, 206, 207, 208, -1, 210, - -1, 212, 213, 214, 215, 216, 217, 218, 219, -1, - 221, -1, 223, -1, -1, 226, -1, 228, 229, 230, - -1, 232, 233, 234, -1, -1, 237, -1, 239, -1, - -1, 242, 243, 244, 245, 246, 247, 248, 249, 250, - 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, - 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, - 271, 272, 273, -1, 275, 276, 277, 278, 279, -1, - 281, 282, -1, 284, -1, 286, 287, 288, 289, 290, - 291, -1, 293, 294, -1, -1, 297, 298, 299, -1, - -1, 302, 303, 304, -1, 306, -1, 308, 309, 310, - 311, 312, 313, 314, -1, 316, 317, 318, 319, 320, - -1, -1, -1, -1, 325, 326, 327, -1, 329, 330, - 331, 332, 333, 334, -1, 336, 337, 338, 339, 340, - 341, -1, 343, 344, 345, -1, 347, 348, 349, 350, - 351, 352, -1, 354, 355, 356, 357, 358, 359, 360, - 361, 362, 363, 364, 365, 366, -1, 368, 369, -1, - 371, 372, 373, 374, -1, 376, 377, 378, 379, 380, - 381, 382, 383, 384, 385, 386, 387, -1, -1, 390, - 391, 392, 393, 394, 395, 396, 397, 398, -1, -1, - 401, 402, 403, 404, -1, 406, 407, 408, 409, 410, - 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, - 421, 422, -1, -1, 425, 426, -1, 428, -1, 430, - 431, 432, 433, 434, 435, -1, 437, 438, 439, -1, - -1, 442, 443, 444, 445, 446, -1, 448, 449, 450, - 451, 452, 453, 454, 455, -1, -1, 458, 459, 460, - -1, -1, 463, 464, 465, 466, -1, 468, 469, 470, - 471, 472, 473, 474, 475, -1, 477, -1, 479, 480, - 481, 482, 483, 484, 485, -1, -1, 488, -1, -1, - 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, - 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, - 511, 23, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 33, -1, 35, 36, -1, -1, -1, -1, 23, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, - -1, 53, -1, -1, -1, -1, -1, -1, -1, -1, - 62, -1, -1, -1, -1, -1, -1, -1, -1, 53, - -1, -1, -1, -1, 76, -1, -1, -1, 62, -1, - -1, -1, -1, -1, -1, 87, -1, -1, -1, -1, - -1, -1, 76, -1, -1, -1, -1, 99, -1, 101, - -1, -1, -1, 87, -1, -1, -1, -1, -1, -1, - 112, -1, -1, -1, -1, 99, -1, 101, -1, -1, - -1, -1, -1, -1, -1, 127, 128, -1, 112, -1, - -1, -1, -1, -1, -1, -1, 138, -1, -1, -1, - -1, -1, 144, 127, 128, -1, -1, -1, -1, -1, - -1, 153, -1, -1, 138, -1, -1, -1, -1, -1, - 144, -1, -1, -1, -1, -1, -1, -1, 170, 153, - -1, -1, 174, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 170, -1, -1, -1, - 174, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 491, 492, 493, 494, 495, 496, 497, 498, + 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, + 509, 510, 511, 3, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 23, 24, 25, 26, 27, 28, 29, + 30, -1, 32, 33, 34, -1, -1, -1, 38, -1, + -1, -1, -1, 43, 44, 45, -1, 47, 48, 49, + 50, 51, 52, 53, -1, 55, 56, 57, 58, -1, + 60, 61, 62, 63, 64, 65, -1, -1, 68, 69, + 70, 71, 72, 73, 74, -1, 76, 77, 78, 79, + -1, -1, 82, -1, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, -1, 95, 96, 97, 98, 99, + 100, -1, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 117, -1, 119, + -1, 121, 122, 123, 124, 125, 126, -1, -1, 129, + 130, 131, 132, -1, -1, 135, 136, 137, 138, 139, + -1, 141, 142, 143, -1, 145, 146, 147, 148, -1, + 150, 151, 152, 153, -1, 155, 156, 157, 158, 159, + 160, -1, -1, 163, -1, 165, 166, 167, 168, -1, + 170, -1, 172, 173, -1, 175, 176, 177, 178, 179, + 180, 181, 182, -1, -1, -1, 186, 187, -1, 189, + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, -1, 202, 203, 204, 205, 206, 207, 208, -1, + 210, 211, -1, 213, 214, 215, 216, 217, 218, 219, + -1, 221, -1, 223, 224, 225, 226, 227, 228, 229, + 230, -1, 232, 233, 234, -1, -1, 237, 238, 239, + 240, -1, 242, 243, 244, 245, 246, 247, 248, 249, + 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, + 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, + 270, 271, 272, 273, 274, 275, 276, 277, 278, -1, + -1, 281, 282, 283, 284, -1, -1, 287, 288, 289, + 290, 291, -1, 293, 294, -1, -1, 297, 298, 299, + -1, -1, 302, 303, -1, 305, 306, 307, -1, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, -1, -1, -1, -1, 325, 326, -1, 328, 329, + 330, -1, 332, 333, 334, -1, 336, 337, 338, 339, + 340, 341, -1, 343, 344, 345, 346, 347, 348, 349, + 350, 351, 352, -1, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 364, 365, 366, -1, 368, 369, + 370, 371, 372, 373, -1, 375, 376, 377, 378, 379, + 380, 381, 382, 383, 384, 385, 386, 387, -1, 389, + 390, 391, 392, 393, 394, 395, -1, 397, 398, -1, + 400, 401, 402, 403, 404, -1, 406, 407, 408, 409, + 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, + 420, 421, -1, -1, -1, 425, 426, -1, 428, 429, + 430, 431, 432, 433, 434, 435, -1, 437, 438, 439, + -1, -1, 442, 443, -1, 445, -1, -1, 448, 449, + 450, 451, 452, 453, 454, 455, -1, -1, 458, 459, + 460, 461, -1, 463, 464, 465, 466, -1, 468, 469, + 470, 471, 472, -1, 474, 475, -1, 477, 478, 479, + 480, 481, 482, 483, 484, 485, -1, -1, 488, -1, + -1, 491, 492, 493, 494, 495, 496, 3, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 508, 509, + 510, 511, -1, -1, -1, -1, -1, 23, 24, 25, + 26, 27, 28, 29, 30, -1, 32, 33, 34, -1, + -1, -1, 38, -1, -1, -1, -1, 43, 44, 45, + -1, 47, 48, 49, 50, 51, 52, 53, -1, 55, + 56, 57, 58, -1, 60, 61, 62, 63, 64, 65, + -1, -1, 68, 69, 70, 71, 72, 73, 74, -1, + 76, 77, 78, 79, -1, -1, 82, -1, 84, 85, + 86, 87, 88, 89, 90, 91, 92, 93, -1, 95, + 96, 97, 98, 99, 100, -1, 102, 103, 104, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, + 116, 117, -1, 119, -1, 121, 122, 123, 124, 125, + 126, -1, -1, 129, 130, 131, 132, -1, -1, 135, + 136, 137, 138, 139, -1, 141, 142, 143, -1, 145, + 146, 147, 148, -1, 150, 151, 152, 153, -1, 155, + 156, 157, 158, 159, 160, -1, -1, 163, -1, 165, + 166, 167, 168, -1, 170, -1, 172, 173, -1, 175, + 176, 177, -1, 179, 180, 181, 182, -1, -1, -1, + 186, 187, -1, 189, 190, 191, 192, 193, 194, 195, + 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, + 206, 207, 208, -1, 210, 211, -1, 213, 214, 215, + 216, 217, 218, 219, -1, 221, -1, 223, 224, 225, + 226, 227, 228, 229, 230, -1, 232, 233, 234, -1, + -1, 237, 238, 239, 240, -1, 242, 243, 244, 245, + 246, 247, 248, 249, -1, 251, 252, 253, 254, 255, + 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, + 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, + 276, 277, 278, -1, -1, 281, 282, 283, 284, -1, + -1, 287, 288, 289, 290, 291, -1, 293, 294, -1, + -1, 297, 298, 299, -1, -1, 302, 303, -1, 305, + 306, 307, -1, 309, 310, 311, 312, 313, 314, 315, + 316, 317, 318, 319, 320, -1, -1, -1, -1, 325, + 326, -1, 328, 329, 330, -1, 332, 333, 334, -1, + 336, 337, 338, 339, 340, 341, -1, 343, 344, 345, + 346, 347, 348, 349, 350, 351, 352, -1, 354, 355, + 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, + 366, -1, 368, 369, 370, 371, 372, 373, -1, 375, + 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, + 386, 387, -1, 389, 390, 391, 392, 393, 394, 395, + -1, 397, 398, -1, 400, 401, 402, 403, 404, -1, + 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, + 416, 417, 418, 419, -1, 421, -1, -1, -1, 425, + 426, -1, 428, 429, 430, 431, 432, 433, 434, 435, + -1, 437, 438, 439, -1, -1, 442, 443, -1, 445, + -1, -1, 448, 449, 450, 451, 452, 453, 454, 455, + -1, -1, 458, 459, 460, 461, -1, 463, 464, 465, + 466, -1, 468, 469, 470, 471, 472, -1, 474, 475, + -1, 477, 478, 479, 480, 481, 482, 483, 484, 485, + -1, -1, 488, -1, -1, 491, 492, 493, 494, 495, + 496, 3, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 508, 509, 510, 511, -1, -1, -1, -1, + -1, 23, 24, 25, 26, 27, 28, 29, 30, -1, + 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 44, 45, -1, -1, 48, 49, -1, 51, + 52, 53, 54, 55, -1, 57, 58, -1, -1, 61, + 62, 63, 64, 65, -1, -1, 68, 69, 70, 71, + 72, 73, 74, -1, 76, 77, 78, 79, 80, -1, + -1, -1, 84, 85, 86, 87, 88, 89, -1, 91, + 92, 93, -1, 95, 96, 97, 98, 99, 100, -1, + -1, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, -1, 119, -1, 121, + 122, 123, 124, 125, 126, -1, -1, 129, 130, 131, + 132, -1, -1, 135, 136, 137, 138, 139, -1, 141, + 142, 143, -1, 145, 146, 147, 148, -1, 150, 151, + 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, + -1, 163, -1, 165, 166, 167, 168, -1, 170, -1, + 172, -1, -1, -1, 176, 177, 178, -1, 180, 181, + 182, -1, 184, 185, -1, 187, -1, 189, 190, 191, + 192, 193, 194, 195, -1, 197, 198, 199, 200, -1, + 202, 203, 204, 205, 206, 207, 208, -1, 210, -1, + 212, 213, 214, 215, 216, 217, 218, 219, -1, 221, + -1, 223, -1, -1, 226, -1, 228, 229, 230, -1, + 232, 233, 234, -1, -1, 237, -1, 239, -1, -1, + 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, + 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + 272, 273, -1, 275, 276, 277, 278, 279, -1, 281, + 282, -1, 284, -1, 286, 287, 288, 289, 290, 291, + -1, 293, 294, -1, -1, 297, 298, 299, -1, -1, + 302, 303, 304, -1, 306, -1, 308, 309, 310, 311, + 312, 313, 314, -1, 316, 317, 318, 319, 320, -1, + -1, -1, -1, 325, 326, 327, -1, 329, 330, 331, + 332, 333, 334, -1, 336, 337, 338, 339, 340, 341, + -1, 343, 344, 345, -1, 347, 348, 349, 350, 351, + 352, -1, 354, 355, 356, 357, 358, 359, 360, 361, + 362, 363, 364, 365, 366, -1, 368, 369, -1, 371, + 372, 373, 374, -1, 376, 377, 378, 379, 380, 381, + 382, 383, 384, 385, 386, 387, -1, -1, 390, 391, + 392, 393, 394, 395, 396, 397, 398, -1, -1, 401, + 402, 403, 404, -1, 406, 407, 408, 409, 410, 411, + 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, + 422, -1, -1, 425, 426, -1, 428, -1, 430, 431, + 432, 433, 434, 435, -1, 437, 438, 439, -1, -1, + 442, 443, 444, 445, 446, -1, 448, 449, 450, 451, + 452, 453, 454, 455, -1, -1, 458, 459, 460, -1, + -1, 463, 464, 465, 466, -1, 468, 469, 470, 471, + 472, 473, 474, 475, -1, 477, -1, 479, 480, 481, + 482, 483, 484, 485, -1, -1, 488, -1, -1, 491, + 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, + 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, + 23, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 33, -1, 35, 36, -1, -1, -1, -1, 23, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 33, -1, + 53, -1, -1, -1, -1, -1, -1, -1, -1, 62, + -1, -1, -1, -1, -1, -1, -1, -1, 53, -1, + -1, -1, -1, 76, -1, -1, -1, 62, -1, -1, + -1, -1, -1, -1, 87, -1, -1, -1, -1, -1, + -1, 76, -1, -1, -1, -1, 99, -1, 101, -1, + -1, -1, 87, -1, -1, -1, -1, -1, -1, 112, + -1, -1, -1, -1, 99, -1, 101, -1, -1, -1, + -1, -1, -1, -1, 127, 128, -1, 112, -1, -1, + -1, -1, -1, -1, -1, 138, -1, -1, -1, -1, + -1, 144, 127, 128, -1, -1, -1, -1, -1, -1, + 153, -1, -1, 138, -1, -1, -1, -1, -1, 144, + -1, -1, -1, -1, -1, -1, -1, 170, 153, -1, + -1, 174, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 170, -1, -1, -1, 174, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 216, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 216, -1, -1, -1, -1, -1, -1, -1, - -1, 243, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 243, + -1, -1, -1, 216, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 216, -1, -1, -1, -1, -1, -1, -1, -1, + 243, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 243, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 321, - 322, 323, -1, -1, -1, -1, -1, 329, -1, -1, - 332, -1, -1, -1, -1, -1, -1, 321, 322, 323, - -1, -1, -1, -1, -1, 329, -1, -1, 332, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 321, 322, + 323, -1, -1, -1, -1, -1, 329, -1, -1, 332, + -1, -1, -1, -1, -1, -1, 321, 322, 323, -1, + -1, -1, -1, -1, 329, -1, -1, 332, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 363, -1, -1, -1, -1, -1, -1, -1, -1, - 372, -1, -1, -1, -1, -1, -1, -1, -1, 363, - -1, -1, -1, -1, -1, -1, 388, -1, 372, -1, - -1, -1, -1, 395, -1, -1, -1, 399, -1, -1, - -1, -1, -1, -1, 388, -1, -1, -1, -1, 411, - -1, 395, -1, -1, -1, 399, -1, -1, -1, -1, - -1, 423, -1, -1, -1, 427, -1, 411, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 423, - -1, -1, -1, 427, -1, -1, 448, -1, -1, -1, + 363, -1, -1, -1, -1, -1, -1, -1, -1, 372, + -1, -1, -1, -1, -1, -1, -1, -1, 363, -1, + -1, -1, -1, -1, -1, 388, -1, 372, -1, -1, + -1, -1, 395, -1, -1, -1, 399, -1, -1, -1, + -1, -1, -1, 388, -1, -1, -1, -1, 411, -1, + 395, -1, -1, -1, 399, -1, -1, -1, -1, -1, + 423, -1, -1, -1, 427, -1, 411, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 423, -1, + -1, -1, 427, -1, -1, 448, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 462, + -1, -1, -1, 448, -1, 468, -1, -1, -1, -1, + 473, -1, -1, -1, -1, 478, -1, 462, -1, -1, + -1, -1, -1, 468, -1, -1, -1, 490, 473, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 462, -1, -1, -1, 448, -1, 468, -1, -1, -1, - -1, 473, -1, -1, -1, -1, 478, -1, 462, -1, - -1, -1, -1, -1, 468, -1, -1, -1, 490, 473, + -1, -1, -1, -1, -1, 490, -1, -1, -1, -1, + -1, 514, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 528, -1, -1, -1, 514, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 490, -1, -1, -1, - -1, -1, 514, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 528, -1, -1, -1, - 514, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 528 + -1, -1, -1, 528 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -20053,12 +20148,12 @@ static const yytype_uint16 yystos[] = 332, 363, 372, 388, 395, 399, 411, 423, 427, 448, 462, 465, 468, 473, 490, 514, 528, 539, 540, 541, 542, 557, 566, 568, 573, 589, 593, 594, 596, 603, - 604, 608, 615, 616, 618, 621, 622, 672, 678, 689, - 700, 701, 714, 715, 716, 717, 719, 721, 722, 726, - 786, 787, 967, 970, 973, 980, 981, 983, 986, 987, - 988, 995, 999, 1005, 1006, 1009, 1014, 1018, 1019, 1020, - 1027, 1030, 1031, 1032, 1035, 1036, 1038, 442, 493, 619, - 109, 205, 379, 390, 427, 480, 109, 194, 300, 1021, + 604, 608, 615, 616, 618, 621, 622, 674, 680, 691, + 702, 703, 716, 717, 718, 719, 721, 723, 724, 728, + 788, 789, 969, 972, 975, 982, 983, 985, 988, 989, + 990, 997, 1001, 1007, 1008, 1011, 1016, 1020, 1021, 1022, + 1029, 1032, 1033, 1034, 1037, 1038, 1040, 442, 493, 619, + 109, 205, 379, 390, 427, 480, 109, 194, 300, 1023, 619, 3, 23, 24, 25, 26, 27, 28, 29, 30, 32, 33, 34, 43, 44, 45, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 61, 62, @@ -20100,10 +20195,10 @@ static const yytype_uint16 yystos[] = 475, 477, 478, 479, 480, 481, 482, 483, 484, 485, 488, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, - 510, 511, 559, 868, 956, 960, 1041, 1042, 1043, 3, - 178, 250, 420, 559, 982, 1041, 295, 619, 56, 174, - 528, 711, 180, 244, 300, 320, 379, 432, 434, 457, - 460, 598, 670, 979, 5, 31, 332, 559, 560, 955, + 510, 511, 559, 870, 958, 962, 1043, 1044, 1045, 3, + 178, 250, 420, 559, 984, 1043, 295, 619, 56, 174, + 528, 713, 180, 244, 300, 320, 379, 432, 434, 457, + 460, 598, 672, 981, 5, 31, 332, 559, 560, 957, 3, 31, 35, 36, 37, 38, 39, 40, 41, 42, 43, 46, 47, 50, 54, 55, 56, 57, 58, 59, 60, 66, 67, 72, 73, 75, 80, 81, 82, 83, @@ -20120,315 +20215,317 @@ static const yytype_uint16 yystos[] = 439, 440, 441, 444, 446, 447, 450, 456, 457, 461, 462, 467, 473, 474, 476, 478, 486, 487, 489, 490, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, - 507, 565, 1041, 1045, 1047, 25, 82, 98, 148, 158, + 507, 565, 1043, 1047, 1049, 25, 82, 98, 148, 158, 171, 176, 205, 249, 254, 326, 341, 376, 379, 390, - 393, 413, 427, 434, 435, 445, 451, 480, 598, 673, - 674, 677, 619, 955, 33, 101, 138, 478, 528, 542, + 393, 413, 427, 434, 435, 445, 451, 480, 598, 675, + 676, 679, 619, 957, 33, 101, 138, 478, 528, 542, 557, 566, 568, 589, 593, 594, 603, 604, 608, 618, - 622, 672, 678, 689, 700, 701, 714, 967, 970, 973, - 980, 981, 991, 995, 999, 1005, 1009, 1014, 1027, 1030, - 1035, 1036, 1038, 109, 76, 67, 80, 82, 161, 235, + 622, 674, 680, 691, 702, 703, 716, 969, 972, 975, + 982, 983, 993, 997, 1001, 1007, 1011, 1016, 1029, 1032, + 1037, 1038, 1040, 109, 76, 67, 80, 82, 161, 235, 286, 296, 308, 327, 375, 422, 444, 446, 450, 473, - 528, 558, 559, 560, 715, 787, 789, 791, 792, 802, - 809, 810, 868, 870, 871, 109, 5, 559, 561, 1007, - 559, 955, 31, 180, 244, 394, 438, 442, 475, 559, - 1028, 1029, 1034, 619, 31, 133, 738, 739, 180, 244, - 379, 394, 438, 475, 1000, 1001, 1034, 619, 558, 559, - 560, 714, 726, 809, 427, 735, 558, 175, 528, 1011, - 528, 351, 727, 728, 955, 727, 715, 716, 1030, 0, - 531, 123, 215, 256, 464, 149, 220, 301, 456, 741, - 742, 792, 792, 715, 717, 719, 532, 478, 989, 216, - 31, 428, 438, 442, 558, 714, 194, 559, 194, 558, - 955, 194, 558, 194, 809, 194, 558, 280, 361, 561, + 528, 558, 559, 560, 717, 789, 791, 793, 794, 804, + 811, 812, 870, 872, 873, 109, 5, 559, 561, 1009, + 559, 957, 31, 180, 244, 394, 438, 442, 475, 559, + 1030, 1031, 1036, 619, 31, 133, 740, 741, 180, 244, + 379, 394, 438, 475, 1002, 1003, 1036, 619, 558, 559, + 560, 716, 728, 811, 427, 737, 558, 175, 528, 1013, + 528, 351, 729, 730, 957, 729, 717, 718, 1032, 0, + 531, 123, 215, 256, 464, 149, 220, 301, 456, 743, + 744, 794, 794, 717, 719, 721, 532, 478, 991, 216, + 31, 428, 438, 442, 558, 716, 194, 559, 194, 558, + 957, 194, 558, 194, 811, 194, 558, 280, 361, 561, 347, 620, 526, 530, 562, 563, 528, 83, 109, 176, - 205, 249, 379, 390, 427, 451, 480, 985, 109, 714, + 205, 249, 379, 390, 427, 451, 480, 987, 109, 716, 558, 432, 434, 432, 434, 361, 194, 558, 386, 176, - 249, 351, 390, 427, 451, 480, 696, 205, 31, 955, + 249, 351, 390, 427, 451, 480, 698, 205, 31, 957, 194, 565, 257, 445, 108, 427, 427, 480, 383, 386, - 194, 559, 675, 962, 194, 952, 955, 194, 955, 528, - 607, 300, 434, 991, 3, 473, 992, 994, 995, 997, - 998, 1041, 1045, 989, 559, 561, 982, 528, 528, 169, - 528, 715, 810, 528, 528, 558, 528, 528, 174, 528, - 528, 528, 528, 715, 787, 792, 802, 521, 562, 19, - 41, 559, 803, 804, 803, 388, 532, 718, 528, 715, - 809, 810, 38, 43, 102, 175, 211, 227, 238, 274, - 321, 328, 370, 389, 462, 806, 804, 41, 559, 803, - 805, 514, 814, 561, 517, 528, 528, 968, 1029, 1029, - 1029, 511, 226, 1029, 530, 295, 4, 6, 7, 8, + 194, 559, 677, 964, 194, 954, 957, 194, 957, 528, + 607, 300, 434, 993, 3, 473, 994, 996, 997, 999, + 1000, 1043, 1047, 991, 559, 561, 984, 528, 528, 169, + 528, 717, 812, 528, 528, 558, 528, 528, 174, 528, + 528, 528, 528, 717, 789, 794, 804, 521, 562, 19, + 41, 559, 805, 806, 805, 388, 532, 720, 528, 717, + 811, 812, 38, 43, 102, 175, 211, 227, 238, 274, + 321, 328, 370, 389, 462, 808, 806, 41, 559, 805, + 807, 514, 816, 561, 517, 528, 528, 970, 1031, 1031, + 1031, 511, 226, 1031, 530, 295, 4, 6, 7, 8, 9, 10, 40, 55, 57, 58, 66, 72, 73, 84, 113, 116, 118, 137, 154, 162, 167, 184, 185, 218, 219, 221, 231, 250, 273, 275, 280, 285, 288, 297, 348, 374, 403, 438, 439, 447, 461, 474, 512, 519, 520, 521, 526, 528, 533, 534, 535, 536, 559, 561, - 715, 776, 826, 829, 832, 833, 834, 836, 837, 838, - 839, 841, 842, 858, 860, 861, 862, 863, 864, 865, - 866, 867, 868, 869, 871, 872, 887, 888, 899, 921, - 927, 935, 936, 937, 956, 957, 958, 934, 936, 1000, - 1000, 561, 1000, 511, 1000, 174, 440, 517, 620, 562, - 809, 1015, 3, 173, 175, 478, 995, 1010, 1012, 173, - 1013, 559, 858, 905, 906, 727, 532, 528, 964, 529, - 529, 529, 541, 174, 300, 576, 222, 159, 1015, 31, - 133, 736, 736, 60, 736, 164, 169, 241, 292, 747, - 749, 750, 779, 781, 782, 783, 183, 295, 467, 295, - 741, 742, 528, 558, 1007, 428, 1033, 174, 511, 226, + 717, 778, 828, 831, 834, 835, 836, 838, 839, 840, + 841, 843, 844, 860, 862, 863, 864, 865, 866, 867, + 868, 869, 870, 871, 873, 874, 889, 890, 901, 923, + 929, 937, 938, 939, 958, 959, 960, 936, 938, 1002, + 1002, 561, 1002, 511, 1002, 174, 440, 517, 620, 562, + 811, 1017, 3, 173, 175, 478, 997, 1012, 1014, 173, + 1015, 559, 860, 907, 908, 729, 532, 528, 966, 529, + 529, 529, 541, 174, 300, 576, 222, 159, 1017, 31, + 133, 738, 738, 60, 738, 164, 169, 241, 292, 749, + 751, 752, 781, 783, 784, 785, 183, 295, 467, 295, + 743, 744, 528, 558, 1009, 428, 1035, 174, 511, 226, 154, 359, 154, 27, 33, 138, 299, 359, 363, 395, 470, 551, 554, 555, 359, 154, 41, 61, 107, 204, 255, 266, 278, 310, 359, 365, 390, 395, 411, 554, 609, 612, 154, 359, 395, 554, 154, 359, 395, 554, - 154, 1021, 41, 1022, 296, 495, 858, 928, 564, 565, + 154, 1023, 41, 1024, 296, 495, 860, 930, 564, 565, 563, 3, 31, 38, 43, 47, 50, 56, 60, 82, 84, 90, 102, 133, 173, 175, 178, 179, 196, 211, 224, 225, 227, 238, 240, 250, 274, 283, 305, 307, 328, 370, 389, 400, 420, 429, 450, 461, 476, 478, - 529, 742, 858, 908, 909, 959, 965, 1041, 1046, 858, - 427, 558, 559, 529, 528, 659, 379, 598, 670, 280, - 971, 194, 559, 597, 480, 194, 558, 194, 558, 1040, - 194, 558, 194, 558, 194, 558, 90, 976, 154, 494, - 91, 130, 313, 433, 194, 559, 154, 530, 963, 64, - 366, 532, 676, 154, 532, 676, 154, 295, 605, 606, - 858, 965, 361, 529, 532, 4, 162, 295, 447, 519, - 520, 561, 611, 614, 958, 990, 992, 993, 996, 991, - 440, 528, 708, 710, 858, 906, 528, 3, 69, 70, + 529, 744, 860, 910, 911, 961, 967, 1043, 1048, 860, + 427, 558, 559, 529, 528, 661, 379, 598, 672, 280, + 973, 194, 559, 597, 480, 194, 558, 194, 558, 1042, + 194, 558, 194, 558, 194, 558, 90, 978, 154, 494, + 91, 130, 313, 433, 194, 559, 154, 530, 965, 64, + 366, 532, 678, 154, 532, 678, 154, 295, 605, 606, + 860, 967, 361, 529, 532, 4, 162, 295, 447, 519, + 520, 561, 611, 614, 960, 992, 994, 995, 998, 993, + 440, 528, 710, 712, 860, 908, 528, 3, 69, 70, 110, 111, 114, 115, 191, 192, 258, 259, 260, 261, 262, 263, 264, 265, 268, 269, 343, 344, 384, 385, - 484, 485, 508, 509, 561, 844, 845, 846, 847, 848, - 849, 850, 851, 852, 853, 854, 855, 856, 911, 912, - 804, 805, 858, 558, 858, 913, 519, 520, 559, 859, - 860, 888, 899, 915, 528, 858, 905, 916, 858, 59, - 174, 236, 441, 858, 906, 919, 858, 529, 560, 528, - 429, 756, 757, 757, 738, 739, 792, 222, 733, 802, - 757, 47, 761, 757, 227, 38, 227, 389, 806, 227, - 305, 807, 792, 807, 227, 806, 528, 227, 807, 227, - 150, 202, 794, 227, 761, 528, 560, 528, 757, 302, - 858, 1002, 1004, 908, 3, 38, 43, 47, 50, 55, + 484, 485, 508, 509, 561, 846, 847, 848, 849, 850, + 851, 852, 853, 854, 855, 856, 857, 858, 913, 914, + 806, 807, 860, 558, 860, 915, 519, 520, 559, 861, + 862, 890, 901, 917, 528, 860, 907, 918, 860, 59, + 174, 236, 441, 860, 908, 921, 860, 529, 560, 528, + 429, 758, 759, 759, 740, 741, 794, 222, 735, 804, + 759, 47, 763, 759, 227, 38, 227, 389, 808, 227, + 305, 809, 794, 809, 227, 808, 528, 227, 809, 227, + 150, 202, 796, 227, 763, 528, 560, 528, 759, 302, + 860, 1004, 1006, 910, 3, 38, 43, 47, 50, 55, 56, 57, 58, 60, 72, 73, 82, 84, 90, 102, 113, 116, 167, 173, 175, 179, 196, 211, 218, 219, 221, 224, 225, 227, 238, 240, 250, 273, 274, 275, 283, 288, 305, 307, 328, 348, 370, 374, 389, 396, 400, 403, 420, 429, 438, 439, 450, 456, 461, 474, - 478, 820, 822, 823, 825, 827, 829, 831, 833, 834, - 835, 837, 838, 841, 842, 910, 961, 1041, 1044, 41, - 239, 559, 528, 526, 715, 477, 840, 858, 925, 840, - 840, 528, 528, 828, 828, 331, 715, 528, 830, 952, - 536, 72, 73, 840, 858, 828, 528, 528, 492, 514, - 528, 843, 528, 843, 528, 858, 858, 858, 84, 150, - 938, 942, 858, 906, 907, 715, 858, 905, 565, 9, - 560, 889, 890, 891, 19, 530, 562, 929, 562, 528, - 561, 528, 528, 561, 958, 3, 8, 11, 15, 16, + 478, 822, 824, 825, 827, 829, 831, 833, 835, 836, + 837, 839, 840, 843, 844, 912, 963, 1043, 1046, 41, + 239, 559, 528, 526, 717, 477, 842, 860, 927, 842, + 842, 528, 528, 830, 830, 331, 717, 528, 832, 954, + 536, 72, 73, 842, 860, 830, 528, 528, 492, 514, + 528, 845, 528, 845, 528, 860, 860, 860, 84, 150, + 940, 944, 860, 908, 909, 717, 860, 907, 565, 9, + 560, 891, 892, 893, 19, 530, 562, 931, 562, 528, + 561, 528, 528, 561, 960, 3, 8, 11, 15, 16, 17, 18, 20, 21, 22, 37, 41, 47, 54, 81, 179, 196, 201, 224, 225, 240, 280, 283, 297, 300, 400, 512, 515, 516, 517, 519, 520, 521, 522, 523, - 524, 897, 898, 899, 901, 932, 491, 873, 307, 858, - 532, 733, 528, 561, 733, 3, 118, 244, 561, 611, - 842, 1003, 105, 1004, 1004, 41, 559, 529, 532, 989, - 532, 529, 728, 952, 953, 467, 729, 1015, 195, 361, - 222, 1015, 659, 395, 717, 717, 31, 743, 744, 858, - 60, 717, 737, 166, 277, 767, 229, 278, 347, 398, - 464, 4, 9, 31, 762, 858, 519, 520, 763, 764, - 858, 860, 779, 780, 750, 749, 747, 748, 169, 782, - 290, 784, 60, 723, 724, 725, 795, 859, 936, 936, - 747, 779, 906, 964, 174, 479, 1008, 558, 239, 559, + 524, 899, 900, 901, 903, 934, 491, 875, 307, 860, + 532, 735, 528, 561, 735, 3, 118, 244, 561, 611, + 844, 1005, 105, 1006, 1006, 41, 559, 529, 532, 991, + 532, 529, 730, 954, 955, 467, 731, 1017, 195, 361, + 222, 1017, 661, 395, 719, 719, 31, 745, 746, 860, + 60, 719, 739, 166, 277, 769, 229, 278, 347, 398, + 464, 4, 9, 31, 764, 860, 519, 520, 765, 766, + 860, 862, 781, 782, 752, 751, 749, 750, 169, 784, + 290, 786, 60, 725, 726, 727, 797, 861, 938, 938, + 749, 781, 908, 966, 174, 479, 1010, 558, 239, 559, 440, 558, 75, 83, 94, 171, 194, 335, 457, 549, - 550, 559, 639, 666, 83, 94, 567, 94, 567, 528, + 550, 559, 639, 668, 83, 94, 567, 94, 567, 528, 440, 316, 406, 528, 637, 248, 316, 406, 460, 637, - 94, 532, 440, 558, 3, 825, 611, 60, 613, 611, + 94, 532, 440, 558, 3, 827, 611, 60, 613, 611, 611, 107, 255, 266, 60, 440, 490, 514, 610, 271, - 379, 610, 612, 809, 94, 440, 567, 379, 558, 440, - 379, 1021, 561, 559, 528, 1026, 527, 19, 908, 908, - 909, 195, 364, 740, 532, 741, 742, 13, 14, 224, - 224, 440, 440, 559, 658, 663, 490, 709, 558, 386, - 351, 390, 427, 451, 480, 696, 154, 101, 594, 622, - 972, 973, 1036, 280, 201, 599, 558, 280, 595, 609, - 280, 528, 659, 41, 280, 41, 280, 659, 280, 528, - 690, 691, 692, 693, 694, 695, 697, 194, 559, 653, - 977, 565, 154, 174, 617, 675, 564, 530, 962, 952, - 955, 955, 962, 529, 532, 13, 991, 997, 4, 958, - 4, 958, 561, 565, 1024, 1025, 56, 103, 124, 142, - 147, 170, 173, 189, 285, 293, 315, 345, 712, 41, - 529, 858, 529, 174, 532, 529, 324, 914, 529, 859, - 859, 11, 15, 16, 20, 21, 22, 201, 224, 297, - 515, 516, 517, 519, 520, 521, 522, 523, 524, 899, - 859, 529, 811, 812, 870, 169, 174, 917, 918, 532, - 529, 41, 919, 906, 919, 919, 174, 529, 41, 803, - 528, 953, 4, 9, 559, 751, 752, 754, 755, 863, - 936, 934, 180, 244, 427, 432, 434, 460, 558, 734, - 487, 815, 529, 528, 757, 792, 792, 227, 792, 295, - 467, 808, 792, 227, 936, 792, 792, 287, 287, 528, - 792, 757, 560, 816, 817, 528, 560, 816, 532, 529, - 532, 530, 528, 825, 528, 528, 530, 824, 40, 824, - 528, 844, 845, 846, 847, 848, 849, 850, 851, 852, - 853, 854, 855, 856, 857, 529, 532, 828, 568, 573, - 700, 701, 714, 969, 1014, 1030, 906, 907, 528, 486, - 922, 923, 858, 907, 958, 19, 858, 892, 893, 894, - 895, 840, 840, 8, 15, 16, 20, 21, 22, 515, - 516, 517, 519, 520, 521, 522, 523, 524, 559, 897, - 902, 529, 906, 438, 438, 958, 958, 858, 528, 528, - 560, 939, 361, 946, 169, 527, 529, 532, 19, 532, - 537, 858, 521, 563, 906, 958, 858, 857, 857, 822, - 858, 858, 858, 858, 858, 858, 858, 858, 5, 565, - 966, 438, 46, 424, 933, 962, 858, 858, 528, 715, - 864, 920, 927, 133, 162, 280, 285, 290, 447, 458, - 858, 285, 528, 858, 440, 54, 179, 196, 201, 240, - 400, 858, 858, 858, 858, 858, 858, 858, 858, 858, - 858, 31, 39, 405, 896, 526, 530, 931, 183, 165, - 874, 374, 528, 888, 937, 174, 788, 908, 788, 528, - 561, 559, 558, 1010, 558, 1018, 858, 532, 529, 229, - 41, 467, 1017, 558, 570, 467, 528, 559, 575, 585, - 586, 588, 42, 127, 745, 532, 467, 745, 271, 717, - 374, 375, 519, 520, 764, 766, 860, 398, 229, 296, - 319, 319, 532, 523, 4, 765, 958, 765, 374, 375, - 766, 558, 951, 284, 402, 785, 528, 953, 954, 532, - 183, 467, 201, 183, 222, 780, 748, 529, 559, 561, - 559, 561, 359, 559, 359, 554, 528, 194, 550, 955, - 229, 280, 229, 467, 528, 642, 649, 650, 821, 822, - 530, 547, 548, 955, 559, 194, 955, 194, 549, 27, - 138, 395, 546, 553, 565, 633, 647, 955, 60, 60, - 565, 641, 662, 60, 60, 955, 551, 955, 359, 395, - 554, 609, 611, 962, 955, 611, 962, 955, 611, 359, - 395, 554, 955, 955, 549, 955, 359, 395, 554, 955, - 955, 561, 1022, 1025, 520, 858, 928, 741, 741, 741, - 287, 287, 529, 476, 909, 740, 858, 858, 285, 561, - 984, 285, 984, 559, 340, 707, 529, 532, 293, 174, - 440, 703, 971, 597, 480, 558, 558, 1040, 558, 558, - 558, 558, 300, 670, 154, 3, 528, 528, 154, 154, - 240, 559, 639, 651, 654, 657, 667, 669, 490, 492, - 644, 153, 714, 154, 145, 590, 822, 154, 490, 978, - 154, 3, 43, 47, 50, 56, 82, 84, 90, 102, - 173, 175, 178, 179, 196, 211, 224, 225, 227, 238, - 240, 250, 274, 283, 305, 307, 328, 370, 400, 420, - 429, 450, 461, 478, 529, 698, 699, 965, 1041, 532, - 532, 41, 280, 295, 559, 3, 676, 564, 676, 295, - 676, 605, 858, 708, 858, 1023, 529, 532, 41, 706, - 561, 706, 280, 285, 345, 706, 60, 706, 822, 529, - 858, 858, 858, 917, 822, 859, 859, 859, 859, 859, - 859, 133, 280, 290, 859, 859, 859, 859, 859, 859, - 859, 859, 859, 859, 529, 532, 41, 813, 858, 858, - 918, 917, 822, 529, 529, 529, 906, 822, 953, 529, - 319, 375, 523, 528, 528, 733, 432, 434, 432, 434, - 558, 735, 735, 735, 858, 183, 768, 439, 479, 759, - 760, 808, 808, 792, 858, 528, 792, 169, 808, 528, - 560, 799, 808, 822, 529, 532, 816, 529, 1002, 3, - 910, 40, 824, 559, 819, 819, 3, 526, 526, 958, - 440, 440, 440, 440, 822, 464, 529, 527, 906, 858, - 140, 923, 924, 529, 529, 529, 858, 19, 532, 537, - 530, 529, 529, 511, 511, 529, 529, 529, 858, 939, - 940, 941, 530, 528, 858, 943, 359, 950, 952, 858, - 858, 889, 942, 529, 529, 529, 511, 859, 859, 147, - 906, 174, 133, 162, 285, 290, 447, 458, 528, 147, - 902, 858, 424, 933, 858, 920, 858, 440, 528, 715, - 858, 928, 564, 528, 528, 157, 875, 789, 790, 815, - 741, 815, 958, 857, 964, 964, 528, 254, 280, 732, - 790, 487, 1016, 41, 60, 571, 792, 581, 588, 929, - 532, 788, 517, 513, 746, 744, 297, 897, 900, 746, - 4, 958, 766, 296, 464, 763, 532, 247, 953, 723, - 60, 936, 528, 560, 60, 271, 1008, 1008, 440, 440, - 858, 280, 666, 528, 154, 528, 642, 205, 663, 664, - 623, 41, 178, 632, 660, 564, 548, 623, 27, 138, - 363, 365, 395, 543, 544, 545, 555, 556, 154, 676, - 154, 676, 633, 647, 633, 529, 532, 561, 626, 517, - 530, 529, 532, 528, 528, 440, 379, 94, 440, 567, - 379, 440, 440, 440, 379, 1022, 1026, 529, 19, 19, - 527, 740, 740, 740, 909, 529, 528, 702, 3, 414, - 415, 528, 561, 713, 863, 658, 707, 599, 558, 595, - 528, 41, 41, 659, 693, 695, 971, 361, 427, 597, - 565, 601, 602, 663, 558, 558, 1040, 558, 649, 650, - 529, 532, 293, 637, 293, 295, 636, 955, 490, 1039, - 558, 528, 715, 558, 637, 41, 558, 529, 532, 821, - 822, 691, 697, 694, 697, 427, 858, 154, 558, 617, - 962, 1024, 561, 561, 285, 663, 521, 663, 561, 521, - 663, 561, 529, 529, 918, 174, 133, 290, 528, 814, - 811, 528, 529, 529, 529, 559, 752, 815, 735, 735, - 735, 735, 558, 558, 558, 60, 188, 777, 14, 529, - 808, 953, 528, 796, 797, 798, 861, 864, 953, 169, - 81, 818, 817, 529, 529, 526, 822, 529, 532, 529, - 527, 958, 958, 529, 845, 847, 848, 849, 848, 849, - 849, 529, 436, 858, 144, 858, 892, 902, 843, 843, - 529, 532, 529, 560, 858, 943, 944, 945, 41, 528, - 939, 947, 201, 529, 946, 857, 858, 37, 37, 858, - 529, 858, 174, 528, 910, 858, 529, 147, 859, 859, - 147, 147, 858, 858, 527, 19, 528, 930, 742, 487, - 858, 306, 879, 532, 768, 740, 768, 529, 559, 730, - 731, 926, 254, 528, 858, 367, 579, 559, 271, 327, - 118, 309, 528, 569, 714, 808, 529, 532, 575, 1016, - 858, 166, 234, 528, 746, 296, 558, 529, 954, 183, - 715, 716, 936, 954, 955, 559, 955, 529, 154, 664, - 550, 664, 623, 653, 532, 529, 120, 209, 278, 280, - 648, 528, 34, 60, 671, 660, 75, 81, 94, 118, - 120, 209, 280, 285, 335, 353, 457, 467, 628, 629, - 643, 178, 118, 193, 280, 637, 610, 108, 118, 178, - 280, 413, 416, 612, 637, 395, 545, 451, 955, 549, - 553, 3, 38, 43, 47, 50, 56, 60, 82, 84, - 90, 102, 173, 175, 179, 196, 211, 224, 225, 227, - 238, 240, 250, 274, 279, 283, 297, 305, 307, 328, - 370, 389, 396, 400, 420, 429, 450, 456, 461, 478, - 519, 520, 561, 611, 624, 665, 822, 900, 959, 1041, - 1047, 565, 662, 906, 743, 955, 955, 955, 955, 549, - 955, 955, 955, 955, 955, 1026, 928, 928, 529, 529, - 529, 741, 108, 379, 530, 858, 610, 713, 528, 528, - 657, 714, 590, 978, 670, 194, 558, 599, 600, 858, - 529, 532, 529, 595, 528, 41, 646, 644, 559, 654, - 87, 607, 108, 278, 41, 561, 591, 592, 659, 714, - 693, 695, 529, 699, 13, 14, 41, 41, 715, 716, - 653, 467, 975, 676, 663, 859, 174, 528, 910, 816, - 529, 532, 529, 768, 558, 558, 558, 558, 31, 104, - 184, 373, 528, 769, 770, 771, 772, 773, 774, 775, - 858, 858, 489, 876, 858, 529, 860, 903, 904, 201, - 183, 793, 797, 529, 799, 800, 801, 962, 824, 958, - 824, 559, 824, 527, 527, 858, 939, 532, 529, 559, - 947, 948, 949, 41, 858, 860, 950, 858, 858, 858, - 910, 529, 858, 37, 37, 858, 858, 147, 529, 520, - 928, 529, 908, 529, 858, 529, 528, 559, 880, 777, - 529, 777, 561, 529, 532, 969, 935, 473, 426, 466, - 580, 559, 574, 584, 295, 577, 486, 684, 686, 687, - 688, 517, 588, 579, 902, 60, 529, 529, 472, 473, - 720, 623, 550, 529, 529, 490, 656, 121, 197, 207, - 120, 469, 858, 118, 41, 528, 962, 955, 859, 121, - 197, 120, 285, 229, 558, 656, 89, 671, 194, 285, - 611, 858, 671, 285, 519, 520, 614, 559, 821, 676, - 676, 3, 959, 963, 517, 529, 529, 440, 440, 527, - 527, 740, 529, 529, 559, 529, 708, 467, 704, 705, - 602, 663, 529, 1039, 41, 427, 280, 528, 528, 601, - 978, 657, 153, 714, 151, 203, 636, 123, 138, 334, - 1039, 108, 590, 529, 532, 978, 490, 1037, 858, 858, - 427, 295, 559, 974, 528, 859, 910, 529, 529, 9, - 360, 758, 777, 528, 397, 528, 529, 532, 559, 877, - 878, 342, 778, 532, 529, 528, 560, 60, 529, 201, - 529, 800, 527, 822, 943, 532, 529, 559, 527, 194, - 529, 858, 858, 858, 19, 19, 527, 529, 529, 559, - 881, 876, 561, 876, 926, 529, 532, 472, 929, 529, - 532, 92, 579, 253, 280, 688, 579, 858, 529, 954, - 954, 353, 656, 528, 645, 623, 529, 193, 528, 858, - 280, 629, 656, 659, 955, 41, 154, 818, 963, 523, - 624, 955, 955, 529, 610, 125, 529, 529, 644, 714, - 558, 154, 602, 41, 529, 955, 1039, 31, 86, 95, - 119, 193, 206, 413, 416, 640, 640, 375, 375, 561, - 41, 65, 75, 244, 715, 558, 528, 559, 578, 587, - 870, 529, 529, 528, 876, 906, 528, 906, 771, 41, - 532, 858, 467, 753, 860, 936, 953, 804, 528, 804, - 947, 858, 928, 928, 315, 882, 778, 778, 714, 309, - 714, 574, 295, 528, 572, 37, 679, 253, 558, 623, - 565, 652, 655, 417, 482, 630, 631, 528, 625, 858, - 529, 252, 668, 193, 467, 552, 523, 451, 708, 561, - 978, 636, 1037, 528, 558, 529, 714, 644, 607, 714, - 75, 298, 75, 975, 858, 81, 582, 529, 532, 582, - 9, 778, 529, 770, 529, 880, 878, 377, 529, 936, - 527, 527, 527, 60, 741, 753, 753, 580, 94, 587, - 134, 858, 436, 60, 685, 659, 517, 529, 532, 609, - 529, 278, 638, 175, 314, 401, 295, 634, 635, 661, - 625, 858, 451, 41, 528, 1037, 636, 1039, 1037, 298, - 298, 528, 529, 962, 583, 962, 978, 578, 583, 529, - 753, 529, 755, 529, 905, 186, 346, 375, 883, 472, - 955, 529, 281, 464, 123, 134, 146, 215, 464, 682, - 407, 431, 679, 668, 624, 655, 529, 631, 207, 123, - 464, 295, 661, 295, 634, 714, 587, 582, 745, 815, - 745, 54, 105, 453, 858, 884, 885, 884, 884, 529, - 714, 815, 395, 281, 683, 858, 118, 528, 571, 680, - 395, 571, 436, 635, 64, 278, 366, 395, 627, 627, - 1037, 529, 583, 746, 746, 885, 374, 168, 330, 168, - 330, 150, 886, 886, 886, 586, 473, 584, 521, 681, - 473, 521, 586, 682, 623, 26, 118, 285, 978, 745, - 37, 105, 183, 278, 437, 815, 529, 528, 815, 746, - 885, 374, 303, 906, 529 + 379, 610, 612, 811, 94, 440, 567, 379, 558, 440, + 379, 1023, 561, 559, 528, 1028, 527, 19, 910, 910, + 911, 195, 364, 742, 532, 743, 744, 13, 14, 224, + 224, 440, 440, 559, 660, 665, 490, 711, 558, 386, + 351, 390, 427, 451, 480, 698, 154, 101, 594, 622, + 974, 975, 1038, 280, 201, 599, 558, 280, 595, 609, + 280, 528, 661, 41, 280, 41, 280, 661, 280, 528, + 692, 693, 694, 695, 696, 697, 699, 194, 559, 655, + 979, 565, 154, 174, 617, 677, 564, 530, 964, 954, + 957, 957, 964, 529, 532, 13, 993, 999, 4, 960, + 4, 960, 561, 565, 1026, 1027, 56, 103, 124, 142, + 147, 170, 173, 189, 285, 293, 315, 345, 714, 41, + 529, 860, 529, 174, 532, 529, 324, 916, 529, 861, + 861, 11, 15, 16, 20, 21, 22, 201, 224, 297, + 515, 516, 517, 519, 520, 521, 522, 523, 524, 901, + 861, 529, 813, 814, 872, 169, 174, 919, 920, 532, + 529, 41, 921, 908, 921, 921, 174, 529, 41, 805, + 528, 955, 4, 9, 559, 753, 754, 756, 757, 865, + 938, 936, 180, 244, 427, 432, 434, 460, 558, 736, + 487, 817, 529, 528, 759, 794, 794, 227, 794, 295, + 467, 810, 794, 227, 938, 794, 794, 287, 287, 528, + 794, 759, 560, 818, 819, 528, 560, 818, 532, 529, + 532, 530, 528, 827, 528, 528, 530, 826, 40, 826, + 528, 846, 847, 848, 849, 850, 851, 852, 853, 854, + 855, 856, 857, 858, 859, 529, 532, 830, 568, 573, + 702, 703, 716, 971, 1016, 1032, 908, 909, 528, 486, + 924, 925, 860, 909, 960, 19, 860, 894, 895, 896, + 897, 842, 842, 8, 15, 16, 20, 21, 22, 515, + 516, 517, 519, 520, 521, 522, 523, 524, 559, 899, + 904, 529, 908, 438, 438, 960, 960, 860, 528, 528, + 560, 941, 361, 948, 169, 527, 529, 532, 19, 532, + 537, 860, 521, 563, 908, 960, 860, 859, 859, 824, + 860, 860, 860, 860, 860, 860, 860, 860, 5, 565, + 968, 438, 46, 424, 935, 964, 860, 860, 528, 717, + 866, 922, 929, 133, 162, 280, 285, 290, 447, 458, + 860, 285, 528, 860, 440, 54, 179, 196, 201, 240, + 400, 860, 860, 860, 860, 860, 860, 860, 860, 860, + 860, 31, 39, 405, 898, 526, 530, 933, 183, 165, + 876, 374, 528, 890, 939, 174, 790, 910, 790, 528, + 561, 559, 558, 1012, 558, 1020, 860, 532, 529, 229, + 41, 467, 1019, 558, 570, 467, 528, 559, 575, 585, + 586, 588, 42, 127, 747, 532, 467, 747, 271, 719, + 374, 375, 519, 520, 766, 768, 862, 398, 229, 296, + 319, 319, 532, 523, 4, 767, 960, 767, 374, 375, + 768, 558, 953, 284, 402, 787, 528, 955, 956, 532, + 183, 467, 201, 183, 222, 782, 750, 529, 559, 561, + 559, 561, 359, 559, 359, 554, 528, 194, 550, 957, + 229, 280, 229, 467, 528, 642, 651, 652, 823, 824, + 530, 547, 548, 957, 559, 194, 957, 194, 549, 27, + 138, 395, 546, 553, 565, 633, 649, 957, 60, 60, + 561, 565, 641, 664, 60, 60, 957, 551, 957, 359, + 395, 554, 609, 611, 964, 957, 611, 964, 957, 611, + 359, 395, 554, 957, 957, 549, 957, 359, 395, 554, + 957, 957, 561, 1024, 1027, 520, 860, 930, 743, 743, + 743, 287, 287, 529, 476, 911, 742, 860, 860, 285, + 561, 986, 285, 986, 559, 340, 709, 529, 532, 293, + 174, 440, 705, 973, 597, 480, 558, 558, 1042, 558, + 558, 558, 558, 300, 672, 154, 3, 528, 528, 154, + 154, 240, 559, 639, 653, 656, 659, 669, 671, 490, + 492, 646, 153, 716, 154, 145, 590, 824, 154, 490, + 980, 154, 3, 43, 47, 50, 56, 82, 84, 90, + 102, 173, 175, 178, 179, 196, 211, 224, 225, 227, + 238, 240, 250, 274, 283, 305, 307, 328, 370, 400, + 420, 429, 450, 461, 478, 529, 700, 701, 967, 1043, + 532, 532, 41, 280, 295, 559, 3, 678, 564, 678, + 295, 678, 605, 860, 710, 860, 1025, 529, 532, 41, + 708, 561, 708, 280, 285, 345, 708, 60, 708, 824, + 529, 860, 860, 860, 919, 824, 861, 861, 861, 861, + 861, 861, 133, 280, 290, 861, 861, 861, 861, 861, + 861, 861, 861, 861, 861, 529, 532, 41, 815, 860, + 860, 920, 919, 824, 529, 529, 529, 908, 824, 955, + 529, 319, 375, 523, 528, 528, 735, 432, 434, 432, + 434, 558, 737, 737, 737, 860, 183, 770, 439, 479, + 761, 762, 810, 810, 794, 860, 528, 794, 169, 810, + 528, 560, 801, 810, 824, 529, 532, 818, 529, 1004, + 3, 912, 40, 826, 559, 821, 821, 3, 526, 526, + 960, 440, 440, 440, 440, 824, 464, 529, 527, 908, + 860, 140, 925, 926, 529, 529, 529, 860, 19, 532, + 537, 530, 529, 529, 511, 511, 529, 529, 529, 860, + 941, 942, 943, 530, 528, 860, 945, 359, 952, 954, + 860, 860, 891, 944, 529, 529, 529, 511, 861, 861, + 147, 908, 174, 133, 162, 285, 290, 447, 458, 528, + 147, 904, 860, 424, 935, 860, 922, 860, 440, 528, + 717, 860, 930, 564, 528, 528, 157, 877, 791, 792, + 817, 743, 817, 960, 859, 966, 966, 528, 254, 280, + 734, 792, 487, 1018, 41, 60, 571, 794, 581, 588, + 931, 532, 790, 517, 513, 748, 746, 297, 899, 902, + 748, 4, 960, 768, 296, 464, 765, 532, 247, 955, + 725, 60, 938, 528, 560, 60, 271, 1010, 1010, 440, + 440, 860, 280, 668, 528, 154, 528, 642, 205, 665, + 666, 623, 41, 178, 632, 662, 564, 548, 623, 27, + 138, 363, 365, 395, 543, 544, 545, 555, 556, 154, + 678, 154, 678, 633, 649, 633, 529, 532, 561, 626, + 517, 517, 530, 529, 532, 528, 528, 440, 379, 94, + 440, 567, 379, 440, 440, 440, 379, 1024, 1028, 529, + 19, 19, 527, 742, 742, 742, 911, 529, 528, 704, + 3, 414, 415, 528, 561, 715, 865, 660, 709, 599, + 558, 595, 528, 41, 41, 661, 695, 697, 973, 361, + 427, 597, 565, 601, 602, 665, 558, 558, 1042, 558, + 651, 652, 529, 532, 293, 637, 293, 295, 636, 957, + 490, 1041, 558, 528, 717, 558, 637, 41, 558, 529, + 532, 823, 824, 693, 699, 696, 699, 427, 860, 154, + 558, 617, 964, 1026, 561, 561, 285, 665, 521, 665, + 561, 521, 665, 561, 529, 529, 920, 174, 133, 290, + 528, 816, 813, 528, 529, 529, 529, 559, 754, 817, + 737, 737, 737, 737, 558, 558, 558, 60, 188, 779, + 14, 529, 810, 955, 528, 798, 799, 800, 863, 866, + 955, 169, 81, 820, 819, 529, 529, 526, 824, 529, + 532, 529, 527, 960, 960, 529, 847, 849, 850, 851, + 850, 851, 851, 529, 436, 860, 144, 860, 894, 904, + 845, 845, 529, 532, 529, 560, 860, 945, 946, 947, + 41, 528, 941, 949, 201, 529, 948, 859, 860, 37, + 37, 860, 529, 860, 174, 528, 912, 860, 529, 147, + 861, 861, 147, 147, 860, 860, 527, 19, 528, 932, + 744, 487, 860, 306, 881, 532, 770, 742, 770, 529, + 559, 732, 733, 928, 254, 528, 860, 367, 579, 559, + 271, 327, 118, 309, 528, 569, 716, 810, 529, 532, + 575, 1018, 860, 166, 234, 528, 748, 296, 558, 529, + 956, 183, 717, 718, 938, 956, 957, 559, 957, 529, + 154, 666, 550, 666, 623, 655, 532, 529, 120, 209, + 278, 280, 650, 528, 34, 60, 673, 662, 75, 81, + 94, 118, 120, 209, 280, 285, 335, 353, 457, 467, + 628, 629, 643, 178, 118, 193, 280, 637, 610, 108, + 118, 178, 280, 413, 416, 612, 637, 395, 545, 451, + 957, 549, 553, 860, 860, 565, 664, 908, 745, 957, + 957, 957, 957, 549, 957, 957, 957, 957, 957, 1028, + 930, 930, 529, 529, 529, 743, 108, 379, 530, 860, + 610, 715, 528, 528, 659, 716, 590, 980, 672, 194, + 558, 599, 600, 860, 529, 532, 529, 595, 528, 41, + 648, 644, 559, 656, 87, 607, 108, 278, 41, 561, + 591, 592, 661, 716, 695, 697, 529, 701, 13, 14, + 41, 41, 717, 718, 655, 467, 977, 678, 665, 861, + 174, 528, 912, 818, 529, 532, 529, 770, 558, 558, + 558, 558, 31, 104, 184, 373, 528, 771, 772, 773, + 774, 775, 776, 777, 860, 860, 489, 878, 860, 529, + 862, 905, 906, 201, 183, 795, 799, 529, 801, 802, + 803, 964, 826, 960, 826, 559, 826, 527, 527, 860, + 941, 532, 529, 559, 949, 950, 951, 41, 860, 862, + 952, 860, 860, 860, 912, 529, 860, 37, 37, 860, + 860, 147, 529, 520, 930, 529, 910, 529, 860, 529, + 528, 559, 882, 779, 529, 779, 561, 529, 532, 971, + 937, 473, 426, 466, 580, 559, 574, 584, 295, 577, + 486, 686, 688, 689, 690, 517, 588, 579, 904, 60, + 529, 529, 472, 473, 722, 623, 550, 529, 529, 490, + 658, 121, 197, 207, 120, 469, 860, 118, 41, 528, + 964, 957, 861, 121, 197, 120, 285, 229, 558, 658, + 89, 673, 194, 285, 611, 860, 673, 285, 519, 520, + 614, 559, 823, 678, 678, 517, 529, 529, 440, 440, + 527, 527, 742, 529, 529, 559, 529, 710, 467, 706, + 707, 602, 665, 529, 1041, 41, 427, 280, 528, 528, + 601, 980, 659, 153, 716, 151, 203, 316, 406, 645, + 646, 123, 138, 334, 1041, 108, 590, 529, 532, 980, + 490, 1039, 860, 860, 427, 295, 559, 976, 528, 861, + 912, 529, 529, 9, 360, 760, 779, 528, 397, 528, + 529, 532, 559, 879, 880, 342, 780, 532, 529, 528, + 560, 60, 529, 201, 529, 802, 527, 824, 945, 532, + 529, 559, 527, 194, 529, 860, 860, 860, 19, 19, + 527, 529, 529, 559, 883, 878, 561, 878, 928, 529, + 532, 472, 931, 529, 532, 92, 579, 253, 280, 690, + 579, 860, 529, 956, 956, 353, 658, 528, 647, 623, + 529, 193, 528, 860, 280, 629, 658, 661, 957, 41, + 154, 820, 3, 38, 43, 47, 50, 56, 60, 82, + 84, 90, 102, 173, 175, 179, 196, 211, 224, 225, + 227, 238, 240, 250, 274, 279, 283, 297, 305, 307, + 328, 370, 389, 396, 400, 420, 429, 450, 456, 461, + 478, 519, 520, 561, 611, 624, 667, 824, 902, 961, + 1043, 1049, 957, 957, 529, 610, 125, 529, 529, 644, + 716, 558, 154, 602, 41, 529, 957, 1041, 31, 86, + 95, 119, 193, 206, 413, 416, 640, 640, 60, 60, + 636, 375, 375, 561, 41, 65, 75, 244, 717, 558, + 528, 559, 578, 587, 872, 529, 529, 528, 878, 908, + 528, 908, 773, 41, 532, 860, 467, 755, 862, 938, + 955, 806, 528, 806, 949, 860, 930, 930, 315, 884, + 780, 780, 716, 309, 716, 574, 295, 528, 572, 37, + 681, 253, 558, 623, 565, 654, 657, 417, 482, 630, + 631, 528, 625, 860, 529, 252, 670, 193, 467, 552, + 3, 961, 965, 710, 561, 980, 646, 1039, 528, 558, + 529, 716, 644, 607, 528, 528, 716, 75, 298, 75, + 977, 860, 81, 582, 529, 532, 582, 9, 780, 529, + 772, 529, 882, 880, 377, 529, 938, 527, 527, 527, + 60, 743, 755, 755, 580, 94, 587, 134, 860, 436, + 60, 687, 661, 517, 529, 532, 609, 529, 278, 638, + 175, 314, 401, 295, 634, 635, 663, 625, 860, 965, + 523, 41, 636, 528, 1039, 646, 1041, 908, 908, 1039, + 298, 298, 528, 529, 964, 583, 964, 980, 578, 583, + 529, 755, 529, 757, 529, 907, 186, 346, 375, 885, + 472, 957, 529, 281, 464, 123, 134, 146, 215, 464, + 684, 407, 431, 681, 670, 624, 657, 529, 631, 207, + 123, 464, 295, 663, 295, 634, 523, 451, 716, 636, + 529, 529, 587, 582, 747, 817, 747, 54, 105, 453, + 860, 886, 887, 886, 886, 529, 716, 817, 395, 281, + 685, 860, 118, 528, 571, 682, 395, 571, 436, 635, + 64, 278, 366, 395, 627, 627, 451, 1039, 529, 583, + 748, 748, 887, 374, 168, 330, 168, 330, 150, 888, + 888, 888, 586, 473, 584, 521, 683, 473, 521, 586, + 684, 623, 26, 118, 285, 980, 747, 37, 105, 183, + 278, 437, 817, 529, 528, 817, 748, 887, 374, 303, + 908, 529 }; #define yyerrok (yyerrstatus = 0) @@ -21271,14 +21368,14 @@ YYLTYPE yylloc; switch (yyn) { case 2: -#line 523 "third_party/libpg_query/grammar/grammar.y" +#line 525 "third_party/libpg_query/grammar/grammar.y" { pg_yyget_extra(yyscanner)->parsetree = (yyvsp[(1) - (1)].list); ;} break; case 3: -#line 539 "third_party/libpg_query/grammar/grammar.y" +#line 541 "third_party/libpg_query/grammar/grammar.y" { if ((yyvsp[(1) - (3)].list) != NIL) { @@ -21293,7 +21390,7 @@ YYLTYPE yylloc; break; case 4: -#line 551 "third_party/libpg_query/grammar/grammar.y" +#line 553 "third_party/libpg_query/grammar/grammar.y" { if ((yyvsp[(1) - (1)].node) != NULL) (yyval.list) = list_make1(makeRawStmt((yyvsp[(1) - (1)].node), 0)); @@ -21303,7 +21400,7 @@ YYLTYPE yylloc; break; case 48: -#line 603 "third_party/libpg_query/grammar/grammar.y" +#line 605 "third_party/libpg_query/grammar/grammar.y" { (yyval.node) = NULL; ;} break; @@ -23395,57 +23492,87 @@ YYLTYPE yylloc; #line 9 "third_party/libpg_query/grammar/statements/create.y" { PGCreateStmt *n = makeNode(PGCreateStmt); - (yyvsp[(4) - (9)].range)->relpersistence = (yyvsp[(2) - (9)].ival); - n->relation = (yyvsp[(4) - (9)].range); - n->tableElts = (yyvsp[(6) - (9)].list); + (yyvsp[(4) - (10)].range)->relpersistence = (yyvsp[(2) - (10)].ival); + n->relation = (yyvsp[(4) - (10)].range); + n->tableElts = (yyvsp[(6) - (10)].list); n->ofTypename = NULL; n->constraints = NIL; - n->options = (yyvsp[(8) - (9)].list); - n->oncommit = (yyvsp[(9) - (9)].oncommit); + + PGListCell *lc; + foreach(lc, (yyvsp[(8) - (10)].list)) { + PGDefElem *de = (PGDefElem *) lfirst(lc); + if (strcmp(de->defname, "partitioned_by") == 0) { + n->partition_list = (PGList *)de->arg; + } else if (strcmp(de->defname, "sorted_by") == 0) { + n->sort_list = (PGList *)de->arg; + } + } + n->options = (yyvsp[(9) - (10)].list); + n->oncommit = (yyvsp[(10) - (10)].oncommit); n->onconflict = PG_ERROR_ON_CONFLICT; (yyval.node) = (PGNode *)n; ;} break; case 293: -#line 24 "third_party/libpg_query/grammar/statements/create.y" +#line 34 "third_party/libpg_query/grammar/statements/create.y" { PGCreateStmt *n = makeNode(PGCreateStmt); - (yyvsp[(7) - (12)].range)->relpersistence = (yyvsp[(2) - (12)].ival); - n->relation = (yyvsp[(7) - (12)].range); - n->tableElts = (yyvsp[(9) - (12)].list); + (yyvsp[(7) - (13)].range)->relpersistence = (yyvsp[(2) - (13)].ival); + n->relation = (yyvsp[(7) - (13)].range); + n->tableElts = (yyvsp[(9) - (13)].list); n->ofTypename = NULL; n->constraints = NIL; - n->options = (yyvsp[(11) - (12)].list); - n->oncommit = (yyvsp[(12) - (12)].oncommit); + + PGListCell *lc; + foreach(lc, (yyvsp[(11) - (13)].list)) { + PGDefElem *de = (PGDefElem *) lfirst(lc); + if (strcmp(de->defname, "partitioned_by") == 0) { + n->partition_list = (PGList *)de->arg; + } else if (strcmp(de->defname, "sorted_by") == 0) { + n->sort_list = (PGList *)de->arg; + } + } + n->options = (yyvsp[(12) - (13)].list); + n->oncommit = (yyvsp[(13) - (13)].oncommit); n->onconflict = PG_IGNORE_ON_CONFLICT; (yyval.node) = (PGNode *)n; ;} break; case 294: -#line 39 "third_party/libpg_query/grammar/statements/create.y" +#line 59 "third_party/libpg_query/grammar/statements/create.y" { PGCreateStmt *n = makeNode(PGCreateStmt); - (yyvsp[(6) - (11)].range)->relpersistence = (yyvsp[(4) - (11)].ival); - n->relation = (yyvsp[(6) - (11)].range); - n->tableElts = (yyvsp[(8) - (11)].list); + (yyvsp[(6) - (12)].range)->relpersistence = (yyvsp[(4) - (12)].ival); + n->relation = (yyvsp[(6) - (12)].range); + n->tableElts = (yyvsp[(8) - (12)].list); n->ofTypename = NULL; n->constraints = NIL; - n->options = (yyvsp[(10) - (11)].list); - n->oncommit = (yyvsp[(11) - (11)].oncommit); + + PGListCell *lc; + foreach(lc, (yyvsp[(10) - (12)].list)) { + PGDefElem *de = (PGDefElem *) lfirst(lc); + if (strcmp(de->defname, "partitioned_by") == 0) { + n->partition_list = (PGList *)de->arg; + } else if (strcmp(de->defname, "sorted_by") == 0) { + n->sort_list = (PGList *)de->arg; + } + } + n->options = (yyvsp[(11) - (12)].list); + n->oncommit = (yyvsp[(12) - (12)].oncommit); n->onconflict = PG_REPLACE_ON_CONFLICT; (yyval.node) = (PGNode *)n; ;} break; case 295: -#line 56 "third_party/libpg_query/grammar/statements/create.y" +#line 86 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = 0; ;} break; case 296: -#line 58 "third_party/libpg_query/grammar/statements/create.y" +#line 88 "third_party/libpg_query/grammar/statements/create.y" { /* * We must complain about conflicting options. @@ -23472,77 +23599,77 @@ YYLTYPE yylloc; break; case 297: -#line 84 "third_party/libpg_query/grammar/statements/create.y" +#line 114 "third_party/libpg_query/grammar/statements/create.y" { (yyval.node) = (PGNode *)(yyvsp[(1) - (1)].typnam); ;} break; case 298: -#line 85 "third_party/libpg_query/grammar/statements/create.y" +#line 115 "third_party/libpg_query/grammar/statements/create.y" { (yyval.node) = (PGNode *)makeString(pstrdup((yyvsp[(1) - (1)].keyword))); ;} break; case 299: -#line 86 "third_party/libpg_query/grammar/statements/create.y" +#line 116 "third_party/libpg_query/grammar/statements/create.y" { (yyval.node) = (PGNode *)(yyvsp[(1) - (1)].list); ;} break; case 300: -#line 87 "third_party/libpg_query/grammar/statements/create.y" +#line 117 "third_party/libpg_query/grammar/statements/create.y" { (yyval.node) = (PGNode *)(yyvsp[(1) - (1)].value); ;} break; case 301: -#line 88 "third_party/libpg_query/grammar/statements/create.y" +#line 118 "third_party/libpg_query/grammar/statements/create.y" { (yyval.node) = (PGNode *)makeString((yyvsp[(1) - (1)].str)); ;} break; case 302: -#line 89 "third_party/libpg_query/grammar/statements/create.y" +#line 119 "third_party/libpg_query/grammar/statements/create.y" { (yyval.node) = (PGNode *)makeString(pstrdup((yyvsp[(1) - (1)].keyword))); ;} break; case 303: -#line 93 "third_party/libpg_query/grammar/statements/create.y" +#line 123 "third_party/libpg_query/grammar/statements/create.y" { (yyval.list) = (yyvsp[(2) - (3)].list); ;} break; case 304: -#line 94 "third_party/libpg_query/grammar/statements/create.y" +#line 124 "third_party/libpg_query/grammar/statements/create.y" { (yyval.list) = NIL; ;} break; case 305: -#line 99 "third_party/libpg_query/grammar/statements/create.y" +#line 128 "third_party/libpg_query/grammar/statements/create.y" { (yyval.node) = (PGNode *) makeString((yyvsp[(1) - (1)].str)); ;} break; case 306: -#line 104 "third_party/libpg_query/grammar/statements/create.y" +#line 133 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = PG_FKCONSTR_ACTION_NOACTION; ;} break; case 307: -#line 105 "third_party/libpg_query/grammar/statements/create.y" +#line 134 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = PG_FKCONSTR_ACTION_RESTRICT; ;} break; case 308: -#line 106 "third_party/libpg_query/grammar/statements/create.y" +#line 135 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = PG_FKCONSTR_ACTION_CASCADE; ;} break; case 309: -#line 107 "third_party/libpg_query/grammar/statements/create.y" +#line 136 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = PG_FKCONSTR_ACTION_SETNULL; ;} break; case 310: -#line 108 "third_party/libpg_query/grammar/statements/create.y" +#line 137 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = PG_FKCONSTR_ACTION_SETDEFAULT; ;} break; case 311: -#line 114 "third_party/libpg_query/grammar/statements/create.y" +#line 143 "third_party/libpg_query/grammar/statements/create.y" { PGConstraint *n = castNode(PGConstraint, (yyvsp[(3) - (3)].node)); n->conname = (yyvsp[(2) - (3)].str); @@ -23552,17 +23679,17 @@ YYLTYPE yylloc; break; case 312: -#line 120 "third_party/libpg_query/grammar/statements/create.y" +#line 149 "third_party/libpg_query/grammar/statements/create.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; case 313: -#line 121 "third_party/libpg_query/grammar/statements/create.y" +#line 150 "third_party/libpg_query/grammar/statements/create.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; case 314: -#line 123 "third_party/libpg_query/grammar/statements/create.y" +#line 152 "third_party/libpg_query/grammar/statements/create.y" { /* * Note: the PGCollateClause is momentarily included in @@ -23578,7 +23705,7 @@ YYLTYPE yylloc; break; case 315: -#line 140 "third_party/libpg_query/grammar/statements/create.y" +#line 169 "third_party/libpg_query/grammar/statements/create.y" { PGConstraint *n = makeNode(PGConstraint); n->contype = PG_CONSTR_NOTNULL; @@ -23588,7 +23715,7 @@ YYLTYPE yylloc; break; case 316: -#line 147 "third_party/libpg_query/grammar/statements/create.y" +#line 176 "third_party/libpg_query/grammar/statements/create.y" { PGConstraint *n = makeNode(PGConstraint); n->contype = PG_CONSTR_NULL; @@ -23598,7 +23725,7 @@ YYLTYPE yylloc; break; case 317: -#line 154 "third_party/libpg_query/grammar/statements/create.y" +#line 183 "third_party/libpg_query/grammar/statements/create.y" { PGConstraint *n = makeNode(PGConstraint); n->contype = PG_CONSTR_UNIQUE; @@ -23611,7 +23738,7 @@ YYLTYPE yylloc; break; case 318: -#line 164 "third_party/libpg_query/grammar/statements/create.y" +#line 193 "third_party/libpg_query/grammar/statements/create.y" { PGConstraint *n = makeNode(PGConstraint); n->contype = PG_CONSTR_PRIMARY; @@ -23624,7 +23751,7 @@ YYLTYPE yylloc; break; case 319: -#line 174 "third_party/libpg_query/grammar/statements/create.y" +#line 203 "third_party/libpg_query/grammar/statements/create.y" { PGConstraint *n = makeNode(PGConstraint); n->contype = PG_CONSTR_CHECK; @@ -23639,7 +23766,7 @@ YYLTYPE yylloc; break; case 320: -#line 186 "third_party/libpg_query/grammar/statements/create.y" +#line 215 "third_party/libpg_query/grammar/statements/create.y" { PGConstraint *n = makeNode(PGConstraint); n->contype = PG_CONSTR_COMPRESSION; @@ -23650,7 +23777,7 @@ YYLTYPE yylloc; break; case 321: -#line 194 "third_party/libpg_query/grammar/statements/create.y" +#line 223 "third_party/libpg_query/grammar/statements/create.y" { PGConstraint *n = makeNode(PGConstraint); n->contype = PG_CONSTR_DEFAULT; @@ -23662,7 +23789,7 @@ YYLTYPE yylloc; break; case 322: -#line 203 "third_party/libpg_query/grammar/statements/create.y" +#line 232 "third_party/libpg_query/grammar/statements/create.y" { PGConstraint *n = makeNode(PGConstraint); n->contype = PG_CONSTR_FOREIGN; @@ -23680,27 +23807,27 @@ YYLTYPE yylloc; break; case 323: -#line 220 "third_party/libpg_query/grammar/statements/create.y" +#line 249 "third_party/libpg_query/grammar/statements/create.y" { (yyval.constr) = PG_CONSTR_GENERATED_VIRTUAL; ;} break; case 324: -#line 221 "third_party/libpg_query/grammar/statements/create.y" +#line 250 "third_party/libpg_query/grammar/statements/create.y" { (yyval.constr) = PG_CONSTR_GENERATED_STORED; ;} break; case 325: -#line 225 "third_party/libpg_query/grammar/statements/create.y" +#line 254 "third_party/libpg_query/grammar/statements/create.y" { (yyval.constr) = (yyvsp[(1) - (1)].constr); ;} break; case 326: -#line 226 "third_party/libpg_query/grammar/statements/create.y" +#line 255 "third_party/libpg_query/grammar/statements/create.y" { (yyval.constr) = PG_CONSTR_GENERATED_VIRTUAL; ;} break; case 327: -#line 231 "third_party/libpg_query/grammar/statements/create.y" +#line 260 "third_party/libpg_query/grammar/statements/create.y" { PGConstraint *n = makeNode(PGConstraint); n->contype = PG_CONSTR_IDENTITY; @@ -23712,7 +23839,7 @@ YYLTYPE yylloc; break; case 328: -#line 240 "third_party/libpg_query/grammar/statements/create.y" +#line 269 "third_party/libpg_query/grammar/statements/create.y" { PGConstraint *n = makeNode(PGConstraint); n->contype = (yyvsp[(7) - (7)].constr); @@ -23738,7 +23865,7 @@ YYLTYPE yylloc; break; case 329: -#line 263 "third_party/libpg_query/grammar/statements/create.y" +#line 292 "third_party/libpg_query/grammar/statements/create.y" { PGConstraint *n = makeNode(PGConstraint); n->contype = (yyvsp[(5) - (5)].constr); @@ -23751,79 +23878,79 @@ YYLTYPE yylloc; break; case 330: -#line 277 "third_party/libpg_query/grammar/statements/create.y" +#line 306 "third_party/libpg_query/grammar/statements/create.y" { (yyval.defelt) = makeDefElem((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} break; case 331: -#line 283 "third_party/libpg_query/grammar/statements/create.y" +#line 312 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = (yyvsp[(3) - (3)].ival); ;} break; case 332: -#line 289 "third_party/libpg_query/grammar/statements/create.y" +#line 318 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = ((yyvsp[(1) - (1)].ival) << 8) | (PG_FKCONSTR_ACTION_NOACTION & 0xFF); ;} break; case 333: -#line 291 "third_party/libpg_query/grammar/statements/create.y" +#line 320 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = (PG_FKCONSTR_ACTION_NOACTION << 8) | ((yyvsp[(1) - (1)].ival) & 0xFF); ;} break; case 334: -#line 293 "third_party/libpg_query/grammar/statements/create.y" +#line 322 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = ((yyvsp[(1) - (2)].ival) << 8) | ((yyvsp[(2) - (2)].ival) & 0xFF); ;} break; case 335: -#line 295 "third_party/libpg_query/grammar/statements/create.y" +#line 324 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = ((yyvsp[(2) - (2)].ival) << 8) | ((yyvsp[(1) - (2)].ival) & 0xFF); ;} break; case 336: -#line 297 "third_party/libpg_query/grammar/statements/create.y" +#line 326 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = (PG_FKCONSTR_ACTION_NOACTION << 8) | (PG_FKCONSTR_ACTION_NOACTION & 0xFF); ;} break; case 337: -#line 300 "third_party/libpg_query/grammar/statements/create.y" +#line 329 "third_party/libpg_query/grammar/statements/create.y" { (yyval.oncommit) = ONCOMMIT_DROP; ;} break; case 338: -#line 301 "third_party/libpg_query/grammar/statements/create.y" +#line 330 "third_party/libpg_query/grammar/statements/create.y" { (yyval.oncommit) = PG_ONCOMMIT_DELETE_ROWS; ;} break; case 339: -#line 302 "third_party/libpg_query/grammar/statements/create.y" +#line 331 "third_party/libpg_query/grammar/statements/create.y" { (yyval.oncommit) = PG_ONCOMMIT_PRESERVE_ROWS; ;} break; case 340: -#line 303 "third_party/libpg_query/grammar/statements/create.y" +#line 332 "third_party/libpg_query/grammar/statements/create.y" { (yyval.oncommit) = PG_ONCOMMIT_NOOP; ;} break; case 341: -#line 308 "third_party/libpg_query/grammar/statements/create.y" +#line 337 "third_party/libpg_query/grammar/statements/create.y" { (yyval.list) = (yyvsp[(2) - (3)].list); ;} break; case 342: -#line 312 "third_party/libpg_query/grammar/statements/create.y" +#line 340 "third_party/libpg_query/grammar/statements/create.y" { (yyval.boolean) = true; ;} break; case 343: -#line 313 "third_party/libpg_query/grammar/statements/create.y" +#line 341 "third_party/libpg_query/grammar/statements/create.y" { (yyval.boolean) = false; ;} break; case 344: -#line 319 "third_party/libpg_query/grammar/statements/create.y" +#line 347 "third_party/libpg_query/grammar/statements/create.y" { PGConstraint *n = castNode(PGConstraint, (yyvsp[(3) - (3)].node)); n->conname = (yyvsp[(2) - (3)].str); @@ -23833,67 +23960,67 @@ YYLTYPE yylloc; break; case 345: -#line 325 "third_party/libpg_query/grammar/statements/create.y" +#line 353 "third_party/libpg_query/grammar/statements/create.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; case 346: -#line 330 "third_party/libpg_query/grammar/statements/create.y" +#line 358 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = PG_CREATE_TABLE_LIKE_COMMENTS; ;} break; case 347: -#line 331 "third_party/libpg_query/grammar/statements/create.y" +#line 359 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = PG_CREATE_TABLE_LIKE_CONSTRAINTS; ;} break; case 348: -#line 332 "third_party/libpg_query/grammar/statements/create.y" +#line 360 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = PG_CREATE_TABLE_LIKE_DEFAULTS; ;} break; case 349: -#line 333 "third_party/libpg_query/grammar/statements/create.y" +#line 361 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = PG_CREATE_TABLE_LIKE_IDENTITY; ;} break; case 350: -#line 334 "third_party/libpg_query/grammar/statements/create.y" +#line 362 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = PG_CREATE_TABLE_LIKE_INDEXES; ;} break; case 351: -#line 335 "third_party/libpg_query/grammar/statements/create.y" +#line 363 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = PG_CREATE_TABLE_LIKE_STATISTICS; ;} break; case 352: -#line 336 "third_party/libpg_query/grammar/statements/create.y" +#line 364 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = PG_CREATE_TABLE_LIKE_STORAGE; ;} break; case 353: -#line 337 "third_party/libpg_query/grammar/statements/create.y" +#line 365 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = PG_CREATE_TABLE_LIKE_ALL; ;} break; case 354: -#line 343 "third_party/libpg_query/grammar/statements/create.y" +#line 371 "third_party/libpg_query/grammar/statements/create.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].defelt)); ;} break; case 355: -#line 344 "third_party/libpg_query/grammar/statements/create.y" +#line 372 "third_party/libpg_query/grammar/statements/create.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].defelt)); ;} break; case 356: -#line 348 "third_party/libpg_query/grammar/statements/create.y" +#line 375 "third_party/libpg_query/grammar/statements/create.y" { (yyval.str) = (yyvsp[(3) - (3)].str); ;} break; case 357: -#line 354 "third_party/libpg_query/grammar/statements/create.y" +#line 381 "third_party/libpg_query/grammar/statements/create.y" { PGConstraint *n = makeNode(PGConstraint); n->contype = PG_CONSTR_ATTR_DEFERRABLE; @@ -23903,7 +24030,7 @@ YYLTYPE yylloc; break; case 358: -#line 361 "third_party/libpg_query/grammar/statements/create.y" +#line 388 "third_party/libpg_query/grammar/statements/create.y" { PGConstraint *n = makeNode(PGConstraint); n->contype = PG_CONSTR_ATTR_NOT_DEFERRABLE; @@ -23913,7 +24040,7 @@ YYLTYPE yylloc; break; case 359: -#line 368 "third_party/libpg_query/grammar/statements/create.y" +#line 395 "third_party/libpg_query/grammar/statements/create.y" { PGConstraint *n = makeNode(PGConstraint); n->contype = PG_CONSTR_ATTR_DEFERRED; @@ -23923,7 +24050,7 @@ YYLTYPE yylloc; break; case 360: -#line 375 "third_party/libpg_query/grammar/statements/create.y" +#line 402 "third_party/libpg_query/grammar/statements/create.y" { PGConstraint *n = makeNode(PGConstraint); n->contype = PG_CONSTR_ATTR_IMMEDIATE; @@ -23933,82 +24060,106 @@ YYLTYPE yylloc; break; case 361: -#line 386 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.list) = (yyvsp[(2) - (2)].list); ;} +#line 412 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].defelt)); ;} break; case 362: -#line 387 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.list) = list_make1(makeDefElem("oids", (PGNode *) makeInteger(true), (yylsp[(1) - (2)]))); ;} +#line 413 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = NIL; ;} break; case 363: -#line 388 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.list) = list_make1(makeDefElem("oids", (PGNode *) makeInteger(false), (yylsp[(1) - (2)]))); ;} +#line 418 "third_party/libpg_query/grammar/statements/create.y" + { + (yyval.defelt) = makeDefElem("partitioned_by", (PGNode *)(yyvsp[(4) - (5)].list), (yylsp[(1) - (5)])); + ;} break; case 364: -#line 389 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.list) = NIL; ;} +#line 422 "third_party/libpg_query/grammar/statements/create.y" + { + (yyval.defelt) = makeDefElem("sorted_by", (PGNode *)(yyvsp[(4) - (5)].list), (yylsp[(1) - (5)])); + ;} break; case 365: -#line 393 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.list) = (yyvsp[(2) - (3)].list); ;} +#line 428 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = (yyvsp[(2) - (2)].list); ;} break; case 366: -#line 398 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = (yyvsp[(1) - (3)].ival) | (yyvsp[(3) - (3)].ival); ;} +#line 429 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = list_make1(makeDefElem("oids", (PGNode *) makeInteger(true), (yylsp[(1) - (2)]))); ;} break; case 367: -#line 399 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = (yyvsp[(1) - (3)].ival) & ~(yyvsp[(3) - (3)].ival); ;} +#line 430 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = list_make1(makeDefElem("oids", (PGNode *) makeInteger(false), (yylsp[(1) - (2)]))); ;} break; case 368: -#line 400 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = 0; ;} +#line 431 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = NIL; ;} break; case 369: -#line 405 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} +#line 434 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = (yyvsp[(2) - (3)].list); ;} break; case 370: -#line 410 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = CAS_NOT_DEFERRABLE; ;} +#line 439 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = (yyvsp[(1) - (3)].ival) | (yyvsp[(3) - (3)].ival); ;} break; case 371: -#line 411 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = CAS_DEFERRABLE; ;} +#line 440 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = (yyvsp[(1) - (3)].ival) & ~(yyvsp[(3) - (3)].ival); ;} break; case 372: -#line 412 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = CAS_INITIALLY_IMMEDIATE; ;} +#line 441 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = 0; ;} break; case 373: -#line 413 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = CAS_INITIALLY_DEFERRED; ;} +#line 446 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; case 374: -#line 414 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = CAS_NOT_VALID; ;} +#line 451 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = CAS_NOT_DEFERRABLE; ;} break; case 375: -#line 415 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = CAS_NO_INHERIT; ;} +#line 452 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = CAS_DEFERRABLE; ;} break; case 376: -#line 421 "third_party/libpg_query/grammar/statements/create.y" +#line 453 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = CAS_INITIALLY_IMMEDIATE; ;} + break; + + case 377: +#line 454 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = CAS_INITIALLY_DEFERRED; ;} + break; + + case 378: +#line 455 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = CAS_NOT_VALID; ;} + break; + + case 379: +#line 456 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = CAS_NO_INHERIT; ;} + break; + + case 380: +#line 462 "third_party/libpg_query/grammar/statements/create.y" { PGColumnDef *n = makeNode(PGColumnDef); n->category = COL_STANDARD; @@ -24027,8 +24178,8 @@ YYLTYPE yylloc; ;} break; - case 377: -#line 441 "third_party/libpg_query/grammar/statements/create.y" + case 381: +#line 482 "third_party/libpg_query/grammar/statements/create.y" { PGColumnDef *n = makeNode(PGColumnDef); n->category = COL_GENERATED; @@ -24054,8 +24205,8 @@ YYLTYPE yylloc; ;} break; - case 378: -#line 467 "third_party/libpg_query/grammar/statements/create.y" + case 382: +#line 508 "third_party/libpg_query/grammar/statements/create.y" { PGColumnDef *n = (PGColumnDef *) (yyvsp[(2) - (2)].node); n->colname = (yyvsp[(1) - (2)].str); @@ -24064,8 +24215,8 @@ YYLTYPE yylloc; ;} break; - case 379: -#line 475 "third_party/libpg_query/grammar/statements/create.y" + case 383: +#line 516 "third_party/libpg_query/grammar/statements/create.y" { PGColumnDef *n = (PGColumnDef *) (yyvsp[(2) - (2)].node); n->colname = (yyvsp[(1) - (2)].str); @@ -24074,163 +24225,170 @@ YYLTYPE yylloc; ;} break; - case 380: -#line 484 "third_party/libpg_query/grammar/statements/create.y" + case 384: +#line 525 "third_party/libpg_query/grammar/statements/create.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].defelt)); ;} break; - case 381: -#line 485 "third_party/libpg_query/grammar/statements/create.y" + case 385: +#line 526 "third_party/libpg_query/grammar/statements/create.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].defelt)); ;} break; - case 382: -#line 489 "third_party/libpg_query/grammar/statements/create.y" + case 386: +#line 530 "third_party/libpg_query/grammar/statements/create.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 383: -#line 493 "third_party/libpg_query/grammar/statements/create.y" + case 387: +#line 534 "third_party/libpg_query/grammar/statements/create.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 384: -#line 494 "third_party/libpg_query/grammar/statements/create.y" + case 388: +#line 535 "third_party/libpg_query/grammar/statements/create.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 385: -#line 495 "third_party/libpg_query/grammar/statements/create.y" + case 389: +#line 536 "third_party/libpg_query/grammar/statements/create.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 386: -#line 500 "third_party/libpg_query/grammar/statements/create.y" + case 390: +#line 541 "third_party/libpg_query/grammar/statements/create.y" { (yyval.defelt) = makeDefElem((yyvsp[(1) - (3)].str), (PGNode *) (yyvsp[(3) - (3)].node), (yylsp[(1) - (3)])); ;} break; - case 387: -#line 504 "third_party/libpg_query/grammar/statements/create.y" + case 391: +#line 545 "third_party/libpg_query/grammar/statements/create.y" { (yyval.defelt) = makeDefElem((yyvsp[(1) - (1)].str), NULL, (yylsp[(1) - (1)])); ;} break; - case 388: -#line 511 "third_party/libpg_query/grammar/statements/create.y" + case 392: +#line 552 "third_party/libpg_query/grammar/statements/create.y" { (yyval.list) = (yyvsp[(2) - (2)].list); ;} break; - case 389: -#line 512 "third_party/libpg_query/grammar/statements/create.y" + case 393: +#line 553 "third_party/libpg_query/grammar/statements/create.y" { (yyval.list) = NIL; ;} break; - case 390: -#line 517 "third_party/libpg_query/grammar/statements/create.y" + case 394: +#line 558 "third_party/libpg_query/grammar/statements/create.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 391: -#line 518 "third_party/libpg_query/grammar/statements/create.y" + case 395: +#line 559 "third_party/libpg_query/grammar/statements/create.y" { (yyval.list) = (yyvsp[(1) - (2)].list); ;} break; - case 392: -#line 519 "third_party/libpg_query/grammar/statements/create.y" + case 396: +#line 560 "third_party/libpg_query/grammar/statements/create.y" { (yyval.list) = NIL; ;} break; - case 393: -#line 524 "third_party/libpg_query/grammar/statements/create.y" + case 397: +#line 565 "third_party/libpg_query/grammar/statements/create.y" { (yyval.node) = (PGNode *) makeString((yyvsp[(1) - (1)].str)); ;} break; - case 394: -#line 531 "third_party/libpg_query/grammar/statements/create.y" + case 398: +#line 572 "third_party/libpg_query/grammar/statements/create.y" { (yyval.list) = (yyvsp[(2) - (3)].list); ;} break; - case 395: -#line 532 "third_party/libpg_query/grammar/statements/create.y" + case 399: +#line 573 "third_party/libpg_query/grammar/statements/create.y" { (yyval.list) = NIL; ;} break; - case 396: -#line 537 "third_party/libpg_query/grammar/statements/create.y" + case 400: +#line 578 "third_party/libpg_query/grammar/statements/create.y" { (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].node)); ;} break; - case 397: -#line 538 "third_party/libpg_query/grammar/statements/create.y" + case 401: +#line 579 "third_party/libpg_query/grammar/statements/create.y" { (yyval.list) = NIL; ;} break; - case 398: -#line 542 "third_party/libpg_query/grammar/statements/create.y" + case 402: +#line 583 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = (yyvsp[(3) - (3)].ival); ;} break; - case 399: -#line 548 "third_party/libpg_query/grammar/statements/create.y" + case 403: +#line 589 "third_party/libpg_query/grammar/statements/create.y" { (yyval.defelt) = makeDefElem((yyvsp[(1) - (3)].str), (PGNode *) (yyvsp[(3) - (3)].node), (yylsp[(1) - (3)])); ;} break; - case 400: -#line 552 "third_party/libpg_query/grammar/statements/create.y" + case 404: +#line 593 "third_party/libpg_query/grammar/statements/create.y" { (yyval.defelt) = makeDefElem((yyvsp[(1) - (1)].str), NULL, (yylsp[(1) - (1)])); ;} break; - case 401: -#line 556 "third_party/libpg_query/grammar/statements/create.y" + case 405: +#line 597 "third_party/libpg_query/grammar/statements/create.y" { (yyval.defelt) = makeDefElemExtended((yyvsp[(1) - (5)].str), (yyvsp[(3) - (5)].str), (PGNode *) (yyvsp[(5) - (5)].node), PG_DEFELEM_UNSPEC, (yylsp[(1) - (5)])); ;} break; - case 402: -#line 561 "third_party/libpg_query/grammar/statements/create.y" + case 406: +#line 602 "third_party/libpg_query/grammar/statements/create.y" { (yyval.defelt) = makeDefElemExtended((yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].str), NULL, PG_DEFELEM_UNSPEC, (yylsp[(1) - (3)])); ;} break; - case 403: -#line 568 "third_party/libpg_query/grammar/statements/create.y" + case 407: +#line 606 "third_party/libpg_query/grammar/statements/create.y" + { + (yyval.defelt) = makeDefElem((yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].node), (yylsp[(1) - (3)])); + ;} + break; + + case 408: +#line 612 "third_party/libpg_query/grammar/statements/create.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 404: -#line 569 "third_party/libpg_query/grammar/statements/create.y" + case 409: +#line 613 "third_party/libpg_query/grammar/statements/create.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; - case 405: -#line 573 "third_party/libpg_query/grammar/statements/create.y" + case 410: +#line 617 "third_party/libpg_query/grammar/statements/create.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 406: -#line 574 "third_party/libpg_query/grammar/statements/create.y" + case 411: +#line 618 "third_party/libpg_query/grammar/statements/create.y" { (yyval.list) = (yyvsp[(1) - (2)].list); ;} break; - case 407: -#line 578 "third_party/libpg_query/grammar/statements/create.y" + case 412: +#line 622 "third_party/libpg_query/grammar/statements/create.y" { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 408: -#line 580 "third_party/libpg_query/grammar/statements/create.y" + case 413: +#line 624 "third_party/libpg_query/grammar/statements/create.y" { (yyval.typnam) = makeTypeNameFromNameList(lcons(makeString((yyvsp[(1) - (4)].str)), (yyvsp[(2) - (4)].list))); (yyval.typnam)->pct_type = true; @@ -24238,8 +24396,8 @@ YYLTYPE yylloc; ;} break; - case 409: -#line 586 "third_party/libpg_query/grammar/statements/create.y" + case 414: +#line 630 "third_party/libpg_query/grammar/statements/create.y" { (yyval.typnam) = makeTypeNameFromNameList(lcons(makeString((yyvsp[(2) - (5)].str)), (yyvsp[(3) - (5)].list))); (yyval.typnam)->pct_type = true; @@ -24248,8 +24406,8 @@ YYLTYPE yylloc; ;} break; - case 410: -#line 597 "third_party/libpg_query/grammar/statements/create.y" + case 415: +#line 641 "third_party/libpg_query/grammar/statements/create.y" { PGConstraint *n = makeNode(PGConstraint); n->contype = PG_CONSTR_CHECK; @@ -24264,8 +24422,8 @@ YYLTYPE yylloc; ;} break; - case 411: -#line 611 "third_party/libpg_query/grammar/statements/create.y" + case 416: +#line 655 "third_party/libpg_query/grammar/statements/create.y" { PGConstraint *n = makeNode(PGConstraint); n->contype = PG_CONSTR_UNIQUE; @@ -24280,8 +24438,8 @@ YYLTYPE yylloc; ;} break; - case 412: -#line 624 "third_party/libpg_query/grammar/statements/create.y" + case 417: +#line 668 "third_party/libpg_query/grammar/statements/create.y" { PGConstraint *n = makeNode(PGConstraint); n->contype = PG_CONSTR_UNIQUE; @@ -24297,8 +24455,8 @@ YYLTYPE yylloc; ;} break; - case 413: -#line 639 "third_party/libpg_query/grammar/statements/create.y" + case 418: +#line 683 "third_party/libpg_query/grammar/statements/create.y" { PGConstraint *n = makeNode(PGConstraint); n->contype = PG_CONSTR_PRIMARY; @@ -24313,8 +24471,8 @@ YYLTYPE yylloc; ;} break; - case 414: -#line 652 "third_party/libpg_query/grammar/statements/create.y" + case 419: +#line 696 "third_party/libpg_query/grammar/statements/create.y" { PGConstraint *n = makeNode(PGConstraint); n->contype = PG_CONSTR_PRIMARY; @@ -24330,8 +24488,8 @@ YYLTYPE yylloc; ;} break; - case 415: -#line 667 "third_party/libpg_query/grammar/statements/create.y" + case 420: +#line 711 "third_party/libpg_query/grammar/statements/create.y" { PGConstraint *n = makeNode(PGConstraint); n->contype = PG_CONSTR_FOREIGN; @@ -24351,29 +24509,29 @@ YYLTYPE yylloc; ;} break; - case 416: -#line 689 "third_party/libpg_query/grammar/statements/create.y" + case 421: +#line 733 "third_party/libpg_query/grammar/statements/create.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 417: -#line 693 "third_party/libpg_query/grammar/statements/create.y" + case 422: +#line 737 "third_party/libpg_query/grammar/statements/create.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; - case 418: -#line 700 "third_party/libpg_query/grammar/statements/create.y" + case 423: +#line 744 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = PG_FKCONSTR_MATCH_FULL; ;} break; - case 419: -#line 704 "third_party/libpg_query/grammar/statements/create.y" + case 424: +#line 748 "third_party/libpg_query/grammar/statements/create.y" { ereport(ERROR, (errcode(PG_ERRCODE_FEATURE_NOT_SUPPORTED), @@ -24383,22 +24541,22 @@ YYLTYPE yylloc; ;} break; - case 420: -#line 712 "third_party/libpg_query/grammar/statements/create.y" + case 425: +#line 756 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = PG_FKCONSTR_MATCH_SIMPLE; ;} break; - case 421: -#line 716 "third_party/libpg_query/grammar/statements/create.y" + case 426: +#line 760 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = PG_FKCONSTR_MATCH_SIMPLE; ;} break; - case 422: -#line 724 "third_party/libpg_query/grammar/statements/create.y" + case 427: +#line 768 "third_party/libpg_query/grammar/statements/create.y" { PGTableLikeClause *n = makeNode(PGTableLikeClause); n->relation = (yyvsp[(2) - (3)].range); @@ -24407,28 +24565,28 @@ YYLTYPE yylloc; ;} break; - case 423: -#line 733 "third_party/libpg_query/grammar/statements/create.y" + case 428: +#line 777 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = PG_RELPERSISTENCE_TEMP; ;} break; - case 424: -#line 734 "third_party/libpg_query/grammar/statements/create.y" + case 429: +#line 778 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = PG_RELPERSISTENCE_TEMP; ;} break; - case 425: -#line 735 "third_party/libpg_query/grammar/statements/create.y" + case 430: +#line 779 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = PG_RELPERSISTENCE_TEMP; ;} break; - case 426: -#line 736 "third_party/libpg_query/grammar/statements/create.y" + case 431: +#line 780 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = PG_RELPERSISTENCE_TEMP; ;} break; - case 427: -#line 738 "third_party/libpg_query/grammar/statements/create.y" + case 432: +#line 782 "third_party/libpg_query/grammar/statements/create.y" { ereport(PGWARNING, (errmsg("GLOBAL is deprecated in temporary table creation"), @@ -24437,8 +24595,8 @@ YYLTYPE yylloc; ;} break; - case 428: -#line 745 "third_party/libpg_query/grammar/statements/create.y" + case 433: +#line 789 "third_party/libpg_query/grammar/statements/create.y" { ereport(PGWARNING, (errmsg("GLOBAL is deprecated in temporary table creation"), @@ -24447,27 +24605,27 @@ YYLTYPE yylloc; ;} break; - case 429: -#line 751 "third_party/libpg_query/grammar/statements/create.y" + case 434: +#line 795 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = PG_RELPERSISTENCE_UNLOGGED; ;} break; - case 430: -#line 752 "third_party/libpg_query/grammar/statements/create.y" + case 435: +#line 796 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = RELPERSISTENCE_PERMANENT; ;} break; - case 431: -#line 757 "third_party/libpg_query/grammar/statements/create.y" + case 436: +#line 800 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = PG_ATTRIBUTE_IDENTITY_ALWAYS; ;} break; - case 432: -#line 758 "third_party/libpg_query/grammar/statements/create.y" + case 437: +#line 801 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = ATTRIBUTE_IDENTITY_BY_DEFAULT; ;} break; - case 433: + case 438: #line 10 "third_party/libpg_query/grammar/statements/drop.y" { PGDropStmt *n = makeNode(PGDropStmt); @@ -24480,7 +24638,7 @@ YYLTYPE yylloc; ;} break; - case 434: + case 439: #line 20 "third_party/libpg_query/grammar/statements/drop.y" { PGDropStmt *n = makeNode(PGDropStmt); @@ -24493,7 +24651,7 @@ YYLTYPE yylloc; ;} break; - case 435: + case 440: #line 30 "third_party/libpg_query/grammar/statements/drop.y" { PGDropStmt *n = makeNode(PGDropStmt); @@ -24506,7 +24664,7 @@ YYLTYPE yylloc; ;} break; - case 436: + case 441: #line 40 "third_party/libpg_query/grammar/statements/drop.y" { PGDropStmt *n = makeNode(PGDropStmt); @@ -24519,7 +24677,7 @@ YYLTYPE yylloc; ;} break; - case 437: + case 442: #line 50 "third_party/libpg_query/grammar/statements/drop.y" { PGDropStmt *n = makeNode(PGDropStmt); @@ -24532,7 +24690,7 @@ YYLTYPE yylloc; ;} break; - case 438: + case 443: #line 60 "third_party/libpg_query/grammar/statements/drop.y" { PGDropStmt *n = makeNode(PGDropStmt); @@ -24545,167 +24703,167 @@ YYLTYPE yylloc; ;} break; - case 439: + case 444: #line 73 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_TABLE; ;} break; - case 440: + case 445: #line 74 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_SEQUENCE; ;} break; - case 441: + case 446: #line 75 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_FUNCTION; ;} break; - case 442: + case 447: #line 76 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_FUNCTION; ;} break; - case 443: + case 448: #line 77 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_TABLE_MACRO; ;} break; - case 444: + case 449: #line 78 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_VIEW; ;} break; - case 445: + case 450: #line 79 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_MATVIEW; ;} break; - case 446: + case 451: #line 80 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_INDEX; ;} break; - case 447: + case 452: #line 81 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_FOREIGN_TABLE; ;} break; - case 448: + case 453: #line 82 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_COLLATION; ;} break; - case 449: + case 454: #line 83 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_CONVERSION; ;} break; - case 450: + case 455: #line 84 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_SCHEMA; ;} break; - case 451: + case 456: #line 85 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_STATISTIC_EXT; ;} break; - case 452: + case 457: #line 86 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_TSPARSER; ;} break; - case 453: + case 458: #line 87 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_TSDICTIONARY; ;} break; - case 454: + case 459: #line 88 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_TSTEMPLATE; ;} break; - case 455: + case 460: #line 89 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_TSCONFIGURATION; ;} break; - case 456: + case 461: #line 90 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_TYPE; ;} break; - case 457: + case 462: #line 95 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_ACCESS_METHOD; ;} break; - case 458: + case 463: #line 96 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_EVENT_TRIGGER; ;} break; - case 459: + case 464: #line 97 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_EXTENSION; ;} break; - case 460: + case 465: #line 98 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_FDW; ;} break; - case 461: + case 466: #line 99 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_PUBLICATION; ;} break; - case 462: + case 467: #line 100 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_FOREIGN_SERVER; ;} break; - case 463: + case 468: #line 105 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].list)); ;} break; - case 464: + case 469: #line 106 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].list)); ;} break; - case 465: + case 470: #line 111 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.dbehavior) = PG_DROP_CASCADE; ;} break; - case 466: + case 471: #line 112 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.dbehavior) = PG_DROP_RESTRICT; ;} break; - case 467: + case 472: #line 113 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.dbehavior) = PG_DROP_RESTRICT; /* default */ ;} break; - case 468: + case 473: #line 118 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_POLICY; ;} break; - case 469: + case 474: #line 119 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_RULE; ;} break; - case 470: + case 475: #line 120 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_TRIGGER; ;} break; - case 471: + case 476: #line 13 "third_party/libpg_query/grammar/statements/merge_into.y" { PGMergeIntoStmt *n = makeNode(PGMergeIntoStmt); @@ -24722,27 +24880,27 @@ YYLTYPE yylloc; ;} break; - case 472: + case 477: #line 29 "third_party/libpg_query/grammar/statements/merge_into.y" { (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; - case 473: + case 478: #line 30 "third_party/libpg_query/grammar/statements/merge_into.y" { (yyval.node) = NULL; ;} break; - case 474: + case 479: #line 34 "third_party/libpg_query/grammar/statements/merge_into.y" { (yyval.list) = (yyvsp[(2) - (3)].list); ;} break; - case 475: + case 480: #line 35 "third_party/libpg_query/grammar/statements/merge_into.y" { (yyval.list) = NULL; ;} break; - case 478: + case 483: #line 44 "third_party/libpg_query/grammar/statements/merge_into.y" { PGMatchAction *n = makeNode(PGMatchAction); @@ -24753,7 +24911,7 @@ YYLTYPE yylloc; ;} break; - case 479: + case 484: #line 52 "third_party/libpg_query/grammar/statements/merge_into.y" { PGMatchAction *n = makeNode(PGMatchAction); @@ -24763,7 +24921,7 @@ YYLTYPE yylloc; ;} break; - case 480: + case 485: #line 59 "third_party/libpg_query/grammar/statements/merge_into.y" { PGMatchAction *n = makeNode(PGMatchAction); @@ -24773,7 +24931,7 @@ YYLTYPE yylloc; ;} break; - case 481: + case 486: #line 66 "third_party/libpg_query/grammar/statements/merge_into.y" { PGMatchAction *n = makeNode(PGMatchAction); @@ -24782,7 +24940,7 @@ YYLTYPE yylloc; ;} break; - case 482: + case 487: #line 72 "third_party/libpg_query/grammar/statements/merge_into.y" { PGMatchAction *n = makeNode(PGMatchAction); @@ -24794,7 +24952,7 @@ YYLTYPE yylloc; ;} break; - case 483: + case 488: #line 81 "third_party/libpg_query/grammar/statements/merge_into.y" { PGMatchAction *n = makeNode(PGMatchAction); @@ -24804,7 +24962,7 @@ YYLTYPE yylloc; ;} break; - case 484: + case 489: #line 88 "third_party/libpg_query/grammar/statements/merge_into.y" { PGMatchAction *n = makeNode(PGMatchAction); @@ -24815,7 +24973,7 @@ YYLTYPE yylloc; ;} break; - case 485: + case 490: #line 96 "third_party/libpg_query/grammar/statements/merge_into.y" { PGMatchAction *n = makeNode(PGMatchAction); @@ -24824,7 +24982,7 @@ YYLTYPE yylloc; ;} break; - case 486: + case 491: #line 102 "third_party/libpg_query/grammar/statements/merge_into.y" { PGMatchAction *n = makeNode(PGMatchAction); @@ -24834,17 +24992,17 @@ YYLTYPE yylloc; ;} break; - case 487: + case 492: #line 111 "third_party/libpg_query/grammar/statements/merge_into.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 488: + case 493: #line 112 "third_party/libpg_query/grammar/statements/merge_into.y" { (yyval.node) = NULL; ;} break; - case 489: + case 494: #line 117 "third_party/libpg_query/grammar/statements/merge_into.y" { PGMatchAction *n = (PGMatchAction *) (yyvsp[(5) - (5)].node); @@ -24854,22 +25012,22 @@ YYLTYPE yylloc; ;} break; - case 490: + case 495: #line 126 "third_party/libpg_query/grammar/statements/merge_into.y" { (yyval.mergeaction) = MERGE_ACTION_WHEN_NOT_MATCHED_BY_SOURCE; ;} break; - case 491: + case 496: #line 127 "third_party/libpg_query/grammar/statements/merge_into.y" { (yyval.mergeaction) = MERGE_ACTION_WHEN_NOT_MATCHED_BY_TARGET; ;} break; - case 492: + case 497: #line 128 "third_party/libpg_query/grammar/statements/merge_into.y" { (yyval.mergeaction) = MERGE_ACTION_WHEN_NOT_MATCHED_BY_TARGET; ;} break; - case 493: + case 498: #line 133 "third_party/libpg_query/grammar/statements/merge_into.y" { PGMatchAction *n = (PGMatchAction *) (yyvsp[(7) - (7)].node); @@ -24879,17 +25037,17 @@ YYLTYPE yylloc; ;} break; - case 496: + case 501: #line 146 "third_party/libpg_query/grammar/statements/merge_into.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 497: + case 502: #line 147 "third_party/libpg_query/grammar/statements/merge_into.y" { (yyval.list) = list_concat(list_make1((yyvsp[(1) - (2)].node)), (yyvsp[(2) - (2)].list)); ;} break; - case 498: + case 503: #line 8 "third_party/libpg_query/grammar/statements/create_function.y" { PGCreateFunctionStmt *n = makeNode(PGCreateFunctionStmt); @@ -24901,7 +25059,7 @@ YYLTYPE yylloc; ;} break; - case 499: + case 504: #line 17 "third_party/libpg_query/grammar/statements/create_function.y" { PGCreateFunctionStmt *n = makeNode(PGCreateFunctionStmt); @@ -24913,7 +25071,7 @@ YYLTYPE yylloc; ;} break; - case 500: + case 505: #line 26 "third_party/libpg_query/grammar/statements/create_function.y" { PGCreateFunctionStmt *n = makeNode(PGCreateFunctionStmt); @@ -24925,7 +25083,7 @@ YYLTYPE yylloc; ;} break; - case 501: + case 506: #line 35 "third_party/libpg_query/grammar/statements/create_function.y" { PGCreateFunctionStmt *n = makeNode(PGCreateFunctionStmt); @@ -24937,7 +25095,7 @@ YYLTYPE yylloc; ;} break; - case 502: + case 507: #line 44 "third_party/libpg_query/grammar/statements/create_function.y" { PGCreateFunctionStmt *n = makeNode(PGCreateFunctionStmt); @@ -24949,7 +25107,7 @@ YYLTYPE yylloc; ;} break; - case 503: + case 508: #line 53 "third_party/libpg_query/grammar/statements/create_function.y" { PGCreateFunctionStmt *n = makeNode(PGCreateFunctionStmt); @@ -24961,7 +25119,7 @@ YYLTYPE yylloc; ;} break; - case 504: + case 509: #line 65 "third_party/libpg_query/grammar/statements/create_function.y" { PGFunctionDefinition *n = makeNode(PGFunctionDefinition); @@ -24971,7 +25129,7 @@ YYLTYPE yylloc; ;} break; - case 505: + case 510: #line 75 "third_party/libpg_query/grammar/statements/create_function.y" { PGFunctionDefinition *n = makeNode(PGFunctionDefinition); @@ -24981,28 +25139,28 @@ YYLTYPE yylloc; ;} break; - case 506: + case 511: #line 85 "third_party/libpg_query/grammar/statements/create_function.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 507: + case 512: #line 89 "third_party/libpg_query/grammar/statements/create_function.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; - case 508: + case 513: #line 96 "third_party/libpg_query/grammar/statements/create_function.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 510: + case 515: #line 104 "third_party/libpg_query/grammar/statements/create_function.y" { PGFunctionDefinition *n = makeNode(PGFunctionDefinition); @@ -25012,56 +25170,56 @@ YYLTYPE yylloc; ;} break; - case 511: + case 516: #line 114 "third_party/libpg_query/grammar/statements/create_function.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 512: + case 517: #line 118 "third_party/libpg_query/grammar/statements/create_function.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; - case 515: + case 520: #line 131 "third_party/libpg_query/grammar/statements/create_function.y" { (yyval.list) = NIL; ;} break; - case 516: + case 521: #line 135 "third_party/libpg_query/grammar/statements/create_function.y" { (yyval.list) = (yyvsp[(2) - (4)].list); ;} break; - case 517: + case 522: #line 139 "third_party/libpg_query/grammar/statements/create_function.y" { (yyval.list) = (yyvsp[(2) - (3)].list); ;} break; - case 518: + case 523: #line 146 "third_party/libpg_query/grammar/statements/create_function.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 519: + case 524: #line 150 "third_party/libpg_query/grammar/statements/create_function.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; - case 520: + case 525: #line 157 "third_party/libpg_query/grammar/statements/create_function.y" { PGFunctionParameter *n = makeNode(PGFunctionParameter); @@ -25072,7 +25230,7 @@ YYLTYPE yylloc; ;} break; - case 521: + case 526: #line 165 "third_party/libpg_query/grammar/statements/create_function.y" { PGFunctionParameter *n = makeNode(PGFunctionParameter); @@ -25083,7 +25241,7 @@ YYLTYPE yylloc; ;} break; - case 522: + case 527: #line 173 "third_party/libpg_query/grammar/statements/create_function.y" { PGFunctionParameter *n = makeNode(PGFunctionParameter); @@ -25094,7 +25252,7 @@ YYLTYPE yylloc; ;} break; - case 523: + case 528: #line 12 "third_party/libpg_query/grammar/statements/update.y" { PGUpdateStmt *n = makeNode(PGUpdateStmt); @@ -25108,7 +25266,7 @@ YYLTYPE yylloc; ;} break; - case 524: + case 529: #line 3 "third_party/libpg_query/grammar/statements/copy.y" { PGCopyStmt *n = makeNode(PGCopyStmt); @@ -25139,7 +25297,7 @@ YYLTYPE yylloc; ;} break; - case 525: + case 530: #line 31 "third_party/libpg_query/grammar/statements/copy.y" { PGCopyStmt *n = makeNode(PGCopyStmt); @@ -25161,7 +25319,7 @@ YYLTYPE yylloc; ;} break; - case 526: + case 531: #line 50 "third_party/libpg_query/grammar/statements/copy.y" { PGCopyDatabaseStmt *n = makeNode(PGCopyDatabaseStmt); @@ -25172,287 +25330,287 @@ YYLTYPE yylloc; ;} break; - case 527: + case 532: #line 61 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.conststr) = NULL; ;} break; - case 528: + case 533: #line 62 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.conststr) = "schema"; ;} break; - case 529: + case 534: #line 63 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.conststr) = "data"; ;} break; - case 530: + case 535: #line 67 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.boolean) = true; ;} break; - case 531: + case 536: #line 68 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.boolean) = false; ;} break; - case 532: + case 537: #line 74 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("delimiter", (PGNode *)makeString((yyvsp[(3) - (3)].str)), (yylsp[(2) - (3)])); ;} break; - case 533: + case 538: #line 77 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = NULL; ;} break; - case 534: + case 539: #line 94 "third_party/libpg_query/grammar/statements/copy.y" {;} break; - case 535: + case 540: #line 95 "third_party/libpg_query/grammar/statements/copy.y" {;} break; - case 536: + case 541: #line 99 "third_party/libpg_query/grammar/statements/copy.y" {;} break; - case 537: + case 542: #line 100 "third_party/libpg_query/grammar/statements/copy.y" {;} break; - case 538: + case 543: #line 105 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.boolean) = true; ;} break; - case 539: + case 544: #line 106 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.boolean) = false; ;} break; - case 540: + case 545: #line 110 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 541: + case 546: #line 111 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.list) = (yyvsp[(2) - (3)].list); ;} break; - case 542: + case 547: #line 116 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("oids", NULL, (yylsp[(1) - (2)])); ;} break; - case 543: + case 548: #line 119 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = NULL; ;} break; - case 544: + case 549: #line 124 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].defelt)); ;} break; - case 545: + case 550: #line 125 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.list) = NIL; ;} break; - case 546: + case 551: #line 131 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("format", (PGNode *)makeStringConst("binary", (yylsp[(1) - (1)])), (yylsp[(1) - (1)])); ;} break; - case 547: + case 552: #line 134 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = NULL; ;} break; - case 548: + case 553: #line 140 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("format", (PGNode *)makeStringConst("binary", (yylsp[(1) - (1)])), (yylsp[(1) - (1)])); ;} break; - case 549: + case 554: #line 144 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("oids", NULL, (yylsp[(1) - (1)])); ;} break; - case 550: + case 555: #line 148 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("freeze", NULL, (yylsp[(1) - (1)])); ;} break; - case 551: + case 556: #line 152 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("delimiter", (PGNode *)makeStringConst((yyvsp[(3) - (3)].str), (yylsp[(3) - (3)])), (yylsp[(1) - (3)])); ;} break; - case 552: + case 557: #line 156 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("null", (PGNode *)makeStringConst((yyvsp[(3) - (3)].str), (yylsp[(3) - (3)])), (yylsp[(1) - (3)])); ;} break; - case 553: + case 558: #line 160 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("format", (PGNode *)makeStringConst("csv", (yylsp[(1) - (1)])), (yylsp[(1) - (1)])); ;} break; - case 554: + case 559: #line 164 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("header", NULL, (yylsp[(1) - (1)])); ;} break; - case 555: + case 560: #line 168 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("quote", (PGNode *)makeStringConst((yyvsp[(3) - (3)].str), (yylsp[(3) - (3)])), (yylsp[(1) - (3)])); ;} break; - case 556: + case 561: #line 172 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("escape", (PGNode *)makeStringConst((yyvsp[(3) - (3)].str), (yylsp[(3) - (3)])), (yylsp[(1) - (3)])); ;} break; - case 557: + case 562: #line 176 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("force_quote", (PGNode *)(yyvsp[(3) - (3)].list), (yylsp[(1) - (3)])); ;} break; - case 558: + case 563: #line 180 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("force_quote", (PGNode *)makeNode(PGAStar), (yylsp[(1) - (3)])); ;} break; - case 559: + case 564: #line 184 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("partition_by", (PGNode *)(yyvsp[(3) - (3)].list), (yylsp[(1) - (3)])); ;} break; - case 560: + case 565: #line 188 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("partition_by", (PGNode *)makeNode(PGAStar), (yylsp[(1) - (3)])); ;} break; - case 561: + case 566: #line 192 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("force_not_null", (PGNode *)(yyvsp[(4) - (4)].list), (yylsp[(1) - (4)])); ;} break; - case 562: + case 567: #line 196 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("force_null", (PGNode *)(yyvsp[(3) - (3)].list), (yylsp[(1) - (3)])); ;} break; - case 563: + case 568: #line 200 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("encoding", (PGNode *)makeStringConst((yyvsp[(2) - (2)].str), (yylsp[(2) - (2)])), (yylsp[(1) - (2)])); ;} break; - case 564: + case 569: #line 211 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.node) = makeStringConst((yyvsp[(1) - (1)].str), (yylsp[(1) - (1)])); ;} break; - case 565: + case 570: #line 212 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.node) = makeStringConst("/dev/stdin", (yylsp[(1) - (1)])); ;} break; - case 566: + case 571: #line 213 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.node) = makeStringConst("/dev/stdout", (yylsp[(1) - (1)])); ;} break; - case 567: + case 572: #line 214 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.node) = makeStringConst(psprintf("%s.%s", (yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].str)), (yylsp[(1) - (3)])); ;} break; - case 568: + case 573: #line 215 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.node) = makeStringConst((yyvsp[(1) - (1)].str), (yylsp[(1) - (1)])); ;} break; - case 569: + case 574: #line 216 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.node) = (yyvsp[(2) - (3)].node); ;} break; - case 570: + case 575: #line 217 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 573: + case 578: #line 52 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(2) - (3)].node); ;} break; - case 574: + case 579: #line 53 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(2) - (3)].node); ;} break; - case 575: + case 580: #line 55 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(2) - (3)].node); ;} break; - case 576: + case 581: #line 72 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 577: + case 582: #line 74 "third_party/libpg_query/grammar/statements/select.y" { insertSelectOptions((PGSelectStmt *) (yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].list), NIL, @@ -25462,7 +25620,7 @@ YYLTYPE yylloc; ;} break; - case 578: + case 583: #line 81 "third_party/libpg_query/grammar/statements/select.y" { insertSelectOptions((PGSelectStmt *) (yyvsp[(1) - (4)].node), (yyvsp[(2) - (4)].list), (yyvsp[(3) - (4)].list), @@ -25473,7 +25631,7 @@ YYLTYPE yylloc; ;} break; - case 579: + case 584: #line 89 "third_party/libpg_query/grammar/statements/select.y" { insertSelectOptions((PGSelectStmt *) (yyvsp[(1) - (4)].node), (yyvsp[(2) - (4)].list), (yyvsp[(4) - (4)].list), @@ -25484,7 +25642,7 @@ YYLTYPE yylloc; ;} break; - case 580: + case 585: #line 97 "third_party/libpg_query/grammar/statements/select.y" { insertSelectOptions((PGSelectStmt *) (yyvsp[(2) - (2)].node), NULL, NIL, @@ -25495,7 +25653,7 @@ YYLTYPE yylloc; ;} break; - case 581: + case 586: #line 105 "third_party/libpg_query/grammar/statements/select.y" { insertSelectOptions((PGSelectStmt *) (yyvsp[(2) - (3)].node), (yyvsp[(3) - (3)].list), NIL, @@ -25506,7 +25664,7 @@ YYLTYPE yylloc; ;} break; - case 582: + case 587: #line 113 "third_party/libpg_query/grammar/statements/select.y" { insertSelectOptions((PGSelectStmt *) (yyvsp[(2) - (5)].node), (yyvsp[(3) - (5)].list), (yyvsp[(4) - (5)].list), @@ -25517,7 +25675,7 @@ YYLTYPE yylloc; ;} break; - case 583: + case 588: #line 121 "third_party/libpg_query/grammar/statements/select.y" { insertSelectOptions((PGSelectStmt *) (yyvsp[(2) - (5)].node), (yyvsp[(3) - (5)].list), (yyvsp[(5) - (5)].list), @@ -25528,24 +25686,24 @@ YYLTYPE yylloc; ;} break; - case 584: + case 589: #line 131 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 585: + case 590: #line 132 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 586: + case 591: #line 160 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(3) - (3)].list); ;} break; - case 587: + case 592: #line 164 "third_party/libpg_query/grammar/statements/select.y" { PGAStar *star = makeNode(PGAStar); @@ -25553,7 +25711,7 @@ YYLTYPE yylloc; ;} break; - case 588: + case 593: #line 175 "third_party/libpg_query/grammar/statements/select.y" { PGSelectStmt *n = makeNode(PGSelectStmt); @@ -25570,7 +25728,7 @@ YYLTYPE yylloc; ;} break; - case 589: + case 594: #line 191 "third_party/libpg_query/grammar/statements/select.y" { PGSelectStmt *n = makeNode(PGSelectStmt); @@ -25588,7 +25746,7 @@ YYLTYPE yylloc; ;} break; - case 590: + case 595: #line 208 "third_party/libpg_query/grammar/statements/select.y" { PGSelectStmt *n = makeNode(PGSelectStmt); @@ -25606,7 +25764,7 @@ YYLTYPE yylloc; ;} break; - case 591: + case 596: #line 226 "third_party/libpg_query/grammar/statements/select.y" { PGSelectStmt *n = makeNode(PGSelectStmt); @@ -25625,12 +25783,12 @@ YYLTYPE yylloc; ;} break; - case 592: + case 597: #line 241 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 593: + case 598: #line 243 "third_party/libpg_query/grammar/statements/select.y" { /* same as SELECT * FROM relation_expr */ @@ -25652,35 +25810,35 @@ YYLTYPE yylloc; ;} break; - case 594: + case 599: #line 262 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeSetOp(PG_SETOP_UNION_BY_NAME, (yyvsp[(3) - (5)].boolean), (yyvsp[(1) - (5)].node), (yyvsp[(5) - (5)].node)); ;} break; - case 595: + case 600: #line 266 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeSetOp(PG_SETOP_UNION, (yyvsp[(3) - (4)].boolean), (yyvsp[(1) - (4)].node), (yyvsp[(4) - (4)].node)); ;} break; - case 596: + case 601: #line 270 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeSetOp(PG_SETOP_INTERSECT, (yyvsp[(3) - (4)].boolean), (yyvsp[(1) - (4)].node), (yyvsp[(4) - (4)].node)); ;} break; - case 597: + case 602: #line 274 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeSetOp(PG_SETOP_EXCEPT, (yyvsp[(3) - (4)].boolean), (yyvsp[(1) - (4)].node), (yyvsp[(4) - (4)].node)); ;} break; - case 598: + case 603: #line 278 "third_party/libpg_query/grammar/statements/select.y" { PGSelectStmt *res = makeNode(PGSelectStmt); @@ -25693,7 +25851,7 @@ YYLTYPE yylloc; ;} break; - case 599: + case 604: #line 288 "third_party/libpg_query/grammar/statements/select.y" { PGSelectStmt *res = makeNode(PGSelectStmt); @@ -25707,7 +25865,7 @@ YYLTYPE yylloc; ;} break; - case 600: + case 605: #line 299 "third_party/libpg_query/grammar/statements/select.y" { PGSelectStmt *res = makeNode(PGSelectStmt); @@ -25720,7 +25878,7 @@ YYLTYPE yylloc; ;} break; - case 601: + case 606: #line 309 "third_party/libpg_query/grammar/statements/select.y" { PGSelectStmt *res = makeNode(PGSelectStmt); @@ -25732,7 +25890,7 @@ YYLTYPE yylloc; ;} break; - case 602: + case 607: #line 318 "third_party/libpg_query/grammar/statements/select.y" { PGSelectStmt *res = makeNode(PGSelectStmt); @@ -25746,7 +25904,7 @@ YYLTYPE yylloc; ;} break; - case 603: + case 608: #line 329 "third_party/libpg_query/grammar/statements/select.y" { PGSelectStmt *res = makeNode(PGSelectStmt); @@ -25760,7 +25918,7 @@ YYLTYPE yylloc; ;} break; - case 604: + case 609: #line 340 "third_party/libpg_query/grammar/statements/select.y" { PGSelectStmt *res = makeNode(PGSelectStmt); @@ -25775,7 +25933,7 @@ YYLTYPE yylloc; ;} break; - case 605: + case 610: #line 352 "third_party/libpg_query/grammar/statements/select.y" { PGSelectStmt *res = makeNode(PGSelectStmt); @@ -25793,7 +25951,7 @@ YYLTYPE yylloc; ;} break; - case 606: + case 611: #line 367 "third_party/libpg_query/grammar/statements/select.y" { PGSelectStmt *res = makeNode(PGSelectStmt); @@ -25811,7 +25969,7 @@ YYLTYPE yylloc; ;} break; - case 613: + case 618: #line 397 "third_party/libpg_query/grammar/statements/select.y" { PGPivot *n = makeNode(PGPivot); @@ -25820,7 +25978,7 @@ YYLTYPE yylloc; ;} break; - case 614: + case 619: #line 403 "third_party/libpg_query/grammar/statements/select.y" { PGPivot *n = makeNode(PGPivot); @@ -25830,32 +25988,32 @@ YYLTYPE yylloc; ;} break; - case 615: + case 620: #line 409 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 616: + case 621: #line 413 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 617: + case 622: #line 414 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; - case 618: + case 623: #line 418 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 619: + case 624: #line 419 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (2)].list); ;} break; - case 620: + case 625: #line 434 "third_party/libpg_query/grammar/statements/select.y" { (yyval.with) = makeNode(PGWithClause); @@ -25865,7 +26023,7 @@ YYLTYPE yylloc; ;} break; - case 621: + case 626: #line 441 "third_party/libpg_query/grammar/statements/select.y" { (yyval.with) = makeNode(PGWithClause); @@ -25875,7 +26033,7 @@ YYLTYPE yylloc; ;} break; - case 622: + case 627: #line 448 "third_party/libpg_query/grammar/statements/select.y" { (yyval.with) = makeNode(PGWithClause); @@ -25885,17 +26043,17 @@ YYLTYPE yylloc; ;} break; - case 623: + case 628: #line 457 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 624: + case 629: #line 458 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; - case 625: + case 630: #line 462 "third_party/libpg_query/grammar/statements/select.y" { PGCommonTableExpr *n = makeNode(PGCommonTableExpr); @@ -25909,52 +26067,52 @@ YYLTYPE yylloc; ;} break; - case 626: + case 631: #line 475 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(4) - (5)].list); ;} break; - case 627: + case 632: #line 476 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(NIL); ;} break; - case 628: + case 633: #line 480 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 629: + case 634: #line 481 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (2)].list); ;} break; - case 630: + case 635: #line 485 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 631: + case 636: #line 486 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; - case 632: + case 637: #line 490 "third_party/libpg_query/grammar/statements/select.y" { (yyval.ctematerialize) = PGCTEMaterializeAlways; ;} break; - case 633: + case 638: #line 491 "third_party/libpg_query/grammar/statements/select.y" { (yyval.ctematerialize) = PGCTEMaterializeNever; ;} break; - case 634: + case 639: #line 492 "third_party/libpg_query/grammar/statements/select.y" { (yyval.ctematerialize) = PGCTEMaterializeDefault; ;} break; - case 635: + case 640: #line 497 "third_party/libpg_query/grammar/statements/select.y" { (yyval.into) = makeNode(PGIntoClause); @@ -25967,12 +26125,12 @@ YYLTYPE yylloc; ;} break; - case 636: + case 641: #line 507 "third_party/libpg_query/grammar/statements/select.y" { (yyval.into) = NULL; ;} break; - case 637: + case 642: #line 516 "third_party/libpg_query/grammar/statements/select.y" { (yyval.range) = (yyvsp[(3) - (3)].range); @@ -25980,7 +26138,7 @@ YYLTYPE yylloc; ;} break; - case 638: + case 643: #line 521 "third_party/libpg_query/grammar/statements/select.y" { (yyval.range) = (yyvsp[(3) - (3)].range); @@ -25988,7 +26146,7 @@ YYLTYPE yylloc; ;} break; - case 639: + case 644: #line 526 "third_party/libpg_query/grammar/statements/select.y" { (yyval.range) = (yyvsp[(4) - (4)].range); @@ -25996,7 +26154,7 @@ YYLTYPE yylloc; ;} break; - case 640: + case 645: #line 531 "third_party/libpg_query/grammar/statements/select.y" { (yyval.range) = (yyvsp[(4) - (4)].range); @@ -26004,7 +26162,7 @@ YYLTYPE yylloc; ;} break; - case 641: + case 646: #line 536 "third_party/libpg_query/grammar/statements/select.y" { ereport(PGWARNING, @@ -26015,7 +26173,7 @@ YYLTYPE yylloc; ;} break; - case 642: + case 647: #line 544 "third_party/libpg_query/grammar/statements/select.y" { ereport(PGWARNING, @@ -26026,7 +26184,7 @@ YYLTYPE yylloc; ;} break; - case 643: + case 648: #line 552 "third_party/libpg_query/grammar/statements/select.y" { (yyval.range) = (yyvsp[(3) - (3)].range); @@ -26034,7 +26192,7 @@ YYLTYPE yylloc; ;} break; - case 644: + case 649: #line 557 "third_party/libpg_query/grammar/statements/select.y" { (yyval.range) = (yyvsp[(2) - (2)].range); @@ -26042,7 +26200,7 @@ YYLTYPE yylloc; ;} break; - case 645: + case 650: #line 562 "third_party/libpg_query/grammar/statements/select.y" { (yyval.range) = (yyvsp[(1) - (1)].range); @@ -26050,87 +26208,87 @@ YYLTYPE yylloc; ;} break; - case 646: + case 651: #line 568 "third_party/libpg_query/grammar/statements/select.y" {;} break; - case 647: + case 652: #line 569 "third_party/libpg_query/grammar/statements/select.y" {;} break; - case 648: + case 653: #line 573 "third_party/libpg_query/grammar/statements/select.y" { (yyval.boolean) = true; ;} break; - case 649: + case 654: #line 574 "third_party/libpg_query/grammar/statements/select.y" { (yyval.boolean) = false; ;} break; - case 650: + case 655: #line 575 "third_party/libpg_query/grammar/statements/select.y" { (yyval.boolean) = false; ;} break; - case 651: + case 656: #line 579 "third_party/libpg_query/grammar/statements/select.y" { ;} break; - case 652: + case 657: #line 586 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(NIL); ;} break; - case 653: + case 658: #line 587 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(4) - (5)].list); ;} break; - case 654: + case 659: #line 591 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL;;} break; - case 655: + case 660: #line 592 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 656: + case 661: #line 596 "third_party/libpg_query/grammar/statements/select.y" { (yyval.ignorenulls) = PG_IGNORE_NULLS;;} break; - case 657: + case 662: #line 597 "third_party/libpg_query/grammar/statements/select.y" { (yyval.ignorenulls) = PG_RESPECT_NULLS;;} break; - case 658: + case 663: #line 598 "third_party/libpg_query/grammar/statements/select.y" { (yyval.ignorenulls) = PG_DEFAULT_NULLS; ;} break; - case 659: + case 664: #line 602 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list);;} break; - case 660: + case 665: #line 603 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 661: + case 666: #line 607 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(3) - (3)].list); ;} break; - case 662: + case 667: #line 609 "third_party/libpg_query/grammar/statements/select.y" { PGSortBy *sort = makeNode(PGSortBy); @@ -26146,17 +26304,17 @@ YYLTYPE yylloc; ;} break; - case 663: + case 668: #line 624 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].sortby)); ;} break; - case 664: + case 669: #line 625 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].sortby)); ;} break; - case 665: + case 670: #line 629 "third_party/libpg_query/grammar/statements/select.y" { (yyval.sortby) = makeNode(PGSortBy); @@ -26168,7 +26326,7 @@ YYLTYPE yylloc; ;} break; - case 666: + case 671: #line 638 "third_party/libpg_query/grammar/statements/select.y" { (yyval.sortby) = makeNode(PGSortBy); @@ -26180,72 +26338,72 @@ YYLTYPE yylloc; ;} break; - case 667: + case 672: #line 648 "third_party/libpg_query/grammar/statements/select.y" { (yyval.sortorder) = PG_SORTBY_ASC; ;} break; - case 668: + case 673: #line 649 "third_party/libpg_query/grammar/statements/select.y" { (yyval.sortorder) = PG_SORTBY_DESC; ;} break; - case 669: + case 674: #line 650 "third_party/libpg_query/grammar/statements/select.y" { (yyval.sortorder) = PG_SORTBY_DEFAULT; ;} break; - case 670: + case 675: #line 653 "third_party/libpg_query/grammar/statements/select.y" { (yyval.nullorder) = PG_SORTBY_NULLS_FIRST; ;} break; - case 671: + case 676: #line 654 "third_party/libpg_query/grammar/statements/select.y" { (yyval.nullorder) = PG_SORTBY_NULLS_LAST; ;} break; - case 672: + case 677: #line 655 "third_party/libpg_query/grammar/statements/select.y" { (yyval.nullorder) = PG_SORTBY_NULLS_DEFAULT; ;} break; - case 673: + case 678: #line 659 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make3((yyvsp[(2) - (2)].node), (yyvsp[(1) - (2)].node), NULL); ;} break; - case 674: + case 679: #line 660 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make3((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].node), (yyvsp[(1) - (2)].node)); ;} break; - case 675: + case 680: #line 661 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make3(NULL, (yyvsp[(1) - (1)].node), NULL); ;} break; - case 676: + case 681: #line 662 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make3((yyvsp[(1) - (1)].node), NULL, (yyvsp[(1) - (1)].node)); ;} break; - case 677: + case 682: #line 666 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 678: + case 683: #line 667 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make3(NULL,NULL,NULL); ;} break; - case 679: + case 684: #line 672 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; - case 680: + case 685: #line 674 "third_party/libpg_query/grammar/statements/select.y" { /* Disabled because it was too confusing, bjm 2002-02-18 */ @@ -26257,91 +26415,91 @@ YYLTYPE yylloc; ;} break; - case 681: + case 686: #line 690 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(3) - (5)].node); ;} break; - case 682: + case 687: #line 692 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeIntConst(1, -1); ;} break; - case 683: + case 688: #line 697 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; - case 684: + case 689: #line 700 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(2) - (3)].node); ;} break; - case 685: + case 690: #line 705 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeFloatConst((yyvsp[(1) - (1)].str), (yylsp[(1) - (1)])); ;} break; - case 686: + case 691: #line 709 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeIntConst((yyvsp[(1) - (1)].ival), (yylsp[(1) - (1)])); ;} break; - case 688: + case 693: #line 720 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeSampleSize((yyvsp[(1) - (2)].node), true); ;} break; - case 689: + case 694: #line 724 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeSampleSize((yyvsp[(1) - (2)].node), true); ;} break; - case 690: + case 695: #line 728 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeSampleSize((yyvsp[(1) - (1)].node), false); ;} break; - case 691: + case 696: #line 732 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeSampleSize((yyvsp[(1) - (2)].node), false); ;} break; - case 692: + case 697: #line 739 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(3) - (3)].node); ;} break; - case 693: + case 698: #line 743 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = NULL; ;} break; - case 694: + case 699: #line 750 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 695: + case 700: #line 751 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = NULL; ;} break; - case 696: + case 701: #line 756 "third_party/libpg_query/grammar/statements/select.y" { int seed = (yyvsp[(5) - (5)].ival); @@ -26349,21 +26507,21 @@ YYLTYPE yylloc; ;} break; - case 697: + case 702: #line 761 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeSampleOptions((yyvsp[(1) - (1)].node), NULL, NULL, (yylsp[(1) - (1)])); ;} break; - case 698: + case 703: #line 765 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeSampleOptions((yyvsp[(1) - (4)].node), (yyvsp[(3) - (4)].str), NULL, (yylsp[(1) - (4)])); ;} break; - case 699: + case 704: #line 769 "third_party/libpg_query/grammar/statements/select.y" { int seed = (yyvsp[(5) - (6)].ival); @@ -26371,44 +26529,44 @@ YYLTYPE yylloc; ;} break; - case 700: + case 705: #line 777 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; - case 701: + case 706: #line 783 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 702: + case 707: #line 784 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = NULL; ;} break; - case 703: + case 708: #line 789 "third_party/libpg_query/grammar/statements/select.y" { (yyval.ival) = (yyvsp[(3) - (4)].ival); ;} break; - case 704: + case 709: #line 790 "third_party/libpg_query/grammar/statements/select.y" { (yyval.ival) = -1; ;} break; - case 705: + case 710: #line 795 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (char*) "TIMESTAMP"; ;} break; - case 706: + case 711: #line 796 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (char*) "VERSION"; ;} break; - case 707: + case 712: #line 801 "third_party/libpg_query/grammar/statements/select.y" { PGAtClause *n = makeNode(PGAtClause); @@ -26418,22 +26576,22 @@ YYLTYPE yylloc; ;} break; - case 708: + case 713: #line 810 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(3) - (4)].node); ;} break; - case 709: + case 714: #line 811 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = NULL; ;} break; - case 710: + case 715: #line 816 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 711: + case 716: #line 818 "third_party/libpg_query/grammar/statements/select.y" { /* LIMIT ALL is represented as a NULL constant */ @@ -26441,77 +26599,77 @@ YYLTYPE yylloc; ;} break; - case 712: + case 717: #line 823 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeLimitPercent((yyvsp[(1) - (2)].node)); ;} break; - case 713: + case 718: #line 825 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeLimitPercent(makeFloatConst((yyvsp[(1) - (2)].str),(yylsp[(1) - (2)]))); ;} break; - case 714: + case 719: #line 827 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeLimitPercent(makeIntConst((yyvsp[(1) - (2)].ival),(yylsp[(1) - (2)]))); ;} break; - case 715: + case 720: #line 831 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 716: + case 721: #line 851 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 717: + case 722: #line 853 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "+", NULL, (yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} break; - case 718: + case 723: #line 855 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = doNegate((yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} break; - case 719: + case 724: #line 859 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeIntConst((yyvsp[(1) - (1)].ival),(yylsp[(1) - (1)])); ;} break; - case 720: + case 725: #line 860 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeFloatConst((yyvsp[(1) - (1)].str),(yylsp[(1) - (1)])); ;} break; - case 721: + case 726: #line 864 "third_party/libpg_query/grammar/statements/select.y" { (yyval.ival) = 0; ;} break; - case 722: + case 727: #line 865 "third_party/libpg_query/grammar/statements/select.y" { (yyval.ival) = 0; ;} break; - case 723: + case 728: #line 868 "third_party/libpg_query/grammar/statements/select.y" { (yyval.ival) = 0; ;} break; - case 724: + case 729: #line 869 "third_party/libpg_query/grammar/statements/select.y" { (yyval.ival) = 0; ;} break; - case 725: + case 730: #line 894 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(3) - (3)].list); ;} break; - case 726: + case 731: #line 896 "third_party/libpg_query/grammar/statements/select.y" { PGNode *node = (PGNode *) makeGroupingSet(GROUPING_SET_ALL, NIL, (yylsp[(3) - (3)])); @@ -26519,145 +26677,145 @@ YYLTYPE yylloc; ;} break; - case 727: + case 732: #line 900 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 728: + case 733: #line 904 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 729: + case 734: #line 905 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list),(yyvsp[(3) - (3)].node)); ;} break; - case 730: + case 735: #line 909 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 731: + case 736: #line 910 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (2)].list); ;} break; - case 732: + case 737: #line 914 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 733: + case 738: #line 915 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 734: + case 739: #line 916 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 735: + case 740: #line 917 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 736: + case 741: #line 918 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 737: + case 742: #line 923 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeGroupingSet(GROUPING_SET_EMPTY, NIL, (yylsp[(1) - (2)])); ;} break; - case 738: + case 743: #line 936 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeGroupingSet(GROUPING_SET_ROLLUP, (yyvsp[(3) - (4)].list), (yylsp[(1) - (4)])); ;} break; - case 739: + case 744: #line 943 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeGroupingSet(GROUPING_SET_CUBE, (yyvsp[(3) - (4)].list), (yylsp[(1) - (4)])); ;} break; - case 740: + case 745: #line 950 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeGroupingSet(GROUPING_SET_SETS, (yyvsp[(4) - (5)].list), (yylsp[(1) - (5)])); ;} break; - case 741: + case 746: #line 956 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = NULL; ;} break; - case 742: + case 747: #line 957 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = NULL; ;} break; - case 743: + case 748: #line 961 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; - case 744: + case 749: #line 962 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = NULL; ;} break; - case 745: + case 750: #line 966 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; - case 746: + case 751: #line 967 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = NULL; ;} break; - case 747: + case 752: #line 971 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 748: + case 753: #line 972 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 749: + case 754: #line 976 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 750: + case 755: #line 977 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 751: + case 756: #line 981 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 752: + case 757: #line 982 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].node)); ;} break; - case 753: + case 758: #line 987 "third_party/libpg_query/grammar/statements/select.y" { PGLockingClause *n = makeNode(PGLockingClause); @@ -26668,52 +26826,52 @@ YYLTYPE yylloc; ;} break; - case 754: + case 759: #line 997 "third_party/libpg_query/grammar/statements/select.y" { (yyval.lockstrength) = LCS_FORUPDATE; ;} break; - case 755: + case 760: #line 998 "third_party/libpg_query/grammar/statements/select.y" { (yyval.lockstrength) = PG_LCS_FORNOKEYUPDATE; ;} break; - case 756: + case 761: #line 999 "third_party/libpg_query/grammar/statements/select.y" { (yyval.lockstrength) = PG_LCS_FORSHARE; ;} break; - case 757: + case 762: #line 1000 "third_party/libpg_query/grammar/statements/select.y" { (yyval.lockstrength) = PG_LCS_FORKEYSHARE; ;} break; - case 758: + case 763: #line 1004 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(2) - (2)].list); ;} break; - case 759: + case 764: #line 1005 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 760: + case 765: #line 1010 "third_party/libpg_query/grammar/statements/select.y" { (yyval.lockwaitpolicy) = LockWaitError; ;} break; - case 761: + case 766: #line 1011 "third_party/libpg_query/grammar/statements/select.y" { (yyval.lockwaitpolicy) = PGLockWaitSkip; ;} break; - case 762: + case 767: #line 1012 "third_party/libpg_query/grammar/statements/select.y" { (yyval.lockwaitpolicy) = PGLockWaitBlock; ;} break; - case 763: + case 768: #line 1022 "third_party/libpg_query/grammar/statements/select.y" { PGSelectStmt *n = makeNode(PGSelectStmt); @@ -26722,7 +26880,7 @@ YYLTYPE yylloc; ;} break; - case 764: + case 769: #line 1028 "third_party/libpg_query/grammar/statements/select.y" { PGSelectStmt *n = (PGSelectStmt *) (yyvsp[(1) - (5)].node); @@ -26731,47 +26889,47 @@ YYLTYPE yylloc; ;} break; - case 765: + case 770: #line 1036 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 766: + case 771: #line 1037 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (2)].node); ;} break; - case 767: + case 772: #line 1050 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(2) - (2)].list); ;} break; - case 768: + case 773: #line 1051 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 769: + case 774: #line 1055 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 770: + case 775: #line 1056 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; - case 771: + case 776: #line 1060 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 772: + case 777: #line 1061 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (2)].list); ;} break; - case 773: + case 778: #line 1066 "third_party/libpg_query/grammar/statements/select.y" { (yyval.alias) = makeNode(PGAlias); @@ -26779,7 +26937,7 @@ YYLTYPE yylloc; ;} break; - case 774: + case 779: #line 1077 "third_party/libpg_query/grammar/statements/select.y" { (yyvsp[(1) - (4)].range)->at_clause = (yyvsp[(3) - (4)].node); @@ -26789,7 +26947,7 @@ YYLTYPE yylloc; ;} break; - case 775: + case 780: #line 1084 "third_party/libpg_query/grammar/statements/select.y" { (yyvsp[(2) - (4)].range)->at_clause = (yyvsp[(3) - (4)].node); @@ -26799,7 +26957,7 @@ YYLTYPE yylloc; ;} break; - case 776: + case 781: #line 1091 "third_party/libpg_query/grammar/statements/select.y" { PGRangeFunction *n = (PGRangeFunction *) (yyvsp[(1) - (3)].node); @@ -26810,7 +26968,7 @@ YYLTYPE yylloc; ;} break; - case 777: + case 782: #line 1099 "third_party/libpg_query/grammar/statements/select.y" { PGRangeFunction *n = (PGRangeFunction *) (yyvsp[(2) - (3)].node); @@ -26820,7 +26978,7 @@ YYLTYPE yylloc; ;} break; - case 778: + case 783: #line 1107 "third_party/libpg_query/grammar/statements/select.y" { PGRangeSubselect *n = makeNode(PGRangeSubselect); @@ -26832,7 +26990,7 @@ YYLTYPE yylloc; ;} break; - case 779: + case 784: #line 1117 "third_party/libpg_query/grammar/statements/select.y" { PGRangeFunction *n = (PGRangeFunction *) (yyvsp[(2) - (3)].node); @@ -26843,7 +27001,7 @@ YYLTYPE yylloc; ;} break; - case 780: + case 785: #line 1125 "third_party/libpg_query/grammar/statements/select.y" { PGRangeSubselect *n = makeNode(PGRangeSubselect); @@ -26855,7 +27013,7 @@ YYLTYPE yylloc; ;} break; - case 781: + case 786: #line 1134 "third_party/libpg_query/grammar/statements/select.y" { PGRangeSubselect *n = makeNode(PGRangeSubselect); @@ -26867,7 +27025,7 @@ YYLTYPE yylloc; ;} break; - case 782: + case 787: #line 1143 "third_party/libpg_query/grammar/statements/select.y" { PGRangeSubselect *n = makeNode(PGRangeSubselect); @@ -26879,14 +27037,14 @@ YYLTYPE yylloc; ;} break; - case 783: + case 788: #line 1152 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) (yyvsp[(1) - (1)].jexpr); ;} break; - case 784: + case 789: #line 1156 "third_party/libpg_query/grammar/statements/select.y" { (yyvsp[(2) - (4)].jexpr)->alias = (yyvsp[(4) - (4)].alias); @@ -26894,7 +27052,7 @@ YYLTYPE yylloc; ;} break; - case 785: + case 790: #line 1161 "third_party/libpg_query/grammar/statements/select.y" { (yyvsp[(3) - (4)].jexpr)->alias = (yyvsp[(1) - (4)].alias); @@ -26902,7 +27060,7 @@ YYLTYPE yylloc; ;} break; - case 786: + case 791: #line 1166 "third_party/libpg_query/grammar/statements/select.y" { PGPivotExpr *n = makeNode(PGPivotExpr); @@ -26916,7 +27074,7 @@ YYLTYPE yylloc; ;} break; - case 787: + case 792: #line 1177 "third_party/libpg_query/grammar/statements/select.y" { PGPivotExpr *n = makeNode(PGPivotExpr); @@ -26930,32 +27088,32 @@ YYLTYPE yylloc; ;} break; - case 788: + case 793: #line 1190 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(3) - (3)].list); ;} break; - case 789: + case 794: #line 1191 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NULL; ;} break; - case 790: + case 795: #line 1194 "third_party/libpg_query/grammar/statements/select.y" { (yyval.boolean) = true; ;} break; - case 791: + case 796: #line 1195 "third_party/libpg_query/grammar/statements/select.y" { (yyval.boolean) = false; ;} break; - case 792: + case 797: #line 1196 "third_party/libpg_query/grammar/statements/select.y" { (yyval.boolean) = false; ;} break; - case 793: + case 798: #line 1200 "third_party/libpg_query/grammar/statements/select.y" { PGPivot *n = makeNode(PGPivot); @@ -26965,7 +27123,7 @@ YYLTYPE yylloc; ;} break; - case 794: + case 799: #line 1208 "third_party/libpg_query/grammar/statements/select.y" { PGPivot *n = makeNode(PGPivot); @@ -26975,22 +27133,22 @@ YYLTYPE yylloc; ;} break; - case 795: + case 800: #line 1217 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 796: + case 801: #line 1218 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 797: + case 802: #line 1219 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(2) - (3)].list); ;} break; - case 798: + case 803: #line 1223 "third_party/libpg_query/grammar/statements/select.y" { PGPivot *n = makeNode(PGPivot); @@ -27000,7 +27158,7 @@ YYLTYPE yylloc; ;} break; - case 799: + case 804: #line 1231 "third_party/libpg_query/grammar/statements/select.y" { PGPivot *n = makeNode(PGPivot); @@ -27010,31 +27168,31 @@ YYLTYPE yylloc; ;} break; - case 800: + case 805: #line 1240 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 801: + case 806: #line 1244 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].node)); ;} break; - case 802: + case 807: #line 1250 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeString((yyvsp[(1) - (1)].str))); ;} break; - case 803: + case 808: #line 1251 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(2) - (3)].list); ;} break; - case 804: + case 809: #line 1256 "third_party/libpg_query/grammar/statements/select.y" { PGPivot *n = makeNode(PGPivot); @@ -27044,28 +27202,28 @@ YYLTYPE yylloc; ;} break; - case 805: + case 810: #line 1265 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 806: + case 811: #line 1269 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].node)); ;} break; - case 807: + case 812: #line 1294 "third_party/libpg_query/grammar/statements/select.y" { (yyval.jexpr) = (yyvsp[(2) - (3)].jexpr); ;} break; - case 808: + case 813: #line 1298 "third_party/libpg_query/grammar/statements/select.y" { /* CROSS JOIN is same as unqualified inner join */ @@ -27081,7 +27239,7 @@ YYLTYPE yylloc; ;} break; - case 809: + case 814: #line 1311 "third_party/libpg_query/grammar/statements/select.y" { PGJoinExpr *n = makeNode(PGJoinExpr); @@ -27098,7 +27256,7 @@ YYLTYPE yylloc; ;} break; - case 810: + case 815: #line 1325 "third_party/libpg_query/grammar/statements/select.y" { /* letting join_type reduce to empty doesn't work */ @@ -27116,7 +27274,7 @@ YYLTYPE yylloc; ;} break; - case 811: + case 816: #line 1340 "third_party/libpg_query/grammar/statements/select.y" { PGJoinExpr *n = makeNode(PGJoinExpr); @@ -27131,7 +27289,7 @@ YYLTYPE yylloc; ;} break; - case 812: + case 817: #line 1352 "third_party/libpg_query/grammar/statements/select.y" { /* letting join_type reduce to empty doesn't work */ @@ -27147,7 +27305,7 @@ YYLTYPE yylloc; ;} break; - case 813: + case 818: #line 1365 "third_party/libpg_query/grammar/statements/select.y" { PGJoinExpr *n = makeNode(PGJoinExpr); @@ -27164,7 +27322,7 @@ YYLTYPE yylloc; ;} break; - case 814: + case 819: #line 1379 "third_party/libpg_query/grammar/statements/select.y" { PGJoinExpr *n = makeNode(PGJoinExpr); @@ -27181,7 +27339,7 @@ YYLTYPE yylloc; ;} break; - case 815: + case 820: #line 1393 "third_party/libpg_query/grammar/statements/select.y" { /* POSITIONAL JOIN is a coordinated scan */ @@ -27197,7 +27355,7 @@ YYLTYPE yylloc; ;} break; - case 816: + case 821: #line 1406 "third_party/libpg_query/grammar/statements/select.y" { /* ANTI JOIN is a filter */ @@ -27215,7 +27373,7 @@ YYLTYPE yylloc; ;} break; - case 817: + case 822: #line 1421 "third_party/libpg_query/grammar/statements/select.y" { /* SEMI JOIN is also a filter */ @@ -27234,7 +27392,7 @@ YYLTYPE yylloc; ;} break; - case 818: + case 823: #line 1440 "third_party/libpg_query/grammar/statements/select.y" { (yyval.alias) = makeNode(PGAlias); @@ -27243,7 +27401,7 @@ YYLTYPE yylloc; ;} break; - case 819: + case 824: #line 1446 "third_party/libpg_query/grammar/statements/select.y" { (yyval.alias) = makeNode(PGAlias); @@ -27251,7 +27409,7 @@ YYLTYPE yylloc; ;} break; - case 820: + case 825: #line 1451 "third_party/libpg_query/grammar/statements/select.y" { (yyval.alias) = makeNode(PGAlias); @@ -27260,7 +27418,7 @@ YYLTYPE yylloc; ;} break; - case 821: + case 826: #line 1457 "third_party/libpg_query/grammar/statements/select.y" { (yyval.alias) = makeNode(PGAlias); @@ -27268,31 +27426,31 @@ YYLTYPE yylloc; ;} break; - case 822: + case 827: #line 1463 "third_party/libpg_query/grammar/statements/select.y" { (yyval.alias) = (yyvsp[(1) - (1)].alias); ;} break; - case 823: + case 828: #line 1464 "third_party/libpg_query/grammar/statements/select.y" { (yyval.alias) = NULL; ;} break; - case 824: + case 829: #line 1473 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make2((yyvsp[(1) - (1)].alias), NIL); ;} break; - case 825: + case 830: #line 1477 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make2(NULL, (yyvsp[(3) - (4)].list)); ;} break; - case 826: + case 831: #line 1481 "third_party/libpg_query/grammar/statements/select.y" { PGAlias *a = makeNode(PGAlias); @@ -27301,7 +27459,7 @@ YYLTYPE yylloc; ;} break; - case 827: + case 832: #line 1487 "third_party/libpg_query/grammar/statements/select.y" { PGAlias *a = makeNode(PGAlias); @@ -27310,64 +27468,64 @@ YYLTYPE yylloc; ;} break; - case 828: + case 833: #line 1493 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make2(NULL, NIL); ;} break; - case 829: + case 834: #line 1498 "third_party/libpg_query/grammar/statements/select.y" { (yyval.jtype) = PG_JOIN_FULL; ;} break; - case 830: + case 835: #line 1499 "third_party/libpg_query/grammar/statements/select.y" { (yyval.jtype) = PG_JOIN_LEFT; ;} break; - case 831: + case 836: #line 1500 "third_party/libpg_query/grammar/statements/select.y" { (yyval.jtype) = PG_JOIN_RIGHT; ;} break; - case 832: + case 837: #line 1501 "third_party/libpg_query/grammar/statements/select.y" { (yyval.jtype) = PG_JOIN_SEMI; ;} break; - case 833: + case 838: #line 1502 "third_party/libpg_query/grammar/statements/select.y" { (yyval.jtype) = PG_JOIN_ANTI; ;} break; - case 834: + case 839: #line 1503 "third_party/libpg_query/grammar/statements/select.y" { (yyval.jtype) = PG_JOIN_INNER; ;} break; - case 835: + case 840: #line 1507 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = NULL; ;} break; - case 836: + case 841: #line 1508 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = NULL; ;} break; - case 837: + case 842: #line 1520 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) (yyvsp[(3) - (4)].list); ;} break; - case 838: + case 843: #line 1521 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; - case 839: + case 844: #line 1527 "third_party/libpg_query/grammar/statements/select.y" { /* inheritance query, implicitly */ @@ -27377,7 +27535,7 @@ YYLTYPE yylloc; ;} break; - case 840: + case 845: #line 1534 "third_party/libpg_query/grammar/statements/select.y" { /* inheritance query, explicitly */ @@ -27387,7 +27545,7 @@ YYLTYPE yylloc; ;} break; - case 841: + case 846: #line 1541 "third_party/libpg_query/grammar/statements/select.y" { /* no inheritance */ @@ -27397,7 +27555,7 @@ YYLTYPE yylloc; ;} break; - case 842: + case 847: #line 1548 "third_party/libpg_query/grammar/statements/select.y" { /* no inheritance, SQL99-style syntax */ @@ -27407,7 +27565,7 @@ YYLTYPE yylloc; ;} break; - case 843: + case 848: #line 1580 "third_party/libpg_query/grammar/statements/select.y" { PGRangeFunction *n = makeNode(PGRangeFunction); @@ -27421,7 +27579,7 @@ YYLTYPE yylloc; ;} break; - case 844: + case 849: #line 1591 "third_party/libpg_query/grammar/statements/select.y" { PGRangeFunction *n = makeNode(PGRangeFunction); @@ -27435,66 +27593,66 @@ YYLTYPE yylloc; ;} break; - case 845: + case 850: #line 1604 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make2((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].list)); ;} break; - case 846: + case 851: #line 1608 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].list)); ;} break; - case 847: + case 852: #line 1609 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].list)); ;} break; - case 848: + case 853: #line 1612 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(3) - (4)].list); ;} break; - case 849: + case 854: #line 1613 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 850: + case 855: #line 1616 "third_party/libpg_query/grammar/statements/select.y" { (yyval.boolean) = true; ;} break; - case 851: + case 856: #line 1617 "third_party/libpg_query/grammar/statements/select.y" { (yyval.boolean) = false; ;} break; - case 852: + case 857: #line 1622 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; - case 853: + case 858: #line 1623 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = NULL; ;} break; - case 854: + case 859: #line 1629 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 855: + case 860: #line 1633 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; - case 856: + case 861: #line 1639 "third_party/libpg_query/grammar/statements/select.y" { PGColumnDef *n = makeNode(PGColumnDef); @@ -27515,7 +27673,7 @@ YYLTYPE yylloc; ;} break; - case 857: + case 862: #line 1660 "third_party/libpg_query/grammar/statements/select.y" { PGCollateClause *n = makeNode(PGCollateClause); @@ -27526,36 +27684,36 @@ YYLTYPE yylloc; ;} break; - case 858: + case 863: #line 1667 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = NULL; ;} break; - case 859: + case 864: #line 1681 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(list_make2(makeString((yyvsp[(1) - (2)].str)), (yyvsp[(2) - (2)].typnam))); ;} break; - case 860: + case 865: #line 1684 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (4)].list), list_make2(makeString((yyvsp[(3) - (4)].str)), (yyvsp[(4) - (4)].typnam))); ;} break; - case 863: + case 868: #line 1691 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 864: + case 869: #line 1692 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = NULL; ;} break; - case 865: + case 870: #line 1695 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (2)].typnam); @@ -27563,7 +27721,7 @@ YYLTYPE yylloc; ;} break; - case 866: + case 871: #line 1700 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(2) - (3)].typnam); @@ -27572,7 +27730,7 @@ YYLTYPE yylloc; ;} break; - case 867: + case 872: #line 1707 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (5)].typnam); @@ -27580,7 +27738,7 @@ YYLTYPE yylloc; ;} break; - case 868: + case 873: #line 1712 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(2) - (6)].typnam); @@ -27589,7 +27747,7 @@ YYLTYPE yylloc; ;} break; - case 869: + case 874: #line 1718 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (2)].typnam); @@ -27597,7 +27755,7 @@ YYLTYPE yylloc; ;} break; - case 870: + case 875: #line 1723 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(2) - (3)].typnam); @@ -27606,7 +27764,7 @@ YYLTYPE yylloc; ;} break; - case 871: + case 876: #line 1729 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = makeTypeNameFromNameList((yyvsp[(1) - (2)].list)); @@ -27614,7 +27772,7 @@ YYLTYPE yylloc; ;} break; - case 872: + case 877: #line 1734 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = SystemTypeName("struct"); @@ -27624,7 +27782,7 @@ YYLTYPE yylloc; ;} break; - case 873: + case 878: #line 1741 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = SystemTypeName("map"); @@ -27634,7 +27792,7 @@ YYLTYPE yylloc; ;} break; - case 874: + case 879: #line 1748 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = SystemTypeName("union"); @@ -27644,57 +27802,57 @@ YYLTYPE yylloc; ;} break; - case 875: + case 880: #line 1757 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make2(makeString((yyvsp[(1) - (3)].str)), makeString((yyvsp[(3) - (3)].str))); ;} break; - case 876: + case 881: #line 1758 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), makeString((yyvsp[(3) - (3)].str))); ;} break; - case 877: + case 882: #line 1763 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), makeInteger(-1)); ;} break; - case 878: + case 883: #line 1765 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (4)].list), makeInteger((yyvsp[(3) - (4)].ival))); ;} break; - case 879: + case 884: #line 1767 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 880: + case 885: #line 1771 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 881: + case 886: #line 1772 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 882: + case 887: #line 1773 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 883: + case 888: #line 1774 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 884: + case 889: #line 1775 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 885: + case 890: #line 1777 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (2)].typnam); @@ -27702,7 +27860,7 @@ YYLTYPE yylloc; ;} break; - case 886: + case 891: #line 1782 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (4)].typnam); @@ -27711,27 +27869,27 @@ YYLTYPE yylloc; ;} break; - case 887: + case 892: #line 1801 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 888: + case 893: #line 1802 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 889: + case 894: #line 1803 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 890: + case 895: #line 1804 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 891: + case 896: #line 1816 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = makeTypeName((yyvsp[(1) - (2)].str)); @@ -27740,17 +27898,17 @@ YYLTYPE yylloc; ;} break; - case 892: + case 897: #line 1829 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(2) - (3)].list); ;} break; - case 893: + case 898: #line 1830 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 894: + case 899: #line 1837 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = SystemTypeName("int4"); @@ -27758,7 +27916,7 @@ YYLTYPE yylloc; ;} break; - case 895: + case 900: #line 1842 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = SystemTypeName("int4"); @@ -27766,7 +27924,7 @@ YYLTYPE yylloc; ;} break; - case 896: + case 901: #line 1847 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = SystemTypeName("int2"); @@ -27774,7 +27932,7 @@ YYLTYPE yylloc; ;} break; - case 897: + case 902: #line 1852 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = SystemTypeName("int8"); @@ -27782,7 +27940,7 @@ YYLTYPE yylloc; ;} break; - case 898: + case 903: #line 1857 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = SystemTypeName("float4"); @@ -27790,7 +27948,7 @@ YYLTYPE yylloc; ;} break; - case 899: + case 904: #line 1862 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(2) - (2)].typnam); @@ -27798,7 +27956,7 @@ YYLTYPE yylloc; ;} break; - case 900: + case 905: #line 1867 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = SystemTypeName("float8"); @@ -27806,7 +27964,7 @@ YYLTYPE yylloc; ;} break; - case 901: + case 906: #line 1872 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = SystemTypeName("numeric"); @@ -27815,7 +27973,7 @@ YYLTYPE yylloc; ;} break; - case 902: + case 907: #line 1878 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = SystemTypeName("numeric"); @@ -27824,7 +27982,7 @@ YYLTYPE yylloc; ;} break; - case 903: + case 908: #line 1884 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = SystemTypeName("numeric"); @@ -27833,7 +27991,7 @@ YYLTYPE yylloc; ;} break; - case 904: + case 909: #line 1890 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = SystemTypeName("bool"); @@ -27841,7 +27999,7 @@ YYLTYPE yylloc; ;} break; - case 905: + case 910: #line 1897 "third_party/libpg_query/grammar/statements/select.y" { /* @@ -27865,35 +28023,35 @@ YYLTYPE yylloc; ;} break; - case 906: + case 911: #line 1918 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = SystemTypeName("float4"); ;} break; - case 907: + case 912: #line 1928 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 908: + case 913: #line 1932 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 909: + case 914: #line 1940 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 910: + case 915: #line 1944 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); @@ -27901,7 +28059,7 @@ YYLTYPE yylloc; ;} break; - case 911: + case 916: #line 1952 "third_party/libpg_query/grammar/statements/select.y" { const char *typname; @@ -27913,7 +28071,7 @@ YYLTYPE yylloc; ;} break; - case 912: + case 917: #line 1964 "third_party/libpg_query/grammar/statements/select.y" { /* bit defaults to bit(1), varbit to no limit */ @@ -27930,28 +28088,28 @@ YYLTYPE yylloc; ;} break; - case 913: + case 918: #line 1985 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 914: + case 919: #line 1989 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 915: + case 920: #line 1995 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 916: + case 921: #line 1999 "third_party/libpg_query/grammar/statements/select.y" { /* Length was not specified so allow to be unrestricted. @@ -27965,7 +28123,7 @@ YYLTYPE yylloc; ;} break; - case 917: + case 922: #line 2012 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = SystemTypeName((yyvsp[(1) - (4)].conststr)); @@ -27974,7 +28132,7 @@ YYLTYPE yylloc; ;} break; - case 918: + case 923: #line 2020 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = SystemTypeName((yyvsp[(1) - (1)].conststr)); @@ -27985,47 +28143,47 @@ YYLTYPE yylloc; ;} break; - case 919: + case 924: #line 2030 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = (yyvsp[(2) - (2)].boolean) ? "varchar": "bpchar"; ;} break; - case 920: + case 925: #line 2032 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = (yyvsp[(2) - (2)].boolean) ? "varchar": "bpchar"; ;} break; - case 921: + case 926: #line 2034 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = "varchar"; ;} break; - case 922: + case 927: #line 2036 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = (yyvsp[(3) - (3)].boolean) ? "varchar": "bpchar"; ;} break; - case 923: + case 928: #line 2038 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = (yyvsp[(3) - (3)].boolean) ? "varchar": "bpchar"; ;} break; - case 924: + case 929: #line 2040 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = (yyvsp[(2) - (2)].boolean) ? "varchar": "bpchar"; ;} break; - case 925: + case 930: #line 2044 "third_party/libpg_query/grammar/statements/select.y" { (yyval.boolean) = true; ;} break; - case 926: + case 931: #line 2045 "third_party/libpg_query/grammar/statements/select.y" { (yyval.boolean) = false; ;} break; - case 927: + case 932: #line 2053 "third_party/libpg_query/grammar/statements/select.y" { if ((yyvsp[(5) - (5)].boolean)) @@ -28037,7 +28195,7 @@ YYLTYPE yylloc; ;} break; - case 928: + case 933: #line 2062 "third_party/libpg_query/grammar/statements/select.y" { if ((yyvsp[(2) - (2)].boolean)) @@ -28048,7 +28206,7 @@ YYLTYPE yylloc; ;} break; - case 929: + case 934: #line 2070 "third_party/libpg_query/grammar/statements/select.y" { if ((yyvsp[(5) - (5)].boolean)) @@ -28060,7 +28218,7 @@ YYLTYPE yylloc; ;} break; - case 930: + case 935: #line 2079 "third_party/libpg_query/grammar/statements/select.y" { if ((yyvsp[(2) - (2)].boolean)) @@ -28071,7 +28229,7 @@ YYLTYPE yylloc; ;} break; - case 931: + case 936: #line 2090 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = SystemTypeName("interval"); @@ -28079,87 +28237,87 @@ YYLTYPE yylloc; ;} break; - case 932: + case 937: #line 2097 "third_party/libpg_query/grammar/statements/select.y" { (yyval.boolean) = true; ;} break; - case 933: + case 938: #line 2098 "third_party/libpg_query/grammar/statements/select.y" { (yyval.boolean) = false; ;} break; - case 934: + case 939: #line 2099 "third_party/libpg_query/grammar/statements/select.y" { (yyval.boolean) = false; ;} break; - case 961: + case 966: #line 2143 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(YEAR), (yylsp[(1) - (1)]))); ;} break; - case 962: + case 967: #line 2145 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(MONTH), (yylsp[(1) - (1)]))); ;} break; - case 963: + case 968: #line 2147 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(DAY), (yylsp[(1) - (1)]))); ;} break; - case 964: + case 969: #line 2149 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(HOUR), (yylsp[(1) - (1)]))); ;} break; - case 965: + case 970: #line 2151 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(MINUTE), (yylsp[(1) - (1)]))); ;} break; - case 966: + case 971: #line 2153 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(SECOND), (yylsp[(1) - (1)]))); ;} break; - case 967: + case 972: #line 2155 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(MILLISECOND), (yylsp[(1) - (1)]))); ;} break; - case 968: + case 973: #line 2157 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(MICROSECOND), (yylsp[(1) - (1)]))); ;} break; - case 969: + case 974: #line 2159 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(WEEK), (yylsp[(1) - (1)]))); ;} break; - case 970: + case 975: #line 2161 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(QUARTER), (yylsp[(1) - (1)]))); ;} break; - case 971: + case 976: #line 2163 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(DECADE), (yylsp[(1) - (1)]))); ;} break; - case 972: + case 977: #line 2165 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(CENTURY), (yylsp[(1) - (1)]))); ;} break; - case 973: + case 978: #line 2167 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(MILLENNIUM), (yylsp[(1) - (1)]))); ;} break; - case 974: + case 979: #line 2169 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(YEAR) | @@ -28167,7 +28325,7 @@ YYLTYPE yylloc; ;} break; - case 975: + case 980: #line 2174 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(DAY) | @@ -28175,7 +28333,7 @@ YYLTYPE yylloc; ;} break; - case 976: + case 981: #line 2179 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(DAY) | @@ -28184,7 +28342,7 @@ YYLTYPE yylloc; ;} break; - case 977: + case 982: #line 2185 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(DAY) | @@ -28194,7 +28352,7 @@ YYLTYPE yylloc; ;} break; - case 978: + case 983: #line 2192 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(HOUR) | @@ -28202,7 +28360,7 @@ YYLTYPE yylloc; ;} break; - case 979: + case 984: #line 2197 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(HOUR) | @@ -28211,7 +28369,7 @@ YYLTYPE yylloc; ;} break; - case 980: + case 985: #line 2203 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(MINUTE) | @@ -28219,22 +28377,22 @@ YYLTYPE yylloc; ;} break; - case 981: + case 986: #line 2208 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 982: + case 987: #line 2239 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 983: + case 988: #line 2242 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeTypeCast((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].typnam), 0, (yylsp[(2) - (3)])); ;} break; - case 984: + case 989: #line 2244 "third_party/libpg_query/grammar/statements/select.y" { PGCollateClause *n = makeNode(PGCollateClause); @@ -28245,7 +28403,7 @@ YYLTYPE yylloc; ;} break; - case 985: + case 990: #line 2252 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName("timezone"), @@ -28254,122 +28412,122 @@ YYLTYPE yylloc; ;} break; - case 986: + case 991: #line 2267 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "+", NULL, (yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} break; - case 987: + case 992: #line 2269 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = doNegate((yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} break; - case 988: + case 993: #line 2271 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "+", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 989: + case 994: #line 2273 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "-", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 990: + case 995: #line 2275 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "*", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 991: + case 996: #line 2277 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "/", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 992: + case 997: #line 2279 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "//", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 993: + case 998: #line 2281 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "%", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 994: + case 999: #line 2283 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "^", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 995: + case 1000: #line 2285 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "**", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 996: + case 1001: #line 2287 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "<", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 997: + case 1002: #line 2289 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, ">", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 998: + case 1003: #line 2291 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "=", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 999: + case 1004: #line 2293 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "<=", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1000: + case 1005: #line 2295 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, ">=", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1001: + case 1006: #line 2297 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "<>", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1002: + case 1007: #line 2300 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeAExpr(PG_AEXPR_OP, (yyvsp[(2) - (3)].list), (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1003: + case 1008: #line 2302 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeAExpr(PG_AEXPR_OP, (yyvsp[(1) - (2)].list), NULL, (yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} break; - case 1004: + case 1009: #line 2304 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeAExpr(PG_AEXPR_OP, (yyvsp[(2) - (2)].list), (yyvsp[(1) - (2)].node), NULL, (yylsp[(2) - (2)])); ;} break; - case 1005: + case 1010: #line 2307 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeAndExpr((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1006: + case 1011: #line 2309 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeOrExpr((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1007: + case 1012: #line 2311 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeNotExpr((yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} break; - case 1008: + case 1013: #line 2313 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeNotExpr((yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} break; - case 1009: + case 1014: #line 2315 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_GLOB, "~~~", @@ -28377,7 +28535,7 @@ YYLTYPE yylloc; ;} break; - case 1010: + case 1015: #line 2320 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_LIKE, "~~", @@ -28385,7 +28543,7 @@ YYLTYPE yylloc; ;} break; - case 1011: + case 1016: #line 2325 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = makeFuncCall(SystemFuncName("like_escape"), @@ -28395,7 +28553,7 @@ YYLTYPE yylloc; ;} break; - case 1012: + case 1017: #line 2332 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_LIKE, "!~~", @@ -28403,7 +28561,7 @@ YYLTYPE yylloc; ;} break; - case 1013: + case 1018: #line 2337 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = makeFuncCall(SystemFuncName("not_like_escape"), @@ -28413,7 +28571,7 @@ YYLTYPE yylloc; ;} break; - case 1014: + case 1019: #line 2344 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_ILIKE, "~~*", @@ -28421,7 +28579,7 @@ YYLTYPE yylloc; ;} break; - case 1015: + case 1020: #line 2349 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = makeFuncCall(SystemFuncName("ilike_escape"), @@ -28431,7 +28589,7 @@ YYLTYPE yylloc; ;} break; - case 1016: + case 1021: #line 2356 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_ILIKE, "!~~*", @@ -28439,7 +28597,7 @@ YYLTYPE yylloc; ;} break; - case 1017: + case 1022: #line 2361 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = makeFuncCall(SystemFuncName("not_ilike_escape"), @@ -28449,7 +28607,7 @@ YYLTYPE yylloc; ;} break; - case 1018: + case 1023: #line 2369 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = makeFuncCall(SystemFuncName("similar_escape"), @@ -28460,7 +28618,7 @@ YYLTYPE yylloc; ;} break; - case 1019: + case 1024: #line 2377 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = makeFuncCall(SystemFuncName("similar_escape"), @@ -28471,7 +28629,7 @@ YYLTYPE yylloc; ;} break; - case 1020: + case 1025: #line 2385 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = makeFuncCall(SystemFuncName("similar_escape"), @@ -28482,7 +28640,7 @@ YYLTYPE yylloc; ;} break; - case 1021: + case 1026: #line 2393 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = makeFuncCall(SystemFuncName("similar_escape"), @@ -28493,7 +28651,7 @@ YYLTYPE yylloc; ;} break; - case 1022: + case 1027: #line 2411 "third_party/libpg_query/grammar/statements/select.y" { PGNullTest *n = makeNode(PGNullTest); @@ -28504,7 +28662,7 @@ YYLTYPE yylloc; ;} break; - case 1023: + case 1028: #line 2419 "third_party/libpg_query/grammar/statements/select.y" { PGNullTest *n = makeNode(PGNullTest); @@ -28515,7 +28673,7 @@ YYLTYPE yylloc; ;} break; - case 1024: + case 1029: #line 2427 "third_party/libpg_query/grammar/statements/select.y" { PGNullTest *n = makeNode(PGNullTest); @@ -28526,7 +28684,7 @@ YYLTYPE yylloc; ;} break; - case 1025: + case 1030: #line 2435 "third_party/libpg_query/grammar/statements/select.y" { PGNullTest *n = makeNode(PGNullTest); @@ -28537,7 +28695,7 @@ YYLTYPE yylloc; ;} break; - case 1026: + case 1031: #line 2443 "third_party/libpg_query/grammar/statements/select.y" { PGNullTest *n = makeNode(PGNullTest); @@ -28548,7 +28706,7 @@ YYLTYPE yylloc; ;} break; - case 1027: + case 1032: #line 2451 "third_party/libpg_query/grammar/statements/select.y" { PGLambdaFunction *n = makeNode(PGLambdaFunction); @@ -28559,7 +28717,7 @@ YYLTYPE yylloc; ;} break; - case 1028: + case 1033: #line 2459 "third_party/libpg_query/grammar/statements/select.y" { PGSingleArrowFunction *n = makeNode(PGSingleArrowFunction); @@ -28570,14 +28728,14 @@ YYLTYPE yylloc; ;} break; - case 1029: + case 1034: #line 2467 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "->>", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1030: + case 1035: #line 2471 "third_party/libpg_query/grammar/statements/select.y" { if (list_length((yyvsp[(1) - (3)].list)) != 2) @@ -28596,7 +28754,7 @@ YYLTYPE yylloc; ;} break; - case 1031: + case 1036: #line 2487 "third_party/libpg_query/grammar/statements/select.y" { PGBooleanTest *b = makeNode(PGBooleanTest); @@ -28607,7 +28765,7 @@ YYLTYPE yylloc; ;} break; - case 1032: + case 1037: #line 2495 "third_party/libpg_query/grammar/statements/select.y" { PGBooleanTest *b = makeNode(PGBooleanTest); @@ -28618,7 +28776,7 @@ YYLTYPE yylloc; ;} break; - case 1033: + case 1038: #line 2503 "third_party/libpg_query/grammar/statements/select.y" { PGBooleanTest *b = makeNode(PGBooleanTest); @@ -28629,7 +28787,7 @@ YYLTYPE yylloc; ;} break; - case 1034: + case 1039: #line 2511 "third_party/libpg_query/grammar/statements/select.y" { PGBooleanTest *b = makeNode(PGBooleanTest); @@ -28640,7 +28798,7 @@ YYLTYPE yylloc; ;} break; - case 1035: + case 1040: #line 2519 "third_party/libpg_query/grammar/statements/select.y" { PGBooleanTest *b = makeNode(PGBooleanTest); @@ -28651,7 +28809,7 @@ YYLTYPE yylloc; ;} break; - case 1036: + case 1041: #line 2527 "third_party/libpg_query/grammar/statements/select.y" { PGBooleanTest *b = makeNode(PGBooleanTest); @@ -28662,35 +28820,35 @@ YYLTYPE yylloc; ;} break; - case 1037: + case 1042: #line 2535 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_DISTINCT, "=", (yyvsp[(1) - (5)].node), (yyvsp[(5) - (5)].node), (yylsp[(2) - (5)])); ;} break; - case 1038: + case 1043: #line 2539 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_NOT_DISTINCT, "=", (yyvsp[(1) - (6)].node), (yyvsp[(6) - (6)].node), (yylsp[(2) - (6)])); ;} break; - case 1039: + case 1044: #line 2543 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OF, "=", (yyvsp[(1) - (6)].node), (PGNode *) (yyvsp[(5) - (6)].list), (yylsp[(2) - (6)])); ;} break; - case 1040: + case 1045: #line 2547 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OF, "<>", (yyvsp[(1) - (7)].node), (PGNode *) (yyvsp[(6) - (7)].list), (yylsp[(2) - (7)])); ;} break; - case 1041: + case 1046: #line 2551 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_BETWEEN, @@ -28701,7 +28859,7 @@ YYLTYPE yylloc; ;} break; - case 1042: + case 1047: #line 2559 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_NOT_BETWEEN, @@ -28712,7 +28870,7 @@ YYLTYPE yylloc; ;} break; - case 1043: + case 1048: #line 2567 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_BETWEEN_SYM, @@ -28723,7 +28881,7 @@ YYLTYPE yylloc; ;} break; - case 1044: + case 1049: #line 2575 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_NOT_BETWEEN_SYM, @@ -28734,7 +28892,7 @@ YYLTYPE yylloc; ;} break; - case 1045: + case 1050: #line 2583 "third_party/libpg_query/grammar/statements/select.y" { /* in_expr returns a PGSubLink or a list of a_exprs */ @@ -28757,7 +28915,7 @@ YYLTYPE yylloc; ;} break; - case 1046: + case 1051: #line 2603 "third_party/libpg_query/grammar/statements/select.y" { /* in_expr returns a PGSubLink or a list of a_exprs */ @@ -28782,7 +28940,7 @@ YYLTYPE yylloc; ;} break; - case 1047: + case 1052: #line 2625 "third_party/libpg_query/grammar/statements/select.y" { PGSubLink *n = makeNode(PGSubLink); @@ -28796,7 +28954,7 @@ YYLTYPE yylloc; ;} break; - case 1048: + case 1053: #line 2636 "third_party/libpg_query/grammar/statements/select.y" { if ((yyvsp[(3) - (6)].subquerytype) == PG_ANY_SUBLINK) @@ -28806,7 +28964,7 @@ YYLTYPE yylloc; ;} break; - case 1049: + case 1054: #line 2643 "third_party/libpg_query/grammar/statements/select.y" { /* @@ -28823,7 +28981,7 @@ YYLTYPE yylloc; ;} break; - case 1050: + case 1055: #line 2657 "third_party/libpg_query/grammar/statements/select.y" { PGAStar *star = makeNode(PGAStar); @@ -28834,7 +28992,7 @@ YYLTYPE yylloc; ;} break; - case 1051: + case 1056: #line 2665 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = makeFuncCall(SystemFuncName("unpack"), list_make1((yyvsp[(3) - (4)].node)), (yylsp[(1) - (4)])); @@ -28842,7 +29000,7 @@ YYLTYPE yylloc; ;} break; - case 1052: + case 1057: #line 2670 "third_party/libpg_query/grammar/statements/select.y" { PGAStar *star = makeNode(PGAStar); @@ -28855,7 +29013,7 @@ YYLTYPE yylloc; ;} break; - case 1053: + case 1058: #line 2680 "third_party/libpg_query/grammar/statements/select.y" { PGAStar *star = makeNode(PGAStar); @@ -28867,7 +29025,7 @@ YYLTYPE yylloc; ;} break; - case 1054: + case 1059: #line 2689 "third_party/libpg_query/grammar/statements/select.y" { PGAStar *star = makeNode(PGAStar); @@ -28880,140 +29038,140 @@ YYLTYPE yylloc; ;} break; - case 1055: + case 1060: #line 2710 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 1056: + case 1061: #line 2712 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeTypeCast((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].typnam), 0, (yylsp[(2) - (3)])); ;} break; - case 1057: + case 1062: #line 2714 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "+", NULL, (yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} break; - case 1058: + case 1063: #line 2716 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = doNegate((yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} break; - case 1059: + case 1064: #line 2718 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "+", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1060: + case 1065: #line 2720 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "-", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1061: + case 1066: #line 2722 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "*", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1062: + case 1067: #line 2724 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "/", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1063: + case 1068: #line 2726 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "//", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1064: + case 1069: #line 2728 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "%", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1065: + case 1070: #line 2730 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "^", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1066: + case 1071: #line 2732 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "**", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1067: + case 1072: #line 2734 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "<", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1068: + case 1073: #line 2736 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, ">", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1069: + case 1074: #line 2738 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "=", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1070: + case 1075: #line 2740 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "<=", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1071: + case 1076: #line 2742 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, ">=", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1072: + case 1077: #line 2744 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "<>", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1073: + case 1078: #line 2746 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeAExpr(PG_AEXPR_OP, (yyvsp[(2) - (3)].list), (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1074: + case 1079: #line 2748 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeAExpr(PG_AEXPR_OP, (yyvsp[(1) - (2)].list), NULL, (yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} break; - case 1075: + case 1080: #line 2750 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeAExpr(PG_AEXPR_OP, (yyvsp[(2) - (2)].list), (yyvsp[(1) - (2)].node), NULL, (yylsp[(2) - (2)])); ;} break; - case 1076: + case 1081: #line 2752 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_DISTINCT, "=", (yyvsp[(1) - (5)].node), (yyvsp[(5) - (5)].node), (yylsp[(2) - (5)])); ;} break; - case 1077: + case 1082: #line 2756 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_NOT_DISTINCT, "=", (yyvsp[(1) - (6)].node), (yyvsp[(6) - (6)].node), (yylsp[(2) - (6)])); ;} break; - case 1078: + case 1083: #line 2760 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OF, "=", (yyvsp[(1) - (6)].node), (PGNode *) (yyvsp[(5) - (6)].list), (yylsp[(2) - (6)])); ;} break; - case 1079: + case 1084: #line 2764 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OF, "<>", (yyvsp[(1) - (7)].node), (PGNode *) (yyvsp[(6) - (7)].list), (yylsp[(2) - (7)])); ;} break; - case 1081: + case 1086: #line 2779 "third_party/libpg_query/grammar/statements/select.y" { if ((yyvsp[(2) - (2)].list)) @@ -29028,17 +29186,17 @@ YYLTYPE yylloc; ;} break; - case 1082: + case 1087: #line 2792 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 1083: + case 1088: #line 2793 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 1084: + case 1089: #line 2795 "third_party/libpg_query/grammar/statements/select.y" { PGSubLink *n = makeNode(PGSubLink); @@ -29052,7 +29210,7 @@ YYLTYPE yylloc; ;} break; - case 1085: + case 1090: #line 2806 "third_party/libpg_query/grammar/statements/select.y" { /* @@ -29079,7 +29237,7 @@ YYLTYPE yylloc; ;} break; - case 1086: + case 1091: #line 2830 "third_party/libpg_query/grammar/statements/select.y" { PGSubLink *n = makeNode(PGSubLink); @@ -29093,7 +29251,7 @@ YYLTYPE yylloc; ;} break; - case 1087: + case 1092: #line 2841 "third_party/libpg_query/grammar/statements/select.y" { PGGroupingFunc *g = makeNode(PGGroupingFunc); @@ -29103,21 +29261,21 @@ YYLTYPE yylloc; ;} break; - case 1088: + case 1093: #line 2851 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(2) - (3)].node); ;} break; - case 1089: + case 1094: #line 2855 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 1090: + case 1095: #line 2858 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = makeFuncCall(SystemFuncName("row"), (yyvsp[(1) - (1)].list), (yylsp[(1) - (1)])); @@ -29125,14 +29283,14 @@ YYLTYPE yylloc; ;} break; - case 1091: + case 1096: #line 2866 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeParamRef(0, (yylsp[(1) - (1)])); ;} break; - case 1092: + case 1097: #line 2870 "third_party/libpg_query/grammar/statements/select.y" { PGParamRef *p = makeNode(PGParamRef); @@ -29142,14 +29300,14 @@ YYLTYPE yylloc; ;} break; - case 1093: + case 1098: #line 2877 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeNamedParamRef((yyvsp[(2) - (2)].str), (yylsp[(1) - (2)])); ;} break; - case 1101: + case 1106: #line 2891 "third_party/libpg_query/grammar/statements/select.y" { PGSubLink *n = makeNode(PGSubLink); @@ -29163,7 +29321,7 @@ YYLTYPE yylloc; ;} break; - case 1102: + case 1107: #line 2901 "third_party/libpg_query/grammar/statements/select.y" { PGList *func_name = list_make1(makeString("construct_array")); @@ -29172,7 +29330,7 @@ YYLTYPE yylloc; ;} break; - case 1103: + case 1108: #line 2907 "third_party/libpg_query/grammar/statements/select.y" { PGPositionalReference *n = makeNode(PGPositionalReference); @@ -29182,7 +29340,7 @@ YYLTYPE yylloc; ;} break; - case 1104: + case 1109: #line 2915 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = makeFuncCall(SystemFuncName("list_value"), (yyvsp[(2) - (3)].list), (yylsp[(2) - (3)])); @@ -29190,7 +29348,7 @@ YYLTYPE yylloc; ;} break; - case 1105: + case 1110: #line 2922 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *f = makeFuncCall(SystemFuncName("struct_pack"), (yyvsp[(2) - (3)].list), (yylsp[(2) - (3)])); @@ -29198,7 +29356,7 @@ YYLTYPE yylloc; ;} break; - case 1106: + case 1111: #line 2929 "third_party/libpg_query/grammar/statements/select.y" { PGList *key_list = NULL; @@ -29218,14 +29376,14 @@ YYLTYPE yylloc; ;} break; - case 1107: + case 1112: #line 2949 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeFuncCall((yyvsp[(1) - (3)].list), NIL, (yylsp[(1) - (3)])); ;} break; - case 1108: + case 1113: #line 2953 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = makeFuncCall((yyvsp[(1) - (5)].list), NIL, (yylsp[(1) - (5)])); @@ -29235,7 +29393,7 @@ YYLTYPE yylloc; ;} break; - case 1109: + case 1114: #line 2960 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = makeFuncCall((yyvsp[(1) - (6)].list), (yyvsp[(3) - (6)].list), (yylsp[(1) - (6)])); @@ -29245,7 +29403,7 @@ YYLTYPE yylloc; ;} break; - case 1110: + case 1115: #line 2967 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = makeFuncCall((yyvsp[(1) - (7)].list), list_make1((yyvsp[(4) - (7)].node)), (yylsp[(1) - (7)])); @@ -29256,7 +29414,7 @@ YYLTYPE yylloc; ;} break; - case 1111: + case 1116: #line 2975 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = makeFuncCall((yyvsp[(1) - (9)].list), lappend((yyvsp[(3) - (9)].list), (yyvsp[(6) - (9)].node)), (yylsp[(1) - (9)])); @@ -29267,7 +29425,7 @@ YYLTYPE yylloc; ;} break; - case 1112: + case 1117: #line 2983 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = makeFuncCall((yyvsp[(1) - (7)].list), (yyvsp[(4) - (7)].list), (yylsp[(1) - (7)])); @@ -29281,7 +29439,7 @@ YYLTYPE yylloc; ;} break; - case 1113: + case 1118: #line 2994 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = makeFuncCall((yyvsp[(1) - (7)].list), (yyvsp[(4) - (7)].list), (yylsp[(1) - (7)])); @@ -29292,7 +29450,7 @@ YYLTYPE yylloc; ;} break; - case 1114: + case 1119: #line 3014 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = (PGFuncCall *) (yyvsp[(1) - (5)].node); @@ -29331,22 +29489,22 @@ YYLTYPE yylloc; ;} break; - case 1115: + case 1120: #line 3050 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 1116: + case 1121: #line 3060 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 1117: + case 1122: #line 3061 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 1118: + case 1123: #line 3069 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName("pg_collation_for"), @@ -29355,24 +29513,24 @@ YYLTYPE yylloc; ;} break; - case 1119: + case 1124: #line 3075 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeTypeCast((yyvsp[(3) - (6)].node), (yyvsp[(5) - (6)].typnam), 0, (yylsp[(1) - (6)])); ;} break; - case 1120: + case 1125: #line 3077 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeTypeCast((yyvsp[(3) - (6)].node), (yyvsp[(5) - (6)].typnam), 1, (yylsp[(1) - (6)])); ;} break; - case 1121: + case 1126: #line 3079 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName("date_part"), (yyvsp[(3) - (4)].list), (yylsp[(1) - (4)])); ;} break; - case 1122: + case 1127: #line 3083 "third_party/libpg_query/grammar/statements/select.y" { /* overlay(A PLACING B FROM C FOR D) is converted to @@ -29384,7 +29542,7 @@ YYLTYPE yylloc; ;} break; - case 1123: + case 1128: #line 3092 "third_party/libpg_query/grammar/statements/select.y" { /* position(A in B) is converted to position_inverse(A, B) */ @@ -29392,7 +29550,7 @@ YYLTYPE yylloc; ;} break; - case 1124: + case 1129: #line 3097 "third_party/libpg_query/grammar/statements/select.y" { /* substring(A from B for C) is converted to @@ -29402,7 +29560,7 @@ YYLTYPE yylloc; ;} break; - case 1125: + case 1130: #line 3104 "third_party/libpg_query/grammar/statements/select.y" { /* TREAT(expr AS target) converts expr of a particular type to target, @@ -29420,7 +29578,7 @@ YYLTYPE yylloc; ;} break; - case 1126: + case 1131: #line 3119 "third_party/libpg_query/grammar/statements/select.y" { /* various trim expressions are defined in SQL @@ -29430,35 +29588,35 @@ YYLTYPE yylloc; ;} break; - case 1127: + case 1132: #line 3126 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName("ltrim"), (yyvsp[(4) - (5)].list), (yylsp[(1) - (5)])); ;} break; - case 1128: + case 1133: #line 3130 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName("rtrim"), (yyvsp[(4) - (5)].list), (yylsp[(1) - (5)])); ;} break; - case 1129: + case 1134: #line 3134 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName("trim"), (yyvsp[(3) - (4)].list), (yylsp[(1) - (4)])); ;} break; - case 1130: + case 1135: #line 3138 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_NULLIF, "=", (yyvsp[(3) - (6)].node), (yyvsp[(5) - (6)].node), (yylsp[(1) - (6)])); ;} break; - case 1131: + case 1136: #line 3142 "third_party/libpg_query/grammar/statements/select.y" { PGCoalesceExpr *c = makeNode(PGCoalesceExpr); @@ -29468,7 +29626,7 @@ YYLTYPE yylloc; ;} break; - case 1132: + case 1137: #line 3152 "third_party/libpg_query/grammar/statements/select.y" { PGLambdaFunction *lambda = makeNode(PGLambdaFunction); @@ -29480,7 +29638,7 @@ YYLTYPE yylloc; ;} break; - case 1133: + case 1138: #line 3161 "third_party/libpg_query/grammar/statements/select.y" { PGLambdaFunction *lambda = makeNode(PGLambdaFunction); @@ -29498,62 +29656,62 @@ YYLTYPE yylloc; ;} break; - case 1134: + case 1139: #line 3182 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(4) - (5)].list); ;} break; - case 1135: + case 1140: #line 3183 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 1136: + case 1141: #line 3187 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(4) - (5)].node); ;} break; - case 1137: + case 1142: #line 3188 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(3) - (4)].node); ;} break; - case 1138: + case 1143: #line 3189 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = NULL; ;} break; - case 1139: + case 1144: #line 3193 "third_party/libpg_query/grammar/statements/select.y" { (yyval.boolean) = true; ;} break; - case 1140: + case 1145: #line 3194 "third_party/libpg_query/grammar/statements/select.y" { (yyval.boolean) = false; ;} break; - case 1141: + case 1146: #line 3201 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(2) - (2)].list); ;} break; - case 1142: + case 1147: #line 3202 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 1143: + case 1148: #line 3206 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].windef)); ;} break; - case 1144: + case 1149: #line 3208 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].windef)); ;} break; - case 1145: + case 1150: #line 3213 "third_party/libpg_query/grammar/statements/select.y" { PGWindowDef *n = (yyvsp[(3) - (3)].windef); @@ -29562,12 +29720,12 @@ YYLTYPE yylloc; ;} break; - case 1146: + case 1151: #line 3221 "third_party/libpg_query/grammar/statements/select.y" { (yyval.windef) = (yyvsp[(2) - (2)].windef); ;} break; - case 1147: + case 1152: #line 3223 "third_party/libpg_query/grammar/statements/select.y" { PGWindowDef *n = makeNode(PGWindowDef); @@ -29583,12 +29741,12 @@ YYLTYPE yylloc; ;} break; - case 1148: + case 1153: #line 3236 "third_party/libpg_query/grammar/statements/select.y" { (yyval.windef) = NULL; ;} break; - case 1149: + case 1154: #line 3241 "third_party/libpg_query/grammar/statements/select.y" { PGWindowDef *n = makeNode(PGWindowDef); @@ -29605,27 +29763,27 @@ YYLTYPE yylloc; ;} break; - case 1150: + case 1155: #line 3266 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1151: + case 1156: #line 3267 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = NULL; ;} break; - case 1152: + case 1157: #line 3270 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(3) - (3)].list); ;} break; - case 1153: + case 1158: #line 3271 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 1154: + case 1159: #line 3280 "third_party/libpg_query/grammar/statements/select.y" { PGWindowDef *n = (yyvsp[(2) - (3)].windef); @@ -29636,7 +29794,7 @@ YYLTYPE yylloc; ;} break; - case 1155: + case 1160: #line 3288 "third_party/libpg_query/grammar/statements/select.y" { PGWindowDef *n = (yyvsp[(2) - (3)].windef); @@ -29647,7 +29805,7 @@ YYLTYPE yylloc; ;} break; - case 1156: + case 1161: #line 3296 "third_party/libpg_query/grammar/statements/select.y" { PGWindowDef *n = (yyvsp[(2) - (3)].windef); @@ -29658,7 +29816,7 @@ YYLTYPE yylloc; ;} break; - case 1157: + case 1162: #line 3304 "third_party/libpg_query/grammar/statements/select.y" { PGWindowDef *n = makeNode(PGWindowDef); @@ -29670,7 +29828,7 @@ YYLTYPE yylloc; ;} break; - case 1158: + case 1163: #line 3315 "third_party/libpg_query/grammar/statements/select.y" { PGWindowDef *n = (yyvsp[(1) - (1)].windef); @@ -29691,7 +29849,7 @@ YYLTYPE yylloc; ;} break; - case 1159: + case 1164: #line 3333 "third_party/libpg_query/grammar/statements/select.y" { PGWindowDef *n1 = (yyvsp[(2) - (4)].windef); @@ -29732,7 +29890,7 @@ YYLTYPE yylloc; ;} break; - case 1160: + case 1165: #line 3379 "third_party/libpg_query/grammar/statements/select.y" { PGWindowDef *n = makeNode(PGWindowDef); @@ -29744,7 +29902,7 @@ YYLTYPE yylloc; ;} break; - case 1161: + case 1166: #line 3388 "third_party/libpg_query/grammar/statements/select.y" { PGWindowDef *n = makeNode(PGWindowDef); @@ -29756,7 +29914,7 @@ YYLTYPE yylloc; ;} break; - case 1162: + case 1167: #line 3397 "third_party/libpg_query/grammar/statements/select.y" { PGWindowDef *n = makeNode(PGWindowDef); @@ -29768,7 +29926,7 @@ YYLTYPE yylloc; ;} break; - case 1163: + case 1168: #line 3406 "third_party/libpg_query/grammar/statements/select.y" { PGWindowDef *n = makeNode(PGWindowDef); @@ -29780,7 +29938,7 @@ YYLTYPE yylloc; ;} break; - case 1164: + case 1169: #line 3415 "third_party/libpg_query/grammar/statements/select.y" { PGWindowDef *n = makeNode(PGWindowDef); @@ -29792,52 +29950,52 @@ YYLTYPE yylloc; ;} break; - case 1165: + case 1170: #line 3426 "third_party/libpg_query/grammar/statements/select.y" { (yyval.ival) = FRAMEOPTION_EXCLUDE_CURRENT_ROW; ;} break; - case 1166: + case 1171: #line 3427 "third_party/libpg_query/grammar/statements/select.y" { (yyval.ival) = FRAMEOPTION_EXCLUDE_GROUP; ;} break; - case 1167: + case 1172: #line 3428 "third_party/libpg_query/grammar/statements/select.y" { (yyval.ival) = FRAMEOPTION_EXCLUDE_TIES; ;} break; - case 1168: + case 1173: #line 3429 "third_party/libpg_query/grammar/statements/select.y" { (yyval.ival) = 0; ;} break; - case 1169: + case 1174: #line 3430 "third_party/libpg_query/grammar/statements/select.y" { (yyval.ival) = 0; ;} break; - case 1170: + case 1175: #line 3444 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(3) - (4)].list); ;} break; - case 1171: + case 1176: #line 3445 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 1172: + case 1177: #line 3448 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list);;} break; - case 1173: + case 1178: #line 3449 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(2) - (5)].list), (yyvsp[(4) - (5)].node)); ;} break; - case 1174: + case 1179: #line 3453 "third_party/libpg_query/grammar/statements/select.y" { PGNamedArgExpr *na = makeNode(PGNamedArgExpr); @@ -29849,320 +30007,320 @@ YYLTYPE yylloc; ;} break; - case 1175: + case 1180: #line 3463 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 1176: + case 1181: #line 3464 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; - case 1177: + case 1182: #line 3468 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 1178: + case 1183: #line 3469 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (2)].list); ;} break; - case 1179: + case 1184: #line 3474 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make2((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); ;} break; - case 1180: + case 1185: #line 3480 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].list)); ;} break; - case 1181: + case 1186: #line 3481 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].list)); ;} break; - case 1182: + case 1187: #line 3486 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 1183: + case 1188: #line 3487 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (2)].list); ;} break; - case 1184: + case 1189: #line 3492 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 1185: + case 1190: #line 3493 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NULL; ;} break; - case 1186: + case 1191: #line 3496 "third_party/libpg_query/grammar/statements/select.y" { (yyval.subquerytype) = PG_ANY_SUBLINK; ;} break; - case 1187: + case 1192: #line 3497 "third_party/libpg_query/grammar/statements/select.y" { (yyval.subquerytype) = PG_ANY_SUBLINK; ;} break; - case 1188: + case 1193: #line 3498 "third_party/libpg_query/grammar/statements/select.y" { (yyval.subquerytype) = PG_ALL_SUBLINK; ;} break; - case 1189: + case 1194: #line 3501 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1190: + case 1195: #line 3502 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (char*) (yyvsp[(1) - (1)].conststr); ;} break; - case 1191: + case 1196: #line 3505 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = "+"; ;} break; - case 1192: + case 1197: #line 3506 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = "-"; ;} break; - case 1193: + case 1198: #line 3507 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = "*"; ;} break; - case 1194: + case 1199: #line 3508 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = "/"; ;} break; - case 1195: + case 1200: #line 3509 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = "//"; ;} break; - case 1196: + case 1201: #line 3510 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = "%"; ;} break; - case 1197: + case 1202: #line 3511 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = "^"; ;} break; - case 1198: + case 1203: #line 3512 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = "**"; ;} break; - case 1199: + case 1204: #line 3513 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = "<"; ;} break; - case 1200: + case 1205: #line 3514 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = ">"; ;} break; - case 1201: + case 1206: #line 3515 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = "="; ;} break; - case 1202: + case 1207: #line 3516 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = "<="; ;} break; - case 1203: + case 1208: #line 3517 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = ">="; ;} break; - case 1204: + case 1209: #line 3518 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = "<>"; ;} break; - case 1205: + case 1210: #line 3522 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeString((yyvsp[(1) - (1)].str))); ;} break; - case 1206: + case 1211: #line 3524 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(3) - (4)].list); ;} break; - case 1207: + case 1212: #line 3529 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeString((yyvsp[(1) - (1)].str))); ;} break; - case 1208: + case 1213: #line 3531 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(3) - (4)].list); ;} break; - case 1209: + case 1214: #line 3536 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeString((yyvsp[(1) - (1)].str))); ;} break; - case 1210: + case 1215: #line 3538 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(3) - (4)].list); ;} break; - case 1211: + case 1216: #line 3540 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeString("~~")); ;} break; - case 1212: + case 1217: #line 3542 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeString("!~~")); ;} break; - case 1213: + case 1218: #line 3544 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeString("~~~")); ;} break; - case 1214: + case 1219: #line 3546 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeString("!~~~")); ;} break; - case 1215: + case 1220: #line 3548 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeString("~~*")); ;} break; - case 1216: + case 1221: #line 3550 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeString("!~~*")); ;} break; - case 1217: + case 1222: #line 3564 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeString((yyvsp[(1) - (1)].str))); ;} break; - case 1218: + case 1223: #line 3566 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lcons(makeString((yyvsp[(1) - (3)].str)), (yyvsp[(3) - (3)].list)); ;} break; - case 1219: + case 1224: #line 3571 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 1220: + case 1225: #line 3575 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; - case 1221: + case 1226: #line 3582 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 1222: + case 1227: #line 3587 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (2)].list); ;} break; - case 1223: + case 1228: #line 3593 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 1224: + case 1229: #line 3597 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; - case 1225: + case 1230: #line 3604 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 1226: + case 1231: #line 3609 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (2)].list); ;} break; - case 1227: + case 1232: #line 3616 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 1228: + case 1233: #line 3620 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NULL; ;} break; - case 1229: + case 1234: #line 3629 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 1230: + case 1235: #line 3633 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; - case 1231: + case 1236: #line 3639 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 1232: + case 1237: #line 3643 "third_party/libpg_query/grammar/statements/select.y" { PGNamedArgExpr *na = makeNode(PGNamedArgExpr); @@ -30174,7 +30332,7 @@ YYLTYPE yylloc; ;} break; - case 1233: + case 1238: #line 3652 "third_party/libpg_query/grammar/statements/select.y" { PGNamedArgExpr *na = makeNode(PGNamedArgExpr); @@ -30186,140 +30344,140 @@ YYLTYPE yylloc; ;} break; - case 1234: + case 1239: #line 3662 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].typnam)); ;} break; - case 1235: + case 1240: #line 3663 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].typnam)); ;} break; - case 1236: + case 1241: #line 3668 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make2(makeStringConst((yyvsp[(1) - (3)].str), (yylsp[(1) - (3)])), (yyvsp[(3) - (3)].node)); ;} break; - case 1237: + case 1242: #line 3671 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 1238: + case 1243: #line 3678 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1239: + case 1244: #line 3679 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (char*) "year"; ;} break; - case 1240: + case 1245: #line 3680 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (char*) "month"; ;} break; - case 1241: + case 1246: #line 3681 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (char*) "day"; ;} break; - case 1242: + case 1247: #line 3682 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (char*) "hour"; ;} break; - case 1243: + case 1248: #line 3683 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (char*) "minute"; ;} break; - case 1244: + case 1249: #line 3684 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (char*) "second"; ;} break; - case 1245: + case 1250: #line 3685 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (char*) "millisecond"; ;} break; - case 1246: + case 1251: #line 3686 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (char*) "microsecond"; ;} break; - case 1247: + case 1252: #line 3687 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (char*) "week"; ;} break; - case 1248: + case 1253: #line 3688 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (char*) "quarter"; ;} break; - case 1249: + case 1254: #line 3689 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (char*) "decade"; ;} break; - case 1250: + case 1255: #line 3690 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (char*) "century"; ;} break; - case 1251: + case 1256: #line 3691 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (char*) "millennium"; ;} break; - case 1252: + case 1257: #line 3692 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1253: + case 1258: #line 3703 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make4((yyvsp[(1) - (4)].node), (yyvsp[(2) - (4)].node), (yyvsp[(3) - (4)].node), (yyvsp[(4) - (4)].node)); ;} break; - case 1254: + case 1259: #line 3707 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make3((yyvsp[(1) - (3)].node), (yyvsp[(2) - (3)].node), (yyvsp[(3) - (3)].node)); ;} break; - case 1255: + case 1260: #line 3714 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; - case 1256: + case 1261: #line 3720 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make2((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); ;} break; - case 1257: + case 1262: #line 3721 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 1258: + case 1263: #line 3738 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make3((yyvsp[(1) - (3)].node), (yyvsp[(2) - (3)].node), (yyvsp[(3) - (3)].node)); ;} break; - case 1259: + case 1264: #line 3742 "third_party/libpg_query/grammar/statements/select.y" { /* not legal per SQL99, but might as well allow it */ @@ -30327,14 +30485,14 @@ YYLTYPE yylloc; ;} break; - case 1260: + case 1265: #line 3747 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make2((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].node)); ;} break; - case 1261: + case 1266: #line 3751 "third_party/libpg_query/grammar/statements/select.y" { /* @@ -30352,44 +30510,44 @@ YYLTYPE yylloc; ;} break; - case 1262: + case 1267: #line 3766 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 1263: + case 1268: #line 3770 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 1264: + case 1269: #line 3774 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; - case 1265: + case 1270: #line 3777 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; - case 1266: + case 1271: #line 3780 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(3) - (3)].list), (yyvsp[(1) - (3)].node)); ;} break; - case 1267: + case 1272: #line 3781 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(2) - (2)].list); ;} break; - case 1268: + case 1273: #line 3782 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 1269: + case 1274: #line 3786 "third_party/libpg_query/grammar/statements/select.y" { PGSubLink *n = makeNode(PGSubLink); @@ -30399,17 +30557,17 @@ YYLTYPE yylloc; ;} break; - case 1270: + case 1275: #line 3792 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *)(yyvsp[(2) - (3)].list); ;} break; - case 1272: + case 1277: #line 3794 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *)(yyvsp[(1) - (1)].node); ;} break; - case 1273: + case 1278: #line 3805 "third_party/libpg_query/grammar/statements/select.y" { PGCaseExpr *c = makeNode(PGCaseExpr); @@ -30422,17 +30580,17 @@ YYLTYPE yylloc; ;} break; - case 1274: + case 1279: #line 3818 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 1275: + case 1280: #line 3819 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].node)); ;} break; - case 1276: + case 1281: #line 3824 "third_party/libpg_query/grammar/statements/select.y" { PGCaseWhen *w = makeNode(PGCaseWhen); @@ -30443,48 +30601,48 @@ YYLTYPE yylloc; ;} break; - case 1277: + case 1282: #line 3834 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; - case 1278: + case 1283: #line 3835 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = NULL; ;} break; - case 1279: + case 1284: #line 3838 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 1280: + case 1285: #line 3839 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = NULL; ;} break; - case 1281: + case 1286: #line 3848 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeColumnRef((yyvsp[(1) - (1)].str), NIL, (yylsp[(1) - (1)]), yyscanner); ;} break; - case 1282: + case 1287: #line 3854 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeColumnRef((yyvsp[(1) - (1)].str), NIL, (yylsp[(1) - (1)]), yyscanner); ;} break; - case 1283: + case 1288: #line 3858 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeColumnRef((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].list), (yylsp[(1) - (2)]), yyscanner); ;} break; - case 1284: + case 1289: #line 3865 "third_party/libpg_query/grammar/statements/select.y" { PGAIndices *ai = makeNode(PGAIndices); @@ -30495,7 +30653,7 @@ YYLTYPE yylloc; ;} break; - case 1285: + case 1290: #line 3873 "third_party/libpg_query/grammar/statements/select.y" { PGAIndices *ai = makeNode(PGAIndices); @@ -30506,7 +30664,7 @@ YYLTYPE yylloc; ;} break; - case 1286: + case 1291: #line 3880 "third_party/libpg_query/grammar/statements/select.y" { PGAIndices *ai = makeNode(PGAIndices); @@ -30518,7 +30676,7 @@ YYLTYPE yylloc; ;} break; - case 1287: + case 1292: #line 3888 "third_party/libpg_query/grammar/statements/select.y" { PGAIndices *ai = makeNode(PGAIndices); @@ -30529,42 +30687,42 @@ YYLTYPE yylloc; ;} break; - case 1288: + case 1293: #line 3898 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 1289: + case 1294: #line 3899 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = NULL; ;} break; - case 1290: + case 1295: #line 3904 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 1291: + case 1296: #line 3905 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].node)); ;} break; - case 1292: + case 1297: #line 3909 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NULL; ;} break; - case 1293: + case 1298: #line 3910 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(NULL); ;} break; - case 1294: + case 1299: #line 3911 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(2) - (3)].list); ;} break; - case 1295: + case 1300: #line 3916 "third_party/libpg_query/grammar/statements/select.y" { if ((yyvsp[(3) - (3)].list)) { @@ -30576,7 +30734,7 @@ YYLTYPE yylloc; ;} break; - case 1296: + case 1301: #line 3925 "third_party/libpg_query/grammar/statements/select.y" { PGAIndices *ai = makeNode(PGAIndices); @@ -30587,7 +30745,7 @@ YYLTYPE yylloc; ;} break; - case 1297: + case 1302: #line 3933 "third_party/libpg_query/grammar/statements/select.y" { PGAIndices *ai = makeNode(PGAIndices); @@ -30598,7 +30756,7 @@ YYLTYPE yylloc; ;} break; - case 1298: + case 1303: #line 3940 "third_party/libpg_query/grammar/statements/select.y" { PGAIndices *ai = makeNode(PGAIndices); @@ -30610,7 +30768,7 @@ YYLTYPE yylloc; ;} break; - case 1299: + case 1304: #line 3949 "third_party/libpg_query/grammar/statements/select.y" { PGAIndices *ai = makeNode(PGAIndices); @@ -30621,47 +30779,47 @@ YYLTYPE yylloc; ;} break; - case 1300: + case 1305: #line 3964 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 1301: + case 1306: #line 3965 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].node)); ;} break; - case 1304: + case 1309: #line 3981 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 1305: + case 1310: #line 3982 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 1306: + case 1311: #line 3986 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].target)); ;} break; - case 1307: + case 1312: #line 3987 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].target)); ;} break; - case 1308: + case 1313: #line 3991 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 1309: + case 1314: #line 3992 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (2)].list); ;} break; - case 1310: + case 1315: #line 3996 "third_party/libpg_query/grammar/statements/select.y" { (yyval.target) = makeNode(PGResTarget); @@ -30672,7 +30830,7 @@ YYLTYPE yylloc; ;} break; - case 1311: + case 1316: #line 4012 "third_party/libpg_query/grammar/statements/select.y" { (yyval.target) = makeNode(PGResTarget); @@ -30683,7 +30841,7 @@ YYLTYPE yylloc; ;} break; - case 1312: + case 1317: #line 4020 "third_party/libpg_query/grammar/statements/select.y" { (yyval.target) = makeNode(PGResTarget); @@ -30694,7 +30852,7 @@ YYLTYPE yylloc; ;} break; - case 1313: + case 1318: #line 4028 "third_party/libpg_query/grammar/statements/select.y" { (yyval.target) = makeNode(PGResTarget); @@ -30705,191 +30863,191 @@ YYLTYPE yylloc; ;} break; - case 1314: + case 1319: #line 4037 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(3) - (4)].list); ;} break; - case 1315: + case 1320: #line 4038 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(2) - (2)].list)); ;} break; - case 1316: + case 1321: #line 4043 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].str)); ;} break; - case 1317: + case 1322: #line 4047 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].str)); ;} break; - case 1318: + case 1323: #line 4053 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].list)); ;} break; - case 1319: + case 1324: #line 4055 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].list)); ;} break; - case 1320: + case 1325: #line 4059 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 1321: + case 1326: #line 4060 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (2)].list); ;} break; - case 1322: + case 1327: #line 4064 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 1323: + case 1328: #line 4065 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NULL; ;} break; - case 1324: + case 1329: #line 4068 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make2((yyvsp[(1) - (3)].node), makeString((yyvsp[(3) - (3)].str))); ;} break; - case 1325: + case 1330: #line 4072 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].list)); ;} break; - case 1326: + case 1331: #line 4073 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].list)); ;} break; - case 1327: + case 1332: #line 4077 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 1328: + case 1333: #line 4078 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (2)].list); ;} break; - case 1329: + case 1334: #line 4081 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(3) - (4)].list); ;} break; - case 1330: + case 1335: #line 4082 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(2) - (2)].list)); ;} break; - case 1331: + case 1336: #line 4083 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NULL; ;} break; - case 1332: + case 1337: #line 4086 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make2((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].str)); ;} break; - case 1333: + case 1338: #line 4090 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].list)); ;} break; - case 1334: + case 1339: #line 4091 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].list)); ;} break; - case 1335: + case 1340: #line 4095 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 1336: + case 1341: #line 4096 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (2)].list); ;} break; - case 1337: + case 1342: #line 4098 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(3) - (4)].list); ;} break; - case 1338: + case 1343: #line 4099 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(2) - (2)].list)); ;} break; - case 1339: + case 1344: #line 4100 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NULL; ;} break; - case 1340: + case 1345: #line 4110 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].range)); ;} break; - case 1341: + case 1346: #line 4111 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].range)); ;} break; - case 1342: + case 1347: #line 4116 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeString((yyvsp[(1) - (1)].str))); ;} break; - case 1343: + case 1348: #line 4118 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), makeString((yyvsp[(3) - (3)].str))); ;} break; - case 1344: + case 1349: #line 4123 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 1345: + case 1350: #line 4124 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (2)].list); ;} break; - case 1346: + case 1351: #line 4128 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 1347: + case 1352: #line 4129 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(2) - (3)].list); ;} break; - case 1348: + case 1353: #line 4132 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1349: + case 1354: #line 4144 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeString((yyvsp[(1) - (1)].str))); ;} break; - case 1350: + case 1355: #line 4147 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = check_func_name(lcons(makeString((yyvsp[(1) - (2)].str)), (yyvsp[(2) - (2)].list)), @@ -30897,21 +31055,21 @@ YYLTYPE yylloc; ;} break; - case 1351: + case 1356: #line 4158 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeIntConst((yyvsp[(1) - (1)].ival), (yylsp[(1) - (1)])); ;} break; - case 1352: + case 1357: #line 4162 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeFloatConst((yyvsp[(1) - (1)].str), (yylsp[(1) - (1)])); ;} break; - case 1353: + case 1358: #line 4166 "third_party/libpg_query/grammar/statements/select.y" { if ((yyvsp[(2) - (2)].list)) @@ -30926,14 +31084,14 @@ YYLTYPE yylloc; ;} break; - case 1354: + case 1359: #line 4178 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeBitStringConst((yyvsp[(1) - (1)].str), (yylsp[(1) - (1)])); ;} break; - case 1355: + case 1360: #line 4182 "third_party/libpg_query/grammar/statements/select.y" { /* This is a bit constant per SQL99: @@ -30945,7 +31103,7 @@ YYLTYPE yylloc; ;} break; - case 1356: + case 1361: #line 4191 "third_party/libpg_query/grammar/statements/select.y" { /* generic type 'literal' syntax */ @@ -30955,7 +31113,7 @@ YYLTYPE yylloc; ;} break; - case 1357: + case 1362: #line 4198 "third_party/libpg_query/grammar/statements/select.y" { /* generic syntax with a type modifier */ @@ -30996,146 +31154,146 @@ YYLTYPE yylloc; ;} break; - case 1358: + case 1363: #line 4236 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeStringConstCast((yyvsp[(2) - (2)].str), (yylsp[(2) - (2)]), (yyvsp[(1) - (2)].typnam)); ;} break; - case 1359: + case 1364: #line 4240 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeIntervalNode((yyvsp[(3) - (5)].node), (yylsp[(3) - (5)]), (yyvsp[(5) - (5)].list)); ;} break; - case 1360: + case 1365: #line 4244 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeIntervalNode((yyvsp[(2) - (3)].ival), (yylsp[(2) - (3)]), (yyvsp[(3) - (3)].list)); ;} break; - case 1361: + case 1366: #line 4248 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeIntervalNode((yyvsp[(2) - (3)].str), (yylsp[(2) - (3)]), (yyvsp[(3) - (3)].list)); ;} break; - case 1362: + case 1367: #line 4252 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeBoolAConst(true, (yylsp[(1) - (1)])); ;} break; - case 1363: + case 1368: #line 4256 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeBoolAConst(false, (yylsp[(1) - (1)])); ;} break; - case 1364: + case 1369: #line 4260 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeNullAConst((yylsp[(1) - (1)])); ;} break; - case 1365: + case 1370: #line 4265 "third_party/libpg_query/grammar/statements/select.y" { (yyval.ival) = (yyvsp[(1) - (1)].ival); ;} break; - case 1366: + case 1371: #line 4282 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1367: + case 1372: #line 4283 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} break; - case 1368: + case 1373: #line 4284 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} break; - case 1369: + case 1374: #line 4287 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1370: + case 1375: #line 4288 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} break; - case 1371: + case 1376: #line 4289 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} break; - case 1372: + case 1377: #line 4292 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1373: + case 1378: #line 4293 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} break; - case 1374: + case 1379: #line 4294 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} break; - case 1375: + case 1380: #line 4297 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeString((yyvsp[(1) - (1)].str))); ;} break; - case 1376: + case 1381: #line 4298 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lcons(makeString((yyvsp[(1) - (2)].str)), (yyvsp[(2) - (2)].list)); ;} break; - case 1377: + case 1382: #line 4302 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeString((yyvsp[(2) - (2)].str))); ;} break; - case 1378: + case 1383: #line 4304 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), makeString((yyvsp[(3) - (3)].str))); ;} break; - case 1379: + case 1384: #line 4308 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(2) - (3)].list); ;} break; - case 1380: + case 1385: #line 4309 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 1382: + case 1387: #line 4316 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1383: + case 1388: #line 4317 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1384: + case 1389: #line 8 "third_party/libpg_query/grammar/statements/prepare.y" { PGPrepareStmt *n = makeNode(PGPrepareStmt); @@ -31146,17 +31304,17 @@ YYLTYPE yylloc; ;} break; - case 1385: + case 1390: #line 18 "third_party/libpg_query/grammar/statements/prepare.y" { (yyval.list) = (yyvsp[(2) - (3)].list); ;} break; - case 1386: + case 1391: #line 19 "third_party/libpg_query/grammar/statements/prepare.y" { (yyval.list) = NIL; ;} break; - case 1393: + case 1398: #line 8 "third_party/libpg_query/grammar/statements/create_schema.y" { PGCreateSchemaStmt *n = makeNode(PGCreateSchemaStmt); @@ -31178,7 +31336,7 @@ YYLTYPE yylloc; ;} break; - case 1394: + case 1399: #line 27 "third_party/libpg_query/grammar/statements/create_schema.y" { PGCreateSchemaStmt *n = makeNode(PGCreateSchemaStmt); @@ -31205,7 +31363,7 @@ YYLTYPE yylloc; ;} break; - case 1395: + case 1400: #line 51 "third_party/libpg_query/grammar/statements/create_schema.y" { PGCreateSchemaStmt *n = makeNode(PGCreateSchemaStmt); @@ -31227,7 +31385,7 @@ YYLTYPE yylloc; ;} break; - case 1396: + case 1401: #line 74 "third_party/libpg_query/grammar/statements/create_schema.y" { if ((yyloc) < 0) /* see comments for YYLLOC_DEFAULT */ @@ -31236,12 +31394,12 @@ YYLTYPE yylloc; ;} break; - case 1397: + case 1402: #line 80 "third_party/libpg_query/grammar/statements/create_schema.y" { (yyval.list) = NIL; ;} break; - case 1402: + case 1407: #line 11 "third_party/libpg_query/grammar/statements/index.y" { PGIndexStmt *n = makeNode(PGIndexStmt); @@ -31267,7 +31425,7 @@ YYLTYPE yylloc; ;} break; - case 1403: + case 1408: #line 36 "third_party/libpg_query/grammar/statements/index.y" { PGIndexStmt *n = makeNode(PGIndexStmt); @@ -31293,62 +31451,62 @@ YYLTYPE yylloc; ;} break; - case 1404: + case 1409: #line 62 "third_party/libpg_query/grammar/statements/index.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1405: + case 1410: #line 66 "third_party/libpg_query/grammar/statements/index.y" { (yyval.str) = (yyvsp[(2) - (2)].str); ;} break; - case 1406: + case 1411: #line 67 "third_party/libpg_query/grammar/statements/index.y" { (yyval.str) = (char*) DEFAULT_INDEX_TYPE; ;} break; - case 1407: + case 1412: #line 72 "third_party/libpg_query/grammar/statements/index.y" { (yyval.boolean) = true; ;} break; - case 1408: + case 1413: #line 73 "third_party/libpg_query/grammar/statements/index.y" { (yyval.boolean) = false; ;} break; - case 1409: + case 1414: #line 78 "third_party/libpg_query/grammar/statements/index.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1410: + case 1415: #line 79 "third_party/libpg_query/grammar/statements/index.y" { (yyval.str) = NULL; ;} break; - case 1411: + case 1416: #line 83 "third_party/libpg_query/grammar/statements/index.y" { (yyval.list) = (yyvsp[(2) - (2)].list); ;} break; - case 1412: + case 1417: #line 84 "third_party/libpg_query/grammar/statements/index.y" { (yyval.list) = NIL; ;} break; - case 1413: + case 1418: #line 89 "third_party/libpg_query/grammar/statements/index.y" { (yyval.boolean) = true; ;} break; - case 1414: + case 1419: #line 90 "third_party/libpg_query/grammar/statements/index.y" { (yyval.boolean) = false; ;} break; - case 1415: + case 1420: #line 8 "third_party/libpg_query/grammar/statements/alter_schema.y" { PGAlterObjectSchemaStmt *n = makeNode(PGAlterObjectSchemaStmt); @@ -31360,7 +31518,7 @@ YYLTYPE yylloc; ;} break; - case 1416: + case 1421: #line 17 "third_party/libpg_query/grammar/statements/alter_schema.y" { PGAlterObjectSchemaStmt *n = makeNode(PGAlterObjectSchemaStmt); @@ -31372,7 +31530,7 @@ YYLTYPE yylloc; ;} break; - case 1417: + case 1422: #line 26 "third_party/libpg_query/grammar/statements/alter_schema.y" { PGAlterObjectSchemaStmt *n = makeNode(PGAlterObjectSchemaStmt); @@ -31384,7 +31542,7 @@ YYLTYPE yylloc; ;} break; - case 1418: + case 1423: #line 35 "third_party/libpg_query/grammar/statements/alter_schema.y" { PGAlterObjectSchemaStmt *n = makeNode(PGAlterObjectSchemaStmt); @@ -31396,7 +31554,7 @@ YYLTYPE yylloc; ;} break; - case 1419: + case 1424: #line 44 "third_party/libpg_query/grammar/statements/alter_schema.y" { PGAlterObjectSchemaStmt *n = makeNode(PGAlterObjectSchemaStmt); @@ -31408,7 +31566,7 @@ YYLTYPE yylloc; ;} break; - case 1420: + case 1425: #line 53 "third_party/libpg_query/grammar/statements/alter_schema.y" { PGAlterObjectSchemaStmt *n = makeNode(PGAlterObjectSchemaStmt); @@ -31420,7 +31578,7 @@ YYLTYPE yylloc; ;} break; - case 1421: + case 1426: #line 6 "third_party/libpg_query/grammar/statements/checkpoint.y" { PGCheckPointStmt *n = makeNode(PGCheckPointStmt); @@ -31430,7 +31588,7 @@ YYLTYPE yylloc; ;} break; - case 1422: + case 1427: #line 13 "third_party/libpg_query/grammar/statements/checkpoint.y" { PGCheckPointStmt *n = makeNode(PGCheckPointStmt); @@ -31440,17 +31598,17 @@ YYLTYPE yylloc; ;} break; - case 1423: + case 1428: #line 22 "third_party/libpg_query/grammar/statements/checkpoint.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1424: + case 1429: #line 23 "third_party/libpg_query/grammar/statements/checkpoint.y" { (yyval.str) = NULL; ;} break; - case 1425: + case 1430: #line 8 "third_party/libpg_query/grammar/statements/comment_on.y" { PGCommentOnStmt *n = makeNode(PGCommentOnStmt); @@ -31461,7 +31619,7 @@ YYLTYPE yylloc; ;} break; - case 1426: + case 1431: #line 16 "third_party/libpg_query/grammar/statements/comment_on.y" { PGCommentOnStmt *n = makeNode(PGCommentOnStmt); @@ -31472,67 +31630,67 @@ YYLTYPE yylloc; ;} break; - case 1427: + case 1432: #line 26 "third_party/libpg_query/grammar/statements/comment_on.y" { (yyval.node) = makeStringConst((yyvsp[(1) - (1)].str), (yylsp[(1) - (1)])); ;} break; - case 1428: + case 1433: #line 27 "third_party/libpg_query/grammar/statements/comment_on.y" { (yyval.node) = makeNullAConst((yylsp[(1) - (1)])); ;} break; - case 1429: + case 1434: #line 30 "third_party/libpg_query/grammar/statements/comment_on.y" { (yyval.objtype) = PG_OBJECT_TABLE; ;} break; - case 1430: + case 1435: #line 31 "third_party/libpg_query/grammar/statements/comment_on.y" { (yyval.objtype) = PG_OBJECT_SEQUENCE; ;} break; - case 1431: + case 1436: #line 32 "third_party/libpg_query/grammar/statements/comment_on.y" { (yyval.objtype) = PG_OBJECT_FUNCTION; ;} break; - case 1432: + case 1437: #line 33 "third_party/libpg_query/grammar/statements/comment_on.y" { (yyval.objtype) = PG_OBJECT_FUNCTION; ;} break; - case 1433: + case 1438: #line 34 "third_party/libpg_query/grammar/statements/comment_on.y" { (yyval.objtype) = PG_OBJECT_TABLE_MACRO; ;} break; - case 1434: + case 1439: #line 35 "third_party/libpg_query/grammar/statements/comment_on.y" { (yyval.objtype) = PG_OBJECT_VIEW; ;} break; - case 1435: + case 1440: #line 36 "third_party/libpg_query/grammar/statements/comment_on.y" { (yyval.objtype) = PG_OBJECT_DATABASE; ;} break; - case 1436: + case 1441: #line 37 "third_party/libpg_query/grammar/statements/comment_on.y" { (yyval.objtype) = PG_OBJECT_INDEX; ;} break; - case 1437: + case 1442: #line 38 "third_party/libpg_query/grammar/statements/comment_on.y" { (yyval.objtype) = PG_OBJECT_SCHEMA; ;} break; - case 1438: + case 1443: #line 39 "third_party/libpg_query/grammar/statements/comment_on.y" { (yyval.objtype) = PG_OBJECT_TYPE; ;} break; - case 1439: + case 1444: #line 8 "third_party/libpg_query/grammar/statements/export.y" { PGExportStmt *n = makeNode(PGExportStmt); @@ -31546,7 +31704,7 @@ YYLTYPE yylloc; ;} break; - case 1440: + case 1445: #line 20 "third_party/libpg_query/grammar/statements/export.y" { PGExportStmt *n = makeNode(PGExportStmt); @@ -31560,7 +31718,7 @@ YYLTYPE yylloc; ;} break; - case 1441: + case 1446: #line 34 "third_party/libpg_query/grammar/statements/export.y" { PGImportStmt *n = makeNode(PGImportStmt); @@ -31569,7 +31727,7 @@ YYLTYPE yylloc; ;} break; - case 1442: + case 1447: #line 10 "third_party/libpg_query/grammar/statements/explain.y" { PGExplainStmt *n = makeNode(PGExplainStmt); @@ -31579,7 +31737,7 @@ YYLTYPE yylloc; ;} break; - case 1443: + case 1448: #line 17 "third_party/libpg_query/grammar/statements/explain.y" { PGExplainStmt *n = makeNode(PGExplainStmt); @@ -31592,7 +31750,7 @@ YYLTYPE yylloc; ;} break; - case 1444: + case 1449: #line 27 "third_party/libpg_query/grammar/statements/explain.y" { PGExplainStmt *n = makeNode(PGExplainStmt); @@ -31602,7 +31760,7 @@ YYLTYPE yylloc; ;} break; - case 1445: + case 1450: #line 34 "third_party/libpg_query/grammar/statements/explain.y" { PGExplainStmt *n = makeNode(PGExplainStmt); @@ -31612,118 +31770,118 @@ YYLTYPE yylloc; ;} break; - case 1446: + case 1451: #line 44 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.boolean) = true; ;} break; - case 1447: + case 1452: #line 45 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.boolean) = false; ;} break; - case 1448: + case 1453: #line 50 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.node) = (PGNode *) makeString((yyvsp[(1) - (1)].str)); ;} break; - case 1449: + case 1454: #line 51 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.node) = (PGNode *) (yyvsp[(1) - (1)].value); ;} break; - case 1450: + case 1455: #line 52 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.node) = NULL; ;} break; - case 1483: + case 1488: #line 92 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1484: + case 1489: #line 93 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} break; - case 1485: + case 1490: #line 94 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} break; - case 1486: + case 1491: #line 99 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1487: + case 1492: #line 100 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1488: + case 1493: #line 106 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].defelt)); ;} break; - case 1489: + case 1494: #line 110 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].defelt)); ;} break; - case 1490: + case 1495: #line 117 "third_party/libpg_query/grammar/statements/explain.y" {;} break; - case 1491: + case 1496: #line 118 "third_party/libpg_query/grammar/statements/explain.y" {;} break; - case 1492: + case 1497: #line 123 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.str) = (char*) "true"; ;} break; - case 1493: + case 1498: #line 124 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.str) = (char*) "false"; ;} break; - case 1494: + case 1499: #line 125 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.str) = (char*) "on"; ;} break; - case 1495: + case 1500: #line 131 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1496: + case 1501: #line 137 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.defelt) = makeDefElem((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} break; - case 1497: + case 1502: #line 144 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1498: + case 1503: #line 145 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.str) = (char*) "analyze"; ;} break; - case 1499: + case 1504: #line 11 "third_party/libpg_query/grammar/statements/variable_set.y" { PGVariableSetStmt *n = (yyvsp[(2) - (2)].vsetstmt); @@ -31732,7 +31890,7 @@ YYLTYPE yylloc; ;} break; - case 1500: + case 1505: #line 17 "third_party/libpg_query/grammar/statements/variable_set.y" { PGVariableSetStmt *n = (yyvsp[(3) - (3)].vsetstmt); @@ -31741,7 +31899,7 @@ YYLTYPE yylloc; ;} break; - case 1501: + case 1506: #line 23 "third_party/libpg_query/grammar/statements/variable_set.y" { PGVariableSetStmt *n = (yyvsp[(3) - (3)].vsetstmt); @@ -31750,7 +31908,7 @@ YYLTYPE yylloc; ;} break; - case 1502: + case 1507: #line 29 "third_party/libpg_query/grammar/statements/variable_set.y" { PGVariableSetStmt *n = (yyvsp[(3) - (3)].vsetstmt); @@ -31759,7 +31917,7 @@ YYLTYPE yylloc; ;} break; - case 1503: + case 1508: #line 35 "third_party/libpg_query/grammar/statements/variable_set.y" { PGVariableSetStmt *n = (yyvsp[(3) - (3)].vsetstmt); @@ -31768,12 +31926,12 @@ YYLTYPE yylloc; ;} break; - case 1504: + case 1509: #line 44 "third_party/libpg_query/grammar/statements/variable_set.y" {(yyval.vsetstmt) = (yyvsp[(1) - (1)].vsetstmt);;} break; - case 1505: + case 1510: #line 46 "third_party/libpg_query/grammar/statements/variable_set.y" { PGVariableSetStmt *n = makeNode(PGVariableSetStmt); @@ -31783,7 +31941,7 @@ YYLTYPE yylloc; ;} break; - case 1506: + case 1511: #line 54 "third_party/libpg_query/grammar/statements/variable_set.y" { PGVariableSetStmt *n = makeNode(PGVariableSetStmt); @@ -31797,7 +31955,7 @@ YYLTYPE yylloc; ;} break; - case 1507: + case 1512: #line 65 "third_party/libpg_query/grammar/statements/variable_set.y" { PGVariableSetStmt *n = makeNode(PGVariableSetStmt); @@ -31808,7 +31966,7 @@ YYLTYPE yylloc; ;} break; - case 1508: + case 1513: #line 77 "third_party/libpg_query/grammar/statements/variable_set.y" { PGVariableSetStmt *n = makeNode(PGVariableSetStmt); @@ -31819,7 +31977,7 @@ YYLTYPE yylloc; ;} break; - case 1509: + case 1514: #line 85 "third_party/libpg_query/grammar/statements/variable_set.y" { PGVariableSetStmt *n = makeNode(PGVariableSetStmt); @@ -31830,26 +31988,26 @@ YYLTYPE yylloc; ;} break; - case 1510: + case 1515: #line 96 "third_party/libpg_query/grammar/statements/variable_set.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 1511: + case 1516: #line 102 "third_party/libpg_query/grammar/statements/variable_set.y" { (yyval.node) = makeStringConst((yyvsp[(1) - (1)].str), (yylsp[(1) - (1)])); ;} break; - case 1512: + case 1517: #line 106 "third_party/libpg_query/grammar/statements/variable_set.y" { (yyval.node) = makeStringConst((yyvsp[(1) - (1)].str), (yylsp[(1) - (1)])); ;} break; - case 1513: + case 1518: #line 110 "third_party/libpg_query/grammar/statements/variable_set.y" { PGTypeName *t = (yyvsp[(1) - (3)].typnam); @@ -31867,7 +32025,7 @@ YYLTYPE yylloc; ;} break; - case 1514: + case 1519: #line 125 "third_party/libpg_query/grammar/statements/variable_set.y" { PGTypeName *t = (yyvsp[(1) - (5)].typnam); @@ -31877,32 +32035,32 @@ YYLTYPE yylloc; ;} break; - case 1515: + case 1520: #line 131 "third_party/libpg_query/grammar/statements/variable_set.y" { (yyval.node) = makeAConst((yyvsp[(1) - (1)].value), (yylsp[(1) - (1)])); ;} break; - case 1516: + case 1521: #line 132 "third_party/libpg_query/grammar/statements/variable_set.y" { (yyval.node) = NULL; ;} break; - case 1517: + case 1522: #line 133 "third_party/libpg_query/grammar/statements/variable_set.y" { (yyval.node) = NULL; ;} break; - case 1518: + case 1523: #line 137 "third_party/libpg_query/grammar/statements/variable_set.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 1519: + case 1524: #line 138 "third_party/libpg_query/grammar/statements/variable_set.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; - case 1520: + case 1525: #line 8 "third_party/libpg_query/grammar/statements/load.y" { PGLoadStmt *n = makeNode(PGLoadStmt); @@ -31915,7 +32073,7 @@ YYLTYPE yylloc; ;} break; - case 1521: + case 1526: #line 17 "third_party/libpg_query/grammar/statements/load.y" { PGLoadStmt *n = makeNode(PGLoadStmt); @@ -31928,7 +32086,7 @@ YYLTYPE yylloc; ;} break; - case 1522: + case 1527: #line 26 "third_party/libpg_query/grammar/statements/load.y" { PGLoadStmt *n = makeNode(PGLoadStmt); @@ -31941,7 +32099,7 @@ YYLTYPE yylloc; ;} break; - case 1523: + case 1528: #line 35 "third_party/libpg_query/grammar/statements/load.y" { PGLoadStmt *n = makeNode(PGLoadStmt); @@ -31954,42 +32112,42 @@ YYLTYPE yylloc; ;} break; - case 1524: + case 1529: #line 46 "third_party/libpg_query/grammar/statements/load.y" { (yyval.loadinstalltype) = PG_LOAD_TYPE_INSTALL; ;} break; - case 1525: + case 1530: #line 47 "third_party/libpg_query/grammar/statements/load.y" { (yyval.loadinstalltype) = PG_LOAD_TYPE_FORCE_INSTALL; ;} break; - case 1526: + case 1531: #line 49 "third_party/libpg_query/grammar/statements/load.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1527: + case 1532: #line 50 "third_party/libpg_query/grammar/statements/load.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1528: + case 1533: #line 53 "third_party/libpg_query/grammar/statements/load.y" { (yyval.str) = NULL; ;} break; - case 1529: + case 1534: #line 54 "third_party/libpg_query/grammar/statements/load.y" { (yyval.str) = (yyvsp[(2) - (2)].str); ;} break; - case 1530: + case 1535: #line 55 "third_party/libpg_query/grammar/statements/load.y" { (yyval.str) = (yyvsp[(2) - (2)].str); ;} break; - case 1531: + case 1536: #line 9 "third_party/libpg_query/grammar/statements/vacuum.y" { PGVacuumStmt *n = makeNode(PGVacuumStmt); @@ -32006,7 +32164,7 @@ YYLTYPE yylloc; ;} break; - case 1532: + case 1537: #line 23 "third_party/libpg_query/grammar/statements/vacuum.y" { PGVacuumStmt *n = makeNode(PGVacuumStmt); @@ -32023,7 +32181,7 @@ YYLTYPE yylloc; ;} break; - case 1533: + case 1538: #line 37 "third_party/libpg_query/grammar/statements/vacuum.y" { PGVacuumStmt *n = (PGVacuumStmt *) (yyvsp[(5) - (5)].node); @@ -32038,7 +32196,7 @@ YYLTYPE yylloc; ;} break; - case 1534: + case 1539: #line 49 "third_party/libpg_query/grammar/statements/vacuum.y" { PGVacuumStmt *n = makeNode(PGVacuumStmt); @@ -32049,7 +32207,7 @@ YYLTYPE yylloc; ;} break; - case 1535: + case 1540: #line 57 "third_party/libpg_query/grammar/statements/vacuum.y" { PGVacuumStmt *n = makeNode(PGVacuumStmt); @@ -32062,27 +32220,27 @@ YYLTYPE yylloc; ;} break; - case 1536: + case 1541: #line 70 "third_party/libpg_query/grammar/statements/vacuum.y" { (yyval.ival) = PG_VACOPT_ANALYZE; ;} break; - case 1537: + case 1542: #line 71 "third_party/libpg_query/grammar/statements/vacuum.y" { (yyval.ival) = PG_VACOPT_VERBOSE; ;} break; - case 1538: + case 1543: #line 72 "third_party/libpg_query/grammar/statements/vacuum.y" { (yyval.ival) = PG_VACOPT_FREEZE; ;} break; - case 1539: + case 1544: #line 73 "third_party/libpg_query/grammar/statements/vacuum.y" { (yyval.ival) = PG_VACOPT_FULL; ;} break; - case 1540: + case 1545: #line 75 "third_party/libpg_query/grammar/statements/vacuum.y" { if (strcmp((yyvsp[(1) - (1)].str), "disable_page_skipping") == 0) @@ -32095,37 +32253,37 @@ YYLTYPE yylloc; ;} break; - case 1541: + case 1546: #line 87 "third_party/libpg_query/grammar/statements/vacuum.y" { (yyval.boolean) = true; ;} break; - case 1542: + case 1547: #line 88 "third_party/libpg_query/grammar/statements/vacuum.y" { (yyval.boolean) = false; ;} break; - case 1543: + case 1548: #line 93 "third_party/libpg_query/grammar/statements/vacuum.y" { (yyval.ival) = (yyvsp[(1) - (1)].ival); ;} break; - case 1544: + case 1549: #line 94 "third_party/libpg_query/grammar/statements/vacuum.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) | (yyvsp[(3) - (3)].ival); ;} break; - case 1545: + case 1550: #line 98 "third_party/libpg_query/grammar/statements/vacuum.y" { (yyval.boolean) = true; ;} break; - case 1546: + case 1551: #line 99 "third_party/libpg_query/grammar/statements/vacuum.y" { (yyval.boolean) = false; ;} break; - case 1547: + case 1552: #line 9 "third_party/libpg_query/grammar/statements/delete.y" { PGDeleteStmt *n = makeNode(PGDeleteStmt); @@ -32138,7 +32296,7 @@ YYLTYPE yylloc; ;} break; - case 1548: + case 1553: #line 19 "third_party/libpg_query/grammar/statements/delete.y" { PGDeleteStmt *n = makeNode(PGDeleteStmt); @@ -32151,14 +32309,14 @@ YYLTYPE yylloc; ;} break; - case 1549: + case 1554: #line 32 "third_party/libpg_query/grammar/statements/delete.y" { (yyval.range) = (yyvsp[(1) - (1)].range); ;} break; - case 1550: + case 1555: #line 36 "third_party/libpg_query/grammar/statements/delete.y" { PGAlias *alias = makeNode(PGAlias); @@ -32168,7 +32326,7 @@ YYLTYPE yylloc; ;} break; - case 1551: + case 1556: #line 43 "third_party/libpg_query/grammar/statements/delete.y" { PGAlias *alias = makeNode(PGAlias); @@ -32178,27 +32336,27 @@ YYLTYPE yylloc; ;} break; - case 1552: + case 1557: #line 53 "third_party/libpg_query/grammar/statements/delete.y" { (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; - case 1553: + case 1558: #line 54 "third_party/libpg_query/grammar/statements/delete.y" { (yyval.node) = NULL; ;} break; - case 1554: + case 1559: #line 60 "third_party/libpg_query/grammar/statements/delete.y" { (yyval.list) = (yyvsp[(2) - (2)].list); ;} break; - case 1555: + case 1560: #line 61 "third_party/libpg_query/grammar/statements/delete.y" { (yyval.list) = NIL; ;} break; - case 1556: + case 1561: #line 10 "third_party/libpg_query/grammar/statements/analyze.y" { PGVacuumStmt *n = makeNode(PGVacuumStmt); @@ -32211,7 +32369,7 @@ YYLTYPE yylloc; ;} break; - case 1557: + case 1562: #line 20 "third_party/libpg_query/grammar/statements/analyze.y" { PGVacuumStmt *n = makeNode(PGVacuumStmt); @@ -32224,7 +32382,7 @@ YYLTYPE yylloc; ;} break; - case 1558: + case 1563: #line 8 "third_party/libpg_query/grammar/statements/attach.y" { PGAttachStmt *n = makeNode(PGAttachStmt); @@ -32236,7 +32394,7 @@ YYLTYPE yylloc; ;} break; - case 1559: + case 1564: #line 17 "third_party/libpg_query/grammar/statements/attach.y" { PGAttachStmt *n = makeNode(PGAttachStmt); @@ -32248,7 +32406,7 @@ YYLTYPE yylloc; ;} break; - case 1560: + case 1565: #line 26 "third_party/libpg_query/grammar/statements/attach.y" { PGAttachStmt *n = makeNode(PGAttachStmt); @@ -32260,7 +32418,7 @@ YYLTYPE yylloc; ;} break; - case 1561: + case 1566: #line 38 "third_party/libpg_query/grammar/statements/attach.y" { PGDetachStmt *n = makeNode(PGDetachStmt); @@ -32270,7 +32428,7 @@ YYLTYPE yylloc; ;} break; - case 1562: + case 1567: #line 45 "third_party/libpg_query/grammar/statements/attach.y" { PGDetachStmt *n = makeNode(PGDetachStmt); @@ -32280,7 +32438,7 @@ YYLTYPE yylloc; ;} break; - case 1563: + case 1568: #line 52 "third_party/libpg_query/grammar/statements/attach.y" { PGDetachStmt *n = makeNode(PGDetachStmt); @@ -32290,72 +32448,72 @@ YYLTYPE yylloc; ;} break; - case 1564: + case 1569: #line 60 "third_party/libpg_query/grammar/statements/attach.y" {;} break; - case 1565: + case 1570: #line 61 "third_party/libpg_query/grammar/statements/attach.y" {;} break; - case 1566: + case 1571: #line 65 "third_party/libpg_query/grammar/statements/attach.y" { (yyval.str) = (yyvsp[(2) - (2)].str); ;} break; - case 1567: + case 1572: #line 66 "third_party/libpg_query/grammar/statements/attach.y" { (yyval.str) = NULL; ;} break; - case 1568: + case 1573: #line 77 "third_party/libpg_query/grammar/statements/attach.y" { (yyval.node) = (PGNode *) (yyvsp[(1) - (1)].node); ;} break; - case 1569: + case 1574: #line 78 "third_party/libpg_query/grammar/statements/attach.y" { (yyval.node) = NULL; ;} break; - case 1570: + case 1575: #line 83 "third_party/libpg_query/grammar/statements/attach.y" { (yyval.defelt) = makeDefElem((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} break; - case 1571: + case 1576: #line 90 "third_party/libpg_query/grammar/statements/attach.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].defelt)); ;} break; - case 1572: + case 1577: #line 94 "third_party/libpg_query/grammar/statements/attach.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].defelt)); ;} break; - case 1573: + case 1578: #line 101 "third_party/libpg_query/grammar/statements/attach.y" { (yyval.list) = (yyvsp[(2) - (3)].list); ;} break; - case 1574: + case 1579: #line 105 "third_party/libpg_query/grammar/statements/attach.y" { (yyval.list) = NULL; ;} break; - case 1575: + case 1580: #line 3 "third_party/libpg_query/grammar/statements/variable_reset.y" { (yyvsp[(2) - (2)].vsetstmt)->scope = VAR_SET_SCOPE_DEFAULT; @@ -32363,7 +32521,7 @@ YYLTYPE yylloc; ;} break; - case 1576: + case 1581: #line 8 "third_party/libpg_query/grammar/statements/variable_reset.y" { (yyvsp[(3) - (3)].vsetstmt)->scope = VAR_SET_SCOPE_LOCAL; @@ -32371,7 +32529,7 @@ YYLTYPE yylloc; ;} break; - case 1577: + case 1582: #line 13 "third_party/libpg_query/grammar/statements/variable_reset.y" { (yyvsp[(3) - (3)].vsetstmt)->scope = VAR_SET_SCOPE_SESSION; @@ -32379,7 +32537,7 @@ YYLTYPE yylloc; ;} break; - case 1578: + case 1583: #line 18 "third_party/libpg_query/grammar/statements/variable_reset.y" { (yyvsp[(3) - (3)].vsetstmt)->scope = VAR_SET_SCOPE_GLOBAL; @@ -32387,7 +32545,7 @@ YYLTYPE yylloc; ;} break; - case 1579: + case 1584: #line 23 "third_party/libpg_query/grammar/statements/variable_reset.y" { (yyvsp[(3) - (3)].vsetstmt)->scope = VAR_SET_SCOPE_VARIABLE; @@ -32395,7 +32553,7 @@ YYLTYPE yylloc; ;} break; - case 1580: + case 1585: #line 32 "third_party/libpg_query/grammar/statements/variable_reset.y" { PGVariableSetStmt *n = makeNode(PGVariableSetStmt); @@ -32405,7 +32563,7 @@ YYLTYPE yylloc; ;} break; - case 1581: + case 1586: #line 39 "third_party/libpg_query/grammar/statements/variable_reset.y" { PGVariableSetStmt *n = makeNode(PGVariableSetStmt); @@ -32414,12 +32572,12 @@ YYLTYPE yylloc; ;} break; - case 1582: + case 1587: #line 48 "third_party/libpg_query/grammar/statements/variable_reset.y" { (yyval.vsetstmt) = (yyvsp[(1) - (1)].vsetstmt); ;} break; - case 1583: + case 1588: #line 50 "third_party/libpg_query/grammar/statements/variable_reset.y" { PGVariableSetStmt *n = makeNode(PGVariableSetStmt); @@ -32429,7 +32587,7 @@ YYLTYPE yylloc; ;} break; - case 1584: + case 1589: #line 57 "third_party/libpg_query/grammar/statements/variable_reset.y" { PGVariableSetStmt *n = makeNode(PGVariableSetStmt); @@ -32439,7 +32597,7 @@ YYLTYPE yylloc; ;} break; - case 1585: + case 1590: #line 3 "third_party/libpg_query/grammar/statements/variable_show.y" { PGVariableShowSelectStmt *n = makeNode(PGVariableShowSelectStmt); @@ -32450,7 +32608,7 @@ YYLTYPE yylloc; ;} break; - case 1586: + case 1591: #line 10 "third_party/libpg_query/grammar/statements/variable_show.y" { PGVariableShowSelectStmt *n = makeNode(PGVariableShowSelectStmt); @@ -32461,7 +32619,7 @@ YYLTYPE yylloc; ;} break; - case 1587: + case 1592: #line 18 "third_party/libpg_query/grammar/statements/variable_show.y" { PGVariableShowStmt *n = makeNode(PGVariableShowStmt); @@ -32471,7 +32629,7 @@ YYLTYPE yylloc; ;} break; - case 1588: + case 1593: #line 25 "third_party/libpg_query/grammar/statements/variable_show.y" { PGVariableShowStmt *n = makeNode(PGVariableShowStmt); @@ -32482,7 +32640,7 @@ YYLTYPE yylloc; ;} break; - case 1589: + case 1594: #line 33 "third_party/libpg_query/grammar/statements/variable_show.y" { PGVariableShowStmt *n = makeNode(PGVariableShowStmt); @@ -32492,7 +32650,7 @@ YYLTYPE yylloc; ;} break; - case 1590: + case 1595: #line 40 "third_party/libpg_query/grammar/statements/variable_show.y" { PGVariableShowStmt *n = makeNode(PGVariableShowStmt); @@ -32502,7 +32660,7 @@ YYLTYPE yylloc; ;} break; - case 1591: + case 1596: #line 47 "third_party/libpg_query/grammar/statements/variable_show.y" { PGVariableShowStmt *n = makeNode(PGVariableShowStmt); @@ -32512,7 +32670,7 @@ YYLTYPE yylloc; ;} break; - case 1592: + case 1597: #line 54 "third_party/libpg_query/grammar/statements/variable_show.y" { PGVariableShowStmt *n = makeNode(PGVariableShowStmt); @@ -32522,7 +32680,7 @@ YYLTYPE yylloc; ;} break; - case 1593: + case 1598: #line 61 "third_party/libpg_query/grammar/statements/variable_show.y" { PGVariableShowStmt *n = makeNode(PGVariableShowStmt); @@ -32532,17 +32690,17 @@ YYLTYPE yylloc; ;} break; - case 1600: + case 1605: #line 75 "third_party/libpg_query/grammar/statements/variable_show.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1601: + case 1606: #line 77 "third_party/libpg_query/grammar/statements/variable_show.y" { (yyval.str) = psprintf("%s.%s", (yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].str)); ;} break; - case 1602: + case 1607: #line 7 "third_party/libpg_query/grammar/statements/call.y" { PGCallStmt *n = makeNode(PGCallStmt); @@ -32551,7 +32709,7 @@ YYLTYPE yylloc; ;} break; - case 1603: + case 1608: #line 10 "third_party/libpg_query/grammar/statements/view.y" { PGViewStmt *n = makeNode(PGViewStmt); @@ -32566,7 +32724,7 @@ YYLTYPE yylloc; ;} break; - case 1604: + case 1609: #line 23 "third_party/libpg_query/grammar/statements/view.y" { PGViewStmt *n = makeNode(PGViewStmt); @@ -32581,7 +32739,7 @@ YYLTYPE yylloc; ;} break; - case 1605: + case 1610: #line 36 "third_party/libpg_query/grammar/statements/view.y" { PGViewStmt *n = makeNode(PGViewStmt); @@ -32596,7 +32754,7 @@ YYLTYPE yylloc; ;} break; - case 1606: + case 1611: #line 49 "third_party/libpg_query/grammar/statements/view.y" { PGViewStmt *n = makeNode(PGViewStmt); @@ -32616,7 +32774,7 @@ YYLTYPE yylloc; ;} break; - case 1607: + case 1612: #line 67 "third_party/libpg_query/grammar/statements/view.y" { PGViewStmt *n = makeNode(PGViewStmt); @@ -32636,27 +32794,27 @@ YYLTYPE yylloc; ;} break; - case 1608: + case 1613: #line 87 "third_party/libpg_query/grammar/statements/view.y" { (yyval.viewcheckoption) = CASCADED_CHECK_OPTION; ;} break; - case 1609: + case 1614: #line 88 "third_party/libpg_query/grammar/statements/view.y" { (yyval.viewcheckoption) = CASCADED_CHECK_OPTION; ;} break; - case 1610: + case 1615: #line 89 "third_party/libpg_query/grammar/statements/view.y" { (yyval.viewcheckoption) = PG_LOCAL_CHECK_OPTION; ;} break; - case 1611: + case 1616: #line 90 "third_party/libpg_query/grammar/statements/view.y" { (yyval.viewcheckoption) = PG_NO_CHECK_OPTION; ;} break; - case 1612: + case 1617: #line 12 "third_party/libpg_query/grammar/statements/create_as.y" { PGCreateTableAsStmt *ctas = makeNode(PGCreateTableAsStmt); @@ -32672,7 +32830,7 @@ YYLTYPE yylloc; ;} break; - case 1613: + case 1618: #line 25 "third_party/libpg_query/grammar/statements/create_as.y" { PGCreateTableAsStmt *ctas = makeNode(PGCreateTableAsStmt); @@ -32688,7 +32846,7 @@ YYLTYPE yylloc; ;} break; - case 1614: + case 1619: #line 38 "third_party/libpg_query/grammar/statements/create_as.y" { PGCreateTableAsStmt *ctas = makeNode(PGCreateTableAsStmt); @@ -32704,22 +32862,22 @@ YYLTYPE yylloc; ;} break; - case 1615: + case 1620: #line 54 "third_party/libpg_query/grammar/statements/create_as.y" { (yyval.boolean) = true; ;} break; - case 1616: + case 1621: #line 55 "third_party/libpg_query/grammar/statements/create_as.y" { (yyval.boolean) = false; ;} break; - case 1617: + case 1622: #line 56 "third_party/libpg_query/grammar/statements/create_as.y" { (yyval.boolean) = true; ;} break; - case 1618: + case 1623: #line 62 "third_party/libpg_query/grammar/statements/create_as.y" { (yyval.into) = makeNode(PGIntoClause); @@ -32734,7 +32892,7 @@ YYLTYPE yylloc; /* Line 1267 of yacc.c. */ -#line 32738 "third_party/libpg_query/grammar/grammar_out.cpp" +#line 32896 "third_party/libpg_query/grammar/grammar_out.cpp" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); diff --git a/src/duckdb/ub_src_function_scalar_generic.cpp b/src/duckdb/ub_src_function_scalar_generic.cpp index 926f394d3..6b6bbcb09 100644 --- a/src/duckdb/ub_src_function_scalar_generic.cpp +++ b/src/duckdb/ub_src_function_scalar_generic.cpp @@ -4,3 +4,5 @@ #include "src/function/scalar/generic/getvariable.cpp" +#include "src/function/scalar/generic/invoke.cpp" + diff --git a/src/duckdb/ub_src_main.cpp b/src/duckdb/ub_src_main.cpp index b8bc22b97..a133a012e 100644 --- a/src/duckdb/ub_src_main.cpp +++ b/src/duckdb/ub_src_main.cpp @@ -62,5 +62,7 @@ #include "src/main/stream_query_result.cpp" +#include "src/main/user_settings.cpp" + #include "src/main/valid_checker.cpp" diff --git a/src/duckdb/ub_src_main_settings.cpp b/src/duckdb/ub_src_main_settings.cpp index 6dbcd419e..c341379a7 100644 --- a/src/duckdb/ub_src_main_settings.cpp +++ b/src/duckdb/ub_src_main_settings.cpp @@ -2,3 +2,5 @@ #include "src/main/settings/autogenerated_settings.cpp" +#include "src/main/settings/settings.cpp" + diff --git a/src/duckdb/ub_src_optimizer_rule.cpp b/src/duckdb/ub_src_optimizer_rule.cpp index 343218acc..2a2c56c3c 100644 --- a/src/duckdb/ub_src_optimizer_rule.cpp +++ b/src/duckdb/ub_src_optimizer_rule.cpp @@ -38,5 +38,3 @@ #include "src/optimizer/rule/constant_order_normalization.cpp" -#include "src/optimizer/rule/not_elimination.cpp" - diff --git a/src/duckdb/ub_src_storage_table.cpp b/src/duckdb/ub_src_storage_table.cpp index 2a3777e94..e06c2d1cc 100644 --- a/src/duckdb/ub_src_storage_table.cpp +++ b/src/duckdb/ub_src_storage_table.cpp @@ -8,6 +8,8 @@ #include "src/storage/table/column_segment.cpp" +#include "src/storage/table/geo_column_data.cpp" + #include "src/storage/table/array_column_data.cpp" #include "src/storage/table/list_column_data.cpp" From 073ea68e2202468c583d5ef19f41422a716d67af Mon Sep 17 00:00:00 2001 From: DuckDB Labs GitHub Bot Date: Fri, 23 Jan 2026 08:56:00 +0000 Subject: [PATCH 02/16] Update vendored DuckDB sources to 3f41e38ba7 --- src/duckdb/src/function/table/version/pragma_version.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/duckdb/src/function/table/version/pragma_version.cpp b/src/duckdb/src/function/table/version/pragma_version.cpp index 86605bb64..a5f7d1896 100644 --- a/src/duckdb/src/function/table/version/pragma_version.cpp +++ b/src/duckdb/src/function/table/version/pragma_version.cpp @@ -1,5 +1,5 @@ #ifndef DUCKDB_PATCH_VERSION -#define DUCKDB_PATCH_VERSION "0-dev5756" +#define DUCKDB_PATCH_VERSION "0-dev5760" #endif #ifndef DUCKDB_MINOR_VERSION #define DUCKDB_MINOR_VERSION 5 @@ -8,10 +8,10 @@ #define DUCKDB_MAJOR_VERSION 1 #endif #ifndef DUCKDB_VERSION -#define DUCKDB_VERSION "v1.5.0-dev5756" +#define DUCKDB_VERSION "v1.5.0-dev5760" #endif #ifndef DUCKDB_SOURCE_ID -#define DUCKDB_SOURCE_ID "9612b5bea5" +#define DUCKDB_SOURCE_ID "3f41e38ba7" #endif #include "duckdb/function/table/system_functions.hpp" #include "duckdb/main/database.hpp" From f5acaa486d66d5b63354f6b0a71763ad8c996b38 Mon Sep 17 00:00:00 2001 From: DuckDB Labs GitHub Bot Date: Mon, 2 Feb 2026 07:09:03 +0000 Subject: [PATCH 03/16] Update vendored DuckDB sources to 5a115ef952 --- .../aggregate/algebraic/avg.cpp | 18 +- .../core_functions/function_list.cpp | 2 + .../scalar/generic_functions.hpp | 20 + .../core_functions/lambda_functions.cpp | 1 + .../core_functions/scalar/date/date_trunc.cpp | 3 +- .../scalar/generic/type_functions.cpp | 121 + .../core_functions/scalar/generic/typeof.cpp | 33 - .../scalar/list/list_filter.cpp | 1 + .../scalar/list/list_reduce.cpp | 2 + .../scalar/list/list_transform.cpp | 1 + src/duckdb/extension/icu/icu-makedate.cpp | 9 +- .../json/json_functions/json_create.cpp | 3 +- .../extension/parquet/column_writer.cpp | 3 + .../parquet/include/column_writer.hpp | 18 +- .../parquet/include/parquet_shredding.hpp | 2 +- .../include/reader/variant_column_reader.hpp | 1 + .../include/writer/list_column_writer.hpp | 3 +- .../writer/parquet_write_operators.hpp | 15 +- .../include/writer/parquet_write_stats.hpp | 13 +- .../writer/primitive_column_writer.hpp | 2 +- .../include/writer/struct_column_writer.hpp | 5 +- .../include/writer/variant_column_writer.hpp | 10 +- .../extension/parquet/parquet_extension.cpp | 6 +- .../extension/parquet/parquet_reader.cpp | 2 +- .../extension/parquet/parquet_shredding.cpp | 4 +- .../extension/parquet/parquet_statistics.cpp | 151 +- .../extension/parquet/parquet_writer.cpp | 92 +- .../reader/variant/variant_binary_decoder.cpp | 27 +- .../variant/variant_shredded_conversion.cpp | 11 +- .../parquet/reader/variant_column_reader.cpp | 69 + .../parquet/writer/list_column_writer.cpp | 9 +- .../writer/primitive_column_writer.cpp | 14 +- .../parquet/writer/struct_column_writer.cpp | 6 +- .../writer/variant/analyze_variant.cpp | 88 +- .../writer/variant/convert_variant.cpp | 18 +- .../aggregate_function_catalog_entry.cpp | 17 + .../catalog_entry/duck_table_entry.cpp | 21 +- .../scalar_function_catalog_entry.cpp | 4 +- .../catalog_entry/table_catalog_entry.cpp | 30 +- .../table_function_catalog_entry.cpp | 4 +- .../catalog_entry/view_catalog_entry.cpp | 108 +- src/duckdb/src/catalog/catalog_set.cpp | 22 +- .../src/catalog/default/default_functions.cpp | 2 +- .../src/catalog/default/default_types.cpp | 559 +- .../src/catalog/default/default_views.cpp | 2 +- src/duckdb/src/common/box_renderer.cpp | 57 +- .../src/common/encryption_functions.cpp | 11 +- .../src/common/encryption_key_manager.cpp | 16 +- src/duckdb/src/common/enum_util.cpp | 37 +- .../src/common/enums/expression_type.cpp | 4 + src/duckdb/src/common/error_data.cpp | 35 +- src/duckdb/src/common/extra_type_info.cpp | 96 +- src/duckdb/src/common/file_system.cpp | 44 +- src/duckdb/src/common/hive_partitioning.cpp | 29 +- src/duckdb/src/common/local_file_system.cpp | 313 +- .../src/common/multi_file/multi_file_list.cpp | 285 +- .../common/multi_file/multi_file_reader.cpp | 6 +- .../src/common/operator/cast_operators.cpp | 18 + src/duckdb/src/common/sort/sort.cpp | 4 +- src/duckdb/src/common/sort/sorted_run.cpp | 8 +- src/duckdb/src/common/thread_util.cpp | 14 +- src/duckdb/src/common/types.cpp | 325 +- .../types/row/partitioned_tuple_data.cpp | 4 +- src/duckdb/src/common/types/type_manager.cpp | 117 + src/duckdb/src/common/types/value.cpp | 67 +- src/duckdb/src/common/types/vector.cpp | 4 + .../vector_operations/is_distinct_from.cpp | 105 +- src/duckdb/src/common/virtual_file_system.cpp | 13 +- .../src/execution/aggregate_hashtable.cpp | 4 +- .../src/execution/column_binding_resolver.cpp | 55 +- .../expression_executor/execute_function.cpp | 10 + .../expression_executor/execute_operator.cpp | 7 + .../execution/expression_executor_state.cpp | 6 + src/duckdb/src/execution/index/art/art.cpp | 20 +- src/duckdb/src/execution/join_hashtable.cpp | 371 +- .../nested_loop_join_inner.cpp | 4 +- .../nested_loop_join_mark.cpp | 2 +- .../aggregate/physical_streaming_window.cpp | 12 +- .../operator/aggregate/physical_window.cpp | 2 +- .../csv_scanner/util/csv_reader_options.cpp | 2 +- .../operator/helper/physical_limit.cpp | 16 + .../helper/physical_limit_percent.cpp | 14 + .../helper/physical_streaming_limit.cpp | 19 + .../join/perfect_hash_join_executor.cpp | 12 +- .../operator/join/physical_asof_join.cpp | 20 +- .../join/physical_comparison_join.cpp | 69 +- .../operator/join/physical_hash_join.cpp | 301 +- .../operator/join/physical_iejoin.cpp | 181 +- .../join/physical_nested_loop_join.cpp | 37 +- .../join/physical_piecewise_merge_join.cpp | 40 +- .../operator/join/physical_range_join.cpp | 18 +- .../persistent/physical_copy_to_file.cpp | 62 +- .../operator/persistent/physical_delete.cpp | 74 +- .../operator/set/physical_recursive_cte.cpp | 14 + .../physical_plan/plan_asof_join.cpp | 93 +- .../physical_plan/plan_comparison_join.cpp | 8 +- .../physical_plan/plan_merge_into.cpp | 4 +- .../physical_plan/plan_recursive_cte.cpp | 4 + .../physical_plan/plan_set_operation.cpp | 22 +- .../aggregate/distributive/first_last_any.cpp | 29 +- .../src/function/cast/default_casts.cpp | 2 + src/duckdb/src/function/cast/list_casts.cpp | 2 +- src/duckdb/src/function/cast/map_cast.cpp | 2 +- src/duckdb/src/function/cast/type_cast.cpp | 15 + src/duckdb/src/function/copy_function.cpp | 8 +- src/duckdb/src/function/function_binder.cpp | 1 + .../src/function/pragma/pragma_queries.cpp | 2 +- .../src/function/scalar/generic/invoke.cpp | 1 + .../function/scalar/operator/arithmetic.cpp | 32 +- .../function/scalar/string/caseconvert.cpp | 24 +- .../scalar/system/aggregate_export.cpp | 6 +- .../scalar/variant/variant_extract.cpp | 5 + src/duckdb/src/function/table/copy_csv.cpp | 6 +- src/duckdb/src/function/table/glob.cpp | 2 + src/duckdb/src/function/table/read_file.cpp | 2 - src/duckdb/src/function/table/sniff_csv.cpp | 4 +- .../function/table/system/duckdb_columns.cpp | 26 +- .../table/system/duckdb_log_contexts.cpp | 5 +- .../function/table/system/duckdb_views.cpp | 92 +- .../table/system/pragma_table_info.cpp | 19 +- src/duckdb/src/function/table/table_scan.cpp | 4 +- .../function/table/version/pragma_version.cpp | 6 +- src/duckdb/src/function/table_function.cpp | 4 +- .../function/window/window_value_function.cpp | 35 +- src/duckdb/src/include/duckdb.h | 54 +- .../aggregate_function_catalog_entry.hpp | 13 +- .../catalog_entry/view_catalog_entry.hpp | 40 +- .../catalog/default/builtin_types/types.hpp | 104 - .../catalog/default/default_generator.hpp | 6 + .../duckdb/catalog/default/default_types.hpp | 1 + .../duckdb/common/encryption_key_manager.hpp | 6 + .../duckdb/common/enums/expression_type.hpp | 2 + .../duckdb/common/enums/memory_tag.hpp | 7 +- .../include/duckdb/common/extra_type_info.hpp | 44 +- .../include/duckdb/common/file_open_flags.hpp | 7 + .../src/include/duckdb/common/file_system.hpp | 14 +- .../duckdb/common/local_file_system.hpp | 13 +- .../src/include/duckdb/common/lru_cache.hpp | 38 +- .../common/multi_file/multi_file_function.hpp | 32 +- .../common/multi_file/multi_file_list.hpp | 157 +- .../duckdb/common/opener_file_system.hpp | 42 + .../duckdb/common/operator/cast_operators.hpp | 12 + .../include/duckdb/common/operator/negate.hpp | 34 + .../src/include/duckdb/common/thread.hpp | 6 +- .../src/include/duckdb/common/types.hpp | 35 +- .../duckdb/common/types/null_value.hpp | 5 +- .../duckdb/common/types/type_manager.hpp | 38 + .../src/include/duckdb/common/types/value.hpp | 8 + .../duckdb/common/virtual_file_system.hpp | 11 +- .../execution/expression_executor_state.hpp | 5 + .../duckdb/execution/index/art/prefix.hpp | 1 + .../duckdb/execution/join_hashtable.hpp | 64 +- .../operator/helper/physical_limit.hpp | 2 + .../helper/physical_limit_percent.hpp | 2 + .../helper/physical_streaming_limit.hpp | 2 + .../join/physical_comparison_join.hpp | 2 + .../operator/join/physical_hash_join.hpp | 39 +- .../join/physical_nested_loop_join.hpp | 3 - .../operator/join/physical_range_join.hpp | 4 +- .../duckdb/function/aggregate_function.hpp | 13 + .../duckdb/function/cast/default_casts.hpp | 1 + .../cast/variant/primitive_to_variant.hpp | 2 + .../variant/variant_value_convert.hpp | 11 +- .../function/window/window_value_function.hpp | 2 +- .../src/include/duckdb/main/appender.hpp | 24 +- .../duckdb/main/capi/extension_api.hpp | 7 +- .../include/duckdb/main/client_context.hpp | 18 +- src/duckdb/src/include/duckdb/main/config.hpp | 24 +- .../src/include/duckdb/main/connection.hpp | 4 +- .../main/extension_callback_manager.hpp | 79 + .../include/duckdb/main/extension_entries.hpp | 5 +- .../include/duckdb/main/extension_helper.hpp | 7 + .../src/include/duckdb/main/secret/secret.hpp | 2 +- .../duckdb/main/secret/secret_manager.hpp | 7 +- .../src/include/duckdb/main/settings.hpp | 66 +- .../join_order/query_graph_manager.hpp | 1 + .../duckdb/optimizer/optimizer_extension.hpp | 8 +- .../optimizer/topn_window_elimination.hpp | 1 + .../src/include/duckdb/parallel/pipeline.hpp | 1 + .../include/duckdb/parser/expression/list.hpp | 1 + .../parser/expression/type_expression.hpp | 66 + .../include/duckdb/parser/keyword_helper.hpp | 8 +- .../parser/parsed_data/alter_table_info.hpp | 44 +- .../parser/parsed_data/create_type_info.hpp | 34 +- .../parser/parsed_data/create_view_info.hpp | 7 +- .../duckdb/parser/parser_extension.hpp | 3 + .../include/duckdb/parser/parser_options.hpp | 4 +- .../src/include/duckdb/parser/query_node.hpp | 1 - .../parser/tableref/expressionlistref.hpp | 10 +- .../src/include/duckdb/parser/transformer.hpp | 11 +- .../include/duckdb/planner/bind_context.hpp | 3 +- .../src/include/duckdb/planner/binder.hpp | 29 +- .../duckdb/planner/expression_binder.hpp | 5 +- .../table_function_binder.hpp | 10 + .../duckdb/planner/extension_callback.hpp | 10 + .../src/include/duckdb/planner/joinside.hpp | 108 +- .../operator/logical_comparison_join.hpp | 19 +- .../planner/operator/logical_merge_into.hpp | 3 + .../duckdb/planner/operator_extension.hpp | 8 + .../duckdb/planner/planner_extension.hpp | 52 + .../include/duckdb/storage/block_manager.hpp | 15 +- .../duckdb/storage/buffer/block_handle.hpp | 74 +- .../duckdb/storage/buffer/buffer_pool.hpp | 17 + .../buffer/buffer_pool_reservation.hpp | 48 + .../storage/caching_file_system_wrapper.hpp | 1 + .../checkpoint/string_checkpoint_state.hpp | 5 + .../storage/compression/alp/alp_scan.hpp | 2 +- .../storage/compression/alprd/alprd_scan.hpp | 2 +- .../storage/compression/chimp/chimp_scan.hpp | 2 +- .../storage/compression/patas/patas_scan.hpp | 2 +- .../include/duckdb/storage/object_cache.hpp | 36 +- .../duckdb/storage/segment/uncompressed.hpp | 7 + .../duckdb/storage/storage_extension.hpp | 5 +- .../duckdb/storage/string_uncompressed.hpp | 15 +- .../duckdb/storage/table/column_segment.hpp | 8 +- src/duckdb/src/include/duckdb_extension.h | 27 +- src/duckdb/src/main/appender.cpp | 117 +- src/duckdb/src/main/capi/data_chunk-c.cpp | 44 +- src/duckdb/src/main/capi/duckdb_value-c.cpp | 6 +- src/duckdb/src/main/capi/helper-c.cpp | 12 + src/duckdb/src/main/client_context.cpp | 125 +- src/duckdb/src/main/config.cpp | 84 +- src/duckdb/src/main/connection.cpp | 9 - src/duckdb/src/main/connection_manager.cpp | 4 +- src/duckdb/src/main/database.cpp | 32 +- src/duckdb/src/main/database_manager.cpp | 9 +- .../src/main/extension/extension_helper.cpp | 2 +- .../src/main/extension/extension_install.cpp | 46 +- .../src/main/extension/extension_load.cpp | 136 +- .../src/main/extension_callback_manager.cpp | 174 + src/duckdb/src/main/extension_manager.cpp | 9 +- src/duckdb/src/main/prepared_statement.cpp | 31 +- src/duckdb/src/main/query_profiler.cpp | 12 +- src/duckdb/src/main/secret/secret.cpp | 5 + .../src/main/settings/custom_settings.cpp | 11 +- .../optimizer/build_probe_side_optimizer.cpp | 12 +- .../optimizer/column_lifetime_analyzer.cpp | 1 + .../compress_comparison_join.cpp | 78 +- src/duckdb/src/optimizer/deliminator.cpp | 59 +- src/duckdb/src/optimizer/filter_pullup.cpp | 3 +- src/duckdb/src/optimizer/filter_pushdown.cpp | 1 + .../src/optimizer/in_clause_rewriter.cpp | 8 +- src/duckdb/src/optimizer/join_elimination.cpp | 10 +- .../join_filter_pushdown_optimizer.cpp | 23 +- .../join_order/query_graph_manager.cpp | 55 +- .../optimizer/join_order/relation_manager.cpp | 66 +- .../src/optimizer/late_materialization.cpp | 8 +- src/duckdb/src/optimizer/optimizer.cpp | 5 +- .../pushdown/pushdown_cross_product.cpp | 6 +- .../optimizer/pushdown/pushdown_left_join.cpp | 90 +- .../optimizer/pushdown/pushdown_mark_join.cpp | 7 +- .../pushdown/pushdown_outer_join.cpp | 22 +- .../src/optimizer/remove_unused_columns.cpp | 31 +- src/duckdb/src/optimizer/row_group_pruner.cpp | 1 + .../optimizer/rule/timestamp_comparison.cpp | 1 + .../statistics/expression/propagate_cast.cpp | 4 + .../statistics/operator/propagate_join.cpp | 37 +- .../src/optimizer/topn_window_elimination.cpp | 27 +- src/duckdb/src/optimizer/window_self_join.cpp | 12 +- src/duckdb/src/parallel/pipeline.cpp | 4 + src/duckdb/src/parallel/pipeline_executor.cpp | 14 +- .../parser/expression/lambda_expression.cpp | 4 +- .../src/parser/expression/type_expression.cpp | 132 + src/duckdb/src/parser/keyword_helper.cpp | 12 +- .../parser/parsed_data/alter_table_info.cpp | 75 + .../parser/parsed_data/create_type_info.cpp | 7 - .../parser/parsed_data/create_view_info.cpp | 46 +- src/duckdb/src/parser/parsed_expression.cpp | 2 + .../src/parser/parsed_expression_iterator.cpp | 7 + src/duckdb/src/parser/parser.cpp | 13 +- src/duckdb/src/parser/tableref/pivotref.cpp | 172 + .../expression/transform_constant.cpp | 86 - .../transform/helpers/transform_typename.cpp | 385 +- .../statement/transform_alter_table.cpp | 23 + .../statement/transform_comment_on.cpp | 3 +- .../statement/transform_create_function.cpp | 6 - .../statement/transform_create_table.cpp | 28 +- .../statement/transform_create_table_as.cpp | 3 +- .../transform/statement/transform_secret.cpp | 3 +- .../transform/tableref/transform_pivot.cpp | 61 +- src/duckdb/src/parser/transformer.cpp | 7 +- src/duckdb/src/planner/bind_context.cpp | 5 +- src/duckdb/src/planner/binder.cpp | 140 + .../expression/bind_collate_expression.cpp | 2 +- .../expression/bind_columnref_expression.cpp | 13 +- .../expression/bind_type_expression.cpp | 110 + .../query_node/bind_recursive_cte_node.cpp | 9 +- .../binder/query_node/plan_subquery.cpp | 36 +- .../planner/binder/statement/bind_copy.cpp | 11 + .../planner/binder/statement/bind_create.cpp | 234 +- .../binder/statement/bind_create_table.cpp | 56 +- .../planner/binder/statement/bind_delete.cpp | 43 +- .../planner/binder/statement/bind_insert.cpp | 5 +- .../binder/statement/bind_merge_into.cpp | 34 + .../planner/binder/statement/bind_simple.cpp | 38 +- .../binder/tableref/bind_basetableref.cpp | 54 +- .../planner/binder/tableref/bind_pivot.cpp | 70 + .../binder/tableref/bind_table_function.cpp | 2 +- .../planner/binder/tableref/plan_joinref.cpp | 176 +- .../expression/bound_cast_expression.cpp | 1 + src/duckdb/src/planner/expression_binder.cpp | 2 + .../expression_binder/order_binder.cpp | 25 +- .../table_function_binder.cpp | 8 +- src/duckdb/src/planner/joinside.cpp | 9 +- .../src/planner/logical_operator_visitor.cpp | 15 +- .../operator/logical_comparison_join.cpp | 58 +- .../src/planner/operator/logical_delete.cpp | 1 + .../operator/logical_extension_operator.cpp | 6 +- .../src/planner/operator/logical_insert.cpp | 1 + .../planner/operator/logical_merge_into.cpp | 2 + .../src/planner/operator/logical_update.cpp | 4 +- .../src/planner/operator/logical_vacuum.cpp | 6 +- src/duckdb/src/planner/planner.cpp | 18 +- .../subquery/flatten_dependent_join.cpp | 97 +- .../src/storage/buffer/block_handle.cpp | 36 +- .../src/storage/buffer/buffer_handle.cpp | 2 +- src/duckdb/src/storage/buffer/buffer_pool.cpp | 43 +- .../buffer/buffer_pool_reservation.cpp | 3 +- .../storage/caching_file_system_wrapper.cpp | 4 + .../write_overflow_strings_to_disk.cpp | 12 + .../src/storage/compression/bitpacking.cpp | 2 +- .../compression/dict_fsst/decompression.cpp | 4 +- .../compression/dictionary/decompression.cpp | 4 +- src/duckdb/src/storage/compression/fsst.cpp | 6 +- src/duckdb/src/storage/compression/rle.cpp | 2 +- .../compression/string_uncompressed.cpp | 26 +- .../compression/validity_uncompressed.cpp | 234 +- src/duckdb/src/storage/compression/zstd.cpp | 2 +- .../src/storage/external_file_cache.cpp | 4 +- .../storage/open_file_storage_extension.cpp | 4 +- .../src/storage/optimistic_data_writer.cpp | 4 +- .../serialization/serialize_create_info.cpp | 26 +- .../serialize_logical_operator.cpp | 8 +- .../storage/serialization/serialize_nodes.cpp | 36 +- .../serialization/serialize_parse_info.cpp | 28 + .../serialize_parsed_expression.cpp | 20 + .../storage/serialization/serialize_types.cpp | 25 +- .../src/storage/standard_buffer_manager.cpp | 12 +- .../src/storage/statistics/variant_stats.cpp | 33 +- src/duckdb/src/storage/storage_manager.cpp | 4 +- .../src/storage/table/column_segment.cpp | 6 +- src/duckdb/src/storage/table/row_group.cpp | 2 +- .../storage/table/standard_column_data.cpp | 25 +- .../table/variant/variant_shredding.cpp | 2 +- .../transaction/duck_transaction_manager.cpp | 4 +- .../libpg_query/include/nodes/parsenodes.hpp | 5 +- .../libpg_query/src_backend_parser_gram.cpp | 5991 +++++++++-------- .../third_party/utf8proc/utf8proc_wrapper.cpp | 20 +- ...xtension_core_functions_scalar_generic.cpp | 2 +- src/duckdb/ub_src_catalog_catalog_entry.cpp | 2 + src/duckdb/ub_src_common_types.cpp | 2 + src/duckdb/ub_src_function_cast.cpp | 2 + src/duckdb/ub_src_main.cpp | 2 + src/duckdb/ub_src_parser_expression.cpp | 2 + .../ub_src_planner_binder_expression.cpp | 2 + 355 files changed, 10810 insertions(+), 6501 deletions(-) create mode 100644 src/duckdb/extension/core_functions/scalar/generic/type_functions.cpp delete mode 100644 src/duckdb/extension/core_functions/scalar/generic/typeof.cpp create mode 100644 src/duckdb/src/catalog/catalog_entry/aggregate_function_catalog_entry.cpp create mode 100644 src/duckdb/src/common/types/type_manager.cpp create mode 100644 src/duckdb/src/function/cast/type_cast.cpp delete mode 100644 src/duckdb/src/include/duckdb/catalog/default/builtin_types/types.hpp create mode 100644 src/duckdb/src/include/duckdb/common/operator/negate.hpp create mode 100644 src/duckdb/src/include/duckdb/common/types/type_manager.hpp create mode 100644 src/duckdb/src/include/duckdb/main/extension_callback_manager.hpp create mode 100644 src/duckdb/src/include/duckdb/parser/expression/type_expression.hpp create mode 100644 src/duckdb/src/include/duckdb/planner/planner_extension.hpp create mode 100644 src/duckdb/src/include/duckdb/storage/buffer/buffer_pool_reservation.hpp create mode 100644 src/duckdb/src/main/extension_callback_manager.cpp create mode 100644 src/duckdb/src/parser/expression/type_expression.cpp create mode 100644 src/duckdb/src/planner/binder/expression/bind_type_expression.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..4b9a306ec 100644 --- a/src/duckdb/extension/core_functions/aggregate/algebraic/avg.cpp +++ b/src/duckdb/extension/core_functions/aggregate/algebraic/avg.cpp @@ -266,12 +266,20 @@ AggregateFunction GetAverageAggregate(PhysicalType type) { } } +LogicalType GetAvgStateType(const AggregateFunction &function) { + child_list_t children; + children.emplace_back("count", LogicalType::UBIGINT); + children.emplace_back("value", function.arguments[0]); + return LogicalType::STRUCT(std::move(children)); +} + unique_ptr BindDecimalAvg(ClientContext &context, AggregateFunction &function, vector> &arguments) { auto decimal_type = arguments[0]->return_type; function = GetAverageAggregate(decimal_type.InternalType()); function.name = "avg"; function.arguments[0] = decimal_type; + function.get_state_type = GetAvgStateType; function.SetReturnType(LogicalType::DOUBLE); return make_uniq( Hugeint::Cast(Hugeint::POWERS_OF_TEN[DecimalType::GetScale(decimal_type)])); @@ -303,12 +311,18 @@ AggregateFunctionSet AvgFun::GetFunctions() { AggregateFunction::UnaryAggregate, dtime_tz_t, dtime_tz_t, TimeTZAverageOperation>( LogicalType::TIME_TZ, LogicalType::TIME_TZ)); + for (auto &function : avg.functions) { + function.get_state_type = GetAvgStateType; + } + return avg; } AggregateFunction FAvgFun::GetFunction() { - return AggregateFunction::UnaryAggregate(LogicalType::DOUBLE, - LogicalType::DOUBLE); + auto function = AggregateFunction::UnaryAggregate( + LogicalType::DOUBLE, LogicalType::DOUBLE); + function.get_state_type = GetAvgStateType; + return function; } } // 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 0e9e9e03e..322c7a202 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/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/type_functions.cpp b/src/duckdb/extension/core_functions/scalar/generic/type_functions.cpp new file mode 100644 index 000000000..fb6b83812 --- /dev/null +++ b/src/duckdb/extension/core_functions/scalar/generic/type_functions.cpp @@ -0,0 +1,121 @@ +#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 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::VARCHAR, GetTypeFunction); + 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 3f9d9b0c7..e55ed6155 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 { 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/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/json/json_functions/json_create.cpp b/src/duckdb/extension/json/json_functions/json_create.cpp index d1c8a8afb..f7566002f 100644 --- a/src/duckdb/extension/json/json_functions/json_create.cpp +++ b/src/duckdb/extension/json/json_functions/json_create.cpp @@ -605,8 +605,9 @@ static void CreateValues(const StructNames &names, yyjson_mut_doc *doc, yyjson_m case LogicalTypeId::INVALID: case LogicalTypeId::UNKNOWN: case LogicalTypeId::ANY: - case LogicalTypeId::USER: case LogicalTypeId::TEMPLATE: + case LogicalTypeId::UNBOUND: + case LogicalTypeId::TYPE: case LogicalTypeId::VARIANT: case LogicalTypeId::CHAR: case LogicalTypeId::STRING_LITERAL: diff --git a/src/duckdb/extension/parquet/column_writer.cpp b/src/duckdb/extension/parquet/column_writer.cpp index cf0652ede..8eda20e4f 100644 --- a/src/duckdb/extension/parquet/column_writer.cpp +++ b/src/duckdb/extension/parquet/column_writer.cpp @@ -288,6 +288,9 @@ unique_ptr ColumnWriter::CreateWriterRecursive(ClientContext &cont //! Construct the column schema auto variant_column = ParquetColumnSchema::FromLogicalType(name, type, max_define, max_repeat, 0, null_type, allow_geometry); + if (field_id && field_id->set) { + variant_column.field_id = field_id->field_id; + } vector> child_writers; child_writers.reserve(child_types.size()); diff --git a/src/duckdb/extension/parquet/include/column_writer.hpp b/src/duckdb/extension/parquet/include/column_writer.hpp index 1463137ad..fb4a0c91e 100644 --- a/src/duckdb/extension/parquet/include/column_writer.hpp +++ b/src/duckdb/extension/parquet/include/column_writer.hpp @@ -122,7 +122,7 @@ class ColumnWriter { } return false; } - virtual LogicalType TransformedType() { + virtual LogicalType TransformedType() const { throw NotImplementedException("Writer does not have a transformed type"); } virtual unique_ptr TransformExpression(unique_ptr expr) { @@ -145,7 +145,7 @@ class ColumnWriter { throw NotImplementedException("Writer doesn't require an AnalyzeSchemaFinalize pass"); } - virtual void FinalizeSchema(vector &schemas) = 0; + virtual idx_t FinalizeSchema(vector &schemas) = 0; //! Create the column writer for a specific type recursively static unique_ptr CreateWriterRecursive(ClientContext &context, ParquetWriter &writer, @@ -179,6 +179,18 @@ class ColumnWriter { virtual void Write(ColumnWriterState &state, Vector &vector, idx_t count) = 0; virtual void FinalizeWrite(ColumnWriterState &state) = 0; +public: + template + TARGET &Cast() { + DynamicCastCheck(this); + return reinterpret_cast(*this); + } + template + const TARGET &Cast() const { + D_ASSERT(dynamic_cast(this)); + return reinterpret_cast(*this); + } + protected: void HandleDefineLevels(ColumnWriterState &state, ColumnWriterState *parent, const ValidityMask &validity, const idx_t count, const uint16_t define_value, const uint16_t null_value) const; @@ -189,6 +201,8 @@ class ColumnWriter { public: ParquetWriter &writer; + //! The parent writer (if this is a nested field) + optional_ptr parent; ParquetColumnSchema column_schema; vector schema_path; bool can_have_nulls; diff --git a/src/duckdb/extension/parquet/include/parquet_shredding.hpp b/src/duckdb/extension/parquet/include/parquet_shredding.hpp index f43cbc42c..9e4e5ebe5 100644 --- a/src/duckdb/extension/parquet/include/parquet_shredding.hpp +++ b/src/duckdb/extension/parquet/include/parquet_shredding.hpp @@ -36,7 +36,7 @@ struct ShreddingType { static ShreddingType Deserialize(Deserializer &source); public: - static ShreddingType GetShreddingTypes(const Value &val); + static ShreddingType GetShreddingTypes(const Value &val, ClientContext &context); void AddChild(const string &name, ShreddingType &&child); optional_ptr GetChild(const string &name) const; diff --git a/src/duckdb/extension/parquet/include/reader/variant_column_reader.hpp b/src/duckdb/extension/parquet/include/reader/variant_column_reader.hpp index 69b429626..ad3e8533d 100644 --- a/src/duckdb/extension/parquet/include/reader/variant_column_reader.hpp +++ b/src/duckdb/extension/parquet/include/reader/variant_column_reader.hpp @@ -35,6 +35,7 @@ class VariantColumnReader : public ColumnReader { idx_t GroupRowsAvailable() override; uint64_t TotalCompressedSize() override; void RegisterPrefetch(ThriftFileTransport &transport, bool allow_merge) override; + static bool TypedValueLayoutToType(const LogicalType &typed_value, LogicalType &logical_type); protected: idx_t metadata_reader_idx; diff --git a/src/duckdb/extension/parquet/include/writer/list_column_writer.hpp b/src/duckdb/extension/parquet/include/writer/list_column_writer.hpp index df7ecf276..ba841ac4e 100644 --- a/src/duckdb/extension/parquet/include/writer/list_column_writer.hpp +++ b/src/duckdb/extension/parquet/include/writer/list_column_writer.hpp @@ -44,10 +44,11 @@ class ListColumnWriter : public ColumnWriter { void BeginWrite(ColumnWriterState &state) override; void Write(ColumnWriterState &state, Vector &vector, idx_t count) override; void FinalizeWrite(ColumnWriterState &state) override; - void FinalizeSchema(vector &schemas) override; + idx_t FinalizeSchema(vector &schemas) override; protected: ColumnWriter &GetChildWriter(); + const ColumnWriter &GetChildWriter() const; }; } // namespace duckdb diff --git a/src/duckdb/extension/parquet/include/writer/parquet_write_operators.hpp b/src/duckdb/extension/parquet/include/writer/parquet_write_operators.hpp index 95bf21e2a..687f7afd7 100644 --- a/src/duckdb/extension/parquet/include/writer/parquet_write_operators.hpp +++ b/src/duckdb/extension/parquet/include/writer/parquet_write_operators.hpp @@ -237,11 +237,6 @@ struct ParquetIntervalOperator : public BaseParquetOperator { } }; -struct ParquetUUIDTargetType { - static constexpr const idx_t PARQUET_UUID_SIZE = 16; - data_t bytes[PARQUET_UUID_SIZE]; -}; - struct ParquetUUIDOperator : public BaseParquetOperator { template static TGT Operation(SRC input) { @@ -274,11 +269,13 @@ struct ParquetUUIDOperator : public BaseParquetOperator { template static void HandleStats(ColumnWriterStatistics *stats_p, TGT target_value) { auto &stats = stats_p->Cast(); - if (!stats.has_stats || memcmp(target_value.bytes, stats.min, ParquetUUIDTargetType::PARQUET_UUID_SIZE) < 0) { - memcpy(stats.min, target_value.bytes, ParquetUUIDTargetType::PARQUET_UUID_SIZE); + if (!stats.has_stats || + memcmp(target_value.bytes, stats.min.bytes, ParquetUUIDTargetType::PARQUET_UUID_SIZE) < 0) { + stats.min = target_value; } - if (!stats.has_stats || memcmp(target_value.bytes, stats.max, ParquetUUIDTargetType::PARQUET_UUID_SIZE) > 0) { - memcpy(stats.max, target_value.bytes, ParquetUUIDTargetType::PARQUET_UUID_SIZE); + if (!stats.has_stats || + memcmp(target_value.bytes, stats.max.bytes, ParquetUUIDTargetType::PARQUET_UUID_SIZE) > 0) { + stats.max = target_value; } stats.has_stats = true; } diff --git a/src/duckdb/extension/parquet/include/writer/parquet_write_stats.hpp b/src/duckdb/extension/parquet/include/writer/parquet_write_stats.hpp index 840830e3a..dc42ce211 100644 --- a/src/duckdb/extension/parquet/include/writer/parquet_write_stats.hpp +++ b/src/duckdb/extension/parquet/include/writer/parquet_write_stats.hpp @@ -227,11 +227,16 @@ class StringStatisticsState : public ColumnWriterStatistics { } }; +struct ParquetUUIDTargetType { + static constexpr const idx_t PARQUET_UUID_SIZE = 16; + data_t bytes[PARQUET_UUID_SIZE]; +}; + class UUIDStatisticsState : public ColumnWriterStatistics { public: bool has_stats = false; - data_t min[16] = {0}; - data_t max[16] = {0}; + ParquetUUIDTargetType min; + ParquetUUIDTargetType max; public: bool HasStats() override { @@ -245,10 +250,10 @@ class UUIDStatisticsState : public ColumnWriterStatistics { return GetMaxValue(); } string GetMinValue() override { - return HasStats() ? string(char_ptr_cast(min), 16) : string(); + return HasStats() ? string(char_ptr_cast(min.bytes), ParquetUUIDTargetType::PARQUET_UUID_SIZE) : string(); } string GetMaxValue() override { - return HasStats() ? string(char_ptr_cast(max), 16) : string(); + return HasStats() ? string(char_ptr_cast(max.bytes), ParquetUUIDTargetType::PARQUET_UUID_SIZE) : string(); } }; diff --git a/src/duckdb/extension/parquet/include/writer/primitive_column_writer.hpp b/src/duckdb/extension/parquet/include/writer/primitive_column_writer.hpp index 36874cf6d..3b3dd5dbe 100644 --- a/src/duckdb/extension/parquet/include/writer/primitive_column_writer.hpp +++ b/src/duckdb/extension/parquet/include/writer/primitive_column_writer.hpp @@ -74,7 +74,7 @@ class PrimitiveColumnWriter : public ColumnWriter { void BeginWrite(ColumnWriterState &state) override; void Write(ColumnWriterState &state, Vector &vector, idx_t count) override; void FinalizeWrite(ColumnWriterState &state) override; - void FinalizeSchema(vector &schemas) override; + idx_t FinalizeSchema(vector &schemas) override; protected: static void WriteLevels(Allocator &allocator, WriteStream &temp_writer, const unsafe_vector &levels, diff --git a/src/duckdb/extension/parquet/include/writer/struct_column_writer.hpp b/src/duckdb/extension/parquet/include/writer/struct_column_writer.hpp index a3d433467..f0dc047bd 100644 --- a/src/duckdb/extension/parquet/include/writer/struct_column_writer.hpp +++ b/src/duckdb/extension/parquet/include/writer/struct_column_writer.hpp @@ -18,6 +18,9 @@ class StructColumnWriter : public ColumnWriter { vector> child_writers_p) : ColumnWriter(writer, std::move(column_schema), std::move(schema_path_p)) { child_writers = std::move(child_writers_p); + for (auto &writer : child_writers) { + writer->parent = *this; + } } ~StructColumnWriter() override = default; @@ -32,7 +35,7 @@ class StructColumnWriter : public ColumnWriter { void BeginWrite(ColumnWriterState &state) override; void Write(ColumnWriterState &state, Vector &vector, idx_t count) override; void FinalizeWrite(ColumnWriterState &state) override; - void FinalizeSchema(vector &schemas) override; + idx_t FinalizeSchema(vector &schemas) override; }; } // namespace duckdb diff --git a/src/duckdb/extension/parquet/include/writer/variant_column_writer.hpp b/src/duckdb/extension/parquet/include/writer/variant_column_writer.hpp index 07250c4ac..0f5f8424a 100644 --- a/src/duckdb/extension/parquet/include/writer/variant_column_writer.hpp +++ b/src/duckdb/extension/parquet/include/writer/variant_column_writer.hpp @@ -28,8 +28,12 @@ struct VariantAnalyzeData { public: //! Map for every value what type it is variant_type_map type_map = {}; + uint32_t decimal_width; + uint32_t decimal_scale; + bool decimal_consistent = false; + idx_t total_count = 0; + //! Map for every decimal value what physical type it has - array decimal_type_map = {}; unique_ptr object_data = nullptr; unique_ptr array_data = nullptr; }; @@ -72,7 +76,7 @@ class VariantColumnWriter : public StructColumnWriter { ~VariantColumnWriter() override = default; public: - void FinalizeSchema(vector &schemas) override; + idx_t FinalizeSchema(vector &schemas) override; unique_ptr AnalyzeSchemaInit() override; void AnalyzeSchema(ParquetAnalyzeSchemaState &state, Vector &input, idx_t count) override; void AnalyzeSchemaFinalize(const ParquetAnalyzeSchemaState &state) override; @@ -80,7 +84,7 @@ class VariantColumnWriter : public StructColumnWriter { bool HasTransform() override { return true; } - LogicalType TransformedType() override { + LogicalType TransformedType() const override { child_list_t children; for (auto &writer : child_writers) { auto &child_name = writer->Schema().name; diff --git a/src/duckdb/extension/parquet/parquet_extension.cpp b/src/duckdb/extension/parquet/parquet_extension.cpp index 357915146..3f78bf482 100644 --- a/src/duckdb/extension/parquet/parquet_extension.cpp +++ b/src/duckdb/extension/parquet/parquet_extension.cpp @@ -248,7 +248,8 @@ static unique_ptr ParquetWriteBind(ClientContext &context, CopyFun } } const auto &child_value = struct_children[i]; - bind_data->shredding_types.AddChild(col_name, ShreddingType::GetShreddingTypes(child_value)); + bind_data->shredding_types.AddChild(col_name, + ShreddingType::GetShreddingTypes(child_value, context)); } } } else if (loption == "kv_metadata") { @@ -659,7 +660,8 @@ static unique_ptr ParquetCopyDeserialize(Deserializer &deserialize 115, "string_dictionary_page_size_limit", default_value.string_dictionary_page_size_limit); data->geoparquet_version = deserializer.ReadPropertyWithExplicitDefault(116, "geoparquet_version", default_value.geoparquet_version); - data->shredding_types = deserializer.ReadProperty(117, "shredding_types"); + data->shredding_types = + deserializer.ReadPropertyWithExplicitDefault(117, "shredding_types", ShreddingType()); return std::move(data); } diff --git a/src/duckdb/extension/parquet/parquet_reader.cpp b/src/duckdb/extension/parquet/parquet_reader.cpp index 8f4cd3997..f08fd1912 100644 --- a/src/duckdb/extension/parquet/parquet_reader.cpp +++ b/src/duckdb/extension/parquet/parquet_reader.cpp @@ -786,7 +786,7 @@ ParquetColumnDefinition ParquetColumnDefinition::FromSchemaValue(ClientContext & const auto children = StructValue::GetChildren(column_def); result.name = StringValue::Get(children[0]); - result.type = TransformStringToLogicalType(StringValue::Get(children[1])); + result.type = TransformStringToLogicalType(StringValue::Get(children[1]), context); string error_message; if (!children[2].TryCastAs(context, result.type, result.default_value, &error_message)) { throw BinderException("Unable to cast Parquet schema default_value \"%s\" to %s", children[2].ToString(), diff --git a/src/duckdb/extension/parquet/parquet_shredding.cpp b/src/duckdb/extension/parquet/parquet_shredding.cpp index b7ed673a8..c5f5092ea 100644 --- a/src/duckdb/extension/parquet/parquet_shredding.cpp +++ b/src/duckdb/extension/parquet/parquet_shredding.cpp @@ -68,12 +68,12 @@ optional_ptr ShreddingType::GetChild(const string &name) co return it->second; } -ShreddingType ShreddingType::GetShreddingTypes(const Value &val) { +ShreddingType ShreddingType::GetShreddingTypes(const Value &val, ClientContext &context) { if (val.type().id() != LogicalTypeId::VARCHAR) { throw BinderException("SHREDDING value should be of type VARCHAR, a stringified type to use for the column"); } auto type_str = val.GetValue(); - auto logical_type = TransformStringToLogicalType(type_str); + auto logical_type = TransformStringToLogicalType(type_str, context); return ConvertShreddingTypeRecursive(logical_type); } diff --git a/src/duckdb/extension/parquet/parquet_statistics.cpp b/src/duckdb/extension/parquet/parquet_statistics.cpp index 33a52abf1..83abce628 100644 --- a/src/duckdb/extension/parquet/parquet_statistics.cpp +++ b/src/duckdb/extension/parquet/parquet_statistics.cpp @@ -7,13 +7,16 @@ #include "parquet_reader.hpp" #include "reader/string_column_reader.hpp" #include "reader/struct_column_reader.hpp" +#include "reader/variant_column_reader.hpp" #include "zstd/common/xxhash.hpp" #include "duckdb/common/types/blob.hpp" #include "duckdb/common/types/time.hpp" #include "duckdb/common/types/value.hpp" #include "duckdb/storage/statistics/struct_stats.hpp" +#include "duckdb/storage/statistics/list_stats.hpp" #include "duckdb/planner/filter/constant_filter.hpp" #include "reader/uuid_column_reader.hpp" +#include "duckdb/common/type_visitor.hpp" namespace duckdb { @@ -319,17 +322,100 @@ Value ParquetStatisticsUtils::ConvertValueInternal(const LogicalType &type, cons } } +static bool ConvertUnshreddedStats(BaseStatistics &result, optional_ptr input_p) { + D_ASSERT(result.GetType().id() == LogicalTypeId::UINTEGER); + + if (!input_p) { + return false; + } + auto &input = *input_p; + D_ASSERT(input.GetType().id() == LogicalTypeId::BLOB); + result.CopyValidity(input); + + auto min = StringStats::Min(input); + auto max = StringStats::Max(input); + + if (!result.CanHaveNoNull()) { + return true; + } + + if (min.empty() && max.empty()) { + //! All non-shredded values are NULL or VARIANT_NULL, set the stats to indicate this + NumericStats::SetMin(result, 0); + NumericStats::SetMax(result, 0); + result.SetHasNoNull(); + } + return true; +} + +static bool ConvertShreddedStats(BaseStatistics &result, optional_ptr input_p); + +static bool ConvertShreddedStatsItem(BaseStatistics &result, BaseStatistics &input) { + D_ASSERT(result.GetType().id() == LogicalTypeId::STRUCT); + D_ASSERT(input.GetType().id() == LogicalTypeId::STRUCT); + + auto &untyped_value_index_stats = StructStats::GetChildStats(result, 0); + auto &typed_value_result = StructStats::GetChildStats(result, 1); + + auto &value_stats = StructStats::GetChildStats(input, 0); + auto &typed_value_input = StructStats::GetChildStats(input, 1); + + if (!ConvertUnshreddedStats(untyped_value_index_stats, value_stats)) { + return false; + } + if (!ConvertShreddedStats(typed_value_result, typed_value_input)) { + return false; + } + return true; +} + +static bool ConvertShreddedStats(BaseStatistics &result, optional_ptr input_p) { + if (!input_p) { + return false; + } + auto &input = *input_p; + result.CopyValidity(input); + + auto type_id = result.GetType().id(); + if (type_id == LogicalTypeId::LIST) { + auto &child_result = ListStats::GetChildStats(result); + auto &child_input = ListStats::GetChildStats(input); + return ConvertShreddedStatsItem(child_result, child_input); + } + if (type_id == LogicalTypeId::STRUCT) { + auto field_count = StructType::GetChildCount(result.GetType()); + for (idx_t i = 0; i < field_count; i++) { + auto &result_field = StructStats::GetChildStats(result, i); + auto &input_field = StructStats::GetChildStats(input, i); + if (!ConvertShreddedStatsItem(result_field, input_field)) { + return false; + } + } + return true; + } + result.Copy(input); + return true; +} + unique_ptr ParquetStatisticsUtils::TransformColumnStatistics(const ParquetColumnSchema &schema, const vector &columns, bool can_have_nan) { // Not supported types auto &type = schema.type; - if (type.id() == LogicalTypeId::ARRAY || type.id() == LogicalTypeId::MAP || type.id() == LogicalTypeId::LIST) { + if (type.id() == LogicalTypeId::ARRAY || type.id() == LogicalTypeId::MAP) { return nullptr; } unique_ptr row_group_stats; + if (type.id() == LogicalTypeId::LIST) { + auto list_stats = ListStats::CreateUnknown(type); + auto &child_schema = schema.children[0]; + auto child_stats = ParquetStatisticsUtils::TransformColumnStatistics(child_schema, columns, can_have_nan); + ListStats::SetChildStats(list_stats, std::move(child_stats)); + row_group_stats = list_stats.ToUnique(); + return row_group_stats; + } // Structs are handled differently (they dont have stats) if (type.id() == LogicalTypeId::STRUCT) { auto struct_stats = StructStats::CreateUnknown(type); @@ -340,19 +426,52 @@ unique_ptr ParquetStatisticsUtils::TransformColumnStatistics(con StructStats::SetChildStats(struct_stats, i, std::move(child_stats)); } row_group_stats = struct_stats.ToUnique(); - - // null count is generic - if (row_group_stats) { - row_group_stats->Set(StatsInfo::CAN_HAVE_NULL_AND_VALID_VALUES); - } return row_group_stats; } else if (schema.schema_type == ParquetColumnSchemaType::VARIANT) { - //! FIXME: there are situations where VARIANT columns can have stats - return nullptr; + auto children_count = schema.children.size(); + if (children_count != 3) { + return nullptr; + } + //! Create the VARIANT stats + auto &typed_value = schema.children[2]; + LogicalType logical_type; + if (!VariantColumnReader::TypedValueLayoutToType(typed_value.type, logical_type)) { + //! We couldn't convert the parquet typed_value to a structured type (likely because a nested 'typed_value' + //! field is missing) + return nullptr; + } + auto shredding_type = TypeVisitor::VisitReplace(logical_type, [](const LogicalType &type) { + return LogicalType::STRUCT({{"untyped_value_index", LogicalType::UINTEGER}, {"typed_value", type}}); + }); + auto variant_stats = VariantStats::CreateShredded(shredding_type); + + //! Take the root stats + auto &shredded_stats = VariantStats::GetShreddedStats(variant_stats); + auto &untyped_value_index_stats = StructStats::GetChildStats(shredded_stats, 0); + auto &typed_value_stats = StructStats::GetChildStats(shredded_stats, 1); + + //! Convert the root 'value' -> 'untyped_value_index' + auto &value = schema.children[1]; + D_ASSERT(value.name == "value"); + auto value_stats = ParquetStatisticsUtils::TransformColumnStatistics(value, columns, can_have_nan); + if (!ConvertUnshreddedStats(untyped_value_index_stats, value_stats.get())) { + //! Couldn't convert the stats, or there are no stats + return nullptr; + } + + auto parquet_typed_value_stats = + ParquetStatisticsUtils::TransformColumnStatistics(typed_value, columns, can_have_nan); + if (!ConvertShreddedStats(typed_value_stats, parquet_typed_value_stats.get())) { + //! Couldn't convert the stats, or there are no stats + return nullptr; + } + //! Set validity to UNKNOWN + variant_stats.SetHasNoNull(); + variant_stats.SetHasNull(); + return variant_stats.ToUnique(); } // Otherwise, its a standard column with stats - auto &column_chunk = columns[schema.column_index]; if (!column_chunk.__isset.meta_data || !column_chunk.meta_data.__isset.statistics) { // no stats present for row group @@ -393,16 +512,18 @@ unique_ptr ParquetStatisticsUtils::TransformColumnStatistics(con row_group_stats = CreateNumericStats(type, schema, parquet_stats); } break; + case LogicalTypeId::BLOB: case LogicalTypeId::VARCHAR: { auto string_stats = StringStats::CreateUnknown(type); - if (parquet_stats.__isset.min_value && StringColumnReader::IsValid(parquet_stats.min_value, true)) { + const bool is_varchar = type.id() == LogicalTypeId::VARCHAR; + if (parquet_stats.__isset.min_value && StringColumnReader::IsValid(parquet_stats.min_value, is_varchar)) { StringStats::SetMin(string_stats, parquet_stats.min_value); - } else if (parquet_stats.__isset.min && StringColumnReader::IsValid(parquet_stats.min, true)) { + } else if (parquet_stats.__isset.min && StringColumnReader::IsValid(parquet_stats.min, is_varchar)) { StringStats::SetMin(string_stats, parquet_stats.min); } - if (parquet_stats.__isset.max_value && StringColumnReader::IsValid(parquet_stats.max_value, true)) { + if (parquet_stats.__isset.max_value && StringColumnReader::IsValid(parquet_stats.max_value, is_varchar)) { StringStats::SetMax(string_stats, parquet_stats.max_value); - } else if (parquet_stats.__isset.max && StringColumnReader::IsValid(parquet_stats.max, true)) { + } else if (parquet_stats.__isset.max && StringColumnReader::IsValid(parquet_stats.max, is_varchar)) { StringStats::SetMax(string_stats, parquet_stats.max); } row_group_stats = string_stats.ToUnique(); @@ -456,7 +577,9 @@ unique_ptr ParquetStatisticsUtils::TransformColumnStatistics(con break; } default: - // no stats for you + // no specific stats, only create unknown stats to hold validity information + auto unknown_stats = BaseStatistics::CreateUnknown(type); + row_group_stats = unknown_stats.ToUnique(); break; } // end of type switch diff --git a/src/duckdb/extension/parquet/parquet_writer.cpp b/src/duckdb/extension/parquet/parquet_writer.cpp index e5b4427e7..1b4cd74b5 100644 --- a/src/duckdb/extension/parquet/parquet_writer.cpp +++ b/src/duckdb/extension/parquet/parquet_writer.cpp @@ -22,6 +22,7 @@ #include "duckdb/parser/parsed_data/create_table_function_info.hpp" #include "duckdb/common/types/blob.hpp" #include "duckdb/common/types/geometry_crs.hpp" +#include "writer/variant_column_writer.hpp" namespace duckdb { @@ -314,7 +315,10 @@ struct ColumnStatsUnifier { string column_name; string global_min; string global_max; + //! Only set by the 'metadata' of the VARIANT column + string variant_type; idx_t null_count = 0; + idx_t num_values = 0; bool all_min_max_set = true; bool all_nulls_set = true; bool min_is_set = false; @@ -411,11 +415,6 @@ ParquetWriter::ParquetWriter(ClientContext &context, FileSystem &fs, string file file_meta_data.created_by = StringUtil::Format("DuckDB version %s (build %s)", DuckDB::LibraryVersion(), DuckDB::SourceID()); - duckdb_parquet::ColumnOrder column_order; - column_order.__set_TYPE_ORDER(duckdb_parquet::TypeDefinedOrder()); - file_meta_data.column_orders.resize(column_names.size(), column_order); - file_meta_data.__isset.column_orders = true; - for (auto &kv_pair : kv_metadata) { duckdb_parquet::KeyValue kv; kv.__set_key(kv_pair.first); @@ -510,25 +509,6 @@ void ParquetWriter::InitializePreprocessing(unique_ptr(context, transformed_types, std::move(transform_expressions)); } -void ParquetWriter::InitializeSchemaElements() { - //! Populate the schema elements of the parquet file we're writing - lock_guard glock(lock); - if (!file_meta_data.schema.empty()) { - return; - } - // populate root schema object - file_meta_data.schema.resize(1); - file_meta_data.schema[0].name = "duckdb_schema"; - file_meta_data.schema[0].num_children = NumericCast(sql_types.size()); - file_meta_data.schema[0].__isset.num_children = true; - file_meta_data.schema[0].repetition_type = duckdb_parquet::FieldRepetitionType::REQUIRED; - file_meta_data.schema[0].__isset.repetition_type = true; - - for (auto &column_writer : column_writers) { - column_writer->FinalizeSchema(file_meta_data.schema); - } -} - void ParquetWriter::PrepareRowGroup(ColumnDataCollection &raw_buffer, PreparedRowGroup &result, unique_ptr &transform_data) { AnalyzeSchema(raw_buffer, column_writers); @@ -959,6 +939,20 @@ static unique_ptr GetBaseStatsUnifier(const LogicalType &typ } } +static bool IsVariantMetadataField(const ColumnWriter &writer) { + if (!writer.parent) { + //! Not a nested column + return false; + } + auto &parent = *writer.parent; + if (parent.Type().id() != LogicalTypeId::VARIANT) { + //! (direct) parent is not a VARIANT + return false; + } + auto &name = writer.Schema().name; + return name == "metadata"; +} + static void GetStatsUnifier(const ColumnWriter &column_writer, vector> &unifiers, string base_name = string()) { auto &schema = column_writer.Schema(); @@ -973,6 +967,12 @@ static void GetStatsUnifier(const ColumnWriter &column_writer, vectorcolumn_name = std::move(base_name); + + if (IsVariantMetadataField(column_writer)) { + //! Stamp the 'metadata' field of the VARIANT with the internal layout of the VARIANT + auto &variant_writer = column_writer.parent->Cast(); + unifier->variant_type = variant_writer.TransformedType().ToString(); + } unifiers.push_back(std::move(unifier)); return; } @@ -986,6 +986,7 @@ void ParquetWriter::FlushColumnStats(idx_t col_idx, duckdb_parquet::ColumnChunk if (!written_stats) { return; } + // push the stats of this column into the unifier auto &stats_unifier = stats_accumulator->stats_unifiers[col_idx]; bool has_nan = false; @@ -1013,6 +1014,7 @@ void ParquetWriter::FlushColumnStats(idx_t col_idx, duckdb_parquet::ColumnChunk stats_unifier->UnifyGeoStats(*writer_stats->GetGeoStats()); } stats_unifier->column_size_bytes += column.meta_data.total_compressed_size; + stats_unifier->num_values += column.meta_data.num_values; } } @@ -1024,6 +1026,7 @@ void ParquetWriter::GatherWrittenStatistics() { auto &stats_unifier = stats_accumulator->stats_unifiers[c]; case_insensitive_map_t column_stats; column_stats["column_size_bytes"] = Value::UBIGINT(stats_unifier->column_size_bytes); + column_stats["num_values"] = Value::UBIGINT(stats_unifier->num_values); if (stats_unifier->all_min_max_set) { auto min_value = stats_unifier->StatsToString(stats_unifier->global_min); auto max_value = stats_unifier->StatsToString(stats_unifier->global_max); @@ -1034,6 +1037,9 @@ void ParquetWriter::GatherWrittenStatistics() { column_stats["max"] = max_value; } } + if (!stats_unifier->variant_type.empty()) { + column_stats["variant_type"] = Value(stats_unifier->variant_type); + } if (stats_unifier->all_nulls_set) { column_stats["null_count"] = Value::UBIGINT(stats_unifier->null_count); } @@ -1069,8 +1075,39 @@ void ParquetWriter::GatherWrittenStatistics() { column_stats["geo_types"] = Value::LIST(type_strings); } } - written_stats->column_statistics.insert(make_pair(stats_unifier->column_name, std::move(column_stats))); + written_stats->column_statistics.emplace(stats_unifier->column_name, std::move(column_stats)); + } +} + +void ParquetWriter::InitializeSchemaElements() { + //! Populate the schema elements of the parquet file we're writing + lock_guard glock(lock); + if (!file_meta_data.schema.empty()) { + return; + } + // populate root schema object + file_meta_data.schema.resize(1); + file_meta_data.schema[0].name = "duckdb_schema"; + file_meta_data.schema[0].num_children = NumericCast(sql_types.size()); + file_meta_data.schema[0].__isset.num_children = true; + file_meta_data.schema[0].repetition_type = duckdb_parquet::FieldRepetitionType::REQUIRED; + file_meta_data.schema[0].__isset.repetition_type = true; + + idx_t unique_columns = 0; + for (auto &column_writer : column_writers) { + unique_columns += column_writer->FinalizeSchema(file_meta_data.schema); + } + + if (written_stats) { + for (auto &column_writer : column_writers) { + GetStatsUnifier(*column_writer, stats_accumulator->stats_unifiers); + } } + + duckdb_parquet::ColumnOrder column_order; + column_order.__set_TYPE_ORDER(duckdb_parquet::TypeDefinedOrder()); + file_meta_data.column_orders.resize(unique_columns, column_order); + file_meta_data.__isset.column_orders = true; } void ParquetWriter::Finalize() { @@ -1166,10 +1203,7 @@ void ParquetWriter::BufferBloomFilter(idx_t col_idx, unique_ptr(); - // create the per-column stats unifiers - for (auto &column_writer : column_writers) { - GetStatsUnifier(*column_writer, stats_accumulator->stats_unifiers); - } + //! NOTE: the actual accumulators for the writers are created after FinalizeSchema() is called } } // namespace duckdb diff --git a/src/duckdb/extension/parquet/reader/variant/variant_binary_decoder.cpp b/src/duckdb/extension/parquet/reader/variant/variant_binary_decoder.cpp index 0388da0b3..8d69660b6 100644 --- a/src/duckdb/extension/parquet/reader/variant/variant_binary_decoder.cpp +++ b/src/duckdb/extension/parquet/reader/variant/variant_binary_decoder.cpp @@ -120,9 +120,12 @@ static T DecodeDecimal(const_data_ptr_t data, uint8_t &scale, uint8_t &width) { data++; auto result = Load(data); - //! FIXME: The spec says: - //! The implied precision of a decimal value is `floor(log_10(val)) + 1` - width = DecimalWidth::max; + auto abs_val = result; + if (abs_val < 0) { + abs_val = -abs_val; + } + uint8_t digits = floor(log10(abs_val)) + 1; + width = digits; return result; } @@ -181,24 +184,21 @@ VariantValue VariantBinaryDecoder::PrimitiveTypeDecode(const VariantValueMetadat uint8_t width; auto value = DecodeDecimal(data, scale, width); - auto value_str = Decimal::ToString(value, width, scale); - return VariantValue(Value(value_str)); + return VariantValue(Value::DECIMAL(value, width, scale)); } case VariantPrimitiveType::DECIMAL8: { uint8_t scale; uint8_t width; auto value = DecodeDecimal(data, scale, width); - auto value_str = Decimal::ToString(value, width, scale); - return VariantValue(Value(value_str)); + return VariantValue(Value::DECIMAL(value, width, scale)); } case VariantPrimitiveType::DECIMAL16: { uint8_t scale; uint8_t width; auto value = DecodeDecimal(data, scale, width); - auto value_str = Decimal::ToString(value, width, scale); - return VariantValue(Value(value_str)); + return VariantValue(Value::DECIMAL(value, width, scale)); } case VariantPrimitiveType::DATE: { date_t value; @@ -215,8 +215,7 @@ VariantValue VariantBinaryDecoder::PrimitiveTypeDecode(const VariantValueMetadat micros_ts.value = Load(data); auto value = Value::TIMESTAMP(micros_ts); - auto value_str = value.ToString(); - return VariantValue(Value(value_str)); + return VariantValue(std::move(value)); } case VariantPrimitiveType::BINARY: { //! Follow the JSON serialization guide by converting BINARY to Base64: @@ -252,13 +251,11 @@ VariantValue VariantBinaryDecoder::PrimitiveTypeDecode(const VariantValueMetadat nanos_ts.value = Load(data); auto value = Value::TIMESTAMPNS(nanos_ts); - auto value_str = value.ToString(); - return VariantValue(Value(value_str)); + return VariantValue(std::move(value)); } case VariantPrimitiveType::UUID: { auto uuid_value = UUIDValueConversion::ReadParquetUUID(data); - auto value_str = UUID::ToString(uuid_value); - return VariantValue(Value(value_str)); + return VariantValue(Value::UUID(uuid_value)); } default: throw NotImplementedException("Variant PrimitiveTypeDecode not implemented for type (%d)", diff --git a/src/duckdb/extension/parquet/reader/variant/variant_shredded_conversion.cpp b/src/duckdb/extension/parquet/reader/variant/variant_shredded_conversion.cpp index b96304d98..ac78ae84b 100644 --- a/src/duckdb/extension/parquet/reader/variant/variant_shredded_conversion.cpp +++ b/src/duckdb/extension/parquet/reader/variant/variant_shredded_conversion.cpp @@ -60,18 +60,15 @@ VariantValue ConvertShreddedValue::Convert(double val) { //! decimal4/decimal8/decimal16 template <> VariantValue ConvertShreddedValue::ConvertDecimal(int32_t val, uint8_t width, uint8_t scale) { - auto value_str = Decimal::ToString(val, width, scale); - return VariantValue(Value(value_str)); + return VariantValue(Value::DECIMAL(val, width, scale)); } template <> VariantValue ConvertShreddedValue::ConvertDecimal(int64_t val, uint8_t width, uint8_t scale) { - auto value_str = Decimal::ToString(val, width, scale); - return VariantValue(Value(value_str)); + return VariantValue(Value::DECIMAL(val, width, scale)); } template <> VariantValue ConvertShreddedValue::ConvertDecimal(hugeint_t val, uint8_t width, uint8_t scale) { - auto value_str = Decimal::ToString(val, width, scale); - return VariantValue(Value(value_str)); + return VariantValue(Value::DECIMAL(val, width, scale)); } //! date template <> @@ -119,7 +116,7 @@ VariantValue ConvertShreddedValue::Convert(string_t val) { //! uuid template <> VariantValue ConvertShreddedValue::Convert(hugeint_t val) { - return VariantValue(Value(UUID::ToString(val))); + return VariantValue(Value::UUID(val)); } template diff --git a/src/duckdb/extension/parquet/reader/variant_column_reader.cpp b/src/duckdb/extension/parquet/reader/variant_column_reader.cpp index 635bfbbb5..c9d6b9798 100644 --- a/src/duckdb/extension/parquet/reader/variant_column_reader.cpp +++ b/src/duckdb/extension/parquet/reader/variant_column_reader.cpp @@ -135,4 +135,73 @@ idx_t VariantColumnReader::GroupRowsAvailable() { throw InternalException("No projected columns in struct?"); } +bool VariantColumnReader::TypedValueLayoutToType(const LogicalType &typed_value, LogicalType &output) { + if (!typed_value.IsNested()) { + output = typed_value; + return true; + } + auto type_id = typed_value.id(); + if (type_id == LogicalTypeId::STRUCT) { + //! OBJECT (...) + auto &object_fields = StructType::GetChildTypes(typed_value); + child_list_t children; + for (auto &object_field : object_fields) { + auto &name = object_field.first; + auto &field = object_field.second; + //! : { + //! value: BLOB, + //! typed_value: + //! } + auto &field_children = StructType::GetChildTypes(field); + idx_t index = DConstants::INVALID_INDEX; + for (idx_t i = 0; i < field_children.size(); i++) { + if (field_children[i].first == "typed_value") { + index = i; + break; + } + } + if (index == DConstants::INVALID_INDEX) { + //! FIXME: we might be able to just omit this field from the OBJECT, instead of flat-out failing the + //! conversion No 'typed_value' field, so we can't assign a structured type to this field at all + return false; + } + LogicalType child_type; + if (!TypedValueLayoutToType(field_children[index].second, child_type)) { + return false; + } + children.emplace_back(name, child_type); + } + output = LogicalType::STRUCT(std::move(children)); + return true; + } + if (type_id == LogicalTypeId::LIST) { + //! ARRAY + auto &element = ListType::GetChildType(typed_value); + //! element: { + //! value: BLOB, + //! typed_value: + //! } + auto &element_children = StructType::GetChildTypes(element); + idx_t index = DConstants::INVALID_INDEX; + for (idx_t i = 0; i < element_children.size(); i++) { + if (element_children[i].first == "typed_value") { + index = i; + break; + } + } + if (index == DConstants::INVALID_INDEX) { + //! This *might* be allowed by the spec, it's hard to reason about.. + return false; + } + LogicalType child_type; + if (!TypedValueLayoutToType(element_children[index].second, child_type)) { + return false; + } + output = LogicalType::LIST(child_type); + return true; + } + throw InvalidInputException("VARIANT typed value has to be a primitive/struct/list, not %s", + typed_value.ToString()); +} + } // namespace duckdb diff --git a/src/duckdb/extension/parquet/writer/list_column_writer.cpp b/src/duckdb/extension/parquet/writer/list_column_writer.cpp index a54017f23..b0d590eec 100644 --- a/src/duckdb/extension/parquet/writer/list_column_writer.cpp +++ b/src/duckdb/extension/parquet/writer/list_column_writer.cpp @@ -146,7 +146,12 @@ ColumnWriter &ListColumnWriter::GetChildWriter() { return *child_writers[0]; } -void ListColumnWriter::FinalizeSchema(vector &schemas) { +const ColumnWriter &ListColumnWriter::GetChildWriter() const { + D_ASSERT(child_writers.size() == 1); + return *child_writers[0]; +} + +idx_t ListColumnWriter::FinalizeSchema(vector &schemas) { idx_t schema_idx = schemas.size(); auto &schema = column_schema; @@ -189,7 +194,7 @@ void ListColumnWriter::FinalizeSchema(vector &sch //! Instead, the "key_value" struct will be marked as REPEATED D_ASSERT(GetChildWriter().Schema().repetition_type == FieldRepetitionType::REPEATED); } - GetChildWriter().FinalizeSchema(schemas); + return GetChildWriter().FinalizeSchema(schemas); } } // namespace duckdb diff --git a/src/duckdb/extension/parquet/writer/primitive_column_writer.cpp b/src/duckdb/extension/parquet/writer/primitive_column_writer.cpp index dcaf80520..238461755 100644 --- a/src/duckdb/extension/parquet/writer/primitive_column_writer.cpp +++ b/src/duckdb/extension/parquet/writer/primitive_column_writer.cpp @@ -264,11 +264,11 @@ void PrimitiveColumnWriter::SetParquetStatistics(PrimitiveColumnWriterState &sta if (!state.stats_state) { return; } - if (MaxRepeat() == 0) { - column_chunk.meta_data.statistics.null_count = NumericCast(state.null_count); - column_chunk.meta_data.statistics.__isset.null_count = true; - column_chunk.meta_data.__isset.statistics = true; - } + auto null_count = MaxRepeat() == 0 ? state.null_count : state.null_count + state.parent_null_count; + column_chunk.meta_data.statistics.null_count = NumericCast(null_count); + column_chunk.meta_data.statistics.__isset.null_count = true; + column_chunk.meta_data.__isset.statistics = true; + // if we have NaN values - don't write the min/max here if (!state.stats_state->HasNaN()) { // set min/max/min_value/max_value @@ -382,7 +382,6 @@ void PrimitiveColumnWriter::FinalizeWrite(ColumnWriterState &state_p) { if (state.bloom_filter) { writer.BufferBloomFilter(state.col_idx, std::move(state.bloom_filter)); } - // finalize the stats writer.FlushColumnStats(state.col_idx, column_chunk, state.stats_state.get()); } @@ -431,7 +430,7 @@ void PrimitiveColumnWriter::WriteDictionary(PrimitiveColumnWriterState &state, u state.write_info.insert(state.write_info.begin(), std::move(write_info)); } -void PrimitiveColumnWriter::FinalizeSchema(vector &schemas) { +idx_t PrimitiveColumnWriter::FinalizeSchema(vector &schemas) { idx_t schema_idx = schemas.size(); auto &schema = column_schema; @@ -458,6 +457,7 @@ void PrimitiveColumnWriter::FinalizeSchema(vector schemas.push_back(std::move(schema_element)); D_ASSERT(child_writers.empty()); + return 1; } } // namespace duckdb diff --git a/src/duckdb/extension/parquet/writer/struct_column_writer.cpp b/src/duckdb/extension/parquet/writer/struct_column_writer.cpp index a792b736b..d17b32d06 100644 --- a/src/duckdb/extension/parquet/writer/struct_column_writer.cpp +++ b/src/duckdb/extension/parquet/writer/struct_column_writer.cpp @@ -105,7 +105,7 @@ void StructColumnWriter::FinalizeWrite(ColumnWriterState &state_p) { } } -void StructColumnWriter::FinalizeSchema(vector &schemas) { +idx_t StructColumnWriter::FinalizeSchema(vector &schemas) { idx_t schema_idx = schemas.size(); auto &schema = column_schema; @@ -129,9 +129,11 @@ void StructColumnWriter::FinalizeSchema(vector &s } schemas.push_back(std::move(schema_element)); + idx_t unique_columns = 0; for (auto &child_writer : child_writers) { - child_writer->FinalizeSchema(schemas); + unique_columns += child_writer->FinalizeSchema(schemas); } + return unique_columns; } } // namespace duckdb diff --git a/src/duckdb/extension/parquet/writer/variant/analyze_variant.cpp b/src/duckdb/extension/parquet/writer/variant/analyze_variant.cpp index c7575d09f..becd73e17 100644 --- a/src/duckdb/extension/parquet/writer/variant/analyze_variant.cpp +++ b/src/duckdb/extension/parquet/writer/variant/analyze_variant.cpp @@ -14,6 +14,7 @@ unique_ptr VariantColumnWriter::AnalyzeSchemaInit() { static void AnalyzeSchemaInternal(VariantAnalyzeData &state, UnifiedVariantVectorData &variant, idx_t row, uint32_t values_index) { + state.total_count++; if (!variant.RowIsValid(row)) { state.type_map[static_cast(VariantLogicalType::VARIANT_NULL)]++; return; @@ -50,19 +51,19 @@ static void AnalyzeSchemaInternal(VariantAnalyzeData &state, UnifiedVariantVecto } } else if (type_id == VariantLogicalType::DECIMAL) { auto decimal_data = VariantUtils::DecodeDecimalData(variant, row, values_index); - auto physical_type = decimal_data.GetPhysicalType(); - switch (physical_type) { - case PhysicalType::INT32: - state.decimal_type_map[0]++; - break; - case PhysicalType::INT64: - state.decimal_type_map[1]++; - break; - case PhysicalType::INT128: - state.decimal_type_map[2]++; - break; - default: - break; + auto decimal_count = state.type_map[static_cast(VariantLogicalType::DECIMAL)]; + decimal_count--; + if (!decimal_count) { + state.decimal_width = decimal_data.width; + state.decimal_scale = decimal_data.scale; + state.decimal_consistent = true; + return; + } + if (!state.decimal_consistent) { + return; + } + if (decimal_data.width != state.decimal_width || decimal_data.scale != state.decimal_scale) { + state.decimal_consistent = false; } } else if (type_id == VariantLogicalType::BOOL_FALSE) { //! Move it to bool_true to have the counts all in one place @@ -87,8 +88,7 @@ namespace { struct ShredAnalysisState { idx_t highest_count = 0; - LogicalTypeId type_id; - PhysicalType decimal_type; + LogicalType type; }; } // namespace @@ -96,36 +96,30 @@ struct ShredAnalysisState { template static void CheckPrimitive(const VariantAnalyzeData &state, ShredAnalysisState &result) { auto count = state.type_map[static_cast(VARIANT_TYPE)]; + if (count <= result.highest_count) { + return; + } if (VARIANT_TYPE == VariantLogicalType::DECIMAL) { - if (!count) { + D_ASSERT(count); + if (!state.decimal_consistent) { return; } - auto int32_count = state.decimal_type_map[0]; - if (int32_count > result.highest_count) { - result.type_id = LogicalTypeId::DECIMAL; - result.decimal_type = PhysicalType::INT32; - } - auto int64_count = state.decimal_type_map[1]; - if (int64_count > result.highest_count) { - result.type_id = LogicalTypeId::DECIMAL; - result.decimal_type = PhysicalType::INT64; - } - auto int128_count = state.decimal_type_map[2]; - if (int128_count > result.highest_count) { - result.type_id = LogicalTypeId::DECIMAL; - result.decimal_type = PhysicalType::INT128; - } + result.highest_count = count; + result.type = LogicalType::DECIMAL(state.decimal_width, state.decimal_scale); } else { - if (count > result.highest_count) { - result.highest_count = count; - result.type_id = SHREDDED_TYPE; - } + result.highest_count = count; + result.type = SHREDDED_TYPE; } } static LogicalType ConstructShreddedType(const VariantAnalyzeData &state) { ShredAnalysisState result; + if (state.type_map[0] == state.total_count) { + //! All NULL, emit INT32 + return LogicalType::INTEGER; + } + CheckPrimitive(state, result); CheckPrimitive(state, result); CheckPrimitive(state, result); @@ -133,9 +127,7 @@ static LogicalType ConstructShreddedType(const VariantAnalyzeData &state) { CheckPrimitive(state, result); CheckPrimitive(state, result); CheckPrimitive(state, result); - //! FIXME: It's not enough for decimals to have the same PhysicalType, their width+scale has to match in order to - //! shred on the type. - // CheckPrimitive(state, result); + CheckPrimitive(state, result); CheckPrimitive(state, result); CheckPrimitive(state, result); CheckPrimitive(state, result); @@ -165,27 +157,19 @@ static LogicalType ConstructShreddedType(const VariantAnalyzeData &state) { return LogicalType::STRUCT(field_types); } } - - if (result.type_id == LogicalTypeId::DECIMAL) { - //! TODO: what should the scale be??? - if (result.decimal_type == PhysicalType::INT32) { - return LogicalType::DECIMAL(DecimalWidth::max, 0); - } else if (result.decimal_type == PhysicalType::INT64) { - return LogicalType::DECIMAL(DecimalWidth::max, 0); - } else if (result.decimal_type == PhysicalType::INT128) { - return LogicalType::DECIMAL(DecimalWidth::max, 0); - } - } - return result.type_id; + return result.type; } void VariantColumnWriter::AnalyzeSchemaFinalize(const ParquetAnalyzeSchemaState &state_p) { auto &state = state_p.Cast(); auto shredded_type = ConstructShreddedType(state.analyze_data); - - auto typed_value = TransformTypedValueRecursive(shredded_type); is_analyzed = true; + if (shredded_type.id() == LogicalTypeId::VARIANT) { + //! Can't shred, keep the original children + return; + } + auto typed_value = TransformTypedValueRecursive(shredded_type); auto &schema = Schema(); auto &context = writer.GetContext(); D_ASSERT(child_writers.size() == 2); diff --git a/src/duckdb/extension/parquet/writer/variant/convert_variant.cpp b/src/duckdb/extension/parquet/writer/variant/convert_variant.cpp index f7be8c755..bb2d73b6f 100644 --- a/src/duckdb/extension/parquet/writer/variant/convert_variant.cpp +++ b/src/duckdb/extension/parquet/writer/variant/convert_variant.cpp @@ -5,6 +5,7 @@ #include "reader/variant/variant_binary_decoder.hpp" #include "parquet_shredding.hpp" #include "duckdb/function/variant/variant_shredding.hpp" +#include "duckdb/planner/expression_binder.hpp" namespace duckdb { @@ -809,7 +810,7 @@ static void ToParquetVariant(DataChunk &input, ExpressionState &state, Vector &r } } -void VariantColumnWriter::FinalizeSchema(vector &schemas) { +idx_t VariantColumnWriter::FinalizeSchema(vector &schemas) { idx_t schema_idx = schemas.size(); auto &schema = Schema(); @@ -817,6 +818,7 @@ void VariantColumnWriter::FinalizeSchema(vector & auto &repetition_type = schema.repetition_type; auto &name = schema.name; + auto &field_id = schema.field_id; // variant group duckdb_parquet::SchemaElement top_element; @@ -829,11 +831,17 @@ void VariantColumnWriter::FinalizeSchema(vector & top_element.__isset.num_children = true; top_element.__isset.repetition_type = true; top_element.name = name; + if (field_id.IsValid()) { + top_element.__isset.field_id = true; + top_element.field_id = field_id.GetIndex(); + } schemas.push_back(std::move(top_element)); + idx_t unique_columns = 0; for (auto &child_writer : child_writers) { - child_writer->FinalizeSchema(schemas); + unique_columns += child_writer->FinalizeSchema(schemas); } + return unique_columns; } LogicalType VariantColumnWriter::TransformTypedValueRecursive(const LogicalType &type) { @@ -865,7 +873,7 @@ LogicalType VariantColumnWriter::TransformTypedValueRecursive(const LogicalType case LogicalTypeId::MAP: case LogicalTypeId::VARIANT: case LogicalTypeId::ARRAY: - throw BinderException("'%s' can't appear inside the a 'typed_value' shredded type!", type.ToString()); + throw BinderException("'%s' can't appear inside a 'typed_value' shredded type!", type.ToString()); default: return type; } @@ -875,7 +883,7 @@ static LogicalType GetParquetVariantType(optional_ptr shredding = n child_list_t children; children.emplace_back("metadata", LogicalType::BLOB); children.emplace_back("value", LogicalType::BLOB); - if (shredding) { + if (shredding && shredding->id() != LogicalTypeId::VARIANT) { children.emplace_back("typed_value", VariantColumnWriter::TransformTypedValueRecursive(*shredding)); } auto res = LogicalType::STRUCT(std::move(children)); @@ -906,7 +914,7 @@ static unique_ptr BindTransform(ClientContext &context, ScalarFunc if (type_str.IsNull()) { throw BinderException("Optional second argument 'shredding' can not be NULL"); } - auto shredded_type = TransformStringToLogicalType(type_str.GetValue()); + auto shredded_type = TransformStringToLogicalType(type_str.GetValue(), context); bound_function.SetReturnType(GetParquetVariantType(shredded_type)); } else { bound_function.SetReturnType(GetParquetVariantType()); diff --git a/src/duckdb/src/catalog/catalog_entry/aggregate_function_catalog_entry.cpp b/src/duckdb/src/catalog/catalog_entry/aggregate_function_catalog_entry.cpp new file mode 100644 index 000000000..e8c653d94 --- /dev/null +++ b/src/duckdb/src/catalog/catalog_entry/aggregate_function_catalog_entry.cpp @@ -0,0 +1,17 @@ +#include "duckdb/catalog/catalog_entry/aggregate_function_catalog_entry.hpp" +#include "duckdb/parser/parsed_data/create_aggregate_function_info.hpp" +#include "duckdb/catalog/catalog_entry/schema_catalog_entry.hpp" +#include "duckdb/main/attached_database.hpp" + +namespace duckdb { + +AggregateFunctionCatalogEntry::AggregateFunctionCatalogEntry(Catalog &catalog, SchemaCatalogEntry &schema, + CreateAggregateFunctionInfo &info) + : FunctionEntry(CatalogType::AGGREGATE_FUNCTION_ENTRY, catalog, schema, info), functions(info.functions) { + for (auto &function : functions.functions) { + function.catalog_name = catalog.GetAttached().GetName(); + function.schema_name = schema.name; + } +} + +} // namespace duckdb diff --git a/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp b/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp index eda90ac9e..365561fd4 100644 --- a/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp +++ b/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp @@ -53,6 +53,10 @@ DuckTableEntry::DuckTableEntry(Catalog &catalog, SchemaCatalogEntry &schema, Bou // create the physical storage vector column_defs; for (auto &col_def : columns.Physical()) { + if (TypeVisitor::Contains(col_def.Type(), LogicalTypeId::TYPE)) { + throw InvalidInputException("A table cannot be created with a 'TYPE' column"); + } + column_defs.push_back(col_def.Copy()); } storage = make_shared_ptr(catalog.GetAttached(), StorageManager::Get(catalog).GetTableIOManager(&info), @@ -242,6 +246,11 @@ unique_ptr DuckTableEntry::AlterEntry(ClientContext &context, Alte throw NotImplementedException("SET PARTITIONED BY is not supported for DuckDB tables"); case AlterTableType::SET_SORTED_BY: throw NotImplementedException("SET SORTED BY is not supported for DuckDB tables"); + case AlterTableType::SET_TABLE_OPTIONS: + throw NotImplementedException("SET () is not supported for DuckDB tables"); + case AlterTableType::RESET_TABLE_OPTIONS: { + throw NotImplementedException("RESET () is not supported for DuckDB tables"); + } default: throw InternalException("Unrecognized alter table type!"); } @@ -359,8 +368,11 @@ unique_ptr DuckTableEntry::AddColumn(ClientContext &context, AddCo for (auto &constraint : constraints) { create_info->constraints.push_back(constraint->Copy()); } + auto binder = Binder::CreateBinder(context); - binder->BindLogicalType(info.new_column.TypeMutable(), &catalog, schema.name); + binder->SetSearchPath(catalog, schema.name); + binder->BindLogicalType(info.new_column.TypeMutable()); + info.new_column.SetOid(columns.LogicalColumnCount()); info.new_column.SetStorageOid(columns.PhysicalColumnCount()); auto col = info.new_column.Copy(); @@ -973,8 +985,10 @@ unique_ptr DuckTableEntry::DropNotNull(ClientContext &context, Dro } unique_ptr DuckTableEntry::ChangeColumnType(ClientContext &context, ChangeColumnTypeInfo &info) { - auto binder = Binder::CreateBinder(context); - binder->BindLogicalType(info.target_type, &catalog, schema.name); + // Bind type + auto type_binder = Binder::CreateBinder(context); + type_binder->SetSearchPath(catalog, schema.name); + type_binder->BindLogicalType(info.target_type); auto change_idx = GetColumnIndex(info.column_name); auto create_info = make_uniq(schema, name); @@ -983,6 +997,7 @@ unique_ptr DuckTableEntry::ChangeColumnType(ClientContext &context create_info->tags = tags; // Bind the USING expression. + auto binder = Binder::CreateBinder(context); vector bound_columns; AlterBinder expr_binder(*binder, context, *this, bound_columns, info.target_type); auto expression = info.expression->Copy(); diff --git a/src/duckdb/src/catalog/catalog_entry/scalar_function_catalog_entry.cpp b/src/duckdb/src/catalog/catalog_entry/scalar_function_catalog_entry.cpp index e5778ad4c..16cc2627b 100644 --- a/src/duckdb/src/catalog/catalog_entry/scalar_function_catalog_entry.cpp +++ b/src/duckdb/src/catalog/catalog_entry/scalar_function_catalog_entry.cpp @@ -1,7 +1,9 @@ #include "duckdb/catalog/catalog_entry/scalar_function_catalog_entry.hpp" + +#include "duckdb/catalog/catalog_entry/schema_catalog_entry.hpp" #include "duckdb/common/vector.hpp" -#include "duckdb/parser/parsed_data/alter_scalar_function_info.hpp" #include "duckdb/main/attached_database.hpp" +#include "duckdb/parser/parsed_data/alter_scalar_function_info.hpp" namespace duckdb { diff --git a/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp b/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp index f31a589ee..6922aab5f 100644 --- a/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +++ b/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp @@ -4,16 +4,18 @@ #include "duckdb/catalog/catalog_entry/schema_catalog_entry.hpp" #include "duckdb/common/algorithm.hpp" #include "duckdb/common/exception.hpp" +#include "duckdb/common/extra_type_info.hpp" #include "duckdb/main/database.hpp" #include "duckdb/parser/constraints/list.hpp" +#include "duckdb/parser/expression/cast_expression.hpp" #include "duckdb/parser/parsed_data/create_table_info.hpp" -#include "duckdb/storage/table_storage_info.hpp" -#include "duckdb/planner/operator/logical_update.hpp" -#include "duckdb/planner/operator/logical_get.hpp" +#include "duckdb/planner/binder.hpp" #include "duckdb/planner/constraints/bound_check_constraint.hpp" +#include "duckdb/planner/expression/bound_columnref_expression.hpp" +#include "duckdb/planner/operator/logical_get.hpp" #include "duckdb/planner/operator/logical_projection.hpp" -#include "duckdb/common/extra_type_info.hpp" -#include "duckdb/parser/expression/cast_expression.hpp" +#include "duckdb/planner/operator/logical_update.hpp" +#include "duckdb/storage/table_storage_info.hpp" #include @@ -157,10 +159,19 @@ string TableCatalogEntry::ColumnsToSQL(const ColumnList &columns, const vectortype == ExtraTypeInfoType::STRING_TYPE_INFO) { - auto &string_info = extra_type_info->Cast(); - if (!string_info.collation.empty()) { - ss << " COLLATE " + string_info.collation; + if (extra_type_info) { + if (extra_type_info->type == ExtraTypeInfoType::STRING_TYPE_INFO) { + auto &string_info = extra_type_info->Cast(); + if (!string_info.collation.empty()) { + ss << " COLLATE " + string_info.collation; + } + } + if (extra_type_info->type == ExtraTypeInfoType::UNBOUND_TYPE_INFO) { + // TODO + // auto &colllation = UnboundType::GetCollation(column_type); + // if (!colllation.empty()) { + // ss << " COLLATE " + colllation; + //} } } bool not_null = not_null_columns.find(column.Logical()) != not_null_columns.end(); @@ -174,7 +185,6 @@ string TableCatalogEntry::ColumnsToSQL(const ColumnList &columns, const vector(); - D_ASSERT(cast_expr.cast_type.id() == column_type.id()); generated_expression = *cast_expr.child; } ss << " GENERATED ALWAYS AS(" << generated_expression.get().ToString() << ")"; diff --git a/src/duckdb/src/catalog/catalog_entry/table_function_catalog_entry.cpp b/src/duckdb/src/catalog/catalog_entry/table_function_catalog_entry.cpp index f06ef164e..6ad264ca7 100644 --- a/src/duckdb/src/catalog/catalog_entry/table_function_catalog_entry.cpp +++ b/src/duckdb/src/catalog/catalog_entry/table_function_catalog_entry.cpp @@ -1,6 +1,8 @@ #include "duckdb/catalog/catalog_entry/table_function_catalog_entry.hpp" -#include "duckdb/parser/parsed_data/alter_table_function_info.hpp" + +#include "duckdb/catalog/catalog_entry/schema_catalog_entry.hpp" #include "duckdb/main/attached_database.hpp" +#include "duckdb/parser/parsed_data/alter_table_function_info.hpp" namespace duckdb { diff --git a/src/duckdb/src/catalog/catalog_entry/view_catalog_entry.cpp b/src/duckdb/src/catalog/catalog_entry/view_catalog_entry.cpp index a02de0cec..89ae13950 100644 --- a/src/duckdb/src/catalog/catalog_entry/view_catalog_entry.cpp +++ b/src/duckdb/src/catalog/catalog_entry/view_catalog_entry.cpp @@ -7,6 +7,8 @@ #include "duckdb/parser/parsed_data/create_view_info.hpp" #include "duckdb/parser/parsed_data/comment_on_column_info.hpp" #include "duckdb/common/limits.hpp" +#include "duckdb/planner/binder.hpp" +#include "duckdb/catalog/catalog.hpp" #include @@ -15,19 +17,27 @@ namespace duckdb { void ViewCatalogEntry::Initialize(CreateViewInfo &info) { query = std::move(info.query); this->aliases = info.aliases; - this->types = info.types; - this->names = info.names; + if (!info.types.empty() && !info.names.empty()) { + bind_state = ViewBindState::BOUND; + view_columns = make_shared_ptr(); + view_columns->types = info.types; + view_columns->names = info.names; + if (info.types.size() != info.names.size()) { + throw InternalException("Error creating view %s - view types / names size mismatch (%d types, %d names)", + name, info.types.size(), info.names.size()); + } + } this->temporary = info.temporary; this->sql = info.sql; this->internal = info.internal; this->dependencies = info.dependencies; this->comment = info.comment; this->tags = info.tags; - this->column_comments = info.column_comments; + this->column_comments = info.column_comments_map; } ViewCatalogEntry::ViewCatalogEntry(Catalog &catalog, SchemaCatalogEntry &schema, CreateViewInfo &info) - : StandardEntry(CatalogType::VIEW_ENTRY, schema, catalog, info.view_name) { + : StandardEntry(CatalogType::VIEW_ENTRY, schema, catalog, info.view_name), bind_state(ViewBindState::UNBOUND) { Initialize(info); } @@ -38,13 +48,16 @@ unique_ptr ViewCatalogEntry::GetInfo() const { result->sql = sql; result->query = query ? unique_ptr_cast(query->Copy()) : nullptr; result->aliases = aliases; - result->names = names; - result->types = types; + auto view_columns = GetColumnInfo(); + if (view_columns) { + result->names = view_columns->names; + result->types = view_columns->types; + } result->temporary = temporary; result->dependencies = dependencies; result->comment = comment; result->tags = tags; - result->column_comments = column_comments; + result->column_comments_map = column_comments; return std::move(result); } @@ -56,22 +69,20 @@ unique_ptr ViewCatalogEntry::AlterEntry(ClientContext &context, Al auto &comment_on_column_info = info.Cast(); auto copied_view = Copy(context); - for (idx_t i = 0; i < names.size(); i++) { - const auto &col_name = names[i]; - if (col_name == comment_on_column_info.column_name) { - auto &copied_view_entry = copied_view->Cast(); - - // If vector is empty, we need to initialize it on setting here - if (copied_view_entry.column_comments.empty()) { - copied_view_entry.column_comments = vector(copied_view_entry.types.size()); - } - - copied_view_entry.column_comments[i] = comment_on_column_info.comment_value; - return copied_view; + auto view_columns = GetColumnInfo(); + if (view_columns) { + // if the view is bound - verify the name we are commenting on exists + auto &names = view_columns->names; + auto entry = std::find(names.begin(), names.end(), comment_on_column_info.column_name); + if (entry == names.end()) { + throw BinderException("View \"%s\" does not have a column with name \"%s\"", name, + comment_on_column_info.column_name); } } - throw BinderException("View \"%s\" does not have a column with name \"%s\"", name, - comment_on_column_info.column_name); + // apply the comment to the view + auto &copied_view_entry = copied_view->Cast(); + copied_view_entry.column_comments[comment_on_column_info.column_name] = comment_on_column_info.comment_value; + return copied_view; } if (info.type != AlterType::ALTER_VIEW) { @@ -90,6 +101,61 @@ unique_ptr ViewCatalogEntry::AlterEntry(ClientContext &context, Al } } +shared_ptr ViewCatalogEntry::GetColumnInfo() const { + return view_columns.atomic_load(); +} + +Value ViewCatalogEntry::GetColumnComment(idx_t column_index) { + auto view_columns = GetColumnInfo(); + if (!view_columns) { + throw InternalException("ViewCatalogEntry::GetColumnComment called - but view has not been bound yet"); + } + auto &names = view_columns->names; + if (column_index >= names.size()) { + return Value(); + } + auto &name = names[column_index]; + auto entry = column_comments.find(name); + if (entry != column_comments.end()) { + return entry->second; + } + return Value(); +} + +void ViewCatalogEntry::BindView(ClientContext &context, BindViewAction action) { + if (bind_state == ViewBindState::BINDING && bind_thread == ThreadUtil::GetThreadId()) { + throw InvalidInputException("View \"%s\" was requested to be bound but this thread is already binding that " + "view - this likely means the view was attempted to be bound recursively", + name); + } + lock_guard guard(bind_lock); + if (action == BindViewAction::BIND_IF_UNBOUND && view_columns) { + // already bound + return; + } + bind_state = ViewBindState::BINDING; + bind_thread = ThreadUtil::GetThreadId(); + auto columns = make_shared_ptr(); + Binder::BindView(context, GetQuery(), ParentCatalog().GetName(), ParentSchema().name, nullptr, aliases, + columns->types, columns->names); + view_columns.atomic_store(columns); + bind_state = ViewBindState::BOUND; +} + +void ViewCatalogEntry::UpdateBinding(const vector &types_p, const vector &names_p) { + auto columns = view_columns.atomic_load(); + if (columns && columns->types == types_p && columns->names == names_p) { + // already bound with the current info + return; + } + lock_guard guard(bind_lock); + auto new_columns = make_shared_ptr(); + new_columns->types = types_p; + new_columns->names = names_p; + view_columns.atomic_store(new_columns); + bind_state = ViewBindState::BOUND; +} + string ViewCatalogEntry::ToSQL() const { if (sql.empty()) { //! Return empty sql with view name so pragma view_tables don't complain diff --git a/src/duckdb/src/catalog/catalog_set.cpp b/src/duckdb/src/catalog/catalog_set.cpp index 6e5b17610..5af535016 100644 --- a/src/duckdb/src/catalog/catalog_set.cpp +++ b/src/duckdb/src/catalog/catalog_set.cpp @@ -568,12 +568,17 @@ optional_ptr CatalogSet::CreateDefaultEntry(CatalogTransaction tra // no defaults either: return null return nullptr; } - read_lock.unlock(); + auto unlock = !defaults->LockDuringCreate(); + if (unlock) { + read_lock.unlock(); + } // this catalog set has a default map defined // check if there is a default entry that we can create with this name auto entry = defaults->CreateDefaultEntry(transaction, name); - read_lock.lock(); + if (unlock) { + read_lock.lock(); + } if (!entry) { // no default entry return nullptr; @@ -586,7 +591,9 @@ optional_ptr CatalogSet::CreateDefaultEntry(CatalogTransaction tra // we found a default entry, but failed // this means somebody else created the entry first // just retry? - read_lock.unlock(); + if (unlock) { + read_lock.unlock(); + } return GetEntry(transaction, name); } @@ -657,6 +664,7 @@ void CatalogSet::CreateDefaultEntries(CatalogTransaction transaction, unique_loc if (!defaults || defaults->created_all_entries) { return; } + auto unlock = !defaults->LockDuringCreate(); // this catalog set has a default set defined: auto default_entries = defaults->GetDefaultEntries(); for (auto &default_entry : default_entries) { @@ -664,13 +672,17 @@ void CatalogSet::CreateDefaultEntries(CatalogTransaction transaction, unique_loc if (!entry_value) { // we unlock during the CreateEntry, since it might reference other catalog sets... // specifically for views this can happen since the view will be bound - read_lock.unlock(); + if (unlock) { + read_lock.unlock(); + } auto entry = defaults->CreateDefaultEntry(transaction, default_entry); if (!entry) { throw InternalException("Failed to create default entry for %s", default_entry); } - read_lock.lock(); + if (unlock) { + read_lock.lock(); + } CreateCommittedEntry(std::move(entry)); } } diff --git a/src/duckdb/src/catalog/default/default_functions.cpp b/src/duckdb/src/catalog/default/default_functions.cpp index 37d5e0286..ec40b5bbc 100644 --- a/src/duckdb/src/catalog/default/default_functions.cpp +++ b/src/duckdb/src/catalog/default/default_functions.cpp @@ -62,7 +62,7 @@ static const DefaultMacro internal_macros[] = { {"pg_catalog", "pg_get_expr", {"pg_node_tree", "relation_oid", nullptr}, {{nullptr, nullptr}}, "pg_node_tree"}, {"pg_catalog", "format_pg_type", {"logical_type", "type_name", nullptr}, {{nullptr, nullptr}}, "case upper(logical_type) when 'FLOAT' then 'float4' when 'DOUBLE' then 'float8' when 'DECIMAL' then 'numeric' when 'ENUM' then lower(type_name) when 'VARCHAR' then 'varchar' when 'BLOB' then 'bytea' when 'TIMESTAMP' then 'timestamp' when 'TIME' then 'time' when 'TIMESTAMP WITH TIME ZONE' then 'timestamptz' when 'TIME WITH TIME ZONE' then 'timetz' when 'SMALLINT' then 'int2' when 'INTEGER' then 'int4' when 'BIGINT' then 'int8' when 'BOOLEAN' then 'bool' else lower(logical_type) end"}, {"pg_catalog", "format_type", {"type_oid", "typemod", nullptr}, {{nullptr, nullptr}}, "(select format_pg_type(logical_type, type_name) from duckdb_types() t where t.type_oid=type_oid) || case when typemod>0 then concat('(', typemod//1000, ',', typemod%1000, ')') else '' end"}, - {"pg_catalog", "map_to_pg_oid", {"type_name", nullptr}, {{nullptr, nullptr}}, "case type_name when 'bool' then 16 when 'int16' then 21 when 'int' then 23 when 'bigint' then 20 when 'date' then 1082 when 'time' then 1083 when 'datetime' then 1114 when 'dec' then 1700 when 'float' then 700 when 'double' then 701 when 'bpchar' then 1043 when 'binary' then 17 when 'interval' then 1186 when 'timestamptz' then 1184 when 'timetz' then 1266 when 'bit' then 1560 when 'guid' then 2950 else null end"}, // map duckdb_oid to pg_oid. If no corresponding type, return null + {"pg_catalog", "map_to_pg_oid", {"type_name", nullptr}, {{nullptr, nullptr}}, "case type_name when 'bool' then 16 when 'int16' then 21 when 'int' then 23 when 'bigint' then 20 when 'date' then 1082 when 'time' then 1083 when 'datetime' then 1114 when 'dec' then 1700 when 'float' then 700 when 'double' then 701 when 'bpchar' then 1043 when 'binary' then 17 when 'interval' then 1186 when 'timestamptz' then 1184 when 'timestamp with time zone' then 1184 when 'timetz' then 1266 when 'time with time zone' then 1266 when 'bit' then 1560 when 'guid' then 2950 else null end"}, // map duckdb_oid to pg_oid. If no corresponding type, return null {"pg_catalog", "pg_has_role", {"user", "role", "privilege", nullptr}, {{nullptr, nullptr}}, "true"}, //boolean //does user have privilege for role {"pg_catalog", "pg_has_role", {"role", "privilege", nullptr}, {{nullptr, nullptr}}, "true"}, //boolean //does current user have privilege for role diff --git a/src/duckdb/src/catalog/default/default_types.cpp b/src/duckdb/src/catalog/default/default_types.cpp index 23edac049..2e3c5c6da 100644 --- a/src/duckdb/src/catalog/default/default_types.cpp +++ b/src/duckdb/src/catalog/default/default_types.cpp @@ -4,10 +4,537 @@ #include "duckdb/catalog/catalog_entry/type_catalog_entry.hpp" #include "duckdb/common/string_util.hpp" #include "duckdb/parser/parsed_data/create_type_info.hpp" -#include "duckdb/catalog/default/builtin_types/types.hpp" +#include "duckdb/common/types/decimal.hpp" +#include "duckdb/common/exception/binder_exception.hpp" +#include "duckdb/common/array.hpp" +#include "duckdb/planner/expression_binder.hpp" namespace duckdb { +namespace { + +//---------------------------------------------------------------------------------------------------------------------- +// DECIMAL Type +//---------------------------------------------------------------------------------------------------------------------- +LogicalType BindDecimalType(BindLogicalTypeInput &input) { + auto &modifiers = input.modifiers; + + uint8_t width = 18; + uint8_t scale = 3; + + if (!modifiers.empty()) { + auto width_value = modifiers[0].GetValue(); + if (width_value.IsNull()) { + throw BinderException("DECIMAL type width cannot be NULL"); + } + if (width_value.DefaultTryCastAs(LogicalTypeId::UTINYINT)) { + width = width_value.GetValueUnsafe(); + scale = 0; // reset scale to 0 if only width is provided + } else { + throw BinderException("DECIMAL type width must be between 1 and %d", Decimal::MAX_WIDTH_DECIMAL); + } + } + + if (modifiers.size() > 1) { + auto scale_value = modifiers[1].GetValue(); + if (scale_value.IsNull()) { + throw BinderException("DECIMAL type scale cannot be NULL"); + } + if (scale_value.DefaultTryCastAs(LogicalTypeId::UTINYINT)) { + scale = scale_value.GetValueUnsafe(); + } else { + throw BinderException("DECIMAL type scale must be between 0 and %d", Decimal::MAX_WIDTH_DECIMAL - 1); + } + } + + if (modifiers.size() > 2) { + throw BinderException("DECIMAL type can take at most two type modifiers, width and scale"); + } + + if (width < 1 || width > Decimal::MAX_WIDTH_DECIMAL) { + throw BinderException("DECIMAL type width must be between 1 and %d", Decimal::MAX_WIDTH_DECIMAL); + } + + if (scale > width) { + throw BinderException("DECIMAL type scale cannot be greater than width"); + } + return LogicalType::DECIMAL(width, scale); +} + +//---------------------------------------------------------------------------------------------------------------------- +// TIMESTAMP Type +//---------------------------------------------------------------------------------------------------------------------- +LogicalType BindTimestampType(BindLogicalTypeInput &input) { + auto &modifiers = input.modifiers; + + if (modifiers.empty()) { + return LogicalType::TIMESTAMP; + } + + if (modifiers.size() > 1) { + throw BinderException("TIMESTAMP type takes at most one type modifier"); + } + + auto precision_value = modifiers[0].GetValue(); + if (precision_value.IsNull()) { + throw BinderException("TIMESTAMP type precision cannot be NULL"); + } + uint8_t precision; + if (precision_value.DefaultTryCastAs(LogicalTypeId::UTINYINT)) { + precision = precision_value.GetValueUnsafe(); + } else { + throw BinderException("TIMESTAMP type precision must be between 0 and 9"); + } + + if (precision > 9) { + throw BinderException("TIMESTAMP only supports until nano-second precision (9)"); + } + if (precision == 0) { + return LogicalType::TIMESTAMP_S; + } + if (precision <= 3) { + return LogicalType::TIMESTAMP_MS; + } + if (precision <= 6) { + return LogicalType::TIMESTAMP; + } + return LogicalType::TIMESTAMP_NS; +} + +//---------------------------------------------------------------------------------------------------------------------- +// VARCHAR Type +//---------------------------------------------------------------------------------------------------------------------- +LogicalType BindVarcharType(BindLogicalTypeInput &input) { + // Varchar type can have a single modifier indicating the length, but we ignore it for now + auto &modifiers = input.modifiers; + + if (!modifiers.empty() && modifiers.size() <= 2) { + for (auto &mod : modifiers) { + if (mod.IsNamed("collation") && mod.GetType() == LogicalType::VARCHAR && mod.IsNotNull()) { + // Ignore all other modifiers and return collation type + auto collation = StringValue::Get(mod.GetValue()); + + if (!input.context) { + throw BinderException("Cannot bind varchar with collation without a connection"); + } + + // Ensure this is a valid collation + ExpressionBinder::TestCollation(*input.context, collation); + + return LogicalType::VARCHAR_COLLATION(collation); + } + } + } + + if (modifiers.size() > 1) { + throw BinderException("VARCHAR type takes at most one type modifier"); + } + + return LogicalType::VARCHAR; +} + +//---------------------------------------------------------------------------------------------------------------------- +// BIT Type +//---------------------------------------------------------------------------------------------------------------------- +LogicalType BindBitType(BindLogicalTypeInput &input) { + // BIT type can have a single modifier indicating the length, but we ignore it for now + auto &args = input.modifiers; + if (args.size() > 1) { + throw BinderException("BIT type takes at most one type modifier"); + } + return LogicalType::BIT; +} + +//---------------------------------------------------------------------------------------------------------------------- +// INTERVAL Type +//---------------------------------------------------------------------------------------------------------------------- +LogicalType BindIntervalType(BindLogicalTypeInput &input) { + // Interval type can have a single modifier indicating the leading field, but we ignore it for now + auto &modifiers = input.modifiers; + if (modifiers.size() > 1) { + throw BinderException("INTERVAL type takes at most one type modifier"); + } + return LogicalType::INTERVAL; +} + +//---------------------------------------------------------------------------------------------------------------------- +// ENUM Type +//---------------------------------------------------------------------------------------------------------------------- +LogicalType BindEnumType(BindLogicalTypeInput &input) { + auto &arguments = input.modifiers; + + if (arguments.empty()) { + throw BinderException("ENUM type requires at least one argument"); + } + + Vector enum_vector(LogicalType::VARCHAR, NumericCast(arguments.size())); + auto string_data = FlatVector::GetData(enum_vector); + + for (idx_t arg_idx = 0; arg_idx < arguments.size(); arg_idx++) { + auto &arg = arguments[arg_idx]; + if (arg.HasName()) { + throw BinderException("ENUM type arguments cannot have names (argument %d has name \"%s\")", arg_idx + 1, + arg.GetName()); + } + + if (arg.GetValue().type() != LogicalTypeId::VARCHAR) { + throw BinderException("ENUM type requires a set of VARCHAR arguments"); + } + + if (arg.GetValue().IsNull()) { + throw BinderException("ENUM type arguments cannot be NULL (argument %d is NULL)", arg_idx + 1); + } + + string_data[arg_idx] = StringVector::AddString(enum_vector, StringValue::Get(arg.GetValue())); + } + + return LogicalType::ENUM(enum_vector, NumericCast(arguments.size())); +} + +//---------------------------------------------------------------------------------------------------------------------- +// LIST Type +//---------------------------------------------------------------------------------------------------------------------- +LogicalType BindListType(BindLogicalTypeInput &input) { + auto &arguments = input.modifiers; + if (arguments.size() != 1) { + throw BinderException("LIST type requires exactly one type modifier"); + } + auto &child_val = arguments[0].GetValue(); + if (child_val.IsNull()) { + throw BinderException("LIST type modifier cannot be NULL"); + } + if (child_val.type() != LogicalTypeId::TYPE) { + throw BinderException("LIST type modifier must be a type, but got %s", child_val.ToString()); + } + + auto child_type = TypeValue::GetType(arguments[0].GetValue()); + return LogicalType::LIST(child_type); +} + +//---------------------------------------------------------------------------------------------------------------------- +// ARRAY Type +//---------------------------------------------------------------------------------------------------------------------- +LogicalType BindArrayType(BindLogicalTypeInput &input) { + auto &arguments = input.modifiers; + if (arguments.size() != 2) { + throw BinderException("ARRAY type requires exactly two type modifiers"); + } + auto &elem_val = arguments[0].GetValue(); + if (elem_val.IsNull()) { + throw BinderException("ARRAY type modifier cannot be NULL"); + } + if (elem_val.type() != LogicalTypeId::TYPE) { + throw BinderException("ARRAY type modifier must be a type, but got %s", elem_val.ToString()); + } + + auto size_val = arguments[1].GetValue(); + if (size_val.IsNull()) { + throw BinderException("ARRAY type size modifier cannot be NULL"); + } + if (!size_val.type().IsIntegral()) { + throw BinderException("ARRAY type size modifier must be an integral type"); + } + if (!size_val.DefaultTryCastAs(LogicalTypeId::BIGINT)) { + throw BinderException("ARRAY type size modifier must be a BIGINT"); + } + + auto array_size = size_val.GetValueUnsafe(); + + if (array_size < 1) { + throw BinderException("ARRAY type size must be at least 1"); + } + if (array_size > static_cast(ArrayType::MAX_ARRAY_SIZE)) { + throw BinderException("ARRAY type size must be at most %d", ArrayType::MAX_ARRAY_SIZE); + } + + auto child_type = TypeValue::GetType(arguments[0].GetValue()); + return LogicalType::ARRAY(child_type, UnsafeNumericCast(array_size)); +} + +//---------------------------------------------------------------------------------------------------------------------- +// STRUCT Type +//---------------------------------------------------------------------------------------------------------------------- +LogicalType BindStructType(BindLogicalTypeInput &input) { + auto &arguments = input.modifiers; + + if (arguments.empty()) { + throw BinderException("STRUCT type requires at least one child type"); + } + + auto all_name = true; + auto all_anon = true; + for (auto &arg : arguments) { + if (arg.HasName()) { + all_anon = false; + } else { + all_name = false; + } + + // Also check if all arguments are types + if (arg.GetValue().type() != LogicalTypeId::TYPE) { + throw BinderException("STRUCT type arguments must be types"); + } + + // And not null! + if (arg.GetValue().IsNull()) { + throw BinderException("STRUCT type arguments cannot be NULL"); + } + } + + if (!all_name && !all_anon) { + throw BinderException("STRUCT type arguments must either all have names or all be anonymous"); + } + + if (all_anon) { + // Unnamed struct case + child_list_t children; + for (auto &arg : arguments) { + children.emplace_back("", TypeValue::GetType(arg.GetValue())); + } + return LogicalType::STRUCT(std::move(children)); + } + + // Named struct case + D_ASSERT(all_name); + child_list_t children; + case_insensitive_set_t name_collision_set; + + for (auto &arg : arguments) { + auto &child_name = arg.GetName(); + if (name_collision_set.find(child_name) != name_collision_set.end()) { + throw BinderException("Duplicate STRUCT type argument name \"%s\"", child_name); + } + name_collision_set.insert(child_name); + children.emplace_back(child_name, TypeValue::GetType(arg.GetValue())); + } + + return LogicalType::STRUCT(std::move(children)); +} + +//---------------------------------------------------------------------------------------------------------------------- +// MAP Type +//---------------------------------------------------------------------------------------------------------------------- +LogicalType BindMapType(BindLogicalTypeInput &input) { + auto &arguments = input.modifiers; + + if (arguments.size() != 2) { + throw BinderException("MAP type requires exactly two type modifiers: key type and value type"); + } + + auto &key_val = arguments[0].GetValue(); + auto &val_val = arguments[1].GetValue(); + + if (key_val.type() != LogicalTypeId::TYPE || val_val.type() != LogicalTypeId::TYPE) { + throw BinderException("MAP type modifiers must be types"); + } + if (key_val.IsNull()) { + throw BinderException("MAP type key type modifier cannot be NULL"); + } + if (val_val.IsNull()) { + throw BinderException("MAP type value type modifier cannot be NULL"); + } + + auto key_type = TypeValue::GetType(arguments[0].GetValue()); + auto val_type = TypeValue::GetType(arguments[1].GetValue()); + + return LogicalType::MAP(std::move(key_type), std::move(val_type)); +} + +//---------------------------------------------------------------------------------------------------------------------- +// UNION Type +//---------------------------------------------------------------------------------------------------------------------- +LogicalType BindUnionType(BindLogicalTypeInput &input) { + auto &arguments = input.modifiers; + + if (arguments.empty()) { + throw BinderException("UNION type requires at least one type modifier"); + } + + if (arguments.size() > UnionType::MAX_UNION_MEMBERS) { + throw BinderException("UNION type supports at most %d type modifiers", UnionType::MAX_UNION_MEMBERS); + } + + child_list_t children; + case_insensitive_set_t name_collision_set; + + for (auto &arg : arguments) { + if (!arg.HasName()) { + throw BinderException("UNION type modifiers must have names"); + } + if (arg.GetValue().type() != LogicalTypeId::TYPE) { + throw BinderException("UNION type modifiers must be types"); + } + if (arg.GetValue().IsNull()) { + throw BinderException("UNION type modifiers cannot be NULL"); + } + + auto &entry_name = arg.GetName(); + auto entry_type = TypeValue::GetType(arg.GetValue()); + + if (name_collision_set.find(entry_name) != name_collision_set.end()) { + throw BinderException("Duplicate UNION type member name \"%s\"", entry_name); + } + + name_collision_set.insert(entry_name); + children.emplace_back(entry_name, entry_type); + } + + return LogicalType::UNION(std::move(children)); +} + +//---------------------------------------------------------------------------------------------------------------------- +// VARIANT Type +//---------------------------------------------------------------------------------------------------------------------- +LogicalType BindVariantType(BindLogicalTypeInput &input) { + // We need this function to make sure we always create a VARIANT type with ExtraTypeInfo + auto &arguments = input.modifiers; + + if (!arguments.empty()) { + throw BinderException("Type 'VARIANT' does not take any type parameters"); + } + return LogicalType::VARIANT(); +} + +//---------------------------------------------------------------------------------------------------------------------- +// GEOMETRY Type +//---------------------------------------------------------------------------------------------------------------------- +LogicalType BindGeometryType(BindLogicalTypeInput &input) { + auto &arguments = input.modifiers; + + if (arguments.empty()) { + return LogicalType::GEOMETRY(); + } + + if (arguments.size() > 1) { + throw BinderException( + "GEOMETRY type takes a single optional type modifier with a coordinate system definition"); + } + + const auto &crs_value = arguments[0].GetValue(); + + // Don't do any casting here - only accept string type directly + if (crs_value.type() != LogicalTypeId::VARCHAR) { + throw BinderException("GEOMETRY type modifier must be a string with a coordinate system definition"); + } + if (crs_value.IsNull()) { + throw BinderException("GEOMETRY type modifier cannot be NULL"); + } + + // FIXME: Use extension/ClientContext to expand incomplete/shorthand CRS definitions + auto &crs = StringValue::Get(crs_value); + + return LogicalType::GEOMETRY(crs); +} + +//---------------------------------------------------------------------------------------------------------------------- +// All Types +//---------------------------------------------------------------------------------------------------------------------- + +struct DefaultType { + const char *name; + LogicalTypeId type; + bind_logical_type_function_t bind_function; +}; + +using builtin_type_array = std::array; + +const builtin_type_array BUILTIN_TYPES = {{{"decimal", LogicalTypeId::DECIMAL, BindDecimalType}, + {"dec", LogicalTypeId::DECIMAL, BindDecimalType}, + {"numeric", LogicalTypeId::DECIMAL, BindDecimalType}, + {"time", LogicalTypeId::TIME, nullptr}, + {"time_ns", LogicalTypeId::TIME_NS, nullptr}, + {"date", LogicalTypeId::DATE, nullptr}, + {"timestamp", LogicalTypeId::TIMESTAMP, BindTimestampType}, + {"datetime", LogicalTypeId::TIMESTAMP, BindTimestampType}, + {"timestamp_us", LogicalTypeId::TIMESTAMP, nullptr}, + {"timestamp_ms", LogicalTypeId::TIMESTAMP_MS, nullptr}, + {"timestamp_ns", LogicalTypeId::TIMESTAMP_NS, nullptr}, + {"timestamp_s", LogicalTypeId::TIMESTAMP_SEC, nullptr}, + {"timestamptz", LogicalTypeId::TIMESTAMP_TZ, nullptr}, + {"timestamp with time zone", LogicalTypeId::TIMESTAMP_TZ, nullptr}, + {"timetz", LogicalTypeId::TIME_TZ, nullptr}, + {"time with time zone", LogicalTypeId::TIME_TZ, nullptr}, + {"interval", LogicalTypeId::INTERVAL, BindIntervalType}, + {"varchar", LogicalTypeId::VARCHAR, BindVarcharType}, + {"bpchar", LogicalTypeId::VARCHAR, BindVarcharType}, + {"string", LogicalTypeId::VARCHAR, BindVarcharType}, + {"char", LogicalTypeId::VARCHAR, BindVarcharType}, + {"nvarchar", LogicalTypeId::VARCHAR, BindVarcharType}, + {"text", LogicalTypeId::VARCHAR, BindVarcharType}, + {"blob", LogicalTypeId::BLOB, nullptr}, + {"bytea", LogicalTypeId::BLOB, nullptr}, + {"varbinary", LogicalTypeId::BLOB, nullptr}, + {"binary", LogicalTypeId::BLOB, nullptr}, + {"hugeint", LogicalTypeId::HUGEINT, nullptr}, + {"int128", LogicalTypeId::HUGEINT, nullptr}, + {"uhugeint", LogicalTypeId::UHUGEINT, nullptr}, + {"uint128", LogicalTypeId::UHUGEINT, nullptr}, + {"bigint", LogicalTypeId::BIGINT, nullptr}, + {"oid", LogicalTypeId::BIGINT, nullptr}, + {"long", LogicalTypeId::BIGINT, nullptr}, + {"int8", LogicalTypeId::BIGINT, nullptr}, + {"int64", LogicalTypeId::BIGINT, nullptr}, + {"ubigint", LogicalTypeId::UBIGINT, nullptr}, + {"uint64", LogicalTypeId::UBIGINT, nullptr}, + {"integer", LogicalTypeId::INTEGER, nullptr}, + {"int", LogicalTypeId::INTEGER, nullptr}, + {"int4", LogicalTypeId::INTEGER, nullptr}, + {"signed", LogicalTypeId::INTEGER, nullptr}, + {"integral", LogicalTypeId::INTEGER, nullptr}, + {"int32", LogicalTypeId::INTEGER, nullptr}, + {"uinteger", LogicalTypeId::UINTEGER, nullptr}, + {"uint32", LogicalTypeId::UINTEGER, nullptr}, + {"smallint", LogicalTypeId::SMALLINT, nullptr}, + {"int2", LogicalTypeId::SMALLINT, nullptr}, + {"short", LogicalTypeId::SMALLINT, nullptr}, + {"int16", LogicalTypeId::SMALLINT, nullptr}, + {"usmallint", LogicalTypeId::USMALLINT, nullptr}, + {"uint16", LogicalTypeId::USMALLINT, nullptr}, + {"tinyint", LogicalTypeId::TINYINT, nullptr}, + {"int1", LogicalTypeId::TINYINT, nullptr}, + {"utinyint", LogicalTypeId::UTINYINT, nullptr}, + {"uint8", LogicalTypeId::UTINYINT, nullptr}, + {"struct", LogicalTypeId::STRUCT, BindStructType}, + {"row", LogicalTypeId::STRUCT, BindStructType}, + {"list", LogicalTypeId::LIST, BindListType}, + {"array", LogicalTypeId::ARRAY, BindArrayType}, + {"map", LogicalTypeId::MAP, BindMapType}, + {"union", LogicalTypeId::UNION, BindUnionType}, + {"bit", LogicalTypeId::BIT, BindBitType}, + {"bitstring", LogicalTypeId::BIT, BindBitType}, + {"variant", LogicalTypeId::VARIANT, BindVariantType}, + {"bignum", LogicalTypeId::BIGNUM, nullptr}, + {"varint", LogicalTypeId::BIGNUM, nullptr}, + {"boolean", LogicalTypeId::BOOLEAN, nullptr}, + {"bool", LogicalTypeId::BOOLEAN, nullptr}, + {"logical", LogicalTypeId::BOOLEAN, nullptr}, + {"uuid", LogicalTypeId::UUID, nullptr}, + {"guid", LogicalTypeId::UUID, nullptr}, + {"enum", LogicalTypeId::ENUM, BindEnumType}, + {"null", LogicalTypeId::SQLNULL, nullptr}, + {"float", LogicalTypeId::FLOAT, nullptr}, + {"real", LogicalTypeId::FLOAT, nullptr}, + {"float4", LogicalTypeId::FLOAT, nullptr}, + {"double", LogicalTypeId::DOUBLE, nullptr}, + {"float8", LogicalTypeId::DOUBLE, nullptr}, + {"geometry", LogicalTypeId::GEOMETRY, BindGeometryType}, + {"type", LogicalTypeId::TYPE, nullptr}}}; + +optional_ptr TryGetDefaultTypeEntry(const string &name) { + auto &internal_types = BUILTIN_TYPES; + for (auto &type : internal_types) { + if (StringUtil::CIEquals(name, type.name)) { + return &type; + } + } + return nullptr; +} + +} // namespace + +//---------------------------------------------------------------------------------------------------------------------- +// Default Type Generator +//---------------------------------------------------------------------------------------------------------------------- LogicalTypeId DefaultTypeGenerator::GetDefaultType(const string &name) { auto &internal_types = BUILTIN_TYPES; for (auto &type : internal_types) { @@ -18,6 +545,29 @@ LogicalTypeId DefaultTypeGenerator::GetDefaultType(const string &name) { return LogicalType::INVALID; } +LogicalType DefaultTypeGenerator::TryDefaultBind(const string &name, const vector> ¶ms) { + auto entry = TryGetDefaultTypeEntry(name); + if (!entry) { + return LogicalTypeId::INVALID; + } + + if (!entry->bind_function) { + if (params.empty()) { + return LogicalType(entry->type); + } else { + throw InvalidInputException("Type '%s' does not take any type parameters", name); + } + } + + vector args; + for (auto ¶m : params) { + args.emplace_back(param.first, param.second); + } + + BindLogicalTypeInput input {nullptr, LogicalType(entry->type), args}; + return entry->bind_function(input); +} + DefaultTypeGenerator::DefaultTypeGenerator(Catalog &catalog, SchemaCatalogEntry &schema) : DefaultGenerator(catalog), schema(schema) { } @@ -26,15 +576,16 @@ unique_ptr DefaultTypeGenerator::CreateDefaultEntry(ClientContext if (schema.name != DEFAULT_SCHEMA) { return nullptr; } - auto type_id = GetDefaultType(entry_name); - if (type_id == LogicalTypeId::INVALID) { + auto entry = TryGetDefaultTypeEntry(entry_name); + if (!entry || entry->type == LogicalTypeId::INVALID) { return nullptr; } CreateTypeInfo info; info.name = entry_name; - info.type = LogicalType(type_id); + info.type = LogicalType(entry->type); info.internal = true; info.temporary = true; + info.bind_function = entry->bind_function; return make_uniq_base(catalog, schema, info); } diff --git a/src/duckdb/src/catalog/default/default_views.cpp b/src/duckdb/src/catalog/default/default_views.cpp index 023b6f800..f2edfdaba 100644 --- a/src/duckdb/src/catalog/default/default_views.cpp +++ b/src/duckdb/src/catalog/default/default_views.cpp @@ -53,7 +53,7 @@ static const DefaultView internal_views[] = { {"information_schema", "tables", "SELECT database_name table_catalog, schema_name table_schema, table_name, CASE WHEN temporary THEN 'LOCAL TEMPORARY' ELSE 'BASE TABLE' END table_type, NULL::VARCHAR self_referencing_column_name, NULL::VARCHAR reference_generation, NULL::VARCHAR user_defined_type_catalog, NULL::VARCHAR user_defined_type_schema, NULL::VARCHAR user_defined_type_name, 'YES' is_insertable_into, 'NO' is_typed, CASE WHEN temporary THEN 'PRESERVE' ELSE NULL END commit_action, comment AS TABLE_COMMENT FROM duckdb_tables() UNION ALL SELECT database_name table_catalog, schema_name table_schema, view_name table_name, 'VIEW' table_type, NULL self_referencing_column_name, NULL reference_generation, NULL user_defined_type_catalog, NULL user_defined_type_schema, NULL user_defined_type_name, 'NO' is_insertable_into, 'NO' is_typed, NULL commit_action, comment AS TABLE_COMMENT FROM duckdb_views;"}, {"information_schema", "character_sets", "SELECT NULL::VARCHAR character_set_catalog, NULL::VARCHAR character_set_schema, 'UTF8' character_set_name, 'UCS' character_repertoire, 'UTF8' form_of_use, current_database() default_collate_catalog, 'pg_catalog' default_collate_schema, 'ucs_basic' default_collate_name;"}, {"information_schema", "referential_constraints", "SELECT f.database_name constraint_catalog, f.schema_name constraint_schema, f.constraint_name constraint_name, c.database_name unique_constraint_catalog, c.schema_name unique_constraint_schema, c.constraint_name unique_constraint_name, 'NONE' match_option, 'NO ACTION' update_rule, 'NO ACTION' delete_rule FROM duckdb_constraints() c, duckdb_constraints() f WHERE f.constraint_type = 'FOREIGN KEY' AND (c.constraint_type = 'UNIQUE' OR c.constraint_type = 'PRIMARY KEY') AND f.database_oid = c.database_oid AND f.schema_oid = c.schema_oid AND lower(f.referenced_table) = lower(c.table_name) AND [lower(x) for x in f.referenced_column_names] = [lower(x) for x in c.constraint_column_names]"}, - {"information_schema", "key_column_usage", "SELECT database_name constraint_catalog, schema_name constraint_schema, constraint_name, database_name table_catalog, schema_name table_schema, table_name, UNNEST(constraint_column_names) column_name, UNNEST(generate_series(1, len(constraint_column_names))) ordinal_position, CASE constraint_type WHEN 'FOREIGN KEY' THEN 1 ELSE NULL END position_in_unique_constraint FROM duckdb_constraints() WHERE constraint_type = 'FOREIGN KEY' OR constraint_type = 'PRIMARY KEY' OR constraint_type = 'UNIQUE';"}, + {"information_schema", "key_column_usage", "SELECT database_name constraint_catalog, schema_name constraint_schema, constraint_name, database_name table_catalog, schema_name table_schema, table_name, UNNEST(constraint_column_names) column_name, UNNEST(generate_series(1, len(constraint_column_names))) ordinal_position, CASE constraint_type WHEN 'FOREIGN KEY' THEN UNNEST (generate_series(1, len(constraint_column_names))) ELSE NULL END position_in_unique_constraint FROM duckdb_constraints() WHERE constraint_type = 'FOREIGN KEY' OR constraint_type = 'PRIMARY KEY' OR constraint_type = 'UNIQUE';"}, {"information_schema", "table_constraints", "SELECT database_name constraint_catalog, schema_name constraint_schema, constraint_name, database_name table_catalog, schema_name table_schema, table_name, CASE constraint_type WHEN 'NOT NULL' THEN 'CHECK' ELSE constraint_type END constraint_type, 'NO' is_deferrable, 'NO' initially_deferred, 'YES' enforced, 'YES' nulls_distinct FROM duckdb_constraints() WHERE constraint_type = 'PRIMARY KEY' OR constraint_type = 'FOREIGN KEY' OR constraint_type = 'UNIQUE' OR constraint_type = 'CHECK' OR constraint_type = 'NOT NULL';"}, {"information_schema", "constraint_column_usage", "SELECT database_name AS table_catalog, schema_name AS table_schema, table_name, column_name, database_name AS constraint_catalog, schema_name AS constraint_schema, constraint_name, constraint_type, constraint_text FROM (SELECT dc.*, UNNEST(dc.constraint_column_names) AS column_name FROM duckdb_constraints() AS dc WHERE constraint_type NOT IN ('NOT NULL') );"}, {"information_schema", "constraint_table_usage", "SELECT database_name AS table_catalog, schema_name AS table_schema, table_name, database_name AS constraint_catalog, schema_name AS constraint_schema, constraint_name, constraint_type FROM duckdb_constraints() WHERE constraint_type NOT IN ('NOT NULL');"}, diff --git a/src/duckdb/src/common/box_renderer.cpp b/src/duckdb/src/common/box_renderer.cpp index b76721596..81caa2ee0 100644 --- a/src/duckdb/src/common/box_renderer.cpp +++ b/src/duckdb/src/common/box_renderer.cpp @@ -205,7 +205,7 @@ struct BoxRendererImplementation : public BoxRendererState { void RenderValue(BaseResultRenderer &ss, const string &value, idx_t column_width, ResultRenderType render_mode, const vector &annotations, ValueRenderAlignment alignment = ValueRenderAlignment::MIDDLE, - optional_idx render_width = optional_idx()); + optional_idx render_width = optional_idx(), const char *vertical = nullptr); string RenderType(const LogicalType &type); ValueRenderAlignment TypeAlignment(const LogicalType &type); void ConvertRenderVector(Vector &vector, Vector &render_lengths, idx_t count, const LogicalType &original_type, @@ -263,9 +263,10 @@ void BoxRendererImplementation::ComputeRowFooter(idx_t row_count, idx_t rendered footer.row_count_str = "? rows"; } if (config.large_number_rendering == LargeNumberRendering::FOOTER && !has_limited_rows) { - footer.readable_rows_str = TryFormatLargeNumber(to_string(row_count)); - if (!footer.readable_rows_str.empty()) { - footer.readable_rows_str += " rows"; + string readable_str = TryFormatLargeNumber(to_string(row_count)); + if (!readable_str.empty()) { + footer.readable_rows_str = to_string(row_count) + " total"; + footer.row_count_str = readable_str + " rows"; } } footer.has_hidden_rows = rendered_rows < row_count; @@ -412,7 +413,8 @@ string BoxRendererImplementation::TruncateValue(const string &value, idx_t colum void BoxRendererImplementation::RenderValue(BaseResultRenderer &ss, const string &value, idx_t column_width, ResultRenderType render_mode, const vector &annotations, - ValueRenderAlignment alignment, optional_idx render_width_input) { + ValueRenderAlignment alignment, optional_idx render_width_input, + const char *vertical) { idx_t render_width; if (render_width_input.IsValid()) { render_width = render_width_input.GetIndex(); @@ -457,7 +459,7 @@ void BoxRendererImplementation::RenderValue(BaseResultRenderer &ss, const string default: throw InternalException("Unrecognized value renderer alignment"); } - ss << config.VERTICAL; + ss << (vertical ? vertical : config.VERTICAL); ss << string(lpadding, ' '); if (!annotations.empty()) { // if we have annotations split up the rendering between annotations @@ -2127,7 +2129,7 @@ void BoxRendererImplementation::RenderValues(BaseResultRenderer &ss, vector= shown_size) { // we have space - render it here extra_render_str = " ("; + extra_render_str += shown_str; if (!readable_rows_str.empty()) { - extra_render_str += readable_rows_str + ", "; + extra_render_str += ", " + readable_rows_str; } - extra_render_str += shown_str; extra_render_str += ")"; D_ASSERT(extra_render_str.size() == shown_size); padding -= shown_size; @@ -2208,12 +2209,11 @@ void BoxRendererImplementation::RenderFooter(BaseResultRenderer &ss, idx_t row_c shown_str = string(); } - ss << config.VERTICAL; - ss << " "; + ss << " "; if (render_rows_and_columns) { ss.Render(ResultRenderType::FOOTER, row_count_str); if (!extra_render_str.empty()) { - ss.Render(ResultRenderType::NULL_VALUE, extra_render_str); + ss.Render(ResultRenderType::FOOTER, extra_render_str); } ss << string(padding, ' '); ss.Render(ResultRenderType::FOOTER, column_count_str); @@ -2223,12 +2223,10 @@ void BoxRendererImplementation::RenderFooter(BaseResultRenderer &ss, idx_t row_c ss << string(lpadding, ' '); ss.Render(ResultRenderType::FOOTER, row_count_str); if (!extra_render_str.empty()) { - ss.Render(ResultRenderType::NULL_VALUE, extra_render_str); + ss.Render(ResultRenderType::FOOTER, extra_render_str); } ss << string(rpadding, ' '); } - ss << " "; - ss << config.VERTICAL; ss << '\n'; if (!readable_rows_str.empty() || !shown_str.empty()) { // we still need to render the readable rows/shown strings @@ -2236,13 +2234,10 @@ void BoxRendererImplementation::RenderFooter(BaseResultRenderer &ss, idx_t row_c idx_t combined_shown_length = readable_rows_str.size() + shown_str.size() + 4; if (!readable_rows_str.empty() && !shown_str.empty() && combined_shown_length <= total_render_length) { // we can! merge them - ss << config.VERTICAL; - ss << " "; - ss.Render(ResultRenderType::NULL_VALUE, readable_rows_str); + ss << " "; + ss.Render(ResultRenderType::FOOTER, shown_str); ss << string(total_render_length - combined_shown_length, ' '); - ss.Render(ResultRenderType::NULL_VALUE, shown_str); - ss << " "; - ss << config.VERTICAL; + ss.Render(ResultRenderType::FOOTER, readable_rows_str); ss << '\n'; readable_rows_str = string(); shown_str = string(); @@ -2250,21 +2245,17 @@ void BoxRendererImplementation::RenderFooter(BaseResultRenderer &ss, idx_t row_c ValueRenderAlignment alignment = render_rows_and_columns ? ValueRenderAlignment::LEFT : ValueRenderAlignment::MIDDLE; vector annotations; - if (!readable_rows_str.empty()) { - RenderValue(ss, "(" + readable_rows_str + ")", total_render_length - 4, ResultRenderType::NULL_VALUE, - annotations, alignment); - ss << config.VERTICAL; + if (!shown_str.empty()) { + RenderValue(ss, "(" + shown_str + ")", total_render_length - 4, ResultRenderType::FOOTER, annotations, + alignment, optional_idx(), " "); ss << '\n'; } - if (!shown_str.empty()) { - RenderValue(ss, "(" + shown_str + ")", total_render_length - 4, ResultRenderType::NULL_VALUE, annotations, - alignment); - ss << config.VERTICAL; + if (!readable_rows_str.empty()) { + RenderValue(ss, "(" + readable_rows_str + ")", total_render_length - 4, ResultRenderType::FOOTER, + annotations, alignment, optional_idx(), " "); ss << '\n'; } } - // render the bottom line - RenderLayoutLine(ss, config.HORIZONTAL, config.HORIZONTAL, config.LDCORNER, config.RDCORNER); } //===--------------------------------------------------------------------===// diff --git a/src/duckdb/src/common/encryption_functions.cpp b/src/duckdb/src/common/encryption_functions.cpp index 262ff3c14..5cd1e4967 100644 --- a/src/duckdb/src/common/encryption_functions.cpp +++ b/src/duckdb/src/common/encryption_functions.cpp @@ -50,6 +50,9 @@ void AdditionalAuthenticatedData::WriteStringData(const std::string &val) const EncryptionEngine::EncryptionEngine() { } +EncryptionEngine::~EncryptionEngine() { +} + const_data_ptr_t EncryptionEngine::GetKeyFromCache(DatabaseInstance &db, const string &key_name) { auto &keys = EncryptionKeyManager::Get(db); return keys.GetKey(key_name); @@ -65,8 +68,8 @@ void EncryptionEngine::AddKeyToCache(DatabaseInstance &db, data_ptr_t key, const if (!keys.HasKey(key_name)) { keys.AddKey(key_name, key); } else { - // wipe out the key - std::memset(key, 0, MainHeader::DEFAULT_ENCRYPTION_KEY_LENGTH); + duckdb_mbedtls::MbedTlsWrapper::AESStateMBEDTLS::SecureClearData(key, + MainHeader::DEFAULT_ENCRYPTION_KEY_LENGTH); } } @@ -77,8 +80,8 @@ string EncryptionEngine::AddKeyToCache(DatabaseInstance &db, data_ptr_t key) { if (!keys.HasKey(key_id)) { keys.AddKey(key_id, key); } else { - // wipe out the original key - std::memset(key, 0, MainHeader::DEFAULT_ENCRYPTION_KEY_LENGTH); + duckdb_mbedtls::MbedTlsWrapper::AESStateMBEDTLS::SecureClearData(key, + MainHeader::DEFAULT_ENCRYPTION_KEY_LENGTH); } return key_id; diff --git a/src/duckdb/src/common/encryption_key_manager.cpp b/src/duckdb/src/common/encryption_key_manager.cpp index 409fe605c..4d174525b 100644 --- a/src/duckdb/src/common/encryption_key_manager.cpp +++ b/src/duckdb/src/common/encryption_key_manager.cpp @@ -75,7 +75,7 @@ string EncryptionKeyManager::GenerateRandomKeyID() { void EncryptionKeyManager::AddKey(const string &key_name, data_ptr_t key) { lock_guard guard(lock); derived_keys.emplace(key_name, EncryptionKey(key)); - // Zero-out the encryption key + // Zero-out the input encryption key duckdb_mbedtls::MbedTlsWrapper::AESStateMBEDTLS::SecureClearData(key, DERIVED_KEY_LENGTH); } @@ -92,6 +92,19 @@ const_data_ptr_t EncryptionKeyManager::GetKey(const string &key_name) const { void EncryptionKeyManager::DeleteKey(const string &key_name) { lock_guard guard(lock); + ClearKey(key_name); + EraseKey(key_name); +} + +void EncryptionKeyManager::ClearKey(const string &key_name) { + D_ASSERT(HasKey(key_name)); + auto const key_data = derived_keys.at(key_name).GetData(); + // clear the key (zero-out its memory) + duckdb_mbedtls::MbedTlsWrapper::AESStateMBEDTLS::SecureClearData(key_data, + MainHeader::DEFAULT_ENCRYPTION_KEY_LENGTH); +} + +void EncryptionKeyManager::EraseKey(const string &key_name) { derived_keys.erase(key_name); } @@ -131,6 +144,7 @@ void EncryptionKeyManager::DeriveKey(string &user_key, data_ptr_t salt, data_ptr KeyDerivationFunctionSHA256(reinterpret_cast(decoded_key.data()), decoded_key.size(), salt, derived_key); + duckdb_mbedtls::MbedTlsWrapper::AESStateMBEDTLS::SecureClearData(data_ptr_cast(&user_key[0]), user_key.size()); duckdb_mbedtls::MbedTlsWrapper::AESStateMBEDTLS::SecureClearData(data_ptr_cast(&decoded_key[0]), decoded_key.size()); diff --git a/src/duckdb/src/common/enum_util.cpp b/src/duckdb/src/common/enum_util.cpp index afb826453..ff9a82e2c 100644 --- a/src/duckdb/src/common/enum_util.cpp +++ b/src/duckdb/src/common/enum_util.cpp @@ -174,7 +174,7 @@ #include "duckdb/planner/binder.hpp" #include "duckdb/planner/bound_result_modifier.hpp" #include "duckdb/planner/table_filter.hpp" -#include "duckdb/storage/buffer/block_handle.hpp" +#include "duckdb/storage/buffer/buffer_pool_reservation.hpp" #include "duckdb/storage/caching_mode.hpp" #include "duckdb/storage/compression/bitpacking.hpp" #include "duckdb/storage/magic_bytes.hpp" @@ -467,19 +467,21 @@ const StringUtil::EnumStringLiteral *GetAlterTableTypeValues() { { static_cast(AlterTableType::SET_SORTED_BY), "SET_SORTED_BY" }, { static_cast(AlterTableType::ADD_FIELD), "ADD_FIELD" }, { static_cast(AlterTableType::REMOVE_FIELD), "REMOVE_FIELD" }, - { static_cast(AlterTableType::RENAME_FIELD), "RENAME_FIELD" } + { static_cast(AlterTableType::RENAME_FIELD), "RENAME_FIELD" }, + { static_cast(AlterTableType::SET_TABLE_OPTIONS), "SET_TABLE_OPTIONS" }, + { static_cast(AlterTableType::RESET_TABLE_OPTIONS), "RESET_TABLE_OPTIONS" } }; return values; } template<> const char* EnumUtil::ToChars(AlterTableType value) { - return StringUtil::EnumToString(GetAlterTableTypeValues(), 17, "AlterTableType", static_cast(value)); + return StringUtil::EnumToString(GetAlterTableTypeValues(), 19, "AlterTableType", static_cast(value)); } template<> AlterTableType EnumUtil::FromString(const char *value) { - return static_cast(StringUtil::StringToEnum(GetAlterTableTypeValues(), 17, "AlterTableType", value)); + return static_cast(StringUtil::StringToEnum(GetAlterTableTypeValues(), 19, "AlterTableType", value)); } const StringUtil::EnumStringLiteral *GetAlterTypeValues() { @@ -1751,6 +1753,7 @@ const StringUtil::EnumStringLiteral *GetExpressionClassValues() { { static_cast(ExpressionClass::POSITIONAL_REFERENCE), "POSITIONAL_REFERENCE" }, { static_cast(ExpressionClass::BETWEEN), "BETWEEN" }, { static_cast(ExpressionClass::LAMBDA_REF), "LAMBDA_REF" }, + { static_cast(ExpressionClass::TYPE), "TYPE" }, { static_cast(ExpressionClass::BOUND_AGGREGATE), "BOUND_AGGREGATE" }, { static_cast(ExpressionClass::BOUND_CASE), "BOUND_CASE" }, { static_cast(ExpressionClass::BOUND_CAST), "BOUND_CAST" }, @@ -1777,12 +1780,12 @@ const StringUtil::EnumStringLiteral *GetExpressionClassValues() { template<> const char* EnumUtil::ToChars(ExpressionClass value) { - return StringUtil::EnumToString(GetExpressionClassValues(), 40, "ExpressionClass", static_cast(value)); + return StringUtil::EnumToString(GetExpressionClassValues(), 41, "ExpressionClass", static_cast(value)); } template<> ExpressionClass EnumUtil::FromString(const char *value) { - return static_cast(StringUtil::StringToEnum(GetExpressionClassValues(), 40, "ExpressionClass", value)); + return static_cast(StringUtil::StringToEnum(GetExpressionClassValues(), 41, "ExpressionClass", value)); } const StringUtil::EnumStringLiteral *GetExpressionTypeValues() { @@ -1850,6 +1853,7 @@ const StringUtil::EnumStringLiteral *GetExpressionTypeValues() { { static_cast(ExpressionType::FUNCTION_REF), "FUNCTION_REF" }, { static_cast(ExpressionType::TABLE_REF), "TABLE_REF" }, { static_cast(ExpressionType::LAMBDA_REF), "LAMBDA_REF" }, + { static_cast(ExpressionType::TYPE), "TYPE" }, { static_cast(ExpressionType::CAST), "CAST" }, { static_cast(ExpressionType::BOUND_REF), "BOUND_REF" }, { static_cast(ExpressionType::BOUND_COLUMN_REF), "BOUND_COLUMN_REF" }, @@ -1865,12 +1869,12 @@ const StringUtil::EnumStringLiteral *GetExpressionTypeValues() { template<> const char* EnumUtil::ToChars(ExpressionType value) { - return StringUtil::EnumToString(GetExpressionTypeValues(), 72, "ExpressionType", static_cast(value)); + return StringUtil::EnumToString(GetExpressionTypeValues(), 73, "ExpressionType", static_cast(value)); } template<> ExpressionType EnumUtil::FromString(const char *value) { - return static_cast(StringUtil::StringToEnum(GetExpressionTypeValues(), 72, "ExpressionType", value)); + return static_cast(StringUtil::StringToEnum(GetExpressionTypeValues(), 73, "ExpressionType", value)); } const StringUtil::EnumStringLiteral *GetExtensionABITypeValues() { @@ -2003,7 +2007,7 @@ const StringUtil::EnumStringLiteral *GetExtraTypeInfoTypeValues() { { static_cast(ExtraTypeInfoType::LIST_TYPE_INFO), "LIST_TYPE_INFO" }, { static_cast(ExtraTypeInfoType::STRUCT_TYPE_INFO), "STRUCT_TYPE_INFO" }, { static_cast(ExtraTypeInfoType::ENUM_TYPE_INFO), "ENUM_TYPE_INFO" }, - { static_cast(ExtraTypeInfoType::USER_TYPE_INFO), "USER_TYPE_INFO" }, + { static_cast(ExtraTypeInfoType::UNBOUND_TYPE_INFO), "UNBOUND_TYPE_INFO" }, { static_cast(ExtraTypeInfoType::AGGREGATE_STATE_TYPE_INFO), "AGGREGATE_STATE_TYPE_INFO" }, { static_cast(ExtraTypeInfoType::ARRAY_TYPE_INFO), "ARRAY_TYPE_INFO" }, { static_cast(ExtraTypeInfoType::ANY_TYPE_INFO), "ANY_TYPE_INFO" }, @@ -2801,8 +2805,9 @@ const StringUtil::EnumStringLiteral *GetLogicalTypeIdValues() { { static_cast(LogicalTypeId::SQLNULL), "NULL" }, { static_cast(LogicalTypeId::UNKNOWN), "UNKNOWN" }, { static_cast(LogicalTypeId::ANY), "ANY" }, - { static_cast(LogicalTypeId::USER), "USER" }, + { static_cast(LogicalTypeId::UNBOUND), "UNBOUND" }, { static_cast(LogicalTypeId::TEMPLATE), "TEMPLATE" }, + { static_cast(LogicalTypeId::TYPE), "TYPE" }, { static_cast(LogicalTypeId::BOOLEAN), "BOOLEAN" }, { static_cast(LogicalTypeId::TINYINT), "TINYINT" }, { static_cast(LogicalTypeId::SMALLINT), "SMALLINT" }, @@ -2854,12 +2859,12 @@ const StringUtil::EnumStringLiteral *GetLogicalTypeIdValues() { template<> const char* EnumUtil::ToChars(LogicalTypeId value) { - return StringUtil::EnumToString(GetLogicalTypeIdValues(), 51, "LogicalTypeId", static_cast(value)); + return StringUtil::EnumToString(GetLogicalTypeIdValues(), 52, "LogicalTypeId", static_cast(value)); } template<> LogicalTypeId EnumUtil::FromString(const char *value) { - return static_cast(StringUtil::StringToEnum(GetLogicalTypeIdValues(), 51, "LogicalTypeId", value)); + return static_cast(StringUtil::StringToEnum(GetLogicalTypeIdValues(), 52, "LogicalTypeId", value)); } const StringUtil::EnumStringLiteral *GetLookupResultTypeValues() { @@ -2937,19 +2942,21 @@ const StringUtil::EnumStringLiteral *GetMemoryTagValues() { { static_cast(MemoryTag::EXTENSION), "EXTENSION" }, { static_cast(MemoryTag::TRANSACTION), "TRANSACTION" }, { static_cast(MemoryTag::EXTERNAL_FILE_CACHE), "EXTERNAL_FILE_CACHE" }, - { static_cast(MemoryTag::WINDOW), "WINDOW" } + { static_cast(MemoryTag::WINDOW), "WINDOW" }, + { static_cast(MemoryTag::OBJECT_CACHE), "OBJECT_CACHE" }, + { static_cast(MemoryTag::UNKNOWN), "UNKNOWN" } }; return values; } template<> const char* EnumUtil::ToChars(MemoryTag value) { - return StringUtil::EnumToString(GetMemoryTagValues(), 15, "MemoryTag", static_cast(value)); + return StringUtil::EnumToString(GetMemoryTagValues(), 17, "MemoryTag", static_cast(value)); } template<> MemoryTag EnumUtil::FromString(const char *value) { - return static_cast(StringUtil::StringToEnum(GetMemoryTagValues(), 15, "MemoryTag", value)); + return static_cast(StringUtil::StringToEnum(GetMemoryTagValues(), 17, "MemoryTag", value)); } const StringUtil::EnumStringLiteral *GetMergeActionConditionValues() { diff --git a/src/duckdb/src/common/enums/expression_type.cpp b/src/duckdb/src/common/enums/expression_type.cpp index f1375d3a1..42014a9d1 100644 --- a/src/duckdb/src/common/enums/expression_type.cpp +++ b/src/duckdb/src/common/enums/expression_type.cpp @@ -147,6 +147,8 @@ string ExpressionTypeToString(ExpressionType type) { return "LAMBDA"; case ExpressionType::ARROW: return "ARROW"; + case ExpressionType::TYPE: + return "TYPE"; case ExpressionType::BOUND_EXPANDED: return "BOUND_EXPANDED"; case ExpressionType::INVALID: @@ -196,6 +198,8 @@ string ExpressionClassToString(ExpressionClass type) { return "POSITIONAL_REFERENCE"; case ExpressionClass::BETWEEN: return "BETWEEN"; + case ExpressionClass::TYPE: + return "TYPE"; case ExpressionClass::BOUND_AGGREGATE: return "BOUND_AGGREGATE"; case ExpressionClass::BOUND_CASE: diff --git a/src/duckdb/src/common/error_data.cpp b/src/duckdb/src/common/error_data.cpp index 8b8da300d..770ab4d14 100644 --- a/src/duckdb/src/common/error_data.cpp +++ b/src/duckdb/src/common/error_data.cpp @@ -18,35 +18,40 @@ ErrorData::ErrorData(const std::exception &ex) : ErrorData(ex.what()) { } ErrorData::ErrorData(ExceptionType type, const string &message) - : initialized(true), type(type), raw_message(SanitizeErrorMessage(message)), - final_message(ConstructFinalMessage()) { + : initialized(true), type(type), raw_message(SanitizeErrorMessage(message)) { + // In the case of ExceptionType::INTERNAL, the stack trace is part of the final message. + // To construct it, we need to access extra_info, which has to be initialized first. + // Thus, we only set final_message in the constructor's body. + final_message = ConstructFinalMessage(); } ErrorData::ErrorData(const string &message) : initialized(true), type(ExceptionType::INVALID), raw_message(string()), final_message(string()) { // parse the constructed JSON if (message.empty() || message[0] != '{') { - // not JSON! Use the message as a raw Exception message and leave type as uninitialized - + // Not a JSON-formatted message. + // Use the message as a raw Exception message and leave the type as uninitialized. if (message == std::bad_alloc().what()) { type = ExceptionType::OUT_OF_MEMORY; raw_message = "Allocation failure"; } else { raw_message = message; } - } else { - auto info = StringUtil::ParseJSONMap(message)->Flatten(); - for (auto &entry : info) { - if (entry.first == "exception_type") { - type = Exception::StringToExceptionType(entry.second); - } else if (entry.first == "exception_message") { - raw_message = SanitizeErrorMessage(entry.second); - } else { - extra_info[entry.first] = entry.second; - } - } + final_message = ConstructFinalMessage(); + return; } + // JSON-formatted message. + auto info = StringUtil::ParseJSONMap(message)->Flatten(); + for (auto &entry : info) { + if (entry.first == "exception_type") { + type = Exception::StringToExceptionType(entry.second); + } else if (entry.first == "exception_message") { + raw_message = SanitizeErrorMessage(entry.second); + } else { + extra_info[entry.first] = entry.second; + } + } final_message = ConstructFinalMessage(); } diff --git a/src/duckdb/src/common/extra_type_info.cpp b/src/duckdb/src/common/extra_type_info.cpp index 932c08c0c..dc34d88ec 100644 --- a/src/duckdb/src/common/extra_type_info.cpp +++ b/src/duckdb/src/common/extra_type_info.cpp @@ -6,6 +6,8 @@ #include "duckdb/common/serializer/serializer.hpp" #include "duckdb/catalog/catalog_entry/schema_catalog_entry.hpp" #include "duckdb/common/string_map_set.hpp" +#include "duckdb/parser/expression/constant_expression.hpp" +#include "duckdb/parser/expression/type_expression.hpp" namespace duckdb { @@ -261,30 +263,66 @@ shared_ptr AggregateStateTypeInfo::Copy() const { //===--------------------------------------------------------------------===// // User Type Info //===--------------------------------------------------------------------===// -UserTypeInfo::UserTypeInfo() : ExtraTypeInfo(ExtraTypeInfoType::USER_TYPE_INFO) { -} +void UnboundTypeInfo::Serialize(Serializer &serializer) const { + ExtraTypeInfo::Serialize(serializer); -UserTypeInfo::UserTypeInfo(string name_p) - : ExtraTypeInfo(ExtraTypeInfoType::USER_TYPE_INFO), user_type_name(std::move(name_p)) { -} + if (serializer.ShouldSerialize(7)) { + serializer.WritePropertyWithDefault>(204, "expr", expr); + return; + } -UserTypeInfo::UserTypeInfo(string name_p, vector modifiers_p) - : ExtraTypeInfo(ExtraTypeInfoType::USER_TYPE_INFO), user_type_name(std::move(name_p)), - user_type_modifiers(std::move(modifiers_p)) { -} + // Try to write this as an old "USER" type, if possible + if (expr->type != ExpressionType::TYPE) { + throw SerializationException( + "Cannot serialize non-type type expression when targeting database storage version '%s'", + serializer.GetOptions().serialization_compatibility.duckdb_version); + } -UserTypeInfo::UserTypeInfo(string catalog_p, string schema_p, string name_p, vector modifiers_p) - : ExtraTypeInfo(ExtraTypeInfoType::USER_TYPE_INFO), catalog(std::move(catalog_p)), schema(std::move(schema_p)), - user_type_name(std::move(name_p)), user_type_modifiers(std::move(modifiers_p)) { -} + auto &type_expr = expr->Cast(); + serializer.WritePropertyWithDefault(200, "name", type_expr.GetTypeName()); + serializer.WritePropertyWithDefault(201, "catalog", type_expr.GetCatalog()); + serializer.WritePropertyWithDefault(202, "schema", type_expr.GetSchema()); + + // Try to write the user type mods too + vector user_type_mods; + for (auto ¶m : type_expr.GetChildren()) { + if (param->type != ExpressionType::VALUE_CONSTANT) { + throw SerializationException( + "Cannot serialize non-constant type parameter when targeting serialization version %s", + serializer.GetOptions().serialization_compatibility.duckdb_version); + } -bool UserTypeInfo::EqualsInternal(ExtraTypeInfo *other_p) const { - auto &other = other_p->Cast(); - return other.user_type_name == user_type_name; + auto &const_expr = param->Cast(); + user_type_mods.push_back(const_expr.value); + } + + serializer.WritePropertyWithDefault>(203, "user_type_modifiers", user_type_mods); } -shared_ptr UserTypeInfo::Copy() const { - return make_shared_ptr(*this); +shared_ptr UnboundTypeInfo::Deserialize(Deserializer &deserializer) { + auto result = duckdb::shared_ptr(new UnboundTypeInfo()); + + deserializer.ReadPropertyWithDefault>(204, "expr", result->expr); + + if (!result->expr) { + // This is a legacy "USER" type + string name; + deserializer.ReadPropertyWithDefault(200, "name", name); + string catalog; + deserializer.ReadPropertyWithDefault(201, "catalog", catalog); + string schema; + deserializer.ReadPropertyWithDefault(202, "schema", schema); + + vector> user_type_mods; + auto mods = deserializer.ReadPropertyWithDefault>(203, "user_type_modifiers"); + for (auto &mod : mods) { + user_type_mods.push_back(make_uniq_base(mod)); + } + + result->expr = make_uniq(catalog, schema, name, std::move(user_type_mods)); + } + + return std::move(result); } //===--------------------------------------------------------------------===// @@ -523,4 +561,26 @@ shared_ptr GeoTypeInfo::Copy() const { return make_shared_ptr(*this); } +//===--------------------------------------------------------------------===// +// Unbound Type Info +//===--------------------------------------------------------------------===// +UnboundTypeInfo::UnboundTypeInfo() : ExtraTypeInfo(ExtraTypeInfoType::UNBOUND_TYPE_INFO) { +} + +UnboundTypeInfo::UnboundTypeInfo(unique_ptr expr_p) + : ExtraTypeInfo(ExtraTypeInfoType::UNBOUND_TYPE_INFO), expr(std::move(expr_p)) { +} + +bool UnboundTypeInfo::EqualsInternal(ExtraTypeInfo *other_p) const { + auto &other = other_p->Cast(); + if (!expr->Equals(*other.expr)) { + return false; + } + return true; +} + +shared_ptr UnboundTypeInfo::Copy() const { + return make_shared_ptr(expr->Copy()); +} + } // namespace duckdb diff --git a/src/duckdb/src/common/file_system.cpp b/src/duckdb/src/common/file_system.cpp index 76f832795..72fbc13ab 100644 --- a/src/duckdb/src/common/file_system.cpp +++ b/src/duckdb/src/common/file_system.cpp @@ -5,6 +5,7 @@ #include "duckdb/common/file_opener.hpp" #include "duckdb/common/helper.hpp" #include "duckdb/common/string_util.hpp" +#include "duckdb/common/multi_file/multi_file_list.hpp" #include "duckdb/common/windows.hpp" #include "duckdb/function/scalar/string_functions.hpp" #include "duckdb/logging/log_type.hpp" @@ -60,6 +61,7 @@ constexpr FileOpenFlags FileFlags::FILE_FLAGS_EXCLUSIVE_CREATE; constexpr FileOpenFlags FileFlags::FILE_FLAGS_NULL_IF_EXISTS; constexpr FileOpenFlags FileFlags::FILE_FLAGS_MULTI_CLIENT_ACCESS; constexpr FileOpenFlags FileFlags::FILE_FLAGS_DISABLE_LOGGING; +constexpr FileOpenFlags FileFlags::FILE_FLAGS_ENABLE_EXTENSION_INSTALL; void FileOpenFlags::Verify() { #ifdef DEBUG @@ -412,6 +414,10 @@ bool FileSystem::SupportsListFilesExtended() const { return false; } +bool FileSystem::SupportsGlobExtended() const { + return false; +} + void FileSystem::Read(FileHandle &handle, void *buffer, int64_t nr_bytes, idx_t location) { throw NotImplementedException("%s: Read (with location) is not implemented!", GetName()); } @@ -600,9 +606,28 @@ bool FileSystem::HasGlob(const string &str) { } vector FileSystem::Glob(const string &path, FileOpener *opener) { + if (SupportsGlobExtended()) { + auto result = GlobFilesExtended(path, FileGlobOptions::ALLOW_EMPTY, opener); + return result->GetAllFiles(); + } throw NotImplementedException("%s: Glob is not implemented!", GetName()); } +unique_ptr FileSystem::Glob(const string &path, const FileGlobInput &input, + optional_ptr opener) { + if (!SupportsGlobExtended()) { + auto result = Glob(path, opener.get()); + return make_uniq(std::move(result)); + } else { + return GlobFilesExtended(path, input, opener); + } +} + +unique_ptr FileSystem::GlobFilesExtended(const string &path, const FileGlobInput &input, + optional_ptr opener) { + throw NotImplementedException("%s: GlobFilesExtended is not implemented!", GetName()); +} + void FileSystem::RegisterSubSystem(unique_ptr sub_fs) { throw NotImplementedException("%s: Can't register a sub system on a non-virtual file system", GetName()); } @@ -611,6 +636,10 @@ void FileSystem::RegisterSubSystem(FileCompressionType compression_type, unique_ throw NotImplementedException("%s: Can't register a sub system on a non-virtual file system", GetName()); } +void FileSystem::UnregisterSubSystem(const string &name) { + throw NotImplementedException("%s: Can't unregister a sub system on a non-virtual file system", GetName()); +} + unique_ptr FileSystem::ExtractSubSystem(const string &name) { throw NotImplementedException("%s: Can't extract a sub system on a non-virtual file system", GetName()); } @@ -635,9 +664,9 @@ bool FileSystem::CanHandleFile(const string &fpath) { throw NotImplementedException("%s: CanHandleFile is not implemented!", GetName()); } -vector FileSystem::GlobFiles(const string &pattern, ClientContext &context, const FileGlobInput &input) { - auto result = Glob(pattern); - if (result.empty()) { +unique_ptr FileSystem::GlobFileList(const string &pattern, const FileGlobInput &input) { + auto result = GlobFilesExtended(pattern, input); + if (result->IsEmpty()) { if (input.behavior == FileGlobOptions::FALLBACK_GLOB && !HasGlob(pattern)) { // if we have no glob in the pattern and we have an extension, we try to glob if (!HasGlob(pattern)) { @@ -645,8 +674,8 @@ vector FileSystem::GlobFiles(const string &pattern, ClientContext throw InternalException("FALLBACK_GLOB requires an extension to be specified"); } string new_pattern = JoinPath(JoinPath(pattern, "**"), "*." + input.extension); - result = GlobFiles(new_pattern, context, FileGlobOptions::ALLOW_EMPTY); - if (!result.empty()) { + result = GlobFileList(new_pattern, FileGlobOptions::ALLOW_EMPTY); + if (!result->IsEmpty()) { // we found files by globbing the target as if it was a directory - return them return result; } @@ -659,6 +688,11 @@ vector FileSystem::GlobFiles(const string &pattern, ClientContext return result; } +vector FileSystem::GlobFiles(const string &pattern, const FileGlobInput &input) { + auto file_list = GlobFileList(pattern, input); + return file_list->GetAllFiles(); +} + void FileSystem::Seek(FileHandle &handle, idx_t location) { throw NotImplementedException("%s: Seek is not implemented!", GetName()); } diff --git a/src/duckdb/src/common/hive_partitioning.cpp b/src/duckdb/src/common/hive_partitioning.cpp index 78f3b40e8..a4ae9486a 100644 --- a/src/duckdb/src/common/hive_partitioning.cpp +++ b/src/duckdb/src/common/hive_partitioning.cpp @@ -126,7 +126,7 @@ std::map HivePartitioning::Parse(const string &filename) { Value HivePartitioning::GetValue(ClientContext &context, const string &key, const string &str_val, const LogicalType &type) { // Handle nulls - if (StringUtil::CIEquals(str_val, "NULL")) { + if (StringUtil::CIEquals(str_val, "NULL") || str_val == "__HIVE_DEFAULT_PARTITION__") { return Value(type); } if (type.id() == LogicalTypeId::VARCHAR) { @@ -244,26 +244,13 @@ static void TemplatedGetHivePartitionValues(Vector &input, vector(data[sel.get_index(0)]).GetTypeMutable() != type; - if (reinterpret) { - for (idx_t i = 0; i < count; i++) { - auto &key = keys[i]; - const auto idx = sel.get_index(i); - if (validity.RowIsValid(idx)) { - key.values[col_idx] = GetHiveKeyValue(data[idx], type); - } else { - key.values[col_idx] = GetHiveKeyNullValue(type); - } - } - } else { - for (idx_t i = 0; i < count; i++) { - auto &key = keys[i]; - const auto idx = sel.get_index(i); - if (validity.RowIsValid(idx)) { - key.values[col_idx] = GetHiveKeyValue(data[idx]); - } else { - key.values[col_idx] = GetHiveKeyNullValue(type); - } + for (idx_t i = 0; i < count; i++) { + auto &key = keys[i]; + const auto idx = sel.get_index(i); + if (validity.RowIsValid(idx)) { + key.values[col_idx] = GetHiveKeyValue(data[idx], type); + } else { + key.values[col_idx] = GetHiveKeyNullValue(type); } } } diff --git a/src/duckdb/src/common/local_file_system.cpp b/src/duckdb/src/common/local_file_system.cpp index 3d9cae503..246796e32 100644 --- a/src/duckdb/src/common/local_file_system.cpp +++ b/src/duckdb/src/common/local_file_system.cpp @@ -11,6 +11,7 @@ #include "duckdb/main/database.hpp" #include "duckdb/logging/file_system_logger.hpp" #include "duckdb/logging/log_manager.hpp" +#include "duckdb/common/multi_file/multi_file_list.hpp" #include #include @@ -1370,9 +1371,7 @@ static bool IsCrawl(const string &glob) { // glob must match exactly return glob == "**"; } -static bool HasMultipleCrawl(const vector &splits) { - return std::count(splits.begin(), splits.end(), "**") > 1; -} + static bool IsSymbolicLink(const string &path) { auto normalized_path = LocalFileSystem::NormalizeLocalPath(path); #ifndef _WIN32 @@ -1386,45 +1385,8 @@ static bool IsSymbolicLink(const string &path) { #endif } -static void RecursiveGlobDirectories(FileSystem &fs, const string &path, vector &result, - bool match_directory, bool join_path) { - fs.ListFiles(path, [&](OpenFileInfo &info) { - if (join_path) { - info.path = fs.JoinPath(path, info.path); - } - if (IsSymbolicLink(info.path)) { - return; - } - bool is_directory = FileSystem::IsDirectory(info); - bool return_file = is_directory == match_directory; - if (is_directory) { - if (return_file) { - result.push_back(info); - } - RecursiveGlobDirectories(fs, info.path, result, match_directory, true); - } else if (return_file) { - result.push_back(std::move(info)); - } - }); -} - -static void GlobFilesInternal(FileSystem &fs, const string &path, const string &glob, bool match_directory, - vector &result, bool join_path) { - fs.ListFiles(path, [&](OpenFileInfo &info) { - bool is_directory = FileSystem::IsDirectory(info); - if (is_directory != match_directory) { - return; - } - if (Glob(info.path.c_str(), info.path.size(), glob.c_str(), glob.size())) { - if (join_path) { - info.path = fs.JoinPath(path, info.path); - } - result.push_back(std::move(info)); - } - }); -} - -vector LocalFileSystem::FetchFileWithoutGlob(const string &path, FileOpener *opener, bool absolute_path) { +vector LocalFileSystem::FetchFileWithoutGlob(const string &path, optional_ptr opener, + bool absolute_path) { vector result; if (FileExists(path, opener) || IsPipe(path, opener)) { result.emplace_back(path); @@ -1485,14 +1447,93 @@ const char *LocalFileSystem::NormalizeLocalPath(const string &path) { return path.c_str() + GetFileUrlOffset(path); } -vector LocalFileSystem::Glob(const string &path, FileOpener *opener) { +struct PathSplit { + PathSplit(LocalFileSystem &fs, string path_p) : path(std::move(path_p)), has_glob(fs.HasGlob(path)) { + } + + string path; + bool has_glob; +}; + +static bool HasMultipleCrawl(const vector &splits) { + idx_t crawl_count = 0; + for (auto &split : splits) { + if (split.path == "**") { + crawl_count++; + } + } + return crawl_count > 1; +} + +struct ExpandDirectory { + ExpandDirectory(string path_p, idx_t split_index, bool is_empty = false) + : path(std::move(path_p)), split_index(split_index), is_empty(is_empty) { + } + + string path; + idx_t split_index; + bool is_empty = false; + + bool operator<(const ExpandDirectory &other) const { + return path > other.path; + } +}; + +static void CrawlDirectoryLevel(FileSystem &fs, const string &path, optional_ptr> files, + std::priority_queue &directories, idx_t split_index) { + fs.ListFiles(path, [&](OpenFileInfo &info) { + info.path = fs.JoinPath(path, info.path); + if (IsSymbolicLink(info.path)) { + return; + } + bool is_directory = FileSystem::IsDirectory(info); + if (is_directory) { + directories.emplace(std::move(info.path), split_index); + } else if (files) { + files->push_back(std::move(info)); + } + }); +} + +static void GlobFilesInternal(FileSystem &fs, const string &path, const string &glob, bool match_directory, + vector &result) { + fs.ListFiles(path, [&](OpenFileInfo &info) { + bool is_directory = FileSystem::IsDirectory(info); + if (is_directory != match_directory) { + return; + } + if (Glob(info.path.c_str(), info.path.size(), glob.c_str(), glob.size())) { + info.path = fs.JoinPath(path, info.path); + result.push_back(std::move(info)); + } + }); +} + +struct LocalGlobResult : public LazyMultiFileList { +public: + LocalGlobResult(LocalFileSystem &fs, const string &path, FileGlobOptions options, optional_ptr opener); + +protected: + bool ExpandNextPath() const override; + +private: + LocalFileSystem &fs; + string path; + optional_ptr opener; + vector splits; + bool absolute_path = false; + mutable std::priority_queue expand_directories; + mutable bool finished = false; +}; + +LocalGlobResult::LocalGlobResult(LocalFileSystem &fs, const string &path_p, FileGlobOptions options_p, + optional_ptr opener) + : LazyMultiFileList(FileOpener::TryGetClientContext(opener)), fs(fs), path(path_p), opener(opener) { if (path.empty()) { - return vector(); + finished = true; + return; } // split up the path into separate chunks - vector splits; - - bool is_file_url = StringUtil::StartsWith(path, "file:/"); idx_t file_url_path_offset = GetFileUrlOffset(path); idx_t last_pos = 0; @@ -1504,129 +1545,151 @@ vector LocalFileSystem::Glob(const string &path, FileOpener *opene continue; } if (splits.empty()) { - // splits.push_back(path.substr(file_url_path_offset, i-file_url_path_offset)); - splits.push_back(path.substr(0, i)); + splits.emplace_back(fs, path.substr(0, i)); } else { - splits.push_back(path.substr(last_pos, i - last_pos)); + splits.emplace_back(fs, path.substr(last_pos, i - last_pos)); } last_pos = i + 1; } } - splits.push_back(path.substr(last_pos, path.size() - last_pos)); + splits.emplace_back(fs, path.substr(last_pos, path.size() - last_pos)); // handle absolute paths - bool absolute_path = false; - if (IsPathAbsolute(path)) { + absolute_path = false; + if (fs.IsPathAbsolute(path)) { // first character is a slash - unix absolute path absolute_path = true; - } else if (StringUtil::Contains(splits[0], ":")) { // TODO: this is weird? shouldn't IsPathAbsolute handle this? + } else if (StringUtil::Contains(splits[0].path, + ":")) { // TODO: this is weird? shouldn't IsPathAbsolute handle this? // first split has a colon - windows absolute path absolute_path = true; - } else if (splits[0] == "~") { + } else if (splits[0].path == "~") { // starts with home directory - auto home_directory = GetHomeDirectory(opener); + auto home_directory = fs.GetHomeDirectory(opener); if (!home_directory.empty()) { absolute_path = true; - splits[0] = home_directory; + splits[0].path = home_directory; D_ASSERT(path[0] == '~'); - if (!HasGlob(path)) { - return Glob(home_directory + path.substr(1)); + if (!fs.HasGlob(path)) { + expanded_files = fs.FetchFileWithoutGlob(home_directory + path.substr(1), opener, absolute_path); + finished = true; + return; } } } // Check if the path has a glob at all - if (!HasGlob(path)) { + if (!fs.HasGlob(path)) { // no glob: return only the file (if it exists or is a pipe) - return FetchFileWithoutGlob(path, opener, absolute_path); + expanded_files = fs.FetchFileWithoutGlob(path, opener, absolute_path); + finished = true; + return; } - vector previous_directories; if (absolute_path) { // for absolute paths, we don't start by scanning the current directory - previous_directories.push_back(splits[0]); + // FIXME: we don't support /[GLOB]/.. - i.e. globs in the first level of an absolute path + if (splits.size() > 1) { + expand_directories.emplace(splits[0].path, 1); + } } else { // If file_search_path is set, use those paths as the first glob elements Value value; if (opener && opener->TryGetCurrentSetting("file_search_path", value)) { auto search_paths_str = value.ToString(); - vector search_paths = StringUtil::Split(search_paths_str, ','); + auto search_paths = StringUtil::Split(search_paths_str, ','); for (const auto &search_path : search_paths) { - previous_directories.push_back(search_path); + expand_directories.emplace(search_path, 0); } } + if (expand_directories.empty()) { + expand_directories.emplace(".", 0, true); + } } if (HasMultipleCrawl(splits)) { throw IOException("Cannot use multiple \'**\' in one path"); } +} + +bool LocalGlobResult::ExpandNextPath() const { + if (finished) { + return false; + } + if (expand_directories.empty()) { + if (expanded_files.empty()) { + // no result found that matches the glob + // last ditch effort: search the path as a string literal + expanded_files = fs.FetchFileWithoutGlob(path, opener, absolute_path); + } + finished = true; + return false; + } - idx_t start_index; - if (is_file_url) { - start_index = 1; - } else if (absolute_path) { - start_index = 1; + auto next_dir = expand_directories.top(); + auto is_empty = next_dir.is_empty; + auto split_index = next_dir.split_index; + auto ¤t_path = next_dir.path; + expand_directories.pop(); + + auto &next_split = splits[split_index]; + bool is_last_component = split_index + 1 == splits.size(); + auto &next_component = next_split.path; + bool has_glob = next_split.has_glob; + // if it's the last chunk we need to find files, otherwise we find directories + // not the last chunk: gather a list of all directories that match the glob pattern + if (!has_glob) { + // no glob, just append as-is + if (is_empty) { + if (is_last_component) { + throw InternalException("No glob in only component - but entire split has globs?"); + } + // no path yet - just append + expand_directories.emplace(next_component, split_index + 1); + } else { + if (is_last_component) { + // last component - we are emitting a result here + auto filename = fs.JoinPath(current_path, next_component); + if (fs.FileExists(filename, opener) || fs.DirectoryExists(filename, opener)) { + expanded_files.emplace_back(std::move(filename)); + } + } else { + // not the last component - add the next directory as "to-be-expanded" + expand_directories.emplace(fs.JoinPath(current_path, next_component), split_index + 1); + } + } } else { - start_index = 0; - } - - for (idx_t i = start_index ? 1 : 0; i < splits.size(); i++) { - bool is_last_chunk = i + 1 == splits.size(); - bool has_glob = HasGlob(splits[i]); - // if it's the last chunk we need to find files, otherwise we find directories - // not the last chunk: gather a list of all directories that match the glob pattern - vector result; - if (!has_glob) { - // no glob, just append as-is - if (previous_directories.empty()) { - result.push_back(splits[i]); + // glob - need to resolve the glob + if (IsCrawl(next_component)) { + if (is_last_component) { + // the crawl is the last component - we are looking for files in this directory + // any directories we encounter are added to the expand directories + CrawlDirectoryLevel(fs, current_path, expanded_files, expand_directories, split_index); } else { - if (is_last_chunk) { - for (auto &prev_directory : previous_directories) { - const string filename = JoinPath(prev_directory.path, splits[i]); - if (FileExists(filename, opener) || DirectoryExists(filename, opener)) { - result.push_back(filename); - } - } - } else { - for (auto &prev_directory : previous_directories) { - result.push_back(JoinPath(prev_directory.path, splits[i])); - } - } + // not the last crawl + // ** also matches the current directory (i.e. dir/**/file.parquet also matches dir/file.parquet) + expand_directories.emplace(current_path, split_index + 1); + // now crawl the contents of this directory - but don't add any files we find + CrawlDirectoryLevel(fs, current_path, nullptr, expand_directories, split_index); } } else { - if (IsCrawl(splits[i])) { - if (!is_last_chunk) { - result = previous_directories; - } - if (previous_directories.empty()) { - RecursiveGlobDirectories(*this, ".", result, !is_last_chunk, false); - } else { - for (auto &prev_dir : previous_directories) { - RecursiveGlobDirectories(*this, prev_dir.path, result, !is_last_chunk, true); - } - } + // glob this directory according to the next component + if (is_last_component) { + // last component - match files and place them in the result + GlobFilesInternal(fs, current_path, next_component, false, expanded_files); } else { - if (previous_directories.empty()) { - // no previous directories: list in the current path - GlobFilesInternal(*this, ".", splits[i], !is_last_chunk, result, false); - } else { - // previous directories - // we iterate over each of the previous directories, and apply the glob of the current directory - for (auto &prev_directory : previous_directories) { - GlobFilesInternal(*this, prev_directory.path, splits[i], !is_last_chunk, result, true); - } + // not the last component - match directories and add to expansion list + vector child_directories; + GlobFilesInternal(fs, current_path, next_component, true, child_directories); + for (auto &file : child_directories) { + expand_directories.emplace(std::move(file.path), split_index + 1); } } } - if (result.empty()) { - // no result found that matches the glob - // last ditch effort: search the path as a string literal - return FetchFileWithoutGlob(path, opener, absolute_path); - } - if (is_last_chunk) { - return result; - } - previous_directories = std::move(result); } - return vector(); + return true; +} + +unique_ptr LocalFileSystem::GlobFilesExtended(const string &path, const FileGlobInput &input, + optional_ptr opener) { + return make_uniq(*this, path, FileGlobOptions::ALLOW_EMPTY, opener); } unique_ptr FileSystem::CreateLocal() { diff --git a/src/duckdb/src/common/multi_file/multi_file_list.cpp b/src/duckdb/src/common/multi_file/multi_file_list.cpp index 97e6addac..e39c92694 100644 --- a/src/duckdb/src/common/multi_file/multi_file_list.cpp +++ b/src/duckdb/src/common/multi_file/multi_file_list.cpp @@ -4,10 +4,9 @@ #include "duckdb/common/hive_partitioning.hpp" #include "duckdb/common/types.hpp" #include "duckdb/function/function_set.hpp" -#include "duckdb/function/table_function.hpp" #include "duckdb/main/config.hpp" #include "duckdb/planner/operator/logical_get.hpp" -#include "duckdb/common/string_util.hpp" +#include "duckdb/planner/expression/bound_columnref_expression.hpp" #include @@ -79,14 +78,15 @@ bool PushdownInternal(ClientContext &context, const MultiFileOptions &options, c //===--------------------------------------------------------------------===// // MultiFileListIterator //===--------------------------------------------------------------------===// -MultiFileListIterationHelper MultiFileList::Files() { +MultiFileListIterationHelper MultiFileList::Files() const { return MultiFileListIterationHelper(*this); } -MultiFileListIterationHelper::MultiFileListIterationHelper(MultiFileList &file_list_p) : file_list(file_list_p) { +MultiFileListIterationHelper::MultiFileListIterationHelper(const MultiFileList &file_list_p) : file_list(file_list_p) { } -MultiFileListIterationHelper::MultiFileListIterator::MultiFileListIterator(MultiFileList *file_list_p) +MultiFileListIterationHelper::MultiFileListIterator::MultiFileListIterator( + optional_ptr file_list_p) : file_list(file_list_p) { if (!file_list) { return; @@ -136,27 +136,41 @@ const OpenFileInfo &MultiFileListIterationHelper::MultiFileListIterator::operato //===--------------------------------------------------------------------===// // MultiFileList //===--------------------------------------------------------------------===// -MultiFileList::MultiFileList(vector paths, FileGlobInput glob_input_p) - : paths(std::move(paths)), glob_input(std::move(glob_input_p)) { +MultiFileList::MultiFileList() { } -MultiFileList::MultiFileList(vector paths, FileGlobOptions options) - : MultiFileList(std::move(paths), FileGlobInput(options)) { +MultiFileList::~MultiFileList() { } -MultiFileList::~MultiFileList() { +void MultiFileList::InitializeScan(MultiFileListScanData &iterator) const { + iterator.current_file_idx = 0; } -const vector MultiFileList::GetPaths() const { - return paths; +vector MultiFileList::GetDisplayFileList(optional_idx max_files) const { + vector files; + for (idx_t i = 0;; i++) { + if (max_files.IsValid() && files.size() >= max_files.GetIndex()) { + break; + } + auto file = GetFile(i); + if (file.path.empty()) { + break; + } + files.push_back(std::move(file)); + } + return files; } -void MultiFileList::InitializeScan(MultiFileListScanData &iterator) { - iterator.current_file_idx = 0; +MultiFileCount MultiFileList::GetFileCount(idx_t min_exact_count) const { + return MultiFileCount(GetTotalFileCount()); } -bool MultiFileList::Scan(MultiFileListScanData &iterator, OpenFileInfo &result_file) { +bool MultiFileList::Scan(MultiFileListScanData &iterator, OpenFileInfo &result_file) const { D_ASSERT(iterator.current_file_idx != DConstants::INVALID_INDEX); + if (iterator.scan_type == MultiFileListScanType::FETCH_IF_AVAILABLE && + !FileIsAvailable(iterator.current_file_idx)) { + return false; + } auto maybe_file = GetFile(iterator.current_file_idx); if (maybe_file.path.empty()) { @@ -171,8 +185,17 @@ bool MultiFileList::Scan(MultiFileListScanData &iterator, OpenFileInfo &result_f unique_ptr MultiFileList::ComplexFilterPushdown(ClientContext &context, const MultiFileOptions &options, MultiFilePushdownInfo &info, - vector> &filters) { - // By default the filter pushdown into a multifilelist does nothing + vector> &filters) const { + if (!options.hive_partitioning && !options.filename) { + return nullptr; + } + + // FIXME: don't copy list until first file is filtered + auto file_copy = GetAllFiles(); + auto res = PushdownInternal(context, options, info, filters, file_copy); + if (res) { + return make_uniq(std::move(file_copy)); + } return nullptr; } @@ -181,75 +204,51 @@ unique_ptr MultiFileList::DynamicFilterPushdown(ClientContext &co const vector &types, const vector &column_ids, TableFilterSet &filters) const { - // By default the filter pushdown into a multifilelist does nothing + if (!options.hive_partitioning && !options.filename) { + return nullptr; + } + + // FIXME: don't copy list until first file is filtered + auto file_copy = GetAllFiles(); + auto res = PushdownInternal(context, options, names, types, column_ids, filters, file_copy); + if (res) { + return make_uniq(std::move(file_copy)); + } + return nullptr; } -unique_ptr MultiFileList::GetCardinality(ClientContext &context) { +unique_ptr MultiFileList::GetCardinality(ClientContext &context) const { return nullptr; } -OpenFileInfo MultiFileList::GetFirstFile() { +OpenFileInfo MultiFileList::GetFirstFile() const { return GetFile(0); } -bool MultiFileList::IsEmpty() { +bool MultiFileList::IsEmpty() const { return GetExpandResult() == FileExpandResult::NO_FILES; } -unique_ptr MultiFileList::Copy() { +unique_ptr MultiFileList::Copy() const { return make_uniq(GetAllFiles()); } +bool MultiFileList::FileIsAvailable(idx_t i) const { + return true; +} + //===--------------------------------------------------------------------===// // SimpleMultiFileList //===--------------------------------------------------------------------===// -SimpleMultiFileList::SimpleMultiFileList(vector paths_p) - : MultiFileList(std::move(paths_p), FileGlobOptions::ALLOW_EMPTY) { -} - -unique_ptr SimpleMultiFileList::ComplexFilterPushdown(ClientContext &context_p, - const MultiFileOptions &options, - MultiFilePushdownInfo &info, - vector> &filters) { - if (!options.hive_partitioning && !options.filename) { - return nullptr; - } - - // FIXME: don't copy list until first file is filtered - auto file_copy = paths; - auto res = PushdownInternal(context_p, options, info, filters, file_copy); - - if (res) { - return make_uniq(file_copy); - } - - return nullptr; -} - -unique_ptr -SimpleMultiFileList::DynamicFilterPushdown(ClientContext &context, const MultiFileOptions &options, - const vector &names, const vector &types, - const vector &column_ids, TableFilterSet &filters) const { - if (!options.hive_partitioning && !options.filename) { - return nullptr; - } - - // FIXME: don't copy list until first file is filtered - auto file_copy = paths; - auto res = PushdownInternal(context, options, names, types, column_ids, filters, file_copy); - if (res) { - return make_uniq(file_copy); - } - - return nullptr; +SimpleMultiFileList::SimpleMultiFileList(vector paths_p) : paths(std::move(paths_p)) { } -vector SimpleMultiFileList::GetAllFiles() { +vector SimpleMultiFileList::GetAllFiles() const { return paths; } -FileExpandResult SimpleMultiFileList::GetExpandResult() { +FileExpandResult SimpleMultiFileList::GetExpandResult() const { if (paths.size() > 1) { return FileExpandResult::MULTIPLE_FILES; } else if (paths.size() == 1) { @@ -259,7 +258,7 @@ FileExpandResult SimpleMultiFileList::GetExpandResult() { return FileExpandResult::NO_FILES; } -OpenFileInfo SimpleMultiFileList::GetFile(idx_t i) { +OpenFileInfo SimpleMultiFileList::GetFile(idx_t i) const { if (paths.empty() || i >= paths.size()) { return OpenFileInfo(""); } @@ -267,99 +266,61 @@ OpenFileInfo SimpleMultiFileList::GetFile(idx_t i) { return paths[i]; } -idx_t SimpleMultiFileList::GetTotalFileCount() { +idx_t SimpleMultiFileList::GetTotalFileCount() const { return paths.size(); } //===--------------------------------------------------------------------===// -// GlobMultiFileList +// LazyFileList //===--------------------------------------------------------------------===// -GlobMultiFileList::GlobMultiFileList(ClientContext &context_p, vector paths_p, FileGlobInput glob_input) - : MultiFileList(std::move(paths_p), std::move(glob_input)), context(context_p), current_path(0) { +LazyMultiFileList::LazyMultiFileList(optional_ptr context_p) : context(context_p) { } -unique_ptr GlobMultiFileList::ComplexFilterPushdown(ClientContext &context_p, - const MultiFileOptions &options, - MultiFilePushdownInfo &info, - vector> &filters) { +vector LazyMultiFileList::GetAllFiles() const { lock_guard lck(lock); - - // Expand all - // FIXME: lazy expansion - // FIXME: push down filters into glob - while (ExpandNextPath()) { - } - - if (!options.hive_partitioning && !options.filename) { - return nullptr; - } - auto res = PushdownInternal(context, options, info, filters, expanded_files); - if (res) { - return make_uniq(expanded_files); + while (ExpandNextPathInternal()) { } - - return nullptr; -} - -unique_ptr -GlobMultiFileList::DynamicFilterPushdown(ClientContext &context, const MultiFileOptions &options, - const vector &names, const vector &types, - const vector &column_ids, TableFilterSet &filters) const { - if (!options.hive_partitioning && !options.filename) { - return nullptr; - } - lock_guard lck(lock); - - // Expand all paths into a copy - // FIXME: lazy expansion and push filters into glob - idx_t path_index = current_path; - auto file_list = expanded_files; - while (ExpandPathInternal(path_index, file_list)) { - } - - auto res = PushdownInternal(context, options, names, types, column_ids, filters, file_list); - if (res) { - return make_uniq(file_list); - } - - return nullptr; + return expanded_files; } -vector GlobMultiFileList::GetAllFiles() { +idx_t LazyMultiFileList::GetTotalFileCount() const { lock_guard lck(lock); - while (ExpandNextPath()) { + while (ExpandNextPathInternal()) { } - return expanded_files; + return expanded_files.size(); } -idx_t GlobMultiFileList::GetTotalFileCount() { +MultiFileCount LazyMultiFileList::GetFileCount(idx_t min_exact_count) const { lock_guard lck(lock); - while (ExpandNextPath()) { + // expand files so that we get to min_exact_count + while (!all_files_expanded && expanded_files.size() < min_exact_count && ExpandNextPathInternal()) { } - return expanded_files.size(); + auto type = all_files_expanded ? FileExpansionType::ALL_FILES_EXPANDED : FileExpansionType::NOT_ALL_FILES_KNOWN; + return MultiFileCount(expanded_files.size(), type); } -FileExpandResult GlobMultiFileList::GetExpandResult() { +FileExpandResult LazyMultiFileList::GetExpandResult() const { // GetFile(1) will ensure at least the first 2 files are expanded if they are available - GetFile(1); + (void)GetFile(1); + lock_guard lck(lock); if (expanded_files.size() > 1) { return FileExpandResult::MULTIPLE_FILES; } else if (expanded_files.size() == 1) { return FileExpandResult::SINGLE_FILE; } - return FileExpandResult::NO_FILES; } -OpenFileInfo GlobMultiFileList::GetFile(idx_t i) { +bool LazyMultiFileList::FileIsAvailable(idx_t i) const { lock_guard lck(lock); - return GetFileInternal(i); + return i < expanded_files.size(); } -OpenFileInfo GlobMultiFileList::GetFileInternal(idx_t i) { +OpenFileInfo LazyMultiFileList::GetFile(idx_t i) const { + lock_guard lck(lock); while (expanded_files.size() <= i) { - if (!ExpandNextPath()) { + if (!ExpandNextPathInternal()) { return OpenFileInfo(""); } } @@ -367,26 +328,76 @@ OpenFileInfo GlobMultiFileList::GetFileInternal(idx_t i) { return expanded_files[i]; } -bool GlobMultiFileList::ExpandPathInternal(idx_t ¤t_path, vector &result) const { - if (current_path >= paths.size()) { +bool LazyMultiFileList::ExpandNextPathInternal() const { + if (all_files_expanded) { + return false; + } + if (context && context->interrupted) { + throw InterruptException(); + } + if (!ExpandNextPath()) { + all_files_expanded = true; return false; } - - auto &fs = FileSystem::GetFileSystem(context); - auto glob_files = fs.GlobFiles(paths[current_path].path, context, glob_input); - std::sort(glob_files.begin(), glob_files.end()); - result.insert(result.end(), glob_files.begin(), glob_files.end()); - - current_path++; return true; } -bool GlobMultiFileList::ExpandNextPath() { - return ExpandPathInternal(current_path, expanded_files); +//===--------------------------------------------------------------------===// +// GlobMultiFileList +//===--------------------------------------------------------------------===// +GlobMultiFileList::GlobMultiFileList(ClientContext &context_p, vector globs_p, FileGlobInput glob_input_p) + : LazyMultiFileList(&context_p), context(context_p), globs(std::move(globs_p)), glob_input(std::move(glob_input_p)), + current_glob(0) { +} + +vector GlobMultiFileList::GetDisplayFileList(optional_idx max_files) const { + // for globs we display the actual globs in the ToString() - instead of expanding to the files read + vector result; + for (auto &glob : globs) { + if (max_files.IsValid() && result.size() >= max_files.GetIndex()) { + break; + } + result.emplace_back(glob); + } + return result; } -bool GlobMultiFileList::IsFullyExpanded() const { - return current_path == paths.size(); +bool GlobMultiFileList::ExpandNextPath() const { + if (current_glob >= globs.size()) { + return false; + } + if (current_glob >= file_lists.size()) { + // glob is not yet started for this file - start it and initiate the scan over this file + auto &fs = FileSystem::GetFileSystem(context); + auto glob_result = fs.GlobFileList(globs[current_glob], glob_input); + scan_state = MultiFileListScanData(); + glob_result->InitializeScan(scan_state); + file_lists.push_back(std::move(glob_result)); + } + // get the next batch of files we can fetch through the glob + auto &glob_list = *file_lists[current_glob]; + scan_state.scan_type = MultiFileListScanType::ALWAYS_FETCH; + OpenFileInfo file; + if (!glob_list.Scan(scan_state, file)) { + // no more files available in this glob - move to the next glob + current_glob++; + return true; + } + // we found a file as part of this glob - add it to the result + vector glob_files; + glob_files.push_back(std::move(file)); + + // now continue scanning files that are already available (i.e. that don't require extra I/O operations to fetch) + scan_state.scan_type = MultiFileListScanType::FETCH_IF_AVAILABLE; + while (glob_list.Scan(scan_state, file)) { + glob_files.push_back(std::move(file)); + } + + // sort the files and add them to the list of files + std::sort(glob_files.begin(), glob_files.end()); + expanded_files.insert(expanded_files.end(), glob_files.begin(), glob_files.end()); + + return true; } } // namespace duckdb diff --git a/src/duckdb/src/common/multi_file/multi_file_reader.cpp b/src/duckdb/src/common/multi_file/multi_file_reader.cpp index d69e4a187..b5a160694 100644 --- a/src/duckdb/src/common/multi_file/multi_file_reader.cpp +++ b/src/duckdb/src/common/multi_file/multi_file_reader.cpp @@ -118,11 +118,7 @@ vector MultiFileReader::ParsePaths(const Value &input) { shared_ptr MultiFileReader::CreateFileList(ClientContext &context, const vector &paths, const FileGlobInput &glob_input) { - vector open_files; - for (auto &path : paths) { - open_files.emplace_back(path); - } - auto res = make_uniq(context, std::move(open_files), glob_input); + auto res = make_uniq(context, paths, glob_input); if (res->GetExpandResult() == FileExpandResult::NO_FILES && glob_input.behavior != FileGlobOptions::ALLOW_EMPTY) { throw IOException("%s needs at least one file to read", function_name); } diff --git a/src/duckdb/src/common/operator/cast_operators.cpp b/src/duckdb/src/common/operator/cast_operators.cpp index 5998d7787..233bcf619 100644 --- a/src/duckdb/src/common/operator/cast_operators.cpp +++ b/src/duckdb/src/common/operator/cast_operators.cpp @@ -26,6 +26,8 @@ #include "duckdb/common/operator/integer_cast_operator.hpp" #include "duckdb/common/operator/double_cast_operator.hpp" #include "duckdb/planner/expression.hpp" +#include "duckdb/common/serializer/binary_deserializer.hpp" +#include "duckdb/common/serializer/memory_stream.hpp" #include #include @@ -1424,6 +1426,22 @@ string_t CastFromPointer::Operation(uintptr_t input, Vector &vector) { return StringVector::AddString(vector, s); } +//===--------------------------------------------------------------------===// +// Cast From Pointer +//===--------------------------------------------------------------------===// +template <> +string_t CastFromType::Operation(string_t input, Vector &vector) { + MemoryStream stream(data_ptr_cast(input.GetDataWriteable()), input.GetSize()); + BinaryDeserializer deserializer(stream); + try { + auto type = LogicalType::Deserialize(deserializer); + return StringVector::AddString(vector, type.ToString()); + } catch (std::exception &ex) { + // TODO: Format better error here? + return StringVector::AddString(vector, ex.what()); + } +} + //===--------------------------------------------------------------------===// // Cast To Blob //===--------------------------------------------------------------------===// diff --git a/src/duckdb/src/common/sort/sort.cpp b/src/duckdb/src/common/sort/sort.cpp index fe0883beb..484426201 100644 --- a/src/duckdb/src/common/sort/sort.cpp +++ b/src/duckdb/src/common/sort/sort.cpp @@ -469,9 +469,7 @@ SourceResultType Sort::MaterializeColumnData(ExecutionContext &context, Operator while (true) { // Check for interrupts since this could be a long-running task - if (context.client.interrupted.load(std::memory_order_relaxed)) { - throw InterruptException(); - } + context.client.InterruptCheck(); // Scan a chunk chunk.Reset(); GetData(context, chunk, input); diff --git a/src/duckdb/src/common/sort/sorted_run.cpp b/src/duckdb/src/common/sort/sorted_run.cpp index 1dc7c9dd5..8f7a7803b 100644 --- a/src/duckdb/src/common/sort/sorted_run.cpp +++ b/src/duckdb/src/common/sort/sorted_run.cpp @@ -263,9 +263,7 @@ static void TemplatedSort(ClientContext &context, const TupleDataCollection &key }; duckdb_vergesort::vergesort(begin, end, std::less(), fallback); - if (context.interrupted.load(std::memory_order_relaxed)) { - throw InterruptException(); - } + context.InterruptCheck(); } static void SortSwitch(ClientContext &context, const TupleDataCollection &key_data, bool is_index_sort) { @@ -369,9 +367,7 @@ static void TemplatedReorder(ClientContext &context, unique_ptr(total_count - index, STANDARD_VECTOR_SIZE); for (idx_t i = 0; i < next; i++) { diff --git a/src/duckdb/src/common/thread_util.cpp b/src/duckdb/src/common/thread_util.cpp index 0860d6d2a..6b5526096 100644 --- a/src/duckdb/src/common/thread_util.cpp +++ b/src/duckdb/src/common/thread_util.cpp @@ -3,12 +3,22 @@ namespace duckdb { -void ThreadUtil::SleepMs(idx_t sleep_ms) { #ifndef DUCKDB_NO_THREADS +void ThreadUtil::SleepMs(idx_t sleep_ms) { std::this_thread::sleep_for(std::chrono::milliseconds(sleep_ms)); +} + +thread_id ThreadUtil::GetThreadId() { + return std::this_thread::get_id(); +} #else + +void ThreadUtil::SleepMs(idx_t sleep_ms) { throw InvalidInputException("ThreadUtil::SleepMs requires DuckDB to be compiled with thread support"); -#endif } +thread_id ThreadUtil::GetThreadId() { + return 0; +} +#endif } // namespace duckdb diff --git a/src/duckdb/src/common/types.cpp b/src/duckdb/src/common/types.cpp index 74bdcc318..459f1a88a 100644 --- a/src/duckdb/src/common/types.cpp +++ b/src/duckdb/src/common/types.cpp @@ -17,15 +17,16 @@ #include "duckdb/common/types/vector.hpp" #include "duckdb/common/uhugeint.hpp" #include "duckdb/function/cast_rules.hpp" -#include "duckdb/main/attached_database.hpp" #include "duckdb/main/client_context.hpp" #include "duckdb/main/client_data.hpp" -#include "duckdb/main/config.hpp" -#include "duckdb/main/database.hpp" -#include "duckdb/main/database_manager.hpp" +#include "duckdb/common/types/type_manager.hpp" +#include "duckdb/parser/expression/constant_expression.hpp" #include "duckdb/parser/keyword_helper.hpp" #include "duckdb/parser/parser.hpp" #include "duckdb/main/settings.hpp" +#include "duckdb/parser/expression/type_expression.hpp" +#include "duckdb/common/serializer/serializer.hpp" +#include "duckdb/common/serializer/deserializer.hpp" #include @@ -119,6 +120,7 @@ PhysicalType LogicalType::GetInternalType() { case LogicalTypeId::CHAR: case LogicalTypeId::BLOB: case LogicalTypeId::BIT: + case LogicalTypeId::TYPE: return PhysicalType::VARCHAR; case LogicalTypeId::INTERVAL: return PhysicalType::INTERVAL; @@ -158,7 +160,7 @@ PhysicalType LogicalType::GetInternalType() { case LogicalTypeId::INTEGER_LITERAL: case LogicalTypeId::TEMPLATE: return PhysicalType::INVALID; - case LogicalTypeId::USER: + case LogicalTypeId::UNBOUND: return PhysicalType::UNKNOWN; case LogicalTypeId::AGGREGATE_STATE: return PhysicalType::VARCHAR; @@ -387,7 +389,7 @@ static string TypeModifierListToString(const vector &mod_li } string LogicalType::ToString() const { - if (id_ != LogicalTypeId::USER) { + if (id_ != LogicalTypeId::UNBOUND) { auto alias = GetAlias(); if (!alias.empty()) { if (HasExtensionInfo()) { @@ -482,39 +484,17 @@ string LogicalType::ToString() const { ret += ")"; return ret; } - case LogicalTypeId::USER: { - string result; - auto &catalog = UserType::GetCatalog(*this); - auto &schema = UserType::GetSchema(*this); - auto &type = UserType::GetTypeName(*this); - auto &mods = UserType::GetTypeModifiers(*this); - - if (!catalog.empty()) { - result = KeywordHelper::WriteOptionallyQuoted(catalog); - } - if (!schema.empty()) { - if (!result.empty()) { - result += "."; - } - result += KeywordHelper::WriteOptionallyQuoted(schema); - } - if (!result.empty()) { - result += "."; - } - result += KeywordHelper::WriteOptionallyQuoted(type); - - if (!mods.empty()) { - result += "("; - for (idx_t i = 0; i < mods.size(); i++) { - result += mods[i].ToString(); - if (i < mods.size() - 1) { - result += ", "; - } - } - result += ")"; + case LogicalTypeId::UNBOUND: { + if (!type_info_) { + return "UNBOUND"; } - return result; + auto &expr = UnboundType::GetTypeExpression(*this); + if (expr->type != ExpressionType::TYPE) { + return "(" + expr->ToString() + ")"; + } else { + return expr->ToString(); + } } case LogicalTypeId::AGGREGATE_STATE: { return AggregateStateType::GetTypeName(*this); @@ -547,110 +527,13 @@ LogicalTypeId TransformStringToLogicalTypeId(const string &str) { if (type == LogicalTypeId::INVALID) { // This is a User Type, at this point we don't know if its one of the User Defined Types or an error // It is checked in the binder - type = LogicalTypeId::USER; + type = LogicalTypeId::UNBOUND; } return type; } -LogicalType TransformStringToLogicalType(const string &str) { - if (StringUtil::Lower(str) == "null") { - return LogicalType::SQLNULL; - } - ColumnList column_list; - try { - column_list = Parser::ParseColumnList("dummy " + str); - } catch (const std::runtime_error &e) { - const vector suggested_types {"BIGINT", - "INT8", - "LONG", - "BIT", - "BITSTRING", - "BLOB", - "BYTEA", - "BINARY,", - "VARBINARY", - "BOOLEAN", - "BOOL", - "LOGICAL", - "DATE", - "DECIMAL(prec, scale)", - "DOUBLE", - "FLOAT8", - "FLOAT", - "FLOAT4", - "REAL", - "HUGEINT", - "INTEGER", - "INT4", - "INT", - "SIGNED", - "INTERVAL", - "SMALLINT", - "INT2", - "SHORT", - "TIME", - "TIMESTAMPTZ", - "TIMESTAMP", - "DATETIME", - "TINYINT", - "INT1", - "UBIGINT", - "UHUGEINT", - "UINTEGER", - "USMALLINT", - "UTINYINT", - "UUID", - "VARCHAR", - "CHAR", - "BPCHAR", - "TEXT", - "STRING", - "MAP(INTEGER, VARCHAR)", - "UNION(num INTEGER, text VARCHAR)"}; - std::ostringstream error; - error << "Value \"" << str << "\" can not be converted to a DuckDB Type." << '\n'; - error << "Possible examples as suggestions: " << '\n'; - auto suggestions = StringUtil::TopNJaroWinkler(suggested_types, str); - for (auto &suggestion : suggestions) { - error << "* " << suggestion << '\n'; - } - throw InvalidInputException(error.str()); - } - return column_list.GetColumn(LogicalIndex(0)).Type(); -} - -LogicalType GetUserTypeRecursive(const LogicalType &type, ClientContext &context) { - if (type.id() == LogicalTypeId::USER && type.HasAlias()) { - auto &type_entry = - Catalog::GetEntry(context, INVALID_CATALOG, INVALID_SCHEMA, type.GetAlias()); - return type_entry.user_type; - } - // Look for LogicalTypeId::USER in nested types - if (type.id() == LogicalTypeId::STRUCT) { - child_list_t children; - children.reserve(StructType::GetChildCount(type)); - for (auto &child : StructType::GetChildTypes(type)) { - children.emplace_back(child.first, GetUserTypeRecursive(child.second, context)); - } - return LogicalType::STRUCT(children); - } - if (type.id() == LogicalTypeId::LIST) { - return LogicalType::LIST(GetUserTypeRecursive(ListType::GetChildType(type), context)); - } - if (type.id() == LogicalTypeId::ARRAY) { - return LogicalType::ARRAY(GetUserTypeRecursive(ArrayType::GetChildType(type), context), - ArrayType::GetSize(type)); - } - if (type.id() == LogicalTypeId::MAP) { - return LogicalType::MAP(GetUserTypeRecursive(MapType::KeyType(type), context), - GetUserTypeRecursive(MapType::ValueType(type), context)); - } - // Not LogicalTypeId::USER or a nested type - return type; -} - LogicalType TransformStringToLogicalType(const string &str, ClientContext &context) { - return GetUserTypeRecursive(TransformStringToLogicalType(str), context); + return TypeManager::Get(context).ParseLogicalType(str, context); } bool LogicalType::IsIntegral() const { @@ -1282,6 +1165,11 @@ bool LogicalType::TryGetMaxLogicalType(ClientContext &context, const LogicalType result = LogicalType::ForceMaxLogicalType(left, right); return true; } + return TryGetMaxLogicalTypeUnchecked(left, right, result); +} + +bool LogicalType::TryGetMaxLogicalTypeUnchecked(const LogicalType &left, const LogicalType &right, + LogicalType &result) { return TryGetMaxLogicalTypeInternal(left, right, result); } @@ -1378,7 +1266,8 @@ static idx_t GetLogicalTypeScore(const LogicalType &type) { case LogicalTypeId::AGGREGATE_STATE: case LogicalTypeId::POINTER: case LogicalTypeId::VALIDITY: - case LogicalTypeId::USER: + case LogicalTypeId::UNBOUND: + case LogicalTypeId::TYPE: break; } return 1000; @@ -1469,6 +1358,33 @@ bool ApproxEqual(double ldecimal, double rdecimal) { return std::fabs(ldecimal - rdecimal) <= epsilon; } +void LogicalType::Serialize(Serializer &serializer) const { + // This is a UNBOUND type and we are writing to older storage. + // 1. try to default-bind into a concrete logical type, and serialize that + // 2. if that fails, serialize normally, in which case the UNBOUND_TYPE_INFO will try to + // write itself as an old-style USER type. + if (id_ == LogicalTypeId::UNBOUND && !serializer.ShouldSerialize(7)) { + try { + auto bound_type = UnboundType::TryDefaultBind(*this); + if (bound_type.id() != LogicalTypeId::INVALID && bound_type.id() != LogicalTypeId::UNBOUND) { + bound_type.Serialize(serializer); + return; + } + } catch (...) { + // Ignore errors, just try to write as a USER type instead + } + } + serializer.WriteProperty(100, "id", id_); + serializer.WritePropertyWithDefault>(101, "type_info", type_info_); +} + +LogicalType LogicalType::Deserialize(Deserializer &deserializer) { + auto id = deserializer.ReadProperty(100, "id"); + auto type_info = deserializer.ReadPropertyWithDefault>(101, "type_info"); + LogicalType result(id, std::move(type_info)); + return result; +} + //===--------------------------------------------------------------------===// // Extra Type Info //===--------------------------------------------------------------------===// @@ -1499,9 +1415,6 @@ void LogicalType::SetAlias(string alias) { } string LogicalType::GetAlias() const { - if (id() == LogicalTypeId::USER) { - return UserType::GetTypeName(*this); - } if (type_info_) { return type_info_->alias; } @@ -1509,9 +1422,6 @@ string LogicalType::GetAlias() const { } bool LogicalType::HasAlias() const { - if (id() == LogicalTypeId::USER) { - return !UserType::GetTypeName(*this).empty(); - } if (type_info_ && !type_info_->alias.empty()) { return true; } @@ -1627,10 +1537,14 @@ const string AggregateStateType::GetTypeName(const LogicalType &type) { return "AGGREGATE_STATE"; } auto aggr_state = info->Cast().state_type; + bool is_nested_type = aggr_state.state_type.IsValid(); return "AGGREGATE_STATE<" + aggr_state.function_name + "(" + StringUtil::Join(aggr_state.bound_argument_types, aggr_state.bound_argument_types.size(), ", ", [](const LogicalType &arg_type) { return arg_type.ToString(); }) + - ")" + "::" + aggr_state.return_type.ToString() + ">"; + ")" + "::" + + (is_nested_type ? aggr_state.return_type.ToString() + ", " + aggr_state.state_type.ToString() + : aggr_state.return_type.ToString()) + + ">"; } //===--------------------------------------------------------------------===// @@ -1767,52 +1681,18 @@ const child_list_t UnionType::CopyMemberTypes(const LogicalType &ty } //===--------------------------------------------------------------------===// -// User Type +// Unbound Type //===--------------------------------------------------------------------===// -const string &UserType::GetCatalog(const LogicalType &type) { - D_ASSERT(type.id() == LogicalTypeId::USER); - auto info = type.AuxInfo(); - return info->Cast().catalog; -} - -const string &UserType::GetSchema(const LogicalType &type) { - D_ASSERT(type.id() == LogicalTypeId::USER); - auto info = type.AuxInfo(); - return info->Cast().schema; +LogicalType LogicalType::UNBOUND(unique_ptr expr) { + auto info = make_shared_ptr(std::move(expr)); + return LogicalType(LogicalTypeId::UNBOUND, std::move(info)); } -const string &UserType::GetTypeName(const LogicalType &type) { - D_ASSERT(type.id() == LogicalTypeId::USER); - auto info = type.AuxInfo(); - return info->Cast().user_type_name; -} - -const vector &UserType::GetTypeModifiers(const LogicalType &type) { - D_ASSERT(type.id() == LogicalTypeId::USER); - auto info = type.AuxInfo(); - return info->Cast().user_type_modifiers; -} - -vector &UserType::GetTypeModifiers(LogicalType &type) { - D_ASSERT(type.id() == LogicalTypeId::USER); - auto info = type.GetAuxInfoShrPtr(); - return info->Cast().user_type_modifiers; -} - -LogicalType LogicalType::USER(const string &user_type_name) { - auto info = make_shared_ptr(user_type_name); - return LogicalType(LogicalTypeId::USER, std::move(info)); -} - -LogicalType LogicalType::USER(const string &user_type_name, const vector &user_type_mods) { - auto info = make_shared_ptr(user_type_name, user_type_mods); - return LogicalType(LogicalTypeId::USER, std::move(info)); -} - -LogicalType LogicalType::USER(string catalog, string schema, string name, vector user_type_mods) { - auto info = make_shared_ptr(std::move(catalog), std::move(schema), std::move(name), - std::move(user_type_mods)); - return LogicalType(LogicalTypeId::USER, std::move(info)); +//===--------------------------------------------------------------------===// +// Type Type +//===--------------------------------------------------------------------===// +LogicalType LogicalType::TYPE() { + return LogicalType(LogicalTypeId::TYPE); } //===--------------------------------------------------------------------===// @@ -2079,6 +1959,77 @@ const CoordinateReferenceSystem &GeoType::GetCRS(const LogicalType &type) { return geo_info.crs; } +//===--------------------------------------------------------------------===// +// Unbound Types +//===--------------------------------------------------------------------===// + +const unique_ptr &UnboundType::GetTypeExpression(const LogicalType &type) { + D_ASSERT(type.id() == LogicalTypeId::UNBOUND); + auto info = type.AuxInfo(); + D_ASSERT(info->type == ExtraTypeInfoType::UNBOUND_TYPE_INFO); + return info->Cast().expr; +} + +LogicalType UnboundType::TryParseAndDefaultBind(const string &type_str) { + if (type_str.empty()) { + return LogicalType::INVALID; + } + try { + ColumnList list = Parser::ParseColumnList("dummy " + type_str); + auto unbound = list.GetColumn(LogicalIndex(0)).Type(); + return TryDefaultBind(unbound); + } catch (const std::runtime_error &e) { + throw InvalidInputException("Could not parse type string '%s'", type_str); + } +} + +static LogicalType TryDefaultBindTypeExpression(const ParsedExpression &expr) { + if (expr.type != ExpressionType::TYPE) { + throw InvalidInputException("Cannot default bind unbound type with non-type expression"); + } + const auto &type_expr = expr.Cast(); + + // Now we try to bind the unbound type to a default type + auto &name = type_expr.GetTypeName(); + auto &args = type_expr.GetChildren(); + + vector> bound_args; + for (auto &arg : args) { + switch (arg->GetExpressionType()) { + case ExpressionType::TYPE: { + auto type = TryDefaultBindTypeExpression(*arg); + bound_args.emplace_back(arg->GetName(), Value::TYPE(type)); + } break; + case ExpressionType::VALUE_CONSTANT: { + auto &const_expr = arg->Cast(); + bound_args.emplace_back(arg->GetName(), const_expr.value); + } break; + default: + throw InvalidInputException("Cannot default bind unbound type with non-type, non-expression parameter"); + break; + } + } + + // Try to bind as far as we can + auto result = DefaultTypeGenerator::TryDefaultBind(name, bound_args); + if (result.id() != LogicalTypeId::INVALID) { + return result; + } + + // Otherwise, wrap this as an unbound type + auto copy = expr.Copy(); + return LogicalType::UNBOUND(std::move(copy)); + // return LogicalType::INVALID; +} + +LogicalType UnboundType::TryDefaultBind(const LogicalType &unbound_type) { + if (!unbound_type.IsUnbound()) { + return unbound_type; + } + auto &expr = UnboundType::GetTypeExpression(unbound_type); + return TryDefaultBindTypeExpression(*expr); +} + //===--------------------------------------------------------------------===// // Logical Type //===--------------------------------------------------------------------===// diff --git a/src/duckdb/src/common/types/row/partitioned_tuple_data.cpp b/src/duckdb/src/common/types/row/partitioned_tuple_data.cpp index e03770d54..f353dcf53 100644 --- a/src/duckdb/src/common/types/row/partitioned_tuple_data.cpp +++ b/src/duckdb/src/common/types/row/partitioned_tuple_data.cpp @@ -288,9 +288,7 @@ void PartitionedTupleData::Repartition(ClientContext &context, PartitionedTupleD auto &chunk_state = iterator.GetChunkState(); do { // Check for interrupts with each chunk - if (context.interrupted) { - throw InterruptException(); - } + context.InterruptCheck(); new_partitioned_data.Append(append_state, chunk_state, iterator.GetCurrentChunkCount()); } while (iterator.Next()); diff --git a/src/duckdb/src/common/types/type_manager.cpp b/src/duckdb/src/common/types/type_manager.cpp new file mode 100644 index 000000000..255e41c85 --- /dev/null +++ b/src/duckdb/src/common/types/type_manager.cpp @@ -0,0 +1,117 @@ +#include "duckdb/common/types/type_manager.hpp" +#include "duckdb/function/cast/cast_function_set.hpp" +#include "duckdb/parser/parser.hpp" +#include "duckdb/planner/binder.hpp" +#include "duckdb/main/config.hpp" +#include "duckdb/main/client_context.hpp" +#include "duckdb/main/database.hpp" + +namespace duckdb { + +CastFunctionSet &TypeManager::GetCastFunctions() { + return *cast_functions; +} + +static LogicalType TransformStringToUnboundType(const string &str) { + if (StringUtil::Lower(str) == "null") { + return LogicalType::SQLNULL; + } + ColumnList column_list; + try { + column_list = Parser::ParseColumnList("dummy " + str); + } catch (const std::runtime_error &e) { + const vector suggested_types {"BIGINT", + "INT8", + "LONG", + "BIT", + "BITSTRING", + "BLOB", + "BYTEA", + "BINARY,", + "VARBINARY", + "BOOLEAN", + "BOOL", + "LOGICAL", + "DATE", + "DECIMAL(prec, scale)", + "DOUBLE", + "FLOAT8", + "FLOAT", + "FLOAT4", + "REAL", + "HUGEINT", + "INTEGER", + "INT4", + "INT", + "SIGNED", + "INTERVAL", + "SMALLINT", + "INT2", + "SHORT", + "TIME", + "TIMESTAMPTZ", + "TIMESTAMP", + "DATETIME", + "TINYINT", + "INT1", + "UBIGINT", + "UHUGEINT", + "UINTEGER", + "USMALLINT", + "UTINYINT", + "UUID", + "VARCHAR", + "CHAR", + "BPCHAR", + "TEXT", + "STRING", + "MAP(INTEGER, VARCHAR)", + "UNION(num INTEGER, text VARCHAR)"}; + std::ostringstream error; + error << "Value \"" << str << "\" can not be converted to a DuckDB Type." << '\n'; + error << "Possible examples as suggestions: " << '\n'; + auto suggestions = StringUtil::TopNJaroWinkler(suggested_types, str); + for (auto &suggestion : suggestions) { + error << "* " << suggestion << '\n'; + } + throw InvalidInputException(error.str()); + } + return column_list.GetColumn(LogicalIndex(0)).Type(); +} + +// This has to be called with a level of indirection (through "parse_function") in order to avoid being included in +// extensions that statically link the core DuckDB library. +static LogicalType ParseLogicalTypeInternal(const string &type_str, ClientContext &context) { + auto type = TransformStringToUnboundType(type_str); + if (type.IsUnbound()) { + if (!context.transaction.HasActiveTransaction()) { + throw InternalException( + "Context does not have a transaction active, try running ClientContext::BindLogicalType instead"); + } + auto binder = Binder::CreateBinder(context, nullptr); + binder->BindLogicalType(type); + } + return type; +} + +LogicalType TypeManager::ParseLogicalType(const string &type_str, ClientContext &context) const { + return parse_function(type_str, context); +} + +TypeManager &TypeManager::Get(DatabaseInstance &db) { + return DBConfig::GetConfig(db).GetTypeManager(); +} + +TypeManager &TypeManager::Get(ClientContext &context) { + return DBConfig::GetConfig(context).GetTypeManager(); +} + +TypeManager::TypeManager(DBConfig &config_p) { + cast_functions = make_uniq(config_p); + parse_function = ParseLogicalTypeInternal; +} + +TypeManager::~TypeManager() { +} + +} // namespace duckdb diff --git a/src/duckdb/src/common/types/value.cpp b/src/duckdb/src/common/types/value.cpp index acedfe835..0ec8310d3 100644 --- a/src/duckdb/src/common/types/value.cpp +++ b/src/duckdb/src/common/types/value.cpp @@ -26,8 +26,12 @@ #include "duckdb/common/types/bignum.hpp" #include "duckdb/common/serializer/serializer.hpp" #include "duckdb/common/serializer/deserializer.hpp" +#include "duckdb/common/serializer/binary_serializer.hpp" +#include "duckdb/common/serializer/binary_deserializer.hpp" +#include "duckdb/common/serializer/memory_stream.hpp" #include "duckdb/common/types/string.hpp" #include "duckdb/common/types/value_map.hpp" +#include "duckdb/function/scalar/variant_utils.hpp" #include #include @@ -935,6 +939,25 @@ Value Value::GEOMETRY(const_data_ptr_t data, idx_t len) { return result; } +Value Value::TYPE(const LogicalType &type) { + MemoryStream stream; + BinarySerializer::Serialize(type, stream); + auto data_ptr = const_char_ptr_cast(stream.GetData()); + auto data_len = stream.GetPosition(); + + Value result(LogicalType::TYPE()); + result.is_null = false; + result.value_info_ = make_shared_ptr(string(data_ptr, data_len)); + return result; +} + +Value Value::TYPE(const string_t &serialized_type) { + Value result(LogicalType::TYPE()); + result.is_null = false; + result.value_info_ = make_shared_ptr(serialized_type.GetString()); + return result; +} + Value Value::BLOB(const string &data) { Value result(LogicalType::BLOB); result.is_null = false; @@ -1645,7 +1668,17 @@ string Value::ToSQLString() const { } return "'" + StringUtil::Replace(ToString(), "'", "''") + "'"; } - case LogicalTypeId::VARIANT: + case LogicalTypeId::VARIANT: { + string ret = "VARIANT("; + Vector tmp(*this); + RecursiveUnifiedVectorFormat format; + Vector::RecursiveToUnifiedFormat(tmp, 1, format); + UnifiedVariantVectorData vector_data(format); + auto val = VariantUtils::ConvertVariantToValue(vector_data, 0, 0); + ret += val.ToString(); + ret += ")"; + return ret; + } case LogicalTypeId::STRUCT: { bool is_unnamed = StructType::IsUnnamed(type_); string ret = is_unnamed ? "(" : "{"; @@ -1786,6 +1819,19 @@ const string &StringValue::Get(const Value &value) { return value.value_info_->Get().GetString(); } +LogicalType TypeValue::GetType(const Value &value) { + if (value.is_null) { + throw InternalException("Calling TypeValue::GetType on a NULL value"); + } + D_ASSERT(value.type().id() == LogicalTypeId::TYPE); + D_ASSERT(value.value_info_); + auto &type_str = value.value_info_->Get().GetString(); + auto str = string_t(type_str); + MemoryStream stream(data_ptr_cast(str.GetDataWriteable()), str.GetSize()); + BinaryDeserializer deserializer(stream); + return LogicalType::Deserialize(deserializer); +} + date_t DateValue::Get(const Value &value) { return value.GetValueUnsafe(); } @@ -2034,7 +2080,7 @@ void Value::Reinterpret(LogicalType new_type) { this->type_ = std::move(new_type); } -const LogicalType &GetChildType(const LogicalType &parent_type, idx_t i) { +static const LogicalType &GetChildType(const LogicalType &parent_type, idx_t i) { switch (parent_type.InternalType()) { case PhysicalType::LIST: return ListType::GetChildType(parent_type); @@ -2047,7 +2093,7 @@ const LogicalType &GetChildType(const LogicalType &parent_type, idx_t i) { } } -bool SerializeTypeMatches(const LogicalType &expected_type, const LogicalType &actual_type) { +static bool SerializeTypeMatches(const LogicalType &expected_type, const LogicalType &actual_type) { if (expected_type.id() != actual_type.id()) { // type id needs to be the same return false; @@ -2087,6 +2133,14 @@ void Value::SerializeInternal(Serializer &serializer, bool serialize_type) const if (IsNull()) { return; } + + if (type_.id() == LogicalTypeId::TYPE) { + // special case for TYPE values: serialize the type as a nested object + auto type_value = TypeValue::GetType(*this); + serializer.WriteProperty(102, "value", type_value); + return; + } + switch (type_.InternalType()) { case PhysicalType::BIT: throw InternalException("BIT type should not be serialized"); @@ -2170,6 +2224,13 @@ Value Value::Deserialize(Deserializer &deserializer) { return new_value; } new_value.is_null = false; + + if (type.id() == LogicalTypeId::TYPE) { + // special case for TYPE values: deserialize the type as a nested object + auto type_value = deserializer.ReadProperty(102, "value"); + return Value::TYPE(type_value); + } + switch (type.InternalType()) { case PhysicalType::BIT: throw InternalException("BIT type should not be deserialized"); diff --git a/src/duckdb/src/common/types/vector.cpp b/src/duckdb/src/common/types/vector.cpp index 5ae9d0643..8caaa55b8 100644 --- a/src/duckdb/src/common/types/vector.cpp +++ b/src/duckdb/src/common/types/vector.cpp @@ -804,6 +804,10 @@ Value Vector::GetValueInternal(const Vector &v_p, idx_t index_p) { } return Value::ARRAY(ArrayType::GetChildType(type), std::move(children)); } + case LogicalTypeId::TYPE: { + auto blob = reinterpret_cast(data)[index]; + return Value::TYPE(blob); + } default: throw InternalException("Unimplemented type for value access"); } diff --git a/src/duckdb/src/common/vector_operations/is_distinct_from.cpp b/src/duckdb/src/common/vector_operations/is_distinct_from.cpp index d08a2d276..538f5f394 100644 --- a/src/duckdb/src/common/vector_operations/is_distinct_from.cpp +++ b/src/duckdb/src/common/vector_operations/is_distinct_from.cpp @@ -1,6 +1,8 @@ #include "duckdb/common/uhugeint.hpp" #include "duckdb/common/vector_operations/vector_operations.hpp" #include "duckdb/common/operator/comparison_operators.hpp" +#include "duckdb/common/value_operations/value_operations.hpp" +#include "duckdb/function/scalar/variant_utils.hpp" namespace duckdb { @@ -862,6 +864,101 @@ idx_t DistinctSelectArray(Vector &left, Vector &right, idx_t count, const Select return match_count; } +template +idx_t DistinctSelectVariant(Vector &left, Vector &right, idx_t count, const SelectionVector &sel, + OptionalSelection &true_opt, OptionalSelection &false_opt, + optional_ptr null_mask) { + idx_t true_count = 0; + idx_t false_count = 0; + + // Convert vectors to unified format for easier access + RecursiveUnifiedVectorFormat left_recursive_data, right_recursive_data; + Vector::RecursiveToUnifiedFormat(left, count, left_recursive_data); + Vector::RecursiveToUnifiedFormat(right, count, right_recursive_data); + + UnifiedVariantVectorData left_variant(left_recursive_data); + UnifiedVariantVectorData right_variant(right_recursive_data); + + auto &left_data = left_recursive_data.unified; + auto &right_data = right_recursive_data.unified; + for (idx_t i = 0; i < count; i++) { + auto result_idx = sel.get_index(i); + auto left_idx = left_data.sel->get_index(i); + auto right_idx = right_data.sel->get_index(i); + + // Check for NULL values + bool left_null = !left_data.validity.RowIsValid(left_idx); + bool right_null = !right_data.validity.RowIsValid(right_idx); + + bool comparison_result; + if (left_null || right_null) { + // Handle NULL semantics based on operation type + if (std::is_same::value) { + comparison_result = !(left_null && right_null); + } else if (std::is_same::value) { + comparison_result = (left_null && right_null); + } else { + // For ordering operations, NULLs are treated as maximal + if (left_null && right_null) { + comparison_result = false; // NULL == NULL for ordering + } else if (left_null) { + // NULL > anything, so left_null means left is greater + comparison_result = std::is_same::value || + std::is_same::value; + } else { + // right_null, so right is greater + comparison_result = std::is_same::value || + std::is_same::value; + } + } + } else { + // Both non-NULL, convert to Values and use appropriate Value operation + auto left_val = VariantUtils::ConvertVariantToValue(left_variant, i, 0); + auto right_val = VariantUtils::ConvertVariantToValue(right_variant, i, 0); + + LogicalType max_logical_type; + auto res = LogicalType::TryGetMaxLogicalTypeUnchecked(left_val.type(), right_val.type(), max_logical_type); + if (!res) { + throw InvalidInputException( + "Can't compare values of type %s (%s) and type %s (%s) - an explicit cast is required", + left_val.type().ToString(), left_val.ToString(), right_val.type().ToString(), right_val.ToString()); + } + + if (std::is_same::value) { + comparison_result = ValueOperations::DistinctFrom(left_val, right_val); + } else if (std::is_same::value) { + comparison_result = ValueOperations::NotDistinctFrom(left_val, right_val); + } else if (std::is_same::value) { + comparison_result = ValueOperations::DistinctGreaterThan(left_val, right_val); + } else if (std::is_same::value) { + comparison_result = ValueOperations::DistinctGreaterThanEquals(left_val, right_val); + } else if (std::is_same::value) { + comparison_result = ValueOperations::DistinctLessThan(left_val, right_val); + } else if (std::is_same::value) { + comparison_result = ValueOperations::DistinctLessThanEquals(left_val, right_val); + } else { + throw InternalException("Unsupported operation for VARIANT comparison"); + } + } + + if (comparison_result) { + true_opt.Append(true_count, result_idx); + } else { + false_opt.Append(false_count, result_idx); + } + + // Set null mask if needed + if (null_mask && (left_null || right_null)) { + null_mask->SetInvalid(result_idx); + } + } + + true_opt.Advance(true_count); + false_opt.Advance(false_count); + + return true_count; +} + template idx_t DistinctSelectNested(Vector &left, Vector &right, optional_ptr sel, const idx_t count, optional_ptr true_sel, optional_ptr false_sel, @@ -899,10 +996,16 @@ idx_t DistinctSelectNested(Vector &left, Vector &right, optional_ptr(l_not_null, r_not_null, unknown, maybe_vec, true_opt, false_opt, null_mask); break; - case PhysicalType::STRUCT: + case PhysicalType::STRUCT: { + if (left_type.id() == LogicalTypeId::VARIANT) { + match_count += + DistinctSelectVariant(l_not_null, r_not_null, unknown, *sel, true_opt, false_opt, null_mask); + break; + } match_count += DistinctSelectStruct(l_not_null, r_not_null, unknown, maybe_vec, true_opt, false_opt, null_mask); break; + } case PhysicalType::ARRAY: match_count += DistinctSelectArray(l_not_null, r_not_null, unknown, maybe_vec, true_opt, false_opt, null_mask); diff --git a/src/duckdb/src/common/virtual_file_system.cpp b/src/duckdb/src/common/virtual_file_system.cpp index 777d1e353..0746f9a24 100644 --- a/src/duckdb/src/common/virtual_file_system.cpp +++ b/src/duckdb/src/common/virtual_file_system.cpp @@ -6,6 +6,7 @@ #include "duckdb/common/string_util.hpp" #include "duckdb/main/client_context.hpp" #include "duckdb/storage/caching_file_system_wrapper.hpp" +#include "duckdb/common/multi_file/multi_file_list.hpp" namespace duckdb { @@ -266,8 +267,9 @@ string VirtualFileSystem::PathSeparator(const string &path) { return FindFileSystem(path, nullptr).PathSeparator(path); } -vector VirtualFileSystem::Glob(const string &path, FileOpener *opener) { - return FindFileSystem(path, opener).Glob(path, opener); +unique_ptr VirtualFileSystem::GlobFilesExtended(const string &path, const FileGlobInput &input, + optional_ptr opener) { + return FindFileSystem(path, opener).Glob(path, input, opener); } void VirtualFileSystem::RegisterSubSystem(unique_ptr fs) { @@ -282,6 +284,13 @@ void VirtualFileSystem::RegisterSubSystem(FileCompressionType compression_type, file_system_registry.atomic_store(new_registry); } +void VirtualFileSystem::UnregisterSubSystem(const string &name) { + auto sub_system = ExtractSubSystem(name); + + lock_guard guard(registry_lock); + unregistered_file_systems.push_back(std::move(sub_system)); +} + void VirtualFileSystem::SetDisabledFileSystems(const vector &names) { lock_guard guard(registry_lock); auto new_registry = file_system_registry->SetDisabledFileSystems(names); diff --git a/src/duckdb/src/execution/aggregate_hashtable.cpp b/src/duckdb/src/execution/aggregate_hashtable.cpp index 2629b6ad3..2518c37c7 100644 --- a/src/duckdb/src/execution/aggregate_hashtable.cpp +++ b/src/duckdb/src/execution/aggregate_hashtable.cpp @@ -895,9 +895,7 @@ void GroupedAggregateHashTable::Combine(TupleDataCollection &other_data, optiona const auto chunk_count = other_data.ChunkCount(); while (fm_state.Scan()) { // Check for interrupts with each chunk - if (context.interrupted.load(std::memory_order_relaxed)) { - throw InterruptException(); - } + context.InterruptCheck(); const auto input_chunk_size = fm_state.groups.size(); FindOrCreateGroups(fm_state.groups, fm_state.hashes, fm_state.group_addresses, fm_state.new_groups_sel); RowOperations::CombineStates(state.row_state, *layout_ptr, fm_state.scan_state.chunk_state.row_locations, diff --git a/src/duckdb/src/execution/column_binding_resolver.cpp b/src/duckdb/src/execution/column_binding_resolver.cpp index 8c8af7873..ebf10dc4c 100644 --- a/src/duckdb/src/execution/column_binding_resolver.cpp +++ b/src/duckdb/src/execution/column_binding_resolver.cpp @@ -19,39 +19,48 @@ void ColumnBindingResolver::VisitOperator(LogicalOperator &op) { switch (op.type) { case LogicalOperatorType::LOGICAL_ASOF_JOIN: case LogicalOperatorType::LOGICAL_COMPARISON_JOIN: { - // special case: comparison join auto &comp_join = op.Cast(); - // first get the bindings of the LHS and resolve the LHS expressions + VisitOperator(*comp_join.children[0]); + auto left_bindings = bindings; + auto left_types = types; for (auto &cond : comp_join.conditions) { - VisitExpression(&cond.left); + if (cond.IsComparison()) { + VisitExpression(&cond.LeftReference()); + } } - // visit the duplicate eliminated columns on the LHS, if any + for (auto &expr : comp_join.duplicate_eliminated_columns) { VisitExpression(&expr); } - // then get the bindings of the RHS and resolve the RHS expressions + VisitOperator(*comp_join.children[1]); + auto right_bindings = bindings; + auto right_types = types; for (auto &cond : comp_join.conditions) { - VisitExpression(&cond.right); + if (cond.IsComparison()) { + VisitExpression(&cond.RightReference()); + } } - // finally update the bindings with the result bindings of the join - bindings = op.GetColumnBindings(); - types = op.types; - // resolve any mixed predicates - // for now, only ASOF supports this. - if (comp_join.predicate) { - D_ASSERT(op.type == LogicalOperatorType::LOGICAL_ASOF_JOIN); - // If this is a SEMI or ANTI join and we have an arbitrary predicate, - // we need to include the bindings of the RHS - if (comp_join.join_type == JoinType::SEMI || comp_join.join_type == JoinType::ANTI) { - auto right_bindings = op.children[1]->GetColumnBindings(); - bindings.insert(bindings.end(), right_bindings.begin(), right_bindings.end()); - auto &right_types = op.children[1]->types; - types.insert(types.end(), right_types.begin(), right_types.end()); + + // combine bindings to resolve predicate + auto combined_bindings = left_bindings; + combined_bindings.insert(combined_bindings.end(), right_bindings.begin(), right_bindings.end()); + auto combined_types = left_types; + combined_types.insert(combined_types.end(), right_types.begin(), right_types.end()); + + bindings = combined_bindings; + types = combined_types; + for (auto &cond : comp_join.conditions) { + if (!cond.IsComparison()) { + VisitExpression(&cond.JoinExpressionReference()); } - VisitExpression(&comp_join.predicate); } + + // update to join output bindings + bindings = op.GetColumnBindings(); + types = op.types; + return; } case LogicalOperatorType::LOGICAL_DELIM_JOIN: { @@ -60,7 +69,7 @@ void ColumnBindingResolver::VisitOperator(LogicalOperator &op) { auto &delim_side = comp_join.delim_flipped ? *comp_join.children[1] : *comp_join.children[0]; VisitOperator(delim_side); for (auto &cond : comp_join.conditions) { - auto &expr = comp_join.delim_flipped ? cond.right : cond.left; + auto &expr = comp_join.delim_flipped ? cond.RightReference() : cond.LeftReference(); VisitExpression(&expr); } // visit the duplicate eliminated columns @@ -71,7 +80,7 @@ void ColumnBindingResolver::VisitOperator(LogicalOperator &op) { auto &other_side = comp_join.delim_flipped ? *comp_join.children[0] : *comp_join.children[1]; VisitOperator(other_side); for (auto &cond : comp_join.conditions) { - auto &expr = comp_join.delim_flipped ? cond.left : cond.right; + auto &expr = comp_join.delim_flipped ? cond.LeftReference() : cond.RightReference(); VisitExpression(&expr); } // finally update the bindings with the result bindings of the join diff --git a/src/duckdb/src/execution/expression_executor/execute_function.cpp b/src/duckdb/src/execution/expression_executor/execute_function.cpp index d3610dae2..4b3272edd 100644 --- a/src/duckdb/src/execution/expression_executor/execute_function.cpp +++ b/src/duckdb/src/execution/expression_executor/execute_function.cpp @@ -116,6 +116,16 @@ bool ExecuteFunctionState::TryExecuteDictionaryExpression(const BoundFunctionExp return true; } +void ExecuteFunctionState::ResetDictionaryStates() { + // Clear the cached dictionary information + current_input_dictionary_id.clear(); + output_dictionary.reset(); + + for (const auto &child_state : child_states) { + child_state->ResetDictionaryStates(); + } +} + unique_ptr ExpressionExecutor::InitializeState(const BoundFunctionExpression &expr, ExpressionExecutorState &root) { auto result = make_uniq(expr, root); diff --git a/src/duckdb/src/execution/expression_executor/execute_operator.cpp b/src/duckdb/src/execution/expression_executor/execute_operator.cpp index 527178d36..8d3cfee46 100644 --- a/src/duckdb/src/execution/expression_executor/execute_operator.cpp +++ b/src/duckdb/src/execution/expression_executor/execute_operator.cpp @@ -133,12 +133,19 @@ void ExpressionExecutor::Execute(const BoundOperatorExpression &expr, Expression throw; } } + + // On error, evaluate per row SelectionVector selvec(1); DataChunk intermediate; intermediate.Initialize(GetAllocator(), {result.GetType()}, 1); for (idx_t i = 0; i < count; i++) { intermediate.Reset(); intermediate.SetCardinality(1); + + // Make sure to clear any dictionary states in the child expression, so that it actually + // gets executed anew for every row + child_state.ResetDictionaryStates(); + selvec.set_index(0, sel ? sel->get_index(i) : i); Value val(result.GetType()); try { diff --git a/src/duckdb/src/execution/expression_executor_state.cpp b/src/duckdb/src/execution/expression_executor_state.cpp index 070a399db..fcac6065b 100644 --- a/src/duckdb/src/execution/expression_executor_state.cpp +++ b/src/duckdb/src/execution/expression_executor_state.cpp @@ -52,6 +52,12 @@ void ExpressionState::Verify(ExpressionExecutorState &root_executor) { } } +void ExpressionState::ResetDictionaryStates() { + for (const auto &child : child_states) { + child->ResetDictionaryStates(); + } +} + void ExpressionExecutorState::Verify() { D_ASSERT(executor); root_state->Verify(*this); diff --git a/src/duckdb/src/execution/index/art/art.cpp b/src/duckdb/src/execution/index/art/art.cpp index 3387116e2..2e4e49f87 100644 --- a/src/duckdb/src/execution/index/art/art.cpp +++ b/src/duckdb/src/execution/index/art/art.cpp @@ -1009,9 +1009,6 @@ void ART::Deserialize(const BlockPointer &pointer) { } void ART::SetPrefixCount(const IndexStorageInfo &info) { - auto numeric_max = NumericLimits().Maximum(); - auto max_aligned = AlignValueFloor(numeric_max - Prefix::METADATA_SIZE); - if (info.IsValid() && info.root_block_ptr.IsValid()) { prefix_count = Prefix::DEPRECATED_COUNT; return; @@ -1028,13 +1025,18 @@ void ART::SetPrefixCount(const IndexStorageInfo &info) { compound_size += GetTypeIdSize(type); } - auto aligned = AlignValue(compound_size) - 1; - if (aligned > NumericCast(max_aligned)) { - prefix_count = max_aligned; - return; - } + // Get the maximum possible prefix size. + // Minus one to index the prefix count (last byte). + auto numeric_max = NumericLimits().Maximum(); + uint8_t max_aligned = AlignValueFloor(numeric_max - Prefix::METADATA_SIZE) - 1; + + // Ceiling of compound size, + // minus one to index the prefix count (last byte). + idx_t key_aligned = AlignValue(compound_size) - 1; - prefix_count = NumericCast(aligned); + // Set the prefix size to the maximum of the (compound) key size and the maximum prefix size. + bool exceeds_max = key_aligned > NumericCast(max_aligned); + prefix_count = exceeds_max ? max_aligned : NumericCast(key_aligned); } idx_t ART::GetInMemorySize(IndexLock &index_lock) { diff --git a/src/duckdb/src/execution/join_hashtable.cpp b/src/duckdb/src/execution/join_hashtable.cpp index d37ec7c84..8ed8fd6e8 100644 --- a/src/duckdb/src/execution/join_hashtable.cpp +++ b/src/duckdb/src/execution/join_hashtable.cpp @@ -1,13 +1,16 @@ #include "duckdb/execution/join_hashtable.hpp" +#include "duckdb/common/enums/join_type.hpp" #include "duckdb/common/exception.hpp" #include "duckdb/common/radix_partitioning.hpp" #include "duckdb/common/vector_operations/vector_operations.hpp" #include "duckdb/execution/ht_entry.hpp" +#include "duckdb/logging/log_manager.hpp" +#include "duckdb/execution/expression_executor.hpp" +#include "duckdb/execution/operator/join/physical_hash_join.hpp" #include "duckdb/main/client_context.hpp" -#include "duckdb/storage/buffer_manager.hpp" #include "duckdb/main/settings.hpp" -#include "duckdb/logging/log_manager.hpp" +#include "duckdb/storage/buffer_manager.hpp" namespace duckdb { @@ -34,32 +37,38 @@ JoinHashTable::InsertState::InsertState(const JoinHashTable &ht) JoinHashTable::JoinHashTable(ClientContext &context_p, const PhysicalOperator &op_p, const vector &conditions_p, vector btypes, JoinType type_p, - const vector &output_columns_p) + const vector &output_columns_p, unique_ptr residual_p, + optional_ptr predicate_ptr, const vector &output_in_probe) : context(context_p), op(op_p), buffer_manager(BufferManager::GetBufferManager(context)), conditions(conditions_p), build_types(std::move(btypes)), output_columns(output_columns_p), entry_size(0), tuple_size(0), vfound(Value::BOOLEAN(false)), join_type(type_p), finalized(false), has_null(false), - radix_bits(INITIAL_RADIX_BITS) { + residual_predicate(predicate_ptr), radix_bits(INITIAL_RADIX_BITS) { + // store residual predicate information + residual_info = std::move(residual_p); + lhs_output_in_probe = output_in_probe; + for (idx_t i = 0; i < conditions.size(); ++i) { auto &condition = conditions[i]; - D_ASSERT(condition.left->return_type == condition.right->return_type); - auto type = condition.left->return_type; - if (condition.comparison == ExpressionType::COMPARE_EQUAL || - condition.comparison == ExpressionType::COMPARE_NOT_DISTINCT_FROM) { + D_ASSERT(condition.IsComparison()); + D_ASSERT(condition.GetLHS().return_type == condition.GetRHS().return_type); + auto type = condition.GetLHS().return_type; + if (condition.GetComparisonType() == ExpressionType::COMPARE_EQUAL || + condition.GetComparisonType() == ExpressionType::COMPARE_NOT_DISTINCT_FROM) { // ensure that all equality conditions are at the front, // and that all other conditions are at the back D_ASSERT(equality_types.size() == condition_types.size()); equality_types.push_back(type); - equality_predicates.push_back(condition.comparison); + equality_predicates.push_back(condition.GetComparisonType()); equality_predicate_columns.push_back(i); } else { // all non-equality conditions are at the back - non_equality_predicates.push_back(condition.comparison); + non_equality_predicates.push_back(condition.GetComparisonType()); non_equality_predicate_columns.push_back(i); } - null_values_are_equal.push_back(condition.comparison == ExpressionType::COMPARE_DISTINCT_FROM || - condition.comparison == ExpressionType::COMPARE_NOT_DISTINCT_FROM); + null_values_are_equal.push_back(condition.GetComparisonType() == ExpressionType::COMPARE_DISTINCT_FROM || + condition.GetComparisonType() == ExpressionType::COMPARE_NOT_DISTINCT_FROM); condition_types.push_back(type); } @@ -844,37 +853,77 @@ ScanStructure::ScanStructure(JoinHashTable &ht_p, TupleDataChunkState &key_state found_match(make_unsafe_uniq_array_uninitialized(STANDARD_VECTOR_SIZE)), ht(ht_p), finished(false), is_null(true), rhs_pointers(LogicalType::POINTER), lhs_sel_vector(STANDARD_VECTOR_SIZE), last_match_count(0), last_sel_vector(STANDARD_VECTOR_SIZE) { + if (ht.residual_predicate) { + residual_executor = make_uniq(ht.context); + residual_executor->AddExpression(*ht.residual_predicate); + + // initialize residual state + residual_state = make_uniq(); + + // determine column types needed + idx_t total_columns = 0; + for (const auto &entry : ht.residual_info->probe_input_to_probe_map) { + total_columns = MaxValue(total_columns, entry.first + 1); + } + for (const auto &entry : ht.residual_info->build_input_to_layout_map) { + total_columns = MaxValue(total_columns, entry.first + 1); + } + + vector eval_types(total_columns, LogicalType::INVALID); + vector initialize_columns(total_columns, false); + + // fill in probe types + for (const auto &entry : ht.residual_info->probe_input_to_probe_map) { + idx_t orig_idx = entry.first; + idx_t probe_data_col = entry.second; + eval_types[orig_idx] = ht.residual_info->probe_types[probe_data_col]; + initialize_columns[orig_idx] = true; + } + + // fill in build types + for (const auto &entry : ht.residual_info->build_input_to_layout_map) { + idx_t col_with_offset = entry.first; + idx_t layout_col = entry.second; + eval_types[col_with_offset] = ht.layout_ptr->GetTypes()[layout_col]; + initialize_columns[col_with_offset] = true; + } + + // initialize chunks ONCE + residual_state->Initialize(Allocator::Get(ht.context), eval_types, initialize_columns); + } } -void ScanStructure::Next(DataChunk &keys, DataChunk &left, DataChunk &result) { - D_ASSERT(keys.size() == left.size()); +void ScanStructure::Next(DataChunk &keys, DataChunk &probe_data, DataChunk &result) { + D_ASSERT(keys.size() == probe_data.size()); + if (finished) { return; } + switch (ht.join_type) { case JoinType::INNER: case JoinType::RIGHT: - NextInnerJoin(keys, left, result); + NextInnerJoin(keys, probe_data, result); break; case JoinType::SEMI: - NextSemiJoin(keys, left, result); + NextSemiJoin(keys, probe_data, result); break; case JoinType::MARK: - NextMarkJoin(keys, left, result); + NextMarkJoin(keys, probe_data, result); break; case JoinType::ANTI: - NextAntiJoin(keys, left, result); + NextAntiJoin(keys, probe_data, result); break; case JoinType::RIGHT_ANTI: case JoinType::RIGHT_SEMI: - NextRightSemiOrAntiJoin(keys); + NextRightSemiOrAntiJoin(keys, probe_data); break; case JoinType::OUTER: case JoinType::LEFT: - NextLeftJoin(keys, left, result); + NextLeftJoin(keys, probe_data, result); break; case JoinType::SINGLE: - NextSingleJoin(keys, left, result); + NextSingleJoin(keys, probe_data, result); break; default: throw InternalException("Unhandled join type in JoinHashTable"); @@ -884,11 +933,12 @@ void ScanStructure::Next(DataChunk &keys, DataChunk &left, DataChunk &result) { bool ScanStructure::PointersExhausted() const { // AdvancePointers creates a "new_count" for every pointer advanced during the // previous advance pointers call. If no pointers are advanced, new_count = 0. - // count is then set ot new_count. + // count is then set to new_count. return count == 0; } -idx_t ScanStructure::ResolvePredicates(DataChunk &keys, SelectionVector &match_sel, SelectionVector *no_match_sel) { +idx_t ScanStructure::ResolvePredicates(DataChunk &keys, DataChunk &probe_data, SelectionVector &match_sel, + SelectionVector *no_match_sel) { // Initialize the found_match array to the current sel_vector for (idx_t i = 0; i < this->count; ++i) { match_sel.set_index(i, this->sel_vector.get_index(i)); @@ -910,16 +960,67 @@ idx_t ScanStructure::ResolvePredicates(DataChunk &keys, SelectionVector &match_s result_count = this->count; } + if (ht.residual_predicate && ht.residual_info && result_count > 0) { + result_count = ApplyResidualPredicate(probe_data, match_sel, result_count, no_match_sel); + } + // Update total probe match count ht.total_probe_matches.fetch_add(result_count, std::memory_order_relaxed); return result_count; } -idx_t ScanStructure::ScanInnerJoin(DataChunk &keys, SelectionVector &result_vector) { +idx_t ScanStructure::ApplyResidualPredicate(DataChunk &probe_data, SelectionVector &match_sel, idx_t match_count, + SelectionVector *no_match_sel) { + D_ASSERT(residual_state); + D_ASSERT(residual_executor); + + // reset chunks for reuse (no reallocation!) + residual_state->eval_chunk.Reset(); + residual_state->eval_chunk.SetCardinality(match_count); + + // copy probe columns at their ORIGINAL positions + for (const auto &entry : ht.residual_info->probe_input_to_probe_map) { + idx_t orig_idx = entry.first; + idx_t probe_data_col = entry.second; + residual_state->eval_chunk.data[orig_idx].Slice(probe_data.data[probe_data_col], match_sel, match_count); + } + + // gather RHS columns from hash table + // TODO: these columns are gathered again when building the final result + for (const auto &entry : ht.residual_info->build_input_to_layout_map) { + idx_t col_with_offset = entry.first; + idx_t layout_col = entry.second; + auto &target_vector = residual_state->eval_chunk.data[col_with_offset]; + GatherResult(target_vector, match_sel, match_count, layout_col); + } + + SelectionVector &selected_sel = residual_state->selected_sel; + SelectionVector &remaining_sel = residual_state->remaining_sel; + + idx_t new_match_count = residual_executor->SelectExpression(residual_state->eval_chunk, selected_sel, remaining_sel, + nullptr, match_count); + + for (idx_t i = 0; i < new_match_count; i++) { + idx_t dense_idx = selected_sel.get_index(i); + match_sel.set_index(i, match_sel.get_index(dense_idx)); + } + + if (no_match_sel) { + idx_t no_match_count = match_count - new_match_count; + for (idx_t i = 0; i < no_match_count; i++) { + idx_t dense_idx = remaining_sel.get_index(i); + no_match_sel->set_index(i, match_sel.get_index(dense_idx)); + } + } + + return new_match_count; +} + +idx_t ScanStructure::ScanInnerJoin(DataChunk &keys, DataChunk &probe_data, SelectionVector &result_vector) { while (true) { // resolve the equality_predicates for this set of keys - idx_t result_count = ResolvePredicates(keys, result_vector, nullptr); + idx_t result_count = ResolvePredicates(keys, probe_data, result_vector, nullptr); // after doing all the comparisons set the found_match vector if (found_match) { @@ -989,9 +1090,9 @@ void ScanStructure::UpdateCompactionBuffer(idx_t base_count, SelectionVector &re VectorOperations::Copy(pointers, rhs_pointers, result_vector, result_count, 0, base_count); } -void ScanStructure::NextInnerJoin(DataChunk &keys, DataChunk &left, DataChunk &result) { +void ScanStructure::NextInnerJoin(DataChunk &keys, DataChunk &probe_data, DataChunk &result) { if (ht.join_type != JoinType::RIGHT_SEMI && ht.join_type != JoinType::RIGHT_ANTI) { - D_ASSERT(result.ColumnCount() == left.ColumnCount() + ht.output_columns.size()); + D_ASSERT(result.ColumnCount() == ht.lhs_output_in_probe.size() + ht.output_columns.size()); } idx_t base_count = 0; @@ -999,7 +1100,7 @@ void ScanStructure::NextInnerJoin(DataChunk &keys, DataChunk &left, DataChunk &r while (this->count > 0) { // if we have saved the match result, we need not call ScanInnerJoin again if (last_match_count == 0) { - result_count = ScanInnerJoin(keys, chain_match_sel_vector); + result_count = ScanInnerJoin(keys, probe_data, chain_match_sel_vector); } else { chain_match_sel_vector.Initialize(last_sel_vector); result_count = last_match_count; @@ -1027,15 +1128,18 @@ void ScanStructure::NextInnerJoin(DataChunk &keys, DataChunk &left, DataChunk &r } if (ht.join_type != JoinType::RIGHT_SEMI && ht.join_type != JoinType::RIGHT_ANTI) { - // Fast Path: if there is NO more than one element in the chain, we construct the result chunk directly + // fast path: no chains longer than one if (!ht.chains_longer_than_one) { - // matches were found - // on the LHS, we create a slice using the result vector - result.Slice(left, chain_match_sel_vector, result_count); + // extract only OUTPUT columns from probe_data + for (idx_t i = 0; i < ht.lhs_output_in_probe.size(); i++) { + idx_t probe_col_idx = ht.lhs_output_in_probe[i]; + result.data[i].Slice(probe_data.data[probe_col_idx], chain_match_sel_vector, result_count); + } + result.SetCardinality(result_count); // on the RHS, we need to fetch the data from the hash table for (idx_t i = 0; i < ht.output_columns.size(); i++) { - auto &vector = result.data[left.ColumnCount() + i]; + auto &vector = result.data[ht.lhs_output_in_probe.size() + i]; const auto output_col_idx = ht.output_columns[i]; D_ASSERT(vector.GetType() == ht.layout_ptr->GetTypes()[output_col_idx]); GatherResult(vector, chain_match_sel_vector, result_count, output_col_idx); @@ -1054,13 +1158,16 @@ void ScanStructure::NextInnerJoin(DataChunk &keys, DataChunk &left, DataChunk &r } if (base_count > 0) { - // create result chunk, we have two steps: - // 1) slice LHS vectors - result.Slice(left, lhs_sel_vector, base_count); + // extract only OUTPUT columns from probe_data using compaction buffer + for (idx_t i = 0; i < ht.lhs_output_in_probe.size(); i++) { + idx_t probe_col_idx = ht.lhs_output_in_probe[i]; + result.data[i].Slice(probe_data.data[probe_col_idx], lhs_sel_vector, base_count); + } + result.SetCardinality(base_count); // 2) gather RHS vectors for (idx_t i = 0; i < ht.output_columns.size(); i++) { - auto &vector = result.data[left.ColumnCount() + i]; + auto &vector = result.data[ht.lhs_output_in_probe.size() + i]; const auto output_col_idx = ht.output_columns[i]; D_ASSERT(vector.GetType() == ht.layout_ptr->GetTypes()[output_col_idx]); GatherResult(vector, base_count, output_col_idx); @@ -1068,7 +1175,7 @@ void ScanStructure::NextInnerJoin(DataChunk &keys, DataChunk &left, DataChunk &r } } -void ScanStructure::ScanKeyMatches(DataChunk &keys) { +void ScanStructure::ScanKeyMatches(DataChunk &keys, DataChunk &probe_data) { // the semi-join, anti-join and mark-join we handle a differently from the inner join // since there can be at most STANDARD_VECTOR_SIZE results // we handle the entire chunk in one call to Next(). @@ -1078,7 +1185,7 @@ void ScanStructure::ScanKeyMatches(DataChunk &keys) { while (this->count > 0) { // resolve the equality_predicates for the current set of pointers - idx_t match_count = ResolvePredicates(keys, chain_match_sel_vector, &chain_no_match_sel_vector); + idx_t match_count = ResolvePredicates(keys, probe_data, chain_match_sel_vector, &chain_no_match_sel_vector); idx_t no_match_count = this->count - match_count; // mark each of the matches as found @@ -1091,8 +1198,9 @@ void ScanStructure::ScanKeyMatches(DataChunk &keys) { } template -void ScanStructure::NextSemiOrAntiJoin(DataChunk &keys, DataChunk &left, DataChunk &result) { - D_ASSERT(left.ColumnCount() == result.ColumnCount()); +void ScanStructure::NextSemiOrAntiJoin(DataChunk &keys, DataChunk &probe_data, DataChunk &result) { + D_ASSERT(ht.lhs_output_in_probe.size() == result.ColumnCount()); + // create the selection vector from the matches that were found SelectionVector sel(STANDARD_VECTOR_SIZE); idx_t result_count = 0; @@ -1104,57 +1212,76 @@ void ScanStructure::NextSemiOrAntiJoin(DataChunk &keys, DataChunk &left, DataChu } // construct the final result if (result_count > 0) { - // we only return the columns on the left side - // reference the columns of the left side from the result - result.Slice(left, sel, result_count); + // extract only OUTPUT columns from probe_data + for (idx_t i = 0; i < ht.lhs_output_in_probe.size(); i++) { + idx_t probe_col_idx = ht.lhs_output_in_probe[i]; + result.data[i].Slice(probe_data.data[probe_col_idx], sel, result_count); + } + result.SetCardinality(result_count); } else { D_ASSERT(result.size() == 0); } } -void ScanStructure::NextSemiJoin(DataChunk &keys, DataChunk &left, DataChunk &result) { +void ScanStructure::NextSemiJoin(DataChunk &keys, DataChunk &probe_data, DataChunk &result) { + D_ASSERT(probe_data.ColumnCount() == result.ColumnCount()); + // first scan for key matches - ScanKeyMatches(keys); + ScanKeyMatches(keys, probe_data); + // then construct the result from all tuples with a match - NextSemiOrAntiJoin(keys, left, result); + NextSemiOrAntiJoin(keys, probe_data, result); finished = true; } -void ScanStructure::NextAntiJoin(DataChunk &keys, DataChunk &left, DataChunk &result) { +void ScanStructure::NextAntiJoin(DataChunk &keys, DataChunk &probe_data, DataChunk &result) { + D_ASSERT(probe_data.ColumnCount() == result.ColumnCount()); + // first scan for key matches - ScanKeyMatches(keys); + ScanKeyMatches(keys, probe_data); + // then construct the result from all tuples that did not find a match - NextSemiOrAntiJoin(keys, left, result); + NextSemiOrAntiJoin(keys, probe_data, result); finished = true; } -void ScanStructure::NextRightSemiOrAntiJoin(DataChunk &keys) { +void ScanStructure::NextRightSemiOrAntiJoin(DataChunk &keys, DataChunk &probe_data) { const auto ptrs = FlatVector::GetData(pointers); while (!PointersExhausted()) { // resolve the equality_predicates for this set of keys - idx_t result_count = ResolvePredicates(keys, chain_match_sel_vector, nullptr); - - // for each match, fully follow the chain - for (idx_t i = 0; i < result_count; i++) { - const auto idx = chain_match_sel_vector.get_index(i); - auto &ptr = ptrs[idx]; - if (Load(ptr + ht.tuple_size)) { // Early out: chain has been fully marked as found before - ptr = ht.dead_end.get(); - continue; - } + idx_t result_count = ResolvePredicates(keys, probe_data, chain_match_sel_vector, nullptr); - // Fully mark chain as found - while (true) { - // NOTE: threadsan reports this as a data race because this can be set concurrently by separate threads - // Technically it is, but it does not matter, since the only value that can be written is "true" - Store(true, ptr + ht.tuple_size); - auto next_ptr = LoadPointer(ptr + ht.pointer_offset); - if (!next_ptr) { - break; + if (ht.non_equality_predicates.empty()) { + // we only have equality predicates - the match is found for the entire chain + for (idx_t i = 0; i < result_count; i++) { + const auto idx = chain_match_sel_vector.get_index(i); + auto &ptr = ptrs[idx]; + if (Load(ptr + ht.tuple_size)) { // Early out: chain has been fully marked as found before + ptr = ht.dead_end.get(); + continue; } - ptr = next_ptr; + + // Fully mark chain as found + while (true) { + // NOTE: threadsan reports this as a data race because this can be set concurrently by separate + // threads Technically it is, but it does not matter, since the only value that can be written is + // "true" + Store(true, ptr + ht.tuple_size); + auto next_ptr = LoadPointer(ptr + ht.pointer_offset); + if (!next_ptr) { + break; + } + ptr = next_ptr; + } + } + } else { + // we have non-equality predicates - we need to evaluate the join condition for every row + // for each match found in the current pass - mark the match as found + for (idx_t i = 0; i < result_count; i++) { + auto idx = chain_match_sel_vector.get_index(i); + Store(true, ptrs[idx] + ht.tuple_size); } } @@ -1165,14 +1292,17 @@ void ScanStructure::NextRightSemiOrAntiJoin(DataChunk &keys) { finished = true; } -void ScanStructure::ConstructMarkJoinResult(DataChunk &join_keys, DataChunk &child, DataChunk &result) { - // for the initial set of columns we just reference the left side - result.SetCardinality(child); - for (idx_t i = 0; i < child.ColumnCount(); i++) { - result.data[i].Reference(child.data[i]); +void ScanStructure::ConstructMarkJoinResult(DataChunk &join_keys, DataChunk &probe_data, DataChunk &result) { + // extract OUTPUT columns from probe_data + result.SetCardinality(probe_data.size()); + for (idx_t i = 0; i < ht.lhs_output_in_probe.size(); i++) { + idx_t probe_col_idx = ht.lhs_output_in_probe[i]; + result.data[i].Reference(probe_data.data[probe_col_idx]); } + auto &mark_vector = result.data.back(); mark_vector.SetVectorType(VectorType::FLAT_VECTOR); + // first we set the NULL values from the join keys // if there is any NULL in the keys, the result is NULL auto bool_result = FlatVector::GetData(mark_vector); @@ -1192,14 +1322,16 @@ void ScanStructure::ConstructMarkJoinResult(DataChunk &join_keys, DataChunk &chi } } } + // now set the remaining entries to either true or false based on whether a match was found D_ASSERT(found_match); - for (idx_t i = 0; i < child.size(); i++) { + for (idx_t i = 0; i < probe_data.size(); i++) { bool_result[i] = found_match[i]; } + // if the right side contains NULL values, the result of any FALSE becomes NULL if (ht.has_null) { - for (idx_t i = 0; i < child.size(); i++) { + for (idx_t i = 0; i < probe_data.size(); i++) { if (!bool_result[i]) { mask.SetInvalid(i); } @@ -1207,15 +1339,16 @@ void ScanStructure::ConstructMarkJoinResult(DataChunk &join_keys, DataChunk &chi } } -void ScanStructure::NextMarkJoin(DataChunk &keys, DataChunk &left, DataChunk &result) { - D_ASSERT(result.ColumnCount() == left.ColumnCount() + 1); +void ScanStructure::NextMarkJoin(DataChunk &keys, DataChunk &probe_data, DataChunk &result) { + D_ASSERT(result.ColumnCount() == ht.lhs_output_in_probe.size() + 1); D_ASSERT(result.data.back().GetType() == LogicalType::BOOLEAN); // this method should only be called for a non-empty HT D_ASSERT(ht.Count() > 0); - ScanKeyMatches(keys); + ScanKeyMatches(keys, probe_data); + if (ht.correlated_mark_join_info.correlated_types.empty()) { - ConstructMarkJoinResult(keys, left, result); + ConstructMarkJoinResult(keys, probe_data, result); } else { auto &info = ht.correlated_mark_join_info; lock_guard mj_lock(info.mj_lock); @@ -1229,31 +1362,35 @@ void ScanStructure::NextMarkJoin(DataChunk &keys, DataChunk &left, DataChunk &re } info.correlated_counts->FetchAggregates(info.group_chunk, info.result_chunk); - // for the initial set of columns we just reference the left side - result.SetCardinality(left); - for (idx_t i = 0; i < left.ColumnCount(); i++) { - result.data[i].Reference(left.data[i]); + // extract OUTPUT columns from probe_data + result.SetCardinality(probe_data.size()); + for (idx_t i = 0; i < ht.lhs_output_in_probe.size(); i++) { + idx_t probe_col_idx = ht.lhs_output_in_probe[i]; + result.data[i].Reference(probe_data.data[probe_col_idx]); } + // create the result matching vector auto &last_key = keys.data.back(); auto &result_vector = result.data.back(); - // first set the nullmask based on whether or not there were NULL values in the join key + // first set the null mask based on whether there were NULL values in the join key result_vector.SetVectorType(VectorType::FLAT_VECTOR); auto bool_result = FlatVector::GetData(result_vector); auto &mask = FlatVector::Validity(result_vector); + + // Set null mask based on NULL values in join key switch (last_key.GetVectorType()) { case VectorType::CONSTANT_VECTOR: if (ConstantVector::IsNull(last_key)) { - mask.SetAllInvalid(left.size()); + mask.SetAllInvalid(probe_data.size()); } break; case VectorType::FLAT_VECTOR: - mask.Copy(FlatVector::Validity(last_key), left.size()); + mask.Copy(FlatVector::Validity(last_key), probe_data.size()); break; default: { UnifiedVectorFormat kdata; last_key.ToUnifiedFormat(keys.size(), kdata); - for (idx_t i = 0; i < left.size(); i++) { + for (idx_t i = 0; i < probe_data.size(); i++) { auto kidx = kdata.sel->get_index(i); mask.Set(i, kdata.validity.RowIsValid(kidx)); } @@ -1263,8 +1400,9 @@ void ScanStructure::NextMarkJoin(DataChunk &keys, DataChunk &left, DataChunk &re auto count_star = FlatVector::GetData(info.result_chunk.data[0]); auto count = FlatVector::GetData(info.result_chunk.data[1]); + // set the entries to either true or false based on whether a match was found - for (idx_t i = 0; i < left.size(); i++) { + for (idx_t i = 0; i < probe_data.size(); i++) { D_ASSERT(count_star[i] >= count[i]); bool_result[i] = found_match ? found_match[i] : false; if (!bool_result[i] && count_star[i] > count[i]) { @@ -1272,7 +1410,7 @@ void ScanStructure::NextMarkJoin(DataChunk &keys, DataChunk &left, DataChunk &re mask.SetInvalid(i); } if (count_star[i] == 0) { - // count == 0, set nullmask to false (we know the result is false now) + // count == 0, set null mask to false (we know the result is false now) mask.SetValid(i); } } @@ -1280,29 +1418,34 @@ void ScanStructure::NextMarkJoin(DataChunk &keys, DataChunk &left, DataChunk &re finished = true; } -void ScanStructure::NextLeftJoin(DataChunk &keys, DataChunk &left, DataChunk &result) { +void ScanStructure::NextLeftJoin(DataChunk &keys, DataChunk &probe_data, DataChunk &result) { // a LEFT OUTER JOIN is identical to an INNER JOIN except all tuples that do // not have a match must return at least one tuple (with the right side set // to NULL in every column) - NextInnerJoin(keys, left, result); + NextInnerJoin(keys, probe_data, result); + if (result.size() == 0) { // no entries left from the normal join // fill in the result of the remaining left tuples // together with NULL values on the right-hand side idx_t remaining_count = 0; SelectionVector sel(STANDARD_VECTOR_SIZE); - for (idx_t i = 0; i < left.size(); i++) { + for (idx_t i = 0; i < probe_data.size(); i++) { if (!found_match[i]) { sel.set_index(remaining_count++, i); } } + if (remaining_count > 0) { - // have remaining tuples - // slice the left side with tuples that did not find a match - result.Slice(left, sel, remaining_count); + // extract only OUTPUT columns from probe_data + for (idx_t i = 0; i < ht.lhs_output_in_probe.size(); i++) { + idx_t probe_col_idx = ht.lhs_output_in_probe[i]; + result.data[i].Slice(probe_data.data[probe_col_idx], sel, remaining_count); + } + result.SetCardinality(remaining_count); // now set the right side to NULL - for (idx_t i = left.ColumnCount(); i < result.ColumnCount(); i++) { + for (idx_t i = ht.lhs_output_in_probe.size(); i < result.ColumnCount(); i++) { Vector &vec = result.data[i]; vec.SetVectorType(VectorType::CONSTANT_VECTOR); ConstantVector::SetNull(vec, true); @@ -1312,40 +1455,38 @@ void ScanStructure::NextLeftJoin(DataChunk &keys, DataChunk &left, DataChunk &re } } -void ScanStructure::NextSingleJoin(DataChunk &keys, DataChunk &left, DataChunk &result) { - // single join - // this join is similar to the semi join except that - // (1) we actually return data from the RHS and - // (2) we return NULL for that data if there is no match - // (3) if single_join_error_on_multiple_rows is set, we need to keep looking for duplicates after fetching +void ScanStructure::NextSingleJoin(DataChunk &keys, DataChunk &probe_data, DataChunk &result) { idx_t result_count = 0; SelectionVector result_sel(STANDARD_VECTOR_SIZE); while (this->count > 0) { - // resolve the equality_predicates for the current set of pointers - idx_t match_count = ResolvePredicates(keys, chain_match_sel_vector, &chain_no_match_sel_vector); + idx_t match_count = ResolvePredicates(keys, probe_data, chain_match_sel_vector, &chain_no_match_sel_vector); idx_t no_match_count = this->count - match_count; - // mark each of the matches as found + // Mark each of the matches as found for (idx_t i = 0; i < match_count; i++) { // found a match for this index auto index = chain_match_sel_vector.get_index(i); found_match[index] = true; result_sel.set_index(result_count++, index); } + // continue searching for the ones where we did not find a match yet AdvancePointers(chain_no_match_sel_vector, no_match_count); } - // reference the columns of the left side from the result - D_ASSERT(left.ColumnCount() > 0); - for (idx_t i = 0; i < left.ColumnCount(); i++) { - result.data[i].Reference(left.data[i]); + + // extract OUTPUT columns from probe_data + D_ASSERT(ht.lhs_output_in_probe.size() > 0); + for (idx_t i = 0; i < ht.lhs_output_in_probe.size(); i++) { + idx_t probe_col_idx = ht.lhs_output_in_probe[i]; + result.data[i].Reference(probe_data.data[probe_col_idx]); } + // now fetch the data from the RHS for (idx_t i = 0; i < ht.output_columns.size(); i++) { - auto &vector = result.data[left.ColumnCount() + i]; + auto &vector = result.data[ht.lhs_output_in_probe.size() + i]; // set NULL entries for every entry that was not found - for (idx_t j = 0; j < left.size(); j++) { + for (idx_t j = 0; j < probe_data.size(); j++) { if (!found_match[j]) { FlatVector::SetNull(vector, j, true); } @@ -1354,7 +1495,7 @@ void ScanStructure::NextSingleJoin(DataChunk &keys, DataChunk &left, DataChunk & D_ASSERT(vector.GetType() == ht.layout_ptr->GetTypes()[output_col_idx]); GatherResult(vector, result_sel, result_sel, result_count, output_col_idx); } - result.SetCardinality(left.size()); + result.SetCardinality(probe_data.size()); // like the SEMI, ANTI and MARK join types, the SINGLE join only ever does one pass over the HT per input chunk finished = true; @@ -1365,7 +1506,7 @@ void ScanStructure::NextSingleJoin(DataChunk &keys, DataChunk &left, DataChunk & AdvancePointers(result_sel, result_count); // now resolve the predicates - idx_t match_count = ResolvePredicates(keys, chain_match_sel_vector, nullptr); + idx_t match_count = ResolvePredicates(keys, probe_data, chain_match_sel_vector, nullptr); if (match_count > 0) { // we found at least one duplicate row - throw throw InvalidInputException( diff --git a/src/duckdb/src/execution/nested_loop_join/nested_loop_join_inner.cpp b/src/duckdb/src/execution/nested_loop_join/nested_loop_join_inner.cpp index 1fca98322..3eadfc870 100644 --- a/src/duckdb/src/execution/nested_loop_join/nested_loop_join_inner.cpp +++ b/src/duckdb/src/execution/nested_loop_join/nested_loop_join_inner.cpp @@ -175,7 +175,7 @@ idx_t NestedLoopJoinInner::Perform(idx_t &lpos, idx_t &rpos, DataChunk &left_con // we initialize them using the InitialNestedLoopJoin idx_t match_count = NestedLoopJoinComparisonSwitch( left_conditions.data[0], right_conditions.data[0], left_conditions.size(), right_conditions.size(), lpos, rpos, - lvector, rvector, 0, conditions[0].comparison); + lvector, rvector, 0, conditions[0].GetComparisonType()); // now resolve the rest of the conditions for (idx_t i = 1; i < conditions.size(); i++) { // check if we have run out of tuples to compare @@ -188,7 +188,7 @@ idx_t NestedLoopJoinInner::Perform(idx_t &lpos, idx_t &rpos, DataChunk &left_con // then we refine the currently obtained results using the RefineNestedLoopJoin match_count = NestedLoopJoinComparisonSwitch( l, r, left_conditions.size(), right_conditions.size(), lpos, rpos, lvector, rvector, match_count, - conditions[i].comparison); + conditions[i].GetComparisonType()); } return match_count; } diff --git a/src/duckdb/src/execution/nested_loop_join/nested_loop_join_mark.cpp b/src/duckdb/src/execution/nested_loop_join/nested_loop_join_mark.cpp index 4bb1c5f29..8cb804211 100644 --- a/src/duckdb/src/execution/nested_loop_join/nested_loop_join_mark.cpp +++ b/src/duckdb/src/execution/nested_loop_join/nested_loop_join_mark.cpp @@ -160,7 +160,7 @@ void NestedLoopJoinMark::Perform(DataChunk &left, ColumnDataCollection &right, b while (right.Scan(scan_state, scan_chunk)) { for (idx_t i = 0; i < conditions.size(); i++) { MarkJoinComparisonSwitch(left.data[i], scan_chunk.data[i], left.size(), scan_chunk.size(), found_match, - conditions[i].comparison); + conditions[i].GetComparisonType()); } } } diff --git a/src/duckdb/src/execution/operator/aggregate/physical_streaming_window.cpp b/src/duckdb/src/execution/operator/aggregate/physical_streaming_window.cpp index 097994855..3f7082de4 100644 --- a/src/duckdb/src/execution/operator/aggregate/physical_streaming_window.cpp +++ b/src/duckdb/src/execution/operator/aggregate/physical_streaming_window.cpp @@ -185,16 +185,16 @@ class StreamingWindowState : public OperatorState { // Special case when we have buffered enough values for the output if (count < buffered) { // Shift down incomplete buffers - // Copy prev[buffered-count, buffered] => temp[0, count] + // Copy prev[count, buffered] => temp[0, buffered-count] source_count = buffered - count; FlatVector::Validity(temp).Reset(); - VectorOperations::Copy(prev, temp, buffered, source_count, 0); + VectorOperations::Copy(prev, temp, buffered, count, 0); - // Copy temp[0, count] => prev[0, count] + // Copy temp[0, buffered-count] => prev[0, buffered-count] FlatVector::Validity(prev).Reset(); - VectorOperations::Copy(temp, prev, count, 0, 0); - // Copy curr[0, buffered-count] => prev[count, buffered] - VectorOperations::Copy(curr, prev, source_count, 0, count); + VectorOperations::Copy(temp, prev, source_count, 0, 0); + // Copy curr[0, count] => prev[buffered-count, buffered] + VectorOperations::Copy(curr, prev, count, 0, source_count); } else { // Copy input values beyond what we have buffered source_count = count - buffered; diff --git a/src/duckdb/src/execution/operator/aggregate/physical_window.cpp b/src/duckdb/src/execution/operator/aggregate/physical_window.cpp index 5ec34c03a..67a9bf5e2 100644 --- a/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +++ b/src/duckdb/src/execution/operator/aggregate/physical_window.cpp @@ -280,7 +280,7 @@ static unique_ptr WindowExecutorFactory(BoundWindowExpression &w case ExpressionType::WINDOW_LAG: return make_uniq(wexpr, shared); case ExpressionType::WINDOW_FILL: - return make_uniq(wexpr, shared); + return make_uniq(wexpr, client, shared); case ExpressionType::WINDOW_FIRST_VALUE: return make_uniq(wexpr, shared); case ExpressionType::WINDOW_LAST_VALUE: diff --git a/src/duckdb/src/execution/operator/csv_scanner/util/csv_reader_options.cpp b/src/duckdb/src/execution/operator/csv_scanner/util/csv_reader_options.cpp index 75a680b3b..bd71f73ca 100644 --- a/src/duckdb/src/execution/operator/csv_scanner/util/csv_reader_options.cpp +++ b/src/duckdb/src/execution/operator/csv_scanner/util/csv_reader_options.cpp @@ -742,7 +742,7 @@ void CSVReaderOptions::ParseOption(ClientContext &context, const string &key, co sql_type_list.reserve(sql_type_names.size()); for (auto &sql_type : sql_type_names) { auto def_type = TransformStringToLogicalType(sql_type, context); - if (def_type.id() == LogicalTypeId::USER) { + if (def_type.id() == LogicalTypeId::UNBOUND) { throw BinderException("Unrecognized type \"%s\" for read_csv %s definition", sql_type, key); } sql_type_list.push_back(std::move(def_type)); diff --git a/src/duckdb/src/execution/operator/helper/physical_limit.cpp b/src/duckdb/src/execution/operator/helper/physical_limit.cpp index d36bd60d6..d46bffc53 100644 --- a/src/duckdb/src/execution/operator/helper/physical_limit.cpp +++ b/src/duckdb/src/execution/operator/helper/physical_limit.cpp @@ -244,4 +244,20 @@ Value PhysicalLimit::GetDelimiter(ExecutionContext &context, DataChunk &input, c return limit_value; } +InsertionOrderPreservingMap PhysicalLimit::ParamsToString() const { + InsertionOrderPreservingMap result; + if (limit_val.Type() == LimitNodeType::CONSTANT_VALUE) { + result["Limit"] = to_string(limit_val.GetConstantValue()); + } else if (limit_val.Type() == LimitNodeType::CONSTANT_PERCENTAGE) { + result["Limit"] = to_string(limit_val.GetConstantPercentage()) + "%"; + } + if (offset_val.Type() == LimitNodeType::CONSTANT_VALUE) { + auto offset = offset_val.GetConstantValue(); + if (offset > 0) { + result["Offset"] = to_string(offset); + } + } + return result; +} + } // namespace duckdb diff --git a/src/duckdb/src/execution/operator/helper/physical_limit_percent.cpp b/src/duckdb/src/execution/operator/helper/physical_limit_percent.cpp index 20db72032..3cc5b028e 100644 --- a/src/duckdb/src/execution/operator/helper/physical_limit_percent.cpp +++ b/src/duckdb/src/execution/operator/helper/physical_limit_percent.cpp @@ -164,4 +164,18 @@ SourceResultType PhysicalLimitPercent::GetDataInternal(ExecutionContext &context return SourceResultType::HAVE_MORE_OUTPUT; } +InsertionOrderPreservingMap PhysicalLimitPercent::ParamsToString() const { + InsertionOrderPreservingMap result; + if (limit_val.Type() == LimitNodeType::CONSTANT_PERCENTAGE) { + result["Limit"] = to_string(limit_val.GetConstantPercentage()) + "%"; + } + if (offset_val.Type() == LimitNodeType::CONSTANT_VALUE) { + auto offset = offset_val.GetConstantValue(); + if (offset > 0) { + result["Offset"] = to_string(offset); + } + } + return result; +} + } // namespace duckdb diff --git a/src/duckdb/src/execution/operator/helper/physical_streaming_limit.cpp b/src/duckdb/src/execution/operator/helper/physical_streaming_limit.cpp index 82dcdbe79..1b6b436ce 100644 --- a/src/duckdb/src/execution/operator/helper/physical_streaming_limit.cpp +++ b/src/duckdb/src/execution/operator/helper/physical_streaming_limit.cpp @@ -54,6 +54,9 @@ OperatorResultType PhysicalStreamingLimit::Execute(ExecutionContext &context, Da if (PhysicalLimit::HandleOffset(input, current_offset, offset.GetIndex(), limit.GetIndex())) { chunk.Reference(input); } + if (current_offset >= limit.GetIndex() + offset.GetIndex()) { + return chunk.size() == 0 ? OperatorResultType::FINISHED : OperatorResultType::HAVE_MORE_OUTPUT; + } return OperatorResultType::NEED_MORE_INPUT; } @@ -65,4 +68,20 @@ bool PhysicalStreamingLimit::ParallelOperator() const { return parallel; } +InsertionOrderPreservingMap PhysicalStreamingLimit::ParamsToString() const { + InsertionOrderPreservingMap result; + if (limit_val.Type() == LimitNodeType::CONSTANT_VALUE) { + result["Limit"] = to_string(limit_val.GetConstantValue()); + } else if (limit_val.Type() == LimitNodeType::CONSTANT_PERCENTAGE) { + result["Limit"] = to_string(limit_val.GetConstantPercentage()) + "%"; + } + if (offset_val.Type() == LimitNodeType::CONSTANT_VALUE) { + auto offset = offset_val.GetConstantValue(); + if (offset > 0) { + result["Offset"] = to_string(offset); + } + } + return result; +} + } // namespace duckdb diff --git a/src/duckdb/src/execution/operator/join/perfect_hash_join_executor.cpp b/src/duckdb/src/execution/operator/join/perfect_hash_join_executor.cpp index a92a2feae..3388955bb 100644 --- a/src/duckdb/src/execution/operator/join/perfect_hash_join_executor.cpp +++ b/src/duckdb/src/execution/operator/join/perfect_hash_join_executor.cpp @@ -64,14 +64,20 @@ bool ExtractNumericValue(Value val, hugeint_t &result) { } bool PerfectHashJoinExecutor::CanDoPerfectHashJoin(const PhysicalHashJoin &op, const Value &min, const Value &max) { + // TODO: Add support for residual predicates + if (op.predicate) { + return false; + } + if (perfect_join_statistics.is_build_small) { return true; // Already true based on static statistics } // We only do this optimization for inner joins with one integer equality condition - const auto key_type = op.conditions[0].left->return_type; + const auto key_type = op.conditions[0].GetLHS().return_type; if (op.join_type != JoinType::INNER || op.conditions.size() != 1 || - op.conditions[0].comparison != ExpressionType::COMPARE_EQUAL || !TypeIsInteger(key_type.InternalType())) { + op.conditions[0].GetComparisonType() != ExpressionType::COMPARE_EQUAL || + !TypeIsInteger(key_type.InternalType())) { return false; } @@ -247,7 +253,7 @@ class PerfectHashJoinState : public OperatorState { PerfectHashJoinState(ClientContext &context, const PhysicalHashJoin &join) : probe_executor(context) { join_keys.Initialize(Allocator::Get(context), join.condition_types); for (auto &cond : join.conditions) { - probe_executor.AddExpression(*cond.left); + probe_executor.AddExpression(cond.GetLHS()); } build_sel_vec.Initialize(STANDARD_VECTOR_SIZE); probe_sel_vec.Initialize(STANDARD_VECTOR_SIZE); diff --git a/src/duckdb/src/execution/operator/join/physical_asof_join.cpp b/src/duckdb/src/execution/operator/join/physical_asof_join.cpp index 6caf414e1..3b437c761 100644 --- a/src/duckdb/src/execution/operator/join/physical_asof_join.cpp +++ b/src/duckdb/src/execution/operator/join/physical_asof_join.cpp @@ -19,20 +19,20 @@ PhysicalAsOfJoin::PhysicalAsOfJoin(PhysicalPlan &physical_plan, LogicalCompariso op.estimated_cardinality), comparison_type(ExpressionType::INVALID) { // Convert the conditions partitions and sorts - D_ASSERT(!op.predicate.get()); for (auto &cond : conditions) { - D_ASSERT(cond.left->return_type == cond.right->return_type); - join_key_types.push_back(cond.left->return_type); + D_ASSERT(cond.IsComparison()); + D_ASSERT(cond.GetLHS().return_type == cond.GetRHS().return_type); + join_key_types.push_back(cond.GetLHS().return_type); - auto left_cond = cond.left->Copy(); - auto right_cond = cond.right->Copy(); - switch (cond.comparison) { + auto left_cond = cond.LeftReference()->Copy(); + auto right_cond = cond.RightReference()->Copy(); + switch (cond.GetComparisonType()) { case ExpressionType::COMPARE_GREATERTHANOREQUALTO: case ExpressionType::COMPARE_GREATERTHAN: null_sensitive.emplace_back(lhs_orders.size()); lhs_orders.emplace_back(OrderType::ASCENDING, OrderByNullType::NULLS_LAST, std::move(left_cond)); rhs_orders.emplace_back(OrderType::ASCENDING, OrderByNullType::NULLS_LAST, std::move(right_cond)); - comparison_type = cond.comparison; + comparison_type = cond.GetComparisonType(); break; case ExpressionType::COMPARE_LESSTHANOREQUALTO: case ExpressionType::COMPARE_LESSTHAN: @@ -40,7 +40,7 @@ PhysicalAsOfJoin::PhysicalAsOfJoin(PhysicalPlan &physical_plan, LogicalCompariso null_sensitive.emplace_back(lhs_orders.size()); lhs_orders.emplace_back(OrderType::DESCENDING, OrderByNullType::NULLS_LAST, std::move(left_cond)); rhs_orders.emplace_back(OrderType::DESCENDING, OrderByNullType::NULLS_LAST, std::move(right_cond)); - comparison_type = cond.comparison; + comparison_type = cond.GetComparisonType(); break; case ExpressionType::COMPARE_EQUAL: null_sensitive.emplace_back(lhs_orders.size()); @@ -903,7 +903,7 @@ AsOfProbeBuffer::AsOfProbeBuffer(ClientContext &client, const PhysicalAsOfJoin & left_outer(IsLeftOuterJoin(op.join_type)), lhs_executor(client), fetch_next_left(true) { lhs_keys.Initialize(client, op.join_key_types); for (const auto &cond : op.conditions) { - lhs_executor.AddExpression(*cond.left); + lhs_executor.AddExpression(cond.GetLHS()); } lhs_payload.Initialize(client, op.children[0].get().GetTypes()); @@ -918,7 +918,7 @@ AsOfProbeBuffer::AsOfProbeBuffer(ClientContext &client, const PhysicalAsOfJoin & vector prefix_types; for (idx_t i = 0; i < op.conditions.size() - 1; ++i) { const auto &cond = op.conditions[i]; - const auto &type = cond.left->return_type; + const auto &type = cond.GetLHS().return_type; prefix_types.emplace_back(type); SortKeyPrefixComparisonColumn col; col.size = DConstants::INVALID_INDEX; diff --git a/src/duckdb/src/execution/operator/join/physical_comparison_join.cpp b/src/duckdb/src/execution/operator/join/physical_comparison_join.cpp index 0f49c7656..6eaea6a51 100644 --- a/src/duckdb/src/execution/operator/join/physical_comparison_join.cpp +++ b/src/duckdb/src/execution/operator/join/physical_comparison_join.cpp @@ -7,8 +7,23 @@ namespace duckdb { PhysicalComparisonJoin::PhysicalComparisonJoin(PhysicalPlan &physical_plan, LogicalOperator &op, PhysicalOperatorType type, vector conditions_p, JoinType join_type, idx_t estimated_cardinality) - : PhysicalJoin(physical_plan, op, type, join_type, estimated_cardinality), conditions(std::move(conditions_p)) { + : PhysicalJoin(physical_plan, op, type, join_type, estimated_cardinality) { + vector comparison_conditions; + vector arbitrary_conditions; + + for (auto &cond : conditions_p) { + if (cond.IsComparison()) { + comparison_conditions.push_back(std::move(cond)); + } else { + arbitrary_conditions.push_back(std::move(cond)); + } + } + conditions = std::move(comparison_conditions); ReorderConditions(conditions); + + if (!arbitrary_conditions.empty()) { + predicate = JoinCondition::CreateExpression(std::move(arbitrary_conditions)); + } } InsertionOrderPreservingMap PhysicalComparisonJoin::ParamsToString() const { @@ -20,12 +35,19 @@ InsertionOrderPreservingMap PhysicalComparisonJoin::ParamsToString() con if (i > 0) { condition_info += "\n"; } - condition_info += - StringUtil::Format("%s %s %s", join_condition.left->GetName(), - ExpressionTypeToOperator(join_condition.comparison), join_condition.right->GetName()); - // string op = ExpressionTypeToOperator(it.comparison); - // extra_info += it.left->GetName() + " " + op + " " + it.right->GetName() + "\n"; + D_ASSERT(join_condition.IsComparison()); + condition_info += StringUtil::Format("%s %s %s", join_condition.GetLHS().GetName(), + ExpressionTypeToOperator(join_condition.GetComparisonType()), + join_condition.GetRHS().GetName()); } + + if (predicate) { + if (!condition_info.empty()) { + condition_info += "\n"; + } + condition_info += predicate->ToString(); + } + result["Conditions"] = condition_info; SetEstimatedCardinality(result, estimated_cardinality); return result; @@ -36,38 +58,55 @@ void PhysicalComparisonJoin::ReorderConditions(vector &conditions // check if this is already the case bool is_ordered = true; bool seen_non_equal = false; + bool seen_non_comparison = false; + for (auto &cond : conditions) { - if (cond.comparison == ExpressionType::COMPARE_EQUAL || - cond.comparison == ExpressionType::COMPARE_NOT_DISTINCT_FROM) { - if (seen_non_equal) { + if (!cond.IsComparison()) { + seen_non_comparison = true; + } else if (cond.GetComparisonType() == ExpressionType::COMPARE_EQUAL || + cond.GetComparisonType() == ExpressionType::COMPARE_NOT_DISTINCT_FROM) { + if (seen_non_equal || seen_non_comparison) { is_ordered = false; break; } } else { + if (seen_non_comparison) { + is_ordered = false; + break; + } seen_non_equal = true; } } + if (is_ordered) { // no need to re-order return; } - // gather lists of equal/other conditions + vector equal_conditions; - vector other_conditions; + vector non_equi_conditions; + vector arbitrary_conditions; + for (auto &cond : conditions) { - if (cond.comparison == ExpressionType::COMPARE_EQUAL || - cond.comparison == ExpressionType::COMPARE_NOT_DISTINCT_FROM) { + if (!cond.IsComparison()) { + arbitrary_conditions.push_back(std::move(cond)); + } else if (cond.GetComparisonType() == ExpressionType::COMPARE_EQUAL || + cond.GetComparisonType() == ExpressionType::COMPARE_NOT_DISTINCT_FROM) { equal_conditions.push_back(std::move(cond)); } else { - other_conditions.push_back(std::move(cond)); + non_equi_conditions.push_back(std::move(cond)); } } + conditions.clear(); // reconstruct the sorted conditions for (auto &cond : equal_conditions) { conditions.push_back(std::move(cond)); } - for (auto &cond : other_conditions) { + for (auto &cond : non_equi_conditions) { + conditions.push_back(std::move(cond)); + } + for (auto &cond : arbitrary_conditions) { conditions.push_back(std::move(cond)); } } diff --git a/src/duckdb/src/execution/operator/join/physical_hash_join.cpp b/src/duckdb/src/execution/operator/join/physical_hash_join.cpp index e7fb060b1..983697391 100644 --- a/src/duckdb/src/execution/operator/join/physical_hash_join.cpp +++ b/src/duckdb/src/execution/operator/join/physical_hash_join.cpp @@ -26,15 +26,16 @@ #include "duckdb/storage/temporary_memory_manager.hpp" #include "duckdb/main/settings.hpp" #include "duckdb/logging/log_manager.hpp" +#include "duckdb/execution/join_hashtable.hpp" namespace duckdb { PhysicalHashJoin::PhysicalHashJoin(PhysicalPlan &physical_plan, LogicalOperator &op, PhysicalOperator &left, - PhysicalOperator &right, vector cond, JoinType join_type, + PhysicalOperator &right, vector conds, JoinType join_type, const vector &left_projection_map, const vector &right_projection_map, vector delim_types, idx_t estimated_cardinality, unique_ptr pushdown_info_p) - : PhysicalComparisonJoin(physical_plan, op, PhysicalOperatorType::HASH_JOIN, std::move(cond), join_type, + : PhysicalComparisonJoin(physical_plan, op, PhysicalOperatorType::HASH_JOIN, std::move(conds), join_type, estimated_cardinality), delim_types(std::move(delim_types)) { filter_pushdown = std::move(pushdown_info_p); @@ -42,71 +43,221 @@ PhysicalHashJoin::PhysicalHashJoin(PhysicalPlan &physical_plan, LogicalOperator children.push_back(left); children.push_back(right); - // Collect condition types, and which conditions are just references (so we won't duplicate them in the payload) - unordered_map build_columns_in_conditions; - for (idx_t cond_idx = 0; cond_idx < conditions.size(); cond_idx++) { - auto &condition = conditions[cond_idx]; - condition_types.push_back(condition.left->return_type); - if (condition.right->GetExpressionClass() == ExpressionClass::BOUND_REF) { - build_columns_in_conditions.emplace(condition.right->Cast().index, cond_idx); - } + auto &lhs_input_types = children[0].get().GetTypes(); + auto &rhs_input_types = children[1].get().GetTypes(); + + for (auto &condition : conditions) { + D_ASSERT(condition.IsComparison()); + condition_types.push_back(condition.GetLHS().return_type); } - auto &lhs_input_types = children[0].get().GetTypes(); + vector probe_cols; + vector build_cols; + + if (predicate) { + ExtractResidualPredicateColumns(predicate, lhs_input_types.size(), probe_cols, build_cols); + residual_info = make_uniq(); + } - // Create a projection map for the LHS (if it was empty), for convenience + // build lhs_output_columns lhs_output_columns.col_idxs = left_projection_map; if (lhs_output_columns.col_idxs.empty()) { - lhs_output_columns.col_idxs.reserve(lhs_input_types.size()); for (idx_t i = 0; i < lhs_input_types.size(); i++) { lhs_output_columns.col_idxs.emplace_back(i); } } for (auto &lhs_col : lhs_output_columns.col_idxs) { - auto &lhs_col_type = lhs_input_types[lhs_col]; - lhs_output_columns.col_types.push_back(lhs_col_type); + lhs_output_columns.col_types.push_back(lhs_input_types[lhs_col]); + } + + // initialize residual predicate structures if present + if (residual_info) { + InitializeResidualPredicate(lhs_input_types, probe_cols); + } else { + // lhs_probe_columns = lhs_output_columns + lhs_probe_columns = lhs_output_columns; + lhs_output_in_probe.reserve(lhs_output_columns.col_idxs.size()); + for (idx_t i = 0; i < lhs_output_columns.col_idxs.size(); i++) { + lhs_output_in_probe.push_back(i); + } + } + + // store probe types + if (residual_info) { + residual_info->probe_types = lhs_probe_columns.col_types; + } + + // handle build side (RHS) + InitializeBuildSide(lhs_input_types, rhs_input_types, right_projection_map, build_cols); +} + +PhysicalHashJoin::PhysicalHashJoin(PhysicalPlan &physical_plan, LogicalOperator &op, PhysicalOperator &left, + PhysicalOperator &right, vector cond, JoinType join_type, + idx_t estimated_cardinality) + : PhysicalHashJoin(physical_plan, op, left, right, std::move(cond), join_type, {}, {}, {}, estimated_cardinality, + nullptr) { +} + +void PhysicalHashJoin::ExtractResidualPredicateColumns(unique_ptr &predicate, idx_t probe_column_count, + vector &probe_column_ids, + vector &build_column_ids) { + unordered_set probe_cols; + unordered_set build_cols; + + ExpressionIterator::EnumerateExpression(predicate, [&](unique_ptr &expr) { + if (expr->GetExpressionClass() == ExpressionClass::BOUND_REF) { + auto &ref = expr->Cast(); + idx_t col_idx = ref.index; + + if (col_idx < probe_column_count) { + // Probe (LHS) column + probe_cols.insert(col_idx); + } else { + // Build (RHS) column + build_cols.insert(col_idx); + } + } + }); + + probe_column_ids.assign(probe_cols.begin(), probe_cols.end()); + build_column_ids.assign(build_cols.begin(), build_cols.end()); +} + +void PhysicalHashJoin::InitializeResidualPredicate(const vector &lhs_input_types, + const vector &probe_cols) { + D_ASSERT(residual_info); + // build lhs_probe_columns (output + predicate columns) + unordered_set required_probe_cols; + for (auto col : lhs_output_columns.col_idxs) { + required_probe_cols.insert(col); + } + for (auto col : probe_cols) { + required_probe_cols.insert(col); + } + + lhs_probe_columns.col_idxs.assign(required_probe_cols.begin(), required_probe_cols.end()); + std::sort(lhs_probe_columns.col_idxs.begin(), lhs_probe_columns.col_idxs.end()); + + for (auto col_idx : lhs_probe_columns.col_idxs) { + lhs_probe_columns.col_types.push_back(lhs_input_types[col_idx]); + } + + // build mapping for predicate probe columns + for (auto predicate_col_idx : probe_cols) { + for (idx_t i = 0; i < lhs_probe_columns.col_idxs.size(); i++) { + if (lhs_probe_columns.col_idxs[i] == predicate_col_idx) { + residual_info->probe_input_to_probe_map[predicate_col_idx] = i; + break; + } + } + } + + // build lhs_output_in_probe mapping + lhs_output_in_probe.reserve(lhs_output_columns.col_idxs.size()); + for (auto output_col_idx : lhs_output_columns.col_idxs) { + for (idx_t i = 0; i < lhs_probe_columns.col_idxs.size(); i++) { + if (lhs_probe_columns.col_idxs[i] == output_col_idx) { + lhs_output_in_probe.push_back(i); + break; + } + } } +} - // For ANTI, SEMI and MARK join, we only need to store the keys, so for these the payload/RHS types are empty +void PhysicalHashJoin::InitializeBuildSide(const vector &lhs_input_types, + const vector &rhs_input_types, + const vector &right_projection_map, const vector &build_cols) { + unordered_map build_columns_in_conditions; + unordered_map build_input_to_layout; + + // Only consider comparison conditions for the hash join conditions + idx_t cond_idx = 0; + for (auto &condition : conditions) { + if (condition.GetRHS().GetExpressionClass() == ExpressionClass::BOUND_REF) { + auto build_input_idx = condition.GetRHS().Cast().index; + build_columns_in_conditions.emplace(build_input_idx, cond_idx); + } + cond_idx++; + } + + // handle SEMI/ANTI/MARK joins if (join_type == JoinType::ANTI || join_type == JoinType::SEMI || join_type == JoinType::MARK) { + MapResidualBuildColumns(lhs_input_types, rhs_input_types, build_cols, build_columns_in_conditions, + build_input_to_layout); + + if (residual_info) { + residual_info->build_input_to_layout_map = std::move(build_input_to_layout); + } return; } - auto &rhs_input_types = children[1].get().GetTypes(); - - // Create a projection map for the RHS (if it was empty), for convenience + // for other join types auto right_projection_map_copy = right_projection_map; if (right_projection_map_copy.empty()) { - right_projection_map_copy.reserve(rhs_input_types.size()); for (idx_t i = 0; i < rhs_input_types.size(); i++) { right_projection_map_copy.emplace_back(i); } } - // Now fill payload expressions/types and RHS columns/types + // map ALL predicate columns (both in conditions and not) + MapResidualBuildColumns(lhs_input_types, rhs_input_types, build_cols, build_columns_in_conditions, + build_input_to_layout); + + // build rhs_output_columns for (auto &rhs_col : right_projection_map_copy) { auto &rhs_col_type = rhs_input_types[rhs_col]; + idx_t rhs_col_with_offset = lhs_input_types.size() + rhs_col; auto it = build_columns_in_conditions.find(rhs_col); - if (it == build_columns_in_conditions.end()) { - // This rhs column is not a join key - payload_columns.col_idxs.push_back(rhs_col); - payload_columns.col_types.push_back(rhs_col_type); - rhs_output_columns.col_idxs.push_back(condition_types.size() + payload_columns.col_types.size() - 1); - } else { - // This rhs column is a join key + if (it != build_columns_in_conditions.end()) { + // it's in join conditions rhs_output_columns.col_idxs.push_back(it->second); + } else { + // check if already in payload (from predicate) + auto layout_it = build_input_to_layout.find(rhs_col_with_offset); + if (layout_it != build_input_to_layout.end()) { + rhs_output_columns.col_idxs.push_back(layout_it->second); + } else { + // new column - add to payload + idx_t layout_pos = condition_types.size() + payload_columns.col_idxs.size(); + payload_columns.col_idxs.push_back(rhs_col); + payload_columns.col_types.push_back(rhs_col_type); + rhs_output_columns.col_idxs.push_back(layout_pos); + } } rhs_output_columns.col_types.push_back(rhs_col_type); } + + if (residual_info) { + residual_info->build_input_to_layout_map = std::move(build_input_to_layout); + } } -PhysicalHashJoin::PhysicalHashJoin(PhysicalPlan &physical_plan, LogicalOperator &op, PhysicalOperator &left, - PhysicalOperator &right, vector cond, JoinType join_type, - idx_t estimated_cardinality) - : PhysicalHashJoin(physical_plan, op, left, right, std::move(cond), join_type, {}, {}, {}, estimated_cardinality, - nullptr) { +void PhysicalHashJoin::MapResidualBuildColumns(const vector &lhs_input_types, + const vector &rhs_input_types, + const vector &build_cols, + const unordered_map &build_columns_in_conditions, + unordered_map &build_input_to_layout) { + if (!residual_info) { + return; + } + + for (auto rhs_idx_with_offset : build_cols) { + idx_t rhs_idx = rhs_idx_with_offset - lhs_input_types.size(); + auto it = build_columns_in_conditions.find(rhs_idx); + + if (it != build_columns_in_conditions.end()) { + // column IS in conditions + build_input_to_layout[rhs_idx_with_offset] = it->second; + } else { + // column NOT in conditions - add to payload + idx_t layout_pos = condition_types.size() + payload_columns.col_idxs.size(); + build_input_to_layout[rhs_idx_with_offset] = layout_pos; + payload_columns.col_idxs.push_back(rhs_idx); + payload_columns.col_types.push_back(rhs_input_types[rhs_idx]); + } + } } //===--------------------------------------------------------------------===// @@ -223,7 +374,7 @@ class HashJoinLocalSinkState : public LocalSinkState { auto &allocator = BufferAllocator::Get(context); for (auto &cond : op.conditions) { - join_key_executor.AddExpression(*cond.right); + join_key_executor.AddExpression(cond.GetRHS()); } join_keys.Initialize(allocator, op.condition_types); @@ -257,7 +408,9 @@ class HashJoinLocalSinkState : public LocalSinkState { unique_ptr PhysicalHashJoin::InitializeHashTable(ClientContext &context) const { auto result = make_uniq(context, *this, conditions, payload_columns.col_types, join_type, - rhs_output_columns.col_idxs); + rhs_output_columns.col_idxs, residual_info ? residual_info->Copy() : nullptr, + predicate ? predicate.get() : nullptr, lhs_output_in_probe); + if (!delim_types.empty() && join_type == JoinType::MARK) { // correlated MARK join if (delim_types.size() + 1 == conditions.size()) { @@ -776,8 +929,8 @@ void JoinFilterPushdownInfo::PushBloomFilter(const JoinFilterPushdownFilter &inf const PhysicalOperator &op, idx_t filter_col_idx) const { // If the nulls are equal, we let nulls pass. If not, we filter them auto filters_null_values = !ht.NullValuesAreEqual(0); - const auto key_name = ht.conditions[0].right->ToString(); - const auto key_type = ht.conditions[0].left->return_type; + const auto key_name = ht.conditions[0].GetRHS().ToString(); + const auto key_type = ht.conditions[0].GetLHS().return_type; auto bf_filter = make_uniq(ht.GetBloomFilter(), filters_null_values, key_name, key_type); ht.SetBuildBloomFilter(true); @@ -809,7 +962,7 @@ unique_ptr JoinFilterPushdownInfo::FinalizeFilters(ClientContext &con // create a filter for each of the aggregates for (idx_t filter_idx = 0; filter_idx < join_condition.size(); filter_idx++) { - const auto cmp = op.conditions[join_condition[filter_idx]].comparison; + const auto cmp = op.conditions[join_condition[filter_idx]].GetComparisonType(); for (auto &info : probe_info) { auto filter_col_idx = info.columns[filter_idx].probe_column_index.column_index; auto min_idx = filter_idx * 2; @@ -964,9 +1117,9 @@ SinkFinalizeType PhysicalHashJoin::Finalize(Pipeline &pipeline, Event &event, Cl filter_min_max = filter_pushdown->FinalizeMinMax(*sink.global_filter_state); min = filter_min_max->data[0].GetValue(0); max = filter_min_max->data[1].GetValue(0); - } else if (TypeIsIntegral(conditions[0].right->return_type.InternalType())) { - min = Value::MinimumValue(conditions[0].right->return_type); - max = Value::MaximumValue(conditions[0].right->return_type); + } else if (TypeIsIntegral(conditions[0].GetRHS().return_type.InternalType())) { + min = Value::MinimumValue(conditions[0].GetRHS().return_type); + max = Value::MaximumValue(conditions[0].GetRHS().return_type); } // check for possible perfect hash table @@ -1004,7 +1157,7 @@ class HashJoinOperatorState : public CachingOperatorState { DataChunk lhs_join_keys; TupleDataChunkState join_key_state; - DataChunk lhs_output; + DataChunk lhs_probe_data; ExpressionExecutor probe_executor; JoinHashTable::ScanStructure scan_structure; @@ -1026,17 +1179,21 @@ unique_ptr PhysicalHashJoin::GetOperatorState(ExecutionContext &c auto &sink = sink_state->Cast(); auto state = make_uniq(context.client, sink); state->lhs_join_keys.Initialize(allocator, condition_types); - if (!lhs_output_columns.col_types.empty()) { - state->lhs_output.Initialize(allocator, lhs_output_columns.col_types); + + // initialize probe data with ALL probe columns (output + predicate) + if (!lhs_probe_columns.col_types.empty()) { + state->lhs_probe_data.Initialize(allocator, lhs_probe_columns.col_types); } + if (sink.perfect_join_executor) { state->perfect_hash_join_state = sink.perfect_join_executor->GetOperatorState(context); } else { for (auto &cond : conditions) { - state->probe_executor.AddExpression(*cond.left); + state->probe_executor.AddExpression(cond.GetLHS()); } TupleDataCollection::InitializeChunkState(state->join_key_state, condition_types); } + if (sink.external) { state->spill_chunk.Initialize(allocator, sink.probe_types); sink.InitializeProbeSpill(); @@ -1056,15 +1213,17 @@ OperatorResultType PhysicalHashJoin::ExecuteInternal(ExecutionContext &context, if (EmptyResultIfRHSIsEmpty()) { return OperatorResultType::FINISHED; } - state.lhs_output.ReferenceColumns(input, lhs_output_columns.col_idxs); - ConstructEmptyJoinResult(sink.hash_table->join_type, sink.hash_table->has_null, state.lhs_output, chunk); + // for empty result, only need output columns (no predicate evaluation) + state.lhs_probe_data.ReferenceColumns(input, lhs_output_columns.col_idxs); + ConstructEmptyJoinResult(sink.hash_table->join_type, sink.hash_table->has_null, state.lhs_probe_data, chunk); return OperatorResultType::NEED_MORE_INPUT; } if (sink.perfect_join_executor) { D_ASSERT(!sink.external); - state.lhs_output.ReferenceColumns(input, lhs_output_columns.col_idxs); - return sink.perfect_join_executor->ProbePerfectHashTable(context, input, state.lhs_output, chunk, + // for perfect hash join, when predicate is NULL, only output columns are needed + state.lhs_probe_data.ReferenceColumns(input, lhs_output_columns.col_idxs); + return sink.perfect_join_executor->ProbePerfectHashTable(context, input, state.lhs_probe_data, chunk, *state.perfect_hash_join_state); } @@ -1092,8 +1251,9 @@ OperatorResultType PhysicalHashJoin::ExecuteInternal(ExecutionContext &context, } } - state.lhs_output.ReferenceColumns(input, lhs_output_columns.col_idxs); - state.scan_structure.Next(state.lhs_join_keys, state.lhs_output, chunk); + // pass probe data and mapping to Next + state.lhs_probe_data.ReferenceColumns(input, lhs_probe_columns.col_idxs); + state.scan_structure.Next(state.lhs_join_keys, state.lhs_probe_data, chunk); if (state.scan_structure.PointersExhausted() && chunk.size() == 0) { state.scan_structure.is_null = true; @@ -1196,7 +1356,7 @@ class HashJoinLocalSourceState : public LocalSourceState { //! Chunks for holding the scanned probe collection DataChunk lhs_probe_chunk; DataChunk lhs_join_keys; - DataChunk lhs_output; + DataChunk lhs_probe_data; TupleDataChunkState join_key_state; ExpressionExecutor lhs_join_key_executor; @@ -1397,11 +1557,14 @@ HashJoinLocalSourceState::HashJoinLocalSourceState(const PhysicalHashJoin &op, c lhs_probe_chunk.Initialize(allocator, sink.probe_types); lhs_join_keys.Initialize(allocator, op.condition_types); - lhs_output.Initialize(allocator, op.lhs_output_columns.col_types); + + // initialize with PROBE columns (not just output) + lhs_probe_data.Initialize(allocator, op.lhs_probe_columns.col_types); + TupleDataCollection::InitializeChunkState(join_key_state, op.condition_types); for (auto &cond : op.conditions) { - lhs_join_key_executor.AddExpression(*cond.left); + lhs_join_key_executor.AddExpression(cond.GetLHS()); } } @@ -1451,15 +1614,14 @@ void HashJoinLocalSourceState::ExternalProbe(HashJoinGlobalSinkState &sink, Hash D_ASSERT(local_stage == HashJoinSourceStage::PROBE && sink.hash_table->finalized); if (!scan_structure.is_null) { - // Still have elements remaining (i.e. we got >STANDARD_VECTOR_SIZE elements in the previous probe) - scan_structure.Next(lhs_join_keys, lhs_output, chunk); + // still have elements remaining + scan_structure.Next(lhs_join_keys, lhs_probe_data, chunk); if (chunk.size() != 0 || !scan_structure.PointersExhausted()) { return; } } if (!scan_structure.is_null || empty_ht_probe_in_progress) { - // Previous probe is done scan_structure.is_null = true; empty_ht_probe_in_progress = false; sink.probe_spill->consumer->FinishChunk(probe_local_scan); @@ -1474,10 +1636,15 @@ void HashJoinLocalSourceState::ExternalProbe(HashJoinGlobalSinkState &sink, Hash // Get the probe chunk columns/hashes lhs_join_keys.Reset(); lhs_join_key_executor.Execute(lhs_probe_chunk, lhs_join_keys); - lhs_output.ReferenceColumns(lhs_probe_chunk, sink.op.lhs_output_columns.col_idxs); + + // reference ALL probe columns + lhs_probe_data.ReferenceColumns(lhs_probe_chunk, gstate.op.lhs_probe_columns.col_idxs); if (sink.hash_table->Count() == 0 && !gstate.op.EmptyResultIfRHSIsEmpty()) { - gstate.op.ConstructEmptyJoinResult(sink.hash_table->join_type, sink.hash_table->has_null, lhs_output, chunk); + // for empty result, only need output columns (no predicate evaluation) + lhs_probe_data.ReferenceColumns(lhs_probe_chunk, gstate.op.lhs_output_columns.col_idxs); + gstate.op.ConstructEmptyJoinResult(sink.hash_table->join_type, sink.hash_table->has_null, lhs_probe_data, + chunk); empty_ht_probe_in_progress = true; return; } @@ -1485,7 +1652,7 @@ void HashJoinLocalSourceState::ExternalProbe(HashJoinGlobalSinkState &sink, Hash // Perform the probe auto precomputed_hashes = &lhs_probe_chunk.data.back(); sink.hash_table->Probe(scan_structure, lhs_join_keys, join_key_state, probe_state, precomputed_hashes); - scan_structure.Next(lhs_join_keys, lhs_output, chunk); + scan_structure.Next(lhs_join_keys, lhs_probe_data, chunk); } void HashJoinLocalSourceState::ExternalScanHT(HashJoinGlobalSinkState &sink, HashJoinGlobalSourceState &gstate, @@ -1591,10 +1758,18 @@ InsertionOrderPreservingMap PhysicalHashJoin::ParamsToString() const { if (i > 0) { condition_info += "\n"; } - condition_info += - StringUtil::Format("%s %s %s", join_condition.left->GetName(), - ExpressionTypeToOperator(join_condition.comparison), join_condition.right->GetName()); + condition_info += StringUtil::Format("%s %s %s", join_condition.GetLHS().GetName(), + ExpressionTypeToOperator(join_condition.GetComparisonType()), + join_condition.GetRHS().GetName()); } + + if (predicate) { + if (!condition_info.empty()) { + condition_info += "\n"; + } + condition_info += predicate->ToString(); + } + result["Conditions"] = condition_info; SetEstimatedCardinality(result, estimated_cardinality); diff --git a/src/duckdb/src/execution/operator/join/physical_iejoin.cpp b/src/duckdb/src/execution/operator/join/physical_iejoin.cpp index 5d26425e3..46c1e4966 100644 --- a/src/duckdb/src/execution/operator/join/physical_iejoin.cpp +++ b/src/duckdb/src/execution/operator/join/physical_iejoin.cpp @@ -1,6 +1,7 @@ #include "duckdb/execution/operator/join/physical_iejoin.hpp" #include "duckdb/common/atomic.hpp" +#include "duckdb/common/bit_utils.hpp" #include "duckdb/common/row_operations/row_operations.hpp" #include "duckdb/common/sorting/sort_key.hpp" #include "duckdb/main/client_context.hpp" @@ -23,19 +24,19 @@ PhysicalIEJoin::PhysicalIEJoin(PhysicalPlan &physical_plan, LogicalComparisonJoi D_ASSERT(conditions.size() >= 2); for (idx_t i = 0; i < 2; ++i) { auto &cond = conditions[i]; - D_ASSERT(cond.left->return_type == cond.right->return_type); - join_key_types.push_back(cond.left->return_type); + D_ASSERT(cond.GetLHS().return_type == cond.GetRHS().return_type); + join_key_types.push_back(cond.GetLHS().return_type); // Convert the conditions to sort orders - auto left = cond.left->Copy(); - auto right = cond.right->Copy(); + auto left = cond.GetLHS().Copy(); + auto right = cond.GetRHS().Copy(); auto sense = OrderType::INVALID; // 2. if (op1 ∈ {>, ≥}) sort L1 in descending order // 3. else if (op1 ∈ {<, ≤}) sort L1 in ascending order // 4. if (op2 ∈ {>, ≥}) sort L2 in ascending order // 5. else if (op2 ∈ {<, ≤}) sort L2 in descending order - switch (cond.comparison) { + switch (cond.GetComparisonType()) { case ExpressionType::COMPARE_GREATERTHAN: case ExpressionType::COMPARE_GREATERTHANOREQUALTO: sense = i ? OrderType::ASCENDING : OrderType::DESCENDING; @@ -53,8 +54,8 @@ PhysicalIEJoin::PhysicalIEJoin(PhysicalPlan &physical_plan, LogicalComparisonJoi for (idx_t i = 2; i < conditions.size(); ++i) { auto &cond = conditions[i]; - D_ASSERT(cond.left->return_type == cond.right->return_type); - join_key_types.push_back(cond.left->return_type); + D_ASSERT(cond.GetLHS().return_type == cond.GetRHS().return_type); + join_key_types.push_back(cond.GetLHS().return_type); } } @@ -327,16 +328,16 @@ class IEJoinGlobalSourceState : public GlobalSourceState { //! Stop producing tasks atomic stopped; //! The number of completed tasks for each stage - array, size_t(IEJoinSourceStage::DONE)> completed; + array, static_cast(IEJoinSourceStage::DONE)> completed; //! L1 unique_ptr l1; //! L2 unique_ptr l2; //! Li - vector li; + unsafe_vector li; //! P - vector p; + unsafe_vector p; // Join queue state idx_t l2_blocks = 0; @@ -386,8 +387,8 @@ struct IEJoinUnion { const ChunkRange &range); template - static vector ExtractColumn(SortedTable &table, idx_t col_idx) { - vector result; + static void ExtractColumn(SortedTable &table, idx_t col_idx, unsafe_vector &result) { + result.clear(); result.reserve(table.count); auto &collection = *table.sorted->payload_data; @@ -400,13 +401,9 @@ struct IEJoinUnion { while (collection.Scan(state, payload)) { const auto count = payload.size(); - const auto data_ptr = FlatVector::GetData(payload.data[0]); - for (idx_t i = 0; i < count; i++) { - result.push_back(UnsafeNumericCast(data_ptr[i])); - } + const auto data_ptr = reinterpret_cast(FlatVector::GetData(payload.data[0])); + result.insert(result.end(), data_ptr, data_ptr + count); } - - return result; } class UnionIterator { @@ -422,11 +419,27 @@ struct IEJoinUnion { index = i; } + inline idx_t GetChunkIndex() const { + idx_t chunk_idx; + idx_t tuple_idx; + state->RandomAccess(chunk_idx, tuple_idx, index); + return chunk_idx; + } + + inline void SetChunkIndex(idx_t chunk_idx) { + index = state->GetDivisor() * chunk_idx; + } + UnionIterator &operator++() { ++index; return *this; } + void Repin() { + state->SetKeepPinned(true); + state->SetPinPayload(true); + } + unique_ptr state; idx_t index = 0; const bool strict; @@ -446,7 +459,7 @@ struct IEJoinUnion { IEJoinGlobalSourceState &gsource; //! Inverted loop - idx_t JoinComplexBlocks(vector &lsel, vector &rsel); + idx_t JoinComplexBlocks(unsafe_vector &lsel, unsafe_vector &rsel); //! B vector bit_array; @@ -462,8 +475,6 @@ struct IEJoinUnion { idx_t i; idx_t n_j; idx_t j; - unique_ptr op1; - unique_ptr off1; unique_ptr op2; unique_ptr off2; int64_t lrid; @@ -548,10 +559,6 @@ idx_t IEJoinUnion::AppendKey(ExecutionContext &context, InterruptState &interrup IEJoinUnion::IEJoinUnion(IEJoinGlobalSourceState &gsource, const ChunkRange &chunks) : gsource(gsource), n(0), i(0) { auto &op = gsource.op; - auto &l1 = *gsource.l1; - const auto strict1 = IsStrictComparison(op.conditions[0].comparison); - op1 = make_uniq(l1, strict1); - off1 = make_uniq(l1, strict1); // 7. initialize bit-array B (|B| = n), and set all bits to 0 auto &l2 = *gsource.l2; @@ -565,7 +572,7 @@ IEJoinUnion::IEJoinUnion(IEJoinGlobalSourceState &gsource, const ChunkRange &chu bloom_filter.Initialize(bloom_array.data(), bloom_count); // 11. for(i←1 to n) do - const auto strict2 = IsStrictComparison(op.conditions[1].comparison); + const auto strict2 = IsStrictComparison(op.conditions[1].GetComparisonType()); op2 = make_uniq(l2, strict2); off2 = make_uniq(l2, strict2); n = l2.BlockStart(chunks.second); @@ -620,6 +627,7 @@ bool IEJoinUnion::NextRow() { auto &li = gsource.li; auto &p = gsource.p; + auto pinned_idx = off2->GetChunkIndex(); for (; i < n; ++i) { // 12. pos ← P[i] auto pos = p[i]; @@ -631,14 +639,19 @@ bool IEJoinUnion::NextRow() { // 16. B[pos] ← 1 op2->SetIndex(i); for (; off2->GetIndex() < n_j; ++(*off2)) { + // Prevent buildup of pinned blocks + if (off2->GetChunkIndex() != pinned_idx) { + off2->Repin(); + pinned_idx = off2->GetChunkIndex(); + } if (!Compare(off2_itr[off2->GetIndex()], op2_itr[op2->GetIndex()], strict)) { break; } const auto p2 = p[off2->GetIndex()]; if (li[p2] < 0) { // Only mark rhs matches. - bit_mask.SetValid(p2); - bloom_filter.SetValid(p2 / BLOOM_CHUNK_BITS); + bit_mask.SetValidUnsafe(p2); + bloom_filter.SetValidUnsafe(p2 / BLOOM_CHUNK_BITS); } } @@ -664,44 +677,61 @@ static idx_t NextValid(const ValidityMask &bits, idx_t j, const idx_t n) { // which gives 64:1. idx_t entry_idx, idx_in_entry; bits.GetEntryIndex(j, entry_idx, idx_in_entry); - auto entry = bits.GetValidityEntry(entry_idx++); - // Trim the bits before the start position - entry &= (ValidityMask::ValidityBuffer::MAX_ENTRY << idx_in_entry); + // Copy first entry to local and trim the bits before the start position + auto first_entry = bits.GetValidityEntryUnsafe(entry_idx++); + first_entry &= (ValidityMask::ValidityBuffer::MAX_ENTRY << idx_in_entry); - // Check the non-ragged entries - for (const auto entry_count = bits.EntryCount(n); entry_idx < entry_count; ++entry_idx) { - if (entry) { - for (; idx_in_entry < bits.BITS_PER_VALUE; ++idx_in_entry, ++j) { - if (bits.RowIsValid(entry, idx_in_entry)) { - return j; - } + // If the first entry has a valid bit, we can return immediately + if (first_entry) { + return j + CountZeros::Trailing(first_entry) - idx_in_entry; + } + + // The first entry did not have a valid bit + j += ValidityMask::BITS_PER_VALUE - idx_in_entry; + + // Loop over non-ragged entries + const auto entry_count_minus_one = bits.EntryCount(n) - 1; + const auto entry_idx_before = entry_idx; + + // The compiler has a hard time optimizing this loop for some reason + // Creating a static inner loop like this improves performance by almost 2x + static constexpr idx_t NEXT_VALID_UNROLL = 8; + for (; entry_idx + NEXT_VALID_UNROLL < entry_count_minus_one; entry_idx += NEXT_VALID_UNROLL) { + for (idx_t unroll_idx = 0; unroll_idx < NEXT_VALID_UNROLL; unroll_idx++) { + const auto unroll_entry_idx = entry_idx + unroll_idx; + const auto &entry = bits.GetValidityEntryUnsafe(unroll_entry_idx); + if (entry) { + return j + (unroll_entry_idx - entry_idx_before) * ValidityMask::BITS_PER_VALUE + + CountZeros::Trailing(entry); } - } else { - j += bits.BITS_PER_VALUE - idx_in_entry; } - - entry = bits.GetValidityEntry(entry_idx); - idx_in_entry = 0; } - // Check the final entry - for (; j < n; ++idx_in_entry, ++j) { - if (bits.RowIsValid(entry, idx_in_entry)) { - return j; + for (; entry_idx < entry_count_minus_one; ++entry_idx) { + const auto &entry = bits.GetValidityEntryUnsafe(entry_idx); + if (entry) { + return j + (entry_idx - entry_idx_before) * ValidityMask::BITS_PER_VALUE + + CountZeros::Trailing(entry); } } - return j; + // Update j once after the loop so we don't have to update it in each iteration + j += (entry_idx - entry_idx_before) * ValidityMask::BITS_PER_VALUE; + + // Check the final entry + return j > n ? n : j + CountZeros::Trailing(bits.GetValidityEntryUnsafe(entry_idx)); } -idx_t IEJoinUnion::JoinComplexBlocks(vector &lsel, vector &rsel) { - auto &li = gsource.li; +idx_t IEJoinUnion::JoinComplexBlocks(unsafe_vector &lsel, unsafe_vector &rsel) { + const auto &li = gsource.li; + + // Release pinned blocks + op2->Repin(); + off2->Repin(); // 8. initialize join result as an empty list for tuple pairs idx_t result_count = 0; - lsel.resize(0); - rsel.resize(0); // 11. for(i←1 to n) do while (i < n) { @@ -731,8 +761,8 @@ idx_t IEJoinUnion::JoinComplexBlocks(vector &lsel, vector &rsel) { D_ASSERT(lrid > 0 && rrid < 0); // 15. add tuples w.r.t. (L1[j], L1[i]) to join result - lsel.emplace_back(idx_t(+lrid - 1)); - rsel.emplace_back(idx_t(-rrid - 1)); + lsel[result_count] = static_cast(+lrid - 1); + rsel[result_count] = static_cast(-rrid - 1); ++result_count; if (result_count == STANDARD_VECTOR_SIZE) { // out of space! @@ -804,7 +834,7 @@ IEJoinGlobalSourceState::IEJoinGlobalSourceState(const PhysicalIEJoin &op, Clien // Using this OrderType, if i < j then value[i] (from left table) and value[j] (from right table) match // the condition (t1.time <= t2.time or t1.time < t2.time), then from_left will force them into the correct order. auto from_left = make_uniq(Value::BOOLEAN(true)); - const auto strict1 = IEJoinUnion::IsStrictComparison(op.conditions[0].comparison); + const auto strict1 = IEJoinUnion::IsStrictComparison(op.conditions[0].GetComparisonType()); orders.emplace_back(!strict1 ? OrderType::DESCENDING : OrderType::ASCENDING, OrderByNullType::ORDER_DEFAULT, std::move(from_left)); @@ -841,7 +871,7 @@ void IEJoinGlobalSourceState::ExecuteLiTask(ClientContext &client) { // We don't actually need the L1 column, just its sort key, which is in the sort blocks l1->GetSortedRun(client); - li = IEJoinUnion::ExtractColumn(*l1, 1); + IEJoinUnion::ExtractColumn(*l1, 1, li); } void IEJoinGlobalSourceState::ExecutePermutationTask(ClientContext &client) { @@ -849,7 +879,7 @@ void IEJoinGlobalSourceState::ExecutePermutationTask(ClientContext &client) { l2->GetSortedRun(client); // 6. compute the permutation array P of L2 w.r.t. L1 - p = IEJoinUnion::ExtractColumn(*l2, 0); + IEJoinUnion::ExtractColumn(*l2, 0, p); } class IEJoinLocalSourceState : public LocalSourceState { @@ -859,7 +889,8 @@ class IEJoinLocalSourceState : public LocalSourceState { IEJoinLocalSourceState(ClientContext &client, IEJoinGlobalSourceState &gsource) : gsource(gsource), lsel(STANDARD_VECTOR_SIZE), rsel(STANDARD_VECTOR_SIZE), true_sel(STANDARD_VECTOR_SIZE), - left_executor(client), right_executor(client), left_matches(nullptr), right_matches(nullptr) + left_executor(client), right_executor(client), pred_executor(client), left_matches(nullptr), + right_matches(nullptr) { auto &op = gsource.op; @@ -881,6 +912,11 @@ class IEJoinLocalSourceState : public LocalSourceState { left_scan_state = left_table.CreateScanState(client); right_scan_state = right_table.CreateScanState(client); + if (op.predicate) { + pred_executor.AddExpression(*op.predicate); + pred_matches.Initialize(); + } + if (op.conditions.size() < 3) { return; } @@ -890,11 +926,11 @@ class IEJoinLocalSourceState : public LocalSourceState { for (idx_t i = 2; i < op.conditions.size(); ++i) { const auto &cond = op.conditions[i]; - left_types.push_back(cond.left->return_type); - left_executor.AddExpression(*cond.left); + left_types.push_back(cond.GetLHS().return_type); + left_executor.AddExpression(cond.GetLHS()); - right_types.push_back(cond.left->return_type); - right_executor.AddExpression(*cond.right); + right_types.push_back(cond.GetLHS().return_type); + right_executor.AddExpression(cond.GetRHS()); } left_keys.Initialize(allocator, left_types); @@ -957,7 +993,7 @@ class IEJoinLocalSourceState : public LocalSourceState { idx_t left_block_index; unique_ptr left_iterator; TupleDataChunkState left_chunk_state; - vector lsel; + unsafe_vector lsel; DataChunk lpayload; unique_ptr left_scan_state; @@ -965,7 +1001,7 @@ class IEJoinLocalSourceState : public LocalSourceState { idx_t right_block_index; unique_ptr right_iterator; TupleDataChunkState right_chunk_state; - vector rsel; + unsafe_vector rsel; DataChunk rpayload; unique_ptr right_scan_state; @@ -980,8 +1016,12 @@ class IEJoinLocalSourceState : public LocalSourceState { DataChunk unprojected; + //! Arbitrary expressions + ExpressionExecutor pred_executor; + SelectionVector pred_matches; + // Outer joins - vector outer_sel; + unsafe_vector outer_sel; idx_t outer_idx; idx_t outer_count; bool *left_matches; @@ -1221,8 +1261,8 @@ void IEJoinLocalSourceState::ResolveComplexJoin(ExecutionContext &context, DataC left.Slice(*sel, tail_count); right.Slice(*sel, tail_count); } - tail_count = - op.SelectJoinTail(conditions[cmp_idx + 2].comparison, left, right, sel, tail_count, match_sel); + tail_count = op.SelectJoinTail(conditions[cmp_idx + 2].GetComparisonType(), left, right, sel, + tail_count, match_sel); sel = match_sel; } @@ -1244,6 +1284,13 @@ void IEJoinLocalSourceState::ResolveComplexJoin(ExecutionContext &context, DataC } chunk.SetCardinality(result_count); + // Apply any arbitrary predicate + if (op.predicate) { + result_count = pred_executor.SelectExpression(chunk, pred_matches); + chunk.Slice(pred_matches, result_count); + sel = &pred_matches; + } + // We need all of the data to compute other predicates, // but we only return what is in the projection map op.ProjectResult(chunk, result); diff --git a/src/duckdb/src/execution/operator/join/physical_nested_loop_join.cpp b/src/duckdb/src/execution/operator/join/physical_nested_loop_join.cpp index 511571854..ed92f1aea 100644 --- a/src/duckdb/src/execution/operator/join/physical_nested_loop_join.cpp +++ b/src/duckdb/src/execution/operator/join/physical_nested_loop_join.cpp @@ -9,12 +9,11 @@ namespace duckdb { PhysicalNestedLoopJoin::PhysicalNestedLoopJoin(PhysicalPlan &physical_plan, LogicalComparisonJoin &op, PhysicalOperator &left, PhysicalOperator &right, - vector cond, JoinType join_type, + vector conds, JoinType join_type, idx_t estimated_cardinality, unique_ptr pushdown_info_p) - : PhysicalComparisonJoin(physical_plan, op, PhysicalOperatorType::NESTED_LOOP_JOIN, std::move(cond), join_type, - estimated_cardinality), - predicate(std::move(op.predicate)) { + : PhysicalComparisonJoin(physical_plan, op, PhysicalOperatorType::NESTED_LOOP_JOIN, std::move(conds), join_type, + estimated_cardinality) { filter_pushdown = std::move(pushdown_info_p); children.push_back(left); children.push_back(right); @@ -122,17 +121,27 @@ bool PhysicalNestedLoopJoin::IsSupported(const vector &conditions return true; } for (auto &cond : conditions) { - if (cond.left->return_type.InternalType() == PhysicalType::STRUCT || - cond.left->return_type.InternalType() == PhysicalType::LIST || - cond.left->return_type.InternalType() == PhysicalType::ARRAY) { + if (!cond.IsComparison()) { + continue; + } + if (cond.GetLHS().return_type.InternalType() == PhysicalType::STRUCT || + cond.GetLHS().return_type.InternalType() == PhysicalType::LIST || + cond.GetLHS().return_type.InternalType() == PhysicalType::ARRAY) { return false; } } + // To avoid situations like https://github.com/duckdb/duckdb/issues/10046 // If there is an equality in the conditions, a hash join is planned // with one condition, we can use mark join logic, otherwise we should use physical blockwise nl join if (join_type == JoinType::SEMI || join_type == JoinType::ANTI) { - return conditions.size() == 1; + idx_t comparison_count = 0; + for (auto &cond : conditions) { + if (cond.IsComparison()) { + comparison_count++; + } + } + return comparison_count == 1; } return true; } @@ -174,8 +183,8 @@ class NestedLoopJoinLocalState : public LocalSinkState { : rhs_executor(context) { vector condition_types; for (auto &cond : op.conditions) { - rhs_executor.AddExpression(*cond.right); - condition_types.push_back(cond.right->return_type); + rhs_executor.AddExpression(cond.GetRHS()); + condition_types.push_back(cond.GetRHS().return_type); } right_condition.Initialize(Allocator::Get(context), condition_types); @@ -194,8 +203,8 @@ class NestedLoopJoinLocalState : public LocalSinkState { vector PhysicalNestedLoopJoin::GetJoinTypes() const { vector result; - for (auto &op : conditions) { - result.push_back(op.right->return_type); + for (auto &cond : conditions) { + result.push_back(cond.GetRHS().return_type); } return result; } @@ -276,8 +285,8 @@ class PhysicalNestedLoopJoinState : public CachingOperatorState { left_outer(IsLeftOuterJoin(op.join_type)), pred_executor(context) { vector condition_types; for (auto &cond : conditions) { - lhs_executor.AddExpression(*cond.left); - condition_types.push_back(cond.left->return_type); + lhs_executor.AddExpression(cond.GetLHS()); + condition_types.push_back(cond.GetLHS().return_type); } auto &allocator = Allocator::Get(context); left_condition.Initialize(allocator, condition_types); diff --git a/src/duckdb/src/execution/operator/join/physical_piecewise_merge_join.cpp b/src/duckdb/src/execution/operator/join/physical_piecewise_merge_join.cpp index 30cd49558..ef746ab56 100644 --- a/src/duckdb/src/execution/operator/join/physical_piecewise_merge_join.cpp +++ b/src/duckdb/src/execution/operator/join/physical_piecewise_merge_join.cpp @@ -19,13 +19,13 @@ PhysicalPiecewiseMergeJoin::PhysicalPiecewiseMergeJoin(PhysicalPlan &physical_pl : PhysicalRangeJoin(physical_plan, op, PhysicalOperatorType::PIECEWISE_MERGE_JOIN, left, right, std::move(cond), join_type, estimated_cardinality, std::move(pushdown_info_p)) { for (auto &join_cond : conditions) { - D_ASSERT(join_cond.left->return_type == join_cond.right->return_type); - join_key_types.push_back(join_cond.left->return_type); + D_ASSERT(join_cond.GetLHS().return_type == join_cond.GetRHS().return_type); + join_key_types.push_back(join_cond.GetLHS().return_type); // Convert the conditions to sort orders - auto left_expr = join_cond.left->Copy(); - auto right_expr = join_cond.right->Copy(); - switch (join_cond.comparison) { + auto left_expr = join_cond.GetLHS().Copy(); + auto right_expr = join_cond.GetRHS().Copy(); + switch (join_cond.GetComparisonType()) { case ExpressionType::COMPARE_LESSTHAN: case ExpressionType::COMPARE_LESSTHANOREQUALTO: lhs_orders.emplace_back(OrderType::ASCENDING, OrderByNullType::NULLS_LAST, std::move(left_expr)); @@ -190,7 +190,7 @@ class PiecewiseMergeJoinState : public CachingOperatorState { PiecewiseMergeJoinState(ClientContext &client, const PhysicalPiecewiseMergeJoin &op) : client(client), allocator(Allocator::Get(client)), op(op), left_outer(IsLeftOuterJoin(op.join_type)), left_position(0), first_fetch(true), finished(true), right_position(0), right_chunk_index(0), - rhs_executor(client) { + rhs_executor(client), pred_executor(client) { left_outer.Initialize(STANDARD_VECTOR_SIZE); lhs_payload.Initialize(client, op.children[0].get().GetTypes()); @@ -215,6 +215,11 @@ class PiecewiseMergeJoinState : public CachingOperatorState { // Since we have now materialized the payload, the keys will not have payloads? sort_key_type = rhs_table.GetSortKeyType(); + + if (op.predicate) { + pred_executor.AddExpression(*op.predicate); + pred_matches.Initialize(); + } } ClientContext &client; @@ -251,6 +256,10 @@ class PiecewiseMergeJoinState : public CachingOperatorState { DataChunk rhs_input; ExpressionExecutor rhs_executor; + //! Arbitrary expressions + ExpressionExecutor pred_executor; + SelectionVector pred_matches; + public: void ResolveJoinKeys(ExecutionContext &context, DataChunk &input) { // sort by join key @@ -404,7 +413,7 @@ void PhysicalPiecewiseMergeJoin::ResolveSimpleJoin(ExecutionContext &context, Da // perform the actual join bool found_match[STANDARD_VECTOR_SIZE]; memset(found_match, 0, sizeof(found_match)); - MergeJoinSimpleBlocks(state, gstate, found_match, conditions[0].comparison); + MergeJoinSimpleBlocks(state, gstate, found_match, conditions[0].GetComparisonType()); // use the sorted payload const auto lhs_not_null = lhs_table.count - lhs_table.has_null; @@ -453,7 +462,7 @@ struct ChunkMergeInfo { //! The left chunk offsets that match SelectionVector lhs; //! The right table offsets that match - vector rhs; + unsafe_vector rhs; ChunkMergeInfo(ExternalBlockIteratorState &state, idx_t block_idx, idx_t &entry_idx, idx_t not_null) : state(state), block_idx(block_idx), not_null(not_null), entry_idx(entry_idx), lhs(STANDARD_VECTOR_SIZE) { @@ -599,7 +608,7 @@ OperatorResultType PhysicalPiecewiseMergeJoin::ResolveComplexJoin(ExecutionConte rhs_table.Repin(rhs_iterator); idx_t result_count = MergeJoinComplexBlocks(state.sort_key_type, left_info, right_info, - conditions[0].comparison, state.prev_left_index); + conditions[0].GetComparisonType(), state.prev_left_index); if (result_count == 0) { // exhausted this chunk on the right side // move to the next right chunk @@ -645,8 +654,8 @@ OperatorResultType PhysicalPiecewiseMergeJoin::ResolveComplexJoin(ExecutionConte left.Slice(*sel, tail_count); right.Slice(*sel, tail_count); } - tail_count = - SelectJoinTail(conditions[cmp_idx].comparison, left, right, sel, tail_count, &state.sel); + tail_count = SelectJoinTail(conditions[cmp_idx].GetComparisonType(), left, right, sel, tail_count, + &state.sel); sel = &state.sel; } @@ -660,6 +669,14 @@ OperatorResultType PhysicalPiecewiseMergeJoin::ResolveComplexJoin(ExecutionConte } } } + chunk.SetCardinality(result_count); + + // Apply any arbitrary predicate + if (predicate) { + result_count = state.pred_executor.SelectExpression(chunk, state.pred_matches); + chunk.Slice(state.pred_matches, result_count); + sel = &state.pred_matches; + } // found matches: mark the found matches if required if (state.left_outer.Enabled()) { @@ -673,7 +690,6 @@ OperatorResultType PhysicalPiecewiseMergeJoin::ResolveComplexJoin(ExecutionConte gstate.table->found_match[state.right_base + right_info.rhs[sel->get_index(i)]] = true; } } - chunk.SetCardinality(result_count); chunk.Verify(); } } while (chunk.size() == 0); diff --git a/src/duckdb/src/execution/operator/join/physical_range_join.cpp b/src/duckdb/src/execution/operator/join/physical_range_join.cpp index 7b324c3d9..9b9b3c04d 100644 --- a/src/duckdb/src/execution/operator/join/physical_range_join.cpp +++ b/src/duckdb/src/execution/operator/join/physical_range_join.cpp @@ -22,10 +22,10 @@ PhysicalRangeJoin::LocalSortedTable::LocalSortedTable(ExecutionContext &context, const auto &op = global_table.op; vector types; for (const auto &cond : op.conditions) { - const auto &expr = child ? cond.right : cond.left; - executor.AddExpression(*expr); + const auto &expr = child ? cond.GetRHS() : cond.GetLHS(); + executor.AddExpression(expr); - types.push_back(expr->return_type); + types.push_back(expr.return_type); } auto &allocator = Allocator::Get(context.client); keys.Initialize(allocator, types); @@ -155,6 +155,7 @@ class RangeJoinMaterializeTask : public ExecutorTask { if (!table.sorted) { table.MaterializeEmpty(execution.client); } + table.global_source.reset(); } event->FinishTask(); @@ -221,6 +222,7 @@ void PhysicalRangeJoin::GlobalSortedTable::GetSortedRun(ClientContext &client) { if (!sorted) { MaterializeEmpty(client); } + global_source.reset(); } void PhysicalRangeJoin::GlobalSortedTable::Materialize(ExecutionContext &context, InterruptState &interrupt) { @@ -244,7 +246,7 @@ PhysicalRangeJoin::PhysicalRangeJoin(PhysicalPlan &physical_plan, LogicalCompari idx_t range_position = 0; idx_t other_position = conditions_p.size(); for (idx_t i = 0; i < conditions_p.size(); ++i) { - switch (conditions_p[i].comparison) { + switch (conditions_p[i].GetComparisonType()) { case ExpressionType::COMPARE_LESSTHAN: case ExpressionType::COMPARE_LESSTHANOREQUALTO: case ExpressionType::COMPARE_GREATERTHAN: @@ -316,7 +318,7 @@ idx_t PhysicalRangeJoin::LocalSortedTable::MergeNulls(Vector &primary, const vec } for (size_t c = 1; c < keys.data.size(); ++c) { // Skip comparisons that accept NULLs - if (conditions[c].comparison == ExpressionType::COMPARE_DISTINCT_FROM) { + if (conditions[c].GetComparisonType() == ExpressionType::COMPARE_DISTINCT_FROM) { continue; } auto &v = keys.data[c]; @@ -341,7 +343,7 @@ idx_t PhysicalRangeJoin::LocalSortedTable::MergeNulls(Vector &primary, const vec D_ASSERT(keys.ColumnCount() == conditions.size()); for (size_t c = 1; c < keys.data.size(); ++c) { // Skip comparisons that accept NULLs - if (conditions[c].comparison == ExpressionType::COMPARE_DISTINCT_FROM) { + if (conditions[c].GetComparisonType() == ExpressionType::COMPARE_DISTINCT_FROM) { continue; } // ToUnifiedFormat the rest, as the sort code will do this anyway. @@ -403,7 +405,7 @@ template static void TemplatedSliceSortedPayload(DataChunk &chunk, const SortedRun &sorted_run, ExternalBlockIteratorState &state, Vector &sort_key_pointers, SortedRunScanState &scan_state, const idx_t chunk_idx, - const vector &result) { + const unsafe_vector &result) { using SORT_KEY = SortKey; using BLOCK_ITERATOR = block_iterator_t; BLOCK_ITERATOR itr(state, chunk_idx, 0); @@ -421,7 +423,7 @@ static void TemplatedSliceSortedPayload(DataChunk &chunk, const SortedRun &sorte void PhysicalRangeJoin::SliceSortedPayload(DataChunk &chunk, GlobalSortedTable &table, ExternalBlockIteratorState &state, TupleDataChunkState &chunk_state, - const idx_t chunk_idx, const vector &result, + const idx_t chunk_idx, const unsafe_vector &result, SortedRunScanState &scan_state) { auto &sorted = *table.sorted; auto &sort_keys = chunk_state.row_locations; diff --git a/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp b/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp index f3b91b8dc..0bf04317d 100644 --- a/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp +++ b/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp @@ -120,7 +120,11 @@ class CopyToFunctionGlobalState : public GlobalSinkState { string p_dir; p_dir += HivePartitioning::Escape(partition_col_name); p_dir += "="; - p_dir += HivePartitioning::Escape(partition_value.ToString()); + if (partition_value.IsNull()) { + p_dir += "__HIVE_DEFAULT_PARTITION__"; + } else { + p_dir += HivePartitioning::Escape(partition_value.ToString()); + } path = fs.JoinPath(path, p_dir); CreateDir(path, fs); } @@ -679,23 +683,25 @@ unique_ptr PhysicalCopyToFile::GetGlobalSourceState(ClientCon return make_uniq(); } -void PhysicalCopyToFile::ReturnStatistics(DataChunk &chunk, idx_t row_idx, CopyToFileInfo &info) { - auto &file_stats = *info.file_stats; +namespace { - // filename VARCHAR - chunk.SetValue(0, row_idx, info.file_path); - // count BIGINT - chunk.SetValue(1, row_idx, Value::UBIGINT(file_stats.row_count)); - // file size bytes BIGINT - chunk.SetValue(2, row_idx, Value::UBIGINT(file_stats.file_size_bytes)); - // footer size bytes BIGINT - chunk.SetValue(3, row_idx, file_stats.footer_size_bytes); - // column statistics map(varchar, map(varchar, varchar)) +struct ColumnStatsMapData { + vector keys; + vector values; +}; + +} // namespace + +static ColumnStatsMapData +CreateColumnStatistics(const case_insensitive_map_t> &column_statistics) { + ColumnStatsMapData result; + + //! Use a map to make sure the result has a consistent ordering map stats; - for (auto &entry : file_stats.column_statistics) { + for (auto &entry : column_statistics) { map per_column_stats; for (auto &stats_entry : entry.second) { - per_column_stats.insert(make_pair(stats_entry.first, stats_entry.second)); + per_column_stats.emplace(stats_entry.first, stats_entry.second); } vector stats_keys; vector stats_values; @@ -705,16 +711,32 @@ void PhysicalCopyToFile::ReturnStatistics(DataChunk &chunk, idx_t row_idx, CopyT } auto map_value = Value::MAP(LogicalType::VARCHAR, LogicalType::VARCHAR, std::move(stats_keys), std::move(stats_values)); - stats.insert(make_pair(entry.first, std::move(map_value))); + stats.emplace(entry.first, std::move(map_value)); } - vector keys; - vector values; for (auto &entry : stats) { - keys.emplace_back(entry.first); - values.emplace_back(std::move(entry.second)); + result.keys.emplace_back(entry.first); + result.values.emplace_back(std::move(entry.second)); } + return result; +} + +void PhysicalCopyToFile::ReturnStatistics(DataChunk &chunk, idx_t row_idx, CopyToFileInfo &info) { + auto &file_stats = *info.file_stats; + + // filename VARCHAR + chunk.SetValue(0, row_idx, info.file_path); + // count BIGINT + chunk.SetValue(1, row_idx, Value::UBIGINT(file_stats.row_count)); + // file size bytes BIGINT + chunk.SetValue(2, row_idx, Value::UBIGINT(file_stats.file_size_bytes)); + // footer size bytes BIGINT + chunk.SetValue(3, row_idx, file_stats.footer_size_bytes); + // column statistics map(varchar, map(varchar, varchar)) + auto column_stats = CreateColumnStatistics(file_stats.column_statistics); auto map_val_type = LogicalType::MAP(LogicalType::VARCHAR, LogicalType::VARCHAR); - chunk.SetValue(4, row_idx, Value::MAP(LogicalType::VARCHAR, map_val_type, std::move(keys), std::move(values))); + chunk.SetValue( + 4, row_idx, + Value::MAP(LogicalType::VARCHAR, map_val_type, std::move(column_stats.keys), std::move(column_stats.values))); // partition_keys map(varchar, varchar) chunk.SetValue(5, row_idx, info.partition_keys); diff --git a/src/duckdb/src/execution/operator/persistent/physical_delete.cpp b/src/duckdb/src/execution/operator/persistent/physical_delete.cpp index 4e01e5c84..0ade93df0 100644 --- a/src/duckdb/src/execution/operator/persistent/physical_delete.cpp +++ b/src/duckdb/src/execution/operator/persistent/physical_delete.cpp @@ -77,75 +77,21 @@ SinkResultType PhysicalDelete::Sink(ExecutionContext &context, DataChunk &chunk, l_state.delete_chunk.Reset(); row_ids.Flatten(chunk.size()); - // Check if we can use columns from the input chunk (passed through from the scan) - // instead of fetching them by row ID - bool use_input_columns = !return_columns.empty(); - - if (use_input_columns) { - // Use columns from the input chunk - they were passed through from the scan - // Only physical columns are passed; generated columns are computed in the RETURNING projection - for (idx_t i = 0; i < table.ColumnCount(); i++) { - D_ASSERT(return_columns[i] != DConstants::INVALID_INDEX); + // Use columns from the input chunk - they were passed through from the scan + // return_columns maps storage_idx -> chunk_idx + // For RETURNING: all columns have valid indices + // For index-only: only indexed columns have valid indices (sparse mapping) + D_ASSERT(!return_columns.empty() && "return_columns should always be populated for RETURNING or unique indexes"); + for (idx_t i = 0; i < table.ColumnCount(); i++) { + if (return_columns[i] != DConstants::INVALID_INDEX) { + // Column was passed through from the scan l_state.delete_chunk.data[i].Reference(chunk.data[return_columns[i]]); - } - l_state.delete_chunk.SetCardinality(chunk.size()); - } else { - // Fall back to fetching columns by row ID - // This path is used when: - // - Unique indexes exist but no RETURNING (need indexed columns for delete tracking) - // - MERGE INTO operations (optimization not implemented there yet) - auto &transaction = DuckTransaction::Get(context.client, table.db); - auto to_be_fetched = vector(types.size(), return_chunk); - vector column_ids; - vector column_types; - - if (return_chunk) { - // Fetch all columns. - column_types = types; - for (idx_t i = 0; i < table.ColumnCount(); i++) { - column_ids.emplace_back(i); - } } else { - // Fetch only the required columns for updating the delete indexes. - auto &local_storage = LocalStorage::Get(context.client, table.db); - auto storage = local_storage.GetStorage(table); - unordered_set indexed_column_id_set; - storage->delete_indexes.Scan([&](Index &index) { - if (!index.IsBound() || !index.IsUnique()) { - return false; - } - auto &set = index.GetColumnIdSet(); - indexed_column_id_set.insert(set.begin(), set.end()); - return false; - }); - for (auto &col : indexed_column_id_set) { - column_ids.emplace_back(col); - } - sort(column_ids.begin(), column_ids.end()); - for (auto &col : column_ids) { - auto i = col.GetPrimaryIndex(); - to_be_fetched[i] = true; - column_types.push_back(types[i]); - } - } - - // Fetch the to-be-deleted chunk. - DataChunk fetch_chunk; - fetch_chunk.Initialize(Allocator::Get(context.client), column_types, chunk.size()); - auto fetch_state = ColumnFetchState(); - table.Fetch(transaction, fetch_chunk, column_ids, row_ids, chunk.size(), fetch_state); - - // Reference the necessary columns of the fetch_chunk. - idx_t fetch_idx = 0; - for (idx_t i = 0; i < table.ColumnCount(); i++) { - if (to_be_fetched[i]) { - l_state.delete_chunk.data[i].Reference(fetch_chunk.data[fetch_idx++]); - continue; - } + // Column not in scan (sparse mapping for index-only case) - use NULL placeholder l_state.delete_chunk.data[i].Reference(Value(types[i])); } - l_state.delete_chunk.SetCardinality(fetch_chunk); } + l_state.delete_chunk.SetCardinality(chunk.size()); // Append the deleted row IDs to the delete indexes. // If we only delete local row IDs, then the delete_chunk is empty. diff --git a/src/duckdb/src/execution/operator/set/physical_recursive_cte.cpp b/src/duckdb/src/execution/operator/set/physical_recursive_cte.cpp index 1fd840709..417ae6d6d 100644 --- a/src/duckdb/src/execution/operator/set/physical_recursive_cte.cpp +++ b/src/duckdb/src/execution/operator/set/physical_recursive_cte.cpp @@ -176,6 +176,20 @@ SourceResultType PhysicalRecursiveCTE::GetDataInternal(ExecutionContext &context // Append the result to the recurring table. recurring_table->Append(result); } + } else if (ref_recurring && gstate.intermediate_table.Count() != 0) { + // we need to populate the recurring table from the intermediate table + // careful: we can not just use Combine here, because this destroys the intermediate table + // instead we need to scan and append to create a copy + // Note: as we are in the "normal" recursion case here, not the USING KEY case, + // we can just scan the intermediate table directly, instead of going through the HT + ColumnDataScanState scan_state; + gstate.intermediate_table.InitializeScan(scan_state); + DataChunk result; + result.Initialize(Allocator::DefaultAllocator(), chunk.GetTypes()); + + while (gstate.intermediate_table.Scan(scan_state, result)) { + recurring_table->Append(result); + } } working_table->Reset(); diff --git a/src/duckdb/src/execution/physical_plan/plan_asof_join.cpp b/src/duckdb/src/execution/physical_plan/plan_asof_join.cpp index 909921504..eea179868 100644 --- a/src/duckdb/src/execution/physical_plan/plan_asof_join.cpp +++ b/src/duckdb/src/execution/physical_plan/plan_asof_join.cpp @@ -9,15 +9,33 @@ #include "duckdb/function/aggregate/distributive_function_utils.hpp" #include "duckdb/execution/physical_plan_generator.hpp" #include "duckdb/function/function_binder.hpp" -#include "duckdb/main/client_context.hpp" +#include "duckdb/planner/binder.hpp" #include "duckdb/planner/expression/bound_constant_expression.hpp" #include "duckdb/planner/expression/bound_reference_expression.hpp" #include "duckdb/planner/expression/bound_window_expression.hpp" #include "duckdb/planner/expression_iterator.hpp" #include "duckdb/main/settings.hpp" +#include "duckdb/planner/expression/bound_conjunction_expression.hpp" namespace duckdb { +//! Create a combined predicate expression from non-comparison conditions +static unique_ptr CreatePredicateFromConditions(const vector &conditions) { + unique_ptr predicate; + for (const auto &cond : conditions) { + if (!cond.IsComparison()) { + auto expr = cond.GetJoinExpression().Copy(); + if (!predicate) { + predicate = std::move(expr); + } else { + predicate = make_uniq(ExpressionType::CONJUNCTION_AND, std::move(predicate), + std::move(expr)); + } + } + } + return predicate; +} + optional_ptr PhysicalPlanGenerator::PlanAsOfLoopJoin(LogicalComparisonJoin &op, PhysicalOperator &probe, PhysicalOperator &build) { // Plan a inverse nested loop join, then aggregate the values to choose the optimal match for each probe row. @@ -65,23 +83,23 @@ PhysicalPlanGenerator::PlanAsOfLoopJoin(LogicalComparisonJoin &op, PhysicalOpera } // Remap predicate column references. - if (op.predicate) { - vector swap_projection_map; + auto predicate = CreatePredicateFromConditions(op.conditions); + if (predicate) { + const auto lhs_width = op.children[0]->types.size(); const auto rhs_width = op.children[1]->types.size(); - for (const auto &l : join_op.right_projection_map) { - swap_projection_map.emplace_back(l + rhs_width); - } - for (const auto &r : join_op.left_projection_map) { - swap_projection_map.emplace_back(r); - } - join_op.predicate = op.predicate->Copy(); - ExpressionIterator::EnumerateExpression(join_op.predicate, [&](Expression &child) { + + ExpressionIterator::EnumerateExpression(predicate, [&](Expression &child) { if (child.GetExpressionClass() == ExpressionClass::BOUND_REF) { - auto &col_idx = child.Cast().index; - const auto new_idx = swap_projection_map[col_idx]; - col_idx = new_idx; + auto &ref = child.Cast(); + if (ref.index < lhs_width) { + ref.index = ref.index + rhs_width; + } else { + ref.index = ref.index - lhs_width; + } } }); + + join_op.conditions.emplace_back(std::move(predicate)); } auto binder = Binder::CreateBinder(context); @@ -90,15 +108,18 @@ PhysicalPlanGenerator::PlanAsOfLoopJoin(LogicalComparisonJoin &op, PhysicalOpera string arg_min_max; for (idx_t i = 0; i < op.conditions.size(); ++i) { const auto &cond = op.conditions[i]; - JoinCondition nested_cond; - nested_cond.left = cond.right->Copy(); - nested_cond.right = cond.left->Copy(); - if (!nested_cond.left || !nested_cond.right) { + if (!cond.IsComparison()) { + continue; + } + auto left_expr = cond.GetRHS().Copy(); + auto right_expr = cond.GetLHS().Copy(); + if (!left_expr || !right_expr) { return nullptr; } - nested_cond.comparison = FlipComparisonExpression(cond.comparison); + auto comparison = FlipComparisonExpression(cond.GetComparisonType()); + JoinCondition nested_cond(std::move(left_expr), std::move(right_expr), comparison); join_op.conditions.emplace_back(std::move(nested_cond)); - switch (cond.comparison) { + switch (cond.GetComparisonType()) { case ExpressionType::COMPARE_GREATERTHANOREQUALTO: case ExpressionType::COMPARE_GREATERTHAN: D_ASSERT(asof_idx == op.conditions.size()); @@ -158,7 +179,7 @@ PhysicalPlanGenerator::PlanAsOfLoopJoin(LogicalComparisonJoin &op, PhysicalOpera comp_list.emplace_back(make_uniq(col_type, col_idx)); } vector comp_types = join_op.types; - auto comp_expr = op.conditions[asof_idx].right->Copy(); + auto comp_expr = op.conditions[asof_idx].GetRHS().Copy(); comp_types.emplace_back(comp_expr->return_type); comp_list.emplace_back(std::move(comp_expr)); @@ -272,7 +293,10 @@ PhysicalOperator &PhysicalPlanGenerator::PlanAsOfJoin(LogicalComparisonJoin &op) auto asof_idx = op.conditions.size(); for (size_t c = 0; c < op.conditions.size(); ++c) { auto &cond = op.conditions[c]; - switch (cond.comparison) { + if (!cond.IsComparison()) { + continue; + } + switch (cond.GetComparisonType()) { case ExpressionType::COMPARE_EQUAL: case ExpressionType::COMPARE_NOT_DISTINCT_FROM: equi_indexes.emplace_back(c); @@ -291,7 +315,7 @@ PhysicalOperator &PhysicalPlanGenerator::PlanAsOfJoin(LogicalComparisonJoin &op) D_ASSERT(asof_idx < op.conditions.size()); // If there is a non-comparison predicate, we have to use NLJ. - const bool has_predicate = op.predicate.get(); + const bool has_predicate = op.HasArbitraryConditions(); const bool force_asof_join = Settings::Get(context); if (!force_asof_join || has_predicate) { const idx_t asof_join_threshold = Settings::Get(context); @@ -317,16 +341,16 @@ PhysicalOperator &PhysicalPlanGenerator::PlanAsOfJoin(LogicalComparisonJoin &op) // Debug implementation: IEJoin of Window // LEAD(asof_column, 1, infinity) OVER (PARTITION BY equi_column... ORDER BY asof_column) AS asof_end auto &asof_comp = op.conditions[asof_idx]; - auto &asof_column = asof_comp.right; + auto &asof_column = asof_comp.RightReference(); auto asof_type = asof_column->return_type; auto asof_end = make_uniq(ExpressionType::WINDOW_LEAD, asof_type, nullptr, nullptr); asof_end->children.emplace_back(asof_column->Copy()); // TODO: If infinities are not supported for a type, fake them by looking at LHS statistics? asof_end->offset_expr = make_uniq(Value::BIGINT(1)); for (auto equi_idx : equi_indexes) { - asof_end->partitions.emplace_back(op.conditions[equi_idx].right->Copy()); + asof_end->partitions.emplace_back(op.conditions[equi_idx].GetRHS().Copy()); } - switch (asof_comp.comparison) { + switch (asof_comp.GetComparisonType()) { case ExpressionType::COMPARE_GREATERTHANOREQUALTO: case ExpressionType::COMPARE_GREATERTHAN: asof_end->orders.emplace_back(OrderType::ASCENDING, OrderByNullType::NULLS_FIRST, asof_column->Copy()); @@ -354,25 +378,26 @@ PhysicalOperator &PhysicalPlanGenerator::PlanAsOfJoin(LogicalComparisonJoin &op) window.children.emplace_back(right); // IEJoin(left, window, conditions || asof_comp ~op asof_end) - JoinCondition asof_upper; - asof_upper.left = asof_comp.left->Copy(); - asof_upper.right = make_uniq(asof_type, window_types.size() - 1); - switch (asof_comp.comparison) { + auto left_expr = asof_comp.GetLHS().Copy(); + auto right_expr = make_uniq(asof_type, window_types.size() - 1); + ExpressionType comparison; + switch (asof_comp.GetComparisonType()) { case ExpressionType::COMPARE_GREATERTHANOREQUALTO: - asof_upper.comparison = ExpressionType::COMPARE_LESSTHAN; + comparison = ExpressionType::COMPARE_LESSTHAN; break; case ExpressionType::COMPARE_GREATERTHAN: - asof_upper.comparison = ExpressionType::COMPARE_LESSTHANOREQUALTO; + comparison = ExpressionType::COMPARE_LESSTHANOREQUALTO; break; case ExpressionType::COMPARE_LESSTHANOREQUALTO: - asof_upper.comparison = ExpressionType::COMPARE_GREATERTHAN; + comparison = ExpressionType::COMPARE_GREATERTHAN; break; case ExpressionType::COMPARE_LESSTHAN: - asof_upper.comparison = ExpressionType::COMPARE_GREATERTHANOREQUALTO; + comparison = ExpressionType::COMPARE_GREATERTHANOREQUALTO; break; default: throw InternalException("Invalid ASOF JOIN comparison for IEJoin"); } + JoinCondition asof_upper(std::move(left_expr), std::move(right_expr), comparison); op.conditions.emplace_back(std::move(asof_upper)); return Make(op, left, window, std::move(op.conditions), op.join_type, lhs_cardinality); diff --git a/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp b/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp index 8e8c19ed9..fda808122 100644 --- a/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +++ b/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp @@ -13,7 +13,6 @@ #include "duckdb/main/settings.hpp" namespace duckdb { - static void RewriteJoinCondition(unique_ptr &root_expr, idx_t offset) { ExpressionIterator::VisitExpressionMutable( root_expr, [&](BoundReferenceExpression &ref, unique_ptr &expr) { ref.index += offset; }); @@ -50,11 +49,12 @@ PhysicalOperator &PhysicalPlanGenerator::PlanComparisonJoin(LogicalComparisonJoi default: break; } + // TODO: Extend PWMJ to handle all comparisons and projection maps bool prefer_range_joins = Settings::Get(context); prefer_range_joins = prefer_range_joins && can_iejoin; if (has_equality && !prefer_range_joins) { - // Equality join with small number of keys : possible perfect join optimization + // pass separately to PhysicalHashJoin auto &join = Make(op, left, right, std::move(op.conditions), op.join_type, op.left_projection_map, op.right_projection_map, std::move(op.mark_types), op.estimated_cardinality, std::move(op.filter_pushdown)); @@ -93,7 +93,9 @@ PhysicalOperator &PhysicalPlanGenerator::PlanComparisonJoin(LogicalComparisonJoi } for (auto &cond : op.conditions) { - RewriteJoinCondition(cond.right, left.types.size()); + if (cond.IsComparison()) { + RewriteJoinCondition(cond.RightReference(), left.types.size()); + } } auto condition = JoinCondition::CreateExpression(std::move(op.conditions)); return Make(op, left, right, std::move(condition), op.join_type, op.estimated_cardinality); diff --git a/src/duckdb/src/execution/physical_plan/plan_merge_into.cpp b/src/duckdb/src/execution/physical_plan/plan_merge_into.cpp index 3ea945005..22a9e3b34 100644 --- a/src/duckdb/src/execution/physical_plan/plan_merge_into.cpp +++ b/src/duckdb/src/execution/physical_plan/plan_merge_into.cpp @@ -41,9 +41,11 @@ unique_ptr PlanMergeIntoAction(ClientContext &context, Logica break; } case MergeActionType::MERGE_DELETE: { + // Use delete_return_columns if available (for optimized RETURNING path) + vector return_columns = op.delete_return_columns; result->op = planner.Make(std::move(return_types), op.table, op.table.GetStorage(), std::move(bound_constraints), op.row_id_start, cardinality, - op.return_chunk, vector()); + op.return_chunk, std::move(return_columns)); break; } case MergeActionType::MERGE_INSERT: { diff --git a/src/duckdb/src/execution/physical_plan/plan_recursive_cte.cpp b/src/duckdb/src/execution/physical_plan/plan_recursive_cte.cpp index 9e75d3c5c..98513cf59 100644 --- a/src/duckdb/src/execution/physical_plan/plan_recursive_cte.cpp +++ b/src/duckdb/src/execution/physical_plan/plan_recursive_cte.cpp @@ -26,10 +26,14 @@ PhysicalOperator &PhysicalPlanGenerator::CreatePlan(LogicalRecursiveCTE &op) { // If the logical operator has no key targets or all columns are referenced, // then we create a normal recursive CTE operator. if (op.key_targets.empty()) { + auto recurring_table = make_shared_ptr(context, op.types); + recurring_cte_tables[op.table_index] = recurring_table; auto &right = CreatePlan(*op.children[1]); auto &cte = Make(op.ctename, op.table_index, op.types, op.union_all, left, right, op.estimated_cardinality); auto &cast_cte = cte.Cast(); + cast_cte.ref_recurring = op.ref_recurring; + cast_cte.recurring_table = recurring_table; cast_cte.distinct_types = op.types; cast_cte.working_table = working_table; return cte; diff --git a/src/duckdb/src/execution/physical_plan/plan_set_operation.cpp b/src/duckdb/src/execution/physical_plan/plan_set_operation.cpp index ee71c5509..a8c89f73a 100644 --- a/src/duckdb/src/execution/physical_plan/plan_set_operation.cpp +++ b/src/duckdb/src/execution/physical_plan/plan_set_operation.cpp @@ -1,4 +1,5 @@ #include "duckdb/execution/physical_plan_generator.hpp" + #include "duckdb/execution/operator/aggregate/physical_hash_aggregate.hpp" #include "duckdb/execution/operator/aggregate/physical_window.hpp" #include "duckdb/execution/operator/join/physical_hash_join.hpp" @@ -6,11 +7,13 @@ #include "duckdb/execution/operator/set/physical_union.hpp" #include "duckdb/planner/expression/bound_reference_expression.hpp" #include "duckdb/planner/expression/bound_window_expression.hpp" +#include "duckdb/planner/expression_binder.hpp" #include "duckdb/planner/operator/logical_set_operation.hpp" namespace duckdb { -static vector> CreatePartitionedRowNumExpression(const vector &types) { +static vector> CreatePartitionedRowNumExpression(ClientContext &client, + const vector &types) { vector> res; auto expr = make_uniq(ExpressionType::WINDOW_ROW_NUMBER, LogicalType::BIGINT, nullptr, nullptr); @@ -18,19 +21,18 @@ static vector> CreatePartitionedRowNumExpression(const ve expr->end = WindowBoundary::UNBOUNDED_FOLLOWING; for (idx_t i = 0; i < types.size(); i++) { expr->partitions.push_back(make_uniq(types[i], i)); + ExpressionBinder::PushCollation(client, expr->partitions.back(), types[i]); } res.push_back(std::move(expr)); return res; } static JoinCondition CreateNotDistinctComparison(ClientContext &context, const LogicalType &type, idx_t i) { - JoinCondition cond; - cond.left = make_uniq(type, i); - cond.right = make_uniq(type, i); - cond.comparison = ExpressionType::COMPARE_NOT_DISTINCT_FROM; - - ExpressionBinder::PushCollation(context, cond.left, type); - ExpressionBinder::PushCollation(context, cond.right, type); + auto left = make_uniq(type, i); + auto right = make_uniq(type, i); + JoinCondition cond(std::move(left), std::move(right), ExpressionType::COMPARE_NOT_DISTINCT_FROM); + ExpressionBinder::PushCollation(context, cond.LeftReference(), type); + ExpressionBinder::PushCollation(context, cond.RightReference(), type); return cond; } @@ -71,13 +73,13 @@ PhysicalOperator &PhysicalPlanGenerator::CreatePlan(LogicalSetOperation &op) { vector window_types = types; window_types.push_back(LogicalType::BIGINT); - auto select_list = CreatePartitionedRowNumExpression(types); + auto select_list = CreatePartitionedRowNumExpression(context, types); auto &left_window = Make(window_types, std::move(select_list), left.get().estimated_cardinality); left_window.children.push_back(left); left = left_window; - select_list = CreatePartitionedRowNumExpression(types); + select_list = CreatePartitionedRowNumExpression(context, types); auto &right_window = Make(window_types, std::move(select_list), right.get().estimated_cardinality); right_window.children.push_back(right); diff --git a/src/duckdb/src/function/aggregate/distributive/first_last_any.cpp b/src/duckdb/src/function/aggregate/distributive/first_last_any.cpp index 0eed72d84..2b6b3bdf8 100644 --- a/src/duckdb/src/function/aggregate/distributive/first_last_any.cpp +++ b/src/duckdb/src/function/aggregate/distributive/first_last_any.cpp @@ -1,5 +1,4 @@ #include "duckdb/common/exception.hpp" -#include "duckdb/common/vector_operations/vector_operations.hpp" #include "duckdb/function/aggregate/distributive_functions.hpp" #include "duckdb/function/aggregate/distributive_function_utils.hpp" #include "duckdb/function/create_sort_key.hpp" @@ -222,16 +221,38 @@ template void FirstFunctionSimpleUpdate(Vector inputs[], AggregateInputData &aggregate_input_data, idx_t input_count, data_ptr_t state, idx_t count) { auto agg_state = reinterpret_cast *>(state); - if (LAST || !agg_state->is_set) { + if (LAST) { + // For LAST, iterate backward within each batch to find the last value + // This saves iterating through all elements when we only need the last one + D_ASSERT(input_count == 1); + UnifiedVectorFormat idata; + inputs[0].ToUnifiedFormat(count, idata); + auto input_data = UnifiedVectorFormat::GetData(idata); + + for (idx_t i = count; i-- > 0;) { + const auto idx = idata.sel->get_index(i); + const auto row_valid = idata.validity.RowIsValid(idx); + if (SKIP_NULLS && !row_valid) { + continue; + } + // Found the last value in this batch - update state and exit + agg_state->is_set = true; + agg_state->is_null = !row_valid; + if (row_valid) { + agg_state->value = input_data[idx]; + } + break; + } + // If we get here with SKIP_NULLS, all values were NULL - keep previous state + } else if (!agg_state->is_set) { // For FIRST, this skips looping over the input once the aggregate state has been set - // FIXME: for LAST we could loop from the back of the Vector instead AggregateFunction::UnaryUpdate, T, FirstFunction>(inputs, aggregate_input_data, input_count, state, count); } } template -AggregateFunction GetFirstAggregateTemplated(LogicalType type) { +AggregateFunction GetFirstAggregateTemplated(const LogicalType &type) { auto result = AggregateFunction::UnaryAggregate, T, T, FirstFunction>(type, type); result.SetStateSimpleUpdateCallback(FirstFunctionSimpleUpdate); return result; diff --git a/src/duckdb/src/function/cast/default_casts.cpp b/src/duckdb/src/function/cast/default_casts.cpp index 558329f70..9ee5f6957 100644 --- a/src/duckdb/src/function/cast/default_casts.cpp +++ b/src/duckdb/src/function/cast/default_casts.cpp @@ -164,6 +164,8 @@ BoundCastInfo DefaultCasts::GetDefaultCastFunction(BindCastInput &input, const L return ArrayCastSwitch(input, source, target); case LogicalTypeId::GEOMETRY: return GeoCastSwitch(input, source, target); + case LogicalTypeId::TYPE: + return TypeCastSwitch(input, source, target); case LogicalTypeId::BIGNUM: return BignumCastSwitch(input, source, target); case LogicalTypeId::AGGREGATE_STATE: diff --git a/src/duckdb/src/function/cast/list_casts.cpp b/src/duckdb/src/function/cast/list_casts.cpp index 156b43143..bf9fcea0b 100644 --- a/src/duckdb/src/function/cast/list_casts.cpp +++ b/src/duckdb/src/function/cast/list_casts.cpp @@ -98,7 +98,7 @@ static bool ListToVarcharCast(Vector &source, Vector &result, idx_t count, CastP static constexpr const idx_t SEP_LENGTH = 2; static constexpr const idx_t NULL_LENGTH = 4; unsafe_unique_array needs_quotes; - idx_t needs_quotes_length; + idx_t needs_quotes_length = DConstants::INVALID_INDEX; for (idx_t i = 0; i < count; i++) { if (!validity.RowIsValid(i)) { diff --git a/src/duckdb/src/function/cast/map_cast.cpp b/src/duckdb/src/function/cast/map_cast.cpp index ee8a4b11a..a8ea727a4 100644 --- a/src/duckdb/src/function/cast/map_cast.cpp +++ b/src/duckdb/src/function/cast/map_cast.cpp @@ -64,7 +64,7 @@ static bool MapToVarcharCast(Vector &source, Vector &result, idx_t count, CastPa auto result_data = FlatVector::GetData(result); unsafe_unique_array key_needs_quotes; unsafe_unique_array value_needs_quotes; - idx_t needs_quotes_length; + idx_t needs_quotes_length = DConstants::INVALID_INDEX; for (idx_t i = 0; i < count; i++) { if (!validity.RowIsValid(i)) { FlatVector::SetNull(result, i, true); diff --git a/src/duckdb/src/function/cast/type_cast.cpp b/src/duckdb/src/function/cast/type_cast.cpp new file mode 100644 index 000000000..3984e79f1 --- /dev/null +++ b/src/duckdb/src/function/cast/type_cast.cpp @@ -0,0 +1,15 @@ +#include "duckdb/function/cast/default_casts.hpp" +#include "duckdb/function/cast/vector_cast_helpers.hpp" + +namespace duckdb { + +BoundCastInfo DefaultCasts::TypeCastSwitch(BindCastInput &input, const LogicalType &source, const LogicalType &target) { + // now switch on the result type + if (target == LogicalType::VARCHAR) { + // type to varchar + return BoundCastInfo(&VectorCastHelpers::StringCast); + } + return nullptr; +} + +} // namespace duckdb diff --git a/src/duckdb/src/function/copy_function.cpp b/src/duckdb/src/function/copy_function.cpp index d355449a5..8b069028b 100644 --- a/src/duckdb/src/function/copy_function.cpp +++ b/src/duckdb/src/function/copy_function.cpp @@ -37,11 +37,17 @@ vector GetCopyFunctionReturnLogicalTypes(CopyFunctionReturnType ret case CopyFunctionReturnType::CHANGED_ROWS_AND_FILE_LIST: return {LogicalType::BIGINT, LogicalType::LIST(LogicalType::VARCHAR)}; case CopyFunctionReturnType::WRITTEN_FILE_STATISTICS: - return {LogicalType::VARCHAR, + return {//! filename + LogicalType::VARCHAR, + //! count LogicalType::UBIGINT, + //! file size bytes LogicalType::UBIGINT, + //! footer size bytes LogicalType::UBIGINT, + //! column_path (potentially nested) -> map(stats_type -> value) LogicalType::MAP(LogicalType::VARCHAR, LogicalType::MAP(LogicalType::VARCHAR, LogicalType::VARCHAR)), + //! partition key -> value LogicalType::MAP(LogicalType::VARCHAR, LogicalType::VARCHAR)}; default: throw NotImplementedException("Unknown CopyFunctionReturnType"); diff --git a/src/duckdb/src/function/function_binder.cpp b/src/duckdb/src/function/function_binder.cpp index 8521dfe71..2d5b8366b 100644 --- a/src/duckdb/src/function/function_binder.cpp +++ b/src/duckdb/src/function/function_binder.cpp @@ -14,6 +14,7 @@ #include "duckdb/planner/expression/bound_constant_expression.hpp" #include "duckdb/planner/expression/bound_function_expression.hpp" #include "duckdb/planner/expression_binder.hpp" +#include "duckdb/planner/binder.hpp" namespace duckdb { diff --git a/src/duckdb/src/function/pragma/pragma_queries.cpp b/src/duckdb/src/function/pragma/pragma_queries.cpp index 62ce195df..7f4f80bbc 100644 --- a/src/duckdb/src/function/pragma/pragma_queries.cpp +++ b/src/duckdb/src/function/pragma/pragma_queries.cpp @@ -202,7 +202,7 @@ static string PragmaDatabaseSize(ClientContext &context, const FunctionParameter } static string PragmaStorageInfo(ClientContext &context, const FunctionParameters ¶meters) { - return StringUtil::Format("SELECT * FROM pragma_storage_info('%s');", parameters.values[0].ToString()); + return StringUtil::Format("SELECT * FROM pragma_storage_info(%s);", SQLString(parameters.values[0].ToString())); } static string PragmaMetadataInfo(ClientContext &context, const FunctionParameters ¶meters) { diff --git a/src/duckdb/src/function/scalar/generic/invoke.cpp b/src/duckdb/src/function/scalar/generic/invoke.cpp index a611d1406..9595a7757 100644 --- a/src/duckdb/src/function/scalar/generic/invoke.cpp +++ b/src/duckdb/src/function/scalar/generic/invoke.cpp @@ -2,6 +2,7 @@ #include "duckdb/function/lambda_functions.hpp" #include "duckdb/common/serializer/serializer.hpp" #include "duckdb/common/serializer/deserializer.hpp" +#include "duckdb/planner/expression/bound_lambda_expression.hpp" namespace duckdb { diff --git a/src/duckdb/src/function/scalar/operator/arithmetic.cpp b/src/duckdb/src/function/scalar/operator/arithmetic.cpp index 7bc3fd2ac..e47b59dab 100644 --- a/src/duckdb/src/function/scalar/operator/arithmetic.cpp +++ b/src/duckdb/src/function/scalar/operator/arithmetic.cpp @@ -5,6 +5,7 @@ #include "duckdb/common/operator/add.hpp" #include "duckdb/common/operator/interpolate.hpp" #include "duckdb/common/operator/multiply.hpp" +#include "duckdb/common/operator/negate.hpp" #include "duckdb/common/operator/numeric_binary_operators.hpp" #include "duckdb/common/operator/subtract.hpp" #include "duckdb/common/serializer/deserializer.hpp" @@ -531,35 +532,6 @@ ScalarFunctionSet OperatorAddFun::GetFunctions() { //===--------------------------------------------------------------------===// // - [subtract] //===--------------------------------------------------------------------===// -namespace { - -struct NegateOperator { - template - static bool CanNegate(T input) { - using Limits = NumericLimits; - return !(Limits::IsSigned() && Limits::Minimum() == input); - } - - template - static inline TR Operation(TA input) { - auto cast = (TR)input; - if (!CanNegate(cast)) { - throw OutOfRangeException("Overflow in negation of integer!"); - } - return -cast; - } -}; - -template <> -bool NegateOperator::CanNegate(float input) { - return true; -} - -template <> -bool NegateOperator::CanNegate(double input) { - return true; -} - template <> interval_t NegateOperator::Operation(interval_t input) { interval_t result; @@ -670,8 +642,6 @@ unique_ptr NegateBindStatistics(ClientContext &context, Function return stats.ToUnique(); } -} // namespace - ScalarFunction SubtractFunction::GetFunction(const LogicalType &type) { if (type.id() == LogicalTypeId::INTERVAL) { ScalarFunction func("-", {type}, type, ScalarFunction::UnaryFunction); diff --git a/src/duckdb/src/function/scalar/string/caseconvert.cpp b/src/duckdb/src/function/scalar/string/caseconvert.cpp index 0309b79f7..0a9f50f4a 100644 --- a/src/duckdb/src/function/scalar/string/caseconvert.cpp +++ b/src/duckdb/src/function/scalar/string/caseconvert.cpp @@ -30,21 +30,21 @@ template static idx_t GetResultLength(const char *input_data, idx_t input_length) { idx_t output_length = 0; for (idx_t i = 0; i < input_length;) { - if (input_data[i] & 0x80) { - // unicode - int sz = 0; - auto codepoint = Utf8Proc::UTF8ToCodepoint(input_data + i, sz); - auto converted_codepoint = - IS_UPPER ? Utf8Proc::CodepointToUpper(codepoint) : Utf8Proc::CodepointToLower(codepoint); - auto new_sz = Utf8Proc::CodepointLength(converted_codepoint); - D_ASSERT(new_sz >= 0); - output_length += UnsafeNumericCast(new_sz); - i += UnsafeNumericCast(sz); - } else { - // ascii + if (!(input_data[i] & 0x80)) { + // ASCII. output_length++; i++; + continue; } + + // UTF-8. + int sz = 0; + auto codepoint = Utf8Proc::UTF8ToCodepoint(input_data + i, sz); + auto converted = IS_UPPER ? Utf8Proc::CodepointToUpper(codepoint) : Utf8Proc::CodepointToLower(codepoint); + auto new_sz = Utf8Proc::CodepointLength(converted); + output_length += UnsafeNumericCast(new_sz); + D_ASSERT(sz != 0); + i += UnsafeNumericCast(sz); } return output_length; } diff --git a/src/duckdb/src/function/scalar/system/aggregate_export.cpp b/src/duckdb/src/function/scalar/system/aggregate_export.cpp index 84c51673b..3202a2823 100644 --- a/src/duckdb/src/function/scalar/system/aggregate_export.cpp +++ b/src/duckdb/src/function/scalar/system/aggregate_export.cpp @@ -312,8 +312,12 @@ ExportAggregateFunction::Bind(unique_ptr child_aggrega } #endif auto export_bind_data = make_uniq(child_aggregate->Copy()); + LogicalType state_layout = LogicalType::INVALID; + if (bound_function.HasGetStateTypeCallback()) { + state_layout = bound_function.GetStateType(); + } aggregate_state_t state_type(child_aggregate->function.name, child_aggregate->function.GetReturnType(), - child_aggregate->function.arguments); + child_aggregate->function.arguments, state_layout); auto return_type = LogicalType::AGGREGATE_STATE(std::move(state_type)); auto export_function = diff --git a/src/duckdb/src/function/scalar/variant/variant_extract.cpp b/src/duckdb/src/function/scalar/variant/variant_extract.cpp index bfa43e8e7..05bcd6351 100644 --- a/src/duckdb/src/function/scalar/variant/variant_extract.cpp +++ b/src/duckdb/src/function/scalar/variant/variant_extract.cpp @@ -172,7 +172,12 @@ void VariantUtils::VariantExtract(Vector &variant_vec, const vector(result_values); + auto &result_values_validity = FlatVector::Validity(result_values); for (idx_t i = 0; i < count; i++) { + if (!validity.RowIsValid(i)) { + result_values_validity.SetInvalid(i); + continue; + } result_values_data[i] = values_data[values.sel->get_index(i)]; } diff --git a/src/duckdb/src/function/table/copy_csv.cpp b/src/duckdb/src/function/table/copy_csv.cpp index 1ffd6e7ee..15f82dc93 100644 --- a/src/duckdb/src/function/table/copy_csv.cpp +++ b/src/duckdb/src/function/table/copy_csv.cpp @@ -1,6 +1,7 @@ #include "duckdb/common/bind_helpers.hpp" #include "duckdb/common/csv_writer.hpp" #include "duckdb/common/file_system.hpp" +#include "duckdb/common/multi_file/multi_file_function.hpp" #include "duckdb/common/multi_file/multi_file_reader.hpp" #include "duckdb/common/serializer/memory_stream.hpp" #include "duckdb/common/serializer/write_stream.hpp" @@ -8,8 +9,8 @@ #include "duckdb/common/types/column/column_data_collection.hpp" #include "duckdb/common/types/string_type.hpp" #include "duckdb/common/vector_operations/vector_operations.hpp" -#include "duckdb/execution/operator/csv_scanner/sniffer/csv_sniffer.hpp" #include "duckdb/execution/operator/csv_scanner/csv_multi_file_info.hpp" +#include "duckdb/execution/operator/csv_scanner/sniffer/csv_sniffer.hpp" #include "duckdb/function/copy_function.hpp" #include "duckdb/function/scalar/string_functions.hpp" #include "duckdb/function/table/read_csv.hpp" @@ -18,8 +19,9 @@ #include "duckdb/parser/expression/constant_expression.hpp" #include "duckdb/parser/expression/function_expression.hpp" #include "duckdb/parser/parsed_data/copy_info.hpp" +#include "duckdb/planner/binder.hpp" #include "duckdb/planner/expression/bound_reference_expression.hpp" -#include "duckdb/common/multi_file/multi_file_function.hpp" +#include "duckdb/planner/expression_binder.hpp" namespace duckdb { diff --git a/src/duckdb/src/function/table/glob.cpp b/src/duckdb/src/function/table/glob.cpp index de1099258..3933a6fa4 100644 --- a/src/duckdb/src/function/table/glob.cpp +++ b/src/duckdb/src/function/table/glob.cpp @@ -41,6 +41,7 @@ static void GlobFunction(ClientContext &context, TableFunctionInput &data_p, Dat auto &bind_data = data_p.bind_data->Cast(); auto &state = data_p.global_state->Cast(); + state.file_list_scan.scan_type = MultiFileListScanType::ALWAYS_FETCH; idx_t count = 0; while (count < STANDARD_VECTOR_SIZE) { OpenFileInfo file; @@ -48,6 +49,7 @@ static void GlobFunction(ClientContext &context, TableFunctionInput &data_p, Dat break; } output.data[0].SetValue(count++, file.path); + state.file_list_scan.scan_type = MultiFileListScanType::FETCH_IF_AVAILABLE; } output.SetCardinality(count); } diff --git a/src/duckdb/src/function/table/read_file.cpp b/src/duckdb/src/function/table/read_file.cpp index ec9fd8260..30b5cc896 100644 --- a/src/duckdb/src/function/table/read_file.cpp +++ b/src/duckdb/src/function/table/read_file.cpp @@ -170,7 +170,6 @@ FileGlobInput DirectMultiFileInfo::GetGlobInput() { struct ReadBlobOperation { static constexpr const char *NAME = "read_blob"; - static constexpr const char *FILE_TYPE = "blob"; static inline LogicalType TYPE() { return LogicalType::BLOB; @@ -179,7 +178,6 @@ struct ReadBlobOperation { struct ReadTextOperation { static constexpr const char *NAME = "read_text"; - static constexpr const char *FILE_TYPE = "text"; static inline LogicalType TYPE() { return LogicalType::VARCHAR; diff --git a/src/duckdb/src/function/table/sniff_csv.cpp b/src/duckdb/src/function/table/sniff_csv.cpp index 7b133bccd..f428d77b3 100644 --- a/src/duckdb/src/function/table/sniff_csv.cpp +++ b/src/duckdb/src/function/table/sniff_csv.cpp @@ -133,9 +133,9 @@ static void CSVSniffFunction(ClientContext &context, TableFunctionInput &data_p, return; } const CSVSniffFunctionData &data = data_p.bind_data->Cast(); - auto &fs = duckdb::FileSystem::GetFileSystem(context); - auto files = fs.GlobFiles(data.path, context, FileGlobOptions::DISALLOW_EMPTY); + auto &fs = FileSystem::GetFileSystem(context); + auto files = fs.GlobFiles(data.path, FileGlobOptions::DISALLOW_EMPTY); if (files.size() > 1) { throw NotImplementedException("sniff_csv does not operate on more than one file yet"); } diff --git a/src/duckdb/src/function/table/system/duckdb_columns.cpp b/src/duckdb/src/function/table/system/duckdb_columns.cpp index ff14fdd73..0a4c0a40f 100644 --- a/src/duckdb/src/function/table/system/duckdb_columns.cpp +++ b/src/duckdb/src/function/table/system/duckdb_columns.cpp @@ -7,6 +7,7 @@ #include "duckdb/main/client_context.hpp" #include "duckdb/main/client_data.hpp" #include "duckdb/parser/constraints/not_null_constraint.hpp" +#include "duckdb/planner/binder.hpp" #include @@ -94,7 +95,7 @@ static unique_ptr DuckDBColumnsInit(ClientContext &con class ColumnHelper { public: - static unique_ptr Create(CatalogEntry &entry); + static unique_ptr Create(ClientContext &context, CatalogEntry &entry); virtual ~ColumnHelper() { } @@ -156,20 +157,22 @@ class TableColumnHelper : public ColumnHelper { class ViewColumnHelper : public ColumnHelper { public: - explicit ViewColumnHelper(ViewCatalogEntry &entry) : entry(entry) { + explicit ViewColumnHelper(ClientContext &context, ViewCatalogEntry &entry) : entry(entry) { + entry.BindView(context); + view_columns = entry.GetColumnInfo(); } StandardEntry &Entry() override { return entry; } idx_t NumColumns() override { - return entry.types.size(); + return view_columns->types.size(); } const string &ColumnName(idx_t col) override { - return col < entry.aliases.size() ? entry.aliases[col] : entry.names[col]; + return col < entry.aliases.size() ? entry.aliases[col] : view_columns->names[col]; } const LogicalType &ColumnType(idx_t col) override { - return entry.types[col]; + return view_columns->types[col]; } const Value ColumnDefault(idx_t col) override { return Value(); @@ -178,23 +181,20 @@ class ViewColumnHelper : public ColumnHelper { return true; } const Value ColumnComment(idx_t col) override { - if (entry.column_comments.empty()) { - return Value(); - } - D_ASSERT(entry.column_comments.size() == entry.types.size()); - return entry.column_comments[col]; + return entry.GetColumnComment(col); } private: ViewCatalogEntry &entry; + shared_ptr view_columns; }; -unique_ptr ColumnHelper::Create(CatalogEntry &entry) { +unique_ptr ColumnHelper::Create(ClientContext &context, CatalogEntry &entry) { switch (entry.type) { case CatalogType::TABLE_ENTRY: return make_uniq(entry.Cast()); case CatalogType::VIEW_ENTRY: - return make_uniq(entry.Cast()); + return make_uniq(context, entry.Cast()); default: throw NotImplementedException({{"catalog_type", CatalogTypeToString(entry.type)}}, "Unsupported catalog type for duckdb_columns"); @@ -318,7 +318,7 @@ static void DuckDBColumnsFunction(ClientContext &context, TableFunctionInput &da idx_t column_offset = data.column_offset; idx_t index = 0; while (next < data.entries.size() && index < STANDARD_VECTOR_SIZE) { - auto column_helper = ColumnHelper::Create(data.entries[next].get()); + auto column_helper = ColumnHelper::Create(context, data.entries[next].get()); idx_t columns = column_helper->NumColumns(); // Check to see if we are going to exceed the maximum index for a DataChunk diff --git a/src/duckdb/src/function/table/system/duckdb_log_contexts.cpp b/src/duckdb/src/function/table/system/duckdb_log_contexts.cpp index c3ec4f39a..d48b8debb 100644 --- a/src/duckdb/src/function/table/system/duckdb_log_contexts.cpp +++ b/src/duckdb/src/function/table/system/duckdb_log_contexts.cpp @@ -3,10 +3,11 @@ #include "duckdb/catalog/catalog.hpp" #include "duckdb/catalog/catalog_entry/schema_catalog_entry.hpp" #include "duckdb/common/exception.hpp" -#include "duckdb/main/client_context.hpp" -#include "duckdb/main/client_data.hpp" #include "duckdb/logging/log_manager.hpp" #include "duckdb/logging/log_storage.hpp" +#include "duckdb/main/client_context.hpp" +#include "duckdb/main/client_data.hpp" +#include "duckdb/parser/tableref.hpp" namespace duckdb { diff --git a/src/duckdb/src/function/table/system/duckdb_views.cpp b/src/duckdb/src/function/table/system/duckdb_views.cpp index 1ae6fcce7..c28b836e9 100644 --- a/src/duckdb/src/function/table/system/duckdb_views.cpp +++ b/src/duckdb/src/function/table/system/duckdb_views.cpp @@ -14,6 +14,7 @@ struct DuckDBViewsData : public GlobalTableFunctionState { } vector> entries; + vector column_ids; idx_t offset; }; @@ -67,6 +68,7 @@ unique_ptr DuckDBViewsInit(ClientContext &context, Tab schema.get().Scan(context, CatalogType::VIEW_ENTRY, [&](CatalogEntry &entry) { result->entries.push_back(entry); }); }; + result->column_ids = input.column_indexes; return std::move(result); } @@ -87,40 +89,74 @@ void DuckDBViewsFunction(ClientContext &context, TableFunctionInput &data_p, Dat } auto &view = entry.Cast(); - // return values: - idx_t col = 0; - // database_name, VARCHAR - output.SetValue(col++, count, view.catalog.GetName()); - // database_oid, BIGINT - output.SetValue(col++, count, Value::BIGINT(NumericCast(view.catalog.GetOid()))); - // schema_name, LogicalType::VARCHAR - output.SetValue(col++, count, Value(view.schema.name)); - // schema_oid, LogicalType::BIGINT - output.SetValue(col++, count, Value::BIGINT(NumericCast(view.schema.oid))); - // view_name, LogicalType::VARCHAR - output.SetValue(col++, count, Value(view.name)); - // view_oid, LogicalType::BIGINT - output.SetValue(col++, count, Value::BIGINT(NumericCast(view.oid))); - // comment, LogicalType::VARCHARs - output.SetValue(col++, count, Value(view.comment)); - // tags, LogicalType::MAP(LogicalType::VARCHAR, LogicalType::VARCHAR) - output.SetValue(col++, count, Value::MAP(view.tags)); - // internal, LogicalType::BOOLEAN - output.SetValue(col++, count, Value::BOOLEAN(view.internal)); - // temporary, LogicalType::BOOLEAN - output.SetValue(col++, count, Value::BOOLEAN(view.temporary)); - // column_count, LogicalType::BIGINT - output.SetValue(col++, count, Value::BIGINT(NumericCast(view.types.size()))); - // sql, LogicalType::VARCHAR - output.SetValue(col++, count, Value(view.ToSQL())); - + for (idx_t c = 0; c < data.column_ids.size(); c++) { + auto column_id = data.column_ids[c].GetPrimaryIndex(); + switch (column_id) { + case 0: + // database_name, VARCHAR + output.SetValue(c, count, view.catalog.GetName()); + break; + case 1: + // database_oid, BIGINT + output.SetValue(c, count, Value::BIGINT(NumericCast(view.catalog.GetOid()))); + break; + case 2: + // schema_name, LogicalType::VARCHAR + output.SetValue(c, count, Value(view.schema.name)); + break; + case 3: + // schema_oid, LogicalType::BIGINT + output.SetValue(c, count, Value::BIGINT(NumericCast(view.schema.oid))); + break; + case 4: + // view_name, LogicalType::VARCHAR + output.SetValue(c, count, Value(view.name)); + break; + case 5: + // view_oid, LogicalType::BIGINT + output.SetValue(c, count, Value::BIGINT(NumericCast(view.oid))); + break; + case 6: + // comment, LogicalType::VARCHARs + output.SetValue(c, count, Value(view.comment)); + break; + case 7: + // tags, LogicalType::MAP(LogicalType::VARCHAR, LogicalType::VARCHAR) + output.SetValue(c, count, Value::MAP(view.tags)); + break; + case 8: + // internal, LogicalType::BOOLEAN + output.SetValue(c, count, Value::BOOLEAN(view.internal)); + break; + case 9: + // temporary, LogicalType::BOOLEAN + output.SetValue(c, count, Value::BOOLEAN(view.temporary)); + break; + case 10: { + // column_count, LogicalType::BIGINT + // make sure the view is bound so we know the columns it emits + view.BindView(context); + auto columns = view.GetColumnInfo(); + output.SetValue(c, count, Value::BIGINT(NumericCast(columns->types.size()))); + break; + } + case 11: + // sql, LogicalType::VARCHAR + output.SetValue(c, count, Value(view.ToSQL())); + break; + default: + throw InternalException("Unsupported column index for duckdb_views"); + } + } count++; } output.SetCardinality(count); } void DuckDBViewsFun::RegisterFunction(BuiltinFunctions &set) { - set.AddFunction(TableFunction("duckdb_views", {}, DuckDBViewsFunction, DuckDBViewsBind, DuckDBViewsInit)); + TableFunction duckdb_views("duckdb_views", {}, DuckDBViewsFunction, DuckDBViewsBind, DuckDBViewsInit); + duckdb_views.projection_pushdown = true; + set.AddFunction(std::move(duckdb_views)); } } // namespace duckdb diff --git a/src/duckdb/src/function/table/system/pragma_table_info.cpp b/src/duckdb/src/function/table/system/pragma_table_info.cpp index 56205d900..2c490003a 100644 --- a/src/duckdb/src/function/table/system/pragma_table_info.cpp +++ b/src/duckdb/src/function/table/system/pragma_table_info.cpp @@ -247,21 +247,26 @@ static void PragmaTableInfoTable(PragmaTableOperatorData &data, TableCatalogEntr data.offset = next; } -static void PragmaTableInfoView(PragmaTableOperatorData &data, ViewCatalogEntry &view, DataChunk &output, - bool is_table_info) { - if (data.offset >= view.types.size()) { +static void PragmaTableInfoView(ClientContext &context, PragmaTableOperatorData &data, ViewCatalogEntry &view, + DataChunk &output, bool is_table_info) { + // force rebind the view to ensure the names / types are up to date + view.BindView(context, BindViewAction::FORCE_REBIND); + auto columns = view.GetColumnInfo(); + auto &view_names = columns->names; + auto &view_types = columns->types; + if (data.offset >= view_types.size()) { // finished returning values return; } // start returning values // either fill up the chunk or return all the remaining columns - idx_t next = MinValue(data.offset + STANDARD_VECTOR_SIZE, view.types.size()); + idx_t next = MinValue(data.offset + STANDARD_VECTOR_SIZE, view_types.size()); output.SetCardinality(next - data.offset); for (idx_t i = data.offset; i < next; i++) { auto index = i - data.offset; - auto type = view.types[i]; - auto &name = i < view.aliases.size() ? view.aliases[i] : view.names[i]; + auto type = view_types[i]; + auto &name = i < view.aliases.size() ? view.aliases[i] : view_names[i]; if (is_table_info) { PragmaTableInfoHelper::GetViewColumns(i, name, type, output, index); @@ -280,7 +285,7 @@ static void PragmaTableInfoFunction(ClientContext &context, TableFunctionInput & PragmaTableInfoTable(state, bind_data.entry.Cast(), output, bind_data.is_table_info); break; case CatalogType::VIEW_ENTRY: - PragmaTableInfoView(state, bind_data.entry.Cast(), output, bind_data.is_table_info); + PragmaTableInfoView(context, state, bind_data.entry.Cast(), output, bind_data.is_table_info); break; default: throw NotImplementedException("Unimplemented catalog type for pragma_table_info"); diff --git a/src/duckdb/src/function/table/table_scan.cpp b/src/duckdb/src/function/table/table_scan.cpp index ca1173402..ac349f930 100644 --- a/src/duckdb/src/function/table/table_scan.cpp +++ b/src/duckdb/src/function/table/table_scan.cpp @@ -330,9 +330,7 @@ class DuckTableScanState : public TableScanGlobalState { } // Before looping back, check if we are interrupted - if (context.interrupted) { - throw InterruptException(); - } + context.InterruptCheck(); } while (true); } diff --git a/src/duckdb/src/function/table/version/pragma_version.cpp b/src/duckdb/src/function/table/version/pragma_version.cpp index a5f7d1896..54bc6cb4e 100644 --- a/src/duckdb/src/function/table/version/pragma_version.cpp +++ b/src/duckdb/src/function/table/version/pragma_version.cpp @@ -1,5 +1,5 @@ #ifndef DUCKDB_PATCH_VERSION -#define DUCKDB_PATCH_VERSION "0-dev5760" +#define DUCKDB_PATCH_VERSION "0-dev6613" #endif #ifndef DUCKDB_MINOR_VERSION #define DUCKDB_MINOR_VERSION 5 @@ -8,10 +8,10 @@ #define DUCKDB_MAJOR_VERSION 1 #endif #ifndef DUCKDB_VERSION -#define DUCKDB_VERSION "v1.5.0-dev5760" +#define DUCKDB_VERSION "v1.5.0-dev6613" #endif #ifndef DUCKDB_SOURCE_ID -#define DUCKDB_SOURCE_ID "3f41e38ba7" +#define DUCKDB_SOURCE_ID "5a115ef952" #endif #include "duckdb/function/table/system_functions.hpp" #include "duckdb/main/database.hpp" diff --git a/src/duckdb/src/function/table_function.cpp b/src/duckdb/src/function/table_function.cpp index db6829ce4..1290dc9ef 100644 --- a/src/duckdb/src/function/table_function.cpp +++ b/src/duckdb/src/function/table_function.cpp @@ -39,8 +39,8 @@ TableFunction::TableFunction(string name, const vector &arguments, pushdown_expression(nullptr), to_string(nullptr), dynamic_to_string(nullptr), table_scan_progress(nullptr), get_partition_data(nullptr), get_bind_info(nullptr), type_pushdown(nullptr), get_multi_file_reader(nullptr), supports_pushdown_type(nullptr), supports_pushdown_extract(nullptr), get_partition_info(nullptr), - get_partition_stats(nullptr), get_virtual_columns(nullptr), get_row_id_columns(nullptr), serialize(nullptr), - deserialize(nullptr), projection_pushdown(false), filter_pushdown(false), filter_prune(false), + get_partition_stats(nullptr), get_virtual_columns(nullptr), get_row_id_columns(nullptr), set_scan_order(nullptr), + serialize(nullptr), deserialize(nullptr), projection_pushdown(false), filter_pushdown(false), filter_prune(false), sampling_pushdown(false), late_materialization(false) { } diff --git a/src/duckdb/src/function/window/window_value_function.cpp b/src/duckdb/src/function/window/window_value_function.cpp index 276b99fad..ff987575b 100644 --- a/src/duckdb/src/function/window/window_value_function.cpp +++ b/src/duckdb/src/function/window/window_value_function.cpp @@ -194,9 +194,8 @@ unique_ptr WindowValueExecutor::GetLocalState(ExecutionContext & class WindowLeadLagGlobalState : public WindowValueGlobalState { public: - explicit WindowLeadLagGlobalState(ClientContext &client, const WindowValueExecutor &executor, - const idx_t payload_count, const ValidityMask &partition_mask, - const ValidityMask &order_mask) + WindowLeadLagGlobalState(ClientContext &client, const WindowValueExecutor &executor, const idx_t payload_count, + const ValidityMask &partition_mask, const ValidityMask &order_mask) : WindowValueGlobalState(client, executor, payload_count, partition_mask, order_mask) { if (value_tree) { use_framing = true; @@ -231,7 +230,7 @@ class WindowLeadLagGlobalState : public WindowValueGlobalState { //===--------------------------------------------------------------------===// class WindowLeadLagLocalState : public WindowValueLocalState { public: - explicit WindowLeadLagLocalState(ExecutionContext &context, const WindowLeadLagGlobalState &gstate) + WindowLeadLagLocalState(ExecutionContext &context, const WindowLeadLagGlobalState &gstate) : WindowValueLocalState(context, gstate) { if (gstate.row_tree) { local_row = gstate.row_tree->GetLocalState(context); @@ -841,8 +840,17 @@ static fill_value_t GetFillValueFunction(const LogicalType &type) { } } -WindowFillExecutor::WindowFillExecutor(BoundWindowExpression &wexpr, WindowSharedExpressions &shared) +WindowFillExecutor::WindowFillExecutor(BoundWindowExpression &wexpr, ClientContext &client, + WindowSharedExpressions &shared) : WindowValueExecutor(wexpr, shared) { + // If the argument order is prefix of the partition ordering, + // then we can just use the partition ordering. + auto &arg_orders = wexpr.arg_orders; + const auto optimize = ClientConfig::GetConfig(client).enable_optimizer; + if (optimize && BoundWindowExpression::GetSharedOrders(wexpr.orders, arg_orders) == arg_orders.size()) { + arg_order_idx.clear(); + } + // We need the sort values for interpolation, so either use the range or the secondary ordering expression if (arg_order_idx.empty()) { // We use the range ordering, even if it has not been defined @@ -871,8 +879,8 @@ static void WindowFillCopy(WindowCursor &cursor, Vector &result, idx_t count, id class WindowFillGlobalState : public WindowLeadLagGlobalState { public: - explicit WindowFillGlobalState(ClientContext &client, const WindowFillExecutor &executor, const idx_t payload_count, - const ValidityMask &partition_mask, const ValidityMask &order_mask) + WindowFillGlobalState(ClientContext &client, const WindowFillExecutor &executor, const idx_t payload_count, + const ValidityMask &partition_mask, const ValidityMask &order_mask) : WindowLeadLagGlobalState(client, executor, payload_count, partition_mask, order_mask), order_idx(executor.order_idx) { } @@ -885,6 +893,11 @@ class WindowFillLocalState : public WindowLeadLagLocalState { public: WindowFillLocalState(ExecutionContext &context, const WindowLeadLagGlobalState &gvstate) : WindowLeadLagLocalState(context, gvstate) { + // If we optimised the ordering, force computation of the validity range. + if (!gvstate.value_tree) { + state.required.insert(VALID_BEGIN); + state.required.insert(VALID_END); + } } //! Finish the sinking and prepare to scan @@ -1007,6 +1020,9 @@ void WindowFillExecutor::EvaluateInternal(ExecutionContext &context, DataChunk & if (prev_valid == DConstants::INVALID_INDEX) { // Skip to the next partition i += partition_end[i] - row_idx - 1; + if (i >= count) { + return; + } row_idx = partition_end[i] - 1; continue; } @@ -1099,7 +1115,7 @@ void WindowFillExecutor::EvaluateInternal(ExecutionContext &context, DataChunk & } } - // If there is nothing beind us (missing early value) then scan forward + // If there is nothing behind us (missing early value) then scan forward if (prev_valid == DConstants::INVALID_INDEX) { for (idx_t j = row_idx + 1; j < valid_end[i]; ++j) { if (!order_value_func(j, order_cursor)) { @@ -1116,6 +1132,9 @@ void WindowFillExecutor::EvaluateInternal(ExecutionContext &context, DataChunk & if (prev_valid == DConstants::INVALID_INDEX) { // Skip to the next partition i += partition_end[i] - row_idx - 1; + if (i >= count) { + break; + } row_idx = partition_end[i] - 1; continue; } diff --git a/src/duckdb/src/include/duckdb.h b/src/duckdb/src/include/duckdb.h index e8aaa62ba..a9f9e79cd 100644 --- a/src/duckdb/src/include/duckdb.h +++ b/src/duckdb/src/include/duckdb.h @@ -1672,6 +1672,16 @@ Get a pointer to the string data of a string_t */ DUCKDB_C_API const char *duckdb_string_t_data(duckdb_string_t *string); +/*! +Checks if a string is valid UTF-8. + +* @param str The string to check +* @param len The length of the string (in bytes) +* @return nullptr if the string is valid UTF-8. Otherwise, a duckdb_error_data containing error information. Must be +destroyed with `duckdb_destroy_error_data`. +*/ +DUCKDB_C_API duckdb_error_data duckdb_valid_utf8_check(const char *str, idx_t len); + //---------------------------------------------------------------------------------------------------------------------- // Date Time Timestamp Helpers //---------------------------------------------------------------------------------------------------------------------- @@ -2017,6 +2027,8 @@ DUCKDB_C_API duckdb_type duckdb_prepared_statement_column_type(duckdb_prepared_s /*! Binds a value to the prepared statement at the specified index. + +Supersedes all type-specific bind functions (e.g., `duckdb_bind_varchar`, `duckdb_bind_int64`, etc.). */ DUCKDB_C_API duckdb_state duckdb_bind_value(duckdb_prepared_statement prepared_statement, idx_t param_idx, duckdb_value val); @@ -2135,12 +2147,16 @@ DUCKDB_C_API duckdb_state duckdb_bind_interval(duckdb_prepared_statement prepare /*! Binds a null-terminated varchar value to the prepared statement at the specified index. + +Superseded by `duckdb_bind_value`. */ DUCKDB_C_API duckdb_state duckdb_bind_varchar(duckdb_prepared_statement prepared_statement, idx_t param_idx, const char *val); /*! Binds a varchar value to the prepared statement at the specified index. + +Superseded by `duckdb_bind_value`. */ DUCKDB_C_API duckdb_state duckdb_bind_varchar_length(duckdb_prepared_statement prepared_statement, idx_t param_idx, const char *val, idx_t length); @@ -2380,7 +2396,9 @@ Destroys the value and de-allocates all memory allocated for that type. DUCKDB_C_API void duckdb_destroy_value(duckdb_value *value); /*! -Creates a value from a null-terminated string +Creates a value from a null-terminated string. Returns nullptr if the string is not valid UTF-8 or other invalid input. + +Superseded by `duckdb_create_varchar_length`. * @param text The null-terminated string * @return The value. This must be destroyed with `duckdb_destroy_value`. @@ -2388,7 +2406,7 @@ Creates a value from a null-terminated string DUCKDB_C_API duckdb_value duckdb_create_varchar(const char *text); /*! -Creates a value from a string +Creates a value from a string. Returns nullptr if the string is not valid UTF-8 or other invalid input. * @param text The text * @param length The length of the text @@ -3457,38 +3475,44 @@ This allows NULL values to be written to the vector, regardless of whether a val DUCKDB_C_API void duckdb_vector_ensure_validity_writable(duckdb_vector vector); /*! -Safely assigns a string element in the vector at the specified location. Supersedes -`duckdb_vector_assign_string_element`. The vector type must be VARCHAR and the input must be valid UTF-8. Otherwise, it -returns an invalid Unicode error. +Assigns a string element in the vector at the specified location. For VARCHAR vectors, the input is validated as UTF-8; +if invalid, a NULL value is assigned at that index. + +Superseded by `duckdb_unsafe_vector_assign_string_element_len`, optionally combined with `duckdb_valid_utf8_check`. * @param vector The vector to alter * @param index The row position in the vector to assign the string to * @param str The null-terminated string -* @return If valid UTF-8, then `nullptr`, else error information. If not `nullptr`, then the return value must be -destroyed with `duckdb_destroy_error_data`. */ -DUCKDB_C_API duckdb_error_data duckdb_vector_safe_assign_string_element(duckdb_vector vector, idx_t index, - const char *str); +DUCKDB_C_API void duckdb_vector_assign_string_element(duckdb_vector vector, idx_t index, const char *str); /*! -Assigns a string element in the vector at the specified location. +Assigns a string element in the vector at the specified location. For VARCHAR vectors, the input is validated as UTF-8; +if invalid, a NULL value is assigned at that index. For BLOB vectors, no validation is performed. + +Superseded by `duckdb_unsafe_vector_assign_string_element_len`, optionally combined with `duckdb_valid_utf8_check`. * @param vector The vector to alter * @param index The row position in the vector to assign the string to -* @param str The null-terminated string +* @param str The string +* @param str_len The length of the string (in bytes) */ -DUCKDB_C_API void duckdb_vector_assign_string_element(duckdb_vector vector, idx_t index, const char *str); +DUCKDB_C_API void duckdb_vector_assign_string_element_len(duckdb_vector vector, idx_t index, const char *str, + idx_t str_len); /*! -Assigns a string element in the vector at the specified location. You may also use this function to assign BLOBs. +Assigns a string element in the vector at the specified location without UTF-8 validation. The caller is responsible for +ensuring the input is valid UTF-8. Use `duckdb_valid_utf8_check` to validate strings before calling this function if +needed. If the input is known to be valid UTF-8, this function can be called directly for better performance, avoiding +the overhead of redundant validation. * @param vector The vector to alter * @param index The row position in the vector to assign the string to * @param str The string * @param str_len The length of the string (in bytes) */ -DUCKDB_C_API void duckdb_vector_assign_string_element_len(duckdb_vector vector, idx_t index, const char *str, - idx_t str_len); +DUCKDB_C_API void duckdb_unsafe_vector_assign_string_element_len(duckdb_vector vector, idx_t index, const char *str, + idx_t str_len); /*! Retrieves the child vector of a list vector. diff --git a/src/duckdb/src/include/duckdb/catalog/catalog_entry/aggregate_function_catalog_entry.hpp b/src/duckdb/src/include/duckdb/catalog/catalog_entry/aggregate_function_catalog_entry.hpp index 925c4a076..3c8465184 100644 --- a/src/duckdb/src/include/duckdb/catalog/catalog_entry/aggregate_function_catalog_entry.hpp +++ b/src/duckdb/src/include/duckdb/catalog/catalog_entry/aggregate_function_catalog_entry.hpp @@ -10,11 +10,10 @@ #include "duckdb/catalog/catalog_entry/function_entry.hpp" #include "duckdb/catalog/catalog_set.hpp" -#include "duckdb/function/function.hpp" -#include "duckdb/parser/parsed_data/create_aggregate_function_info.hpp" -#include "duckdb/main/attached_database.hpp" +#include "duckdb/function/function_set.hpp" namespace duckdb { +struct CreateAggregateFunctionInfo; //! An aggregate function in the catalog class AggregateFunctionCatalogEntry : public FunctionEntry { @@ -23,13 +22,7 @@ class AggregateFunctionCatalogEntry : public FunctionEntry { static constexpr const char *Name = "aggregate function"; public: - AggregateFunctionCatalogEntry(Catalog &catalog, SchemaCatalogEntry &schema, CreateAggregateFunctionInfo &info) - : FunctionEntry(CatalogType::AGGREGATE_FUNCTION_ENTRY, catalog, schema, info), functions(info.functions) { - for (auto &function : functions.functions) { - function.catalog_name = catalog.GetAttached().GetName(); - function.schema_name = schema.name; - } - } + AggregateFunctionCatalogEntry(Catalog &catalog, SchemaCatalogEntry &schema, CreateAggregateFunctionInfo &info); //! The aggregate functions AggregateFunctionSet functions; diff --git a/src/duckdb/src/include/duckdb/catalog/catalog_entry/view_catalog_entry.hpp b/src/duckdb/src/include/duckdb/catalog/catalog_entry/view_catalog_entry.hpp index c64ffbf9e..b860ec855 100644 --- a/src/duckdb/src/include/duckdb/catalog/catalog_entry/view_catalog_entry.hpp +++ b/src/duckdb/src/include/duckdb/catalog/catalog_entry/view_catalog_entry.hpp @@ -12,12 +12,22 @@ #include "duckdb/parser/statement/select_statement.hpp" #include "duckdb/common/types.hpp" #include "duckdb/common/vector.hpp" +#include "duckdb/common/thread.hpp" +#include "duckdb/common/mutex.hpp" namespace duckdb { class DataTable; struct CreateViewInfo; +enum class ViewBindState { BOUND, BINDING, UNBOUND }; +enum class BindViewAction { BIND_IF_UNBOUND, FORCE_REBIND }; + +struct ViewColumnInfo { + vector types; + vector names; +}; + //! A view catalog entry class ViewCatalogEntry : public StandardEntry { public: @@ -34,12 +44,14 @@ class ViewCatalogEntry : public StandardEntry { string sql; //! The set of aliases associated with the view vector aliases; - //! The returned types of the view - vector types; - //! The returned names of the view - vector names; - //! The comments on the columns of the view: can be empty if there are no comments - vector column_comments; + + //! Returns the view column info, if the view is bound. Otherwise returns `nullptr` + virtual shared_ptr GetColumnInfo() const; + //! Bind a view so we know the types / names returned by it + virtual void BindView(ClientContext &context, BindViewAction action = BindViewAction::BIND_IF_UNBOUND); + //! Update the view with a new set of types / names + virtual void UpdateBinding(const vector &types, const vector &names); + Value GetColumnComment(idx_t column_index); public: unique_ptr GetInfo() const override; @@ -50,13 +62,19 @@ class ViewCatalogEntry : public StandardEntry { virtual const SelectStatement &GetQuery(); - virtual bool HasTypes() const { - // Whether or not the view has types/names defined - return true; - } - string ToSQL() const override; +private: + mutable mutex bind_lock; + //! Columns returned by the view, if bound + shared_ptr view_columns; + //! The current bind state of the view + atomic bind_state; + //! Current binding thread + atomic bind_thread; + //! The comments on the columns of the view: can be empty if there are no comments + unordered_map column_comments; + private: void Initialize(CreateViewInfo &info); }; diff --git a/src/duckdb/src/include/duckdb/catalog/default/builtin_types/types.hpp b/src/duckdb/src/include/duckdb/catalog/default/builtin_types/types.hpp deleted file mode 100644 index f3a71b594..000000000 --- a/src/duckdb/src/include/duckdb/catalog/default/builtin_types/types.hpp +++ /dev/null @@ -1,104 +0,0 @@ -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/catalog/default/builtin_types/types.hpp -// -// -//===----------------------------------------------------------------------===// -// This file is generated by scripts/generate_builtin_types.py - -#pragma once - -#include "duckdb/common/types.hpp" -#include "duckdb/common/array.hpp" - -namespace duckdb { - -struct DefaultType { - const char *name; - LogicalTypeId type; -}; - -using builtin_type_array = std::array; - -static constexpr const builtin_type_array BUILTIN_TYPES{{ - {"decimal", LogicalTypeId::DECIMAL}, - {"dec", LogicalTypeId::DECIMAL}, - {"numeric", LogicalTypeId::DECIMAL}, - {"time", LogicalTypeId::TIME}, - {"time_ns", LogicalTypeId::TIME_NS}, - {"date", LogicalTypeId::DATE}, - {"timestamp", LogicalTypeId::TIMESTAMP}, - {"datetime", LogicalTypeId::TIMESTAMP}, - {"timestamp_us", LogicalTypeId::TIMESTAMP}, - {"timestamp_ms", LogicalTypeId::TIMESTAMP_MS}, - {"timestamp_ns", LogicalTypeId::TIMESTAMP_NS}, - {"timestamp_s", LogicalTypeId::TIMESTAMP_SEC}, - {"timestamptz", LogicalTypeId::TIMESTAMP_TZ}, - {"timetz", LogicalTypeId::TIME_TZ}, - {"interval", LogicalTypeId::INTERVAL}, - {"varchar", LogicalTypeId::VARCHAR}, - {"bpchar", LogicalTypeId::VARCHAR}, - {"string", LogicalTypeId::VARCHAR}, - {"char", LogicalTypeId::VARCHAR}, - {"nvarchar", LogicalTypeId::VARCHAR}, - {"text", LogicalTypeId::VARCHAR}, - {"blob", LogicalTypeId::BLOB}, - {"bytea", LogicalTypeId::BLOB}, - {"varbinary", LogicalTypeId::BLOB}, - {"binary", LogicalTypeId::BLOB}, - {"hugeint", LogicalTypeId::HUGEINT}, - {"int128", LogicalTypeId::HUGEINT}, - {"uhugeint", LogicalTypeId::UHUGEINT}, - {"uint128", LogicalTypeId::UHUGEINT}, - {"bigint", LogicalTypeId::BIGINT}, - {"oid", LogicalTypeId::BIGINT}, - {"long", LogicalTypeId::BIGINT}, - {"int8", LogicalTypeId::BIGINT}, - {"int64", LogicalTypeId::BIGINT}, - {"ubigint", LogicalTypeId::UBIGINT}, - {"uint64", LogicalTypeId::UBIGINT}, - {"integer", LogicalTypeId::INTEGER}, - {"int", LogicalTypeId::INTEGER}, - {"int4", LogicalTypeId::INTEGER}, - {"signed", LogicalTypeId::INTEGER}, - {"integral", LogicalTypeId::INTEGER}, - {"int32", LogicalTypeId::INTEGER}, - {"uinteger", LogicalTypeId::UINTEGER}, - {"uint32", LogicalTypeId::UINTEGER}, - {"smallint", LogicalTypeId::SMALLINT}, - {"int2", LogicalTypeId::SMALLINT}, - {"short", LogicalTypeId::SMALLINT}, - {"int16", LogicalTypeId::SMALLINT}, - {"usmallint", LogicalTypeId::USMALLINT}, - {"uint16", LogicalTypeId::USMALLINT}, - {"tinyint", LogicalTypeId::TINYINT}, - {"int1", LogicalTypeId::TINYINT}, - {"utinyint", LogicalTypeId::UTINYINT}, - {"uint8", LogicalTypeId::UTINYINT}, - {"struct", LogicalTypeId::STRUCT}, - {"row", LogicalTypeId::STRUCT}, - {"list", LogicalTypeId::LIST}, - {"map", LogicalTypeId::MAP}, - {"union", LogicalTypeId::UNION}, - {"bit", LogicalTypeId::BIT}, - {"bitstring", LogicalTypeId::BIT}, - {"variant", LogicalTypeId::VARIANT}, - {"bignum", LogicalTypeId::BIGNUM}, - {"varint", LogicalTypeId::BIGNUM}, - {"boolean", LogicalTypeId::BOOLEAN}, - {"bool", LogicalTypeId::BOOLEAN}, - {"logical", LogicalTypeId::BOOLEAN}, - {"uuid", LogicalTypeId::UUID}, - {"guid", LogicalTypeId::UUID}, - {"enum", LogicalTypeId::ENUM}, - {"null", LogicalTypeId::SQLNULL}, - {"float", LogicalTypeId::FLOAT}, - {"real", LogicalTypeId::FLOAT}, - {"float4", LogicalTypeId::FLOAT}, - {"double", LogicalTypeId::DOUBLE}, - {"float8", LogicalTypeId::DOUBLE}, - {"geometry", LogicalTypeId::GEOMETRY} -}}; - -} // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/catalog/default/default_generator.hpp b/src/duckdb/src/include/duckdb/catalog/default/default_generator.hpp index 02480084a..88161f7c4 100644 --- a/src/duckdb/src/include/duckdb/catalog/default/default_generator.hpp +++ b/src/duckdb/src/include/duckdb/catalog/default/default_generator.hpp @@ -28,6 +28,12 @@ class DefaultGenerator { virtual unique_ptr CreateDefaultEntry(CatalogTransaction transaction, const string &entry_name); //! Get a list of all default entries in the generator virtual vector GetDefaultEntries() = 0; + //! Whether or not we should keep the lock while calling CreateDefaultEntry + //! If this is set to false, CreateDefaultEntry might be called multiple times in parallel also for the same entry + //! Otherwise it will be called exactly once per entry + virtual bool LockDuringCreate() const { + return false; + } }; } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/catalog/default/default_types.hpp b/src/duckdb/src/include/duckdb/catalog/default/default_types.hpp index 83d90982b..5d58a8299 100644 --- a/src/duckdb/src/include/duckdb/catalog/default/default_types.hpp +++ b/src/duckdb/src/include/duckdb/catalog/default/default_types.hpp @@ -22,6 +22,7 @@ class DefaultTypeGenerator : public DefaultGenerator { public: DUCKDB_API static LogicalTypeId GetDefaultType(const string &name); + DUCKDB_API static LogicalType TryDefaultBind(const string &name, const vector> ¶ms); unique_ptr CreateDefaultEntry(ClientContext &context, const string &entry_name) override; vector GetDefaultEntries() override; diff --git a/src/duckdb/src/include/duckdb/common/encryption_key_manager.hpp b/src/duckdb/src/include/duckdb/common/encryption_key_manager.hpp index cec709f4e..dd1970662 100644 --- a/src/duckdb/src/include/duckdb/common/encryption_key_manager.hpp +++ b/src/duckdb/src/include/duckdb/common/encryption_key_manager.hpp @@ -32,6 +32,10 @@ class EncryptionKey { return key; } + data_ptr_t GetData() { + return key; + } + public: static void LockEncryptionKey(data_ptr_t key, idx_t key_len = MainHeader::DEFAULT_ENCRYPTION_KEY_LENGTH); static void UnlockEncryptionKey(data_ptr_t key, idx_t key_len = MainHeader::DEFAULT_ENCRYPTION_KEY_LENGTH); @@ -50,6 +54,8 @@ class EncryptionKeyManager : public ObjectCacheEntry { void AddKey(const string &key_name, data_ptr_t key); bool HasKey(const string &key_name) const; void DeleteKey(const string &key_name); + void ClearKey(const string &key_name); + void EraseKey(const string &key_name); const_data_ptr_t GetKey(const string &key_name) const; public: diff --git a/src/duckdb/src/include/duckdb/common/enums/expression_type.hpp b/src/duckdb/src/include/duckdb/common/enums/expression_type.hpp index 0a5728aa6..8a6f38eae 100644 --- a/src/duckdb/src/include/duckdb/common/enums/expression_type.hpp +++ b/src/duckdb/src/include/duckdb/common/enums/expression_type.hpp @@ -138,6 +138,7 @@ enum class ExpressionType : uint8_t { FUNCTION_REF = 204, TABLE_REF = 205, LAMBDA_REF = 206, + TYPE = 207, // ----------------------------- // Miscellaneous @@ -180,6 +181,7 @@ enum class ExpressionClass : uint8_t { POSITIONAL_REFERENCE = 18, BETWEEN = 19, LAMBDA_REF = 20, + TYPE = 21, //===--------------------------------------------------------------------===// // Bound Expressions //===--------------------------------------------------------------------===// diff --git a/src/duckdb/src/include/duckdb/common/enums/memory_tag.hpp b/src/duckdb/src/include/duckdb/common/enums/memory_tag.hpp index 55dc0b62e..775f8e702 100644 --- a/src/duckdb/src/include/duckdb/common/enums/memory_tag.hpp +++ b/src/duckdb/src/include/duckdb/common/enums/memory_tag.hpp @@ -27,9 +27,12 @@ enum class MemoryTag : uint8_t { EXTENSION = 11, TRANSACTION = 12, EXTERNAL_FILE_CACHE = 13, - WINDOW = 14 + WINDOW = 14, + OBJECT_CACHE = 15, + // Intentionally left as the end, used to indicate memory tag type count. + UNKNOWN = 16, }; -static constexpr const idx_t MEMORY_TAG_COUNT = 15; +static constexpr const idx_t MEMORY_TAG_COUNT = static_cast(MemoryTag::UNKNOWN); } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/common/extra_type_info.hpp b/src/duckdb/src/include/duckdb/common/extra_type_info.hpp index 152e37d15..6fe9e1d00 100644 --- a/src/duckdb/src/include/duckdb/common/extra_type_info.hpp +++ b/src/duckdb/src/include/duckdb/common/extra_type_info.hpp @@ -15,6 +15,8 @@ namespace duckdb { +class ParsedExpression; + //! Extra Type Info Type enum class ExtraTypeInfoType : uint8_t { INVALID_TYPE_INFO = 0, @@ -24,13 +26,13 @@ enum class ExtraTypeInfoType : uint8_t { LIST_TYPE_INFO = 4, STRUCT_TYPE_INFO = 5, ENUM_TYPE_INFO = 6, - USER_TYPE_INFO = 7, + UNBOUND_TYPE_INFO = 7, AGGREGATE_STATE_TYPE_INFO = 8, ARRAY_TYPE_INFO = 9, ANY_TYPE_INFO = 10, INTEGER_LITERAL_TYPE_INFO = 11, TEMPLATE_TYPE_INFO = 12, - GEO_TYPE_INFO = 13 + GEO_TYPE_INFO = 13, }; struct ExtraTypeInfo { @@ -158,28 +160,6 @@ struct AggregateStateTypeInfo : public ExtraTypeInfo { AggregateStateTypeInfo(); }; -struct UserTypeInfo : public ExtraTypeInfo { - explicit UserTypeInfo(string name_p); - UserTypeInfo(string name_p, vector modifiers_p); - UserTypeInfo(string catalog_p, string schema_p, string name_p, vector modifiers_p); - - string catalog; - string schema; - string user_type_name; - vector user_type_modifiers; - -public: - void Serialize(Serializer &serializer) const override; - static shared_ptr Deserialize(Deserializer &source); - shared_ptr Copy() const override; - -protected: - bool EqualsInternal(ExtraTypeInfo *other_p) const override; - -private: - UserTypeInfo(); -}; - // If this type is primarily stored in the catalog or not. Enums from Pandas/Factors are not in the catalog. enum EnumDictType : uint8_t { INVALID = 0, VECTOR_DICT = 1 }; @@ -294,4 +274,20 @@ struct GeoTypeInfo : public ExtraTypeInfo { bool EqualsInternal(ExtraTypeInfo *other_p) const override; }; +struct UnboundTypeInfo : public ExtraTypeInfo { + explicit UnboundTypeInfo(unique_ptr expr_p); + + unique_ptr expr; + + void Serialize(Serializer &serializer) const override; + static shared_ptr Deserialize(Deserializer &source); + shared_ptr Copy() const override; + +protected: + bool EqualsInternal(ExtraTypeInfo *other_p) const override; + +private: + UnboundTypeInfo(); +}; + } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/common/file_open_flags.hpp b/src/duckdb/src/include/duckdb/common/file_open_flags.hpp index 89cd24b78..9f71e2c54 100644 --- a/src/duckdb/src/include/duckdb/common/file_open_flags.hpp +++ b/src/duckdb/src/include/duckdb/common/file_open_flags.hpp @@ -31,6 +31,7 @@ class FileOpenFlags { static constexpr idx_t FILE_FLAGS_NULL_IF_EXISTS = idx_t(1 << 10); static constexpr idx_t FILE_FLAGS_MULTI_CLIENT_ACCESS = idx_t(1 << 11); static constexpr idx_t FILE_FLAGS_DISABLE_LOGGING = idx_t(1 << 12); + static constexpr idx_t FILE_FLAGS_ENABLE_EXTENSION_INSTALL = idx_t(1 << 13); public: FileOpenFlags() = default; @@ -128,6 +129,9 @@ class FileOpenFlags { inline bool DisableLogging() const { return flags & FILE_FLAGS_DISABLE_LOGGING; } + inline bool EnableExtensionInstall() const { + return flags & FILE_FLAGS_ENABLE_EXTENSION_INSTALL; + } inline idx_t GetFlagsInternal() const { return flags; } @@ -173,6 +177,9 @@ class FileFlags { //! Disables logging to avoid infinite loops when using FileHandle-backed log storage static constexpr FileOpenFlags FILE_FLAGS_DISABLE_LOGGING = FileOpenFlags(FileOpenFlags::FILE_FLAGS_DISABLE_LOGGING); + //! Opened file is allowed to be a duckdb_extension + static constexpr FileOpenFlags FILE_FLAGS_ENABLE_EXTENSION_INSTALL = + FileOpenFlags(FileOpenFlags::FILE_FLAGS_ENABLE_EXTENSION_INSTALL); }; } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/common/file_system.hpp b/src/duckdb/src/include/duckdb/common/file_system.hpp index d723340b2..ac5c8d87f 100644 --- a/src/duckdb/src/include/duckdb/common/file_system.hpp +++ b/src/duckdb/src/include/duckdb/common/file_system.hpp @@ -38,6 +38,7 @@ class FileSystem; class Logger; class ClientContext; class QueryContext; +class MultiFileList; enum class FileType { //! Regular file @@ -251,13 +252,20 @@ class FileSystem { DUCKDB_API static bool HasGlob(const string &str); //! Runs a glob on the file system, returning a list of matching files DUCKDB_API virtual vector Glob(const string &path, FileOpener *opener = nullptr); - DUCKDB_API vector GlobFiles(const string &path, ClientContext &context, + DUCKDB_API unique_ptr Glob(const string &path, const FileGlobInput &input, + optional_ptr opener); + DUCKDB_API unique_ptr GlobFileList(const string &path, + const FileGlobInput &input = FileGlobOptions::DISALLOW_EMPTY); + DUCKDB_API vector GlobFiles(const string &pattern, const FileGlobInput &input = FileGlobOptions::DISALLOW_EMPTY); //! registers a sub-file system to handle certain file name prefixes, e.g. http:// etc. DUCKDB_API virtual void RegisterSubSystem(unique_ptr sub_fs); DUCKDB_API virtual void RegisterSubSystem(FileCompressionType compression_type, unique_ptr fs); + //! Unregister a sub-filesystem by name + DUCKDB_API virtual void UnregisterSubSystem(const string &name); + // !Extract a sub-filesystem by name, with ownership transfered, return nullptr if not registered or the subsystem // has been disabled. DUCKDB_API virtual unique_ptr ExtractSubSystem(const string &name); @@ -312,6 +320,10 @@ class FileSystem { optional_ptr opener); DUCKDB_API virtual bool SupportsListFilesExtended() const; + DUCKDB_API virtual unique_ptr GlobFilesExtended(const string &path, const FileGlobInput &input, + optional_ptr opener = nullptr); + DUCKDB_API virtual bool SupportsGlobExtended() const; + public: template TARGET &Cast() { diff --git a/src/duckdb/src/include/duckdb/common/local_file_system.hpp b/src/duckdb/src/include/duckdb/common/local_file_system.hpp index 8d941475e..fce47be65 100644 --- a/src/duckdb/src/include/duckdb/common/local_file_system.hpp +++ b/src/duckdb/src/include/duckdb/common/local_file_system.hpp @@ -67,9 +67,6 @@ class LocalFileSystem : public FileSystem { //! Sync a file handle to disk void FileSync(FileHandle &handle) override; - //! Runs a glob on the file system, returning a list of matching files - vector Glob(const string &path, FileOpener *opener = nullptr) override; - bool CanHandleFile(const string &fpath) override { //! Whether or not a sub-system can handle a specific file path return false; @@ -100,6 +97,8 @@ class LocalFileSystem : public FileSystem { // returns a C-string of the path that trims any file:/ prefix static const char *NormalizeLocalPath(const string &path); + vector FetchFileWithoutGlob(const string &path, optional_ptr opener, bool absolute_path); + protected: bool ListFilesExtended(const string &directory, const std::function &callback, optional_ptr opener) override; @@ -108,12 +107,16 @@ class LocalFileSystem : public FileSystem { return true; } + unique_ptr GlobFilesExtended(const string &path, const FileGlobInput &input, + optional_ptr opener) override; + bool SupportsGlobExtended() const override { + return true; + } + private: //! Set the file pointer of a file handle to a specified location. Reads and writes will happen from this location void SetFilePointer(FileHandle &handle, idx_t location); idx_t GetFilePointer(FileHandle &handle); - - vector FetchFileWithoutGlob(const string &path, FileOpener *opener, bool absolute_path); }; } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/common/lru_cache.hpp b/src/duckdb/src/include/duckdb/common/lru_cache.hpp index 322f5d550..d0a6bbfc3 100644 --- a/src/duckdb/src/include/duckdb/common/lru_cache.hpp +++ b/src/duckdb/src/include/duckdb/common/lru_cache.hpp @@ -11,11 +11,13 @@ #include #include "duckdb/common/common.hpp" +#include "duckdb/common/exception.hpp" #include "duckdb/common/list.hpp" #include "duckdb/common/mutex.hpp" #include "duckdb/common/shared_ptr.hpp" #include "duckdb/common/string.hpp" #include "duckdb/common/unordered_map.hpp" +#include "duckdb/storage/buffer/buffer_pool_reservation.hpp" namespace duckdb { @@ -40,8 +42,13 @@ class SharedLruCache { ~SharedLruCache() = default; // Insert `value` with key `key` and explicit memory size. This will replace any previous entry with the same key. - void Put(Key key, shared_ptr value, idx_t memory_size) { + void Put(Key key, shared_ptr value, unique_ptr reservation) { + if (reservation == nullptr) { + throw InvalidInputException("Reservation cannot be null when emplace into LRU!"); + } + // Remove existing entry if present + const idx_t memory_size = reservation->size; auto existing_it = entry_map.find(key); if (existing_it != entry_map.end()) { DeleteImpl(existing_it); @@ -56,8 +63,8 @@ class SharedLruCache { lru_list.emplace_front(key); Entry new_entry; new_entry.value = std::move(value); - new_entry.memory = memory_size; new_entry.lru_iterator = lru_list.begin(); + new_entry.reservation = std::move(reservation); entry_map[std::move(key)] = std::move(new_entry); current_memory += memory_size; @@ -88,11 +95,29 @@ class SharedLruCache { // Clear the whole cache. void Clear() { + for (auto &entry : entry_map) { + D_ASSERT(entry.second.reservation != nullptr); + entry.second.reservation->Resize(0); + } entry_map.clear(); lru_list.clear(); current_memory = 0; } + // Evict entries based on their access, until we've freed at least the target number of bytes or there's no entries + // in the cache. Return number of bytes freed. + idx_t EvictToReduceMemory(idx_t target_bytes) { + idx_t freed = 0; + while (!lru_list.empty() && freed < target_bytes) { + const auto &stale_key = lru_list.back(); + auto stale_it = entry_map.find(stale_key); + D_ASSERT(stale_it != entry_map.end()); + freed += stale_it->second.reservation->size; + DeleteImpl(stale_it); + } + return freed; + } + idx_t MaxMemory() const { return max_memory; } @@ -102,18 +127,25 @@ class SharedLruCache { size_t Size() const { return entry_map.size(); } + bool IsEmpty() const { + return entry_map.empty(); + } private: struct Entry { shared_ptr value; idx_t memory; typename list::iterator lru_iterator; + // Record memory reservation in the buffer pool, which is used for global memory control. + unique_ptr reservation; }; using EntryMap = unordered_map; void DeleteImpl(typename EntryMap::iterator iter) { - current_memory -= iter->second.memory; + current_memory -= iter->second.reservation->size; + D_ASSERT(current_memory >= 0); + iter->second.reservation->Resize(0); lru_list.erase(iter->second.lru_iterator); entry_map.erase(iter); } diff --git a/src/duckdb/src/include/duckdb/common/multi_file/multi_file_function.hpp b/src/duckdb/src/include/duckdb/common/multi_file/multi_file_function.hpp index d7777a052..13dbf15bf 100644 --- a/src/duckdb/src/include/duckdb/common/multi_file/multi_file_function.hpp +++ b/src/duckdb/src/include/duckdb/common/multi_file/multi_file_function.hpp @@ -122,7 +122,7 @@ class MultiFileFunction : public TableFunction { if (!result->file_options.union_by_name && bound_on_first_file) { file_string = result->file_list->GetFirstFile().path; } else { - for (auto &file : result->file_list->GetPaths()) { + for (auto &file : result->file_list->GetAllFiles()) { if (!file_string.empty()) { file_string += ","; } @@ -708,7 +708,22 @@ class MultiFileFunction : public TableFunction { const GlobalTableFunctionState *global_state) { auto &gstate = global_state->Cast(); - auto total_count = gstate.file_list.GetTotalFileCount(); + // get the file count - for >100 files we allow a lower bound to be given instead + auto count_info = gstate.file_list.GetFileCount(100); + while (count_info.type != FileExpansionType::ALL_FILES_EXPANDED) { + // the entire glob has not yet been expanded - we don't know how many files there are exactly + // we try to postpone expanding the glob by only expanding it once we have scanned 1% of the files + // check if we have reached AT LEAST 1% of progress + idx_t one_percent_min = count_info.count / 100; + if (gstate.completed_file_index < one_percent_min) { + // we have not - just report 0% + return 0.0; + } + // we have reached 1% given the currently known (incomplete) list of files + // retrieve more files to scan + count_info = gstate.file_list.GetFileCount(count_info.count + 1); + } + auto total_count = count_info.count; if (total_count == 0) { return 100.0; } @@ -754,7 +769,14 @@ class MultiFileFunction : public TableFunction { if (file_list_cardinality_estimate) { return file_list_cardinality_estimate; } - return data.interface->GetCardinality(data, data.file_list->GetTotalFileCount()); + // get the file count - for >500 files we allow an estimate + auto count_info = data.file_list->GetFileCount(500); + idx_t estimated_file_count = count_info.count; + if (count_info.type != FileExpansionType::ALL_FILES_EXPANDED) { + // not all files have been expanded - it's probably twice as many files + estimated_file_count *= 2; + } + return data.interface->GetCardinality(data, estimated_file_count); } static void MultiFileComplexFilterPushdown(ClientContext &context, LogicalGet &get, FunctionData *bind_data_p, @@ -776,7 +798,7 @@ class MultiFileFunction : public TableFunction { auto &bind_data = bind_data_p->Cast(); vector file_path; - for (const auto &file : bind_data.file_list->Files()) { + for (const auto &file : bind_data.file_list->GetDisplayFileList()) { file_path.emplace_back(file.path); } @@ -812,7 +834,7 @@ class MultiFileFunction : public TableFunction { result.insert(make_pair("Total Files Read", std::to_string(files_loaded))); constexpr size_t FILE_NAME_LIST_LIMIT = 5; - auto file_paths = gstate.file_list.GetPaths(); + auto file_paths = gstate.file_list.GetDisplayFileList(FILE_NAME_LIST_LIMIT + 1); if (!file_paths.empty()) { vector file_path_names; for (idx_t i = 0; i < MinValue(file_paths.size(), FILE_NAME_LIST_LIMIT); i++) { diff --git a/src/duckdb/src/include/duckdb/common/multi_file/multi_file_list.hpp b/src/duckdb/src/include/duckdb/common/multi_file/multi_file_list.hpp index ded5bad05..077076b14 100644 --- a/src/duckdb/src/include/duckdb/common/multi_file/multi_file_list.hpp +++ b/src/duckdb/src/include/duckdb/common/multi_file/multi_file_list.hpp @@ -17,26 +17,39 @@ namespace duckdb { class MultiFileList; enum class FileExpandResult : uint8_t { NO_FILES, SINGLE_FILE, MULTIPLE_FILES }; +enum class MultiFileListScanType { ALWAYS_FETCH, FETCH_IF_AVAILABLE }; + +enum class FileExpansionType { ALL_FILES_EXPANDED, NOT_ALL_FILES_KNOWN }; struct MultiFileListScanData { idx_t current_file_idx = DConstants::INVALID_INDEX; + MultiFileListScanType scan_type = MultiFileListScanType::ALWAYS_FETCH; +}; + +struct MultiFileCount { + explicit MultiFileCount(idx_t count, FileExpansionType type = FileExpansionType::ALL_FILES_EXPANDED) + : count(count), type(type) { + } + + idx_t count; + FileExpansionType type; }; class MultiFileListIterationHelper { public: - DUCKDB_API explicit MultiFileListIterationHelper(MultiFileList &collection); + DUCKDB_API explicit MultiFileListIterationHelper(const MultiFileList &collection); private: - MultiFileList &file_list; + const MultiFileList &file_list; private: class MultiFileListIterator; class MultiFileListIterator { public: - DUCKDB_API explicit MultiFileListIterator(MultiFileList *file_list); + DUCKDB_API explicit MultiFileListIterator(optional_ptr file_list); - optional_ptr file_list; + optional_ptr file_list; MultiFileListScanData file_scan_data; OpenFileInfo current_file; @@ -69,53 +82,50 @@ struct MultiFilePushdownInfo { //! NOTE: subclasses are responsible for ensuring thread-safety class MultiFileList { public: - MultiFileList(vector paths, FileGlobOptions options); - MultiFileList(vector paths, FileGlobInput input); + MultiFileList(); virtual ~MultiFileList(); - //! Returns the raw, unexpanded paths, pre-filter - const vector GetPaths() const; - //! Get Iterator over the files for pretty for loops - MultiFileListIterationHelper Files(); + MultiFileListIterationHelper Files() const; //! Initialize a sequential scan over a file list - void InitializeScan(MultiFileListScanData &iterator); + void InitializeScan(MultiFileListScanData &iterator) const; //! Scan the next file into result_file, returns false when out of files - bool Scan(MultiFileListScanData &iterator, OpenFileInfo &result_file); + bool Scan(MultiFileListScanData &iterator, OpenFileInfo &result_file) const; //! Returns the first file or an empty string if GetTotalFileCount() == 0 - OpenFileInfo GetFirstFile(); + OpenFileInfo GetFirstFile() const; //! Syntactic sugar for GetExpandResult() == FileExpandResult::NO_FILES - bool IsEmpty(); + bool IsEmpty() const; //! Virtual functions for subclasses public: virtual unique_ptr ComplexFilterPushdown(ClientContext &context, const MultiFileOptions &options, MultiFilePushdownInfo &info, - vector> &filters); + vector> &filters) const; virtual unique_ptr DynamicFilterPushdown(ClientContext &context, const MultiFileOptions &options, const vector &names, const vector &types, const vector &column_ids, TableFilterSet &filters) const; - virtual vector GetAllFiles() = 0; - virtual FileExpandResult GetExpandResult() = 0; - virtual idx_t GetTotalFileCount() = 0; + virtual vector GetAllFiles() const = 0; + virtual FileExpandResult GetExpandResult() const = 0; + //! Get the total file count - forces all files to be expanded / known so the exact count can be computed + virtual idx_t GetTotalFileCount() const = 0; + //! Get the file count - anything under "min_exact_count" is allowed to be incomplete (i.e. `NOT_ALL_FILES_KNOWN`) + //! This allows us to get a rough idea of the file count + virtual MultiFileCount GetFileCount(idx_t min_exact_count = 0) const; + virtual vector GetDisplayFileList(optional_idx max_files = optional_idx()) const; - virtual unique_ptr GetCardinality(ClientContext &context); - virtual unique_ptr Copy(); + virtual unique_ptr GetCardinality(ClientContext &context) const; + virtual unique_ptr Copy() const; protected: + //! Whether or not the file at the index is available instantly - or if this requires additional I/O + virtual bool FileIsAvailable(idx_t i) const; //! Get the i-th expanded file - virtual OpenFileInfo GetFile(idx_t i) = 0; - -protected: - //! The unexpanded input paths - const vector paths; - //! Whether paths can expand to 0 files - const FileGlobInput glob_input; + virtual OpenFileInfo GetFile(idx_t i) const = 0; public: template @@ -136,64 +146,73 @@ class SimpleMultiFileList : public MultiFileList { public: //! Construct a SimpleMultiFileList from a list of already expanded files explicit SimpleMultiFileList(vector paths); - //! Copy `paths` to `filtered_files` and apply the filters - unique_ptr ComplexFilterPushdown(ClientContext &context, const MultiFileOptions &options, - MultiFilePushdownInfo &info, - vector> &filters) override; - unique_ptr DynamicFilterPushdown(ClientContext &context, const MultiFileOptions &options, - const vector &names, const vector &types, - const vector &column_ids, - TableFilterSet &filters) const override; //! Main MultiFileList API - vector GetAllFiles() override; - FileExpandResult GetExpandResult() override; - idx_t GetTotalFileCount() override; + vector GetAllFiles() const override; + FileExpandResult GetExpandResult() const override; + idx_t GetTotalFileCount() const override; protected: //! Main MultiFileList API - OpenFileInfo GetFile(idx_t i) override; + OpenFileInfo GetFile(idx_t i) const override; + +protected: + //! The list of input paths + const vector paths; }; -//! MultiFileList that takes a list of paths and produces a list of files with all globs expanded -class GlobMultiFileList : public MultiFileList { +//! Lazily expanded MultiFileList +class LazyMultiFileList : public MultiFileList { public: - GlobMultiFileList(ClientContext &context, vector paths, FileGlobInput glob_input); - //! Calls ExpandAll, then prunes the expanded_files using the hive/filename filters - unique_ptr ComplexFilterPushdown(ClientContext &context, const MultiFileOptions &options, - MultiFilePushdownInfo &info, - vector> &filters) override; - unique_ptr DynamicFilterPushdown(ClientContext &context, const MultiFileOptions &options, - const vector &names, const vector &types, - const vector &column_ids, - TableFilterSet &filters) const override; + explicit LazyMultiFileList(optional_ptr context); - //! Main MultiFileList API - vector GetAllFiles() override; - FileExpandResult GetExpandResult() override; - idx_t GetTotalFileCount() override; + vector GetAllFiles() const override; + FileExpandResult GetExpandResult() const override; + idx_t GetTotalFileCount() const override; + MultiFileCount GetFileCount(idx_t min_exact_count = 0) const override; protected: - //! Main MultiFileList API - OpenFileInfo GetFile(idx_t i) override; + bool FileIsAvailable(idx_t i) const override; + OpenFileInfo GetFile(idx_t i) const override; - //! Get the i-th expanded file - OpenFileInfo GetFileInternal(idx_t i); - //! Grabs the next path and expands it into Expanded paths: returns false if no more files to expand - bool ExpandNextPath(); //! Grabs the next path and expands it into Expanded paths: returns false if no more files to expand - bool ExpandPathInternal(idx_t ¤t_path, vector &result) const; - //! Whether all files have been expanded - bool IsFullyExpanded() const; + virtual bool ExpandNextPath() const = 0; - //! The ClientContext for globbing - ClientContext &context; - //! The current path to expand - idx_t current_path; - //! The expanded files - vector expanded_files; +private: + bool ExpandNextPathInternal() const; +protected: mutable mutex lock; + //! The expanded files + mutable vector expanded_files; + //! Whether or not all files have been expanded + mutable bool all_files_expanded = false; + optional_ptr context; +}; + +//! MultiFileList that takes a list of globs and resolves all of the globs lazily into files +class GlobMultiFileList : public LazyMultiFileList { +public: + GlobMultiFileList(ClientContext &context, vector globs, FileGlobInput input); + + vector GetDisplayFileList(optional_idx max_files = optional_idx()) const override; + +protected: + bool ExpandNextPath() const override; + +protected: + //! The ClientContext for globbing + ClientContext &context; + //! The list of globs to expand + const vector globs; + //! Glob input + const FileGlobInput glob_input; + //! The current glob to expand + mutable idx_t current_glob; + //! File lists for the underlying globs + mutable vector> file_lists; + //! Current scan state + mutable MultiFileListScanData scan_state; }; } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/common/opener_file_system.hpp b/src/duckdb/src/include/duckdb/common/opener_file_system.hpp index 8197b06af..e3eeab8bd 100644 --- a/src/duckdb/src/include/duckdb/common/opener_file_system.hpp +++ b/src/duckdb/src/include/duckdb/common/opener_file_system.hpp @@ -9,6 +9,7 @@ #pragma once #include "duckdb/common/file_system.hpp" +#include "duckdb/common/multi_file/multi_file_list.hpp" namespace duckdb { @@ -21,6 +22,18 @@ class OpenerFileSystem : public FileSystem { void VerifyNoOpener(optional_ptr opener); void VerifyCanAccessDirectory(const string &path); void VerifyCanAccessFile(const string &path); + void VerifyCanAccessExtension(const string &path, const FileOpenFlags &flags) { + if (flags.OpenForWriting() && !flags.EnableExtensionInstall()) { + throw PermissionException( + "File '%s' cannot be opened for writing since files ending with '.duckdb_extension' are reserved for " + "DuckDB extensions, and these can only be installed through the INSTALL command", + path); + } + } + + bool IsDuckDBExtensionName(const string &path) { + return StringUtil::EndsWith(path, ".duckdb_extension"); + } void Read(FileHandle &handle, void *buffer, int64_t nr_bytes, idx_t location) override { GetFileSystem().Read(handle, buffer, nr_bytes, location); @@ -83,6 +96,13 @@ class OpenerFileSystem : public FileSystem { VerifyNoOpener(opener); VerifyCanAccessFile(source); VerifyCanAccessFile(target); + if (IsDuckDBExtensionName(target) && !IsDuckDBExtensionName(source)) { + throw PermissionException( + "File '%s' cannot be moved to '%s', files ending with '.duckdb_extension' are reserved for DuckDB " + "extensions, and these can only be installed through the INSTALL command, or moved if both are " + "extensions'", + source, target); + } GetFileSystem().MoveFile(source, target, GetOpener()); } @@ -146,6 +166,14 @@ class OpenerFileSystem : public FileSystem { GetFileSystem().RegisterSubSystem(compression_type, std::move(fs)); } + void UnregisterSubSystem(const string &name) override { + GetFileSystem().UnregisterSubSystem(name); + } + + unique_ptr ExtractSubSystem(const string &name) override { + return GetFileSystem().ExtractSubSystem(name); + } + void SetDisabledFileSystems(const vector &names) override { GetFileSystem().SetDisabledFileSystems(names); } @@ -167,6 +195,9 @@ class OpenerFileSystem : public FileSystem { optional_ptr opener = nullptr) override { VerifyNoOpener(opener); VerifyCanAccessFile(file.path); + if (IsDuckDBExtensionName(file.path)) { + VerifyCanAccessExtension(file.path, flags); + } return GetFileSystem().OpenFile(file, flags, GetOpener()); } @@ -185,6 +216,17 @@ class OpenerFileSystem : public FileSystem { return true; } + unique_ptr GlobFilesExtended(const string &path, const FileGlobInput &input, + optional_ptr opener) override { + VerifyNoOpener(opener); + VerifyCanAccessFile(path); + return GetFileSystem().Glob(path, input, GetOpener()); + } + + bool SupportsGlobExtended() const override { + return true; + } + private: void VerifyCanAccessFileInternal(const string &path, FileType type); }; diff --git a/src/duckdb/src/include/duckdb/common/operator/cast_operators.hpp b/src/duckdb/src/include/duckdb/common/operator/cast_operators.hpp index e495e9760..26dbad58c 100644 --- a/src/duckdb/src/include/duckdb/common/operator/cast_operators.hpp +++ b/src/duckdb/src/include/duckdb/common/operator/cast_operators.hpp @@ -1095,4 +1095,16 @@ struct CastFromPointer { template <> duckdb::string_t CastFromPointer::Operation(uintptr_t input, Vector &vector); +//===--------------------------------------------------------------------===// +// Types +//===--------------------------------------------------------------------===// +struct CastFromType { + template + static inline string_t Operation(SRC input, Vector &result) { + throw duckdb::NotImplementedException("Cast from pointer could not be performed!"); + } +}; +template <> +duckdb::string_t CastFromType::Operation(string_t input, Vector &vector); + } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/common/operator/negate.hpp b/src/duckdb/src/include/duckdb/common/operator/negate.hpp new file mode 100644 index 000000000..f5b1f3f7b --- /dev/null +++ b/src/duckdb/src/include/duckdb/common/operator/negate.hpp @@ -0,0 +1,34 @@ +#pragma once + +#include "duckdb/common/limits.hpp" +#include "duckdb/common/exception.hpp" + +namespace duckdb { + +struct NegateOperator { + template + static bool CanNegate(T input) { + using Limits = NumericLimits; + return !(Limits::IsSigned() && Limits::Minimum() == input); + } + + template + static inline TR Operation(TA input) { + if (!CanNegate(input)) { + throw OutOfRangeException("Overflow in negation of numeric value!"); + } + return -(TR)input; + } +}; + +// Specialization for floating point (always negatable) +template <> +inline bool NegateOperator::CanNegate(float input) { + return true; +} +template <> +inline bool NegateOperator::CanNegate(double input) { + return true; +} + +} // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/common/thread.hpp b/src/duckdb/src/include/duckdb/common/thread.hpp index 6c15a662b..99f3aea43 100644 --- a/src/duckdb/src/include/duckdb/common/thread.hpp +++ b/src/duckdb/src/include/duckdb/common/thread.hpp @@ -14,15 +14,19 @@ namespace duckdb { using std::thread; +using thread_id = std::thread::id; -} +} // namespace duckdb +#else +using thread_id = uint64_t; #endif namespace duckdb { struct ThreadUtil { static void SleepMs(idx_t ms); + static thread_id GetThreadId(); }; } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/common/types.hpp b/src/duckdb/src/include/duckdb/common/types.hpp index 343a4e4f0..40c89db26 100644 --- a/src/duckdb/src/include/duckdb/common/types.hpp +++ b/src/duckdb/src/include/duckdb/common/types.hpp @@ -22,6 +22,7 @@ class Value; class TypeCatalogEntry; class Vector; class ClientContext; +class ParsedExpression; class CoordinateReferenceSystem; struct string_t; // NOLINT: mimic std casing @@ -186,8 +187,7 @@ enum class LogicalTypeId : uint8_t { SQLNULL = 1, /* NULL type, used for constant NULL */ UNKNOWN = 2, /* unknown type, used for parameter expressions */ ANY = 3, /* ANY type, used for functions that accept any type as parameter */ - USER = 4, /* A User Defined Type (e.g., ENUMs before the binder) */ - + UNBOUND = 4, /* A parsed but unbound type, used during query planning */ // A "template" type functions as a "placeholder" type for function arguments and return types. // Templates only exist during the binding phase, in the scope of a function, and are replaced with concrete types @@ -196,6 +196,8 @@ enum class LogicalTypeId : uint8_t { // name are always resolved to the same concrete type. TEMPLATE = 5, + TYPE = 6, /* Type type, used for type parameters */ + BOOLEAN = 10, TINYINT = 11, SMALLINT = 12, @@ -284,6 +286,9 @@ struct LogicalType { inline bool IsUnknown() const { return id_ == LogicalTypeId::UNKNOWN; } + inline bool IsUnbound() const { + return id_ == LogicalTypeId::UNBOUND; + } inline shared_ptr GetAuxInfoShrPtr() const { return type_info_; @@ -352,6 +357,7 @@ struct LogicalType { //! Returns the maximum logical type when combining the two types - or throws an exception if combining is not possible DUCKDB_API static LogicalType MaxLogicalType(ClientContext &context, const LogicalType &left, const LogicalType &right); DUCKDB_API static bool TryGetMaxLogicalType(ClientContext &context, const LogicalType &left, const LogicalType &right, LogicalType &result); + DUCKDB_API static bool TryGetMaxLogicalTypeUnchecked(const LogicalType &left, const LogicalType &right, LogicalType &result); //! Forcibly returns a maximum logical type - similar to MaxLogicalType but never throws. As a fallback either left or right are returned. DUCKDB_API static LogicalType ForceMaxLogicalType(const LogicalType &left, const LogicalType &right); //! Normalize a type - removing literals @@ -444,9 +450,8 @@ struct LogicalType { DUCKDB_API static LogicalType INTEGER_LITERAL(const Value &constant); // NOLINT // DEPRECATED - provided for backwards compatibility DUCKDB_API static LogicalType ENUM(const string &enum_name, Vector &ordered_data, idx_t size); // NOLINT - DUCKDB_API static LogicalType USER(const string &user_type_name); // NOLINT - DUCKDB_API static LogicalType USER(const string &user_type_name, const vector &user_type_mods); // NOLINT - DUCKDB_API static LogicalType USER(string catalog, string schema, string name, vector user_type_mods); // NOLINT + DUCKDB_API static LogicalType UNBOUND(unique_ptr expr); // NOLINT + DUCKDB_API static LogicalType TYPE(); // NOLINT //! A list of all NUMERIC types (integral and floating point types) DUCKDB_API static const vector Numeric(); //! A list of all INTEGRAL types @@ -477,12 +482,12 @@ struct ListType { DUCKDB_API static const LogicalType &GetChildType(const LogicalType &type); }; -struct UserType { - DUCKDB_API static const string &GetCatalog(const LogicalType &type); - DUCKDB_API static const string &GetSchema(const LogicalType &type); - DUCKDB_API static const string &GetTypeName(const LogicalType &type); - DUCKDB_API static const vector &GetTypeModifiers(const LogicalType &type); - DUCKDB_API static vector &GetTypeModifiers(LogicalType &type); + +struct UnboundType { + // Try to bind the unbound type into a concrete type, using just the built in types + DUCKDB_API static LogicalType TryParseAndDefaultBind(const string &type_str); + DUCKDB_API static LogicalType TryDefaultBind(const LogicalType &unbound_type); + DUCKDB_API static const unique_ptr &GetTypeExpression(const LogicalType &type); }; struct EnumType { @@ -557,8 +562,6 @@ DUCKDB_API string LogicalTypeIdToString(LogicalTypeId type); DUCKDB_API LogicalTypeId TransformStringToLogicalTypeId(const string &str); -DUCKDB_API LogicalType TransformStringToLogicalType(const string &str); - DUCKDB_API LogicalType TransformStringToLogicalType(const string &str, ClientContext &context); //! The PhysicalType used by the row identifiers column @@ -578,14 +581,16 @@ struct aggregate_state_t { aggregate_state_t() { } // NOLINTNEXTLINE: work around bug in clang-tidy - aggregate_state_t(string function_name_p, LogicalType return_type_p, vector bound_argument_types_p) + aggregate_state_t(string function_name_p, LogicalType return_type_p, vector bound_argument_types_p, LogicalType state_type ) : function_name(std::move(function_name_p)), return_type(std::move(return_type_p)), - bound_argument_types(std::move(bound_argument_types_p)) { + bound_argument_types(std::move(bound_argument_types_p)), state_type(std::move(state_type)) { } string function_name; LogicalType return_type; vector bound_argument_types; + + LogicalType state_type; }; diff --git a/src/duckdb/src/include/duckdb/common/types/null_value.hpp b/src/duckdb/src/include/duckdb/common/types/null_value.hpp index ed96b721a..9cf57f944 100644 --- a/src/duckdb/src/include/duckdb/common/types/null_value.hpp +++ b/src/duckdb/src/include/duckdb/common/types/null_value.hpp @@ -27,11 +27,12 @@ inline T NullValue() { return std::numeric_limits::min(); } -constexpr const char str_nil[2] = {'\200', '\0'}; +//! This could be two bytes but then GCC gives a warning when it's copied +constexpr const char str_nil[4] = {'\200', '\0', '\0', '\0'}; template <> inline const char *NullValue() { - D_ASSERT(str_nil[0] == '\200' && str_nil[1] == '\0'); + D_ASSERT(str_nil[0] == '\200' && str_nil[1] == '\0' && str_nil[2] == '\0' && str_nil[3] == '\0'); return str_nil; } diff --git a/src/duckdb/src/include/duckdb/common/types/type_manager.hpp b/src/duckdb/src/include/duckdb/common/types/type_manager.hpp new file mode 100644 index 000000000..2347bba75 --- /dev/null +++ b/src/duckdb/src/include/duckdb/common/types/type_manager.hpp @@ -0,0 +1,38 @@ +#pragma once + +#include "duckdb/common/types.hpp" +#include "duckdb/common/types/string.hpp" + +namespace duckdb { + +class ClientContext; +class DatabaseInstance; +class CastFunctionSet; +struct DBConfig; + +class TypeManager { +public: + explicit TypeManager(DBConfig &config); + + ~TypeManager(); + + //! Get the CastFunctionSet from the TypeManager + CastFunctionSet &GetCastFunctions(); + + //! Try to parse and bind a logical type from a string. Throws an exception if the type could not be parsed. + LogicalType ParseLogicalType(const string &type_str, ClientContext &context) const; + + //! Get the TypeManager from the DatabaseInstance + static TypeManager &Get(DatabaseInstance &db); + static TypeManager &Get(ClientContext &context); + +private: + //! This has to be a function pointer to avoid the compiler inlining the implementation and + //! blowing up the binary size of extensions that include type_manager.hpp + LogicalType (*parse_function)(const string &, ClientContext &); + + //! The set of cast functions + unique_ptr cast_functions; +}; + +} // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/common/types/value.hpp b/src/duckdb/src/include/duckdb/common/types/value.hpp index 4b54a64d5..b93f5e5b7 100644 --- a/src/duckdb/src/include/duckdb/common/types/value.hpp +++ b/src/duckdb/src/include/duckdb/common/types/value.hpp @@ -36,6 +36,7 @@ class Value { friend struct UnionValue; friend struct ArrayValue; friend struct MapValue; + friend struct TypeValue; public: //! Create an empty NULL value of the specified type @@ -204,6 +205,9 @@ class Value { DUCKDB_API static Value GEOMETRY(const_data_ptr_t data, idx_t len); DUCKDB_API static Value GEOMETRY(const_data_ptr_t data, idx_t len, const CoordinateReferenceSystem &crs); + DUCKDB_API static Value TYPE(const LogicalType &type); + DUCKDB_API static Value TYPE(const string_t &serialized_type); + //! Creates an aggregate state DUCKDB_API static Value AGGREGATE_STATE(const LogicalType &type, const_data_ptr_t data, idx_t len); // NOLINT @@ -468,6 +472,10 @@ struct UnionValue { DUCKDB_API static const LogicalType &GetType(const Value &value); }; +struct TypeValue { + DUCKDB_API static LogicalType GetType(const Value &value); +}; + //! Return the internal integral value for any type that is stored as an integral value internally //! This can be used on values of type integer, uinteger, but also date, timestamp, decimal, etc struct IntegralValue { diff --git a/src/duckdb/src/include/duckdb/common/virtual_file_system.hpp b/src/duckdb/src/include/duckdb/common/virtual_file_system.hpp index 278be615e..2e0bb170f 100644 --- a/src/duckdb/src/include/duckdb/common/virtual_file_system.hpp +++ b/src/duckdb/src/include/duckdb/common/virtual_file_system.hpp @@ -53,11 +53,9 @@ class VirtualFileSystem : public FileSystem { bool TryRemoveFile(const string &filename, optional_ptr opener) override; void RemoveFiles(const vector &filenames, optional_ptr opener) override; - vector Glob(const string &path, FileOpener *opener = nullptr) override; - void RegisterSubSystem(unique_ptr fs) override; void RegisterSubSystem(FileCompressionType compression_type, unique_ptr fs) override; - + void UnregisterSubSystem(const string &name) override; unique_ptr ExtractSubSystem(const string &name) override; vector ListSubSystems() override; @@ -84,6 +82,12 @@ class VirtualFileSystem : public FileSystem { return true; } + unique_ptr GlobFilesExtended(const string &path, const FileGlobInput &input, + optional_ptr opener) override; + bool SupportsGlobExtended() const override { + return true; + } + private: FileSystem &FindFileSystem(const string &path, optional_ptr file_opener); FileSystem &FindFileSystem(shared_ptr ®istry, const string &path, @@ -93,6 +97,7 @@ class VirtualFileSystem : public FileSystem { private: mutex registry_lock; shared_ptr file_system_registry; + vector> unregistered_file_systems; }; } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/execution/expression_executor_state.hpp b/src/duckdb/src/include/duckdb/execution/expression_executor_state.hpp index 112e76109..fdccac78c 100644 --- a/src/duckdb/src/include/duckdb/execution/expression_executor_state.hpp +++ b/src/duckdb/src/include/duckdb/execution/expression_executor_state.hpp @@ -41,6 +41,9 @@ struct ExpressionState { void Verify(ExpressionExecutorState &root); + //! Reset any cached dictionary expression states in this expression state and its children + virtual void ResetDictionaryStates(); + public: template TARGET &Cast() { @@ -67,6 +70,8 @@ struct ExecuteFunctionState : public ExpressionState { bool TryExecuteDictionaryExpression(const BoundFunctionExpression &expr, DataChunk &args, ExpressionState &state, Vector &result); + void ResetDictionaryStates() override; + public: unique_ptr local_state; diff --git a/src/duckdb/src/include/duckdb/execution/index/art/prefix.hpp b/src/duckdb/src/include/duckdb/execution/index/art/prefix.hpp index b8c77733f..9c3b09455 100644 --- a/src/duckdb/src/include/duckdb/execution/index/art/prefix.hpp +++ b/src/duckdb/src/include/duckdb/execution/index/art/prefix.hpp @@ -25,6 +25,7 @@ class Prefix { static constexpr uint8_t ROW_ID_SIZE = sizeof(row_t); static constexpr uint8_t ROW_ID_COUNT = ROW_ID_SIZE - 1; static constexpr uint8_t DEPRECATED_COUNT = 15; + // The child pointer and the in_memory boolean. static constexpr uint8_t METADATA_SIZE = sizeof(Node) + 1; public: diff --git a/src/duckdb/src/include/duckdb/execution/join_hashtable.hpp b/src/duckdb/src/include/duckdb/execution/join_hashtable.hpp index 942997dbb..ecff8166d 100644 --- a/src/duckdb/src/include/duckdb/execution/join_hashtable.hpp +++ b/src/duckdb/src/include/duckdb/execution/join_hashtable.hpp @@ -27,6 +27,7 @@ class BufferHandle; class ColumnDataCollection; struct ColumnDataAppendState; struct ClientConfig; +struct ResidualPredicateInfo; struct JoinHTScanState { public: @@ -60,6 +61,21 @@ class JoinHashTable { public: using ValidityBytes = TemplatedValidityMask; + struct ResidualPredicateProbeState { + //! Evaluation chunk + DataChunk eval_chunk; + SelectionVector selected_sel; + SelectionVector remaining_sel; + + ResidualPredicateProbeState() : selected_sel(STANDARD_VECTOR_SIZE), remaining_sel(STANDARD_VECTOR_SIZE) { + } + + void Initialize(Allocator &allocator, const vector &eval_types, + const vector &initialize_columns) { + eval_chunk.Initialize(allocator, eval_types, initialize_columns, STANDARD_VECTOR_SIZE); + } + }; + #ifdef DUCKDB_HASH_ZERO //! Verify salt when all hashes are 0 static constexpr const idx_t USE_SALT_THRESHOLD = 0; @@ -99,39 +115,40 @@ class JoinHashTable { explicit ScanStructure(JoinHashTable &ht, TupleDataChunkState &key_state); //! Get the next batch of data from the scan structure - void Next(DataChunk &keys, DataChunk &left, DataChunk &result); + void Next(DataChunk &keys, DataChunk &probe_data, DataChunk &result); //! Are pointer chains all pointing to NULL? bool PointersExhausted() const; private: //! Next operator for the inner join - void NextInnerJoin(DataChunk &keys, DataChunk &left, DataChunk &result); - //! Next operator for the semi join - void NextSemiJoin(DataChunk &keys, DataChunk &left, DataChunk &result); - //! Next operator for the anti join - void NextAntiJoin(DataChunk &keys, DataChunk &left, DataChunk &result); - //! Next operator for the RIGHT semi and anti join - void NextRightSemiOrAntiJoin(DataChunk &keys); - //! Next operator for the left outer join - void NextLeftJoin(DataChunk &keys, DataChunk &left, DataChunk &result); - //! Next operator for the mark join - void NextMarkJoin(DataChunk &keys, DataChunk &left, DataChunk &result); - //! Next operator for the single join - void NextSingleJoin(DataChunk &keys, DataChunk &left, DataChunk &result); + void NextInnerJoin(DataChunk &keys, DataChunk &probe_data, DataChunk &result); + void NextSemiJoin(DataChunk &keys, DataChunk &probe_data, DataChunk &result); + void NextAntiJoin(DataChunk &keys, DataChunk &probe_data, DataChunk &result); + void NextRightSemiOrAntiJoin(DataChunk &keys, DataChunk &probe_data); + void NextLeftJoin(DataChunk &keys, DataChunk &probe_data, DataChunk &result); + void NextMarkJoin(DataChunk &keys, DataChunk &probe_data, DataChunk &result); + void NextSingleJoin(DataChunk &keys, DataChunk &probe_data, DataChunk &result); //! Scan the hashtable for matches of the specified keys, setting the found_match[] array to true or false //! for every tuple - void ScanKeyMatches(DataChunk &keys); + void ScanKeyMatches(DataChunk &keys, DataChunk &probe_data); template void NextSemiOrAntiJoin(DataChunk &keys, DataChunk &left, DataChunk &result); - void ConstructMarkJoinResult(DataChunk &join_keys, DataChunk &child, DataChunk &result); - idx_t ScanInnerJoin(DataChunk &keys, SelectionVector &result_vector); + idx_t ScanInnerJoin(DataChunk &keys, DataChunk &probe_data, SelectionVector &result_vector); //! Update the data chunk compaction buffer void UpdateCompactionBuffer(idx_t base_count, SelectionVector &result_vector, idx_t result_count); + //! Apply residual predicate filtering + idx_t ApplyResidualPredicate(DataChunk &probe_data, SelectionVector &match_sel, idx_t match_count, + SelectionVector *no_match_sel); + + private: + unique_ptr residual_executor; + unique_ptr residual_state; + public: void AdvancePointers(); void AdvancePointers(const SelectionVector &sel, idx_t sel_count); @@ -139,7 +156,8 @@ class JoinHashTable { const idx_t count, const idx_t col_idx); void GatherResult(Vector &result, const SelectionVector &sel_vector, const idx_t count, const idx_t col_idx); void GatherResult(Vector &result, const idx_t count, const idx_t col_idx); - idx_t ResolvePredicates(DataChunk &keys, SelectionVector &match_sel, SelectionVector *no_match_sel); + idx_t ResolvePredicates(DataChunk &keys, DataChunk &probe_data, SelectionVector &match_sel, + SelectionVector *no_match_sel); }; public: @@ -175,7 +193,9 @@ class JoinHashTable { }; JoinHashTable(ClientContext &context, const PhysicalOperator &op, const vector &conditions, - vector build_types, JoinType type, const vector &output_columns); + vector build_types, JoinType type, const vector &output_columns, + unique_ptr residual_p, optional_ptr predicate_ptr = nullptr, + const vector &output_in_probe = {}); ~JoinHashTable(); //! Add the given data to the HT @@ -286,6 +306,12 @@ class JoinHashTable { bool insert_duplicate_keys = true; //! Number of probe matches atomic total_probe_matches {0}; + //! Residual predicate to evaluate during probing + optional_ptr residual_predicate; + //! Residual predicate mapping info + unique_ptr residual_info; + //! Mapping from lhs_output_columns positions to lhs_probe_data positions + vector lhs_output_in_probe; struct { mutex mj_lock; diff --git a/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit.hpp b/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit.hpp index 0c5ab2172..c2c920ff1 100644 --- a/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit.hpp +++ b/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit.hpp @@ -70,6 +70,8 @@ class PhysicalLimit : public PhysicalOperator { const BoundLimitNode &offset_val); static bool HandleOffset(DataChunk &input, idx_t ¤t_offset, idx_t offset, idx_t limit); static Value GetDelimiter(ExecutionContext &context, DataChunk &input, const Expression &expr); + + InsertionOrderPreservingMap ParamsToString() const override; }; } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit_percent.hpp b/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit_percent.hpp index 5f9613a3a..eab1186b6 100644 --- a/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit_percent.hpp +++ b/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit_percent.hpp @@ -49,6 +49,8 @@ class PhysicalLimitPercent : public PhysicalOperator { bool IsSink() const override { return true; } + + InsertionOrderPreservingMap ParamsToString() const override; }; } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/execution/operator/helper/physical_streaming_limit.hpp b/src/duckdb/src/include/duckdb/execution/operator/helper/physical_streaming_limit.hpp index 76313fbec..9dc401ae5 100644 --- a/src/duckdb/src/include/duckdb/execution/operator/helper/physical_streaming_limit.hpp +++ b/src/duckdb/src/include/duckdb/execution/operator/helper/physical_streaming_limit.hpp @@ -35,6 +35,8 @@ class PhysicalStreamingLimit : public PhysicalOperator { OrderPreservationType OperatorOrder() const override; bool ParallelOperator() const override; + + InsertionOrderPreservingMap ParamsToString() const override; }; } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/execution/operator/join/physical_comparison_join.hpp b/src/duckdb/src/include/duckdb/execution/operator/join/physical_comparison_join.hpp index 9812d982d..ede809f81 100644 --- a/src/duckdb/src/include/duckdb/execution/operator/join/physical_comparison_join.hpp +++ b/src/duckdb/src/include/duckdb/execution/operator/join/physical_comparison_join.hpp @@ -24,6 +24,8 @@ class PhysicalComparisonJoin : public PhysicalJoin { vector cond, JoinType join_type, idx_t estimated_cardinality); vector conditions; + //! Non-comparison predicate for additional filtering (can be nullptr) + unique_ptr predicate; //! Scans where we should push generated filters into (if any) unique_ptr filter_pushdown; diff --git a/src/duckdb/src/include/duckdb/execution/operator/join/physical_hash_join.hpp b/src/duckdb/src/include/duckdb/execution/operator/join/physical_hash_join.hpp index c8b9c58e7..e9a62e97b 100644 --- a/src/duckdb/src/include/duckdb/execution/operator/join/physical_hash_join.hpp +++ b/src/duckdb/src/include/duckdb/execution/operator/join/physical_hash_join.hpp @@ -9,13 +9,29 @@ #pragma once #include "duckdb/common/value_operations/value_operations.hpp" -#include "duckdb/execution/join_hashtable.hpp" #include "duckdb/execution/operator/join/perfect_hash_join_executor.hpp" #include "duckdb/execution/operator/join/physical_comparison_join.hpp" #include "duckdb/execution/physical_operator.hpp" #include "duckdb/planner/operator/logical_join.hpp" namespace duckdb { +class JoinHashTable; + +//! Residual predicate information for hash joins +struct ResidualPredicateInfo { + unordered_map build_input_to_layout_map; + unordered_map probe_input_to_probe_map; + vector probe_types; + + ResidualPredicateInfo() = default; + unique_ptr Copy() const { + auto result = make_uniq(); + result->build_input_to_layout_map = build_input_to_layout_map; + result->probe_input_to_probe_map = probe_input_to_probe_map; + result->probe_types = probe_types; + return result; + } +}; //! PhysicalHashJoin represents a hash loop join between two tables class PhysicalHashJoin : public PhysicalComparisonJoin { @@ -29,7 +45,7 @@ class PhysicalHashJoin : public PhysicalComparisonJoin { public: PhysicalHashJoin(PhysicalPlan &physical_plan, LogicalOperator &op, PhysicalOperator &left, PhysicalOperator &right, - vector cond, JoinType join_type, const vector &left_projection_map, + vector conds, JoinType join_type, const vector &left_projection_map, const vector &right_projection_map, vector delim_types, idx_t estimated_cardinality, unique_ptr pushdown_info); PhysicalHashJoin(PhysicalPlan &physical_plan, LogicalOperator &op, PhysicalOperator &left, PhysicalOperator &right, @@ -54,6 +70,12 @@ class PhysicalHashJoin : public PhysicalComparisonJoin { //! Join Keys statistics (optional) vector> join_stats; + unique_ptr residual_info; + //! For probe phase (includes predicate columns) + JoinProjectionColumns lhs_probe_columns; + //! Mapping from lhs_output_columns positions to lhs_probe_columns positions + vector lhs_output_in_probe; + public: InsertionOrderPreservingMap ParamsToString() const override; @@ -105,6 +127,19 @@ class PhysicalHashJoin : public PhysicalComparisonJoin { bool ParallelSink() const override { return true; } + +private: + static void ExtractResidualPredicateColumns(unique_ptr &predicate, idx_t probe_column_count, + vector &probe_column_ids, vector &build_column_ids); + + void InitializeResidualPredicate(const vector &lhs_input_types, const vector &probe_cols); + + void InitializeBuildSide(const vector &lhs_input_types, const vector &rhs_input_types, + const vector &right_projection_map, const vector &build_cols); + void MapResidualBuildColumns(const vector &lhs_input_types, const vector &rhs_input_types, + const vector &build_cols, + const unordered_map &build_columns_in_conditions, + unordered_map &build_input_to_layout); }; } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/execution/operator/join/physical_nested_loop_join.hpp b/src/duckdb/src/include/duckdb/execution/operator/join/physical_nested_loop_join.hpp index 2536a2016..ef7cc91e4 100644 --- a/src/duckdb/src/include/duckdb/execution/operator/join/physical_nested_loop_join.hpp +++ b/src/duckdb/src/include/duckdb/execution/operator/join/physical_nested_loop_join.hpp @@ -25,9 +25,6 @@ class PhysicalNestedLoopJoin : public PhysicalComparisonJoin { PhysicalOperator &right, vector cond, JoinType join_type, idx_t estimated_cardinality); - // Predicate (join conditions that don't reference both sides) - unique_ptr predicate; - public: // Operator Interface unique_ptr GetOperatorState(ExecutionContext &context) const override; diff --git a/src/duckdb/src/include/duckdb/execution/operator/join/physical_range_join.hpp b/src/duckdb/src/include/duckdb/execution/operator/join/physical_range_join.hpp index 86bf51dc2..85f38ec97 100644 --- a/src/duckdb/src/include/duckdb/execution/operator/join/physical_range_join.hpp +++ b/src/duckdb/src/include/duckdb/execution/operator/join/physical_range_join.hpp @@ -154,8 +154,8 @@ class PhysicalRangeJoin : public PhysicalComparisonJoin { public: // Gather the result values and slice the payload columns to those values. static void SliceSortedPayload(DataChunk &chunk, GlobalSortedTable &table, ExternalBlockIteratorState &state, - TupleDataChunkState &chunk_state, const idx_t chunk_idx, const vector &result, - SortedRunScanState &scan_state); + TupleDataChunkState &chunk_state, const idx_t chunk_idx, + const unsafe_vector &result, SortedRunScanState &scan_state); // Apply a tail condition to the current selection static idx_t SelectJoinTail(const ExpressionType &condition, Vector &left, Vector &right, const SelectionVector *sel, idx_t count, SelectionVector *true_sel); diff --git a/src/duckdb/src/include/duckdb/function/aggregate_function.hpp b/src/duckdb/src/include/duckdb/function/aggregate_function.hpp index 1ac83bc0a..6259fe519 100644 --- a/src/duckdb/src/include/duckdb/function/aggregate_function.hpp +++ b/src/duckdb/src/include/duckdb/function/aggregate_function.hpp @@ -90,6 +90,8 @@ typedef void (*aggregate_serialize_t)(Serializer &serializer, const optional_ptr const AggregateFunction &function); typedef unique_ptr (*aggregate_deserialize_t)(Deserializer &deserializer, AggregateFunction &function); +typedef LogicalType (*aggregate_get_state_type_t)(const AggregateFunction &function); + struct AggregateFunctionInfo { DUCKDB_API virtual ~AggregateFunctionInfo(); @@ -270,6 +272,8 @@ class AggregateFunction : public BaseScalarFunction { // NOLINT: work-around bug //! Whether or not the aggregate is affect by distinct modifiers AggregateDistinctDependent distinct_dependent; + aggregate_get_state_type_t get_state_type = nullptr; + AggregateOrderDependent GetOrderDependent() const { return order_dependent; } @@ -283,6 +287,15 @@ class AggregateFunction : public BaseScalarFunction { // NOLINT: work-around bug distinct_dependent = value; } + bool HasGetStateTypeCallback() const { + return get_state_type != nullptr; + } + + LogicalType GetStateType() const { + D_ASSERT(get_state_type); + return get_state_type(*this); + } + //! Additional function info, passed to the bind shared_ptr function_info; diff --git a/src/duckdb/src/include/duckdb/function/cast/default_casts.hpp b/src/duckdb/src/include/duckdb/function/cast/default_casts.hpp index 107b482b7..cab0e28f7 100644 --- a/src/duckdb/src/include/duckdb/function/cast/default_casts.hpp +++ b/src/duckdb/src/include/duckdb/function/cast/default_casts.hpp @@ -171,6 +171,7 @@ struct DefaultCasts { static BoundCastInfo VariantCastSwitch(BindCastInput &input, const LogicalType &source, const LogicalType &target); static BoundCastInfo UUIDCastSwitch(BindCastInput &input, const LogicalType &source, const LogicalType &target); static BoundCastInfo GeoCastSwitch(BindCastInput &input, const LogicalType &source, const LogicalType &target); + static BoundCastInfo TypeCastSwitch(BindCastInput &input, const LogicalType &source, const LogicalType &target); static BoundCastInfo BignumCastSwitch(BindCastInput &input, const LogicalType &source, const LogicalType &target); static BoundCastInfo ImplicitToUnionCast(BindCastInput &input, const LogicalType &source, const LogicalType &target); diff --git a/src/duckdb/src/include/duckdb/function/cast/variant/primitive_to_variant.hpp b/src/duckdb/src/include/duckdb/function/cast/variant/primitive_to_variant.hpp index 9aa105bd3..250daef4a 100644 --- a/src/duckdb/src/include/duckdb/function/cast/variant/primitive_to_variant.hpp +++ b/src/duckdb/src/include/duckdb/function/cast/variant/primitive_to_variant.hpp @@ -392,6 +392,8 @@ bool ConvertPrimitiveToVariant(ToVariantSourceData &source, ToVariantGlobalResul case LogicalTypeId::BIT: return ConvertPrimitiveTemplated( source, result, count, selvec, values_index_selvec, empty_payload, is_root); + case LogicalTypeId::TYPE: + throw NotImplementedException("Cannot convert TYPE to VARIANT"); default: throw NotImplementedException("Invalid LogicalType (%s) for ConvertToVariant", EnumUtil::ToString(logical_type)); diff --git a/src/duckdb/src/include/duckdb/function/variant/variant_value_convert.hpp b/src/duckdb/src/include/duckdb/function/variant/variant_value_convert.hpp index 3b83418fa..5565c472b 100644 --- a/src/duckdb/src/include/duckdb/function/variant/variant_value_convert.hpp +++ b/src/duckdb/src/include/duckdb/function/variant/variant_value_convert.hpp @@ -103,7 +103,16 @@ struct ValueConverter { static Value VisitArray(const UnifiedVariantVectorData &variant, idx_t row, const VariantNestedData &nested_data) { auto array_items = VariantVisitor::VisitArrayItems(variant, row, nested_data); - return Value::LIST(LogicalType::VARIANT(), std::move(array_items)); + if (array_items.empty()) { + return Value::LIST(LogicalType::VARIANT(), std::move(array_items)); + } + auto &child_type = array_items[0].type(); + for (idx_t i = 1; i < array_items.size(); i++) { + if (child_type != array_items[i].type()) { + return Value::LIST(LogicalType::VARIANT(), std::move(array_items)); + } + } + return Value::LIST(child_type, std::move(array_items)); } static Value VisitObject(const UnifiedVariantVectorData &variant, idx_t row, const VariantNestedData &nested_data) { diff --git a/src/duckdb/src/include/duckdb/function/window/window_value_function.hpp b/src/duckdb/src/include/duckdb/function/window/window_value_function.hpp index 4504cfc30..04a0fae39 100644 --- a/src/duckdb/src/include/duckdb/function/window/window_value_function.hpp +++ b/src/duckdb/src/include/duckdb/function/window/window_value_function.hpp @@ -79,7 +79,7 @@ class WindowNthValueExecutor : public WindowValueExecutor { class WindowFillExecutor : public WindowValueExecutor { public: - WindowFillExecutor(BoundWindowExpression &wexpr, WindowSharedExpressions &shared); + WindowFillExecutor(BoundWindowExpression &wexpr, ClientContext &client, WindowSharedExpressions &shared); //! Never ignore nulls (that's the point!) bool IgnoreNulls() const override { diff --git a/src/duckdb/src/include/duckdb/main/appender.hpp b/src/duckdb/src/include/duckdb/main/appender.hpp index b637717f8..f1b6c091f 100644 --- a/src/duckdb/src/include/duckdb/main/appender.hpp +++ b/src/duckdb/src/include/duckdb/main/appender.hpp @@ -14,11 +14,12 @@ namespace duckdb { -class ColumnDataCollection; class ClientContext; +class ColumnDataCollection; +class Connection; class DuckDB; +class SQLStatement; class TableCatalogEntry; -class Connection; enum class AppenderType : uint8_t { LOGICAL, // Cast input -> LogicalType @@ -31,6 +32,14 @@ class BaseAppender { //! The amount of tuples that are gathered in the column data collection before flushing. static constexpr const idx_t DEFAULT_FLUSH_COUNT = STANDARD_VECTOR_SIZE * 100ULL; +public: + //! Returns a table reference to the appended data. + static unique_ptr GetColumnDataTableRef(ColumnDataCollection &collection, const string &table_name, + const vector &expected_names); + //! Parses the statement to append data. + static unique_ptr ParseStatement(unique_ptr table_ref, const string &query, + const string &table_name); + protected: //! The allocator for the column data collection. Allocator &allocator; @@ -148,6 +157,11 @@ class Appender : public BaseAppender { void AppendDefault(DataChunk &chunk, idx_t col, idx_t row) override; void AddColumn(const string &name) override; void ClearColumns() override; + //! Get the expected names based on the active columns. + vector GetExpectedNames(); + //! Construct a query that appends data from, typically, a column data collection. + static string ConstructQuery(TableDescription &description_p, const string &table_name, + const vector &expected_names); private: //! A shared pointer to the context of this appender. @@ -176,11 +190,11 @@ class QueryAppender : public BaseAppender { private: //! A shared pointer to the context of this appender. weak_ptr context; - //! The query to run + //! The query to run. string query; - //! The column names of the to-be-appended data, or "col1, col2, ..." if empty + //! The column names of the to-be-appended data, or "col1, col2, ...", if empty. vector names; - //! The table name that we can reference in the query, or "appended_data" if empty + //! The table name that we can reference in the query, or "appended_data", if empty. string table_name; protected: diff --git a/src/duckdb/src/include/duckdb/main/capi/extension_api.hpp b/src/duckdb/src/include/duckdb/main/capi/extension_api.hpp index b32dd04df..9be892ef5 100644 --- a/src/duckdb/src/include/duckdb/main/capi/extension_api.hpp +++ b/src/duckdb/src/include/duckdb/main/capi/extension_api.hpp @@ -644,6 +644,7 @@ typedef struct { // New string functions that are added char *(*duckdb_value_to_string)(duckdb_value value); + duckdb_error_data (*duckdb_valid_utf8_check)(const char *str, idx_t len); // New functions around the table description idx_t (*duckdb_table_description_get_column_count)(duckdb_table_description table_description); @@ -671,7 +672,8 @@ typedef struct { sel_t *(*duckdb_selection_vector_get_data_ptr)(duckdb_selection_vector sel); void (*duckdb_vector_copy_sel)(duckdb_vector src, duckdb_vector dst, duckdb_selection_vector sel, idx_t src_count, idx_t src_offset, idx_t dst_offset); - duckdb_error_data (*duckdb_vector_safe_assign_string_element)(duckdb_vector vector, idx_t index, const char *str); + void (*duckdb_unsafe_vector_assign_string_element_len)(duckdb_vector vector, idx_t index, const char *str, + idx_t str_len); } duckdb_ext_api_v1; //===--------------------------------------------------------------------===// @@ -1206,6 +1208,7 @@ inline duckdb_ext_api_v1 CreateAPIv1() { result.duckdb_scalar_function_init_get_bind_data = duckdb_scalar_function_init_get_bind_data; result.duckdb_scalar_function_init_get_extra_info = duckdb_scalar_function_init_get_extra_info; result.duckdb_value_to_string = duckdb_value_to_string; + result.duckdb_valid_utf8_check = duckdb_valid_utf8_check; result.duckdb_table_description_get_column_count = duckdb_table_description_get_column_count; result.duckdb_table_description_get_column_type = duckdb_table_description_get_column_type; result.duckdb_table_function_get_client_context = duckdb_table_function_get_client_context; @@ -1222,7 +1225,7 @@ inline duckdb_ext_api_v1 CreateAPIv1() { result.duckdb_destroy_selection_vector = duckdb_destroy_selection_vector; result.duckdb_selection_vector_get_data_ptr = duckdb_selection_vector_get_data_ptr; result.duckdb_vector_copy_sel = duckdb_vector_copy_sel; - result.duckdb_vector_safe_assign_string_element = duckdb_vector_safe_assign_string_element; + result.duckdb_unsafe_vector_assign_string_element_len = duckdb_unsafe_vector_assign_string_element_len; return result; } diff --git a/src/duckdb/src/include/duckdb/main/client_context.hpp b/src/duckdb/src/include/duckdb/main/client_context.hpp index 962ad0cde..d0ca215dc 100644 --- a/src/duckdb/src/include/duckdb/main/client_context.hpp +++ b/src/duckdb/src/include/duckdb/main/client_context.hpp @@ -12,6 +12,7 @@ #include "duckdb/catalog/catalog_set.hpp" #include "duckdb/common/atomic.hpp" #include "duckdb/common/deque.hpp" +#include "duckdb/common/optional_idx.hpp" #include "duckdb/common/enums/pending_execution_result.hpp" #include "duckdb/common/enums/prepared_statement_mode.hpp" #include "duckdb/common/error_data.hpp" @@ -79,6 +80,8 @@ class ClientContext : public enable_shared_from_this { shared_ptr db; //! Whether or not the query is interrupted atomic interrupted; + //! The deadline for the current query (milliseconds since epoch) + optional_idx query_deadline; //! Set of optional states (e.g. Caches) that can be held by the ClientContext unique_ptr registered_state; //! The logger to be used by this ClientContext @@ -101,6 +104,9 @@ class ClientContext : public enable_shared_from_this { DUCKDB_API void ClearInterrupt(); DUCKDB_API void CancelTransaction(); + //! Check for interrupt or timeout, throws InterruptException if triggered + DUCKDB_API void InterruptCheck() const; + //! Enable query profiling DUCKDB_API void EnableProfiling(); //! Disable query profiling @@ -136,12 +142,10 @@ class ClientContext : public enable_shared_from_this { const string &table_name); //! Get the table info of a specific table, or nullptr if it cannot be found. Uses INVALID_CATALOG. DUCKDB_API unique_ptr TableInfo(const string &schema_name, const string &table_name); - //! Execute a query with the given collection "attached" to the query using a CTE - DUCKDB_API void Append(ColumnDataCollection &collection, const string &query, const vector &column_names, - const string &collection_name); - //! Appends a DataChunk and its default columns to the specified table. - DUCKDB_API void Append(TableDescription &description, ColumnDataCollection &collection, - optional_ptr> column_ids = nullptr); + //! Executes a query with the given collection "attached" to the query using a CTE. + DUCKDB_API void Append(unique_ptr stmt); + //! Appends a ColumnDataCollection to the described table. + DUCKDB_API void Append(TableDescription &description, ColumnDataCollection &collection); //! Try to bind a relation in the current client context; either throws an exception or fills the result_columns //! list with the set of returned columns @@ -233,6 +237,8 @@ class ClientContext : public enable_shared_from_this { //! Process an error for display to the user DUCKDB_API void ProcessError(ErrorData &error, const string &query) const; + DUCKDB_API LogicalType ParseLogicalType(const string &type); + private: //! Parse statements and resolve pragmas from a query vector> ParseStatements(ClientContextLock &lock, const string &query); diff --git a/src/duckdb/src/include/duckdb/main/config.hpp b/src/duckdb/src/include/duckdb/main/config.hpp index e66bea925..e36e43af3 100644 --- a/src/duckdb/src/include/duckdb/main/config.hpp +++ b/src/duckdb/src/include/duckdb/main/config.hpp @@ -30,15 +30,13 @@ #include "duckdb/execution/index/index_type_set.hpp" #include "duckdb/function/cast/default_casts.hpp" #include "duckdb/function/replacement_scan.hpp" -#include "duckdb/optimizer/optimizer_extension.hpp" -#include "duckdb/parser/parsed_data/create_info.hpp" -#include "duckdb/parser/parser_extension.hpp" -#include "duckdb/planner/operator_extension.hpp" #include "duckdb/storage/compression/bitpacking.hpp" #include "duckdb/function/encoding_function.hpp" #include "duckdb/main/setting_info.hpp" #include "duckdb/logging/log_manager.hpp" #include "duckdb/main/user_settings.hpp" +#include "duckdb/parser/parsed_data/create_info.hpp" +#include "duckdb/common/types/type_manager.hpp" namespace duckdb { @@ -59,6 +57,8 @@ class CompressionInfo; class EncryptionUtil; class HTTPUtil; class DatabaseFilePathManager; +class ExtensionCallbackManager; +class TypeManager; struct CompressionFunctionSet; struct DatabaseCacheEntry; @@ -190,24 +190,14 @@ struct DBConfig { unique_ptr block_allocator; //! Database configuration options DBConfigOptions options; - //! Extensions made to the parser - vector parser_extensions; - //! Extensions made to the optimizer - vector optimizer_extensions; //! Error manager unique_ptr error_manager; //! A reference to the (shared) default allocator (Allocator::DefaultAllocator) shared_ptr default_allocator; - //! Extensions made to binder - vector> operator_extensions; - //! Extensions made to storage - case_insensitive_map_t> storage_extensions; //! A buffer pool can be shared across multiple databases (if desired). shared_ptr buffer_pool; //! Provide a custom buffer manager implementation (if desired). shared_ptr buffer_manager; - //! Set of callbacks that can be installed by extensions - vector> extension_callbacks; //! Encryption Util for OpenSSL shared_ptr encryption_util; //! HTTP Request utility functions @@ -287,6 +277,7 @@ struct DBConfig { bool operator!=(const DBConfig &other); DUCKDB_API CastFunctionSet &GetCastFunctions(); + DUCKDB_API TypeManager &GetTypeManager(); DUCKDB_API CollationBinding &GetCollationBinding(); DUCKDB_API IndexTypeSet &GetIndexTypes(); static idx_t GetSystemMaxThreads(FileSystem &fs); @@ -310,15 +301,18 @@ struct DBConfig { void AddAllowedDirectory(const string &path); void AddAllowedPath(const string &path); string SanitizeAllowedPath(const string &path) const; + ExtensionCallbackManager &GetCallbackManager(); + const ExtensionCallbackManager &GetCallbackManager() const; private: mutable mutex config_lock; unique_ptr compression_functions; unique_ptr encoding_functions; unique_ptr arrow_extensions; - unique_ptr cast_functions; + unique_ptr type_manager; unique_ptr collation_bindings; unique_ptr index_types; + unique_ptr callback_manager; bool is_user_config = true; }; diff --git a/src/duckdb/src/include/duckdb/main/connection.hpp b/src/duckdb/src/include/duckdb/main/connection.hpp index 1c88757fc..164dec6b8 100644 --- a/src/duckdb/src/include/duckdb/main/connection.hpp +++ b/src/duckdb/src/include/duckdb/main/connection.hpp @@ -139,9 +139,7 @@ class Connection { //! Extract the logical plan that corresponds to a query DUCKDB_API unique_ptr ExtractPlan(const string &query); - //! Appends a DataChunk to the specified table - DUCKDB_API void Append(TableDescription &description, DataChunk &chunk); - //! Appends a ColumnDataCollection to the specified table + //! Appends a ColumnDataCollection to the described table. DUCKDB_API void Append(TableDescription &description, ColumnDataCollection &collection); //! Returns a relation that produces a table from this connection diff --git a/src/duckdb/src/include/duckdb/main/extension_callback_manager.hpp b/src/duckdb/src/include/duckdb/main/extension_callback_manager.hpp new file mode 100644 index 000000000..a44108f0f --- /dev/null +++ b/src/duckdb/src/include/duckdb/main/extension_callback_manager.hpp @@ -0,0 +1,79 @@ +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/main/extension_callback_manager.hpp +// +// +//===----------------------------------------------------------------------===// + +#pragma once + +#include "duckdb/common/mutex.hpp" +#include "duckdb/common/optional_ptr.hpp" +#include "duckdb/common/shared_ptr.hpp" +#include "duckdb/common/vector.hpp" + +namespace duckdb { + +class ClientContext; +class DatabaseInstance; +class ExtensionCallback; +class OperatorExtension; +class OptimizerExtension; +class ParserExtension; +class PlannerExtension; +class StorageExtension; +struct ExtensionCallbackRegistry; + +template +class ExtensionCallbackIteratorHelper; + +class ExtensionCallbackManager { +public: + ExtensionCallbackManager(); + ~ExtensionCallbackManager(); + + static ExtensionCallbackManager &Get(ClientContext &context); + static ExtensionCallbackManager &Get(DatabaseInstance &db); + static const ExtensionCallbackManager &Get(const ClientContext &context); + + void Register(ParserExtension extension); + void Register(PlannerExtension extension); + void Register(OptimizerExtension extension); + void Register(shared_ptr extension); + void Register(const string &name, shared_ptr extension); + void Register(shared_ptr extension); + + ExtensionCallbackIteratorHelper> OperatorExtensions() const; + ExtensionCallbackIteratorHelper OptimizerExtensions() const; + ExtensionCallbackIteratorHelper ParserExtensions() const; + ExtensionCallbackIteratorHelper PlannerExtensions() const; + ExtensionCallbackIteratorHelper> ExtensionCallbacks() const; + optional_ptr FindStorageExtension(const string &name) const; + bool HasParserExtensions() const; + +private: + mutex registry_lock; + shared_ptr callback_registry; +}; + +template +class ExtensionCallbackIteratorHelper { +public: + ExtensionCallbackIteratorHelper(const vector &vec, shared_ptr callback_registry); + ~ExtensionCallbackIteratorHelper(); + +private: + const vector &vec; + shared_ptr callback_registry; + +public: + typename vector::const_iterator begin() { // NOLINT: match stl API + return vec.cbegin(); + } + typename vector::const_iterator end() { // NOLINT: match stl API + return vec.cend(); + } +}; + +} // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/main/extension_entries.hpp b/src/duckdb/src/include/duckdb/main/extension_entries.hpp index 2ea4cc2ce..8738619fa 100644 --- a/src/duckdb/src/include/duckdb/main/extension_entries.hpp +++ b/src/duckdb/src/include/duckdb/main/extension_entries.hpp @@ -211,6 +211,7 @@ static constexpr ExtensionFunctionEntry EXTENSION_FUNCTIONS[] = { {"get_bit", "core_functions", CatalogType::SCALAR_FUNCTION_ENTRY}, {"get_current_time", "icu", CatalogType::SCALAR_FUNCTION_ENTRY}, {"get_current_timestamp", "core_functions", CatalogType::SCALAR_FUNCTION_ENTRY}, + {"get_type", "core_functions", CatalogType::SCALAR_FUNCTION_ENTRY}, {"grade_up", "core_functions", CatalogType::SCALAR_FUNCTION_ENTRY}, {"greatest", "core_functions", CatalogType::SCALAR_FUNCTION_ENTRY}, {"greatest_common_divisor", "core_functions", CatalogType::SCALAR_FUNCTION_ENTRY}, @@ -453,6 +454,7 @@ static constexpr ExtensionFunctionEntry EXTENSION_FUNCTIONS[] = { {"make_timestamp_ms", "core_functions", CatalogType::SCALAR_FUNCTION_ENTRY}, {"make_timestamp_ns", "core_functions", CatalogType::SCALAR_FUNCTION_ENTRY}, {"make_timestamptz", "icu", CatalogType::SCALAR_FUNCTION_ENTRY}, + {"make_type", "core_functions", CatalogType::SCALAR_FUNCTION_ENTRY}, {"map", "core_functions", CatalogType::SCALAR_FUNCTION_ENTRY}, {"map_concat", "core_functions", CatalogType::SCALAR_FUNCTION_ENTRY}, {"map_entries", "core_functions", CatalogType::SCALAR_FUNCTION_ENTRY}, @@ -628,6 +630,7 @@ static constexpr ExtensionFunctionEntry EXTENSION_FUNCTIONS[] = { {"st_hasm", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY}, {"st_hasz", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY}, {"st_hilbert", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY}, + {"st_interiorringn", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY}, {"st_interpolatepoint", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY}, {"st_intersection", "spatial", CatalogType::SCALAR_FUNCTION_ENTRY}, {"st_intersection_agg", "spatial", CatalogType::AGGREGATE_FUNCTION_ENTRY}, @@ -1207,7 +1210,7 @@ static constexpr const char *AUTOLOADABLE_EXTENSIONS[] = {"avro", "postgres_scanner", "tpcds", "tpch", - "uc_catalog", + "unity_catalog", "ui"}; // END_OF_AUTOLOADABLE_EXTENSIONS } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/main/extension_helper.hpp b/src/duckdb/src/include/duckdb/main/extension_helper.hpp index 4f5fc7621..6dd63f7db 100644 --- a/src/duckdb/src/include/duckdb/main/extension_helper.hpp +++ b/src/duckdb/src/include/duckdb/main/extension_helper.hpp @@ -127,8 +127,15 @@ class ExtensionHelper { static vector GetExtensionDirectoryPath(ClientContext &context); static vector GetExtensionDirectoryPath(DatabaseInstance &db, FileSystem &fs); + // Check signature of an Extension stored as FileHandle static bool CheckExtensionSignature(FileHandle &handle, ParsedExtensionMetaData &parsed_metadata, const bool allow_community_extensions); + // Check signature of an Extension, represented by a buffer and total_buffer_length, and a signature to be added + static bool CheckExtensionBufferSignature(const char *buffer, idx_t buffer_length, const string &signature, + const bool allow_community_extensions); + // Check signature of an Extension, represented by a buffer and total_buffer_length + static bool CheckExtensionBufferSignature(const char *buffer, idx_t total_buffer_length, + const bool allow_community_extensions); static ParsedExtensionMetaData ParseExtensionMetaData(const char *metadata) noexcept; static ParsedExtensionMetaData ParseExtensionMetaData(FileHandle &handle); diff --git a/src/duckdb/src/include/duckdb/main/secret/secret.hpp b/src/duckdb/src/include/duckdb/main/secret/secret.hpp index fd8a1b241..cc6ad1c94 100644 --- a/src/duckdb/src/include/duckdb/main/secret/secret.hpp +++ b/src/duckdb/src/include/duckdb/main/secret/secret.hpp @@ -252,7 +252,7 @@ class KeyValueSecret : public BaseSecret { class KeyValueSecretReader { public: //! Manually pass in a secret reference - KeyValueSecretReader(const KeyValueSecret &secret_p, FileOpener &opener_p) : secret(secret_p) {}; + KeyValueSecretReader(const KeyValueSecret &secret_p, FileOpener &opener_p); //! Initializes the KeyValueSecretReader by fetching the secret automatically KeyValueSecretReader(FileOpener &opener_p, optional_ptr info, const char **secret_types, diff --git a/src/duckdb/src/include/duckdb/main/secret/secret_manager.hpp b/src/duckdb/src/include/duckdb/main/secret/secret_manager.hpp index 80fb46044..8ba703dcd 100644 --- a/src/duckdb/src/include/duckdb/main/secret/secret_manager.hpp +++ b/src/duckdb/src/include/duckdb/main/secret/secret_manager.hpp @@ -16,8 +16,10 @@ #include "duckdb/parser/parsed_data/create_secret_info.hpp" namespace duckdb { -class SecretManager; + +struct BoundStatement; struct DBConfig; +class SecretManager; class SchemaCatalogEntry; //! A Secret Entry in the secret manager @@ -217,6 +219,9 @@ class DefaultSecretGenerator : public DefaultGenerator { unique_ptr CreateDefaultEntry(CatalogTransaction transaction, const string &entry_name) override; unique_ptr CreateDefaultEntry(ClientContext &context, const string &entry_name) override; vector GetDefaultEntries() override; + bool LockDuringCreate() const override { + return true; + } protected: unique_ptr CreateDefaultEntryInternal(const string &entry_name); diff --git a/src/duckdb/src/include/duckdb/main/settings.hpp b/src/duckdb/src/include/duckdb/main/settings.hpp index 4506c1231..32835c430 100644 --- a/src/duckdb/src/include/duckdb/main/settings.hpp +++ b/src/duckdb/src/include/duckdb/main/settings.hpp @@ -1070,6 +1070,16 @@ struct LoggingStorage { static Value GetSetting(const ClientContext &context); }; +struct MaxExecutionTimeSetting { + using RETURN_TYPE = int64_t; + static constexpr const char *Name = "max_execution_time"; + static constexpr const char *Description = "The maximum execution time per query in milliseconds (0 = no limit)"; + static constexpr const char *InputType = "BIGINT"; + static constexpr const char *DefaultValue = "0"; + static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_ONLY; + static constexpr idx_t SettingIndex = 62; +}; + struct MaxExpressionDepthSetting { using RETURN_TYPE = idx_t; static constexpr const char *Name = "max_expression_depth"; @@ -1079,7 +1089,7 @@ struct MaxExpressionDepthSetting { static constexpr const char *InputType = "UBIGINT"; static constexpr const char *DefaultValue = "1000"; static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; - static constexpr idx_t SettingIndex = 62; + static constexpr idx_t SettingIndex = 63; }; struct MaxMemorySetting { @@ -1110,7 +1120,7 @@ struct MaxVacuumTasksSetting { static constexpr const char *InputType = "UBIGINT"; static constexpr const char *DefaultValue = "100"; static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; - static constexpr idx_t SettingIndex = 63; + static constexpr idx_t SettingIndex = 64; }; struct MergeJoinThresholdSetting { @@ -1120,7 +1130,7 @@ struct MergeJoinThresholdSetting { static constexpr const char *InputType = "UBIGINT"; static constexpr const char *DefaultValue = "1000"; static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; - static constexpr idx_t SettingIndex = 64; + static constexpr idx_t SettingIndex = 65; }; struct NestedLoopJoinThresholdSetting { @@ -1131,7 +1141,7 @@ struct NestedLoopJoinThresholdSetting { static constexpr const char *InputType = "UBIGINT"; static constexpr const char *DefaultValue = "5"; static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; - static constexpr idx_t SettingIndex = 65; + static constexpr idx_t SettingIndex = 66; }; struct OldImplicitCastingSetting { @@ -1141,7 +1151,7 @@ struct OldImplicitCastingSetting { static constexpr const char *InputType = "BOOLEAN"; static constexpr const char *DefaultValue = "false"; static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; - static constexpr idx_t SettingIndex = 66; + static constexpr idx_t SettingIndex = 67; }; struct OrderByNonIntegerLiteralSetting { @@ -1152,7 +1162,7 @@ struct OrderByNonIntegerLiteralSetting { static constexpr const char *InputType = "BOOLEAN"; static constexpr const char *DefaultValue = "false"; static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; - static constexpr idx_t SettingIndex = 67; + static constexpr idx_t SettingIndex = 68; }; struct OrderedAggregateThresholdSetting { @@ -1162,7 +1172,7 @@ struct OrderedAggregateThresholdSetting { static constexpr const char *InputType = "UBIGINT"; static constexpr const char *DefaultValue = "262144"; static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; - static constexpr idx_t SettingIndex = 68; + static constexpr idx_t SettingIndex = 69; static void OnSet(SettingCallbackInfo &info, Value &input); }; @@ -1174,7 +1184,7 @@ struct PartitionedWriteFlushThresholdSetting { static constexpr const char *InputType = "UBIGINT"; static constexpr const char *DefaultValue = "524288"; static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; - static constexpr idx_t SettingIndex = 69; + static constexpr idx_t SettingIndex = 70; }; struct PartitionedWriteMaxOpenFilesSetting { @@ -1185,7 +1195,7 @@ struct PartitionedWriteMaxOpenFilesSetting { static constexpr const char *InputType = "UBIGINT"; static constexpr const char *DefaultValue = "100"; static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; - static constexpr idx_t SettingIndex = 70; + static constexpr idx_t SettingIndex = 71; }; struct PasswordSetting { @@ -1195,7 +1205,7 @@ struct PasswordSetting { static constexpr const char *InputType = "VARCHAR"; static constexpr const char *DefaultValue = ""; static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; - static constexpr idx_t SettingIndex = 71; + static constexpr idx_t SettingIndex = 72; }; struct PerfectHtThresholdSetting { @@ -1205,7 +1215,7 @@ struct PerfectHtThresholdSetting { static constexpr const char *InputType = "UBIGINT"; static constexpr const char *DefaultValue = "12"; static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; - static constexpr idx_t SettingIndex = 72; + static constexpr idx_t SettingIndex = 73; static void OnSet(SettingCallbackInfo &info, Value &input); }; @@ -1217,7 +1227,7 @@ struct PinThreadsSetting { static constexpr const char *InputType = "VARCHAR"; static constexpr const char *DefaultValue = "auto"; static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; - static constexpr idx_t SettingIndex = 73; + static constexpr idx_t SettingIndex = 74; static void OnSet(SettingCallbackInfo &info, Value &input); }; @@ -1229,7 +1239,7 @@ struct PivotFilterThresholdSetting { static constexpr const char *InputType = "UBIGINT"; static constexpr const char *DefaultValue = "20"; static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; - static constexpr idx_t SettingIndex = 74; + static constexpr idx_t SettingIndex = 75; }; struct PivotLimitSetting { @@ -1239,7 +1249,7 @@ struct PivotLimitSetting { static constexpr const char *InputType = "UBIGINT"; static constexpr const char *DefaultValue = "100000"; static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; - static constexpr idx_t SettingIndex = 75; + static constexpr idx_t SettingIndex = 76; }; struct PreferRangeJoinsSetting { @@ -1249,7 +1259,7 @@ struct PreferRangeJoinsSetting { static constexpr const char *InputType = "BOOLEAN"; static constexpr const char *DefaultValue = "false"; static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; - static constexpr idx_t SettingIndex = 76; + static constexpr idx_t SettingIndex = 77; }; struct PreserveIdentifierCaseSetting { @@ -1260,7 +1270,7 @@ struct PreserveIdentifierCaseSetting { static constexpr const char *InputType = "BOOLEAN"; static constexpr const char *DefaultValue = "true"; static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; - static constexpr idx_t SettingIndex = 77; + static constexpr idx_t SettingIndex = 78; }; struct PreserveInsertionOrderSetting { @@ -1272,7 +1282,7 @@ struct PreserveInsertionOrderSetting { static constexpr const char *InputType = "BOOLEAN"; static constexpr const char *DefaultValue = "true"; static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; - static constexpr idx_t SettingIndex = 78; + static constexpr idx_t SettingIndex = 79; }; struct ProduceArrowStringViewSetting { @@ -1283,7 +1293,7 @@ struct ProduceArrowStringViewSetting { static constexpr const char *InputType = "BOOLEAN"; static constexpr const char *DefaultValue = "false"; static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; - static constexpr idx_t SettingIndex = 79; + static constexpr idx_t SettingIndex = 80; }; struct ProfileOutputSetting { @@ -1336,7 +1346,7 @@ struct ScalarSubqueryErrorOnMultipleRowsSetting { static constexpr const char *InputType = "BOOLEAN"; static constexpr const char *DefaultValue = "true"; static constexpr SettingScopeTarget Scope = SettingScopeTarget::LOCAL_DEFAULT; - static constexpr idx_t SettingIndex = 80; + static constexpr idx_t SettingIndex = 81; }; struct SchedulerProcessPartialSetting { @@ -1351,7 +1361,7 @@ struct SchedulerProcessPartialSetting { static constexpr const char *DefaultValue = "false"; #endif static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; - static constexpr idx_t SettingIndex = 81; + static constexpr idx_t SettingIndex = 82; }; struct SchemaSetting { @@ -1393,7 +1403,7 @@ struct StorageBlockPrefetchSetting { static constexpr const char *InputType = "VARCHAR"; static constexpr const char *DefaultValue = "REMOTE_ONLY"; static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; - static constexpr idx_t SettingIndex = 82; + static constexpr idx_t SettingIndex = 83; static void OnSet(SettingCallbackInfo &info, Value &input); }; @@ -1435,7 +1445,7 @@ struct TempFileEncryptionSetting { static constexpr const char *InputType = "BOOLEAN"; static constexpr const char *DefaultValue = "false"; static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; - static constexpr idx_t SettingIndex = 83; + static constexpr idx_t SettingIndex = 84; static void OnSet(SettingCallbackInfo &info, Value &input); }; @@ -1456,7 +1466,7 @@ struct UsernameSetting { static constexpr const char *InputType = "VARCHAR"; static constexpr const char *DefaultValue = ""; static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; - static constexpr idx_t SettingIndex = 84; + static constexpr idx_t SettingIndex = 85; }; struct ValidateExternalFileCacheSetting { @@ -1468,7 +1478,7 @@ struct ValidateExternalFileCacheSetting { static constexpr const char *InputType = "VARCHAR"; static constexpr const char *DefaultValue = "VALIDATE_ALL"; static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; - static constexpr idx_t SettingIndex = 85; + static constexpr idx_t SettingIndex = 86; static void OnSet(SettingCallbackInfo &info, Value &input); }; @@ -1480,7 +1490,7 @@ struct VariantMinimumShreddingSizeSetting { static constexpr const char *InputType = "BIGINT"; static constexpr const char *DefaultValue = "30000"; static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; - static constexpr idx_t SettingIndex = 86; + static constexpr idx_t SettingIndex = 87; }; struct WriteBufferRowGroupCountSetting { @@ -1491,7 +1501,7 @@ struct WriteBufferRowGroupCountSetting { static constexpr const char *InputType = "UBIGINT"; static constexpr const char *DefaultValue = "5"; static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_DEFAULT; - static constexpr idx_t SettingIndex = 87; + static constexpr idx_t SettingIndex = 88; }; struct ZstdMinStringLengthSetting { @@ -1502,11 +1512,11 @@ struct ZstdMinStringLengthSetting { static constexpr const char *InputType = "UBIGINT"; static constexpr const char *DefaultValue = "4096"; static constexpr SettingScopeTarget Scope = SettingScopeTarget::GLOBAL_ONLY; - static constexpr idx_t SettingIndex = 88; + static constexpr idx_t SettingIndex = 89; }; struct GeneratedSettingInfo { - static constexpr idx_t MaxSettingIndex = 89; + static constexpr idx_t MaxSettingIndex = 90; }; //===----------------------------------------------------------------------===// diff --git a/src/duckdb/src/include/duckdb/optimizer/join_order/query_graph_manager.hpp b/src/duckdb/src/include/duckdb/optimizer/join_order/query_graph_manager.hpp index e98868115..2a13c7034 100644 --- a/src/duckdb/src/include/duckdb/optimizer/join_order/query_graph_manager.hpp +++ b/src/duckdb/src/include/duckdb/optimizer/join_order/query_graph_manager.hpp @@ -55,6 +55,7 @@ class FilterInfo { optional_ptr right_set; ColumnBinding left_binding; ColumnBinding right_binding; + bool from_residual_predicate = false; void SetLeftSet(optional_ptr left_set_new); void SetRightSet(optional_ptr right_set_new); diff --git a/src/duckdb/src/include/duckdb/optimizer/optimizer_extension.hpp b/src/duckdb/src/include/duckdb/optimizer/optimizer_extension.hpp index d2202fcb1..4ea4b323d 100644 --- a/src/duckdb/src/include/duckdb/optimizer/optimizer_extension.hpp +++ b/src/duckdb/src/include/duckdb/optimizer/optimizer_extension.hpp @@ -10,9 +10,10 @@ #include "duckdb/common/common.hpp" #include "duckdb/planner/logical_operator.hpp" +#include "duckdb/main/extension_callback_manager.hpp" namespace duckdb { - +struct DBConfig; class Optimizer; class ClientContext; @@ -44,6 +45,11 @@ class OptimizerExtension { //! Additional optimizer info passed to the optimize functions shared_ptr optimizer_info; + + static void Register(DBConfig &config, OptimizerExtension extension); + static ExtensionCallbackIteratorHelper Iterate(ClientContext &context) { + return ExtensionCallbackManager::Get(context).OptimizerExtensions(); + } }; } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/optimizer/topn_window_elimination.hpp b/src/duckdb/src/include/duckdb/optimizer/topn_window_elimination.hpp index 0fb5ba00c..2a52f432b 100644 --- a/src/duckdb/src/include/duckdb/optimizer/topn_window_elimination.hpp +++ b/src/duckdb/src/include/duckdb/optimizer/topn_window_elimination.hpp @@ -11,6 +11,7 @@ #include "duckdb/main/client_context.hpp" #include "duckdb/optimizer/column_binding_replacer.hpp" #include "duckdb/optimizer/remove_unused_columns.hpp" +#include "duckdb/optimizer/optimizer.hpp" namespace duckdb { diff --git a/src/duckdb/src/include/duckdb/parallel/pipeline.hpp b/src/duckdb/src/include/duckdb/parallel/pipeline.hpp index 45e603467..0d8a665a5 100644 --- a/src/duckdb/src/include/duckdb/parallel/pipeline.hpp +++ b/src/duckdb/src/include/duckdb/parallel/pipeline.hpp @@ -86,6 +86,7 @@ class Pipeline : public enable_shared_from_this { ClientContext &GetClientContext(); void AddDependency(shared_ptr &pipeline); + vector> GetDependencies() const; void Ready(); void Reset(); diff --git a/src/duckdb/src/include/duckdb/parser/expression/list.hpp b/src/duckdb/src/include/duckdb/parser/expression/list.hpp index 0114a55a2..c6d84ec4b 100644 --- a/src/duckdb/src/include/duckdb/parser/expression/list.hpp +++ b/src/duckdb/src/include/duckdb/parser/expression/list.hpp @@ -17,3 +17,4 @@ #include "duckdb/parser/expression/star_expression.hpp" #include "duckdb/parser/expression/subquery_expression.hpp" #include "duckdb/parser/expression/window_expression.hpp" +#include "duckdb/parser/expression/type_expression.hpp" diff --git a/src/duckdb/src/include/duckdb/parser/expression/type_expression.hpp b/src/duckdb/src/include/duckdb/parser/expression/type_expression.hpp new file mode 100644 index 000000000..e26e2fc4e --- /dev/null +++ b/src/duckdb/src/include/duckdb/parser/expression/type_expression.hpp @@ -0,0 +1,66 @@ +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/parser/expression/type_expression.hpp +// +// +//===----------------------------------------------------------------------===// + +#pragma once + +#include "duckdb/common/vector.hpp" +#include "duckdb/parser/parsed_expression.hpp" +#include "duckdb/parser/keyword_helper.hpp" + +namespace duckdb { + +class TypeExpression : public ParsedExpression { +public: + static constexpr const ExpressionClass TYPE = ExpressionClass::TYPE; + + TypeExpression(string catalog, string schema, string type_name, vector> children); + TypeExpression(string type_name, vector> children); + +public: + const string &GetTypeName() const { + return type_name; + } + const string &GetSchema() const { + return schema; + } + const string &GetCatalog() const { + return catalog; + } + const vector> &GetChildren() const { + return children; + } + vector> &GetChildren() { + return children; + } + +public: + string ToString() const override; + + unique_ptr Copy() const override; + + static bool Equal(const TypeExpression &a, const TypeExpression &b); + hash_t Hash() const override; + + void Serialize(Serializer &serializer) const override; + static unique_ptr Deserialize(Deserializer &deserializer); + + void Verify() const override; + +private: + TypeExpression(); + + //! Qualified name parts + string catalog; + string schema; + string type_name; + + //! Children of the type expression (e.g. type parameters) + vector> children; +}; + +} // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/parser/keyword_helper.hpp b/src/duckdb/src/include/duckdb/parser/keyword_helper.hpp index d53951105..5a621321b 100644 --- a/src/duckdb/src/include/duckdb/parser/keyword_helper.hpp +++ b/src/duckdb/src/include/duckdb/parser/keyword_helper.hpp @@ -16,20 +16,22 @@ namespace duckdb { class KeywordHelper { public: //! Returns true if the given text matches a keyword of the parser - static bool IsKeyword(const string &text); + static bool IsKeyword(const string &text, KeywordCategory category = KeywordCategory::KEYWORD_NONE); static KeywordCategory KeywordCategoryType(const string &text); static string EscapeQuotes(const string &text, char quote = '"'); //! Returns true if the given string needs to be quoted when written as an identifier - static bool RequiresQuotes(const string &text, bool allow_caps = true); + static bool RequiresQuotes(const string &text, bool allow_caps = true, + KeywordCategory category = KeywordCategory::KEYWORD_NONE); //! Writes a string that is quoted static string WriteQuoted(const string &text, char quote = '\''); //! Writes a string that is optionally quoted + escaped so it can be used as an identifier - static string WriteOptionallyQuoted(const string &text, char quote = '"', bool allow_caps = true); + static string WriteOptionallyQuoted(const string &text, char quote = '"', bool allow_caps = true, + KeywordCategory category = KeywordCategory::KEYWORD_NONE); }; } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/parser/parsed_data/alter_table_info.hpp b/src/duckdb/src/include/duckdb/parser/parsed_data/alter_table_info.hpp index 1408d6e28..0730f7642 100644 --- a/src/duckdb/src/include/duckdb/parser/parsed_data/alter_table_info.hpp +++ b/src/duckdb/src/include/duckdb/parser/parsed_data/alter_table_info.hpp @@ -84,7 +84,9 @@ enum class AlterTableType : uint8_t { SET_SORTED_BY = 13, ADD_FIELD = 14, REMOVE_FIELD = 15, - RENAME_FIELD = 16 + RENAME_FIELD = 16, + SET_TABLE_OPTIONS = 17, + RESET_TABLE_OPTIONS = 18, }; struct AlterTableInfo : public AlterInfo { @@ -493,4 +495,44 @@ struct SetSortedByInfo : public AlterTableInfo { SetSortedByInfo(); }; +//===--------------------------------------------------------------------===// +// SetOptionsInfo +//===--------------------------------------------------------------------===// +struct SetTableOptionsInfo : public AlterTableInfo { + SetTableOptionsInfo(AlterEntryData data, case_insensitive_map_t> table_options); + ~SetTableOptionsInfo() override; + + case_insensitive_map_t> table_options; + +public: + unique_ptr Copy() const override; + string ToString() const override; + + void Serialize(Serializer &serializer) const override; + static unique_ptr Deserialize(Deserializer &deserializer); + +private: + SetTableOptionsInfo(); +}; + +//===--------------------------------------------------------------------===// +// ResetOptionsInfo +//===--------------------------------------------------------------------===// +struct ResetTableOptionsInfo : public AlterTableInfo { + ResetTableOptionsInfo(AlterEntryData data, case_insensitive_set_t table_options); + ~ResetTableOptionsInfo() override; + + case_insensitive_set_t table_options; + +public: + unique_ptr Copy() const override; + string ToString() const override; + + void Serialize(Serializer &serializer) const override; + static unique_ptr Deserialize(Deserializer &deserializer); + +private: + ResetTableOptionsInfo(); +}; + } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/parser/parsed_data/create_type_info.hpp b/src/duckdb/src/include/duckdb/parser/parsed_data/create_type_info.hpp index 2c4eb983f..8d25b626a 100644 --- a/src/duckdb/src/include/duckdb/parser/parsed_data/create_type_info.hpp +++ b/src/duckdb/src/include/duckdb/parser/parsed_data/create_type_info.hpp @@ -13,14 +13,42 @@ namespace duckdb { +class TypeArgument { +public: + TypeArgument(string name_p, Value value_p) : name(std::move(name_p)), value(std::move(value_p)) { + } + const string &GetName() const { + return name; + } + const Value &GetValue() const { + return value; + } + bool HasName() const { + return !name.empty(); + } + bool IsNamed(const char *name_to_check) const { + return StringUtil::CIEquals(name, name_to_check); + } + bool IsNotNull() const { + return !value.IsNull(); + } + const LogicalType &GetType() const { + return value.type(); + } + +private: + string name; + Value value; +}; + struct BindLogicalTypeInput { - ClientContext &context; + optional_ptr context; const LogicalType &base_type; - const vector &modifiers; + const vector &modifiers; }; //! The type to bind type modifiers to a type -typedef LogicalType (*bind_logical_type_function_t)(const BindLogicalTypeInput &input); +typedef LogicalType (*bind_logical_type_function_t)(BindLogicalTypeInput &input); struct CreateTypeInfo : public CreateInfo { CreateTypeInfo(); diff --git a/src/duckdb/src/include/duckdb/parser/parsed_data/create_view_info.hpp b/src/duckdb/src/include/duckdb/parser/parsed_data/create_view_info.hpp index f45f9ecb5..cb005325e 100644 --- a/src/duckdb/src/include/duckdb/parser/parsed_data/create_view_info.hpp +++ b/src/duckdb/src/include/duckdb/parser/parsed_data/create_view_info.hpp @@ -30,7 +30,7 @@ struct CreateViewInfo : public CreateInfo { //! Names of the query vector names; //! Comments on columns of the query. Note: vector can be empty when no comments are set - vector column_comments; + unordered_map column_comments_map; //! The SelectStatement of the view unique_ptr query; @@ -49,6 +49,11 @@ struct CreateViewInfo : public CreateInfo { DUCKDB_API static unique_ptr Deserialize(Deserializer &deserializer); string ToString() const override; + +private: + CreateViewInfo(vector names, vector comments, unordered_map column_comments); + + vector GetColumnCommentsList() const; }; } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/parser/parser_extension.hpp b/src/duckdb/src/include/duckdb/parser/parser_extension.hpp index cf264adc7..b97349a74 100644 --- a/src/duckdb/src/include/duckdb/parser/parser_extension.hpp +++ b/src/duckdb/src/include/duckdb/parser/parser_extension.hpp @@ -14,6 +14,7 @@ #include "duckdb/parser/sql_statement.hpp" namespace duckdb { +struct DBConfig; //! The ParserExtensionInfo holds static information relevant to the parser extension //! It is made available in the parse_function, and will be kept alive as long as the database system is kept alive @@ -114,6 +115,8 @@ class ParserExtension { //! Additional parser info passed to the parse function shared_ptr parser_info; + + static void Register(DBConfig &config, ParserExtension extension); }; } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/parser/parser_options.hpp b/src/duckdb/src/include/duckdb/parser/parser_options.hpp index 2a83b6ad3..2d8227aca 100644 --- a/src/duckdb/src/include/duckdb/parser/parser_options.hpp +++ b/src/duckdb/src/include/duckdb/parser/parser_options.hpp @@ -10,15 +10,17 @@ #include "duckdb/common/common.hpp" #include "duckdb/common/enums/allow_parser_override.hpp" +#include "duckdb/common/optional_ptr.hpp" namespace duckdb { +class ExtensionCallbackManager; class ParserExtension; struct ParserOptions { bool preserve_identifier_case = true; bool integer_division = false; idx_t max_expression_depth = 1000; - const vector *extensions = nullptr; + optional_ptr extensions; AllowParserOverride parser_override_setting = AllowParserOverride::DEFAULT_OVERRIDE; }; diff --git a/src/duckdb/src/include/duckdb/parser/query_node.hpp b/src/duckdb/src/include/duckdb/parser/query_node.hpp index 4981e8afc..98f085523 100644 --- a/src/duckdb/src/include/duckdb/parser/query_node.hpp +++ b/src/duckdb/src/include/duckdb/parser/query_node.hpp @@ -41,7 +41,6 @@ class CommonTableExpressionMap { CommonTableExpressionMap Copy() const; void Serialize(Serializer &serializer) const; - // static void Deserialize(Deserializer &deserializer, CommonTableExpressionMap &ret); static CommonTableExpressionMap Deserialize(Deserializer &deserializer); }; diff --git a/src/duckdb/src/include/duckdb/parser/tableref/expressionlistref.hpp b/src/duckdb/src/include/duckdb/parser/tableref/expressionlistref.hpp index 7d0bd86e1..a38bd422b 100644 --- a/src/duckdb/src/include/duckdb/parser/tableref/expressionlistref.hpp +++ b/src/duckdb/src/include/duckdb/parser/tableref/expressionlistref.hpp @@ -14,7 +14,9 @@ #include "duckdb/common/vector.hpp" namespace duckdb { -//! Represents an expression list as generated by a VALUES statement + +//! A table reference that consists of a list of expressions. +//! The expression list is generated by, e.g., a VALUES statement. class ExpressionListRef : public TableRef { public: static constexpr const TableReferenceType TYPE = TableReferenceType::EXPRESSION_LIST; @@ -23,11 +25,11 @@ class ExpressionListRef : public TableRef { ExpressionListRef() : TableRef(TableReferenceType::EXPRESSION_LIST) { } - //! Value list, only used for VALUES statement + //! Value list like in a VALUES statement. vector>> values; - //! Expected SQL types + //! Expected table types. vector expected_types; - //! The set of expected names + //! Expected table names. vector expected_names; public: diff --git a/src/duckdb/src/include/duckdb/parser/transformer.hpp b/src/duckdb/src/include/duckdb/parser/transformer.hpp index de6eb2c4d..460755566 100644 --- a/src/duckdb/src/include/duckdb/parser/transformer.hpp +++ b/src/duckdb/src/include/duckdb/parser/transformer.hpp @@ -157,7 +157,7 @@ class Transformer { void TransformCopyOptions(CopyInfo &info, optional_ptr options); void TransformCreateSecretOptions(CreateSecretInfo &info, optional_ptr options); void TransformTableOptions(case_insensitive_map_t> &info, - optional_ptr options); + optional_ptr options, bool throw_if_value = false); //! Transform a Postgres duckdb_libpgquery::T_PGTransactionStmt node into a TransactionStatement unique_ptr TransformTransaction(duckdb_libpgquery::PGTransactionStmt &stmt); //! Transform a Postgres T_DeleteStatement node into a DeleteStatement @@ -193,8 +193,6 @@ class Transformer { unique_ptr CreatePivotStatement(unique_ptr statement); PivotColumn TransformPivotColumn(duckdb_libpgquery::PGPivot &pivot, bool is_pivot); vector TransformPivotList(duckdb_libpgquery::PGList &list, bool is_pivot); - static bool TransformPivotInList(unique_ptr &expr, PivotColumnEntry &entry, - bool root_entry = true); unique_ptr TransformMergeInto(duckdb_libpgquery::PGMergeIntoStmt &stmt); unique_ptr TransformMergeIntoAction(duckdb_libpgquery::PGMatchAction &action); @@ -310,7 +308,6 @@ class Transformer { unique_ptr TransformUnaryOperator(const string &op, unique_ptr child); unique_ptr TransformBinaryOperator(string op, unique_ptr left, unique_ptr right); - static bool ConstructConstantFromExpression(const ParsedExpression &expr, Value &value); //===--------------------------------------------------------------------===// // TableRef transform //===--------------------------------------------------------------------===// @@ -338,13 +335,11 @@ class Transformer { QualifiedName TransformQualifiedName(duckdb_libpgquery::PGRangeVar &root); //! Transform a Postgres TypeName string into a LogicalType (non-LIST types) - LogicalType TransformTypeNameInternal(duckdb_libpgquery::PGTypeName &name); + unique_ptr TransformTypeExpressionInternal(duckdb_libpgquery::PGTypeName &name); + unique_ptr TransformTypeExpression(duckdb_libpgquery::PGTypeName &name); //! Transform a Postgres TypeName string into a LogicalType LogicalType TransformTypeName(duckdb_libpgquery::PGTypeName &name); - //! Transform a list of type modifiers into a list of values - vector TransformTypeModifiers(duckdb_libpgquery::PGTypeName &name); - //! Transform a Postgres GROUP BY expression into a list of Expression bool TransformGroupBy(optional_ptr group, SelectNode &result); void TransformGroupByNode(duckdb_libpgquery::PGNode &n, GroupingExpressionMap &map, SelectNode &result, diff --git a/src/duckdb/src/include/duckdb/planner/bind_context.hpp b/src/duckdb/src/include/duckdb/planner/bind_context.hpp index db5b52c78..7b4d8d567 100644 --- a/src/duckdb/src/include/duckdb/planner/bind_context.hpp +++ b/src/duckdb/src/include/duckdb/planner/bind_context.hpp @@ -46,7 +46,8 @@ class BindContext { public: //! Given a column name, find the matching table it belongs to. Throws an //! exception if no table has a column of the given name. - optional_ptr GetMatchingBinding(const string &column_name); + optional_ptr GetMatchingBinding(const string &column_name, + QueryErrorContext context = QueryErrorContext()); //! Like GetMatchingBinding, but instead of throwing an error if multiple tables have the same binding it will //! return a list of all the matching ones vector> GetMatchingBindings(const string &column_name); diff --git a/src/duckdb/src/include/duckdb/planner/binder.hpp b/src/duckdb/src/include/duckdb/planner/binder.hpp index 523ba484a..18fda32ca 100644 --- a/src/duckdb/src/include/duckdb/planner/binder.hpp +++ b/src/duckdb/src/include/duckdb/planner/binder.hpp @@ -242,6 +242,11 @@ class Binder : public enable_shared_from_this { void SetCatalogLookupCallback(catalog_entry_callback_t callback); void BindCreateViewInfo(CreateViewInfo &base); + static void BindView(ClientContext &context, const SelectStatement &stmt, const string &catalog_name, + const string &schema_name, optional_ptr dependencies, + const vector &aliases, vector &result_types, + vector &result_names); + void SearchSchema(CreateInfo &info); SchemaCatalogEntry &BindSchema(CreateInfo &info); SchemaCatalogEntry &BindCreateFunctionInfo(CreateInfo &info); @@ -288,8 +293,8 @@ class Binder : public enable_shared_from_this { void BindVacuumTable(LogicalVacuum &vacuum, unique_ptr &root); static void BindSchemaOrCatalog(ClientContext &context, string &catalog, string &schema); - void BindLogicalType(LogicalType &type, optional_ptr catalog = nullptr, - const string &schema = INVALID_SCHEMA); + + void BindLogicalType(LogicalType &type); optional_ptr GetMatchingBinding(const string &table_name, const string &column_name, ErrorData &error); optional_ptr GetMatchingBinding(const string &schema_name, const string &table_name, @@ -321,6 +326,8 @@ class Binder : public enable_shared_from_this { unique_ptr UnionOperators(vector> nodes); + void SetSearchPath(Catalog &catalog, const string &schema); + private: //! The parent binder (if any) shared_ptr parent; @@ -397,6 +404,22 @@ class Binder : public enable_shared_from_this { BoundStatement Bind(MergeIntoStatement &stmt); void BindRowIdColumns(TableCatalogEntry &table, LogicalGet &get, vector> &expressions); + //! Build a mapping from storage column index to scan chunk index for RETURNING. + //! Ensures all physical columns are present in the scan. + //! return_columns[storage_idx] = scan_chunk_idx + void BindDeleteReturningColumns(TableCatalogEntry &table, LogicalGet &get, vector &return_columns); + //! Overload for MERGE INTO: also creates projection expressions and maps to projection indices + //! return_columns[storage_idx] = projection_expr_idx + void BindDeleteReturningColumns(TableCatalogEntry &table, LogicalGet &get, vector &return_columns, + vector> &projection_expressions, + LogicalOperator &target_binding); + //! Build a sparse mapping for unique index columns only (for DELETE without RETURNING) + //! return_columns[storage_idx] = scan_chunk_idx (only for indexed columns) + void BindDeleteIndexColumns(TableCatalogEntry &table, LogicalGet &get, vector &return_columns); + //! Overload for MERGE INTO: builds projection expressions and maps storage_idx -> projection_expr_idx + void BindDeleteIndexColumns(TableCatalogEntry &table, LogicalGet &get, vector &return_columns, + vector> &projection_expressions, + LogicalOperator &target_binding); BoundStatement BindReturning(vector> returning_list, TableCatalogEntry &table, const string &alias, idx_t update_table_index, unique_ptr child_operator, @@ -505,7 +528,7 @@ class Binder : public enable_shared_from_this { vector GetSearchPath(Catalog &catalog, const string &schema_name); - LogicalType BindLogicalTypeInternal(const LogicalType &type, optional_ptr catalog, const string &schema); + LogicalType BindLogicalTypeInternal(const unique_ptr &type_expr); BoundStatement BindSelectNode(SelectNode &statement, BoundStatement from_table); diff --git a/src/duckdb/src/include/duckdb/planner/expression_binder.hpp b/src/duckdb/src/include/duckdb/planner/expression_binder.hpp index 3232c4d99..a60c8b375 100644 --- a/src/duckdb/src/include/duckdb/planner/expression_binder.hpp +++ b/src/duckdb/src/include/duckdb/planner/expression_binder.hpp @@ -14,6 +14,7 @@ #include "duckdb/common/exception/binder_exception.hpp" #include "duckdb/parser/expression/bound_expression.hpp" #include "duckdb/parser/expression/lambdaref_expression.hpp" +#include "duckdb/parser/expression/type_expression.hpp" #include "duckdb/parser/parsed_expression.hpp" #include "duckdb/parser/tokens.hpp" #include "duckdb/planner/expression.hpp" @@ -115,7 +116,8 @@ class ExpressionBinder { BindResult BindQualifiedColumnName(ColumnRefExpression &colref, const string &table_name); //! Returns a qualified column reference from a column name - unique_ptr QualifyColumnName(const string &column_name, ErrorData &error); + unique_ptr QualifyColumnName(const ParsedExpression &expr, const string &column_name, + ErrorData &error); //! Returns a qualified column reference from a column reference with column_names.size() > 2 unique_ptr QualifyColumnNameWithManyDots(ColumnRefExpression &col_ref, ErrorData &error); //! Returns a qualified column reference from a column reference @@ -180,6 +182,7 @@ class ExpressionBinder { BindResult BindExpression(ConjunctionExpression &expr, idx_t depth); BindResult BindExpression(ConstantExpression &expr, idx_t depth); BindResult BindExpression(FunctionExpression &expr, idx_t depth, unique_ptr &expr_ptr); + BindResult BindExpression(TypeExpression &expr, idx_t depth); BindResult BindExpression(LambdaExpression &expr, idx_t depth, const vector &function_child_types, optional_ptr bind_lambda_function); diff --git a/src/duckdb/src/include/duckdb/planner/expression_binder/table_function_binder.hpp b/src/duckdb/src/include/duckdb/planner/expression_binder/table_function_binder.hpp index cc20dd5ed..a86c2ed45 100644 --- a/src/duckdb/src/include/duckdb/planner/expression_binder/table_function_binder.hpp +++ b/src/duckdb/src/include/duckdb/planner/expression_binder/table_function_binder.hpp @@ -18,6 +18,14 @@ class TableFunctionBinder : public ExpressionBinder { TableFunctionBinder(Binder &binder, ClientContext &context, string table_function_name = string(), string clause = "Table function"); +public: + void DisableSQLValueFunctions() { + accept_sql_value_functions = false; + } + void EnableSQLValueFunctions() { + accept_sql_value_functions = true; + } + protected: BindResult BindLambdaReference(LambdaRefExpression &expr, idx_t depth); BindResult BindColumnReference(unique_ptr &expr, idx_t depth, bool root_expression); @@ -28,6 +36,8 @@ class TableFunctionBinder : public ExpressionBinder { private: string table_function_name; string clause; + //! Whether sql_value_functions (GetSQLValueFunctionName) are considered when binding column refs + bool accept_sql_value_functions = true; }; } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/planner/extension_callback.hpp b/src/duckdb/src/include/duckdb/planner/extension_callback.hpp index 389f8f257..d457019bf 100644 --- a/src/duckdb/src/include/duckdb/planner/extension_callback.hpp +++ b/src/duckdb/src/include/duckdb/planner/extension_callback.hpp @@ -9,8 +9,10 @@ #pragma once #include "duckdb/common/common.hpp" +#include "duckdb/main/extension_callback_manager.hpp" namespace duckdb { +struct DBConfig; class ClientContext; class DatabaseInstance; class ErrorData; @@ -35,6 +37,14 @@ class ExtensionCallback { //! Called after an extension fails to load loading virtual void OnExtensionLoadFail(DatabaseInstance &db, const string &name, const ErrorData &error) { } + + static void Register(DBConfig &config, shared_ptr extension); + static ExtensionCallbackIteratorHelper> Iterate(ClientContext &context) { + return ExtensionCallbackManager::Get(context).ExtensionCallbacks(); + } + static ExtensionCallbackIteratorHelper> Iterate(DatabaseInstance &db) { + return ExtensionCallbackManager::Get(db).ExtensionCallbacks(); + } }; } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/planner/joinside.hpp b/src/duckdb/src/include/duckdb/planner/joinside.hpp index aa655e3e2..acc373f41 100644 --- a/src/duckdb/src/include/duckdb/planner/joinside.hpp +++ b/src/duckdb/src/include/duckdb/planner/joinside.hpp @@ -16,7 +16,111 @@ namespace duckdb { //! JoinCondition represents a left-right comparison join condition struct JoinCondition { public: - JoinCondition() { + JoinCondition(unique_ptr lhs, unique_ptr rhs, ExpressionType comparison) + : left(std::move(lhs)), right(std::move(rhs)), comparison(comparison) { + } + + explicit JoinCondition(unique_ptr join_condition) + : left(std::move(join_condition)), comparison(ExpressionType::INVALID) { + } + + JoinCondition() : comparison(ExpressionType::INVALID) { + } + + bool IsComparison() const { + return comparison != ExpressionType::INVALID; + } + + JoinCondition Copy() const { + if (IsComparison()) { + return JoinCondition(left->Copy(), right->Copy(), comparison); + } + return JoinCondition(left->Copy()); + } + + Expression &GetLHS() { + if (!IsComparison()) { + throw InternalException("GetLHS used on a JoinCondition that is not a left/right comparison"); + } + return *left; + } + + const Expression &GetLHS() const { + if (!IsComparison()) { + throw InternalException("GetLHS used on a JoinCondition that is not a left/right comparison"); + } + return *left; + } + + Expression &GetRHS() { + if (!IsComparison()) { + throw InternalException("GetRHS used on a JoinCondition that is not a left/right comparison"); + } + return *right; + } + + const Expression &GetRHS() const { + if (!IsComparison()) { + throw InternalException("GetRHS used on a JoinCondition that is not a left/right comparison"); + } + return *right; + } + + ExpressionType GetComparisonType() const { + if (!IsComparison()) { + throw InternalException("GetComparisonType used on a JoinCondition that is not a left/right comparison"); + } + return comparison; + } + + void Swap() { + if (!IsComparison()) { + throw InternalException("Swap used on a JoinCondition that is not a left/right comparison"); + } + std::swap(left, right); + comparison = FlipComparisonExpression(comparison); + } + + unique_ptr &LeftReference() { + if (!IsComparison()) { + throw InternalException("LeftReference used on a JoinCondition that is not a left/right comparison"); + } + return left; + } + + unique_ptr &RightReference() { + if (!IsComparison()) { + throw InternalException("RightReference used on a JoinCondition that is not a left/right comparison"); + } + return right; + } + + Expression &GetJoinExpression() { + if (IsComparison()) { + throw InternalException("GetJoinExpression used on a JoinCondition that is a comparison"); + } + return *left; + } + + const Expression &GetJoinExpression() const { + if (IsComparison()) { + throw InternalException("GetJoinExpression used on a JoinCondition that is a comparison"); + } + return *left; + } + + unique_ptr &JoinExpressionReference() { + if (IsComparison()) { + throw InternalException("JoinExpressionReference used on a JoinCondition that is a comparison"); + } + return left; + } + + const unique_ptr &JoinExpressionReference() const { + if (IsComparison()) { + throw InternalException("JoinExpressionReference used on a JoinCondition that is a comparison"); + } + return left; } //! Turns the JoinCondition into an expression; note that this destroys the JoinCondition as the expression inherits @@ -27,7 +131,7 @@ struct JoinCondition { void Serialize(Serializer &serializer) const; static JoinCondition Deserialize(Deserializer &deserializer); -public: +private: unique_ptr left; unique_ptr right; ExpressionType comparison; diff --git a/src/duckdb/src/include/duckdb/planner/operator/logical_comparison_join.hpp b/src/duckdb/src/include/duckdb/planner/operator/logical_comparison_join.hpp index 35ec90266..d6f4fb178 100644 --- a/src/duckdb/src/include/duckdb/planner/operator/logical_comparison_join.hpp +++ b/src/duckdb/src/include/duckdb/planner/operator/logical_comparison_join.hpp @@ -38,8 +38,6 @@ class LogicalComparisonJoin : public LogicalJoin { bool convert_mark_to_semi = true; //! Scans where we should push generated filters into (if any) unique_ptr filter_pushdown; - //! Filtering predicate from the ON clause with expressions that don't reference both sides - unique_ptr predicate; public: InsertionOrderPreservingMap ParamsToString() const override; @@ -55,25 +53,22 @@ class LogicalComparisonJoin : public LogicalJoin { static unique_ptr CreateJoin(JoinType type, JoinRefType ref_type, unique_ptr left_child, unique_ptr right_child, - vector conditions, - vector> arbitrary_expressions); + vector conditions); static void ExtractJoinConditions(ClientContext &context, JoinType type, JoinRefType ref_type, unique_ptr &left_child, unique_ptr &right_child, - unique_ptr condition, vector &conditions, - vector> &arbitrary_expressions); + const unordered_set &left_bindings, + const unordered_set &right_bindings, + vector> &expressions, vector &conditions); static void ExtractJoinConditions(ClientContext &context, JoinType type, JoinRefType ref_type, unique_ptr &left_child, unique_ptr &right_child, - vector> &expressions, vector &conditions, - vector> &arbitrary_expressions); + vector> &expressions, vector &conditions); static void ExtractJoinConditions(ClientContext &context, JoinType type, JoinRefType ref_type, unique_ptr &left_child, unique_ptr &right_child, - const unordered_set &left_bindings, - const unordered_set &right_bindings, - vector> &expressions, vector &conditions, - vector> &arbitrary_expressions); + unique_ptr condition, vector &conditions); bool HasEquality(idx_t &range_count) const; + bool HasArbitraryConditions() const; }; } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/planner/operator/logical_merge_into.hpp b/src/duckdb/src/include/duckdb/planner/operator/logical_merge_into.hpp index 657fec212..fbf4ef66a 100644 --- a/src/duckdb/src/include/duckdb/planner/operator/logical_merge_into.hpp +++ b/src/duckdb/src/include/duckdb/planner/operator/logical_merge_into.hpp @@ -54,6 +54,9 @@ class LogicalMergeInto : public LogicalOperator { vector> bound_constraints; //! Whether or not to return the input data bool return_chunk = false; + //! For DELETE with RETURNING: maps storage_idx -> input chunk position + //! Used to pass columns through instead of fetching by row ID + vector delete_return_columns; map>> actions; diff --git a/src/duckdb/src/include/duckdb/planner/operator_extension.hpp b/src/duckdb/src/include/duckdb/planner/operator_extension.hpp index b14b640d1..35668580b 100644 --- a/src/duckdb/src/include/duckdb/planner/operator_extension.hpp +++ b/src/duckdb/src/include/duckdb/planner/operator_extension.hpp @@ -11,9 +11,12 @@ #include "duckdb/common/common.hpp" #include "duckdb/execution/physical_plan_generator.hpp" #include "duckdb/planner/binder.hpp" +#include "duckdb/main/extension_callback_manager.hpp" namespace duckdb { +struct DBConfig; + //! The OperatorExtensionInfo holds static information relevant to the operator extension struct OperatorExtensionInfo { virtual ~OperatorExtensionInfo() { @@ -38,6 +41,11 @@ class OperatorExtension { virtual ~OperatorExtension() { } + + static void Register(DBConfig &config, shared_ptr extension); + static ExtensionCallbackIteratorHelper> Iterate(ClientContext &context) { + return ExtensionCallbackManager::Get(context).OperatorExtensions(); + } }; } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/planner/planner_extension.hpp b/src/duckdb/src/include/duckdb/planner/planner_extension.hpp new file mode 100644 index 000000000..669ddbde6 --- /dev/null +++ b/src/duckdb/src/include/duckdb/planner/planner_extension.hpp @@ -0,0 +1,52 @@ +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/planner/planner_extension.hpp +// +// +//===----------------------------------------------------------------------===// + +#pragma once + +#include "duckdb/common/common.hpp" +#include "duckdb/planner/bound_statement.hpp" +#include "duckdb/main/extension_callback_manager.hpp" + +namespace duckdb { +struct DBConfig; +class Binder; +class ClientContext; + +//! The PlannerExtensionInfo holds static information relevant to the planner extension +struct PlannerExtensionInfo { + virtual ~PlannerExtensionInfo() { + } +}; + +struct PlannerExtensionInput { + ClientContext &context; + Binder &binder; + optional_ptr info; +}; + +//! The post_bind function runs after binding succeeds, allowing modification of the bound statement +typedef void (*post_bind_function_t)(PlannerExtensionInput &input, BoundStatement &statement); + +class PlannerExtension { +public: + //! The post-bind function of the planner extension. + //! Takes a bound statement as input, which it can modify in place. + //! This runs after the binder has successfully bound the statement, + //! allowing modification of the plan and result types. + post_bind_function_t post_bind_function = nullptr; + + //! Additional planner info passed to the functions + shared_ptr planner_info; + + static void Register(DBConfig &config, PlannerExtension extension); + static ExtensionCallbackIteratorHelper Iterate(ClientContext &context) { + return ExtensionCallbackManager::Get(context).PlannerExtensions(); + } +}; + +} // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/storage/block_manager.hpp b/src/duckdb/src/include/duckdb/storage/block_manager.hpp index 695b6aed9..3f52205e3 100644 --- a/src/duckdb/src/include/duckdb/storage/block_manager.hpp +++ b/src/duckdb/src/include/duckdb/storage/block_manager.hpp @@ -120,8 +120,9 @@ class BlockManager { //! Returns a reference to the metadata manager of this block manager. MetadataManager &GetMetadataManager(); + //! Returns the block allocation size of this block manager. - inline idx_t GetBlockAllocSize() const { + idx_t GetBlockAllocSize() const { return block_alloc_size.GetIndex(); } //! Returns the possibly invalid block allocation size of this block manager. @@ -132,15 +133,15 @@ class BlockManager { inline optional_idx GetOptionalBlockHeaderSize() const { return block_header_size; } - //! Block header size including the 8-byte checksum - inline idx_t GetBlockHeaderSize() const { + //! Returns the block header size including the 8-byte checksum of this block manager. + idx_t GetBlockHeaderSize() const { if (!block_header_size.IsValid()) { return Storage::DEFAULT_BLOCK_HEADER_SIZE; } return block_header_size.GetIndex(); } - //! Size of the block available for the user - inline idx_t GetBlockSize() const { + //! Returns the size of the block that is available for usage. + idx_t GetBlockSize() const { return block_alloc_size.GetIndex() - block_header_size.GetIndex(); } //! Sets the block allocation size. This should only happen when initializing an existing database. @@ -194,9 +195,9 @@ class BlockManager { //! for in-memory block managers. Default to default_block_alloc_size for file-backed block managers. //! This is NOT the actual memory available on a block (block_size). optional_idx block_alloc_size; - //! The size of the block headers (incl. checksum) in this block manager. + //! The size of the block headers (including checksum) in this block manager. //! Defaults to DEFAULT_BLOCK_HEADER_SIZE for in-memory block managers. - //! Default to default_block_header_size for file-backed block managers. + //! Defaults to default_block_header_size for file-backed block managers. optional_idx block_header_size; }; diff --git a/src/duckdb/src/include/duckdb/storage/buffer/block_handle.hpp b/src/duckdb/src/include/duckdb/storage/buffer/block_handle.hpp index b4095853b..00a6a1006 100644 --- a/src/duckdb/src/include/duckdb/storage/buffer/block_handle.hpp +++ b/src/duckdb/src/include/duckdb/storage/buffer/block_handle.hpp @@ -13,57 +13,36 @@ #include "duckdb/common/enums/memory_tag.hpp" #include "duckdb/common/file_buffer.hpp" #include "duckdb/common/mutex.hpp" +#include "duckdb/common/numeric_utils.hpp" +#include "duckdb/common/optional_idx.hpp" +#include "duckdb/storage/buffer/buffer_pool_reservation.hpp" #include "duckdb/storage/storage_info.hpp" namespace duckdb { +// Forward declaration. class BlockManager; class BufferHandle; -class BufferPool; +class BufferManager; class DatabaseInstance; -enum class BlockState : uint8_t { BLOCK_UNLOADED = 0, BLOCK_LOADED = 1 }; - -struct BufferPoolReservation { - MemoryTag tag; - idx_t size {0}; - BufferPool &pool; - - BufferPoolReservation(MemoryTag tag, BufferPool &pool); - BufferPoolReservation(const BufferPoolReservation &) = delete; - BufferPoolReservation &operator=(const BufferPoolReservation &) = delete; - - BufferPoolReservation(BufferPoolReservation &&) noexcept; - BufferPoolReservation &operator=(BufferPoolReservation &&) noexcept; - - ~BufferPoolReservation(); - - void Resize(idx_t new_size); - void Merge(BufferPoolReservation src); -}; - -struct TempBufferPoolReservation : BufferPoolReservation { - TempBufferPoolReservation(MemoryTag tag, BufferPool &pool, idx_t size) : BufferPoolReservation(tag, pool) { - Resize(size); - } - TempBufferPoolReservation(TempBufferPoolReservation &&) = default; - ~TempBufferPoolReservation() { - Resize(0); - } -}; - using BlockLock = unique_lock; class BlockHandle : public enable_shared_from_this { public: BlockHandle(BlockManager &block_manager, block_id_t block_id, MemoryTag tag); BlockHandle(BlockManager &block_manager, block_id_t block_id, MemoryTag tag, unique_ptr buffer, - DestroyBufferUpon destroy_buffer_upon, idx_t block_size, BufferPoolReservation &&reservation); + DestroyBufferUpon destroy_buffer_upon, idx_t size, BufferPoolReservation &&reservation); ~BlockHandle(); - BlockManager &block_manager; - public: + BufferManager &GetBufferManager() const { + return buffer_manager; + } + BlockManager &GetBlockManager() const { + return block_manager; + } + block_id_t BlockId() const { return block_id; } @@ -107,10 +86,25 @@ class BlockHandle : public enable_shared_from_this { return destroy_buffer_upon == DestroyBufferUpon::BLOCK; } - inline idx_t GetMemoryUsage() const { + idx_t GetMemoryUsage() const { return memory_usage; } + //! Returns the block allocation size of this block. + idx_t GetBlockAllocSize() const { + return block_alloc_size; + } + //! Returns the block header size including the 8-byte checksum. + idx_t GetBlockHeaderSize() const { + return block_header_size; + } + //! Returns the size of the block that is available for usage, as determined by the block manager that created the + //! block. The block_alloc_size can differ from the memory_usage for blocks managed by the temporary block manager, + //! thus, this should only be called for persistent blocks. + idx_t GetBlockSize() const { + return block_alloc_size - block_header_size; + } + bool IsUnloaded() const { return state == BlockState::BLOCK_UNLOADED; } @@ -178,6 +172,16 @@ class BlockHandle : public enable_shared_from_this { void VerifyMutex(unique_lock &l) const; private: + BufferManager &buffer_manager; + BlockManager &block_manager; + //! The block allocation size, which is determined by the block manager creating the block. + //! For non-temporary block managers the block_alloc_size corresponds to the memory_usage. + //! If we are pinning/loading an unloaded block, then we know how much memory to reserve. + //! This is NOT the actual memory available on a block. + idx_t block_alloc_size; + //! The size of the block header, including the checksum. + idx_t block_header_size; + //! The block-level lock mutex lock; //! Whether or not the block is loaded/unloaded diff --git a/src/duckdb/src/include/duckdb/storage/buffer/buffer_pool.hpp b/src/duckdb/src/include/duckdb/storage/buffer/buffer_pool.hpp index a77b34ef7..0f668bd90 100644 --- a/src/duckdb/src/include/duckdb/storage/buffer/buffer_pool.hpp +++ b/src/duckdb/src/include/duckdb/storage/buffer/buffer_pool.hpp @@ -10,14 +10,17 @@ #include "duckdb/common/array.hpp" #include "duckdb/common/enums/memory_tag.hpp" +#include "duckdb/common/exception.hpp" #include "duckdb/common/file_buffer.hpp" #include "duckdb/common/mutex.hpp" +#include "duckdb/common/optional_ptr.hpp" #include "duckdb/common/typedefs.hpp" #include "duckdb/storage/buffer/block_handle.hpp" namespace duckdb { class TemporaryMemoryManager; +class ObjectCache; struct EvictionQueue; struct BufferEvictionNode { @@ -63,6 +66,15 @@ class BufferPool { TemporaryMemoryManager &GetTemporaryMemoryManager(); + //! Take per-database ObjectCache under buffer pool's memory management. + //! Notice, object cache should be registered for at most once, otherwise InvalidInput exception is thrown. + void SetObjectCache(ObjectCache *object_cache_p) { + if (object_cache != nullptr) { + throw InvalidInputException("Object cache has already been registered in buffer pool, cannot re-register!"); + } + object_cache = object_cache_p; + } + protected: //! Evict blocks until the currently used memory + extra_memory fit, returns false if this was not possible //! (i.e. not enough blocks could be evicted) @@ -79,6 +91,9 @@ class BufferPool { virtual EvictionResult EvictBlocksInternal(EvictionQueue &queue, MemoryTag tag, idx_t extra_memory, idx_t memory_limit, unique_ptr *buffer = nullptr); + //! Evict object cache entries if needed. + EvictionResult EvictObjectCacheEntries(MemoryTag tag, idx_t extra_memory, idx_t memory_limit); + //! Purge all blocks that haven't been pinned within the last N seconds idx_t PurgeAgedBlocks(uint32_t max_age_sec); idx_t PurgeAgedBlocksInternal(EvictionQueue &queue, uint32_t max_age_sec, int64_t now, int64_t limit); @@ -163,6 +178,8 @@ class BufferPool { mutable MemoryUsage memory_usage; //! The block allocator BlockAllocator &block_allocator; + //! Per-database singleton object cache managed by buffer pool. + optional_ptr object_cache = nullptr; }; } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/storage/buffer/buffer_pool_reservation.hpp b/src/duckdb/src/include/duckdb/storage/buffer/buffer_pool_reservation.hpp new file mode 100644 index 000000000..4140c9f00 --- /dev/null +++ b/src/duckdb/src/include/duckdb/storage/buffer/buffer_pool_reservation.hpp @@ -0,0 +1,48 @@ +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/storage/buffer/buffer_pool_reservation.hpp +// +// +//===----------------------------------------------------------------------===// + +#pragma once + +#include "duckdb/common/enums/memory_tag.hpp" + +namespace duckdb { + +enum class BlockState : uint8_t { BLOCK_UNLOADED = 0, BLOCK_LOADED = 1 }; + +// Forward declaration. +class BufferPool; + +struct BufferPoolReservation { + MemoryTag tag; + idx_t size {0}; + BufferPool &pool; + + BufferPoolReservation(MemoryTag tag, BufferPool &pool); + BufferPoolReservation(const BufferPoolReservation &) = delete; + BufferPoolReservation &operator=(const BufferPoolReservation &) = delete; + + BufferPoolReservation(BufferPoolReservation &&) noexcept; + BufferPoolReservation &operator=(BufferPoolReservation &&) noexcept; + + virtual ~BufferPoolReservation(); + + void Resize(idx_t new_size); + void Merge(BufferPoolReservation src); +}; + +struct TempBufferPoolReservation : BufferPoolReservation { + TempBufferPoolReservation(MemoryTag tag, BufferPool &pool, idx_t size) : BufferPoolReservation(tag, pool) { + Resize(size); + } + TempBufferPoolReservation(TempBufferPoolReservation &&) = default; + ~TempBufferPoolReservation() override { + Resize(0); + } +}; + +} // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/storage/caching_file_system_wrapper.hpp b/src/duckdb/src/include/duckdb/storage/caching_file_system_wrapper.hpp index 3e1f9ec39..005c6563d 100644 --- a/src/duckdb/src/include/duckdb/storage/caching_file_system_wrapper.hpp +++ b/src/duckdb/src/include/duckdb/storage/caching_file_system_wrapper.hpp @@ -101,6 +101,7 @@ class CachingFileSystemWrapper : public FileSystem, public enable_shared_from_th DUCKDB_API void RegisterSubSystem(unique_ptr sub_fs) override; DUCKDB_API void RegisterSubSystem(FileCompressionType compression_type, unique_ptr fs) override; + DUCKDB_API void UnregisterSubSystem(const string &name) override; DUCKDB_API unique_ptr ExtractSubSystem(const string &name) override; DUCKDB_API vector ListSubSystems() override; DUCKDB_API bool CanHandleFile(const string &fpath) override; diff --git a/src/duckdb/src/include/duckdb/storage/checkpoint/string_checkpoint_state.hpp b/src/duckdb/src/include/duckdb/storage/checkpoint/string_checkpoint_state.hpp index a13c72943..a598e74a9 100644 --- a/src/duckdb/src/include/duckdb/storage/checkpoint/string_checkpoint_state.hpp +++ b/src/duckdb/src/include/duckdb/storage/checkpoint/string_checkpoint_state.hpp @@ -55,9 +55,14 @@ struct UncompressedStringSegmentState : public CompressedSegmentState { string GetSegmentInfo() const override; + void InsertOverflowBlock(block_id_t block_id, reference block); + reference FindOverflowBlock(block_id_t block_id); + private: mutex block_lock; unordered_map> handles; + + StorageLock overflow_blocks_lock; }; } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/storage/compression/alp/alp_scan.hpp b/src/duckdb/src/include/duckdb/storage/compression/alp/alp_scan.hpp index 0aa9f00c8..188b5f1bb 100644 --- a/src/duckdb/src/include/duckdb/storage/compression/alp/alp_scan.hpp +++ b/src/duckdb/src/include/duckdb/storage/compression/alp/alp_scan.hpp @@ -124,7 +124,7 @@ struct AlpScanState : public SegmentScanState { // Load the offset (metadata) indicating where the vector data starts metadata_ptr -= AlpConstants::METADATA_POINTER_SIZE; auto data_byte_offset = Load(metadata_ptr); - D_ASSERT(data_byte_offset < segment.GetBlockManager().GetBlockSize()); + D_ASSERT(data_byte_offset < segment.GetBlockSize()); idx_t vector_size = MinValue((idx_t)AlpConstants::ALP_VECTOR_SIZE, (count - total_value_count)); diff --git a/src/duckdb/src/include/duckdb/storage/compression/alprd/alprd_scan.hpp b/src/duckdb/src/include/duckdb/storage/compression/alprd/alprd_scan.hpp index a05b2026c..47e29434d 100644 --- a/src/duckdb/src/include/duckdb/storage/compression/alprd/alprd_scan.hpp +++ b/src/duckdb/src/include/duckdb/storage/compression/alprd/alprd_scan.hpp @@ -143,7 +143,7 @@ struct AlpRDScanState : public SegmentScanState { // Load the offset (metadata) indicating where the vector data starts metadata_ptr -= AlpRDConstants::METADATA_POINTER_SIZE; auto data_byte_offset = Load(metadata_ptr); - D_ASSERT(data_byte_offset < segment.GetBlockManager().GetBlockSize()); + D_ASSERT(data_byte_offset < segment.GetBlockSize()); idx_t vector_size = MinValue((idx_t)AlpRDConstants::ALP_VECTOR_SIZE, (count - total_value_count)); diff --git a/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_scan.hpp b/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_scan.hpp index b29ecc8d1..6cd49a1e6 100644 --- a/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_scan.hpp +++ b/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_scan.hpp @@ -187,7 +187,7 @@ struct ChimpScanState : public SegmentScanState { // Load the offset indicating where a groups data starts metadata_ptr -= sizeof(uint32_t); auto data_byte_offset = Load(metadata_ptr); - D_ASSERT(data_byte_offset < segment.GetBlockManager().GetBlockSize()); + D_ASSERT(data_byte_offset < segment.GetBlockSize()); // Only used for point queries (void)data_byte_offset; diff --git a/src/duckdb/src/include/duckdb/storage/compression/patas/patas_scan.hpp b/src/duckdb/src/include/duckdb/storage/compression/patas/patas_scan.hpp index 74a0cf9a9..ea1f95fb0 100644 --- a/src/duckdb/src/include/duckdb/storage/compression/patas/patas_scan.hpp +++ b/src/duckdb/src/include/duckdb/storage/compression/patas/patas_scan.hpp @@ -154,7 +154,7 @@ struct PatasScanState : public SegmentScanState { // Load the offset indicating where a groups data starts metadata_ptr -= sizeof(uint32_t); auto data_byte_offset = Load(metadata_ptr); - D_ASSERT(data_byte_offset < segment.GetBlockManager().GetBlockSize()); + D_ASSERT(data_byte_offset < segment.GetBlockSize()); // Initialize the byte_reader with the data values for the group group_state.Init(segment_data + data_byte_offset); diff --git a/src/duckdb/src/include/duckdb/storage/object_cache.hpp b/src/duckdb/src/include/duckdb/storage/object_cache.hpp index e2a0de155..8a21a22d0 100644 --- a/src/duckdb/src/include/duckdb/storage/object_cache.hpp +++ b/src/duckdb/src/include/duckdb/storage/object_cache.hpp @@ -9,14 +9,19 @@ #pragma once #include "duckdb/common/common.hpp" +#include "duckdb/common/enums/memory_tag.hpp" #include "duckdb/common/lru_cache.hpp" #include "duckdb/common/mutex.hpp" #include "duckdb/common/string.hpp" #include "duckdb/common/unordered_map.hpp" #include "duckdb/main/database.hpp" +#include "duckdb/storage/buffer/buffer_pool_reservation.hpp" namespace duckdb { +// Forward declaration. +class BufferPool; + //! ObjectCache is the base class for objects caches in DuckDB class ObjectCacheEntry { public: @@ -33,17 +38,12 @@ class ObjectCacheEntry { class ObjectCache { public: //! Default max memory 8GiB for non-evictable cache entries. - // - // TODO(hjiang): Hard-code a large enough memory consumption upper bound, which is likely a non-regression change. - // I will followup with another PR before v1.5.0 release to provide a user option to tune. - // - // A few consideration here: should we cap object cache memory consumption with duckdb max memory or separate. static constexpr idx_t DEFAULT_MAX_MEMORY = 8ULL * 1024 * 1024 * 1024; - ObjectCache() : ObjectCache(DEFAULT_MAX_MEMORY) { + explicit ObjectCache(BufferPool &buffer_pool_p) : ObjectCache(DEFAULT_MAX_MEMORY, buffer_pool_p) { } - explicit ObjectCache(idx_t max_memory) : lru_cache(max_memory) { + ObjectCache(idx_t max_memory, BufferPool &buffer_pool_p) : lru_cache(max_memory), buffer_pool(buffer_pool_p) { } shared_ptr GetObject(const string &key) { @@ -93,10 +93,12 @@ class ObjectCache { const bool is_evictable = estimated_memory.IsValid(); if (!is_evictable) { non_evictable_entries[key] = value; - } else { - lru_cache.Put(key, value, estimated_memory.GetIndex()); + return value; } + auto reservation = + make_uniq(MemoryTag::OBJECT_CACHE, buffer_pool, estimated_memory.GetIndex()); + lru_cache.Put(key, value, std::move(reservation)); return value; } @@ -112,7 +114,10 @@ class ObjectCache { non_evictable_entries[std::move(key)] = std::move(value); return; } - lru_cache.Put(std::move(key), std::move(value), estimated_memory.GetIndex()); + + auto reservation = + make_uniq(MemoryTag::OBJECT_CACHE, buffer_pool, estimated_memory.GetIndex()); + lru_cache.Put(std::move(key), std::move(value), std::move(reservation)); } void Delete(const string &key) { @@ -139,6 +144,15 @@ class ObjectCache { const lock_guard lock(lock_mutex); return lru_cache.Size() + non_evictable_entries.size(); } + bool IsEmpty() const { + const lock_guard lock(lock_mutex); + return lru_cache.IsEmpty() && non_evictable_entries.empty(); + } + + idx_t EvictToReduceMemory(idx_t target_bytes) { + const lock_guard lock(lock_mutex); + return lru_cache.EvictToReduceMemory(target_bytes); + } private: mutable mutex lock_mutex; @@ -146,6 +160,8 @@ class ObjectCache { SharedLruCache lru_cache; //! Separate storage for non-evictable entries (i.e., encryption keys) unordered_map> non_evictable_entries; + //! Used to create buffer pool reservation on entries creation. + BufferPool &buffer_pool; }; } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/storage/segment/uncompressed.hpp b/src/duckdb/src/include/duckdb/storage/segment/uncompressed.hpp index 763a0d067..d28d56a93 100644 --- a/src/duckdb/src/include/duckdb/storage/segment/uncompressed.hpp +++ b/src/duckdb/src/include/duckdb/storage/segment/uncompressed.hpp @@ -30,6 +30,13 @@ struct ValidityUncompressed { public: static CompressionFunction GetFunction(PhysicalType data_type); static void AlignedScan(data_ptr_t input, idx_t input_start, Vector &result, idx_t scan_count); + + //! ANDs scan_count validity bits from input (starting at input_start) into the result validity mask + //! (starting at result_offset). If a bit in the result is already invalid (0), it remains invalid + //! regardless of the input bit value - i.e., the operation is result[i] &= input[i]. + //! This function should be used, as the name suggests, if the starting points are unaligned relative to + //! ValidityMask::BITS_PER_VALUE, otherwise AlignedScan should be used (however this function will + //! still work). static void UnalignedScan(data_ptr_t input, idx_t input_size, idx_t input_start, Vector &result, idx_t result_offset, idx_t scan_count); diff --git a/src/duckdb/src/include/duckdb/storage/storage_extension.hpp b/src/duckdb/src/include/duckdb/storage/storage_extension.hpp index 8f55d9b7c..62b887cd1 100644 --- a/src/duckdb/src/include/duckdb/storage/storage_extension.hpp +++ b/src/duckdb/src/include/duckdb/storage/storage_extension.hpp @@ -44,10 +44,13 @@ class StorageExtension { virtual void OnCheckpointEnd(AttachedDatabase &db, CheckpointOptions checkpoint_options) { } + + static optional_ptr Find(const DBConfig &config, const string &extension_name); + static void Register(DBConfig &config, const string &extension_name, shared_ptr extension); }; struct OpenFileStorageExtension { - static unique_ptr Create(); + static shared_ptr Create(); }; } // namespace duckdb diff --git a/src/duckdb/src/include/duckdb/storage/string_uncompressed.hpp b/src/duckdb/src/include/duckdb/storage/string_uncompressed.hpp index 286c97fdf..52ed376c4 100644 --- a/src/duckdb/src/include/duckdb/storage/string_uncompressed.hpp +++ b/src/duckdb/src/include/duckdb/storage/string_uncompressed.hpp @@ -127,7 +127,7 @@ struct UncompressedStringStorage { auto end = handle.Ptr() + *dictionary_end; #ifdef DEBUG - GetDictionary(segment, handle).Verify(segment.GetBlockManager().GetBlockSize()); + GetDictionary(segment, handle).Verify(segment.GetBlockSize()); #endif // Unknown string, continue // non-null value, check if we can fit it within the block @@ -136,8 +136,7 @@ struct UncompressedStringStorage { // determine whether or not we have space in the block for this string bool use_overflow_block = false; idx_t required_space = string_length; - if (DUCKDB_UNLIKELY(required_space >= - StringUncompressed::GetStringBlockLimit(segment.GetBlockManager().GetBlockSize()))) { + if (DUCKDB_UNLIKELY(required_space >= StringUncompressed::GetStringBlockLimit(segment.GetBlockSize()))) { // string exceeds block limit, store in overflow block and only write a marker here required_space = BIG_STRING_MARKER_SIZE; use_overflow_block = true; @@ -168,7 +167,7 @@ struct UncompressedStringStorage { // note: for overflow strings we write negative value // dictionary_size is an uint32_t value, so we can cast up. - D_ASSERT(NumericCast(*dictionary_size) <= segment.GetBlockManager().GetBlockSize()); + D_ASSERT(NumericCast(*dictionary_size) <= segment.GetBlockSize()); result_data[target_idx] = -NumericCast((*dictionary_size)); } else { // string fits in block, append to dictionary and increment dictionary position @@ -180,13 +179,13 @@ struct UncompressedStringStorage { memcpy(dict_pos, source_data[source_idx].GetData(), string_length); // dictionary_size is an uint32_t value, so we can cast up. - D_ASSERT(NumericCast(*dictionary_size) <= segment.GetBlockManager().GetBlockSize()); + D_ASSERT(NumericCast(*dictionary_size) <= segment.GetBlockSize()); // Place the dictionary offset into the set of vectors. result_data[target_idx] = NumericCast(*dictionary_size); } - D_ASSERT(RemainingSpace(segment, handle) <= segment.GetBlockManager().GetBlockSize()); + D_ASSERT(RemainingSpace(segment, handle) <= segment.GetBlockSize()); #ifdef DEBUG - GetDictionary(segment, handle).Verify(segment.GetBlockManager().GetBlockSize()); + GetDictionary(segment, handle).Verify(segment.GetBlockSize()); #endif } segment.count += count; @@ -220,7 +219,7 @@ struct UncompressedStringStorage { inline static string_t FetchStringFromDict(ColumnSegment &segment, uint32_t dict_end_offset, Vector &result, data_ptr_t base_ptr, int32_t dict_offset, uint32_t string_length) { - D_ASSERT(dict_offset <= NumericCast(segment.GetBlockManager().GetBlockSize())); + D_ASSERT(dict_offset <= NumericCast(segment.GetBlockSize())); if (DUCKDB_LIKELY(dict_offset >= 0)) { // regular string - fetch from dictionary auto dict_end = base_ptr + dict_end_offset; diff --git a/src/duckdb/src/include/duckdb/storage/table/column_segment.hpp b/src/duckdb/src/include/duckdb/storage/table/column_segment.hpp index ce75200b4..3f5750bad 100644 --- a/src/duckdb/src/include/duckdb/storage/table/column_segment.hpp +++ b/src/duckdb/src/include/duckdb/storage/table/column_segment.hpp @@ -110,11 +110,9 @@ class ColumnSegment : public SegmentBase { return block_id; } - //! Returns the block manager handling this segment. For transient segments, this might be the temporary block - //! manager. Later, we possibly convert this (transient) segment to a persistent segment. In that case, there - //! exists another block manager handling the ColumnData, of which this segment is a part. - BlockManager &GetBlockManager() const { - return block->block_manager; + //! Returns the size of the underlying block of the segment. It is size is the size available for usage on a block. + idx_t GetBlockSize() const { + return block->GetBlockSize(); } idx_t GetBlockOffset() { diff --git a/src/duckdb/src/include/duckdb_extension.h b/src/duckdb/src/include/duckdb_extension.h index 63a809001..78de2d88a 100644 --- a/src/duckdb/src/include/duckdb_extension.h +++ b/src/duckdb/src/include/duckdb_extension.h @@ -741,6 +741,7 @@ typedef struct { // New string functions that are added #ifdef DUCKDB_EXTENSION_API_VERSION_UNSTABLE char *(*duckdb_value_to_string)(duckdb_value value); + duckdb_error_data (*duckdb_valid_utf8_check)(const char *str, idx_t len); #endif // New functions around the table description @@ -776,7 +777,8 @@ typedef struct { sel_t *(*duckdb_selection_vector_get_data_ptr)(duckdb_selection_vector sel); void (*duckdb_vector_copy_sel)(duckdb_vector src, duckdb_vector dst, duckdb_selection_vector sel, idx_t src_count, idx_t src_offset, idx_t dst_offset); - duckdb_error_data (*duckdb_vector_safe_assign_string_element)(duckdb_vector vector, idx_t index, const char *str); + void (*duckdb_unsafe_vector_assign_string_element_len)(duckdb_vector vector, idx_t index, const char *str, + idx_t str_len); #endif } duckdb_ext_api_v1; @@ -1351,7 +1353,8 @@ typedef struct { #define duckdb_scalar_function_init_get_extra_info duckdb_ext_api.duckdb_scalar_function_init_get_extra_info // Version unstable_new_string_functions -#define duckdb_value_to_string duckdb_ext_api.duckdb_value_to_string +#define duckdb_valid_utf8_check duckdb_ext_api.duckdb_valid_utf8_check +#define duckdb_value_to_string duckdb_ext_api.duckdb_value_to_string // Version unstable_new_table_description_functions #define duckdb_table_description_get_column_count duckdb_ext_api.duckdb_table_description_get_column_count @@ -1367,16 +1370,16 @@ typedef struct { #define duckdb_create_union_value duckdb_ext_api.duckdb_create_union_value // Version unstable_new_vector_functions -#define duckdb_create_vector duckdb_ext_api.duckdb_create_vector -#define duckdb_destroy_vector duckdb_ext_api.duckdb_destroy_vector -#define duckdb_vector_safe_assign_string_element duckdb_ext_api.duckdb_vector_safe_assign_string_element -#define duckdb_slice_vector duckdb_ext_api.duckdb_slice_vector -#define duckdb_vector_copy_sel duckdb_ext_api.duckdb_vector_copy_sel -#define duckdb_vector_reference_value duckdb_ext_api.duckdb_vector_reference_value -#define duckdb_vector_reference_vector duckdb_ext_api.duckdb_vector_reference_vector -#define duckdb_create_selection_vector duckdb_ext_api.duckdb_create_selection_vector -#define duckdb_destroy_selection_vector duckdb_ext_api.duckdb_destroy_selection_vector -#define duckdb_selection_vector_get_data_ptr duckdb_ext_api.duckdb_selection_vector_get_data_ptr +#define duckdb_create_vector duckdb_ext_api.duckdb_create_vector +#define duckdb_destroy_vector duckdb_ext_api.duckdb_destroy_vector +#define duckdb_unsafe_vector_assign_string_element_len duckdb_ext_api.duckdb_unsafe_vector_assign_string_element_len +#define duckdb_slice_vector duckdb_ext_api.duckdb_slice_vector +#define duckdb_vector_copy_sel duckdb_ext_api.duckdb_vector_copy_sel +#define duckdb_vector_reference_value duckdb_ext_api.duckdb_vector_reference_value +#define duckdb_vector_reference_vector duckdb_ext_api.duckdb_vector_reference_vector +#define duckdb_create_selection_vector duckdb_ext_api.duckdb_create_selection_vector +#define duckdb_destroy_selection_vector duckdb_ext_api.duckdb_destroy_selection_vector +#define duckdb_selection_vector_get_data_ptr duckdb_ext_api.duckdb_selection_vector_get_data_ptr //===--------------------------------------------------------------------===// // Struct Global Macros diff --git a/src/duckdb/src/main/appender.cpp b/src/duckdb/src/main/appender.cpp index 858011efe..b46e9fff4 100644 --- a/src/duckdb/src/main/appender.cpp +++ b/src/duckdb/src/main/appender.cpp @@ -15,6 +15,16 @@ #include "duckdb/planner/expression_binder/constant_binder.hpp" #include "duckdb/planner/expression/bound_constant_expression.hpp" #include "duckdb/execution/expression_executor.hpp" +#include "duckdb/parser/tableref/column_data_ref.hpp" +#include "duckdb/parser/parser.hpp" +#include "duckdb/parser/statement/insert_statement.hpp" +#include "duckdb/parser/statement/delete_statement.hpp" +#include "duckdb/parser/statement/update_statement.hpp" +#include "duckdb/parser/statement/merge_into_statement.hpp" +#include "duckdb/parser/query_node/select_node.hpp" +#include "duckdb/parser/expression/parameter_expression.hpp" +#include "duckdb/parser/tableref/expressionlistref.hpp" +#include "duckdb/planner/binder.hpp" namespace duckdb { @@ -423,6 +433,64 @@ void BaseAppender::ClearColumns() { throw NotImplementedException("ClearColumns is only supported when directly appending to a table"); } +unique_ptr BaseAppender::GetColumnDataTableRef(ColumnDataCollection &collection, const string &table_name, + const vector &expected_names) { + auto column_data_ref = make_uniq(collection); + column_data_ref->alias = table_name.empty() ? "appended_data" : table_name; + ; + column_data_ref->expected_names = expected_names; + return std::move(column_data_ref); +} + +CommonTableExpressionMap &GetCTEMap(SQLStatement &statement) { + switch (statement.type) { + case StatementType::INSERT_STATEMENT: + return statement.Cast().cte_map; + case StatementType::DELETE_STATEMENT: + return statement.Cast().cte_map; + case StatementType::UPDATE_STATEMENT: + return statement.Cast().cte_map; + case StatementType::MERGE_INTO_STATEMENT: + return statement.Cast().cte_map; + default: + throw InvalidInputException( + "Unsupported statement type for appender: expected INSERT, DELETE, UPDATE or MERGE INTO"); + } +} + +unique_ptr BaseAppender::ParseStatement(unique_ptr table_ref, const string &query, + const string &table_name) { + // Parse the query. + Parser parser; + parser.ParseQuery(query); + + // Must be a single statement. + if (parser.statements.size() != 1) { + throw InvalidInputException("Expected exactly one query for appending data."); + } + + // Create the CTE for the appender. + auto cte = make_uniq(); + cte->select_list.push_back(make_uniq()); + cte->from_table = std::move(table_ref); + + // Create the SELECT CTE. + auto cte_select = make_uniq(); + cte_select->node = std::move(cte); + + // Create the CTE info. + auto cte_info = make_uniq(); + cte_info->query = std::move(cte_select); + cte_info->materialized = CTEMaterialize::CTE_MATERIALIZE_NEVER; + + // Add the appender data as a CTE to the CTE map of the statement. + string alias = table_name.empty() ? "appended_data" : table_name; + auto &cte_map = GetCTEMap(*parser.statements[0]); + cte_map.map.insert(alias, std::move(cte_info)); + + return std::move(parser.statements[0]); +} + //===--------------------------------------------------------------------===// // Table Appender //===--------------------------------------------------------------------===// @@ -501,12 +569,53 @@ Appender::~Appender() { Destructor(); } +vector Appender::GetExpectedNames() { + vector expected_names; + for (idx_t i = 0; i < column_ids.size(); i++) { + auto &col_name = description->columns[column_ids[i].index].Name(); + expected_names.push_back(col_name); + } + return expected_names; +} + +string Appender::ConstructQuery(TableDescription &description_p, const string &table_name, + const vector &expected_names) { + string query = "INSERT INTO "; + if (!description_p.database.empty()) { + query += StringUtil::Format("%s.", SQLIdentifier(description_p.database)); + } + if (!description_p.schema.empty()) { + query += StringUtil::Format("%s.", SQLIdentifier(description_p.schema)); + } + query += StringUtil::Format("%s", SQLIdentifier(description_p.table)); + if (!expected_names.empty()) { + query += "("; + for (idx_t i = 0; i < expected_names.size(); i++) { + if (i > 0) { + query += ", "; + } + query += StringUtil::Format("%s", SQLIdentifier(expected_names[i])); + } + query += ")"; + } + query += " FROM "; + query += table_name; + return query; +} + void Appender::FlushInternal(ColumnDataCollection &collection) { auto context_ref = context.lock(); if (!context_ref) { throw InvalidInputException("Appender: Attempting to flush data to a closed connection"); } - context_ref->Append(*description, collection, &column_ids); + + string table_name = "__duckdb_internal_appended_data"; + auto expected_names = GetExpectedNames(); + auto query = ConstructQuery(*description, table_name, expected_names); + + auto table_ref = GetColumnDataTableRef(collection, table_name, expected_names); + auto stmt = ParseStatement(std::move(table_ref), query, table_name); + context_ref->Append(std::move(stmt)); } void Appender::AppendDefault() { @@ -603,9 +712,11 @@ QueryAppender::~QueryAppender() { void QueryAppender::FlushInternal(ColumnDataCollection &collection) { auto context_ref = context.lock(); if (!context_ref) { - throw InvalidInputException("Appender: Attempting to flush data to a closed connection"); + throw InvalidInputException("Attempting to flush query appender data on a closed connection"); } - context_ref->Append(collection, query, names, table_name); + auto table_ref = GetColumnDataTableRef(collection, table_name, names); + auto parsed_statement = ParseStatement(std::move(table_ref), query, table_name); + context_ref->Append(std::move(parsed_statement)); } //===--------------------------------------------------------------------===// diff --git a/src/duckdb/src/main/capi/data_chunk-c.cpp b/src/duckdb/src/main/capi/data_chunk-c.cpp index 9183858ca..67708285e 100644 --- a/src/duckdb/src/main/capi/data_chunk-c.cpp +++ b/src/duckdb/src/main/capi/data_chunk-c.cpp @@ -137,34 +137,40 @@ void duckdb_vector_ensure_validity_writable(duckdb_vector vector) { validity.EnsureWritable(); } -duckdb_error_data duckdb_vector_safe_assign_string_element(duckdb_vector vector, idx_t index, const char *str) { +void duckdb_vector_assign_string_element(duckdb_vector vector, idx_t index, const char *str) { if (!vector) { - return nullptr; + return; + } + auto str_len = strlen(str); + auto error = duckdb_valid_utf8_check(str, str_len); + if (error != nullptr) { + duckdb_destroy_error_data(&error); + duckdb_vector_ensure_validity_writable(vector); + duckdb_validity_set_row_invalid(duckdb_vector_get_validity(vector), index); + return; } + duckdb_unsafe_vector_assign_string_element_len(vector, index, str, str_len); +} +void duckdb_vector_assign_string_element_len(duckdb_vector vector, idx_t index, const char *str, idx_t str_len) { + if (!vector) { + return; + } auto v = reinterpret_cast(vector); - idx_t str_len = strlen(str); - - // UTF-8 analysis for VARCHAR vectors, which expect valid UTF-8. + // UTF-8 validation for VARCHAR vectors. if (v->GetType().id() == duckdb::LogicalTypeId::VARCHAR) { - duckdb::UnicodeInvalidReason reason; - size_t pos; - auto utf_type = duckdb::Utf8Proc::Analyze(str, str_len, &reason, &pos); - if (utf_type == duckdb::UnicodeType::INVALID) { - return duckdb_create_error_data(DUCKDB_ERROR_INVALID_INPUT, - "invalid Unicode detected, str must be valid UTF-8"); + auto error = duckdb_valid_utf8_check(str, str_len); + if (error != nullptr) { + duckdb_destroy_error_data(&error); + duckdb_vector_ensure_validity_writable(vector); + duckdb_validity_set_row_invalid(duckdb_vector_get_validity(vector), index); + return; } } - auto data = duckdb::FlatVector::GetData(*v); - data[index] = duckdb::StringVector::AddStringOrBlob(*v, str, str_len); - return nullptr; + duckdb_unsafe_vector_assign_string_element_len(vector, index, str, str_len); } -void duckdb_vector_assign_string_element(duckdb_vector vector, idx_t index, const char *str) { - duckdb_vector_assign_string_element_len(vector, index, str, strlen(str)); -} - -void duckdb_vector_assign_string_element_len(duckdb_vector vector, idx_t index, const char *str, idx_t str_len) { +void duckdb_unsafe_vector_assign_string_element_len(duckdb_vector vector, idx_t index, const char *str, idx_t str_len) { if (!vector) { return; } diff --git a/src/duckdb/src/main/capi/duckdb_value-c.cpp b/src/duckdb/src/main/capi/duckdb_value-c.cpp index 9c91df242..6e33822eb 100644 --- a/src/duckdb/src/main/capi/duckdb_value-c.cpp +++ b/src/duckdb/src/main/capi/duckdb_value-c.cpp @@ -30,7 +30,11 @@ void duckdb_destroy_value(duckdb_value *value) { } duckdb_value duckdb_create_varchar_length(const char *text, idx_t length) { - return WrapValue(new duckdb::Value(std::string(text, length))); + try { + return WrapValue(new duckdb::Value(std::string(text, length))); + } catch (...) { + return nullptr; + } } duckdb_value duckdb_create_varchar(const char *text) { diff --git a/src/duckdb/src/main/capi/helper-c.cpp b/src/duckdb/src/main/capi/helper-c.cpp index bdf87f2fd..b46fa7fdb 100644 --- a/src/duckdb/src/main/capi/helper-c.cpp +++ b/src/duckdb/src/main/capi/helper-c.cpp @@ -1,4 +1,5 @@ #include "duckdb/main/capi/capi_internal.hpp" +#include "utf8proc_wrapper.hpp" namespace duckdb { @@ -518,3 +519,14 @@ const char *duckdb_string_t_data(duckdb_string_t *string_p) { auto &string = *reinterpret_cast(string_p); return string.GetData(); } + +duckdb_error_data duckdb_valid_utf8_check(const char *str, idx_t len) { + duckdb::UnicodeInvalidReason reason; + size_t pos; + auto utf_type = duckdb::Utf8Proc::Analyze(str, len, &reason, &pos); + if (utf_type == duckdb::UnicodeType::INVALID) { + return duckdb_create_error_data(DUCKDB_ERROR_INVALID_INPUT, + "invalid Unicode detected, str must be valid UTF-8"); + } + return nullptr; +} diff --git a/src/duckdb/src/main/client_context.cpp b/src/duckdb/src/main/client_context.cpp index 0b93f3a88..5e27337ff 100644 --- a/src/duckdb/src/main/client_context.cpp +++ b/src/duckdb/src/main/client_context.cpp @@ -3,6 +3,7 @@ #include "duckdb/catalog/catalog_entry/scalar_function_catalog_entry.hpp" #include "duckdb/catalog/catalog_entry/table_catalog_entry.hpp" #include "duckdb/catalog/catalog_search_path.hpp" +#include "duckdb/common/chrono.hpp" #include "duckdb/common/error_data.hpp" #include "duckdb/common/exception/transaction_exception.hpp" #include "duckdb/common/progress_bar/progress_bar.hpp" @@ -213,6 +214,15 @@ void ClientContext::BeginQueryInternal(ClientContextLock &lock, const string &qu active_query->query = query; query_progress.Initialize(); + // Set query deadline if max_execution_time is configured + auto max_execution_time = Settings::Get(*this); + if (max_execution_time > 0) { + auto now = steady_clock::now(); + auto deadline_tp = now + milliseconds(max_execution_time); + query_deadline = NumericCast(duration_cast(deadline_tp.time_since_epoch()).count()); + } else { + query_deadline.SetInvalid(); + } // Notify any registered state of query begin for (auto &state : registered_state->States()) { state->QueryBegin(*this); @@ -238,6 +248,7 @@ ErrorData ClientContext::EndQueryInternal(ClientContextLock &lock, bool success, active_query->progress_bar.reset(); D_ASSERT(active_query.get()); active_query.reset(); + query_deadline.SetInvalid(); query_progress.Initialize(); ErrorData error; try { @@ -720,8 +731,10 @@ unique_ptr ClientContext::PrepareInternal(ClientContextLock & unique_ptr ClientContext::Prepare(unique_ptr statement) { auto lock = LockContext(); - // prepare the query + // Store the query in case of an error. auto query = statement->query; + + // Try to prepare. try { InitialCleanup(*lock); return PrepareInternal(*lock, std::move(statement)); @@ -1123,6 +1136,23 @@ void ClientContext::ClearInterrupt() { interrupted = false; } +void ClientContext::InterruptCheck() const { + // Counter for throttling timeout checks - only check every N iterations + static constexpr uint32_t TIMEOUT_CHECK_INTERVAL = 256; + thread_local uint32_t timeout_check_counter = 0; + + if (interrupted.load(std::memory_order_relaxed)) { + throw InterruptException(); + } + // Only check timeout every N calls to avoid expensive steady_clock::now() syscall + if (query_deadline.IsValid() && ++timeout_check_counter % TIMEOUT_CHECK_INTERVAL == 0) { + auto now = NumericCast(duration_cast(steady_clock::now().time_since_epoch()).count()); + if (now >= query_deadline.GetIndex()) { + throw InterruptException(); + } + } +} + void ClientContext::CancelTransaction() { auto lock = LockContext(); InitialCleanup(*lock); @@ -1170,6 +1200,7 @@ void ClientContext::RunFunctionInTransactionInternal(ClientContextLock &lock, co if (require_new_transaction) { D_ASSERT(!active_query); transaction.BeginTransaction(); + interrupted = false; } try { fun(); @@ -1225,86 +1256,20 @@ unique_ptr ClientContext::TableInfo(const string &schema_name, return TableInfo(INVALID_CATALOG, schema_name, table_name); } -CommonTableExpressionMap &GetCTEMap(SQLStatement &statement) { - switch (statement.type) { - case StatementType::INSERT_STATEMENT: - return statement.Cast().cte_map; - case StatementType::DELETE_STATEMENT: - return statement.Cast().cte_map; - case StatementType::UPDATE_STATEMENT: - return statement.Cast().cte_map; - case StatementType::MERGE_INTO_STATEMENT: - return statement.Cast().cte_map; - default: - throw InvalidInputException( - "Unsupported statement type for appender: expected INSERT, DELETE, UPDATE or MERGE INTO"); - } -} - -void ClientContext::Append(ColumnDataCollection &collection, const string &query, const vector &column_names, - const string &collection_name) { - // create the CTE for the appender - string alias = collection_name.empty() ? "appended_data" : collection_name; - auto column_data_ref = make_uniq(collection); - column_data_ref->alias = alias; - column_data_ref->expected_names = column_names; - auto cte = make_uniq(); - cte->select_list.push_back(make_uniq()); - cte->from_table = std::move(column_data_ref); - auto cte_select = make_uniq(); - cte_select->node = std::move(cte); - - // parse the query - Parser parser; - parser.ParseQuery(query); - - // must be a single statement with CTEs - if (parser.statements.size() != 1) { - throw InvalidInputException("Expected exactly 1 query for appending data"); - } - - // add the appender data as a CTE to the cte map - auto &cte_map = GetCTEMap(*parser.statements[0]); - auto cte_info = make_uniq(); - cte_info->query = std::move(cte_select); - cte_info->materialized = CTEMaterialize::CTE_MATERIALIZE_NEVER; - - cte_map.map.insert(alias, std::move(cte_info)); - - // now we have the query - run it in a transaction - auto result = Query(std::move(parser.statements[0]), false); +void ClientContext::Append(unique_ptr stmt) { + auto result = Query(std::move(stmt), false); if (result->HasError()) { result->GetErrorObject().Throw("Failed to append: "); } } -void ClientContext::Append(TableDescription &description, ColumnDataCollection &collection, - optional_ptr> column_ids) { +void ClientContext::Append(TableDescription &description, ColumnDataCollection &collection) { string table_name = "__duckdb_internal_appended_data"; - string query = "INSERT INTO "; - if (!description.database.empty()) { - query += StringUtil::Format("%s.", SQLIdentifier(description.database)); - } - if (!description.schema.empty()) { - query += StringUtil::Format("%s.", SQLIdentifier(description.schema)); - } - query += StringUtil::Format("%s", SQLIdentifier(description.table)); - if (column_ids && !column_ids->empty()) { - query += "("; - auto &ids = *column_ids; - for (idx_t i = 0; i < ids.size(); i++) { - if (i > 0) { - query += ", "; - } - auto &col_name = description.columns[ids[i].index].Name(); - query += StringUtil::Format("%s", SQLIdentifier(col_name)); - } - query += ")"; - } - query += " FROM "; - query += table_name; - vector column_names; - Append(collection, query, column_names, table_name); + vector expected_names; + auto query = Appender::ConstructQuery(description, table_name, expected_names); + auto table_ref = BaseAppender::GetColumnDataTableRef(collection, table_name, expected_names); + auto stmt = BaseAppender::ParseStatement(std::move(table_ref), query, table_name); + Append(std::move(stmt)); } void ClientContext::InternalTryBindRelation(Relation &relation, vector &result_columns) { @@ -1456,7 +1421,7 @@ ParserOptions ClientContext::GetParserOptions() const { options.preserve_identifier_case = Settings::Get(*this); options.integer_division = Settings::Get(*this); options.max_expression_depth = Settings::Get(*this); - options.extensions = &DBConfig::GetConfig(*this).parser_extensions; + options.extensions = DBConfig::GetConfig(*this).GetCallbackManager(); options.parser_override_setting = Settings::Get(*this); return options; } @@ -1492,4 +1457,12 @@ bool ClientContext::ExecutionIsFinished() { return active_query->executor->ExecutionIsFinished(); } +LogicalType ClientContext::ParseLogicalType(const string &type) { + auto lock = LockContext(); + LogicalType logical_type; + RunFunctionInTransactionInternal(*lock, + [&]() { logical_type = TypeManager::Get(*db).ParseLogicalType(type, *this); }); + return logical_type; +} + } // namespace duckdb diff --git a/src/duckdb/src/main/config.cpp b/src/duckdb/src/main/config.cpp index 4143243ab..e5ada66c2 100644 --- a/src/duckdb/src/main/config.cpp +++ b/src/duckdb/src/main/config.cpp @@ -153,6 +153,7 @@ static const ConfigurationOption internal_options[] = { DUCKDB_GLOBAL(LoggingLevel), DUCKDB_GLOBAL(LoggingMode), DUCKDB_GLOBAL(LoggingStorage), + DUCKDB_SETTING(MaxExecutionTimeSetting), DUCKDB_SETTING(MaxExpressionDepthSetting), DUCKDB_GLOBAL(MaxMemorySetting), DUCKDB_GLOBAL(MaxTempDirectorySizeSetting), @@ -195,12 +196,12 @@ static const ConfigurationOption internal_options[] = { DUCKDB_SETTING(ZstdMinStringLengthSetting), FINAL_SETTING}; -static const ConfigurationAlias setting_aliases[] = {DUCKDB_SETTING_ALIAS("memory_limit", 91), +static const ConfigurationAlias setting_aliases[] = {DUCKDB_SETTING_ALIAS("memory_limit", 92), DUCKDB_SETTING_ALIAS("null_order", 38), - DUCKDB_SETTING_ALIAS("profiling_output", 110), - DUCKDB_SETTING_ALIAS("user", 125), + DUCKDB_SETTING_ALIAS("profiling_output", 111), + DUCKDB_SETTING_ALIAS("user", 126), DUCKDB_SETTING_ALIAS("wal_autocheckpoint", 22), - DUCKDB_SETTING_ALIAS("worker_threads", 124), + DUCKDB_SETTING_ALIAS("worker_threads", 125), FINAL_ALIAS}; vector DBConfig::GetOptions() { @@ -453,8 +454,8 @@ LogicalType DBConfig::ParseLogicalType(const string &type) { return LogicalType::STRUCT(struct_members); } - LogicalType type_id = StringUtil::CIEquals(type, "ANY") ? LogicalType::ANY : TransformStringToLogicalTypeId(type); - if (type_id == LogicalTypeId::USER) { + const auto type_id = StringUtil::CIEquals(type, "ANY") ? LogicalTypeId::ANY : TransformStringToLogicalTypeId(type); + if (type_id == LogicalTypeId::UNBOUND) { throw InternalException("Error while generating extension function overloads - unrecognized logical type %s", type); } @@ -506,7 +507,11 @@ bool DBConfig::IsInMemoryDatabase(const char *database_path) { } CastFunctionSet &DBConfig::GetCastFunctions() { - return *cast_functions; + return type_manager->GetCastFunctions(); +} + +TypeManager &DBConfig::GetTypeManager() { + return *type_manager; } CollationBinding &DBConfig::GetCollationBinding() { @@ -764,12 +769,48 @@ const string DBConfig::UserAgent() const { return user_agent; } -string DBConfig::SanitizeAllowedPath(const string &path) const { - auto path_sep = file_system->PathSeparator(path); +ExtensionCallbackManager &DBConfig::GetCallbackManager() { + return *callback_manager; +} + +const ExtensionCallbackManager &DBConfig::GetCallbackManager() const { + return *callback_manager; +} + +string DBConfig::SanitizeAllowedPath(const string &path_p) const { + auto path_sep = file_system->PathSeparator(path_p); + auto path = path_p; if (path_sep != "/") { // allowed_directories/allowed_path always uses forward slashes regardless of the OS - return StringUtil::Replace(path, path_sep, "/"); + path = StringUtil::Replace(path_p, path_sep, "/"); } + + auto elements = StringUtil::Split(path, "/"); + path.clear(); // later reconstructed + deque path_stack; + for (idx_t i = 0; i < elements.size(); i++) { + if (elements[i].empty() || elements[i] == ".") { + // we ignore empty and `.` + continue; + } + if (elements[i] == "..") { + // .. pops from stack if possible, if already at root its ignored + if (!path_stack.empty()) { + path_stack.pop_back(); + } + } else { + path_stack.push_back(elements[i]); + } + } + // we lost the leading / in the split/loop so leats put it back + if (path_p[0] == '/') { + path = "/"; + } + while (!path_stack.empty()) { + path += path_stack.front() + '/'; + path_stack.pop_front(); + } + return path; } @@ -796,10 +837,12 @@ bool DBConfig::CanAccessFile(const string &input_path, FileType type) { return true; } string path = SanitizeAllowedPath(input_path); + if (options.allowed_paths.count(path) > 0) { // path is explicitly allowed return true; } + if (options.allowed_directories.empty()) { // no prefix directories specified return false; @@ -824,27 +867,6 @@ bool DBConfig::CanAccessFile(const string &input_path, FileType type) { return false; } D_ASSERT(StringUtil::EndsWith(prefix, "/")); - // path is inside an allowed directory - HOWEVER, we could still exit the allowed directory using ".." - // we check if we ever exit the allowed directory using ".." by looking at the path fragments - idx_t directory_level = 0; - idx_t current_pos = prefix.size(); - for (; current_pos < path.size(); current_pos++) { - idx_t dir_begin = current_pos; - // find either the end of the path or the directory separator - for (; path[current_pos] != '/' && current_pos < path.size(); current_pos++) { - } - idx_t path_length = current_pos - dir_begin; - if (path_length == 2 && path[dir_begin] == '.' && path[dir_begin + 1] == '.') { - // go up a directory - if (directory_level == 0) { - // we cannot go up past the prefix - return false; - } - --directory_level; - } else if (path_length > 0) { - directory_level++; - } - } return true; } diff --git a/src/duckdb/src/main/connection.cpp b/src/duckdb/src/main/connection.cpp index 5546594a8..586e8755a 100644 --- a/src/duckdb/src/main/connection.cpp +++ b/src/duckdb/src/main/connection.cpp @@ -204,15 +204,6 @@ unique_ptr Connection::ExtractPlan(const string &query) { return context->ExtractPlan(query); } -void Connection::Append(TableDescription &description, DataChunk &chunk) { - if (chunk.size() == 0) { - return; - } - ColumnDataCollection collection(Allocator::Get(*context), chunk.GetTypes()); - collection.Append(chunk); - Append(description, collection); -} - void Connection::Append(TableDescription &description, ColumnDataCollection &collection) { context->Append(description, collection); } diff --git a/src/duckdb/src/main/connection_manager.cpp b/src/duckdb/src/main/connection_manager.cpp index 436c89eff..f97d373aa 100644 --- a/src/duckdb/src/main/connection_manager.cpp +++ b/src/duckdb/src/main/connection_manager.cpp @@ -11,7 +11,7 @@ ConnectionManager::ConnectionManager() : connection_count(0), current_connection void ConnectionManager::AddConnection(ClientContext &context) { lock_guard lock(connections_lock); - for (auto &callback : DBConfig::GetConfig(context).extension_callbacks) { + for (auto &callback : ExtensionCallback::Iterate(context)) { callback->OnConnectionOpened(context); } connections[context] = weak_ptr(context.shared_from_this()); @@ -20,7 +20,7 @@ void ConnectionManager::AddConnection(ClientContext &context) { void ConnectionManager::RemoveConnection(ClientContext &context) { lock_guard lock(connections_lock); - for (auto &callback : DBConfig::GetConfig(context).extension_callbacks) { + for (auto &callback : ExtensionCallback::Iterate(context)) { callback->OnConnectionClosed(context); } connections.erase(context); diff --git a/src/duckdb/src/main/database.cpp b/src/duckdb/src/main/database.cpp index cfd40872f..30cbed3a8 100644 --- a/src/duckdb/src/main/database.cpp +++ b/src/duckdb/src/main/database.cpp @@ -5,6 +5,7 @@ #include "duckdb/execution/index/index_type_set.hpp" #include "duckdb/execution/operator/helper/physical_set.hpp" #include "duckdb/function/cast/cast_function_set.hpp" +#include "duckdb/common/types/type_manager.hpp" #include "duckdb/function/compression_function.hpp" #include "duckdb/main/attached_database.hpp" #include "duckdb/main/client_context.hpp" @@ -34,6 +35,7 @@ #include "mbedtls_wrapper.hpp" #include "duckdb/main/database_file_path_manager.hpp" #include "duckdb/main/result_set_manager.hpp" +#include "duckdb/main/extension_callback_manager.hpp" #ifndef DUCKDB_NO_THREADS #include "duckdb/common/thread.hpp" @@ -47,13 +49,14 @@ DBConfig::DBConfig() { encoding_functions->Initialize(*this); arrow_extensions = make_uniq(); arrow_extensions->Initialize(*this); - cast_functions = make_uniq(*this); + type_manager = make_uniq(*this); collation_bindings = make_uniq(); index_types = make_uniq(); error_manager = make_uniq(); secret_manager = make_uniq(); http_util = make_shared_ptr(); - storage_extensions["__open_file__"] = OpenFileStorageExtension::Create(); + callback_manager = make_uniq(); + callback_manager->Register("__open_file__", OpenFileStorageExtension::Create()); } DBConfig::DBConfig(bool read_only) : DBConfig::DBConfig() { @@ -171,15 +174,15 @@ shared_ptr DatabaseInstance::CreateAttachedDatabase(ClientCont if (!options.db_type.empty()) { // Find the storage extension for this database file. auto extension_name = ExtensionHelper::ApplyExtensionAlias(options.db_type); - auto entry = config.storage_extensions.find(extension_name); - if (entry == config.storage_extensions.end()) { + auto storage_extension = StorageExtension::Find(config, extension_name); + if (!storage_extension) { throw BinderException("Unrecognized storage type \"%s\"", options.db_type); } - if (entry->second->attach != nullptr && entry->second->create_transaction_manager != nullptr) { + if (storage_extension->attach != nullptr && storage_extension->create_transaction_manager != nullptr) { // Use the storage extension to create the initial database. - attached_database = - make_shared_ptr(*this, catalog, *entry->second, context, info.name, info, options); + attached_database = make_shared_ptr(*this, catalog, *storage_extension, context, + info.name, info, options); return attached_database; } @@ -292,7 +295,8 @@ void DatabaseInstance::Initialize(const char *database_path, DBConfig *user_conf result_set_manager = make_uniq(*this); scheduler = make_uniq(*this); - object_cache = make_uniq(); + object_cache = make_uniq(*config.buffer_pool); + config.buffer_pool->SetObjectCache(object_cache.get()); connection_manager = make_uniq(); extension_manager = make_uniq(*this); @@ -311,8 +315,8 @@ void DatabaseInstance::Initialize(const char *database_path, DBConfig *user_conf if (!config.file_system) { throw InternalException("No file system!?"); } - auto entry = config.storage_extensions.find(config.options.database_type); - if (entry == config.storage_extensions.end()) { + auto storage_extension = StorageExtension::Find(config, config.options.database_type); + if (!storage_extension) { ExtensionHelper::LoadExternalExtension(*this, *config.file_system, config.options.database_type); } } @@ -449,9 +453,6 @@ void DatabaseInstance::Configure(DBConfig &new_config, const char *database_path if (new_config.secret_manager) { config.secret_manager = std::move(new_config.secret_manager); } - if (!new_config.storage_extensions.empty()) { - config.storage_extensions = std::move(new_config.storage_extensions); - } if (config.options.maximum_memory == DConstants::INVALID_INDEX) { config.SetDefaultMaxMemory(); } @@ -467,7 +468,10 @@ void DatabaseInstance::Configure(DBConfig &new_config, const char *database_path DBConfig::GetSystemAvailableMemory(*config.file_system) * 8 / 10, config.options.block_allocator_size); config.replacement_scans = std::move(new_config.replacement_scans); - config.parser_extensions = std::move(new_config.parser_extensions); + if (new_config.callback_manager) { + config.callback_manager = std::move(new_config.callback_manager); + new_config.callback_manager = make_uniq(); + } config.error_manager = std::move(new_config.error_manager); if (!config.error_manager) { config.error_manager = make_uniq(); diff --git a/src/duckdb/src/main/database_manager.cpp b/src/duckdb/src/main/database_manager.cpp index 80b78ee57..4b59e6f2b 100644 --- a/src/duckdb/src/main/database_manager.cpp +++ b/src/duckdb/src/main/database_manager.cpp @@ -7,10 +7,11 @@ #include "duckdb/main/database.hpp" #include "duckdb/main/database_path_and_type.hpp" #include "duckdb/main/extension_helper.hpp" +#include "duckdb/parser/parsed_data/alter_database_info.hpp" +#include "duckdb/storage/storage_extension.hpp" #include "duckdb/storage/storage_manager.hpp" #include "duckdb/transaction/duck_transaction.hpp" #include "duckdb/transaction/duck_transaction_manager.hpp" -#include "duckdb/parser/parsed_data/alter_database_info.hpp" namespace duckdb { @@ -116,9 +117,7 @@ shared_ptr DatabaseManager::AttachDatabase(ClientContext &cont // The database ACTUALLY exists, so we return it. return entry->second; } - if (context.interrupted) { - throw InterruptException(); - } + context.InterruptCheck(); } } auto &config = DBConfig::GetConfig(context); @@ -320,7 +319,7 @@ void DatabaseManager::GetDatabaseType(ClientContext &context, AttachInfo &info, } auto extension_name = ExtensionHelper::ApplyExtensionAlias(options.db_type); - if (config.storage_extensions.find(extension_name) != config.storage_extensions.end()) { + if (StorageExtension::Find(config, extension_name)) { // If the database type is already registered, we don't need to load it again. return; } diff --git a/src/duckdb/src/main/extension/extension_helper.cpp b/src/duckdb/src/main/extension/extension_helper.cpp index a9737342d..27dc3aecd 100644 --- a/src/duckdb/src/main/extension/extension_helper.cpp +++ b/src/duckdb/src/main/extension/extension_helper.cpp @@ -143,7 +143,7 @@ DefaultExtension ExtensionHelper::GetDefaultExtension(idx_t index) { // Allow Auto-Install Extensions //===--------------------------------------------------------------------===// static const char *const auto_install[] = { - "motherduck", "postgres_scanner", "mysql_scanner", "sqlite_scanner", "delta", "iceberg", "uc_catalog", + "motherduck", "postgres_scanner", "mysql_scanner", "sqlite_scanner", "delta", "iceberg", "unity_catalog", "ui", "ducklake", nullptr}; // TODO: unify with new autoload mechanism diff --git a/src/duckdb/src/main/extension/extension_install.cpp b/src/duckdb/src/main/extension/extension_install.cpp index 3fa2ebff7..346aa65a9 100644 --- a/src/duckdb/src/main/extension/extension_install.cpp +++ b/src/duckdb/src/main/extension/extension_install.cpp @@ -220,10 +220,25 @@ static unsafe_unique_array ReadExtensionFileFromDisk(FileSystem &fs, con } static void WriteExtensionFileToDisk(QueryContext &query_context, FileSystem &fs, const string &path, void *data, - idx_t data_size) { - auto target_file = fs.OpenFile(path, FileFlags::FILE_FLAGS_WRITE | FileFlags::FILE_FLAGS_APPEND | - FileFlags::FILE_FLAGS_FILE_CREATE_NEW); + idx_t data_size, DBConfig &config) { + if (!Settings::Get(config)) { + const bool signature_valid = ExtensionHelper::CheckExtensionBufferSignature( + static_cast(data), data_size, Settings::Get(config)); + if (!signature_valid) { + throw IOException("Attempting to install an extension file that doesn't have a valid signature, see " + "https://duckdb.org/docs/stable/operations_manual/securing_duckdb/securing_extensions"); + } + } + + // Now signature has been checked (if signature checking is enabled) + + // Open target_file, at this points ending with '.duckdb_extension' + auto target_file = + fs.OpenFile(path, FileFlags::FILE_FLAGS_WRITE | FileFlags::FILE_FLAGS_READ | FileFlags::FILE_FLAGS_APPEND | + FileFlags::FILE_FLAGS_FILE_CREATE_NEW | FileFlags::FILE_FLAGS_ENABLE_EXTENSION_INSTALL); + // Write content to the file target_file->Write(query_context, data, data_size); + target_file->Close(); target_file.reset(); } @@ -284,9 +299,23 @@ static void CheckExtensionMetadataOnInstall(DatabaseInstance &db, void *in_buffe // 3. Crash after extension move: extension is now uninstalled, new metadata file present static void WriteExtensionFiles(QueryContext &query_context, FileSystem &fs, const string &temp_path, const string &local_extension_path, void *in_buffer, idx_t file_size, - ExtensionInstallInfo &info) { + ExtensionInstallInfo &info, DBConfig &config) { + // temp_path ends with '.duckdb_extension' + if (!StringUtil::EndsWith(temp_path, ".duckdb_extension")) { + throw InternalException("Extension install temp_path of '%s' is not valid, should end in '.duckdb_extension'", + temp_path); + } + // local_extension_path ends with '.duckdb_extension', and given it will be written only after signature checks, + // it's now loadable + if (!StringUtil::EndsWith(local_extension_path, ".duckdb_extension")) { + throw InternalException("Extension install local_extension_path of '%s' is not valid, should end in " + "'.duckdb_extension'", + temp_path); + } + // Write extension to tmp file - WriteExtensionFileToDisk(query_context, fs, temp_path, in_buffer, file_size); + WriteExtensionFileToDisk(query_context, fs, temp_path, in_buffer, file_size, config); + // When this exit, signature has already being checked (if enabled by config) // Write metadata to tmp file auto metadata_tmp_path = temp_path + ".info"; @@ -370,7 +399,7 @@ static unique_ptr DirectInstallExtension(DatabaseInstance QueryContext query_context(context); WriteExtensionFiles(query_context, fs, temp_path, local_extension_path, extension_decompressed, - extension_decompressed_size, info); + extension_decompressed_size, info, db.config); return make_uniq(info); } @@ -462,7 +491,7 @@ static unique_ptr InstallFromHttpUrl(DatabaseInstance &db, QueryContext query_context(context); auto fs = FileSystem::CreateLocal(); WriteExtensionFiles(query_context, *fs, temp_path, local_extension_path, (void *)decompressed_body.data(), - decompressed_body.size(), info); + decompressed_body.size(), info, db.config); return make_uniq(info); } @@ -528,7 +557,8 @@ unique_ptr ExtensionHelper::InstallExtensionInternal(Datab auto extension_name = ApplyExtensionAlias(fs.ExtractBaseName(extension)); string local_extension_path = fs.JoinPath(local_path, extension_name + ".duckdb_extension"); - string temp_path = local_extension_path + ".tmp-" + UUID::ToString(UUID::GenerateRandomUUID()); + string temp_path = + local_extension_path + ".tmp-" + UUID::ToString(UUID::GenerateRandomUUID()) + ".duckdb_extension"; if (fs.FileExists(local_extension_path) && !options.force_install) { // File exists: throw error if origin mismatches diff --git a/src/duckdb/src/main/extension/extension_load.cpp b/src/duckdb/src/main/extension/extension_load.cpp index 1003354bf..50f95a2bb 100644 --- a/src/duckdb/src/main/extension/extension_load.cpp +++ b/src/duckdb/src/main/extension/extension_load.cpp @@ -34,6 +34,7 @@ struct DuckDBExtensionLoadState { //! Create a DuckDBExtensionLoadState reference from a C API opaque pointer static DuckDBExtensionLoadState &Get(duckdb_extension_info info) { D_ASSERT(info); + return *reinterpret_cast(info); } @@ -164,9 +165,41 @@ static T TryLoadFunctionFromDLL(void *dll, const string &function_name, const st return (T)function; } -static void ComputeSHA256String(const string &to_hash, string *res) { +static void ComputeSHA256Buffer(const char *buffer, const idx_t start, const idx_t end, string *res) { // Invoke MbedTls function to actually compute sha256 - *res = duckdb_mbedtls::MbedTlsWrapper::ComputeSha256Hash(to_hash); + char hash[duckdb_mbedtls::MbedTlsWrapper::SHA256_HASH_LENGTH_BYTES]; + duckdb_mbedtls::MbedTlsWrapper::ComputeSha256Hash(buffer + start, end - start, hash); + *res = std::string(hash, duckdb_mbedtls::MbedTlsWrapper::SHA256_HASH_LENGTH_BYTES); +} + +static void ComputeSHA256String(const string &to_hash, string *res) { + ComputeSHA256Buffer(to_hash.data(), 0, to_hash.length(), res); +} + +static string ComputeFinalHash(const vector &chunks) { + string hash_concatenation; + hash_concatenation.reserve(32 * chunks.size()); // 256 bits -> 32 bytes per chunk + + for (auto &chunk : chunks) { + hash_concatenation += chunk; + } + + string two_level_hash; + ComputeSHA256String(hash_concatenation, &two_level_hash); + + return two_level_hash; +} + +static void IntializeAncillaryData(vector &hash_chunks, vector &splits, idx_t length) { + const idx_t maxLenChunks = 1024ULL * 1024ULL; + const idx_t numChunks = (length + maxLenChunks - 1) / maxLenChunks; + hash_chunks.resize(numChunks); + splits.resize(numChunks + 1); + + for (idx_t i = 0; i < numChunks; i++) { + splits[i] = maxLenChunks * i; + } + splits.back() = length; } static void ComputeSHA256FileSegment(FileHandle *handle, const idx_t start, const idx_t end, string *res) { @@ -189,6 +222,26 @@ static void ComputeSHA256FileSegment(FileHandle *handle, const idx_t start, cons *res = state.Finalize(); } +template +static void ComputeHashesOnSegments(F ComputeHashFun, T handle, const vector &splits, + vector &hash_chunks) { +#ifndef DUCKDB_NO_THREADS + vector threads; + threads.reserve(hash_chunks.size()); + for (idx_t i = 0; i < hash_chunks.size(); i++) { + threads.emplace_back(ComputeHashFun, handle, splits[i], splits[i + 1], &hash_chunks[i]); + } + + for (auto &thread : threads) { + thread.join(); + } +#else + for (idx_t i = 0; i < hash_chunks.size(); i++) { + ComputeHashFun(handle, splits[i], splits[i + 1], &hash_chunks[i]); + } +#endif // DUCKDB_NO_THREADS +} + static string FilterZeroAtEnd(string s) { while (!s.empty() && s.back() == '\0') { s.pop_back(); @@ -257,57 +310,54 @@ ParsedExtensionMetaData ExtensionHelper::ParseExtensionMetaData(FileHandle &hand return ParseExtensionMetaData(metadata_segment.data()); } +static bool CheckKnownSignatures(const string &two_level_hash, const string &signature, + const bool allow_community_extensions) { + for (auto &key : ExtensionHelper::GetPublicKeys(allow_community_extensions)) { + if (duckdb_mbedtls::MbedTlsWrapper::IsValidSha256Signature(key, signature, two_level_hash)) { + return true; + } + } + + return false; +} + bool ExtensionHelper::CheckExtensionSignature(FileHandle &handle, ParsedExtensionMetaData &parsed_metadata, const bool allow_community_extensions) { auto signature_offset = handle.GetFileSize() - ParsedExtensionMetaData::SIGNATURE_SIZE; - const idx_t maxLenChunks = 1024ULL * 1024ULL; - const idx_t numChunks = (signature_offset + maxLenChunks - 1) / maxLenChunks; - vector hash_chunks(numChunks); - vector splits(numChunks + 1); + vector hash_chunks; + vector splits; + IntializeAncillaryData(hash_chunks, splits, signature_offset); - for (idx_t i = 0; i < numChunks; i++) { - splits[i] = maxLenChunks * i; - } - splits.back() = signature_offset; + ComputeHashesOnSegments(ComputeSHA256FileSegment, &handle, splits, hash_chunks); -#ifndef DUCKDB_NO_THREADS - vector threads; - threads.reserve(numChunks); - for (idx_t i = 0; i < numChunks; i++) { - threads.emplace_back(ComputeSHA256FileSegment, &handle, splits[i], splits[i + 1], &hash_chunks[i]); - } + const string resulting_hash = ComputeFinalHash(hash_chunks); - for (auto &thread : threads) { - thread.join(); - } -#else - for (idx_t i = 0; i < numChunks; i++) { - ComputeSHA256FileSegment(&handle, splits[i], splits[i + 1], &hash_chunks[i]); - } -#endif // DUCKDB_NO_THREADS + // TODO maybe we should do a stream read / hash update here + handle.Read((void *)parsed_metadata.signature.data(), parsed_metadata.signature.size(), signature_offset); - string hash_concatenation; - hash_concatenation.reserve(32 * numChunks); // 256 bits -> 32 bytes per chunk + return CheckKnownSignatures(resulting_hash, parsed_metadata.signature, allow_community_extensions); +} - for (auto &hash_chunk : hash_chunks) { - hash_concatenation += hash_chunk; - } +bool ExtensionHelper::CheckExtensionBufferSignature(const char *buffer, idx_t buffer_length, const string &signature, + const bool allow_community_extensions) { + vector hash_chunks; + vector splits; + IntializeAncillaryData(hash_chunks, splits, buffer_length); - string two_level_hash; - ComputeSHA256String(hash_concatenation, &two_level_hash); + ComputeHashesOnSegments(ComputeSHA256Buffer, buffer, splits, hash_chunks); - // TODO maybe we should do a stream read / hash update here - handle.Read((void *)parsed_metadata.signature.data(), parsed_metadata.signature.size(), signature_offset); + const string resulting_hash = ComputeFinalHash(hash_chunks); - for (auto &key : ExtensionHelper::GetPublicKeys(allow_community_extensions)) { - if (duckdb_mbedtls::MbedTlsWrapper::IsValidSha256Signature(key, parsed_metadata.signature, two_level_hash)) { - return true; - break; - } - } + return CheckKnownSignatures(resulting_hash, signature, allow_community_extensions); +} - return false; +bool ExtensionHelper::CheckExtensionBufferSignature(const char *buffer, idx_t total_buffer_length, + const bool allow_community_extensions) { + auto signature_offset = total_buffer_length - ParsedExtensionMetaData::SIGNATURE_SIZE; + string signature = std::string(buffer + signature_offset, ParsedExtensionMetaData::SIGNATURE_SIZE); + + return CheckExtensionBufferSignature(buffer, signature_offset, signature, allow_community_extensions); } bool ExtensionHelper::TryInitialLoad(DatabaseInstance &db, FileSystem &fs, const string &extension, @@ -403,6 +453,12 @@ bool ExtensionHelper::TryInitialLoad(DatabaseInstance &db, FileSystem &fs, const direct_load = true; filename = fs.ExpandPath(filename); } + if (!StringUtil::EndsWith(filename, ".duckdb_extension")) { + throw PermissionException( + "DuckDB extensions are files ending with '.duckdb_extension', loading different " + "files is not possible, error while loading from '%s', consider 'INSTALL ; LOAD ;'", + filename); + } if (!fs.FileExists(filename)) { string message; bool exact_match = ExtensionHelper::CreateSuggestions(extension, message); diff --git a/src/duckdb/src/main/extension_callback_manager.cpp b/src/duckdb/src/main/extension_callback_manager.cpp new file mode 100644 index 000000000..fc0423d02 --- /dev/null +++ b/src/duckdb/src/main/extension_callback_manager.cpp @@ -0,0 +1,174 @@ +#include "duckdb/main/extension_callback_manager.hpp" +#include "duckdb/parser/parser_extension.hpp" +#include "duckdb/optimizer/optimizer_extension.hpp" +#include "duckdb/planner/operator_extension.hpp" +#include "duckdb/planner/planner_extension.hpp" +#include "duckdb/storage/storage_extension.hpp" +#include "duckdb/planner/extension_callback.hpp" + +namespace duckdb { + +struct ExtensionCallbackRegistry { + //! Extensions made to the parser + vector parser_extensions; + //! Extensions made to the planner + vector planner_extensions; + //! Extensions made to the optimizer + vector optimizer_extensions; + //! Extensions made to binder + vector> operator_extensions; + //! Extensions made to storage + case_insensitive_map_t> storage_extensions; + //! Set of callbacks that can be installed by extensions + vector> extension_callbacks; +}; + +ExtensionCallbackManager &ExtensionCallbackManager::Get(ClientContext &context) { + return DBConfig::GetConfig(context).GetCallbackManager(); +} + +const ExtensionCallbackManager &ExtensionCallbackManager::Get(const ClientContext &context) { + return DBConfig::GetConfig(context).GetCallbackManager(); +} + +ExtensionCallbackManager &ExtensionCallbackManager::Get(DatabaseInstance &db) { + return DBConfig::GetConfig(db).GetCallbackManager(); +} + +ExtensionCallbackManager::ExtensionCallbackManager() : callback_registry(make_shared_ptr()) { +} +ExtensionCallbackManager::~ExtensionCallbackManager() { +} + +void ExtensionCallbackManager::Register(ParserExtension extension) { + lock_guard guard(registry_lock); + auto new_registry = make_shared_ptr(*callback_registry); + new_registry->parser_extensions.push_back(std::move(extension)); + callback_registry.atomic_store(new_registry); +} + +void ExtensionCallbackManager::Register(PlannerExtension extension) { + lock_guard guard(registry_lock); + auto new_registry = make_shared_ptr(*callback_registry); + new_registry->planner_extensions.push_back(std::move(extension)); + callback_registry.atomic_store(new_registry); +} + +void ExtensionCallbackManager::Register(OptimizerExtension extension) { + lock_guard guard(registry_lock); + auto new_registry = make_shared_ptr(*callback_registry); + new_registry->optimizer_extensions.push_back(std::move(extension)); + callback_registry.atomic_store(new_registry); +} + +void ExtensionCallbackManager::Register(shared_ptr extension) { + lock_guard guard(registry_lock); + auto new_registry = make_shared_ptr(*callback_registry); + new_registry->operator_extensions.push_back(std::move(extension)); + callback_registry.atomic_store(new_registry); +} + +void ExtensionCallbackManager::Register(const string &name, shared_ptr extension) { + lock_guard guard(registry_lock); + auto new_registry = make_shared_ptr(*callback_registry); + new_registry->storage_extensions[name] = std::move(extension); + callback_registry.atomic_store(new_registry); +} + +void ExtensionCallbackManager::Register(shared_ptr extension) { + lock_guard guard(registry_lock); + auto new_registry = make_shared_ptr(*callback_registry); + new_registry->extension_callbacks.push_back(std::move(extension)); + callback_registry.atomic_store(new_registry); +} + +template +ExtensionCallbackIteratorHelper::ExtensionCallbackIteratorHelper( + const vector &vec, shared_ptr callback_registry) + : vec(vec), callback_registry(std::move(callback_registry)) { +} + +template +ExtensionCallbackIteratorHelper::~ExtensionCallbackIteratorHelper() { +} + +ExtensionCallbackIteratorHelper> ExtensionCallbackManager::OperatorExtensions() const { + auto registry = callback_registry.atomic_load(); + auto &operator_extensions = registry->operator_extensions; + return ExtensionCallbackIteratorHelper>(operator_extensions, std::move(registry)); +} + +ExtensionCallbackIteratorHelper ExtensionCallbackManager::OptimizerExtensions() const { + auto registry = callback_registry.atomic_load(); + auto &optimizer_extensions = registry->optimizer_extensions; + return ExtensionCallbackIteratorHelper(optimizer_extensions, std::move(registry)); +} + +ExtensionCallbackIteratorHelper ExtensionCallbackManager::ParserExtensions() const { + auto registry = callback_registry.atomic_load(); + auto &parser_extensions = registry->parser_extensions; + return ExtensionCallbackIteratorHelper(parser_extensions, std::move(registry)); +} + +ExtensionCallbackIteratorHelper ExtensionCallbackManager::PlannerExtensions() const { + auto registry = callback_registry.atomic_load(); + auto &planner_extensions = registry->planner_extensions; + return ExtensionCallbackIteratorHelper(planner_extensions, std::move(registry)); +} + +ExtensionCallbackIteratorHelper> ExtensionCallbackManager::ExtensionCallbacks() const { + auto registry = callback_registry.atomic_load(); + auto &extension_callbacks = registry->extension_callbacks; + return ExtensionCallbackIteratorHelper>(extension_callbacks, std::move(registry)); +} + +optional_ptr ExtensionCallbackManager::FindStorageExtension(const string &name) const { + auto registry = callback_registry.atomic_load(); + auto entry = registry->storage_extensions.find(name); + if (entry == registry->storage_extensions.end()) { + return nullptr; + } + return entry->second.get(); +} + +bool ExtensionCallbackManager::HasParserExtensions() const { + auto registry = callback_registry.atomic_load(); + return !registry->parser_extensions.empty(); +} + +void OptimizerExtension::Register(DBConfig &config, OptimizerExtension extension) { + config.GetCallbackManager().Register(std::move(extension)); +} + +void ParserExtension::Register(DBConfig &config, ParserExtension extension) { + config.GetCallbackManager().Register(std::move(extension)); +} + +void PlannerExtension::Register(DBConfig &config, PlannerExtension extension) { + config.GetCallbackManager().Register(std::move(extension)); +} + +void OperatorExtension::Register(DBConfig &config, shared_ptr extension) { + config.GetCallbackManager().Register(std::move(extension)); +} + +optional_ptr StorageExtension::Find(const DBConfig &config, const string &extension_name) { + return config.GetCallbackManager().FindStorageExtension(extension_name); +} + +void ExtensionCallback::Register(DBConfig &config, shared_ptr extension) { + config.GetCallbackManager().Register(std::move(extension)); +} + +void StorageExtension::Register(DBConfig &config, const string &extension_name, + shared_ptr extension) { + config.GetCallbackManager().Register(extension_name, std::move(extension)); +} + +template class ExtensionCallbackIteratorHelper>; +template class ExtensionCallbackIteratorHelper>; +template class ExtensionCallbackIteratorHelper; +template class ExtensionCallbackIteratorHelper; +template class ExtensionCallbackIteratorHelper; + +} // namespace duckdb diff --git a/src/duckdb/src/main/extension_manager.cpp b/src/duckdb/src/main/extension_manager.cpp index fbb2b9cea..24459fabf 100644 --- a/src/duckdb/src/main/extension_manager.cpp +++ b/src/duckdb/src/main/extension_manager.cpp @@ -17,16 +17,14 @@ void ExtensionActiveLoad::FinishLoad(ExtensionInstallInfo &install_info) { info.is_loaded = true; info.install_info = make_uniq(install_info); - auto &callbacks = DBConfig::GetConfig(db).extension_callbacks; - for (auto &callback : callbacks) { + for (auto &callback : ExtensionCallback::Iterate(db)) { callback->OnExtensionLoaded(db, extension_name); } DUCKDB_LOG_INFO(db, extension_name); } void ExtensionActiveLoad::LoadFail(const ErrorData &error) { - auto &callbacks = DBConfig::GetConfig(db).extension_callbacks; - for (auto &callback : callbacks) { + for (auto &callback : ExtensionCallback::Iterate(db)) { callback->OnExtensionLoadFail(db, extension_name, error); } DUCKDB_LOG_INFO(db, "Failed to load extension '%s': %s", extension_name, error.Message()); @@ -104,8 +102,7 @@ unique_ptr ExtensionManager::BeginLoad(const string &name) if (info->is_loaded) { return nullptr; } - auto &callbacks = DBConfig::GetConfig(db).extension_callbacks; - for (auto &callback : callbacks) { + for (auto &callback : ExtensionCallback::Iterate(db)) { callback->OnBeginExtensionLoad(db, extension_name); } // extension is not loaded yet and we are in charge of loading it - return diff --git a/src/duckdb/src/main/prepared_statement.cpp b/src/duckdb/src/main/prepared_statement.cpp index 49ff9ac94..69332537a 100644 --- a/src/duckdb/src/main/prepared_statement.cpp +++ b/src/duckdb/src/main/prepared_statement.cpp @@ -70,19 +70,34 @@ case_insensitive_map_t PreparedStatement::GetExpectedParameterTypes unique_ptr PreparedStatement::Execute(case_insensitive_map_t &named_values, bool allow_stream_result) { - auto pending = PendingQuery(named_values, allow_stream_result); - if (pending->HasError()) { - return make_uniq(pending->GetErrorObject()); + if (!success) { + return make_uniq( + ErrorData(InvalidInputException("Attempting to execute an unsuccessfully prepared statement!"))); } - return pending->Execute(); + + try { + VerifyParameters(named_values, named_param_map); + } catch (const std::exception &ex) { + return make_uniq(ErrorData(ex)); + } + + PendingQueryParameters parameters; + parameters.parameters = &named_values; + D_ASSERT(data); + parameters.query_parameters.output_type = + allow_stream_result && data->properties.output_type == QueryResultOutputType::ALLOW_STREAMING + ? QueryResultOutputType::ALLOW_STREAMING + : QueryResultOutputType::FORCE_MATERIALIZED; + + return context->Execute(query, data, parameters); } unique_ptr PreparedStatement::Execute(vector &values, bool allow_stream_result) { - auto pending = PendingQuery(values, allow_stream_result); - if (pending->HasError()) { - return make_uniq(pending->GetErrorObject()); + case_insensitive_map_t named_values; + for (idx_t i = 0; i < values.size(); i++) { + named_values[std::to_string(i + 1)] = BoundParameterData(values[i]); } - return pending->Execute(); + return Execute(named_values, allow_stream_result); } unique_ptr PreparedStatement::PendingQuery(vector &values, bool allow_stream_result) { diff --git a/src/duckdb/src/main/query_profiler.cpp b/src/duckdb/src/main/query_profiler.cpp index 17e5f1f42..f989f6fb6 100644 --- a/src/duckdb/src/main/query_profiler.cpp +++ b/src/duckdb/src/main/query_profiler.cpp @@ -801,13 +801,11 @@ string QueryProfiler::ToJSON() const { } void QueryProfiler::WriteToFile(const char *path, string &info) const { - ofstream out(path); - out << info; - out.close(); - // throw an IO exception if it fails to write the file - if (out.fail()) { - throw IOException(strerror(errno)); - } + auto &fs = FileSystem::GetFileSystem(context); + auto flags = FileOpenFlags::FILE_FLAGS_WRITE | FileOpenFlags::FILE_FLAGS_FILE_CREATE_NEW; + auto file = fs.OpenFile(path, flags); + file->Write((void *)info.c_str(), info.size()); + file->Close(); } profiler_settings_t EraseQueryRootSettings(profiler_settings_t settings) { diff --git a/src/duckdb/src/main/secret/secret.cpp b/src/duckdb/src/main/secret/secret.cpp index 9a39b7176..1e53afb14 100644 --- a/src/duckdb/src/main/secret/secret.cpp +++ b/src/duckdb/src/main/secret/secret.cpp @@ -163,6 +163,11 @@ void KeyValueSecretReader::Initialize(const char **secret_types, idx_t secret_ty } } +KeyValueSecretReader::KeyValueSecretReader(const KeyValueSecret &secret_p, FileOpener &opener_p) : secret(secret_p) { + db = opener_p.TryGetDatabase(); + context = opener_p.TryGetClientContext(); +} + KeyValueSecretReader::KeyValueSecretReader(FileOpener &opener_p, optional_ptr info, const char **secret_types, idx_t secret_types_len) { db = opener_p.TryGetDatabase(); diff --git a/src/duckdb/src/main/settings/custom_settings.cpp b/src/duckdb/src/main/settings/custom_settings.cpp index 72953fc16..cf05f7f4f 100644 --- a/src/duckdb/src/main/settings/custom_settings.cpp +++ b/src/duckdb/src/main/settings/custom_settings.cpp @@ -703,8 +703,8 @@ void EnableExternalAccessSetting::OnSet(SettingCallbackInfo &info, Value &input) for (auto &path : attached_paths) { config.AddAllowedPath(path); config.AddAllowedPath(path + ".wal"); - config.AddAllowedPath(path + ".checkpoint.wal"); - config.AddAllowedPath(path + ".recovery.wal"); + config.AddAllowedPath(path + ".wal.checkpoint"); + config.AddAllowedPath(path + ".wal.recovery"); } } if (config.options.use_temporary_directory && !config.options.temporary_directory.empty()) { @@ -750,7 +750,12 @@ void ForceVariantShredding::SetGlobal(DatabaseInstance *_, DBConfig &config, con value.type().ToString()); } - auto logical_type = TransformStringToLogicalType(value.GetValue()); + auto logical_type = UnboundType::TryParseAndDefaultBind(value.GetValue()); + if (logical_type.id() == LogicalTypeId::INVALID) { + throw InvalidInputException("Could not parse the argument '%s' to 'force_variant_shredding' as a built in type", + value.GetValue()); + } + TypeVisitor::Contains(logical_type, [](const LogicalType &type) { if (type.IsNested()) { if (type.id() != LogicalTypeId::STRUCT && type.id() != LogicalTypeId::LIST) { diff --git a/src/duckdb/src/optimizer/build_probe_side_optimizer.cpp b/src/duckdb/src/optimizer/build_probe_side_optimizer.cpp index b4e92b7cd..15910474a 100644 --- a/src/duckdb/src/optimizer/build_probe_side_optimizer.cpp +++ b/src/duckdb/src/optimizer/build_probe_side_optimizer.cpp @@ -59,9 +59,15 @@ static void FlipChildren(LogicalOperator &op) { case LogicalOperatorType::LOGICAL_DELIM_JOIN: { auto &join = op.Cast(); join.join_type = InverseJoinType(join.join_type); - for (auto &cond : join.conditions) { - std::swap(cond.left, cond.right); - cond.comparison = FlipComparisonExpression(cond.comparison); + for (idx_t i = 0; i < join.conditions.size(); i++) { + auto &cond = join.conditions[i]; + if (cond.IsComparison()) { + auto left_expr = cond.RightReference()->Copy(); + auto right_expr = cond.LeftReference()->Copy(); + auto flipped_comparison = FlipComparisonExpression(cond.GetComparisonType()); + + join.conditions[i] = JoinCondition(std::move(left_expr), std::move(right_expr), flipped_comparison); + } } std::swap(join.left_projection_map, join.right_projection_map); return; diff --git a/src/duckdb/src/optimizer/column_lifetime_analyzer.cpp b/src/duckdb/src/optimizer/column_lifetime_analyzer.cpp index 8bb1b0cb6..e31e9b445 100644 --- a/src/duckdb/src/optimizer/column_lifetime_analyzer.cpp +++ b/src/duckdb/src/optimizer/column_lifetime_analyzer.cpp @@ -13,6 +13,7 @@ #include "duckdb/planner/operator/logical_order.hpp" #include "duckdb/planner/operator/logical_projection.hpp" #include "duckdb/main/settings.hpp" +#include "duckdb/planner/binder.hpp" namespace duckdb { diff --git a/src/duckdb/src/optimizer/compressed_materialization/compress_comparison_join.cpp b/src/duckdb/src/optimizer/compressed_materialization/compress_comparison_join.cpp index ed5b7ddac..28a9da85f 100644 --- a/src/duckdb/src/optimizer/compressed_materialization/compress_comparison_join.cpp +++ b/src/duckdb/src/optimizer/compressed_materialization/compress_comparison_join.cpp @@ -53,38 +53,60 @@ void CompressedMaterialization::CompressComparisonJoin(unique_ptrGetExpressionType() == ExpressionType::BOUND_COLUMN_REF && - condition.right->GetExpressionType() == ExpressionType::BOUND_COLUMN_REF) { - // Both are bound column refs, see if both can be compressed generically to the same type - auto &lhs_colref = condition.left->Cast(); - auto &rhs_colref = condition.right->Cast(); - auto lhs_it = statistics_map.find(lhs_colref.binding); - auto rhs_it = statistics_map.find(rhs_colref.binding); - if (lhs_it != statistics_map.end() && rhs_it != statistics_map.end() && lhs_it->second && - rhs_it->second) { - // For joins we need to compress both using the same statistics, otherwise comparisons don't work - auto merged_stats = lhs_it->second->Copy(); - merged_stats.Merge(*rhs_it->second); - - // If one can be compressed, both can (same stats) - auto compress_expr = GetCompressExpression(condition.left->Copy(), merged_stats); - if (compress_expr) { - D_ASSERT(GetCompressExpression(condition.right->Copy(), merged_stats)); - // This will be compressed generically, but we have to merge the stats - lhs_it->second->Merge(merged_stats); - rhs_it->second->Merge(merged_stats); - probe_compress_bindings.insert(lhs_colref.binding); - continue; + if (condition.IsComparison() && + condition.GetLHS().GetExpressionType() == ExpressionType::BOUND_COLUMN_REF && + condition.GetRHS().GetExpressionType() == ExpressionType::BOUND_COLUMN_REF) { + // check if either side is referenced in residual predicate + auto &lhs_colref = condition.GetLHS().Cast(); + auto &rhs_colref = condition.GetRHS().Cast(); + bool lhs_referenced = referenced_bindings.count(lhs_colref.binding) > 0; + bool rhs_referenced = referenced_bindings.count(rhs_colref.binding) > 0; + + if (!lhs_referenced && !rhs_referenced) { + // Both are bound column refs, see if both can be compressed generically to the same type + auto lhs_it = statistics_map.find(lhs_colref.binding); + auto rhs_it = statistics_map.find(rhs_colref.binding); + if (lhs_it != statistics_map.end() && rhs_it != statistics_map.end() && lhs_it->second && + rhs_it->second) { + // For joins we need to compress both using the same statistics, otherwise comparisons don't + // work + auto merged_stats = lhs_it->second->Copy(); + merged_stats.Merge(*rhs_it->second); + + // If one can be compressed, both can (same stats) + auto compress_expr = GetCompressExpression(condition.GetLHS().Copy(), merged_stats); + if (compress_expr) { + D_ASSERT(GetCompressExpression(condition.GetRHS().Copy(), merged_stats)); + // This will be compressed generically, but we have to merge the stats + lhs_it->second->Merge(merged_stats); + rhs_it->second->Merge(merged_stats); + probe_compress_bindings.insert(lhs_colref.binding); + continue; + } } } } } - GetReferencedBindings(*condition.left, referenced_bindings); - GetReferencedBindings(*condition.right, referenced_bindings); + if (condition.IsComparison()) { + GetReferencedBindings(condition.GetLHS(), referenced_bindings); + GetReferencedBindings(condition.GetRHS(), referenced_bindings); + } } if (join.type == LogicalOperatorType::LOGICAL_DELIM_JOIN) { @@ -130,16 +152,16 @@ void CompressedMaterialization::UpdateComparisonJoinStats(unique_ptrGetExpressionType() != ExpressionType::BOUND_COLUMN_REF || - condition.right->GetExpressionType() != ExpressionType::BOUND_COLUMN_REF) { + if (!condition.IsComparison() || condition.GetLHS().GetExpressionType() != ExpressionType::BOUND_COLUMN_REF || + condition.GetRHS().GetExpressionType() != ExpressionType::BOUND_COLUMN_REF) { continue; // We definitely didn't compress these, nothing changed } if (condition_idx * 2 >= compressed_join.join_stats.size()) { break; } - auto &lhs_colref = condition.left->Cast(); - auto &rhs_colref = condition.right->Cast(); + auto &lhs_colref = condition.GetLHS().Cast(); + auto &rhs_colref = condition.GetRHS().Cast(); auto &lhs_join_stats = compressed_join.join_stats[condition_idx * 2]; auto &rhs_join_stats = compressed_join.join_stats[condition_idx * 2 + 1]; auto lhs_it = statistics_map.find(lhs_colref.binding); diff --git a/src/duckdb/src/optimizer/deliminator.cpp b/src/duckdb/src/optimizer/deliminator.cpp index 210d17a87..d1f6f92da 100644 --- a/src/duckdb/src/optimizer/deliminator.cpp +++ b/src/duckdb/src/optimizer/deliminator.cpp @@ -36,7 +36,10 @@ struct DelimCandidate { }; static bool IsEqualityJoinCondition(const JoinCondition &cond) { - switch (cond.comparison) { + if (!cond.IsComparison()) { + return false; + } + switch (cond.GetComparisonType()) { case ExpressionType::COMPARE_EQUAL: case ExpressionType::COMPARE_NOT_DISTINCT_FROM: return true; @@ -203,9 +206,12 @@ bool Deliminator::RemoveJoinWithDelimGet(LogicalComparisonJoin &delim_join, cons ColumnBindingReplacer replacer; auto &replacement_bindings = replacer.replacement_bindings; for (auto &cond : comparison_join.conditions) { + if (!cond.IsComparison()) { + return false; + } all_equality_conditions = all_equality_conditions && IsEqualityJoinCondition(cond); - auto &delim_side = delim_idx == 0 ? *cond.left : *cond.right; - auto &other_side = delim_idx == 0 ? *cond.right : *cond.left; + auto &delim_side = delim_idx == 0 ? cond.GetLHS() : cond.GetRHS(); + auto &other_side = delim_idx == 0 ? cond.GetRHS() : cond.GetLHS(); if (delim_side.GetExpressionType() != ExpressionType::BOUND_COLUMN_REF || other_side.GetExpressionType() != ExpressionType::BOUND_COLUMN_REF) { return false; @@ -216,8 +222,8 @@ bool Deliminator::RemoveJoinWithDelimGet(LogicalComparisonJoin &delim_join, cons // Only add IS NOT NULL filter for regular equality/inequality comparisons // Do NOT add for DISTINCT FROM variants, as they handle NULL correctly - if (cond.comparison != ExpressionType::COMPARE_NOT_DISTINCT_FROM && - cond.comparison != ExpressionType::COMPARE_DISTINCT_FROM) { + if (cond.GetComparisonType() != ExpressionType::COMPARE_NOT_DISTINCT_FROM && + cond.GetComparisonType() != ExpressionType::COMPARE_DISTINCT_FROM) { auto is_not_null_expr = make_uniq(ExpressionType::OPERATOR_IS_NOT_NULL, LogicalType::BOOLEAN); is_not_null_expr->children.push_back(other_side.Copy()); @@ -297,10 +303,10 @@ bool Deliminator::RemoveInequalityJoinWithDelimGet(LogicalComparisonJoin &delim_ // We only support colref's vector traced_bindings; for (const auto &cond : delim_conditions) { - if (cond.right->GetExpressionType() != ExpressionType::BOUND_COLUMN_REF) { + if (!cond.IsComparison() || cond.GetRHS().GetExpressionType() != ExpressionType::BOUND_COLUMN_REF) { return false; } - auto &colref = cond.right->Cast(); + auto &colref = cond.GetRHS().Cast(); traced_bindings.emplace_back(colref.binding); } @@ -329,17 +335,23 @@ bool Deliminator::RemoveInequalityJoinWithDelimGet(LogicalComparisonJoin &delim_ bool found_all = true; for (idx_t cond_idx = 0; cond_idx < delim_conditions.size(); cond_idx++) { auto &delim_condition = delim_conditions[cond_idx]; + if (!delim_condition.IsComparison()) { + continue; + } const auto &traced_binding = traced_bindings[cond_idx]; bool found = false; for (auto &join_condition : join_conditions) { - auto &delim_side = delim_idx == 0 ? *join_condition.left : *join_condition.right; + auto &delim_side = delim_idx == 0 ? join_condition.GetLHS() : join_condition.GetRHS(); auto &colref = delim_side.Cast(); if (colref.binding == traced_binding) { - auto join_comparison = join_condition.comparison; - auto original_join_comparison = join_condition.comparison; // Save original for later check - if (delim_condition.comparison == ExpressionType::COMPARE_DISTINCT_FROM || - delim_condition.comparison == ExpressionType::COMPARE_NOT_DISTINCT_FROM) { + if (!join_condition.IsComparison()) { + continue; + } + auto join_comparison = join_condition.GetComparisonType(); + auto original_join_comparison = join_condition.GetComparisonType(); // Save original for later check + if (delim_condition.GetComparisonType() == ExpressionType::COMPARE_DISTINCT_FROM || + delim_condition.GetComparisonType() == ExpressionType::COMPARE_NOT_DISTINCT_FROM) { // We need to compare NULL values if (join_comparison == ExpressionType::COMPARE_EQUAL) { join_comparison = ExpressionType::COMPARE_NOT_DISTINCT_FROM; @@ -352,7 +364,11 @@ bool Deliminator::RemoveInequalityJoinWithDelimGet(LogicalComparisonJoin &delim_ break; } } - delim_condition.comparison = FlipComparisonExpression(join_comparison); + auto left_copy = delim_condition.LeftReference()->Copy(); + auto right_copy = delim_condition.RightReference()->Copy(); + + delim_conditions[cond_idx] = JoinCondition(std::move(left_copy), std::move(right_copy), + FlipComparisonExpression(join_comparison)); // join condition was a not equal and filtered out all NULLS. // DELIM JOIN need to do that for not DELIM_GET side. Easiest way is to change the // comparison expression type. See duckdb/duckdb#16803 @@ -360,12 +376,15 @@ bool Deliminator::RemoveInequalityJoinWithDelimGet(LogicalComparisonJoin &delim_ if (delim_join.join_type != JoinType::MARK && original_join_comparison != ExpressionType::COMPARE_DISTINCT_FROM && original_join_comparison != ExpressionType::COMPARE_NOT_DISTINCT_FROM) { - if (delim_condition.comparison == ExpressionType::COMPARE_DISTINCT_FROM) { - delim_condition.comparison = ExpressionType::COMPARE_NOTEQUAL; - } - if (delim_condition.comparison == ExpressionType::COMPARE_NOT_DISTINCT_FROM) { - delim_condition.comparison = ExpressionType::COMPARE_EQUAL; + auto final_comparison = delim_conditions[cond_idx].GetComparisonType(); + if (final_comparison == ExpressionType::COMPARE_DISTINCT_FROM) { + final_comparison = ExpressionType::COMPARE_NOTEQUAL; + } else if (final_comparison == ExpressionType::COMPARE_NOT_DISTINCT_FROM) { + final_comparison = ExpressionType::COMPARE_EQUAL; } + delim_conditions[cond_idx] = + JoinCondition(delim_conditions[cond_idx].LeftReference()->Copy(), + delim_conditions[cond_idx].RightReference()->Copy(), final_comparison); } found = true; break; @@ -386,10 +405,10 @@ void Deliminator::TrySwitchSingleToLeft(LogicalComparisonJoin &delim_join) { if (!IsEqualityJoinCondition(cond)) { return; } - if (cond.right->GetExpressionType() != ExpressionType::BOUND_COLUMN_REF) { + if (!cond.IsComparison() || cond.GetRHS().GetExpressionType() != ExpressionType::BOUND_COLUMN_REF) { return; } - auto &colref = cond.right->Cast(); + auto &colref = cond.GetRHS().Cast(); join_bindings.emplace_back(colref.binding); } diff --git a/src/duckdb/src/optimizer/filter_pullup.cpp b/src/duckdb/src/optimizer/filter_pullup.cpp index f9ebb63c3..62aef15c1 100644 --- a/src/duckdb/src/optimizer/filter_pullup.cpp +++ b/src/duckdb/src/optimizer/filter_pullup.cpp @@ -86,8 +86,7 @@ unique_ptr FilterPullup::PullupInnerJoin(unique_ptrCast(); for (auto &cond : comp_join.conditions) { - expressions.push_back( - make_uniq(cond.comparison, std::move(cond.left), std::move(cond.right))); + expressions.push_back(JoinCondition::CreateExpression(std::move(cond))); } break; } diff --git a/src/duckdb/src/optimizer/filter_pushdown.cpp b/src/duckdb/src/optimizer/filter_pushdown.cpp index 7c13386d9..1c1251f8c 100644 --- a/src/duckdb/src/optimizer/filter_pushdown.cpp +++ b/src/duckdb/src/optimizer/filter_pushdown.cpp @@ -9,6 +9,7 @@ #include "duckdb/planner/operator/logical_projection.hpp" #include "duckdb/planner/operator/logical_empty_result.hpp" #include "duckdb/planner/operator/logical_window.hpp" +#include "duckdb/planner/expression/bound_columnref_expression.hpp" namespace duckdb { diff --git a/src/duckdb/src/optimizer/in_clause_rewriter.cpp b/src/duckdb/src/optimizer/in_clause_rewriter.cpp index 8b32d2a0c..fb45fc660 100644 --- a/src/duckdb/src/optimizer/in_clause_rewriter.cpp +++ b/src/duckdb/src/optimizer/in_clause_rewriter.cpp @@ -107,11 +107,9 @@ unique_ptr InClauseRewriter::VisitReplace(BoundOperatorExpression &e join->AddChild(std::move(root)); join->AddChild(std::move(chunk_scan)); // create the JOIN condition - JoinCondition cond; - cond.left = std::move(expr.children[0]); - - cond.right = make_uniq(in_type, ColumnBinding(chunk_index, 0)); - cond.comparison = ExpressionType::COMPARE_EQUAL; + JoinCondition cond(std::move(expr.children[0]), + make_uniq(in_type, ColumnBinding(chunk_index, 0)), + ExpressionType::COMPARE_EQUAL); join->conditions.push_back(std::move(cond)); root = std::move(join); diff --git a/src/duckdb/src/optimizer/join_elimination.cpp b/src/duckdb/src/optimizer/join_elimination.cpp index 61bb84fc5..a9926fbf9 100644 --- a/src/duckdb/src/optimizer/join_elimination.cpp +++ b/src/duckdb/src/optimizer/join_elimination.cpp @@ -264,14 +264,14 @@ unique_ptr JoinElimination::TryEliminateJoin() { // 2. inner table join condition columns contains a whole distinct group vector col_bindings; for (auto &condition : join.conditions) { - if (condition.comparison != ExpressionType::COMPARE_EQUAL || - condition.left->GetExpressionType() != ExpressionType::BOUND_COLUMN_REF || - condition.right->GetExpressionType() != ExpressionType::BOUND_COLUMN_REF) { + if (!condition.IsComparison() || condition.GetComparisonType() != ExpressionType::COMPARE_EQUAL || + condition.GetLHS().GetExpressionType() != ExpressionType::BOUND_COLUMN_REF || + condition.GetRHS().GetExpressionType() != ExpressionType::BOUND_COLUMN_REF) { is_output_unique = false; break; } - auto inner_binding = inner_idx == 0 ? condition.left->Cast().binding - : condition.right->Cast().binding; + auto inner_binding = inner_idx == 0 ? condition.GetLHS().Cast().binding + : condition.GetRHS().Cast().binding; col_bindings.push_back(inner_binding); } if (is_output_unique && !ContainDistinctGroup(col_bindings)) { diff --git a/src/duckdb/src/optimizer/join_filter_pushdown_optimizer.cpp b/src/duckdb/src/optimizer/join_filter_pushdown_optimizer.cpp index 74227ddda..886205800 100644 --- a/src/duckdb/src/optimizer/join_filter_pushdown_optimizer.cpp +++ b/src/duckdb/src/optimizer/join_filter_pushdown_optimizer.cpp @@ -192,7 +192,10 @@ void JoinFilterPushdownOptimizer::GenerateJoinFilters(LogicalComparisonJoin &joi vector pushdown_columns; for (idx_t cond_idx = 0; cond_idx < join.conditions.size(); cond_idx++) { auto &cond = join.conditions[cond_idx]; - switch (cond.comparison) { + if (!cond.IsComparison()) { + continue; + } + switch (cond.GetComparisonType()) { case ExpressionType::COMPARE_EQUAL: case ExpressionType::COMPARE_LESSTHAN: case ExpressionType::COMPARE_LESSTHANOREQUALTO: @@ -205,20 +208,20 @@ void JoinFilterPushdownOptimizer::GenerateJoinFilters(LogicalComparisonJoin &joi default: continue; } - if (cond.left->GetExpressionType() != ExpressionType::BOUND_COLUMN_REF) { + if (cond.GetLHS().GetExpressionType() != ExpressionType::BOUND_COLUMN_REF) { // only bound column ref supported for now continue; } - if (cond.left->return_type.IsNested()) { + if (cond.GetLHS().return_type.IsNested()) { // nested columns are not supported for pushdown continue; } - if (cond.left->return_type.id() == LogicalTypeId::INTERVAL) { + if (cond.GetLHS().return_type.id() == LogicalTypeId::INTERVAL) { // interval is not supported for pushdown continue; } JoinFilterPushdownColumn pushdown_col; - auto &colref = cond.left->Cast(); + auto &colref = cond.GetLHS().Cast(); pushdown_col.probe_column_index = colref.binding; pushdown_columns.push_back(pushdown_col); @@ -247,10 +250,10 @@ void JoinFilterPushdownOptimizer::GenerateJoinFilters(LogicalComparisonJoin &joi // Even if we cannot find any table sources in which we can push down filters, // we still initialize the aggregate states so that we have the possibility of doing a perfect hash join // TODO: Can ExpressionType::COMPARE_NOT_DISTINCT_FROM be used with perfect hash joins? - const auto compute_aggregates_anyway = join.join_type == JoinType::INNER && join.conditions.size() == 1 && - pushdown_info->join_condition.size() == 1 && - join.conditions[0].comparison == ExpressionType::COMPARE_EQUAL && - TypeIsIntegral(join.conditions[0].right->return_type.InternalType()); + const auto compute_aggregates_anyway = + join.join_type == JoinType::INNER && join.conditions.size() == 1 && pushdown_info->join_condition.size() == 1 && + join.conditions[0].IsComparison() && join.conditions[0].GetComparisonType() == ExpressionType::COMPARE_EQUAL && + TypeIsIntegral(join.conditions[0].GetRHS().return_type.InternalType()); if (pushdown_info->probe_info.empty() && !compute_aggregates_anyway) { // no table sources found in which we can push down filters return; @@ -264,7 +267,7 @@ void JoinFilterPushdownOptimizer::GenerateJoinFilters(LogicalComparisonJoin &joi for (auto &aggr : aggr_functions) { FunctionBinder function_binder(optimizer.GetContext()); vector> aggr_children; - aggr_children.push_back(join.conditions[join_condition].right->Copy()); + aggr_children.push_back(join.conditions[join_condition].GetRHS().Copy()); auto aggr_expr = function_binder.BindAggregateFunction(aggr, std::move(aggr_children), nullptr, AggregateType::NON_DISTINCT); if (aggr_expr->children.size() != 1) { diff --git a/src/duckdb/src/optimizer/join_order/query_graph_manager.cpp b/src/duckdb/src/optimizer/join_order/query_graph_manager.cpp index 28f6a9eb3..236dfabca 100644 --- a/src/duckdb/src/optimizer/join_order/query_graph_manager.cpp +++ b/src/duckdb/src/optimizer/join_order/query_graph_manager.cpp @@ -219,15 +219,14 @@ unique_ptr QueryGraphManager::Reconstruct(unique_ptr condition, bool invert) { auto &comparison = condition->Cast(); - JoinCondition cond; - cond.left = !invert ? std::move(comparison.left) : std::move(comparison.right); - cond.right = !invert ? std::move(comparison.right) : std::move(comparison.left); - cond.comparison = condition->GetExpressionType(); + auto left = !invert ? std::move(comparison.left) : std::move(comparison.right); + auto right = !invert ? std::move(comparison.right) : std::move(comparison.left); + auto comp_type = condition->GetExpressionType(); if (invert) { // reverse comparison expression if we reverse the order of the children - cond.comparison = FlipComparisonExpression(cond.comparison); + comp_type = FlipComparisonExpression(comp_type); } - return cond; + return JoinCondition(std::move(left), std::move(right), comp_type); } GenerateJoinRelation QueryGraphManager::GenerateJoins(vector> &extracted_relations, @@ -319,6 +318,35 @@ GenerateJoinRelation QueryGraphManager::GenerateJoins(vectorestimated_props = node.estimated_props->Copy(); result_operator->estimated_cardinality = node->cardinality; result_operator->has_estimated_cardinality = true; + + // collect unused residual predicates that belong to THIS join + vector> unused_residual_predicates; + for (auto &filter_info : filters_and_bindings) { + if (filter_info->from_residual_predicate && filters_and_bindings[filter_info->filter_index]->filter) { + if (filter_info->set.get().count > 0 && JoinRelationSet::IsSubset(*result_relation, filter_info->set)) { + unused_residual_predicates.push_back( + std::move(filters_and_bindings[filter_info->filter_index]->filter)); + } + } + } + + if (!unused_residual_predicates.empty()) { + unique_ptr combined = std::move(unused_residual_predicates[0]); + for (idx_t i = 1; i < unused_residual_predicates.size(); i++) { + combined = make_uniq(ExpressionType::CONJUNCTION_AND, std::move(combined), + std::move(unused_residual_predicates[i])); + } + + if (result_operator->type == LogicalOperatorType::LOGICAL_COMPARISON_JOIN) { + // attach to join's predicate field + auto &comp_join = result_operator->Cast(); + comp_join.conditions.emplace_back(std::move(combined)); + } else { + // push as filter + result_operator = PushFilter(std::move(result_operator), std::move(combined)); + } + } + // check if we should do a pushdown on this node // basically, any remaining filter that is a subset of the current relation will no longer be used in joins // hence we should push it here @@ -326,6 +354,11 @@ GenerateJoinRelation QueryGraphManager::GenerateJoins(vectorfilter) { + // skip filters from residual predicates + if (info.from_residual_predicate) { + continue; + } + // now check if the filter is a subset of the current relation // note that infos with an empty relation set are a special case and we do not push them down if (info.set.get().count > 0 && JoinRelationSet::IsSubset(*result_relation, info.set)) { @@ -357,17 +390,17 @@ GenerateJoinRelation QueryGraphManager::GenerateJoins(vectorGetExpressionClass() == ExpressionClass::BOUND_COMPARISON); auto &comparison = filter->Cast(); // we need to figure out which side is which by looking at the relations available to us - cond.left = !invert ? std::move(comparison.left) : std::move(comparison.right); - cond.right = !invert ? std::move(comparison.right) : std::move(comparison.left); - cond.comparison = comparison.GetExpressionType(); + auto left = !invert ? std::move(comparison.left) : std::move(comparison.right); + auto right = !invert ? std::move(comparison.right) : std::move(comparison.left); + auto comp_type = comparison.GetExpressionType(); if (invert) { // reverse comparison expression if we reverse the order of the children - cond.comparison = FlipComparisonExpression(comparison.GetExpressionType()); + comp_type = FlipComparisonExpression(comp_type); } + JoinCondition cond(std::move(left), std::move(right), comp_type); // now find the join to push it into auto node = result_operator.get(); if (node->type == LogicalOperatorType::LOGICAL_FILTER) { diff --git a/src/duckdb/src/optimizer/join_order/relation_manager.cpp b/src/duckdb/src/optimizer/join_order/relation_manager.cpp index 18498c9ad..f54957f42 100644 --- a/src/duckdb/src/optimizer/join_order/relation_manager.cpp +++ b/src/duckdb/src/optimizer/join_order/relation_manager.cpp @@ -142,14 +142,27 @@ bool ExpressionContainsColumnRef(const Expression &root_expr) { static bool JoinIsReorderable(LogicalOperator &op) { if (op.type == LogicalOperatorType::LOGICAL_CROSS_PRODUCT) { return true; - } else if (op.type == LogicalOperatorType::LOGICAL_COMPARISON_JOIN) { + } + + if (op.type == LogicalOperatorType::LOGICAL_COMPARISON_JOIN) { auto &join = op.Cast(); + + // TODO: SEMI/ANTI joins with residual predicates are not supported + if (join.join_type == JoinType::SEMI || join.join_type == JoinType::ANTI) { + for (auto &cond : join.conditions) { + if (!cond.IsComparison()) { + return false; + } + } + } + switch (join.join_type) { case JoinType::INNER: case JoinType::SEMI: case JoinType::ANTI: for (auto &cond : join.conditions) { - if (ExpressionContainsColumnRef(*cond.left) && ExpressionContainsColumnRef(*cond.right)) { + if (cond.IsComparison() && ExpressionContainsColumnRef(cond.GetLHS()) && + ExpressionContainsColumnRef(cond.GetRHS())) { return true; } } @@ -548,6 +561,21 @@ bool RelationManager::ExtractBindings(Expression &expression, unordered_set> &result) { + if (expr.GetExpressionClass() == ExpressionClass::BOUND_CONJUNCTION) { + auto &conj = expr.Cast(); + if (conj.GetExpressionType() == ExpressionType::CONJUNCTION_AND) { + for (auto &child : conj.children) { + FlattenConjunction(*child, result); + } + return; + } + } + // not an AND conjunction - add as is + result.push_back(expr.Copy()); +} + vector> RelationManager::ExtractEdges(LogicalOperator &op, vector> &filter_operators, JoinRelationSetManager &set_manager) { @@ -573,9 +601,11 @@ vector> RelationManager::ExtractEdges(LogicalOperator &op // the relations from the conditions in the conjunction expression, we can prevent invalid // reordering. for (auto &cond : join.conditions) { - auto comparison = make_uniq(cond.comparison, std::move(cond.left), - std::move(cond.right)); - conjunction_expression->children.push_back(std::move(comparison)); + if (cond.IsComparison()) { + auto comparison = make_uniq( + cond.GetComparisonType(), cond.GetLHS().Copy(), cond.GetRHS().Copy()); + conjunction_expression->children.push_back(std::move(comparison)); + } } // create the filter info so all required LHS relations are present when reconstructing the @@ -621,19 +651,31 @@ vector> RelationManager::ExtractEdges(LogicalOperator &op } else { // can extract every inner join condition individually. for (auto &cond : join.conditions) { - auto comparison = make_uniq(cond.comparison, std::move(cond.left), - std::move(cond.right)); - if (filter_set.find(*comparison) == filter_set.end()) { - filter_set.insert(*comparison); + unique_ptr expr; + bool is_residual = false; + + if (cond.IsComparison()) { + auto comp_type = cond.GetComparisonType(); + expr = + make_uniq(comp_type, cond.GetLHS().Copy(), cond.GetRHS().Copy()); + } else { + expr = cond.GetJoinExpression().Copy(); + is_residual = true; + } + + if (filter_set.find(*expr) == filter_set.end()) { + filter_set.insert(*expr); unordered_set bindings; - ExtractBindings(*comparison, bindings); + ExtractBindings(*expr, bindings); auto &set = set_manager.GetJoinRelation(bindings); - auto filter_info = make_uniq(std::move(comparison), set, - filters_and_bindings.size(), join.join_type); + auto filter_info = + make_uniq(std::move(expr), set, filters_and_bindings.size(), join.join_type); + filter_info->from_residual_predicate = is_residual; filters_and_bindings.push_back(std::move(filter_info)); } } } + join.conditions.clear(); } else { vector> leftover_expressions; diff --git a/src/duckdb/src/optimizer/late_materialization.cpp b/src/duckdb/src/optimizer/late_materialization.cpp index 6d1a06d9b..aa73a1f69 100644 --- a/src/duckdb/src/optimizer/late_materialization.cpp +++ b/src/duckdb/src/optimizer/late_materialization.cpp @@ -318,10 +318,10 @@ bool LateMaterialization::TryLateMaterialization(unique_ptr &op for (idx_t r_idx = 0; r_idx < row_id_columns.size(); r_idx++) { auto &row_id_col = row_id_columns[r_idx]; - JoinCondition condition; - condition.comparison = ExpressionType::COMPARE_EQUAL; - condition.left = make_uniq(row_id_col.name, row_id_col.type, lhs_bindings[r_idx]); - condition.right = make_uniq(row_id_col.name, row_id_col.type, rhs_bindings[r_idx]); + JoinCondition condition( + make_uniq(row_id_col.name, row_id_col.type, lhs_bindings[r_idx]), + make_uniq(row_id_col.name, row_id_col.type, rhs_bindings[r_idx]), + ExpressionType::COMPARE_EQUAL); join->conditions.push_back(std::move(condition)); } diff --git a/src/duckdb/src/optimizer/optimizer.cpp b/src/duckdb/src/optimizer/optimizer.cpp index 97585c1f0..c2c4540c1 100644 --- a/src/duckdb/src/optimizer/optimizer.cpp +++ b/src/duckdb/src/optimizer/optimizer.cpp @@ -39,6 +39,7 @@ #include "duckdb/optimizer/late_materialization.hpp" #include "duckdb/optimizer/common_subplan_optimizer.hpp" #include "duckdb/optimizer/window_self_join.hpp" +#include "duckdb/optimizer/optimizer_extension.hpp" #include "duckdb/planner/binder.hpp" #include "duckdb/planner/planner.hpp" @@ -325,7 +326,7 @@ unique_ptr Optimizer::Optimize(unique_ptr plan this->plan = std::move(plan_p); - for (auto &pre_optimizer_extension : DBConfig::GetConfig(context).optimizer_extensions) { + for (auto &pre_optimizer_extension : OptimizerExtension::Iterate(context)) { RunOptimizer(OptimizerType::EXTENSION, [&]() { OptimizerExtensionInput input {GetContext(), *this, pre_optimizer_extension.optimizer_info.get()}; if (pre_optimizer_extension.pre_optimize_function) { @@ -336,7 +337,7 @@ unique_ptr Optimizer::Optimize(unique_ptr plan RunBuiltInOptimizers(); - for (auto &optimizer_extension : DBConfig::GetConfig(context).optimizer_extensions) { + for (auto &optimizer_extension : OptimizerExtension::Iterate(context)) { RunOptimizer(OptimizerType::EXTENSION, [&]() { OptimizerExtensionInput input {GetContext(), *this, optimizer_extension.optimizer_info.get()}; if (optimizer_extension.optimize_function) { diff --git a/src/duckdb/src/optimizer/pushdown/pushdown_cross_product.cpp b/src/duckdb/src/optimizer/pushdown/pushdown_cross_product.cpp index f9dcbf84e..fad3dda23 100644 --- a/src/duckdb/src/optimizer/pushdown/pushdown_cross_product.cpp +++ b/src/duckdb/src/optimizer/pushdown/pushdown_cross_product.cpp @@ -46,15 +46,13 @@ unique_ptr FilterPushdown::PushdownCrossProduct(unique_ptr conditions; - vector> arbitrary_expressions; const auto join_type = JoinType::INNER; LogicalComparisonJoin::ExtractJoinConditions(GetContext(), join_type, join_ref_type, op->children[0], op->children[1], left_bindings, right_bindings, join_expressions, - conditions, arbitrary_expressions); + conditions); // create the join from the join conditions auto new_op = LogicalComparisonJoin::CreateJoin(join_type, join_ref_type, std::move(op->children[0]), - std::move(op->children[1]), std::move(conditions), - std::move(arbitrary_expressions)); + std::move(op->children[1]), std::move(conditions)); // possible cases are: AnyJoin, ComparisonJoin, or Filter + ComparisonJoin if (op->has_estimated_cardinality) { diff --git a/src/duckdb/src/optimizer/pushdown/pushdown_left_join.cpp b/src/duckdb/src/optimizer/pushdown/pushdown_left_join.cpp index 1ebf3cedd..f234f6289 100644 --- a/src/duckdb/src/optimizer/pushdown/pushdown_left_join.cpp +++ b/src/duckdb/src/optimizer/pushdown/pushdown_left_join.cpp @@ -43,6 +43,37 @@ static unique_ptr ReplaceColRefWithNull(unique_ptr root_ return root_expr; } +static unique_ptr CreateDummyRHS(Optimizer &optimizer, unique_ptr &rhs_op) { + unordered_map>> projections_groups; + auto column_bindings = rhs_op->GetColumnBindings(); + rhs_op->ResolveOperatorTypes(); + auto &types = rhs_op->types; + + for (idx_t i = 0; i < column_bindings.size(); i++) { + projections_groups[column_bindings[i].table_index].emplace_back( + make_uniq(Value(types[i]))); + } + + auto create_proj_dummy_scan = [&](idx_t table_index) { + auto dummy_scan = make_uniq(optimizer.binder.GenerateTableIndex()); + auto proj = make_uniq(table_index, std::move(projections_groups[table_index])); + proj->AddChild(std::move(dummy_scan)); + return proj; + }; + + auto begin = projections_groups.begin(); + D_ASSERT(begin != projections_groups.end()); + unique_ptr rhs = create_proj_dummy_scan(begin->first); + projections_groups.erase(begin); + + for (auto &group : projections_groups) { + auto proj = create_proj_dummy_scan(group.first); + rhs = LogicalCrossProduct::Create(std::move(rhs), std::move(proj)); + } + + return rhs; +} + static bool FilterRemovesNull(ClientContext &context, ExpressionRewriter &rewriter, Expression *expr, unordered_set &right_bindings) { // make a copy of the expression @@ -91,8 +122,12 @@ unique_ptr FilterPushdown::PushdownLeftJoin(unique_ptrCast(); for (auto &cond : comparison_join.conditions) { - filter_combiner.AddFilter( - make_uniq(cond.comparison, cond.left->Copy(), cond.right->Copy())); + if (cond.IsComparison()) { + filter_combiner.AddFilter(make_uniq( + cond.GetComparisonType(), cond.GetLHS().Copy(), cond.GetRHS().Copy())); + } else { + filter_combiner.AddFilter(cond.GetJoinExpression().Copy()); + } } } // now check the set of filters @@ -153,41 +188,30 @@ unique_ptr FilterPushdown::PushdownLeftJoin(unique_ptrchildren[0] = left_pushdown.Rewrite(std::move(op->children[0])); bool rewrite_right = true; - if (op->type == LogicalOperatorType::LOGICAL_ANY_JOIN) { - auto &any_join = join.Cast(); - if (AddFilter(any_join.condition->Copy()) == FilterResult::UNSATISFIABLE) { - // filter statically evaluates to false, turns it to the cross product join with 1 row NULLs - if (any_join.join_type == JoinType::LEFT) { - unordered_map>> projections_groups; - auto column_bindings = op->children[1]->GetColumnBindings(); - op->children[1]->ResolveOperatorTypes(); - auto &types = op->children[1]->types; - for (idx_t i = 0; i < column_bindings.size(); i++) { - projections_groups[column_bindings[i].table_index].emplace_back( - make_uniq(Value(types[i]))); - } + bool has_unsatisfiable_condition = false; - auto create_proj_dummy_scan = [&](idx_t table_index) { - auto dummy_scan = make_uniq(optimizer.binder.GenerateTableIndex()); - auto proj = make_uniq(table_index, std::move(projections_groups[table_index])); - proj->AddChild(std::move(dummy_scan)); - return proj; - }; - // make cross products on the RHS first - auto begin = projections_groups.begin(); - D_ASSERT(begin != projections_groups.end()); - unique_ptr left = create_proj_dummy_scan(begin->first); - projections_groups.erase(begin); - for (auto &group : projections_groups) { - auto proj = create_proj_dummy_scan(group.first); - auto op = LogicalCrossProduct::Create(std::move(left), std::move(proj)); - left = std::move(op); + if (op->type == LogicalOperatorType::LOGICAL_COMPARISON_JOIN) { + auto &comparison_join = join.Cast(); + for (auto &cond : comparison_join.conditions) { + if (!cond.IsComparison()) { + if (AddFilter(cond.GetJoinExpression().Copy()) == FilterResult::UNSATISFIABLE) { + has_unsatisfiable_condition = true; + break; } - // then make cross product with the LHS - op = LogicalCrossProduct::Create(std::move(op->children[0]), std::move(left)); - rewrite_right = false; } } + } else if (op->type == LogicalOperatorType::LOGICAL_ANY_JOIN) { + auto &any_join = join.Cast(); + if (AddFilter(any_join.condition->Copy()) == FilterResult::UNSATISFIABLE) { + has_unsatisfiable_condition = true; + } + } + + // if unsatisfiable and LEFT JOIN - replace RHS with dummy scan + if (has_unsatisfiable_condition && join.join_type == JoinType::LEFT) { + auto dummy_rhs = CreateDummyRHS(optimizer, op->children[1]); + op = LogicalCrossProduct::Create(std::move(op->children[0]), std::move(dummy_rhs)); + rewrite_right = false; } if (rewrite_right) { diff --git a/src/duckdb/src/optimizer/pushdown/pushdown_mark_join.cpp b/src/duckdb/src/optimizer/pushdown/pushdown_mark_join.cpp index 8958bb88a..87790efe2 100644 --- a/src/duckdb/src/optimizer/pushdown/pushdown_mark_join.cpp +++ b/src/duckdb/src/optimizer/pushdown/pushdown_mark_join.cpp @@ -57,8 +57,11 @@ unique_ptr FilterPushdown::PushdownMarkJoin(unique_ptr ReplaceIn(unique_ptr expr, const expre } }); - return std::move(expr); + return expr; } //! True if replacing all the `args` expressions occurring in `expr` with a @@ -95,8 +94,7 @@ static bool ExprIsFunctionOnlyOf(const Expression &expr, const expression_set_t //! the left and right table respectively, then pushdown `P(l)` to the left //! table, `P(r)` to the right table, and remove the original filter. static bool -PushDownFiltersOnCoalescedEqualJoinKeys(vector> &filters, - const vector &join_conditions, +PushDownFiltersOnCoalescedEqualJoinKeys(vector> &filters, vector &join_conditions, const std::function filter)> &pushdown_left, const std::function filter)> &pushdown_right) { // Generate set of all possible coalesced join keys expressions to later @@ -105,11 +103,13 @@ PushDownFiltersOnCoalescedEqualJoinKeys(vector> &filters, join_cond_by_coalesced_join_keys; for (auto &cond : join_conditions) { - if (cond.comparison == ExpressionType::COMPARE_EQUAL) { - auto left = std::ref(*cond.left); - auto right = std::ref(*cond.right); - auto coalesce_left_right = FlattenedCoalesce::Of({left, right}); - auto coalesce_right_left = FlattenedCoalesce::Of({right, left}); + if (cond.IsComparison() && cond.GetComparisonType() == ExpressionType::COMPARE_EQUAL) { + auto &left = cond.GetLHS(); + auto &right = cond.GetRHS(); + auto coalesce_left_right = FlattenedCoalesce::Of({std::ref(left), std::ref(right)}); + auto coalesce_right_left = FlattenedCoalesce::Of({std::ref(right), std::ref(left)}); + join_cond_by_coalesced_join_keys.emplace(coalesce_left_right, std::ref(cond)); + join_cond_by_coalesced_join_keys.emplace(coalesce_right_left, std::ref(cond)); join_cond_by_coalesced_join_keys.emplace(coalesce_left_right, std::ref(cond)); join_cond_by_coalesced_join_keys.emplace(coalesce_right_left, std::ref(cond)); } @@ -159,8 +159,8 @@ PushDownFiltersOnCoalescedEqualJoinKeys(vector> &filters, continue; } - auto left_filter = ReplaceIn(filter->Copy(), coalesce_exprs_to_replace, *join_cond_ptr->left); - auto right_filter = ReplaceIn(filter->Copy(), coalesce_exprs_to_replace, *join_cond_ptr->right); + auto left_filter = ReplaceIn(filter->Copy(), coalesce_exprs_to_replace, join_cond_ptr->GetLHS()); + auto right_filter = ReplaceIn(filter->Copy(), coalesce_exprs_to_replace, join_cond_ptr->GetRHS()); pushdown_left(std::move(left_filter)); pushdown_right(std::move(right_filter)); filters.erase_at(i); diff --git a/src/duckdb/src/optimizer/remove_unused_columns.cpp b/src/duckdb/src/optimizer/remove_unused_columns.cpp index da67bb4da..6d48cc1fb 100644 --- a/src/duckdb/src/optimizer/remove_unused_columns.cpp +++ b/src/duckdb/src/optimizer/remove_unused_columns.cpp @@ -135,25 +135,25 @@ void RemoveUnusedColumns::VisitOperator(LogicalOperator &op) { // this reduces the amount of columns we need to extract from the join hash table // (except in the case of floating point numbers which have +0 and -0, equal but different). for (auto &cond : comp_join.conditions) { - if (cond.comparison != ExpressionType::COMPARE_EQUAL) { + if (!cond.IsComparison() || cond.GetComparisonType() != ExpressionType::COMPARE_EQUAL) { continue; } - if (cond.left->GetExpressionClass() != ExpressionClass::BOUND_COLUMN_REF) { + if (cond.GetLHS().GetExpressionClass() != ExpressionClass::BOUND_COLUMN_REF) { continue; } - if (cond.right->GetExpressionClass() != ExpressionClass::BOUND_COLUMN_REF) { + if (cond.GetRHS().GetExpressionClass() != ExpressionClass::BOUND_COLUMN_REF) { continue; } - if (cond.left->Cast().return_type.IsFloating()) { + if (cond.GetLHS().Cast().return_type.IsFloating()) { continue; } - if (cond.right->Cast().return_type.IsFloating()) { + if (cond.GetRHS().Cast().return_type.IsFloating()) { continue; } // comparison join between two bound column refs // we can replace any reference to the RHS (build-side) with a reference to the LHS (probe-side) - auto &lhs_col = cond.left->Cast(); - auto &rhs_col = cond.right->Cast(); + auto &lhs_col = cond.GetLHS().Cast(); + auto &rhs_col = cond.GetRHS().Cast(); // if there are any columns that refer to the RHS, auto colrefs = column_references.find(rhs_col.binding); if (colrefs == column_references.end()) { @@ -313,10 +313,17 @@ void RemoveUnusedColumns::VisitOperator(LogicalOperator &op) { for (auto &cond : comp_join.conditions) { bool found = false; for (auto &unique_cond : unique_conditions) { - if (cond.comparison == unique_cond.comparison && cond.left->Equals(*unique_cond.left) && - cond.right->Equals(*unique_cond.right)) { - found = true; - break; + if (cond.IsComparison() && unique_cond.IsComparison()) { + if (cond.GetComparisonType() == unique_cond.GetComparisonType() && + cond.GetLHS().Equals(unique_cond.GetLHS()) && cond.GetRHS().Equals(unique_cond.GetRHS())) { + found = true; + break; + } + } else if (!cond.IsComparison() && !unique_cond.IsComparison()) { + if (cond.GetJoinExpression().Equals(unique_cond.GetJoinExpression())) { + found = true; + break; + } } } if (!found) { @@ -443,7 +450,7 @@ static unique_ptr ConstructStructExtractFromPath(ClientContext &cont } path_iter = path_iter.get().GetChildIndex(0); } - return std::move(target); + return target; } void RemoveUnusedColumns::RewriteExpressions(LogicalProjection &proj, idx_t expression_count) { diff --git a/src/duckdb/src/optimizer/row_group_pruner.cpp b/src/duckdb/src/optimizer/row_group_pruner.cpp index 5d293bb52..558bac04f 100644 --- a/src/duckdb/src/optimizer/row_group_pruner.cpp +++ b/src/duckdb/src/optimizer/row_group_pruner.cpp @@ -8,6 +8,7 @@ #include "duckdb/planner/operator/logical_order.hpp" #include "duckdb/storage/table/row_group_reorderer.hpp" #include "duckdb/catalog/catalog_entry/table_catalog_entry.hpp" +#include "duckdb/planner/expression/bound_columnref_expression.hpp" namespace duckdb { diff --git a/src/duckdb/src/optimizer/rule/timestamp_comparison.cpp b/src/duckdb/src/optimizer/rule/timestamp_comparison.cpp index 8b5a71dc8..2a0f67ebf 100644 --- a/src/duckdb/src/optimizer/rule/timestamp_comparison.cpp +++ b/src/duckdb/src/optimizer/rule/timestamp_comparison.cpp @@ -5,6 +5,7 @@ #include "duckdb/common/constants.hpp" #include "duckdb/execution/expression_executor.hpp" #include "duckdb/planner/expression/bound_cast_expression.hpp" +#include "duckdb/planner/expression/bound_columnref_expression.hpp" #include "duckdb/planner/expression/bound_conjunction_expression.hpp" #include "duckdb/planner/expression/bound_comparison_expression.hpp" #include "duckdb/planner/expression/bound_constant_expression.hpp" diff --git a/src/duckdb/src/optimizer/statistics/expression/propagate_cast.cpp b/src/duckdb/src/optimizer/statistics/expression/propagate_cast.cpp index 9709a1290..9ee30747b 100644 --- a/src/duckdb/src/optimizer/statistics/expression/propagate_cast.cpp +++ b/src/duckdb/src/optimizer/statistics/expression/propagate_cast.cpp @@ -5,6 +5,10 @@ namespace duckdb { static unique_ptr StatisticsOperationsNumericNumericCast(const BaseStatistics &input, const LogicalType &target) { + // Bail out if the stats are not numeric + if (input.GetStatsType() != StatisticsType::NUMERIC_STATS) { + return nullptr; + } if (!NumericStats::HasMinMax(input)) { return nullptr; } diff --git a/src/duckdb/src/optimizer/statistics/operator/propagate_join.cpp b/src/duckdb/src/optimizer/statistics/operator/propagate_join.cpp index 1787a7f26..712a0974d 100644 --- a/src/duckdb/src/optimizer/statistics/operator/propagate_join.cpp +++ b/src/duckdb/src/optimizer/statistics/operator/propagate_join.cpp @@ -17,17 +17,22 @@ namespace duckdb { void StatisticsPropagator::PropagateStatistics(LogicalComparisonJoin &join, unique_ptr &node_ptr) { for (idx_t i = 0; i < join.conditions.size(); i++) { auto &condition = join.conditions[i]; - const auto stats_left = PropagateExpression(condition.left); - const auto stats_right = PropagateExpression(condition.right); + if (!condition.IsComparison()) { + PropagateExpression(condition.JoinExpressionReference()); + continue; + } + + const auto stats_left = PropagateExpression(condition.LeftReference()); + const auto stats_right = PropagateExpression(condition.RightReference()); if (stats_left && stats_right) { - if ((condition.comparison == ExpressionType::COMPARE_DISTINCT_FROM || - condition.comparison == ExpressionType::COMPARE_NOT_DISTINCT_FROM) && + if ((condition.GetComparisonType() == ExpressionType::COMPARE_DISTINCT_FROM || + condition.GetComparisonType() == ExpressionType::COMPARE_NOT_DISTINCT_FROM) && stats_left->CanHaveNull() && stats_right->CanHaveNull()) { // null values are equal in this join, and both sides can have null values // nothing to do here continue; } - auto prune_result = PropagateComparison(*stats_left, *stats_right, condition.comparison); + auto prune_result = PropagateComparison(*stats_left, *stats_right, condition.GetComparisonType()); // Add stats to logical_join for perfect hash join join.join_stats.push_back(stats_left->ToUnique()); join.join_stats.push_back(stats_right->ToUnique()); @@ -73,7 +78,7 @@ void StatisticsPropagator::PropagateStatistics(LogicalComparisonJoin &join, uniq // the semantics of restricting to a single match // so we can't replace it with an equi-join on the remaining conditions. if (join.type == LogicalOperatorType::LOGICAL_ASOF_JOIN) { - switch (condition.comparison) { + switch (condition.GetComparisonType()) { case ExpressionType::COMPARE_GREATERTHAN: case ExpressionType::COMPARE_GREATERTHANOREQUALTO: case ExpressionType::COMPARE_LESSTHAN: @@ -143,24 +148,26 @@ void StatisticsPropagator::PropagateStatistics(LogicalComparisonJoin &join, uniq // anti joins have inverse statistics propagation // (i.e. if we have an anti join on i: [0, 100] and j: [0, 25], the resulting stats are i:[25,100]) // for now we don't handle anti joins - if (condition.comparison == ExpressionType::COMPARE_DISTINCT_FROM || - condition.comparison == ExpressionType::COMPARE_NOT_DISTINCT_FROM) { + if (condition.GetComparisonType() == ExpressionType::COMPARE_DISTINCT_FROM || + condition.GetComparisonType() == ExpressionType::COMPARE_NOT_DISTINCT_FROM) { // skip update when null values are equal (for now?) continue; } switch (join.join_type) { case JoinType::INNER: case JoinType::SEMI: { - UpdateFilterStatistics(*condition.left, *condition.right, condition.comparison); - auto updated_stats_left = PropagateExpression(condition.left); - auto updated_stats_right = PropagateExpression(condition.right); + UpdateFilterStatistics(condition.GetLHS(), condition.GetRHS(), condition.GetComparisonType()); + auto updated_stats_left = PropagateExpression(condition.LeftReference()); + auto updated_stats_right = PropagateExpression(condition.RightReference()); // Try to push lhs stats down rhs and vice versa if (stats_left && stats_right && updated_stats_left && updated_stats_right && - condition.left->GetExpressionType() == ExpressionType::BOUND_COLUMN_REF && - condition.right->GetExpressionType() == ExpressionType::BOUND_COLUMN_REF) { - CreateFilterFromJoinStats(join.children[0], condition.left, *stats_left, *updated_stats_left); - CreateFilterFromJoinStats(join.children[1], condition.right, *stats_right, *updated_stats_right); + condition.GetLHS().GetExpressionType() == ExpressionType::BOUND_COLUMN_REF && + condition.GetRHS().GetExpressionType() == ExpressionType::BOUND_COLUMN_REF) { + CreateFilterFromJoinStats(join.children[0], condition.LeftReference(), *stats_left, + *updated_stats_left); + CreateFilterFromJoinStats(join.children[1], condition.RightReference(), *stats_right, + *updated_stats_right); } // Update join_stats when is already part of the join diff --git a/src/duckdb/src/optimizer/topn_window_elimination.cpp b/src/duckdb/src/optimizer/topn_window_elimination.cpp index e0d9f3e19..43d825264 100644 --- a/src/duckdb/src/optimizer/topn_window_elimination.cpp +++ b/src/duckdb/src/optimizer/topn_window_elimination.cpp @@ -360,7 +360,7 @@ TopNWindowElimination::TryCreateUnnestOperator(unique_ptr op, if (params.limit <= 1) { // LIMIT 1 -> we do not need to unnest - return std::move(op); + return op; } // Create unnest expression for aggregate args @@ -420,10 +420,16 @@ TopNWindowElimination::CreateProjectionOperator(unique_ptr op, const auto op_column_bindings = op->GetColumnBindings(); vector> proj_exprs; - // Only project necessary group columns + // Only project necessary group columns, but in the same order as they appear in the aggregate operator. + // For that, we need the group_idxs ordered by value. + std::set ordered_group_projection_idxs; for (const auto &group_idx : group_idxs) { - proj_exprs.push_back( - make_uniq(op->types[group_idx.second], op_column_bindings[group_idx.second])); + ordered_group_projection_idxs.insert(group_idx.second); + } + + for (const idx_t group_projection_idx : ordered_group_projection_idxs) { + proj_exprs.push_back(make_uniq(op->types[group_projection_idx], + op_column_bindings[group_projection_idx])); } auto aggregate_column_ref = @@ -794,13 +800,13 @@ bool TopNWindowElimination::CanUseLateMaterialization(const LogicalWindow &windo // However, we allow replacing references to join columns as they are equal to the other side by condition. column_binding_map_t replaceable_bindings; for (auto &condition : join.conditions) { - if (condition.comparison != ExpressionType::COMPARE_EQUAL) { + if (!condition.IsComparison() || condition.GetComparisonType() != ExpressionType::COMPARE_EQUAL) { return false; } - VisitExpression(&condition.left); + VisitExpression(&condition.LeftReference()); auto left_binding = column_references.begin()->first; column_references.clear(); - VisitExpression(&condition.right); + VisitExpression(&condition.RightReference()); auto right_binding = column_references.begin()->first; column_references.clear(); @@ -1019,12 +1025,11 @@ unique_ptr TopNWindowElimination::ConstructJoin(unique_ptr(alias, lhs->types[lhs_rowid_idx], + auto left_expr = make_uniq(alias, lhs->types[lhs_rowid_idx], ColumnBinding {lhs->GetTableIndex()[0], lhs_rowid_idx}); - condition.right = make_uniq(alias, rhs->types[aggregate_offset + i], + auto right_expr = make_uniq(alias, rhs->types[aggregate_offset + i], ColumnBinding {GetAggregateIdx(rhs), rhs_rowid_idx}); + JoinCondition condition(std::move(left_expr), std::move(right_expr), ExpressionType::COMPARE_EQUAL); join->conditions.push_back(std::move(condition)); } diff --git a/src/duckdb/src/optimizer/window_self_join.cpp b/src/duckdb/src/optimizer/window_self_join.cpp index f1f9f42d2..b6e8d3ce0 100644 --- a/src/duckdb/src/optimizer/window_self_join.cpp +++ b/src/duckdb/src/optimizer/window_self_join.cpp @@ -26,6 +26,7 @@ class WindowSelfJoinTableRebinder : public LogicalOperatorVisitor { case LogicalOperatorType::LOGICAL_PROJECTION: case LogicalOperatorType::LOGICAL_AGGREGATE_AND_GROUP_BY: case LogicalOperatorType::LOGICAL_DUMMY_SCAN: + case LogicalOperatorType::LOGICAL_FILTER: if (!op.children.empty()) { return CanRebind(*op.children[0]); } @@ -230,13 +231,12 @@ unique_ptr WindowSelfJoinOptimizer::OptimizeInternal(unique_ptr // Inner Join on the partition keys auto join = make_uniq(JoinType::INNER); - for (size_t i = 0; i < partitions.size(); ++i) { - JoinCondition cond; - cond.comparison = ExpressionType::COMPARE_NOT_DISTINCT_FROM; - cond.left = partitions[i]->Copy(); - cond.right = make_uniq(partitions[i]->return_type, ColumnBinding(group_index, i)); - join->conditions.push_back(std::move(cond)); + auto left_expr = partitions[i]->Copy(); + auto right_expr = + make_uniq(partitions[i]->return_type, ColumnBinding(group_index, i)); + join->conditions.push_back( + JoinCondition(std::move(left_expr), std::move(right_expr), ExpressionType::COMPARE_NOT_DISTINCT_FROM)); } join->children.push_back(std::move(original_child)); diff --git a/src/duckdb/src/parallel/pipeline.cpp b/src/duckdb/src/parallel/pipeline.cpp index e213d78be..d48cc1241 100644 --- a/src/duckdb/src/parallel/pipeline.cpp +++ b/src/duckdb/src/parallel/pipeline.cpp @@ -255,6 +255,10 @@ void Pipeline::AddDependency(shared_ptr &pipeline) { pipeline->parents.push_back(weak_ptr(shared_from_this())); } +vector> Pipeline::GetDependencies() const { + return dependencies; +} + string Pipeline::ToString() const { TextTreeRenderer renderer; return renderer.ToString(*this); diff --git a/src/duckdb/src/parallel/pipeline_executor.cpp b/src/duckdb/src/parallel/pipeline_executor.cpp index 274dc8b99..a8553028e 100644 --- a/src/duckdb/src/parallel/pipeline_executor.cpp +++ b/src/duckdb/src/parallel/pipeline_executor.cpp @@ -192,9 +192,7 @@ PipelineExecuteResult PipelineExecutor::Execute(idx_t max_chunks) { auto &source_chunk = pipeline.operators.empty() ? final_chunk : *intermediate_chunks[0]; ExecutionBudget chunk_budget(max_chunks); do { - if (context.client.interrupted) { - throw InterruptException(); - } + context.client.InterruptCheck(); OperatorResultType result; if (exhausted_pipeline && done_flushing && !remaining_sink_chunk && !next_batch_blocked && @@ -262,8 +260,8 @@ PipelineExecuteResult PipelineExecutor::Execute(idx_t max_chunks) { } if (result == OperatorResultType::FINISHED) { + D_ASSERT(in_process_operators.empty()); exhausted_pipeline = true; - break; } } while (chunk_budget.Next()); @@ -421,9 +419,7 @@ OperatorResultType PipelineExecutor::Execute(DataChunk &input, DataChunk &result return OperatorResultType::NEED_MORE_INPUT; } while (true) { - if (context.client.interrupted) { - throw InterruptException(); - } + context.client.InterruptCheck(); // now figure out where to put the chunk // if current_idx is the last possible index (>= operators.size()) we write to the result // otherwise we write to an intermediate chunk @@ -548,9 +544,7 @@ void PipelineExecutor::InitializeChunk(DataChunk &chunk) { } void PipelineExecutor::StartOperator(PhysicalOperator &op) { - if (context.client.interrupted) { - throw InterruptException(); - } + context.client.InterruptCheck(); context.thread.profiler.StartOperator(&op); } diff --git a/src/duckdb/src/parser/expression/lambda_expression.cpp b/src/duckdb/src/parser/expression/lambda_expression.cpp index 2b14abd61..7e0a812a2 100644 --- a/src/duckdb/src/parser/expression/lambda_expression.cpp +++ b/src/duckdb/src/parser/expression/lambda_expression.cpp @@ -1,10 +1,10 @@ #include "duckdb/parser/expression/lambda_expression.hpp" +#include "duckdb/common/serializer/serializer.hpp" #include "duckdb/common/types/hash.hpp" +#include "duckdb/parser/expression/columnref_expression.hpp" #include "duckdb/parser/expression/function_expression.hpp" -#include "duckdb/common/serializer/serializer.hpp" - namespace duckdb { LambdaExpression::LambdaExpression() : ParsedExpression(ExpressionType::LAMBDA, ExpressionClass::LAMBDA) { diff --git a/src/duckdb/src/parser/expression/type_expression.cpp b/src/duckdb/src/parser/expression/type_expression.cpp new file mode 100644 index 000000000..22289eff7 --- /dev/null +++ b/src/duckdb/src/parser/expression/type_expression.cpp @@ -0,0 +1,132 @@ +#include "duckdb/parser/expression/type_expression.hpp" +#include "duckdb/common/exception.hpp" +#include "duckdb/common/types/value.hpp" +#include "duckdb/common/string_util.hpp" +#include "duckdb/parser/expression/constant_expression.hpp" +#include "duckdb/common/types/hash.hpp" +namespace duckdb { + +TypeExpression::TypeExpression(string catalog, string schema, string type_name, + vector> children_p) + : ParsedExpression(ExpressionType::TYPE, ExpressionClass::TYPE), catalog(std::move(catalog)), + schema(std::move(schema)), type_name(std::move(type_name)), children(std::move(children_p)) { + D_ASSERT(!this->type_name.empty()); +} + +TypeExpression::TypeExpression(string type_name, vector> children) + : TypeExpression(INVALID_CATALOG, INVALID_SCHEMA, std::move(type_name), std::move(children)) { +} + +TypeExpression::TypeExpression() : ParsedExpression(ExpressionType::TYPE, ExpressionClass::TYPE) { +} + +string TypeExpression::ToString() const { + string result; + if (!catalog.empty()) { + result += KeywordHelper::WriteOptionallyQuoted(catalog) + "."; + } + if (!schema.empty()) { + result += KeywordHelper::WriteOptionallyQuoted(schema) + "."; + } + + auto ¶ms = children; + + // LIST and ARRAY have special syntax + if (result.empty() && StringUtil::CIEquals(type_name, "LIST") && params.size() == 1) { + return params[0]->ToString() + "[]"; + } + if (result.empty() && StringUtil::CIEquals(type_name, "ARRAY") && params.size() == 2) { + auto &type_param = params[0]; + auto &size_param = params[1]; + return type_param->ToString() + "[" + size_param->ToString() + "]"; + } + // So does STRUCT, MAP and UNION + if (result.empty() && StringUtil::CIEquals(type_name, "STRUCT")) { + if (params.empty()) { + return "STRUCT"; + } + string struct_result = "STRUCT("; + for (idx_t i = 0; i < params.size(); i++) { + struct_result += KeywordHelper::WriteOptionallyQuoted(params[i]->GetAlias()) + " " + params[i]->ToString(); + if (i < params.size() - 1) { + struct_result += ", "; + } + } + struct_result += ")"; + return struct_result; + } + if (result.empty() && StringUtil::CIEquals(type_name, "UNION")) { + if (params.empty()) { + return "UNION"; + } + string union_result = "UNION("; + for (idx_t i = 0; i < params.size(); i++) { + union_result += KeywordHelper::WriteOptionallyQuoted(params[i]->GetAlias()) + " " + params[i]->ToString(); + if (i < params.size() - 1) { + union_result += ", "; + } + } + union_result += ")"; + return union_result; + } + + if (result.empty() && StringUtil::CIEquals(type_name, "MAP") && params.size() == 2) { + return "MAP(" + params[0]->ToString() + ", " + params[1]->ToString() + ")"; + } + + if (result.empty() && StringUtil::CIEquals(type_name, "VARCHAR") && !params.empty()) { + if (params.back()->HasAlias() && StringUtil::CIEquals(params.back()->GetAlias(), "collation")) { + // Special case for VARCHAR with collation + auto collate_expr = params.back()->Cast(); + return StringUtil::Format("VARCHAR COLLATE %s", SQLIdentifier(StringValue::Get(collate_expr.value))); + } + } + + result += KeywordHelper::WriteOptionallyQuoted(type_name, '"', true, KeywordCategory::KEYWORD_COL_NAME); + + if (!params.empty()) { + result += "("; + for (idx_t i = 0; i < params.size(); i++) { + result += params[i]->ToString(); + if (i < params.size() - 1) { + result += ", "; + } + } + result += ")"; + } + return result; +} + +unique_ptr TypeExpression::Copy() const { + vector> copy_children; + copy_children.reserve(children.size()); + for (const auto &child : children) { + copy_children.push_back(child->Copy()); + } + + auto copy = make_uniq(catalog, schema, type_name, std::move(copy_children)); + copy->CopyProperties(*this); + + return std::move(copy); +} + +bool TypeExpression::Equal(const TypeExpression &a, const TypeExpression &b) { + if (a.catalog != b.catalog || a.schema != b.schema || a.type_name != b.type_name) { + return false; + } + return ParsedExpression::ListEquals(a.children, b.children); +} + +void TypeExpression::Verify() const { + D_ASSERT(!type_name.empty()); +} + +hash_t TypeExpression::Hash() const { + hash_t result = ParsedExpression::Hash(); + result = CombineHash(result, duckdb::Hash(catalog.c_str())); + result = CombineHash(result, duckdb::Hash(schema.c_str())); + result = CombineHash(result, duckdb::Hash(type_name.c_str())); + return result; +} + +} // namespace duckdb diff --git a/src/duckdb/src/parser/keyword_helper.cpp b/src/duckdb/src/parser/keyword_helper.cpp index 80cea773b..fd488170f 100644 --- a/src/duckdb/src/parser/keyword_helper.cpp +++ b/src/duckdb/src/parser/keyword_helper.cpp @@ -4,15 +4,15 @@ namespace duckdb { -bool KeywordHelper::IsKeyword(const string &text) { - return Parser::IsKeyword(text) != KeywordCategory::KEYWORD_NONE; +bool KeywordHelper::IsKeyword(const string &text, KeywordCategory category) { + return Parser::IsKeyword(text) != category; } KeywordCategory KeywordHelper::KeywordCategoryType(const string &text) { return Parser::IsKeyword(text); } -bool KeywordHelper::RequiresQuotes(const string &text, bool allow_caps) { +bool KeywordHelper::RequiresQuotes(const string &text, bool allow_caps, KeywordCategory category) { for (size_t i = 0; i < text.size(); i++) { if (i > 0 && (text[i] >= '0' && text[i] <= '9')) { continue; @@ -30,7 +30,7 @@ bool KeywordHelper::RequiresQuotes(const string &text, bool allow_caps) { } return true; } - return IsKeyword(text); + return IsKeyword(text, category); } string KeywordHelper::EscapeQuotes(const string &text, char quote) { @@ -43,8 +43,8 @@ string KeywordHelper::WriteQuoted(const string &text, char quote) { return string(1, quote) + EscapeQuotes(text, quote) + string(1, quote); } -string KeywordHelper::WriteOptionallyQuoted(const string &text, char quote, bool allow_caps) { - if (!RequiresQuotes(text, allow_caps)) { +string KeywordHelper::WriteOptionallyQuoted(const string &text, char quote, bool allow_caps, KeywordCategory category) { + if (!RequiresQuotes(text, allow_caps, category)) { return text; } return WriteQuoted(text, quote); diff --git a/src/duckdb/src/parser/parsed_data/alter_table_info.cpp b/src/duckdb/src/parser/parsed_data/alter_table_info.cpp index 8d50e3dd6..b0d3d8b27 100644 --- a/src/duckdb/src/parser/parsed_data/alter_table_info.cpp +++ b/src/duckdb/src/parser/parsed_data/alter_table_info.cpp @@ -671,4 +671,79 @@ string SetSortedByInfo::ToString() const { return result; } +//===--------------------------------------------------------------------===// +// SetTblPropertiesInfo +//===--------------------------------------------------------------------===// +SetTableOptionsInfo::SetTableOptionsInfo() : AlterTableInfo(AlterTableType::SET_TABLE_OPTIONS) { +} + +SetTableOptionsInfo::SetTableOptionsInfo(AlterEntryData data, + case_insensitive_map_t> table_options) + : AlterTableInfo(AlterTableType::SET_TABLE_OPTIONS, std::move(data)), table_options(std::move(table_options)) { +} + +SetTableOptionsInfo::~SetTableOptionsInfo() { +} + +unique_ptr SetTableOptionsInfo::Copy() const { + case_insensitive_map_t> table_options_copy; + for (auto &option : table_options) { + table_options_copy.emplace(option.first, option.second->Copy()); + } + return make_uniq(GetAlterEntryData(), std::move(table_options_copy)); +} + +string SetTableOptionsInfo::ToString() const { + string result = "ALTER TABLE "; + result += QualifierToString(catalog, schema, name); + result += " SET ("; + idx_t i = 0; + for (auto &entry : table_options) { + if (i > 0) { + result += ", "; + } + result += KeywordHelper::WriteQuoted(entry.first, '\'') + "=" + entry.second->ToString(); + i++; + } + result += ")"; + return result; +} + +//===--------------------------------------------------------------------===// +// SetTblPropertiesInfo +//===--------------------------------------------------------------------===// +ResetTableOptionsInfo::ResetTableOptionsInfo() : AlterTableInfo(AlterTableType::RESET_TABLE_OPTIONS) { +} + +ResetTableOptionsInfo::ResetTableOptionsInfo(AlterEntryData data, case_insensitive_set_t table_options) + : AlterTableInfo(AlterTableType::RESET_TABLE_OPTIONS, std::move(data)), table_options(std::move(table_options)) { +} + +ResetTableOptionsInfo::~ResetTableOptionsInfo() { +} + +unique_ptr ResetTableOptionsInfo::Copy() const { + case_insensitive_set_t table_options_copy; + for (auto &option : table_options) { + table_options_copy.emplace(option); + } + return make_uniq(GetAlterEntryData(), table_options_copy); +} + +string ResetTableOptionsInfo::ToString() const { + string result = "ALTER TABLE "; + result += QualifierToString(catalog, schema, name); + result += " RESET ("; + idx_t i = 0; + for (auto &entry : table_options) { + if (i > 0) { + result += ", "; + } + result += KeywordHelper::WriteQuoted(entry, '\''); + i++; + } + result += ")"; + return result; +} + } // namespace duckdb diff --git a/src/duckdb/src/parser/parsed_data/create_type_info.cpp b/src/duckdb/src/parser/parsed_data/create_type_info.cpp index c48799402..95d9bee19 100644 --- a/src/duckdb/src/parser/parsed_data/create_type_info.cpp +++ b/src/duckdb/src/parser/parsed_data/create_type_info.cpp @@ -41,13 +41,6 @@ string CreateTypeInfo::ToString() const { // CREATE TYPE mood AS ENUM (SELECT 'happy') D_ASSERT(query); result += " AS ENUM (" + query->ToString() + ")"; - } else if (type.id() == LogicalTypeId::USER) { - result += " AS "; - auto extra_info = type.AuxInfo(); - D_ASSERT(extra_info); - D_ASSERT(extra_info->type == ExtraTypeInfoType::USER_TYPE_INFO); - auto &user_info = extra_info->Cast(); - result += QualifierToString(user_info.catalog, user_info.schema, user_info.user_type_name); } else { result += " AS "; result += type.ToString(); diff --git a/src/duckdb/src/parser/parsed_data/create_view_info.cpp b/src/duckdb/src/parser/parsed_data/create_view_info.cpp index c4fe3a624..c574cf572 100644 --- a/src/duckdb/src/parser/parsed_data/create_view_info.cpp +++ b/src/duckdb/src/parser/parsed_data/create_view_info.cpp @@ -39,7 +39,7 @@ unique_ptr CreateViewInfo::Copy() const { CopyProperties(*result); result->aliases = aliases; result->types = types; - result->column_comments = column_comments; + result->column_comments_map = column_comments_map; result->query = unique_ptr_cast(query->Copy()); return std::move(result); } @@ -63,10 +63,6 @@ unique_ptr CreateViewInfo::FromSelect(ClientContext &context, un D_ASSERT(!info->query); info->query = ParseSelect(info->sql); - - auto binder = Binder::CreateBinder(context); - binder->BindCreateViewInfo(*info); - return info; } @@ -99,4 +95,44 @@ unique_ptr CreateViewInfo::FromCreateView(ClientContext &context return result; } +vector CreateViewInfo::GetColumnCommentsList() const { + if (column_comments_map.empty()) { + return vector(); + } + if (names.empty()) { + throw InternalException( + "Attempting to serialize column comments using the legacy format, but view is not bound"); + } + vector result; + result.resize(names.size()); + for (auto &entry : column_comments_map) { + auto it = std::find(names.begin(), names.end(), entry.first); + if (it == names.end()) { + throw InternalException( + "While serializing comments for view \"%s\" - did not find column \"%s\" in list of names", view_name, + entry.first); + } + result[NumericCast(it - names.begin())] = entry.second; + } + return result; +} + +CreateViewInfo::CreateViewInfo(vector names_p, vector comments, + unordered_map column_comments_p) + : CreateInfo(CatalogType::VIEW_ENTRY, INVALID_SCHEMA), names(std::move(names_p)), + column_comments_map(std::move(column_comments_p)) { + if (comments.empty()) { + return; + } + if (!column_comments_map.empty()) { + throw SerializationException("Either column_comments or column_comments_map should be provided, not both"); + } + for (idx_t i = 0; i < comments.size(); i++) { + if (comments[i].IsNull()) { + continue; + } + column_comments_map[names[i]] = std::move(comments[i]); + } +} + } // namespace duckdb diff --git a/src/duckdb/src/parser/parsed_expression.cpp b/src/duckdb/src/parser/parsed_expression.cpp index 2732e760c..5d270b8ff 100644 --- a/src/duckdb/src/parser/parsed_expression.cpp +++ b/src/duckdb/src/parser/parsed_expression.cpp @@ -87,6 +87,8 @@ bool ParsedExpression::Equals(const BaseExpression &other) const { return SubqueryExpression::Equal(Cast(), other.Cast()); case ExpressionClass::WINDOW: return WindowExpression::Equal(Cast(), other.Cast()); + case ExpressionClass::TYPE: + return TypeExpression::Equal(Cast(), other.Cast()); default: throw SerializationException("Unsupported type for expression comparison!"); } diff --git a/src/duckdb/src/parser/parsed_expression_iterator.cpp b/src/duckdb/src/parser/parsed_expression_iterator.cpp index f5746f9f7..f654bcf90 100644 --- a/src/duckdb/src/parser/parsed_expression_iterator.cpp +++ b/src/duckdb/src/parser/parsed_expression_iterator.cpp @@ -84,6 +84,13 @@ void ParsedExpressionIterator::EnumerateChildren( } break; } + case ExpressionClass::TYPE: { + auto &type_expr = expr.Cast(); + for (auto &child : type_expr.GetChildren()) { + callback(child); + } + break; + } case ExpressionClass::LAMBDA: { auto &lambda_expr = expr.Cast(); callback(lambda_expr.lhs); diff --git a/src/duckdb/src/parser/parser.cpp b/src/duckdb/src/parser/parser.cpp index d69bf5ceb..b299f3a6c 100644 --- a/src/duckdb/src/parser/parser.cpp +++ b/src/duckdb/src/parser/parser.cpp @@ -1,5 +1,6 @@ #include "duckdb/parser/parser.hpp" +#include "duckdb/main/extension_callback_manager.hpp" #include "duckdb/parser/group_by_node.hpp" #include "duckdb/parser/parsed_data/create_table_info.hpp" #include "duckdb/parser/parser_extension.hpp" @@ -11,6 +12,7 @@ #include "duckdb/parser/tableref/expressionlistref.hpp" #include "duckdb/parser/transformer.hpp" #include "parser/parser.hpp" + #include "postgres_parser.hpp" namespace duckdb { @@ -240,7 +242,7 @@ void Parser::ParseQuery(const string &query) { } { if (options.extensions) { - for (auto &ext : *options.extensions) { + for (auto &ext : options.extensions->ParserExtensions()) { if (!ext.parser_override) { continue; } @@ -262,7 +264,10 @@ void Parser::ParseQuery(const string &query) { } bool is_supported = false; switch (statement->type) { + case StatementType::ANALYZE_STATEMENT: + case StatementType::VACUUM_STATEMENT: case StatementType::CALL_STATEMENT: + case StatementType::MERGE_INTO_STATEMENT: case StatementType::TRANSACTION_STATEMENT: case StatementType::VARIABLE_SET_STATEMENT: case StatementType::LOAD_STATEMENT: @@ -272,6 +277,8 @@ void Parser::ParseQuery(const string &query) { case StatementType::DROP_STATEMENT: case StatementType::ALTER_STATEMENT: case StatementType::PRAGMA_STATEMENT: + case StatementType::INSERT_STATEMENT: + case StatementType::UPDATE_STATEMENT: case StatementType::COPY_DATABASE_STATEMENT: is_supported = true; break; @@ -333,7 +340,7 @@ void Parser::ParseQuery(const string &query) { // no-op // return here would require refactoring into another function. o.w. will just no-op in order to run wrap up // code at the end of this function - } else if (!options.extensions || options.extensions->empty()) { + } else if (!options.extensions || !options.extensions->HasParserExtensions()) { throw ParserException::SyntaxError(query, parser_error, parser_error_location); } else { // split sql string into statements and re-parse using extension @@ -369,7 +376,7 @@ void Parser::ParseQuery(const string &query) { // LCOV_EXCL_START // let extensions parse the statement which DuckDB failed to parse bool parsed_single_statement = false; - for (auto &ext : *options.extensions) { + for (auto &ext : options.extensions->ParserExtensions()) { D_ASSERT(!parsed_single_statement); if (!ext.parse_function) { continue; diff --git a/src/duckdb/src/parser/tableref/pivotref.cpp b/src/duckdb/src/parser/tableref/pivotref.cpp index 8874fdee7..ffcc0ad38 100644 --- a/src/duckdb/src/parser/tableref/pivotref.cpp +++ b/src/duckdb/src/parser/tableref/pivotref.cpp @@ -2,6 +2,15 @@ #include "duckdb/parser/expression_util.hpp" #include "duckdb/common/limits.hpp" +#include "duckdb/common/exception/conversion_exception.hpp" +#include "duckdb/parser/expression/cast_expression.hpp" +#include "duckdb/parser/expression/constant_expression.hpp" +#include "duckdb/parser/expression/function_expression.hpp" +#include "duckdb/parser/expression/columnref_expression.hpp" +#include "duckdb/common/serializer/serializer.hpp" +#include "duckdb/common/serializer/deserializer.hpp" +#include "duckdb/common/types/value.hpp" + namespace duckdb { //===--------------------------------------------------------------------===// @@ -129,6 +138,169 @@ PivotColumnEntry PivotColumnEntry::Copy() const { return result; } +static bool TryFoldConstantForBackwardsCompatability(const ParsedExpression &expr, Value &value) { + switch (expr.GetExpressionType()) { + case ExpressionType::FUNCTION: { + auto &function = expr.Cast(); + if (function.function_name == "struct_pack") { + unordered_set unique_names; + child_list_t values; + values.reserve(function.children.size()); + for (const auto &child : function.children) { + if (!unique_names.insert(child->GetAlias()).second) { + return false; + } + Value child_value; + if (!TryFoldConstantForBackwardsCompatability(*child, child_value)) { + return false; + } + values.emplace_back(child->GetAlias(), std::move(child_value)); + } + value = Value::STRUCT(std::move(values)); + return true; + } else if (function.function_name == "list_value") { + vector values; + values.reserve(function.children.size()); + for (const auto &child : function.children) { + Value child_value; + if (!TryFoldConstantForBackwardsCompatability(*child, child_value)) { + return false; + } + values.emplace_back(std::move(child_value)); + } + + // figure out child type + LogicalType child_type(LogicalTypeId::SQLNULL); + for (auto &child_value : values) { + child_type = LogicalType::ForceMaxLogicalType(child_type, child_value.type()); + } + + // finally create the list + value = Value::LIST(child_type, values); + return true; + } else if (function.function_name == "map") { + Value keys; + if (!TryFoldConstantForBackwardsCompatability(*function.children[0], keys)) { + return false; + } + + Value values; + if (!TryFoldConstantForBackwardsCompatability(*function.children[1], values)) { + return false; + } + + vector keys_unpacked = ListValue::GetChildren(keys); + vector values_unpacked = ListValue::GetChildren(values); + + value = Value::MAP(ListType::GetChildType(keys.type()), ListType::GetChildType(values.type()), + keys_unpacked, values_unpacked); + return true; + } else { + return false; + } + } + case ExpressionType::VALUE_CONSTANT: { + auto &constant = expr.Cast(); + value = constant.value; + return true; + } + case ExpressionType::OPERATOR_CAST: { + auto &cast = expr.Cast(); + Value dummy_value; + if (!TryFoldConstantForBackwardsCompatability(*cast.child, dummy_value)) { + return false; + } + + // Try to default bind cast + LogicalType cast_type; + try { + cast_type = UnboundType::TryDefaultBind(cast.cast_type); + } catch (...) { + return false; + } + + if (cast_type == LogicalType::INVALID || cast_type == LogicalTypeId::UNBOUND) { + return false; + } + + string error_message; + if (!dummy_value.DefaultTryCastAs(cast_type, value, &error_message)) { + return false; + } + return true; + } + default: + return false; + } +} + +static bool TryFoldForBackwardsCompatibility(const unique_ptr &expr, vector &values) { + if (!expr) { + return true; + } + + switch (expr->GetExpressionType()) { + case ExpressionType::COLUMN_REF: { + auto &colref = expr->Cast(); + if (colref.IsQualified()) { + return false; + } + values.emplace_back(colref.GetColumnName()); + return true; + } + case ExpressionType::FUNCTION: { + auto &function = expr->Cast(); + if (function.function_name != "row") { + return false; + } + for (auto &child : function.children) { + if (!TryFoldForBackwardsCompatibility(child, values)) { + return false; + } + } + return true; + } + default: { + Value val; + if (!TryFoldConstantForBackwardsCompatability(*expr, val)) { + return false; + } + values.push_back(std::move(val)); + return true; + } + } +} + +void PivotColumnEntry::Serialize(Serializer &serializer) const { + if (serializer.ShouldSerialize(7) || !expr) { + serializer.WritePropertyWithDefault>(100, "values", values); + serializer.WritePropertyWithDefault>(101, "star_expr", expr); + serializer.WritePropertyWithDefault(102, "alias", alias); + } else { + // We used to only support constant values in pivot entries, and folded expressions in the + // transformer. So we need to seriaize in a backwards compatible way here by trying to fold + // the expression back to constant values. + vector dummy_values; + if (!TryFoldForBackwardsCompatibility(expr, dummy_values)) { + throw SerializationException( + "Cannot serialize arbitrary expression pivot entries when targeting database storage version '%s'", + serializer.GetOptions().serialization_compatibility.duckdb_version); + ; + } + serializer.WritePropertyWithDefault>(100, "values", dummy_values); + serializer.WritePropertyWithDefault>(101, "star_expr", nullptr); + serializer.WritePropertyWithDefault(102, "alias", alias); + } +} + +PivotColumnEntry PivotColumnEntry::Deserialize(Deserializer &deserializer) { + PivotColumnEntry result; + deserializer.ReadPropertyWithDefault>(100, "values", result.values); + deserializer.ReadPropertyWithDefault>(101, "star_expr", result.expr); + deserializer.ReadPropertyWithDefault(102, "alias", result.alias); + return result; +} + //===--------------------------------------------------------------------===// // PivotRef //===--------------------------------------------------------------------===// diff --git a/src/duckdb/src/parser/transform/expression/transform_constant.cpp b/src/duckdb/src/parser/transform/expression/transform_constant.cpp index 88fd295ff..2f83a843c 100644 --- a/src/duckdb/src/parser/transform/expression/transform_constant.cpp +++ b/src/duckdb/src/parser/transform/expression/transform_constant.cpp @@ -95,90 +95,4 @@ unique_ptr Transformer::TransformConstant(duckdb_libpgquery::P return std::move(constant); } -bool Transformer::ConstructConstantFromExpression(const ParsedExpression &expr, Value &value) { - // We have to construct it like this because we don't have the ClientContext for binding/executing the expr here - switch (expr.GetExpressionType()) { - case ExpressionType::FUNCTION: { - auto &function = expr.Cast(); - if (function.function_name == "struct_pack") { - unordered_set unique_names; - child_list_t values; - values.reserve(function.children.size()); - for (const auto &child : function.children) { - if (!unique_names.insert(child->GetAlias()).second) { - throw BinderException("Duplicate struct entry name \"%s\"", child->GetAlias()); - } - Value child_value; - if (!ConstructConstantFromExpression(*child, child_value)) { - return false; - } - values.emplace_back(child->GetAlias(), std::move(child_value)); - } - value = Value::STRUCT(std::move(values)); - return true; - } else if (function.function_name == "list_value") { - vector values; - values.reserve(function.children.size()); - for (const auto &child : function.children) { - Value child_value; - if (!ConstructConstantFromExpression(*child, child_value)) { - return false; - } - values.emplace_back(std::move(child_value)); - } - - // figure out child type - LogicalType child_type(LogicalTypeId::SQLNULL); - for (auto &child_value : values) { - child_type = LogicalType::ForceMaxLogicalType(child_type, child_value.type()); - } - - // finally create the list - value = Value::LIST(child_type, values); - return true; - } else if (function.function_name == "map") { - Value keys; - if (!ConstructConstantFromExpression(*function.children[0], keys)) { - return false; - } - - Value values; - if (!ConstructConstantFromExpression(*function.children[1], values)) { - return false; - } - - vector keys_unpacked = ListValue::GetChildren(keys); - vector values_unpacked = ListValue::GetChildren(values); - - value = Value::MAP(ListType::GetChildType(keys.type()), ListType::GetChildType(values.type()), - keys_unpacked, values_unpacked); - return true; - } else { - return false; - } - } - case ExpressionType::VALUE_CONSTANT: { - auto &constant = expr.Cast(); - value = constant.value; - return true; - } - case ExpressionType::OPERATOR_CAST: { - auto &cast = expr.Cast(); - Value dummy_value; - if (!ConstructConstantFromExpression(*cast.child, dummy_value)) { - return false; - } - - string error_message; - if (!dummy_value.DefaultTryCastAs(cast.cast_type, value, &error_message)) { - throw ConversionException("Unable to cast %s to %s", dummy_value.ToString(), - EnumUtil::ToString(cast.cast_type.id())); - } - return true; - } - default: - return false; - } -} - } // namespace duckdb diff --git a/src/duckdb/src/parser/transform/helpers/transform_typename.cpp b/src/duckdb/src/parser/transform/helpers/transform_typename.cpp index 917b6cc80..b2492b176 100644 --- a/src/duckdb/src/parser/transform/helpers/transform_typename.cpp +++ b/src/duckdb/src/parser/transform/helpers/transform_typename.cpp @@ -6,315 +6,168 @@ #include "duckdb/common/types/decimal.hpp" #include "duckdb/common/types/vector.hpp" #include "duckdb/parser/expression/constant_expression.hpp" +#include "duckdb/parser/expression/type_expression.hpp" namespace duckdb { -struct SizeModifiers { - int64_t width = 0; - int64_t scale = 0; - // How many modifiers were found - idx_t count = 0; -}; +unique_ptr Transformer::TransformTypeExpressionInternal(duckdb_libpgquery::PGTypeName &type_name) { + // Parse typename/any qualifications -static SizeModifiers GetSizeModifiers(duckdb_libpgquery::PGTypeName &type_name, LogicalTypeId base_type) { - SizeModifiers result; + string unbound_name; + string schema_name; + string catalog_name; - if (base_type == LogicalTypeId::DECIMAL) { - // Defaults for DECIMAL - result.width = 18; - result.scale = 3; + if (type_name.names->length == 0) { + throw ParserException("Type name cannot be empty"); } + if (type_name.names->length == 1) { + auto unbound_name_cell = type_name.names->head; - if (type_name.typmods) { - for (auto node = type_name.typmods->head; node; node = node->next) { - auto &const_val = *Transformer::PGPointerCast(node->data.ptr_value); - if (const_val.type != duckdb_libpgquery::T_PGAConst || - const_val.val.type != duckdb_libpgquery::T_PGInteger) { - throw ParserException("Expected an integer constant as type modifier"); - } - if (const_val.val.val.ival < 0) { - throw ParserException("Negative modifier not supported"); - } - if (result.count == 0) { - result.width = const_val.val.val.ival; - if (base_type == LogicalTypeId::BIT && const_val.location != -1) { - result.width = 0; - } - } else if (result.count == 1) { - result.scale = const_val.val.val.ival; - } else { - throw ParserException("A maximum of two modifiers is supported"); - } - result.count++; - } - } - return result; -} - -vector Transformer::TransformTypeModifiers(duckdb_libpgquery::PGTypeName &type_name) { - vector type_mods; - if (type_name.typmods) { - for (auto node = type_name.typmods->head; node; node = node->next) { - const auto &const_val = *PGPointerCast(node->data.ptr_value); - if (const_val.type != duckdb_libpgquery::T_PGAConst) { - throw ParserException("Expected a constant as type modifier"); - } - const auto const_expr = TransformValue(const_val.val); - type_mods.push_back(std::move(const_expr->value)); - } - if (type_mods.size() > 9) { - const auto name = PGPointerCast(type_name.names->tail->data.ptr_value)->val.str; - throw ParserException("'%s': a maximum of 9 type modifiers is allowed", name); - } - } - return type_mods; -} - -LogicalType Transformer::TransformTypeNameInternal(duckdb_libpgquery::PGTypeName &type_name) { - if (type_name.names->length > 1) { - // qualified typename - vector names; - for (auto cell = type_name.names->head; cell; cell = cell->next) { - names.push_back(PGPointerCast(cell->data.ptr_value)->val.str); - } - vector type_mods = TransformTypeModifiers(type_name); - switch (type_name.names->length) { - case 2: { - return LogicalType::USER(INVALID_CATALOG, std::move(names[0]), std::move(names[1]), std::move(type_mods)); - } - case 3: { - return LogicalType::USER(std::move(names[0]), std::move(names[1]), std::move(names[2]), - std::move(type_mods)); - } - default: - throw ParserException( - "Too many qualifications for type name - expected [catalog.schema.name] or [schema.name]"); - } + unbound_name = PGPointerCast(unbound_name_cell->data.ptr_value)->val.str; } + if (type_name.names->length == 2) { + auto schema_name_cell = type_name.names->head; + auto unbound_name_cell = schema_name_cell->next; - auto name = PGPointerCast(type_name.names->tail->data.ptr_value)->val.str; - // transform it to the SQL type - LogicalTypeId base_type = TransformStringToLogicalTypeId(name); - - if (base_type == LogicalTypeId::LIST) { - throw ParserException("LIST is not valid as a stand-alone type"); + schema_name = PGPointerCast(schema_name_cell->data.ptr_value)->val.str; + unbound_name = PGPointerCast(unbound_name_cell->data.ptr_value)->val.str; } - if (base_type == LogicalTypeId::ENUM) { - if (!type_name.typmods || type_name.typmods->length == 0) { - throw ParserException("Enum needs a set of entries"); - } - Vector enum_vector(LogicalType::VARCHAR, NumericCast(type_name.typmods->length)); - auto string_data = FlatVector::GetData(enum_vector); - idx_t pos = 0; - for (auto node = type_name.typmods->head; node; node = node->next) { - auto constant_value = PGPointerCast(node->data.ptr_value); - if (constant_value->type != duckdb_libpgquery::T_PGAConst || - constant_value->val.type != duckdb_libpgquery::T_PGString) { - throw ParserException("Enum type requires a set of strings as type modifiers"); - } - string_data[pos++] = StringVector::AddString(enum_vector, constant_value->val.val.str); - } - return LogicalType::ENUM(enum_vector, NumericCast(type_name.typmods->length)); + if (type_name.names->length == 3) { + auto catalog_name_cell = type_name.names->head; + auto schema_name_cell = catalog_name_cell->next; + auto unbound_name_cell = schema_name_cell->next; + + catalog_name = PGPointerCast(catalog_name_cell->data.ptr_value)->val.str; + schema_name = PGPointerCast(schema_name_cell->data.ptr_value)->val.str; + unbound_name = PGPointerCast(unbound_name_cell->data.ptr_value)->val.str; } - if (base_type == LogicalTypeId::GEOMETRY) { - if (!type_name.typmods || type_name.typmods->length == 0) { - return LogicalType::GEOMETRY(); - } - // Expect a single type modifier with the CRS definition - if (type_name.typmods->length != 1) { - throw ParserException( - "GEOMETRY type takes a single optional type modifier with a coordinate system definition"); - } - auto crs_node = PGPointerCast(type_name.typmods->head->data.ptr_value); - if (crs_node->type != duckdb_libpgquery::T_PGAConst || crs_node->val.type != duckdb_libpgquery::T_PGString) { - throw ParserException( - "GEOMETRY type modifier must be a string with a coordinate system definition definition"); - } - return LogicalType::GEOMETRY(crs_node->val.val.str); + if (type_name.names->length >= 4) { + throw ParserException( + "Too many qualifications for type name - expected [catalog.schema.name] or [schema.name]"); } - if (base_type == LogicalTypeId::STRUCT) { - if (!type_name.typmods || type_name.typmods->length == 0) { - throw ParserException("Struct needs a name and entries"); - } - child_list_t children; - case_insensitive_set_t name_collision_set; + D_ASSERT(!unbound_name.empty()); - for (auto node = type_name.typmods->head; node; node = node->next) { - auto &type_val = *PGPointerCast(node->data.ptr_value); - if (type_val.length != 2) { - throw ParserException("Struct entry needs an entry name and a type name"); - } + // The postgres parser emits a bunch of strange type names - we want to normalize them here so that the alias for + // columns from expressions containing these types actually use the DuckDB type name. + // Eventually we should make the parser emit the correct names directly. + auto known_type_id = TransformStringToLogicalTypeId(unbound_name); + if (known_type_id != LogicalTypeId::UNBOUND) { + unbound_name = LogicalTypeIdToString(known_type_id); + } - auto entry_name_node = PGPointerCast(type_val.head->data.ptr_value); - D_ASSERT(entry_name_node->type == duckdb_libpgquery::T_PGString); - auto entry_type_node = PGPointerCast(type_val.tail->data.ptr_value); - D_ASSERT(entry_type_node->type == duckdb_libpgquery::T_PGTypeName); + // Parse type modifiers + vector> type_params; + for (auto typemod = type_name.typmods ? type_name.typmods->head : nullptr; typemod; typemod = typemod->next) { + // Type mods are always a list of (name, node) pairs - auto entry_name = string(entry_name_node->val.str); - D_ASSERT(!entry_name.empty()); + string name_str; + auto typemod_node = PGPointerCast(typemod->data.ptr_value); - if (name_collision_set.find(entry_name) != name_collision_set.end()) { - throw ParserException("Duplicate struct entry name \"%s\"", entry_name); + if (typemod_node->type == duckdb_libpgquery::T_PGList) { + auto &typemod_pair = *PGPointerCast(typemod->data.ptr_value); + if (typemod_pair.length != 2) { + throw ParserException("Expected type modifier to be a pair of (name, value)"); } - name_collision_set.insert(entry_name); - auto entry_type = TransformTypeName(*entry_type_node); - children.push_back(make_pair(entry_name, entry_type)); - } - D_ASSERT(!children.empty()); - return LogicalType::STRUCT(children); - } - if (base_type == LogicalTypeId::VARIANT) { - return LogicalType::VARIANT(); - } - if (base_type == LogicalTypeId::MAP) { - if (!type_name.typmods || type_name.typmods->length != 2) { - throw ParserException("Map type needs exactly two entries, key and value type"); - } - auto key_type = - TransformTypeName(*PGPointerCast(type_name.typmods->head->data.ptr_value)); - auto value_type = - TransformTypeName(*PGPointerCast(type_name.typmods->tail->data.ptr_value)); - - return LogicalType::MAP(std::move(key_type), std::move(value_type)); - } - if (base_type == LogicalTypeId::UNION) { - if (!type_name.typmods || type_name.typmods->length == 0) { - throw ParserException("Union type needs at least one member"); - } - if (type_name.typmods->length > (int)UnionType::MAX_UNION_MEMBERS) { - throw ParserException("Union types can have at most %d members", UnionType::MAX_UNION_MEMBERS); - } + // This is the actual argument node + typemod_node = PGPointerCast(typemod_pair.tail->data.ptr_value); - child_list_t children; - case_insensitive_set_t name_collision_set; - - for (auto node = type_name.typmods->head; node; node = node->next) { - auto &type_val = *PGPointerCast(node->data.ptr_value); - if (type_val.length != 2) { - throw ParserException("Union type member needs a tag name and a type name"); + // Extract name of the type modifier (optional) + auto name_node = PGPointerCast(typemod_pair.head->data.ptr_value); + if (name_node) { + if (name_node->type != duckdb_libpgquery::T_PGString) { + throw ParserException("Expected a constant as type modifier name"); + } + name_str = PGPointerCast(name_node.get())->val.str; } + } - auto entry_name_node = PGPointerCast(type_val.head->data.ptr_value); - D_ASSERT(entry_name_node->type == duckdb_libpgquery::T_PGString); - auto entry_type_node = PGPointerCast(type_val.tail->data.ptr_value); - D_ASSERT(entry_type_node->type == duckdb_libpgquery::T_PGTypeName); + // Extract value of the type modifier + // This is either: + // 1. A constant value + // 2. A expression + // 3. A type name - auto entry_name = string(entry_name_node->val.str); - D_ASSERT(!entry_name.empty()); + if (typemod_node->type == duckdb_libpgquery::T_PGTypeName) { + auto type_node = *PGPointerCast(typemod_node.get()); + auto type_expr = TransformTypeExpression(type_node); + type_expr->SetAlias(std::move(name_str)); + type_params.push_back(std::move(type_expr)); + } else { + // Expression + auto expr = TransformExpression(*typemod_node); - if (name_collision_set.find(entry_name) != name_collision_set.end()) { - throw ParserException("Duplicate union type tag name \"%s\"", entry_name); + // TODO: Allow arbitrary expressions in the future + if (expr->GetExpressionClass() != ExpressionClass::CONSTANT) { + throw ParserException("Expected a constant as type modifier"); } - name_collision_set.insert(entry_name); - - auto entry_type = TransformTypeName(*entry_type_node); - children.push_back(make_pair(entry_name, entry_type)); + expr->SetAlias(std::move(name_str)); + type_params.push_back(std::move(expr)); } - D_ASSERT(!children.empty()); - return LogicalType::UNION(std::move(children)); - } - if (base_type == LogicalTypeId::USER) { - string user_type_name {name}; - vector type_mods = TransformTypeModifiers(type_name); - return LogicalType::USER(user_type_name, type_mods); } - SizeModifiers modifiers = GetSizeModifiers(type_name, base_type); - switch (base_type) { - case LogicalTypeId::VARCHAR: - if (modifiers.count > 1) { - throw ParserException("VARCHAR only supports a single modifier"); - } - // FIXME: create CHECK constraint based on varchar width - modifiers.width = 0; - return LogicalType::VARCHAR; - case LogicalTypeId::DECIMAL: - if (modifiers.count > 2) { - throw ParserException("DECIMAL only supports a maximum of two modifiers"); - } - if (modifiers.count == 1) { - // only width is provided: set scale to 0 - modifiers.scale = 0; - } - if (modifiers.width <= 0 || modifiers.width > Decimal::MAX_WIDTH_DECIMAL) { - throw ParserException("Width must be between 1 and %d!", (int)Decimal::MAX_WIDTH_DECIMAL); - } - if (modifiers.scale > modifiers.width) { - throw ParserException("Scale cannot be bigger than width"); - } - return LogicalType::DECIMAL(NumericCast(modifiers.width), NumericCast(modifiers.scale)); - case LogicalTypeId::INTERVAL: - if (modifiers.count > 1) { - throw ParserException("INTERVAL only supports a single modifier"); - } - modifiers.width = 0; - return LogicalType::INTERVAL; - case LogicalTypeId::BIT: - if (!modifiers.width && type_name.typmods) { - throw ParserException("Type %s does not support any modifiers!", LogicalType(base_type).ToString()); - } - return LogicalType(base_type); - case LogicalTypeId::TIMESTAMP: - if (modifiers.count == 0) { - return LogicalType::TIMESTAMP; - } - if (modifiers.count > 1) { - throw ParserException("TIMESTAMP only supports a single modifier"); - } - if (modifiers.width > 10) { - throw ParserException("TIMESTAMP only supports until nano-second precision (9)"); - } - if (modifiers.width == 0) { - return LogicalType::TIMESTAMP_S; - } - if (modifiers.width <= 3) { - return LogicalType::TIMESTAMP_MS; - } - if (modifiers.width <= 6) { - return LogicalType::TIMESTAMP; - } - return LogicalType::TIMESTAMP_NS; - default: - if (modifiers.count > 0) { - throw ParserException("Type %s does not support any modifiers!", LogicalType(base_type).ToString()); - } - return LogicalType(base_type); + auto result = make_uniq(catalog_name, schema_name, unbound_name, std::move(type_params)); + + // Assign query location + if (type_name.location >= 0) { + result->query_location = NumericCast(type_name.location); } + + return std::move(result); } -LogicalType Transformer::TransformTypeName(duckdb_libpgquery::PGTypeName &type_name) { +unique_ptr Transformer::TransformTypeExpression(duckdb_libpgquery::PGTypeName &type_name) { if (type_name.type != duckdb_libpgquery::T_PGTypeName) { throw ParserException("Expected a type"); } auto stack_checker = StackCheck(); - auto result_type = TransformTypeNameInternal(type_name); + + auto result = TransformTypeExpressionInternal(type_name); + if (type_name.arrayBounds) { - // array bounds: turn the type into a list + // For both arrays and lists, the inner type is stored as the first type parameter + idx_t extra_stack = 0; for (auto cell = type_name.arrayBounds->head; cell != nullptr; cell = cell->next) { StackCheck(extra_stack++); - auto val = PGPointerCast(cell->data.ptr_value); - if (val->type != duckdb_libpgquery::T_PGInteger) { - throw ParserException("Expected integer value as array bound"); - } - auto array_size = val->val.ival; - if (array_size < 0) { - // -1 if bounds are empty - result_type = LogicalType::LIST(result_type); - } else if (array_size == 0) { - // Empty arrays are not supported - throw ParserException("Arrays must have a size of at least 1"); - } else if (array_size > static_cast(ArrayType::MAX_ARRAY_SIZE)) { - throw ParserException("Arrays must have a size of at most %d", ArrayType::MAX_ARRAY_SIZE); - } else { - result_type = LogicalType::ARRAY(result_type, NumericCast(array_size)); + auto arg = PGPointerCast(cell->data.ptr_value); + + if (arg->type == duckdb_libpgquery::T_PGInteger) { + auto int_node = PGPointerCast(arg.get()); + auto size = int_node->val.ival; + + vector> type_params; + type_params.push_back(std::move(result)); + + if (size == -1) { + // LIST type + result = make_uniq("list", std::move(type_params)); + } else { + // ARRAY type + type_params.push_back(make_uniq(Value::BIGINT(int_node->val.ival))); + result = make_uniq("array", std::move(type_params)); + } + + continue; } + + throw ParserException("ARRAY bounds must only contain expressions"); } } - return result_type; + + // Assign query location + if (type_name.location >= 0) { + result->query_location = NumericCast(type_name.location); + } + + return result; +} + +LogicalType Transformer::TransformTypeName(duckdb_libpgquery::PGTypeName &type_name) { + auto type_expr = TransformTypeExpression(type_name); + return LogicalType::UNBOUND(std::move(type_expr)); } } // namespace duckdb diff --git a/src/duckdb/src/parser/transform/statement/transform_alter_table.cpp b/src/duckdb/src/parser/transform/statement/transform_alter_table.cpp index 203d90fdc..71dc1967d 100644 --- a/src/duckdb/src/parser/transform/statement/transform_alter_table.cpp +++ b/src/duckdb/src/parser/transform/statement/transform_alter_table.cpp @@ -223,6 +223,29 @@ unique_ptr Transformer::TransformAlter(duckdb_libpgquery::PGAlterT result->info = make_uniq(std::move(data), std::move(orders)); break; } + case duckdb_libpgquery::PG_AT_SetRelOptions: { + case_insensitive_map_t> options; + if (command->options) { + TransformTableOptions(options, command->options); + } + result->info = make_uniq(std::move(data), std::move(options)); + break; + } + case duckdb_libpgquery::PG_AT_ResetRelOptions: { + case_insensitive_map_t> rel_options_map; + case_insensitive_set_t options; + if (command->options) { + // TransformTableOptions will throw if key values are parsed + TransformTableOptions(rel_options_map, command->options, true); + // make sure RESET only supports single value options + // default of true is allowed + for (auto &option : rel_options_map) { + options.insert(option.first); + } + } + result->info = make_uniq(std::move(data), std::move(options)); + break; + } default: throw NotImplementedException("No support for that ALTER TABLE option yet!"); } diff --git a/src/duckdb/src/parser/transform/statement/transform_comment_on.cpp b/src/duckdb/src/parser/transform/statement/transform_comment_on.cpp index 6ab5d9e68..d9680168d 100644 --- a/src/duckdb/src/parser/transform/statement/transform_comment_on.cpp +++ b/src/duckdb/src/parser/transform/statement/transform_comment_on.cpp @@ -1,8 +1,9 @@ +#include "duckdb/parser/expression/columnref_expression.hpp" #include "duckdb/parser/expression/constant_expression.hpp" #include "duckdb/parser/parsed_data/alter_info.hpp" #include "duckdb/parser/parsed_data/alter_table_info.hpp" -#include "duckdb/parser/statement/alter_statement.hpp" #include "duckdb/parser/parsed_data/comment_on_column_info.hpp" +#include "duckdb/parser/statement/alter_statement.hpp" #include "duckdb/parser/transformer.hpp" namespace duckdb { diff --git a/src/duckdb/src/parser/transform/statement/transform_create_function.cpp b/src/duckdb/src/parser/transform/statement/transform_create_function.cpp index 1525f634d..2632243af 100644 --- a/src/duckdb/src/parser/transform/statement/transform_create_function.cpp +++ b/src/duckdb/src/parser/transform/statement/transform_create_function.cpp @@ -39,12 +39,6 @@ unique_ptr Transformer::TransformMacroFunction(duckdb_libpgquery: // Transform parameter default value if (param.defaultValue) { auto default_expr = TransformExpression(PGPointerCast(param.defaultValue)); - Value default_value; - if (!ConstructConstantFromExpression(*default_expr, default_value)) { - throw ParserException("Invalid default value for parameter '%s': %s", param.name, - default_expr->ToString()); - } - default_expr = make_uniq(std::move(default_value)); default_expr->SetAlias(param.name); macro_func->default_parameters[param.name] = std::move(default_expr); } else if (!macro_func->default_parameters.empty()) { diff --git a/src/duckdb/src/parser/transform/statement/transform_create_table.cpp b/src/duckdb/src/parser/transform/statement/transform_create_table.cpp index 19f2cd351..8a180497d 100644 --- a/src/duckdb/src/parser/transform/statement/transform_create_table.cpp +++ b/src/duckdb/src/parser/transform/statement/transform_create_table.cpp @@ -1,6 +1,8 @@ #include "duckdb/catalog/catalog_entry/table_column_type.hpp" #include "duckdb/parser/constraint.hpp" #include "duckdb/parser/expression/collate_expression.hpp" +#include "duckdb/parser/expression/constant_expression.hpp" +#include "duckdb/parser/expression/type_expression.hpp" #include "duckdb/parser/parsed_data/create_table_info.hpp" #include "duckdb/parser/statement/create_statement.hpp" #include "duckdb/parser/transformer.hpp" @@ -59,18 +61,30 @@ ColumnDefinition Transformer::TransformColumnDefinition(duckdb_libpgquery::PGCol } else if (!cdef.typeName) { // ALTER TABLE tbl ALTER TYPE USING ... target_type = LogicalType::UNKNOWN; - } else { - target_type = TransformTypeName(*cdef.typeName); - } - - if (cdef.collClause) { + } else if (cdef.collClause) { if (cdef.category == duckdb_libpgquery::COL_GENERATED) { throw ParserException("Collations are not supported on generated columns"); } - if (target_type.id() != LogicalTypeId::VARCHAR) { + + auto typename_expr = TransformTypeExpressionInternal(*cdef.typeName); + if (typename_expr->type != ExpressionType::TYPE) { + throw ParserException("Only type names can have collations!"); + } + + auto &type_expr = typename_expr->Cast(); + if (!StringUtil::CIEquals(type_expr.GetTypeName(), "VARCHAR")) { throw ParserException("Only VARCHAR columns can have collations!"); } - target_type = LogicalType::VARCHAR_COLLATION(TransformCollation(cdef.collClause)); + + // Push back collation as a parameter of the type expression + auto collation = TransformCollation(cdef.collClause); + auto collation_expr = make_uniq(Value(collation)); + collation_expr->SetAlias("collation"); + type_expr.GetChildren().push_back(std::move(collation_expr)); + + target_type = LogicalType::UNBOUND(std::move(typename_expr)); + } else { + target_type = TransformTypeName(*cdef.typeName); } return ColumnDefinition(name, target_type); diff --git a/src/duckdb/src/parser/transform/statement/transform_create_table_as.cpp b/src/duckdb/src/parser/transform/statement/transform_create_table_as.cpp index 16ab1b596..bfb428662 100644 --- a/src/duckdb/src/parser/transform/statement/transform_create_table_as.cpp +++ b/src/duckdb/src/parser/transform/statement/transform_create_table_as.cpp @@ -1,7 +1,8 @@ -#include "duckdb/parser/statement/create_statement.hpp" #include "duckdb/parser/expression/constant_expression.hpp" +#include "duckdb/parser/expression/star_expression.hpp" #include "duckdb/parser/parsed_data/create_table_info.hpp" #include "duckdb/parser/query_node/select_node.hpp" +#include "duckdb/parser/statement/create_statement.hpp" #include "duckdb/parser/tableref/subqueryref.hpp" #include "duckdb/parser/transformer.hpp" diff --git a/src/duckdb/src/parser/transform/statement/transform_secret.cpp b/src/duckdb/src/parser/transform/statement/transform_secret.cpp index bde6c38f7..749cde6e9 100644 --- a/src/duckdb/src/parser/transform/statement/transform_secret.cpp +++ b/src/duckdb/src/parser/transform/statement/transform_secret.cpp @@ -1,6 +1,7 @@ -#include "duckdb/parser/statement/create_statement.hpp" +#include "duckdb/parser/expression/columnref_expression.hpp" #include "duckdb/parser/expression/constant_expression.hpp" #include "duckdb/parser/expression/function_expression.hpp" +#include "duckdb/parser/statement/create_statement.hpp" #include "duckdb/parser/tableref/basetableref.hpp" #include "duckdb/parser/transformer.hpp" diff --git a/src/duckdb/src/parser/transform/tableref/transform_pivot.cpp b/src/duckdb/src/parser/transform/tableref/transform_pivot.cpp index dcb2dc036..a48fa76c3 100644 --- a/src/duckdb/src/parser/transform/tableref/transform_pivot.cpp +++ b/src/duckdb/src/parser/transform/tableref/transform_pivot.cpp @@ -8,39 +8,6 @@ namespace duckdb { -bool Transformer::TransformPivotInList(unique_ptr &expr, PivotColumnEntry &entry, bool root_entry) { - switch (expr->GetExpressionType()) { - case ExpressionType::COLUMN_REF: { - auto &colref = expr->Cast(); - if (colref.IsQualified()) { - throw ParserException(expr->GetQueryLocation(), "PIVOT IN list cannot contain qualified column references"); - } - entry.values.emplace_back(colref.GetColumnName()); - return true; - } - case ExpressionType::FUNCTION: { - auto &function = expr->Cast(); - if (function.function_name != "row") { - return false; - } - for (auto &child : function.children) { - if (!TransformPivotInList(child, entry, false)) { - return false; - } - } - return true; - } - default: { - Value val; - if (!Transformer::ConstructConstantFromExpression(*expr, val)) { - return false; - } - entry.values.push_back(std::move(val)); - return true; - } - } -} - PivotColumn Transformer::TransformPivotColumn(duckdb_libpgquery::PGPivot &pivot, bool is_pivot) { PivotColumn col; if (pivot.pivot_columns) { @@ -65,19 +32,7 @@ PivotColumn Transformer::TransformPivotColumn(duckdb_libpgquery::PGPivot &pivot, auto expr = TransformExpression(n); PivotColumnEntry entry; entry.alias = expr->GetAlias(); - auto transformed = TransformPivotInList(expr, entry); - if (!transformed) { - // could not transform into list of constant values - if (is_pivot) { - // for pivot - throw an exception - throw ParserException(expr->GetQueryLocation(), - "PIVOT IN list must contain columns or lists of columns"); - } else { - // for unpivot - we can forward the expression immediately - entry.values.clear(); - entry.expr = std::move(expr); - } - } + entry.expr = std::move(expr); col.entries.push_back(std::move(entry)); } } @@ -123,20 +78,6 @@ unique_ptr Transformer::TransformPivot(duckdb_libpgquery::PGPivotExpr throw ParserException("UNPIVOT requires a single column name for the PIVOT IN clause"); } D_ASSERT(pivot.pivot_expressions.empty()); - } else { - // pivot - auto expected_size = pivot.pivot_expressions.size(); - D_ASSERT(pivot.unpivot_names.empty()); - for (auto &entry : pivot.entries) { - if (entry.expr) { - throw ParserException("PIVOT IN list must contain columns or lists of columns - expressions are " - "only supported for UNPIVOT"); - } - if (entry.values.size() != expected_size) { - throw ParserException("PIVOT IN list - inconsistent amount of rows - expected %d but got %d", - expected_size, entry.values.size()); - } - } } } result->include_nulls = root.include_nulls; diff --git a/src/duckdb/src/parser/transformer.cpp b/src/duckdb/src/parser/transformer.cpp index c277578de..b489ef086 100644 --- a/src/duckdb/src/parser/transformer.cpp +++ b/src/duckdb/src/parser/transformer.cpp @@ -245,7 +245,7 @@ void Transformer::SetQueryLocation(TableRef &ref, int query_location) { } void Transformer::TransformTableOptions(case_insensitive_map_t> &options, - optional_ptr pg_options) { + optional_ptr pg_options, bool throw_if_value) { if (!pg_options) { return; } @@ -258,10 +258,13 @@ void Transformer::TransformTableOptions(case_insensitive_map_targ) { - options.emplace(lower_name, make_uniq(Value::BOOLEAN(true))); + options.emplace(lower_name, make_uniq(Value())); continue; } auto expr = TransformExpression(def_elem->arg); + if (throw_if_value) { + throw ParserException("\"%s\"", expr->ToString()); + } options.emplace(lower_name, std::move(expr)); } } diff --git a/src/duckdb/src/planner/bind_context.cpp b/src/duckdb/src/planner/bind_context.cpp index 470a8bc37..d588f8805 100644 --- a/src/duckdb/src/planner/bind_context.cpp +++ b/src/duckdb/src/planner/bind_context.cpp @@ -34,7 +34,7 @@ string MinimumUniqueAlias(const BindingAlias &alias, const BindingAlias &other) return alias.ToString(); } -optional_ptr BindContext::GetMatchingBinding(const string &column_name) { +optional_ptr BindContext::GetMatchingBinding(const string &column_name, QueryErrorContext context) { optional_ptr result; for (auto &binding_ptr : bindings_list) { auto &binding = *binding_ptr; @@ -45,6 +45,7 @@ optional_ptr BindContext::GetMatchingBinding(const string &column_name) if (binding.HasMatchingBinding(column_name)) { if (result || is_using_binding) { throw BinderException( + context, "Ambiguous reference to column name \"%s\" (use: \"%s.%s\" " "or \"%s.%s\")", column_name, MinimumUniqueAlias(result->GetBindingAlias(), binding.GetBindingAlias()), column_name, @@ -548,7 +549,7 @@ void BindContext::GenerateAllColumnExpressions(StarExpression &expr, auto binding = GetBinding(expr.relation_name, error); bool is_struct_ref = false; if (!binding) { - binding = GetMatchingBinding(expr.relation_name); + binding = GetMatchingBinding(expr.relation_name, expr); if (!binding) { error.Throw(); } diff --git a/src/duckdb/src/planner/binder.cpp b/src/duckdb/src/planner/binder.cpp index 5d5be868e..fd2b68861 100644 --- a/src/duckdb/src/planner/binder.cpp +++ b/src/duckdb/src/planner/binder.cpp @@ -19,7 +19,9 @@ #include "duckdb/parser/tableref/table_function_ref.hpp" #include "duckdb/planner/bound_query_node.hpp" #include "duckdb/planner/expression.hpp" +#include "duckdb/planner/expression/bound_columnref_expression.hpp" #include "duckdb/planner/expression_binder/returning_binder.hpp" +#include "duckdb/planner/operator/logical_get.hpp" #include "duckdb/planner/operator/logical_projection.hpp" #include "duckdb/planner/operator/logical_sample.hpp" #include "duckdb/planner/query_node/list.hpp" @@ -365,6 +367,144 @@ void VerifyNotExcluded(const ParsedExpression &root_expr) { }); } +void Binder::BindDeleteReturningColumns(TableCatalogEntry &table, LogicalGet &get, vector &return_columns) { + // Build a mapping from storage column index to scan chunk index for RETURNING. + // This allows PhysicalDelete to pass columns through from the scan instead of + // fetching them by row ID. Generated columns will be computed by the RETURNING projection. + auto &column_ids = get.GetColumnIds(); + auto &columns = table.GetColumns(); + auto physical_count = columns.PhysicalColumnCount(); + + // Initialize the mapping with INVALID_INDEX + return_columns.resize(physical_count, DConstants::INVALID_INDEX); + + // First, map columns already in the scan to their storage indices + for (idx_t chunk_idx = 0; chunk_idx < column_ids.size(); chunk_idx++) { + auto &col_id = column_ids[chunk_idx]; + if (col_id.IsVirtualColumn()) { + continue; + } + // Get the column by logical index, then get its storage index + auto logical_idx = col_id.GetPrimaryIndex(); + auto &col = columns.GetColumn(LogicalIndex(logical_idx)); + if (!col.Generated()) { + auto storage_idx = col.StorageOid(); + return_columns[storage_idx] = chunk_idx; + } + } + + // Add any missing physical columns to the scan + for (auto &col : columns.Physical()) { + auto storage_idx = col.StorageOid(); + if (return_columns[storage_idx] == DConstants::INVALID_INDEX) { + return_columns[storage_idx] = column_ids.size(); + get.AddColumnId(col.Logical().index); + } + } +} + +//! Helper: convert scan column mapping to projection expression mapping for MERGE INTO +static void ConvertScanToProjectionMapping(TableCatalogEntry &table, const vector &scan_return_columns, + vector &return_columns, + vector> &projection_expressions, + LogicalOperator &target_binding) { + target_binding.ResolveOperatorTypes(); + auto target_bindings = target_binding.GetColumnBindings(); + auto &target_types = target_binding.types; + + auto physical_count = table.GetColumns().PhysicalColumnCount(); + return_columns.resize(physical_count, DConstants::INVALID_INDEX); + + for (idx_t storage_idx = 0; storage_idx < scan_return_columns.size(); storage_idx++) { + auto scan_idx = scan_return_columns[storage_idx]; + if (scan_idx != DConstants::INVALID_INDEX && scan_idx < target_bindings.size()) { + return_columns[storage_idx] = projection_expressions.size(); + projection_expressions.push_back( + make_uniq(target_types[scan_idx], target_bindings[scan_idx])); + } + } +} + +void Binder::BindDeleteReturningColumns(TableCatalogEntry &table, LogicalGet &get, vector &return_columns, + vector> &projection_expressions, + LogicalOperator &target_binding) { + vector scan_return_columns; + BindDeleteReturningColumns(table, get, scan_return_columns); + ConvertScanToProjectionMapping(table, scan_return_columns, return_columns, projection_expressions, target_binding); +} + +void Binder::BindDeleteIndexColumns(TableCatalogEntry &table, LogicalGet &get, vector &return_columns) { + // Build a mapping from storage column index to scan chunk index for unique index tracking. + // This is a sparse mapping - only indexed columns have valid indices. + // Used when DELETE has no RETURNING but table has unique indexes. + auto &storage = table.GetStorage(); + auto &info = storage.GetDataTableInfo(); + auto &indexes = info->GetIndexes(); + + // Collect column IDs from unique indexes + unordered_set indexed_column_ids; + indexes.Scan([&](Index &index) { + if (index.IsUnique()) { + auto &col_ids = index.GetColumnIdSet(); + indexed_column_ids.insert(col_ids.begin(), col_ids.end()); + } + return false; + }); + + if (indexed_column_ids.empty()) { + return; + } + + auto &column_ids = get.GetColumnIds(); + auto &columns = table.GetColumns(); + auto physical_count = columns.PhysicalColumnCount(); + + // Initialize the mapping with INVALID_INDEX + return_columns.resize(physical_count, DConstants::INVALID_INDEX); + + // First, map columns already in the scan to their storage indices + for (idx_t chunk_idx = 0; chunk_idx < column_ids.size(); chunk_idx++) { + auto &col_id = column_ids[chunk_idx]; + if (col_id.IsVirtualColumn()) { + continue; + } + auto logical_idx = col_id.GetPrimaryIndex(); + auto &col = columns.GetColumn(LogicalIndex(logical_idx)); + if (!col.Generated()) { + auto storage_idx = col.StorageOid(); + // Only map if this column is in a unique index + if (indexed_column_ids.count(storage_idx)) { + return_columns[storage_idx] = chunk_idx; + } + } + } + + // Add any missing indexed columns to the scan + for (auto col_idx : indexed_column_ids) { + if (return_columns[col_idx] == DConstants::INVALID_INDEX) { + return_columns[col_idx] = column_ids.size(); + // Find the logical index for this storage index + for (auto &col : columns.Physical()) { + if (col.StorageOid() == col_idx) { + get.AddColumnId(col.Logical().index); + break; + } + } + } + } +} + +void Binder::BindDeleteIndexColumns(TableCatalogEntry &table, LogicalGet &get, vector &return_columns, + vector> &projection_expressions, + LogicalOperator &target_binding) { + vector scan_return_columns; + BindDeleteIndexColumns(table, get, scan_return_columns); + if (!scan_return_columns.empty()) { + ConvertScanToProjectionMapping(table, scan_return_columns, return_columns, projection_expressions, + target_binding); + } +} + BoundStatement Binder::BindReturning(vector> returning_list, TableCatalogEntry &table, const string &alias, idx_t update_table_index, unique_ptr child_operator, virtual_column_map_t virtual_columns) { diff --git a/src/duckdb/src/planner/binder/expression/bind_collate_expression.cpp b/src/duckdb/src/planner/binder/expression/bind_collate_expression.cpp index 0bcb8d213..13988462e 100644 --- a/src/duckdb/src/planner/binder/expression/bind_collate_expression.cpp +++ b/src/duckdb/src/planner/binder/expression/bind_collate_expression.cpp @@ -16,7 +16,7 @@ BindResult ExpressionBinder::BindExpression(CollateExpression &expr, idx_t depth throw ParameterNotResolvedException(); } if (child->return_type.id() != LogicalTypeId::VARCHAR) { - throw BinderException("collations are only supported for type varchar"); + throw BinderException(child->query_location, "collations are only supported for type varchar"); } // Validate the collation, but don't use it auto collation_test = make_uniq_base(Value(child->return_type)); diff --git a/src/duckdb/src/planner/binder/expression/bind_columnref_expression.cpp b/src/duckdb/src/planner/binder/expression/bind_columnref_expression.cpp index ca6824599..45d541d9e 100644 --- a/src/duckdb/src/planner/binder/expression/bind_columnref_expression.cpp +++ b/src/duckdb/src/planner/binder/expression/bind_columnref_expression.cpp @@ -54,7 +54,8 @@ unique_ptr ExpressionBinder::GetSQLValueFunction(const string return make_uniq(value_function, std::move(children)); } -unique_ptr ExpressionBinder::QualifyColumnName(const string &column_name, ErrorData &error) { +unique_ptr ExpressionBinder::QualifyColumnName(const ParsedExpression &expr, + const string &column_name, ErrorData &error) { auto using_binding = binder.bind_context.GetUsingBinding(column_name); if (using_binding) { // we are referencing a USING column @@ -81,14 +82,14 @@ unique_ptr ExpressionBinder::QualifyColumnName(const string &c } // find a table binding that contains this column name - auto table_binding = binder.bind_context.GetMatchingBinding(column_name); + auto table_binding = binder.bind_context.GetMatchingBinding(column_name, expr); // throw an error if a macro parameter name conflicts with a column name auto is_macro_column = false; if (binder.macro_binding && binder.macro_binding->HasMatchingBinding(column_name)) { is_macro_column = true; if (table_binding) { - throw BinderException("Conflicting column names for column " + column_name + "!"); + throw BinderException(expr, "Conflicting column names for column " + column_name + "!"); } } @@ -341,7 +342,7 @@ unique_ptr ExpressionBinder::QualifyColumnNameWithManyDotsInte } // part1 could be a column ErrorData unused_error; - auto result_expr = QualifyColumnName(col_ref.column_names[0], unused_error); + auto result_expr = QualifyColumnName(col_ref, col_ref.column_names[0], unused_error); if (result_expr) { // it is! add the struct extract calls struct_extract_start = 1; @@ -462,7 +463,7 @@ unique_ptr ExpressionBinder::QualifyColumnName(ColumnRefExpres // no dots (i.e. "part1") // -> part1 refers to a column // check if we can qualify the column name with the table name - auto qualified_col_ref = QualifyColumnName(col_ref.GetColumnName(), error); + auto qualified_col_ref = QualifyColumnName(col_ref, col_ref.GetColumnName(), error); if (qualified_col_ref) { // we could: return it return qualified_col_ref; @@ -486,7 +487,7 @@ unique_ptr ExpressionBinder::QualifyColumnName(ColumnRefExpres // otherwise check if we can turn this into a struct extract ErrorData other_error; - auto qualified_col_ref = QualifyColumnName(col_ref.column_names[0], other_error); + auto qualified_col_ref = QualifyColumnName(col_ref, col_ref.column_names[0], other_error); if (qualified_col_ref) { // we could: create a struct extract return CreateStructExtract(std::move(qualified_col_ref), col_ref.column_names[1]); diff --git a/src/duckdb/src/planner/binder/expression/bind_type_expression.cpp b/src/duckdb/src/planner/binder/expression/bind_type_expression.cpp new file mode 100644 index 000000000..e2e8b9292 --- /dev/null +++ b/src/duckdb/src/planner/binder/expression/bind_type_expression.cpp @@ -0,0 +1,110 @@ +#include "duckdb/catalog/catalog.hpp" +#include "duckdb/execution/expression_executor.hpp" +#include "duckdb/planner/binder.hpp" +#include "duckdb/planner/expression/bound_constant_expression.hpp" +#include "duckdb/planner/expression_binder.hpp" +#include "duckdb/planner/expression_binder/constant_binder.hpp" +#include "duckdb/catalog/catalog_entry/type_catalog_entry.hpp" + +namespace duckdb { + +static bool IsValidTypeLookup(optional_ptr entry) { + if (!entry) { + return false; + } + return entry->Cast().user_type.id() != LogicalTypeId::INVALID; +} + +BindResult ExpressionBinder::BindExpression(TypeExpression &type_expr, idx_t depth) { + auto &type_name = type_expr.GetTypeName(); + auto type_schema = type_expr.GetSchema(); + auto type_catalog = type_expr.GetCatalog(); + + QueryErrorContext error_context(type_expr); + EntryLookupInfo type_lookup(CatalogType::TYPE_ENTRY, type_name, error_context); + + optional_ptr entry = nullptr; + + binder.BindSchemaOrCatalog(context, type_catalog, type_schema); + + // Required for WAL lookup to work + if (type_catalog.empty() && !DatabaseManager::Get(context).HasDefaultDatabase()) { + // Look in the system catalog if no catalog was specified + entry = binder.entry_retriever.GetEntry(SYSTEM_CATALOG, type_schema, type_lookup); + } else { + // Try to search from most specific to least specific + // The search path should already have been set to the correct catalog/schema, + // in case we are looking for a type in the same schema as a table we are creating + + entry = binder.entry_retriever.GetEntry(type_catalog, type_schema, type_lookup, OnEntryNotFound::RETURN_NULL); + + if (!IsValidTypeLookup(entry)) { + entry = binder.entry_retriever.GetEntry(type_catalog, INVALID_SCHEMA, type_lookup, + OnEntryNotFound::RETURN_NULL); + } + if (!IsValidTypeLookup(entry)) { + entry = binder.entry_retriever.GetEntry(INVALID_CATALOG, INVALID_SCHEMA, type_lookup, + OnEntryNotFound::RETURN_NULL); + } + if (!IsValidTypeLookup(entry)) { + entry = binder.entry_retriever.GetEntry(SYSTEM_CATALOG, DEFAULT_SCHEMA, type_lookup, + OnEntryNotFound::THROW_EXCEPTION); + } + } + + // By this point we have to have found a type in the catalog + D_ASSERT(entry != nullptr); + auto &type_entry = entry->Cast(); + + // Now handle type parameters + auto &unbound_parameters = type_expr.GetChildren(); + + if (!type_entry.bind_function) { + if (!unbound_parameters.empty()) { + // This type does not support type parameters + throw BinderException(type_expr, "Type '%s' does not take any type parameters", type_name); + } + + // Otherwise, return the user type directly! + auto result_expr = make_uniq(Value::TYPE(type_entry.user_type)); + result_expr->query_location = type_expr.GetQueryLocation(); + return BindResult(std::move(result_expr)); + } + + // Bind value parameters + vector bound_parameters; + + for (auto ¶m : unbound_parameters) { + // Otherwise, try to fold it to a constant value + ConstantBinder binder(this->binder, context, StringUtil::Format("Type parameter for type '%s'", type_name)); + + auto expr = param->Copy(); + auto bound_expr = binder.Bind(expr); + + if (!bound_expr->IsFoldable()) { + throw BinderException(type_expr, "Type parameter expression for type '%s' is not a constant", type_name); + } + + // Shortcut for constant expressions + if (bound_expr->GetExpressionClass() == ExpressionClass::BOUND_CONSTANT) { + auto &const_expr = bound_expr->Cast(); + bound_parameters.emplace_back(param->GetAlias(), const_expr.value); + continue; + } + + // Otherwise we need to evaluate the expression + auto bound_param = ExpressionExecutor::EvaluateScalar(context, *bound_expr); + bound_parameters.emplace_back(param->GetAlias(), bound_param); + }; + + // Call the bind function + BindLogicalTypeInput input {context, type_entry.user_type, bound_parameters}; + auto result_type = type_entry.bind_function(input); + + // Return the resulting type! + auto result_expr = make_uniq(Value::TYPE(result_type)); + result_expr->query_location = type_expr.GetQueryLocation(); + return BindResult(std::move(result_expr)); +} + +} // namespace duckdb diff --git a/src/duckdb/src/planner/binder/query_node/bind_recursive_cte_node.cpp b/src/duckdb/src/planner/binder/query_node/bind_recursive_cte_node.cpp index efc9740de..dbbdfa382 100644 --- a/src/duckdb/src/planner/binder/query_node/bind_recursive_cte_node.cpp +++ b/src/duckdb/src/planner/binder/query_node/bind_recursive_cte_node.cpp @@ -41,10 +41,8 @@ BoundStatement Binder::BindNode(RecursiveCTENode &statement) { // Add bindings of left side to temporary CTE bindings context BindingAlias cte_alias(statement.ctename); right_binder->bind_context.AddCTEBinding(setop_index, std::move(cte_alias), result.names, result.types); - if (!statement.key_targets.empty()) { - BindingAlias recurring_alias("recurring", statement.ctename); - right_binder->bind_context.AddCTEBinding(setop_index, std::move(recurring_alias), result.names, result.types); - } + BindingAlias recurring_alias("recurring", statement.ctename); + right_binder->bind_context.AddCTEBinding(setop_index, std::move(recurring_alias), result.names, result.types); auto right = right_binder->BindNode(*statement.right); for (auto &c : left_binder->correlated_columns) { @@ -91,9 +89,6 @@ BoundStatement Binder::BindNode(RecursiveCTENode &statement) { auto recurring_binding = right_binder->GetCTEBinding(BindingAlias("recurring", ctename)); bool ref_recurring = recurring_binding && recurring_binding->IsReferenced(); - if (key_targets.empty() && ref_recurring) { - throw InvalidInputException("RECURRING can only be used with USING KEY in recursive CTE."); - } // Check if there is a reference to the recursive or recurring table, if not create a set operator. auto cte_binding = right_binder->GetCTEBinding(BindingAlias(ctename)); diff --git a/src/duckdb/src/planner/binder/query_node/plan_subquery.cpp b/src/duckdb/src/planner/binder/query_node/plan_subquery.cpp index 40aad85bb..f4cfc84fd 100644 --- a/src/duckdb/src/planner/binder/query_node/plan_subquery.cpp +++ b/src/duckdb/src/planner/binder/query_node/plan_subquery.cpp @@ -184,30 +184,25 @@ static unique_ptr PlanUncorrelatedSubquery(Binder &binder, BoundSubq FunctionBinder function_binder(binder); auto struct_expr = function_binder.BindScalarFunction(RowFun::GetFunction(), std::move(struct_children)); - JoinCondition cond; - cond.left = std::move(expr.children[0]); - cond.right = std::move(struct_expr); - cond.comparison = expr.comparison_type; + JoinCondition cond(std::move(expr.children[0]), std::move(struct_expr), expr.comparison_type); // push collations - ExpressionBinder::PushCollation(binder.context, cond.left, cond.left->return_type); - ExpressionBinder::PushCollation(binder.context, cond.right, cond.right->return_type); + ExpressionBinder::PushCollation(binder.context, cond.LeftReference(), cond.GetLHS().return_type); + ExpressionBinder::PushCollation(binder.context, cond.RightReference(), cond.GetRHS().return_type); join->conditions.push_back(std::move(cond)); } else { // Standard case: compare each child separately for (idx_t child_idx = 0; child_idx < expr.children.size(); child_idx++) { - JoinCondition cond; - cond.left = std::move(expr.children[child_idx]); auto &child_type = expr.child_types[child_idx]; auto &compare_type = expr.child_targets[child_idx]; - cond.right = BoundCastExpression::AddDefaultCastToType( + auto right_expr = BoundCastExpression::AddDefaultCastToType( make_uniq(child_type, plan_columns[child_idx]), compare_type); - cond.comparison = expr.comparison_type; + JoinCondition cond(std::move(expr.children[child_idx]), std::move(right_expr), expr.comparison_type); // push collations - ExpressionBinder::PushCollation(binder.context, cond.left, compare_type); - ExpressionBinder::PushCollation(binder.context, cond.right, compare_type); + ExpressionBinder::PushCollation(binder.context, cond.LeftReference(), compare_type); + ExpressionBinder::PushCollation(binder.context, cond.RightReference(), compare_type); join->conditions.push_back(std::move(cond)); } @@ -444,14 +439,23 @@ unique_ptr Binder::PlanLateralJoin(unique_ptr // scan the right operator for correlated columns // correlated LATERAL JOIN vector conditions; - vector> arbitrary_expressions; if (condition) { if (condition->HasSubquery()) { throw BinderException(*condition, "Subqueries are not supported in LATERAL join conditions"); } // extract join conditions, if there are any LogicalComparisonJoin::ExtractJoinConditions(context, join_type, JoinRefType::REGULAR, left, right, - std::move(condition), conditions, arbitrary_expressions); + std::move(condition), conditions); + } + + vector comparison_conditions; + vector> non_comparison_conditions; + for (auto &cond : conditions) { + if (cond.IsComparison()) { + comparison_conditions.push_back(std::move(cond)); + } else { + non_comparison_conditions.push_back(JoinCondition::CreateExpression(std::move(cond))); + } } auto perform_delim = PerformDuplicateElimination(*this, correlated); @@ -462,8 +466,8 @@ unique_ptr Binder::PlanLateralJoin(unique_ptr delim_join->any_join = false; delim_join->propagate_null_values = join_type != JoinType::INNER; delim_join->is_lateral_join = true; - delim_join->arbitrary_expressions = std::move(arbitrary_expressions); - delim_join->conditions = std::move(conditions); + delim_join->arbitrary_expressions = std::move(non_comparison_conditions); + delim_join->conditions = std::move(comparison_conditions); delim_join->AddChild(std::move(right)); return std::move(delim_join); } diff --git a/src/duckdb/src/planner/binder/statement/bind_copy.cpp b/src/duckdb/src/planner/binder/statement/bind_copy.cpp index 7a6944b4a..b627e7fb1 100644 --- a/src/duckdb/src/planner/binder/statement/bind_copy.cpp +++ b/src/duckdb/src/planner/binder/statement/bind_copy.cpp @@ -422,10 +422,21 @@ vector BindCopyOption(ClientContext &context, TableFunctionBinder &option return result; } } + const bool is_partition_by = StringUtil::CIEquals(name, "partition_by"); + + if (is_partition_by) { + //! When binding the 'partition_by' option, we don't want to resolve a column reference to a SQLValueFunction + //! (like 'user') + option_binder.DisableSQLValueFunctions(); + } auto bound_expr = option_binder.Bind(expr); if (bound_expr->HasParameter()) { throw ParameterNotResolvedException(); } + if (is_partition_by) { + option_binder.EnableSQLValueFunctions(); + } + auto val = ExpressionExecutor::EvaluateScalar(context, *bound_expr, true); if (val.IsNull()) { throw BinderException("NULL is not supported as a valid option for COPY option \"" + name + "\""); diff --git a/src/duckdb/src/planner/binder/statement/bind_create.cpp b/src/duckdb/src/planner/binder/statement/bind_create.cpp index 735f5de49..6d4a86406 100644 --- a/src/duckdb/src/planner/binder/statement/bind_create.cpp +++ b/src/duckdb/src/planner/binder/statement/bind_create.cpp @@ -44,6 +44,8 @@ #include "duckdb/common/type_visitor.hpp" #include "duckdb/function/table_macro_function.hpp" #include "duckdb/main/settings.hpp" +#include "duckdb/parser/expression/type_expression.hpp" +#include "duckdb/planner/expression/bound_constant_expression.hpp" namespace duckdb { @@ -159,36 +161,41 @@ void Binder::SetCatalogLookupCallback(catalog_entry_callback_t callback) { entry_retriever.SetCallback(std::move(callback)); } -void Binder::BindCreateViewInfo(CreateViewInfo &base) { - // bind the view as if it were a query so we can catch errors - // note that we bind the original, and replace the original with a copy +void Binder::BindView(ClientContext &context, const SelectStatement &stmt, const string &catalog_name, + const string &schema_name, optional_ptr dependencies, + const vector &aliases, vector &result_types, vector &result_names) { auto view_binder = Binder::CreateBinder(context); - auto &dependencies = base.dependencies; - auto &catalog = Catalog::GetCatalog(context, base.catalog); + auto &catalog = Catalog::GetCatalog(context, catalog_name); - bool should_create_dependencies = Settings::Get(context); - if (should_create_dependencies) { + if (dependencies) { view_binder->SetCatalogLookupCallback([&dependencies, &catalog](CatalogEntry &entry) { if (&catalog != &entry.ParentCatalog()) { // Don't register dependencies between catalogs return; } - dependencies.AddDependency(entry); + dependencies->AddDependency(entry); }); } view_binder->can_contain_nulls = true; - auto view_search_path = GetSearchPath(catalog, base.schema); + auto view_search_path = view_binder->GetSearchPath(catalog, schema_name); view_binder->entry_retriever.SetSearchPath(std::move(view_search_path)); - auto copy = base.query->Copy(); - auto query_node = view_binder->Bind(*base.query); - base.query = unique_ptr_cast(std::move(copy)); - if (base.aliases.size() > query_node.names.size()) { + auto copy = stmt.Copy(); + auto query_node = view_binder->Bind(*copy); + if (aliases.size() > query_node.names.size()) { throw BinderException("More VIEW aliases than columns in query result"); } - base.types = query_node.types; - base.names = query_node.names; + result_types = query_node.types; + result_names = query_node.names; +} + +void Binder::BindCreateViewInfo(CreateViewInfo &base) { + optional_ptr dependencies; + if (Settings::Get(context)) { + dependencies = base.dependencies; + } + BindView(context, *base.query, base.catalog, base.schema, dependencies, base.aliases, base.types, base.names); } SchemaCatalogEntry &Binder::BindCreateFunctionInfo(CreateInfo &info) { @@ -264,14 +271,40 @@ SchemaCatalogEntry &Binder::BindCreateFunctionInfo(CreateInfo &info) { }); } + // Constant-fold all default parameter expressions + for (auto &it : function->default_parameters) { + auto ¶m_name = it.first; + auto ¶m_expr = it.second; + + if (param_expr->type == ExpressionType::VALUE_CONSTANT) { + continue; + } + + ConstantBinder binder(*this, context, StringUtil::Format("Default value for parameter '%s'", param_name)); + auto default_expr = param_expr->Copy(); + auto bound_default = binder.Bind(default_expr); + if (!bound_default->IsFoldable()) { + auto msg = StringUtil::Format("Default value '%s' for parameter '%s' is not a constant expression.", + param_expr->ToString(), param_name); + throw BinderException(msg); + } + + auto default_val = ExpressionExecutor::EvaluateScalar(context, *bound_default); + + // Save this back as a constant expression + auto const_expr = make_uniq(default_val); + const_expr->alias = param_name; + it.second = std::move(const_expr); + } + // Resolve any user type arguments for (idx_t param_idx = 0; param_idx < function->types.size(); param_idx++) { auto &type = function->types[param_idx]; if (type.id() == LogicalTypeId::UNKNOWN) { continue; } - if (type.id() == LogicalTypeId::USER) { - type = TransformStringToLogicalType(type.ToString(), context); + if (type.id() == LogicalTypeId::UNBOUND) { + BindLogicalType(type); } const auto ¶m_name = function->parameters[param_idx]->Cast().GetColumnName(); auto it = function->default_parameters.find(param_name); @@ -364,132 +397,49 @@ SchemaCatalogEntry &Binder::BindCreateFunctionInfo(CreateInfo &info) { return BindCreateSchema(info); } -static bool IsValidUserType(optional_ptr entry) { - if (!entry) { - return false; - } - return entry->Cast().user_type.id() != LogicalTypeId::INVALID; -} +LogicalType Binder::BindLogicalTypeInternal(const unique_ptr &type_expr) { + ConstantBinder binder(*this, context, "Type binding"); + auto copy = type_expr->Copy(); + auto expr = binder.Bind(copy); -LogicalType Binder::BindLogicalTypeInternal(const LogicalType &type, optional_ptr catalog, - const string &schema) { - if (type.id() != LogicalTypeId::USER) { - // Nested type, make sure to bind any nested user types recursively - LogicalType result; - switch (type.id()) { - case LogicalTypeId::LIST: { - auto child_type = BindLogicalTypeInternal(ListType::GetChildType(type), catalog, schema); - result = LogicalType::LIST(child_type); - break; - } - case LogicalTypeId::MAP: { - auto key_type = BindLogicalTypeInternal(MapType::KeyType(type), catalog, schema); - auto value_type = BindLogicalTypeInternal(MapType::ValueType(type), catalog, schema); - result = LogicalType::MAP(std::move(key_type), std::move(value_type)); - break; - } - case LogicalTypeId::ARRAY: { - auto child_type = BindLogicalTypeInternal(ArrayType::GetChildType(type), catalog, schema); - auto array_size = ArrayType::GetSize(type); - result = LogicalType::ARRAY(child_type, array_size); - break; - } - case LogicalTypeId::STRUCT: { - auto child_types = StructType::GetChildTypes(type); - child_list_t new_child_types; - for (auto &entry : child_types) { - new_child_types.emplace_back(entry.first, BindLogicalTypeInternal(entry.second, catalog, schema)); - } - result = LogicalType::STRUCT(std::move(new_child_types)); - break; - } - case LogicalTypeId::UNION: { - child_list_t member_types; - for (idx_t i = 0; i < UnionType::GetMemberCount(type); i++) { - auto child_type = BindLogicalTypeInternal(UnionType::GetMemberType(type, i), catalog, schema); - member_types.emplace_back(UnionType::GetMemberName(type, i), std::move(child_type)); - } - result = LogicalType::UNION(std::move(member_types)); - break; - } - default: - return type; - } - - // Set the alias and extension info back - result.SetAlias(type.GetAlias()); - auto ext_info = type.HasExtensionInfo() ? make_uniq(*type.GetExtensionInfo()) : nullptr; - result.SetExtensionInfo(std::move(ext_info)); - return result; + if (!expr->IsFoldable()) { + throw BinderException(*type_expr, "Type expression is not constant"); } - // User type, bind the user type - auto user_type_name = UserType::GetTypeName(type); - auto user_type_schema = UserType::GetSchema(type); - auto user_type_mods = UserType::GetTypeModifiers(type); - - bind_logical_type_function_t user_bind_modifiers_func = nullptr; - - LogicalType result; - EntryLookupInfo type_lookup(CatalogType::TYPE_ENTRY, user_type_name); - if (catalog) { - // The search order is: - // 1) In the explicitly set schema (my_schema.my_type) - // 2) In the same schema as the table - // 3) In the same catalog - // 4) System catalog - - optional_ptr entry = nullptr; - if (!user_type_schema.empty()) { - entry = entry_retriever.GetEntry(*catalog, user_type_schema, type_lookup, OnEntryNotFound::RETURN_NULL); - } - if (!IsValidUserType(entry)) { - entry = entry_retriever.GetEntry(*catalog, schema, type_lookup, OnEntryNotFound::RETURN_NULL); - } - if (!IsValidUserType(entry)) { - entry = entry_retriever.GetEntry(*catalog, INVALID_SCHEMA, type_lookup, OnEntryNotFound::RETURN_NULL); - } - if (!IsValidUserType(entry)) { - entry = entry_retriever.GetEntry(INVALID_CATALOG, INVALID_SCHEMA, type_lookup, - OnEntryNotFound::THROW_EXCEPTION); - } - auto &type_entry = entry->Cast(); - result = type_entry.user_type; - user_bind_modifiers_func = type_entry.bind_function; - } else { - string type_catalog = UserType::GetCatalog(type); - string type_schema = UserType::GetSchema(type); - - BindSchemaOrCatalog(context, type_catalog, type_schema); - auto entry = entry_retriever.GetEntry(type_catalog, type_schema, type_lookup); - auto &type_entry = entry->Cast(); - result = type_entry.user_type; - user_bind_modifiers_func = type_entry.bind_function; + if (expr->return_type != LogicalTypeId::TYPE) { + throw BinderException(*type_expr, "Expected a type returning expression, but got expression of type '%s'", + expr->return_type.ToString()); } - // Now we bind the inner user type - BindLogicalType(result, catalog, schema); - - // Apply the type modifiers (if any) - if (user_bind_modifiers_func) { - // If an explicit bind_modifiers function was provided, use that to construct the type - - BindLogicalTypeInput input {context, result, user_type_mods}; - result = user_bind_modifiers_func(input); - } else { - if (!user_type_mods.empty()) { - throw BinderException("Type '%s' does not take any type modifiers", user_type_name); - } + // Shortcut for constant expressions + if (expr->GetExpressionClass() == ExpressionClass::BOUND_CONSTANT) { + auto &const_expr = expr->Cast(); + return TypeValue::GetType(const_expr.value); } - return result; + + // Else, evaluate the type expression + auto type_value = ExpressionExecutor::EvaluateScalar(context, *expr); + D_ASSERT(type_value.type().id() == LogicalTypeId::TYPE); + return TypeValue::GetType(type_value); } -void Binder::BindLogicalType(LogicalType &type, optional_ptr catalog, const string &schema) { - // check if we need to bind this type at all - if (!TypeVisitor::Contains(type, LogicalTypeId::USER)) { +void Binder::BindLogicalType(LogicalType &type) { + // Check if we need to bind this type at all + if (!TypeVisitor::Contains(type, LogicalTypeId::UNBOUND)) { return; } - type = BindLogicalTypeInternal(type, catalog, schema); + + // Replace all unbound types within the type + // Normally, the unbound type is the root type, but it can also be nested within other types if we e.g. + // alter-table and change a struct field. + type = TypeVisitor::VisitReplace(type, [&](const LogicalType &ty) { + if (ty.id() == LogicalTypeId::UNBOUND) { + auto &type_expr = UnboundType::GetTypeExpression(ty); + return BindLogicalTypeInternal(type_expr); + } + + return ty; + }); } unique_ptr DuckCatalog::BindCreateIndex(Binder &binder, CreateStatement &stmt, @@ -621,26 +571,10 @@ BoundStatement Binder::Bind(CreateStatement &stmt) { } result.plan->AddChild(std::move(query)); - } else if (create_type_info.type.id() == LogicalTypeId::USER) { - SetCatalogLookupCallback(dependency_callback); - // two cases: - // 1: create a type with a non-existent type as source, Binder::BindLogicalType(...) will throw exception. - // 2: create a type alias with a custom type. - // eg. CREATE TYPE a AS INT; CREATE TYPE b AS a; - // We set b to be an alias for the underlying type of a - - EntryLookupInfo type_lookup(CatalogType::TYPE_ENTRY, UserType::GetTypeName(create_type_info.type)); - auto type_entry_p = entry_retriever.GetEntry(schema.catalog.GetName(), schema.name, type_lookup); - D_ASSERT(type_entry_p); - auto &type_entry = type_entry_p->Cast(); - create_type_info.type = type_entry.user_type; } else { SetCatalogLookupCallback(dependency_callback); - // This is done so that if the type contains a USER type, - // we register this dependency - auto preserved_type = create_type_info.type; + // Bind the underlying type BindLogicalType(create_type_info.type); - create_type_info.type = preserved_type; } break; } diff --git a/src/duckdb/src/planner/binder/statement/bind_create_table.cpp b/src/duckdb/src/planner/binder/statement/bind_create_table.cpp index ac8a32f65..4ba4eb686 100644 --- a/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +++ b/src/duckdb/src/planner/binder/statement/bind_create_table.cpp @@ -23,6 +23,7 @@ #include "duckdb/parser/parsed_expression_iterator.hpp" #include "duckdb/storage/data_table.hpp" #include "duckdb/storage/storage_manager.hpp" +#include "duckdb/common/type_visitor.hpp" namespace duckdb { @@ -55,7 +56,7 @@ static void VerifyCompressionType(ClientContext &context, optional_ptr( context, INVALID_CATALOG, INVALID_SCHEMA, logical_type.GetAlias(), OnEntryNotFound::RETURN_NULL); @@ -284,6 +285,7 @@ void Binder::BindGeneratedColumns(BoundCreateTableInfo &info) { continue; } D_ASSERT(col.Generated()); + auto expression = col.GeneratedExpression().Copy(); auto bound_expression = expr_binder.Bind(expression); @@ -299,7 +301,12 @@ void Binder::BindGeneratedColumns(BoundCreateTableInfo &info) { // Update the type in the binding, for future expansions table_binding->SetColumnType(i.index, col.Type()); + } else if (col.Type().id() == LogicalTypeId::UNBOUND) { + // Bind column type + BindLogicalType(col.TypeMutable()); + table_binding->SetColumnType(i.index, col.Type()); } + bound_indices.insert(i); } } @@ -352,8 +359,8 @@ unique_ptr Binder::BindCreateTableCheckpoint(unique_ptr &gcols, - bool &contains_gcol) { +static void ExpressionContainsGeneratedColumn(const ParsedExpression &root_expr, const unordered_set &gcols, + bool &contains_gcol) { ParsedExpressionIterator::VisitExpression(root_expr, [&](const ColumnRefExpression &column_ref) { auto &name = column_ref.GetColumnName(); @@ -596,6 +603,10 @@ unique_ptr Binder::BindCreateTableInfo(unique_ptrSetSearchPath(result->schema.catalog, result->schema.name); + vector> bound_constraints; if (base.query) { // construct the result object @@ -631,23 +642,34 @@ unique_ptr Binder::BindCreateTableInfo(unique_ptrschema.catalog, result->schema.name); + type_binder->BindLogicalType(column.TypeMutable()); } + } else { SetCatalogLookupCallback([&dependencies, &schema](CatalogEntry &entry) { if (&schema.ParentCatalog() != &entry.ParentCatalog()) { // Don't register dependencies between catalogs return; } + + if (entry.type == CatalogType::TYPE_ENTRY && entry.internal) { + // Don't register dependencies on internal types + return; + } + dependencies.AddDependency(entry); }); + // Bind all physical column types + for (idx_t i = 0; i < base.columns.PhysicalColumnCount(); i++) { + auto &column = base.columns.GetColumnMutable(PhysicalIndex(i)); + type_binder->BindLogicalType(column.TypeMutable()); + } + auto &config = DBConfig::Get(catalog.GetAttached()); VerifyCompressionType(context, storage_manager, config, *result); CreateColumnDependencyManager(*result); @@ -655,14 +677,6 @@ unique_ptr Binder::BindCreateTableInfo(unique_ptrschema.catalog, result->schema.name); - } BindCreateTableConstraints(base, entry_retriever, schema); if (AnyConstraintReferencesGeneratedColumn(base)) { @@ -681,6 +695,16 @@ unique_ptr Binder::BindCreateTableInfo(unique_ptrdependencies.VerifyDependencies(schema.catalog, result->Base().table); +#ifdef DEBUG + // Ensure all types are bound + for (idx_t i = 0; i < base.columns.LogicalColumnCount(); i++) { + auto &column = base.columns.GetColumn(LogicalIndex(i)); + if (TypeVisitor::Contains(column.Type(), LogicalTypeId::UNBOUND)) { + throw InternalException("Unbound type remaining in column \"%s\" during Create Table bind", column.Name()); + } + } +#endif + auto &properties = GetStatementProperties(); properties.output_type = QueryResultOutputType::FORCE_MATERIALIZED; return result; diff --git a/src/duckdb/src/planner/binder/statement/bind_delete.cpp b/src/duckdb/src/planner/binder/statement/bind_delete.cpp index e38cb7669..c965282c9 100644 --- a/src/duckdb/src/planner/binder/statement/bind_delete.cpp +++ b/src/duckdb/src/planner/binder/statement/bind_delete.cpp @@ -7,6 +7,7 @@ #include "duckdb/planner/operator/logical_get.hpp" #include "duckdb/planner/operator/logical_cross_product.hpp" #include "duckdb/catalog/catalog_entry/table_catalog_entry.hpp" +#include "duckdb/storage/data_table.hpp" namespace duckdb { @@ -64,39 +65,17 @@ BoundStatement Binder::Bind(DeleteStatement &stmt) { auto del = make_uniq(table, GenerateTableIndex()); del->bound_constraints = BindConstraints(table); - // If RETURNING is present, add all physical table columns to the scan so we can pass them through - // instead of having to fetch them by row ID in PhysicalDelete. - // Generated columns will be computed in the RETURNING projection by the binder. + // Add columns to the scan to avoid fetching by row ID in PhysicalDelete: + // - If RETURNING: add all physical columns (for RETURNING projection) + // - Else if unique indexes exist: add only indexed columns (for delete index tracking) if (!stmt.returning_list.empty()) { - auto &column_ids = get.GetColumnIds(); - auto &columns = table.GetColumns(); - auto physical_count = columns.PhysicalColumnCount(); - - // Build a map from storage index -> input chunk index - // return_columns[storage_idx] = input_chunk_idx - del->return_columns.resize(physical_count, DConstants::INVALID_INDEX); - - // First, map columns already in the scan to their storage indices - for (idx_t chunk_idx = 0; chunk_idx < column_ids.size(); chunk_idx++) { - auto &col_id = column_ids[chunk_idx]; - if (col_id.IsVirtualColumn()) { - continue; - } - // Get the column by logical index, then get its storage index - auto logical_idx = col_id.GetPrimaryIndex(); - if (!columns.GetColumn(LogicalIndex(logical_idx)).Generated()) { - auto storage_idx = columns.GetColumn(LogicalIndex(logical_idx)).StorageOid(); - del->return_columns[storage_idx] = chunk_idx; - } - } - - // Add any missing physical columns to the scan - for (auto &col : columns.Physical()) { - auto storage_idx = col.StorageOid(); - if (del->return_columns[storage_idx] == DConstants::INVALID_INDEX) { - del->return_columns[storage_idx] = column_ids.size(); - get.AddColumnId(col.Logical().index); - } + // Add all physical columns for RETURNING + BindDeleteReturningColumns(table, get, del->return_columns); + } else if (table.IsDuckTable()) { + // Only optimize for DuckDB tables (not attached external tables like SQLite) + auto &storage = table.GetStorage(); + if (storage.HasUniqueIndexes()) { + BindDeleteIndexColumns(table, get, del->return_columns); } } diff --git a/src/duckdb/src/planner/binder/statement/bind_insert.cpp b/src/duckdb/src/planner/binder/statement/bind_insert.cpp index f9c073ad9..0d44ac5ac 100644 --- a/src/duckdb/src/planner/binder/statement/bind_insert.cpp +++ b/src/duckdb/src/planner/binder/statement/bind_insert.cpp @@ -387,9 +387,10 @@ unique_ptr Binder::GenerateMergeInto(InsertStatement &stmt, named_column_map.push_back(col.Logical()); } } else { + // Ensure that the columns are valid. for (auto &col_name : stmt.columns) { - auto &col = table.GetColumn(col_name); - named_column_map.push_back(col.Logical()); + auto col_idx = table.GetColumnIndex(col_name); + named_column_map.push_back(col_idx); } } ExpandDefaultInValuesList(stmt, table, values_list, named_column_map); diff --git a/src/duckdb/src/planner/binder/statement/bind_merge_into.cpp b/src/duckdb/src/planner/binder/statement/bind_merge_into.cpp index dcc37e017..79dbaef26 100644 --- a/src/duckdb/src/planner/binder/statement/bind_merge_into.cpp +++ b/src/duckdb/src/planner/binder/statement/bind_merge_into.cpp @@ -368,6 +368,40 @@ BoundStatement Binder::Bind(MergeIntoStatement &stmt) { projection_expressions.push_back(std::move(marker_ref)); } + // Check if we have a DELETE action + bool has_delete_action = false; + for (auto &entry : merge_into->actions) { + for (auto &action : entry.second) { + if (action->action_type == MergeActionType::MERGE_DELETE) { + has_delete_action = true; + break; + } + } + if (has_delete_action) { + break; + } + } + + // If RETURNING is present and we have a DELETE action, add all physical columns to the scan + // so we can pass them through instead of fetching by row ID in PhysicalDelete. + // Generated columns will be computed in the RETURNING projection by the binder. + if (has_delete_action) { + if (!stmt.returning_list.empty()) { + // Use the overloaded helper to add physical columns to the scan and build projection expressions + auto &target_binding = join_ref.get().children[inverted ? 0 : 1]; + BindDeleteReturningColumns(table, get, merge_into->delete_return_columns, projection_expressions, + *target_binding); + } else if (table.IsDuckTable()) { + // Only optimize for DuckDB tables (not attached external tables like SQLite) + auto &storage = table.GetStorage(); + if (storage.HasUniqueIndexes()) { + auto &target_binding = join_ref.get().children[inverted ? 0 : 1]; + BindDeleteIndexColumns(table, get, merge_into->delete_return_columns, projection_expressions, + *target_binding); + } + } + } + merge_into->row_id_start = projection_expressions.size(); // finally bind the row id column and add them to the projection list BindRowIdColumns(table, get, projection_expressions); diff --git a/src/duckdb/src/planner/binder/statement/bind_simple.cpp b/src/duckdb/src/planner/binder/statement/bind_simple.cpp index f21f26b9f..31869ac1b 100644 --- a/src/duckdb/src/planner/binder/statement/bind_simple.cpp +++ b/src/duckdb/src/planner/binder/statement/bind_simple.cpp @@ -76,6 +76,28 @@ BoundStatement Binder::BindAlterAddIndex(BoundStatement &result, CatalogEntry &e return std::move(result); } +static void BindAlterTypes(Binder &binder, AlterStatement &stmt) { + if (stmt.info->type == AlterType::ALTER_TABLE) { + auto &table_info = stmt.info->Cast(); + switch (table_info.alter_table_type) { + case AlterTableType::ADD_COLUMN: { + auto &add_info = table_info.Cast(); + binder.BindLogicalType(add_info.new_column.TypeMutable()); + } break; + case AlterTableType::ADD_FIELD: { + auto &add_info = table_info.Cast(); + binder.BindLogicalType(add_info.new_field.TypeMutable()); + } break; + case AlterTableType::ALTER_COLUMN_TYPE: { + auto &alter_column_info = table_info.Cast(); + binder.BindLogicalType(alter_column_info.target_type); + } break; + default: + break; + } + } +} + BoundStatement Binder::Bind(AlterStatement &stmt) { BoundStatement result; result.names = {"Success"}; @@ -97,7 +119,11 @@ BoundStatement Binder::Bind(AlterStatement &stmt) { // Extra step for column comments: They can alter a table or a view, and we resolve that here. auto &info = stmt.info->Cast(); entry = info.TryResolveCatalogEntry(entry_retriever); - + if (entry && info.catalog_entry_type == CatalogType::VIEW_ENTRY) { + // when running SET COLUMN on a VIEW - ensure the view is bound + auto &view = entry->Cast(); + view.BindView(context); + } } else { // For any other ALTER, we retrieve the catalog entry directly. EntryLookupInfo lookup_info(stmt.info->GetCatalogType(), stmt.info->name); @@ -107,12 +133,22 @@ BoundStatement Binder::Bind(AlterStatement &stmt) { auto &properties = GetStatementProperties(); properties.return_type = StatementReturnType::NOTHING; if (!entry) { + // Bind types in this binder + BindAlterTypes(*this, stmt); + result.plan = make_uniq(LogicalOperatorType::LOGICAL_ALTER, std::move(stmt.info)); return result; } D_ASSERT(!entry->deleted); auto &catalog = entry->ParentCatalog(); + + // Bind types in the same catalog as the entry + auto type_binder = Binder::CreateBinder(context, *this); + type_binder->SetSearchPath(catalog, stmt.info->schema); + + BindAlterTypes(*type_binder, stmt); + if (catalog.IsSystemCatalog()) { throw BinderException("Can not comment on System Catalog entries"); } diff --git a/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp b/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp index f2ad149a3..8b790b727 100644 --- a/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp +++ b/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp @@ -111,14 +111,9 @@ vector Binder::GetSearchPath(Catalog &catalog, const string return view_search_path; } -static vector ExchangeAllNullTypes(const vector &types) { - vector result = types; - for (auto &type : result) { - if (ExpressionBinder::ContainsNullType(type)) { - type = ExpressionBinder::ExchangeNullType(type); - } - } - return result; +void Binder::SetSearchPath(Catalog &catalog, const string &schema) { + auto search_path = GetSearchPath(catalog, schema); + entry_retriever.SetSearchPath(std::move(search_path)); } BoundStatement Binder::Bind(BaseTableRef &ref) { @@ -293,13 +288,17 @@ BoundStatement Binder::Bind(BaseTableRef &ref) { SubqueryRef subquery(unique_ptr_cast(std::move(query))); subquery.alias = ref.alias; - // construct view names by first (1) taking the view aliases, (2) adding the view names, then (3) applying - // subquery aliases - vector view_names = view_catalog_entry.aliases; - for (idx_t n = view_names.size(); n < view_catalog_entry.names.size(); n++) { - view_names.push_back(view_catalog_entry.names[n]); + // construct view names by taking the view aliases + subquery.column_name_alias = view_catalog_entry.aliases; + // now apply the subquery column aliases + for (idx_t i = 0; i < ref.column_name_alias.size(); i++) { + if (i < subquery.column_name_alias.size()) { + // override alias + subquery.column_name_alias[i] = ref.column_name_alias[i]; + } else { + subquery.column_name_alias.push_back(ref.column_name_alias[i]); + } } - subquery.column_name_alias = BindContext::AliasColumnNames(ref.table_name, view_names, ref.column_name_alias); // when binding a view, we always look into the catalog/schema where the view is stored first auto view_search_path = @@ -314,31 +313,8 @@ BoundStatement Binder::Bind(BaseTableRef &ref) { if (!view_binder->correlated_columns.empty()) { throw BinderException("Contents of view were altered - view bound correlated columns"); } - - // verify that the types and names match up with the expected types and names if the view has type info defined - if (GetBindingMode() != BindingMode::EXTRACT_NAMES && - GetBindingMode() != BindingMode::EXTRACT_QUALIFIED_NAMES && view_catalog_entry.HasTypes()) { - // we bind the view subquery and the original view with different "can_contain_nulls", - // but we don't want to throw an error when SQLNULL does not match up with INTEGER, - // so we exchange all SQLNULL with INTEGER here before comparing - auto bound_types = ExchangeAllNullTypes(bound_child.types); - auto view_types = ExchangeAllNullTypes(view_catalog_entry.types); - if (bound_types != view_types) { - auto actual_types = StringUtil::ToString(bound_types, ", "); - auto expected_types = StringUtil::ToString(view_types, ", "); - throw BinderException( - "Contents of view were altered: types don't match! Expected [%s], but found [%s] instead", - expected_types, actual_types); - } - if (bound_child.names.size() == view_catalog_entry.names.size() && - bound_child.names != view_catalog_entry.names) { - auto actual_names = StringUtil::Join(bound_child.names, ", "); - auto expected_names = StringUtil::Join(view_catalog_entry.names, ", "); - throw BinderException( - "Contents of view were altered: names don't match! Expected [%s], but found [%s] instead", - expected_names, actual_names); - } - } + // update the view binding with the bound view information + view_catalog_entry.UpdateBinding(bound_child.types, bound_child.names); bind_context.AddView(bound_child.plan->GetRootIndex(), subquery.alias, subquery, bound_child, view_catalog_entry); return bound_child; diff --git a/src/duckdb/src/planner/binder/tableref/bind_pivot.cpp b/src/duckdb/src/planner/binder/tableref/bind_pivot.cpp index 50773f06a..3e1094e52 100644 --- a/src/duckdb/src/planner/binder/tableref/bind_pivot.cpp +++ b/src/duckdb/src/planner/binder/tableref/bind_pivot.cpp @@ -22,6 +22,8 @@ #include "duckdb/planner/operator/logical_aggregate.hpp" #include "duckdb/planner/operator/logical_pivot.hpp" #include "duckdb/main/settings.hpp" +#include "duckdb/execution/expression_executor.hpp" +#include "duckdb/planner/expression_binder/constant_binder.hpp" namespace duckdb { @@ -506,6 +508,37 @@ BoundStatement Binder::BindBoundPivot(PivotRef &ref) { return result_statement; } +static void BindPivotInList(unique_ptr &expr, vector &values, Binder &binder) { + switch (expr->GetExpressionType()) { + case ExpressionType::COLUMN_REF: { + auto &colref = expr->Cast(); + if (colref.IsQualified()) { + throw BinderException(expr->GetQueryLocation(), "PIVOT IN list cannot contain qualified column references"); + } + values.emplace_back(colref.GetColumnName()); + } break; + case ExpressionType::FUNCTION: { + auto &function = expr->Cast(); + if (function.function_name != "row") { + throw BinderException(expr->GetQueryLocation(), "PIVOT IN list must contain columns or lists of columns"); + } + for (auto &child : function.children) { + BindPivotInList(child, values, binder); + } + } break; + default: { + Value val; + ConstantBinder const_binder(binder, binder.context, "PIVOT IN list"); + auto bound_expr = const_binder.Bind(expr); + if (!bound_expr->IsFoldable()) { + throw BinderException(expr->GetQueryLocation(), "PIVOT IN list must contain constant expressions"); + } + auto folded_value = ExpressionExecutor::EvaluateScalar(binder.context, *bound_expr); + values.push_back(folded_value); + } break; + } +} + unique_ptr Binder::BindPivot(PivotRef &ref, vector> all_columns) { // keep track of the columns by which we pivot/aggregate // any columns which are not pivoted/aggregated on are added to the GROUP BY clause @@ -533,6 +566,32 @@ unique_ptr Binder::BindPivot(PivotRef &ref, vector &unpivot_entries) { + // Try to bind the entry expression as values + try { + auto expr_copy = entry.expr->Copy(); + BindPivotInList(expr_copy, entry.values, child_binder); + // successfully bound as values - clear the expression + entry.expr = nullptr; + } catch (...) { + // ignore binder exceptions here - we fall back to expression mode + entry.values.clear(); + } + if (!entry.expr) { // pivot entry without an expression - generate one UnpivotEntry unpivot_entry; diff --git a/src/duckdb/src/planner/binder/tableref/bind_table_function.cpp b/src/duckdb/src/planner/binder/tableref/bind_table_function.cpp index 528478c58..4d2a47629 100644 --- a/src/duckdb/src/planner/binder/tableref/bind_table_function.cpp +++ b/src/duckdb/src/planner/binder/tableref/bind_table_function.cpp @@ -193,7 +193,7 @@ BoundStatement Binder::BindTableFunctionInternal(TableFunction &table_function, vector return_names; auto constexpr ordinality_name = "ordinality"; string ordinality_column_name = ordinality_name; - idx_t ordinality_column_id; + optional_idx ordinality_column_id; if (table_function.bind || table_function.bind_replace || table_function.bind_operator) { TableFunctionBindInput bind_input(parameters, named_parameters, input_table_types, input_table_names, table_function.function_info.get(), this, table_function, ref); diff --git a/src/duckdb/src/planner/binder/tableref/plan_joinref.cpp b/src/duckdb/src/planner/binder/tableref/plan_joinref.cpp index 03c41b033..147e7f922 100644 --- a/src/duckdb/src/planner/binder/tableref/plan_joinref.cpp +++ b/src/duckdb/src/planner/binder/tableref/plan_joinref.cpp @@ -4,7 +4,6 @@ #include "duckdb/planner/binder.hpp" #include "duckdb/planner/expression/bound_columnref_expression.hpp" #include "duckdb/planner/expression/bound_comparison_expression.hpp" -#include "duckdb/planner/expression/bound_conjunction_expression.hpp" #include "duckdb/planner/expression/bound_constant_expression.hpp" #include "duckdb/planner/expression_binder/lateral_binder.hpp" #include "duckdb/planner/expression_iterator.hpp" @@ -22,7 +21,12 @@ namespace duckdb { //! This is used ONLY for join conditions in the ON clause, not for WHERE clause filters. //! The logic determines whether a condition that references only the left side can be //! pushed down as a filter on the left child operator. -static bool CanPushToLeftChild(JoinType type) { +static bool CanPushToLeftChild(JoinType type, JoinRefType ref_type) { + // Unsupported arbitrary predicates for some ASOF types + if (ref_type == JoinRefType::ASOF && type != JoinType::INNER && type != JoinType::LEFT) { + return false; + } + switch (type) { case JoinType::INNER: case JoinType::SEMI: @@ -41,7 +45,12 @@ static bool CanPushToLeftChild(JoinType type) { //! This is used ONLY for join conditions in the ON clause, not for WHERE clause filters. //! The logic determines whether a condition that references only the right side can be //! pushed down as a filter on the right child operator. -static bool CanPushToRightChild(JoinType type) { +static bool CanPushToRightChild(JoinType type, JoinRefType ref_type) { + // Unsupported arbitrary predicates for some ASOF types + if (ref_type == JoinRefType::ASOF && type != JoinType::INNER && type != JoinType::LEFT) { + return false; + } + switch (type) { case JoinType::INNER: case JoinType::SEMI: @@ -148,29 +157,28 @@ static bool CreateJoinCondition(Expression &expr, const unordered_set &le auto right_side = JoinSide::GetJoinSide(*comparison.right, left_bindings, right_bindings); if (left_side != JoinSide::BOTH && right_side != JoinSide::BOTH) { // join condition can be divided in a left/right side - JoinCondition condition; - condition.comparison = expr.GetExpressionType(); + auto comp_type = expr.GetExpressionType(); auto left = std::move(comparison.left); auto right = std::move(comparison.right); if (left_side == JoinSide::RIGHT) { // left = right, right = left, flip the comparison symbol and reverse sides swap(left, right); - condition.comparison = FlipComparisonExpression(expr.GetExpressionType()); + comp_type = FlipComparisonExpression(comp_type); } - condition.left = std::move(left); - condition.right = std::move(right); - conditions.push_back(std::move(condition)); + conditions.push_back(JoinCondition(std::move(left), std::move(right), comp_type)); return true; } return false; } //! Extract join conditions, pushing single-side filters to children when it's safe -void LogicalComparisonJoin::ExtractJoinConditions( - ClientContext &context, JoinType type, JoinRefType ref_type, unique_ptr &left_child, - unique_ptr &right_child, const unordered_set &left_bindings, - const unordered_set &right_bindings, vector> &expressions, - vector &conditions, vector> &arbitrary_expressions) { +void LogicalComparisonJoin::ExtractJoinConditions(ClientContext &context, JoinType type, JoinRefType ref_type, + unique_ptr &left_child, + unique_ptr &right_child, + const unordered_set &left_bindings, + const unordered_set &right_bindings, + vector> &expressions, + vector &conditions) { for (auto &expr : expressions) { auto side = JoinSide::GetJoinSide(*expr, left_bindings, right_bindings); @@ -179,12 +187,12 @@ void LogicalComparisonJoin::ExtractJoinConditions( continue; } } else if (side == JoinSide::LEFT) { - if (CanPushToLeftChild(type)) { + if (CanPushToLeftChild(type, ref_type)) { PushFilterToChild(left_child, expr); continue; } } else if (side == JoinSide::RIGHT) { - if (CanPushToRightChild(type)) { + if (CanPushToRightChild(type, ref_type)) { PushFilterToChild(right_child, expr); continue; } @@ -195,7 +203,7 @@ void LogicalComparisonJoin::ExtractJoinConditions( } } - arbitrary_expressions.push_back(std::move(expr)); + conditions.emplace_back(std::move(expr)); } } @@ -203,36 +211,43 @@ void LogicalComparisonJoin::ExtractJoinConditions(ClientContext &context, JoinTy unique_ptr &left_child, unique_ptr &right_child, vector> &expressions, - vector &conditions, - vector> &arbitrary_expressions) { + vector &conditions) { unordered_set left_bindings, right_bindings; LogicalJoin::GetTableReferences(*left_child, left_bindings); LogicalJoin::GetTableReferences(*right_child, right_bindings); return ExtractJoinConditions(context, type, ref_type, left_child, right_child, left_bindings, right_bindings, - expressions, conditions, arbitrary_expressions); + expressions, conditions); } void LogicalComparisonJoin::ExtractJoinConditions(ClientContext &context, JoinType type, JoinRefType ref_type, unique_ptr &left_child, unique_ptr &right_child, - unique_ptr condition, vector &conditions, - vector> &arbitrary_expressions) { + unique_ptr condition, vector &conditions) { // split the expressions by the AND clause vector> expressions; expressions.push_back(std::move(condition)); LogicalFilter::SplitPredicates(expressions); - return ExtractJoinConditions(context, type, ref_type, left_child, right_child, expressions, conditions, - arbitrary_expressions); + return ExtractJoinConditions(context, type, ref_type, left_child, right_child, expressions, conditions); } //! Create the join operator based on conditions and join type unique_ptr LogicalComparisonJoin::CreateJoin(JoinType type, JoinRefType ref_type, unique_ptr left_child, unique_ptr right_child, - vector conditions, - vector> arbitrary_expressions) { + vector conditions) { const bool is_asof = ref_type == JoinRefType::ASOF; + // separate comparison and non-comparison conditions for validation + vector comparison_conditions; + vector non_comparison_conditions; + for (auto &cond : conditions) { + if (cond.IsComparison()) { + comparison_conditions.push_back(std::move(cond)); + } else { + non_comparison_conditions.push_back(std::move(cond)); + } + } + // validate ASOF join conditions if (is_asof) { // We can't support arbitrary predicates with some ASOF joins @@ -241,7 +256,7 @@ unique_ptr LogicalComparisonJoin::CreateJoin(JoinType type, Joi case JoinType::OUTER: case JoinType::SEMI: case JoinType::ANTI: - if (!arbitrary_expressions.empty()) { + if (!non_comparison_conditions.empty()) { throw NotImplementedException("Unsupported ASOF JOIN type (%s) with arbitrary predicate", EnumUtil::ToChars(type)); } @@ -250,10 +265,10 @@ unique_ptr LogicalComparisonJoin::CreateJoin(JoinType type, Joi break; } - idx_t asof_idx = conditions.size(); - for (size_t c = 0; c < conditions.size(); ++c) { - auto &cond = conditions[c]; - switch (cond.comparison) { + idx_t asof_idx = comparison_conditions.size(); + for (size_t c = 0; c < comparison_conditions.size(); ++c) { + auto &cond = comparison_conditions[c]; + switch (cond.GetComparisonType()) { case ExpressionType::COMPARE_EQUAL: case ExpressionType::COMPARE_NOT_DISTINCT_FROM: break; @@ -261,7 +276,7 @@ unique_ptr LogicalComparisonJoin::CreateJoin(JoinType type, Joi case ExpressionType::COMPARE_GREATERTHAN: case ExpressionType::COMPARE_LESSTHANOREQUALTO: case ExpressionType::COMPARE_LESSTHAN: - if (asof_idx < conditions.size()) { + if (asof_idx < comparison_conditions.size()) { throw BinderException("Multiple ASOF JOIN inequalities"); } asof_idx = c; @@ -270,90 +285,46 @@ unique_ptr LogicalComparisonJoin::CreateJoin(JoinType type, Joi throw BinderException("Invalid ASOF JOIN comparison"); } } - if (asof_idx >= conditions.size()) { + if (asof_idx >= comparison_conditions.size()) { throw BinderException("Missing ASOF JOIN inequality"); } } + // Reconstruct full conditions vector + vector all_conditions; + for (auto &cond : comparison_conditions) { + all_conditions.push_back(std::move(cond)); + } + for (auto &cond : non_comparison_conditions) { + all_conditions.push_back(std::move(cond)); + } + // what type of join to create now? - // Case 1: ASOF join - use comparison join + // Case 1: ASOF join - use comparison join (all conditions already in vector) if (is_asof) { auto asof_join = make_uniq(type, LogicalOperatorType::LOGICAL_ASOF_JOIN); - asof_join->conditions = std::move(conditions); + asof_join->conditions = std::move(all_conditions); asof_join->children.push_back(std::move(left_child)); asof_join->children.push_back(std::move(right_child)); - - if (!arbitrary_expressions.empty()) { - asof_join->predicate = std::move(arbitrary_expressions[0]); - for (idx_t i = 1; i < arbitrary_expressions.size(); i++) { - asof_join->predicate = make_uniq(ExpressionType::CONJUNCTION_AND, - std::move(asof_join->predicate), - std::move(arbitrary_expressions[i])); - } - } - return std::move(asof_join); } - // Case 2: No join conditions - use any join - if (conditions.empty()) { - if (arbitrary_expressions.empty()) { - arbitrary_expressions.push_back(make_uniq(Value::BOOLEAN(true))); + // Case 2: No comparison conditions - use any join + if (comparison_conditions.empty()) { + if (all_conditions.empty()) { + all_conditions.emplace_back(make_uniq(Value::BOOLEAN(true))); } auto any_join = make_uniq(type); any_join->children.push_back(std::move(left_child)); any_join->children.push_back(std::move(right_child)); - - any_join->condition = std::move(arbitrary_expressions[0]); - for (idx_t i = 1; i < arbitrary_expressions.size(); i++) { - any_join->condition = make_uniq( - ExpressionType::CONJUNCTION_AND, std::move(any_join->condition), std::move(arbitrary_expressions[i])); - } - + any_join->condition = JoinCondition::CreateExpression(std::move(all_conditions)); return std::move(any_join); } - // Case 3: Has join conditions and arbitrary expressions - decide based on join type - if (!arbitrary_expressions.empty()) { - // for inner join create comparison join + filter on top - if (type == JoinType::INNER) { - auto comp_join = make_uniq(type, LogicalOperatorType::LOGICAL_COMPARISON_JOIN); - comp_join->conditions = std::move(conditions); - comp_join->children.push_back(std::move(left_child)); - comp_join->children.push_back(std::move(right_child)); - - auto filter = make_uniq(); - for (auto &expr : arbitrary_expressions) { - filter->expressions.push_back(std::move(expr)); - } - filter->children.push_back(std::move(comp_join)); - - return std::move(filter); - } else { - auto any_join = make_uniq(type); - any_join->children.push_back(std::move(left_child)); - any_join->children.push_back(std::move(right_child)); - - any_join->condition = JoinCondition::CreateExpression(std::move(conditions[0])); - for (idx_t i = 1; i < conditions.size(); i++) { - any_join->condition = make_uniq( - ExpressionType::CONJUNCTION_AND, std::move(any_join->condition), - JoinCondition::CreateExpression(std::move(conditions[i]))); - } - - for (auto &expr : arbitrary_expressions) { - any_join->condition = make_uniq( - ExpressionType::CONJUNCTION_AND, std::move(any_join->condition), std::move(expr)); - } - - return std::move(any_join); - } - } - - // Case 4: Has join conditions but not arbitrary expressions - use comparison join + // Case 3: Has comparison conditions - Use comparison join auto comp_join = make_uniq(type, LogicalOperatorType::LOGICAL_COMPARISON_JOIN); - comp_join->conditions = std::move(conditions); + comp_join->conditions = std::move(all_conditions); comp_join->children.push_back(std::move(left_child)); comp_join->children.push_back(std::move(right_child)); @@ -377,11 +348,10 @@ unique_ptr LogicalComparisonJoin::CreateJoin(ClientContext &con unique_ptr right_child, unique_ptr condition) { vector conditions; - vector> arbitrary_expressions; LogicalComparisonJoin::ExtractJoinConditions(context, type, reftype, left_child, right_child, std::move(condition), - conditions, arbitrary_expressions); + conditions); return LogicalComparisonJoin::CreateJoin(type, reftype, std::move(left_child), std::move(right_child), - std::move(conditions), std::move(arbitrary_expressions)); + std::move(conditions)); } unique_ptr Binder::CreatePlan(BoundJoinRef &ref) { @@ -468,13 +438,13 @@ unique_ptr Binder::CreatePlan(BoundJoinRef &ref) { switch (join->type) { case LogicalOperatorType::LOGICAL_ASOF_JOIN: case LogicalOperatorType::LOGICAL_COMPARISON_JOIN: { - // comparison join - // in this join we visit the expressions on the LHS with the LHS as root node - // and the expressions on the RHS with the RHS as root node auto &comp_join = join->Cast(); for (idx_t i = 0; i < comp_join.conditions.size(); i++) { - PlanSubqueries(comp_join.conditions[i].left, comp_join.children[0]); - PlanSubqueries(comp_join.conditions[i].right, comp_join.children[1]); + auto &cond = comp_join.conditions[i]; + if (cond.IsComparison()) { + PlanSubqueries(cond.LeftReference(), comp_join.children[0]); + PlanSubqueries(cond.RightReference(), comp_join.children[1]); + } } break; } diff --git a/src/duckdb/src/planner/expression/bound_cast_expression.cpp b/src/duckdb/src/planner/expression/bound_cast_expression.cpp index e2efdfa2e..1de7ee2b1 100644 --- a/src/duckdb/src/planner/expression/bound_cast_expression.cpp +++ b/src/duckdb/src/planner/expression/bound_cast_expression.cpp @@ -6,6 +6,7 @@ #include "duckdb/function/cast_rules.hpp" #include "duckdb/function/cast/cast_function_set.hpp" #include "duckdb/main/config.hpp" +#include "duckdb/planner/expression_binder.hpp" namespace duckdb { diff --git a/src/duckdb/src/planner/expression_binder.cpp b/src/duckdb/src/planner/expression_binder.cpp index 86b131ed4..c2cc9bff5 100644 --- a/src/duckdb/src/planner/expression_binder.cpp +++ b/src/duckdb/src/planner/expression_binder.cpp @@ -80,6 +80,8 @@ BindResult ExpressionBinder::BindExpression(unique_ptr &expr, return BindExpression(expr_ref.Cast(), depth); case ExpressionClass::CONSTANT: return BindExpression(expr_ref.Cast(), depth); + case ExpressionClass::TYPE: + return BindExpression(expr_ref.Cast(), depth); case ExpressionClass::FUNCTION: { auto &function = expr_ref.Cast(); if (IsUnnestFunction(function.function_name)) { diff --git a/src/duckdb/src/planner/expression_binder/order_binder.cpp b/src/duckdb/src/planner/expression_binder/order_binder.cpp index 28ff24ca2..1ad8582eb 100644 --- a/src/duckdb/src/planner/expression_binder/order_binder.cpp +++ b/src/duckdb/src/planner/expression_binder/order_binder.cpp @@ -83,11 +83,28 @@ optional_idx OrderBinder::TryGetProjectionReference(ParsedExpression &expr) cons string alias_name = colref.column_names.back(); // check the alias list auto entry = bind_state.alias_map.find(alias_name); - if (entry == bind_state.alias_map.end()) { - break; + if (entry != bind_state.alias_map.end()) { + // this is an alias - return the index + return entry->second; } - // this is an alias - return the index - return entry->second; + // check the expression list + vector matching_columns; + for (idx_t i = 0; i < bind_state.original_expressions.size(); i++) { + if (bind_state.original_expressions[i]->type != ExpressionType::COLUMN_REF) { + continue; + } + auto &colref = bind_state.original_expressions[i]->Cast(); + if (colref.HasAlias()) { + continue; + } + if (colref.GetColumnName() == alias_name) { + matching_columns.push_back(i); + } + } + if (matching_columns.size() == 1) { + return matching_columns[0]; + } + break; } case ExpressionClass::POSITIONAL_REFERENCE: { auto &posref = expr.Cast(); diff --git a/src/duckdb/src/planner/expression_binder/table_function_binder.cpp b/src/duckdb/src/planner/expression_binder/table_function_binder.cpp index 16b612cd6..f653a129d 100644 --- a/src/duckdb/src/planner/expression_binder/table_function_binder.cpp +++ b/src/duckdb/src/planner/expression_binder/table_function_binder.cpp @@ -51,9 +51,11 @@ BindResult TableFunctionBinder::BindColumnReference(unique_ptr } } - auto value_function = ExpressionBinder::GetSQLValueFunction(column_names.back()); - if (value_function) { - return BindExpression(value_function, depth, root_expression); + if (accept_sql_value_functions) { + auto value_function = ExpressionBinder::GetSQLValueFunction(column_names.back()); + if (value_function) { + return BindExpression(value_function, depth, root_expression); + } } auto result = BindCorrelatedColumns(expr_ptr, ErrorData("error")); diff --git a/src/duckdb/src/planner/joinside.cpp b/src/duckdb/src/planner/joinside.cpp index b4c571b91..1dfdbd97a 100644 --- a/src/duckdb/src/planner/joinside.cpp +++ b/src/duckdb/src/planner/joinside.cpp @@ -9,9 +9,12 @@ namespace duckdb { unique_ptr JoinCondition::CreateExpression(JoinCondition cond) { - auto bound_comparison = - make_uniq(cond.comparison, std::move(cond.left), std::move(cond.right)); - return std::move(bound_comparison); + if (cond.IsComparison()) { + auto bound_comparison = make_uniq( + cond.GetComparisonType(), std::move(cond.LeftReference()), std::move(cond.RightReference())); + return std::move(bound_comparison); + } + return std::move(cond.JoinExpressionReference()); } unique_ptr JoinCondition::CreateExpression(vector conditions) { diff --git a/src/duckdb/src/planner/logical_operator_visitor.cpp b/src/duckdb/src/planner/logical_operator_visitor.cpp index b7723d640..6ef975074 100644 --- a/src/duckdb/src/planner/logical_operator_visitor.cpp +++ b/src/duckdb/src/planner/logical_operator_visitor.cpp @@ -145,8 +145,8 @@ void LogicalOperatorVisitor::EnumerateExpressions(LogicalOperator &op, callback(&expr); } for (auto &cond : join.conditions) { - callback(&cond.left); - callback(&cond.right); + callback(&cond.LeftReference()); + callback(&cond.RightReference()); } for (auto &expr : join.arbitrary_expressions) { callback(&expr); @@ -164,11 +164,12 @@ void LogicalOperatorVisitor::EnumerateExpressions(LogicalOperator &op, callback(&expr); } for (auto &cond : join.conditions) { - callback(&cond.left); - callback(&cond.right); - } - if (join.predicate) { - callback(&join.predicate); + if (cond.IsComparison()) { + callback(&cond.LeftReference()); + callback(&cond.RightReference()); + } else { + callback(&cond.JoinExpressionReference()); + } } break; } diff --git a/src/duckdb/src/planner/operator/logical_comparison_join.cpp b/src/duckdb/src/planner/operator/logical_comparison_join.cpp index e8e1e5202..09e3a67f4 100644 --- a/src/duckdb/src/planner/operator/logical_comparison_join.cpp +++ b/src/duckdb/src/planner/operator/logical_comparison_join.cpp @@ -18,15 +18,13 @@ InsertionOrderPreservingMap LogicalComparisonJoin::ParamsToString() cons conditions_info += "\n"; } auto &condition = conditions[i]; - auto expr = - make_uniq(condition.comparison, condition.left->Copy(), condition.right->Copy()); - conditions_info += expr->ToString(); - } - if (predicate) { - if (!conditions.empty()) { - conditions_info += "\n"; + if (condition.IsComparison()) { + auto expr = make_uniq(condition.GetComparisonType(), condition.GetLHS().Copy(), + condition.GetRHS().Copy()); + conditions_info += expr->ToString(); + } else { + conditions_info += condition.GetJoinExpression().ToString(); } - conditions_info += predicate->ToString(); } result["Conditions"] = conditions_info; SetParamsEstimatedCardinality(result); @@ -38,25 +36,37 @@ bool LogicalComparisonJoin::HasEquality(idx_t &range_count) const { bool result = false; for (size_t c = 0; c < conditions.size(); ++c) { auto &cond = conditions[c]; - switch (cond.comparison) { - case ExpressionType::COMPARE_EQUAL: - case ExpressionType::COMPARE_NOT_DISTINCT_FROM: - result = true; - break; - case ExpressionType::COMPARE_LESSTHAN: - case ExpressionType::COMPARE_GREATERTHAN: - case ExpressionType::COMPARE_LESSTHANOREQUALTO: - case ExpressionType::COMPARE_GREATERTHANOREQUALTO: - ++range_count; - break; - case ExpressionType::COMPARE_NOTEQUAL: - case ExpressionType::COMPARE_DISTINCT_FROM: - break; - default: - throw NotImplementedException("Unimplemented comparison join"); + if (cond.IsComparison()) { + switch (cond.GetComparisonType()) { + case ExpressionType::COMPARE_EQUAL: + case ExpressionType::COMPARE_NOT_DISTINCT_FROM: + result = true; + break; + case ExpressionType::COMPARE_LESSTHAN: + case ExpressionType::COMPARE_GREATERTHAN: + case ExpressionType::COMPARE_LESSTHANOREQUALTO: + case ExpressionType::COMPARE_GREATERTHANOREQUALTO: + ++range_count; + break; + case ExpressionType::COMPARE_NOTEQUAL: + case ExpressionType::COMPARE_DISTINCT_FROM: + break; + default: + throw NotImplementedException("Unimplemented comparison join"); + } } } return result; } +bool LogicalComparisonJoin::HasArbitraryConditions() const { + for (size_t c = 0; c < conditions.size(); ++c) { + auto &cond = conditions[c]; + if (!cond.IsComparison()) { + return true; + } + } + return false; +} + } // namespace duckdb diff --git a/src/duckdb/src/planner/operator/logical_delete.cpp b/src/duckdb/src/planner/operator/logical_delete.cpp index d82c3bfd8..de3080f02 100644 --- a/src/duckdb/src/planner/operator/logical_delete.cpp +++ b/src/duckdb/src/planner/operator/logical_delete.cpp @@ -3,6 +3,7 @@ #include "duckdb/catalog/catalog_entry/table_catalog_entry.hpp" #include "duckdb/main/config.hpp" #include "duckdb/parser/parsed_data/create_table_info.hpp" +#include "duckdb/planner/binder.hpp" namespace duckdb { diff --git a/src/duckdb/src/planner/operator/logical_extension_operator.cpp b/src/duckdb/src/planner/operator/logical_extension_operator.cpp index 2e0cb6d15..98fea77ed 100644 --- a/src/duckdb/src/planner/operator/logical_extension_operator.cpp +++ b/src/duckdb/src/planner/operator/logical_extension_operator.cpp @@ -1,8 +1,8 @@ #include "duckdb/planner/operator/logical_extension_operator.hpp" #include "duckdb/execution/column_binding_resolver.hpp" -#include "duckdb/main/config.hpp" #include "duckdb/common/serializer/serializer.hpp" #include "duckdb/common/serializer/deserializer.hpp" +#include "duckdb/planner/operator_extension.hpp" namespace duckdb { @@ -26,9 +26,9 @@ void LogicalExtensionOperator::Serialize(Serializer &serializer) const { } unique_ptr LogicalExtensionOperator::Deserialize(Deserializer &deserializer) { - auto &config = DBConfig::GetConfig(deserializer.Get()); + auto &context = deserializer.Get(); auto extension_name = deserializer.ReadProperty(200, "extension_name"); - for (auto &extension : config.operator_extensions) { + for (auto &extension : OperatorExtension::Iterate(context)) { if (extension->GetName() == extension_name) { return extension->Deserialize(deserializer); } diff --git a/src/duckdb/src/planner/operator/logical_insert.cpp b/src/duckdb/src/planner/operator/logical_insert.cpp index bab6820fe..52c5d25d1 100644 --- a/src/duckdb/src/planner/operator/logical_insert.cpp +++ b/src/duckdb/src/planner/operator/logical_insert.cpp @@ -3,6 +3,7 @@ #include "duckdb/catalog/catalog_entry/table_catalog_entry.hpp" #include "duckdb/main/config.hpp" #include "duckdb/parser/parsed_data/create_table_info.hpp" +#include "duckdb/planner/binder.hpp" namespace duckdb { diff --git a/src/duckdb/src/planner/operator/logical_merge_into.cpp b/src/duckdb/src/planner/operator/logical_merge_into.cpp index fa99f69ab..cd74905dd 100644 --- a/src/duckdb/src/planner/operator/logical_merge_into.cpp +++ b/src/duckdb/src/planner/operator/logical_merge_into.cpp @@ -1,6 +1,8 @@ #include "duckdb/planner/operator/logical_merge_into.hpp" + #include "duckdb/catalog/catalog_entry/table_catalog_entry.hpp" #include "duckdb/parser/parsed_data/create_table_info.hpp" +#include "duckdb/planner/binder.hpp" namespace duckdb { diff --git a/src/duckdb/src/planner/operator/logical_update.cpp b/src/duckdb/src/planner/operator/logical_update.cpp index 386264478..b2de4d12d 100644 --- a/src/duckdb/src/planner/operator/logical_update.cpp +++ b/src/duckdb/src/planner/operator/logical_update.cpp @@ -1,7 +1,9 @@ #include "duckdb/planner/operator/logical_update.hpp" + #include "duckdb/catalog/catalog_entry/table_catalog_entry.hpp" -#include "duckdb/parser/parsed_data/create_table_info.hpp" #include "duckdb/main/config.hpp" +#include "duckdb/parser/parsed_data/create_table_info.hpp" +#include "duckdb/planner/binder.hpp" namespace duckdb { diff --git a/src/duckdb/src/planner/operator/logical_vacuum.cpp b/src/duckdb/src/planner/operator/logical_vacuum.cpp index ce4a76951..734ae8ea3 100644 --- a/src/duckdb/src/planner/operator/logical_vacuum.cpp +++ b/src/duckdb/src/planner/operator/logical_vacuum.cpp @@ -1,9 +1,11 @@ #include "duckdb/planner/operator/logical_vacuum.hpp" -#include "duckdb/planner/operator/logical_get.hpp" + #include "duckdb/catalog/catalog_entry/table_catalog_entry.hpp" -#include "duckdb/common/serializer/serializer.hpp" #include "duckdb/common/serializer/deserializer.hpp" +#include "duckdb/common/serializer/serializer.hpp" #include "duckdb/parser/parsed_data/vacuum_info.hpp" +#include "duckdb/planner/binder.hpp" +#include "duckdb/planner/operator/logical_get.hpp" namespace duckdb { diff --git a/src/duckdb/src/planner/planner.cpp b/src/duckdb/src/planner/planner.cpp index 0ec34789c..7f5caba77 100644 --- a/src/duckdb/src/planner/planner.cpp +++ b/src/duckdb/src/planner/planner.cpp @@ -17,6 +17,8 @@ #include "duckdb/main/attached_database.hpp" #include "duckdb/parser/statement/multi_statement.hpp" #include "duckdb/planner/subquery/flatten_dependent_join.hpp" +#include "duckdb/planner/operator_extension.hpp" +#include "duckdb/planner/planner_extension.hpp" namespace duckdb { @@ -32,6 +34,15 @@ static void CheckTreeDepth(const LogicalOperator &op, idx_t max_depth, idx_t dep } } +static void RunPostBindExtensions(ClientContext &context, Binder &binder, BoundStatement &statement) { + for (auto &planner_extension : PlannerExtension::Iterate(context)) { + if (planner_extension.post_bind_function) { + PlannerExtensionInput input {context, binder, planner_extension.planner_info.get()}; + planner_extension.post_bind_function(input, statement); + } + } +} + void Planner::CreatePlan(SQLStatement &statement) { auto &profiler = QueryProfiler::Get(context); auto parameter_count = statement.named_param_map.size(); @@ -46,6 +57,8 @@ void Planner::CreatePlan(SQLStatement &statement) { auto bound_statement = binder->Bind(statement); profiler.EndPhase(); + RunPostBindExtensions(context, *binder, bound_statement); + this->names = bound_statement.names; this->types = bound_statement.types; this->plan = std::move(bound_statement.plan); @@ -59,11 +72,12 @@ void Planner::CreatePlan(SQLStatement &statement) { parameters_resolved = false; } else if (error.Type() != ExceptionType::INVALID) { // different exception type - try operator_extensions - auto &config = DBConfig::GetConfig(context); - for (auto &extension_op : config.operator_extensions) { + for (auto &extension_op : OperatorExtension::Iterate(context)) { auto bound_statement = extension_op->Bind(context, *this->binder, extension_op->operator_info.get(), statement); if (bound_statement.plan != nullptr) { + RunPostBindExtensions(context, *this->binder, bound_statement); + this->names = bound_statement.names; this->types = bound_statement.types; this->plan = std::move(bound_statement.plan); diff --git a/src/duckdb/src/planner/subquery/flatten_dependent_join.cpp b/src/duckdb/src/planner/subquery/flatten_dependent_join.cpp index 23dd23ec4..12fc09ceb 100644 --- a/src/duckdb/src/planner/subquery/flatten_dependent_join.cpp +++ b/src/duckdb/src/planner/subquery/flatten_dependent_join.cpp @@ -39,10 +39,9 @@ static void CreateDelimJoinConditions(LogicalComparisonJoin &delim_join, const C if (binding_idx >= bindings.size()) { throw InternalException("Delim join - binding index out of range"); } - JoinCondition cond; - cond.left = make_uniq(col.name, col.type, col.binding); - cond.right = make_uniq(col.name, col.type, bindings[binding_idx]); - cond.comparison = ExpressionType::COMPARE_NOT_DISTINCT_FROM; + JoinCondition cond(make_uniq(col.name, col.type, col.binding), + make_uniq(col.name, col.type, bindings[binding_idx]), + ExpressionType::COMPARE_NOT_DISTINCT_FROM); delim_join.conditions.push_back(std::move(cond)); } } @@ -183,18 +182,17 @@ unique_ptr FlattenDependentJoins::Decorrelate(unique_ptr(child_type, plan_columns[child_idx]), op.child_targets[child_idx]); - compare_cond.comparison = op.comparison_type; + JoinCondition compare_cond(std::move(left_expr), std::move(right_expr), op.comparison_type); // push collations - ExpressionBinder::PushCollation(binder.context, compare_cond.left, compare_type); - ExpressionBinder::PushCollation(binder.context, compare_cond.right, compare_type); + ExpressionBinder::PushCollation(binder.context, compare_cond.LeftReference(), compare_type); + ExpressionBinder::PushCollation(binder.context, compare_cond.RightReference(), compare_type); op.conditions.push_back(std::move(compare_cond)); } } @@ -271,8 +269,20 @@ bool FlattenDependentJoins::DetectCorrelatedExpressions(LogicalOperator &op, boo return true; } // Found a materialized CTE, subtree correlation depends on the CTE node - has_correlated_expressions[op] = has_correlated_expressions[*cte_node]; - return has_correlated_expressions[*cte_node]; + bool handled_by_dependent_join = false; + idx_t join_depth = lateral_depth + 1; + for (auto &ctx_col : correlated_columns) { + if (ctx_col.depth == join_depth) { + // Check if the current dependent join will handle the correlation + handled_by_dependent_join = true; + break; + } + } + + auto &setop = cte_node->Cast(); + has_correlated_expressions[op] = (!handled_by_dependent_join && !setop.correlated_columns.empty()) || + has_correlated_expressions[*cte_node]; + return has_correlated_expressions[op]; } // No CTE found: subtree is correlated return true; @@ -401,12 +411,13 @@ unique_ptr FlattenDependentJoins::PushDownDependentJoinInternal ColumnBinding(cteref.table_index, cteref.chunk_types.size() - cteref.correlated_columns); // add the correlated columns to the join conditions for (idx_t i = 0; i < cteref.correlated_columns; i++) { - JoinCondition cond; - cond.left = make_uniq( - correlated_columns[i].type, ColumnBinding(left_binding.table_index, left_binding.column_index + i)); - cond.right = make_uniq( - correlated_columns[i].type, ColumnBinding(base_binding.table_index, base_binding.column_index + i)); - cond.comparison = ExpressionType::COMPARE_NOT_DISTINCT_FROM; + JoinCondition cond(make_uniq( + correlated_columns[i].type, + ColumnBinding(left_binding.table_index, left_binding.column_index + i)), + make_uniq( + correlated_columns[i].type, + ColumnBinding(base_binding.table_index, base_binding.column_index + i)), + ExpressionType::COMPARE_NOT_DISTINCT_FROM); join->conditions.push_back(std::move(cond)); } join->children.push_back(std::move(plan)); @@ -559,11 +570,11 @@ unique_ptr FlattenDependentJoins::PushDownDependentJoinInternal join->children.push_back(std::move(plan)); for (idx_t i = 0; i < new_group_count; i++) { auto &col = correlated_columns[i]; - JoinCondition cond; - cond.left = make_uniq(col.name, col.type, ColumnBinding(left_index, i)); - cond.right = make_uniq( - correlated_columns[i].type, ColumnBinding(delim_table_index, delim_column_offset + i)); - cond.comparison = ExpressionType::COMPARE_NOT_DISTINCT_FROM; + JoinCondition cond( + make_uniq(col.name, col.type, ColumnBinding(left_index, i)), + make_uniq(correlated_columns[i].type, + ColumnBinding(delim_table_index, delim_column_offset + i)), + ExpressionType::COMPARE_NOT_DISTINCT_FROM); join->conditions.push_back(std::move(cond)); } // for any COUNT aggregate we replace references to the column with: CASE WHEN COUNT(*) IS NULL THEN 0 @@ -618,20 +629,22 @@ unique_ptr FlattenDependentJoins::PushDownDependentJoinInternal } // both sides have correlation // turn into an inner join + // correctly use left child's delim_offset so execute left child as the last one auto join = make_uniq(JoinType::INNER); - plan->children[0] = - PushDownDependentJoinInternal(std::move(plan->children[0]), parent_propagate_null_values, lateral_depth); - auto left_binding = this->base_binding; plan->children[1] = PushDownDependentJoinInternal(std::move(plan->children[1]), parent_propagate_null_values, lateral_depth); + auto right_binding = this->base_binding; + plan->children[0] = + PushDownDependentJoinInternal(std::move(plan->children[0]), parent_propagate_null_values, lateral_depth); // add the correlated columns to the join conditions for (idx_t i = 0; i < correlated_columns.size(); i++) { - JoinCondition cond; - cond.left = make_uniq( - correlated_columns[i].type, ColumnBinding(left_binding.table_index, left_binding.column_index + i)); - cond.right = make_uniq( - correlated_columns[i].type, ColumnBinding(base_binding.table_index, base_binding.column_index + i)); - cond.comparison = ExpressionType::COMPARE_NOT_DISTINCT_FROM; + JoinCondition cond( + make_uniq( + correlated_columns[i].type, ColumnBinding(base_binding.table_index, base_binding.column_index + i)), + make_uniq( + correlated_columns[i].type, + ColumnBinding(right_binding.table_index, right_binding.column_index + i)), + ExpressionType::COMPARE_NOT_DISTINCT_FROM); join->conditions.push_back(std::move(cond)); } join->children.push_back(std::move(plan->children[0])); @@ -712,14 +725,13 @@ unique_ptr FlattenDependentJoins::PushDownDependentJoinInternal // add the correlated columns to the join conditions for (idx_t i = 0; i < correlated_columns.size(); i++) { - JoinCondition cond; - cond.left = make_uniq( - correlated_columns[i].type, - ColumnBinding(left_binding.table_index, left_binding.column_index + i)); - cond.right = make_uniq( - correlated_columns[i].type, - ColumnBinding(right_binding.table_index, right_binding.column_index + i)); - cond.comparison = ExpressionType::COMPARE_NOT_DISTINCT_FROM; + JoinCondition cond(make_uniq( + correlated_columns[i].type, + ColumnBinding(left_binding.table_index, left_binding.column_index + i)), + make_uniq( + correlated_columns[i].type, + ColumnBinding(right_binding.table_index, right_binding.column_index + i)), + ExpressionType::COMPARE_NOT_DISTINCT_FROM); auto &comparison_join = join.Cast(); comparison_join.conditions.push_back(std::move(cond)); @@ -766,10 +778,7 @@ unique_ptr FlattenDependentJoins::PushDownDependentJoinInternal if (join.type == LogicalOperatorType::LOGICAL_COMPARISON_JOIN || join.type == LogicalOperatorType::LOGICAL_ASOF_JOIN) { - JoinCondition cond; - cond.left = std::move(left); - cond.right = std::move(right); - cond.comparison = ExpressionType::COMPARE_NOT_DISTINCT_FROM; + JoinCondition cond(std::move(left), std::move(right), ExpressionType::COMPARE_NOT_DISTINCT_FROM); auto &comparison_join = join.Cast(); comparison_join.conditions.push_back(std::move(cond)); diff --git a/src/duckdb/src/storage/buffer/block_handle.cpp b/src/duckdb/src/storage/buffer/block_handle.cpp index 91c98d4b4..7c3c98e7d 100644 --- a/src/duckdb/src/storage/buffer/block_handle.cpp +++ b/src/duckdb/src/storage/buffer/block_handle.cpp @@ -11,26 +11,25 @@ namespace duckdb { BlockHandle::BlockHandle(BlockManager &block_manager, block_id_t block_id_p, MemoryTag tag) - : block_manager(block_manager), readers(0), block_id(block_id_p), tag(tag), buffer_type(FileBufferType::BLOCK), + : buffer_manager(block_manager.GetBufferManager()), block_manager(block_manager), + block_alloc_size(block_manager.GetBlockAllocSize()), block_header_size(block_manager.GetBlockHeaderSize()), + state(BlockState::BLOCK_UNLOADED), readers(0), block_id(block_id_p), tag(tag), buffer_type(FileBufferType::BLOCK), buffer(nullptr), eviction_seq_num(0), destroy_buffer_upon(DestroyBufferUpon::BLOCK), - memory_charge(tag, block_manager.buffer_manager.GetBufferPool()), unswizzled(nullptr), + memory_usage(block_alloc_size), memory_charge(tag, buffer_manager.GetBufferPool()), unswizzled(nullptr), eviction_queue_idx(DConstants::INVALID_INDEX) { - eviction_seq_num = 0; - state = BlockState::BLOCK_UNLOADED; - memory_usage = block_manager.GetBlockAllocSize(); } BlockHandle::BlockHandle(BlockManager &block_manager, block_id_t block_id_p, MemoryTag tag, - unique_ptr buffer_p, DestroyBufferUpon destroy_buffer_upon_p, idx_t block_size, + unique_ptr buffer_p, DestroyBufferUpon destroy_buffer_upon_p, idx_t size_p, BufferPoolReservation &&reservation) - : block_manager(block_manager), readers(0), block_id(block_id_p), tag(tag), buffer_type(buffer_p->GetBufferType()), - eviction_seq_num(0), destroy_buffer_upon(destroy_buffer_upon_p), - memory_charge(tag, block_manager.buffer_manager.GetBufferPool()), unswizzled(nullptr), + : buffer_manager(block_manager.GetBufferManager()), block_manager(block_manager), + block_alloc_size(block_manager.GetBlockAllocSize()), block_header_size(block_manager.GetBlockHeaderSize()), + state(BlockState::BLOCK_LOADED), readers(0), block_id(block_id_p), tag(tag), + buffer_type(buffer_p->GetBufferType()), buffer(std::move(buffer_p)), eviction_seq_num(0), + destroy_buffer_upon(destroy_buffer_upon_p), memory_usage(size_p), + memory_charge(tag, buffer_manager.GetBufferPool()), unswizzled(nullptr), eviction_queue_idx(DConstants::INVALID_INDEX) { - buffer = std::move(buffer_p); - state = BlockState::BLOCK_LOADED; - memory_usage = block_size; - memory_charge = std::move(reservation); + memory_charge = std::move(reservation); // Moved to constructor body due to tidy check. } BlockHandle::~BlockHandle() { // NOLINT: allow internal exceptions @@ -38,8 +37,7 @@ BlockHandle::~BlockHandle() { // NOLINT: allow internal exceptions unswizzled = nullptr; D_ASSERT(!buffer || buffer->GetBufferType() == buffer_type); if (buffer && buffer_type != FileBufferType::TINY_BUFFER) { - // we kill the latest version in the eviction queue - auto &buffer_manager = block_manager.buffer_manager; + // Kill the latest version in the eviction queue. buffer_manager.GetBufferPool().IncrementDeadNodes(*this); } @@ -150,8 +148,7 @@ BufferHandle BlockHandle::Load(QueryContext context, unique_ptr reus buffer = std::move(block); } else { if (MustWriteToTemporaryFile()) { - buffer = block_manager.buffer_manager.ReadTemporaryBuffer(QueryContext(), tag, *this, - std::move(reusable_buffer)); + buffer = buffer_manager.ReadTemporaryBuffer(QueryContext(), tag, *this, std::move(reusable_buffer)); } else { return BufferHandle(); // Destroyed upon unpin/evict, so there is no temp buffer to read } @@ -173,7 +170,7 @@ unique_ptr BlockHandle::UnloadAndTakeBlock(BlockLock &lock) { if (block_id >= MAXIMUM_BLOCK && MustWriteToTemporaryFile()) { // temporary block that cannot be destroyed upon evict/unpin: write to temporary file - block_manager.buffer_manager.WriteTemporaryBuffer(tag, block_id, *buffer); + buffer_manager.WriteTemporaryBuffer(tag, block_id, *buffer); } memory_charge.Resize(0); state = BlockState::BLOCK_UNLOADED; @@ -194,8 +191,7 @@ bool BlockHandle::CanUnload() const { // there are active readers return false; } - if (block_id >= MAXIMUM_BLOCK && MustWriteToTemporaryFile() && - !block_manager.buffer_manager.HasTemporaryDirectory()) { + if (block_id >= MAXIMUM_BLOCK && MustWriteToTemporaryFile() && !buffer_manager.HasTemporaryDirectory()) { // this block cannot be destroyed upon evict/unpin // in order to unload this block we need to write it to a temporary buffer // however, no temporary directory is specified! diff --git a/src/duckdb/src/storage/buffer/buffer_handle.cpp b/src/duckdb/src/storage/buffer/buffer_handle.cpp index a0a5d20c9..0658bdc66 100644 --- a/src/duckdb/src/storage/buffer/buffer_handle.cpp +++ b/src/duckdb/src/storage/buffer/buffer_handle.cpp @@ -34,7 +34,7 @@ void BufferHandle::Destroy() { if (!handle || !IsValid()) { return; } - handle->block_manager.buffer_manager.Unpin(handle); + handle->GetBufferManager().Unpin(handle); handle.reset(); node = nullptr; } diff --git a/src/duckdb/src/storage/buffer/buffer_pool.cpp b/src/duckdb/src/storage/buffer/buffer_pool.cpp index 9c13d4ccb..7fdb3ea12 100644 --- a/src/duckdb/src/storage/buffer/buffer_pool.cpp +++ b/src/duckdb/src/storage/buffer/buffer_pool.cpp @@ -5,6 +5,7 @@ #include "duckdb/parallel/concurrentqueue.hpp" #include "duckdb/parallel/task_scheduler.hpp" #include "duckdb/storage/block_allocator.hpp" +#include "duckdb/storage/object_cache.hpp" #include "duckdb/storage/temporary_memory_manager.hpp" namespace duckdb { @@ -314,16 +315,50 @@ TemporaryMemoryManager &BufferPool::GetTemporaryMemoryManager() { return *temporary_memory_manager; } +BufferPool::EvictionResult BufferPool::EvictObjectCacheEntries(MemoryTag tag, idx_t extra_memory, idx_t memory_limit) { + TempBufferPoolReservation r(tag, *this, extra_memory); + + if (memory_usage.GetUsedMemory(MemoryUsageCaches::NO_FLUSH) <= memory_limit) { + if (extra_memory > allocator_bulk_deallocation_flush_threshold) { + block_allocator.FlushAll(extra_memory); + } + return {true, std::move(r)}; + } + + bool success = false; + while (!object_cache->IsEmpty()) { + const idx_t freed_mem = object_cache->EvictToReduceMemory(extra_memory); + // Break if all entries cannot be evicted. + if (freed_mem == 0) { + break; + } + + if (memory_usage.GetUsedMemory(MemoryUsageCaches::NO_FLUSH) <= memory_limit) { + success = true; + break; + } + } + if (!success) { + r.Resize(0); + } else if (extra_memory > allocator_bulk_deallocation_flush_threshold) { + block_allocator.FlushAll(extra_memory); + } + + return {success, std::move(r)}; +} + BufferPool::EvictionResult BufferPool::EvictBlocks(MemoryTag tag, idx_t extra_memory, idx_t memory_limit, unique_ptr *buffer) { for (auto &queue : queues) { auto block_result = EvictBlocksInternal(*queue, tag, extra_memory, memory_limit, buffer); - if (block_result.success || RefersToSameObject(*queue, *queues.back())) { - return block_result; // Return upon success or upon last queue + if (block_result.success) { + return block_result; } } - // This can never happen since we always return when i == 1. Exception to silence compiler warning - throw InternalException("Exited BufferPool::EvictBlocksInternal without obtaining BufferPool::EvictionResult"); + + // Evict object cache, which is usually used to cache metadata and configs, when flushing buffer blocks alone is not + // enough to limit overall memory consumption. + return EvictObjectCacheEntries(tag, extra_memory, memory_limit); } BufferPool::EvictionResult BufferPool::EvictBlocksInternal(EvictionQueue &queue, MemoryTag tag, idx_t extra_memory, diff --git a/src/duckdb/src/storage/buffer/buffer_pool_reservation.cpp b/src/duckdb/src/storage/buffer/buffer_pool_reservation.cpp index 783a98079..f9fbe209a 100644 --- a/src/duckdb/src/storage/buffer/buffer_pool_reservation.cpp +++ b/src/duckdb/src/storage/buffer/buffer_pool_reservation.cpp @@ -1,4 +1,5 @@ -#include "duckdb/storage/buffer/block_handle.hpp" +#include "duckdb/storage/buffer/buffer_pool_reservation.hpp" + #include "duckdb/storage/buffer/buffer_pool.hpp" namespace duckdb { diff --git a/src/duckdb/src/storage/caching_file_system_wrapper.cpp b/src/duckdb/src/storage/caching_file_system_wrapper.cpp index dd29b7e39..a6c8278b4 100644 --- a/src/duckdb/src/storage/caching_file_system_wrapper.cpp +++ b/src/duckdb/src/storage/caching_file_system_wrapper.cpp @@ -312,6 +312,10 @@ void CachingFileSystemWrapper::RegisterSubSystem(FileCompressionType compression underlying_file_system.RegisterSubSystem(compression_type, std::move(fs)); } +void CachingFileSystemWrapper::UnregisterSubSystem(const string &name) { + underlying_file_system.UnregisterSubSystem(name); +} + unique_ptr CachingFileSystemWrapper::ExtractSubSystem(const string &name) { return underlying_file_system.ExtractSubSystem(name); } diff --git a/src/duckdb/src/storage/checkpoint/write_overflow_strings_to_disk.cpp b/src/duckdb/src/storage/checkpoint/write_overflow_strings_to_disk.cpp index 48ffb70bc..6e7134ed6 100644 --- a/src/duckdb/src/storage/checkpoint/write_overflow_strings_to_disk.cpp +++ b/src/duckdb/src/storage/checkpoint/write_overflow_strings_to_disk.cpp @@ -48,6 +48,18 @@ string UncompressedStringSegmentState::GetSegmentInfo() const { return "Overflow String Block Ids: " + result; } +void UncompressedStringSegmentState::InsertOverflowBlock(block_id_t block_id, reference block) { + auto write_lock = overflow_blocks_lock.GetExclusiveLock(); + overflow_blocks.insert(make_pair(block_id, block)); +} + +reference UncompressedStringSegmentState::FindOverflowBlock(block_id_t block_id) { + auto read_lock = overflow_blocks_lock.GetSharedLock(); + auto entry = overflow_blocks.find(block_id); + D_ASSERT(entry != overflow_blocks.end()); + return entry->second; +} + void WriteOverflowStringsToDisk::WriteString(UncompressedStringSegmentState &state, string_t string, block_id_t &result_block, int32_t &result_offset) { auto &block_manager = partial_block_manager.GetBlockManager(); diff --git a/src/duckdb/src/storage/compression/bitpacking.cpp b/src/duckdb/src/storage/compression/bitpacking.cpp index 156c9db35..6c057f6dd 100644 --- a/src/duckdb/src/storage/compression/bitpacking.cpp +++ b/src/duckdb/src/storage/compression/bitpacking.cpp @@ -642,7 +642,7 @@ struct BitpackingScanState : public SegmentScanState { //! depending on the bitpacking mode of that group. void LoadNextGroup() { D_ASSERT(bitpacking_metadata_ptr > handle.Ptr() && - (bitpacking_metadata_ptr < handle.Ptr() + current_segment.GetBlockManager().GetBlockSize())); + (bitpacking_metadata_ptr < handle.Ptr() + current_segment.GetBlockSize())); current_group_offset = 0; current_group = DecodeMeta(reinterpret_cast(bitpacking_metadata_ptr)); diff --git a/src/duckdb/src/storage/compression/dict_fsst/decompression.cpp b/src/duckdb/src/storage/compression/dict_fsst/decompression.cpp index f6befffe5..c27efd1e5 100644 --- a/src/duckdb/src/storage/compression/dict_fsst/decompression.cpp +++ b/src/duckdb/src/storage/compression/dict_fsst/decompression.cpp @@ -10,7 +10,7 @@ CompressedStringScanState::~CompressedStringScanState() { } string_t CompressedStringScanState::FetchStringFromDict(Vector &result, uint32_t dict_offset, idx_t dict_idx) { - D_ASSERT(dict_offset <= NumericCast(segment.GetBlockManager().GetBlockSize())); + D_ASSERT(dict_offset <= NumericCast(segment.GetBlockSize())); if (dict_idx == 0) { return string_t(nullptr, 0); @@ -69,7 +69,7 @@ void CompressedStringScanState::Initialize(bool initialize_dictionary) { auto dictionary_indices_dest = AlignValue(string_lengths_dest + string_lengths_space); const auto total_space = segment.GetBlockOffset() + dictionary_indices_dest + dictionary_indices_space; - if (total_space > segment.GetBlockManager().GetBlockSize()) { + if (total_space > segment.GetBlockSize()) { throw IOException( "Failed to scan dictionary string - index was out of range. Database file appears to be corrupted."); } diff --git a/src/duckdb/src/storage/compression/dictionary/decompression.cpp b/src/duckdb/src/storage/compression/dictionary/decompression.cpp index 6e389d026..cf631b6f9 100644 --- a/src/duckdb/src/storage/compression/dictionary/decompression.cpp +++ b/src/duckdb/src/storage/compression/dictionary/decompression.cpp @@ -33,14 +33,14 @@ void CompressedStringScanState::Initialize(ColumnSegment &segment, bool initiali index_buffer_count = Load(data_ptr_cast(&header_ptr->index_buffer_count)); current_width = (bitpacking_width_t)(Load(data_ptr_cast(&header_ptr->bitpacking_width))); if (segment.GetBlockOffset() + index_buffer_offset + sizeof(uint32_t) * index_buffer_count > - segment.GetBlockManager().GetBlockSize()) { + segment.GetBlockSize()) { throw IOException( "Failed to scan dictionary string - index was out of range. Database file appears to be corrupted."); } index_buffer_ptr = reinterpret_cast(baseptr + index_buffer_offset); base_data = data_ptr_cast(baseptr + DictionaryCompression::DICTIONARY_HEADER_SIZE); - block_size = segment.GetBlockManager().GetBlockSize(); + block_size = segment.GetBlockSize(); dict = DictionaryCompression::GetDictionary(segment, *handle); if (!initialize_dictionary) { diff --git a/src/duckdb/src/storage/compression/fsst.cpp b/src/duckdb/src/storage/compression/fsst.cpp index eba399754..4bd713b2e 100644 --- a/src/duckdb/src/storage/compression/fsst.cpp +++ b/src/duckdb/src/storage/compression/fsst.cpp @@ -573,7 +573,7 @@ struct FSSTScanState : public StringScanState { }; unique_ptr FSSTStorage::StringInitScan(const QueryContext &context, ColumnSegment &segment) { - auto block_size = segment.GetBlockManager().GetBlockSize(); + auto block_size = segment.GetBlockSize(); auto string_block_limit = StringUncompressed::GetStringBlockLimit(block_size); auto state = make_uniq(string_block_limit); auto &buffer_manager = BufferManager::GetBufferManager(segment.db); @@ -668,7 +668,7 @@ void FSSTStorage::StringScanPartial(ColumnSegment &segment, ColumnScanState &sta if (scan_state.duckdb_fsst_decoder) { D_ASSERT(result_offset == 0 || result.GetVectorType() == VectorType::FSST_VECTOR); result.SetVectorType(VectorType::FSST_VECTOR); - auto string_block_limit = StringUncompressed::GetStringBlockLimit(segment.GetBlockManager().GetBlockSize()); + auto string_block_limit = StringUncompressed::GetStringBlockLimit(segment.GetBlockSize()); FSSTVector::RegisterDecoder(result, scan_state.duckdb_fsst_decoder, string_block_limit); result_data = FSSTVector::GetCompressedData(result); } else { @@ -745,7 +745,7 @@ void FSSTStorage::StringFetchRow(ColumnSegment &segment, ColumnFetchState &state duckdb_fsst_decoder_t decoder; bitpacking_width_t width; - auto block_size = segment.GetBlockManager().GetBlockSize(); + auto block_size = segment.GetBlockSize(); auto have_symbol_table = ParseFSSTSegmentHeader(base_ptr, &decoder, &width, block_size); auto result_data = FlatVector::GetData(result); diff --git a/src/duckdb/src/storage/compression/rle.cpp b/src/duckdb/src/storage/compression/rle.cpp index 1b4699259..fd31d8f04 100644 --- a/src/duckdb/src/storage/compression/rle.cpp +++ b/src/duckdb/src/storage/compression/rle.cpp @@ -264,7 +264,7 @@ struct RLEScanState : public SegmentScanState { entry_pos = 0; position_in_entry = 0; rle_count_offset = UnsafeNumericCast(Load(handle.Ptr() + segment.GetBlockOffset())); - D_ASSERT(rle_count_offset <= segment.GetBlockManager().GetBlockSize()); + D_ASSERT(rle_count_offset <= segment.GetBlockSize()); } inline void SkipInternal(rle_count_t *index_pointer, idx_t skip_count) { diff --git a/src/duckdb/src/storage/compression/string_uncompressed.cpp b/src/duckdb/src/storage/compression/string_uncompressed.cpp index f2c246cce..c5d4f78de 100644 --- a/src/duckdb/src/storage/compression/string_uncompressed.cpp +++ b/src/duckdb/src/storage/compression/string_uncompressed.cpp @@ -68,7 +68,7 @@ void UncompressedStringInitPrefetch(ColumnSegment &segment, PrefetchState &prefe auto segment_state = segment.GetSegmentState(); if (segment_state) { auto &state = segment_state->Cast(); - auto &block_manager = segment.GetBlockManager(); + auto &block_manager = segment.block->GetBlockManager(); for (auto &block_id : state.on_disk_blocks) { auto block_handle = state.GetHandle(block_manager, block_id); prefetch_state.AddBlock(block_handle); @@ -221,7 +221,7 @@ idx_t UncompressedStringStorage::FinalizeAppend(ColumnSegment &segment, SegmentS auto offset_size = DICTIONARY_HEADER_SIZE + segment.count * sizeof(int32_t); auto total_size = offset_size + dict.size; - CompressionInfo info(segment.GetBlockManager()); + CompressionInfo info(segment.block->GetBlockManager()); if (total_size >= info.GetCompactionFlushLimit()) { // the block is full enough, don't bother moving around the dictionary return segment.SegmentSize(); @@ -337,14 +337,14 @@ void UncompressedStringStorage::WriteStringMemory(ColumnSegment &segment, string if (!state.head || state.head->offset + total_length >= state.head->size) { // string does not fit, allocate space for it // create a new string block - auto alloc_size = MaxValue(total_length, segment.GetBlockManager().GetBlockSize()); + auto alloc_size = MaxValue(total_length, segment.GetBlockSize()); auto new_block = make_uniq(); new_block->offset = 0; new_block->size = alloc_size; // allocate an in-memory buffer for it handle = buffer_manager.Allocate(MemoryTag::OVERFLOW_STRINGS, alloc_size, false); block = handle.GetBlockHandle(); - state.overflow_blocks.insert(make_pair(block->BlockId(), reference(*new_block))); + state.InsertOverflowBlock(block->BlockId(), reference(*new_block)); new_block->block = std::move(block); new_block->next = std::move(state.head); state.head = std::move(new_block); @@ -366,17 +366,16 @@ void UncompressedStringStorage::WriteStringMemory(ColumnSegment &segment, string string_t UncompressedStringStorage::ReadOverflowString(ColumnSegment &segment, Vector &result, block_id_t block, int32_t offset) { - auto &block_manager = segment.GetBlockManager(); - auto &buffer_manager = block_manager.buffer_manager; + auto &buffer_manager = segment.block->GetBufferManager(); auto &state = segment.GetSegmentState()->Cast(); D_ASSERT(block != INVALID_BLOCK); - D_ASSERT(offset < NumericCast(block_manager.GetBlockSize())); + D_ASSERT(offset < NumericCast(segment.GetBlockSize())); if (block < MAXIMUM_BLOCK) { // read the overflow string from disk // pin the initial handle and read the length - auto block_handle = state.GetHandle(block_manager, block); + auto block_handle = state.GetHandle(segment.block->GetBlockManager(), block); auto handle = buffer_manager.Pin(block_handle); // read header @@ -387,7 +386,7 @@ string_t UncompressedStringStorage::ReadOverflowString(ColumnSegment &segment, V BufferHandle target_handle; string_t overflow_string; data_ptr_t target_ptr; - bool allocate_block = length >= block_manager.GetBlockSize(); + bool allocate_block = length >= segment.GetBlockSize(); if (allocate_block) { // overflow string is bigger than a block - allocate a temporary buffer for it target_handle = buffer_manager.Allocate(MemoryTag::OVERFLOW_STRINGS, length); @@ -400,7 +399,7 @@ string_t UncompressedStringStorage::ReadOverflowString(ColumnSegment &segment, V // now append the string to the single buffer while (remaining > 0) { - idx_t to_write = MinValue(remaining, block_manager.GetBlockSize() - sizeof(block_id_t) - + idx_t to_write = MinValue(remaining, segment.GetBlockSize() - sizeof(block_id_t) - UnsafeNumericCast(offset)); memcpy(target_ptr, handle.Ptr() + offset, to_write); remaining -= to_write; @@ -409,7 +408,7 @@ string_t UncompressedStringStorage::ReadOverflowString(ColumnSegment &segment, V if (remaining > 0) { // read the next block block_id_t next_block = Load(handle.Ptr() + offset); - block_handle = state.GetHandle(block_manager, next_block); + block_handle = state.GetHandle(segment.block->GetBlockManager(), next_block); handle = buffer_manager.Pin(block_handle); offset = 0; } @@ -426,9 +425,8 @@ string_t UncompressedStringStorage::ReadOverflowString(ColumnSegment &segment, V // read the overflow string from memory // first pin the handle, if it is not pinned yet - auto entry = state.overflow_blocks.find(block); - D_ASSERT(entry != state.overflow_blocks.end()); - auto handle = buffer_manager.Pin(entry->second.get().block); + auto string_block = state.FindOverflowBlock(block); + auto handle = buffer_manager.Pin(string_block.get().block); auto final_buffer = handle.Ptr(); StringVector::AddHandle(result, std::move(handle)); return ReadStringWithLength(final_buffer, offset); diff --git a/src/duckdb/src/storage/compression/validity_uncompressed.cpp b/src/duckdb/src/storage/compression/validity_uncompressed.cpp index 49e3c2dc8..acb477a42 100644 --- a/src/duckdb/src/storage/compression/validity_uncompressed.cpp +++ b/src/duckdb/src/storage/compression/validity_uncompressed.cpp @@ -223,6 +223,17 @@ void ValidityUncompressed::UnalignedScan(data_ptr_t input, idx_t input_size, idx auto &result_mask = FlatVector::Validity(result); auto input_data = reinterpret_cast(input); +#ifdef DEBUG + // save boundary entries to verify we don't corrupt surrounding bits later. + idx_t debug_first_entry = result_offset / ValidityMask::BITS_PER_VALUE; + idx_t debug_last_entry = (result_offset + scan_count - 1) / ValidityMask::BITS_PER_VALUE; + auto debug_result_data = (validity_t *)result_mask.GetData(); + validity_t debug_original_first_entry = + debug_result_data ? debug_result_data[debug_first_entry] : ValidityMask::ValidityBuffer::MAX_ENTRY; + validity_t debug_original_last_entry = + debug_result_data ? debug_result_data[debug_last_entry] : ValidityMask::ValidityBuffer::MAX_ENTRY; +#endif + #if STANDARD_VECTOR_SIZE < 128 // fallback for tiny vector sizes // the bitwise ops we use below don't work if the vector size is too small @@ -248,118 +259,163 @@ void ValidityUncompressed::UnalignedScan(data_ptr_t input, idx_t input_size, idx idx_t input_entry = input_start / ValidityMask::BITS_PER_VALUE; idx_t input_idx = input_start - input_entry * ValidityMask::BITS_PER_VALUE; + // Window scanning algorithm -- the goal is to copy a contiguous sequence of bits from input into result, + // and to do this using bit operations on 64 bit fields. + // + // On each loop iteration, we are inspecting a 64 bit field in both the input and result, starting at a certain + // index (in the code, these are denoted by input(result)_entry and input(result)_index, respectively. + // + // For example, on the first loop iteration for the diagram, both entries are entry 0, and the starting indexes are + // the index of window 1 in each entry. + // + // input(result)_window is the window from input(result)_index to the end of either the current bit field, or + // the end of the range of bits we are trying to copy if that is contained within the current entry. + // + // window is minimum(input_window, result_window), which is window 1 on the first iteration, window 2 on the + // second iteration, etc. These are what are shown in the diagram below. + // + // INPUT: + // 0 63| 127| 191 + // +-------------------------------+--------------------------------+--------------------------------+ + // | [ 1 ]|[ 2 ][ 3 ]|[ 4 ][ 5 ]| + // +-------------------------------+--------------------------------+--------------------------------+ + // + // RESULT: + // 0 63| 127| 191 + // +-------------------------------+--------------------------------+--------------------------------+ + // [ 1 ][ 2 ]|[ 3 ][ 4 ]|[ 5 ] | + // +-------------------------------+--------------------------------+--------------------------------+ + // + // Note: in case this ever becomes a bottleneck, it should be possible to make each loop iteration branchless. + // The idea would be to do an odd iteration before the loop, then have two loops depending on the layout of the + // windows that will either shift left then right on each iteration, or the other loop will always shift right + // then left. For example, in the diagram above, we would first apply the first window outside of the loop + // beforehand, then we can see that each loop iteration requires us to shift right, fetch a new result entry, + // shift left, fetch a new input entry. This would have to be generalized to two possible branchless loops, + // depending on the input. + // now start the bit games idx_t pos = 0; while (pos < scan_count) { - // these are the current validity entries we are dealing with - idx_t current_result_idx = result_entry; - idx_t offset; validity_t input_mask = input_data[input_entry]; + idx_t bits_left = scan_count - pos; - // construct the mask to AND together with the result - if (result_idx < input_idx) { - // +======================================+ - // input: |xxxxxxxxx| | - // +======================================+ - // - // +======================================+ - // result: | xxxxxxxxx| | - // +======================================+ - // 1. We shift (>>) 'input' to line up with 'result' - // 2. We set the bits we shifted to 1 + // these are bits left within the current entries (possibly extra than what we need). + idx_t input_bits_left = ValidityMask::BITS_PER_VALUE - input_idx; + idx_t result_bits_left = ValidityMask::BITS_PER_VALUE - result_idx; - // we have to shift the input RIGHT if the result_idx is smaller than the input_idx - auto shift_amount = input_idx - result_idx; - D_ASSERT(shift_amount > 0 && shift_amount <= ValidityMask::BITS_PER_VALUE); + // these are the bits left within the current entries that need to be processed. + idx_t input_window_size = MinValue(bits_left, input_bits_left); + idx_t result_window_size = MinValue(bits_left, result_bits_left); - input_mask = input_mask >> shift_amount; + // the smaller of the two is our next window to copy from input to result. + idx_t window_size = MinValue(input_window_size, result_window_size); - // now the upper "shift_amount" bits are set to 0 - // we need them to be set to 1 - // otherwise the subsequent bitwise & will modify values outside of the range of values we want to alter - input_mask |= ValidityUncompressed::UPPER_MASKS[shift_amount]; + // Now within each loop iteration, we can think of the general case that handles all scenarios as just + // copying the window from the starting index in input to the window in the starting index of result. - if (pos == 0) { - // We also need to set the lower bits, which are to the left of the relevant bits (x), to 1 - // These are the bits that are "behind" this scan window, and should not affect this scan - auto non_relevant_mask = ValidityUncompressed::LOWER_MASKS[result_idx]; - input_mask |= non_relevant_mask; - } - - // after this, we move to the next input_entry - offset = ValidityMask::BITS_PER_VALUE - input_idx; - input_entry++; - input_idx = 0; - result_idx += offset; - } else if (result_idx > input_idx) { - // +======================================+ - // input: | xxxxxxxxx| | - // +======================================+ + // First, line up the windows: + if (result_idx < input_idx) { + // X is arbitrary bits, P is arbitrary protected bits. + // INPUT ENTRY: + // 63 0 + // +--------------------------------------------------------------------------------------------------+ + // |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX[=============WINDOW=============]XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX| + // +--------------------------------------------------------------------------------------------------+ + // ^ + // input_idx // - // +======================================+ - // result: |xxxxxxxxx| | - // +======================================+ - // 1. We set the bits to the left of the relevant bits (x) to 0 - // 1. We shift (<<) 'input' to line up with 'result' - // 2. We set the bits that we zeroed to the right of the relevant bits (x) to 1 - - // we have to shift the input LEFT if the result_idx is bigger than the input_idx - auto shift_amount = result_idx - input_idx; - D_ASSERT(shift_amount > 0 && shift_amount <= ValidityMask::BITS_PER_VALUE); - - // to avoid overflows, we set the upper "shift_amount" values to 0 first - input_mask = (input_mask & ~ValidityUncompressed::UPPER_MASKS[shift_amount]) << shift_amount; - - // now the lower "shift_amount" bits are set to 0 - // we need them to be set to 1 - // otherwise the subsequent bitwise & will modify values outside of the range of values we want to alter - input_mask |= ValidityUncompressed::LOWER_MASKS[shift_amount]; - - // after this, we move to the next result_entry - offset = ValidityMask::BITS_PER_VALUE - result_idx; - result_entry++; - result_idx = 0; - input_idx += offset; - } else { - // if the input_idx is equal to result_idx they are already aligned - // we just move to the next entry for both after this - offset = ValidityMask::BITS_PER_VALUE - result_idx; - input_entry++; - result_entry++; - result_idx = input_idx = 0; - } - // now we need to check if we should include the ENTIRE mask - // OR if we need to mask from the right side - pos += offset; - if (pos > scan_count) { - // +======================================+ - // mask: | |xxxxxxxxxxxxxxxxxxxxxxxxx| - // +======================================+ + // RESULT ENTRY: + // 63 0 + // +--------------------------------------------------------------------------------------------------+ + // |PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP[=============WINDOW=============]PPPPPPPPPPPPPPPPPPPPPP| + // +--------------------------------------------------------------------------------------------------+ + // ^ + // result_idx // - // The bits on the right side of the relevant bits (x) need to stay 1, to be adjusted by later scans - // so we adjust the mask to clear out any 0s that might be present on the right side. + idx_t shift_amount = input_idx - result_idx; + input_mask = input_mask >> shift_amount; + } else { + // current_result_idx >= current_input_idx + idx_t shift_amount = result_idx - input_idx; + input_mask = (input_mask & ~UPPER_MASKS[shift_amount]); - // we need to set any bits that are past the scan_count on the right-side to 1 - // this is required so we don't influence any bits that are not part of the scan - input_mask |= ValidityUncompressed::UPPER_MASKS[pos - scan_count]; + // X is arbitrary bits, P is arbitrary protected bits. + // Note the zeroed out bits in INPUT_ENTRY - these have to be zeroed before shifting left to align with + // result window, to prevent overflow. + // + // INPUT ENTRY: + // 63 0 + // +--------------------------------------------------------------------------------------------------+ + // |000000000000XXXXXXXXXXXXXXXXXXXX[=============WINDOW=============]XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX| + // +--------------------------------------------------------------------------------------------------+ + // ^ + // input_idx + // + // RESULT ENTRY: + // 63 0 + // +--------------------------------------------------------------------------------------------------+ + // |PPPPPPPPPPPPPPPPPPPP[=============WINDOW=============]PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP| + // +--------------------------------------------------------------------------------------------------+ + // ^ + // result_idx + input_mask = input_mask << shift_amount; } - // now finally we can merge the input mask with the result mask + + // Once the windows are aligned, mask the input to prevent overwriting protected bits in the result_mask. + auto protected_upper_bits = UPPER_MASKS[ValidityMask::BITS_PER_VALUE - result_idx - window_size]; + auto protected_lower_bits = LOWER_MASKS[result_idx]; + input_mask |= protected_upper_bits; + input_mask |= protected_lower_bits; + if (input_mask != ValidityMask::ValidityBuffer::MAX_ENTRY) { if (!result_data) { result_mask.Initialize(); result_data = (validity_t *)result_mask.GetData(); } - result_data[current_result_idx] &= input_mask; + result_data[result_entry] &= input_mask; + } + // Now update pos, entries, and indexes for the next iteration. + pos += window_size; + + // Windows can only go until the end of the current entry, so the mod can only wrap to 0 here. + input_idx = (input_idx + window_size) % ValidityMask::BITS_PER_VALUE; + result_idx = (result_idx + window_size) % ValidityMask::BITS_PER_VALUE; + + // Advance entries if the mod was 0. + if (input_idx == 0) { + input_entry++; + } + if (result_idx == 0) { + result_entry++; } } #endif #ifdef DEBUG - // verify that we actually accomplished the bitwise ops equivalent that we wanted to do - ValidityMask input_mask(input_data, input_size); - for (idx_t i = 0; i < scan_count; i++) { - D_ASSERT(result_mask.RowIsValid(result_offset + i) == input_mask.RowIsValid(input_start + i)); - } + // FIXME: Previously, this function had an assumption that all the bits in the result range we are copying + // to were all set to valid. with dict_fsst compression, this is no longer the case, so if we want to have + // a debug verification of the result here, we need to check that all the bits that were initially valid + // in the result range have the same value as the corresponding bit in the input, and if they are invalid + // they remain invalid. + + // verify surrounding bits weren't modified + auto debug_final_result_data = (validity_t *)result_mask.GetData(); + validity_t debug_final_first_entry = + debug_final_result_data ? debug_final_result_data[debug_first_entry] : ValidityMask::ValidityBuffer::MAX_ENTRY; + validity_t debug_final_last_entry = + debug_final_result_data ? debug_final_result_data[debug_last_entry] : ValidityMask::ValidityBuffer::MAX_ENTRY; + + idx_t first_bit_in_first_entry = result_offset % ValidityMask::BITS_PER_VALUE; + idx_t last_bit_in_last_entry = (result_offset + scan_count - 1) % ValidityMask::BITS_PER_VALUE; + + // lower bits of first entry should be unchanged + validity_t lower_mask = LOWER_MASKS[first_bit_in_first_entry]; + D_ASSERT((debug_original_first_entry & lower_mask) == (debug_final_first_entry & lower_mask)); + + // upper bits of last entry should be unchanged + validity_t upper_mask = UPPER_MASKS[ValidityMask::BITS_PER_VALUE - last_bit_in_last_entry - 1]; + D_ASSERT((debug_original_last_entry & upper_mask) == (debug_final_last_entry & upper_mask)); #endif } diff --git a/src/duckdb/src/storage/compression/zstd.cpp b/src/duckdb/src/storage/compression/zstd.cpp index 32309bcbd..5598f7135 100644 --- a/src/duckdb/src/storage/compression/zstd.cpp +++ b/src/duckdb/src/storage/compression/zstd.cpp @@ -695,7 +695,7 @@ struct ZSTDScanState : public SegmentScanState { public: explicit ZSTDScanState(ColumnSegment &segment) : state(segment.GetSegmentState()->Cast()), - block_manager(segment.GetBlockManager()), buffer_manager(BufferManager::GetBufferManager(segment.db)), + block_manager(segment.block->GetBlockManager()), buffer_manager(BufferManager::GetBufferManager(segment.db)), segment_block_offset(segment.GetBlockOffset()), segment(segment) { decompression_context = duckdb_zstd::ZSTD_createDCtx(); segment_handle = buffer_manager.Pin(segment.block); diff --git a/src/duckdb/src/storage/external_file_cache.cpp b/src/duckdb/src/storage/external_file_cache.cpp index 304116c7f..14a4f12a6 100644 --- a/src/duckdb/src/storage/external_file_cache.cpp +++ b/src/duckdb/src/storage/external_file_cache.cpp @@ -39,7 +39,7 @@ ExternalFileCache::CachedFileRange::GetOverlap(const CachedFileRange &other) con void ExternalFileCache::CachedFileRange::AddCheckSum() { #ifdef DEBUG D_ASSERT(checksum == 0); - auto buffer_handle = block_handle->block_manager.buffer_manager.Pin(block_handle); + auto buffer_handle = block_handle->GetBufferManager().Pin(block_handle); checksum = Checksum(buffer_handle.Ptr(), nr_bytes); #endif } @@ -49,7 +49,7 @@ void ExternalFileCache::CachedFileRange::VerifyCheckSum() { if (checksum == 0) { return; } - auto buffer_handle = block_handle->block_manager.buffer_manager.Pin(block_handle); + auto buffer_handle = block_handle->GetBufferManager().Pin(block_handle); if (!buffer_handle.IsValid()) { return; } diff --git a/src/duckdb/src/storage/open_file_storage_extension.cpp b/src/duckdb/src/storage/open_file_storage_extension.cpp index 1daf5b5e6..25dbacbe9 100644 --- a/src/duckdb/src/storage/open_file_storage_extension.cpp +++ b/src/duckdb/src/storage/open_file_storage_extension.cpp @@ -71,8 +71,8 @@ unique_ptr OpenFileStorageTransactionManager(optional_ptr(db); } -unique_ptr OpenFileStorageExtension::Create() { - auto result = make_uniq(); +shared_ptr OpenFileStorageExtension::Create() { + auto result = make_shared_ptr(); result->attach = OpenFileStorageAttach; result->create_transaction_manager = OpenFileStorageTransactionManager; return result; diff --git a/src/duckdb/src/storage/optimistic_data_writer.cpp b/src/duckdb/src/storage/optimistic_data_writer.cpp index 186c6013d..08a971b3c 100644 --- a/src/duckdb/src/storage/optimistic_data_writer.cpp +++ b/src/duckdb/src/storage/optimistic_data_writer.cpp @@ -23,7 +23,9 @@ OptimisticDataWriter::~OptimisticDataWriter() { bool OptimisticDataWriter::PrepareWrite() { // check if we should pre-emptively write the table to disk - if (table.IsTemporary() || StorageManager::Get(table.GetAttached()).InMemory()) { + auto &attached = table.GetAttached(); + auto &storage_manager = StorageManager::Get(attached); + if (table.IsTemporary() || storage_manager.InMemory() || attached.IsReadOnly()) { return false; } // we should! write the second-to-last row group to disk diff --git a/src/duckdb/src/storage/serialization/serialize_create_info.cpp b/src/duckdb/src/storage/serialization/serialize_create_info.cpp index 8469f606c..7e3f82192 100644 --- a/src/duckdb/src/storage/serialization/serialize_create_info.cpp +++ b/src/duckdb/src/storage/serialization/serialize_create_info.cpp @@ -205,17 +205,27 @@ void CreateViewInfo::Serialize(Serializer &serializer) const { serializer.WritePropertyWithDefault>(202, "types", types); serializer.WritePropertyWithDefault>(203, "query", query); serializer.WritePropertyWithDefault>(204, "names", names); - serializer.WritePropertyWithDefault>(205, "column_comments", column_comments, vector()); + if (!serializer.ShouldSerialize(7)) { + serializer.WritePropertyWithDefault>(205, "column_comments", GetColumnCommentsList()); + } + if (serializer.ShouldSerialize(7)) { + serializer.WritePropertyWithDefault>(206, "column_comments_map", column_comments_map, unordered_map()); + } } unique_ptr CreateViewInfo::Deserialize(Deserializer &deserializer) { - auto result = duckdb::unique_ptr(new CreateViewInfo()); - deserializer.ReadPropertyWithDefault(200, "view_name", result->view_name); - deserializer.ReadPropertyWithDefault>(201, "aliases", result->aliases); - deserializer.ReadPropertyWithDefault>(202, "types", result->types); - deserializer.ReadPropertyWithDefault>(203, "query", result->query); - deserializer.ReadPropertyWithDefault>(204, "names", result->names); - deserializer.ReadPropertyWithExplicitDefault>(205, "column_comments", result->column_comments, vector()); + auto view_name = deserializer.ReadPropertyWithDefault(200, "view_name"); + auto aliases = deserializer.ReadPropertyWithDefault>(201, "aliases"); + auto types = deserializer.ReadPropertyWithDefault>(202, "types"); + auto query = deserializer.ReadPropertyWithDefault>(203, "query"); + auto names = deserializer.ReadPropertyWithDefault>(204, "names"); + auto column_comments = deserializer.ReadPropertyWithDefault>(205, "column_comments"); + auto column_comments_map = deserializer.ReadPropertyWithExplicitDefault>(206, "column_comments_map", unordered_map()); + auto result = duckdb::unique_ptr(new CreateViewInfo(std::move(names), std::move(column_comments), std::move(column_comments_map))); + result->view_name = std::move(view_name); + result->aliases = std::move(aliases); + result->types = std::move(types); + result->query = std::move(query); return std::move(result); } diff --git a/src/duckdb/src/storage/serialization/serialize_logical_operator.cpp b/src/duckdb/src/storage/serialization/serialize_logical_operator.cpp index 0231144e0..4338cf16f 100644 --- a/src/duckdb/src/storage/serialization/serialize_logical_operator.cpp +++ b/src/duckdb/src/storage/serialization/serialize_logical_operator.cpp @@ -290,6 +290,7 @@ void LogicalCTERef::Serialize(Serializer &serializer) const { serializer.WritePropertyWithDefault(201, "cte_index", cte_index); serializer.WritePropertyWithDefault>(202, "chunk_types", chunk_types); serializer.WritePropertyWithDefault>(203, "bound_columns", bound_columns); + /* [Deleted] (CTEMaterialize) "materialized_cte" */ serializer.WritePropertyWithDefault(205, "is_recurring", is_recurring); } @@ -299,6 +300,7 @@ unique_ptr LogicalCTERef::Deserialize(Deserializer &deserialize auto chunk_types = deserializer.ReadPropertyWithDefault>(202, "chunk_types"); auto bound_columns = deserializer.ReadPropertyWithDefault>(203, "bound_columns"); auto result = duckdb::unique_ptr(new LogicalCTERef(table_index, cte_index, std::move(chunk_types), std::move(bound_columns))); + deserializer.ReadDeletedProperty(204, "materialized_cte"); deserializer.ReadPropertyWithDefault(205, "is_recurring", result->is_recurring); return std::move(result); } @@ -328,7 +330,7 @@ void LogicalComparisonJoin::Serialize(Serializer &serializer) const { serializer.WritePropertyWithDefault>(205, "mark_types", mark_types); serializer.WritePropertyWithDefault>>(206, "duplicate_eliminated_columns", duplicate_eliminated_columns); serializer.WritePropertyWithDefault(207, "delim_flipped", delim_flipped, false); - serializer.WritePropertyWithDefault>(208, "predicate", predicate); + /* [Deleted] (unique_ptr) "predicate" */ } unique_ptr LogicalComparisonJoin::Deserialize(Deserializer &deserializer) { @@ -341,7 +343,7 @@ unique_ptr LogicalComparisonJoin::Deserialize(Deserializer &des deserializer.ReadPropertyWithDefault>(205, "mark_types", result->mark_types); deserializer.ReadPropertyWithDefault>>(206, "duplicate_eliminated_columns", result->duplicate_eliminated_columns); deserializer.ReadPropertyWithExplicitDefault(207, "delim_flipped", result->delim_flipped, false); - deserializer.ReadPropertyWithDefault>(208, "predicate", result->predicate); + deserializer.ReadDeletedProperty>(208, "predicate"); return std::move(result); } @@ -617,6 +619,7 @@ void LogicalMergeInto::Serialize(Serializer &serializer) const { serializer.WriteProperty(204, "source_marker", source_marker); serializer.WritePropertyWithDefault>>>(205, "actions", actions); serializer.WritePropertyWithDefault(206, "return_chunk", return_chunk); + serializer.WritePropertyWithDefault>(207, "delete_return_columns", delete_return_columns); } unique_ptr LogicalMergeInto::Deserialize(Deserializer &deserializer) { @@ -628,6 +631,7 @@ unique_ptr LogicalMergeInto::Deserialize(Deserializer &deserial deserializer.ReadProperty(204, "source_marker", result->source_marker); deserializer.ReadPropertyWithDefault>>>(205, "actions", result->actions); deserializer.ReadPropertyWithDefault(206, "return_chunk", result->return_chunk); + deserializer.ReadPropertyWithDefault>(207, "delete_return_columns", result->delete_return_columns); return std::move(result); } diff --git a/src/duckdb/src/storage/serialization/serialize_nodes.cpp b/src/duckdb/src/storage/serialization/serialize_nodes.cpp index 06dfe3eaf..ededc48fd 100644 --- a/src/duckdb/src/storage/serialization/serialize_nodes.cpp +++ b/src/duckdb/src/storage/serialization/serialize_nodes.cpp @@ -5,8 +5,6 @@ #include "duckdb/common/serializer/serializer.hpp" #include "duckdb/common/serializer/deserializer.hpp" -#include "duckdb/common/types.hpp" -#include "duckdb/common/extra_type_info.hpp" #include "duckdb/parser/common_table_expression_info.hpp" #include "duckdb/parser/query_node.hpp" #include "duckdb/parser/result_modifier.hpp" @@ -346,22 +344,10 @@ void JoinCondition::Serialize(Serializer &serializer) const { } JoinCondition JoinCondition::Deserialize(Deserializer &deserializer) { - JoinCondition result; - deserializer.ReadPropertyWithDefault>(100, "left", result.left); - deserializer.ReadPropertyWithDefault>(101, "right", result.right); - deserializer.ReadProperty(102, "comparison", result.comparison); - return result; -} - -void LogicalType::Serialize(Serializer &serializer) const { - serializer.WriteProperty(100, "id", id_); - serializer.WritePropertyWithDefault>(101, "type_info", type_info_); -} - -LogicalType LogicalType::Deserialize(Deserializer &deserializer) { - auto id = deserializer.ReadProperty(100, "id"); - auto type_info = deserializer.ReadPropertyWithDefault>(101, "type_info"); - LogicalType result(id, std::move(type_info)); + auto left = deserializer.ReadPropertyWithDefault>(100, "left"); + auto right = deserializer.ReadPropertyWithDefault>(101, "right"); + auto comparison = deserializer.ReadProperty(102, "comparison"); + JoinCondition result(std::move(left), std::move(right), comparison); return result; } @@ -429,20 +415,6 @@ PivotColumn PivotColumn::Deserialize(Deserializer &deserializer) { return result; } -void PivotColumnEntry::Serialize(Serializer &serializer) const { - serializer.WritePropertyWithDefault>(100, "values", values); - serializer.WritePropertyWithDefault>(101, "star_expr", expr); - serializer.WritePropertyWithDefault(102, "alias", alias); -} - -PivotColumnEntry PivotColumnEntry::Deserialize(Deserializer &deserializer) { - PivotColumnEntry result; - deserializer.ReadPropertyWithDefault>(100, "values", result.values); - deserializer.ReadPropertyWithDefault>(101, "star_expr", result.expr); - deserializer.ReadPropertyWithDefault(102, "alias", result.alias); - return result; -} - void QualifiedColumnName::Serialize(Serializer &serializer) const { serializer.WritePropertyWithDefault(100, "catalog", catalog); serializer.WritePropertyWithDefault(101, "schema", schema); diff --git a/src/duckdb/src/storage/serialization/serialize_parse_info.cpp b/src/duckdb/src/storage/serialization/serialize_parse_info.cpp index a5616e0e6..e5ffc2c45 100644 --- a/src/duckdb/src/storage/serialization/serialize_parse_info.cpp +++ b/src/duckdb/src/storage/serialization/serialize_parse_info.cpp @@ -164,6 +164,9 @@ unique_ptr AlterTableInfo::Deserialize(Deserializer &deserializer) { case AlterTableType::RENAME_TABLE: result = RenameTableInfo::Deserialize(deserializer); break; + case AlterTableType::RESET_TABLE_OPTIONS: + result = ResetTableOptionsInfo::Deserialize(deserializer); + break; case AlterTableType::SET_DEFAULT: result = SetDefaultInfo::Deserialize(deserializer); break; @@ -176,6 +179,9 @@ unique_ptr AlterTableInfo::Deserialize(Deserializer &deserializer) { case AlterTableType::SET_SORTED_BY: result = SetSortedByInfo::Deserialize(deserializer); break; + case AlterTableType::SET_TABLE_OPTIONS: + result = SetTableOptionsInfo::Deserialize(deserializer); + break; default: throw SerializationException("Unsupported type for deserialization of AlterTableInfo!"); } @@ -550,6 +556,17 @@ unique_ptr RenameViewInfo::Deserialize(Deserializer &deserializer return std::move(result); } +void ResetTableOptionsInfo::Serialize(Serializer &serializer) const { + AlterTableInfo::Serialize(serializer); + serializer.WriteProperty(400, "table_options", table_options); +} + +unique_ptr ResetTableOptionsInfo::Deserialize(Deserializer &deserializer) { + auto result = duckdb::unique_ptr(new ResetTableOptionsInfo()); + deserializer.ReadProperty(400, "table_options", result->table_options); + return std::move(result); +} + void SetColumnCommentInfo::Serialize(Serializer &serializer) const { AlterInfo::Serialize(serializer); serializer.WriteProperty(300, "catalog_entry_type", catalog_entry_type); @@ -624,6 +641,17 @@ unique_ptr SetSortedByInfo::Deserialize(Deserializer &deserializ return std::move(result); } +void SetTableOptionsInfo::Serialize(Serializer &serializer) const { + AlterTableInfo::Serialize(serializer); + serializer.WritePropertyWithDefault>>(400, "table_options", table_options); +} + +unique_ptr SetTableOptionsInfo::Deserialize(Deserializer &deserializer) { + auto result = duckdb::unique_ptr(new SetTableOptionsInfo()); + deserializer.ReadPropertyWithDefault>>(400, "table_options", result->table_options); + return std::move(result); +} + void TransactionInfo::Serialize(Serializer &serializer) const { ParseInfo::Serialize(serializer); serializer.WriteProperty(200, "type", type); diff --git a/src/duckdb/src/storage/serialization/serialize_parsed_expression.cpp b/src/duckdb/src/storage/serialization/serialize_parsed_expression.cpp index 54dfd646e..dc54bc327 100644 --- a/src/duckdb/src/storage/serialization/serialize_parsed_expression.cpp +++ b/src/duckdb/src/storage/serialization/serialize_parsed_expression.cpp @@ -75,6 +75,9 @@ unique_ptr ParsedExpression::Deserialize(Deserializer &deseria case ExpressionClass::SUBQUERY: result = SubqueryExpression::Deserialize(deserializer); break; + case ExpressionClass::TYPE: + result = TypeExpression::Deserialize(deserializer); + break; case ExpressionClass::WINDOW: result = WindowExpression::Deserialize(deserializer); break; @@ -331,6 +334,23 @@ unique_ptr SubqueryExpression::Deserialize(Deserializer &deser return std::move(result); } +void TypeExpression::Serialize(Serializer &serializer) const { + ParsedExpression::Serialize(serializer); + serializer.WritePropertyWithDefault(200, "catalog", catalog); + serializer.WritePropertyWithDefault(201, "schema", schema); + serializer.WritePropertyWithDefault(202, "type_name", type_name); + serializer.WritePropertyWithDefault>>(203, "children", children); +} + +unique_ptr TypeExpression::Deserialize(Deserializer &deserializer) { + auto result = duckdb::unique_ptr(new TypeExpression()); + deserializer.ReadPropertyWithDefault(200, "catalog", result->catalog); + deserializer.ReadPropertyWithDefault(201, "schema", result->schema); + deserializer.ReadPropertyWithDefault(202, "type_name", result->type_name); + deserializer.ReadPropertyWithDefault>>(203, "children", result->children); + return std::move(result); +} + void WindowExpression::Serialize(Serializer &serializer) const { ParsedExpression::Serialize(serializer); serializer.WritePropertyWithDefault(200, "function_name", function_name); diff --git a/src/duckdb/src/storage/serialization/serialize_types.cpp b/src/duckdb/src/storage/serialization/serialize_types.cpp index 8e77ef866..1f9c06325 100644 --- a/src/duckdb/src/storage/serialization/serialize_types.cpp +++ b/src/duckdb/src/storage/serialization/serialize_types.cpp @@ -62,8 +62,8 @@ shared_ptr ExtraTypeInfo::Deserialize(Deserializer &deserializer) case ExtraTypeInfoType::TEMPLATE_TYPE_INFO: result = TemplateTypeInfo::Deserialize(deserializer); break; - case ExtraTypeInfoType::USER_TYPE_INFO: - result = UserTypeInfo::Deserialize(deserializer); + case ExtraTypeInfoType::UNBOUND_TYPE_INFO: + result = UnboundTypeInfo::Deserialize(deserializer); break; default: throw SerializationException("Unsupported type for deserialization of ExtraTypeInfo!"); @@ -78,6 +78,9 @@ void AggregateStateTypeInfo::Serialize(Serializer &serializer) const { serializer.WritePropertyWithDefault(200, "function_name", state_type.function_name); serializer.WriteProperty(201, "return_type", state_type.return_type); serializer.WritePropertyWithDefault>(202, "bound_argument_types", state_type.bound_argument_types); + if (serializer.ShouldSerialize(7)) { + serializer.WritePropertyWithDefault(203, "state_type", state_type.state_type, LogicalTypeId::INVALID); + } } shared_ptr AggregateStateTypeInfo::Deserialize(Deserializer &deserializer) { @@ -85,6 +88,7 @@ shared_ptr AggregateStateTypeInfo::Deserialize(Deserializer &dese deserializer.ReadPropertyWithDefault(200, "function_name", result->state_type.function_name); deserializer.ReadProperty(201, "return_type", result->state_type.return_type); deserializer.ReadPropertyWithDefault>(202, "bound_argument_types", result->state_type.bound_argument_types); + deserializer.ReadPropertyWithExplicitDefault(203, "state_type", result->state_type.state_type, LogicalTypeId::INVALID); return std::move(result); } @@ -217,21 +221,4 @@ shared_ptr TemplateTypeInfo::Deserialize(Deserializer &deserializ return std::move(result); } -void UserTypeInfo::Serialize(Serializer &serializer) const { - ExtraTypeInfo::Serialize(serializer); - serializer.WritePropertyWithDefault(200, "user_type_name", user_type_name); - serializer.WritePropertyWithDefault(201, "catalog", catalog, string()); - serializer.WritePropertyWithDefault(202, "schema", schema, string()); - serializer.WritePropertyWithDefault>(203, "user_type_modifiers", user_type_modifiers); -} - -shared_ptr UserTypeInfo::Deserialize(Deserializer &deserializer) { - auto result = duckdb::shared_ptr(new UserTypeInfo()); - deserializer.ReadPropertyWithDefault(200, "user_type_name", result->user_type_name); - deserializer.ReadPropertyWithExplicitDefault(201, "catalog", result->catalog, string()); - deserializer.ReadPropertyWithExplicitDefault(202, "schema", result->schema, string()); - deserializer.ReadPropertyWithDefault>(203, "user_type_modifiers", result->user_type_modifiers); - return std::move(result); -} - } // namespace duckdb diff --git a/src/duckdb/src/storage/standard_buffer_manager.cpp b/src/duckdb/src/storage/standard_buffer_manager.cpp index 691f5912c..c5f839832 100644 --- a/src/duckdb/src/storage/standard_buffer_manager.cpp +++ b/src/duckdb/src/storage/standard_buffer_manager.cpp @@ -218,7 +218,7 @@ void StandardBufferManager::ReAllocate(shared_ptr &handle, idx_t bl D_ASSERT(handle_memory_usage == handle->GetBuffer(lock)->AllocSize()); D_ASSERT(handle_memory_usage == handle->GetMemoryCharge(lock).size); - auto req = handle->GetBuffer(lock)->CalculateMemory(block_size, handle->block_manager.GetBlockHeaderSize()); + auto req = handle->GetBuffer(lock)->CalculateMemory(block_size, handle->GetBlockHeaderSize()); int64_t memory_delta = NumericCast(req.alloc_size) - NumericCast(handle_memory_usage); if (memory_delta == 0) { @@ -245,7 +245,6 @@ void StandardBufferManager::ReAllocate(shared_ptr &handle, idx_t bl void StandardBufferManager::BatchRead(vector> &handles, const map &load_map, block_id_t first_block, block_id_t last_block) { - auto &block_manager = handles[0]->block_manager; idx_t block_count = NumericCast(last_block - first_block + 1); if (block_count == 1) { if (Settings::Get(db) != StorageBlockPrefetch::DEBUG_FORCE_ALWAYS) { @@ -256,12 +255,14 @@ void StandardBufferManager::BatchRead(vector> &handles, } } - // allocate a buffer to hold the data of all of the blocks - auto total_block_size = block_count * block_manager.GetBlockAllocSize(); + // Allocate a buffer to hold the data of all blocks. + auto block_alloc_size = handles[0]->GetBlockAllocSize(); + auto total_block_size = block_count * block_alloc_size; auto batch_memory = RegisterMemory(MemoryTag::BASE_TABLE, total_block_size, 0, true); auto intermediate_buffer = Pin(batch_memory); // perform a batch read of the blocks into the buffer + auto &block_manager = handles[0]->GetBlockManager(); block_manager.ReadBlocks(intermediate_buffer.GetFileBuffer(), first_block, block_count); // the blocks are read - now we need to assign them to the individual blocks @@ -288,8 +289,7 @@ void StandardBufferManager::BatchRead(vector> &handles, reservation.Resize(0); continue; } - auto block_ptr = - intermediate_buffer.GetFileBuffer().InternalBuffer() + block_idx * block_manager.GetBlockAllocSize(); + auto block_ptr = intermediate_buffer.GetFileBuffer().InternalBuffer() + block_idx * block_alloc_size; buf = handle->LoadFromBuffer(lock, block_ptr, std::move(reusable_buffer), std::move(reservation)); } } diff --git a/src/duckdb/src/storage/statistics/variant_stats.cpp b/src/duckdb/src/storage/statistics/variant_stats.cpp index ca93aa608..ff6db38fc 100644 --- a/src/duckdb/src/storage/statistics/variant_stats.cpp +++ b/src/duckdb/src/storage/statistics/variant_stats.cpp @@ -150,7 +150,10 @@ bool VariantShreddedStats::IsFullyShredded(const BaseStatistics &stats) { } if (!untyped_value_index_stats.CanHaveNoNull()) { //! In the event that this field is entirely missing from the parent OBJECT, both are NULL - return false; + //! But that doesn't mean we can't do pushdown into this field, so it is shredded (only when the extract path + //! ends at the parent we can't do pushdown) + D_ASSERT(untyped_value_index_stats.CanHaveNull()); + return true; } if (!NumericStats::HasMin(untyped_value_index_stats) || !NumericStats::HasMax(untyped_value_index_stats)) { //! Has no min/max values, essentially double-checking the CanHaveNoNull from above @@ -176,7 +179,17 @@ LogicalType ToStructuredType(const LogicalType &shredding) { if (typed_value.id() == LogicalTypeId::STRUCT) { auto &struct_children = StructType::GetChildTypes(typed_value); child_list_t structured_children; - for (auto &child : struct_children) { + vector indices(struct_children.size()); + for (idx_t i = 0; i < indices.size(); i++) { + indices[i] = i; + } + std::sort(indices.begin(), indices.end(), [&](const idx_t &lhs, const idx_t &rhs) { + auto &a = struct_children[lhs].first; + auto &b = struct_children[rhs].first; + return a < b; + }); + for (auto &index : indices) { + auto &child = struct_children[index]; structured_children.emplace_back(child.first, ToStructuredType(child.second)); } return LogicalType::STRUCT(structured_children); @@ -307,12 +320,22 @@ static string ToStringInternal(const BaseStatistics &stats) { } else if (type_id == LogicalTypeId::STRUCT) { result += ", children: {"; auto &fields = StructType::GetChildTypes(typed_value.GetType()); - for (idx_t i = 0; i < fields.size(); i++) { + vector indices(fields.size()); + for (idx_t i = 0; i < indices.size(); i++) { + indices[i] = i; + } + std::sort(indices.begin(), indices.end(), [&](const idx_t &lhs, const idx_t &rhs) { + auto &a = fields[lhs].first; + auto &b = fields[rhs].first; + return std::lexicographical_compare(a.begin(), a.end(), b.begin(), b.end()); + }); + for (idx_t i = 0; i < indices.size(); i++) { if (i) { result += ", "; } - auto &child_stats = StructStats::GetChildStats(typed_value, i); - result += StringUtil::Format("%s: %s", fields[i].first, ToStringInternal(child_stats)); + auto &child_stats = StructStats::GetChildStats(typed_value, indices[i]); + auto &field = fields[indices[i]]; + result += StringUtil::Format("%s: %s", field.first, ToStringInternal(child_stats)); } result += "}"; } diff --git a/src/duckdb/src/storage/storage_manager.cpp b/src/duckdb/src/storage/storage_manager.cpp index ce07cc706..c29556bb6 100644 --- a/src/duckdb/src/storage/storage_manager.cpp +++ b/src/duckdb/src/storage/storage_manager.cpp @@ -282,11 +282,11 @@ string StorageManager::GetWALPath(const string &suffix) { } string StorageManager::GetCheckpointWALPath() { - return GetWALPath(".checkpoint.wal"); + return GetWALPath(".wal.checkpoint"); } string StorageManager::GetRecoveryWALPath() { - return GetWALPath(".recovery.wal"); + return GetWALPath(".wal.recovery"); } bool StorageManager::InMemory() const { diff --git a/src/duckdb/src/storage/table/column_segment.cpp b/src/duckdb/src/storage/table/column_segment.cpp index 8589c5e64..bdd9f9156 100644 --- a/src/duckdb/src/storage/table/column_segment.cpp +++ b/src/duckdb/src/storage/table/column_segment.cpp @@ -70,7 +70,7 @@ ColumnSegment::ColumnSegment(DatabaseInstance &db, shared_ptr block } // For constant segments (CompressionType::COMPRESSION_CONSTANT) the block is a nullptr. - D_ASSERT(!block || segment_size <= GetBlockManager().GetBlockSize()); + D_ASSERT(!block || segment_size <= GetBlockSize()); } ColumnSegment::ColumnSegment(ColumnSegment &other) @@ -79,7 +79,7 @@ ColumnSegment::ColumnSegment(ColumnSegment &other) block(std::move(other.block)), function(other.function), block_id(other.block_id), offset(other.offset), segment_size(other.segment_size), segment_state(std::move(other.segment_state)) { // For constant segments (CompressionType::COMPRESSION_CONSTANT) the block is a nullptr. - D_ASSERT(!block || segment_size <= GetBlockManager().GetBlockSize()); + D_ASSERT(!block || segment_size <= GetBlockSize()); } ColumnSegment::~ColumnSegment() { @@ -165,7 +165,7 @@ idx_t ColumnSegment::SegmentSize() const { void ColumnSegment::Resize(idx_t new_size) { D_ASSERT(new_size > segment_size); D_ASSERT(offset == 0); - D_ASSERT(block && new_size <= GetBlockManager().GetBlockSize()); + D_ASSERT(block && new_size <= GetBlockSize()); auto &buffer_manager = BufferManager::GetBufferManager(db); auto old_handle = buffer_manager.Pin(block); diff --git a/src/duckdb/src/storage/table/row_group.cpp b/src/duckdb/src/storage/table/row_group.cpp index 2ce3bfe9f..b57a74906 100644 --- a/src/duckdb/src/storage/table/row_group.cpp +++ b/src/duckdb/src/storage/table/row_group.cpp @@ -192,7 +192,7 @@ void ColumnScanState::PushDownCast(const LogicalType &original_type, const Logic D_ASSERT(!expression_state); auto &client_context = *context.GetClientContext(); - auto input = make_uniq(original_type, 0); + auto input = make_uniq(original_type, 0ULL); auto cast_expression = BoundCastExpression::AddCastToType(client_context, std::move(input), cast_type); expression_state = make_uniq(client_context); expression_state->target.Initialize(client_context, {cast_type}); diff --git a/src/duckdb/src/storage/table/standard_column_data.cpp b/src/duckdb/src/storage/table/standard_column_data.cpp index 6fb6312c1..7969657a9 100644 --- a/src/duckdb/src/storage/table/standard_column_data.cpp +++ b/src/duckdb/src/storage/table/standard_column_data.cpp @@ -124,11 +124,17 @@ void StandardColumnData::InitializeAppend(ColumnAppendState &state) { void StandardColumnData::AppendData(BaseStatistics &stats, ColumnAppendState &state, UnifiedVectorFormat &vdata, idx_t count) { + const lock_guard standard_guard(update_lock); + const lock_guard validity_guard(validity->update_lock); + ColumnData::AppendData(stats, state, vdata, count); validity->AppendData(stats, state.child_appends[0], vdata, count); } void StandardColumnData::RevertAppend(row_t new_count) { + const lock_guard standard_guard(update_lock); + const lock_guard validity_guard(validity->update_lock); + ColumnData::RevertAppend(new_count); validity->RevertAppend(new_count); } @@ -150,16 +156,27 @@ void StandardColumnData::Update(TransactionData transaction, DataTable &data_tab ColumnScanState standard_state(nullptr); ColumnScanState validity_state(nullptr); Vector base_vector(type); + + const unique_lock standard_lock(update_lock); + const unique_lock validity_lock(validity->update_lock); + auto standard_fetch = FetchUpdateData(standard_state, row_ids, base_vector, row_group_start); auto validity_fetch = validity->FetchUpdateData(validity_state, row_ids, base_vector, row_group_start); if (standard_fetch != validity_fetch) { throw InternalException("Unaligned fetch in validity and main column data for update"); } - UpdateInternal(transaction, data_table, column_index, update_vector, row_ids, update_count, base_vector, - row_group_start); - validity->UpdateInternal(transaction, data_table, column_index, update_vector, row_ids, update_count, base_vector, - row_group_start); + if (!updates) { + updates = make_uniq(*this); + } + if (!validity->updates) { + validity->updates = make_uniq(*validity); + } + + updates->Update(transaction, data_table, column_index, update_vector, row_ids, update_count, base_vector, + row_group_start); + validity->updates->Update(transaction, data_table, column_index, update_vector, row_ids, update_count, base_vector, + row_group_start); } void StandardColumnData::UpdateColumn(TransactionData transaction, DataTable &data_table, diff --git a/src/duckdb/src/storage/table/variant/variant_shredding.cpp b/src/duckdb/src/storage/table/variant/variant_shredding.cpp index e0485626d..585dd89f8 100644 --- a/src/duckdb/src/storage/table/variant/variant_shredding.cpp +++ b/src/duckdb/src/storage/table/variant/variant_shredding.cpp @@ -376,7 +376,7 @@ static LogicalType SetShreddedType(const LogicalType &typed_value) { bool VariantShreddingStats::GetShreddedTypeInternal(const VariantColumnStatsData &column, LogicalType &out_type) const { idx_t max_count = 0; - uint8_t type_index; + uint8_t type_index = 0; if (column.type_counts[0] == column.total_count) { //! All NULL, emit INT32 out_type = SetShreddedType(LogicalTypeId::INTEGER); diff --git a/src/duckdb/src/transaction/duck_transaction_manager.cpp b/src/duckdb/src/transaction/duck_transaction_manager.cpp index b8b005988..3528a9170 100644 --- a/src/duckdb/src/transaction/duck_transaction_manager.cpp +++ b/src/duckdb/src/transaction/duck_transaction_manager.cpp @@ -240,9 +240,7 @@ void DuckTransactionManager::Checkpoint(ClientContext &context, bool force) { lock_guard start_lock(start_transaction_lock); // wait until any active transactions are finished while (!lock) { - if (context.interrupted) { - throw InterruptException(); - } + context.InterruptCheck(); lock = checkpoint_lock.TryGetExclusiveLock(); } } diff --git a/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp b/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp index 4730bd0cc..d6c1e3271 100644 --- a/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp +++ b/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp @@ -1489,7 +1489,7 @@ typedef enum PGAlterTableType { PG_AT_SetIdentity, /* SET identity column options */ AT_DropIdentity, /* DROP IDENTITY */ PG_AT_SetPartitionedBy, /* SET PARTITIONED BY */ - PG_AT_SetSortedBy /* SET SORTED BY */ + PG_AT_SetSortedBy, /* SET SORTED BY */ } PGAlterTableType; typedef struct PGAlterTableCmd /* one subcommand of an ALTER TABLE */ @@ -1499,7 +1499,8 @@ typedef struct PGAlterTableCmd /* one subcommand of an ALTER TABLE */ char *name; /* column, constraint, or trigger to act on, * or tablespace */ PGNode *def; /* definition of new column, index, * constraint, or parent table */ - PGList *def_list; /* e.g. expression list for partitioned by */ + PGList *def_list; /* e.g. expression list for partitioned by or sorted by */ + PGList *options; /* set table options e.g. SET ('foo'='bar'); RESET ('foo'='bar') */ PGDropBehavior behavior; /* RESTRICT or CASCADE for DROP cases */ bool missing_ok; /* skip error if missing? */ } PGAlterTableCmd; diff --git a/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp b/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp index eca8859fe..def43ccea 100644 --- a/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +++ b/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp @@ -1654,7 +1654,7 @@ union yyalloc /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 512 /* YYNRULES -- Number of rules. */ -#define YYNRULES 2262 +#define YYNRULES 2263 /* YYNRULES -- Number of states. */ #define YYNSTATES 3832 @@ -1794,128 +1794,128 @@ static const yytype_uint16 yyprhs[] = 1364, 1367, 1371, 1374, 1377, 1379, 1383, 1385, 1387, 1389, 1391, 1395, 1397, 1400, 1401, 1403, 1406, 1407, 1409, 1413, 1414, 1417, 1418, 1422, 1426, 1428, 1434, 1438, 1442, 1444, - 1448, 1450, 1453, 1455, 1460, 1466, 1472, 1479, 1483, 1491, - 1496, 1508, 1510, 1514, 1517, 1520, 1523, 1524, 1528, 1530, - 1532, 1535, 1538, 1541, 1544, 1546, 1547, 1549, 1552, 1559, - 1564, 1571, 1576, 1583, 1592, 1594, 1596, 1598, 1600, 1603, - 1605, 1608, 1610, 1613, 1615, 1617, 1619, 1621, 1625, 1629, - 1633, 1637, 1639, 1642, 1645, 1647, 1651, 1653, 1655, 1657, - 1661, 1663, 1665, 1666, 1668, 1670, 1672, 1682, 1685, 1686, - 1690, 1691, 1693, 1694, 1698, 1702, 1705, 1707, 1714, 1718, - 1722, 1725, 1728, 1730, 1731, 1737, 1740, 1743, 1744, 1752, - 1754, 1756, 1758, 1761, 1767, 1776, 1784, 1790, 1799, 1807, - 1812, 1817, 1819, 1823, 1825, 1827, 1831, 1833, 1837, 1839, - 1841, 1844, 1849, 1853, 1855, 1859, 1862, 1867, 1872, 1881, - 1893, 1903, 1911, 1912, 1916, 1920, 1922, 1924, 1928, 1929, - 1931, 1932, 1934, 1935, 1937, 1938, 1940, 1944, 1947, 1948, - 1951, 1952, 1954, 1955, 1957, 1959, 1961, 1965, 1969, 1971, - 1973, 1977, 1981, 1985, 1989, 1993, 1997, 2002, 2006, 2009, - 2011, 2013, 2015, 2019, 2021, 2025, 2027, 2029, 2031, 2035, - 2039, 2043, 2045, 2048, 2053, 2058, 2061, 2065, 2071, 2077, - 2079, 2081, 2085, 2086, 2098, 2110, 2121, 2134, 2136, 2139, - 2145, 2150, 2155, 2160, 2165, 2173, 2179, 2184, 2192, 2199, - 2209, 2219, 2224, 2226, 2228, 2230, 2232, 2234, 2236, 2238, - 2244, 2246, 2248, 2252, 2254, 2257, 2260, 2263, 2267, 2269, - 2273, 2282, 2288, 2289, 2291, 2294, 2296, 2300, 2302, 2305, - 2306, 2309, 2310, 2314, 2318, 2323, 2328, 2333, 2338, 2342, - 2345, 2347, 2349, 2350, 2352, 2354, 2355, 2358, 2360, 2366, - 2368, 2369, 2372, 2375, 2376, 2378, 2379, 2383, 2389, 2391, - 2395, 2400, 2404, 2406, 2408, 2409, 2412, 2415, 2416, 2419, - 2422, 2424, 2426, 2428, 2429, 2432, 2437, 2443, 2448, 2451, - 2455, 2457, 2459, 2461, 2464, 2467, 2469, 2472, 2476, 2477, - 2479, 2480, 2486, 2488, 2493, 2500, 2503, 2505, 2506, 2511, - 2512, 2514, 2516, 2520, 2525, 2526, 2528, 2530, 2533, 2536, - 2539, 2541, 2543, 2546, 2549, 2551, 2553, 2555, 2557, 2559, - 2561, 2565, 2569, 2570, 2572, 2576, 2578, 2581, 2583, 2585, - 2587, 2589, 2591, 2594, 2599, 2604, 2610, 2612, 2614, 2617, - 2618, 2621, 2622, 2624, 2628, 2630, 2631, 2633, 2636, 2640, - 2643, 2648, 2651, 2655, 2658, 2659, 2661, 2664, 2665, 2670, - 2676, 2678, 2681, 2684, 2685, 2687, 2691, 2693, 2696, 2699, - 2704, 2709, 2713, 2717, 2721, 2725, 2729, 2733, 2737, 2739, - 2744, 2749, 2759, 2769, 2773, 2774, 2777, 2780, 2781, 2787, - 2791, 2793, 2795, 2799, 2805, 2809, 2811, 2814, 2816, 2820, - 2826, 2828, 2831, 2835, 2840, 2846, 2851, 2857, 2862, 2869, - 2875, 2880, 2886, 2892, 2898, 2901, 2906, 2908, 2910, 2911, - 2913, 2918, 2924, 2929, 2930, 2933, 2936, 2939, 2941, 2943, - 2945, 2947, 2948, 2953, 2956, 2958, 2961, 2964, 2969, 2972, - 2979, 2982, 2984, 2988, 2993, 2994, 2997, 2998, 3001, 3002, - 3004, 3008, 3012, 3015, 3016, 3019, 3024, 3026, 3028, 3030, - 3031, 3034, 3038, 3044, 3051, 3054, 3058, 3061, 3067, 3073, - 3079, 3083, 3087, 3091, 3096, 3097, 3099, 3101, 3103, 3105, - 3107, 3110, 3115, 3117, 3119, 3121, 3123, 3126, 3130, 3131, - 3133, 3135, 3137, 3139, 3141, 3144, 3147, 3150, 3153, 3156, - 3158, 3162, 3163, 3165, 3167, 3169, 3171, 3177, 3180, 3182, - 3184, 3186, 3188, 3193, 3195, 3198, 3201, 3203, 3207, 3211, - 3214, 3216, 3217, 3223, 3226, 3232, 3235, 3237, 3241, 3245, - 3246, 3248, 3250, 3252, 3254, 3256, 3258, 3260, 3262, 3264, + 1446, 1450, 1452, 1455, 1457, 1462, 1468, 1474, 1481, 1485, + 1493, 1498, 1510, 1512, 1516, 1519, 1522, 1525, 1526, 1530, + 1532, 1534, 1537, 1540, 1543, 1546, 1548, 1549, 1551, 1554, + 1561, 1566, 1573, 1578, 1585, 1594, 1596, 1598, 1600, 1602, + 1605, 1607, 1610, 1612, 1615, 1617, 1619, 1621, 1623, 1627, + 1631, 1635, 1639, 1641, 1644, 1647, 1649, 1653, 1655, 1657, + 1659, 1663, 1665, 1667, 1668, 1670, 1672, 1674, 1684, 1687, + 1688, 1692, 1693, 1695, 1696, 1700, 1704, 1707, 1709, 1716, + 1720, 1724, 1727, 1730, 1732, 1733, 1739, 1742, 1745, 1746, + 1754, 1756, 1758, 1760, 1763, 1769, 1778, 1786, 1792, 1801, + 1809, 1814, 1819, 1821, 1825, 1827, 1829, 1833, 1835, 1839, + 1841, 1843, 1846, 1851, 1855, 1857, 1861, 1864, 1869, 1874, + 1883, 1895, 1905, 1913, 1914, 1918, 1922, 1924, 1926, 1930, + 1931, 1933, 1934, 1936, 1937, 1939, 1940, 1942, 1946, 1949, + 1950, 1953, 1954, 1956, 1957, 1959, 1961, 1963, 1967, 1971, + 1973, 1975, 1979, 1983, 1987, 1991, 1995, 1999, 2004, 2008, + 2011, 2013, 2015, 2017, 2021, 2023, 2027, 2029, 2031, 2033, + 2037, 2041, 2045, 2047, 2050, 2055, 2060, 2063, 2067, 2073, + 2079, 2081, 2083, 2087, 2088, 2100, 2112, 2123, 2136, 2138, + 2141, 2147, 2152, 2157, 2162, 2167, 2175, 2181, 2186, 2194, + 2201, 2211, 2221, 2226, 2228, 2230, 2232, 2234, 2236, 2238, + 2240, 2246, 2248, 2250, 2254, 2256, 2259, 2262, 2265, 2269, + 2271, 2275, 2284, 2290, 2291, 2293, 2296, 2298, 2302, 2304, + 2307, 2308, 2311, 2312, 2316, 2320, 2325, 2330, 2335, 2340, + 2344, 2347, 2349, 2351, 2352, 2354, 2356, 2357, 2360, 2362, + 2368, 2370, 2371, 2374, 2377, 2378, 2380, 2381, 2385, 2391, + 2393, 2397, 2402, 2406, 2408, 2410, 2411, 2414, 2417, 2418, + 2421, 2424, 2426, 2428, 2430, 2431, 2434, 2439, 2445, 2450, + 2453, 2457, 2459, 2461, 2463, 2466, 2469, 2471, 2474, 2478, + 2479, 2481, 2482, 2488, 2490, 2495, 2502, 2505, 2507, 2508, + 2513, 2514, 2516, 2518, 2522, 2527, 2528, 2530, 2532, 2535, + 2538, 2541, 2543, 2545, 2548, 2551, 2553, 2555, 2557, 2559, + 2561, 2563, 2567, 2571, 2572, 2574, 2578, 2580, 2583, 2585, + 2587, 2589, 2591, 2593, 2596, 2601, 2606, 2612, 2614, 2616, + 2619, 2620, 2623, 2624, 2626, 2630, 2632, 2633, 2635, 2638, + 2642, 2645, 2650, 2653, 2657, 2660, 2661, 2663, 2666, 2667, + 2672, 2678, 2680, 2683, 2686, 2687, 2689, 2693, 2695, 2698, + 2701, 2706, 2711, 2715, 2719, 2723, 2727, 2731, 2735, 2739, + 2741, 2746, 2751, 2761, 2771, 2775, 2776, 2779, 2782, 2783, + 2789, 2793, 2795, 2797, 2801, 2807, 2811, 2813, 2816, 2818, + 2822, 2828, 2830, 2833, 2837, 2842, 2848, 2853, 2859, 2864, + 2871, 2877, 2882, 2888, 2894, 2900, 2903, 2908, 2910, 2912, + 2913, 2915, 2920, 2926, 2931, 2932, 2935, 2938, 2941, 2943, + 2945, 2947, 2949, 2950, 2955, 2958, 2960, 2963, 2966, 2971, + 2974, 2981, 2984, 2986, 2990, 2995, 2996, 2999, 3000, 3003, + 3004, 3006, 3010, 3014, 3017, 3018, 3021, 3026, 3028, 3030, + 3032, 3033, 3036, 3040, 3046, 3053, 3056, 3060, 3063, 3069, + 3075, 3081, 3085, 3089, 3093, 3098, 3099, 3101, 3103, 3105, + 3107, 3109, 3112, 3117, 3119, 3121, 3123, 3125, 3128, 3132, + 3133, 3135, 3137, 3139, 3141, 3143, 3146, 3149, 3152, 3155, + 3158, 3160, 3164, 3165, 3167, 3169, 3171, 3173, 3179, 3182, + 3184, 3186, 3188, 3190, 3195, 3197, 3200, 3203, 3205, 3209, + 3213, 3216, 3218, 3219, 3225, 3228, 3234, 3237, 3239, 3243, + 3247, 3248, 3250, 3252, 3254, 3256, 3258, 3260, 3262, 3264, 3266, 3268, 3270, 3272, 3274, 3276, 3278, 3280, 3282, 3284, 3286, 3288, 3290, 3292, 3294, 3296, 3298, 3300, 3302, 3304, 3306, 3308, 3310, 3312, 3314, 3316, 3318, 3320, 3322, 3324, - 3328, 3332, 3336, 3340, 3344, 3348, 3352, 3353, 3355, 3359, - 3363, 3369, 3372, 3375, 3379, 3383, 3387, 3391, 3395, 3399, - 3403, 3407, 3411, 3415, 3419, 3423, 3427, 3431, 3435, 3438, - 3441, 3445, 3449, 3452, 3455, 3459, 3463, 3469, 3474, 3481, - 3485, 3491, 3496, 3503, 3508, 3515, 3521, 3529, 3533, 3536, - 3541, 3545, 3548, 3553, 3557, 3561, 3565, 3569, 3574, 3578, - 3583, 3587, 3592, 3598, 3605, 3612, 3620, 3627, 3635, 3642, - 3650, 3654, 3659, 3664, 3671, 3673, 3678, 3683, 3689, 3694, - 3701, 3703, 3707, 3710, 3713, 3717, 3721, 3725, 3729, 3733, - 3737, 3741, 3745, 3749, 3753, 3757, 3761, 3765, 3769, 3773, - 3776, 3779, 3785, 3792, 3799, 3807, 3809, 3812, 3814, 3816, - 3818, 3821, 3824, 3829, 3833, 3835, 3837, 3839, 3841, 3844, - 3846, 3848, 3850, 3852, 3854, 3856, 3858, 3861, 3866, 3869, - 3873, 3877, 3882, 3886, 3892, 3899, 3907, 3917, 3925, 3933, - 3939, 3941, 3943, 3945, 3951, 3958, 3965, 3970, 3975, 3980, - 3985, 3992, 3998, 4004, 4010, 4015, 4022, 4027, 4035, 4045, - 4051, 4052, 4058, 4063, 4064, 4066, 4067, 4070, 4071, 4073, - 4077, 4081, 4084, 4087, 4088, 4095, 4097, 4098, 4102, 4103, - 4107, 4111, 4115, 4116, 4118, 4123, 4126, 4129, 4132, 4135, - 4138, 4142, 4145, 4148, 4152, 4153, 4158, 4162, 4164, 4170, - 4174, 4176, 4180, 4182, 4185, 4189, 4191, 4195, 4197, 4200, - 4202, 4203, 4205, 4207, 4209, 4211, 4213, 4215, 4217, 4219, + 3326, 3330, 3334, 3338, 3342, 3346, 3350, 3354, 3355, 3357, + 3361, 3365, 3371, 3374, 3377, 3381, 3385, 3389, 3393, 3397, + 3401, 3405, 3409, 3413, 3417, 3421, 3425, 3429, 3433, 3437, + 3440, 3443, 3447, 3451, 3454, 3457, 3461, 3465, 3471, 3476, + 3483, 3487, 3493, 3498, 3505, 3510, 3517, 3523, 3531, 3535, + 3538, 3543, 3547, 3550, 3555, 3559, 3563, 3567, 3571, 3576, + 3580, 3585, 3589, 3594, 3600, 3607, 3614, 3622, 3629, 3637, + 3644, 3652, 3656, 3661, 3666, 3673, 3675, 3680, 3685, 3691, + 3696, 3703, 3705, 3709, 3712, 3715, 3719, 3723, 3727, 3731, + 3735, 3739, 3743, 3747, 3751, 3755, 3759, 3763, 3767, 3771, + 3775, 3778, 3781, 3787, 3794, 3801, 3809, 3811, 3814, 3816, + 3818, 3820, 3823, 3826, 3831, 3835, 3837, 3839, 3841, 3843, + 3846, 3848, 3850, 3852, 3854, 3856, 3858, 3860, 3863, 3868, + 3871, 3875, 3879, 3884, 3888, 3894, 3901, 3909, 3919, 3927, + 3935, 3941, 3943, 3945, 3947, 3953, 3960, 3967, 3972, 3977, + 3982, 3987, 3994, 4000, 4006, 4012, 4017, 4024, 4029, 4037, + 4047, 4053, 4054, 4060, 4065, 4066, 4068, 4069, 4072, 4073, + 4075, 4079, 4083, 4086, 4089, 4090, 4097, 4099, 4100, 4104, + 4105, 4109, 4113, 4117, 4118, 4120, 4125, 4128, 4131, 4134, + 4137, 4140, 4144, 4147, 4150, 4154, 4155, 4160, 4164, 4166, + 4172, 4176, 4178, 4182, 4184, 4187, 4191, 4193, 4197, 4199, + 4202, 4204, 4205, 4207, 4209, 4211, 4213, 4215, 4217, 4219, 4221, 4223, 4225, 4227, 4229, 4231, 4233, 4235, 4237, 4239, - 4241, 4243, 4248, 4250, 4255, 4257, 4262, 4264, 4267, 4269, - 4272, 4274, 4277, 4279, 4283, 4285, 4289, 4291, 4294, 4296, - 4300, 4302, 4305, 4307, 4308, 4310, 4314, 4316, 4320, 4324, - 4326, 4330, 4334, 4335, 4337, 4339, 4341, 4343, 4345, 4347, - 4349, 4351, 4353, 4355, 4357, 4359, 4361, 4363, 4365, 4370, - 4374, 4377, 4381, 4382, 4386, 4390, 4393, 4396, 4398, 4399, - 4402, 4405, 4409, 4412, 4414, 4416, 4420, 4422, 4424, 4430, - 4432, 4435, 4440, 4443, 4444, 4446, 4447, 4449, 4451, 4454, - 4458, 4464, 4472, 4480, 4482, 4483, 4484, 4487, 4488, 4491, - 4495, 4499, 4503, 4509, 4517, 4525, 4526, 4529, 4531, 4532, - 4534, 4535, 4537, 4541, 4543, 4546, 4550, 4553, 4555, 4559, - 4564, 4567, 4569, 4573, 4575, 4579, 4581, 4584, 4586, 4587, - 4591, 4593, 4597, 4599, 4602, 4607, 4610, 4611, 4615, 4617, - 4621, 4623, 4626, 4631, 4634, 4635, 4637, 4641, 4643, 4647, - 4649, 4652, 4654, 4658, 4660, 4662, 4665, 4667, 4669, 4672, - 4674, 4676, 4679, 4687, 4690, 4696, 4700, 4704, 4706, 4708, + 4241, 4243, 4245, 4250, 4252, 4257, 4259, 4264, 4266, 4269, + 4271, 4274, 4276, 4279, 4281, 4285, 4287, 4291, 4293, 4296, + 4298, 4302, 4304, 4307, 4309, 4310, 4312, 4316, 4318, 4322, + 4326, 4328, 4332, 4336, 4337, 4339, 4341, 4343, 4345, 4347, + 4349, 4351, 4353, 4355, 4357, 4359, 4361, 4363, 4365, 4367, + 4372, 4376, 4379, 4383, 4384, 4388, 4392, 4395, 4398, 4400, + 4401, 4404, 4407, 4411, 4414, 4416, 4418, 4422, 4424, 4426, + 4432, 4434, 4437, 4442, 4445, 4446, 4448, 4449, 4451, 4453, + 4456, 4460, 4466, 4474, 4482, 4484, 4485, 4486, 4489, 4490, + 4493, 4497, 4501, 4505, 4511, 4519, 4527, 4528, 4531, 4533, + 4534, 4536, 4537, 4539, 4543, 4545, 4548, 4552, 4555, 4557, + 4561, 4566, 4569, 4571, 4575, 4577, 4581, 4583, 4586, 4588, + 4589, 4593, 4595, 4599, 4601, 4604, 4609, 4612, 4613, 4617, + 4619, 4623, 4625, 4628, 4633, 4636, 4637, 4639, 4643, 4645, + 4649, 4651, 4654, 4656, 4660, 4662, 4664, 4667, 4669, 4671, + 4674, 4676, 4678, 4681, 4689, 4692, 4698, 4702, 4706, 4708, 4710, 4712, 4714, 4716, 4718, 4720, 4722, 4724, 4726, 4728, - 4730, 4732, 4735, 4738, 4742, 4746, 4747, 4749, 4751, 4753, - 4759, 4763, 4764, 4766, 4768, 4770, 4772, 4774, 4776, 4781, - 4789, 4796, 4799, 4800, 4802, 4804, 4806, 4808, 4822, 4839, - 4841, 4844, 4845, 4847, 4848, 4850, 4851, 4854, 4855, 4857, - 4858, 4865, 4874, 4881, 4890, 4897, 4906, 4910, 4913, 4915, - 4916, 4923, 4930, 4932, 4934, 4936, 4938, 4940, 4942, 4945, - 4947, 4949, 4951, 4953, 4955, 4960, 4967, 4971, 4974, 4979, - 4983, 4989, 4991, 4992, 4994, 4996, 4997, 4999, 5001, 5003, + 4730, 4732, 4734, 4737, 4740, 4744, 4748, 4749, 4751, 4753, + 4755, 4761, 4765, 4766, 4768, 4770, 4772, 4774, 4776, 4778, + 4783, 4791, 4798, 4801, 4802, 4804, 4806, 4808, 4810, 4824, + 4841, 4843, 4846, 4847, 4849, 4850, 4852, 4853, 4856, 4857, + 4859, 4860, 4867, 4876, 4883, 4892, 4899, 4908, 4912, 4915, + 4917, 4918, 4925, 4932, 4934, 4936, 4938, 4940, 4942, 4944, + 4947, 4949, 4951, 4953, 4955, 4957, 4962, 4969, 4973, 4976, + 4981, 4985, 4991, 4993, 4994, 4996, 4998, 4999, 5001, 5003, 5005, 5007, 5009, 5011, 5013, 5015, 5017, 5019, 5021, 5023, 5025, 5027, 5029, 5031, 5033, 5035, 5037, 5039, 5041, 5043, 5045, 5047, 5049, 5051, 5053, 5055, 5057, 5059, 5061, 5063, - 5065, 5067, 5069, 5071, 5073, 5077, 5079, 5081, 5083, 5085, - 5087, 5089, 5092, 5094, 5096, 5099, 5103, 5107, 5111, 5115, - 5117, 5121, 5125, 5128, 5132, 5136, 5138, 5140, 5142, 5146, - 5152, 5154, 5156, 5158, 5160, 5164, 5167, 5172, 5179, 5186, - 5187, 5189, 5191, 5193, 5194, 5197, 5200, 5205, 5212, 5218, - 5223, 5230, 5232, 5234, 5236, 5238, 5240, 5242, 5243, 5245, - 5249, 5251, 5252, 5260, 5264, 5266, 5269, 5273, 5276, 5277, - 5280, 5281, 5284, 5289, 5295, 5304, 5312, 5315, 5319, 5325, - 5327, 5328, 5331, 5332, 5334, 5335, 5338, 5340, 5344, 5348, - 5349, 5352, 5356, 5360, 5364, 5368, 5370, 5372, 5374, 5377, - 5381, 5384, 5387, 5390, 5395, 5398, 5402, 5407, 5411, 5413, - 5415, 5417, 5419, 5421, 5423, 5424, 5426, 5430, 5433, 5443, - 5456, 5468, 5481, 5496, 5500, 5505, 5510, 5511, 5519, 5530, - 5540, 5543, 5547, 5548, 5553, 5555, 5557, 5559, 5561, 5563, + 5065, 5067, 5069, 5071, 5073, 5075, 5079, 5081, 5083, 5085, + 5087, 5089, 5091, 5094, 5096, 5098, 5101, 5105, 5109, 5113, + 5117, 5119, 5123, 5127, 5130, 5134, 5138, 5140, 5142, 5144, + 5148, 5154, 5156, 5158, 5160, 5162, 5166, 5169, 5174, 5181, + 5188, 5189, 5191, 5193, 5195, 5196, 5199, 5202, 5207, 5214, + 5220, 5225, 5232, 5234, 5236, 5238, 5240, 5242, 5244, 5245, + 5247, 5251, 5253, 5254, 5262, 5266, 5268, 5271, 5275, 5278, + 5279, 5282, 5283, 5286, 5291, 5297, 5306, 5314, 5317, 5321, + 5327, 5329, 5330, 5333, 5334, 5336, 5337, 5340, 5342, 5346, + 5350, 5351, 5354, 5358, 5362, 5366, 5370, 5372, 5374, 5376, + 5379, 5383, 5386, 5389, 5392, 5397, 5400, 5404, 5409, 5413, + 5415, 5417, 5419, 5421, 5423, 5425, 5426, 5428, 5432, 5435, + 5445, 5458, 5470, 5483, 5498, 5502, 5507, 5512, 5513, 5521, + 5532, 5542, 5545, 5549, 5550, 5555, 5557, 5559, 5561, 5563, 5565, 5567, 5569, 5571, 5573, 5575, 5577, 5579, 5581, 5583, 5585, 5587, 5589, 5591, 5593, 5595, 5597, 5599, 5601, 5603, 5605, 5607, 5609, 5611, 5613, 5615, 5617, 5619, 5621, 5623, @@ -1979,7 +1979,7 @@ static const yytype_uint16 yyprhs[] = 6765, 6767, 6769, 6771, 6773, 6775, 6777, 6779, 6781, 6783, 6785, 6787, 6789, 6791, 6793, 6795, 6797, 6799, 6801, 6803, 6805, 6807, 6809, 6811, 6813, 6815, 6817, 6819, 6821, 6823, - 6825, 6827, 6829 + 6825, 6827, 6829, 6831 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ @@ -2129,546 +2129,546 @@ static const yytype_int16 yyrhs[] = 665, 529, -1, -1, 662, 628, -1, -1, 295, 123, 627, -1, 565, 517, 860, -1, 565, -1, 565, 530, 565, 517, 624, -1, 565, 530, 565, -1, 561, 517, - 860, -1, 660, -1, 665, 532, 660, -1, 665, -1, - 665, 532, -1, 824, -1, 961, 965, 523, 451, -1, - 396, 961, 965, 523, 451, -1, 75, 528, 860, 529, - 623, -1, 457, 528, 666, 529, 658, 623, -1, 457, - 642, 623, -1, 335, 229, 528, 666, 529, 658, 623, - -1, 335, 229, 642, 623, -1, 171, 229, 528, 666, - 529, 353, 558, 661, 670, 635, 623, -1, 656, -1, - 669, 532, 656, -1, 252, 175, -1, 252, 314, -1, - 252, 401, -1, -1, 240, 558, 648, -1, 434, -1, - 432, -1, 244, 434, -1, 244, 432, -1, 180, 434, - -1, 180, 432, -1, 460, -1, -1, 34, -1, 60, - 118, -1, 138, 675, 194, 154, 677, 678, -1, 138, - 675, 677, 678, -1, 138, 676, 194, 154, 954, 678, - -1, 138, 676, 954, 678, -1, 138, 679, 957, 295, - 964, 678, -1, 138, 679, 194, 154, 957, 295, 964, - 678, -1, 427, -1, 390, -1, 176, -1, 249, -1, - 249, 427, -1, 480, -1, 254, 480, -1, 205, -1, - 171, 427, -1, 82, -1, 98, -1, 379, -1, 413, - -1, 435, 383, 313, -1, 435, 383, 130, -1, 435, - 383, 433, -1, 435, 383, 91, -1, 451, -1, 25, - 257, -1, 148, 445, -1, 158, -1, 171, 108, 494, - -1, 341, -1, 393, -1, 964, -1, 677, 532, 964, - -1, 64, -1, 366, -1, -1, 326, -1, 376, -1, - 445, -1, 573, 256, 222, 1017, 467, 794, 810, 690, - 579, -1, 37, 860, -1, -1, 528, 584, 529, -1, - -1, 521, -1, -1, 464, 395, 586, -1, 464, 395, - 521, -1, 464, 571, -1, 123, -1, 215, 682, 473, - 528, 908, 529, -1, 215, 571, 683, -1, 215, 118, - 473, -1, 134, 281, -1, 146, 685, -1, 860, -1, - -1, 486, 253, 681, 436, 684, -1, 60, 407, -1, - 60, 431, -1, -1, 486, 280, 253, 687, 681, 436, - 684, -1, 686, -1, 688, -1, 689, -1, 689, 690, - -1, 101, 672, 698, 558, 695, -1, 101, 672, 698, - 194, 280, 154, 558, 695, -1, 101, 300, 361, 672, - 698, 558, 695, -1, 101, 672, 698, 558, 697, -1, - 101, 672, 698, 194, 280, 154, 558, 697, -1, 101, - 300, 361, 672, 698, 558, 697, -1, 699, 41, 427, - 718, -1, 699, 41, 427, 717, -1, 693, -1, 694, - 532, 693, -1, 692, -1, 694, -1, 699, 41, 860, - -1, 696, -1, 697, 532, 696, -1, 176, -1, 249, - -1, 528, 529, -1, 528, 700, 532, 529, -1, 528, - 700, 529, -1, 701, -1, 700, 532, 701, -1, 967, - 823, -1, 967, 823, 13, 860, -1, 967, 823, 14, - 860, -1, 573, 464, 1017, 395, 586, 790, 1018, 579, - -1, 99, 713, 558, 661, 711, 705, 709, 715, 706, - 610, 710, -1, 99, 528, 716, 529, 440, 709, 715, - 610, 710, -1, 99, 174, 109, 559, 440, 559, 704, - -1, -1, 528, 379, 529, -1, 528, 108, 529, -1, - 174, -1, 440, -1, 707, 125, 561, -1, -1, 467, - -1, -1, 41, -1, -1, 340, -1, -1, 712, -1, - 528, 1027, 529, -1, 490, 293, -1, -1, 712, 714, - -1, -1, 56, -1, -1, 56, -1, 293, -1, 173, - -1, 124, 708, 561, -1, 285, 708, 561, -1, 103, - -1, 189, -1, 345, 708, 561, -1, 147, 708, 561, - -1, 170, 345, 665, -1, 170, 345, 521, -1, 315, - 60, 665, -1, 315, 60, 521, -1, 170, 280, 285, - 665, -1, 170, 285, 665, -1, 142, 561, -1, 561, - -1, 414, -1, 415, -1, 3, 530, 559, -1, 3, - -1, 528, 860, 529, -1, 865, -1, 718, -1, 717, - -1, 528, 718, 529, -1, 528, 717, 529, -1, 528, - 1032, 529, -1, 721, -1, 719, 744, -1, 719, 743, - 781, 750, -1, 719, 743, 749, 782, -1, 728, 719, - -1, 728, 719, 744, -1, 728, 719, 743, 781, 750, - -1, 728, 719, 743, 749, 782, -1, 721, -1, 717, - -1, 388, 741, 936, -1, -1, 388, 741, 936, 735, - 790, 817, 770, 779, 878, 780, 755, -1, 388, 740, - 938, 735, 790, 817, 770, 779, 878, 780, 755, -1, - 174, 791, 720, 735, 817, 770, 779, 878, 780, 755, - -1, 174, 791, 388, 740, 938, 735, 817, 770, 779, - 878, 780, 755, -1, 789, -1, 427, 811, -1, 719, - 456, 738, 739, 719, -1, 719, 456, 738, 719, -1, - 719, 220, 738, 719, -1, 719, 149, 738, 719, -1, - 723, 794, 467, 938, -1, 723, 794, 467, 938, 183, - 60, 956, -1, 723, 794, 183, 60, 956, -1, 723, - 794, 295, 727, -1, 723, 794, 295, 727, 183, 60, - 956, -1, 723, 794, 295, 727, 467, 938, -1, 723, - 794, 295, 727, 467, 938, 183, 60, 956, -1, 724, - 794, 295, 938, 222, 271, 957, 722, 956, -1, 724, - 794, 295, 938, -1, 472, -1, 473, -1, 321, -1, - 323, -1, 462, -1, 322, -1, 861, -1, 861, 201, - 528, 718, 529, -1, 797, -1, 725, -1, 726, 532, - 725, -1, 726, -1, 726, 532, -1, 490, 729, -1, - 514, 729, -1, 490, 351, 729, -1, 730, -1, 729, - 532, 730, -1, 957, 966, 731, 41, 734, 528, 971, - 529, -1, 467, 229, 528, 732, 529, -1, -1, 733, - -1, 733, 532, -1, 928, -1, 733, 532, 928, -1, - 254, -1, 280, 254, -1, -1, 222, 736, -1, -1, - 434, 737, 558, -1, 432, 737, 558, -1, 244, 434, - 737, 558, -1, 244, 432, 737, 558, -1, 180, 434, - 737, 558, -1, 180, 432, 737, 558, -1, 460, 737, - 558, -1, 427, 558, -1, 558, -1, 427, -1, -1, - 31, -1, 133, -1, -1, 60, 271, -1, 133, -1, - 133, 295, 528, 908, 529, -1, 31, -1, -1, 195, - 287, -1, 364, 287, -1, -1, 744, -1, -1, 301, - 60, 745, -1, 301, 60, 31, 747, 748, -1, 746, - -1, 745, 532, 746, -1, 860, 467, 902, 748, -1, - 860, 747, 748, -1, 42, -1, 127, -1, -1, 513, - 166, -1, 513, 234, -1, -1, 751, 752, -1, 752, - 751, -1, 751, -1, 752, -1, 749, -1, -1, 241, - 764, -1, 241, 764, 532, 765, -1, 164, 769, 766, - 768, 296, -1, 164, 769, 768, 296, -1, 292, 765, - -1, 292, 766, 768, -1, 4, -1, 9, -1, 865, - -1, 753, 523, -1, 753, 319, -1, 753, -1, 753, - 375, -1, 467, 377, 757, -1, -1, 559, -1, -1, - 756, 528, 754, 529, 760, -1, 754, -1, 754, 528, - 559, 529, -1, 754, 528, 559, 532, 9, 529, -1, - 429, 757, -1, 758, -1, -1, 360, 528, 9, 529, - -1, -1, 439, -1, 479, -1, 761, 14, 860, -1, - 47, 528, 762, 529, -1, -1, 860, -1, 31, -1, - 860, 523, -1, 4, 319, -1, 9, 319, -1, 860, - -1, 862, -1, 519, 767, -1, 520, 767, -1, 960, - -1, 4, -1, 374, -1, 375, -1, 166, -1, 277, - -1, 183, 60, 772, -1, 183, 60, 31, -1, -1, - 773, -1, 771, 532, 773, -1, 771, -1, 771, 532, - -1, 860, -1, 774, -1, 776, -1, 775, -1, 777, - -1, 528, 529, -1, 373, 528, 908, 529, -1, 104, - 528, 908, 529, -1, 184, 397, 528, 772, 529, -1, - 184, -1, 185, -1, 188, 860, -1, -1, 342, 860, - -1, -1, 783, -1, 169, 347, 296, -1, 781, -1, - -1, 784, -1, 783, 784, -1, 785, 786, 787, -1, - 169, 464, -1, 169, 278, 229, 464, -1, 169, 398, - -1, 169, 229, 398, -1, 290, 953, -1, -1, 284, - -1, 402, 247, -1, -1, 473, 528, 908, 529, -1, - 788, 532, 528, 908, 529, -1, 788, -1, 788, 532, - -1, 174, 792, -1, -1, 794, -1, 791, 532, 794, - -1, 791, -1, 791, 532, -1, 560, 19, -1, 811, - 806, 763, 759, -1, 793, 811, 763, 759, -1, 812, - 807, 759, -1, 793, 812, 759, -1, 789, 805, 759, - -1, 235, 812, 807, -1, 717, 806, 759, -1, 793, - 717, 759, -1, 235, 717, 806, -1, 804, -1, 528, - 804, 529, 805, -1, 793, 528, 804, 529, -1, 794, - 321, 528, 938, 169, 800, 795, 529, 806, -1, 794, - 462, 796, 528, 801, 169, 803, 529, 806, -1, 183, - 60, 955, -1, -1, 202, 287, -1, 150, 287, -1, - -1, 861, 201, 528, 938, 529, -1, 861, 201, 560, - -1, 863, -1, 866, -1, 528, 906, 529, -1, 798, - 201, 528, 938, 529, -1, 798, 201, 560, -1, 799, - -1, 800, 799, -1, 560, -1, 528, 955, 529, -1, - 801, 201, 528, 938, 529, -1, 802, -1, 803, 802, - -1, 528, 804, 529, -1, 794, 102, 227, 794, -1, - 794, 808, 227, 794, 810, -1, 794, 227, 794, 810, - -1, 794, 274, 808, 227, 794, -1, 794, 274, 227, - 794, -1, 794, 43, 808, 227, 794, 810, -1, 794, - 43, 227, 794, 810, -1, 794, 328, 227, 794, -1, - 794, 38, 227, 794, 810, -1, 794, 389, 227, 794, - 810, -1, 41, 560, 528, 955, 529, -1, 41, 560, - -1, 559, 528, 955, 529, -1, 559, -1, 805, -1, - -1, 805, -1, 41, 528, 818, 529, -1, 41, 560, - 528, 818, 529, -1, 559, 528, 818, 529, -1, -1, - 175, 809, -1, 238, 809, -1, 370, 809, -1, 389, - -1, 38, -1, 211, -1, 305, -1, -1, 467, 528, - 955, 529, -1, 295, 860, -1, 558, -1, 558, 521, - -1, 296, 558, -1, 296, 528, 558, 529, -1, 872, - 816, -1, 375, 174, 528, 814, 529, 816, -1, 872, - 815, -1, 813, -1, 814, 532, 813, -1, 41, 528, - 818, 529, -1, -1, 514, 302, -1, -1, 487, 860, - -1, -1, 819, -1, 818, 532, 819, -1, 560, 824, - 820, -1, 81, 964, -1, -1, 559, 824, -1, 821, - 532, 559, 824, -1, 374, -1, 420, -1, 824, -1, - -1, 827, 826, -1, 396, 827, 826, -1, 827, 40, - 526, 960, 527, -1, 396, 827, 40, 526, 960, 527, - -1, 827, 40, -1, 396, 827, 40, -1, 825, 826, - -1, 822, 528, 821, 529, 826, -1, 250, 528, 912, - 529, 826, -1, 456, 528, 821, 529, 826, -1, 3, - 530, 3, -1, 825, 530, 3, -1, 826, 526, 527, - -1, 826, 526, 960, 527, -1, -1, 829, -1, 831, - -1, 833, -1, 837, -1, 843, -1, 844, 859, -1, - 844, 528, 960, 529, -1, 831, -1, 834, -1, 838, - -1, 843, -1, 963, 830, -1, 528, 909, 529, -1, - -1, 218, -1, 219, -1, 403, -1, 55, -1, 348, - -1, 167, 832, -1, 137, 331, -1, 116, 830, -1, - 113, 830, -1, 288, 830, -1, 58, -1, 528, 960, - 529, -1, -1, 835, -1, 836, -1, 835, -1, 836, - -1, 57, 842, 528, 908, 529, -1, 57, 842, -1, - 839, -1, 840, -1, 839, -1, 840, -1, 841, 528, - 960, 529, -1, 841, -1, 73, 842, -1, 72, 842, - -1, 474, -1, 273, 73, 842, -1, 273, 72, 842, - -1, 275, 842, -1, 477, -1, -1, 439, 528, 960, - 529, 845, -1, 439, 845, -1, 438, 528, 960, 529, - 845, -1, 438, 845, -1, 221, -1, 514, 438, 511, - -1, 492, 438, 511, -1, -1, 508, -1, 509, -1, - 268, -1, 269, -1, 110, -1, 111, -1, 191, -1, - 192, -1, 264, -1, 265, -1, 384, -1, 385, -1, - 262, -1, 263, -1, 258, -1, 259, -1, 484, -1, - 485, -1, 343, -1, 344, -1, 114, -1, 115, -1, - 70, -1, 69, -1, 261, -1, 260, -1, 846, -1, - 847, -1, 848, -1, 849, -1, 850, -1, 851, -1, - 852, -1, 853, -1, 854, -1, 855, -1, 856, -1, - 857, -1, 858, -1, 846, 440, 847, -1, 848, 440, - 849, -1, 848, 440, 850, -1, 848, 440, 851, -1, - 849, 440, 850, -1, 849, 440, 851, -1, 850, 440, - 851, -1, -1, 862, -1, 860, 11, 824, -1, 860, - 81, 964, -1, 860, 47, 438, 511, 860, -1, 519, - 860, -1, 520, 860, -1, 860, 519, 860, -1, 860, - 520, 860, -1, 860, 521, 860, -1, 860, 522, 860, - -1, 860, 15, 860, -1, 860, 523, 860, -1, 860, - 524, 860, -1, 860, 16, 860, -1, 860, 515, 860, - -1, 860, 516, 860, -1, 860, 517, 860, -1, 860, - 20, 860, -1, 860, 21, 860, -1, 860, 22, 860, - -1, 860, 901, 860, -1, 901, 860, -1, 860, 901, - -1, 860, 37, 860, -1, 860, 300, 860, -1, 280, - 860, -1, 512, 860, -1, 860, 179, 860, -1, 860, - 240, 860, -1, 860, 240, 860, 147, 860, -1, 860, - 512, 240, 860, -1, 860, 512, 240, 860, 147, 860, - -1, 860, 196, 860, -1, 860, 196, 860, 147, 860, - -1, 860, 512, 196, 860, -1, 860, 512, 196, 860, - 147, 860, -1, 860, 400, 440, 860, -1, 860, 400, - 440, 860, 147, 860, -1, 860, 512, 400, 440, 860, - -1, 860, 512, 400, 440, 860, 147, 860, -1, 860, - 224, 285, -1, 860, 225, -1, 860, 224, 280, 285, - -1, 860, 280, 285, -1, 860, 283, -1, 231, 954, - 19, 860, -1, 860, 17, 860, -1, 860, 18, 860, - -1, 890, 307, 890, -1, 860, 224, 447, -1, 860, - 224, 280, 447, -1, 860, 224, 162, -1, 860, 224, - 280, 162, -1, 860, 224, 458, -1, 860, 224, 280, - 458, -1, 860, 224, 133, 174, 860, -1, 860, 224, - 280, 133, 174, 860, -1, 860, 224, 290, 528, 912, - 529, -1, 860, 224, 280, 290, 528, 912, 529, -1, - 860, 54, 935, 861, 37, 860, -1, 860, 512, 54, - 935, 861, 37, 860, -1, 860, 54, 424, 861, 37, - 860, -1, 860, 512, 54, 424, 861, 37, 860, -1, - 860, 201, 922, -1, 860, 512, 201, 922, -1, 860, - 903, 898, 717, -1, 860, 903, 898, 528, 860, 529, - -1, 118, -1, 84, 528, 860, 529, -1, 461, 528, - 860, 529, -1, 521, 84, 528, 860, 529, -1, 521, - 944, 948, 952, -1, 559, 530, 521, 944, 948, 952, - -1, 862, -1, 861, 11, 824, -1, 519, 861, -1, - 520, 861, -1, 861, 519, 861, -1, 861, 520, 861, - -1, 861, 521, 861, -1, 861, 522, 861, -1, 861, - 15, 861, -1, 861, 523, 861, -1, 861, 524, 861, - -1, 861, 16, 861, -1, 861, 515, 861, -1, 861, - 516, 861, -1, 861, 517, 861, -1, 861, 20, 861, - -1, 861, 21, 861, -1, 861, 22, 861, -1, 861, - 901, 861, -1, 901, 861, -1, 861, 901, -1, 861, - 224, 133, 174, 861, -1, 861, 224, 280, 133, 174, - 861, -1, 861, 224, 290, 528, 912, 529, -1, 861, - 224, 280, 290, 528, 912, 529, -1, 863, -1, 864, - 934, -1, 929, -1, 959, -1, 717, -1, 717, 562, - -1, 154, 717, -1, 778, 528, 908, 529, -1, 528, - 860, 529, -1, 866, -1, 890, -1, 533, -1, 10, - -1, 534, 565, -1, 865, -1, 868, -1, 869, -1, - 871, -1, 923, -1, 867, -1, 874, -1, 40, 717, - -1, 40, 526, 909, 527, -1, 535, 9, -1, 526, - 909, 527, -1, 536, 893, 537, -1, 250, 536, 897, - 537, -1, 958, 528, 529, -1, 958, 528, 744, 742, - 529, -1, 958, 528, 910, 743, 742, 529, -1, 958, - 528, 476, 911, 743, 742, 529, -1, 958, 528, 910, - 532, 476, 911, 743, 742, 529, -1, 958, 528, 31, - 910, 743, 742, 529, -1, 958, 528, 133, 910, 743, - 742, 529, -1, 870, 875, 876, 877, 881, -1, 873, - -1, 870, -1, 873, -1, 82, 169, 528, 860, 529, - -1, 67, 528, 860, 41, 824, 529, -1, 450, 528, - 860, 41, 824, 529, -1, 161, 528, 913, 529, -1, - 308, 528, 915, 529, -1, 327, 528, 917, 529, -1, - 422, 528, 918, 529, -1, 444, 528, 860, 41, 824, - 529, -1, 446, 528, 59, 921, 529, -1, 446, 528, - 236, 921, 529, -1, 446, 528, 441, 921, 529, -1, - 446, 528, 921, 529, -1, 286, 528, 860, 532, 860, - 529, -1, 80, 528, 908, 529, -1, 526, 860, 169, - 954, 201, 860, 527, -1, 526, 860, 169, 954, 201, - 862, 194, 860, 527, -1, 491, 183, 528, 744, 529, - -1, -1, 165, 528, 487, 860, 529, -1, 165, 528, - 860, 529, -1, -1, 157, -1, -1, 489, 879, -1, - -1, 880, -1, 879, 532, 880, -1, 559, 41, 882, - -1, 306, 882, -1, 306, 559, -1, -1, 528, 883, - 884, 743, 885, 529, -1, 559, -1, -1, 315, 60, - 907, -1, -1, 346, 886, 888, -1, 375, 886, 888, - -1, 186, 886, 888, -1, -1, 887, -1, 54, 887, - 37, 887, -1, 453, 330, -1, 453, 168, -1, 105, - 374, -1, 860, 330, -1, 860, 168, -1, 150, 105, - 374, -1, 150, 183, -1, 150, 437, -1, 150, 278, - 303, -1, -1, 374, 528, 908, 529, -1, 374, 528, - 529, -1, 889, -1, 528, 907, 532, 860, 529, -1, - 560, 19, 860, -1, 891, -1, 892, 532, 891, -1, - 892, -1, 892, 532, -1, 860, 19, 860, -1, 894, - -1, 895, 532, 894, -1, 895, -1, 895, 532, -1, - 896, -1, -1, 39, -1, 405, -1, 31, -1, 8, - -1, 900, -1, 519, -1, 520, -1, 521, -1, 522, - -1, 15, -1, 523, -1, 524, -1, 16, -1, 515, - -1, 516, -1, 517, -1, 20, -1, 21, -1, 22, - -1, 8, -1, 297, 528, 904, 529, -1, 899, -1, - 297, 528, 904, 529, -1, 899, -1, 297, 528, 904, - 529, -1, 240, -1, 512, 240, -1, 179, -1, 512, - 179, -1, 196, -1, 512, 196, -1, 899, -1, 559, - 530, 904, -1, 862, -1, 905, 532, 862, -1, 905, - -1, 905, 532, -1, 860, -1, 907, 532, 860, -1, - 907, -1, 907, 532, -1, 908, -1, -1, 911, -1, - 910, 532, 911, -1, 860, -1, 967, 13, 860, -1, - 967, 14, 860, -1, 824, -1, 912, 532, 824, -1, - 914, 174, 860, -1, -1, 3, -1, 846, -1, 847, - -1, 848, -1, 849, -1, 850, -1, 851, -1, 852, - -1, 853, -1, 854, -1, 855, -1, 856, -1, 857, - -1, 858, -1, 561, -1, 860, 916, 919, 920, -1, - 860, 916, 919, -1, 324, 860, -1, 861, 201, 861, - -1, -1, 860, 919, 920, -1, 860, 920, 919, -1, - 860, 919, -1, 860, 920, -1, 907, -1, -1, 174, - 860, -1, 169, 860, -1, 860, 174, 908, -1, 174, - 908, -1, 908, -1, 717, -1, 528, 908, 529, -1, - 929, -1, 866, -1, 66, 927, 924, 926, 144, -1, - 925, -1, 924, 925, -1, 486, 860, 436, 860, -1, - 140, 860, -1, -1, 860, -1, -1, 559, -1, 559, - -1, 559, 562, -1, 526, 860, 527, -1, 526, 930, - 19, 930, 527, -1, 526, 930, 19, 930, 19, 930, - 527, -1, 526, 930, 19, 520, 19, 930, 527, -1, - 860, -1, -1, -1, 931, 563, -1, -1, 528, 529, - -1, 528, 910, 529, -1, 530, 564, 932, -1, 526, - 860, 527, -1, 526, 930, 19, 930, 527, -1, 526, - 930, 19, 930, 19, 930, 527, -1, 526, 930, 19, - 520, 19, 930, 527, -1, -1, 934, 933, -1, 46, - -1, -1, 938, -1, -1, 939, -1, 937, 532, 939, - -1, 937, -1, 937, 532, -1, 860, 41, 968, -1, - 860, 3, -1, 860, -1, 559, 19, 860, -1, 150, - 528, 943, 529, -1, 150, 941, -1, 560, -1, 941, - 530, 560, -1, 941, -1, 942, 532, 941, -1, 942, - -1, 942, 532, -1, 940, -1, -1, 860, 41, 559, - -1, 945, -1, 946, 532, 945, -1, 946, -1, 946, - 532, -1, 361, 528, 947, 529, -1, 361, 945, -1, - -1, 941, 41, 559, -1, 949, -1, 950, 532, 949, - -1, 950, -1, 950, 532, -1, 359, 528, 951, 529, - -1, 359, 949, -1, -1, 558, -1, 953, 532, 558, - -1, 957, -1, 954, 532, 957, -1, 954, -1, 954, - 532, -1, 955, -1, 528, 955, 529, -1, 560, -1, - 962, -1, 559, 562, -1, 960, -1, 4, -1, 561, - 931, -1, 6, -1, 7, -1, 958, 561, -1, 958, - 528, 910, 743, 742, 529, 561, -1, 828, 561, -1, - 844, 528, 860, 529, 859, -1, 844, 960, 859, -1, - 844, 561, 859, -1, 447, -1, 162, -1, 285, -1, - 9, -1, 3, -1, 1043, -1, 1048, -1, 3, -1, - 1043, -1, 1045, -1, 3, -1, 1043, -1, 1046, -1, - 559, -1, 559, 965, -1, 530, 564, -1, 965, 530, - 564, -1, 528, 955, 529, -1, -1, 961, -1, 565, - -1, 5, -1, 332, 957, 970, 41, 971, -1, 528, - 912, 529, -1, -1, 716, -1, 568, -1, 702, -1, - 703, -1, 1016, -1, 1032, -1, 101, 379, 558, 973, - -1, 101, 379, 194, 280, 154, 558, 973, -1, 101, - 300, 361, 379, 558, 973, -1, 973, 974, -1, -1, - 622, -1, 975, -1, 594, -1, 1038, -1, 101, 981, - 205, 978, 979, 295, 558, 977, 528, 587, 529, 980, - 817, -1, 101, 981, 205, 978, 194, 280, 154, 655, - 295, 558, 977, 528, 587, 529, 980, 817, -1, 559, - -1, 467, 976, -1, -1, 90, -1, -1, 655, -1, - -1, 490, 637, -1, -1, 457, -1, -1, 33, 427, - 811, 395, 379, 957, -1, 33, 427, 194, 154, 811, - 395, 379, 957, -1, 33, 390, 558, 395, 379, 957, - -1, 33, 390, 194, 154, 558, 395, 379, 957, -1, - 33, 480, 558, 395, 379, 957, -1, 33, 480, 194, - 154, 558, 395, 379, 957, -1, 170, 76, 984, -1, - 76, 984, -1, 559, -1, -1, 85, 295, 987, 558, - 224, 986, -1, 85, 295, 83, 860, 224, 986, -1, - 561, -1, 285, -1, 427, -1, 390, -1, 176, -1, - 249, -1, 249, 427, -1, 480, -1, 109, -1, 205, - -1, 379, -1, 451, -1, 156, 109, 561, 710, -1, - 156, 109, 559, 440, 561, 710, -1, 200, 109, 561, - -1, 155, 993, -1, 155, 997, 991, 993, -1, 155, - 478, 993, -1, 155, 528, 996, 529, 993, -1, 478, - -1, -1, 998, -1, 611, -1, -1, 982, -1, 608, - -1, 542, -1, 1037, -1, 983, -1, 703, -1, 1040, - -1, 691, -1, 972, -1, 594, -1, 622, -1, 589, - -1, 557, -1, 1016, -1, 674, -1, 604, -1, 975, - -1, 568, -1, 1007, -1, 680, -1, 593, -1, 969, - -1, 566, -1, 716, -1, 618, -1, 702, -1, 603, - -1, 1011, -1, 1029, -1, 1001, -1, 1032, -1, 1038, - -1, 3, -1, 1043, -1, 1047, -1, 994, -1, 561, - -1, 999, -1, 996, 532, 999, -1, 36, -1, 35, - -1, 447, -1, 162, -1, 295, -1, 995, -1, 1000, - 992, -1, 994, -1, 997, -1, 395, 1002, -1, 395, - 244, 1002, -1, 395, 394, 1002, -1, 395, 180, 1002, - -1, 395, 475, 1002, -1, 1003, -1, 1036, 174, 105, - -1, 438, 511, 1005, -1, 379, 561, -1, 1036, 440, - 1006, -1, 1036, 517, 1006, -1, 860, -1, 561, -1, - 3, -1, 844, 561, 859, -1, 844, 528, 960, 529, - 561, -1, 611, -1, 118, -1, 244, -1, 1004, -1, - 1006, 532, 1004, -1, 243, 1009, -1, 1008, 216, 1009, - 1010, -1, 1008, 216, 1009, 174, 559, 1010, -1, 1008, - 216, 1009, 174, 561, 1010, -1, -1, 170, -1, 561, - -1, 559, -1, -1, 479, 561, -1, 479, 559, -1, - 468, 1013, 1015, 991, -1, 468, 1013, 1015, 991, 558, - 966, -1, 468, 1013, 1015, 991, 1020, -1, 468, 528, - 1014, 529, -1, 468, 528, 1014, 529, 558, 966, -1, - 997, -1, 478, -1, 173, -1, 175, -1, 3, -1, - 175, -1, -1, 1012, -1, 1014, 532, 1012, -1, 173, - -1, -1, 573, 123, 174, 1017, 1019, 1018, 579, -1, - 448, 737, 1017, -1, 811, -1, 811, 559, -1, 811, - 41, 559, -1, 487, 860, -1, -1, 467, 792, -1, - -1, 997, 991, -1, 997, 991, 558, 966, -1, 48, - 1023, 561, 1024, 1028, -1, 48, 194, 280, 154, 1023, - 561, 1024, 1028, -1, 48, 300, 361, 1023, 561, 1024, - 1028, -1, 129, 565, -1, 129, 109, 565, -1, 129, - 109, 194, 154, 565, -1, 109, -1, -1, 41, 559, - -1, -1, 860, -1, -1, 565, 1025, -1, 1026, -1, - 1027, 532, 1026, -1, 528, 1027, 529, -1, -1, 363, - 1031, -1, 363, 244, 1031, -1, 363, 394, 1031, -1, - 363, 180, 1031, -1, 363, 475, 1031, -1, 1036, -1, - 31, -1, 1030, -1, 438, 511, -1, 442, 226, 239, - -1, 1034, 716, -1, 423, 716, -1, 423, 558, -1, - 1034, 428, 174, 558, -1, 1034, 558, -1, 1034, 438, - 511, -1, 1034, 442, 226, 239, -1, 1034, 31, 1035, - -1, 1034, -1, 128, -1, 127, -1, 399, -1, 1033, - -1, 428, -1, -1, 559, -1, 1036, 530, 559, -1, - 62, 870, -1, 101, 672, 480, 558, 661, 980, 41, - 716, 1039, -1, 101, 672, 480, 194, 280, 154, 558, - 661, 980, 41, 716, 1039, -1, 101, 300, 361, 672, - 480, 558, 661, 980, 41, 716, 1039, -1, 101, 672, - 351, 480, 558, 528, 665, 529, 980, 41, 716, 1039, - -1, 101, 300, 361, 672, 351, 480, 558, 528, 665, - 529, 980, 41, 716, 1039, -1, 490, 75, 298, -1, - 490, 65, 75, 298, -1, 490, 244, 75, 298, -1, - -1, 101, 672, 427, 1042, 41, 716, 1041, -1, 101, - 672, 427, 194, 280, 154, 1042, 41, 716, 1041, -1, - 101, 300, 361, 672, 427, 1042, 41, 716, 1041, -1, - 490, 108, -1, 490, 278, 108, -1, -1, 558, 661, - 646, 636, -1, 23, -1, 24, -1, 25, -1, 26, - -1, 27, -1, 28, -1, 29, -1, 30, -1, 32, - -1, 33, -1, 34, -1, 44, -1, 45, -1, 48, - -1, 49, -1, 51, -1, 52, -1, 53, -1, 61, - -1, 62, -1, 63, -1, 64, -1, 65, -1, 68, - -1, 69, -1, 70, -1, 71, -1, 74, -1, 76, - -1, 77, -1, 78, -1, 79, -1, 85, -1, 86, - -1, 87, -1, 88, -1, 89, -1, 91, -1, 92, - -1, 93, -1, 95, -1, 96, -1, 97, -1, 98, - -1, 99, -1, 100, -1, 103, -1, 104, -1, 105, - -1, 106, -1, 107, -1, 108, -1, 109, -1, 110, - -1, 111, -1, 112, -1, 114, -1, 115, -1, 117, - -1, 119, -1, 121, -1, 122, -1, 123, -1, 124, - -1, 125, -1, 126, -1, 129, -1, 130, -1, 131, - -1, 132, -1, 135, -1, 136, -1, 137, -1, 138, - -1, 139, -1, 141, -1, 142, -1, 143, -1, 145, - -1, 146, -1, 147, -1, 148, -1, 150, -1, 151, - -1, 152, -1, 153, -1, 155, -1, 156, -1, 157, - -1, 158, -1, 159, -1, 160, -1, 163, -1, 165, - -1, 166, -1, 168, -1, 170, -1, 172, -1, 176, - -1, 177, -1, 180, -1, 181, -1, 182, -1, 186, - -1, 187, -1, 189, -1, 190, -1, 191, -1, 192, - -1, 193, -1, 194, -1, 195, -1, 197, -1, 198, - -1, 199, -1, 200, -1, 202, -1, 203, -1, 204, - -1, 205, -1, 206, -1, 207, -1, 208, -1, 210, - -1, 213, -1, 214, -1, 215, -1, 216, -1, 217, - -1, 223, -1, 226, -1, 228, -1, 229, -1, 230, - -1, 232, -1, 233, -1, 234, -1, 237, -1, 239, - -1, 242, -1, 243, -1, 244, -1, 245, -1, 246, - -1, 247, -1, 248, -1, 249, -1, 251, -1, 252, - -1, 253, -1, 254, -1, 255, -1, 256, -1, 257, - -1, 258, -1, 259, -1, 260, -1, 261, -1, 262, - -1, 263, -1, 264, -1, 265, -1, 266, -1, 267, - -1, 268, -1, 269, -1, 270, -1, 271, -1, 272, - -1, 276, -1, 277, -1, 278, -1, 281, -1, 282, - -1, 284, -1, 287, -1, 289, -1, 290, -1, 291, - -1, 293, -1, 294, -1, 297, -1, 298, -1, 299, - -1, 302, -1, 303, -1, 306, -1, 309, -1, 310, - -1, 311, -1, 312, -1, 313, -1, 314, -1, 315, - -1, 316, -1, 317, -1, 318, -1, 319, -1, 320, - -1, 325, -1, 326, -1, 329, -1, 330, -1, 332, - -1, 333, -1, 334, -1, 336, -1, 337, -1, 338, - -1, 339, -1, 340, -1, 341, -1, 343, -1, 344, - -1, 345, -1, 346, -1, 347, -1, 349, -1, 350, - -1, 351, -1, 352, -1, 354, -1, 355, -1, 356, - -1, 357, -1, 358, -1, 359, -1, 360, -1, 361, - -1, 362, -1, 363, -1, 364, -1, 365, -1, 366, - -1, 368, -1, 369, -1, 371, -1, 372, -1, 373, - -1, 375, -1, 376, -1, 377, -1, 378, -1, 379, - -1, 380, -1, 381, -1, 382, -1, 383, -1, 384, - -1, 385, -1, 386, -1, 387, -1, 390, -1, 391, - -1, 392, -1, 393, -1, 394, -1, 395, -1, 397, - -1, 398, -1, 401, -1, 402, -1, 404, -1, 406, - -1, 407, -1, 408, -1, 409, -1, 410, -1, 411, - -1, 412, -1, 413, -1, 414, -1, 415, -1, 416, - -1, 417, -1, 418, -1, 419, -1, 421, -1, 425, - -1, 426, -1, 428, -1, 430, -1, 431, -1, 432, - -1, 433, -1, 434, -1, 435, -1, 437, -1, 442, - -1, 443, -1, 445, -1, 448, -1, 449, -1, 451, - -1, 452, -1, 453, -1, 454, -1, 455, -1, 458, - -1, 459, -1, 460, -1, 463, -1, 464, -1, 465, - -1, 466, -1, 468, -1, 469, -1, 470, -1, 471, - -1, 472, -1, 475, -1, 477, -1, 479, -1, 480, - -1, 481, -1, 482, -1, 483, -1, 484, -1, 485, - -1, 488, -1, 491, -1, 492, -1, 493, -1, 494, - -1, 495, -1, 496, -1, 508, -1, 509, -1, 510, - -1, 511, -1, 54, -1, 55, -1, 57, -1, 58, - -1, 72, -1, 73, -1, 80, -1, 84, -1, 113, - -1, 116, -1, 154, -1, 161, -1, 167, -1, 178, - -1, 184, -1, 185, -1, 212, -1, 218, -1, 219, - -1, 221, -1, 250, -1, 273, -1, 275, -1, 279, - -1, 286, -1, 288, -1, 304, -1, 308, -1, 327, - -1, 331, -1, 348, -1, 374, -1, 396, -1, 403, - -1, 420, -1, 422, -1, 438, -1, 439, -1, 444, - -1, 446, -1, 450, -1, 473, -1, 474, -1, 497, - -1, 498, -1, 499, -1, 500, -1, 501, -1, 502, - -1, 503, -1, 504, -1, 505, -1, 506, -1, 507, - -1, 43, -1, 47, -1, 50, -1, 56, -1, 82, - -1, 90, -1, 102, -1, 173, -1, 175, -1, 178, - -1, 179, -1, 196, -1, 211, -1, 224, -1, 225, - -1, 227, -1, 238, -1, 240, -1, 250, -1, 274, - -1, 283, -1, 305, -1, 307, -1, 328, -1, 370, - -1, 400, -1, 420, -1, 429, -1, 478, -1, 38, - -1, 43, -1, 47, -1, 50, -1, 56, -1, 60, - -1, 82, -1, 84, -1, 90, -1, 102, -1, 173, - -1, 175, -1, 179, -1, 196, -1, 211, -1, 224, - -1, 225, -1, 227, -1, 238, -1, 240, -1, 274, - -1, 283, -1, 305, -1, 307, -1, 328, -1, 370, - -1, 389, -1, 400, -1, 429, -1, 450, -1, 461, - -1, 478, -1, 38, -1, 43, -1, 47, -1, 50, - -1, 54, -1, 55, -1, 56, -1, 57, -1, 58, - -1, 60, -1, 73, -1, 72, -1, 80, -1, 82, - -1, 84, -1, 90, -1, 102, -1, 113, -1, 116, - -1, 154, -1, 161, -1, 167, -1, 173, -1, 175, - -1, 178, -1, 179, -1, 184, -1, 185, -1, 196, - -1, 211, -1, 212, -1, 219, -1, 221, -1, 218, - -1, 224, -1, 225, -1, 227, -1, 238, -1, 240, - -1, 250, -1, 273, -1, 274, -1, 275, -1, 279, - -1, 283, -1, 286, -1, 288, -1, 305, -1, 304, - -1, 307, -1, 308, -1, 327, -1, 328, -1, 331, - -1, 348, -1, 370, -1, 374, -1, 389, -1, 396, - -1, 400, -1, 403, -1, 420, -1, 422, -1, 429, - -1, 438, -1, 439, -1, 444, -1, 446, -1, 450, - -1, 461, -1, 473, -1, 474, -1, 478, -1, 497, - -1, 498, -1, 499, -1, 500, -1, 501, -1, 502, - -1, 503, -1, 504, -1, 505, -1, 506, -1, 507, + 860, -1, 561, -1, 660, -1, 665, 532, 660, -1, + 665, -1, 665, 532, -1, 824, -1, 961, 965, 523, + 451, -1, 396, 961, 965, 523, 451, -1, 75, 528, + 860, 529, 623, -1, 457, 528, 666, 529, 658, 623, + -1, 457, 642, 623, -1, 335, 229, 528, 666, 529, + 658, 623, -1, 335, 229, 642, 623, -1, 171, 229, + 528, 666, 529, 353, 558, 661, 670, 635, 623, -1, + 656, -1, 669, 532, 656, -1, 252, 175, -1, 252, + 314, -1, 252, 401, -1, -1, 240, 558, 648, -1, + 434, -1, 432, -1, 244, 434, -1, 244, 432, -1, + 180, 434, -1, 180, 432, -1, 460, -1, -1, 34, + -1, 60, 118, -1, 138, 675, 194, 154, 677, 678, + -1, 138, 675, 677, 678, -1, 138, 676, 194, 154, + 954, 678, -1, 138, 676, 954, 678, -1, 138, 679, + 957, 295, 964, 678, -1, 138, 679, 194, 154, 957, + 295, 964, 678, -1, 427, -1, 390, -1, 176, -1, + 249, -1, 249, 427, -1, 480, -1, 254, 480, -1, + 205, -1, 171, 427, -1, 82, -1, 98, -1, 379, + -1, 413, -1, 435, 383, 313, -1, 435, 383, 130, + -1, 435, 383, 433, -1, 435, 383, 91, -1, 451, + -1, 25, 257, -1, 148, 445, -1, 158, -1, 171, + 108, 494, -1, 341, -1, 393, -1, 964, -1, 677, + 532, 964, -1, 64, -1, 366, -1, -1, 326, -1, + 376, -1, 445, -1, 573, 256, 222, 1017, 467, 794, + 810, 690, 579, -1, 37, 860, -1, -1, 528, 584, + 529, -1, -1, 521, -1, -1, 464, 395, 586, -1, + 464, 395, 521, -1, 464, 571, -1, 123, -1, 215, + 682, 473, 528, 908, 529, -1, 215, 571, 683, -1, + 215, 118, 473, -1, 134, 281, -1, 146, 685, -1, + 860, -1, -1, 486, 253, 681, 436, 684, -1, 60, + 407, -1, 60, 431, -1, -1, 486, 280, 253, 687, + 681, 436, 684, -1, 686, -1, 688, -1, 689, -1, + 689, 690, -1, 101, 672, 698, 558, 695, -1, 101, + 672, 698, 194, 280, 154, 558, 695, -1, 101, 300, + 361, 672, 698, 558, 695, -1, 101, 672, 698, 558, + 697, -1, 101, 672, 698, 194, 280, 154, 558, 697, + -1, 101, 300, 361, 672, 698, 558, 697, -1, 699, + 41, 427, 718, -1, 699, 41, 427, 717, -1, 693, + -1, 694, 532, 693, -1, 692, -1, 694, -1, 699, + 41, 860, -1, 696, -1, 697, 532, 696, -1, 176, + -1, 249, -1, 528, 529, -1, 528, 700, 532, 529, + -1, 528, 700, 529, -1, 701, -1, 700, 532, 701, + -1, 967, 823, -1, 967, 823, 13, 860, -1, 967, + 823, 14, 860, -1, 573, 464, 1017, 395, 586, 790, + 1018, 579, -1, 99, 713, 558, 661, 711, 705, 709, + 715, 706, 610, 710, -1, 99, 528, 716, 529, 440, + 709, 715, 610, 710, -1, 99, 174, 109, 559, 440, + 559, 704, -1, -1, 528, 379, 529, -1, 528, 108, + 529, -1, 174, -1, 440, -1, 707, 125, 561, -1, + -1, 467, -1, -1, 41, -1, -1, 340, -1, -1, + 712, -1, 528, 1027, 529, -1, 490, 293, -1, -1, + 712, 714, -1, -1, 56, -1, -1, 56, -1, 293, + -1, 173, -1, 124, 708, 561, -1, 285, 708, 561, + -1, 103, -1, 189, -1, 345, 708, 561, -1, 147, + 708, 561, -1, 170, 345, 665, -1, 170, 345, 521, + -1, 315, 60, 665, -1, 315, 60, 521, -1, 170, + 280, 285, 665, -1, 170, 285, 665, -1, 142, 561, + -1, 561, -1, 414, -1, 415, -1, 3, 530, 559, + -1, 3, -1, 528, 860, 529, -1, 865, -1, 718, + -1, 717, -1, 528, 718, 529, -1, 528, 717, 529, + -1, 528, 1032, 529, -1, 721, -1, 719, 744, -1, + 719, 743, 781, 750, -1, 719, 743, 749, 782, -1, + 728, 719, -1, 728, 719, 744, -1, 728, 719, 743, + 781, 750, -1, 728, 719, 743, 749, 782, -1, 721, + -1, 717, -1, 388, 741, 936, -1, -1, 388, 741, + 936, 735, 790, 817, 770, 779, 878, 780, 755, -1, + 388, 740, 938, 735, 790, 817, 770, 779, 878, 780, + 755, -1, 174, 791, 720, 735, 817, 770, 779, 878, + 780, 755, -1, 174, 791, 388, 740, 938, 735, 817, + 770, 779, 878, 780, 755, -1, 789, -1, 427, 811, + -1, 719, 456, 738, 739, 719, -1, 719, 456, 738, + 719, -1, 719, 220, 738, 719, -1, 719, 149, 738, + 719, -1, 723, 794, 467, 938, -1, 723, 794, 467, + 938, 183, 60, 956, -1, 723, 794, 183, 60, 956, + -1, 723, 794, 295, 727, -1, 723, 794, 295, 727, + 183, 60, 956, -1, 723, 794, 295, 727, 467, 938, + -1, 723, 794, 295, 727, 467, 938, 183, 60, 956, + -1, 724, 794, 295, 938, 222, 271, 957, 722, 956, + -1, 724, 794, 295, 938, -1, 472, -1, 473, -1, + 321, -1, 323, -1, 462, -1, 322, -1, 861, -1, + 861, 201, 528, 718, 529, -1, 797, -1, 725, -1, + 726, 532, 725, -1, 726, -1, 726, 532, -1, 490, + 729, -1, 514, 729, -1, 490, 351, 729, -1, 730, + -1, 729, 532, 730, -1, 957, 966, 731, 41, 734, + 528, 971, 529, -1, 467, 229, 528, 732, 529, -1, + -1, 733, -1, 733, 532, -1, 928, -1, 733, 532, + 928, -1, 254, -1, 280, 254, -1, -1, 222, 736, + -1, -1, 434, 737, 558, -1, 432, 737, 558, -1, + 244, 434, 737, 558, -1, 244, 432, 737, 558, -1, + 180, 434, 737, 558, -1, 180, 432, 737, 558, -1, + 460, 737, 558, -1, 427, 558, -1, 558, -1, 427, + -1, -1, 31, -1, 133, -1, -1, 60, 271, -1, + 133, -1, 133, 295, 528, 908, 529, -1, 31, -1, + -1, 195, 287, -1, 364, 287, -1, -1, 744, -1, + -1, 301, 60, 745, -1, 301, 60, 31, 747, 748, + -1, 746, -1, 745, 532, 746, -1, 860, 467, 902, + 748, -1, 860, 747, 748, -1, 42, -1, 127, -1, + -1, 513, 166, -1, 513, 234, -1, -1, 751, 752, + -1, 752, 751, -1, 751, -1, 752, -1, 749, -1, + -1, 241, 764, -1, 241, 764, 532, 765, -1, 164, + 769, 766, 768, 296, -1, 164, 769, 768, 296, -1, + 292, 765, -1, 292, 766, 768, -1, 4, -1, 9, + -1, 865, -1, 753, 523, -1, 753, 319, -1, 753, + -1, 753, 375, -1, 467, 377, 757, -1, -1, 559, + -1, -1, 756, 528, 754, 529, 760, -1, 754, -1, + 754, 528, 559, 529, -1, 754, 528, 559, 532, 9, + 529, -1, 429, 757, -1, 758, -1, -1, 360, 528, + 9, 529, -1, -1, 439, -1, 479, -1, 761, 14, + 860, -1, 47, 528, 762, 529, -1, -1, 860, -1, + 31, -1, 860, 523, -1, 4, 319, -1, 9, 319, + -1, 860, -1, 862, -1, 519, 767, -1, 520, 767, + -1, 960, -1, 4, -1, 374, -1, 375, -1, 166, + -1, 277, -1, 183, 60, 772, -1, 183, 60, 31, + -1, -1, 773, -1, 771, 532, 773, -1, 771, -1, + 771, 532, -1, 860, -1, 774, -1, 776, -1, 775, + -1, 777, -1, 528, 529, -1, 373, 528, 908, 529, + -1, 104, 528, 908, 529, -1, 184, 397, 528, 772, + 529, -1, 184, -1, 185, -1, 188, 860, -1, -1, + 342, 860, -1, -1, 783, -1, 169, 347, 296, -1, + 781, -1, -1, 784, -1, 783, 784, -1, 785, 786, + 787, -1, 169, 464, -1, 169, 278, 229, 464, -1, + 169, 398, -1, 169, 229, 398, -1, 290, 953, -1, + -1, 284, -1, 402, 247, -1, -1, 473, 528, 908, + 529, -1, 788, 532, 528, 908, 529, -1, 788, -1, + 788, 532, -1, 174, 792, -1, -1, 794, -1, 791, + 532, 794, -1, 791, -1, 791, 532, -1, 560, 19, + -1, 811, 806, 763, 759, -1, 793, 811, 763, 759, + -1, 812, 807, 759, -1, 793, 812, 759, -1, 789, + 805, 759, -1, 235, 812, 807, -1, 717, 806, 759, + -1, 793, 717, 759, -1, 235, 717, 806, -1, 804, + -1, 528, 804, 529, 805, -1, 793, 528, 804, 529, + -1, 794, 321, 528, 938, 169, 800, 795, 529, 806, + -1, 794, 462, 796, 528, 801, 169, 803, 529, 806, + -1, 183, 60, 955, -1, -1, 202, 287, -1, 150, + 287, -1, -1, 861, 201, 528, 938, 529, -1, 861, + 201, 560, -1, 863, -1, 866, -1, 528, 906, 529, + -1, 798, 201, 528, 938, 529, -1, 798, 201, 560, + -1, 799, -1, 800, 799, -1, 560, -1, 528, 955, + 529, -1, 801, 201, 528, 938, 529, -1, 802, -1, + 803, 802, -1, 528, 804, 529, -1, 794, 102, 227, + 794, -1, 794, 808, 227, 794, 810, -1, 794, 227, + 794, 810, -1, 794, 274, 808, 227, 794, -1, 794, + 274, 227, 794, -1, 794, 43, 808, 227, 794, 810, + -1, 794, 43, 227, 794, 810, -1, 794, 328, 227, + 794, -1, 794, 38, 227, 794, 810, -1, 794, 389, + 227, 794, 810, -1, 41, 560, 528, 955, 529, -1, + 41, 560, -1, 559, 528, 955, 529, -1, 559, -1, + 805, -1, -1, 805, -1, 41, 528, 818, 529, -1, + 41, 560, 528, 818, 529, -1, 559, 528, 818, 529, + -1, -1, 175, 809, -1, 238, 809, -1, 370, 809, + -1, 389, -1, 38, -1, 211, -1, 305, -1, -1, + 467, 528, 955, 529, -1, 295, 860, -1, 558, -1, + 558, 521, -1, 296, 558, -1, 296, 528, 558, 529, + -1, 872, 816, -1, 375, 174, 528, 814, 529, 816, + -1, 872, 815, -1, 813, -1, 814, 532, 813, -1, + 41, 528, 818, 529, -1, -1, 514, 302, -1, -1, + 487, 860, -1, -1, 819, -1, 818, 532, 819, -1, + 560, 824, 820, -1, 81, 964, -1, -1, 559, 824, + -1, 821, 532, 559, 824, -1, 374, -1, 420, -1, + 824, -1, -1, 827, 826, -1, 396, 827, 826, -1, + 827, 40, 526, 960, 527, -1, 396, 827, 40, 526, + 960, 527, -1, 827, 40, -1, 396, 827, 40, -1, + 825, 826, -1, 822, 528, 821, 529, 826, -1, 250, + 528, 912, 529, 826, -1, 456, 528, 821, 529, 826, + -1, 3, 530, 3, -1, 825, 530, 3, -1, 826, + 526, 527, -1, 826, 526, 960, 527, -1, -1, 829, + -1, 831, -1, 833, -1, 837, -1, 843, -1, 844, + 859, -1, 844, 528, 960, 529, -1, 831, -1, 834, + -1, 838, -1, 843, -1, 963, 830, -1, 528, 909, + 529, -1, -1, 218, -1, 219, -1, 403, -1, 55, + -1, 348, -1, 167, 832, -1, 137, 331, -1, 116, + 830, -1, 113, 830, -1, 288, 830, -1, 58, -1, + 528, 960, 529, -1, -1, 835, -1, 836, -1, 835, + -1, 836, -1, 57, 842, 528, 908, 529, -1, 57, + 842, -1, 839, -1, 840, -1, 839, -1, 840, -1, + 841, 528, 960, 529, -1, 841, -1, 73, 842, -1, + 72, 842, -1, 474, -1, 273, 73, 842, -1, 273, + 72, 842, -1, 275, 842, -1, 477, -1, -1, 439, + 528, 960, 529, 845, -1, 439, 845, -1, 438, 528, + 960, 529, 845, -1, 438, 845, -1, 221, -1, 514, + 438, 511, -1, 492, 438, 511, -1, -1, 508, -1, + 509, -1, 268, -1, 269, -1, 110, -1, 111, -1, + 191, -1, 192, -1, 264, -1, 265, -1, 384, -1, + 385, -1, 262, -1, 263, -1, 258, -1, 259, -1, + 484, -1, 485, -1, 343, -1, 344, -1, 114, -1, + 115, -1, 70, -1, 69, -1, 261, -1, 260, -1, + 846, -1, 847, -1, 848, -1, 849, -1, 850, -1, + 851, -1, 852, -1, 853, -1, 854, -1, 855, -1, + 856, -1, 857, -1, 858, -1, 846, 440, 847, -1, + 848, 440, 849, -1, 848, 440, 850, -1, 848, 440, + 851, -1, 849, 440, 850, -1, 849, 440, 851, -1, + 850, 440, 851, -1, -1, 862, -1, 860, 11, 824, + -1, 860, 81, 964, -1, 860, 47, 438, 511, 860, + -1, 519, 860, -1, 520, 860, -1, 860, 519, 860, + -1, 860, 520, 860, -1, 860, 521, 860, -1, 860, + 522, 860, -1, 860, 15, 860, -1, 860, 523, 860, + -1, 860, 524, 860, -1, 860, 16, 860, -1, 860, + 515, 860, -1, 860, 516, 860, -1, 860, 517, 860, + -1, 860, 20, 860, -1, 860, 21, 860, -1, 860, + 22, 860, -1, 860, 901, 860, -1, 901, 860, -1, + 860, 901, -1, 860, 37, 860, -1, 860, 300, 860, + -1, 280, 860, -1, 512, 860, -1, 860, 179, 860, + -1, 860, 240, 860, -1, 860, 240, 860, 147, 860, + -1, 860, 512, 240, 860, -1, 860, 512, 240, 860, + 147, 860, -1, 860, 196, 860, -1, 860, 196, 860, + 147, 860, -1, 860, 512, 196, 860, -1, 860, 512, + 196, 860, 147, 860, -1, 860, 400, 440, 860, -1, + 860, 400, 440, 860, 147, 860, -1, 860, 512, 400, + 440, 860, -1, 860, 512, 400, 440, 860, 147, 860, + -1, 860, 224, 285, -1, 860, 225, -1, 860, 224, + 280, 285, -1, 860, 280, 285, -1, 860, 283, -1, + 231, 954, 19, 860, -1, 860, 17, 860, -1, 860, + 18, 860, -1, 890, 307, 890, -1, 860, 224, 447, + -1, 860, 224, 280, 447, -1, 860, 224, 162, -1, + 860, 224, 280, 162, -1, 860, 224, 458, -1, 860, + 224, 280, 458, -1, 860, 224, 133, 174, 860, -1, + 860, 224, 280, 133, 174, 860, -1, 860, 224, 290, + 528, 912, 529, -1, 860, 224, 280, 290, 528, 912, + 529, -1, 860, 54, 935, 861, 37, 860, -1, 860, + 512, 54, 935, 861, 37, 860, -1, 860, 54, 424, + 861, 37, 860, -1, 860, 512, 54, 424, 861, 37, + 860, -1, 860, 201, 922, -1, 860, 512, 201, 922, + -1, 860, 903, 898, 717, -1, 860, 903, 898, 528, + 860, 529, -1, 118, -1, 84, 528, 860, 529, -1, + 461, 528, 860, 529, -1, 521, 84, 528, 860, 529, + -1, 521, 944, 948, 952, -1, 559, 530, 521, 944, + 948, 952, -1, 862, -1, 861, 11, 824, -1, 519, + 861, -1, 520, 861, -1, 861, 519, 861, -1, 861, + 520, 861, -1, 861, 521, 861, -1, 861, 522, 861, + -1, 861, 15, 861, -1, 861, 523, 861, -1, 861, + 524, 861, -1, 861, 16, 861, -1, 861, 515, 861, + -1, 861, 516, 861, -1, 861, 517, 861, -1, 861, + 20, 861, -1, 861, 21, 861, -1, 861, 22, 861, + -1, 861, 901, 861, -1, 901, 861, -1, 861, 901, + -1, 861, 224, 133, 174, 861, -1, 861, 224, 280, + 133, 174, 861, -1, 861, 224, 290, 528, 912, 529, + -1, 861, 224, 280, 290, 528, 912, 529, -1, 863, + -1, 864, 934, -1, 929, -1, 959, -1, 717, -1, + 717, 562, -1, 154, 717, -1, 778, 528, 908, 529, + -1, 528, 860, 529, -1, 866, -1, 890, -1, 533, + -1, 10, -1, 534, 565, -1, 865, -1, 868, -1, + 869, -1, 871, -1, 923, -1, 867, -1, 874, -1, + 40, 717, -1, 40, 526, 909, 527, -1, 535, 9, + -1, 526, 909, 527, -1, 536, 893, 537, -1, 250, + 536, 897, 537, -1, 958, 528, 529, -1, 958, 528, + 744, 742, 529, -1, 958, 528, 910, 743, 742, 529, + -1, 958, 528, 476, 911, 743, 742, 529, -1, 958, + 528, 910, 532, 476, 911, 743, 742, 529, -1, 958, + 528, 31, 910, 743, 742, 529, -1, 958, 528, 133, + 910, 743, 742, 529, -1, 870, 875, 876, 877, 881, + -1, 873, -1, 870, -1, 873, -1, 82, 169, 528, + 860, 529, -1, 67, 528, 860, 41, 824, 529, -1, + 450, 528, 860, 41, 824, 529, -1, 161, 528, 913, + 529, -1, 308, 528, 915, 529, -1, 327, 528, 917, + 529, -1, 422, 528, 918, 529, -1, 444, 528, 860, + 41, 824, 529, -1, 446, 528, 59, 921, 529, -1, + 446, 528, 236, 921, 529, -1, 446, 528, 441, 921, + 529, -1, 446, 528, 921, 529, -1, 286, 528, 860, + 532, 860, 529, -1, 80, 528, 908, 529, -1, 526, + 860, 169, 954, 201, 860, 527, -1, 526, 860, 169, + 954, 201, 862, 194, 860, 527, -1, 491, 183, 528, + 744, 529, -1, -1, 165, 528, 487, 860, 529, -1, + 165, 528, 860, 529, -1, -1, 157, -1, -1, 489, + 879, -1, -1, 880, -1, 879, 532, 880, -1, 559, + 41, 882, -1, 306, 882, -1, 306, 559, -1, -1, + 528, 883, 884, 743, 885, 529, -1, 559, -1, -1, + 315, 60, 907, -1, -1, 346, 886, 888, -1, 375, + 886, 888, -1, 186, 886, 888, -1, -1, 887, -1, + 54, 887, 37, 887, -1, 453, 330, -1, 453, 168, + -1, 105, 374, -1, 860, 330, -1, 860, 168, -1, + 150, 105, 374, -1, 150, 183, -1, 150, 437, -1, + 150, 278, 303, -1, -1, 374, 528, 908, 529, -1, + 374, 528, 529, -1, 889, -1, 528, 907, 532, 860, + 529, -1, 560, 19, 860, -1, 891, -1, 892, 532, + 891, -1, 892, -1, 892, 532, -1, 860, 19, 860, + -1, 894, -1, 895, 532, 894, -1, 895, -1, 895, + 532, -1, 896, -1, -1, 39, -1, 405, -1, 31, + -1, 8, -1, 900, -1, 519, -1, 520, -1, 521, + -1, 522, -1, 15, -1, 523, -1, 524, -1, 16, + -1, 515, -1, 516, -1, 517, -1, 20, -1, 21, + -1, 22, -1, 8, -1, 297, 528, 904, 529, -1, + 899, -1, 297, 528, 904, 529, -1, 899, -1, 297, + 528, 904, 529, -1, 240, -1, 512, 240, -1, 179, + -1, 512, 179, -1, 196, -1, 512, 196, -1, 899, + -1, 559, 530, 904, -1, 862, -1, 905, 532, 862, + -1, 905, -1, 905, 532, -1, 860, -1, 907, 532, + 860, -1, 907, -1, 907, 532, -1, 908, -1, -1, + 911, -1, 910, 532, 911, -1, 860, -1, 967, 13, + 860, -1, 967, 14, 860, -1, 824, -1, 912, 532, + 824, -1, 914, 174, 860, -1, -1, 3, -1, 846, + -1, 847, -1, 848, -1, 849, -1, 850, -1, 851, + -1, 852, -1, 853, -1, 854, -1, 855, -1, 856, + -1, 857, -1, 858, -1, 561, -1, 860, 916, 919, + 920, -1, 860, 916, 919, -1, 324, 860, -1, 861, + 201, 861, -1, -1, 860, 919, 920, -1, 860, 920, + 919, -1, 860, 919, -1, 860, 920, -1, 907, -1, + -1, 174, 860, -1, 169, 860, -1, 860, 174, 908, + -1, 174, 908, -1, 908, -1, 717, -1, 528, 908, + 529, -1, 929, -1, 866, -1, 66, 927, 924, 926, + 144, -1, 925, -1, 924, 925, -1, 486, 860, 436, + 860, -1, 140, 860, -1, -1, 860, -1, -1, 559, + -1, 559, -1, 559, 562, -1, 526, 860, 527, -1, + 526, 930, 19, 930, 527, -1, 526, 930, 19, 930, + 19, 930, 527, -1, 526, 930, 19, 520, 19, 930, + 527, -1, 860, -1, -1, -1, 931, 563, -1, -1, + 528, 529, -1, 528, 910, 529, -1, 530, 564, 932, + -1, 526, 860, 527, -1, 526, 930, 19, 930, 527, + -1, 526, 930, 19, 930, 19, 930, 527, -1, 526, + 930, 19, 520, 19, 930, 527, -1, -1, 934, 933, + -1, 46, -1, -1, 938, -1, -1, 939, -1, 937, + 532, 939, -1, 937, -1, 937, 532, -1, 860, 41, + 968, -1, 860, 3, -1, 860, -1, 559, 19, 860, + -1, 150, 528, 943, 529, -1, 150, 941, -1, 560, + -1, 941, 530, 560, -1, 941, -1, 942, 532, 941, + -1, 942, -1, 942, 532, -1, 940, -1, -1, 860, + 41, 559, -1, 945, -1, 946, 532, 945, -1, 946, + -1, 946, 532, -1, 361, 528, 947, 529, -1, 361, + 945, -1, -1, 941, 41, 559, -1, 949, -1, 950, + 532, 949, -1, 950, -1, 950, 532, -1, 359, 528, + 951, 529, -1, 359, 949, -1, -1, 558, -1, 953, + 532, 558, -1, 957, -1, 954, 532, 957, -1, 954, + -1, 954, 532, -1, 955, -1, 528, 955, 529, -1, + 560, -1, 962, -1, 559, 562, -1, 960, -1, 4, + -1, 561, 931, -1, 6, -1, 7, -1, 958, 561, + -1, 958, 528, 910, 743, 742, 529, 561, -1, 828, + 561, -1, 844, 528, 860, 529, 859, -1, 844, 960, + 859, -1, 844, 561, 859, -1, 447, -1, 162, -1, + 285, -1, 9, -1, 3, -1, 1043, -1, 1048, -1, + 3, -1, 1043, -1, 1045, -1, 3, -1, 1043, -1, + 1046, -1, 559, -1, 559, 965, -1, 530, 564, -1, + 965, 530, 564, -1, 528, 955, 529, -1, -1, 961, + -1, 565, -1, 5, -1, 332, 957, 970, 41, 971, + -1, 528, 912, 529, -1, -1, 716, -1, 568, -1, + 702, -1, 703, -1, 1016, -1, 1032, -1, 101, 379, + 558, 973, -1, 101, 379, 194, 280, 154, 558, 973, + -1, 101, 300, 361, 379, 558, 973, -1, 973, 974, + -1, -1, 622, -1, 975, -1, 594, -1, 1038, -1, + 101, 981, 205, 978, 979, 295, 558, 977, 528, 587, + 529, 980, 817, -1, 101, 981, 205, 978, 194, 280, + 154, 655, 295, 558, 977, 528, 587, 529, 980, 817, + -1, 559, -1, 467, 976, -1, -1, 90, -1, -1, + 655, -1, -1, 490, 637, -1, -1, 457, -1, -1, + 33, 427, 811, 395, 379, 957, -1, 33, 427, 194, + 154, 811, 395, 379, 957, -1, 33, 390, 558, 395, + 379, 957, -1, 33, 390, 194, 154, 558, 395, 379, + 957, -1, 33, 480, 558, 395, 379, 957, -1, 33, + 480, 194, 154, 558, 395, 379, 957, -1, 170, 76, + 984, -1, 76, 984, -1, 559, -1, -1, 85, 295, + 987, 558, 224, 986, -1, 85, 295, 83, 860, 224, + 986, -1, 561, -1, 285, -1, 427, -1, 390, -1, + 176, -1, 249, -1, 249, 427, -1, 480, -1, 109, + -1, 205, -1, 379, -1, 451, -1, 156, 109, 561, + 710, -1, 156, 109, 559, 440, 561, 710, -1, 200, + 109, 561, -1, 155, 993, -1, 155, 997, 991, 993, + -1, 155, 478, 993, -1, 155, 528, 996, 529, 993, + -1, 478, -1, -1, 998, -1, 611, -1, -1, 982, + -1, 608, -1, 542, -1, 1037, -1, 983, -1, 703, + -1, 1040, -1, 691, -1, 972, -1, 594, -1, 622, + -1, 589, -1, 557, -1, 1016, -1, 674, -1, 604, + -1, 975, -1, 568, -1, 1007, -1, 680, -1, 593, + -1, 969, -1, 566, -1, 716, -1, 618, -1, 702, + -1, 603, -1, 1011, -1, 1029, -1, 1001, -1, 1032, + -1, 1038, -1, 3, -1, 1043, -1, 1047, -1, 994, + -1, 561, -1, 999, -1, 996, 532, 999, -1, 36, + -1, 35, -1, 447, -1, 162, -1, 295, -1, 995, + -1, 1000, 992, -1, 994, -1, 997, -1, 395, 1002, + -1, 395, 244, 1002, -1, 395, 394, 1002, -1, 395, + 180, 1002, -1, 395, 475, 1002, -1, 1003, -1, 1036, + 174, 105, -1, 438, 511, 1005, -1, 379, 561, -1, + 1036, 440, 1006, -1, 1036, 517, 1006, -1, 860, -1, + 561, -1, 3, -1, 844, 561, 859, -1, 844, 528, + 960, 529, 561, -1, 611, -1, 118, -1, 244, -1, + 1004, -1, 1006, 532, 1004, -1, 243, 1009, -1, 1008, + 216, 1009, 1010, -1, 1008, 216, 1009, 174, 559, 1010, + -1, 1008, 216, 1009, 174, 561, 1010, -1, -1, 170, + -1, 561, -1, 559, -1, -1, 479, 561, -1, 479, + 559, -1, 468, 1013, 1015, 991, -1, 468, 1013, 1015, + 991, 558, 966, -1, 468, 1013, 1015, 991, 1020, -1, + 468, 528, 1014, 529, -1, 468, 528, 1014, 529, 558, + 966, -1, 997, -1, 478, -1, 173, -1, 175, -1, + 3, -1, 175, -1, -1, 1012, -1, 1014, 532, 1012, + -1, 173, -1, -1, 573, 123, 174, 1017, 1019, 1018, + 579, -1, 448, 737, 1017, -1, 811, -1, 811, 559, + -1, 811, 41, 559, -1, 487, 860, -1, -1, 467, + 792, -1, -1, 997, 991, -1, 997, 991, 558, 966, + -1, 48, 1023, 561, 1024, 1028, -1, 48, 194, 280, + 154, 1023, 561, 1024, 1028, -1, 48, 300, 361, 1023, + 561, 1024, 1028, -1, 129, 565, -1, 129, 109, 565, + -1, 129, 109, 194, 154, 565, -1, 109, -1, -1, + 41, 559, -1, -1, 860, -1, -1, 565, 1025, -1, + 1026, -1, 1027, 532, 1026, -1, 528, 1027, 529, -1, + -1, 363, 1031, -1, 363, 244, 1031, -1, 363, 394, + 1031, -1, 363, 180, 1031, -1, 363, 475, 1031, -1, + 1036, -1, 31, -1, 1030, -1, 438, 511, -1, 442, + 226, 239, -1, 1034, 716, -1, 423, 716, -1, 423, + 558, -1, 1034, 428, 174, 558, -1, 1034, 558, -1, + 1034, 438, 511, -1, 1034, 442, 226, 239, -1, 1034, + 31, 1035, -1, 1034, -1, 128, -1, 127, -1, 399, + -1, 1033, -1, 428, -1, -1, 559, -1, 1036, 530, + 559, -1, 62, 870, -1, 101, 672, 480, 558, 661, + 980, 41, 716, 1039, -1, 101, 672, 480, 194, 280, + 154, 558, 661, 980, 41, 716, 1039, -1, 101, 300, + 361, 672, 480, 558, 661, 980, 41, 716, 1039, -1, + 101, 672, 351, 480, 558, 528, 665, 529, 980, 41, + 716, 1039, -1, 101, 300, 361, 672, 351, 480, 558, + 528, 665, 529, 980, 41, 716, 1039, -1, 490, 75, + 298, -1, 490, 65, 75, 298, -1, 490, 244, 75, + 298, -1, -1, 101, 672, 427, 1042, 41, 716, 1041, + -1, 101, 672, 427, 194, 280, 154, 1042, 41, 716, + 1041, -1, 101, 300, 361, 672, 427, 1042, 41, 716, + 1041, -1, 490, 108, -1, 490, 278, 108, -1, -1, + 558, 661, 646, 636, -1, 23, -1, 24, -1, 25, + -1, 26, -1, 27, -1, 28, -1, 29, -1, 30, + -1, 32, -1, 33, -1, 34, -1, 44, -1, 45, + -1, 48, -1, 49, -1, 51, -1, 52, -1, 53, + -1, 61, -1, 62, -1, 63, -1, 64, -1, 65, + -1, 68, -1, 69, -1, 70, -1, 71, -1, 74, + -1, 76, -1, 77, -1, 78, -1, 79, -1, 85, + -1, 86, -1, 87, -1, 88, -1, 89, -1, 91, + -1, 92, -1, 93, -1, 95, -1, 96, -1, 97, + -1, 98, -1, 99, -1, 100, -1, 103, -1, 104, + -1, 105, -1, 106, -1, 107, -1, 108, -1, 109, + -1, 110, -1, 111, -1, 112, -1, 114, -1, 115, + -1, 117, -1, 119, -1, 121, -1, 122, -1, 123, + -1, 124, -1, 125, -1, 126, -1, 129, -1, 130, + -1, 131, -1, 132, -1, 135, -1, 136, -1, 137, + -1, 138, -1, 139, -1, 141, -1, 142, -1, 143, + -1, 145, -1, 146, -1, 147, -1, 148, -1, 150, + -1, 151, -1, 152, -1, 153, -1, 155, -1, 156, + -1, 157, -1, 158, -1, 159, -1, 160, -1, 163, + -1, 165, -1, 166, -1, 168, -1, 170, -1, 172, + -1, 176, -1, 177, -1, 180, -1, 181, -1, 182, + -1, 186, -1, 187, -1, 189, -1, 190, -1, 191, + -1, 192, -1, 193, -1, 194, -1, 195, -1, 197, + -1, 198, -1, 199, -1, 200, -1, 202, -1, 203, + -1, 204, -1, 205, -1, 206, -1, 207, -1, 208, + -1, 210, -1, 213, -1, 214, -1, 215, -1, 216, + -1, 217, -1, 223, -1, 226, -1, 228, -1, 229, + -1, 230, -1, 232, -1, 233, -1, 234, -1, 237, + -1, 239, -1, 242, -1, 243, -1, 244, -1, 245, + -1, 246, -1, 247, -1, 248, -1, 249, -1, 251, + -1, 252, -1, 253, -1, 254, -1, 255, -1, 256, + -1, 257, -1, 258, -1, 259, -1, 260, -1, 261, + -1, 262, -1, 263, -1, 264, -1, 265, -1, 266, + -1, 267, -1, 268, -1, 269, -1, 270, -1, 271, + -1, 272, -1, 276, -1, 277, -1, 278, -1, 281, + -1, 282, -1, 284, -1, 287, -1, 289, -1, 290, + -1, 291, -1, 293, -1, 294, -1, 297, -1, 298, + -1, 299, -1, 302, -1, 303, -1, 306, -1, 309, + -1, 310, -1, 311, -1, 312, -1, 313, -1, 314, + -1, 315, -1, 316, -1, 317, -1, 318, -1, 319, + -1, 320, -1, 325, -1, 326, -1, 329, -1, 330, + -1, 332, -1, 333, -1, 334, -1, 336, -1, 337, + -1, 338, -1, 339, -1, 340, -1, 341, -1, 343, + -1, 344, -1, 345, -1, 346, -1, 347, -1, 349, + -1, 350, -1, 351, -1, 352, -1, 354, -1, 355, + -1, 356, -1, 357, -1, 358, -1, 359, -1, 360, + -1, 361, -1, 362, -1, 363, -1, 364, -1, 365, + -1, 366, -1, 368, -1, 369, -1, 371, -1, 372, + -1, 373, -1, 375, -1, 376, -1, 377, -1, 378, + -1, 379, -1, 380, -1, 381, -1, 382, -1, 383, + -1, 384, -1, 385, -1, 386, -1, 387, -1, 390, + -1, 391, -1, 392, -1, 393, -1, 394, -1, 395, + -1, 397, -1, 398, -1, 401, -1, 402, -1, 404, + -1, 406, -1, 407, -1, 408, -1, 409, -1, 410, + -1, 411, -1, 412, -1, 413, -1, 414, -1, 415, + -1, 416, -1, 417, -1, 418, -1, 419, -1, 421, + -1, 425, -1, 426, -1, 428, -1, 430, -1, 431, + -1, 432, -1, 433, -1, 434, -1, 435, -1, 437, + -1, 442, -1, 443, -1, 445, -1, 448, -1, 449, + -1, 451, -1, 452, -1, 453, -1, 454, -1, 455, + -1, 458, -1, 459, -1, 460, -1, 463, -1, 464, + -1, 465, -1, 466, -1, 468, -1, 469, -1, 470, + -1, 471, -1, 472, -1, 475, -1, 477, -1, 479, + -1, 480, -1, 481, -1, 482, -1, 483, -1, 484, + -1, 485, -1, 488, -1, 491, -1, 492, -1, 493, + -1, 494, -1, 495, -1, 496, -1, 508, -1, 509, + -1, 510, -1, 511, -1, 54, -1, 55, -1, 57, + -1, 58, -1, 72, -1, 73, -1, 80, -1, 84, + -1, 113, -1, 116, -1, 154, -1, 161, -1, 167, + -1, 178, -1, 184, -1, 185, -1, 212, -1, 218, + -1, 219, -1, 221, -1, 250, -1, 273, -1, 275, + -1, 279, -1, 286, -1, 288, -1, 304, -1, 308, + -1, 327, -1, 331, -1, 348, -1, 374, -1, 396, + -1, 403, -1, 420, -1, 422, -1, 438, -1, 439, + -1, 444, -1, 446, -1, 450, -1, 473, -1, 474, + -1, 497, -1, 498, -1, 499, -1, 500, -1, 501, + -1, 502, -1, 503, -1, 504, -1, 505, -1, 506, + -1, 507, -1, 43, -1, 47, -1, 50, -1, 56, + -1, 82, -1, 90, -1, 102, -1, 173, -1, 175, + -1, 178, -1, 179, -1, 196, -1, 211, -1, 224, + -1, 225, -1, 227, -1, 238, -1, 240, -1, 250, + -1, 274, -1, 283, -1, 305, -1, 307, -1, 328, + -1, 370, -1, 400, -1, 420, -1, 429, -1, 478, -1, 38, -1, 43, -1, 47, -1, 50, -1, 56, -1, 60, -1, 82, -1, 84, -1, 90, -1, 102, - -1, 173, -1, 175, -1, 178, -1, 179, -1, 196, - -1, 211, -1, 224, -1, 225, -1, 227, -1, 238, - -1, 240, -1, 250, -1, 274, -1, 283, -1, 305, - -1, 307, -1, 328, -1, 370, -1, 389, -1, 400, - -1, 420, -1, 429, -1, 450, -1, 461, -1, 478, - -1, 31, -1, 35, -1, 36, -1, 37, -1, 39, - -1, 40, -1, 41, -1, 42, -1, 46, -1, 59, - -1, 66, -1, 67, -1, 75, -1, 81, -1, 83, - -1, 94, -1, 101, -1, 118, -1, 120, -1, 127, - -1, 128, -1, 133, -1, 134, -1, 140, -1, 144, - -1, 149, -1, 162, -1, 164, -1, 169, -1, 171, - -1, 174, -1, 183, -1, 188, -1, 201, -1, 209, - -1, 220, -1, 222, -1, 231, -1, 235, -1, 236, - -1, 241, -1, 280, -1, 285, -1, 292, -1, 295, - -1, 296, -1, 300, -1, 301, -1, 321, -1, 322, - -1, 323, -1, 324, -1, 335, -1, 342, -1, 353, - -1, 367, -1, 388, -1, 399, -1, 405, -1, 423, - -1, 424, -1, 427, -1, 436, -1, 440, -1, 441, - -1, 447, -1, 456, -1, 457, -1, 462, -1, 467, - -1, 476, -1, 486, -1, 487, -1, 489, -1, 490, - -1 + -1, 173, -1, 175, -1, 179, -1, 196, -1, 211, + -1, 224, -1, 225, -1, 227, -1, 238, -1, 240, + -1, 274, -1, 283, -1, 305, -1, 307, -1, 328, + -1, 370, -1, 389, -1, 400, -1, 429, -1, 450, + -1, 461, -1, 478, -1, 38, -1, 43, -1, 47, + -1, 50, -1, 54, -1, 55, -1, 56, -1, 57, + -1, 58, -1, 60, -1, 73, -1, 72, -1, 80, + -1, 82, -1, 84, -1, 90, -1, 102, -1, 113, + -1, 116, -1, 154, -1, 161, -1, 167, -1, 173, + -1, 175, -1, 178, -1, 179, -1, 184, -1, 185, + -1, 196, -1, 211, -1, 212, -1, 219, -1, 221, + -1, 218, -1, 224, -1, 225, -1, 227, -1, 238, + -1, 240, -1, 250, -1, 273, -1, 274, -1, 275, + -1, 279, -1, 283, -1, 286, -1, 288, -1, 305, + -1, 304, -1, 307, -1, 308, -1, 327, -1, 328, + -1, 331, -1, 348, -1, 370, -1, 374, -1, 389, + -1, 396, -1, 400, -1, 403, -1, 420, -1, 422, + -1, 429, -1, 438, -1, 439, -1, 444, -1, 446, + -1, 450, -1, 461, -1, 473, -1, 474, -1, 478, + -1, 497, -1, 498, -1, 499, -1, 500, -1, 501, + -1, 502, -1, 503, -1, 504, -1, 505, -1, 506, + -1, 507, -1, 38, -1, 43, -1, 47, -1, 50, + -1, 56, -1, 60, -1, 82, -1, 84, -1, 90, + -1, 102, -1, 173, -1, 175, -1, 178, -1, 179, + -1, 196, -1, 211, -1, 224, -1, 225, -1, 227, + -1, 238, -1, 240, -1, 250, -1, 274, -1, 283, + -1, 305, -1, 307, -1, 328, -1, 370, -1, 389, + -1, 400, -1, 420, -1, 429, -1, 450, -1, 461, + -1, 478, -1, 31, -1, 35, -1, 36, -1, 37, + -1, 39, -1, 40, -1, 41, -1, 42, -1, 46, + -1, 59, -1, 66, -1, 67, -1, 75, -1, 81, + -1, 83, -1, 94, -1, 101, -1, 118, -1, 120, + -1, 127, -1, 128, -1, 133, -1, 134, -1, 140, + -1, 144, -1, 149, -1, 162, -1, 164, -1, 169, + -1, 171, -1, 174, -1, 183, -1, 188, -1, 201, + -1, 209, -1, 220, -1, 222, -1, 231, -1, 235, + -1, 236, -1, 241, -1, 280, -1, 285, -1, 292, + -1, 295, -1, 296, -1, 300, -1, 301, -1, 321, + -1, 322, -1, 323, -1, 324, -1, 335, -1, 342, + -1, 353, -1, 367, -1, 388, -1, 399, -1, 405, + -1, 423, -1, 424, -1, 427, -1, 436, -1, 440, + -1, 441, -1, 447, -1, 456, -1, 457, -1, 462, + -1, 467, -1, 476, -1, 486, -1, 487, -1, 489, + -1, 490, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ @@ -2714,129 +2714,129 @@ static const yytype_uint16 yyrline[] = 439, 440, 441, 446, 451, 452, 453, 454, 455, 456, 461, 481, 507, 515, 525, 526, 530, 534, 535, 536, 540, 544, 552, 553, 558, 559, 560, 564, 572, 573, - 578, 579, 583, 588, 592, 596, 601, 605, 612, 613, - 617, 618, 622, 623, 629, 640, 653, 667, 681, 695, - 709, 732, 736, 743, 747, 755, 760, 767, 777, 778, - 779, 780, 781, 788, 795, 796, 800, 801, 9, 19, - 29, 39, 49, 59, 73, 74, 75, 76, 77, 78, - 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, - 89, 90, 95, 96, 97, 98, 99, 100, 105, 106, - 111, 112, 113, 118, 119, 120, 7, 29, 30, 34, - 35, 39, 39, 43, 51, 58, 65, 71, 80, 87, - 95, 101, 111, 112, 116, 126, 127, 128, 132, 142, - 142, 146, 147, 7, 16, 25, 34, 43, 52, 64, - 74, 84, 88, 95, 99, 103, 113, 117, 124, 125, - 130, 134, 138, 145, 149, 156, 164, 172, 7, 1, - 30, 49, 61, 62, 63, 67, 68, 73, 77, 94, - 95, 99, 100, 105, 106, 110, 111, 115, 119, 124, - 125, 130, 134, 139, 143, 147, 151, 155, 159, 163, - 167, 171, 175, 179, 183, 187, 191, 195, 199, 211, - 212, 213, 214, 215, 216, 217, 47, 48, 52, 53, - 54, 72, 73, 80, 88, 96, 104, 112, 120, 131, - 132, 159, 164, 172, 188, 205, 223, 241, 242, 261, - 265, 269, 273, 277, 287, 298, 308, 317, 328, 339, - 351, 366, 384, 384, 388, 388, 392, 392, 396, 402, - 409, 413, 414, 418, 419, 433, 440, 447, 457, 458, - 461, 475, 476, 480, 481, 485, 486, 490, 491, 492, - 496, 507, 515, 520, 525, 530, 535, 543, 551, 556, - 561, 568, 569, 573, 574, 575, 579, 586, 587, 591, - 592, 596, 597, 598, 602, 603, 607, 608, 624, 625, - 628, 637, 648, 649, 650, 653, 654, 655, 659, 660, - 661, 662, 666, 667, 671, 673, 689, 691, 696, 699, - 704, 708, 712, 719, 723, 727, 731, 738, 743, 750, - 751, 755, 760, 764, 768, 776, 783, 784, 789, 790, - 795, 796, 800, 810, 811, 816, 817, 822, 824, 826, - 831, 851, 852, 854, 859, 860, 864, 865, 868, 869, - 894, 895, 900, 904, 905, 909, 910, 914, 915, 916, - 917, 918, 922, 935, 942, 949, 956, 957, 961, 962, - 966, 967, 971, 972, 976, 977, 981, 982, 986, 997, - 998, 999, 1000, 1004, 1005, 1010, 1011, 1012, 1021, 1027, - 1036, 1037, 1050, 1051, 1055, 1056, 1060, 1061, 1065, 1076, - 1083, 1090, 1098, 1106, 1116, 1124, 1133, 1142, 1151, 1155, - 1160, 1165, 1176, 1190, 1191, 1194, 1195, 1196, 1199, 1207, - 1217, 1218, 1219, 1222, 1230, 1239, 1243, 1250, 1251, 1255, - 1264, 1268, 1293, 1297, 1310, 1324, 1339, 1351, 1364, 1378, - 1392, 1405, 1420, 1439, 1445, 1450, 1456, 1463, 1464, 1472, - 1476, 1480, 1486, 1493, 1498, 1499, 1500, 1501, 1502, 1503, - 1507, 1508, 1520, 1521, 1526, 1533, 1540, 1547, 1579, 1590, - 1603, 1608, 1609, 1612, 1613, 1616, 1617, 1622, 1623, 1628, - 1632, 1638, 1659, 1667, 1681, 1684, 1688, 1688, 1691, 1692, - 1694, 1699, 1706, 1711, 1717, 1722, 1728, 1733, 1740, 1747, - 1757, 1758, 1762, 1764, 1767, 1771, 1772, 1773, 1774, 1775, - 1776, 1781, 1801, 1802, 1803, 1804, 1815, 1829, 1830, 1836, - 1841, 1846, 1851, 1856, 1861, 1866, 1871, 1877, 1883, 1889, - 1896, 1918, 1927, 1931, 1939, 1943, 1951, 1963, 1984, 1988, - 1994, 1998, 2011, 2019, 2029, 2031, 2033, 2035, 2037, 2039, - 2044, 2045, 2052, 2061, 2069, 2078, 2089, 2097, 2098, 2099, - 2103, 2103, 2106, 2106, 2109, 2109, 2112, 2112, 2115, 2115, - 2118, 2118, 2121, 2121, 2124, 2124, 2127, 2127, 2130, 2130, - 2133, 2133, 2136, 2136, 2139, 2139, 2142, 2144, 2146, 2148, - 2150, 2152, 2154, 2156, 2158, 2160, 2162, 2164, 2166, 2168, - 2173, 2178, 2184, 2191, 2196, 2202, 2208, 2239, 2241, 2243, - 2251, 2266, 2268, 2270, 2272, 2274, 2276, 2278, 2280, 2282, - 2284, 2286, 2288, 2290, 2292, 2294, 2296, 2299, 2301, 2303, - 2306, 2308, 2310, 2312, 2314, 2319, 2324, 2331, 2336, 2343, - 2348, 2355, 2360, 2368, 2376, 2384, 2392, 2410, 2418, 2426, - 2434, 2442, 2450, 2458, 2466, 2470, 2486, 2494, 2502, 2510, - 2518, 2526, 2534, 2538, 2542, 2546, 2550, 2558, 2566, 2574, - 2582, 2602, 2624, 2635, 2642, 2656, 2664, 2669, 2679, 2688, - 2709, 2711, 2713, 2715, 2717, 2719, 2721, 2723, 2725, 2727, - 2729, 2731, 2733, 2735, 2737, 2739, 2741, 2743, 2745, 2747, - 2749, 2751, 2755, 2759, 2763, 2777, 2778, 2792, 2793, 2794, - 2805, 2829, 2840, 2850, 2854, 2858, 2865, 2869, 2876, 2883, - 2884, 2885, 2886, 2887, 2888, 2889, 2890, 2901, 2906, 2915, - 2921, 2928, 2948, 2952, 2959, 2966, 2974, 2982, 2993, 3013, - 3049, 3060, 3061, 3068, 3074, 3076, 3078, 3082, 3091, 3096, - 3103, 3118, 3125, 3129, 3133, 3137, 3141, 3151, 3160, 3182, - 3183, 3187, 3188, 3189, 3193, 3194, 3201, 3202, 3206, 3207, - 3212, 3220, 3222, 3236, 3239, 3266, 3267, 3270, 3271, 3279, - 3287, 3295, 3304, 3314, 3332, 3378, 3387, 3396, 3405, 3414, - 3426, 3427, 3428, 3429, 3430, 3444, 3445, 3448, 3449, 3453, - 3463, 3464, 3468, 3469, 3473, 3480, 3481, 3486, 3487, 3492, - 3493, 3496, 3497, 3498, 3501, 3502, 3505, 3506, 3507, 3508, - 3509, 3510, 3511, 3512, 3513, 3514, 3515, 3516, 3517, 3518, - 3521, 3523, 3528, 3530, 3535, 3537, 3539, 3541, 3543, 3545, - 3547, 3549, 3563, 3565, 3570, 3574, 3581, 3586, 3592, 3596, - 3603, 3608, 3615, 3620, 3628, 3632, 3638, 3642, 3651, 3662, - 3663, 3667, 3671, 3678, 3679, 3680, 3681, 3682, 3683, 3684, - 3685, 3686, 3687, 3688, 3689, 3690, 3691, 3692, 3702, 3706, - 3713, 3720, 3721, 3737, 3741, 3746, 3750, 3765, 3770, 3774, - 3777, 3780, 3781, 3782, 3785, 3792, 3793, 3794, 3804, 3818, - 3819, 3823, 3834, 3835, 3838, 3839, 3847, 3853, 3857, 3864, - 3872, 3880, 3888, 3898, 3899, 3904, 3905, 3909, 3910, 3911, - 3915, 3924, 3932, 3940, 3949, 3964, 3965, 3970, 3971, 3981, - 3982, 3986, 3987, 3991, 3992, 3995, 4011, 4019, 4027, 4037, - 4038, 4042, 4046, 4052, 4054, 4059, 4060, 4064, 4065, 4068, - 4072, 4073, 4077, 4078, 4081, 4082, 4083, 4086, 4090, 4091, - 4095, 4096, 4098, 4099, 4100, 4110, 4111, 4115, 4117, 4123, - 4124, 4128, 4129, 4132, 4143, 4146, 4157, 4161, 4165, 4177, - 4181, 4190, 4197, 4235, 4239, 4243, 4247, 4251, 4255, 4259, - 4265, 4282, 4283, 4284, 4287, 4288, 4289, 4292, 4293, 4294, - 4297, 4298, 4301, 4303, 4308, 4309, 4312, 4316, 4317, 7, - 18, 19, 23, 24, 25, 26, 27, 28, 7, 26, - 50, 73, 80, 85, 86, 87, 88, 8, 33, 62, - 66, 67, 72, 73, 78, 79, 83, 84, 89, 90, - 7, 16, 25, 34, 43, 52, 5, 12, 22, 23, - 7, 15, 26, 27, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 7, 19, 33, 9, 16, 26, - 33, 44, 45, 50, 51, 52, 57, 58, 59, 60, - 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - 81, 82, 83, 84, 85, 86, 87, 88, 92, 93, - 94, 99, 100, 105, 109, 117, 118, 123, 124, 125, - 131, 136, 144, 145, 10, 16, 22, 28, 34, 44, - 45, 53, 64, 76, 84, 95, 101, 105, 109, 124, - 131, 132, 133, 137, 138, 7, 17, 26, 35, 46, - 47, 49, 50, 53, 54, 55, 8, 22, 36, 48, - 56, 70, 71, 72, 73, 74, 87, 88, 93, 94, - 98, 99, 7, 18, 31, 35, 42, 53, 54, 60, - 61, 9, 19, 7, 16, 25, 37, 44, 51, 60, - 61, 65, 66, 77, 78, 82, 89, 93, 100, 105, - 2, 7, 12, 17, 22, 31, 38, 48, 49, 56, - 3, 10, 17, 24, 32, 39, 46, 53, 60, 69, - 69, 71, 71, 73, 73, 75, 76, 6, 8, 21, - 34, 47, 65, 87, 88, 89, 90, 11, 24, 37, - 54, 55, 56, 61, 74, 74, 74, 74, 74, 74, + 578, 579, 583, 588, 592, 596, 601, 605, 609, 616, + 617, 621, 622, 626, 627, 633, 644, 657, 671, 685, + 699, 713, 736, 740, 747, 751, 759, 764, 771, 781, + 782, 783, 784, 785, 792, 799, 800, 804, 805, 9, + 19, 29, 39, 49, 59, 73, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 95, 96, 97, 98, 99, 100, 105, + 106, 111, 112, 113, 118, 119, 120, 7, 29, 30, + 34, 35, 39, 39, 43, 51, 58, 65, 71, 80, + 87, 95, 101, 111, 112, 116, 126, 127, 128, 132, + 142, 142, 146, 147, 7, 16, 25, 34, 43, 52, + 64, 74, 84, 88, 95, 99, 103, 113, 117, 124, + 125, 130, 134, 138, 145, 149, 156, 164, 172, 7, + 1, 30, 49, 61, 62, 63, 67, 68, 73, 77, + 94, 95, 99, 100, 105, 106, 110, 111, 115, 119, + 124, 125, 130, 134, 139, 143, 147, 151, 155, 159, + 163, 167, 171, 175, 179, 183, 187, 191, 195, 199, + 211, 212, 213, 214, 215, 216, 217, 47, 48, 52, + 53, 54, 72, 73, 80, 88, 96, 104, 112, 120, + 131, 132, 159, 164, 172, 188, 205, 223, 241, 242, + 261, 265, 269, 273, 277, 287, 298, 308, 317, 328, + 339, 351, 366, 384, 384, 388, 388, 392, 392, 396, + 402, 409, 413, 414, 418, 419, 433, 440, 447, 457, + 458, 461, 475, 476, 480, 481, 485, 486, 490, 491, + 492, 496, 507, 515, 520, 525, 530, 535, 543, 551, + 556, 561, 568, 569, 573, 574, 575, 579, 586, 587, + 591, 592, 596, 597, 598, 602, 603, 607, 608, 624, + 625, 628, 637, 648, 649, 650, 653, 654, 655, 659, + 660, 661, 662, 666, 667, 671, 673, 689, 691, 696, + 699, 704, 708, 712, 719, 723, 727, 731, 738, 743, + 750, 751, 755, 760, 764, 768, 776, 783, 784, 789, + 790, 795, 796, 800, 810, 811, 816, 817, 822, 824, + 826, 831, 851, 852, 854, 859, 860, 864, 865, 868, + 869, 894, 895, 900, 904, 905, 909, 910, 914, 915, + 916, 917, 918, 922, 935, 942, 949, 956, 957, 961, + 962, 966, 967, 971, 972, 976, 977, 981, 982, 986, + 997, 998, 999, 1000, 1004, 1005, 1010, 1011, 1012, 1021, + 1027, 1036, 1037, 1050, 1051, 1055, 1056, 1060, 1061, 1065, + 1076, 1083, 1090, 1098, 1106, 1116, 1124, 1133, 1142, 1151, + 1155, 1160, 1165, 1176, 1190, 1191, 1194, 1195, 1196, 1199, + 1207, 1217, 1218, 1219, 1222, 1230, 1239, 1243, 1250, 1251, + 1255, 1264, 1268, 1293, 1297, 1310, 1324, 1339, 1351, 1364, + 1378, 1392, 1405, 1420, 1439, 1445, 1450, 1456, 1463, 1464, + 1472, 1476, 1480, 1486, 1493, 1498, 1499, 1500, 1501, 1502, + 1503, 1507, 1508, 1520, 1521, 1526, 1533, 1540, 1547, 1579, + 1590, 1603, 1608, 1609, 1612, 1613, 1616, 1617, 1622, 1623, + 1628, 1632, 1638, 1659, 1667, 1681, 1684, 1688, 1688, 1691, + 1692, 1694, 1699, 1706, 1711, 1717, 1722, 1728, 1733, 1740, + 1747, 1757, 1758, 1762, 1764, 1767, 1771, 1772, 1773, 1774, + 1775, 1776, 1781, 1801, 1802, 1803, 1804, 1815, 1829, 1830, + 1836, 1841, 1846, 1851, 1856, 1861, 1866, 1871, 1877, 1883, + 1889, 1896, 1918, 1927, 1931, 1939, 1943, 1951, 1963, 1984, + 1988, 1994, 1998, 2011, 2019, 2029, 2031, 2033, 2035, 2037, + 2039, 2044, 2045, 2052, 2061, 2069, 2078, 2089, 2097, 2098, + 2099, 2103, 2103, 2106, 2106, 2109, 2109, 2112, 2112, 2115, + 2115, 2118, 2118, 2121, 2121, 2124, 2124, 2127, 2127, 2130, + 2130, 2133, 2133, 2136, 2136, 2139, 2139, 2142, 2144, 2146, + 2148, 2150, 2152, 2154, 2156, 2158, 2160, 2162, 2164, 2166, + 2168, 2173, 2178, 2184, 2191, 2196, 2202, 2208, 2239, 2241, + 2243, 2251, 2266, 2268, 2270, 2272, 2274, 2276, 2278, 2280, + 2282, 2284, 2286, 2288, 2290, 2292, 2294, 2296, 2299, 2301, + 2303, 2306, 2308, 2310, 2312, 2314, 2319, 2324, 2331, 2336, + 2343, 2348, 2355, 2360, 2368, 2376, 2384, 2392, 2410, 2418, + 2426, 2434, 2442, 2450, 2458, 2466, 2470, 2486, 2494, 2502, + 2510, 2518, 2526, 2534, 2538, 2542, 2546, 2550, 2558, 2566, + 2574, 2582, 2602, 2624, 2635, 2642, 2656, 2664, 2669, 2679, + 2688, 2709, 2711, 2713, 2715, 2717, 2719, 2721, 2723, 2725, + 2727, 2729, 2731, 2733, 2735, 2737, 2739, 2741, 2743, 2745, + 2747, 2749, 2751, 2755, 2759, 2763, 2777, 2778, 2792, 2793, + 2794, 2805, 2829, 2840, 2850, 2854, 2858, 2865, 2869, 2876, + 2883, 2884, 2885, 2886, 2887, 2888, 2889, 2890, 2901, 2906, + 2915, 2921, 2928, 2948, 2952, 2959, 2966, 2974, 2982, 2993, + 3013, 3049, 3060, 3061, 3068, 3074, 3076, 3078, 3082, 3091, + 3096, 3103, 3118, 3125, 3129, 3133, 3137, 3141, 3151, 3160, + 3220, 3221, 3225, 3226, 3227, 3231, 3232, 3239, 3240, 3244, + 3245, 3250, 3258, 3260, 3274, 3277, 3304, 3305, 3308, 3309, + 3317, 3325, 3333, 3342, 3352, 3370, 3416, 3425, 3434, 3443, + 3452, 3464, 3465, 3466, 3467, 3468, 3482, 3483, 3486, 3487, + 3491, 3501, 3502, 3506, 3507, 3511, 3518, 3519, 3524, 3525, + 3530, 3531, 3534, 3535, 3536, 3539, 3540, 3543, 3544, 3545, + 3546, 3547, 3548, 3549, 3550, 3551, 3552, 3553, 3554, 3555, + 3556, 3559, 3561, 3566, 3568, 3573, 3575, 3577, 3579, 3581, + 3583, 3585, 3587, 3601, 3603, 3608, 3612, 3619, 3624, 3630, + 3634, 3641, 3646, 3653, 3658, 3666, 3670, 3676, 3680, 3689, + 3700, 3701, 3705, 3709, 3716, 3717, 3718, 3719, 3720, 3721, + 3722, 3723, 3724, 3725, 3726, 3727, 3728, 3729, 3730, 3740, + 3744, 3751, 3758, 3759, 3775, 3779, 3784, 3788, 3803, 3808, + 3812, 3815, 3818, 3819, 3820, 3823, 3830, 3831, 3832, 3842, + 3856, 3857, 3861, 3872, 3873, 3876, 3877, 3885, 3891, 3895, + 3902, 3910, 3918, 3926, 3936, 3937, 3942, 3943, 3947, 3948, + 3949, 3953, 3962, 3970, 3978, 3987, 4002, 4003, 4008, 4009, + 4019, 4020, 4024, 4025, 4029, 4030, 4033, 4049, 4057, 4065, + 4075, 4076, 4080, 4084, 4090, 4092, 4097, 4098, 4102, 4103, + 4106, 4110, 4111, 4115, 4116, 4119, 4120, 4121, 4124, 4128, + 4129, 4133, 4134, 4136, 4137, 4138, 4148, 4149, 4153, 4155, + 4161, 4162, 4166, 4167, 4170, 4181, 4184, 4195, 4199, 4203, + 4215, 4219, 4228, 4235, 4273, 4277, 4281, 4285, 4289, 4293, + 4297, 4303, 4320, 4321, 4322, 4325, 4326, 4327, 4330, 4331, + 4332, 4335, 4336, 4339, 4341, 4346, 4347, 4350, 4354, 4355, + 7, 18, 19, 23, 24, 25, 26, 27, 28, 7, + 26, 50, 73, 80, 85, 86, 87, 88, 8, 33, + 62, 66, 67, 72, 73, 78, 79, 83, 84, 89, + 90, 7, 16, 25, 34, 43, 52, 5, 12, 22, + 23, 7, 15, 26, 27, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 7, 19, 33, 9, 16, + 26, 33, 44, 45, 50, 51, 52, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 92, + 93, 94, 99, 100, 105, 109, 117, 118, 123, 124, + 125, 131, 136, 144, 145, 10, 16, 22, 28, 34, + 44, 45, 53, 64, 76, 84, 95, 101, 105, 109, + 124, 131, 132, 133, 137, 138, 7, 17, 26, 35, + 46, 47, 49, 50, 53, 54, 55, 8, 22, 36, + 48, 56, 70, 71, 72, 73, 74, 87, 88, 93, + 94, 98, 99, 7, 18, 31, 35, 42, 53, 54, + 60, 61, 9, 19, 7, 16, 25, 37, 44, 51, + 60, 61, 65, 66, 77, 78, 82, 89, 93, 100, + 105, 2, 7, 12, 17, 22, 31, 38, 48, 49, + 56, 3, 10, 17, 24, 32, 39, 46, 53, 60, + 69, 69, 71, 71, 73, 73, 75, 76, 6, 8, + 21, 34, 47, 65, 87, 88, 89, 90, 11, 24, + 37, 54, 55, 56, 61, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, @@ -2869,18 +2869,18 @@ static const yytype_uint16 yyrline[] = 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, - 74, 74, 74, 74, 75, 75, 75, 75, 75, 75, + 74, 74, 74, 74, 74, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, - 75, 75, 75, 75, 75, 75, 75, 75, 76, 76, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, - 76, 76, 76, 76, 76, 76, 76, 77, 77, 77, + 76, 76, 76, 76, 76, 76, 76, 76, 77, 77, + 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 77, 77, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, @@ -2889,10 +2889,10 @@ static const yytype_uint16 yyrline[] = 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, - 78, 78, 78, 79, 79, 79, 79, 79, 79, 79, + 78, 78, 78, 78, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 80, 80, + 79, 79, 79, 79, 79, 79, 79, 79, 79, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, @@ -2900,7 +2900,7 @@ static const yytype_uint16 yyrline[] = 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80 + 80, 80, 80, 80 }; #endif @@ -3250,65 +3250,65 @@ static const yytype_uint16 yyr1[] = 648, 648, 648, 649, 650, 650, 650, 650, 650, 650, 651, 652, 653, 653, 654, 654, 655, 656, 656, 656, 657, 657, 658, 658, 659, 659, 659, 660, 661, 661, - 662, 662, 663, 664, 664, 664, 664, 664, 665, 665, - 666, 666, 667, 667, 667, 668, 668, 668, 668, 668, - 668, 669, 669, 670, 670, 670, 670, 671, 672, 672, - 672, 672, 672, 672, 672, 672, 673, 673, 674, 674, - 674, 674, 674, 674, 675, 675, 675, 675, 675, 675, + 662, 662, 663, 664, 664, 664, 664, 664, 664, 665, + 665, 666, 666, 667, 667, 667, 668, 668, 668, 668, + 668, 668, 669, 669, 670, 670, 670, 670, 671, 672, + 672, 672, 672, 672, 672, 672, 672, 673, 673, 674, + 674, 674, 674, 674, 674, 675, 675, 675, 675, 675, 675, 675, 675, 675, 675, 675, 675, 675, 675, 675, - 675, 675, 676, 676, 676, 676, 676, 676, 677, 677, - 678, 678, 678, 679, 679, 679, 680, 681, 681, 682, - 682, 683, 683, 684, 684, 684, 684, 684, 684, 684, - 684, 684, 685, 685, 686, 687, 687, 687, 688, 689, - 689, 690, 690, 691, 691, 691, 691, 691, 691, 692, - 693, 694, 694, 695, 695, 696, 697, 697, 698, 698, - 699, 699, 699, 700, 700, 701, 701, 701, 702, 703, - 703, 703, 704, 704, 704, 705, 705, 706, 706, 707, - 707, 708, 708, 709, 709, 710, 710, 711, 711, 712, - 712, 713, 713, 714, 714, 714, 714, 714, 714, 714, - 714, 714, 714, 714, 714, 714, 714, 714, 714, 715, - 715, 715, 715, 715, 715, 715, 716, 716, 717, 717, - 717, 718, 718, 718, 718, 718, 718, 718, 718, 719, - 719, 720, 720, 721, 721, 721, 721, 721, 721, 721, + 675, 675, 675, 676, 676, 676, 676, 676, 676, 677, + 677, 678, 678, 678, 679, 679, 679, 680, 681, 681, + 682, 682, 683, 683, 684, 684, 684, 684, 684, 684, + 684, 684, 684, 685, 685, 686, 687, 687, 687, 688, + 689, 689, 690, 690, 691, 691, 691, 691, 691, 691, + 692, 693, 694, 694, 695, 695, 696, 697, 697, 698, + 698, 699, 699, 699, 700, 700, 701, 701, 701, 702, + 703, 703, 703, 704, 704, 704, 705, 705, 706, 706, + 707, 707, 708, 708, 709, 709, 710, 710, 711, 711, + 712, 712, 713, 713, 714, 714, 714, 714, 714, 714, + 714, 714, 714, 714, 714, 714, 714, 714, 714, 714, + 715, 715, 715, 715, 715, 715, 715, 716, 716, 717, + 717, 717, 718, 718, 718, 718, 718, 718, 718, 718, + 719, 719, 720, 720, 721, 721, 721, 721, 721, 721, 721, 721, 721, 721, 721, 721, 721, 721, 721, 721, - 721, 721, 722, 722, 723, 723, 724, 724, 725, 725, - 725, 726, 726, 727, 727, 728, 728, 728, 729, 729, - 730, 731, 731, 732, 732, 733, 733, 734, 734, 734, - 735, 735, 736, 736, 736, 736, 736, 736, 736, 736, - 736, 737, 737, 738, 738, 738, 739, 740, 740, 741, - 741, 742, 742, 742, 743, 743, 744, 744, 745, 745, - 746, 746, 747, 747, 747, 748, 748, 748, 749, 749, - 749, 749, 750, 750, 751, 751, 751, 751, 752, 752, - 753, 753, 753, 754, 754, 754, 754, 755, 755, 756, - 756, 757, 757, 757, 757, 758, 759, 759, 760, 760, - 761, 761, 762, 763, 763, 764, 764, 764, 764, 764, - 765, 766, 766, 766, 767, 767, 768, 768, 769, 769, - 770, 770, 770, 771, 771, 772, 772, 773, 773, 773, - 773, 773, 774, 775, 776, 777, 778, 778, 779, 779, - 780, 780, 781, 781, 782, 782, 783, 783, 784, 785, - 785, 785, 785, 786, 786, 787, 787, 787, 788, 788, - 789, 789, 790, 790, 791, 791, 792, 792, 793, 794, + 721, 721, 721, 722, 722, 723, 723, 724, 724, 725, + 725, 725, 726, 726, 727, 727, 728, 728, 728, 729, + 729, 730, 731, 731, 732, 732, 733, 733, 734, 734, + 734, 735, 735, 736, 736, 736, 736, 736, 736, 736, + 736, 736, 737, 737, 738, 738, 738, 739, 740, 740, + 741, 741, 742, 742, 742, 743, 743, 744, 744, 745, + 745, 746, 746, 747, 747, 747, 748, 748, 748, 749, + 749, 749, 749, 750, 750, 751, 751, 751, 751, 752, + 752, 753, 753, 753, 754, 754, 754, 754, 755, 755, + 756, 756, 757, 757, 757, 757, 758, 759, 759, 760, + 760, 761, 761, 762, 763, 763, 764, 764, 764, 764, + 764, 765, 766, 766, 766, 767, 767, 768, 768, 769, + 769, 770, 770, 770, 771, 771, 772, 772, 773, 773, + 773, 773, 773, 774, 775, 776, 777, 778, 778, 779, + 779, 780, 780, 781, 781, 782, 782, 783, 783, 784, + 785, 785, 785, 785, 786, 786, 787, 787, 787, 788, + 788, 789, 789, 790, 790, 791, 791, 792, 792, 793, 794, 794, 794, 794, 794, 794, 794, 794, 794, 794, - 794, 794, 794, 795, 795, 796, 796, 796, 797, 797, - 798, 798, 798, 799, 799, 800, 800, 801, 801, 802, - 803, 803, 804, 804, 804, 804, 804, 804, 804, 804, - 804, 804, 804, 805, 805, 805, 805, 806, 806, 807, - 807, 807, 807, 807, 808, 808, 808, 808, 808, 808, - 809, 809, 810, 810, 811, 811, 811, 811, 812, 812, - 813, 814, 814, 815, 815, 816, 816, 817, 817, 818, - 818, 819, 820, 820, 821, 821, 822, 822, 823, 823, - 824, 824, 824, 824, 824, 824, 824, 824, 824, 824, - 825, 825, 826, 826, 826, 827, 827, 827, 827, 827, - 827, 827, 828, 828, 828, 828, 829, 830, 830, 831, + 794, 794, 794, 794, 795, 795, 796, 796, 796, 797, + 797, 798, 798, 798, 799, 799, 800, 800, 801, 801, + 802, 803, 803, 804, 804, 804, 804, 804, 804, 804, + 804, 804, 804, 804, 805, 805, 805, 805, 806, 806, + 807, 807, 807, 807, 807, 808, 808, 808, 808, 808, + 808, 809, 809, 810, 810, 811, 811, 811, 811, 812, + 812, 813, 814, 814, 815, 815, 816, 816, 817, 817, + 818, 818, 819, 820, 820, 821, 821, 822, 822, 823, + 823, 824, 824, 824, 824, 824, 824, 824, 824, 824, + 824, 825, 825, 826, 826, 826, 827, 827, 827, 827, + 827, 827, 827, 828, 828, 828, 828, 829, 830, 830, 831, 831, 831, 831, 831, 831, 831, 831, 831, 831, - 832, 832, 833, 833, 834, 834, 835, 836, 837, 837, - 838, 838, 839, 840, 841, 841, 841, 841, 841, 841, - 842, 842, 843, 843, 843, 843, 844, 845, 845, 845, - 846, 846, 847, 847, 848, 848, 849, 849, 850, 850, - 851, 851, 852, 852, 853, 853, 854, 854, 855, 855, - 856, 856, 857, 857, 858, 858, 859, 859, 859, 859, + 831, 832, 832, 833, 833, 834, 834, 835, 836, 837, + 837, 838, 838, 839, 840, 841, 841, 841, 841, 841, + 841, 842, 842, 843, 843, 843, 843, 844, 845, 845, + 845, 846, 846, 847, 847, 848, 848, 849, 849, 850, + 850, 851, 851, 852, 852, 853, 853, 854, 854, 855, + 855, 856, 856, 857, 857, 858, 858, 859, 859, 859, 859, 859, 859, 859, 859, 859, 859, 859, 859, 859, - 859, 859, 859, 859, 859, 859, 859, 860, 860, 860, + 859, 859, 859, 859, 859, 859, 859, 859, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, @@ -3316,63 +3316,63 @@ static const yytype_uint16 yyr1[] = 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, 860, + 860, 861, 861, 861, 861, 861, 861, 861, 861, 861, 861, 861, 861, 861, 861, 861, 861, 861, 861, 861, - 861, 861, 861, 861, 861, 861, 861, 861, 861, 861, - 861, 861, 861, 861, 861, 862, 862, 863, 863, 863, - 863, 863, 863, 864, 864, 864, 865, 865, 865, 866, - 866, 866, 866, 866, 866, 866, 866, 866, 866, 867, - 868, 869, 870, 870, 870, 870, 870, 870, 870, 871, - 871, 872, 872, 873, 873, 873, 873, 873, 873, 873, - 873, 873, 873, 873, 873, 873, 873, 874, 874, 875, - 875, 876, 876, 876, 877, 877, 878, 878, 879, 879, - 880, 881, 881, 881, 882, 883, 883, 884, 884, 885, - 885, 885, 885, 886, 886, 887, 887, 887, 887, 887, - 888, 888, 888, 888, 888, 889, 889, 890, 890, 891, - 892, 892, 893, 893, 894, 895, 895, 896, 896, 897, - 897, 898, 898, 898, 899, 899, 900, 900, 900, 900, + 861, 861, 861, 861, 861, 861, 862, 862, 863, 863, + 863, 863, 863, 863, 864, 864, 864, 865, 865, 865, + 866, 866, 866, 866, 866, 866, 866, 866, 866, 866, + 867, 868, 869, 870, 870, 870, 870, 870, 870, 870, + 871, 871, 872, 872, 873, 873, 873, 873, 873, 873, + 873, 873, 873, 873, 873, 873, 873, 873, 874, 874, + 875, 875, 876, 876, 876, 877, 877, 878, 878, 879, + 879, 880, 881, 881, 881, 882, 883, 883, 884, 884, + 885, 885, 885, 885, 886, 886, 887, 887, 887, 887, + 887, 888, 888, 888, 888, 888, 889, 889, 890, 890, + 891, 892, 892, 893, 893, 894, 895, 895, 896, 896, + 897, 897, 898, 898, 898, 899, 899, 900, 900, 900, 900, 900, 900, 900, 900, 900, 900, 900, 900, 900, - 901, 901, 902, 902, 903, 903, 903, 903, 903, 903, - 903, 903, 904, 904, 905, 905, 906, 906, 907, 907, - 908, 908, 909, 909, 910, 910, 911, 911, 911, 912, - 912, 913, 913, 914, 914, 914, 914, 914, 914, 914, - 914, 914, 914, 914, 914, 914, 914, 914, 915, 915, - 916, 917, 917, 918, 918, 918, 918, 918, 918, 919, - 920, 921, 921, 921, 922, 922, 922, 922, 923, 924, - 924, 925, 926, 926, 927, 927, 928, 929, 929, 563, - 563, 563, 563, 930, 930, 931, 931, 932, 932, 932, - 933, 933, 933, 933, 933, 934, 934, 935, 935, 936, - 936, 937, 937, 938, 938, 939, 939, 939, 939, 940, - 940, 941, 941, 942, 942, 943, 943, 944, 944, 945, - 946, 946, 947, 947, 948, 948, 948, 949, 950, 950, - 951, 951, 952, 952, 952, 953, 953, 954, 954, 955, - 955, 956, 956, 957, 958, 958, 959, 959, 959, 959, + 900, 901, 901, 902, 902, 903, 903, 903, 903, 903, + 903, 903, 903, 904, 904, 905, 905, 906, 906, 907, + 907, 908, 908, 909, 909, 910, 910, 911, 911, 911, + 912, 912, 913, 913, 914, 914, 914, 914, 914, 914, + 914, 914, 914, 914, 914, 914, 914, 914, 914, 915, + 915, 916, 917, 917, 918, 918, 918, 918, 918, 918, + 919, 920, 921, 921, 921, 922, 922, 922, 922, 923, + 924, 924, 925, 926, 926, 927, 927, 928, 929, 929, + 563, 563, 563, 563, 930, 930, 931, 931, 932, 932, + 932, 933, 933, 933, 933, 933, 934, 934, 935, 935, + 936, 936, 937, 937, 938, 938, 939, 939, 939, 939, + 940, 940, 941, 941, 942, 942, 943, 943, 944, 944, + 945, 946, 946, 947, 947, 948, 948, 948, 949, 950, + 950, 951, 951, 952, 952, 952, 953, 953, 954, 954, + 955, 955, 956, 956, 957, 958, 958, 959, 959, 959, 959, 959, 959, 959, 959, 959, 959, 959, 959, 959, - 960, 961, 961, 961, 962, 962, 962, 963, 963, 963, - 964, 964, 965, 965, 966, 966, 967, 968, 968, 969, - 970, 970, 971, 971, 971, 971, 971, 971, 972, 972, - 972, 973, 973, 974, 974, 974, 974, 975, 975, 976, - 977, 977, 978, 978, 979, 979, 980, 980, 981, 981, - 982, 982, 982, 982, 982, 982, 983, 983, 984, 984, - 985, 985, 986, 986, 987, 987, 987, 987, 987, 987, - 987, 987, 987, 987, 988, 988, 989, 990, 990, 990, - 990, 991, 991, 992, 992, 992, 993, 993, 993, 993, + 959, 960, 961, 961, 961, 962, 962, 962, 963, 963, + 963, 964, 964, 965, 965, 966, 966, 967, 968, 968, + 969, 970, 970, 971, 971, 971, 971, 971, 971, 972, + 972, 972, 973, 973, 974, 974, 974, 974, 975, 975, + 976, 977, 977, 978, 978, 979, 979, 980, 980, 981, + 981, 982, 982, 982, 982, 982, 982, 983, 983, 984, + 984, 985, 985, 986, 986, 987, 987, 987, 987, 987, + 987, 987, 987, 987, 987, 988, 988, 989, 990, 990, + 990, 990, 991, 991, 992, 992, 992, 993, 993, 993, 993, 993, 993, 993, 993, 993, 993, 993, 993, 993, 993, 993, 993, 993, 993, 993, 993, 993, 993, 993, - 993, 993, 993, 993, 993, 993, 993, 993, 994, 994, - 994, 995, 995, 996, 996, 997, 997, 998, 998, 998, - 998, 999, 1000, 1000, 1001, 1001, 1001, 1001, 1001, 1002, - 1002, 1002, 1002, 1003, 1003, 1004, 1005, 1005, 1005, 1005, - 1005, 1005, 1005, 1006, 1006, 1007, 1007, 1007, 1007, 1008, - 1008, 1009, 1009, 1010, 1010, 1010, 1011, 1011, 1011, 1011, - 1011, 1012, 1012, 1012, 1012, 1012, 1013, 1013, 1014, 1014, - 1015, 1015, 1016, 1016, 1017, 1017, 1017, 1018, 1018, 1019, - 1019, 1020, 1020, 1021, 1021, 1021, 1022, 1022, 1022, 1023, - 1023, 1024, 1024, 1025, 1025, 1026, 1027, 1027, 1028, 1028, - 1029, 1029, 1029, 1029, 1029, 1030, 1030, 1031, 1031, 1031, - 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1033, - 1033, 1034, 1034, 1035, 1035, 1036, 1036, 1037, 1038, 1038, - 1038, 1038, 1038, 1039, 1039, 1039, 1039, 1040, 1040, 1040, - 1041, 1041, 1041, 1042, 1043, 1043, 1043, 1043, 1043, 1043, + 993, 993, 993, 993, 993, 993, 993, 993, 993, 994, + 994, 994, 995, 995, 996, 996, 997, 997, 998, 998, + 998, 998, 999, 1000, 1000, 1001, 1001, 1001, 1001, 1001, + 1002, 1002, 1002, 1002, 1003, 1003, 1004, 1005, 1005, 1005, + 1005, 1005, 1005, 1005, 1006, 1006, 1007, 1007, 1007, 1007, + 1008, 1008, 1009, 1009, 1010, 1010, 1010, 1011, 1011, 1011, + 1011, 1011, 1012, 1012, 1012, 1012, 1012, 1013, 1013, 1014, + 1014, 1015, 1015, 1016, 1016, 1017, 1017, 1017, 1018, 1018, + 1019, 1019, 1020, 1020, 1021, 1021, 1021, 1022, 1022, 1022, + 1023, 1023, 1024, 1024, 1025, 1025, 1026, 1027, 1027, 1028, + 1028, 1029, 1029, 1029, 1029, 1029, 1030, 1030, 1031, 1031, + 1031, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, 1032, + 1033, 1033, 1034, 1034, 1035, 1035, 1036, 1036, 1037, 1038, + 1038, 1038, 1038, 1038, 1039, 1039, 1039, 1039, 1040, 1040, + 1040, 1041, 1041, 1041, 1042, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, @@ -3405,18 +3405,18 @@ static const yytype_uint16 yyr1[] = 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, - 1043, 1043, 1043, 1043, 1044, 1044, 1044, 1044, 1044, 1044, + 1043, 1043, 1043, 1043, 1043, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, - 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1045, 1045, + 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, - 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1046, 1046, 1046, + 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1045, 1046, 1046, + 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, - 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, @@ -3425,10 +3425,10 @@ static const yytype_uint16 yyr1[] = 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, - 1047, 1047, 1047, 1048, 1048, 1048, 1048, 1048, 1048, 1048, + 1047, 1047, 1047, 1047, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, - 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1049, 1049, + 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, @@ -3436,7 +3436,7 @@ static const yytype_uint16 yyr1[] = 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, 1049, - 1049, 1049, 1049 + 1049, 1049, 1049, 1049 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -3482,129 +3482,129 @@ static const yytype_uint8 yyr2[] = 3, 3, 0, 1, 2, 1, 2, 2, 2, 2, 2, 3, 2, 2, 1, 3, 1, 1, 1, 1, 3, 1, 2, 0, 1, 2, 0, 1, 3, 0, - 2, 0, 3, 3, 1, 5, 3, 3, 1, 3, - 1, 2, 1, 4, 5, 5, 6, 3, 7, 4, - 11, 1, 3, 2, 2, 2, 0, 3, 1, 1, - 2, 2, 2, 2, 1, 0, 1, 2, 6, 4, - 6, 4, 6, 8, 1, 1, 1, 1, 2, 1, - 2, 1, 2, 1, 1, 1, 1, 3, 3, 3, - 3, 1, 2, 2, 1, 3, 1, 1, 1, 3, - 1, 1, 0, 1, 1, 1, 9, 2, 0, 3, - 0, 1, 0, 3, 3, 2, 1, 6, 3, 3, - 2, 2, 1, 0, 5, 2, 2, 0, 7, 1, - 1, 1, 2, 5, 8, 7, 5, 8, 7, 4, - 4, 1, 3, 1, 1, 3, 1, 3, 1, 1, - 2, 4, 3, 1, 3, 2, 4, 4, 8, 11, - 9, 7, 0, 3, 3, 1, 1, 3, 0, 1, - 0, 1, 0, 1, 0, 1, 3, 2, 0, 2, - 0, 1, 0, 1, 1, 1, 3, 3, 1, 1, - 3, 3, 3, 3, 3, 3, 4, 3, 2, 1, - 1, 1, 3, 1, 3, 1, 1, 1, 3, 3, - 3, 1, 2, 4, 4, 2, 3, 5, 5, 1, - 1, 3, 0, 11, 11, 10, 12, 1, 2, 5, - 4, 4, 4, 4, 7, 5, 4, 7, 6, 9, - 9, 4, 1, 1, 1, 1, 1, 1, 1, 5, - 1, 1, 3, 1, 2, 2, 2, 3, 1, 3, - 8, 5, 0, 1, 2, 1, 3, 1, 2, 0, - 2, 0, 3, 3, 4, 4, 4, 4, 3, 2, - 1, 1, 0, 1, 1, 0, 2, 1, 5, 1, - 0, 2, 2, 0, 1, 0, 3, 5, 1, 3, - 4, 3, 1, 1, 0, 2, 2, 0, 2, 2, - 1, 1, 1, 0, 2, 4, 5, 4, 2, 3, - 1, 1, 1, 2, 2, 1, 2, 3, 0, 1, - 0, 5, 1, 4, 6, 2, 1, 0, 4, 0, - 1, 1, 3, 4, 0, 1, 1, 2, 2, 2, - 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, - 3, 3, 0, 1, 3, 1, 2, 1, 1, 1, - 1, 1, 2, 4, 4, 5, 1, 1, 2, 0, - 2, 0, 1, 3, 1, 0, 1, 2, 3, 2, - 4, 2, 3, 2, 0, 1, 2, 0, 4, 5, - 1, 2, 2, 0, 1, 3, 1, 2, 2, 4, - 4, 3, 3, 3, 3, 3, 3, 3, 1, 4, - 4, 9, 9, 3, 0, 2, 2, 0, 5, 3, - 1, 1, 3, 5, 3, 1, 2, 1, 3, 5, - 1, 2, 3, 4, 5, 4, 5, 4, 6, 5, - 4, 5, 5, 5, 2, 4, 1, 1, 0, 1, - 4, 5, 4, 0, 2, 2, 2, 1, 1, 1, - 1, 0, 4, 2, 1, 2, 2, 4, 2, 6, - 2, 1, 3, 4, 0, 2, 0, 2, 0, 1, - 3, 3, 2, 0, 2, 4, 1, 1, 1, 0, - 2, 3, 5, 6, 2, 3, 2, 5, 5, 5, - 3, 3, 3, 4, 0, 1, 1, 1, 1, 1, - 2, 4, 1, 1, 1, 1, 2, 3, 0, 1, - 1, 1, 1, 1, 2, 2, 2, 2, 2, 1, - 3, 0, 1, 1, 1, 1, 5, 2, 1, 1, - 1, 1, 4, 1, 2, 2, 1, 3, 3, 2, - 1, 0, 5, 2, 5, 2, 1, 3, 3, 0, + 2, 0, 3, 3, 1, 5, 3, 3, 1, 1, + 3, 1, 2, 1, 4, 5, 5, 6, 3, 7, + 4, 11, 1, 3, 2, 2, 2, 0, 3, 1, + 1, 2, 2, 2, 2, 1, 0, 1, 2, 6, + 4, 6, 4, 6, 8, 1, 1, 1, 1, 2, + 1, 2, 1, 2, 1, 1, 1, 1, 3, 3, + 3, 3, 1, 2, 2, 1, 3, 1, 1, 1, + 3, 1, 1, 0, 1, 1, 1, 9, 2, 0, + 3, 0, 1, 0, 3, 3, 2, 1, 6, 3, + 3, 2, 2, 1, 0, 5, 2, 2, 0, 7, + 1, 1, 1, 2, 5, 8, 7, 5, 8, 7, + 4, 4, 1, 3, 1, 1, 3, 1, 3, 1, + 1, 2, 4, 3, 1, 3, 2, 4, 4, 8, + 11, 9, 7, 0, 3, 3, 1, 1, 3, 0, + 1, 0, 1, 0, 1, 0, 1, 3, 2, 0, + 2, 0, 1, 0, 1, 1, 1, 3, 3, 1, + 1, 3, 3, 3, 3, 3, 3, 4, 3, 2, + 1, 1, 1, 3, 1, 3, 1, 1, 1, 3, + 3, 3, 1, 2, 4, 4, 2, 3, 5, 5, + 1, 1, 3, 0, 11, 11, 10, 12, 1, 2, + 5, 4, 4, 4, 4, 7, 5, 4, 7, 6, + 9, 9, 4, 1, 1, 1, 1, 1, 1, 1, + 5, 1, 1, 3, 1, 2, 2, 2, 3, 1, + 3, 8, 5, 0, 1, 2, 1, 3, 1, 2, + 0, 2, 0, 3, 3, 4, 4, 4, 4, 3, + 2, 1, 1, 0, 1, 1, 0, 2, 1, 5, + 1, 0, 2, 2, 0, 1, 0, 3, 5, 1, + 3, 4, 3, 1, 1, 0, 2, 2, 0, 2, + 2, 1, 1, 1, 0, 2, 4, 5, 4, 2, + 3, 1, 1, 1, 2, 2, 1, 2, 3, 0, + 1, 0, 5, 1, 4, 6, 2, 1, 0, 4, + 0, 1, 1, 3, 4, 0, 1, 1, 2, 2, + 2, 1, 1, 2, 2, 1, 1, 1, 1, 1, + 1, 3, 3, 0, 1, 3, 1, 2, 1, 1, + 1, 1, 1, 2, 4, 4, 5, 1, 1, 2, + 0, 2, 0, 1, 3, 1, 0, 1, 2, 3, + 2, 4, 2, 3, 2, 0, 1, 2, 0, 4, + 5, 1, 2, 2, 0, 1, 3, 1, 2, 2, + 4, 4, 3, 3, 3, 3, 3, 3, 3, 1, + 4, 4, 9, 9, 3, 0, 2, 2, 0, 5, + 3, 1, 1, 3, 5, 3, 1, 2, 1, 3, + 5, 1, 2, 3, 4, 5, 4, 5, 4, 6, + 5, 4, 5, 5, 5, 2, 4, 1, 1, 0, + 1, 4, 5, 4, 0, 2, 2, 2, 1, 1, + 1, 1, 0, 4, 2, 1, 2, 2, 4, 2, + 6, 2, 1, 3, 4, 0, 2, 0, 2, 0, + 1, 3, 3, 2, 0, 2, 4, 1, 1, 1, + 0, 2, 3, 5, 6, 2, 3, 2, 5, 5, + 5, 3, 3, 3, 4, 0, 1, 1, 1, 1, + 1, 2, 4, 1, 1, 1, 1, 2, 3, 0, + 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, + 1, 3, 0, 1, 1, 1, 1, 5, 2, 1, + 1, 1, 1, 4, 1, 2, 2, 1, 3, 3, + 2, 1, 0, 5, 2, 5, 2, 1, 3, 3, + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, - 3, 3, 3, 3, 3, 3, 0, 1, 3, 3, - 5, 2, 2, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, - 3, 3, 2, 2, 3, 3, 5, 4, 6, 3, - 5, 4, 6, 4, 6, 5, 7, 3, 2, 4, - 3, 2, 4, 3, 3, 3, 3, 4, 3, 4, - 3, 4, 5, 6, 6, 7, 6, 7, 6, 7, - 3, 4, 4, 6, 1, 4, 4, 5, 4, 6, - 1, 3, 2, 2, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 0, 1, 3, + 3, 5, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, - 2, 5, 6, 6, 7, 1, 2, 1, 1, 1, - 2, 2, 4, 3, 1, 1, 1, 1, 2, 1, - 1, 1, 1, 1, 1, 1, 2, 4, 2, 3, - 3, 4, 3, 5, 6, 7, 9, 7, 7, 5, - 1, 1, 1, 5, 6, 6, 4, 4, 4, 4, - 6, 5, 5, 5, 4, 6, 4, 7, 9, 5, - 0, 5, 4, 0, 1, 0, 2, 0, 1, 3, - 3, 2, 2, 0, 6, 1, 0, 3, 0, 3, - 3, 3, 0, 1, 4, 2, 2, 2, 2, 2, - 3, 2, 2, 3, 0, 4, 3, 1, 5, 3, - 1, 3, 1, 2, 3, 1, 3, 1, 2, 1, - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 3, 3, 2, 2, 3, 3, 5, 4, 6, + 3, 5, 4, 6, 4, 6, 5, 7, 3, 2, + 4, 3, 2, 4, 3, 3, 3, 3, 4, 3, + 4, 3, 4, 5, 6, 6, 7, 6, 7, 6, + 7, 3, 4, 4, 6, 1, 4, 4, 5, 4, + 6, 1, 3, 2, 2, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 2, 2, 5, 6, 6, 7, 1, 2, 1, 1, + 1, 2, 2, 4, 3, 1, 1, 1, 1, 2, + 1, 1, 1, 1, 1, 1, 1, 2, 4, 2, + 3, 3, 4, 3, 5, 6, 7, 9, 7, 7, + 5, 1, 1, 1, 5, 6, 6, 4, 4, 4, + 4, 6, 5, 5, 5, 4, 6, 4, 7, 9, + 5, 0, 5, 4, 0, 1, 0, 2, 0, 1, + 3, 3, 2, 2, 0, 6, 1, 0, 3, 0, + 3, 3, 3, 0, 1, 4, 2, 2, 2, 2, + 2, 3, 2, 2, 3, 0, 4, 3, 1, 5, + 3, 1, 3, 1, 2, 3, 1, 3, 1, 2, + 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 4, 1, 4, 1, 4, 1, 2, 1, 2, - 1, 2, 1, 3, 1, 3, 1, 2, 1, 3, - 1, 2, 1, 0, 1, 3, 1, 3, 3, 1, - 3, 3, 0, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 4, 3, - 2, 3, 0, 3, 3, 2, 2, 1, 0, 2, - 2, 3, 2, 1, 1, 3, 1, 1, 5, 1, - 2, 4, 2, 0, 1, 0, 1, 1, 2, 3, - 5, 7, 7, 1, 0, 0, 2, 0, 2, 3, - 3, 3, 5, 7, 7, 0, 2, 1, 0, 1, - 0, 1, 3, 1, 2, 3, 2, 1, 3, 4, - 2, 1, 3, 1, 3, 1, 2, 1, 0, 3, - 1, 3, 1, 2, 4, 2, 0, 3, 1, 3, - 1, 2, 4, 2, 0, 1, 3, 1, 3, 1, - 2, 1, 3, 1, 1, 2, 1, 1, 2, 1, - 1, 2, 7, 2, 5, 3, 3, 1, 1, 1, + 1, 1, 4, 1, 4, 1, 4, 1, 2, 1, + 2, 1, 2, 1, 3, 1, 3, 1, 2, 1, + 3, 1, 2, 1, 0, 1, 3, 1, 3, 3, + 1, 3, 3, 0, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, + 3, 2, 3, 0, 3, 3, 2, 2, 1, 0, + 2, 2, 3, 2, 1, 1, 3, 1, 1, 5, + 1, 2, 4, 2, 0, 1, 0, 1, 1, 2, + 3, 5, 7, 7, 1, 0, 0, 2, 0, 2, + 3, 3, 3, 5, 7, 7, 0, 2, 1, 0, + 1, 0, 1, 3, 1, 2, 3, 2, 1, 3, + 4, 2, 1, 3, 1, 3, 1, 2, 1, 0, + 3, 1, 3, 1, 2, 4, 2, 0, 3, 1, + 3, 1, 2, 4, 2, 0, 1, 3, 1, 3, + 1, 2, 1, 3, 1, 1, 2, 1, 1, 2, + 1, 1, 2, 7, 2, 5, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 2, 3, 3, 0, 1, 1, 1, 5, - 3, 0, 1, 1, 1, 1, 1, 1, 4, 7, - 6, 2, 0, 1, 1, 1, 1, 13, 16, 1, - 2, 0, 1, 0, 1, 0, 2, 0, 1, 0, - 6, 8, 6, 8, 6, 8, 3, 2, 1, 0, - 6, 6, 1, 1, 1, 1, 1, 1, 2, 1, - 1, 1, 1, 1, 4, 6, 3, 2, 4, 3, - 5, 1, 0, 1, 1, 0, 1, 1, 1, 1, + 1, 1, 2, 2, 3, 3, 0, 1, 1, 1, + 5, 3, 0, 1, 1, 1, 1, 1, 1, 4, + 7, 6, 2, 0, 1, 1, 1, 1, 13, 16, + 1, 2, 0, 1, 0, 1, 0, 2, 0, 1, + 0, 6, 8, 6, 8, 6, 8, 3, 2, 1, + 0, 6, 6, 1, 1, 1, 1, 1, 1, 2, + 1, 1, 1, 1, 1, 4, 6, 3, 2, 4, + 3, 5, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, - 1, 2, 1, 1, 2, 3, 3, 3, 3, 1, - 3, 3, 2, 3, 3, 1, 1, 1, 3, 5, - 1, 1, 1, 1, 3, 2, 4, 6, 6, 0, - 1, 1, 1, 0, 2, 2, 4, 6, 5, 4, - 6, 1, 1, 1, 1, 1, 1, 0, 1, 3, - 1, 0, 7, 3, 1, 2, 3, 2, 0, 2, - 0, 2, 4, 5, 8, 7, 2, 3, 5, 1, - 0, 2, 0, 1, 0, 2, 1, 3, 3, 0, - 2, 3, 3, 3, 3, 1, 1, 1, 2, 3, - 2, 2, 2, 4, 2, 3, 4, 3, 1, 1, - 1, 1, 1, 1, 0, 1, 3, 2, 9, 12, - 11, 12, 14, 3, 4, 4, 0, 7, 10, 9, - 2, 3, 0, 4, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, + 1, 1, 2, 1, 1, 2, 3, 3, 3, 3, + 1, 3, 3, 2, 3, 3, 1, 1, 1, 3, + 5, 1, 1, 1, 1, 3, 2, 4, 6, 6, + 0, 1, 1, 1, 0, 2, 2, 4, 6, 5, + 4, 6, 1, 1, 1, 1, 1, 1, 0, 1, + 3, 1, 0, 7, 3, 1, 2, 3, 2, 0, + 2, 0, 2, 4, 5, 8, 7, 2, 3, 5, + 1, 0, 2, 0, 1, 0, 2, 1, 3, 3, + 0, 2, 3, 3, 3, 3, 1, 1, 1, 2, + 3, 2, 2, 2, 4, 2, 3, 4, 3, 1, + 1, 1, 1, 1, 1, 0, 1, 3, 2, 9, + 12, 11, 12, 14, 3, 4, 4, 0, 7, 10, + 9, 2, 3, 0, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -3668,7 +3668,7 @@ static const yytype_uint8 yyr2[] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1 + 1, 1, 1, 1 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -3676,390 +3676,390 @@ static const yytype_uint8 yyr2[] = means the default is an error. */ static const yytype_uint16 yydefact[] = { - 169, 287, 0, 1496, 1495, 1570, 287, 0, 1429, 0, - 287, 552, 435, 0, 1600, 1599, 0, 224, 287, 0, - 169, 0, 1530, 0, 0, 0, 614, 617, 615, 0, - 0, 0, 287, 660, 0, 1601, 287, 0, 0, 652, - 616, 0, 1547, 0, 0, 0, 0, 0, 2, 4, + 169, 287, 0, 1497, 1496, 1571, 287, 0, 1430, 0, + 287, 553, 436, 0, 1601, 1600, 0, 224, 287, 0, + 169, 0, 1531, 0, 0, 0, 615, 618, 616, 0, + 0, 0, 287, 661, 0, 1602, 287, 0, 0, 653, + 617, 0, 1548, 0, 0, 0, 0, 0, 2, 4, 8, 22, 37, 32, 0, 21, 35, 19, 18, 40, 27, 7, 5, 25, 39, 42, 20, 26, 34, 16, - 41, 14, 38, 590, 576, 665, 589, 0, 0, 168, - 770, 597, 36, 17, 31, 6, 12, 13, 29, 30, - 28, 1452, 45, 33, 0, 43, 23, 9, 10, 24, - 44, 46, 1602, 1598, 11, 47, 15, 286, 285, 279, - 0, 0, 0, 0, 0, 0, 1569, 0, 0, 0, - 290, 125, 1624, 1625, 1626, 1627, 1628, 1629, 1630, 1631, - 1632, 1633, 1634, 2008, 1635, 1636, 2009, 1637, 1638, 2010, - 1639, 1640, 1641, 1954, 1955, 2011, 1956, 1957, 1642, 1643, - 1644, 1645, 1646, 1647, 1648, 1649, 1650, 1958, 1959, 1651, - 1652, 1653, 1654, 1655, 1960, 2012, 1961, 1656, 1657, 1658, - 1659, 1660, 2013, 1661, 1662, 1663, 1664, 1665, 1666, 1667, - 1668, 1669, 2014, 1670, 1671, 1672, 1673, 1674, 1675, 1676, - 1677, 1678, 1679, 1962, 1680, 1681, 1963, 1682, 1683, 1684, - 1685, 1686, 1687, 1688, 1689, 1690, 1691, 1692, 1693, 1694, - 1695, 1696, 1697, 1698, 1699, 1700, 1701, 1702, 1703, 1704, - 1705, 1706, 1707, 1708, 1709, 1964, 1710, 1711, 1712, 1713, - 1714, 1715, 1965, 1716, 1717, 1718, 1966, 1719, 1720, 1721, - 2015, 2016, 1722, 1723, 1967, 2018, 1724, 1725, 1726, 1968, - 1969, 1727, 1728, 1729, 1730, 1731, 1732, 1733, 1734, 1735, - 2019, 1736, 1737, 1738, 1739, 1740, 1741, 1742, 1743, 1744, - 1745, 1746, 1747, 2020, 1970, 1748, 1749, 1750, 1751, 1752, - 1971, 1972, 1973, 1753, 2021, 2022, 1754, 2023, 1755, 1756, - 1757, 1758, 1759, 1760, 1761, 2024, 1762, 2025, 1763, 1764, - 1765, 1766, 1767, 1768, 1769, 1770, 1974, 1771, 1772, 1773, - 1774, 1775, 1776, 1777, 1778, 1779, 1780, 1781, 1782, 1783, - 1784, 1785, 1786, 1787, 1788, 1789, 1790, 1791, 1792, 1975, - 2027, 1976, 1793, 1794, 1795, 1977, 1796, 1797, 2028, 1798, - 1978, 1799, 1979, 1800, 1801, 1802, 1803, 1804, 1805, 1806, - 1807, 1808, 1809, 1980, 2029, 1810, 2030, 1981, 1811, 1812, - 1813, 1814, 1815, 1816, 1817, 1818, 1819, 1820, 1821, 1822, - 1823, 1824, 1982, 2031, 1825, 1826, 1983, 1827, 1828, 1829, - 1830, 1831, 1832, 1833, 1834, 1835, 1836, 1837, 1838, 1839, - 1840, 1984, 1841, 1842, 1843, 1844, 1845, 1846, 1847, 1848, - 1849, 1850, 1851, 1852, 1853, 1854, 1855, 1856, 1857, 1858, - 1859, 2032, 1860, 1861, 1862, 1985, 1863, 1864, 1865, 1866, - 1867, 1868, 1869, 1870, 1871, 1872, 1873, 1874, 1875, 1876, - 1877, 1878, 1879, 1880, 1881, 1986, 1882, 1883, 2033, 1884, - 1885, 1987, 1886, 1887, 1888, 1889, 1890, 1891, 1892, 1893, - 1894, 1895, 1896, 1897, 1898, 1899, 1900, 1988, 1901, 1989, - 1902, 1903, 1904, 2035, 1905, 1906, 1907, 1908, 1909, 1910, - 1911, 1990, 1991, 1912, 1913, 1992, 1914, 1993, 1915, 1916, - 1994, 1917, 1918, 1919, 1920, 1921, 1922, 1923, 1924, 1925, - 1926, 1927, 1928, 1929, 1930, 1931, 1932, 1933, 1995, 1996, - 1934, 1935, 2036, 1936, 1937, 1938, 1939, 1940, 1941, 1942, - 1943, 1944, 1945, 1946, 1947, 1948, 1949, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 1950, 1951, - 1952, 1953, 0, 1607, 0, 1354, 126, 127, 1376, 125, - 1967, 1974, 1988, 1428, 1427, 126, 0, 282, 551, 0, - 0, 0, 0, 0, 0, 226, 0, 429, 428, 1418, - 434, 0, 0, 0, 129, 121, 1827, 128, 1353, 119, - 135, 2188, 2189, 2190, 2191, 2069, 2192, 2193, 2194, 2195, - 2070, 2196, 2071, 2072, 2073, 2074, 2075, 2076, 2077, 2197, - 2078, 2198, 2199, 2080, 2079, 2200, 2081, 2201, 2082, 2202, - 2083, 2084, 2203, 2204, 2085, 1676, 2086, 2087, 2205, 2206, - 2207, 2208, 2209, 2210, 2211, 2212, 2213, 2088, 2089, 2214, - 2215, 2090, 2216, 2217, 2091, 2218, 2092, 2093, 2094, 2219, - 2095, 2096, 2220, 2097, 2221, 2222, 2098, 2099, 2102, 2100, - 2223, 2101, 2224, 2103, 2104, 2105, 2225, 2226, 2227, 2106, - 2107, 2228, 2108, 2109, 2110, 2111, 2112, 2229, 2113, 2230, - 2114, 2115, 2231, 2232, 2233, 2234, 2235, 2117, 2116, 2118, - 2119, 2236, 2237, 2238, 2239, 2120, 2121, 2122, 2240, 2241, - 2123, 2242, 2243, 2124, 2125, 2244, 2126, 2127, 2245, 2128, - 2129, 2246, 2130, 2131, 2247, 2248, 2249, 2132, 2250, 2133, - 2134, 2251, 2252, 2135, 2136, 2253, 2137, 2254, 2255, 2138, - 2256, 2257, 2139, 2140, 2258, 2141, 2259, 2260, 2261, 2262, - 2142, 2143, 2144, 2145, 2146, 2147, 2148, 2149, 2150, 2151, - 2152, 1566, 137, 136, 138, 0, 453, 454, 0, 464, - 0, 446, 451, 447, 0, 473, 466, 474, 455, 445, - 467, 456, 444, 225, 0, 475, 461, 449, 0, 0, - 0, 0, 283, 242, 0, 435, 0, 169, 0, 1458, - 1468, 1478, 1473, 1467, 1476, 1465, 1482, 1471, 1457, 1480, - 1466, 1470, 1475, 1463, 1481, 1461, 1479, 1477, 1464, 1472, - 1456, 1460, 1447, 1452, 1485, 1474, 1483, 1469, 1484, 1486, - 1459, 1487, 1462, 0, 1429, 0, 1960, 2012, 1965, 0, - 1978, 0, 1981, 1982, 1863, 1989, 1992, 1993, 1994, 1995, - 0, 844, 128, 123, 828, 0, 592, 0, 774, 788, - 828, 833, 1121, 856, 1122, 0, 130, 1532, 1531, 1525, - 211, 1391, 1586, 1724, 1765, 1880, 1990, 1912, 1934, 1605, - 1587, 1580, 1585, 284, 659, 657, 0, 1310, 1724, 1765, - 1867, 1880, 1990, 1934, 1504, 1509, 0, 290, 1592, 128, - 123, 1591, 0, 598, 651, 0, 291, 1546, 0, 1551, - 0, 1843, 625, 628, 1385, 626, 590, 0, 0, 1, - 169, 0, 175, 0, 0, 655, 655, 0, 655, 0, - 582, 0, 0, 590, 585, 589, 771, 1451, 1561, 0, - 1604, 1904, 1990, 1912, 1594, 1590, 1734, 0, 1734, 0, - 0, 1734, 0, 1734, 0, 1734, 0, 0, 1570, 1572, - 0, 280, 1294, 0, 1355, 131, 0, 0, 1440, 1436, - 1441, 1437, 1442, 1435, 1434, 1443, 1439, 0, 0, 0, - 399, 433, 432, 431, 430, 435, 1734, 1402, 222, 518, - 519, 0, 0, 0, 0, 0, 0, 1413, 122, 120, - 1734, 1567, 462, 463, 0, 452, 448, 450, 0, 0, - 1734, 1380, 472, 468, 1734, 472, 1347, 1734, 0, 0, - 234, 0, 428, 1449, 1488, 2139, 1502, 0, 1503, 1493, - 1455, 1489, 1490, 169, 0, 550, 1426, 0, 0, 0, - 1242, 828, 833, 0, 0, 846, 0, 1262, 0, 1268, - 0, 0, 0, 828, 597, 0, 788, 845, 124, 778, - 0, 826, 827, 707, 707, 660, 0, 641, 0, 707, - 714, 707, 838, 0, 0, 841, 839, 0, 841, 0, - 0, 0, 841, 837, 797, 0, 714, 0, 826, 829, - 707, 0, 848, 1446, 0, 0, 0, 0, 1583, 1581, - 1582, 1588, 0, 1584, 0, 0, 1357, 1359, 1360, 1210, - 1370, 1097, 0, 1955, 1956, 1957, 1285, 1958, 1959, 1961, - 1962, 1963, 1054, 1696, 1964, 1368, 1966, 1968, 1969, 1971, - 1972, 1973, 0, 1974, 1975, 1976, 0, 1369, 1979, 1805, - 1984, 1985, 1987, 1990, 1991, 1367, 0, 1996, 0, 0, - 0, 1328, 1233, 0, 1096, 0, 0, 0, 1287, 1295, - 1089, 0, 0, 892, 893, 914, 915, 894, 920, 921, - 923, 895, 0, 1317, 987, 1085, 1305, 1099, 1094, 1104, - 1100, 1101, 1140, 1102, 1120, 1105, 1177, 1095, 0, 1103, - 1087, 1313, 641, 1311, 0, 1088, 1356, 641, 1309, 1507, - 1505, 1512, 1506, 0, 1508, 0, 0, 0, 281, 124, - 1554, 1553, 1545, 1543, 1544, 1542, 1541, 1548, 0, 1550, - 1452, 1287, 1228, 1230, 0, 627, 0, 0, 632, 579, - 578, 580, 3, 0, 0, 0, 0, 1714, 0, 653, - 654, 0, 0, 0, 0, 0, 0, 0, 0, 755, - 680, 681, 683, 752, 756, 764, 0, 0, 0, 0, - 0, 586, 0, 1385, 1533, 1603, 1597, 0, 1595, 0, + 41, 14, 38, 591, 577, 666, 590, 0, 0, 168, + 771, 598, 36, 17, 31, 6, 12, 13, 29, 30, + 28, 1453, 45, 33, 0, 43, 23, 9, 10, 24, + 44, 46, 1603, 1599, 11, 47, 15, 286, 285, 279, + 0, 0, 0, 0, 0, 0, 1570, 0, 0, 0, + 290, 125, 1625, 1626, 1627, 1628, 1629, 1630, 1631, 1632, + 1633, 1634, 1635, 2009, 1636, 1637, 2010, 1638, 1639, 2011, + 1640, 1641, 1642, 1955, 1956, 2012, 1957, 1958, 1643, 1644, + 1645, 1646, 1647, 1648, 1649, 1650, 1651, 1959, 1960, 1652, + 1653, 1654, 1655, 1656, 1961, 2013, 1962, 1657, 1658, 1659, + 1660, 1661, 2014, 1662, 1663, 1664, 1665, 1666, 1667, 1668, + 1669, 1670, 2015, 1671, 1672, 1673, 1674, 1675, 1676, 1677, + 1678, 1679, 1680, 1963, 1681, 1682, 1964, 1683, 1684, 1685, + 1686, 1687, 1688, 1689, 1690, 1691, 1692, 1693, 1694, 1695, + 1696, 1697, 1698, 1699, 1700, 1701, 1702, 1703, 1704, 1705, + 1706, 1707, 1708, 1709, 1710, 1965, 1711, 1712, 1713, 1714, + 1715, 1716, 1966, 1717, 1718, 1719, 1967, 1720, 1721, 1722, + 2016, 2017, 1723, 1724, 1968, 2019, 1725, 1726, 1727, 1969, + 1970, 1728, 1729, 1730, 1731, 1732, 1733, 1734, 1735, 1736, + 2020, 1737, 1738, 1739, 1740, 1741, 1742, 1743, 1744, 1745, + 1746, 1747, 1748, 2021, 1971, 1749, 1750, 1751, 1752, 1753, + 1972, 1973, 1974, 1754, 2022, 2023, 1755, 2024, 1756, 1757, + 1758, 1759, 1760, 1761, 1762, 2025, 1763, 2026, 1764, 1765, + 1766, 1767, 1768, 1769, 1770, 1771, 1975, 1772, 1773, 1774, + 1775, 1776, 1777, 1778, 1779, 1780, 1781, 1782, 1783, 1784, + 1785, 1786, 1787, 1788, 1789, 1790, 1791, 1792, 1793, 1976, + 2028, 1977, 1794, 1795, 1796, 1978, 1797, 1798, 2029, 1799, + 1979, 1800, 1980, 1801, 1802, 1803, 1804, 1805, 1806, 1807, + 1808, 1809, 1810, 1981, 2030, 1811, 2031, 1982, 1812, 1813, + 1814, 1815, 1816, 1817, 1818, 1819, 1820, 1821, 1822, 1823, + 1824, 1825, 1983, 2032, 1826, 1827, 1984, 1828, 1829, 1830, + 1831, 1832, 1833, 1834, 1835, 1836, 1837, 1838, 1839, 1840, + 1841, 1985, 1842, 1843, 1844, 1845, 1846, 1847, 1848, 1849, + 1850, 1851, 1852, 1853, 1854, 1855, 1856, 1857, 1858, 1859, + 1860, 2033, 1861, 1862, 1863, 1986, 1864, 1865, 1866, 1867, + 1868, 1869, 1870, 1871, 1872, 1873, 1874, 1875, 1876, 1877, + 1878, 1879, 1880, 1881, 1882, 1987, 1883, 1884, 2034, 1885, + 1886, 1988, 1887, 1888, 1889, 1890, 1891, 1892, 1893, 1894, + 1895, 1896, 1897, 1898, 1899, 1900, 1901, 1989, 1902, 1990, + 1903, 1904, 1905, 2036, 1906, 1907, 1908, 1909, 1910, 1911, + 1912, 1991, 1992, 1913, 1914, 1993, 1915, 1994, 1916, 1917, + 1995, 1918, 1919, 1920, 1921, 1922, 1923, 1924, 1925, 1926, + 1927, 1928, 1929, 1930, 1931, 1932, 1933, 1934, 1996, 1997, + 1935, 1936, 2037, 1937, 1938, 1939, 1940, 1941, 1942, 1943, + 1944, 1945, 1946, 1947, 1948, 1949, 1950, 1998, 1999, 2000, + 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 1951, 1952, + 1953, 1954, 0, 1608, 0, 1355, 126, 127, 1377, 125, + 1968, 1975, 1989, 1429, 1428, 126, 0, 282, 552, 0, + 0, 0, 0, 0, 0, 226, 0, 430, 429, 1419, + 435, 0, 0, 0, 129, 121, 1828, 128, 1354, 119, + 135, 2189, 2190, 2191, 2192, 2070, 2193, 2194, 2195, 2196, + 2071, 2197, 2072, 2073, 2074, 2075, 2076, 2077, 2078, 2198, + 2079, 2199, 2200, 2081, 2080, 2201, 2082, 2202, 2083, 2203, + 2084, 2085, 2204, 2205, 2086, 1677, 2087, 2088, 2206, 2207, + 2208, 2209, 2210, 2211, 2212, 2213, 2214, 2089, 2090, 2215, + 2216, 2091, 2217, 2218, 2092, 2219, 2093, 2094, 2095, 2220, + 2096, 2097, 2221, 2098, 2222, 2223, 2099, 2100, 2103, 2101, + 2224, 2102, 2225, 2104, 2105, 2106, 2226, 2227, 2228, 2107, + 2108, 2229, 2109, 2110, 2111, 2112, 2113, 2230, 2114, 2231, + 2115, 2116, 2232, 2233, 2234, 2235, 2236, 2118, 2117, 2119, + 2120, 2237, 2238, 2239, 2240, 2121, 2122, 2123, 2241, 2242, + 2124, 2243, 2244, 2125, 2126, 2245, 2127, 2128, 2246, 2129, + 2130, 2247, 2131, 2132, 2248, 2249, 2250, 2133, 2251, 2134, + 2135, 2252, 2253, 2136, 2137, 2254, 2138, 2255, 2256, 2139, + 2257, 2258, 2140, 2141, 2259, 2142, 2260, 2261, 2262, 2263, + 2143, 2144, 2145, 2146, 2147, 2148, 2149, 2150, 2151, 2152, + 2153, 1567, 137, 136, 138, 0, 454, 455, 0, 465, + 0, 447, 452, 448, 0, 474, 467, 475, 456, 446, + 468, 457, 445, 225, 0, 476, 462, 450, 0, 0, + 0, 0, 283, 242, 0, 436, 0, 169, 0, 1459, + 1469, 1479, 1474, 1468, 1477, 1466, 1483, 1472, 1458, 1481, + 1467, 1471, 1476, 1464, 1482, 1462, 1480, 1478, 1465, 1473, + 1457, 1461, 1448, 1453, 1486, 1475, 1484, 1470, 1485, 1487, + 1460, 1488, 1463, 0, 1430, 0, 1961, 2013, 1966, 0, + 1979, 0, 1982, 1983, 1864, 1990, 1993, 1994, 1995, 1996, + 0, 845, 128, 123, 829, 0, 593, 0, 775, 789, + 829, 834, 1122, 857, 1123, 0, 130, 1533, 1532, 1526, + 211, 1392, 1587, 1725, 1766, 1881, 1991, 1913, 1935, 1606, + 1588, 1581, 1586, 284, 660, 658, 0, 1311, 1725, 1766, + 1868, 1881, 1991, 1935, 1505, 1510, 0, 290, 1593, 128, + 123, 1592, 0, 599, 652, 0, 291, 1547, 0, 1552, + 0, 1844, 626, 629, 1386, 627, 591, 0, 0, 1, + 169, 0, 175, 0, 0, 656, 656, 0, 656, 0, + 583, 0, 0, 591, 586, 590, 772, 1452, 1562, 0, + 1605, 1905, 1991, 1913, 1595, 1591, 1735, 0, 1735, 0, + 0, 1735, 0, 1735, 0, 1735, 0, 0, 1571, 1573, + 0, 280, 1295, 0, 1356, 131, 0, 0, 1441, 1437, + 1442, 1438, 1443, 1436, 1435, 1444, 1440, 0, 0, 0, + 399, 434, 433, 432, 431, 436, 1735, 1403, 222, 519, + 520, 0, 0, 0, 0, 0, 0, 1414, 122, 120, + 1735, 1568, 463, 464, 0, 453, 449, 451, 0, 0, + 1735, 1381, 473, 469, 1735, 473, 1348, 1735, 0, 0, + 234, 0, 429, 1450, 1489, 2140, 1503, 0, 1504, 1494, + 1456, 1490, 1491, 169, 0, 551, 1427, 0, 0, 0, + 1243, 829, 834, 0, 0, 847, 0, 1263, 0, 1269, + 0, 0, 0, 829, 598, 0, 789, 846, 124, 779, + 0, 827, 828, 708, 708, 661, 0, 642, 0, 708, + 715, 708, 839, 0, 0, 842, 840, 0, 842, 0, + 0, 0, 842, 838, 798, 0, 715, 0, 827, 830, + 708, 0, 849, 1447, 0, 0, 0, 0, 1584, 1582, + 1583, 1589, 0, 1585, 0, 0, 1358, 1360, 1361, 1211, + 1371, 1098, 0, 1956, 1957, 1958, 1286, 1959, 1960, 1962, + 1963, 1964, 1055, 1697, 1965, 1369, 1967, 1969, 1970, 1972, + 1973, 1974, 0, 1975, 1976, 1977, 0, 1370, 1980, 1806, + 1985, 1986, 1988, 1991, 1992, 1368, 0, 1997, 0, 0, + 0, 1329, 1234, 0, 1097, 0, 0, 0, 1288, 1296, + 1090, 0, 0, 893, 894, 915, 916, 895, 921, 922, + 924, 896, 0, 1318, 988, 1086, 1306, 1100, 1095, 1105, + 1101, 1102, 1141, 1103, 1121, 1106, 1178, 1096, 0, 1104, + 1088, 1314, 642, 1312, 0, 1089, 1357, 642, 1310, 1508, + 1506, 1513, 1507, 0, 1509, 0, 0, 0, 281, 124, + 1555, 1554, 1546, 1544, 1545, 1543, 1542, 1549, 0, 1551, + 1453, 1288, 1229, 1231, 0, 628, 0, 0, 633, 580, + 579, 581, 3, 0, 0, 0, 0, 1715, 0, 654, + 655, 0, 0, 0, 0, 0, 0, 0, 0, 756, + 681, 682, 684, 753, 757, 765, 0, 0, 0, 0, + 0, 587, 0, 1386, 1534, 1604, 1598, 0, 1596, 0, 0, 0, 0, 0, 153, 153, 0, 0, 0, 0, 0, 113, 51, 106, 0, 0, 0, 0, 256, 269, 0, 0, 0, 0, 0, 266, 0, 0, 249, 53, 243, 245, 0, 153, 0, 49, 0, 0, 0, 55, - 1570, 0, 0, 1579, 288, 289, 1293, 0, 133, 134, - 132, 125, 0, 2153, 2008, 2009, 2010, 2011, 2158, 2012, - 1961, 2013, 2014, 0, 2015, 2016, 1967, 2018, 2019, 2020, - 2021, 2022, 2023, 2024, 2025, 1974, 2027, 2028, 2029, 2030, - 2031, 2032, 2181, 2033, 1988, 2035, 1994, 2186, 0, 2036, - 1112, 663, 1236, 665, 1234, 1386, 0, 126, 1373, 0, - 1438, 0, 0, 0, 0, 548, 0, 0, 0, 0, - 1398, 1734, 223, 227, 0, 1734, 218, 1734, 399, 0, - 1734, 0, 1734, 399, 1734, 0, 1412, 1415, 0, 465, - 460, 458, 457, 459, 1734, 277, 0, 0, 1381, 470, - 471, 0, 439, 0, 0, 441, 0, 0, 239, 0, - 237, 0, 435, 169, 0, 250, 1498, 1499, 1497, 0, - 0, 1492, 1454, 253, 270, 1501, 1491, 1500, 1453, 1448, - 0, 0, 1444, 545, 0, 0, 0, 1243, 963, 962, - 944, 945, 960, 961, 946, 947, 954, 955, 965, 964, - 952, 953, 948, 949, 942, 943, 958, 959, 950, 951, - 956, 957, 940, 941, 1257, 1244, 1245, 1246, 1247, 1248, - 1249, 1250, 1251, 1252, 1253, 1254, 1255, 1256, 0, 0, - 787, 784, 0, 0, 0, 0, 0, 0, 1287, 0, - 1060, 1095, 0, 0, 0, 1228, 1267, 0, 0, 0, - 0, 0, 0, 1228, 1273, 0, 0, 812, 824, 0, - 700, 706, 785, 783, 0, 1310, 775, 0, 858, 788, - 786, 0, 707, 782, 0, 838, 0, 837, 0, 0, - 840, 834, 0, 835, 0, 0, 0, 0, 836, 0, - 0, 0, 0, 0, 707, 0, 824, 0, 781, 855, - 1515, 1523, 212, 0, 1377, 2037, 2038, 2039, 2040, 902, - 2041, 931, 909, 2042, 931, 931, 2043, 2044, 2045, 2046, - 898, 898, 911, 2047, 2048, 2049, 2050, 2051, 899, 900, - 936, 2052, 2053, 2054, 2055, 2056, 0, 0, 2057, 931, - 2058, 898, 2059, 2060, 2061, 903, 2062, 866, 2063, 0, - 2064, 901, 867, 2065, 939, 939, 2066, 0, 2067, 926, - 2068, 0, 1239, 884, 884, 885, 886, 887, 912, 913, - 888, 918, 919, 889, 986, 0, 898, 1378, 1379, 169, - 1589, 1606, 0, 1233, 1106, 930, 917, 1284, 0, 925, - 924, 0, 1233, 907, 906, 905, 1091, 0, 904, 0, - 1190, 931, 931, 929, 1012, 908, 0, 0, 0, 0, - 0, 935, 0, 933, 0, 1013, 991, 992, 0, 0, - 1327, 1336, 1228, 1232, 0, 1089, 1228, 0, 1098, 1108, - 0, 1180, 1182, 0, 0, 0, 1288, 1358, 1090, 0, - 1363, 0, 0, 986, 986, 1316, 1210, 0, 1200, 1203, - 0, 0, 1207, 1208, 1209, 0, 0, 0, 1308, 0, - 1218, 1220, 0, 0, 1028, 1216, 0, 1031, 0, 0, - 0, 0, 1204, 1205, 1206, 1196, 1197, 1198, 1199, 1201, - 1202, 1214, 1195, 1009, 0, 1086, 0, 1143, 0, 1008, - 1314, 773, 0, 1361, 773, 1517, 1521, 1522, 1516, 1520, - 0, 1511, 1510, 1513, 1514, 0, 1555, 1539, 0, 1536, - 1231, 768, 629, 1349, 0, 0, 0, 1560, 174, 173, - 0, 0, 233, 0, 602, 601, 674, 666, 668, 674, - 0, 600, 0, 728, 729, 0, 0, 0, 0, 761, - 759, 1357, 1370, 716, 684, 715, 0, 0, 688, 0, - 720, 987, 754, 584, 678, 679, 682, 583, 0, 757, - 0, 767, 0, 621, 623, 606, 620, 618, 603, 611, - 755, 683, 0, 1562, 0, 0, 1526, 1593, 1596, 0, - 0, 0, 0, 0, 0, 0, 1734, 0, 0, 869, + 1571, 0, 0, 1580, 288, 289, 1294, 0, 133, 134, + 132, 125, 0, 2154, 2009, 2010, 2011, 2012, 2159, 2013, + 1962, 2014, 2015, 0, 2016, 2017, 1968, 2019, 2020, 2021, + 2022, 2023, 2024, 2025, 2026, 1975, 2028, 2029, 2030, 2031, + 2032, 2033, 2182, 2034, 1989, 2036, 1995, 2187, 0, 2037, + 1113, 664, 1237, 666, 1235, 1387, 0, 126, 1374, 0, + 1439, 0, 0, 0, 0, 549, 0, 0, 0, 0, + 1399, 1735, 223, 227, 0, 1735, 218, 1735, 399, 0, + 1735, 0, 1735, 399, 1735, 0, 1413, 1416, 0, 466, + 461, 459, 458, 460, 1735, 277, 0, 0, 1382, 471, + 472, 0, 440, 0, 0, 442, 0, 0, 239, 0, + 237, 0, 436, 169, 0, 250, 1499, 1500, 1498, 0, + 0, 1493, 1455, 253, 270, 1502, 1492, 1501, 1454, 1449, + 0, 0, 1445, 546, 0, 0, 0, 1244, 964, 963, + 945, 946, 961, 962, 947, 948, 955, 956, 966, 965, + 953, 954, 949, 950, 943, 944, 959, 960, 951, 952, + 957, 958, 941, 942, 1258, 1245, 1246, 1247, 1248, 1249, + 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 0, 0, + 788, 785, 0, 0, 0, 0, 0, 0, 1288, 0, + 1061, 1096, 0, 0, 0, 1229, 1268, 0, 0, 0, + 0, 0, 0, 1229, 1274, 0, 0, 813, 825, 0, + 701, 707, 786, 784, 0, 1311, 776, 0, 859, 789, + 787, 0, 708, 783, 0, 839, 0, 838, 0, 0, + 841, 835, 0, 836, 0, 0, 0, 0, 837, 0, + 0, 0, 0, 0, 708, 0, 825, 0, 782, 856, + 1516, 1524, 212, 0, 1378, 2038, 2039, 2040, 2041, 903, + 2042, 932, 910, 2043, 932, 932, 2044, 2045, 2046, 2047, + 899, 899, 912, 2048, 2049, 2050, 2051, 2052, 900, 901, + 937, 2053, 2054, 2055, 2056, 2057, 0, 0, 2058, 932, + 2059, 899, 2060, 2061, 2062, 904, 2063, 867, 2064, 0, + 2065, 902, 868, 2066, 940, 940, 2067, 0, 2068, 927, + 2069, 0, 1240, 885, 885, 886, 887, 888, 913, 914, + 889, 919, 920, 890, 987, 0, 899, 1379, 1380, 169, + 1590, 1607, 0, 1234, 1107, 931, 918, 1285, 0, 926, + 925, 0, 1234, 908, 907, 906, 1092, 0, 905, 0, + 1191, 932, 932, 930, 1013, 909, 0, 0, 0, 0, + 0, 936, 0, 934, 0, 1014, 992, 993, 0, 0, + 1328, 1337, 1229, 1233, 0, 1090, 1229, 0, 1099, 1109, + 0, 1181, 1183, 0, 0, 0, 1289, 1359, 1091, 0, + 1364, 0, 0, 987, 987, 1317, 1211, 0, 1201, 1204, + 0, 0, 1208, 1209, 1210, 0, 0, 0, 1309, 0, + 1219, 1221, 0, 0, 1029, 1217, 0, 1032, 0, 0, + 0, 0, 1205, 1206, 1207, 1197, 1198, 1199, 1200, 1202, + 1203, 1215, 1196, 1010, 0, 1087, 0, 1144, 0, 1009, + 1315, 774, 0, 1362, 774, 1518, 1522, 1523, 1517, 1521, + 0, 1512, 1511, 1514, 1515, 0, 1556, 1540, 0, 1537, + 1232, 769, 630, 1350, 0, 0, 0, 1561, 174, 173, + 0, 0, 233, 0, 603, 602, 675, 667, 669, 675, + 0, 601, 0, 729, 730, 0, 0, 0, 0, 762, + 760, 1358, 1371, 717, 685, 716, 0, 0, 689, 0, + 721, 988, 755, 585, 679, 680, 683, 584, 0, 758, + 0, 768, 0, 622, 624, 607, 621, 619, 604, 612, + 756, 684, 0, 1563, 0, 0, 1527, 1594, 1597, 0, + 0, 0, 0, 0, 0, 0, 1735, 0, 0, 870, 74, 70, 97, 345, 152, 0, 0, 0, 0, 0, 0, 0, 0, 0, 105, 102, 0, 0, 103, 104, - 0, 0, 0, 0, 1377, 254, 255, 268, 0, 259, + 0, 0, 0, 0, 1378, 254, 255, 268, 0, 259, 260, 257, 261, 262, 0, 0, 247, 248, 0, 0, 0, 0, 246, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1572, 1571, 0, 1563, 1289, 1294, 665, 665, - 665, 0, 0, 0, 0, 663, 664, 0, 0, 0, - 0, 0, 544, 397, 408, 0, 0, 0, 1402, 222, - 0, 0, 0, 0, 0, 0, 0, 435, 1405, 1403, - 1401, 1404, 1406, 0, 0, 0, 0, 0, 214, 217, - 0, 396, 368, 0, 0, 0, 0, 1417, 0, 0, - 513, 511, 514, 503, 516, 506, 0, 1734, 386, 1414, - 0, 1568, 0, 0, 275, 472, 1382, 0, 469, 472, - 1348, 0, 472, 241, 0, 0, 1450, 1494, 251, 271, - 252, 272, 550, 1574, 1576, 0, 553, 558, 542, 0, - 542, 0, 555, 559, 542, 554, 0, 542, 549, 0, - 1136, 0, 1126, 0, 0, 847, 0, 0, 1127, 1062, - 1063, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1080, - 1079, 1128, 851, 0, 854, 0, 0, 1265, 1266, 0, - 1129, 0, 0, 1272, 0, 0, 0, 1134, 0, 789, - 0, 0, 690, 691, 699, 695, 702, 0, 705, 692, - 641, 591, 1724, 1765, 0, 652, 652, 652, 650, 640, - 0, 732, 790, 0, 780, 0, 0, 0, 813, 0, - 0, 815, 817, 0, 0, 820, 0, 796, 795, 0, - 0, 779, 0, 0, 859, 0, 1353, 0, 0, 213, - 0, 0, 0, 884, 0, 0, 0, 876, 874, 870, - 0, 966, 967, 968, 969, 970, 971, 972, 973, 974, - 975, 976, 977, 978, 890, 1390, 0, 896, 1393, 0, - 1394, 1395, 1392, 1389, 1396, 1397, 0, 0, 0, 0, - 1283, 1279, 0, 0, 0, 0, 0, 1185, 1187, 1189, - 0, 928, 927, 1194, 1200, 1203, 1207, 1208, 1209, 1204, - 1205, 1206, 1196, 1197, 1198, 1199, 1201, 1202, 0, 1222, - 0, 1176, 0, 0, 0, 0, 0, 0, 0, 0, - 1321, 1320, 0, 1344, 0, 1109, 1093, 0, 0, 1183, - 1110, 1318, 1328, 1296, 0, 0, 0, 1366, 1365, 988, - 997, 1000, 1033, 1034, 1004, 1005, 1006, 1010, 1388, 1387, - 1315, 0, 1307, 0, 0, 989, 1014, 1019, 0, 1274, - 1277, 1050, 1276, 0, 1038, 0, 1027, 0, 1036, 1040, - 1015, 1030, 0, 1011, 0, 1308, 1219, 1221, 0, 1217, - 0, 1001, 1002, 1003, 993, 994, 995, 996, 998, 999, - 1007, 1193, 1191, 1192, 0, 1294, 0, 1306, 0, 0, - 1145, 0, 0, 1035, 1312, 0, 858, 665, 858, 0, - 986, 1556, 1385, 1549, 1385, 1538, 1229, 1350, 1384, 0, - 639, 0, 1558, 160, 164, 0, 0, 1295, 194, 196, - 773, 0, 672, 673, 677, 0, 0, 677, 656, 599, - 1985, 1863, 0, 0, 0, 0, 721, 762, 0, 753, - 718, 719, 0, 717, 1357, 722, 1356, 723, 726, 727, - 689, 1345, 763, 765, 0, 758, 0, 1351, 605, 624, - 0, 0, 0, 0, 0, 588, 587, 769, 1533, 1533, - 1535, 1534, 0, 273, 0, 52, 0, 1734, 76, 0, + 0, 0, 1573, 1572, 0, 1564, 1290, 1295, 666, 666, + 666, 0, 0, 0, 0, 664, 665, 0, 0, 0, + 0, 0, 545, 397, 409, 0, 0, 0, 1403, 222, + 0, 0, 0, 0, 0, 0, 0, 436, 1406, 1404, + 1402, 1405, 1407, 0, 0, 0, 0, 0, 214, 217, + 0, 396, 368, 0, 0, 0, 0, 1418, 0, 0, + 514, 512, 515, 504, 517, 507, 0, 1735, 386, 1415, + 0, 1569, 0, 0, 275, 473, 1383, 0, 470, 473, + 1349, 0, 473, 241, 0, 0, 1451, 1495, 251, 271, + 252, 272, 551, 1575, 1577, 0, 554, 559, 543, 0, + 543, 0, 556, 560, 543, 555, 0, 543, 550, 0, + 1137, 0, 1127, 0, 0, 848, 0, 0, 1128, 1063, + 1064, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1081, + 1080, 1129, 852, 0, 855, 0, 0, 1266, 1267, 0, + 1130, 0, 0, 1273, 0, 0, 0, 1135, 0, 790, + 0, 0, 691, 692, 700, 696, 703, 0, 706, 693, + 642, 592, 1725, 1766, 0, 653, 653, 653, 651, 641, + 0, 733, 791, 0, 781, 0, 0, 0, 814, 0, + 0, 816, 818, 0, 0, 821, 0, 797, 796, 0, + 0, 780, 0, 0, 860, 0, 1354, 0, 0, 213, + 0, 0, 0, 885, 0, 0, 0, 877, 875, 871, + 0, 967, 968, 969, 970, 971, 972, 973, 974, 975, + 976, 977, 978, 979, 891, 1391, 0, 897, 1394, 0, + 1395, 1396, 1393, 1390, 1397, 1398, 0, 0, 0, 0, + 1284, 1280, 0, 0, 0, 0, 0, 1186, 1188, 1190, + 0, 929, 928, 1195, 1201, 1204, 1208, 1209, 1210, 1205, + 1206, 1207, 1197, 1198, 1199, 1200, 1202, 1203, 0, 1223, + 0, 1177, 0, 0, 0, 0, 0, 0, 0, 0, + 1322, 1321, 0, 1345, 0, 1110, 1094, 0, 0, 1184, + 1111, 1319, 1329, 1297, 0, 0, 0, 1367, 1366, 989, + 998, 1001, 1034, 1035, 1005, 1006, 1007, 1011, 1389, 1388, + 1316, 0, 1308, 0, 0, 990, 1015, 1020, 0, 1275, + 1278, 1051, 1277, 0, 1039, 0, 1028, 0, 1037, 1041, + 1016, 1031, 0, 1012, 0, 1309, 1220, 1222, 0, 1218, + 0, 1002, 1003, 1004, 994, 995, 996, 997, 999, 1000, + 1008, 1194, 1192, 1193, 0, 1295, 0, 1307, 0, 0, + 1146, 0, 0, 1036, 1313, 0, 859, 666, 859, 0, + 987, 1557, 1386, 1550, 1386, 1539, 1230, 1351, 1385, 0, + 640, 0, 1559, 160, 164, 0, 0, 1296, 194, 196, + 774, 0, 673, 674, 678, 0, 0, 678, 657, 600, + 1986, 1864, 0, 0, 0, 0, 722, 763, 0, 754, + 719, 720, 0, 718, 1358, 723, 1357, 724, 727, 728, + 690, 1346, 764, 766, 0, 759, 0, 1352, 606, 625, + 0, 0, 0, 0, 0, 589, 588, 770, 1534, 1534, + 1536, 1535, 0, 273, 0, 52, 0, 1735, 76, 0, 0, 0, 0, 0, 0, 295, 72, 73, 0, 401, - 0, 71, 67, 295, 118, 1734, 472, 1734, 472, 1628, - 1697, 1881, 0, 65, 373, 109, 0, 146, 79, 81, - 0, 404, 0, 354, 0, 0, 99, 114, 139, 0, - 0, 54, 244, 258, 263, 142, 267, 264, 1422, 265, - 153, 0, 50, 0, 140, 0, 1420, 0, 0, 56, - 144, 1424, 1572, 1579, 0, 0, 1293, 0, 663, 663, - 663, 661, 662, 1113, 0, 1235, 0, 1237, 1238, 1027, - 1432, 1431, 1433, 1430, 532, 543, 0, 398, 0, 547, - 535, 536, 544, 1400, 227, 0, 218, 399, 0, 0, - 399, 0, 1402, 0, 0, 222, 228, 0, 0, 0, - 0, 0, 397, 389, 387, 421, 0, 394, 388, 0, - 0, 340, 0, 1622, 0, 1702, 201, 206, 0, 0, - 0, 0, 1371, 2154, 2155, 2156, 2157, 2159, 2160, 2161, - 2162, 2163, 2164, 2165, 2166, 2167, 2168, 2169, 2170, 2171, - 2172, 2173, 2174, 2175, 2176, 2177, 2178, 2179, 2180, 2182, - 2183, 2184, 2185, 2186, 2187, 520, 0, 523, 869, 1372, - 0, 0, 0, 0, 0, 277, 278, 438, 1383, 440, - 0, 442, 240, 238, 1445, 1573, 1575, 546, 0, 541, - 0, 568, 0, 0, 0, 0, 0, 0, 0, 0, - 1123, 1241, 0, 1260, 1259, 1061, 1068, 1071, 1075, 1076, - 1077, 1261, 0, 0, 0, 1072, 1073, 1074, 1064, 1065, - 1066, 1067, 1069, 1070, 1078, 856, 0, 0, 850, 1270, - 1269, 1263, 1264, 0, 1131, 1132, 1133, 1271, 0, 0, - 825, 694, 696, 693, 0, 0, 858, 652, 652, 652, - 652, 649, 0, 0, 0, 857, 0, 749, 710, 711, - 0, 0, 821, 819, 0, 843, 0, 816, 0, 822, - 0, 807, 0, 814, 863, 830, 0, 0, 832, 1524, - 880, 0, 875, 871, 0, 0, 0, 881, 0, 0, - 0, 0, 0, 0, 0, 1240, 0, 658, 1107, 0, - 0, 0, 1280, 0, 1055, 897, 910, 1032, 0, 1188, - 1111, 0, 1211, 1175, 938, 937, 939, 939, 1056, 0, - 1323, 1325, 0, 0, 0, 0, 1335, 0, 1058, 0, - 1229, 1179, 1181, 1336, 1092, 922, 986, 0, 0, 0, - 0, 0, 0, 0, 1039, 1029, 0, 1037, 1041, 0, - 0, 0, 1023, 0, 0, 1021, 1051, 1017, 0, 0, - 1052, 1293, 0, 1297, 0, 0, 1144, 1153, 776, 772, - 732, 663, 732, 0, 1518, 1540, 1537, 0, 637, 0, - 0, 1559, 0, 183, 0, 0, 0, 0, 0, 186, - 200, 197, 1558, 0, 0, 667, 669, 0, 1212, 677, - 671, 725, 724, 0, 687, 760, 685, 0, 766, 0, - 622, 0, 608, 0, 799, 0, 0, 1527, 1528, 0, - 0, 0, 0, 344, 0, 0, 0, 295, 0, 410, - 0, 417, 0, 0, 401, 380, 69, 68, 98, 0, + 0, 71, 67, 295, 118, 1735, 473, 1735, 473, 1629, + 1698, 1882, 0, 65, 373, 109, 0, 146, 79, 81, + 408, 404, 0, 354, 0, 0, 99, 114, 139, 0, + 0, 54, 244, 258, 263, 142, 267, 264, 1423, 265, + 153, 0, 50, 0, 140, 0, 1421, 0, 0, 56, + 144, 1425, 1573, 1580, 0, 0, 1294, 0, 664, 664, + 664, 662, 663, 1114, 0, 1236, 0, 1238, 1239, 1028, + 1433, 1432, 1434, 1431, 533, 544, 0, 398, 0, 548, + 536, 537, 545, 1401, 227, 0, 218, 399, 0, 0, + 399, 0, 1403, 0, 0, 222, 228, 0, 0, 0, + 0, 0, 397, 389, 387, 422, 0, 394, 388, 0, + 0, 340, 0, 1623, 0, 1703, 201, 206, 0, 0, + 0, 0, 1372, 2155, 2156, 2157, 2158, 2160, 2161, 2162, + 2163, 2164, 2165, 2166, 2167, 2168, 2169, 2170, 2171, 2172, + 2173, 2174, 2175, 2176, 2177, 2178, 2179, 2180, 2181, 2183, + 2184, 2185, 2186, 2187, 2188, 521, 0, 524, 870, 1373, + 0, 0, 0, 0, 0, 277, 278, 439, 1384, 441, + 0, 443, 240, 238, 1446, 1574, 1576, 547, 0, 542, + 0, 569, 0, 0, 0, 0, 0, 0, 0, 0, + 1124, 1242, 0, 1261, 1260, 1062, 1069, 1072, 1076, 1077, + 1078, 1262, 0, 0, 0, 1073, 1074, 1075, 1065, 1066, + 1067, 1068, 1070, 1071, 1079, 857, 0, 0, 851, 1271, + 1270, 1264, 1265, 0, 1132, 1133, 1134, 1272, 0, 0, + 826, 695, 697, 694, 0, 0, 859, 653, 653, 653, + 653, 650, 0, 0, 0, 858, 0, 750, 711, 712, + 0, 0, 822, 820, 0, 844, 0, 817, 0, 823, + 0, 808, 0, 815, 864, 831, 0, 0, 833, 1525, + 881, 0, 876, 872, 0, 0, 0, 882, 0, 0, + 0, 0, 0, 0, 0, 1241, 0, 659, 1108, 0, + 0, 0, 1281, 0, 1056, 898, 911, 1033, 0, 1189, + 1112, 0, 1212, 1176, 939, 938, 940, 940, 1057, 0, + 1324, 1326, 0, 0, 0, 0, 1336, 0, 1059, 0, + 1230, 1180, 1182, 1337, 1093, 923, 987, 0, 0, 0, + 0, 0, 0, 0, 1040, 1030, 0, 1038, 1042, 0, + 0, 0, 1024, 0, 0, 1022, 1052, 1018, 0, 0, + 1053, 1294, 0, 1298, 0, 0, 1145, 1154, 777, 773, + 733, 664, 733, 0, 1519, 1541, 1538, 0, 638, 0, + 0, 1560, 0, 183, 0, 0, 0, 0, 0, 186, + 200, 197, 1559, 0, 0, 668, 670, 0, 1213, 678, + 672, 726, 725, 0, 688, 761, 686, 0, 767, 0, + 623, 0, 609, 0, 800, 0, 0, 1528, 1529, 0, + 0, 0, 0, 344, 0, 0, 0, 295, 0, 411, + 0, 418, 0, 0, 401, 380, 69, 68, 98, 0, 0, 0, 61, 117, 90, 82, 57, 96, 0, 0, 101, 0, 94, 111, 112, 110, 115, 0, 305, 330, 0, 0, 0, 341, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1579, 1565, 1578, - 1294, 1294, 1290, 0, 0, 0, 665, 1114, 0, 531, - 573, 570, 571, 0, 569, 249, 575, 409, 0, 0, - 0, 216, 396, 0, 0, 1417, 505, 508, 1399, 435, + 0, 0, 0, 0, 0, 0, 0, 1580, 1566, 1579, + 1295, 1295, 1291, 0, 0, 0, 666, 1115, 0, 532, + 574, 571, 572, 0, 570, 249, 576, 410, 0, 0, + 0, 216, 396, 0, 0, 1418, 506, 509, 1400, 436, 0, 227, 0, 231, 0, 0, 218, 399, 0, 372, - 382, 383, 362, 395, 366, 365, 367, 0, 1623, 242, - 0, 1617, 0, 208, 204, 399, 1416, 0, 0, 522, - 0, 525, 868, 512, 0, 517, 0, 0, 515, 0, - 1411, 276, 472, 1577, 556, 561, 0, 567, 563, 562, - 557, 565, 564, 560, 1124, 1135, 1258, 0, 0, 0, - 0, 849, 852, 0, 1130, 1125, 823, 0, 0, 732, - 0, 0, 0, 0, 643, 642, 648, 0, 0, 1147, - 0, 713, 818, 0, 0, 0, 805, 794, 800, 801, - 0, 0, 0, 861, 860, 831, 884, 0, 864, 884, - 0, 884, 882, 0, 0, 891, 979, 980, 981, 982, - 983, 984, 985, 916, 0, 1282, 1278, 1184, 1186, 1223, - 934, 932, 1057, 1326, 1319, 1322, 1228, 1330, 1332, 0, - 0, 0, 0, 1343, 0, 1178, 1344, 1364, 990, 0, - 0, 1020, 1275, 1042, 0, 0, 0, 1016, 1211, 0, - 0, 0, 0, 0, 1025, 0, 1301, 1294, 0, 1300, - 0, 0, 0, 0, 1119, 777, 749, 0, 749, 0, - 1286, 0, 633, 635, 638, 169, 1557, 0, 1552, 161, + 382, 383, 362, 395, 366, 365, 367, 0, 1624, 242, + 0, 1618, 0, 208, 204, 399, 1417, 0, 0, 523, + 0, 526, 869, 513, 0, 518, 0, 0, 516, 0, + 1412, 276, 473, 1578, 557, 562, 0, 568, 564, 563, + 558, 566, 565, 561, 1125, 1136, 1259, 0, 0, 0, + 0, 850, 853, 0, 1131, 1126, 824, 0, 0, 733, + 0, 0, 0, 0, 644, 643, 649, 0, 0, 1148, + 0, 714, 819, 0, 0, 0, 806, 795, 801, 802, + 0, 0, 0, 862, 861, 832, 885, 0, 865, 885, + 0, 885, 883, 0, 0, 892, 980, 981, 982, 983, + 984, 985, 986, 917, 0, 1283, 1279, 1185, 1187, 1224, + 935, 933, 1058, 1327, 1320, 1323, 1229, 1331, 1333, 0, + 0, 0, 0, 1344, 0, 1179, 1345, 1365, 991, 0, + 0, 1021, 1276, 1043, 0, 0, 0, 1017, 1212, 0, + 0, 0, 0, 0, 1026, 0, 1302, 1295, 0, 1301, + 0, 0, 0, 0, 1120, 778, 750, 0, 750, 0, + 1287, 0, 634, 636, 639, 169, 1558, 0, 1553, 161, 162, 163, 0, 0, 0, 178, 155, 0, 0, 0, - 195, 183, 171, 675, 676, 0, 670, 686, 1346, 1352, - 607, 0, 1089, 0, 0, 604, 0, 274, 147, 295, - 0, 0, 75, 0, 419, 356, 411, 393, 375, 0, - 0, 0, 296, 0, 436, 0, 0, 381, 0, 0, + 195, 183, 171, 676, 677, 0, 671, 687, 1347, 1353, + 608, 0, 1090, 0, 0, 605, 0, 274, 147, 295, + 0, 0, 75, 0, 420, 356, 412, 393, 375, 0, + 0, 0, 296, 0, 437, 0, 0, 381, 0, 0, 0, 0, 357, 0, 0, 316, 0, 0, 393, 0, 400, 312, 313, 0, 60, 91, 0, 87, 0, 116, - 0, 0, 0, 0, 0, 63, 86, 0, 58, 869, - 472, 472, 66, 407, 403, 406, 355, 0, 0, 143, - 1423, 0, 141, 0, 1421, 150, 148, 145, 1425, 1564, - 0, 0, 1117, 1118, 1115, 663, 0, 0, 0, 0, - 550, 538, 0, 0, 0, 1622, 203, 0, 0, 1734, - 0, 0, 230, 229, 219, 0, 1417, 215, 396, 0, - 427, 368, 869, 422, 0, 1622, 1620, 0, 0, 209, - 0, 207, 1417, 1616, 504, 507, 521, 524, 0, 0, - 0, 0, 590, 509, 0, 0, 0, 443, 566, 1081, - 0, 0, 0, 0, 703, 0, 709, 749, 647, 646, - 645, 644, 731, 1671, 1968, 1862, 0, 735, 730, 733, - 738, 740, 739, 741, 737, 748, 0, 751, 712, 842, - 1224, 1226, 0, 0, 0, 0, 806, 808, 0, 810, - 0, 862, 878, 0, 879, 0, 877, 883, 872, 1281, - 1324, 1333, 1334, 1329, 1338, 1340, 0, 0, 0, 987, - 1059, 1048, 1046, 1043, 0, 1044, 1024, 0, 0, 1022, - 1018, 0, 1053, 0, 0, 1298, 0, 1139, 0, 1142, - 1156, 1152, 1151, 1147, 1114, 1147, 1519, 631, 634, 0, - 182, 159, 185, 184, 0, 1295, 192, 0, 0, 183, - 0, 499, 500, 501, 183, 0, 187, 528, 0, 0, - 619, 798, 612, 613, 0, 415, 77, 0, 393, 0, - 295, 377, 376, 379, 374, 378, 0, 437, 0, 0, + 0, 0, 0, 0, 0, 63, 86, 0, 58, 870, + 473, 473, 66, 407, 403, 406, 355, 0, 0, 143, + 1424, 0, 141, 0, 1422, 150, 148, 145, 1426, 1565, + 0, 0, 1118, 1119, 1116, 664, 0, 0, 0, 0, + 551, 539, 0, 0, 0, 1623, 203, 0, 0, 1735, + 0, 0, 230, 229, 219, 0, 1418, 215, 396, 0, + 428, 368, 870, 423, 0, 1623, 1621, 0, 0, 209, + 0, 207, 1418, 1617, 505, 508, 522, 525, 0, 0, + 0, 0, 591, 510, 0, 0, 0, 444, 567, 1082, + 0, 0, 0, 0, 704, 0, 710, 750, 648, 647, + 646, 645, 732, 1672, 1969, 1863, 0, 736, 731, 734, + 739, 741, 740, 742, 738, 749, 0, 752, 713, 843, + 1225, 1227, 0, 0, 0, 0, 807, 809, 0, 811, + 0, 863, 879, 0, 880, 0, 878, 884, 873, 1282, + 1325, 1334, 1335, 1330, 1339, 1341, 0, 0, 0, 988, + 1060, 1049, 1047, 1044, 0, 1045, 1025, 0, 0, 1023, + 1019, 0, 1054, 0, 0, 1299, 0, 1140, 0, 1143, + 1157, 1153, 1152, 1148, 1115, 1148, 1520, 632, 635, 0, + 182, 159, 185, 184, 0, 1296, 192, 0, 0, 183, + 0, 500, 501, 502, 183, 0, 187, 529, 0, 0, + 620, 799, 613, 614, 0, 416, 77, 0, 393, 0, + 295, 377, 376, 379, 374, 378, 0, 438, 0, 0, 314, 0, 321, 359, 360, 358, 315, 393, 399, 317, 0, 0, 0, 83, 62, 59, 64, 84, 0, 0, - 85, 88, 863, 100, 93, 0, 78, 80, 0, 0, - 1292, 1291, 0, 534, 533, 572, 574, 530, 539, 249, - 0, 0, 0, 362, 1619, 0, 0, 0, 396, 0, - 232, 0, 0, 0, 1622, 0, 0, 0, 0, 361, - 340, 0, 337, 0, 235, 1621, 202, 205, 0, 0, - 0, 1608, 526, 527, 0, 0, 1409, 1410, 0, 1082, - 0, 1083, 853, 0, 0, 701, 1147, 0, 0, 0, - 742, 736, 0, 1146, 1148, 0, 698, 1227, 802, 0, - 804, 0, 828, 0, 828, 811, 873, 865, 1331, 1341, - 1342, 1337, 1137, 0, 1045, 1049, 1047, 1026, 1294, 1294, - 1302, 1299, 1141, 1155, 1158, 751, 1362, 751, 636, 630, - 0, 0, 170, 0, 0, 167, 154, 478, 0, 502, - 476, 172, 1213, 609, 610, 0, 295, 0, 392, 416, - 326, 304, 0, 0, 0, 311, 318, 426, 320, 0, - 92, 108, 1377, 2037, 2038, 2039, 2040, 2041, 2042, 2043, - 2044, 2045, 2046, 2047, 2048, 2049, 2050, 2051, 2052, 2053, - 2054, 2055, 2056, 2174, 2057, 302, 2058, 1805, 2059, 2060, - 2061, 2062, 2063, 0, 2064, 867, 2065, 2066, 2254, 2067, - 2068, 1196, 1197, 301, 300, 405, 297, 412, 299, 0, - 1378, 298, 151, 149, 1116, 550, 0, 221, 1417, 368, - 1616, 0, 0, 0, 0, 362, 242, 1618, 353, 346, + 85, 88, 864, 100, 93, 0, 78, 80, 0, 0, + 1293, 1292, 0, 535, 534, 573, 575, 531, 540, 249, + 0, 0, 0, 362, 1620, 0, 0, 0, 396, 0, + 232, 0, 0, 0, 1623, 0, 0, 0, 0, 361, + 340, 0, 337, 0, 235, 1622, 202, 205, 0, 0, + 0, 1609, 527, 528, 0, 0, 1410, 1411, 0, 1083, + 0, 1084, 854, 0, 0, 702, 1148, 0, 0, 0, + 743, 737, 0, 1147, 1149, 0, 699, 1228, 803, 0, + 805, 0, 829, 0, 829, 812, 874, 866, 1332, 1342, + 1343, 1338, 1138, 0, 1046, 1050, 1048, 1027, 1295, 1295, + 1303, 1300, 1142, 1156, 1159, 752, 1363, 752, 637, 631, + 0, 0, 170, 0, 0, 167, 154, 479, 0, 503, + 477, 172, 1214, 610, 611, 0, 295, 0, 392, 417, + 326, 304, 0, 0, 0, 311, 318, 427, 320, 0, + 92, 108, 1378, 2038, 2039, 2040, 2041, 2042, 2043, 2044, + 2045, 2046, 2047, 2048, 2049, 2050, 2051, 2052, 2053, 2054, + 2055, 2056, 2057, 2175, 2058, 302, 2059, 1806, 2060, 2061, + 2062, 2063, 2064, 0, 2065, 868, 2066, 2067, 2255, 2068, + 2069, 1197, 1198, 301, 300, 405, 297, 413, 299, 0, + 1379, 298, 151, 149, 1117, 551, 0, 221, 1418, 368, + 1617, 0, 0, 0, 0, 362, 242, 1619, 353, 346, 347, 348, 349, 350, 351, 352, 371, 370, 0, 0, - 292, 338, 339, 210, 0, 0, 0, 0, 510, 1411, - 0, 189, 198, 0, 189, 1084, 704, 0, 751, 0, - 0, 0, 734, 0, 0, 750, 0, 595, 1225, 0, - 793, 791, 0, 792, 1339, 0, 0, 0, 0, 665, - 698, 698, 156, 0, 157, 193, 0, 0, 0, 0, - 0, 497, 399, 418, 391, 0, 384, 324, 323, 325, + 292, 338, 339, 210, 0, 0, 0, 0, 511, 1412, + 0, 189, 198, 0, 189, 1085, 705, 0, 752, 0, + 0, 0, 735, 0, 0, 751, 0, 596, 1226, 0, + 794, 792, 0, 793, 1340, 0, 0, 0, 0, 666, + 699, 699, 156, 0, 157, 193, 0, 0, 0, 0, + 0, 498, 399, 419, 391, 0, 384, 324, 323, 325, 329, 0, 327, 0, 343, 0, 336, 304, 0, 95, - 1377, 0, 0, 529, 537, 0, 340, 1610, 396, 0, - 220, 1616, 368, 1622, 0, 0, 1616, 0, 1613, 0, - 0, 0, 0, 191, 1417, 0, 191, 0, 698, 744, - 0, 743, 1150, 1149, 700, 803, 0, 1138, 1304, 1303, - 0, 1162, 594, 593, 0, 0, 0, 0, 477, 0, - 0, 478, 426, 0, 369, 0, 0, 326, 0, 319, - 423, 424, 425, 0, 332, 322, 333, 89, 107, 0, - 0, 0, 294, 396, 1611, 340, 236, 0, 0, 1609, - 1614, 1615, 0, 189, 188, 674, 190, 858, 199, 674, - 708, 596, 745, 697, 809, 1157, 0, 0, 0, 0, - 0, 166, 858, 177, 0, 486, 0, 493, 164, 164, - 494, 495, 496, 0, 336, 390, 385, 303, 328, 342, - 0, 0, 0, 334, 0, 335, 0, 413, 1616, 293, - 363, 364, 0, 191, 677, 1407, 677, 1954, 1672, 1919, - 0, 1174, 1163, 1174, 1174, 1154, 158, 165, 0, 490, - 491, 492, 0, 0, 482, 0, 0, 485, 0, 295, - 308, 0, 307, 0, 402, 331, 414, 1612, 1417, 674, - 179, 180, 0, 1167, 1166, 1165, 1169, 1168, 0, 1161, - 1159, 1160, 858, 489, 0, 481, 488, 0, 484, 483, - 498, 420, 306, 310, 309, 858, 677, 0, 0, 1171, - 0, 1172, 176, 479, 0, 1408, 181, 1164, 1170, 1173, - 0, 487 + 1378, 0, 0, 530, 538, 0, 340, 1611, 396, 0, + 220, 1617, 368, 1623, 0, 0, 1617, 0, 1614, 0, + 0, 0, 0, 191, 1418, 0, 191, 0, 699, 745, + 0, 744, 1151, 1150, 701, 804, 0, 1139, 1305, 1304, + 0, 1163, 595, 594, 0, 0, 0, 0, 478, 0, + 0, 479, 427, 0, 369, 0, 0, 326, 0, 319, + 424, 425, 426, 0, 332, 322, 333, 89, 107, 0, + 0, 0, 294, 396, 1612, 340, 236, 0, 0, 1610, + 1615, 1616, 0, 189, 188, 675, 190, 859, 199, 675, + 709, 597, 746, 698, 810, 1158, 0, 0, 0, 0, + 0, 166, 859, 177, 0, 487, 0, 494, 164, 164, + 495, 496, 497, 0, 336, 390, 385, 303, 328, 342, + 0, 0, 0, 334, 0, 335, 0, 414, 1617, 293, + 363, 364, 0, 191, 678, 1408, 678, 1955, 1673, 1920, + 0, 1175, 1164, 1175, 1175, 1155, 158, 165, 0, 491, + 492, 493, 0, 0, 483, 0, 0, 486, 0, 295, + 308, 0, 307, 0, 402, 331, 415, 1613, 1418, 675, + 179, 180, 0, 1168, 1167, 1166, 1170, 1169, 0, 1162, + 1160, 1161, 859, 490, 0, 482, 489, 0, 485, 484, + 499, 421, 306, 310, 309, 859, 678, 0, 0, 1172, + 0, 1173, 176, 480, 0, 1409, 181, 1165, 1171, 1174, + 0, 488 }; /* YYDEFGOTO[NTERM-NUM]. */ @@ -4571,7 +4571,7 @@ static const yytype_int16 yypgoto[] = positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -2188 +#define YYTABLE_NINF -2189 static const yytype_int16 yytable[] = { 536, 1270, 934, 1162, 1230, 887, 57, 53, 72, 732, @@ -4588,29 +4588,29 @@ static const yytype_int16 yytable[] = 1034, 915, 2759, 1002, 2348, 1657, 1059, 61, 3137, 993, 2871, 2592, 2593, 2967, 2248, 3040, 1290, 64, 67, 3045, 929, 2428, 2599, 2423, 68, 866, 2603, 832, 832, 1619, - 1620, 2393, 2561, 69, 2424, 1415, 2297, 1080, -1433, 2202, - -510, 82, 2385, 3237, 548, 3370, 1379, 1633, 2582, 2583, + 1620, 2393, 2561, 69, 2424, 1415, 2297, 1080, -1434, 2202, + -511, 82, 2385, 3237, 548, 3370, 1379, 1633, 2582, 2583, 2584, 2300, 834, 834, 2715, 83, 1379, -399, 1080, 3642, - 85, -2026, 86, -936, 92, 2125, -1355, -936, 93, 95, - 100, -577, -581, 104, 877, 106, 2836, 3234, -2160, -2160, - 2837, -1374, 2820, 2831, 836, -2026, 1460, -1374, 2829, 1081, - 1812, -2017, -2017, -2174, -2174, -1371, -1371, -2034, 2808, -2165, - -2165, -2034, 2032, 901, 902, -1375, 2845, 2033, 1081, -2183, - -2183, 3354, 3772, -1372, -1372, 836, 891, 1175, -939, 1080, - -1375, 1674, -931, -898, -911, -926, 1664, 2339, 2811, 836, - 836, 3374, -1194, 1003, 2974, -939, 14, 15, 1729, -540, - -1194, 2192, -2185, -2185, 1281, 2928, 825, 1878, 1677, 1653, + 85, -2027, 86, -937, 92, 2125, -1356, -937, 93, 95, + 100, -578, -582, 104, 877, 106, 2836, 3234, -2161, -2161, + 2837, -1375, 2820, 2831, 836, -2027, 1460, -1375, 2829, 1081, + 1812, -2018, -2018, -2175, -2175, -1372, -1372, -2035, 2808, -2166, + -2166, -2035, 2032, 901, 902, -1376, 2845, 2033, 1081, -2184, + -2184, 3354, 3772, -1373, -1373, 836, 891, 1175, -940, 1080, + -1376, 1674, -932, -899, -912, -927, 1664, 2339, 2811, 836, + 836, 3374, -1195, 1003, 2974, -940, 14, 15, 1729, -541, + -1195, 2192, -2186, -2186, 1281, 2928, 825, 1878, 1677, 1653, 2192, 3429, 1404, 1679, 1725, 1395, 836, 3740, 1879, 1752, 1080, 1181, 549, 1395, 3521, 836, 3461, 1290, 1080, 111, - 2231, 3304, -577, -581, -249, 1991, 1379, 3287, 2232, -249, + 2231, 3304, -578, -582, -249, 1991, 1379, 3287, 2232, -249, 1993, 897, 1028, 23, 1687, 3550, 1815, 1059, 3596, 3519, 2631, 3351, 2887, 2889, 116, 2892, 3319, 3136, 2854, 1034, - 825, 825, -726, 1624, 3725, 1182, 3371, 1831, 892, 3315, + 825, 825, -727, 1624, 3725, 1182, 3371, 1831, 892, 3315, 1026, 2031, 1677, 2310, 3529, 3726, 1678, 1679, 1689, 1991, 1635, 3372, 1846, 1992, 1993, 1849, 1850, 3727, 897, 1179, 2898, 3794, 3627, 2457, 3813, 1002, 1404, 3, 4, 1404, - 1404, 2083, 1881, 1748, -1215, 1409, 3709, 2571, 1687, 2031, - 1035, 2241, -1215, 3680, 1370, 1284, 1677, 891, 836, 1802, + 1404, 2083, 1881, 1748, -1216, 1409, 3709, 2571, 1687, 2031, + 1035, 2241, -1216, 3680, 1370, 1284, 1677, 891, 836, 1802, 1678, 1679, 2272, 3646, 2909, 1798, 1799, 3818, 3555, 1726, 1991, 1763, 1677, 1824, 1992, 1993, 974, 3716, 3556, 117, 546, 3723, 1689, 1493, 1864, 3156, 3055, 2529, 1500, 1677, @@ -4621,56 +4621,56 @@ static const yytype_int16 yytable[] = 26, 27, 28, 3694, 1222, 3379, 2568, 2562, 3699, 2772, 3537, 3666, 1689, 112, 3435, 3819, 3437, 2273, 1380, 892, 1817, 1857, 1064, 3789, 113, 3539, 1958, 3621, 1380, 1689, - 803, 1080, 1348, 1065, 3540, 3827, -577, -581, 2589, 3097, + 803, 1080, 1348, 1065, 3540, 3827, -578, -582, 2589, 3097, 3034, 3302, 1560, 1649, 3316, 1183, 3085, 1184, 1959, 1961, 2604, 1217, 1764, 1176, 2604, 118, 2203, 2899, 3541, 3036, 893, 114, 3681, 3795, 1036, 1727, 3632, 33, 1989, 1990, 2420, 3814, 3753, 3054, 2010, 2242, 73, 3174, 35, 1749, 3126, 1882, 1884, 1643, 2625, 2204, 3456, 3373, 3533, 1833, 2959, 3597, 2759, 3626, 2759, 3446, 73, 878, 1499, 824, - 3450, 2304, 37, 1833, 1637, 3466, 38, 3717, -577, -581, + 3450, 2304, 37, 1833, 1637, 3466, 38, 3717, -578, -582, 3820, 3692, 2613, 73, 115, 2412, 3752, 3557, 949, 2763, 3787, 2573, 886, 3648, 1285, 3157, 804, 2626, 3780, 2080, - 1177, 2650, 3542, 3086, 3724, 1384, 3718, -480, 2813, 2814, + 1177, 2650, 3542, 3086, 3724, 1384, 3718, -481, 2813, 2814, 2815, 40, 1818, 1074, 2928, 3543, 1372, 3568, 1380, 3682, 2200, 3348, 43, 824, 824, 903, 1619, 1620, 732, 1747, 1668, 2607, 1751, 2821, 2822, 3396, 1871, 2311, 3741, 44, - 971, 3462, 3521, 3147, 932, 3141, -1194, 2023, 933, 73, + 971, 3462, 3521, 3147, 932, 3141, -1195, 2023, 933, 73, 3749, 1633, 3119, 3164, 1381, 2149, 550, 3165, 2405, 2193, 3305, 3376, 3773, 45, 1384, 3584, 3695, 3519, 2683, 983, 1739, 2040, 2653, 2205, 1948, 569, 2119, 46, 2409, 835, 1952, 763, 2297, 2207, 2233, 3729, 2704, 3328, 3329, 2896, 2922, 2807, 841, 2064, 3178, 2986, 2733, 2838, 2508, 2848, - 2722, -577, -581, 3453, 1862, 2202, 884, 884, 3454, -1433, - 2841, -510, -510, 2131, 2132, 1949, 2942, 2247, 1384, 2728, - 2910, 2911, 2912, 2913, -2026, 1344, -936, 932, -399, -1355, - 3418, 933, 1630, 1621, 1615, 975, 1373, -868, 894, 3821, - -577, -581, -577, -581, -1374, 1638, 2124, 2823, -2026, 3696, - -1374, 3332, 1124, 1125, -2017, -2017, 1630, 887, -1215, 2155, - -2034, 2156, 1638, 1805, -2034, 2827, 3776, 1639, -1375, 1002, + 2722, -578, -582, 3453, 1862, 2202, 884, 884, 3454, -1434, + 2841, -511, -511, 2131, 2132, 1949, 2942, 2247, 1384, 2728, + 2910, 2911, 2912, 2913, -2027, 1344, -937, 932, -399, -1356, + 3418, 933, 1630, 1621, 1615, 975, 1373, -869, 894, 3821, + -578, -582, -578, -582, -1375, 1638, 2124, 2823, -2027, 3696, + -1375, 3332, 1124, 1125, -2018, -2018, 1630, 887, -1216, 2155, + -2035, 2156, 1638, 1805, -2035, 2827, 3776, 1639, -1376, 1002, 1865, 1124, 1125, 932, 920, 1956, 2812, 1665, 1672, 2116, - 1653, 1640, 1800, -1375, 1639, -931, 1622, 1627, -926, 1653, + 1653, 1640, 1800, -1376, 1639, -932, 1622, 1627, -927, 1653, 2175, 1001, 1722, 2249, 1290, 2173, 1290, 1022, 1642, 3430, 1856, 1710, 2029, 1624, 2152, 1801, 2421, 2800, 874, 887, 1399, 1400, 3781, 3027, 3633, 3731, 79, 799, 1399, 1400, 1185, 3127, 3544, 1635, 1857, 3545, 998, 895, 2008, -249, -249, 2542, 536, 1520, 3398, 3295, 2174, 3607, 3313, 3732, - 2208, 3625, -665, 536, 1005, 1040, 854, -665, 1215, 836, + 2208, 3625, -666, 536, 1005, 1040, 854, -666, 1215, 836, 536, 2209, 880, 1216, 2405, 961, 1851, 3272, 2107, 1760, 1705, 1706, 1707, 1708, 1709, 1710, 534, 2003, 2004, 2005, - 2006, 2007, 2008, 3006, -868, 3008, 1063, 534, 904, 536, + 2006, 2007, 2008, 3006, -869, 3008, 1063, 534, 904, 536, 536, 890, 2523, 905, 534, 1521, 3286, 2524, 2333, 110, 2339, 2054, 2569, 1180, 962, 2296, 2296, 3273, 896, 832, 3782, 1171, 3608, 536, 895, 3020, 1707, 1708, 1709, 1710, - 832, 3007, 1180, 2071, 3314, 889, 3182, 832, 3134, -665, + 832, 3007, 1180, 2071, 3314, 889, 3182, 832, 3134, -666, 2005, 2006, 2007, 2008, 834, 1217, 57, 53, 72, 3783, 66, 2840, 1231, 84, 105, 834, 1186, 2569, 70, 79, 101, 3352, 834, 71, 96, 2333, 2872, 2525, 855, 2334, 838, 906, 2372, 2373, 3288, 536, 732, 3707, 552, 1337, - 536, 3021, 3365, 2376, 1331, -746, 2379, 1404, 3447, 1195, - -665, 14, 15, 23, 1638, 896, 1218, 1404, 2543, 897, + 536, 3021, 3365, 2376, 1331, -747, 2379, 1404, 3447, 1195, + -666, 14, 15, 23, 1638, 896, 1218, 1404, 2543, 897, 1404, 907, 2195, 3362, 965, 111, 1025, 2693, 2544, 866, - 866, 909, 866, 2576, 866, 3448, 1639, 2826, -2159, -2159, + 866, 909, 866, 2576, 866, 3448, 1639, 2826, -2160, -2160, 2929, 3244, 50, 2325, 1852, 1209, 2756, 51, 2398, 2399, 2400, 52, 1337, 2498, 3366, 1853, 55, 2434, 23, 3058, 56, 2507, 553, 1001, 2769, 2509, 59, 887, 2511, 60, @@ -4682,20 +4682,20 @@ static const yytype_int16 yytable[] = 2553, 2554, 3187, 1024, 2149, 83, 3459, 536, 1337, 1607, 85, 2766, 86, 534, 92, 534, 73, 3101, 93, 95, 100, 3815, 2977, 104, 534, 106, 2708, 1210, 3059, 536, - 1900, 928, 887, 3622, 1766, 3442, 1505, 3113, 3068, -664, - 26, 27, 28, 107, -664, 2705, 832, 2706, 832, 536, + 1900, 928, 887, 3622, 1766, 3442, 1505, 3113, 3068, -665, + 26, 27, 28, 107, -665, 2705, 832, 2706, 832, 536, 1393, 1042, 2709, 1394, 898, 2770, 1043, 832, 1243, 2014, 2203, 536, 536, 536, 1244, 536, 536, 2374, 732, 1901, 3064, 834, 2377, 834, 1009, 1668, 2039, 1862, 1215, 112, 1658, 3071, 834, 1767, 1012, 26, 27, 28, 2739, 2204, 113, 3662, 3663, 1670, 108, 2791, 3065, 3060, 2816, 3061, 937, 536, 1041, 1673, 1243, 1766, 3356, 33, 2792, 2117, - 1244, 836, 1824, 2567, 1045, 1044, -664, 3390, 2123, 536, + 1244, 836, 1824, 2567, 1045, 1044, -665, 3390, 2123, 536, 536, 930, 1496, 1825, 1025, 1723, 938, 114, 3367, 2620, - 557, 898, 992, 1512, 1728, 3689, -2026, 1754, 1755, 3254, + 557, 898, 992, 1512, 1728, 3689, -2027, 1754, 1755, 3254, 1761, 1180, 905, 905, 1180, 905, 38, 2215, 969, 3711, 1046, 2801, 33, 120, 1767, 1217, 536, 547, 560, 1904, - 536, 536, 3603, 35, 936, 762, 1506, -664, 1638, 1245, + 536, 536, 3603, 35, 936, 762, 1506, -665, 1638, 1245, 536, 536, 536, 1045, 3347, 536, 948, 1048, 1638, 853, 115, 40, 955, 867, 1657, 2668, 2669, 37, 1045, 1243, 1639, 38, 43, 939, 3690, 1244, 1226, 1432, 1433, 1607, @@ -4707,9 +4707,9 @@ static const yytype_int16 yytable[] = 967, 1048, 1827, 2522, 44, 3342, 3746, 2526, 1508, 1737, 2528, 3296, 1738, 1947, 1515, 2022, 941, 2024, 2025, 1770, 1953, 1337, 2216, 1954, 1769, 1011, 1169, 1170, 45, 1172, - 2771, 1174, 2772, -2154, -2154, 2671, 1023, 1049, 2703, 2217, + 2771, 1174, 2772, -2155, -2155, 2671, 1023, 1049, 2703, 2217, 972, 932, 46, 1039, 2218, 933, 1835, 2701, 3076, 1836, - 1245, 932, 2449, -1355, 2450, 933, 1908, 973, 1227, 1052, + 1245, 932, 2449, -1356, 2450, 933, 1908, 973, 1227, 1052, 1909, 732, 2773, 1911, 1912, 932, 3077, 1438, 1439, 1665, 732, 2732, 2732, 1941, 951, 3230, 952, 2235, 1507, 2826, 1246, 2236, 1513, 2219, 1050, 976, 1518, 1001, 903, 978, @@ -4719,7 +4719,7 @@ static const yytype_int16 yytable[] = 2418, 1962, 998, 1010, 2208, 2674, 1246, 2517, 2923, 3183, 2518, 2555, 2930, 1052, 2556, 2209, 1613, 1507, 46, 1837, 1247, 1424, 1425, 1009, 1248, 1243, 942, 2605, 2149, 1013, - 2606, 1244, 1053, 2608, -2155, -2155, 2606, 943, 2742, 536, + 2606, 1244, 1053, 2608, -2156, -2156, 2606, 943, 2742, 536, 536, 2449, 1016, 2450, 2109, 536, 2659, 536, 2786, 1017, 3078, 2787, 536, 536, 536, 536, 1249, 1860, 2793, 2809, 3079, 2794, 2518, 2577, 1018, 2578, 1273, 536, 536, 2579, @@ -4732,8 +4732,8 @@ static const yytype_int16 yytable[] = 534, 1250, 824, 2676, 1023, 1212, 1245, 1214, 1838, 834, 1246, 1833, 1029, 824, 832, 2939, 832, 1061, 2940, 832, 2339, 1277, 1607, 1066, 832, 1248, 2457, 832, 2941, 832, - 1071, 2940, 1072, 832, 2960, 2961, 3826, -2156, -2156, 834, - 3130, 834, 1074, 1835, 834, -2157, -2157, 1250, 1614, 834, + 1071, 2940, 1072, 832, 2960, 2961, 3826, -2157, -2157, 834, + 3130, 834, 1074, 1835, 834, -2158, -2158, 1250, 1614, 834, 3822, 3087, 834, 3096, 834, 536, 536, 1278, 834, 553, 1626, 1245, 1075, 3825, 536, 536, 2108, 2112, 1173, 3623, 3586, 3587, 3028, 536, 1248, 3029, 1833, 2110, 79, 2115, @@ -4742,48 +4742,48 @@ static const yytype_int16 yytable[] = 2062, 3145, 1200, 2065, 2947, 2066, 1249, 536, 732, 2070, 1201, 1836, 536, 2948, 2950, 536, 2949, 2951, 2952, 1203, 1607, 536, 536, 536, 536, 536, 536, 536, 536, 732, - -2161, -2161, 1250, 536, 536, 536, 3146, 3184, 536, 2418, - 3185, 2189, 536, -2162, -2162, 536, 536, 536, 536, 536, - 536, 536, 536, 536, -2163, -2163, 536, 2943, 2944, 1204, + -2162, -2162, 1250, 536, 536, 536, 3146, 3184, 536, 2418, + 3185, 2189, 536, -2163, -2163, 536, 536, 536, 536, 536, + 536, 536, 536, 536, -2164, -2164, 536, 2943, 2944, 1204, 2677, 1835, 1256, 536, 1206, 1337, 1213, 1246, 1232, 534, - 1331, 2678, -2164, -2164, 1867, 2990, 2991, 903, 903, 1235, - 903, 1250, 1257, 536, -2166, -2166, 1237, 825, 2279, 825, - 1238, 2250, 825, 905, 1346, -2167, -2167, 825, 2728, 1245, + 1331, 2678, -2165, -2165, 1867, 2990, 2991, 903, 903, 1235, + 903, 1250, 1257, 536, -2167, -2167, 1237, 825, 2279, 825, + 1238, 2250, 825, 905, 1346, -2168, -2168, 825, 2728, 1245, 825, 1837, 825, 3517, 959, 1239, 825, 2244, 536, 1068, 1069, 1070, 3245, 1241, 1073, 2106, 1186, 1240, 3337, 536, - 536, 2275, 1246, 2882, -2168, -2168, 1242, 2324, 1258, 1836, + 536, 2275, 1246, 2882, -2169, -2169, 1242, 2324, 1258, 1836, 3391, 1248, 3392, 2106, 3424, 2606, 3431, 2106, 3443, 2080, 1254, 3444, 1255, 3527, 1272, 3528, 3145, 557, 2418, 992, 3565, 3630, 116, 2106, 3145, 1838, 3644, 3674, 3722, 3645, 3675, 3645, 1607, 1249, 3788, 2319, 2321, 3645, 2173, 1276, - 3823, 1282, 732, 3444, 1340, 560, 732, 960, 884, -2169, - -2169, 1280, 2380, 1343, 2354, 1344, 1248, 1349, 2361, -2170, - -2170, 1354, 1870, 1366, 2360, -2171, -2171, -2172, -2172, 1368, - 1079, 1369, 3095, 1991, -2173, -2173, 1376, 1992, 1993, -2175, - -2175, 1377, 1994, 1995, 1996, 959, 1383, 732, 2381, 1837, + 3823, 1282, 732, 3444, 1340, 560, 732, 960, 884, -2170, + -2170, 1280, 2380, 1343, 2354, 1344, 1248, 1349, 2361, -2171, + -2171, 1354, 1870, 1366, 2360, -2172, -2172, -2173, -2173, 1368, + 1079, 1369, 3095, 1991, -2174, -2174, 1376, 1992, 1993, -2176, + -2176, 1377, 1994, 1995, 1996, 959, 1383, 732, 2381, 1837, 536, 1386, 552, 1833, 1387, 1259, 1392, 1337, 11, 1963, - 536, 536, 2392, 1410, 1835, -2176, -2176, 1411, 1250, 1487, - 3044, 1079, -2177, -2177, 1991, 1416, 1835, -1419, 1992, 1993, + 536, 536, 2392, 1410, 1835, -2177, -2177, 1411, 1250, 1487, + 3044, 1079, -2178, -2178, 1991, 1416, 1835, -1420, 1992, 1993, 2410, 2410, 1474, 1994, 1995, 1996, 14, 15, 1489, 73, - 1246, -2178, -2178, -2179, -2179, 1596, 3125, 1501, 1607, 3138, + 1246, -2179, -2179, -2180, -2180, 1596, 3125, 1501, 1607, 3138, 2979, 1497, 2499, 1838, 2498, 1490, 1260, 3162, 3177, 961, - 1509, 2453, 3107, -2180, -2180, 1510, 553, 1261, 960, 3179, - 732, 3564, 1516, 1250, -2182, -2182, -590, 1337, 536, 1262, - -2184, -2184, 1836, 23, -2187, -2187, 536, 1887, 1888, 2298, - 2299, -590, 1517, 3256, 1836, 1523, -590, 1527, 962, 1609, - 2387, 1529, 1607, 1610, 1248, 1612, 536, 536, -902, 536, - 2521, 1263, -721, -721, 1607, 536, 536, 536, 536, 536, + 1509, 2453, 3107, -2181, -2181, 1510, 553, 1261, 960, 3179, + 732, 3564, 1516, 1250, -2183, -2183, -591, 1337, 536, 1262, + -2185, -2185, 1836, 23, -2188, -2188, 536, 1887, 1888, 2298, + 2299, -591, 1517, 3256, 1836, 1523, -591, 1527, 962, 1609, + 2387, 1529, 1607, 1610, 1248, 1612, 536, 536, -903, 536, + 2521, 1263, -722, -722, 1607, 536, 536, 536, 536, 536, 536, 1833, 2433, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 3754, 3068, 963, 2388, 3756, 536, 536, - 3069, -909, 536, 1621, 1607, 2798, 1950, -590, 1951, 536, - 824, 1607, 824, 3070, -899, 824, 3223, 2802, 1625, 964, - 824, -725, -725, 824, 46, 824, 1265, -746, -590, 824, - 1900, -747, 1837, 536, -724, -724, -900, 3071, 1636, 3072, - 536, -903, 536, 1637, 1837, -901, 536, 1659, 965, 1434, + 3069, -910, 536, 1621, 1607, 2798, 1950, -591, 1951, 536, + 824, 1607, 824, 3070, -900, 824, 3223, 2802, 1625, 964, + 824, -726, -726, 824, 46, 824, 1265, -747, -591, 824, + 1900, -748, 1837, 536, -725, -725, -901, 3071, 1636, 3072, + 536, -904, 536, 1637, 1837, -902, 536, 1659, 965, 1434, 1435, 1266, 1438, 1439, 1644, 1607, 1998, 3168, 3169, 1607, 1669, 536, 1671, 1337, 1716, 1607, 3292, 3293, 1718, 1901, - 1720, 1250, 1268, 1732, 534, 1740, 2728, 3816, 1741, -590, - 534, 3517, 3774, 3777, 2874, 2876, 1838, 1750, -590, 1607, + 1720, 1250, 1268, 1732, 534, 1740, 2728, 3816, 1741, -591, + 534, 3517, 3774, 3777, 2874, 2876, 1838, 1750, -591, 1607, 26, 27, 28, 1835, 1745, 1596, 1753, 1998, 1838, 3763, 3764, 536, 536, 3312, 3525, 1216, 1902, 832, 536, 3800, 3801, 1733, 1734, 832, 557, 73, 992, 2747, 2748, 1218, @@ -4799,26 +4799,26 @@ static const yytype_int16 yytable[] = 2019, 2057, 3389, 2050, 2063, 2067, 2030, 39, 536, 732, 2068, 1615, 2078, 1982, 2806, 536, 1985, 1988, 536, 2011, 2088, 40, 2119, 3580, 2452, 534, 2081, 2020, 2027, 2052, - 2053, 2069, 43, -590, 536, 3564, 2086, 2075, 536, 1622, + 2053, 2069, 43, -591, 536, 3564, 2086, 2075, 536, 1622, 1080, 1837, 2153, 1258, 3076, 23, 2154, 1627, 536, 44, 552, 2082, 534, 2084, 2085, 2083, 2118, 1677, 903, 2158, 2162, 2167, 3077, 2168, 2165, 536, 536, 2169, 534, 552, - 825, 2191, 534, 45, 1245, -1419, 825, -590, 2211, 2170, + 825, 2191, 534, 45, 1245, -1420, 825, -591, 2211, 2170, 2212, 2214, 536, 2238, 536, 832, 2239, 46, 2245, 26, - 27, 28, -590, 2257, -1419, 1838, 2258, -590, 2259, 536, + 27, 28, -591, 2257, -1420, 1838, 2258, -591, 2259, 536, 2260, 832, 896, 932, 2261, 832, 1199, 933, 2275, 2265, 834, 2278, 3310, 732, 553, 2288, 2289, 2287, 2292, 2309, 2290, 2291, 732, 732, 732, 2313, 834, 2314, 2317, 2322, 834, 2326, 2330, 553, 2354, 2354, 2354, 2000, 2001, 2002, - 1259, 2003, 2004, 2005, 2006, 2007, 2008, 2788, -590, 2332, + 1259, 2003, 2004, 2005, 2006, 2007, 2008, 2788, -591, 2332, 2340, 2358, 2331, 2359, 2364, 2365, 33, 897, 2403, 2415, - 3467, 2401, 2402, 1833, 2435, 2425, 3078, 2436, 536, -590, + 3467, 2401, 2402, 1833, 2435, 2425, 3078, 2436, 536, -591, 554, 2419, 2437, 2438, 2439, 2440, 3079, 1337, 2000, 2001, 2002, 2717, 2003, 2004, 2005, 2006, 2007, 2008, 2454, 991, 555, 1260, 26, 27, 28, 38, 2458, 1959, 1961, 2461, 2459, 2500, 1261, 2501, 1404, 2503, 2502, 2824, 1596, 1908, 732, 1862, 2504, 1909, 1262, 1607, 1911, 1912, 2506, 73, - -590, 2510, 2842, 2519, 2016, 1991, 2329, 2527, 2557, -590, + -591, 2510, 2842, 2519, 2016, 1991, 2329, 2527, 2557, -591, 40, 3022, 2015, 2564, 2565, 1246, 2566, 2343, 2586, 2346, 2574, 43, 2357, 2570, 2575, 2598, 1263, 2610, 2596, 556, 2612, 2617, 2366, 2618, 2368, 2619, -224, 2621, 825, 33, @@ -4829,64 +4829,64 @@ static const yytype_int16 yytable[] = 2665, 1265, 557, 1963, 558, 2667, 1596, 2679, 2688, 2689, 2694, 2884, 1256, 2885, 3569, 2695, 3571, 2890, 2696, 2893, 2173, 557, 2712, 992, 2707, 2714, 1266, 559, 2715, 536, - 560, 1267, 1257, 40, 1604, 2721, 3579, 552, 2737, -727, + 560, 1267, 1257, 40, 1604, 2721, 3579, 552, 2737, -728, 2724, 2735, 2741, 2734, 43, 2738, 559, 1268, 2723, 560, 2745, 2746, 1805, 824, 2752, 2749, 2750, 2755, 2758, 824, 2754, 44, 2779, 534, 2790, 2781, 2795, 2797, 2833, 2796, - -1907, 536, 2803, 2817, 2804, 2805, 2818, 3581, 1258, 3583, - 1959, 1961, 2832, 2834, -590, 45, 2839, 1607, 2852, 2853, + -1908, 536, 2803, 2817, 2804, 2805, 2818, 3581, 1258, 3583, + 1959, 1961, 2832, 2834, -591, 45, 2839, 1607, 2852, 2853, 2856, 2857, 2860, 887, 1180, 1079, 832, 2867, 1991, 46, - 2879, 553, 1992, 1993, 536, 2886, 1250, -2188, -2188, -2188, + 2879, 553, 1992, 1993, 536, 2886, 1250, -2189, -2189, -2189, 2894, 536, 536, 2863, 2897, 1833, 2900, 2917, 2903, 2918, 2904, 834, 3023, 2905, 2906, 2920, 2921, 536, 887, 2931, 2932, 2956, 3715, 2937, 26, 27, 28, 2945, 2953, 2984, 536, 1730, 2963, 536, 3672, 536, 2997, 2964, 1596, 3091, 3003, 2982, 1607, 536, 932, 1598, 536, 536, 933, 2985, 3014, 536, 536, 3041, 3037, 2998, 2133, 2988, 536, 3661, - 3676, -1907, 3000, 2134, 2135, 1259, 3005, 555, 2136, 2137, + 3676, -1908, 3000, 2134, 2135, 1259, 3005, 555, 2136, 2137, 2138, 3009, 3043, 3015, 3017, 536, 3035, 3050, 3039, 3056, 3057, 3063, 3083, 3122, 1655, 3123, 536, 3124, 3149, 3099, 3128, 33, 3132, 3133, 3026, 3148, 3154, 3158, 3170, 3656, - 3171, 2418, 3180, 3181, 2199, 3186, 536, 3206, 3209, -1907, + 3171, 2418, 3180, 3181, 2199, 3186, 536, 3206, 3209, -1908, 3175, 3213, 3217, 3227, 1604, 3228, 1260, 3231, 3232, 3257, - 2690, 3264, 3267, 3268, -1907, 3271, 1346, 1261, 3278, -1907, - 38, 824, 1404, -224, -1907, 3289, 3280, 3285, 3290, 1262, - 3303, 3697, 3698, -1907, 1596, 3291, 3297, 824, -1907, 3299, + 2690, 3264, 3267, 3268, -1908, 3271, 1346, 1261, 3278, -1908, + 38, 824, 1404, -224, -1908, 3289, 3280, 3285, 3290, 1262, + 3303, 3697, 3698, -1908, 1596, 3291, 3297, 824, -1908, 3299, 732, 824, 3298, 536, 536, 732, 3307, 732, 536, 536, 3308, 3320, 2354, 3317, 3322, 40, 3323, 3105, 3327, 2361, 3309, 1263, 3335, 536, 536, 2360, 43, 3336, 3338, 557, - -1907, 558, 3339, 3340, 3341, 3355, 536, 3343, 3357, 3344, + -1908, 558, 3339, 3340, 3341, 3355, 536, 3343, 3357, 3344, 3353, 3358, 887, 44, 3375, 3359, 3380, 1607, 1596, 3393, - 3377, -1907, 3384, 3388, 3378, 536, 3173, 560, 3385, 2824, + 3377, -1908, 3384, 3388, 3378, 536, 3173, 560, 3385, 2824, 1596, 3135, 3394, 3405, 1908, 3411, 3413, 45, 1909, 3397, 3399, 1911, 1912, 3408, 3416, 3401, 1265, 3407, 3412, 1079, 3419, 3024, 1991, 2499, 3420, 1598, 1992, 1993, 3423, 3441, 1596, 1994, 1995, 1996, 3159, 3163, 3439, 1596, 3440, 3445, - 3452, 1266, -1907, 887, 3455, -1907, 3457, 3469, 3470, 1950, - 536, -1907, 3524, 1607, 3526, 3532, 3534, 3551, 3535, 3548, + 3452, 1266, -1908, 887, 3455, -1908, 3457, 3469, 3470, 1950, + 536, -1908, 3524, 1607, 3526, 3532, 3534, 3551, 3535, 3548, 3549, 3552, 1268, 3554, 1999, 3704, 3573, 3566, 3567, 3576, 536, 536, 3588, 536, 3570, 3574, 3599, 536, 3582, 3601, 536, 1596, 532, 543, 3611, 1596, 3316, 3615, 567, 3617, - -2153, 1596, -1907, -2154, 567, 3637, 3618, 3642, 822, -2155, - 837, -2156, -2157, -2158, 840, 567, 849, 536, -2159, 849, - -2160, -2161, 869, 869, -2162, 1596, 869, -1907, 3638, 567, - 567, 3830, -2163, 1599, 3628, 3634, 23, 536, -2164, -2166, - -2167, 2864, 536, 536, -2168, 2727, -2169, 536, 1607, -2170, - -2171, 3635, 536, 887, -2172, 536, 536, -2173, -2175, -2176, - 536, 1337, 822, 822, 536, -2177, 3639, -2178, 536, 3647, - -2179, -2180, -2181, -2182, -2183, -2184, -2185, -2186, -2187, -1372, + -2154, 1596, -1908, -2155, 567, 3637, 3618, 3642, 822, -2156, + 837, -2157, -2158, -2159, 840, 567, 849, 536, -2160, 849, + -2161, -2162, 869, 869, -2163, 1596, 869, -1908, 3638, 567, + 567, 3830, -2164, 1599, 3628, 3634, 23, 536, -2165, -2167, + -2168, 2864, 536, 536, -2169, 2727, -2170, 536, 1607, -2171, + -2172, 3635, 536, 887, -2173, 536, 536, -2174, -2176, -2177, + 536, 1337, 822, 822, 536, -2178, 3639, -2179, 536, 3647, + -2180, -2181, -2182, -2183, -2184, -2185, -2186, -2187, -2188, -1373, 536, 23, 3649, 3651, 3260, 3654, 3655, 874, 869, 3658, 3266, 3659, 2108, 2112, 3660, 917, 869, 567, 869, 869, 869, 934, 534, 2110, 79, 2115, 3665, 3667, 2111, 2114, - 3669, 3670, 3673, 3678, -1371, 3683, -1907, 3691, 1042, 3693, - 3700, 3701, 1997, 1043, 3720, 3739, 536, -1907, 3702, 3742, + 3669, 3670, 3673, 3678, -1372, 3683, -1908, 3691, 1042, 3693, + 3700, 3701, 1997, 1043, 3720, 3739, 536, -1908, 3702, 3742, 3747, 3710, 3712, 3744, 536, 832, 3714, 1604, 3750, 3769, - 3751, 3765, 3778, 3740, 3768, 1998, 3741, -1907, 3786, -1907, - -1907, 3793, 3798, 536, 2859, 3812, 3803, 3805, 3807, 3817, + 3751, 3765, 3778, 3740, 3768, 1998, 3741, -1908, 3786, -1908, + -1908, 3793, 3798, 536, 2859, 3812, 3803, 3805, 3807, 3817, 834, 3828, 1607, 3824, 3829, 3098, 3831, 1202, 2767, 2367, 2777, 3593, 3102, 3595, 3030, 3708, 3664, 3804, 3360, 2512, - 3330, 2881, 1044, 26, 27, 28, -1907, 3735, 3687, -1907, - -1907, -1907, -2188, -2188, -2188, 732, 2003, 2004, 2005, 2006, + 3330, 2881, 1044, 26, 27, 28, -1908, 3735, 3687, -1908, + -1908, -1908, -2189, -2189, -2189, 732, 2003, 2004, 2005, 2006, 2007, 2008, 3785, 3465, 3738, 3745, 1178, 2842, 732, 3779, 3547, 1496, 2757, 2784, 1822, 1607, 2336, 2337, 1999, 3153, 2842, 1607, 3736, 1599, 3106, 887, 3067, 3364, 26, 27, @@ -4907,10 +4907,10 @@ static const yytype_int16 yytable[] = 0, 0, 536, 0, 0, 2059, 45, 1604, 0, 0, 43, 0, 0, 0, 0, 1676, 0, 0, 1677, 0, 46, 0, 1678, 1679, 0, 0, 1687, 44, 3520, 0, - 0, 1050, 0, -2188, 0, 0, 0, 0, 1051, 0, + 0, 1050, 0, -2189, 0, 0, 0, 0, 1051, 0, 0, 0, 0, 0, 0, 0, 3513, 1596, 0, 73, 0, 45, 732, 0, 1687, 0, 0, 0, 0, 0, - 1689, -2188, 0, 3530, 2842, 46, 2000, 2001, 2002, 0, + 1689, -2189, 0, 3530, 2842, 46, 2000, 2001, 2002, 0, 2003, 2004, 2005, 2006, 2007, 2008, 0, 0, 3046, 886, 1052, 536, 3048, 73, 0, 0, 0, 0, 1689, 3553, 536, 0, 536, 3172, 536, 0, 0, 1966, 536, 1053, @@ -4919,16 +4919,16 @@ static const yytype_int16 yytable[] = 0, 536, 536, 0, 0, 0, 2670, 0, 1598, 3109, 3110, 3111, 3112, 536, 3114, 3115, 3116, 3117, 3118, 0, 1655, 0, 0, 0, 1967, 0, 0, 0, 832, 3592, - 732, 3594, 0, 0, 2680, 536, 0, 0, -2188, 0, + 732, 3594, 0, 0, 2680, 536, 0, 0, -2189, 0, 0, 0, 3604, 1596, 0, 1968, 869, 1604, 0, 0, - 0, 869, 1054, 834, 0, -2188, 1599, 2060, 0, 1604, - -2188, 567, 0, 1969, 0, 0, -2188, 0, 1970, 1781, + 0, 869, 1054, 834, 0, -2189, 1599, 2060, 0, 1604, + -2189, 567, 0, 1969, 0, 0, -2189, 0, 1970, 1781, 0, 0, 0, 0, 0, 0, 3520, 0, 1470, 0, - 0, 0, 0, -2188, 0, 0, 0, 0, -2188, 1604, - 0, 1971, 0, 0, 1972, 0, 1604, 0, 0, -2188, + 0, 0, 0, -2189, 0, 0, 0, 0, -2189, 1604, + 0, 1971, 0, 0, 1972, 0, 1604, 0, 0, -2189, 0, 824, 0, 0, 0, 0, 0, 0, 1596, 0, 1973, 73, 0, 0, 1598, 0, 0, 3624, 0, 0, - 886, 0, 3631, 0, 0, 0, 0, -2188, 0, 0, + 886, 0, 3631, 0, 0, 0, 0, -2189, 0, 0, 0, 0, 1042, 536, 0, 0, 0, 1043, 0, 0, 1604, 0, 3636, 536, 1604, 0, 0, 0, 0, 0, 1604, 0, 0, 0, 1599, 536, 1698, 0, 0, 0, @@ -4941,10 +4941,10 @@ static const yytype_int16 yytable[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1257, 536, 0, 0, 1976, 832, 0, 0, 0, 0, 0, 0, 0, 73, 3520, 0, 732, 0, - 0, 0, 534, 0, 981, 567, 567, 0, 0, -2188, + 0, 0, 534, 0, 981, 567, 567, 0, 0, -2189, 3604, 1598, 834, 1596, 3513, 1598, 1977, 0, 0, 1045, 0, 1598, 0, 0, 0, 536, 0, 0, 1258, 3748, - 0, 0, 3311, 0, 0, 832, 0, -2188, 0, 536, + 0, 0, 3311, 0, 0, 832, 0, -2189, 0, 536, 536, 536, 1655, 0, 0, 1598, 1599, 0, 1004, 543, 536, 0, 0, 0, 532, 1046, 869, 0, 3766, 534, 834, 0, 0, 0, 0, 822, 0, 1470, 1470, 1031, @@ -4953,9 +4953,9 @@ static const yytype_int16 yytable[] = 849, 0, 832, 849, 0, 0, 0, 0, 0, 0, 0, 1128, 1128, 849, 849, 0, 849, 0, 849, 0, 0, 0, 0, 1601, 0, 0, 0, 834, 1049, 0, - 869, -2188, 0, 0, 0, 1259, 567, 0, 1705, 1706, + 869, -2189, 0, 0, 0, 1259, 567, 0, 1705, 1706, 1707, 1708, 1709, 1710, 0, 0, 0, 0, 0, 869, - 536, 0, 0, 0, 0, 0, 0, 536, 0, -2188, + 536, 0, 0, 0, 0, 0, 0, 536, 0, -2189, 0, 33, 1599, 869, 837, 0, 1705, 1706, 1707, 1708, 1709, 1710, 0, 0, 1596, 1050, 0, 0, 0, 0, 0, 0, 1051, 1602, 0, 0, 1260, 0, 0, 0, @@ -4963,7 +4963,7 @@ static const yytype_int16 yytable[] = 38, 0, 869, 1342, 0, 0, 0, 0, 0, 1262, 0, 73, 0, 1352, 0, 0, 1599, 869, 869, 869, 869, 869, 0, 0, 1052, 0, 0, 0, 1599, 0, - 1687, 0, 0, 0, 1375, 40, 0, -2188, 0, 0, + 1687, 0, 0, 0, 1375, 40, 0, -2189, 0, 0, 3558, 1263, 0, 1053, 0, 0, 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1599, 0, 0, 0, 0, 44, 1689, 1599, 1031, 1058, 0, 869, @@ -4975,43 +4975,43 @@ static const yytype_int16 yytable[] = 0, 1266, 0, 0, 0, 0, 1604, 0, 0, 1611, 2989, 0, 0, 0, 0, 3536, 0, 0, 0, 0, 0, 1596, 1268, 1599, 0, 0, 0, 1596, 0, 0, - 0, 0, -1909, 0, 0, 0, 0, 567, 0, 0, - 0, 0, -2188, 0, 0, 0, 1042, 0, 0, 0, - 1596, 1043, 0, 1602, 0, 0, 2286, 0, 0, -2188, - 0, 0, 567, 0, -2188, 0, 0, 0, 0, 0, + 0, 0, -1910, 0, 0, 0, 0, 567, 0, 0, + 0, 0, -2189, 0, 0, 0, 1042, 0, 0, 0, + 1596, 1043, 0, 1602, 0, 0, 2286, 0, 0, -2189, + 0, 0, 567, 0, -2189, 0, 0, 0, 0, 0, 73, 1598, 0, 0, 1676, 0, 0, 1677, 0, 0, - 0, 1678, 1679, 0, 0, 0, -2188, -2188, -2188, 0, + 0, 1678, 1679, 0, 0, 0, -2189, -2189, -2189, 0, 73, 0, 0, 0, 1596, 0, 0, 0, 0, 0, - 0, 0, 0, -2188, 0, 0, 0, 0, 0, 0, + 0, 0, 0, -2189, 0, 0, 0, 0, 0, 0, 1044, 0, 0, 1687, 0, 1736, 0, 0, 0, 0, 1688, 0, 1604, 0, 0, 0, 1601, 1598, 0, 0, - 0, 567, 567, -1909, 0, 0, 0, 0, 869, 0, + 0, 567, 567, -1910, 0, 0, 0, 0, 869, 0, 0, 869, 0, 0, 0, 0, 0, 1689, 0, 0, 0, 0, 1603, 0, 0, 0, 0, 0, 0, 0, 1698, 0, 1468, 1128, 1128, 0, 0, 0, 0, 0, 0, 0, 869, 0, 0, 1809, 0, 869, 1821, 0, - 0, -1909, 0, 1045, 0, 0, 0, 1604, 0, 0, - 869, 0, 0, 0, 0, 0, -1909, 0, 0, 0, - 0, -1909, 0, 0, 1596, 0, -1909, 869, 0, 0, - 0, 869, 0, 0, 0, -1909, 0, 1873, 0, 1046, - -1909, 0, 0, 0, 1601, 0, 0, 73, 0, 0, + 0, -1910, 0, 1045, 0, 0, 0, 1604, 0, 0, + 869, 0, 0, 0, 0, 0, -1910, 0, 0, 0, + 0, -1910, 0, 0, 1596, 0, -1910, 869, 0, 0, + 0, 869, 0, 0, 0, -1910, 0, 1873, 0, 1046, + -1910, 0, 0, 0, 1601, 0, 0, 73, 0, 0, 0, 0, 0, 0, 0, 1047, 0, 0, 0, 0, 0, 0, 0, 1598, 0, 1690, 1048, 0, 0, 0, - 0, 0, -1909, 0, 0, 0, 73, 0, 0, 0, - 0, 0, 1691, -2188, 0, 0, 0, 1692, 0, 0, - 0, 0, 0, -1909, 0, 0, 0, 0, 0, 1893, + 0, 0, -1910, 0, 0, 0, 73, 0, 0, 0, + 0, 0, 1691, -2189, 0, 0, 0, 1692, 0, 0, + 0, 0, 0, -1910, 0, 0, 0, 0, 0, 1893, 0, 869, 1049, 1470, 1470, 1470, 1470, 1470, 1470, 869, 0, 1470, 1470, 1470, 1470, 1470, 1470, 1470, 1470, 1470, 1470, 0, 1938, 1229, 0, 0, 1695, 0, 1598, 0, 0, 981, 0, 0, 0, 0, 981, 3721, 567, 567, - 0, 567, 981, 0, -1909, 0, 0, -1909, 0, 1050, - 0, 0, 0, -1909, 0, 0, 1051, 0, 0, 0, + 0, 567, 981, 0, -1910, 0, 0, -1910, 0, 1050, + 0, 0, 0, -1910, 0, 0, 1051, 0, 0, 0, 0, 0, 1604, 0, 0, 868, 0, 0, 0, 876, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1599, 0, 0, 0, 1698, 0, 0, 1601, 0, 0, 0, - 0, 0, 1596, 0, -1909, -2188, 1602, 0, 1052, 0, + 0, 0, 1596, 0, -1910, -2189, 1602, 0, 1052, 0, 0, 0, 1705, 1706, 1707, 1708, 1709, 1710, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1053, 0, -1909, + 0, 0, 0, 0, 0, 0, 0, 1053, 0, -1910, 0, 1468, 1468, 0, 0, 0, 0, 1468, 1604, 532, 0, 914, 0, 0, 0, 1599, 0, 0, 0, 919, 0, 922, 1031, 926, 567, 2034, 0, 0, 0, 1128, @@ -5020,17 +5020,17 @@ static const yytype_int16 yytable[] = 0, 1128, 822, 0, 822, 0, 0, 0, 822, 874, 567, 0, 567, 1598, 0, 0, 1700, 0, 0, 0, 1054, 0, 1601, 0, 1602, 1603, 0, 0, 0, 0, - 568, 0, 0, 0, 1470, 1470, 568, 0, -1909, 0, - 823, 0, 0, 1604, 0, 0, 0, 568, 0, -1909, + 568, 0, 0, 0, 1470, 1470, 568, 0, -1910, 0, + 823, 0, 0, 1604, 0, 0, 0, 568, 0, -1910, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 568, 568, 0, 0, 0, 0, 0, 0, -1909, - 0, -1909, -1909, 0, 0, 0, 1601, 0, 0, 1598, + 0, 568, 568, 0, 0, 0, 0, 0, 0, -1910, + 0, -1910, -1910, 0, 0, 0, 1601, 0, 0, 1598, 0, 1599, 0, 0, 0, 0, 0, 0, 1601, 0, 0, 0, 1596, 0, 823, 823, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, -1909, 0, - 0, -1909, -1909, -1909, 0, 0, 0, 0, 1601, 0, + 0, 0, 0, 0, 0, 0, 0, 0, -1910, 0, + 0, -1910, -1910, -1910, 0, 0, 0, 0, 1601, 0, 0, 2148, 0, 1603, 0, 1601, 0, 0, 1701, 568, - 0, -2188, -2188, -2188, 567, 1705, 1706, 1707, 1708, 1709, + 0, -2189, -2189, -2189, 567, 1705, 1706, 1707, 1708, 1709, 1710, 0, 0, 0, 0, 0, 1599, 0, 0, 0, 1470, 0, 0, 0, 0, 0, 0, 1604, 0, 0, 0, 0, 0, 0, 1598, 0, 1602, 0, 0, 1601, @@ -5057,7 +5057,7 @@ static const yytype_int16 yytable[] = 1679, 1603, 0, 0, 0, 1602, 2414, 0, 0, 0, 0, 0, 0, 0, 1352, 0, 869, 869, 869, 869, 869, 869, 0, 1604, 0, 0, 0, 0, 0, 0, - 0, 1687, 0, 0, 1598, 0, 2442, 0, -2188, 950, + 0, 1687, 0, 0, 1598, 0, 2442, 0, -2189, 950, 0, 0, 0, 0, 957, 0, 0, 0, 0, 1602, 0, 0, 0, 1602, 0, 1603, 0, 2505, 0, 1602, 0, 0, 0, 0, 0, 1689, 0, 1603, 0, 0, @@ -5070,70 +5070,70 @@ static const yytype_int16 yytable[] = 0, 2992, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1598, 567, 0, 0, 1603, 0, 0, 0, 1603, 0, 1470, 1470, 0, 0, 1603, 869, - 0, 0, 0, -2188, 0, 0, 0, 0, 0, 1601, - 0, 0, 822, 0, 0, 0, 0, 0, 822, -1924, - -2188, 0, 1603, 0, 567, -2188, 0, 0, 0, 0, + 0, 0, 0, -2189, 0, 0, 0, 0, 0, 1601, + 0, 0, 822, 0, 0, 0, 0, 0, 822, -1925, + -2189, 0, 1603, 0, 567, -2189, 0, 0, 0, 0, 567, 1604, 0, 0, 0, 0, 1599, 0, 0, 2614, 2614, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 568, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1676, -2188, 1601, 1677, 0, 0, 0, + 0, 0, 0, 1676, -2189, 1601, 1677, 0, 0, 0, 1678, 1679, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1599, 0, 0, 0, 0, 0, 1599, 0, 0, 0, 0, - 0, 0, 1687, 0, 0, 0, 0, 0, 0, -2188, + 0, 0, 1687, 0, 0, 0, 0, 0, 0, -2189, 0, 0, 0, 0, 567, 0, 0, 0, 1599, 567, - -1924, 1698, 0, 0, 567, 0, 0, 0, 0, 0, + -1925, 1698, 0, 0, 567, 0, 0, 0, 0, 0, 1676, 0, 0, 1677, 0, 0, 1689, 1678, 1679, 1015, 0, 0, 0, 0, 0, 0, 0, 0, 1468, 1468, 0, 0, 1598, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1599, 0, 0, 0, 0, 2148, -1924, 1687, - 0, 0, 0, 1468, 0, 0, -2188, 0, 0, 0, - 0, 1601, 0, -1924, 0, 0, 0, 0, -1924, 0, - 0, 0, 0, -1924, 0, 0, 0, 0, 0, 0, - 822, 1604, -1924, 1689, 0, 0, 0, -1924, 1470, 0, + 0, 0, 1599, 0, 0, 0, 0, 2148, -1925, 1687, + 0, 0, 0, 1468, 0, 0, -2189, 0, 0, 0, + 0, 1601, 0, -1925, 0, 0, 0, 0, -1925, 0, + 0, 0, 0, -1925, 0, 0, 0, 0, 0, 0, + 822, 1604, -1925, 1689, 0, 0, 0, -1925, 1470, 0, 0, 0, 567, 0, 0, 0, 822, 0, 0, 0, - 822, 2267, 0, 0, -2188, 0, 0, 0, 0, 0, - 0, 0, 0, 0, -2188, 3210, 1233, 0, 0, -1924, + 822, 2267, 0, 0, -2189, 0, 0, 0, 0, 0, + 0, 0, 0, 0, -2189, 3210, 1233, 0, 0, -1925, 0, 0, 0, 0, 0, 0, 1601, 568, 568, 0, - 0, -2188, 0, 0, 0, 0, -2188, 0, 0, 1602, - -1924, 567, 0, 0, 1468, 0, 1128, 567, 0, 2993, + 0, -2189, 0, 0, 0, 0, -2189, 0, 0, 1602, + -1925, 567, 0, 0, 1468, 0, 1128, 567, 0, 2993, 0, 0, 1599, 0, 0, 1341, 0, 0, 0, 0, 0, 0, 1471, 0, 0, 3239, 0, 0, 0, 1893, - 1356, 1358, 1361, 1363, 1365, -2188, 0, 0, 0, 0, - 0, -2188, 0, 0, 0, 0, 0, 823, 0, 0, - 0, -1924, 0, 0, -1924, 1602, 0, 0, -2188, 0, - -1924, 0, 1598, -2188, 0, 0, 0, 0, 0, 0, - 0, 1676, 0, 0, 1677, 0, -2188, 0, 1678, 1679, + 1356, 1358, 1361, 1363, 1365, -2189, 0, 0, 0, 0, + 0, -2189, 0, 0, 0, 0, 0, 823, 0, 0, + 0, -1925, 0, 0, -1925, 1602, 0, 0, -2189, 0, + -1925, 0, 1598, -2189, 0, 0, 0, 0, 0, 0, + 0, 1676, 0, 0, 1677, 0, -2189, 0, 1678, 1679, 0, 0, 1463, 1705, 1706, 1707, 1708, 1709, 1710, 0, 0, 0, 1698, 0, 0, 0, 0, 0, 1603, 0, - 0, -1924, -2188, 0, 0, 0, 0, 0, 568, 0, - 1687, 0, 0, 1893, 0, 0, 0, -2188, 0, 0, - 869, 0, 1470, 0, 0, 0, -1924, 0, 0, 0, + 0, -1925, -2189, 0, 0, 0, 0, 0, 568, 0, + 1687, 0, 0, 1893, 0, 0, 0, -2189, 0, 0, + 869, 0, 1470, 0, 0, 0, -1925, 0, 0, 0, 1352, 0, 0, 1893, 869, 869, 869, 0, 0, 0, 0, 1601, 0, 0, 1689, 0, 0, 567, 0, 869, 0, 0, 0, 869, 1603, 0, 869, 0, 0, 1698, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1602, 0, 0, 0, 0, 0, 0, 0, 0, 1599, 0, 0, 0, 0, 0, 874, 0, 0, 0, - 0, 0, 0, 0, 0, -2188, 0, 0, 0, 869, + 0, 0, 0, 0, 0, -2189, 0, 0, 0, 869, 0, 0, 0, 0, 0, 981, 0, 1601, 0, 0, - 3251, 0, 0, 0, 0, -1924, 0, 0, 0, 1893, - 1893, 0, 1893, 0, 0, 0, -1924, 0, 0, 0, + 3251, 0, 0, 0, 0, -1925, 0, 0, 0, 1893, + 1893, 0, 1893, 0, 0, 0, -1925, 0, 0, 0, 0, 1470, 1471, 0, 0, 0, 1602, 0, 0, 0, - 0, 0, -2188, 0, 0, 0, -1924, 0, -1924, -1924, - 0, 532, 0, 0, 0, 0, 0, 1488, 0, -2188, - 0, 0, -2188, 823, -2188, 823, 0, 0, 0, 2907, + 0, 0, -2189, 0, 0, 0, -1925, 0, -1925, -1925, + 0, 532, 0, 0, 0, 0, 0, 1488, 0, -2189, + 0, 0, -2189, 823, -2189, 823, 0, 0, 0, 2907, 1603, 0, 0, 0, 823, 0, 0, 869, 869, 869, - 0, 0, 0, 0, 1526, -1924, 0, 0, -1924, -1924, - -1924, 567, 1601, 1468, 0, 567, 0, 0, 0, 0, - 0, 567, 0, -2188, 0, 1807, 0, -2188, 0, 0, + 0, 0, 0, 0, 1526, -1925, 0, 0, -1925, -1925, + -1925, 567, 1601, 1468, 0, 567, 0, 0, 0, 0, + 0, 567, 0, -2189, 0, 1807, 0, -2189, 0, 0, 1811, 0, 0, 0, 1705, 1706, 1707, 1708, 1709, 1710, 0, 869, 0, 1843, 0, 0, 0, 0, 0, 568, 0, 0, 0, 0, 0, 1603, 2148, 0, 0, 0, 0, 0, 0, 0, 1868, 0, 0, 0, 567, 0, 1599, 0, 567, 0, 1660, 0, 0, 0, 0, 0, 1698, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, -2188, 0, 0, 0, 1468, 1468, + 0, 0, 0, 0, -2189, 0, 0, 0, 1468, 1468, 0, 1705, 1706, 1707, 1708, 1709, 1710, 0, 0, 0, 0, 1602, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3010, 0, 0, 1079, 1601, 0, 1991, 3019, @@ -5142,7 +5142,7 @@ static const yytype_int16 yytable[] = 0, 0, 869, 0, 2980, 0, 567, 0, 1128, 0, 567, 567, 0, 0, 3047, 567, 0, 0, 0, 1893, 1821, 1893, 0, 1938, 0, 0, 0, 1602, 3578, 1601, - 0, 0, 0, -2188, 0, 1601, 0, 0, 0, 0, + 0, 0, 0, -2189, 0, 1601, 0, 0, 0, 0, 0, 1471, 1471, 0, 567, 0, 1821, 1471, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1601, 0, 1603, 0, 567, 567, 567, 567, 1821, 567, 567, 567, @@ -5153,7 +5153,7 @@ static const yytype_int16 yytable[] = 0, 0, 1602, 0, 0, 0, 0, 0, 3152, 0, 0, 0, 0, 0, 0, 0, 1603, 0, 0, 0, 0, 0, 0, 0, 0, 2048, 0, 0, 0, 0, - 0, 0, 0, 0, 1938, -2188, 0, 0, 0, 0, + 0, 0, 0, 0, 1938, -2189, 0, 0, 0, 0, 0, 1893, 1705, 1706, 1707, 1708, 1709, 1710, 0, 0, 0, 0, 1468, 0, 0, 0, 0, 0, 567, 0, 0, 0, 0, 0, 0, 869, 869, 869, 869, 0, @@ -5199,7 +5199,7 @@ static const yytype_int16 yytable[] = 1471, 1471, 1471, 0, 0, 1471, 1471, 1471, 1471, 1471, 1471, 1471, 1471, 1471, 1471, 567, 2000, 2001, 2002, 568, 2003, 2004, 2005, 2006, 2007, 2008, 0, 0, 0, 0, - 0, 0, 0, 567, 567, -2188, 0, 0, 1265, 0, + 0, 0, 0, 567, 567, -2189, 0, 0, 1265, 0, 0, 568, 0, 1143, 1143, 0, 0, 0, 0, 0, 0, 869, 568, 3152, 568, 0, 0, 568, 567, 0, 1602, 0, 0, 1266, 0, 0, 0, 568, 0, 568, @@ -5332,7 +5332,7 @@ static const yytype_int16 yytable[] = 0, 0, 740, 0, 0, 0, 0, 741, 0, 0, 0, 0, 0, 0, 0, 2649, 24, 0, 0, 2655, 0, 0, 1442, 1443, 2660, 2661, 0, 0, 0, 1243, - 0, 0, -1529, 0, 0, 1244, 742, 0, 0, 0, + 0, 0, -1530, 0, 0, 1244, 742, 0, 0, 0, 0, 0, 2090, 1256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 0, 0, 0, 1257, 0, 0, 0, 0, 0, 0, @@ -5379,13 +5379,13 @@ static const yytype_int16 yytable[] = 0, 0, 1250, 0, 0, 0, 0, 0, 1691, 0, 0, 0, 0, 1692, 0, 0, 0, 0, 2955, 0, 0, 0, 0, 0, 0, 2957, 2126, 0, 1713, 0, - 0, 0, 0, 0, 0, 0, -2188, -2188, 0, 0, + 0, 0, 0, 0, 0, 0, -2189, -2189, 0, 0, 0, 2966, 1418, 1419, 0, 0, 0, 0, 0, 0, 0, 0, 1695, 0, 2978, 0, 0, 2981, 0, 2983, 0, 0, 0, 0, 0, 0, 0, 2987, 0, 0, 0, 0, 1690, 0, 0, 2994, 2995, 0, 0, 0, 0, 0, 3002, 1420, 1421, 0, 0, 1422, 1423, 1691, - 0, 0, 568, 0, 1692, -2188, 0, 0, 0, 3016, + 0, 0, 568, 0, 1692, -2189, 0, 0, 0, 3016, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1698, 3032, 0, 0, 0, 0, 1713, 0, 1693, 1694, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -6075,8 +6075,8 @@ static const yytype_int16 yytable[] = 1124, 1125, 1126, 1127, 121, 1076, 836, 1077, 1078, 1079, 1080, 1081, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, - 128, 129, -1201, 130, 131, 132, 0, 0, 0, 0, - -1201, 1082, 0, 0, 133, 134, 135, 0, 136, 137, + 128, 129, -1202, 130, 131, 132, 0, 0, 0, 0, + -1202, 1082, 0, 0, 133, 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, 143, 1083, 145, 1084, 1085, 0, 0, 148, 149, 150, 151, 152, 1086, 805, 153, 154, 155, 156, 1087, 1088, 159, 0, 160, 161, 162, @@ -6112,7 +6112,7 @@ static const yytype_int16 yytable[] = 410, 411, 412, 413, 414, 1111, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 0, 0, 429, 430, 431, 432, 433, 434, 435, 436, 437, - 0, 438, 439, 440, 1112, 442, -1201, 443, 444, 445, + 0, 438, 439, 440, 1112, 442, -1202, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 815, 0, 0, 460, 461, 0, 462, 463, 464, 465, 466, 467, 468, 469, 0, 470, 1113, @@ -7092,7 +7092,7 @@ static const yytype_int16 yytable[] = 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, 132, 0, 0, 0, 0, 0, 1082, 0, 0, 133, 134, 135, 0, 136, 137, 138, 139, 140, 141, - 142, -2188, 1083, 145, 1084, 1085, 0, 0, 148, 149, + 142, -2189, 1083, 145, 1084, 1085, 0, 0, 148, 149, 150, 151, 152, 1086, 805, 153, 154, 155, 156, 1087, 1088, 159, 0, 160, 161, 162, 163, 806, 0, 807, 0, 1089, 167, 168, 169, 170, 171, 172, 173, 174, @@ -7104,13 +7104,13 @@ static const yytype_int16 yytable[] = 216, 0, 217, 218, 219, 220, 0, 221, 222, 223, 224, 1094, 226, 227, 228, 229, 230, 231, 808, 1095, 233, 0, 234, 235, 1096, 237, 0, 238, 0, 239, - 240, 0, 241, 242, 243, 244, -2188, 246, 247, 248, + 240, 0, 241, 242, 243, 244, -2189, 246, 247, 248, 0, 1097, 1098, 251, 252, 0, 253, 254, 255, 256, - 257, 258, 259, -2188, 261, 262, 263, 264, 0, 265, + 257, 258, 259, -2189, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 273, 274, 275, 276, 277, 278, 279, 1099, 1100, 0, 1101, 0, 283, 0, 0, 286, 287, 288, 289, 290, 1102, 291, - 292, 293, 0, 0, 294, 295, 296, -2188, 0, 298, + 292, 293, 0, 0, 294, 295, 296, -2189, 0, 298, 299, 300, 301, 302, 303, 304, 305, 1103, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, @@ -7126,7 +7126,7 @@ static const yytype_int16 yytable[] = 405, 406, 407, 408, 0, 409, 410, 411, 412, 413, 414, 1111, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 0, 0, 429, 430, 431, - 432, 433, 434, 435, 436, 437, 0, -2188, 439, 440, + 432, 433, 434, 435, 436, 437, 0, -2189, 439, 440, 1112, 442, 0, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 815, 0, 0, 460, 461, 0, 462, 463, 464, 465, 466, @@ -7137,7 +7137,7 @@ static const yytype_int16 yytable[] = 498, 1117, 500, 0, 501, 502, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, - 523, 524, 525, 526, 527, 528, 529, 530, 531, -2188, + 523, 524, 525, 526, 527, 528, 529, 530, 531, -2189, 0, 0, 0, 0, 0, 0, 1119, 1120, 1121, 0, 0, 0, 0, 1122, 0, 1123, 0, 0, 0, 0, 1124, 1125, 1126, 1127, 121, 1076, 836, 1077, 1078, 1079, @@ -7623,22 +7623,22 @@ static const yytype_int16 yytable[] = 195, 196, 197, 0, 198, 0, 199, 200, 201, 202, 203, 204, 0, 0, 205, 206, 207, 208, 0, 0, 209, 210, 211, 212, 213, 0, 214, 215, 216, 0, - 217, 218, 219, 220, -590, 221, 222, 223, 224, 225, - 226, 227, 228, 229, 230, 231, 232, 0, 233, -590, - 234, 235, 236, 237, -590, 238, 0, 239, 0, 0, + 217, 218, 219, 220, -591, 221, 222, 223, 224, 225, + 226, 227, 228, 229, 230, 231, 232, 0, 233, -591, + 234, 235, 236, 237, -591, 238, 0, 239, 0, 0, 0, 242, 243, 540, 0, 246, 247, 248, 0, 249, 250, 251, 252, 0, 253, 254, 255, 256, 257, 258, 259, 0, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 0, 274, 275, 276, - 277, 278, 279, 280, 281, -590, 282, 0, 283, 0, + 277, 278, 279, 280, 281, -591, 282, 0, 283, 0, 0, 286, 0, 288, 289, 290, 0, 291, 292, 293, - 0, 0, 294, 0, 296, 0, -590, 298, 299, 300, + 0, 0, 294, 0, 296, 0, -591, 298, 299, 300, 301, 302, 303, 304, 305, 541, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 0, 331, 332, 333, 334, 335, 0, 336, 337, 0, 339, - 0, 340, 341, 342, 343, 344, 345, -590, 346, 347, - 0, 0, 348, 349, 350, 0, -590, 351, 352, 353, + 0, 340, 341, 342, 343, 344, 345, -591, 346, 347, + 0, 0, 348, 349, 350, 0, -591, 351, 352, 353, 0, 355, 0, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 0, 0, 0, 0, 370, 371, 372, 0, 374, 375, 376, 377, 378, 379, @@ -7654,7 +7654,7 @@ static const yytype_int16 yytable[] = 460, 461, 0, 462, 0, 464, 465, 466, 467, 468, 469, 0, 470, 471, 472, 0, 0, 473, 474, 475, 476, 477, 0, 478, 479, 480, 481, 482, 483, 484, - 485, -590, 0, 486, 487, 488, 0, 0, 489, 490, + 485, -591, 0, 486, 487, 488, 0, 0, 489, 490, 491, 492, 0, 493, 494, 495, 496, 497, 498, 499, 500, 0, 501, 0, 503, 504, 505, 506, 507, 508, 509, 0, 0, 510, 0, 0, 511, 512, 513, 514, @@ -10071,7 +10071,7 @@ static const yytype_int16 yytable[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 123, 124, 125, 126, 127, 128, 129, 0, 130, 131, - 132, 0, 0, 0, 1535, 0, 0, -869, 0, 1536, + 132, 0, 0, 0, 1535, 0, 0, -870, 0, 1536, 134, 135, 0, 1537, 137, 138, 1538, 140, 141, 142, 0, 1539, 1540, 1541, 1542, 0, 1543, 148, 149, 150, 151, 152, 0, 0, 153, 154, 155, 156, 1544, 1545, @@ -10085,7 +10085,7 @@ static const yytype_int16 yytable[] = 0, 217, 218, 219, 220, 0, 221, 222, 223, 224, 0, 226, 227, 228, 229, 230, 231, 0, 0, 233, 0, 234, 235, 1552, 237, 0, 238, 0, 239, 1553, - 0, 1554, 242, 243, -869, 1555, 246, 247, 248, 0, + 0, 1554, 242, 243, -870, 1555, 246, 247, 248, 0, 0, 0, 251, 252, 0, 253, 254, 255, 256, 257, 258, 259, 1556, 261, 262, 263, 264, 0, 265, 266, 267, 268, 269, 270, 271, 0, 272, 1557, 0, 275, @@ -12319,9 +12319,9 @@ static const yytype_int16 yytable[] = 0, 0, 0, 0, 0, 22, 0, 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, -1529, 0, 0, 0, 0, 0, 0, + 0, 0, 0, -1530, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, -1529, 0, 0, 0, 0, 0, 0, 0, 0, + 0, -1530, 0, 0, 0, 0, 0, 0, 0, 0, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -21961,7 +21961,7 @@ YYLTYPE yylloc; { PGAlterTableCmd *n = makeNode(PGAlterTableCmd); n->subtype = PG_AT_SetRelOptions; - n->def = (PGNode *)(yyvsp[(2) - (2)].list); + n->options = (yyvsp[(2) - (2)].list); (yyval.node) = (PGNode *)n; ;} break; @@ -21971,7 +21971,7 @@ YYLTYPE yylloc; { PGAlterTableCmd *n = makeNode(PGAlterTableCmd); n->subtype = PG_AT_ResetRelOptions; - n->def = (PGNode *)(yyvsp[(2) - (2)].list); + n->options = (yyvsp[(2) - (2)].list); (yyval.node) = (PGNode *)n; ;} break; @@ -24358,37 +24358,44 @@ YYLTYPE yylloc; case 407: #line 606 "third_party/libpg_query/grammar/statements/create.y" { - (yyval.defelt) = makeDefElem((yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].node), (yylsp[(1) - (3)])); + (yyval.defelt) = makeDefElem((yyvsp[(1) - (3)].str), (PGNode *) (yyvsp[(3) - (3)].node), (yylsp[(1) - (3)])); ;} break; case 408: -#line 612 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} +#line 610 "third_party/libpg_query/grammar/statements/create.y" + { + (yyval.defelt) = makeDefElem((yyvsp[(1) - (1)].str), NULL, (yylsp[(1) - (1)])); + ;} break; case 409: -#line 613 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} +#line 616 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; case 410: #line 617 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.list) = (yyvsp[(1) - (1)].list); ;} + { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; case 411: -#line 618 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.list) = (yyvsp[(1) - (2)].list); ;} +#line 621 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; case 412: #line 622 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} + { (yyval.list) = (yyvsp[(1) - (2)].list); ;} break; case 413: -#line 624 "third_party/libpg_query/grammar/statements/create.y" +#line 626 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} + break; + + case 414: +#line 628 "third_party/libpg_query/grammar/statements/create.y" { (yyval.typnam) = makeTypeNameFromNameList(lcons(makeString((yyvsp[(1) - (4)].str)), (yyvsp[(2) - (4)].list))); (yyval.typnam)->pct_type = true; @@ -24396,8 +24403,8 @@ YYLTYPE yylloc; ;} break; - case 414: -#line 630 "third_party/libpg_query/grammar/statements/create.y" + case 415: +#line 634 "third_party/libpg_query/grammar/statements/create.y" { (yyval.typnam) = makeTypeNameFromNameList(lcons(makeString((yyvsp[(2) - (5)].str)), (yyvsp[(3) - (5)].list))); (yyval.typnam)->pct_type = true; @@ -24406,8 +24413,8 @@ YYLTYPE yylloc; ;} break; - case 415: -#line 641 "third_party/libpg_query/grammar/statements/create.y" + case 416: +#line 645 "third_party/libpg_query/grammar/statements/create.y" { PGConstraint *n = makeNode(PGConstraint); n->contype = PG_CONSTR_CHECK; @@ -24422,8 +24429,8 @@ YYLTYPE yylloc; ;} break; - case 416: -#line 655 "third_party/libpg_query/grammar/statements/create.y" + case 417: +#line 659 "third_party/libpg_query/grammar/statements/create.y" { PGConstraint *n = makeNode(PGConstraint); n->contype = PG_CONSTR_UNIQUE; @@ -24438,8 +24445,8 @@ YYLTYPE yylloc; ;} break; - case 417: -#line 668 "third_party/libpg_query/grammar/statements/create.y" + case 418: +#line 672 "third_party/libpg_query/grammar/statements/create.y" { PGConstraint *n = makeNode(PGConstraint); n->contype = PG_CONSTR_UNIQUE; @@ -24455,8 +24462,8 @@ YYLTYPE yylloc; ;} break; - case 418: -#line 683 "third_party/libpg_query/grammar/statements/create.y" + case 419: +#line 687 "third_party/libpg_query/grammar/statements/create.y" { PGConstraint *n = makeNode(PGConstraint); n->contype = PG_CONSTR_PRIMARY; @@ -24471,8 +24478,8 @@ YYLTYPE yylloc; ;} break; - case 419: -#line 696 "third_party/libpg_query/grammar/statements/create.y" + case 420: +#line 700 "third_party/libpg_query/grammar/statements/create.y" { PGConstraint *n = makeNode(PGConstraint); n->contype = PG_CONSTR_PRIMARY; @@ -24488,8 +24495,8 @@ YYLTYPE yylloc; ;} break; - case 420: -#line 711 "third_party/libpg_query/grammar/statements/create.y" + case 421: +#line 715 "third_party/libpg_query/grammar/statements/create.y" { PGConstraint *n = makeNode(PGConstraint); n->contype = PG_CONSTR_FOREIGN; @@ -24509,29 +24516,29 @@ YYLTYPE yylloc; ;} break; - case 421: -#line 733 "third_party/libpg_query/grammar/statements/create.y" + case 422: +#line 737 "third_party/libpg_query/grammar/statements/create.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 422: -#line 737 "third_party/libpg_query/grammar/statements/create.y" + case 423: +#line 741 "third_party/libpg_query/grammar/statements/create.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; - case 423: -#line 744 "third_party/libpg_query/grammar/statements/create.y" + case 424: +#line 748 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = PG_FKCONSTR_MATCH_FULL; ;} break; - case 424: -#line 748 "third_party/libpg_query/grammar/statements/create.y" + case 425: +#line 752 "third_party/libpg_query/grammar/statements/create.y" { ereport(ERROR, (errcode(PG_ERRCODE_FEATURE_NOT_SUPPORTED), @@ -24541,22 +24548,22 @@ YYLTYPE yylloc; ;} break; - case 425: -#line 756 "third_party/libpg_query/grammar/statements/create.y" + case 426: +#line 760 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = PG_FKCONSTR_MATCH_SIMPLE; ;} break; - case 426: -#line 760 "third_party/libpg_query/grammar/statements/create.y" + case 427: +#line 764 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = PG_FKCONSTR_MATCH_SIMPLE; ;} break; - case 427: -#line 768 "third_party/libpg_query/grammar/statements/create.y" + case 428: +#line 772 "third_party/libpg_query/grammar/statements/create.y" { PGTableLikeClause *n = makeNode(PGTableLikeClause); n->relation = (yyvsp[(2) - (3)].range); @@ -24565,28 +24572,28 @@ YYLTYPE yylloc; ;} break; - case 428: -#line 777 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = PG_RELPERSISTENCE_TEMP; ;} - break; - case 429: -#line 778 "third_party/libpg_query/grammar/statements/create.y" +#line 781 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = PG_RELPERSISTENCE_TEMP; ;} break; case 430: -#line 779 "third_party/libpg_query/grammar/statements/create.y" +#line 782 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = PG_RELPERSISTENCE_TEMP; ;} break; case 431: -#line 780 "third_party/libpg_query/grammar/statements/create.y" +#line 783 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = PG_RELPERSISTENCE_TEMP; ;} break; case 432: -#line 782 "third_party/libpg_query/grammar/statements/create.y" +#line 784 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = PG_RELPERSISTENCE_TEMP; ;} + break; + + case 433: +#line 786 "third_party/libpg_query/grammar/statements/create.y" { ereport(PGWARNING, (errmsg("GLOBAL is deprecated in temporary table creation"), @@ -24595,8 +24602,8 @@ YYLTYPE yylloc; ;} break; - case 433: -#line 789 "third_party/libpg_query/grammar/statements/create.y" + case 434: +#line 793 "third_party/libpg_query/grammar/statements/create.y" { ereport(PGWARNING, (errmsg("GLOBAL is deprecated in temporary table creation"), @@ -24605,27 +24612,27 @@ YYLTYPE yylloc; ;} break; - case 434: -#line 795 "third_party/libpg_query/grammar/statements/create.y" + case 435: +#line 799 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = PG_RELPERSISTENCE_UNLOGGED; ;} break; - case 435: -#line 796 "third_party/libpg_query/grammar/statements/create.y" + case 436: +#line 800 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = RELPERSISTENCE_PERMANENT; ;} break; - case 436: -#line 800 "third_party/libpg_query/grammar/statements/create.y" + case 437: +#line 804 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = PG_ATTRIBUTE_IDENTITY_ALWAYS; ;} break; - case 437: -#line 801 "third_party/libpg_query/grammar/statements/create.y" + case 438: +#line 805 "third_party/libpg_query/grammar/statements/create.y" { (yyval.ival) = ATTRIBUTE_IDENTITY_BY_DEFAULT; ;} break; - case 438: + case 439: #line 10 "third_party/libpg_query/grammar/statements/drop.y" { PGDropStmt *n = makeNode(PGDropStmt); @@ -24638,7 +24645,7 @@ YYLTYPE yylloc; ;} break; - case 439: + case 440: #line 20 "third_party/libpg_query/grammar/statements/drop.y" { PGDropStmt *n = makeNode(PGDropStmt); @@ -24651,7 +24658,7 @@ YYLTYPE yylloc; ;} break; - case 440: + case 441: #line 30 "third_party/libpg_query/grammar/statements/drop.y" { PGDropStmt *n = makeNode(PGDropStmt); @@ -24664,7 +24671,7 @@ YYLTYPE yylloc; ;} break; - case 441: + case 442: #line 40 "third_party/libpg_query/grammar/statements/drop.y" { PGDropStmt *n = makeNode(PGDropStmt); @@ -24677,7 +24684,7 @@ YYLTYPE yylloc; ;} break; - case 442: + case 443: #line 50 "third_party/libpg_query/grammar/statements/drop.y" { PGDropStmt *n = makeNode(PGDropStmt); @@ -24690,7 +24697,7 @@ YYLTYPE yylloc; ;} break; - case 443: + case 444: #line 60 "third_party/libpg_query/grammar/statements/drop.y" { PGDropStmt *n = makeNode(PGDropStmt); @@ -24703,167 +24710,167 @@ YYLTYPE yylloc; ;} break; - case 444: + case 445: #line 73 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_TABLE; ;} break; - case 445: + case 446: #line 74 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_SEQUENCE; ;} break; - case 446: + case 447: #line 75 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_FUNCTION; ;} break; - case 447: + case 448: #line 76 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_FUNCTION; ;} break; - case 448: + case 449: #line 77 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_TABLE_MACRO; ;} break; - case 449: + case 450: #line 78 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_VIEW; ;} break; - case 450: + case 451: #line 79 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_MATVIEW; ;} break; - case 451: + case 452: #line 80 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_INDEX; ;} break; - case 452: + case 453: #line 81 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_FOREIGN_TABLE; ;} break; - case 453: + case 454: #line 82 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_COLLATION; ;} break; - case 454: + case 455: #line 83 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_CONVERSION; ;} break; - case 455: + case 456: #line 84 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_SCHEMA; ;} break; - case 456: + case 457: #line 85 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_STATISTIC_EXT; ;} break; - case 457: + case 458: #line 86 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_TSPARSER; ;} break; - case 458: + case 459: #line 87 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_TSDICTIONARY; ;} break; - case 459: + case 460: #line 88 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_TSTEMPLATE; ;} break; - case 460: + case 461: #line 89 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_TSCONFIGURATION; ;} break; - case 461: + case 462: #line 90 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_TYPE; ;} break; - case 462: + case 463: #line 95 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_ACCESS_METHOD; ;} break; - case 463: + case 464: #line 96 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_EVENT_TRIGGER; ;} break; - case 464: + case 465: #line 97 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_EXTENSION; ;} break; - case 465: + case 466: #line 98 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_FDW; ;} break; - case 466: + case 467: #line 99 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_PUBLICATION; ;} break; - case 467: + case 468: #line 100 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_FOREIGN_SERVER; ;} break; - case 468: + case 469: #line 105 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].list)); ;} break; - case 469: + case 470: #line 106 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].list)); ;} break; - case 470: + case 471: #line 111 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.dbehavior) = PG_DROP_CASCADE; ;} break; - case 471: + case 472: #line 112 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.dbehavior) = PG_DROP_RESTRICT; ;} break; - case 472: + case 473: #line 113 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.dbehavior) = PG_DROP_RESTRICT; /* default */ ;} break; - case 473: + case 474: #line 118 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_POLICY; ;} break; - case 474: + case 475: #line 119 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_RULE; ;} break; - case 475: + case 476: #line 120 "third_party/libpg_query/grammar/statements/drop.y" { (yyval.objtype) = PG_OBJECT_TRIGGER; ;} break; - case 476: + case 477: #line 13 "third_party/libpg_query/grammar/statements/merge_into.y" { PGMergeIntoStmt *n = makeNode(PGMergeIntoStmt); @@ -24880,27 +24887,27 @@ YYLTYPE yylloc; ;} break; - case 477: + case 478: #line 29 "third_party/libpg_query/grammar/statements/merge_into.y" { (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; - case 478: + case 479: #line 30 "third_party/libpg_query/grammar/statements/merge_into.y" { (yyval.node) = NULL; ;} break; - case 479: + case 480: #line 34 "third_party/libpg_query/grammar/statements/merge_into.y" { (yyval.list) = (yyvsp[(2) - (3)].list); ;} break; - case 480: + case 481: #line 35 "third_party/libpg_query/grammar/statements/merge_into.y" { (yyval.list) = NULL; ;} break; - case 483: + case 484: #line 44 "third_party/libpg_query/grammar/statements/merge_into.y" { PGMatchAction *n = makeNode(PGMatchAction); @@ -24911,7 +24918,7 @@ YYLTYPE yylloc; ;} break; - case 484: + case 485: #line 52 "third_party/libpg_query/grammar/statements/merge_into.y" { PGMatchAction *n = makeNode(PGMatchAction); @@ -24921,7 +24928,7 @@ YYLTYPE yylloc; ;} break; - case 485: + case 486: #line 59 "third_party/libpg_query/grammar/statements/merge_into.y" { PGMatchAction *n = makeNode(PGMatchAction); @@ -24931,7 +24938,7 @@ YYLTYPE yylloc; ;} break; - case 486: + case 487: #line 66 "third_party/libpg_query/grammar/statements/merge_into.y" { PGMatchAction *n = makeNode(PGMatchAction); @@ -24940,7 +24947,7 @@ YYLTYPE yylloc; ;} break; - case 487: + case 488: #line 72 "third_party/libpg_query/grammar/statements/merge_into.y" { PGMatchAction *n = makeNode(PGMatchAction); @@ -24952,7 +24959,7 @@ YYLTYPE yylloc; ;} break; - case 488: + case 489: #line 81 "third_party/libpg_query/grammar/statements/merge_into.y" { PGMatchAction *n = makeNode(PGMatchAction); @@ -24962,7 +24969,7 @@ YYLTYPE yylloc; ;} break; - case 489: + case 490: #line 88 "third_party/libpg_query/grammar/statements/merge_into.y" { PGMatchAction *n = makeNode(PGMatchAction); @@ -24973,7 +24980,7 @@ YYLTYPE yylloc; ;} break; - case 490: + case 491: #line 96 "third_party/libpg_query/grammar/statements/merge_into.y" { PGMatchAction *n = makeNode(PGMatchAction); @@ -24982,7 +24989,7 @@ YYLTYPE yylloc; ;} break; - case 491: + case 492: #line 102 "third_party/libpg_query/grammar/statements/merge_into.y" { PGMatchAction *n = makeNode(PGMatchAction); @@ -24992,17 +24999,17 @@ YYLTYPE yylloc; ;} break; - case 492: + case 493: #line 111 "third_party/libpg_query/grammar/statements/merge_into.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 493: + case 494: #line 112 "third_party/libpg_query/grammar/statements/merge_into.y" { (yyval.node) = NULL; ;} break; - case 494: + case 495: #line 117 "third_party/libpg_query/grammar/statements/merge_into.y" { PGMatchAction *n = (PGMatchAction *) (yyvsp[(5) - (5)].node); @@ -25012,22 +25019,22 @@ YYLTYPE yylloc; ;} break; - case 495: + case 496: #line 126 "third_party/libpg_query/grammar/statements/merge_into.y" { (yyval.mergeaction) = MERGE_ACTION_WHEN_NOT_MATCHED_BY_SOURCE; ;} break; - case 496: + case 497: #line 127 "third_party/libpg_query/grammar/statements/merge_into.y" { (yyval.mergeaction) = MERGE_ACTION_WHEN_NOT_MATCHED_BY_TARGET; ;} break; - case 497: + case 498: #line 128 "third_party/libpg_query/grammar/statements/merge_into.y" { (yyval.mergeaction) = MERGE_ACTION_WHEN_NOT_MATCHED_BY_TARGET; ;} break; - case 498: + case 499: #line 133 "third_party/libpg_query/grammar/statements/merge_into.y" { PGMatchAction *n = (PGMatchAction *) (yyvsp[(7) - (7)].node); @@ -25037,17 +25044,17 @@ YYLTYPE yylloc; ;} break; - case 501: + case 502: #line 146 "third_party/libpg_query/grammar/statements/merge_into.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 502: + case 503: #line 147 "third_party/libpg_query/grammar/statements/merge_into.y" { (yyval.list) = list_concat(list_make1((yyvsp[(1) - (2)].node)), (yyvsp[(2) - (2)].list)); ;} break; - case 503: + case 504: #line 8 "third_party/libpg_query/grammar/statements/create_function.y" { PGCreateFunctionStmt *n = makeNode(PGCreateFunctionStmt); @@ -25059,7 +25066,7 @@ YYLTYPE yylloc; ;} break; - case 504: + case 505: #line 17 "third_party/libpg_query/grammar/statements/create_function.y" { PGCreateFunctionStmt *n = makeNode(PGCreateFunctionStmt); @@ -25071,7 +25078,7 @@ YYLTYPE yylloc; ;} break; - case 505: + case 506: #line 26 "third_party/libpg_query/grammar/statements/create_function.y" { PGCreateFunctionStmt *n = makeNode(PGCreateFunctionStmt); @@ -25083,7 +25090,7 @@ YYLTYPE yylloc; ;} break; - case 506: + case 507: #line 35 "third_party/libpg_query/grammar/statements/create_function.y" { PGCreateFunctionStmt *n = makeNode(PGCreateFunctionStmt); @@ -25095,7 +25102,7 @@ YYLTYPE yylloc; ;} break; - case 507: + case 508: #line 44 "third_party/libpg_query/grammar/statements/create_function.y" { PGCreateFunctionStmt *n = makeNode(PGCreateFunctionStmt); @@ -25107,7 +25114,7 @@ YYLTYPE yylloc; ;} break; - case 508: + case 509: #line 53 "third_party/libpg_query/grammar/statements/create_function.y" { PGCreateFunctionStmt *n = makeNode(PGCreateFunctionStmt); @@ -25119,7 +25126,7 @@ YYLTYPE yylloc; ;} break; - case 509: + case 510: #line 65 "third_party/libpg_query/grammar/statements/create_function.y" { PGFunctionDefinition *n = makeNode(PGFunctionDefinition); @@ -25129,7 +25136,7 @@ YYLTYPE yylloc; ;} break; - case 510: + case 511: #line 75 "third_party/libpg_query/grammar/statements/create_function.y" { PGFunctionDefinition *n = makeNode(PGFunctionDefinition); @@ -25139,28 +25146,28 @@ YYLTYPE yylloc; ;} break; - case 511: + case 512: #line 85 "third_party/libpg_query/grammar/statements/create_function.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 512: + case 513: #line 89 "third_party/libpg_query/grammar/statements/create_function.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; - case 513: + case 514: #line 96 "third_party/libpg_query/grammar/statements/create_function.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 515: + case 516: #line 104 "third_party/libpg_query/grammar/statements/create_function.y" { PGFunctionDefinition *n = makeNode(PGFunctionDefinition); @@ -25170,56 +25177,56 @@ YYLTYPE yylloc; ;} break; - case 516: + case 517: #line 114 "third_party/libpg_query/grammar/statements/create_function.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 517: + case 518: #line 118 "third_party/libpg_query/grammar/statements/create_function.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; - case 520: + case 521: #line 131 "third_party/libpg_query/grammar/statements/create_function.y" { (yyval.list) = NIL; ;} break; - case 521: + case 522: #line 135 "third_party/libpg_query/grammar/statements/create_function.y" { (yyval.list) = (yyvsp[(2) - (4)].list); ;} break; - case 522: + case 523: #line 139 "third_party/libpg_query/grammar/statements/create_function.y" { (yyval.list) = (yyvsp[(2) - (3)].list); ;} break; - case 523: + case 524: #line 146 "third_party/libpg_query/grammar/statements/create_function.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 524: + case 525: #line 150 "third_party/libpg_query/grammar/statements/create_function.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; - case 525: + case 526: #line 157 "third_party/libpg_query/grammar/statements/create_function.y" { PGFunctionParameter *n = makeNode(PGFunctionParameter); @@ -25230,7 +25237,7 @@ YYLTYPE yylloc; ;} break; - case 526: + case 527: #line 165 "third_party/libpg_query/grammar/statements/create_function.y" { PGFunctionParameter *n = makeNode(PGFunctionParameter); @@ -25241,7 +25248,7 @@ YYLTYPE yylloc; ;} break; - case 527: + case 528: #line 173 "third_party/libpg_query/grammar/statements/create_function.y" { PGFunctionParameter *n = makeNode(PGFunctionParameter); @@ -25252,7 +25259,7 @@ YYLTYPE yylloc; ;} break; - case 528: + case 529: #line 12 "third_party/libpg_query/grammar/statements/update.y" { PGUpdateStmt *n = makeNode(PGUpdateStmt); @@ -25266,7 +25273,7 @@ YYLTYPE yylloc; ;} break; - case 529: + case 530: #line 3 "third_party/libpg_query/grammar/statements/copy.y" { PGCopyStmt *n = makeNode(PGCopyStmt); @@ -25297,7 +25304,7 @@ YYLTYPE yylloc; ;} break; - case 530: + case 531: #line 31 "third_party/libpg_query/grammar/statements/copy.y" { PGCopyStmt *n = makeNode(PGCopyStmt); @@ -25319,7 +25326,7 @@ YYLTYPE yylloc; ;} break; - case 531: + case 532: #line 50 "third_party/libpg_query/grammar/statements/copy.y" { PGCopyDatabaseStmt *n = makeNode(PGCopyDatabaseStmt); @@ -25330,287 +25337,287 @@ YYLTYPE yylloc; ;} break; - case 532: + case 533: #line 61 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.conststr) = NULL; ;} break; - case 533: + case 534: #line 62 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.conststr) = "schema"; ;} break; - case 534: + case 535: #line 63 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.conststr) = "data"; ;} break; - case 535: + case 536: #line 67 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.boolean) = true; ;} break; - case 536: + case 537: #line 68 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.boolean) = false; ;} break; - case 537: + case 538: #line 74 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("delimiter", (PGNode *)makeString((yyvsp[(3) - (3)].str)), (yylsp[(2) - (3)])); ;} break; - case 538: + case 539: #line 77 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = NULL; ;} break; - case 539: + case 540: #line 94 "third_party/libpg_query/grammar/statements/copy.y" {;} break; - case 540: + case 541: #line 95 "third_party/libpg_query/grammar/statements/copy.y" {;} break; - case 541: + case 542: #line 99 "third_party/libpg_query/grammar/statements/copy.y" {;} break; - case 542: + case 543: #line 100 "third_party/libpg_query/grammar/statements/copy.y" {;} break; - case 543: + case 544: #line 105 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.boolean) = true; ;} break; - case 544: + case 545: #line 106 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.boolean) = false; ;} break; - case 545: + case 546: #line 110 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 546: + case 547: #line 111 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.list) = (yyvsp[(2) - (3)].list); ;} break; - case 547: + case 548: #line 116 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("oids", NULL, (yylsp[(1) - (2)])); ;} break; - case 548: + case 549: #line 119 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = NULL; ;} break; - case 549: + case 550: #line 124 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].defelt)); ;} break; - case 550: + case 551: #line 125 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.list) = NIL; ;} break; - case 551: + case 552: #line 131 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("format", (PGNode *)makeStringConst("binary", (yylsp[(1) - (1)])), (yylsp[(1) - (1)])); ;} break; - case 552: + case 553: #line 134 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = NULL; ;} break; - case 553: + case 554: #line 140 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("format", (PGNode *)makeStringConst("binary", (yylsp[(1) - (1)])), (yylsp[(1) - (1)])); ;} break; - case 554: + case 555: #line 144 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("oids", NULL, (yylsp[(1) - (1)])); ;} break; - case 555: + case 556: #line 148 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("freeze", NULL, (yylsp[(1) - (1)])); ;} break; - case 556: + case 557: #line 152 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("delimiter", (PGNode *)makeStringConst((yyvsp[(3) - (3)].str), (yylsp[(3) - (3)])), (yylsp[(1) - (3)])); ;} break; - case 557: + case 558: #line 156 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("null", (PGNode *)makeStringConst((yyvsp[(3) - (3)].str), (yylsp[(3) - (3)])), (yylsp[(1) - (3)])); ;} break; - case 558: + case 559: #line 160 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("format", (PGNode *)makeStringConst("csv", (yylsp[(1) - (1)])), (yylsp[(1) - (1)])); ;} break; - case 559: + case 560: #line 164 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("header", NULL, (yylsp[(1) - (1)])); ;} break; - case 560: + case 561: #line 168 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("quote", (PGNode *)makeStringConst((yyvsp[(3) - (3)].str), (yylsp[(3) - (3)])), (yylsp[(1) - (3)])); ;} break; - case 561: + case 562: #line 172 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("escape", (PGNode *)makeStringConst((yyvsp[(3) - (3)].str), (yylsp[(3) - (3)])), (yylsp[(1) - (3)])); ;} break; - case 562: + case 563: #line 176 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("force_quote", (PGNode *)(yyvsp[(3) - (3)].list), (yylsp[(1) - (3)])); ;} break; - case 563: + case 564: #line 180 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("force_quote", (PGNode *)makeNode(PGAStar), (yylsp[(1) - (3)])); ;} break; - case 564: + case 565: #line 184 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("partition_by", (PGNode *)(yyvsp[(3) - (3)].list), (yylsp[(1) - (3)])); ;} break; - case 565: + case 566: #line 188 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("partition_by", (PGNode *)makeNode(PGAStar), (yylsp[(1) - (3)])); ;} break; - case 566: + case 567: #line 192 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("force_not_null", (PGNode *)(yyvsp[(4) - (4)].list), (yylsp[(1) - (4)])); ;} break; - case 567: + case 568: #line 196 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("force_null", (PGNode *)(yyvsp[(3) - (3)].list), (yylsp[(1) - (3)])); ;} break; - case 568: + case 569: #line 200 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.defelt) = makeDefElem("encoding", (PGNode *)makeStringConst((yyvsp[(2) - (2)].str), (yylsp[(2) - (2)])), (yylsp[(1) - (2)])); ;} break; - case 569: + case 570: #line 211 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.node) = makeStringConst((yyvsp[(1) - (1)].str), (yylsp[(1) - (1)])); ;} break; - case 570: + case 571: #line 212 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.node) = makeStringConst("/dev/stdin", (yylsp[(1) - (1)])); ;} break; - case 571: + case 572: #line 213 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.node) = makeStringConst("/dev/stdout", (yylsp[(1) - (1)])); ;} break; - case 572: + case 573: #line 214 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.node) = makeStringConst(psprintf("%s.%s", (yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].str)), (yylsp[(1) - (3)])); ;} break; - case 573: + case 574: #line 215 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.node) = makeStringConst((yyvsp[(1) - (1)].str), (yylsp[(1) - (1)])); ;} break; - case 574: + case 575: #line 216 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.node) = (yyvsp[(2) - (3)].node); ;} break; - case 575: + case 576: #line 217 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 578: + case 579: #line 52 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(2) - (3)].node); ;} break; - case 579: + case 580: #line 53 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(2) - (3)].node); ;} break; - case 580: + case 581: #line 55 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(2) - (3)].node); ;} break; - case 581: + case 582: #line 72 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 582: + case 583: #line 74 "third_party/libpg_query/grammar/statements/select.y" { insertSelectOptions((PGSelectStmt *) (yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].list), NIL, @@ -25620,7 +25627,7 @@ YYLTYPE yylloc; ;} break; - case 583: + case 584: #line 81 "third_party/libpg_query/grammar/statements/select.y" { insertSelectOptions((PGSelectStmt *) (yyvsp[(1) - (4)].node), (yyvsp[(2) - (4)].list), (yyvsp[(3) - (4)].list), @@ -25631,7 +25638,7 @@ YYLTYPE yylloc; ;} break; - case 584: + case 585: #line 89 "third_party/libpg_query/grammar/statements/select.y" { insertSelectOptions((PGSelectStmt *) (yyvsp[(1) - (4)].node), (yyvsp[(2) - (4)].list), (yyvsp[(4) - (4)].list), @@ -25642,7 +25649,7 @@ YYLTYPE yylloc; ;} break; - case 585: + case 586: #line 97 "third_party/libpg_query/grammar/statements/select.y" { insertSelectOptions((PGSelectStmt *) (yyvsp[(2) - (2)].node), NULL, NIL, @@ -25653,7 +25660,7 @@ YYLTYPE yylloc; ;} break; - case 586: + case 587: #line 105 "third_party/libpg_query/grammar/statements/select.y" { insertSelectOptions((PGSelectStmt *) (yyvsp[(2) - (3)].node), (yyvsp[(3) - (3)].list), NIL, @@ -25664,7 +25671,7 @@ YYLTYPE yylloc; ;} break; - case 587: + case 588: #line 113 "third_party/libpg_query/grammar/statements/select.y" { insertSelectOptions((PGSelectStmt *) (yyvsp[(2) - (5)].node), (yyvsp[(3) - (5)].list), (yyvsp[(4) - (5)].list), @@ -25675,7 +25682,7 @@ YYLTYPE yylloc; ;} break; - case 588: + case 589: #line 121 "third_party/libpg_query/grammar/statements/select.y" { insertSelectOptions((PGSelectStmt *) (yyvsp[(2) - (5)].node), (yyvsp[(3) - (5)].list), (yyvsp[(5) - (5)].list), @@ -25686,24 +25693,24 @@ YYLTYPE yylloc; ;} break; - case 589: + case 590: #line 131 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 590: + case 591: #line 132 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 591: + case 592: #line 160 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(3) - (3)].list); ;} break; - case 592: + case 593: #line 164 "third_party/libpg_query/grammar/statements/select.y" { PGAStar *star = makeNode(PGAStar); @@ -25711,7 +25718,7 @@ YYLTYPE yylloc; ;} break; - case 593: + case 594: #line 175 "third_party/libpg_query/grammar/statements/select.y" { PGSelectStmt *n = makeNode(PGSelectStmt); @@ -25728,7 +25735,7 @@ YYLTYPE yylloc; ;} break; - case 594: + case 595: #line 191 "third_party/libpg_query/grammar/statements/select.y" { PGSelectStmt *n = makeNode(PGSelectStmt); @@ -25746,7 +25753,7 @@ YYLTYPE yylloc; ;} break; - case 595: + case 596: #line 208 "third_party/libpg_query/grammar/statements/select.y" { PGSelectStmt *n = makeNode(PGSelectStmt); @@ -25764,7 +25771,7 @@ YYLTYPE yylloc; ;} break; - case 596: + case 597: #line 226 "third_party/libpg_query/grammar/statements/select.y" { PGSelectStmt *n = makeNode(PGSelectStmt); @@ -25783,12 +25790,12 @@ YYLTYPE yylloc; ;} break; - case 597: + case 598: #line 241 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 598: + case 599: #line 243 "third_party/libpg_query/grammar/statements/select.y" { /* same as SELECT * FROM relation_expr */ @@ -25810,35 +25817,35 @@ YYLTYPE yylloc; ;} break; - case 599: + case 600: #line 262 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeSetOp(PG_SETOP_UNION_BY_NAME, (yyvsp[(3) - (5)].boolean), (yyvsp[(1) - (5)].node), (yyvsp[(5) - (5)].node)); ;} break; - case 600: + case 601: #line 266 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeSetOp(PG_SETOP_UNION, (yyvsp[(3) - (4)].boolean), (yyvsp[(1) - (4)].node), (yyvsp[(4) - (4)].node)); ;} break; - case 601: + case 602: #line 270 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeSetOp(PG_SETOP_INTERSECT, (yyvsp[(3) - (4)].boolean), (yyvsp[(1) - (4)].node), (yyvsp[(4) - (4)].node)); ;} break; - case 602: + case 603: #line 274 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeSetOp(PG_SETOP_EXCEPT, (yyvsp[(3) - (4)].boolean), (yyvsp[(1) - (4)].node), (yyvsp[(4) - (4)].node)); ;} break; - case 603: + case 604: #line 278 "third_party/libpg_query/grammar/statements/select.y" { PGSelectStmt *res = makeNode(PGSelectStmt); @@ -25851,7 +25858,7 @@ YYLTYPE yylloc; ;} break; - case 604: + case 605: #line 288 "third_party/libpg_query/grammar/statements/select.y" { PGSelectStmt *res = makeNode(PGSelectStmt); @@ -25865,7 +25872,7 @@ YYLTYPE yylloc; ;} break; - case 605: + case 606: #line 299 "third_party/libpg_query/grammar/statements/select.y" { PGSelectStmt *res = makeNode(PGSelectStmt); @@ -25878,7 +25885,7 @@ YYLTYPE yylloc; ;} break; - case 606: + case 607: #line 309 "third_party/libpg_query/grammar/statements/select.y" { PGSelectStmt *res = makeNode(PGSelectStmt); @@ -25890,7 +25897,7 @@ YYLTYPE yylloc; ;} break; - case 607: + case 608: #line 318 "third_party/libpg_query/grammar/statements/select.y" { PGSelectStmt *res = makeNode(PGSelectStmt); @@ -25904,7 +25911,7 @@ YYLTYPE yylloc; ;} break; - case 608: + case 609: #line 329 "third_party/libpg_query/grammar/statements/select.y" { PGSelectStmt *res = makeNode(PGSelectStmt); @@ -25918,7 +25925,7 @@ YYLTYPE yylloc; ;} break; - case 609: + case 610: #line 340 "third_party/libpg_query/grammar/statements/select.y" { PGSelectStmt *res = makeNode(PGSelectStmt); @@ -25933,7 +25940,7 @@ YYLTYPE yylloc; ;} break; - case 610: + case 611: #line 352 "third_party/libpg_query/grammar/statements/select.y" { PGSelectStmt *res = makeNode(PGSelectStmt); @@ -25951,7 +25958,7 @@ YYLTYPE yylloc; ;} break; - case 611: + case 612: #line 367 "third_party/libpg_query/grammar/statements/select.y" { PGSelectStmt *res = makeNode(PGSelectStmt); @@ -25969,7 +25976,7 @@ YYLTYPE yylloc; ;} break; - case 618: + case 619: #line 397 "third_party/libpg_query/grammar/statements/select.y" { PGPivot *n = makeNode(PGPivot); @@ -25978,7 +25985,7 @@ YYLTYPE yylloc; ;} break; - case 619: + case 620: #line 403 "third_party/libpg_query/grammar/statements/select.y" { PGPivot *n = makeNode(PGPivot); @@ -25988,32 +25995,32 @@ YYLTYPE yylloc; ;} break; - case 620: + case 621: #line 409 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 621: + case 622: #line 413 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 622: + case 623: #line 414 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; - case 623: + case 624: #line 418 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 624: + case 625: #line 419 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (2)].list); ;} break; - case 625: + case 626: #line 434 "third_party/libpg_query/grammar/statements/select.y" { (yyval.with) = makeNode(PGWithClause); @@ -26023,7 +26030,7 @@ YYLTYPE yylloc; ;} break; - case 626: + case 627: #line 441 "third_party/libpg_query/grammar/statements/select.y" { (yyval.with) = makeNode(PGWithClause); @@ -26033,7 +26040,7 @@ YYLTYPE yylloc; ;} break; - case 627: + case 628: #line 448 "third_party/libpg_query/grammar/statements/select.y" { (yyval.with) = makeNode(PGWithClause); @@ -26043,17 +26050,17 @@ YYLTYPE yylloc; ;} break; - case 628: + case 629: #line 457 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 629: + case 630: #line 458 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; - case 630: + case 631: #line 462 "third_party/libpg_query/grammar/statements/select.y" { PGCommonTableExpr *n = makeNode(PGCommonTableExpr); @@ -26067,52 +26074,52 @@ YYLTYPE yylloc; ;} break; - case 631: + case 632: #line 475 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(4) - (5)].list); ;} break; - case 632: + case 633: #line 476 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(NIL); ;} break; - case 633: + case 634: #line 480 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 634: + case 635: #line 481 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (2)].list); ;} break; - case 635: + case 636: #line 485 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 636: + case 637: #line 486 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; - case 637: + case 638: #line 490 "third_party/libpg_query/grammar/statements/select.y" { (yyval.ctematerialize) = PGCTEMaterializeAlways; ;} break; - case 638: + case 639: #line 491 "third_party/libpg_query/grammar/statements/select.y" { (yyval.ctematerialize) = PGCTEMaterializeNever; ;} break; - case 639: + case 640: #line 492 "third_party/libpg_query/grammar/statements/select.y" { (yyval.ctematerialize) = PGCTEMaterializeDefault; ;} break; - case 640: + case 641: #line 497 "third_party/libpg_query/grammar/statements/select.y" { (yyval.into) = makeNode(PGIntoClause); @@ -26125,12 +26132,12 @@ YYLTYPE yylloc; ;} break; - case 641: + case 642: #line 507 "third_party/libpg_query/grammar/statements/select.y" { (yyval.into) = NULL; ;} break; - case 642: + case 643: #line 516 "third_party/libpg_query/grammar/statements/select.y" { (yyval.range) = (yyvsp[(3) - (3)].range); @@ -26138,7 +26145,7 @@ YYLTYPE yylloc; ;} break; - case 643: + case 644: #line 521 "third_party/libpg_query/grammar/statements/select.y" { (yyval.range) = (yyvsp[(3) - (3)].range); @@ -26146,7 +26153,7 @@ YYLTYPE yylloc; ;} break; - case 644: + case 645: #line 526 "third_party/libpg_query/grammar/statements/select.y" { (yyval.range) = (yyvsp[(4) - (4)].range); @@ -26154,7 +26161,7 @@ YYLTYPE yylloc; ;} break; - case 645: + case 646: #line 531 "third_party/libpg_query/grammar/statements/select.y" { (yyval.range) = (yyvsp[(4) - (4)].range); @@ -26162,7 +26169,7 @@ YYLTYPE yylloc; ;} break; - case 646: + case 647: #line 536 "third_party/libpg_query/grammar/statements/select.y" { ereport(PGWARNING, @@ -26173,7 +26180,7 @@ YYLTYPE yylloc; ;} break; - case 647: + case 648: #line 544 "third_party/libpg_query/grammar/statements/select.y" { ereport(PGWARNING, @@ -26184,7 +26191,7 @@ YYLTYPE yylloc; ;} break; - case 648: + case 649: #line 552 "third_party/libpg_query/grammar/statements/select.y" { (yyval.range) = (yyvsp[(3) - (3)].range); @@ -26192,7 +26199,7 @@ YYLTYPE yylloc; ;} break; - case 649: + case 650: #line 557 "third_party/libpg_query/grammar/statements/select.y" { (yyval.range) = (yyvsp[(2) - (2)].range); @@ -26200,7 +26207,7 @@ YYLTYPE yylloc; ;} break; - case 650: + case 651: #line 562 "third_party/libpg_query/grammar/statements/select.y" { (yyval.range) = (yyvsp[(1) - (1)].range); @@ -26208,87 +26215,87 @@ YYLTYPE yylloc; ;} break; - case 651: + case 652: #line 568 "third_party/libpg_query/grammar/statements/select.y" {;} break; - case 652: + case 653: #line 569 "third_party/libpg_query/grammar/statements/select.y" {;} break; - case 653: + case 654: #line 573 "third_party/libpg_query/grammar/statements/select.y" { (yyval.boolean) = true; ;} break; - case 654: + case 655: #line 574 "third_party/libpg_query/grammar/statements/select.y" { (yyval.boolean) = false; ;} break; - case 655: + case 656: #line 575 "third_party/libpg_query/grammar/statements/select.y" { (yyval.boolean) = false; ;} break; - case 656: + case 657: #line 579 "third_party/libpg_query/grammar/statements/select.y" { ;} break; - case 657: + case 658: #line 586 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(NIL); ;} break; - case 658: + case 659: #line 587 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(4) - (5)].list); ;} break; - case 659: + case 660: #line 591 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL;;} break; - case 660: + case 661: #line 592 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 661: + case 662: #line 596 "third_party/libpg_query/grammar/statements/select.y" { (yyval.ignorenulls) = PG_IGNORE_NULLS;;} break; - case 662: + case 663: #line 597 "third_party/libpg_query/grammar/statements/select.y" { (yyval.ignorenulls) = PG_RESPECT_NULLS;;} break; - case 663: + case 664: #line 598 "third_party/libpg_query/grammar/statements/select.y" { (yyval.ignorenulls) = PG_DEFAULT_NULLS; ;} break; - case 664: + case 665: #line 602 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list);;} break; - case 665: + case 666: #line 603 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 666: + case 667: #line 607 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(3) - (3)].list); ;} break; - case 667: + case 668: #line 609 "third_party/libpg_query/grammar/statements/select.y" { PGSortBy *sort = makeNode(PGSortBy); @@ -26304,17 +26311,17 @@ YYLTYPE yylloc; ;} break; - case 668: + case 669: #line 624 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].sortby)); ;} break; - case 669: + case 670: #line 625 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].sortby)); ;} break; - case 670: + case 671: #line 629 "third_party/libpg_query/grammar/statements/select.y" { (yyval.sortby) = makeNode(PGSortBy); @@ -26326,7 +26333,7 @@ YYLTYPE yylloc; ;} break; - case 671: + case 672: #line 638 "third_party/libpg_query/grammar/statements/select.y" { (yyval.sortby) = makeNode(PGSortBy); @@ -26338,72 +26345,72 @@ YYLTYPE yylloc; ;} break; - case 672: + case 673: #line 648 "third_party/libpg_query/grammar/statements/select.y" { (yyval.sortorder) = PG_SORTBY_ASC; ;} break; - case 673: + case 674: #line 649 "third_party/libpg_query/grammar/statements/select.y" { (yyval.sortorder) = PG_SORTBY_DESC; ;} break; - case 674: + case 675: #line 650 "third_party/libpg_query/grammar/statements/select.y" { (yyval.sortorder) = PG_SORTBY_DEFAULT; ;} break; - case 675: + case 676: #line 653 "third_party/libpg_query/grammar/statements/select.y" { (yyval.nullorder) = PG_SORTBY_NULLS_FIRST; ;} break; - case 676: + case 677: #line 654 "third_party/libpg_query/grammar/statements/select.y" { (yyval.nullorder) = PG_SORTBY_NULLS_LAST; ;} break; - case 677: + case 678: #line 655 "third_party/libpg_query/grammar/statements/select.y" { (yyval.nullorder) = PG_SORTBY_NULLS_DEFAULT; ;} break; - case 678: + case 679: #line 659 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make3((yyvsp[(2) - (2)].node), (yyvsp[(1) - (2)].node), NULL); ;} break; - case 679: + case 680: #line 660 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make3((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].node), (yyvsp[(1) - (2)].node)); ;} break; - case 680: + case 681: #line 661 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make3(NULL, (yyvsp[(1) - (1)].node), NULL); ;} break; - case 681: + case 682: #line 662 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make3((yyvsp[(1) - (1)].node), NULL, (yyvsp[(1) - (1)].node)); ;} break; - case 682: + case 683: #line 666 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 683: + case 684: #line 667 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make3(NULL,NULL,NULL); ;} break; - case 684: + case 685: #line 672 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; - case 685: + case 686: #line 674 "third_party/libpg_query/grammar/statements/select.y" { /* Disabled because it was too confusing, bjm 2002-02-18 */ @@ -26415,91 +26422,91 @@ YYLTYPE yylloc; ;} break; - case 686: + case 687: #line 690 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(3) - (5)].node); ;} break; - case 687: + case 688: #line 692 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeIntConst(1, -1); ;} break; - case 688: + case 689: #line 697 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; - case 689: + case 690: #line 700 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(2) - (3)].node); ;} break; - case 690: + case 691: #line 705 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeFloatConst((yyvsp[(1) - (1)].str), (yylsp[(1) - (1)])); ;} break; - case 691: + case 692: #line 709 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeIntConst((yyvsp[(1) - (1)].ival), (yylsp[(1) - (1)])); ;} break; - case 693: + case 694: #line 720 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeSampleSize((yyvsp[(1) - (2)].node), true); ;} break; - case 694: + case 695: #line 724 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeSampleSize((yyvsp[(1) - (2)].node), true); ;} break; - case 695: + case 696: #line 728 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeSampleSize((yyvsp[(1) - (1)].node), false); ;} break; - case 696: + case 697: #line 732 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeSampleSize((yyvsp[(1) - (2)].node), false); ;} break; - case 697: + case 698: #line 739 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(3) - (3)].node); ;} break; - case 698: + case 699: #line 743 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = NULL; ;} break; - case 699: + case 700: #line 750 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 700: + case 701: #line 751 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = NULL; ;} break; - case 701: + case 702: #line 756 "third_party/libpg_query/grammar/statements/select.y" { int seed = (yyvsp[(5) - (5)].ival); @@ -26507,21 +26514,21 @@ YYLTYPE yylloc; ;} break; - case 702: + case 703: #line 761 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeSampleOptions((yyvsp[(1) - (1)].node), NULL, NULL, (yylsp[(1) - (1)])); ;} break; - case 703: + case 704: #line 765 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeSampleOptions((yyvsp[(1) - (4)].node), (yyvsp[(3) - (4)].str), NULL, (yylsp[(1) - (4)])); ;} break; - case 704: + case 705: #line 769 "third_party/libpg_query/grammar/statements/select.y" { int seed = (yyvsp[(5) - (6)].ival); @@ -26529,44 +26536,44 @@ YYLTYPE yylloc; ;} break; - case 705: + case 706: #line 777 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; - case 706: + case 707: #line 783 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 707: + case 708: #line 784 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = NULL; ;} break; - case 708: + case 709: #line 789 "third_party/libpg_query/grammar/statements/select.y" { (yyval.ival) = (yyvsp[(3) - (4)].ival); ;} break; - case 709: + case 710: #line 790 "third_party/libpg_query/grammar/statements/select.y" { (yyval.ival) = -1; ;} break; - case 710: + case 711: #line 795 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (char*) "TIMESTAMP"; ;} break; - case 711: + case 712: #line 796 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (char*) "VERSION"; ;} break; - case 712: + case 713: #line 801 "third_party/libpg_query/grammar/statements/select.y" { PGAtClause *n = makeNode(PGAtClause); @@ -26576,22 +26583,22 @@ YYLTYPE yylloc; ;} break; - case 713: + case 714: #line 810 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(3) - (4)].node); ;} break; - case 714: + case 715: #line 811 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = NULL; ;} break; - case 715: + case 716: #line 816 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 716: + case 717: #line 818 "third_party/libpg_query/grammar/statements/select.y" { /* LIMIT ALL is represented as a NULL constant */ @@ -26599,77 +26606,77 @@ YYLTYPE yylloc; ;} break; - case 717: + case 718: #line 823 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeLimitPercent((yyvsp[(1) - (2)].node)); ;} break; - case 718: + case 719: #line 825 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeLimitPercent(makeFloatConst((yyvsp[(1) - (2)].str),(yylsp[(1) - (2)]))); ;} break; - case 719: + case 720: #line 827 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeLimitPercent(makeIntConst((yyvsp[(1) - (2)].ival),(yylsp[(1) - (2)]))); ;} break; - case 720: + case 721: #line 831 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 721: + case 722: #line 851 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 722: + case 723: #line 853 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "+", NULL, (yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} break; - case 723: + case 724: #line 855 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = doNegate((yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} break; - case 724: + case 725: #line 859 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeIntConst((yyvsp[(1) - (1)].ival),(yylsp[(1) - (1)])); ;} break; - case 725: + case 726: #line 860 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeFloatConst((yyvsp[(1) - (1)].str),(yylsp[(1) - (1)])); ;} break; - case 726: + case 727: #line 864 "third_party/libpg_query/grammar/statements/select.y" { (yyval.ival) = 0; ;} break; - case 727: + case 728: #line 865 "third_party/libpg_query/grammar/statements/select.y" { (yyval.ival) = 0; ;} break; - case 728: + case 729: #line 868 "third_party/libpg_query/grammar/statements/select.y" { (yyval.ival) = 0; ;} break; - case 729: + case 730: #line 869 "third_party/libpg_query/grammar/statements/select.y" { (yyval.ival) = 0; ;} break; - case 730: + case 731: #line 894 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(3) - (3)].list); ;} break; - case 731: + case 732: #line 896 "third_party/libpg_query/grammar/statements/select.y" { PGNode *node = (PGNode *) makeGroupingSet(GROUPING_SET_ALL, NIL, (yylsp[(3) - (3)])); @@ -26677,145 +26684,145 @@ YYLTYPE yylloc; ;} break; - case 732: + case 733: #line 900 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 733: + case 734: #line 904 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 734: + case 735: #line 905 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list),(yyvsp[(3) - (3)].node)); ;} break; - case 735: + case 736: #line 909 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 736: + case 737: #line 910 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (2)].list); ;} break; - case 737: + case 738: #line 914 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 738: + case 739: #line 915 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 739: + case 740: #line 916 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 740: + case 741: #line 917 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 741: + case 742: #line 918 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 742: + case 743: #line 923 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeGroupingSet(GROUPING_SET_EMPTY, NIL, (yylsp[(1) - (2)])); ;} break; - case 743: + case 744: #line 936 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeGroupingSet(GROUPING_SET_ROLLUP, (yyvsp[(3) - (4)].list), (yylsp[(1) - (4)])); ;} break; - case 744: + case 745: #line 943 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeGroupingSet(GROUPING_SET_CUBE, (yyvsp[(3) - (4)].list), (yylsp[(1) - (4)])); ;} break; - case 745: + case 746: #line 950 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeGroupingSet(GROUPING_SET_SETS, (yyvsp[(4) - (5)].list), (yylsp[(1) - (5)])); ;} break; - case 746: + case 747: #line 956 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = NULL; ;} break; - case 747: + case 748: #line 957 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = NULL; ;} break; - case 748: + case 749: #line 961 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; - case 749: + case 750: #line 962 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = NULL; ;} break; - case 750: + case 751: #line 966 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; - case 751: + case 752: #line 967 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = NULL; ;} break; - case 752: + case 753: #line 971 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 753: + case 754: #line 972 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 754: + case 755: #line 976 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 755: + case 756: #line 977 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 756: + case 757: #line 981 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 757: + case 758: #line 982 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].node)); ;} break; - case 758: + case 759: #line 987 "third_party/libpg_query/grammar/statements/select.y" { PGLockingClause *n = makeNode(PGLockingClause); @@ -26826,52 +26833,52 @@ YYLTYPE yylloc; ;} break; - case 759: + case 760: #line 997 "third_party/libpg_query/grammar/statements/select.y" { (yyval.lockstrength) = LCS_FORUPDATE; ;} break; - case 760: + case 761: #line 998 "third_party/libpg_query/grammar/statements/select.y" { (yyval.lockstrength) = PG_LCS_FORNOKEYUPDATE; ;} break; - case 761: + case 762: #line 999 "third_party/libpg_query/grammar/statements/select.y" { (yyval.lockstrength) = PG_LCS_FORSHARE; ;} break; - case 762: + case 763: #line 1000 "third_party/libpg_query/grammar/statements/select.y" { (yyval.lockstrength) = PG_LCS_FORKEYSHARE; ;} break; - case 763: + case 764: #line 1004 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(2) - (2)].list); ;} break; - case 764: + case 765: #line 1005 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 765: + case 766: #line 1010 "third_party/libpg_query/grammar/statements/select.y" { (yyval.lockwaitpolicy) = LockWaitError; ;} break; - case 766: + case 767: #line 1011 "third_party/libpg_query/grammar/statements/select.y" { (yyval.lockwaitpolicy) = PGLockWaitSkip; ;} break; - case 767: + case 768: #line 1012 "third_party/libpg_query/grammar/statements/select.y" { (yyval.lockwaitpolicy) = PGLockWaitBlock; ;} break; - case 768: + case 769: #line 1022 "third_party/libpg_query/grammar/statements/select.y" { PGSelectStmt *n = makeNode(PGSelectStmt); @@ -26880,7 +26887,7 @@ YYLTYPE yylloc; ;} break; - case 769: + case 770: #line 1028 "third_party/libpg_query/grammar/statements/select.y" { PGSelectStmt *n = (PGSelectStmt *) (yyvsp[(1) - (5)].node); @@ -26889,47 +26896,47 @@ YYLTYPE yylloc; ;} break; - case 770: + case 771: #line 1036 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 771: + case 772: #line 1037 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (2)].node); ;} break; - case 772: + case 773: #line 1050 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(2) - (2)].list); ;} break; - case 773: + case 774: #line 1051 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 774: + case 775: #line 1055 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 775: + case 776: #line 1056 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; - case 776: + case 777: #line 1060 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 777: + case 778: #line 1061 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (2)].list); ;} break; - case 778: + case 779: #line 1066 "third_party/libpg_query/grammar/statements/select.y" { (yyval.alias) = makeNode(PGAlias); @@ -26937,7 +26944,7 @@ YYLTYPE yylloc; ;} break; - case 779: + case 780: #line 1077 "third_party/libpg_query/grammar/statements/select.y" { (yyvsp[(1) - (4)].range)->at_clause = (yyvsp[(3) - (4)].node); @@ -26947,7 +26954,7 @@ YYLTYPE yylloc; ;} break; - case 780: + case 781: #line 1084 "third_party/libpg_query/grammar/statements/select.y" { (yyvsp[(2) - (4)].range)->at_clause = (yyvsp[(3) - (4)].node); @@ -26957,7 +26964,7 @@ YYLTYPE yylloc; ;} break; - case 781: + case 782: #line 1091 "third_party/libpg_query/grammar/statements/select.y" { PGRangeFunction *n = (PGRangeFunction *) (yyvsp[(1) - (3)].node); @@ -26968,7 +26975,7 @@ YYLTYPE yylloc; ;} break; - case 782: + case 783: #line 1099 "third_party/libpg_query/grammar/statements/select.y" { PGRangeFunction *n = (PGRangeFunction *) (yyvsp[(2) - (3)].node); @@ -26978,7 +26985,7 @@ YYLTYPE yylloc; ;} break; - case 783: + case 784: #line 1107 "third_party/libpg_query/grammar/statements/select.y" { PGRangeSubselect *n = makeNode(PGRangeSubselect); @@ -26990,7 +26997,7 @@ YYLTYPE yylloc; ;} break; - case 784: + case 785: #line 1117 "third_party/libpg_query/grammar/statements/select.y" { PGRangeFunction *n = (PGRangeFunction *) (yyvsp[(2) - (3)].node); @@ -27001,7 +27008,7 @@ YYLTYPE yylloc; ;} break; - case 785: + case 786: #line 1125 "third_party/libpg_query/grammar/statements/select.y" { PGRangeSubselect *n = makeNode(PGRangeSubselect); @@ -27013,7 +27020,7 @@ YYLTYPE yylloc; ;} break; - case 786: + case 787: #line 1134 "third_party/libpg_query/grammar/statements/select.y" { PGRangeSubselect *n = makeNode(PGRangeSubselect); @@ -27025,7 +27032,7 @@ YYLTYPE yylloc; ;} break; - case 787: + case 788: #line 1143 "third_party/libpg_query/grammar/statements/select.y" { PGRangeSubselect *n = makeNode(PGRangeSubselect); @@ -27037,14 +27044,14 @@ YYLTYPE yylloc; ;} break; - case 788: + case 789: #line 1152 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) (yyvsp[(1) - (1)].jexpr); ;} break; - case 789: + case 790: #line 1156 "third_party/libpg_query/grammar/statements/select.y" { (yyvsp[(2) - (4)].jexpr)->alias = (yyvsp[(4) - (4)].alias); @@ -27052,7 +27059,7 @@ YYLTYPE yylloc; ;} break; - case 790: + case 791: #line 1161 "third_party/libpg_query/grammar/statements/select.y" { (yyvsp[(3) - (4)].jexpr)->alias = (yyvsp[(1) - (4)].alias); @@ -27060,7 +27067,7 @@ YYLTYPE yylloc; ;} break; - case 791: + case 792: #line 1166 "third_party/libpg_query/grammar/statements/select.y" { PGPivotExpr *n = makeNode(PGPivotExpr); @@ -27074,7 +27081,7 @@ YYLTYPE yylloc; ;} break; - case 792: + case 793: #line 1177 "third_party/libpg_query/grammar/statements/select.y" { PGPivotExpr *n = makeNode(PGPivotExpr); @@ -27088,32 +27095,32 @@ YYLTYPE yylloc; ;} break; - case 793: + case 794: #line 1190 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(3) - (3)].list); ;} break; - case 794: + case 795: #line 1191 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NULL; ;} break; - case 795: + case 796: #line 1194 "third_party/libpg_query/grammar/statements/select.y" { (yyval.boolean) = true; ;} break; - case 796: + case 797: #line 1195 "third_party/libpg_query/grammar/statements/select.y" { (yyval.boolean) = false; ;} break; - case 797: + case 798: #line 1196 "third_party/libpg_query/grammar/statements/select.y" { (yyval.boolean) = false; ;} break; - case 798: + case 799: #line 1200 "third_party/libpg_query/grammar/statements/select.y" { PGPivot *n = makeNode(PGPivot); @@ -27123,7 +27130,7 @@ YYLTYPE yylloc; ;} break; - case 799: + case 800: #line 1208 "third_party/libpg_query/grammar/statements/select.y" { PGPivot *n = makeNode(PGPivot); @@ -27133,22 +27140,22 @@ YYLTYPE yylloc; ;} break; - case 800: + case 801: #line 1217 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 801: + case 802: #line 1218 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 802: + case 803: #line 1219 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(2) - (3)].list); ;} break; - case 803: + case 804: #line 1223 "third_party/libpg_query/grammar/statements/select.y" { PGPivot *n = makeNode(PGPivot); @@ -27158,7 +27165,7 @@ YYLTYPE yylloc; ;} break; - case 804: + case 805: #line 1231 "third_party/libpg_query/grammar/statements/select.y" { PGPivot *n = makeNode(PGPivot); @@ -27168,31 +27175,31 @@ YYLTYPE yylloc; ;} break; - case 805: + case 806: #line 1240 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 806: + case 807: #line 1244 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].node)); ;} break; - case 807: + case 808: #line 1250 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeString((yyvsp[(1) - (1)].str))); ;} break; - case 808: + case 809: #line 1251 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(2) - (3)].list); ;} break; - case 809: + case 810: #line 1256 "third_party/libpg_query/grammar/statements/select.y" { PGPivot *n = makeNode(PGPivot); @@ -27202,28 +27209,28 @@ YYLTYPE yylloc; ;} break; - case 810: + case 811: #line 1265 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 811: + case 812: #line 1269 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].node)); ;} break; - case 812: + case 813: #line 1294 "third_party/libpg_query/grammar/statements/select.y" { (yyval.jexpr) = (yyvsp[(2) - (3)].jexpr); ;} break; - case 813: + case 814: #line 1298 "third_party/libpg_query/grammar/statements/select.y" { /* CROSS JOIN is same as unqualified inner join */ @@ -27239,7 +27246,7 @@ YYLTYPE yylloc; ;} break; - case 814: + case 815: #line 1311 "third_party/libpg_query/grammar/statements/select.y" { PGJoinExpr *n = makeNode(PGJoinExpr); @@ -27256,7 +27263,7 @@ YYLTYPE yylloc; ;} break; - case 815: + case 816: #line 1325 "third_party/libpg_query/grammar/statements/select.y" { /* letting join_type reduce to empty doesn't work */ @@ -27274,7 +27281,7 @@ YYLTYPE yylloc; ;} break; - case 816: + case 817: #line 1340 "third_party/libpg_query/grammar/statements/select.y" { PGJoinExpr *n = makeNode(PGJoinExpr); @@ -27289,7 +27296,7 @@ YYLTYPE yylloc; ;} break; - case 817: + case 818: #line 1352 "third_party/libpg_query/grammar/statements/select.y" { /* letting join_type reduce to empty doesn't work */ @@ -27305,7 +27312,7 @@ YYLTYPE yylloc; ;} break; - case 818: + case 819: #line 1365 "third_party/libpg_query/grammar/statements/select.y" { PGJoinExpr *n = makeNode(PGJoinExpr); @@ -27322,7 +27329,7 @@ YYLTYPE yylloc; ;} break; - case 819: + case 820: #line 1379 "third_party/libpg_query/grammar/statements/select.y" { PGJoinExpr *n = makeNode(PGJoinExpr); @@ -27339,7 +27346,7 @@ YYLTYPE yylloc; ;} break; - case 820: + case 821: #line 1393 "third_party/libpg_query/grammar/statements/select.y" { /* POSITIONAL JOIN is a coordinated scan */ @@ -27355,7 +27362,7 @@ YYLTYPE yylloc; ;} break; - case 821: + case 822: #line 1406 "third_party/libpg_query/grammar/statements/select.y" { /* ANTI JOIN is a filter */ @@ -27373,7 +27380,7 @@ YYLTYPE yylloc; ;} break; - case 822: + case 823: #line 1421 "third_party/libpg_query/grammar/statements/select.y" { /* SEMI JOIN is also a filter */ @@ -27392,7 +27399,7 @@ YYLTYPE yylloc; ;} break; - case 823: + case 824: #line 1440 "third_party/libpg_query/grammar/statements/select.y" { (yyval.alias) = makeNode(PGAlias); @@ -27401,7 +27408,7 @@ YYLTYPE yylloc; ;} break; - case 824: + case 825: #line 1446 "third_party/libpg_query/grammar/statements/select.y" { (yyval.alias) = makeNode(PGAlias); @@ -27409,7 +27416,7 @@ YYLTYPE yylloc; ;} break; - case 825: + case 826: #line 1451 "third_party/libpg_query/grammar/statements/select.y" { (yyval.alias) = makeNode(PGAlias); @@ -27418,7 +27425,7 @@ YYLTYPE yylloc; ;} break; - case 826: + case 827: #line 1457 "third_party/libpg_query/grammar/statements/select.y" { (yyval.alias) = makeNode(PGAlias); @@ -27426,31 +27433,31 @@ YYLTYPE yylloc; ;} break; - case 827: + case 828: #line 1463 "third_party/libpg_query/grammar/statements/select.y" { (yyval.alias) = (yyvsp[(1) - (1)].alias); ;} break; - case 828: + case 829: #line 1464 "third_party/libpg_query/grammar/statements/select.y" { (yyval.alias) = NULL; ;} break; - case 829: + case 830: #line 1473 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make2((yyvsp[(1) - (1)].alias), NIL); ;} break; - case 830: + case 831: #line 1477 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make2(NULL, (yyvsp[(3) - (4)].list)); ;} break; - case 831: + case 832: #line 1481 "third_party/libpg_query/grammar/statements/select.y" { PGAlias *a = makeNode(PGAlias); @@ -27459,7 +27466,7 @@ YYLTYPE yylloc; ;} break; - case 832: + case 833: #line 1487 "third_party/libpg_query/grammar/statements/select.y" { PGAlias *a = makeNode(PGAlias); @@ -27468,64 +27475,64 @@ YYLTYPE yylloc; ;} break; - case 833: + case 834: #line 1493 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make2(NULL, NIL); ;} break; - case 834: + case 835: #line 1498 "third_party/libpg_query/grammar/statements/select.y" { (yyval.jtype) = PG_JOIN_FULL; ;} break; - case 835: + case 836: #line 1499 "third_party/libpg_query/grammar/statements/select.y" { (yyval.jtype) = PG_JOIN_LEFT; ;} break; - case 836: + case 837: #line 1500 "third_party/libpg_query/grammar/statements/select.y" { (yyval.jtype) = PG_JOIN_RIGHT; ;} break; - case 837: + case 838: #line 1501 "third_party/libpg_query/grammar/statements/select.y" { (yyval.jtype) = PG_JOIN_SEMI; ;} break; - case 838: + case 839: #line 1502 "third_party/libpg_query/grammar/statements/select.y" { (yyval.jtype) = PG_JOIN_ANTI; ;} break; - case 839: + case 840: #line 1503 "third_party/libpg_query/grammar/statements/select.y" { (yyval.jtype) = PG_JOIN_INNER; ;} break; - case 840: + case 841: #line 1507 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = NULL; ;} break; - case 841: + case 842: #line 1508 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = NULL; ;} break; - case 842: + case 843: #line 1520 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) (yyvsp[(3) - (4)].list); ;} break; - case 843: + case 844: #line 1521 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; - case 844: + case 845: #line 1527 "third_party/libpg_query/grammar/statements/select.y" { /* inheritance query, implicitly */ @@ -27535,7 +27542,7 @@ YYLTYPE yylloc; ;} break; - case 845: + case 846: #line 1534 "third_party/libpg_query/grammar/statements/select.y" { /* inheritance query, explicitly */ @@ -27545,7 +27552,7 @@ YYLTYPE yylloc; ;} break; - case 846: + case 847: #line 1541 "third_party/libpg_query/grammar/statements/select.y" { /* no inheritance */ @@ -27555,7 +27562,7 @@ YYLTYPE yylloc; ;} break; - case 847: + case 848: #line 1548 "third_party/libpg_query/grammar/statements/select.y" { /* no inheritance, SQL99-style syntax */ @@ -27565,7 +27572,7 @@ YYLTYPE yylloc; ;} break; - case 848: + case 849: #line 1580 "third_party/libpg_query/grammar/statements/select.y" { PGRangeFunction *n = makeNode(PGRangeFunction); @@ -27579,7 +27586,7 @@ YYLTYPE yylloc; ;} break; - case 849: + case 850: #line 1591 "third_party/libpg_query/grammar/statements/select.y" { PGRangeFunction *n = makeNode(PGRangeFunction); @@ -27593,66 +27600,66 @@ YYLTYPE yylloc; ;} break; - case 850: + case 851: #line 1604 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make2((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].list)); ;} break; - case 851: + case 852: #line 1608 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].list)); ;} break; - case 852: + case 853: #line 1609 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].list)); ;} break; - case 853: + case 854: #line 1612 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(3) - (4)].list); ;} break; - case 854: + case 855: #line 1613 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 855: + case 856: #line 1616 "third_party/libpg_query/grammar/statements/select.y" { (yyval.boolean) = true; ;} break; - case 856: + case 857: #line 1617 "third_party/libpg_query/grammar/statements/select.y" { (yyval.boolean) = false; ;} break; - case 857: + case 858: #line 1622 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; - case 858: + case 859: #line 1623 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = NULL; ;} break; - case 859: + case 860: #line 1629 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 860: + case 861: #line 1633 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; - case 861: + case 862: #line 1639 "third_party/libpg_query/grammar/statements/select.y" { PGColumnDef *n = makeNode(PGColumnDef); @@ -27673,7 +27680,7 @@ YYLTYPE yylloc; ;} break; - case 862: + case 863: #line 1660 "third_party/libpg_query/grammar/statements/select.y" { PGCollateClause *n = makeNode(PGCollateClause); @@ -27684,36 +27691,36 @@ YYLTYPE yylloc; ;} break; - case 863: + case 864: #line 1667 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = NULL; ;} break; - case 864: + case 865: #line 1681 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(list_make2(makeString((yyvsp[(1) - (2)].str)), (yyvsp[(2) - (2)].typnam))); ;} break; - case 865: + case 866: #line 1684 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (4)].list), list_make2(makeString((yyvsp[(3) - (4)].str)), (yyvsp[(4) - (4)].typnam))); ;} break; - case 868: + case 869: #line 1691 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 869: + case 870: #line 1692 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = NULL; ;} break; - case 870: + case 871: #line 1695 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (2)].typnam); @@ -27721,7 +27728,7 @@ YYLTYPE yylloc; ;} break; - case 871: + case 872: #line 1700 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(2) - (3)].typnam); @@ -27730,7 +27737,7 @@ YYLTYPE yylloc; ;} break; - case 872: + case 873: #line 1707 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (5)].typnam); @@ -27738,7 +27745,7 @@ YYLTYPE yylloc; ;} break; - case 873: + case 874: #line 1712 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(2) - (6)].typnam); @@ -27747,7 +27754,7 @@ YYLTYPE yylloc; ;} break; - case 874: + case 875: #line 1718 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (2)].typnam); @@ -27755,7 +27762,7 @@ YYLTYPE yylloc; ;} break; - case 875: + case 876: #line 1723 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(2) - (3)].typnam); @@ -27764,7 +27771,7 @@ YYLTYPE yylloc; ;} break; - case 876: + case 877: #line 1729 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = makeTypeNameFromNameList((yyvsp[(1) - (2)].list)); @@ -27772,7 +27779,7 @@ YYLTYPE yylloc; ;} break; - case 877: + case 878: #line 1734 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = SystemTypeName("struct"); @@ -27782,7 +27789,7 @@ YYLTYPE yylloc; ;} break; - case 878: + case 879: #line 1741 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = SystemTypeName("map"); @@ -27792,7 +27799,7 @@ YYLTYPE yylloc; ;} break; - case 879: + case 880: #line 1748 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = SystemTypeName("union"); @@ -27802,57 +27809,57 @@ YYLTYPE yylloc; ;} break; - case 880: + case 881: #line 1757 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make2(makeString((yyvsp[(1) - (3)].str)), makeString((yyvsp[(3) - (3)].str))); ;} break; - case 881: + case 882: #line 1758 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), makeString((yyvsp[(3) - (3)].str))); ;} break; - case 882: + case 883: #line 1763 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), makeInteger(-1)); ;} break; - case 883: + case 884: #line 1765 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (4)].list), makeInteger((yyvsp[(3) - (4)].ival))); ;} break; - case 884: + case 885: #line 1767 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 885: + case 886: #line 1771 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 886: + case 887: #line 1772 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 887: + case 888: #line 1773 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 888: + case 889: #line 1774 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 889: + case 890: #line 1775 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 890: + case 891: #line 1777 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (2)].typnam); @@ -27860,7 +27867,7 @@ YYLTYPE yylloc; ;} break; - case 891: + case 892: #line 1782 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (4)].typnam); @@ -27869,27 +27876,27 @@ YYLTYPE yylloc; ;} break; - case 892: + case 893: #line 1801 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 893: + case 894: #line 1802 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 894: + case 895: #line 1803 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 895: + case 896: #line 1804 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 896: + case 897: #line 1816 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = makeTypeName((yyvsp[(1) - (2)].str)); @@ -27898,17 +27905,17 @@ YYLTYPE yylloc; ;} break; - case 897: + case 898: #line 1829 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(2) - (3)].list); ;} break; - case 898: + case 899: #line 1830 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 899: + case 900: #line 1837 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = SystemTypeName("int4"); @@ -27916,7 +27923,7 @@ YYLTYPE yylloc; ;} break; - case 900: + case 901: #line 1842 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = SystemTypeName("int4"); @@ -27924,7 +27931,7 @@ YYLTYPE yylloc; ;} break; - case 901: + case 902: #line 1847 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = SystemTypeName("int2"); @@ -27932,7 +27939,7 @@ YYLTYPE yylloc; ;} break; - case 902: + case 903: #line 1852 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = SystemTypeName("int8"); @@ -27940,7 +27947,7 @@ YYLTYPE yylloc; ;} break; - case 903: + case 904: #line 1857 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = SystemTypeName("float4"); @@ -27948,7 +27955,7 @@ YYLTYPE yylloc; ;} break; - case 904: + case 905: #line 1862 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(2) - (2)].typnam); @@ -27956,7 +27963,7 @@ YYLTYPE yylloc; ;} break; - case 905: + case 906: #line 1867 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = SystemTypeName("float8"); @@ -27964,7 +27971,7 @@ YYLTYPE yylloc; ;} break; - case 906: + case 907: #line 1872 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = SystemTypeName("numeric"); @@ -27973,7 +27980,7 @@ YYLTYPE yylloc; ;} break; - case 907: + case 908: #line 1878 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = SystemTypeName("numeric"); @@ -27982,7 +27989,7 @@ YYLTYPE yylloc; ;} break; - case 908: + case 909: #line 1884 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = SystemTypeName("numeric"); @@ -27991,7 +27998,7 @@ YYLTYPE yylloc; ;} break; - case 909: + case 910: #line 1890 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = SystemTypeName("bool"); @@ -27999,7 +28006,7 @@ YYLTYPE yylloc; ;} break; - case 910: + case 911: #line 1897 "third_party/libpg_query/grammar/statements/select.y" { /* @@ -28023,35 +28030,35 @@ YYLTYPE yylloc; ;} break; - case 911: + case 912: #line 1918 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = SystemTypeName("float4"); ;} break; - case 912: + case 913: #line 1928 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 913: + case 914: #line 1932 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 914: + case 915: #line 1940 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 915: + case 916: #line 1944 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); @@ -28059,7 +28066,7 @@ YYLTYPE yylloc; ;} break; - case 916: + case 917: #line 1952 "third_party/libpg_query/grammar/statements/select.y" { const char *typname; @@ -28071,7 +28078,7 @@ YYLTYPE yylloc; ;} break; - case 917: + case 918: #line 1964 "third_party/libpg_query/grammar/statements/select.y" { /* bit defaults to bit(1), varbit to no limit */ @@ -28088,28 +28095,28 @@ YYLTYPE yylloc; ;} break; - case 918: + case 919: #line 1985 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 919: + case 920: #line 1989 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 920: + case 921: #line 1995 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 921: + case 922: #line 1999 "third_party/libpg_query/grammar/statements/select.y" { /* Length was not specified so allow to be unrestricted. @@ -28123,7 +28130,7 @@ YYLTYPE yylloc; ;} break; - case 922: + case 923: #line 2012 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = SystemTypeName((yyvsp[(1) - (4)].conststr)); @@ -28132,7 +28139,7 @@ YYLTYPE yylloc; ;} break; - case 923: + case 924: #line 2020 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = SystemTypeName((yyvsp[(1) - (1)].conststr)); @@ -28143,47 +28150,47 @@ YYLTYPE yylloc; ;} break; - case 924: + case 925: #line 2030 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = (yyvsp[(2) - (2)].boolean) ? "varchar": "bpchar"; ;} break; - case 925: + case 926: #line 2032 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = (yyvsp[(2) - (2)].boolean) ? "varchar": "bpchar"; ;} break; - case 926: + case 927: #line 2034 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = "varchar"; ;} break; - case 927: + case 928: #line 2036 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = (yyvsp[(3) - (3)].boolean) ? "varchar": "bpchar"; ;} break; - case 928: + case 929: #line 2038 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = (yyvsp[(3) - (3)].boolean) ? "varchar": "bpchar"; ;} break; - case 929: + case 930: #line 2040 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = (yyvsp[(2) - (2)].boolean) ? "varchar": "bpchar"; ;} break; - case 930: + case 931: #line 2044 "third_party/libpg_query/grammar/statements/select.y" { (yyval.boolean) = true; ;} break; - case 931: + case 932: #line 2045 "third_party/libpg_query/grammar/statements/select.y" { (yyval.boolean) = false; ;} break; - case 932: + case 933: #line 2053 "third_party/libpg_query/grammar/statements/select.y" { if ((yyvsp[(5) - (5)].boolean)) @@ -28195,7 +28202,7 @@ YYLTYPE yylloc; ;} break; - case 933: + case 934: #line 2062 "third_party/libpg_query/grammar/statements/select.y" { if ((yyvsp[(2) - (2)].boolean)) @@ -28206,7 +28213,7 @@ YYLTYPE yylloc; ;} break; - case 934: + case 935: #line 2070 "third_party/libpg_query/grammar/statements/select.y" { if ((yyvsp[(5) - (5)].boolean)) @@ -28218,7 +28225,7 @@ YYLTYPE yylloc; ;} break; - case 935: + case 936: #line 2079 "third_party/libpg_query/grammar/statements/select.y" { if ((yyvsp[(2) - (2)].boolean)) @@ -28229,7 +28236,7 @@ YYLTYPE yylloc; ;} break; - case 936: + case 937: #line 2090 "third_party/libpg_query/grammar/statements/select.y" { (yyval.typnam) = SystemTypeName("interval"); @@ -28237,87 +28244,87 @@ YYLTYPE yylloc; ;} break; - case 937: + case 938: #line 2097 "third_party/libpg_query/grammar/statements/select.y" { (yyval.boolean) = true; ;} break; - case 938: + case 939: #line 2098 "third_party/libpg_query/grammar/statements/select.y" { (yyval.boolean) = false; ;} break; - case 939: + case 940: #line 2099 "third_party/libpg_query/grammar/statements/select.y" { (yyval.boolean) = false; ;} break; - case 966: + case 967: #line 2143 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(YEAR), (yylsp[(1) - (1)]))); ;} break; - case 967: + case 968: #line 2145 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(MONTH), (yylsp[(1) - (1)]))); ;} break; - case 968: + case 969: #line 2147 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(DAY), (yylsp[(1) - (1)]))); ;} break; - case 969: + case 970: #line 2149 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(HOUR), (yylsp[(1) - (1)]))); ;} break; - case 970: + case 971: #line 2151 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(MINUTE), (yylsp[(1) - (1)]))); ;} break; - case 971: + case 972: #line 2153 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(SECOND), (yylsp[(1) - (1)]))); ;} break; - case 972: + case 973: #line 2155 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(MILLISECOND), (yylsp[(1) - (1)]))); ;} break; - case 973: + case 974: #line 2157 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(MICROSECOND), (yylsp[(1) - (1)]))); ;} break; - case 974: + case 975: #line 2159 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(WEEK), (yylsp[(1) - (1)]))); ;} break; - case 975: + case 976: #line 2161 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(QUARTER), (yylsp[(1) - (1)]))); ;} break; - case 976: + case 977: #line 2163 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(DECADE), (yylsp[(1) - (1)]))); ;} break; - case 977: + case 978: #line 2165 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(CENTURY), (yylsp[(1) - (1)]))); ;} break; - case 978: + case 979: #line 2167 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(MILLENNIUM), (yylsp[(1) - (1)]))); ;} break; - case 979: + case 980: #line 2169 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(YEAR) | @@ -28325,7 +28332,7 @@ YYLTYPE yylloc; ;} break; - case 980: + case 981: #line 2174 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(DAY) | @@ -28333,7 +28340,7 @@ YYLTYPE yylloc; ;} break; - case 981: + case 982: #line 2179 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(DAY) | @@ -28342,7 +28349,7 @@ YYLTYPE yylloc; ;} break; - case 982: + case 983: #line 2185 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(DAY) | @@ -28352,7 +28359,7 @@ YYLTYPE yylloc; ;} break; - case 983: + case 984: #line 2192 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(HOUR) | @@ -28360,7 +28367,7 @@ YYLTYPE yylloc; ;} break; - case 984: + case 985: #line 2197 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(HOUR) | @@ -28369,7 +28376,7 @@ YYLTYPE yylloc; ;} break; - case 985: + case 986: #line 2203 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(MINUTE) | @@ -28377,22 +28384,22 @@ YYLTYPE yylloc; ;} break; - case 986: + case 987: #line 2208 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 987: + case 988: #line 2239 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 988: + case 989: #line 2242 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeTypeCast((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].typnam), 0, (yylsp[(2) - (3)])); ;} break; - case 989: + case 990: #line 2244 "third_party/libpg_query/grammar/statements/select.y" { PGCollateClause *n = makeNode(PGCollateClause); @@ -28403,7 +28410,7 @@ YYLTYPE yylloc; ;} break; - case 990: + case 991: #line 2252 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName("timezone"), @@ -28412,122 +28419,122 @@ YYLTYPE yylloc; ;} break; - case 991: + case 992: #line 2267 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "+", NULL, (yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} break; - case 992: + case 993: #line 2269 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = doNegate((yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} break; - case 993: + case 994: #line 2271 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "+", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 994: + case 995: #line 2273 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "-", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 995: + case 996: #line 2275 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "*", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 996: + case 997: #line 2277 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "/", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 997: + case 998: #line 2279 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "//", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 998: + case 999: #line 2281 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "%", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 999: + case 1000: #line 2283 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "^", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1000: + case 1001: #line 2285 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "**", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1001: + case 1002: #line 2287 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "<", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1002: + case 1003: #line 2289 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, ">", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1003: + case 1004: #line 2291 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "=", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1004: + case 1005: #line 2293 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "<=", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1005: + case 1006: #line 2295 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, ">=", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1006: + case 1007: #line 2297 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "<>", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1007: + case 1008: #line 2300 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeAExpr(PG_AEXPR_OP, (yyvsp[(2) - (3)].list), (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1008: + case 1009: #line 2302 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeAExpr(PG_AEXPR_OP, (yyvsp[(1) - (2)].list), NULL, (yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} break; - case 1009: + case 1010: #line 2304 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeAExpr(PG_AEXPR_OP, (yyvsp[(2) - (2)].list), (yyvsp[(1) - (2)].node), NULL, (yylsp[(2) - (2)])); ;} break; - case 1010: + case 1011: #line 2307 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeAndExpr((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1011: + case 1012: #line 2309 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeOrExpr((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1012: + case 1013: #line 2311 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeNotExpr((yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} break; - case 1013: + case 1014: #line 2313 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeNotExpr((yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} break; - case 1014: + case 1015: #line 2315 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_GLOB, "~~~", @@ -28535,7 +28542,7 @@ YYLTYPE yylloc; ;} break; - case 1015: + case 1016: #line 2320 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_LIKE, "~~", @@ -28543,7 +28550,7 @@ YYLTYPE yylloc; ;} break; - case 1016: + case 1017: #line 2325 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = makeFuncCall(SystemFuncName("like_escape"), @@ -28553,7 +28560,7 @@ YYLTYPE yylloc; ;} break; - case 1017: + case 1018: #line 2332 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_LIKE, "!~~", @@ -28561,7 +28568,7 @@ YYLTYPE yylloc; ;} break; - case 1018: + case 1019: #line 2337 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = makeFuncCall(SystemFuncName("not_like_escape"), @@ -28571,7 +28578,7 @@ YYLTYPE yylloc; ;} break; - case 1019: + case 1020: #line 2344 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_ILIKE, "~~*", @@ -28579,7 +28586,7 @@ YYLTYPE yylloc; ;} break; - case 1020: + case 1021: #line 2349 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = makeFuncCall(SystemFuncName("ilike_escape"), @@ -28589,7 +28596,7 @@ YYLTYPE yylloc; ;} break; - case 1021: + case 1022: #line 2356 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_ILIKE, "!~~*", @@ -28597,7 +28604,7 @@ YYLTYPE yylloc; ;} break; - case 1022: + case 1023: #line 2361 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = makeFuncCall(SystemFuncName("not_ilike_escape"), @@ -28607,7 +28614,7 @@ YYLTYPE yylloc; ;} break; - case 1023: + case 1024: #line 2369 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = makeFuncCall(SystemFuncName("similar_escape"), @@ -28618,7 +28625,7 @@ YYLTYPE yylloc; ;} break; - case 1024: + case 1025: #line 2377 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = makeFuncCall(SystemFuncName("similar_escape"), @@ -28629,7 +28636,7 @@ YYLTYPE yylloc; ;} break; - case 1025: + case 1026: #line 2385 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = makeFuncCall(SystemFuncName("similar_escape"), @@ -28640,7 +28647,7 @@ YYLTYPE yylloc; ;} break; - case 1026: + case 1027: #line 2393 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = makeFuncCall(SystemFuncName("similar_escape"), @@ -28651,7 +28658,7 @@ YYLTYPE yylloc; ;} break; - case 1027: + case 1028: #line 2411 "third_party/libpg_query/grammar/statements/select.y" { PGNullTest *n = makeNode(PGNullTest); @@ -28662,7 +28669,7 @@ YYLTYPE yylloc; ;} break; - case 1028: + case 1029: #line 2419 "third_party/libpg_query/grammar/statements/select.y" { PGNullTest *n = makeNode(PGNullTest); @@ -28673,7 +28680,7 @@ YYLTYPE yylloc; ;} break; - case 1029: + case 1030: #line 2427 "third_party/libpg_query/grammar/statements/select.y" { PGNullTest *n = makeNode(PGNullTest); @@ -28684,7 +28691,7 @@ YYLTYPE yylloc; ;} break; - case 1030: + case 1031: #line 2435 "third_party/libpg_query/grammar/statements/select.y" { PGNullTest *n = makeNode(PGNullTest); @@ -28695,7 +28702,7 @@ YYLTYPE yylloc; ;} break; - case 1031: + case 1032: #line 2443 "third_party/libpg_query/grammar/statements/select.y" { PGNullTest *n = makeNode(PGNullTest); @@ -28706,7 +28713,7 @@ YYLTYPE yylloc; ;} break; - case 1032: + case 1033: #line 2451 "third_party/libpg_query/grammar/statements/select.y" { PGLambdaFunction *n = makeNode(PGLambdaFunction); @@ -28717,7 +28724,7 @@ YYLTYPE yylloc; ;} break; - case 1033: + case 1034: #line 2459 "third_party/libpg_query/grammar/statements/select.y" { PGSingleArrowFunction *n = makeNode(PGSingleArrowFunction); @@ -28728,14 +28735,14 @@ YYLTYPE yylloc; ;} break; - case 1034: + case 1035: #line 2467 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "->>", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1035: + case 1036: #line 2471 "third_party/libpg_query/grammar/statements/select.y" { if (list_length((yyvsp[(1) - (3)].list)) != 2) @@ -28754,7 +28761,7 @@ YYLTYPE yylloc; ;} break; - case 1036: + case 1037: #line 2487 "third_party/libpg_query/grammar/statements/select.y" { PGBooleanTest *b = makeNode(PGBooleanTest); @@ -28765,7 +28772,7 @@ YYLTYPE yylloc; ;} break; - case 1037: + case 1038: #line 2495 "third_party/libpg_query/grammar/statements/select.y" { PGBooleanTest *b = makeNode(PGBooleanTest); @@ -28776,7 +28783,7 @@ YYLTYPE yylloc; ;} break; - case 1038: + case 1039: #line 2503 "third_party/libpg_query/grammar/statements/select.y" { PGBooleanTest *b = makeNode(PGBooleanTest); @@ -28787,7 +28794,7 @@ YYLTYPE yylloc; ;} break; - case 1039: + case 1040: #line 2511 "third_party/libpg_query/grammar/statements/select.y" { PGBooleanTest *b = makeNode(PGBooleanTest); @@ -28798,7 +28805,7 @@ YYLTYPE yylloc; ;} break; - case 1040: + case 1041: #line 2519 "third_party/libpg_query/grammar/statements/select.y" { PGBooleanTest *b = makeNode(PGBooleanTest); @@ -28809,7 +28816,7 @@ YYLTYPE yylloc; ;} break; - case 1041: + case 1042: #line 2527 "third_party/libpg_query/grammar/statements/select.y" { PGBooleanTest *b = makeNode(PGBooleanTest); @@ -28820,35 +28827,35 @@ YYLTYPE yylloc; ;} break; - case 1042: + case 1043: #line 2535 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_DISTINCT, "=", (yyvsp[(1) - (5)].node), (yyvsp[(5) - (5)].node), (yylsp[(2) - (5)])); ;} break; - case 1043: + case 1044: #line 2539 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_NOT_DISTINCT, "=", (yyvsp[(1) - (6)].node), (yyvsp[(6) - (6)].node), (yylsp[(2) - (6)])); ;} break; - case 1044: + case 1045: #line 2543 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OF, "=", (yyvsp[(1) - (6)].node), (PGNode *) (yyvsp[(5) - (6)].list), (yylsp[(2) - (6)])); ;} break; - case 1045: + case 1046: #line 2547 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OF, "<>", (yyvsp[(1) - (7)].node), (PGNode *) (yyvsp[(6) - (7)].list), (yylsp[(2) - (7)])); ;} break; - case 1046: + case 1047: #line 2551 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_BETWEEN, @@ -28859,7 +28866,7 @@ YYLTYPE yylloc; ;} break; - case 1047: + case 1048: #line 2559 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_NOT_BETWEEN, @@ -28870,7 +28877,7 @@ YYLTYPE yylloc; ;} break; - case 1048: + case 1049: #line 2567 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_BETWEEN_SYM, @@ -28881,7 +28888,7 @@ YYLTYPE yylloc; ;} break; - case 1049: + case 1050: #line 2575 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_NOT_BETWEEN_SYM, @@ -28892,7 +28899,7 @@ YYLTYPE yylloc; ;} break; - case 1050: + case 1051: #line 2583 "third_party/libpg_query/grammar/statements/select.y" { /* in_expr returns a PGSubLink or a list of a_exprs */ @@ -28915,7 +28922,7 @@ YYLTYPE yylloc; ;} break; - case 1051: + case 1052: #line 2603 "third_party/libpg_query/grammar/statements/select.y" { /* in_expr returns a PGSubLink or a list of a_exprs */ @@ -28940,7 +28947,7 @@ YYLTYPE yylloc; ;} break; - case 1052: + case 1053: #line 2625 "third_party/libpg_query/grammar/statements/select.y" { PGSubLink *n = makeNode(PGSubLink); @@ -28954,7 +28961,7 @@ YYLTYPE yylloc; ;} break; - case 1053: + case 1054: #line 2636 "third_party/libpg_query/grammar/statements/select.y" { if ((yyvsp[(3) - (6)].subquerytype) == PG_ANY_SUBLINK) @@ -28964,7 +28971,7 @@ YYLTYPE yylloc; ;} break; - case 1054: + case 1055: #line 2643 "third_party/libpg_query/grammar/statements/select.y" { /* @@ -28981,7 +28988,7 @@ YYLTYPE yylloc; ;} break; - case 1055: + case 1056: #line 2657 "third_party/libpg_query/grammar/statements/select.y" { PGAStar *star = makeNode(PGAStar); @@ -28992,7 +28999,7 @@ YYLTYPE yylloc; ;} break; - case 1056: + case 1057: #line 2665 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = makeFuncCall(SystemFuncName("unpack"), list_make1((yyvsp[(3) - (4)].node)), (yylsp[(1) - (4)])); @@ -29000,7 +29007,7 @@ YYLTYPE yylloc; ;} break; - case 1057: + case 1058: #line 2670 "third_party/libpg_query/grammar/statements/select.y" { PGAStar *star = makeNode(PGAStar); @@ -29013,7 +29020,7 @@ YYLTYPE yylloc; ;} break; - case 1058: + case 1059: #line 2680 "third_party/libpg_query/grammar/statements/select.y" { PGAStar *star = makeNode(PGAStar); @@ -29025,7 +29032,7 @@ YYLTYPE yylloc; ;} break; - case 1059: + case 1060: #line 2689 "third_party/libpg_query/grammar/statements/select.y" { PGAStar *star = makeNode(PGAStar); @@ -29038,140 +29045,140 @@ YYLTYPE yylloc; ;} break; - case 1060: + case 1061: #line 2710 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 1061: + case 1062: #line 2712 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeTypeCast((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].typnam), 0, (yylsp[(2) - (3)])); ;} break; - case 1062: + case 1063: #line 2714 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "+", NULL, (yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} break; - case 1063: + case 1064: #line 2716 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = doNegate((yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} break; - case 1064: + case 1065: #line 2718 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "+", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1065: + case 1066: #line 2720 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "-", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1066: + case 1067: #line 2722 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "*", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1067: + case 1068: #line 2724 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "/", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1068: + case 1069: #line 2726 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "//", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1069: + case 1070: #line 2728 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "%", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1070: + case 1071: #line 2730 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "^", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1071: + case 1072: #line 2732 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "**", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1072: + case 1073: #line 2734 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "<", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1073: + case 1074: #line 2736 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, ">", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1074: + case 1075: #line 2738 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "=", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1075: + case 1076: #line 2740 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "<=", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1076: + case 1077: #line 2742 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, ">=", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1077: + case 1078: #line 2744 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "<>", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1078: + case 1079: #line 2746 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeAExpr(PG_AEXPR_OP, (yyvsp[(2) - (3)].list), (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 1079: + case 1080: #line 2748 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeAExpr(PG_AEXPR_OP, (yyvsp[(1) - (2)].list), NULL, (yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} break; - case 1080: + case 1081: #line 2750 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeAExpr(PG_AEXPR_OP, (yyvsp[(2) - (2)].list), (yyvsp[(1) - (2)].node), NULL, (yylsp[(2) - (2)])); ;} break; - case 1081: + case 1082: #line 2752 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_DISTINCT, "=", (yyvsp[(1) - (5)].node), (yyvsp[(5) - (5)].node), (yylsp[(2) - (5)])); ;} break; - case 1082: + case 1083: #line 2756 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_NOT_DISTINCT, "=", (yyvsp[(1) - (6)].node), (yyvsp[(6) - (6)].node), (yylsp[(2) - (6)])); ;} break; - case 1083: + case 1084: #line 2760 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OF, "=", (yyvsp[(1) - (6)].node), (PGNode *) (yyvsp[(5) - (6)].list), (yylsp[(2) - (6)])); ;} break; - case 1084: + case 1085: #line 2764 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OF, "<>", (yyvsp[(1) - (7)].node), (PGNode *) (yyvsp[(6) - (7)].list), (yylsp[(2) - (7)])); ;} break; - case 1086: + case 1087: #line 2779 "third_party/libpg_query/grammar/statements/select.y" { if ((yyvsp[(2) - (2)].list)) @@ -29186,17 +29193,17 @@ YYLTYPE yylloc; ;} break; - case 1087: + case 1088: #line 2792 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 1088: + case 1089: #line 2793 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 1089: + case 1090: #line 2795 "third_party/libpg_query/grammar/statements/select.y" { PGSubLink *n = makeNode(PGSubLink); @@ -29210,7 +29217,7 @@ YYLTYPE yylloc; ;} break; - case 1090: + case 1091: #line 2806 "third_party/libpg_query/grammar/statements/select.y" { /* @@ -29237,7 +29244,7 @@ YYLTYPE yylloc; ;} break; - case 1091: + case 1092: #line 2830 "third_party/libpg_query/grammar/statements/select.y" { PGSubLink *n = makeNode(PGSubLink); @@ -29251,7 +29258,7 @@ YYLTYPE yylloc; ;} break; - case 1092: + case 1093: #line 2841 "third_party/libpg_query/grammar/statements/select.y" { PGGroupingFunc *g = makeNode(PGGroupingFunc); @@ -29261,21 +29268,21 @@ YYLTYPE yylloc; ;} break; - case 1093: + case 1094: #line 2851 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(2) - (3)].node); ;} break; - case 1094: + case 1095: #line 2855 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 1095: + case 1096: #line 2858 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = makeFuncCall(SystemFuncName("row"), (yyvsp[(1) - (1)].list), (yylsp[(1) - (1)])); @@ -29283,14 +29290,14 @@ YYLTYPE yylloc; ;} break; - case 1096: + case 1097: #line 2866 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeParamRef(0, (yylsp[(1) - (1)])); ;} break; - case 1097: + case 1098: #line 2870 "third_party/libpg_query/grammar/statements/select.y" { PGParamRef *p = makeNode(PGParamRef); @@ -29300,14 +29307,14 @@ YYLTYPE yylloc; ;} break; - case 1098: + case 1099: #line 2877 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeNamedParamRef((yyvsp[(2) - (2)].str), (yylsp[(1) - (2)])); ;} break; - case 1106: + case 1107: #line 2891 "third_party/libpg_query/grammar/statements/select.y" { PGSubLink *n = makeNode(PGSubLink); @@ -29321,7 +29328,7 @@ YYLTYPE yylloc; ;} break; - case 1107: + case 1108: #line 2901 "third_party/libpg_query/grammar/statements/select.y" { PGList *func_name = list_make1(makeString("construct_array")); @@ -29330,7 +29337,7 @@ YYLTYPE yylloc; ;} break; - case 1108: + case 1109: #line 2907 "third_party/libpg_query/grammar/statements/select.y" { PGPositionalReference *n = makeNode(PGPositionalReference); @@ -29340,7 +29347,7 @@ YYLTYPE yylloc; ;} break; - case 1109: + case 1110: #line 2915 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = makeFuncCall(SystemFuncName("list_value"), (yyvsp[(2) - (3)].list), (yylsp[(2) - (3)])); @@ -29348,7 +29355,7 @@ YYLTYPE yylloc; ;} break; - case 1110: + case 1111: #line 2922 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *f = makeFuncCall(SystemFuncName("struct_pack"), (yyvsp[(2) - (3)].list), (yylsp[(2) - (3)])); @@ -29356,7 +29363,7 @@ YYLTYPE yylloc; ;} break; - case 1111: + case 1112: #line 2929 "third_party/libpg_query/grammar/statements/select.y" { PGList *key_list = NULL; @@ -29376,14 +29383,14 @@ YYLTYPE yylloc; ;} break; - case 1112: + case 1113: #line 2949 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeFuncCall((yyvsp[(1) - (3)].list), NIL, (yylsp[(1) - (3)])); ;} break; - case 1113: + case 1114: #line 2953 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = makeFuncCall((yyvsp[(1) - (5)].list), NIL, (yylsp[(1) - (5)])); @@ -29393,7 +29400,7 @@ YYLTYPE yylloc; ;} break; - case 1114: + case 1115: #line 2960 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = makeFuncCall((yyvsp[(1) - (6)].list), (yyvsp[(3) - (6)].list), (yylsp[(1) - (6)])); @@ -29403,7 +29410,7 @@ YYLTYPE yylloc; ;} break; - case 1115: + case 1116: #line 2967 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = makeFuncCall((yyvsp[(1) - (7)].list), list_make1((yyvsp[(4) - (7)].node)), (yylsp[(1) - (7)])); @@ -29414,7 +29421,7 @@ YYLTYPE yylloc; ;} break; - case 1116: + case 1117: #line 2975 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = makeFuncCall((yyvsp[(1) - (9)].list), lappend((yyvsp[(3) - (9)].list), (yyvsp[(6) - (9)].node)), (yylsp[(1) - (9)])); @@ -29425,7 +29432,7 @@ YYLTYPE yylloc; ;} break; - case 1117: + case 1118: #line 2983 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = makeFuncCall((yyvsp[(1) - (7)].list), (yyvsp[(4) - (7)].list), (yylsp[(1) - (7)])); @@ -29439,7 +29446,7 @@ YYLTYPE yylloc; ;} break; - case 1118: + case 1119: #line 2994 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = makeFuncCall((yyvsp[(1) - (7)].list), (yyvsp[(4) - (7)].list), (yylsp[(1) - (7)])); @@ -29450,7 +29457,7 @@ YYLTYPE yylloc; ;} break; - case 1119: + case 1120: #line 3014 "third_party/libpg_query/grammar/statements/select.y" { PGFuncCall *n = (PGFuncCall *) (yyvsp[(1) - (5)].node); @@ -29489,22 +29496,22 @@ YYLTYPE yylloc; ;} break; - case 1120: + case 1121: #line 3050 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 1121: + case 1122: #line 3060 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 1122: + case 1123: #line 3061 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 1123: + case 1124: #line 3069 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName("pg_collation_for"), @@ -29513,24 +29520,24 @@ YYLTYPE yylloc; ;} break; - case 1124: + case 1125: #line 3075 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeTypeCast((yyvsp[(3) - (6)].node), (yyvsp[(5) - (6)].typnam), 0, (yylsp[(1) - (6)])); ;} break; - case 1125: + case 1126: #line 3077 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeTypeCast((yyvsp[(3) - (6)].node), (yyvsp[(5) - (6)].typnam), 1, (yylsp[(1) - (6)])); ;} break; - case 1126: + case 1127: #line 3079 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName("date_part"), (yyvsp[(3) - (4)].list), (yylsp[(1) - (4)])); ;} break; - case 1127: + case 1128: #line 3083 "third_party/libpg_query/grammar/statements/select.y" { /* overlay(A PLACING B FROM C FOR D) is converted to @@ -29542,7 +29549,7 @@ YYLTYPE yylloc; ;} break; - case 1128: + case 1129: #line 3092 "third_party/libpg_query/grammar/statements/select.y" { /* position(A in B) is converted to position_inverse(A, B) */ @@ -29550,7 +29557,7 @@ YYLTYPE yylloc; ;} break; - case 1129: + case 1130: #line 3097 "third_party/libpg_query/grammar/statements/select.y" { /* substring(A from B for C) is converted to @@ -29560,7 +29567,7 @@ YYLTYPE yylloc; ;} break; - case 1130: + case 1131: #line 3104 "third_party/libpg_query/grammar/statements/select.y" { /* TREAT(expr AS target) converts expr of a particular type to target, @@ -29578,7 +29585,7 @@ YYLTYPE yylloc; ;} break; - case 1131: + case 1132: #line 3119 "third_party/libpg_query/grammar/statements/select.y" { /* various trim expressions are defined in SQL @@ -29588,35 +29595,35 @@ YYLTYPE yylloc; ;} break; - case 1132: + case 1133: #line 3126 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName("ltrim"), (yyvsp[(4) - (5)].list), (yylsp[(1) - (5)])); ;} break; - case 1133: + case 1134: #line 3130 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName("rtrim"), (yyvsp[(4) - (5)].list), (yylsp[(1) - (5)])); ;} break; - case 1134: + case 1135: #line 3134 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName("trim"), (yyvsp[(3) - (4)].list), (yylsp[(1) - (4)])); ;} break; - case 1135: + case 1136: #line 3138 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_NULLIF, "=", (yyvsp[(3) - (6)].node), (yyvsp[(5) - (6)].node), (yylsp[(1) - (6)])); ;} break; - case 1136: + case 1137: #line 3142 "third_party/libpg_query/grammar/statements/select.y" { PGCoalesceExpr *c = makeNode(PGCoalesceExpr); @@ -29626,7 +29633,7 @@ YYLTYPE yylloc; ;} break; - case 1137: + case 1138: #line 3152 "third_party/libpg_query/grammar/statements/select.y" { PGLambdaFunction *lambda = makeNode(PGLambdaFunction); @@ -29638,81 +29645,119 @@ YYLTYPE yylloc; ;} break; - case 1138: + case 1139: #line 3161 "third_party/libpg_query/grammar/statements/select.y" { - PGLambdaFunction *lambda = makeNode(PGLambdaFunction); + /* Construct first apply */ + PGNamedArgExpr *filter_expr = makeNode(PGNamedArgExpr); + filter_expr->name = pstrdup("filter"); + filter_expr->arg = (PGExpr *) (yyvsp[(8) - (9)].node); + filter_expr->argnumber = -1; + filter_expr->location = (yylsp[(8) - (9)]); + + PGNamedArgExpr *result_expr = makeNode(PGNamedArgExpr); + result_expr->name = pstrdup("result"); + result_expr->arg = (PGExpr *) (yyvsp[(2) - (9)].node); + result_expr->argnumber = -1; + result_expr->location = (yylsp[(2) - (9)]); + + PGFuncCall *struct_pack = makeFuncCall(SystemFuncName("struct_pack"), list_make2(filter_expr, result_expr), (yylsp[(1) - (9)])); + + PGLambdaFunction *lambda_apply_1 = makeNode(PGLambdaFunction); + lambda_apply_1->lhs = (yyvsp[(4) - (9)].list); + lambda_apply_1->rhs = (PGNode *)struct_pack; + lambda_apply_1->location = (yylsp[(1) - (9)]); + + PGFuncCall *apply_func_1 = makeFuncCall(SystemFuncName("list_apply"), list_make2((yyvsp[(6) - (9)].node), lambda_apply_1), (yylsp[(1) - (9)])); + + /* Construct filter */ + PGNode *elem_column_ref_filter = makeColumnRef(pstrdup("elem"), NIL, (yylsp[(1) - (9)]), yyscanner); + PGNode *filter_column_name = makeStringConst("filter", (yylsp[(1) - (9)])); + PGFuncCall *filter_extract = makeFuncCall(SystemFuncName("struct_extract"), list_make2(elem_column_ref_filter, filter_column_name), (yylsp[(1) - (9)])); PGLambdaFunction *lambda = makeNode(PGLambdaFunction); lambda->lhs = (yyvsp[(4) - (9)].list); lambda->rhs = (yyvsp[(2) - (9)].node); lambda->location = (yylsp[(1) - (9)]); PGLambdaFunction *lambda_filter = makeNode(PGLambdaFunction); - lambda_filter->lhs = (yyvsp[(4) - (9)].list); - lambda_filter->rhs = (yyvsp[(8) - (9)].node); - lambda_filter->location = (yylsp[(8) - (9)]); - PGFuncCall *filter = makeFuncCall(SystemFuncName("list_filter"), list_make2((yyvsp[(6) - (9)].node), lambda_filter), (yylsp[(1) - (9)])); - PGFuncCall *n = makeFuncCall(SystemFuncName("list_apply"), list_make2(filter, lambda), (yylsp[(1) - (9)])); - (yyval.node) = (PGNode *) n; + lambda_filter->lhs = list_make1(makeString("elem")); + lambda_filter->rhs = (PGNode *) filter_extract; + lambda_filter->location = (yylsp[(1) - (9)]); + + PGFuncCall *filter_func = makeFuncCall(SystemFuncName("list_filter"), list_make2(apply_func_1, lambda_filter), (yylsp[(1) - (9)])); + + /* Construct second apply */ + PGNode *elem_column_ref_result = makeColumnRef(pstrdup("elem"), NIL, (yylsp[(1) - (9)]), yyscanner); + PGNode *result_column_name = makeStringConst("result", (yylsp[(1) - (9)])); + PGFuncCall *result_extract = makeFuncCall(SystemFuncName("struct_extract"), list_make2(elem_column_ref_filter, result_column_name), (yylsp[(1) - (9)])); + + PGLambdaFunction *lambda_apply_2 = makeNode(PGLambdaFunction); + lambda_apply_2->lhs = list_make1(makeString("elem")); + lambda_apply_2->rhs = (PGNode *) result_extract; + lambda_apply_2->location = (yylsp[(1) - (9)]); + + PGFuncCall *apply_func_2 = makeFuncCall(SystemFuncName("list_apply"), list_make2(filter_func, lambda_apply_2), (yylsp[(1) - (9)])); + + (yyval.node) = (PGNode *) apply_func_2; ;} break; - case 1139: -#line 3182 "third_party/libpg_query/grammar/statements/select.y" + case 1140: +#line 3220 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(4) - (5)].list); ;} break; - case 1140: -#line 3183 "third_party/libpg_query/grammar/statements/select.y" + case 1141: +#line 3221 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 1141: -#line 3187 "third_party/libpg_query/grammar/statements/select.y" + case 1142: +#line 3225 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(4) - (5)].node); ;} break; - case 1142: -#line 3188 "third_party/libpg_query/grammar/statements/select.y" + case 1143: +#line 3226 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(3) - (4)].node); ;} break; - case 1143: -#line 3189 "third_party/libpg_query/grammar/statements/select.y" + case 1144: +#line 3227 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = NULL; ;} break; - case 1144: -#line 3193 "third_party/libpg_query/grammar/statements/select.y" + case 1145: +#line 3231 "third_party/libpg_query/grammar/statements/select.y" { (yyval.boolean) = true; ;} break; - case 1145: -#line 3194 "third_party/libpg_query/grammar/statements/select.y" + case 1146: +#line 3232 "third_party/libpg_query/grammar/statements/select.y" { (yyval.boolean) = false; ;} break; - case 1146: -#line 3201 "third_party/libpg_query/grammar/statements/select.y" + case 1147: +#line 3239 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(2) - (2)].list); ;} break; - case 1147: -#line 3202 "third_party/libpg_query/grammar/statements/select.y" + case 1148: +#line 3240 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 1148: -#line 3206 "third_party/libpg_query/grammar/statements/select.y" + case 1149: +#line 3244 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].windef)); ;} break; - case 1149: -#line 3208 "third_party/libpg_query/grammar/statements/select.y" + case 1150: +#line 3246 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].windef)); ;} break; - case 1150: -#line 3213 "third_party/libpg_query/grammar/statements/select.y" + case 1151: +#line 3251 "third_party/libpg_query/grammar/statements/select.y" { PGWindowDef *n = (yyvsp[(3) - (3)].windef); n->name = (yyvsp[(1) - (3)].str); @@ -29720,13 +29765,13 @@ YYLTYPE yylloc; ;} break; - case 1151: -#line 3221 "third_party/libpg_query/grammar/statements/select.y" + case 1152: +#line 3259 "third_party/libpg_query/grammar/statements/select.y" { (yyval.windef) = (yyvsp[(2) - (2)].windef); ;} break; - case 1152: -#line 3223 "third_party/libpg_query/grammar/statements/select.y" + case 1153: +#line 3261 "third_party/libpg_query/grammar/statements/select.y" { PGWindowDef *n = makeNode(PGWindowDef); n->name = (yyvsp[(2) - (2)].str); @@ -29741,13 +29786,13 @@ YYLTYPE yylloc; ;} break; - case 1153: -#line 3236 "third_party/libpg_query/grammar/statements/select.y" + case 1154: +#line 3274 "third_party/libpg_query/grammar/statements/select.y" { (yyval.windef) = NULL; ;} break; - case 1154: -#line 3241 "third_party/libpg_query/grammar/statements/select.y" + case 1155: +#line 3279 "third_party/libpg_query/grammar/statements/select.y" { PGWindowDef *n = makeNode(PGWindowDef); n->name = NULL; @@ -29763,28 +29808,28 @@ YYLTYPE yylloc; ;} break; - case 1155: -#line 3266 "third_party/libpg_query/grammar/statements/select.y" + case 1156: +#line 3304 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1156: -#line 3267 "third_party/libpg_query/grammar/statements/select.y" + case 1157: +#line 3305 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = NULL; ;} break; - case 1157: -#line 3270 "third_party/libpg_query/grammar/statements/select.y" + case 1158: +#line 3308 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(3) - (3)].list); ;} break; - case 1158: -#line 3271 "third_party/libpg_query/grammar/statements/select.y" + case 1159: +#line 3309 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 1159: -#line 3280 "third_party/libpg_query/grammar/statements/select.y" + case 1160: +#line 3318 "third_party/libpg_query/grammar/statements/select.y" { PGWindowDef *n = (yyvsp[(2) - (3)].windef); @@ -29794,8 +29839,8 @@ YYLTYPE yylloc; ;} break; - case 1160: -#line 3288 "third_party/libpg_query/grammar/statements/select.y" + case 1161: +#line 3326 "third_party/libpg_query/grammar/statements/select.y" { PGWindowDef *n = (yyvsp[(2) - (3)].windef); @@ -29805,8 +29850,8 @@ YYLTYPE yylloc; ;} break; - case 1161: -#line 3296 "third_party/libpg_query/grammar/statements/select.y" + case 1162: +#line 3334 "third_party/libpg_query/grammar/statements/select.y" { PGWindowDef *n = (yyvsp[(2) - (3)].windef); @@ -29816,8 +29861,8 @@ YYLTYPE yylloc; ;} break; - case 1162: -#line 3304 "third_party/libpg_query/grammar/statements/select.y" + case 1163: +#line 3342 "third_party/libpg_query/grammar/statements/select.y" { PGWindowDef *n = makeNode(PGWindowDef); @@ -29828,8 +29873,8 @@ YYLTYPE yylloc; ;} break; - case 1163: -#line 3315 "third_party/libpg_query/grammar/statements/select.y" + case 1164: +#line 3353 "third_party/libpg_query/grammar/statements/select.y" { PGWindowDef *n = (yyvsp[(1) - (1)].windef); @@ -29849,8 +29894,8 @@ YYLTYPE yylloc; ;} break; - case 1164: -#line 3333 "third_party/libpg_query/grammar/statements/select.y" + case 1165: +#line 3371 "third_party/libpg_query/grammar/statements/select.y" { PGWindowDef *n1 = (yyvsp[(2) - (4)].windef); PGWindowDef *n2 = (yyvsp[(4) - (4)].windef); @@ -29890,8 +29935,8 @@ YYLTYPE yylloc; ;} break; - case 1165: -#line 3379 "third_party/libpg_query/grammar/statements/select.y" + case 1166: +#line 3417 "third_party/libpg_query/grammar/statements/select.y" { PGWindowDef *n = makeNode(PGWindowDef); @@ -29902,8 +29947,8 @@ YYLTYPE yylloc; ;} break; - case 1166: -#line 3388 "third_party/libpg_query/grammar/statements/select.y" + case 1167: +#line 3426 "third_party/libpg_query/grammar/statements/select.y" { PGWindowDef *n = makeNode(PGWindowDef); @@ -29914,8 +29959,8 @@ YYLTYPE yylloc; ;} break; - case 1167: -#line 3397 "third_party/libpg_query/grammar/statements/select.y" + case 1168: +#line 3435 "third_party/libpg_query/grammar/statements/select.y" { PGWindowDef *n = makeNode(PGWindowDef); @@ -29926,8 +29971,8 @@ YYLTYPE yylloc; ;} break; - case 1168: -#line 3406 "third_party/libpg_query/grammar/statements/select.y" + case 1169: +#line 3444 "third_party/libpg_query/grammar/statements/select.y" { PGWindowDef *n = makeNode(PGWindowDef); @@ -29938,8 +29983,8 @@ YYLTYPE yylloc; ;} break; - case 1169: -#line 3415 "third_party/libpg_query/grammar/statements/select.y" + case 1170: +#line 3453 "third_party/libpg_query/grammar/statements/select.y" { PGWindowDef *n = makeNode(PGWindowDef); @@ -29950,53 +29995,53 @@ YYLTYPE yylloc; ;} break; - case 1170: -#line 3426 "third_party/libpg_query/grammar/statements/select.y" + case 1171: +#line 3464 "third_party/libpg_query/grammar/statements/select.y" { (yyval.ival) = FRAMEOPTION_EXCLUDE_CURRENT_ROW; ;} break; - case 1171: -#line 3427 "third_party/libpg_query/grammar/statements/select.y" + case 1172: +#line 3465 "third_party/libpg_query/grammar/statements/select.y" { (yyval.ival) = FRAMEOPTION_EXCLUDE_GROUP; ;} break; - case 1172: -#line 3428 "third_party/libpg_query/grammar/statements/select.y" + case 1173: +#line 3466 "third_party/libpg_query/grammar/statements/select.y" { (yyval.ival) = FRAMEOPTION_EXCLUDE_TIES; ;} break; - case 1173: -#line 3429 "third_party/libpg_query/grammar/statements/select.y" + case 1174: +#line 3467 "third_party/libpg_query/grammar/statements/select.y" { (yyval.ival) = 0; ;} break; - case 1174: -#line 3430 "third_party/libpg_query/grammar/statements/select.y" + case 1175: +#line 3468 "third_party/libpg_query/grammar/statements/select.y" { (yyval.ival) = 0; ;} break; - case 1175: -#line 3444 "third_party/libpg_query/grammar/statements/select.y" + case 1176: +#line 3482 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(3) - (4)].list); ;} break; - case 1176: -#line 3445 "third_party/libpg_query/grammar/statements/select.y" + case 1177: +#line 3483 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 1177: -#line 3448 "third_party/libpg_query/grammar/statements/select.y" + case 1178: +#line 3486 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list);;} break; - case 1178: -#line 3449 "third_party/libpg_query/grammar/statements/select.y" + case 1179: +#line 3487 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(2) - (5)].list), (yyvsp[(4) - (5)].node)); ;} break; - case 1179: -#line 3453 "third_party/libpg_query/grammar/statements/select.y" + case 1180: +#line 3491 "third_party/libpg_query/grammar/statements/select.y" { PGNamedArgExpr *na = makeNode(PGNamedArgExpr); na->name = (yyvsp[(1) - (3)].str); @@ -30007,321 +30052,321 @@ YYLTYPE yylloc; ;} break; - case 1180: -#line 3463 "third_party/libpg_query/grammar/statements/select.y" + case 1181: +#line 3501 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 1181: -#line 3464 "third_party/libpg_query/grammar/statements/select.y" + case 1182: +#line 3502 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; - case 1182: -#line 3468 "third_party/libpg_query/grammar/statements/select.y" + case 1183: +#line 3506 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 1183: -#line 3469 "third_party/libpg_query/grammar/statements/select.y" + case 1184: +#line 3507 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (2)].list); ;} break; - case 1184: -#line 3474 "third_party/libpg_query/grammar/statements/select.y" + case 1185: +#line 3512 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make2((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); ;} break; - case 1185: -#line 3480 "third_party/libpg_query/grammar/statements/select.y" + case 1186: +#line 3518 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].list)); ;} break; - case 1186: -#line 3481 "third_party/libpg_query/grammar/statements/select.y" + case 1187: +#line 3519 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].list)); ;} break; - case 1187: -#line 3486 "third_party/libpg_query/grammar/statements/select.y" + case 1188: +#line 3524 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 1188: -#line 3487 "third_party/libpg_query/grammar/statements/select.y" + case 1189: +#line 3525 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (2)].list); ;} break; - case 1189: -#line 3492 "third_party/libpg_query/grammar/statements/select.y" + case 1190: +#line 3530 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 1190: -#line 3493 "third_party/libpg_query/grammar/statements/select.y" + case 1191: +#line 3531 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NULL; ;} break; - case 1191: -#line 3496 "third_party/libpg_query/grammar/statements/select.y" + case 1192: +#line 3534 "third_party/libpg_query/grammar/statements/select.y" { (yyval.subquerytype) = PG_ANY_SUBLINK; ;} break; - case 1192: -#line 3497 "third_party/libpg_query/grammar/statements/select.y" + case 1193: +#line 3535 "third_party/libpg_query/grammar/statements/select.y" { (yyval.subquerytype) = PG_ANY_SUBLINK; ;} break; - case 1193: -#line 3498 "third_party/libpg_query/grammar/statements/select.y" + case 1194: +#line 3536 "third_party/libpg_query/grammar/statements/select.y" { (yyval.subquerytype) = PG_ALL_SUBLINK; ;} break; - case 1194: -#line 3501 "third_party/libpg_query/grammar/statements/select.y" + case 1195: +#line 3539 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1195: -#line 3502 "third_party/libpg_query/grammar/statements/select.y" + case 1196: +#line 3540 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (char*) (yyvsp[(1) - (1)].conststr); ;} break; - case 1196: -#line 3505 "third_party/libpg_query/grammar/statements/select.y" + case 1197: +#line 3543 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = "+"; ;} break; - case 1197: -#line 3506 "third_party/libpg_query/grammar/statements/select.y" + case 1198: +#line 3544 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = "-"; ;} break; - case 1198: -#line 3507 "third_party/libpg_query/grammar/statements/select.y" + case 1199: +#line 3545 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = "*"; ;} break; - case 1199: -#line 3508 "third_party/libpg_query/grammar/statements/select.y" + case 1200: +#line 3546 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = "/"; ;} break; - case 1200: -#line 3509 "third_party/libpg_query/grammar/statements/select.y" + case 1201: +#line 3547 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = "//"; ;} break; - case 1201: -#line 3510 "third_party/libpg_query/grammar/statements/select.y" + case 1202: +#line 3548 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = "%"; ;} break; - case 1202: -#line 3511 "third_party/libpg_query/grammar/statements/select.y" + case 1203: +#line 3549 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = "^"; ;} break; - case 1203: -#line 3512 "third_party/libpg_query/grammar/statements/select.y" + case 1204: +#line 3550 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = "**"; ;} break; - case 1204: -#line 3513 "third_party/libpg_query/grammar/statements/select.y" + case 1205: +#line 3551 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = "<"; ;} break; - case 1205: -#line 3514 "third_party/libpg_query/grammar/statements/select.y" + case 1206: +#line 3552 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = ">"; ;} break; - case 1206: -#line 3515 "third_party/libpg_query/grammar/statements/select.y" + case 1207: +#line 3553 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = "="; ;} break; - case 1207: -#line 3516 "third_party/libpg_query/grammar/statements/select.y" + case 1208: +#line 3554 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = "<="; ;} break; - case 1208: -#line 3517 "third_party/libpg_query/grammar/statements/select.y" + case 1209: +#line 3555 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = ">="; ;} break; - case 1209: -#line 3518 "third_party/libpg_query/grammar/statements/select.y" + case 1210: +#line 3556 "third_party/libpg_query/grammar/statements/select.y" { (yyval.conststr) = "<>"; ;} break; - case 1210: -#line 3522 "third_party/libpg_query/grammar/statements/select.y" + case 1211: +#line 3560 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeString((yyvsp[(1) - (1)].str))); ;} break; - case 1211: -#line 3524 "third_party/libpg_query/grammar/statements/select.y" + case 1212: +#line 3562 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(3) - (4)].list); ;} break; - case 1212: -#line 3529 "third_party/libpg_query/grammar/statements/select.y" + case 1213: +#line 3567 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeString((yyvsp[(1) - (1)].str))); ;} break; - case 1213: -#line 3531 "third_party/libpg_query/grammar/statements/select.y" + case 1214: +#line 3569 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(3) - (4)].list); ;} break; - case 1214: -#line 3536 "third_party/libpg_query/grammar/statements/select.y" + case 1215: +#line 3574 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeString((yyvsp[(1) - (1)].str))); ;} break; - case 1215: -#line 3538 "third_party/libpg_query/grammar/statements/select.y" + case 1216: +#line 3576 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(3) - (4)].list); ;} break; - case 1216: -#line 3540 "third_party/libpg_query/grammar/statements/select.y" + case 1217: +#line 3578 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeString("~~")); ;} break; - case 1217: -#line 3542 "third_party/libpg_query/grammar/statements/select.y" + case 1218: +#line 3580 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeString("!~~")); ;} break; - case 1218: -#line 3544 "third_party/libpg_query/grammar/statements/select.y" + case 1219: +#line 3582 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeString("~~~")); ;} break; - case 1219: -#line 3546 "third_party/libpg_query/grammar/statements/select.y" + case 1220: +#line 3584 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeString("!~~~")); ;} break; - case 1220: -#line 3548 "third_party/libpg_query/grammar/statements/select.y" + case 1221: +#line 3586 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeString("~~*")); ;} break; - case 1221: -#line 3550 "third_party/libpg_query/grammar/statements/select.y" + case 1222: +#line 3588 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeString("!~~*")); ;} break; - case 1222: -#line 3564 "third_party/libpg_query/grammar/statements/select.y" + case 1223: +#line 3602 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeString((yyvsp[(1) - (1)].str))); ;} break; - case 1223: -#line 3566 "third_party/libpg_query/grammar/statements/select.y" + case 1224: +#line 3604 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lcons(makeString((yyvsp[(1) - (3)].str)), (yyvsp[(3) - (3)].list)); ;} break; - case 1224: -#line 3571 "third_party/libpg_query/grammar/statements/select.y" + case 1225: +#line 3609 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 1225: -#line 3575 "third_party/libpg_query/grammar/statements/select.y" + case 1226: +#line 3613 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; - case 1226: -#line 3582 "third_party/libpg_query/grammar/statements/select.y" + case 1227: +#line 3620 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 1227: -#line 3587 "third_party/libpg_query/grammar/statements/select.y" + case 1228: +#line 3625 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (2)].list); ;} break; - case 1228: -#line 3593 "third_party/libpg_query/grammar/statements/select.y" + case 1229: +#line 3631 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 1229: -#line 3597 "third_party/libpg_query/grammar/statements/select.y" + case 1230: +#line 3635 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; - case 1230: -#line 3604 "third_party/libpg_query/grammar/statements/select.y" + case 1231: +#line 3642 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 1231: -#line 3609 "third_party/libpg_query/grammar/statements/select.y" + case 1232: +#line 3647 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (2)].list); ;} break; - case 1232: -#line 3616 "third_party/libpg_query/grammar/statements/select.y" + case 1233: +#line 3654 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 1233: -#line 3620 "third_party/libpg_query/grammar/statements/select.y" + case 1234: +#line 3658 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NULL; ;} break; - case 1234: -#line 3629 "third_party/libpg_query/grammar/statements/select.y" + case 1235: +#line 3667 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 1235: -#line 3633 "third_party/libpg_query/grammar/statements/select.y" + case 1236: +#line 3671 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; - case 1236: -#line 3639 "third_party/libpg_query/grammar/statements/select.y" + case 1237: +#line 3677 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 1237: -#line 3643 "third_party/libpg_query/grammar/statements/select.y" + case 1238: +#line 3681 "third_party/libpg_query/grammar/statements/select.y" { PGNamedArgExpr *na = makeNode(PGNamedArgExpr); na->name = (yyvsp[(1) - (3)].str); @@ -30332,8 +30377,8 @@ YYLTYPE yylloc; ;} break; - case 1238: -#line 3652 "third_party/libpg_query/grammar/statements/select.y" + case 1239: +#line 3690 "third_party/libpg_query/grammar/statements/select.y" { PGNamedArgExpr *na = makeNode(PGNamedArgExpr); na->name = (yyvsp[(1) - (3)].str); @@ -30344,156 +30389,156 @@ YYLTYPE yylloc; ;} break; - case 1239: -#line 3662 "third_party/libpg_query/grammar/statements/select.y" + case 1240: +#line 3700 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].typnam)); ;} break; - case 1240: -#line 3663 "third_party/libpg_query/grammar/statements/select.y" + case 1241: +#line 3701 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].typnam)); ;} break; - case 1241: -#line 3668 "third_party/libpg_query/grammar/statements/select.y" + case 1242: +#line 3706 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make2(makeStringConst((yyvsp[(1) - (3)].str), (yylsp[(1) - (3)])), (yyvsp[(3) - (3)].node)); ;} break; - case 1242: -#line 3671 "third_party/libpg_query/grammar/statements/select.y" + case 1243: +#line 3709 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 1243: -#line 3678 "third_party/libpg_query/grammar/statements/select.y" + case 1244: +#line 3716 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1244: -#line 3679 "third_party/libpg_query/grammar/statements/select.y" + case 1245: +#line 3717 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (char*) "year"; ;} break; - case 1245: -#line 3680 "third_party/libpg_query/grammar/statements/select.y" + case 1246: +#line 3718 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (char*) "month"; ;} break; - case 1246: -#line 3681 "third_party/libpg_query/grammar/statements/select.y" + case 1247: +#line 3719 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (char*) "day"; ;} break; - case 1247: -#line 3682 "third_party/libpg_query/grammar/statements/select.y" + case 1248: +#line 3720 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (char*) "hour"; ;} break; - case 1248: -#line 3683 "third_party/libpg_query/grammar/statements/select.y" + case 1249: +#line 3721 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (char*) "minute"; ;} break; - case 1249: -#line 3684 "third_party/libpg_query/grammar/statements/select.y" + case 1250: +#line 3722 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (char*) "second"; ;} break; - case 1250: -#line 3685 "third_party/libpg_query/grammar/statements/select.y" + case 1251: +#line 3723 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (char*) "millisecond"; ;} break; - case 1251: -#line 3686 "third_party/libpg_query/grammar/statements/select.y" + case 1252: +#line 3724 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (char*) "microsecond"; ;} break; - case 1252: -#line 3687 "third_party/libpg_query/grammar/statements/select.y" + case 1253: +#line 3725 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (char*) "week"; ;} break; - case 1253: -#line 3688 "third_party/libpg_query/grammar/statements/select.y" + case 1254: +#line 3726 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (char*) "quarter"; ;} break; - case 1254: -#line 3689 "third_party/libpg_query/grammar/statements/select.y" + case 1255: +#line 3727 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (char*) "decade"; ;} break; - case 1255: -#line 3690 "third_party/libpg_query/grammar/statements/select.y" + case 1256: +#line 3728 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (char*) "century"; ;} break; - case 1256: -#line 3691 "third_party/libpg_query/grammar/statements/select.y" + case 1257: +#line 3729 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (char*) "millennium"; ;} break; - case 1257: -#line 3692 "third_party/libpg_query/grammar/statements/select.y" + case 1258: +#line 3730 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1258: -#line 3703 "third_party/libpg_query/grammar/statements/select.y" + case 1259: +#line 3741 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make4((yyvsp[(1) - (4)].node), (yyvsp[(2) - (4)].node), (yyvsp[(3) - (4)].node), (yyvsp[(4) - (4)].node)); ;} break; - case 1259: -#line 3707 "third_party/libpg_query/grammar/statements/select.y" + case 1260: +#line 3745 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make3((yyvsp[(1) - (3)].node), (yyvsp[(2) - (3)].node), (yyvsp[(3) - (3)].node)); ;} break; - case 1260: -#line 3714 "third_party/libpg_query/grammar/statements/select.y" + case 1261: +#line 3752 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; - case 1261: -#line 3720 "third_party/libpg_query/grammar/statements/select.y" + case 1262: +#line 3758 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make2((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); ;} break; - case 1262: -#line 3721 "third_party/libpg_query/grammar/statements/select.y" + case 1263: +#line 3759 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 1263: -#line 3738 "third_party/libpg_query/grammar/statements/select.y" + case 1264: +#line 3776 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make3((yyvsp[(1) - (3)].node), (yyvsp[(2) - (3)].node), (yyvsp[(3) - (3)].node)); ;} break; - case 1264: -#line 3742 "third_party/libpg_query/grammar/statements/select.y" + case 1265: +#line 3780 "third_party/libpg_query/grammar/statements/select.y" { /* not legal per SQL99, but might as well allow it */ (yyval.list) = list_make3((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yyvsp[(2) - (3)].node)); ;} break; - case 1265: -#line 3747 "third_party/libpg_query/grammar/statements/select.y" + case 1266: +#line 3785 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make2((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].node)); ;} break; - case 1266: -#line 3751 "third_party/libpg_query/grammar/statements/select.y" + case 1267: +#line 3789 "third_party/libpg_query/grammar/statements/select.y" { /* * Since there are no cases where this syntax allows @@ -30510,45 +30555,45 @@ YYLTYPE yylloc; ;} break; - case 1267: -#line 3766 "third_party/libpg_query/grammar/statements/select.y" + case 1268: +#line 3804 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 1268: -#line 3770 "third_party/libpg_query/grammar/statements/select.y" + case 1269: +#line 3808 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 1269: -#line 3774 "third_party/libpg_query/grammar/statements/select.y" + case 1270: +#line 3812 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; - case 1270: -#line 3777 "third_party/libpg_query/grammar/statements/select.y" + case 1271: +#line 3815 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; - case 1271: -#line 3780 "third_party/libpg_query/grammar/statements/select.y" + case 1272: +#line 3818 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(3) - (3)].list), (yyvsp[(1) - (3)].node)); ;} break; - case 1272: -#line 3781 "third_party/libpg_query/grammar/statements/select.y" + case 1273: +#line 3819 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(2) - (2)].list); ;} break; - case 1273: -#line 3782 "third_party/libpg_query/grammar/statements/select.y" + case 1274: +#line 3820 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 1274: -#line 3786 "third_party/libpg_query/grammar/statements/select.y" + case 1275: +#line 3824 "third_party/libpg_query/grammar/statements/select.y" { PGSubLink *n = makeNode(PGSubLink); n->subselect = (yyvsp[(1) - (1)].node); @@ -30557,18 +30602,18 @@ YYLTYPE yylloc; ;} break; - case 1275: -#line 3792 "third_party/libpg_query/grammar/statements/select.y" + case 1276: +#line 3830 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *)(yyvsp[(2) - (3)].list); ;} break; - case 1277: -#line 3794 "third_party/libpg_query/grammar/statements/select.y" + case 1278: +#line 3832 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (PGNode *)(yyvsp[(1) - (1)].node); ;} break; - case 1278: -#line 3805 "third_party/libpg_query/grammar/statements/select.y" + case 1279: +#line 3843 "third_party/libpg_query/grammar/statements/select.y" { PGCaseExpr *c = makeNode(PGCaseExpr); c->casetype = InvalidOid; /* not analyzed yet */ @@ -30580,18 +30625,18 @@ YYLTYPE yylloc; ;} break; - case 1279: -#line 3818 "third_party/libpg_query/grammar/statements/select.y" + case 1280: +#line 3856 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 1280: -#line 3819 "third_party/libpg_query/grammar/statements/select.y" + case 1281: +#line 3857 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].node)); ;} break; - case 1281: -#line 3824 "third_party/libpg_query/grammar/statements/select.y" + case 1282: +#line 3862 "third_party/libpg_query/grammar/statements/select.y" { PGCaseWhen *w = makeNode(PGCaseWhen); w->expr = (PGExpr *) (yyvsp[(2) - (4)].node); @@ -30601,49 +30646,49 @@ YYLTYPE yylloc; ;} break; - case 1282: -#line 3834 "third_party/libpg_query/grammar/statements/select.y" + case 1283: +#line 3872 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; - case 1283: -#line 3835 "third_party/libpg_query/grammar/statements/select.y" + case 1284: +#line 3873 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = NULL; ;} break; - case 1284: -#line 3838 "third_party/libpg_query/grammar/statements/select.y" + case 1285: +#line 3876 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 1285: -#line 3839 "third_party/libpg_query/grammar/statements/select.y" + case 1286: +#line 3877 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = NULL; ;} break; - case 1286: -#line 3848 "third_party/libpg_query/grammar/statements/select.y" + case 1287: +#line 3886 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeColumnRef((yyvsp[(1) - (1)].str), NIL, (yylsp[(1) - (1)]), yyscanner); ;} break; - case 1287: -#line 3854 "third_party/libpg_query/grammar/statements/select.y" + case 1288: +#line 3892 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeColumnRef((yyvsp[(1) - (1)].str), NIL, (yylsp[(1) - (1)]), yyscanner); ;} break; - case 1288: -#line 3858 "third_party/libpg_query/grammar/statements/select.y" + case 1289: +#line 3896 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeColumnRef((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].list), (yylsp[(1) - (2)]), yyscanner); ;} break; - case 1289: -#line 3865 "third_party/libpg_query/grammar/statements/select.y" + case 1290: +#line 3903 "third_party/libpg_query/grammar/statements/select.y" { PGAIndices *ai = makeNode(PGAIndices); ai->is_slice = false; @@ -30653,8 +30698,8 @@ YYLTYPE yylloc; ;} break; - case 1290: -#line 3873 "third_party/libpg_query/grammar/statements/select.y" + case 1291: +#line 3911 "third_party/libpg_query/grammar/statements/select.y" { PGAIndices *ai = makeNode(PGAIndices); ai->is_slice = true; @@ -30664,8 +30709,8 @@ YYLTYPE yylloc; ;} break; - case 1291: -#line 3880 "third_party/libpg_query/grammar/statements/select.y" + case 1292: +#line 3918 "third_party/libpg_query/grammar/statements/select.y" { PGAIndices *ai = makeNode(PGAIndices); ai->is_slice = true; @@ -30676,8 +30721,8 @@ YYLTYPE yylloc; ;} break; - case 1292: -#line 3888 "third_party/libpg_query/grammar/statements/select.y" + case 1293: +#line 3926 "third_party/libpg_query/grammar/statements/select.y" { PGAIndices *ai = makeNode(PGAIndices); ai->is_slice = true; @@ -30687,43 +30732,43 @@ YYLTYPE yylloc; ;} break; - case 1293: -#line 3898 "third_party/libpg_query/grammar/statements/select.y" + case 1294: +#line 3936 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 1294: -#line 3899 "third_party/libpg_query/grammar/statements/select.y" + case 1295: +#line 3937 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = NULL; ;} break; - case 1295: -#line 3904 "third_party/libpg_query/grammar/statements/select.y" + case 1296: +#line 3942 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 1296: -#line 3905 "third_party/libpg_query/grammar/statements/select.y" + case 1297: +#line 3943 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].node)); ;} break; - case 1297: -#line 3909 "third_party/libpg_query/grammar/statements/select.y" + case 1298: +#line 3947 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NULL; ;} break; - case 1298: -#line 3910 "third_party/libpg_query/grammar/statements/select.y" + case 1299: +#line 3948 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(NULL); ;} break; - case 1299: -#line 3911 "third_party/libpg_query/grammar/statements/select.y" + case 1300: +#line 3949 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(2) - (3)].list); ;} break; - case 1300: -#line 3916 "third_party/libpg_query/grammar/statements/select.y" + case 1301: +#line 3954 "third_party/libpg_query/grammar/statements/select.y" { if ((yyvsp[(3) - (3)].list)) { PGFuncCall *n = makeFuncCall(list_make1(makeString((yyvsp[(2) - (3)].str))), (yyvsp[(3) - (3)].list)->head->data.ptr_value ? (yyvsp[(3) - (3)].list) : NULL, (yylsp[(2) - (3)])); @@ -30734,8 +30779,8 @@ YYLTYPE yylloc; ;} break; - case 1301: -#line 3925 "third_party/libpg_query/grammar/statements/select.y" + case 1302: +#line 3963 "third_party/libpg_query/grammar/statements/select.y" { PGAIndices *ai = makeNode(PGAIndices); ai->is_slice = false; @@ -30745,8 +30790,8 @@ YYLTYPE yylloc; ;} break; - case 1302: -#line 3933 "third_party/libpg_query/grammar/statements/select.y" + case 1303: +#line 3971 "third_party/libpg_query/grammar/statements/select.y" { PGAIndices *ai = makeNode(PGAIndices); ai->is_slice = true; @@ -30756,8 +30801,8 @@ YYLTYPE yylloc; ;} break; - case 1303: -#line 3940 "third_party/libpg_query/grammar/statements/select.y" + case 1304: +#line 3978 "third_party/libpg_query/grammar/statements/select.y" { PGAIndices *ai = makeNode(PGAIndices); ai->is_slice = true; @@ -30768,8 +30813,8 @@ YYLTYPE yylloc; ;} break; - case 1304: -#line 3949 "third_party/libpg_query/grammar/statements/select.y" + case 1305: +#line 3987 "third_party/libpg_query/grammar/statements/select.y" { PGAIndices *ai = makeNode(PGAIndices); ai->is_slice = true; @@ -30779,48 +30824,48 @@ YYLTYPE yylloc; ;} break; - case 1305: -#line 3964 "third_party/libpg_query/grammar/statements/select.y" + case 1306: +#line 4002 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 1306: -#line 3965 "third_party/libpg_query/grammar/statements/select.y" + case 1307: +#line 4003 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].node)); ;} break; - case 1309: -#line 3981 "third_party/libpg_query/grammar/statements/select.y" + case 1310: +#line 4019 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 1310: -#line 3982 "third_party/libpg_query/grammar/statements/select.y" + case 1311: +#line 4020 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 1311: -#line 3986 "third_party/libpg_query/grammar/statements/select.y" + case 1312: +#line 4024 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].target)); ;} break; - case 1312: -#line 3987 "third_party/libpg_query/grammar/statements/select.y" + case 1313: +#line 4025 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].target)); ;} break; - case 1313: -#line 3991 "third_party/libpg_query/grammar/statements/select.y" + case 1314: +#line 4029 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 1314: -#line 3992 "third_party/libpg_query/grammar/statements/select.y" + case 1315: +#line 4030 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (2)].list); ;} break; - case 1315: -#line 3996 "third_party/libpg_query/grammar/statements/select.y" + case 1316: +#line 4034 "third_party/libpg_query/grammar/statements/select.y" { (yyval.target) = makeNode(PGResTarget); (yyval.target)->name = (yyvsp[(3) - (3)].str); @@ -30830,8 +30875,8 @@ YYLTYPE yylloc; ;} break; - case 1316: -#line 4012 "third_party/libpg_query/grammar/statements/select.y" + case 1317: +#line 4050 "third_party/libpg_query/grammar/statements/select.y" { (yyval.target) = makeNode(PGResTarget); (yyval.target)->name = (yyvsp[(2) - (2)].str); @@ -30841,8 +30886,8 @@ YYLTYPE yylloc; ;} break; - case 1317: -#line 4020 "third_party/libpg_query/grammar/statements/select.y" + case 1318: +#line 4058 "third_party/libpg_query/grammar/statements/select.y" { (yyval.target) = makeNode(PGResTarget); (yyval.target)->name = NULL; @@ -30852,8 +30897,8 @@ YYLTYPE yylloc; ;} break; - case 1318: -#line 4028 "third_party/libpg_query/grammar/statements/select.y" + case 1319: +#line 4066 "third_party/libpg_query/grammar/statements/select.y" { (yyval.target) = makeNode(PGResTarget); (yyval.target)->name = (yyvsp[(1) - (3)].str); @@ -30863,214 +30908,214 @@ YYLTYPE yylloc; ;} break; - case 1319: -#line 4037 "third_party/libpg_query/grammar/statements/select.y" + case 1320: +#line 4075 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(3) - (4)].list); ;} break; - case 1320: -#line 4038 "third_party/libpg_query/grammar/statements/select.y" + case 1321: +#line 4076 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(2) - (2)].list)); ;} break; - case 1321: -#line 4043 "third_party/libpg_query/grammar/statements/select.y" + case 1322: +#line 4081 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].str)); ;} break; - case 1322: -#line 4047 "third_party/libpg_query/grammar/statements/select.y" + case 1323: +#line 4085 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].str)); ;} break; - case 1323: -#line 4053 "third_party/libpg_query/grammar/statements/select.y" + case 1324: +#line 4091 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].list)); ;} break; - case 1324: -#line 4055 "third_party/libpg_query/grammar/statements/select.y" + case 1325: +#line 4093 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].list)); ;} break; - case 1325: -#line 4059 "third_party/libpg_query/grammar/statements/select.y" + case 1326: +#line 4097 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 1326: -#line 4060 "third_party/libpg_query/grammar/statements/select.y" + case 1327: +#line 4098 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (2)].list); ;} break; - case 1327: -#line 4064 "third_party/libpg_query/grammar/statements/select.y" + case 1328: +#line 4102 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 1328: -#line 4065 "third_party/libpg_query/grammar/statements/select.y" + case 1329: +#line 4103 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NULL; ;} break; - case 1329: -#line 4068 "third_party/libpg_query/grammar/statements/select.y" + case 1330: +#line 4106 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make2((yyvsp[(1) - (3)].node), makeString((yyvsp[(3) - (3)].str))); ;} break; - case 1330: -#line 4072 "third_party/libpg_query/grammar/statements/select.y" + case 1331: +#line 4110 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].list)); ;} break; - case 1331: -#line 4073 "third_party/libpg_query/grammar/statements/select.y" + case 1332: +#line 4111 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].list)); ;} break; - case 1332: -#line 4077 "third_party/libpg_query/grammar/statements/select.y" + case 1333: +#line 4115 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 1333: -#line 4078 "third_party/libpg_query/grammar/statements/select.y" + case 1334: +#line 4116 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (2)].list); ;} break; - case 1334: -#line 4081 "third_party/libpg_query/grammar/statements/select.y" + case 1335: +#line 4119 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(3) - (4)].list); ;} break; - case 1335: -#line 4082 "third_party/libpg_query/grammar/statements/select.y" + case 1336: +#line 4120 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(2) - (2)].list)); ;} break; - case 1336: -#line 4083 "third_party/libpg_query/grammar/statements/select.y" + case 1337: +#line 4121 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NULL; ;} break; - case 1337: -#line 4086 "third_party/libpg_query/grammar/statements/select.y" + case 1338: +#line 4124 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make2((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].str)); ;} break; - case 1338: -#line 4090 "third_party/libpg_query/grammar/statements/select.y" + case 1339: +#line 4128 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].list)); ;} break; - case 1339: -#line 4091 "third_party/libpg_query/grammar/statements/select.y" + case 1340: +#line 4129 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].list)); ;} break; - case 1340: -#line 4095 "third_party/libpg_query/grammar/statements/select.y" + case 1341: +#line 4133 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 1341: -#line 4096 "third_party/libpg_query/grammar/statements/select.y" + case 1342: +#line 4134 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (2)].list); ;} break; - case 1342: -#line 4098 "third_party/libpg_query/grammar/statements/select.y" + case 1343: +#line 4136 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(3) - (4)].list); ;} break; - case 1343: -#line 4099 "third_party/libpg_query/grammar/statements/select.y" + case 1344: +#line 4137 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(2) - (2)].list)); ;} break; - case 1344: -#line 4100 "third_party/libpg_query/grammar/statements/select.y" + case 1345: +#line 4138 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NULL; ;} break; - case 1345: -#line 4110 "third_party/libpg_query/grammar/statements/select.y" + case 1346: +#line 4148 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].range)); ;} break; - case 1346: -#line 4111 "third_party/libpg_query/grammar/statements/select.y" + case 1347: +#line 4149 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].range)); ;} break; - case 1347: -#line 4116 "third_party/libpg_query/grammar/statements/select.y" + case 1348: +#line 4154 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeString((yyvsp[(1) - (1)].str))); ;} break; - case 1348: -#line 4118 "third_party/libpg_query/grammar/statements/select.y" + case 1349: +#line 4156 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), makeString((yyvsp[(3) - (3)].str))); ;} break; - case 1349: -#line 4123 "third_party/libpg_query/grammar/statements/select.y" + case 1350: +#line 4161 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 1350: -#line 4124 "third_party/libpg_query/grammar/statements/select.y" + case 1351: +#line 4162 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (2)].list); ;} break; - case 1351: -#line 4128 "third_party/libpg_query/grammar/statements/select.y" + case 1352: +#line 4166 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 1352: -#line 4129 "third_party/libpg_query/grammar/statements/select.y" + case 1353: +#line 4167 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(2) - (3)].list); ;} break; - case 1353: -#line 4132 "third_party/libpg_query/grammar/statements/select.y" + case 1354: +#line 4170 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1354: -#line 4144 "third_party/libpg_query/grammar/statements/select.y" + case 1355: +#line 4182 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1(makeString((yyvsp[(1) - (1)].str))); ;} break; - case 1355: -#line 4147 "third_party/libpg_query/grammar/statements/select.y" + case 1356: +#line 4185 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = check_func_name(lcons(makeString((yyvsp[(1) - (2)].str)), (yyvsp[(2) - (2)].list)), yyscanner); ;} break; - case 1356: -#line 4158 "third_party/libpg_query/grammar/statements/select.y" + case 1357: +#line 4196 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeIntConst((yyvsp[(1) - (1)].ival), (yylsp[(1) - (1)])); ;} break; - case 1357: -#line 4162 "third_party/libpg_query/grammar/statements/select.y" + case 1358: +#line 4200 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeFloatConst((yyvsp[(1) - (1)].str), (yylsp[(1) - (1)])); ;} break; - case 1358: -#line 4166 "third_party/libpg_query/grammar/statements/select.y" + case 1359: +#line 4204 "third_party/libpg_query/grammar/statements/select.y" { if ((yyvsp[(2) - (2)].list)) { @@ -31084,15 +31129,15 @@ YYLTYPE yylloc; ;} break; - case 1359: -#line 4178 "third_party/libpg_query/grammar/statements/select.y" + case 1360: +#line 4216 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeBitStringConst((yyvsp[(1) - (1)].str), (yylsp[(1) - (1)])); ;} break; - case 1360: -#line 4182 "third_party/libpg_query/grammar/statements/select.y" + case 1361: +#line 4220 "third_party/libpg_query/grammar/statements/select.y" { /* This is a bit constant per SQL99: * Without Feature F511, "BIT data type", @@ -31103,8 +31148,8 @@ YYLTYPE yylloc; ;} break; - case 1361: -#line 4191 "third_party/libpg_query/grammar/statements/select.y" + case 1362: +#line 4229 "third_party/libpg_query/grammar/statements/select.y" { /* generic type 'literal' syntax */ PGTypeName *t = makeTypeNameFromNameList((yyvsp[(1) - (2)].list)); @@ -31113,8 +31158,8 @@ YYLTYPE yylloc; ;} break; - case 1362: -#line 4198 "third_party/libpg_query/grammar/statements/select.y" + case 1363: +#line 4236 "third_party/libpg_query/grammar/statements/select.y" { /* generic syntax with a type modifier */ PGTypeName *t = makeTypeNameFromNameList((yyvsp[(1) - (7)].list)); @@ -31154,146 +31199,146 @@ YYLTYPE yylloc; ;} break; - case 1363: -#line 4236 "third_party/libpg_query/grammar/statements/select.y" + case 1364: +#line 4274 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeStringConstCast((yyvsp[(2) - (2)].str), (yylsp[(2) - (2)]), (yyvsp[(1) - (2)].typnam)); ;} break; - case 1364: -#line 4240 "third_party/libpg_query/grammar/statements/select.y" + case 1365: +#line 4278 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeIntervalNode((yyvsp[(3) - (5)].node), (yylsp[(3) - (5)]), (yyvsp[(5) - (5)].list)); ;} break; - case 1365: -#line 4244 "third_party/libpg_query/grammar/statements/select.y" + case 1366: +#line 4282 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeIntervalNode((yyvsp[(2) - (3)].ival), (yylsp[(2) - (3)]), (yyvsp[(3) - (3)].list)); ;} break; - case 1366: -#line 4248 "third_party/libpg_query/grammar/statements/select.y" + case 1367: +#line 4286 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeIntervalNode((yyvsp[(2) - (3)].str), (yylsp[(2) - (3)]), (yyvsp[(3) - (3)].list)); ;} break; - case 1367: -#line 4252 "third_party/libpg_query/grammar/statements/select.y" + case 1368: +#line 4290 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeBoolAConst(true, (yylsp[(1) - (1)])); ;} break; - case 1368: -#line 4256 "third_party/libpg_query/grammar/statements/select.y" + case 1369: +#line 4294 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeBoolAConst(false, (yylsp[(1) - (1)])); ;} break; - case 1369: -#line 4260 "third_party/libpg_query/grammar/statements/select.y" + case 1370: +#line 4298 "third_party/libpg_query/grammar/statements/select.y" { (yyval.node) = makeNullAConst((yylsp[(1) - (1)])); ;} break; - case 1370: -#line 4265 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.ival) = (yyvsp[(1) - (1)].ival); ;} - break; - case 1371: -#line 4282 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} +#line 4303 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.ival) = (yyvsp[(1) - (1)].ival); ;} break; case 1372: -#line 4283 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} +#line 4320 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; case 1373: -#line 4284 "third_party/libpg_query/grammar/statements/select.y" +#line 4321 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} break; case 1374: -#line 4287 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} +#line 4322 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} break; case 1375: -#line 4288 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} +#line 4325 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; case 1376: -#line 4289 "third_party/libpg_query/grammar/statements/select.y" +#line 4326 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} break; case 1377: -#line 4292 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} +#line 4327 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} break; case 1378: -#line 4293 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} +#line 4330 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; case 1379: -#line 4294 "third_party/libpg_query/grammar/statements/select.y" +#line 4331 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} break; case 1380: -#line 4297 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1(makeString((yyvsp[(1) - (1)].str))); ;} +#line 4332 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} break; case 1381: -#line 4298 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = lcons(makeString((yyvsp[(1) - (2)].str)), (yyvsp[(2) - (2)].list)); ;} +#line 4335 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1(makeString((yyvsp[(1) - (1)].str))); ;} break; case 1382: -#line 4302 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1(makeString((yyvsp[(2) - (2)].str))); ;} +#line 4336 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = lcons(makeString((yyvsp[(1) - (2)].str)), (yyvsp[(2) - (2)].list)); ;} break; case 1383: -#line 4304 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = lappend((yyvsp[(1) - (3)].list), makeString((yyvsp[(3) - (3)].str))); ;} +#line 4340 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1(makeString((yyvsp[(2) - (2)].str))); ;} break; case 1384: -#line 4308 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = (yyvsp[(2) - (3)].list); ;} +#line 4342 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = lappend((yyvsp[(1) - (3)].list), makeString((yyvsp[(3) - (3)].str))); ;} break; case 1385: -#line 4309 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = NIL; ;} +#line 4346 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(2) - (3)].list); ;} break; - case 1387: -#line 4316 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} + case 1386: +#line 4347 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = NIL; ;} break; case 1388: -#line 4317 "third_party/libpg_query/grammar/statements/select.y" +#line 4354 "third_party/libpg_query/grammar/statements/select.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; case 1389: +#line 4355 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} + break; + + case 1390: #line 8 "third_party/libpg_query/grammar/statements/prepare.y" { PGPrepareStmt *n = makeNode(PGPrepareStmt); @@ -31304,17 +31349,17 @@ YYLTYPE yylloc; ;} break; - case 1390: + case 1391: #line 18 "third_party/libpg_query/grammar/statements/prepare.y" { (yyval.list) = (yyvsp[(2) - (3)].list); ;} break; - case 1391: + case 1392: #line 19 "third_party/libpg_query/grammar/statements/prepare.y" { (yyval.list) = NIL; ;} break; - case 1398: + case 1399: #line 8 "third_party/libpg_query/grammar/statements/create_schema.y" { PGCreateSchemaStmt *n = makeNode(PGCreateSchemaStmt); @@ -31336,7 +31381,7 @@ YYLTYPE yylloc; ;} break; - case 1399: + case 1400: #line 27 "third_party/libpg_query/grammar/statements/create_schema.y" { PGCreateSchemaStmt *n = makeNode(PGCreateSchemaStmt); @@ -31363,7 +31408,7 @@ YYLTYPE yylloc; ;} break; - case 1400: + case 1401: #line 51 "third_party/libpg_query/grammar/statements/create_schema.y" { PGCreateSchemaStmt *n = makeNode(PGCreateSchemaStmt); @@ -31385,7 +31430,7 @@ YYLTYPE yylloc; ;} break; - case 1401: + case 1402: #line 74 "third_party/libpg_query/grammar/statements/create_schema.y" { if ((yyloc) < 0) /* see comments for YYLLOC_DEFAULT */ @@ -31394,12 +31439,12 @@ YYLTYPE yylloc; ;} break; - case 1402: + case 1403: #line 80 "third_party/libpg_query/grammar/statements/create_schema.y" { (yyval.list) = NIL; ;} break; - case 1407: + case 1408: #line 11 "third_party/libpg_query/grammar/statements/index.y" { PGIndexStmt *n = makeNode(PGIndexStmt); @@ -31425,7 +31470,7 @@ YYLTYPE yylloc; ;} break; - case 1408: + case 1409: #line 36 "third_party/libpg_query/grammar/statements/index.y" { PGIndexStmt *n = makeNode(PGIndexStmt); @@ -31451,62 +31496,62 @@ YYLTYPE yylloc; ;} break; - case 1409: + case 1410: #line 62 "third_party/libpg_query/grammar/statements/index.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1410: + case 1411: #line 66 "third_party/libpg_query/grammar/statements/index.y" { (yyval.str) = (yyvsp[(2) - (2)].str); ;} break; - case 1411: + case 1412: #line 67 "third_party/libpg_query/grammar/statements/index.y" { (yyval.str) = (char*) DEFAULT_INDEX_TYPE; ;} break; - case 1412: + case 1413: #line 72 "third_party/libpg_query/grammar/statements/index.y" { (yyval.boolean) = true; ;} break; - case 1413: + case 1414: #line 73 "third_party/libpg_query/grammar/statements/index.y" { (yyval.boolean) = false; ;} break; - case 1414: + case 1415: #line 78 "third_party/libpg_query/grammar/statements/index.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1415: + case 1416: #line 79 "third_party/libpg_query/grammar/statements/index.y" { (yyval.str) = NULL; ;} break; - case 1416: + case 1417: #line 83 "third_party/libpg_query/grammar/statements/index.y" { (yyval.list) = (yyvsp[(2) - (2)].list); ;} break; - case 1417: + case 1418: #line 84 "third_party/libpg_query/grammar/statements/index.y" { (yyval.list) = NIL; ;} break; - case 1418: + case 1419: #line 89 "third_party/libpg_query/grammar/statements/index.y" { (yyval.boolean) = true; ;} break; - case 1419: + case 1420: #line 90 "third_party/libpg_query/grammar/statements/index.y" { (yyval.boolean) = false; ;} break; - case 1420: + case 1421: #line 8 "third_party/libpg_query/grammar/statements/alter_schema.y" { PGAlterObjectSchemaStmt *n = makeNode(PGAlterObjectSchemaStmt); @@ -31518,7 +31563,7 @@ YYLTYPE yylloc; ;} break; - case 1421: + case 1422: #line 17 "third_party/libpg_query/grammar/statements/alter_schema.y" { PGAlterObjectSchemaStmt *n = makeNode(PGAlterObjectSchemaStmt); @@ -31530,7 +31575,7 @@ YYLTYPE yylloc; ;} break; - case 1422: + case 1423: #line 26 "third_party/libpg_query/grammar/statements/alter_schema.y" { PGAlterObjectSchemaStmt *n = makeNode(PGAlterObjectSchemaStmt); @@ -31542,7 +31587,7 @@ YYLTYPE yylloc; ;} break; - case 1423: + case 1424: #line 35 "third_party/libpg_query/grammar/statements/alter_schema.y" { PGAlterObjectSchemaStmt *n = makeNode(PGAlterObjectSchemaStmt); @@ -31554,7 +31599,7 @@ YYLTYPE yylloc; ;} break; - case 1424: + case 1425: #line 44 "third_party/libpg_query/grammar/statements/alter_schema.y" { PGAlterObjectSchemaStmt *n = makeNode(PGAlterObjectSchemaStmt); @@ -31566,7 +31611,7 @@ YYLTYPE yylloc; ;} break; - case 1425: + case 1426: #line 53 "third_party/libpg_query/grammar/statements/alter_schema.y" { PGAlterObjectSchemaStmt *n = makeNode(PGAlterObjectSchemaStmt); @@ -31578,7 +31623,7 @@ YYLTYPE yylloc; ;} break; - case 1426: + case 1427: #line 6 "third_party/libpg_query/grammar/statements/checkpoint.y" { PGCheckPointStmt *n = makeNode(PGCheckPointStmt); @@ -31588,7 +31633,7 @@ YYLTYPE yylloc; ;} break; - case 1427: + case 1428: #line 13 "third_party/libpg_query/grammar/statements/checkpoint.y" { PGCheckPointStmt *n = makeNode(PGCheckPointStmt); @@ -31598,17 +31643,17 @@ YYLTYPE yylloc; ;} break; - case 1428: + case 1429: #line 22 "third_party/libpg_query/grammar/statements/checkpoint.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1429: + case 1430: #line 23 "third_party/libpg_query/grammar/statements/checkpoint.y" { (yyval.str) = NULL; ;} break; - case 1430: + case 1431: #line 8 "third_party/libpg_query/grammar/statements/comment_on.y" { PGCommentOnStmt *n = makeNode(PGCommentOnStmt); @@ -31619,7 +31664,7 @@ YYLTYPE yylloc; ;} break; - case 1431: + case 1432: #line 16 "third_party/libpg_query/grammar/statements/comment_on.y" { PGCommentOnStmt *n = makeNode(PGCommentOnStmt); @@ -31630,67 +31675,67 @@ YYLTYPE yylloc; ;} break; - case 1432: + case 1433: #line 26 "third_party/libpg_query/grammar/statements/comment_on.y" { (yyval.node) = makeStringConst((yyvsp[(1) - (1)].str), (yylsp[(1) - (1)])); ;} break; - case 1433: + case 1434: #line 27 "third_party/libpg_query/grammar/statements/comment_on.y" { (yyval.node) = makeNullAConst((yylsp[(1) - (1)])); ;} break; - case 1434: + case 1435: #line 30 "third_party/libpg_query/grammar/statements/comment_on.y" { (yyval.objtype) = PG_OBJECT_TABLE; ;} break; - case 1435: + case 1436: #line 31 "third_party/libpg_query/grammar/statements/comment_on.y" { (yyval.objtype) = PG_OBJECT_SEQUENCE; ;} break; - case 1436: + case 1437: #line 32 "third_party/libpg_query/grammar/statements/comment_on.y" { (yyval.objtype) = PG_OBJECT_FUNCTION; ;} break; - case 1437: + case 1438: #line 33 "third_party/libpg_query/grammar/statements/comment_on.y" { (yyval.objtype) = PG_OBJECT_FUNCTION; ;} break; - case 1438: + case 1439: #line 34 "third_party/libpg_query/grammar/statements/comment_on.y" { (yyval.objtype) = PG_OBJECT_TABLE_MACRO; ;} break; - case 1439: + case 1440: #line 35 "third_party/libpg_query/grammar/statements/comment_on.y" { (yyval.objtype) = PG_OBJECT_VIEW; ;} break; - case 1440: + case 1441: #line 36 "third_party/libpg_query/grammar/statements/comment_on.y" { (yyval.objtype) = PG_OBJECT_DATABASE; ;} break; - case 1441: + case 1442: #line 37 "third_party/libpg_query/grammar/statements/comment_on.y" { (yyval.objtype) = PG_OBJECT_INDEX; ;} break; - case 1442: + case 1443: #line 38 "third_party/libpg_query/grammar/statements/comment_on.y" { (yyval.objtype) = PG_OBJECT_SCHEMA; ;} break; - case 1443: + case 1444: #line 39 "third_party/libpg_query/grammar/statements/comment_on.y" { (yyval.objtype) = PG_OBJECT_TYPE; ;} break; - case 1444: + case 1445: #line 8 "third_party/libpg_query/grammar/statements/export.y" { PGExportStmt *n = makeNode(PGExportStmt); @@ -31704,7 +31749,7 @@ YYLTYPE yylloc; ;} break; - case 1445: + case 1446: #line 20 "third_party/libpg_query/grammar/statements/export.y" { PGExportStmt *n = makeNode(PGExportStmt); @@ -31718,7 +31763,7 @@ YYLTYPE yylloc; ;} break; - case 1446: + case 1447: #line 34 "third_party/libpg_query/grammar/statements/export.y" { PGImportStmt *n = makeNode(PGImportStmt); @@ -31727,7 +31772,7 @@ YYLTYPE yylloc; ;} break; - case 1447: + case 1448: #line 10 "third_party/libpg_query/grammar/statements/explain.y" { PGExplainStmt *n = makeNode(PGExplainStmt); @@ -31737,7 +31782,7 @@ YYLTYPE yylloc; ;} break; - case 1448: + case 1449: #line 17 "third_party/libpg_query/grammar/statements/explain.y" { PGExplainStmt *n = makeNode(PGExplainStmt); @@ -31750,7 +31795,7 @@ YYLTYPE yylloc; ;} break; - case 1449: + case 1450: #line 27 "third_party/libpg_query/grammar/statements/explain.y" { PGExplainStmt *n = makeNode(PGExplainStmt); @@ -31760,7 +31805,7 @@ YYLTYPE yylloc; ;} break; - case 1450: + case 1451: #line 34 "third_party/libpg_query/grammar/statements/explain.y" { PGExplainStmt *n = makeNode(PGExplainStmt); @@ -31770,118 +31815,118 @@ YYLTYPE yylloc; ;} break; - case 1451: + case 1452: #line 44 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.boolean) = true; ;} break; - case 1452: + case 1453: #line 45 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.boolean) = false; ;} break; - case 1453: + case 1454: #line 50 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.node) = (PGNode *) makeString((yyvsp[(1) - (1)].str)); ;} break; - case 1454: + case 1455: #line 51 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.node) = (PGNode *) (yyvsp[(1) - (1)].value); ;} break; - case 1455: + case 1456: #line 52 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.node) = NULL; ;} break; - case 1488: + case 1489: #line 92 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1489: + case 1490: #line 93 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} break; - case 1490: + case 1491: #line 94 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} break; - case 1491: + case 1492: #line 99 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1492: + case 1493: #line 100 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1493: + case 1494: #line 106 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].defelt)); ;} break; - case 1494: + case 1495: #line 110 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].defelt)); ;} break; - case 1495: + case 1496: #line 117 "third_party/libpg_query/grammar/statements/explain.y" {;} break; - case 1496: + case 1497: #line 118 "third_party/libpg_query/grammar/statements/explain.y" {;} break; - case 1497: + case 1498: #line 123 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.str) = (char*) "true"; ;} break; - case 1498: + case 1499: #line 124 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.str) = (char*) "false"; ;} break; - case 1499: + case 1500: #line 125 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.str) = (char*) "on"; ;} break; - case 1500: + case 1501: #line 131 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1501: + case 1502: #line 137 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.defelt) = makeDefElem((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} break; - case 1502: + case 1503: #line 144 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1503: + case 1504: #line 145 "third_party/libpg_query/grammar/statements/explain.y" { (yyval.str) = (char*) "analyze"; ;} break; - case 1504: + case 1505: #line 11 "third_party/libpg_query/grammar/statements/variable_set.y" { PGVariableSetStmt *n = (yyvsp[(2) - (2)].vsetstmt); @@ -31890,7 +31935,7 @@ YYLTYPE yylloc; ;} break; - case 1505: + case 1506: #line 17 "third_party/libpg_query/grammar/statements/variable_set.y" { PGVariableSetStmt *n = (yyvsp[(3) - (3)].vsetstmt); @@ -31899,7 +31944,7 @@ YYLTYPE yylloc; ;} break; - case 1506: + case 1507: #line 23 "third_party/libpg_query/grammar/statements/variable_set.y" { PGVariableSetStmt *n = (yyvsp[(3) - (3)].vsetstmt); @@ -31908,7 +31953,7 @@ YYLTYPE yylloc; ;} break; - case 1507: + case 1508: #line 29 "third_party/libpg_query/grammar/statements/variable_set.y" { PGVariableSetStmt *n = (yyvsp[(3) - (3)].vsetstmt); @@ -31917,7 +31962,7 @@ YYLTYPE yylloc; ;} break; - case 1508: + case 1509: #line 35 "third_party/libpg_query/grammar/statements/variable_set.y" { PGVariableSetStmt *n = (yyvsp[(3) - (3)].vsetstmt); @@ -31926,12 +31971,12 @@ YYLTYPE yylloc; ;} break; - case 1509: + case 1510: #line 44 "third_party/libpg_query/grammar/statements/variable_set.y" {(yyval.vsetstmt) = (yyvsp[(1) - (1)].vsetstmt);;} break; - case 1510: + case 1511: #line 46 "third_party/libpg_query/grammar/statements/variable_set.y" { PGVariableSetStmt *n = makeNode(PGVariableSetStmt); @@ -31941,7 +31986,7 @@ YYLTYPE yylloc; ;} break; - case 1511: + case 1512: #line 54 "third_party/libpg_query/grammar/statements/variable_set.y" { PGVariableSetStmt *n = makeNode(PGVariableSetStmt); @@ -31955,7 +32000,7 @@ YYLTYPE yylloc; ;} break; - case 1512: + case 1513: #line 65 "third_party/libpg_query/grammar/statements/variable_set.y" { PGVariableSetStmt *n = makeNode(PGVariableSetStmt); @@ -31966,7 +32011,7 @@ YYLTYPE yylloc; ;} break; - case 1513: + case 1514: #line 77 "third_party/libpg_query/grammar/statements/variable_set.y" { PGVariableSetStmt *n = makeNode(PGVariableSetStmt); @@ -31977,7 +32022,7 @@ YYLTYPE yylloc; ;} break; - case 1514: + case 1515: #line 85 "third_party/libpg_query/grammar/statements/variable_set.y" { PGVariableSetStmt *n = makeNode(PGVariableSetStmt); @@ -31988,26 +32033,26 @@ YYLTYPE yylloc; ;} break; - case 1515: + case 1516: #line 96 "third_party/libpg_query/grammar/statements/variable_set.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 1516: + case 1517: #line 102 "third_party/libpg_query/grammar/statements/variable_set.y" { (yyval.node) = makeStringConst((yyvsp[(1) - (1)].str), (yylsp[(1) - (1)])); ;} break; - case 1517: + case 1518: #line 106 "third_party/libpg_query/grammar/statements/variable_set.y" { (yyval.node) = makeStringConst((yyvsp[(1) - (1)].str), (yylsp[(1) - (1)])); ;} break; - case 1518: + case 1519: #line 110 "third_party/libpg_query/grammar/statements/variable_set.y" { PGTypeName *t = (yyvsp[(1) - (3)].typnam); @@ -32025,7 +32070,7 @@ YYLTYPE yylloc; ;} break; - case 1519: + case 1520: #line 125 "third_party/libpg_query/grammar/statements/variable_set.y" { PGTypeName *t = (yyvsp[(1) - (5)].typnam); @@ -32035,32 +32080,32 @@ YYLTYPE yylloc; ;} break; - case 1520: + case 1521: #line 131 "third_party/libpg_query/grammar/statements/variable_set.y" { (yyval.node) = makeAConst((yyvsp[(1) - (1)].value), (yylsp[(1) - (1)])); ;} break; - case 1521: + case 1522: #line 132 "third_party/libpg_query/grammar/statements/variable_set.y" { (yyval.node) = NULL; ;} break; - case 1522: + case 1523: #line 133 "third_party/libpg_query/grammar/statements/variable_set.y" { (yyval.node) = NULL; ;} break; - case 1523: + case 1524: #line 137 "third_party/libpg_query/grammar/statements/variable_set.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 1524: + case 1525: #line 138 "third_party/libpg_query/grammar/statements/variable_set.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; - case 1525: + case 1526: #line 8 "third_party/libpg_query/grammar/statements/load.y" { PGLoadStmt *n = makeNode(PGLoadStmt); @@ -32073,7 +32118,7 @@ YYLTYPE yylloc; ;} break; - case 1526: + case 1527: #line 17 "third_party/libpg_query/grammar/statements/load.y" { PGLoadStmt *n = makeNode(PGLoadStmt); @@ -32086,7 +32131,7 @@ YYLTYPE yylloc; ;} break; - case 1527: + case 1528: #line 26 "third_party/libpg_query/grammar/statements/load.y" { PGLoadStmt *n = makeNode(PGLoadStmt); @@ -32099,7 +32144,7 @@ YYLTYPE yylloc; ;} break; - case 1528: + case 1529: #line 35 "third_party/libpg_query/grammar/statements/load.y" { PGLoadStmt *n = makeNode(PGLoadStmt); @@ -32112,42 +32157,42 @@ YYLTYPE yylloc; ;} break; - case 1529: + case 1530: #line 46 "third_party/libpg_query/grammar/statements/load.y" { (yyval.loadinstalltype) = PG_LOAD_TYPE_INSTALL; ;} break; - case 1530: + case 1531: #line 47 "third_party/libpg_query/grammar/statements/load.y" { (yyval.loadinstalltype) = PG_LOAD_TYPE_FORCE_INSTALL; ;} break; - case 1531: + case 1532: #line 49 "third_party/libpg_query/grammar/statements/load.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1532: + case 1533: #line 50 "third_party/libpg_query/grammar/statements/load.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1533: + case 1534: #line 53 "third_party/libpg_query/grammar/statements/load.y" { (yyval.str) = NULL; ;} break; - case 1534: + case 1535: #line 54 "third_party/libpg_query/grammar/statements/load.y" { (yyval.str) = (yyvsp[(2) - (2)].str); ;} break; - case 1535: + case 1536: #line 55 "third_party/libpg_query/grammar/statements/load.y" { (yyval.str) = (yyvsp[(2) - (2)].str); ;} break; - case 1536: + case 1537: #line 9 "third_party/libpg_query/grammar/statements/vacuum.y" { PGVacuumStmt *n = makeNode(PGVacuumStmt); @@ -32164,7 +32209,7 @@ YYLTYPE yylloc; ;} break; - case 1537: + case 1538: #line 23 "third_party/libpg_query/grammar/statements/vacuum.y" { PGVacuumStmt *n = makeNode(PGVacuumStmt); @@ -32181,7 +32226,7 @@ YYLTYPE yylloc; ;} break; - case 1538: + case 1539: #line 37 "third_party/libpg_query/grammar/statements/vacuum.y" { PGVacuumStmt *n = (PGVacuumStmt *) (yyvsp[(5) - (5)].node); @@ -32196,7 +32241,7 @@ YYLTYPE yylloc; ;} break; - case 1539: + case 1540: #line 49 "third_party/libpg_query/grammar/statements/vacuum.y" { PGVacuumStmt *n = makeNode(PGVacuumStmt); @@ -32207,7 +32252,7 @@ YYLTYPE yylloc; ;} break; - case 1540: + case 1541: #line 57 "third_party/libpg_query/grammar/statements/vacuum.y" { PGVacuumStmt *n = makeNode(PGVacuumStmt); @@ -32220,27 +32265,27 @@ YYLTYPE yylloc; ;} break; - case 1541: + case 1542: #line 70 "third_party/libpg_query/grammar/statements/vacuum.y" { (yyval.ival) = PG_VACOPT_ANALYZE; ;} break; - case 1542: + case 1543: #line 71 "third_party/libpg_query/grammar/statements/vacuum.y" { (yyval.ival) = PG_VACOPT_VERBOSE; ;} break; - case 1543: + case 1544: #line 72 "third_party/libpg_query/grammar/statements/vacuum.y" { (yyval.ival) = PG_VACOPT_FREEZE; ;} break; - case 1544: + case 1545: #line 73 "third_party/libpg_query/grammar/statements/vacuum.y" { (yyval.ival) = PG_VACOPT_FULL; ;} break; - case 1545: + case 1546: #line 75 "third_party/libpg_query/grammar/statements/vacuum.y" { if (strcmp((yyvsp[(1) - (1)].str), "disable_page_skipping") == 0) @@ -32253,37 +32298,37 @@ YYLTYPE yylloc; ;} break; - case 1546: + case 1547: #line 87 "third_party/libpg_query/grammar/statements/vacuum.y" { (yyval.boolean) = true; ;} break; - case 1547: + case 1548: #line 88 "third_party/libpg_query/grammar/statements/vacuum.y" { (yyval.boolean) = false; ;} break; - case 1548: + case 1549: #line 93 "third_party/libpg_query/grammar/statements/vacuum.y" { (yyval.ival) = (yyvsp[(1) - (1)].ival); ;} break; - case 1549: + case 1550: #line 94 "third_party/libpg_query/grammar/statements/vacuum.y" { (yyval.ival) = (yyvsp[(1) - (3)].ival) | (yyvsp[(3) - (3)].ival); ;} break; - case 1550: + case 1551: #line 98 "third_party/libpg_query/grammar/statements/vacuum.y" { (yyval.boolean) = true; ;} break; - case 1551: + case 1552: #line 99 "third_party/libpg_query/grammar/statements/vacuum.y" { (yyval.boolean) = false; ;} break; - case 1552: + case 1553: #line 9 "third_party/libpg_query/grammar/statements/delete.y" { PGDeleteStmt *n = makeNode(PGDeleteStmt); @@ -32296,7 +32341,7 @@ YYLTYPE yylloc; ;} break; - case 1553: + case 1554: #line 19 "third_party/libpg_query/grammar/statements/delete.y" { PGDeleteStmt *n = makeNode(PGDeleteStmt); @@ -32309,14 +32354,14 @@ YYLTYPE yylloc; ;} break; - case 1554: + case 1555: #line 32 "third_party/libpg_query/grammar/statements/delete.y" { (yyval.range) = (yyvsp[(1) - (1)].range); ;} break; - case 1555: + case 1556: #line 36 "third_party/libpg_query/grammar/statements/delete.y" { PGAlias *alias = makeNode(PGAlias); @@ -32326,7 +32371,7 @@ YYLTYPE yylloc; ;} break; - case 1556: + case 1557: #line 43 "third_party/libpg_query/grammar/statements/delete.y" { PGAlias *alias = makeNode(PGAlias); @@ -32336,27 +32381,27 @@ YYLTYPE yylloc; ;} break; - case 1557: + case 1558: #line 53 "third_party/libpg_query/grammar/statements/delete.y" { (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; - case 1558: + case 1559: #line 54 "third_party/libpg_query/grammar/statements/delete.y" { (yyval.node) = NULL; ;} break; - case 1559: + case 1560: #line 60 "third_party/libpg_query/grammar/statements/delete.y" { (yyval.list) = (yyvsp[(2) - (2)].list); ;} break; - case 1560: + case 1561: #line 61 "third_party/libpg_query/grammar/statements/delete.y" { (yyval.list) = NIL; ;} break; - case 1561: + case 1562: #line 10 "third_party/libpg_query/grammar/statements/analyze.y" { PGVacuumStmt *n = makeNode(PGVacuumStmt); @@ -32369,7 +32414,7 @@ YYLTYPE yylloc; ;} break; - case 1562: + case 1563: #line 20 "third_party/libpg_query/grammar/statements/analyze.y" { PGVacuumStmt *n = makeNode(PGVacuumStmt); @@ -32382,7 +32427,7 @@ YYLTYPE yylloc; ;} break; - case 1563: + case 1564: #line 8 "third_party/libpg_query/grammar/statements/attach.y" { PGAttachStmt *n = makeNode(PGAttachStmt); @@ -32394,7 +32439,7 @@ YYLTYPE yylloc; ;} break; - case 1564: + case 1565: #line 17 "third_party/libpg_query/grammar/statements/attach.y" { PGAttachStmt *n = makeNode(PGAttachStmt); @@ -32406,7 +32451,7 @@ YYLTYPE yylloc; ;} break; - case 1565: + case 1566: #line 26 "third_party/libpg_query/grammar/statements/attach.y" { PGAttachStmt *n = makeNode(PGAttachStmt); @@ -32418,7 +32463,7 @@ YYLTYPE yylloc; ;} break; - case 1566: + case 1567: #line 38 "third_party/libpg_query/grammar/statements/attach.y" { PGDetachStmt *n = makeNode(PGDetachStmt); @@ -32428,7 +32473,7 @@ YYLTYPE yylloc; ;} break; - case 1567: + case 1568: #line 45 "third_party/libpg_query/grammar/statements/attach.y" { PGDetachStmt *n = makeNode(PGDetachStmt); @@ -32438,7 +32483,7 @@ YYLTYPE yylloc; ;} break; - case 1568: + case 1569: #line 52 "third_party/libpg_query/grammar/statements/attach.y" { PGDetachStmt *n = makeNode(PGDetachStmt); @@ -32448,72 +32493,72 @@ YYLTYPE yylloc; ;} break; - case 1569: + case 1570: #line 60 "third_party/libpg_query/grammar/statements/attach.y" {;} break; - case 1570: + case 1571: #line 61 "third_party/libpg_query/grammar/statements/attach.y" {;} break; - case 1571: + case 1572: #line 65 "third_party/libpg_query/grammar/statements/attach.y" { (yyval.str) = (yyvsp[(2) - (2)].str); ;} break; - case 1572: + case 1573: #line 66 "third_party/libpg_query/grammar/statements/attach.y" { (yyval.str) = NULL; ;} break; - case 1573: + case 1574: #line 77 "third_party/libpg_query/grammar/statements/attach.y" { (yyval.node) = (PGNode *) (yyvsp[(1) - (1)].node); ;} break; - case 1574: + case 1575: #line 78 "third_party/libpg_query/grammar/statements/attach.y" { (yyval.node) = NULL; ;} break; - case 1575: + case 1576: #line 83 "third_party/libpg_query/grammar/statements/attach.y" { (yyval.defelt) = makeDefElem((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} break; - case 1576: + case 1577: #line 90 "third_party/libpg_query/grammar/statements/attach.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].defelt)); ;} break; - case 1577: + case 1578: #line 94 "third_party/libpg_query/grammar/statements/attach.y" { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].defelt)); ;} break; - case 1578: + case 1579: #line 101 "third_party/libpg_query/grammar/statements/attach.y" { (yyval.list) = (yyvsp[(2) - (3)].list); ;} break; - case 1579: + case 1580: #line 105 "third_party/libpg_query/grammar/statements/attach.y" { (yyval.list) = NULL; ;} break; - case 1580: + case 1581: #line 3 "third_party/libpg_query/grammar/statements/variable_reset.y" { (yyvsp[(2) - (2)].vsetstmt)->scope = VAR_SET_SCOPE_DEFAULT; @@ -32521,7 +32566,7 @@ YYLTYPE yylloc; ;} break; - case 1581: + case 1582: #line 8 "third_party/libpg_query/grammar/statements/variable_reset.y" { (yyvsp[(3) - (3)].vsetstmt)->scope = VAR_SET_SCOPE_LOCAL; @@ -32529,7 +32574,7 @@ YYLTYPE yylloc; ;} break; - case 1582: + case 1583: #line 13 "third_party/libpg_query/grammar/statements/variable_reset.y" { (yyvsp[(3) - (3)].vsetstmt)->scope = VAR_SET_SCOPE_SESSION; @@ -32537,7 +32582,7 @@ YYLTYPE yylloc; ;} break; - case 1583: + case 1584: #line 18 "third_party/libpg_query/grammar/statements/variable_reset.y" { (yyvsp[(3) - (3)].vsetstmt)->scope = VAR_SET_SCOPE_GLOBAL; @@ -32545,7 +32590,7 @@ YYLTYPE yylloc; ;} break; - case 1584: + case 1585: #line 23 "third_party/libpg_query/grammar/statements/variable_reset.y" { (yyvsp[(3) - (3)].vsetstmt)->scope = VAR_SET_SCOPE_VARIABLE; @@ -32553,7 +32598,7 @@ YYLTYPE yylloc; ;} break; - case 1585: + case 1586: #line 32 "third_party/libpg_query/grammar/statements/variable_reset.y" { PGVariableSetStmt *n = makeNode(PGVariableSetStmt); @@ -32563,7 +32608,7 @@ YYLTYPE yylloc; ;} break; - case 1586: + case 1587: #line 39 "third_party/libpg_query/grammar/statements/variable_reset.y" { PGVariableSetStmt *n = makeNode(PGVariableSetStmt); @@ -32572,12 +32617,12 @@ YYLTYPE yylloc; ;} break; - case 1587: + case 1588: #line 48 "third_party/libpg_query/grammar/statements/variable_reset.y" { (yyval.vsetstmt) = (yyvsp[(1) - (1)].vsetstmt); ;} break; - case 1588: + case 1589: #line 50 "third_party/libpg_query/grammar/statements/variable_reset.y" { PGVariableSetStmt *n = makeNode(PGVariableSetStmt); @@ -32587,7 +32632,7 @@ YYLTYPE yylloc; ;} break; - case 1589: + case 1590: #line 57 "third_party/libpg_query/grammar/statements/variable_reset.y" { PGVariableSetStmt *n = makeNode(PGVariableSetStmt); @@ -32597,7 +32642,7 @@ YYLTYPE yylloc; ;} break; - case 1590: + case 1591: #line 3 "third_party/libpg_query/grammar/statements/variable_show.y" { PGVariableShowSelectStmt *n = makeNode(PGVariableShowSelectStmt); @@ -32608,7 +32653,7 @@ YYLTYPE yylloc; ;} break; - case 1591: + case 1592: #line 10 "third_party/libpg_query/grammar/statements/variable_show.y" { PGVariableShowSelectStmt *n = makeNode(PGVariableShowSelectStmt); @@ -32619,7 +32664,7 @@ YYLTYPE yylloc; ;} break; - case 1592: + case 1593: #line 18 "third_party/libpg_query/grammar/statements/variable_show.y" { PGVariableShowStmt *n = makeNode(PGVariableShowStmt); @@ -32629,7 +32674,7 @@ YYLTYPE yylloc; ;} break; - case 1593: + case 1594: #line 25 "third_party/libpg_query/grammar/statements/variable_show.y" { PGVariableShowStmt *n = makeNode(PGVariableShowStmt); @@ -32640,7 +32685,7 @@ YYLTYPE yylloc; ;} break; - case 1594: + case 1595: #line 33 "third_party/libpg_query/grammar/statements/variable_show.y" { PGVariableShowStmt *n = makeNode(PGVariableShowStmt); @@ -32650,7 +32695,7 @@ YYLTYPE yylloc; ;} break; - case 1595: + case 1596: #line 40 "third_party/libpg_query/grammar/statements/variable_show.y" { PGVariableShowStmt *n = makeNode(PGVariableShowStmt); @@ -32660,7 +32705,7 @@ YYLTYPE yylloc; ;} break; - case 1596: + case 1597: #line 47 "third_party/libpg_query/grammar/statements/variable_show.y" { PGVariableShowStmt *n = makeNode(PGVariableShowStmt); @@ -32670,7 +32715,7 @@ YYLTYPE yylloc; ;} break; - case 1597: + case 1598: #line 54 "third_party/libpg_query/grammar/statements/variable_show.y" { PGVariableShowStmt *n = makeNode(PGVariableShowStmt); @@ -32680,7 +32725,7 @@ YYLTYPE yylloc; ;} break; - case 1598: + case 1599: #line 61 "third_party/libpg_query/grammar/statements/variable_show.y" { PGVariableShowStmt *n = makeNode(PGVariableShowStmt); @@ -32690,17 +32735,17 @@ YYLTYPE yylloc; ;} break; - case 1605: + case 1606: #line 75 "third_party/libpg_query/grammar/statements/variable_show.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1606: + case 1607: #line 77 "third_party/libpg_query/grammar/statements/variable_show.y" { (yyval.str) = psprintf("%s.%s", (yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].str)); ;} break; - case 1607: + case 1608: #line 7 "third_party/libpg_query/grammar/statements/call.y" { PGCallStmt *n = makeNode(PGCallStmt); @@ -32709,7 +32754,7 @@ YYLTYPE yylloc; ;} break; - case 1608: + case 1609: #line 10 "third_party/libpg_query/grammar/statements/view.y" { PGViewStmt *n = makeNode(PGViewStmt); @@ -32724,7 +32769,7 @@ YYLTYPE yylloc; ;} break; - case 1609: + case 1610: #line 23 "third_party/libpg_query/grammar/statements/view.y" { PGViewStmt *n = makeNode(PGViewStmt); @@ -32739,7 +32784,7 @@ YYLTYPE yylloc; ;} break; - case 1610: + case 1611: #line 36 "third_party/libpg_query/grammar/statements/view.y" { PGViewStmt *n = makeNode(PGViewStmt); @@ -32754,7 +32799,7 @@ YYLTYPE yylloc; ;} break; - case 1611: + case 1612: #line 49 "third_party/libpg_query/grammar/statements/view.y" { PGViewStmt *n = makeNode(PGViewStmt); @@ -32774,7 +32819,7 @@ YYLTYPE yylloc; ;} break; - case 1612: + case 1613: #line 67 "third_party/libpg_query/grammar/statements/view.y" { PGViewStmt *n = makeNode(PGViewStmt); @@ -32794,27 +32839,27 @@ YYLTYPE yylloc; ;} break; - case 1613: + case 1614: #line 87 "third_party/libpg_query/grammar/statements/view.y" { (yyval.viewcheckoption) = CASCADED_CHECK_OPTION; ;} break; - case 1614: + case 1615: #line 88 "third_party/libpg_query/grammar/statements/view.y" { (yyval.viewcheckoption) = CASCADED_CHECK_OPTION; ;} break; - case 1615: + case 1616: #line 89 "third_party/libpg_query/grammar/statements/view.y" { (yyval.viewcheckoption) = PG_LOCAL_CHECK_OPTION; ;} break; - case 1616: + case 1617: #line 90 "third_party/libpg_query/grammar/statements/view.y" { (yyval.viewcheckoption) = PG_NO_CHECK_OPTION; ;} break; - case 1617: + case 1618: #line 12 "third_party/libpg_query/grammar/statements/create_as.y" { PGCreateTableAsStmt *ctas = makeNode(PGCreateTableAsStmt); @@ -32830,7 +32875,7 @@ YYLTYPE yylloc; ;} break; - case 1618: + case 1619: #line 25 "third_party/libpg_query/grammar/statements/create_as.y" { PGCreateTableAsStmt *ctas = makeNode(PGCreateTableAsStmt); @@ -32846,7 +32891,7 @@ YYLTYPE yylloc; ;} break; - case 1619: + case 1620: #line 38 "third_party/libpg_query/grammar/statements/create_as.y" { PGCreateTableAsStmt *ctas = makeNode(PGCreateTableAsStmt); @@ -32862,22 +32907,22 @@ YYLTYPE yylloc; ;} break; - case 1620: + case 1621: #line 54 "third_party/libpg_query/grammar/statements/create_as.y" { (yyval.boolean) = true; ;} break; - case 1621: + case 1622: #line 55 "third_party/libpg_query/grammar/statements/create_as.y" { (yyval.boolean) = false; ;} break; - case 1622: + case 1623: #line 56 "third_party/libpg_query/grammar/statements/create_as.y" { (yyval.boolean) = true; ;} break; - case 1623: + case 1624: #line 62 "third_party/libpg_query/grammar/statements/create_as.y" { (yyval.into) = makeNode(PGIntoClause); @@ -32892,7 +32937,7 @@ YYLTYPE yylloc; /* Line 1267 of yacc.c. */ -#line 32896 "third_party/libpg_query/grammar/grammar_out.cpp" +#line 32941 "third_party/libpg_query/grammar/grammar_out.cpp" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); diff --git a/src/duckdb/third_party/utf8proc/utf8proc_wrapper.cpp b/src/duckdb/third_party/utf8proc/utf8proc_wrapper.cpp index 7ee4f39c2..7aba4df0f 100644 --- a/src/duckdb/third_party/utf8proc/utf8proc_wrapper.cpp +++ b/src/duckdb/third_party/utf8proc/utf8proc_wrapper.cpp @@ -343,16 +343,20 @@ bool Utf8Proc::CodepointToUtf8(int cp, int &sz, char *c) { int Utf8Proc::CodepointLength(int cp) { if (cp <= 0x7F) { return 1; - } else if (cp <= 0x7FF) { + } + if (cp <= 0x7FF) { return 2; - } else if (0xd800 <= cp && cp <= 0xdfff) { - return -1; - } else if (cp <= 0xFFFF) { + } + if (0xd800 <= cp && cp <= 0xdfff) { + throw InternalException("invalid code point detected in Utf8Proc::CodepointLength (0xd800 to 0xdfff), likely due to invalid UTF-8"); + } + if (cp <= 0xFFFF) { return 3; - } else if (cp <= 0x10FFFF) { + } + if (cp <= 0x10FFFF) { return 4; } - return -1; + throw InternalException("invalid code point detected in Utf8Proc::CodepointLength, likely due to invalid UTF-8"); } int32_t Utf8Proc::UTF8ToCodepoint(const char *u_input, int &sz) { @@ -369,7 +373,7 @@ int32_t Utf8Proc::UTF8ToCodepoint(const char *u_input, int &sz) { return (u0 - 192) * 64 + (u1 - 128); } if (u[0] == 0xed && (u[1] & 0xa0) == 0xa0) { - return -1; // code points, 0xd800 to 0xdfff + throw InternalException("invalid code point detected in Utf8Proc::UTF8ToCodepoint (0xd800 to 0xdfff), likely due to invalid UTF-8"); } unsigned char u2 = u[2]; if (u0 >= 224 && u0 <= 239) { @@ -381,7 +385,7 @@ int32_t Utf8Proc::UTF8ToCodepoint(const char *u_input, int &sz) { sz = 4; return (u0 - 240) * 262144 + (u1 - 128) * 4096 + (u2 - 128) * 64 + (u3 - 128); } - return -1; + throw InternalException("invalid code point detected in Utf8Proc::UTF8ToCodepoint, likely due to invalid UTF-8"); } size_t Utf8Proc::RenderWidth(const char *s, size_t len, size_t pos) { diff --git a/src/duckdb/ub_extension_core_functions_scalar_generic.cpp b/src/duckdb/ub_extension_core_functions_scalar_generic.cpp index 68eb6db63..07f2ee65f 100644 --- a/src/duckdb/ub_extension_core_functions_scalar_generic.cpp +++ b/src/duckdb/ub_extension_core_functions_scalar_generic.cpp @@ -16,7 +16,7 @@ #include "extension/core_functions/scalar/generic/stats.cpp" -#include "extension/core_functions/scalar/generic/typeof.cpp" +#include "extension/core_functions/scalar/generic/type_functions.cpp" #include "extension/core_functions/scalar/generic/system_functions.cpp" diff --git a/src/duckdb/ub_src_catalog_catalog_entry.cpp b/src/duckdb/ub_src_catalog_catalog_entry.cpp index 2e11f6d71..6028f3295 100644 --- a/src/duckdb/ub_src_catalog_catalog_entry.cpp +++ b/src/duckdb/ub_src_catalog_catalog_entry.cpp @@ -1,3 +1,5 @@ +#include "src/catalog/catalog_entry/aggregate_function_catalog_entry.cpp" + #include "src/catalog/catalog_entry/copy_function_catalog_entry.cpp" #include "src/catalog/catalog_entry/duck_index_entry.cpp" diff --git a/src/duckdb/ub_src_common_types.cpp b/src/duckdb/ub_src_common_types.cpp index 5b4b933e1..57aa028c4 100644 --- a/src/duckdb/ub_src_common_types.cpp +++ b/src/duckdb/ub_src_common_types.cpp @@ -38,6 +38,8 @@ #include "src/common/types/timestamp.cpp" +#include "src/common/types/type_manager.cpp" + #include "src/common/types/time.cpp" #include "src/common/types/validity_mask.cpp" diff --git a/src/duckdb/ub_src_function_cast.cpp b/src/duckdb/ub_src_function_cast.cpp index 99f3378ca..3b71c2026 100644 --- a/src/duckdb/ub_src_function_cast.cpp +++ b/src/duckdb/ub_src_function_cast.cpp @@ -28,6 +28,8 @@ #include "src/function/cast/time_casts.cpp" +#include "src/function/cast/type_cast.cpp" + #include "src/function/cast/union_casts.cpp" #include "src/function/cast/uuid_casts.cpp" diff --git a/src/duckdb/ub_src_main.cpp b/src/duckdb/ub_src_main.cpp index a133a012e..5028119d6 100644 --- a/src/duckdb/ub_src_main.cpp +++ b/src/duckdb/ub_src_main.cpp @@ -36,6 +36,8 @@ #include "src/main/extension.cpp" +#include "src/main/extension_callback_manager.cpp" + #include "src/main/extension_install_info.cpp" #include "src/main/extension_manager.cpp" diff --git a/src/duckdb/ub_src_parser_expression.cpp b/src/duckdb/ub_src_parser_expression.cpp index 1d9ba299b..d4bd7486e 100644 --- a/src/duckdb/ub_src_parser_expression.cpp +++ b/src/duckdb/ub_src_parser_expression.cpp @@ -32,5 +32,7 @@ #include "src/parser/expression/subquery_expression.cpp" +#include "src/parser/expression/type_expression.cpp" + #include "src/parser/expression/window_expression.cpp" diff --git a/src/duckdb/ub_src_planner_binder_expression.cpp b/src/duckdb/ub_src_planner_binder_expression.cpp index 86a595025..f02698c85 100644 --- a/src/duckdb/ub_src_planner_binder_expression.cpp +++ b/src/duckdb/ub_src_planner_binder_expression.cpp @@ -34,6 +34,8 @@ #include "src/planner/binder/expression/bind_subquery_expression.cpp" +#include "src/planner/binder/expression/bind_type_expression.cpp" + #include "src/planner/binder/expression/bind_unnest_expression.cpp" #include "src/planner/binder/expression/bind_window_expression.cpp" From 4abdfd34b24ba18714d19426c25db83e6904dfdc Mon Sep 17 00:00:00 2001 From: DuckDB Labs GitHub Bot Date: Tue, 3 Feb 2026 07:58:50 +0000 Subject: [PATCH 04/16] Update vendored DuckDB sources to e5fb0a7eab --- .../function/table/version/pragma_version.cpp | 6 ++--- .../src/include/duckdb/main/client_config.hpp | 5 ++++ .../src/include/duckdb/main/settings.hpp | 11 ++++++++ src/duckdb/src/main/client_data.cpp | 9 ++++++- src/duckdb/src/main/config.cpp | 7 +++--- .../src/main/settings/custom_settings.cpp | 25 +++++++++++++++++++ 6 files changed, 56 insertions(+), 7 deletions(-) diff --git a/src/duckdb/src/function/table/version/pragma_version.cpp b/src/duckdb/src/function/table/version/pragma_version.cpp index 54bc6cb4e..daa051125 100644 --- a/src/duckdb/src/function/table/version/pragma_version.cpp +++ b/src/duckdb/src/function/table/version/pragma_version.cpp @@ -1,5 +1,5 @@ #ifndef DUCKDB_PATCH_VERSION -#define DUCKDB_PATCH_VERSION "0-dev6613" +#define DUCKDB_PATCH_VERSION "0-dev6617" #endif #ifndef DUCKDB_MINOR_VERSION #define DUCKDB_MINOR_VERSION 5 @@ -8,10 +8,10 @@ #define DUCKDB_MAJOR_VERSION 1 #endif #ifndef DUCKDB_VERSION -#define DUCKDB_VERSION "v1.5.0-dev6613" +#define DUCKDB_VERSION "v1.5.0-dev6617" #endif #ifndef DUCKDB_SOURCE_ID -#define DUCKDB_SOURCE_ID "5a115ef952" +#define DUCKDB_SOURCE_ID "e5fb0a7eab" #endif #include "duckdb/function/table/system_functions.hpp" #include "duckdb/main/database.hpp" diff --git a/src/duckdb/src/include/duckdb/main/client_config.hpp b/src/duckdb/src/include/duckdb/main/client_config.hpp index 40980b8a0..9fe07387c 100644 --- a/src/duckdb/src/include/duckdb/main/client_config.hpp +++ b/src/duckdb/src/include/duckdb/main/client_config.hpp @@ -10,6 +10,7 @@ #include "duckdb/common/case_insensitive_map.hpp" #include "duckdb/common/common.hpp" +#include "duckdb/common/optional_idx.hpp" #include "duckdb/common/enums/output_type.hpp" #include "duckdb/common/enums/profiler_format.hpp" #include "duckdb/common/progress_bar/progress_bar.hpp" @@ -81,6 +82,10 @@ struct ClientConfig { //! The maximum amount of memory to keep buffered in a streaming query result. Default: 1mb. idx_t streaming_buffer_size = 1000000; + //! The maximum memory for query intermediates (sorts, hash tables) per connection (in bytes). Default: Global + //! memory limit. + optional_idx operator_memory_limit; + //! Callback to create a progress bar display progress_bar_display_create_func_t display_create_func = nullptr; diff --git a/src/duckdb/src/include/duckdb/main/settings.hpp b/src/duckdb/src/include/duckdb/main/settings.hpp index 32835c430..ede26abe9 100644 --- a/src/duckdb/src/include/duckdb/main/settings.hpp +++ b/src/duckdb/src/include/duckdb/main/settings.hpp @@ -1154,6 +1154,17 @@ struct OldImplicitCastingSetting { static constexpr idx_t SettingIndex = 67; }; +struct OperatorMemoryLimitSetting { + using RETURN_TYPE = string; + static constexpr const char *Name = "operator_memory_limit"; + static constexpr const char *Description = + "The maximum memory for query intermediates (sorts, hash tables) per connection (e.g. 256MB)"; + static constexpr const char *InputType = "VARCHAR"; + static void SetLocal(ClientContext &context, const Value ¶meter); + static void ResetLocal(ClientContext &context); + static Value GetSetting(const ClientContext &context); +}; + struct OrderByNonIntegerLiteralSetting { using RETURN_TYPE = bool; static constexpr const char *Name = "order_by_non_integer_literal"; diff --git a/src/duckdb/src/main/client_data.cpp b/src/duckdb/src/main/client_data.cpp index ac517736e..4af481072 100644 --- a/src/duckdb/src/main/client_data.cpp +++ b/src/duckdb/src/main/client_data.cpp @@ -1,10 +1,12 @@ #include "duckdb/main/client_data.hpp" #include "duckdb/catalog/catalog_search_path.hpp" +#include "duckdb/common/constants.hpp" #include "duckdb/common/opener_file_system.hpp" #include "duckdb/common/random_engine.hpp" #include "duckdb/common/serializer/buffered_file_writer.hpp" #include "duckdb/main/attached_database.hpp" +#include "duckdb/main/client_config.hpp" #include "duckdb/main/client_context.hpp" #include "duckdb/main/client_context_file_opener.hpp" #include "duckdb/main/database.hpp" @@ -114,7 +116,12 @@ class ClientBufferManager : public BufferManager { return buffer_manager.GetBlockSize(); } idx_t GetQueryMaxMemory() const override { - return buffer_manager.GetQueryMaxMemory(); + idx_t global_budget = buffer_manager.GetQueryMaxMemory(); + const auto &config = ClientConfig::GetConfig(context); + if (!config.operator_memory_limit.IsValid()) { + return global_budget; + } + return MinValue(global_budget, config.operator_memory_limit.GetIndex()); } shared_ptr RegisterTransientMemory(const idx_t size, BlockManager &block_manager) override { diff --git a/src/duckdb/src/main/config.cpp b/src/duckdb/src/main/config.cpp index e5ada66c2..7eef218c5 100644 --- a/src/duckdb/src/main/config.cpp +++ b/src/duckdb/src/main/config.cpp @@ -161,6 +161,7 @@ static const ConfigurationOption internal_options[] = { DUCKDB_SETTING(MergeJoinThresholdSetting), DUCKDB_SETTING(NestedLoopJoinThresholdSetting), DUCKDB_SETTING(OldImplicitCastingSetting), + DUCKDB_LOCAL(OperatorMemoryLimitSetting), DUCKDB_SETTING(OrderByNonIntegerLiteralSetting), DUCKDB_SETTING_CALLBACK(OrderedAggregateThresholdSetting), DUCKDB_SETTING(PartitionedWriteFlushThresholdSetting), @@ -198,10 +199,10 @@ static const ConfigurationOption internal_options[] = { static const ConfigurationAlias setting_aliases[] = {DUCKDB_SETTING_ALIAS("memory_limit", 92), DUCKDB_SETTING_ALIAS("null_order", 38), - DUCKDB_SETTING_ALIAS("profiling_output", 111), - DUCKDB_SETTING_ALIAS("user", 126), + DUCKDB_SETTING_ALIAS("profiling_output", 112), + DUCKDB_SETTING_ALIAS("user", 127), DUCKDB_SETTING_ALIAS("wal_autocheckpoint", 22), - DUCKDB_SETTING_ALIAS("worker_threads", 125), + DUCKDB_SETTING_ALIAS("worker_threads", 126), FINAL_ALIAS}; vector DBConfig::GetOptions() { diff --git a/src/duckdb/src/main/settings/custom_settings.cpp b/src/duckdb/src/main/settings/custom_settings.cpp index cf05f7f4f..2d3090b61 100644 --- a/src/duckdb/src/main/settings/custom_settings.cpp +++ b/src/duckdb/src/main/settings/custom_settings.cpp @@ -1267,6 +1267,31 @@ Value MaxTempDirectorySizeSetting::GetSetting(const ClientContext &context) { } } +//===----------------------------------------------------------------------===// +// Operator Memory Limit +//===----------------------------------------------------------------------===// +void OperatorMemoryLimitSetting::SetLocal(ClientContext &context, const Value &input) { + auto &config = ClientConfig::GetConfig(context); + if (input.IsNull()) { + config.operator_memory_limit.SetInvalid(); + } else { + config.operator_memory_limit = DBConfig::ParseMemoryLimit(input.ToString()); + } +} + +void OperatorMemoryLimitSetting::ResetLocal(ClientContext &context) { + auto &config = ClientConfig::GetConfig(context); + config.operator_memory_limit.SetInvalid(); +} + +Value OperatorMemoryLimitSetting::GetSetting(const ClientContext &context) { + auto &config = ClientConfig::GetConfig(context); + if (!config.operator_memory_limit.IsValid()) { + return Value(); + } + return Value(StringUtil::BytesToHumanReadableString(config.operator_memory_limit.GetIndex())); +} + //===----------------------------------------------------------------------===// // Ordered Aggregate Threshold //===----------------------------------------------------------------------===// From a3f2e604a0c3f9cce8df934a4c4a5263021c817c Mon Sep 17 00:00:00 2001 From: DuckDB Labs GitHub Bot Date: Thu, 5 Feb 2026 07:47:28 +0000 Subject: [PATCH 05/16] Update vendored DuckDB sources to d9122b9075 --- src/duckdb/src/function/table/version/pragma_version.cpp | 6 +++--- .../execution/operator/scan/physical_empty_result.hpp | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/duckdb/src/function/table/version/pragma_version.cpp b/src/duckdb/src/function/table/version/pragma_version.cpp index daa051125..db134d18f 100644 --- a/src/duckdb/src/function/table/version/pragma_version.cpp +++ b/src/duckdb/src/function/table/version/pragma_version.cpp @@ -1,5 +1,5 @@ #ifndef DUCKDB_PATCH_VERSION -#define DUCKDB_PATCH_VERSION "0-dev6617" +#define DUCKDB_PATCH_VERSION "0-dev6623" #endif #ifndef DUCKDB_MINOR_VERSION #define DUCKDB_MINOR_VERSION 5 @@ -8,10 +8,10 @@ #define DUCKDB_MAJOR_VERSION 1 #endif #ifndef DUCKDB_VERSION -#define DUCKDB_VERSION "v1.5.0-dev6617" +#define DUCKDB_VERSION "v1.5.0-dev6623" #endif #ifndef DUCKDB_SOURCE_ID -#define DUCKDB_SOURCE_ID "e5fb0a7eab" +#define DUCKDB_SOURCE_ID "d9122b9075" #endif #include "duckdb/function/table/system_functions.hpp" #include "duckdb/main/database.hpp" diff --git a/src/duckdb/src/include/duckdb/execution/operator/scan/physical_empty_result.hpp b/src/duckdb/src/include/duckdb/execution/operator/scan/physical_empty_result.hpp index 3f8a72e27..f45af5f50 100644 --- a/src/duckdb/src/include/duckdb/execution/operator/scan/physical_empty_result.hpp +++ b/src/duckdb/src/include/duckdb/execution/operator/scan/physical_empty_result.hpp @@ -28,5 +28,9 @@ class PhysicalEmptyResult : public PhysicalOperator { bool IsSource() const override { return true; } + + bool SupportsPartitioning(const OperatorPartitionInfo &partition_info) const override { + return true; + } }; } // namespace duckdb From bfe17d4ba1ee9ef62eb2f9354f0583a7700237a1 Mon Sep 17 00:00:00 2001 From: DuckDB Labs GitHub Bot Date: Fri, 6 Feb 2026 07:16:52 +0000 Subject: [PATCH 06/16] Update vendored DuckDB sources to e55e16c21c --- src/duckdb/src/function/table/version/pragma_version.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/duckdb/src/function/table/version/pragma_version.cpp b/src/duckdb/src/function/table/version/pragma_version.cpp index db134d18f..5baf0285a 100644 --- a/src/duckdb/src/function/table/version/pragma_version.cpp +++ b/src/duckdb/src/function/table/version/pragma_version.cpp @@ -1,5 +1,5 @@ #ifndef DUCKDB_PATCH_VERSION -#define DUCKDB_PATCH_VERSION "0-dev6623" +#define DUCKDB_PATCH_VERSION "0-dev6626" #endif #ifndef DUCKDB_MINOR_VERSION #define DUCKDB_MINOR_VERSION 5 @@ -8,10 +8,10 @@ #define DUCKDB_MAJOR_VERSION 1 #endif #ifndef DUCKDB_VERSION -#define DUCKDB_VERSION "v1.5.0-dev6623" +#define DUCKDB_VERSION "v1.5.0-dev6626" #endif #ifndef DUCKDB_SOURCE_ID -#define DUCKDB_SOURCE_ID "d9122b9075" +#define DUCKDB_SOURCE_ID "e55e16c21c" #endif #include "duckdb/function/table/system_functions.hpp" #include "duckdb/main/database.hpp" From 4075d6ae1f2d16dfdef2cc9fec60c1c9fe87d3e4 Mon Sep 17 00:00:00 2001 From: DuckDB Labs GitHub Bot Date: Wed, 11 Feb 2026 06:56:30 +0000 Subject: [PATCH 07/16] Update vendored DuckDB sources to e0ff645498 --- CMakeLists.txt | 328 +- .../aggregate/algebraic/avg.cpp | 62 +- .../core_functions/scalar/bit/bitstring.cpp | 6 +- .../core_functions/scalar/generic/stats.cpp | 16 +- .../core_functions/scalar/list/list_sort.cpp | 2 +- .../scalar/struct/struct_keys.cpp | 5 +- .../icu/third_party/icu/common/appendable.cpp | 22 +- .../icu/third_party/icu/common/bmpset.cpp | 16 +- .../icu/third_party/icu/common/bmpset.h | 6 +- .../icu/third_party/icu/common/brkeng.cpp | 284 - .../icu/third_party/icu/common/brkeng.h | 75 +- .../icu/third_party/icu/common/brkiter.cpp | 508 - .../third_party/icu/common/bytesinkutil.cpp | 26 +- .../icu/third_party/icu/common/bytesinkutil.h | 9 +- .../icu/third_party/icu/common/bytestream.cpp | 12 +- .../icu/third_party/icu/common/bytestrie.cpp | 32 +- .../icu/common/bytestriebuilder.cpp | 78 +- .../icu/common/bytestrieiterator.cpp | 38 +- .../icu/third_party/icu/common/caniter.cpp | 100 +- .../icu/common/characterproperties.cpp | 74 +- .../icu/third_party/icu/common/chariter.cpp | 6 +- .../icu/third_party/icu/common/charstr.cpp | 84 +- .../icu/third_party/icu/common/charstr.h | 39 +- .../icu/third_party/icu/common/charstrmap.h | 55 + .../icu/third_party/icu/common/cmemory.cpp | 20 +- .../icu/third_party/icu/common/cmemory.h | 330 +- .../icu/third_party/icu/common/cpputils.h | 54 +- .../icu/third_party/icu/common/cstr.cpp | 2 +- .../icu/third_party/icu/common/cstr.h | 6 +- .../icu/third_party/icu/common/cstring.cpp | 18 +- .../icu/third_party/icu/common/cstring.h | 2 + .../icu/third_party/icu/common/cwchar.cpp | 55 - .../icu/third_party/icu/common/dictbe.cpp | 1394 - .../icu/third_party/icu/common/dictbe.h | 282 +- .../third_party/icu/common/dictionarydata.cpp | 242 - .../third_party/icu/common/dictionarydata.h | 382 +- .../icu/third_party/icu/common/edits.cpp | 75 +- .../icu/third_party/icu/common/emojiprops.cpp | 220 + .../icu/third_party/icu/common/emojiprops.h | 90 + .../third_party/icu/common/filteredbrk.cpp | 710 - .../icu/common/filterednormalizer2.cpp | 24 +- .../icu/third_party/icu/common/hash.h | 37 +- .../icu/third_party/icu/common/icudataver.cpp | 6 +- .../icu/third_party/icu/common/icuplug.cpp | 884 - .../icu/third_party/icu/common/icuplugimp.h | 12 +- .../icu/common/loadednormalizer2impl.cpp | 129 +- .../third_party/icu/common/localebuilder.cpp | 20 +- .../icu/common/localefallback_data.h | 1344 + .../third_party/icu/common/localematcher.cpp | 436 +- .../icu/common/localeprioritylist.cpp | 71 +- .../icu/common/localeprioritylist.h | 2 +- .../third_party/icu/common/locavailable.cpp | 52 +- .../icu/third_party/icu/common/locbased.cpp | 4 +- .../third_party/icu/common/locdispnames.cpp | 203 +- .../third_party/icu/common/locdistance.cpp | 109 +- .../icu/third_party/icu/common/locdistance.h | 56 +- .../icu/third_party/icu/common/locdspnm.cpp | 205 +- .../icu/third_party/icu/common/locid.cpp | 1738 +- .../icu/third_party/icu/common/loclikely.cpp | 803 +- .../icu/common/loclikelysubtags.cpp | 624 +- .../third_party/icu/common/loclikelysubtags.h | 84 +- .../icu/third_party/icu/common/locmap.cpp | 44 +- .../icu/third_party/icu/common/locresdata.cpp | 34 +- .../icu/third_party/icu/common/locutil.cpp | 275 - .../icu/third_party/icu/common/locutil.h | 58 +- .../icu/third_party/icu/common/lsr.cpp | 55 +- .../icu/third_party/icu/common/lsr.h | 25 +- .../icu/third_party/icu/common/messageimpl.h | 4 +- .../third_party/icu/common/messagepattern.cpp | 250 +- .../icu/third_party/icu/common/msvcres.h | 2 +- .../third_party/icu/common/norm2_nfc_data.h | 765 +- .../third_party/icu/common/norm2allmodes.h | 209 +- .../third_party/icu/common/normalizer2.cpp | 134 +- .../icu/common/normalizer2impl.cpp | 567 +- .../third_party/icu/common/normalizer2impl.h | 128 +- .../icu/third_party/icu/common/normlzr.cpp | 20 +- .../third_party/icu/common/patternprops.cpp | 38 +- .../icu/third_party/icu/common/patternprops.h | 18 +- .../icu/third_party/icu/common/pluralmap.cpp | 2 +- .../icu/third_party/icu/common/pluralmap.h | 54 +- .../icu/third_party/icu/common/propname.cpp | 26 +- .../third_party/icu/common/propname_data.h | 1899 +- .../icu/third_party/icu/common/propsvec.cpp | 50 +- .../icu/third_party/icu/common/punycode.cpp | 589 - .../icu/third_party/icu/common/punycode.h | 10 +- .../icu/third_party/icu/common/putil.cpp | 545 +- .../icu/third_party/icu/common/putilimp.h | 100 +- .../icu/third_party/icu/common/rbbi.cpp | 1266 - .../icu/third_party/icu/common/rbbi_cache.cpp | 653 - .../icu/third_party/icu/common/rbbi_cache.h | 386 +- .../icu/third_party/icu/common/rbbidata.cpp | 425 - .../icu/third_party/icu/common/rbbidata.h | 105 +- .../icu/third_party/icu/common/rbbinode.cpp | 372 - .../icu/third_party/icu/common/rbbinode.h | 6 +- .../icu/third_party/icu/common/rbbirb.cpp | 328 - .../icu/third_party/icu/common/rbbirb.h | 465 +- .../icu/third_party/icu/common/rbbirpt.h | 208 +- .../icu/third_party/icu/common/rbbiscan.cpp | 1279 - .../icu/third_party/icu/common/rbbiscan.h | 12 +- .../icu/third_party/icu/common/rbbisetb.cpp | 684 - .../icu/third_party/icu/common/rbbisetb.h | 52 +- .../icu/third_party/icu/common/rbbistbl.cpp | 270 - .../icu/third_party/icu/common/rbbitblb.cpp | 1684 - .../icu/third_party/icu/common/rbbitblb.h | 448 +- .../icu/third_party/icu/common/resbund.cpp | 64 +- .../third_party/icu/common/resbund_cnv.cpp | 8 +- .../icu/third_party/icu/common/resource.h | 34 +- .../icu/third_party/icu/common/restrace.cpp | 130 - .../icu/third_party/icu/common/ruleiter.cpp | 6 +- .../icu/third_party/icu/common/ruleiter.h | 12 +- .../icu/third_party/icu/common/schriter.cpp | 6 +- .../icu/third_party/icu/common/serv.cpp | 982 - .../icu/third_party/icu/common/serv.h | 126 +- .../icu/third_party/icu/common/servlk.cpp | 188 - .../icu/third_party/icu/common/servlkf.cpp | 152 - .../icu/third_party/icu/common/servloc.h | 42 +- .../icu/third_party/icu/common/servls.cpp | 295 - .../icu/third_party/icu/common/servnotf.cpp | 120 - .../icu/third_party/icu/common/servnotf.h | 14 +- .../icu/third_party/icu/common/servrbf.cpp | 96 - .../icu/third_party/icu/common/servslkf.cpp | 123 - .../icu/third_party/icu/common/sharedobject.h | 28 +- .../icu/common/simpleformatter.cpp | 76 +- .../icu/common/static_unicode_sets.cpp | 130 +- .../icu/common/static_unicode_sets.h | 84 +- .../third_party/icu/common/stringpiece.cpp | 45 +- .../icu/common/stringtriebuilder.cpp | 126 +- .../icu/third_party/icu/common/uarrsort.cpp | 20 +- .../icu/third_party/icu/common/uassert.h | 30 +- .../icu/third_party/icu/common/ubidi.cpp | 224 +- .../third_party/icu/common/ubidi_props.cpp | 8 +- .../third_party/icu/common/ubidi_props_data.h | 1417 +- .../icu/third_party/icu/common/ubidiimp.h | 24 +- .../icu/third_party/icu/common/ubidiln.cpp | 66 +- .../third_party/icu/common/ubiditransform.cpp | 120 +- .../icu/third_party/icu/common/ubidiwrt.cpp | 58 +- .../icu/third_party/icu/common/ubrk.cpp | 357 - .../icu/third_party/icu/common/ucase.cpp | 398 +- .../icu/third_party/icu/common/ucase.h | 34 +- .../third_party/icu/common/ucase_props_data.h | 1408 +- .../icu/third_party/icu/common/ucasemap.cpp | 202 +- .../icu/third_party/icu/common/ucasemap_imp.h | 35 +- .../icu/common/ucasemap_titlecase_brkiter.cpp | 134 - .../icu/third_party/icu/common/ucat.cpp | 18 +- .../icu/third_party/icu/common/uchar.cpp | 124 +- .../third_party/icu/common/uchar_props_data.h | 6481 ++-- .../icu/third_party/icu/common/ucharstrie.cpp | 54 +- .../icu/common/ucharstriebuilder.cpp | 110 +- .../icu/common/ucharstrieiterator.cpp | 50 +- .../icu/third_party/icu/common/uchriter.cpp | 26 +- .../icu/third_party/icu/common/ucln_cmn.cpp | 16 +- .../icu/third_party/icu/common/ucln_cmn.h | 3 + .../icu/third_party/icu/common/ucln_imp.h | 16 +- .../icu/third_party/icu/common/ucmndata.cpp | 20 +- .../icu/third_party/icu/common/ucmndata.h | 4 +- .../icu/third_party/icu/common/ucnv.cpp | 2910 -- .../icu/third_party/icu/common/ucnv2022.cpp | 3973 --- .../icu/third_party/icu/common/ucnv_bld.cpp | 1689 - .../icu/third_party/icu/common/ucnv_bld.h | 296 + .../icu/third_party/icu/common/ucnv_cb.cpp | 261 - .../icu/third_party/icu/common/ucnv_cnv.cpp | 182 - .../icu/third_party/icu/common/ucnv_cnv.h | 323 + .../icu/third_party/icu/common/ucnv_ct.cpp | 0 .../icu/third_party/icu/common/ucnv_err.cpp | 0 .../icu/third_party/icu/common/ucnv_ext.cpp | 0 .../icu/third_party/icu/common/ucnv_ext.h | 481 + .../icu/third_party/icu/common/ucnv_imp.h | 139 + .../icu/third_party/icu/common/ucnv_io.cpp | 1360 - .../icu/third_party/icu/common/ucnv_io.h | 254 +- .../icu/third_party/icu/common/ucnv_lmb.cpp | 0 .../icu/third_party/icu/common/ucnv_set.cpp | 70 - .../icu/third_party/icu/common/ucnv_u16.cpp | 1579 - .../icu/third_party/icu/common/ucnv_u32.cpp | 1253 - .../icu/third_party/icu/common/ucnv_u7.cpp | 0 .../icu/third_party/icu/common/ucnv_u8.cpp | 944 - .../icu/third_party/icu/common/ucnvbocu.cpp | 0 .../icu/third_party/icu/common/ucnvdisp.cpp | 88 - .../icu/third_party/icu/common/ucnvhz.cpp | 0 .../icu/third_party/icu/common/ucnvisci.cpp | 0 .../icu/third_party/icu/common/ucnvlat1.cpp | 756 - .../icu/third_party/icu/common/ucnvmbcs.cpp | 5723 ---- .../icu/third_party/icu/common/ucnvmbcs.h | 605 + .../icu/third_party/icu/common/ucnvscsu.cpp | 2045 -- .../icu/third_party/icu/common/ucnvsel.cpp | 823 - .../icu/third_party/icu/common/ucol_data.h | 4 +- .../icu/third_party/icu/common/ucol_swp.cpp | 26 +- .../icu/third_party/icu/common/ucol_swp.h | 2 +- .../icu/third_party/icu/common/ucptrie.cpp | 4 +- .../icu/third_party/icu/common/ucptrie_impl.h | 110 +- .../icu/third_party/icu/common/ucurr.cpp | 629 +- .../icu/third_party/icu/common/udata.cpp | 310 +- .../icu/third_party/icu/common/udatamem.cpp | 22 +- .../icu/third_party/icu/common/udatamem.h | 2 +- .../icu/third_party/icu/common/udataswp.cpp | 52 +- .../icu/third_party/icu/common/uelement.h | 9 +- .../icu/third_party/icu/common/uenum.cpp | 56 +- .../icu/third_party/icu/common/uhash.cpp | 235 +- .../icu/third_party/icu/common/uhash.h | 105 +- .../icu/third_party/icu/common/uidna.cpp | 921 - .../icu/third_party/icu/common/uinit.cpp | 4 +- .../icu/third_party/icu/common/uinvchar.cpp | 54 +- .../icu/third_party/icu/common/uinvchar.h | 18 +- .../icu/third_party/icu/common/uiter.cpp | 98 +- .../icu/third_party/icu/common/ulist.cpp | 78 +- .../icu/third_party/icu/common/uloc.cpp | 1369 +- .../third_party/icu/common/uloc_keytype.cpp | 164 +- .../icu/third_party/icu/common/uloc_tag.cpp | 791 +- .../icu/third_party/icu/common/ulocimp.h | 96 +- .../icu/third_party/icu/common/umapfile.cpp | 60 +- .../icu/third_party/icu/common/umapfile.h | 4 +- .../third_party/icu/common/umutablecptrie.cpp | 10 +- .../icu/third_party/icu/common/umutex.h | 14 +- .../icu/third_party/icu/common/unames.cpp | 135 +- .../icu/common/unicode/appendable.h | 34 +- .../third_party/icu/common/unicode/brkiter.h | 1340 +- .../icu/common/unicode/bytestream.h | 42 +- .../icu/common/unicode/bytestrie.h | 35 +- .../icu/common/unicode/bytestriebuilder.h | 54 +- .../third_party/icu/common/unicode/caniter.h | 16 +- .../third_party/icu/common/unicode/casemap.h | 66 +- .../icu/common/unicode/char16ptr.h | 4 +- .../third_party/icu/common/unicode/chariter.h | 22 +- .../third_party/icu/common/unicode/dtintrv.h | 8 +- .../third_party/icu/common/unicode/edits.h | 48 +- .../icu/common/unicode/filteredbrk.h | 304 +- .../icu/common/unicode/icudataver.h | 2 +- .../third_party/icu/common/unicode/icuplug.h | 49 +- .../icu/third_party/icu/common/unicode/idna.h | 26 +- .../icu/common/unicode/localebuilder.h | 60 +- .../icu/common/unicode/localematcher.h | 219 +- .../icu/common/unicode/localpointer.h | 173 +- .../third_party/icu/common/unicode/locid.h | 114 +- .../icu/common/unicode/messagepattern.h | 34 +- .../icu/common/unicode/normalizer2.h | 130 +- .../third_party/icu/common/unicode/normlzr.h | 30 +- .../third_party/icu/common/unicode/parsepos.h | 16 +- .../third_party/icu/common/unicode/platform.h | 64 +- .../third_party/icu/common/unicode/putil.h | 12 +- .../icu/third_party/icu/common/unicode/rbbi.h | 1529 +- .../icu/third_party/icu/common/unicode/rep.h | 2 +- .../third_party/icu/common/unicode/resbund.h | 24 +- .../third_party/icu/common/unicode/schriter.h | 16 +- .../icu/common/unicode/simpleformatter.h | 14 +- .../third_party/icu/common/unicode/strenum.h | 34 +- .../icu/common/unicode/stringpiece.h | 108 +- .../icu/common/unicode/stringtriebuilder.h | 58 +- .../third_party/icu/common/unicode/symtable.h | 8 +- .../third_party/icu/common/unicode/ubidi.h | 128 +- .../icu/common/unicode/ubiditransform.h | 15 +- .../icu/third_party/icu/common/unicode/ubrk.h | 1275 +- .../third_party/icu/common/unicode/ucasemap.h | 31 +- .../icu/third_party/icu/common/unicode/ucat.h | 6 +- .../third_party/icu/common/unicode/uchar.h | 387 +- .../icu/common/unicode/ucharstrie.h | 36 +- .../icu/common/unicode/ucharstriebuilder.h | 49 +- .../third_party/icu/common/unicode/uchriter.h | 60 +- .../third_party/icu/common/unicode/uclean.h | 12 +- .../icu/third_party/icu/common/unicode/ucnv.h | 2045 ++ .../third_party/icu/common/unicode/ucnv_cb.h | 306 +- .../third_party/icu/common/unicode/ucnv_err.h | 868 +- .../third_party/icu/common/unicode/ucnvsel.h | 382 +- .../third_party/icu/common/unicode/uconfig.h | 42 +- .../third_party/icu/common/unicode/ucpmap.h | 3 +- .../third_party/icu/common/unicode/ucptrie.h | 17 +- .../third_party/icu/common/unicode/ucurr.h | 60 +- .../third_party/icu/common/unicode/udata.h | 33 +- .../icu/common/unicode/udisplaycontext.h | 3 +- .../third_party/icu/common/unicode/uenum.h | 21 +- .../third_party/icu/common/unicode/uidna.h | 30 +- .../third_party/icu/common/unicode/uiter.h | 20 +- .../third_party/icu/common/unicode/uldnames.h | 33 +- .../icu/third_party/icu/common/unicode/uloc.h | 309 +- .../third_party/icu/common/unicode/umachine.h | 96 +- .../third_party/icu/common/unicode/umisc.h | 4 +- .../icu/common/unicode/umutablecptrie.h | 48 +- .../third_party/icu/common/unicode/unifilt.h | 12 +- .../third_party/icu/common/unicode/unifunct.h | 4 +- .../third_party/icu/common/unicode/unimatch.h | 10 +- .../third_party/icu/common/unicode/uniset.h | 197 +- .../third_party/icu/common/unicode/unistr.h | 237 +- .../third_party/icu/common/unicode/unorm.h | 16 +- .../third_party/icu/common/unicode/unorm2.h | 83 +- .../third_party/icu/common/unicode/uobject.h | 26 +- .../third_party/icu/common/unicode/urename.h | 3851 +-- .../icu/third_party/icu/common/unicode/ures.h | 104 +- .../third_party/icu/common/unicode/uscript.h | 54 +- .../icu/third_party/icu/common/unicode/uset.h | 378 +- .../third_party/icu/common/unicode/usetiter.h | 64 +- .../third_party/icu/common/unicode/ushape.h | 4 +- .../third_party/icu/common/unicode/usprep.h | 11 +- .../third_party/icu/common/unicode/ustring.h | 142 +- .../third_party/icu/common/unicode/utext.h | 238 +- .../icu/third_party/icu/common/unicode/utf.h | 28 +- .../third_party/icu/common/unicode/utf16.h | 21 +- .../icu/third_party/icu/common/unicode/utf8.h | 31 +- .../third_party/icu/common/unicode/utf_old.h | 10 +- .../third_party/icu/common/unicode/utrace.h | 110 +- .../third_party/icu/common/unicode/utypes.h | 36 +- .../third_party/icu/common/unicode/uvernum.h | 29 +- .../third_party/icu/common/unicode/uversion.h | 8 +- .../third_party/icu/common/unifiedcache.cpp | 132 +- .../icu/third_party/icu/common/unifiedcache.h | 194 +- .../third_party/icu/common/uniquecharstr.h | 120 + .../icu/third_party/icu/common/uniset.cpp | 391 +- .../third_party/icu/common/uniset_closure.cpp | 280 +- .../third_party/icu/common/uniset_props.cpp | 274 +- .../icu/third_party/icu/common/unisetspan.cpp | 117 +- .../icu/third_party/icu/common/unisetspan.h | 12 +- .../icu/third_party/icu/common/unistr.cpp | 432 +- .../third_party/icu/common/unistr_case.cpp | 36 +- .../icu/common/unistr_case_locale.cpp | 4 +- .../icu/third_party/icu/common/unistr_cnv.cpp | 417 - .../third_party/icu/common/unistr_props.cpp | 2 +- .../icu/common/unistr_titlecase_brkiter.cpp | 57 - .../third_party/icu/common/unistrappender.h | 6 +- .../icu/third_party/icu/common/unorm.cpp | 50 +- .../icu/third_party/icu/common/unormcmp.cpp | 56 +- .../icu/third_party/icu/common/unormimp.h | 4 +- .../icu/third_party/icu/common/uobject.cpp | 18 +- .../icu/third_party/icu/common/uposixdefs.h | 8 +- .../icu/third_party/icu/common/uprops.cpp | 169 +- .../icu/third_party/icu/common/uprops.h | 97 +- .../icu/third_party/icu/common/ures_cnv.cpp | 18 +- .../icu/third_party/icu/common/uresbund.cpp | 2265 +- .../icu/third_party/icu/common/uresdata.cpp | 190 +- .../icu/third_party/icu/common/uresdata.h | 71 +- .../icu/third_party/icu/common/uresimp.h | 135 +- .../icu/third_party/icu/common/usc_impl.cpp | 44 +- .../icu/third_party/icu/common/usc_impl.h | 2 +- .../icu/third_party/icu/common/uscript.cpp | 27 +- .../third_party/icu/common/uscript_props.cpp | 363 +- .../icu/third_party/icu/common/uset.cpp | 122 +- .../icu/third_party/icu/common/uset_imp.h | 11 +- .../icu/third_party/icu/common/uset_props.cpp | 34 +- .../icu/third_party/icu/common/usetiter.cpp | 38 +- .../icu/third_party/icu/common/ushape.cpp | 370 +- .../icu/third_party/icu/common/usprep.cpp | 871 - .../icu/third_party/icu/common/ustack.cpp | 9 +- .../icu/third_party/icu/common/ustr_cnv.cpp | 256 - .../icu/third_party/icu/common/ustr_cnv.h | 102 +- .../icu/third_party/icu/common/ustr_imp.h | 16 +- .../icu/common/ustr_titlecase_brkiter.cpp | 237 - .../icu/third_party/icu/common/ustr_wcs.cpp | 90 +- .../icu/third_party/icu/common/ustrcase.cpp | 365 +- .../icu/common/ustrcase_locale.cpp | 18 +- .../icu/third_party/icu/common/ustrenum.cpp | 94 +- .../icu/third_party/icu/common/ustrenum.h | 14 +- .../icu/third_party/icu/common/ustrfmt.cpp | 14 +- .../icu/third_party/icu/common/ustring.cpp | 514 +- .../icu/third_party/icu/common/ustrtrns.cpp | 270 +- .../icu/third_party/icu/common/utext.cpp | 437 +- .../icu/third_party/icu/common/utf_impl.cpp | 10 +- .../icu/third_party/icu/common/util.cpp | 150 +- .../icu/third_party/icu/common/util.h | 38 +- .../icu/third_party/icu/common/util_props.cpp | 8 +- .../icu/third_party/icu/common/utrace.cpp | 78 +- .../icu/third_party/icu/common/utracimp.h | 14 +- .../icu/third_party/icu/common/utrie.cpp | 138 +- .../icu/third_party/icu/common/utrie.h | 12 +- .../icu/third_party/icu/common/utrie2.cpp | 84 +- .../icu/third_party/icu/common/utrie2.h | 30 +- .../third_party/icu/common/utrie2_builder.cpp | 156 +- .../icu/third_party/icu/common/utrie_swap.cpp | 34 +- .../icu/third_party/icu/common/uts46.cpp | 1484 - .../icu/third_party/icu/common/utypes.cpp | 3 +- .../icu/third_party/icu/common/uvector.cpp | 247 +- .../icu/third_party/icu/common/uvector.h | 227 +- .../icu/third_party/icu/common/uvectr32.cpp | 70 +- .../icu/third_party/icu/common/uvectr32.h | 42 +- .../icu/third_party/icu/common/uvectr64.cpp | 46 +- .../icu/third_party/icu/common/uvectr64.h | 30 +- .../icu/third_party/icu/common/wintz.cpp | 317 +- .../icu/third_party/icu/common/wintz.h | 8 +- .../icu/third_party/icu/i18n/alphaindex.cpp | 349 +- .../icu/third_party/icu/i18n/anytrans.h | 8 +- .../icu/third_party/icu/i18n/astro.cpp | 130 +- .../icu/third_party/icu/i18n/astro.h | 4 +- .../icu/third_party/icu/i18n/basictz.cpp | 267 +- .../icu/third_party/icu/i18n/bocsu.cpp | 2 +- .../icu/third_party/icu/i18n/brktrans.h | 208 +- .../icu/third_party/icu/i18n/buddhcal.cpp | 39 +- .../icu/third_party/icu/i18n/buddhcal.h | 37 +- .../icu/third_party/icu/i18n/calendar.cpp | 954 +- .../icu/third_party/icu/i18n/casetrn.h | 4 +- .../icu/third_party/icu/i18n/cecal.cpp | 45 +- .../icu/third_party/icu/i18n/cecal.h | 49 +- .../icu/third_party/icu/i18n/chnsecal.cpp | 312 +- .../icu/third_party/icu/i18n/chnsecal.h | 128 +- .../icu/third_party/icu/i18n/choicfmt.cpp | 142 +- .../icu/third_party/icu/i18n/coleitr.cpp | 68 +- .../icu/third_party/icu/i18n/coll.cpp | 202 +- .../icu/third_party/icu/i18n/collation.cpp | 9 - .../icu/third_party/icu/i18n/collation.h | 11 +- .../third_party/icu/i18n/collationbuilder.cpp | 255 +- .../third_party/icu/i18n/collationbuilder.h | 12 +- .../third_party/icu/i18n/collationcompare.cpp | 6 +- .../third_party/icu/i18n/collationdata.cpp | 8 +- .../icu/third_party/icu/i18n/collationdata.h | 38 +- .../icu/i18n/collationdatabuilder.cpp | 405 +- .../icu/i18n/collationdatabuilder.h | 20 +- .../icu/i18n/collationdatareader.cpp | 88 +- .../icu/i18n/collationdatareader.h | 6 +- .../icu/i18n/collationdatawriter.cpp | 42 +- .../icu/i18n/collationdatawriter.h | 2 +- .../icu/i18n/collationfastlatin.cpp | 54 +- .../third_party/icu/i18n/collationfastlatin.h | 10 +- .../icu/i18n/collationfastlatinbuilder.cpp | 124 +- .../icu/third_party/icu/i18n/collationfcd.cpp | 106 +- .../icu/third_party/icu/i18n/collationfcd.h | 8 +- .../icu/i18n/collationiterator.cpp | 58 +- .../third_party/icu/i18n/collationiterator.h | 18 +- .../third_party/icu/i18n/collationkeys.cpp | 20 +- .../icu/third_party/icu/i18n/collationkeys.h | 18 +- .../third_party/icu/i18n/collationroot.cpp | 70 +- .../icu/third_party/icu/i18n/collationroot.h | 5 +- .../icu/i18n/collationruleparser.cpp | 89 +- .../icu/i18n/collationruleparser.h | 4 +- .../third_party/icu/i18n/collationsets.cpp | 120 +- .../icu/third_party/icu/i18n/collationsets.h | 16 +- .../icu/i18n/collationsettings.cpp | 30 +- .../third_party/icu/i18n/collationsettings.h | 10 +- .../icu/i18n/collationtailoring.cpp | 28 +- .../third_party/icu/i18n/collationtailoring.h | 16 +- .../third_party/icu/i18n/collationweights.cpp | 26 +- .../third_party/icu/i18n/collationweights.h | 2 +- .../icu/i18n/compactdecimalformat.cpp | 3 - .../icu/third_party/icu/i18n/coptccal.cpp | 30 +- .../icu/third_party/icu/i18n/coptccal.h | 32 +- .../icu/third_party/icu/i18n/cpdtrans.h | 26 +- .../icu/third_party/icu/i18n/curramt.cpp | 6 +- .../icu/third_party/icu/i18n/currfmt.cpp | 2 +- .../icu/third_party/icu/i18n/currfmt.h | 8 +- .../icu/third_party/icu/i18n/currpinf.cpp | 78 +- .../icu/third_party/icu/i18n/currunit.cpp | 33 +- .../icu/third_party/icu/i18n/dangical.cpp | 126 +- .../icu/third_party/icu/i18n/dangical.h | 30 +- .../icu/third_party/icu/i18n/datefmt.cpp | 113 +- .../third_party/icu/i18n/dayperiodrules.cpp | 54 +- .../icu/third_party/icu/i18n/dayperiodrules.h | 2 +- .../icu/third_party/icu/i18n/dcfmtsym.cpp | 320 +- .../icu/third_party/icu/i18n/decContext.cpp | 10 +- .../icu/third_party/icu/i18n/decContext.h | 41 +- .../icu/third_party/icu/i18n/decNumber.cpp | 768 +- .../icu/third_party/icu/i18n/decNumber.h | 135 +- .../icu/third_party/icu/i18n/decNumberLocal.h | 461 +- .../icu/third_party/icu/i18n/decimfmt.cpp | 192 +- .../third_party/icu/i18n/displayoptions.cpp | 167 + .../i18n/double-conversion-bignum-dtoa.cpp | 6 +- .../icu/i18n/double-conversion-bignum.cpp | 15 +- .../i18n/double-conversion-cached-powers.h | 2 - .../double-conversion-double-to-string.cpp | 43 +- .../i18n/double-conversion-double-to-string.h | 116 +- .../icu/i18n/double-conversion-fast-dtoa.cpp | 4 +- .../icu/i18n/double-conversion-fast-dtoa.h | 4 +- .../icu/i18n/double-conversion-ieee.h | 45 + .../double-conversion-string-to-double.cpp | 81 +- .../i18n/double-conversion-string-to-double.h | 18 +- .../icu/i18n/double-conversion-strtod.cpp | 34 +- .../icu/i18n/double-conversion-strtod.h | 20 +- .../icu/i18n/double-conversion-utils.h | 78 +- .../icu/third_party/icu/i18n/dt_impl.h | 114 +- .../icu/third_party/icu/i18n/dtfmtsym.cpp | 691 +- .../icu/third_party/icu/i18n/dtitv_impl.h | 120 +- .../icu/third_party/icu/i18n/dtitvfmt.cpp | 660 +- .../icu/third_party/icu/i18n/dtitvinf.cpp | 187 +- .../icu/third_party/icu/i18n/dtptngen.cpp | 930 +- .../icu/third_party/icu/i18n/dtptngen_impl.h | 189 +- .../icu/third_party/icu/i18n/dtrule.cpp | 14 +- .../icu/third_party/icu/i18n/erarules.cpp | 18 +- .../icu/third_party/icu/i18n/esctrn.h | 6 +- .../icu/third_party/icu/i18n/ethpccal.cpp | 200 +- .../icu/third_party/icu/i18n/ethpccal.h | 187 +- .../icu/third_party/icu/i18n/fmtable.cpp | 238 +- .../icu/third_party/icu/i18n/fmtable_cnv.cpp | 46 - .../icu/third_party/icu/i18n/format.cpp | 4 + .../icu/i18n/formatted_string_builder.cpp | 71 +- .../icu/i18n/formatted_string_builder.h | 97 +- .../third_party/icu/i18n/formattedval_impl.h | 66 +- .../icu/i18n/formattedval_iterimpl.cpp | 2 +- .../icu/i18n/formattedval_sbimpl.cpp | 230 +- .../third_party/icu/i18n/formattedvalue.cpp | 12 +- .../icu/third_party/icu/i18n/fphdlimp.cpp | 10 +- .../icu/third_party/icu/i18n/fphdlimp.h | 29 +- .../icu/third_party/icu/i18n/fpositer.cpp | 24 +- .../icu/third_party/icu/i18n/gender.cpp | 71 +- .../icu/third_party/icu/i18n/gregocal.cpp | 213 +- .../icu/third_party/icu/i18n/gregoimp.cpp | 44 +- .../icu/third_party/icu/i18n/gregoimp.h | 12 +- .../icu/third_party/icu/i18n/hebrwcal.cpp | 144 +- .../icu/third_party/icu/i18n/hebrwcal.h | 132 +- .../icu/third_party/icu/i18n/indiancal.cpp | 79 +- .../icu/third_party/icu/i18n/indiancal.h | 58 +- .../icu/third_party/icu/i18n/islamcal.cpp | 629 +- .../icu/third_party/icu/i18n/islamcal.h | 504 +- .../icu/third_party/icu/i18n/iso8601cal.cpp | 43 + .../icu/third_party/icu/i18n/iso8601cal.h | 102 + .../icu/third_party/icu/i18n/japancal.cpp | 30 +- .../icu/third_party/icu/i18n/japancal.h | 34 +- .../third_party/icu/i18n/listformatter.cpp | 628 +- .../icu/third_party/icu/i18n/measfmt.cpp | 132 +- .../icu/third_party/icu/i18n/measunit.cpp | 767 +- .../third_party/icu/i18n/measunit_extra.cpp | 1260 + .../icu/third_party/icu/i18n/measunit_impl.h | 376 + .../icu/third_party/icu/i18n/measure.cpp | 18 +- .../icu/third_party/icu/i18n/msgfmt.cpp | 444 +- .../icu/third_party/icu/i18n/msgfmt_impl.h | 14 +- .../icu/third_party/icu/i18n/name2uni.h | 186 +- .../icu/third_party/icu/i18n/nfrlist.h | 18 +- .../icu/third_party/icu/i18n/nfrs.cpp | 130 +- .../extension/icu/third_party/icu/i18n/nfrs.h | 8 +- .../icu/third_party/icu/i18n/nfrule.cpp | 312 +- .../icu/third_party/icu/i18n/nfrule.h | 6 +- .../icu/third_party/icu/i18n/nfsubs.cpp | 316 +- .../icu/third_party/icu/i18n/nfsubs.h | 10 +- .../icu/third_party/icu/i18n/nortrans.h | 204 +- .../icu/third_party/icu/i18n/nounit.cpp | 42 - .../icu/third_party/icu/i18n/nultrans.h | 146 +- .../icu/i18n/number_affixutils.cpp | 60 +- .../third_party/icu/i18n/number_asformat.cpp | 15 +- .../third_party/icu/i18n/number_asformat.h | 15 +- .../icu/third_party/icu/i18n/number_capi.cpp | 226 +- .../third_party/icu/i18n/number_compact.cpp | 95 +- .../icu/third_party/icu/i18n/number_compact.h | 36 +- .../icu/i18n/number_currencysymbols.cpp | 21 +- .../icu/i18n/number_currencysymbols.h | 6 + .../icu/i18n/number_decimalquantity.cpp | 248 +- .../icu/i18n/number_decimalquantity.h | 97 +- .../icu/i18n/number_decimfmtprops.cpp | 6 +- .../icu/i18n/number_decimfmtprops.h | 6 +- .../icu/third_party/icu/i18n/number_decnum.h | 15 + .../third_party/icu/i18n/number_fluent.cpp | 371 +- .../icu/i18n/number_formatimpl.cpp | 430 +- .../third_party/icu/i18n/number_formatimpl.h | 68 +- .../third_party/icu/i18n/number_grouping.cpp | 22 +- .../icu/i18n/number_integerwidth.cpp | 5 +- .../third_party/icu/i18n/number_longnames.cpp | 1661 +- .../third_party/icu/i18n/number_longnames.h | 224 +- .../third_party/icu/i18n/number_mapper.cpp | 59 +- .../icu/third_party/icu/i18n/number_mapper.h | 109 +- .../third_party/icu/i18n/number_microprops.h | 126 +- .../third_party/icu/i18n/number_modifiers.cpp | 87 +- .../third_party/icu/i18n/number_modifiers.h | 134 +- .../icu/i18n/number_multiplier.cpp | 12 +- .../third_party/icu/i18n/number_multiplier.h | 2 +- .../third_party/icu/i18n/number_notation.cpp | 2 +- .../third_party/icu/i18n/number_output.cpp | 53 +- .../third_party/icu/i18n/number_padding.cpp | 2 +- .../icu/i18n/number_patternmodifier.cpp | 130 +- .../icu/i18n/number_patternmodifier.h | 70 +- .../icu/i18n/number_patternstring.cpp | 235 +- .../icu/i18n/number_patternstring.h | 55 +- .../third_party/icu/i18n/number_rounding.cpp | 281 +- .../icu/i18n/number_roundingutils.h | 76 +- .../icu/i18n/number_scientific.cpp | 17 +- .../third_party/icu/i18n/number_scientific.h | 20 +- .../third_party/icu/i18n/number_simple.cpp | 255 + .../third_party/icu/i18n/number_skeletons.cpp | 633 +- .../third_party/icu/i18n/number_skeletons.h | 81 +- .../icu/i18n/number_symbolswrapper.cpp | 131 + .../icu/third_party/icu/i18n/number_types.h | 50 +- .../icu/i18n/number_usageprefs.cpp | 216 + .../third_party/icu/i18n/number_usageprefs.h | 126 + .../icu/third_party/icu/i18n/number_utils.cpp | 27 +- .../icu/third_party/icu/i18n/number_utils.h | 4 +- .../icu/third_party/icu/i18n/number_utypes.h | 19 +- .../icu/third_party/icu/i18n/numfmt.cpp | 276 +- .../third_party/icu/i18n/numparse_affixes.cpp | 82 +- .../third_party/icu/i18n/numparse_affixes.h | 21 +- .../icu/i18n/numparse_compositions.cpp | 2 - .../icu/i18n/numparse_compositions.h | 5 +- .../icu/i18n/numparse_currency.cpp | 4 +- .../third_party/icu/i18n/numparse_currency.h | 2 +- .../third_party/icu/i18n/numparse_decimal.cpp | 19 +- .../third_party/icu/i18n/numparse_decimal.h | 2 +- .../third_party/icu/i18n/numparse_impl.cpp | 29 +- .../icu/i18n/numparse_parsednumber.cpp | 2 - .../icu/i18n/numparse_scientific.cpp | 6 +- .../third_party/icu/i18n/numparse_symbols.cpp | 20 +- .../icu/third_party/icu/i18n/numparse_types.h | 13 +- .../icu/third_party/icu/i18n/numparse_utils.h | 30 +- .../icu/i18n/numparse_validators.cpp | 2 - .../icu/i18n/numparse_validators.h | 26 +- .../third_party/icu/i18n/numrange_capi.cpp | 198 + .../third_party/icu/i18n/numrange_fluent.cpp | 104 +- .../third_party/icu/i18n/numrange_impl.cpp | 186 +- .../icu/third_party/icu/i18n/numrange_impl.h | 40 +- .../icu/third_party/icu/i18n/numsys.cpp | 81 +- .../icu/third_party/icu/i18n/numsys_impl.h | 4 +- .../icu/third_party/icu/i18n/olsontz.cpp | 298 +- .../icu/third_party/icu/i18n/olsontz.h | 68 +- .../icu/third_party/icu/i18n/persncal.cpp | 72 +- .../icu/third_party/icu/i18n/persncal.h | 52 +- .../icu/third_party/icu/i18n/pluralranges.cpp | 144 + .../icu/third_party/icu/i18n/pluralranges.h | 67 + .../icu/third_party/icu/i18n/plurfmt.cpp | 94 +- .../icu/third_party/icu/i18n/plurrule.cpp | 834 +- .../icu/third_party/icu/i18n/plurrule_impl.h | 274 +- .../icu/i18n/quantityformatter.cpp | 39 +- .../third_party/icu/i18n/quantityformatter.h | 10 +- .../icu/third_party/icu/i18n/rbnf.cpp | 782 +- .../extension/icu/third_party/icu/i18n/rbt.h | 446 +- .../icu/third_party/icu/i18n/rbt_data.h | 308 +- .../icu/third_party/icu/i18n/rbt_pars.h | 22 +- .../icu/third_party/icu/i18n/rbt_set.h | 334 +- .../icu/third_party/icu/i18n/rbtz.cpp | 357 +- .../icu/third_party/icu/i18n/region.cpp | 320 +- .../icu/third_party/icu/i18n/region_impl.h | 16 +- .../icu/third_party/icu/i18n/reldatefmt.cpp | 1416 - .../icu/third_party/icu/i18n/reldtfmt.cpp | 130 +- .../icu/third_party/icu/i18n/reldtfmt.h | 30 +- .../icu/third_party/icu/i18n/remtrans.h | 160 +- .../icu/i18n/rulebasedcollator.cpp | 258 +- .../icu/i18n/scientificnumberformatter.cpp | 32 +- .../icu/third_party/icu/i18n/search.cpp | 445 - .../icu/third_party/icu/i18n/selfmt.cpp | 12 +- .../icu/third_party/icu/i18n/selfmtimpl.h | 118 +- .../icu/i18n/sharedbreakiterator.h | 4 +- .../icu/third_party/icu/i18n/sharedcalendar.h | 10 +- .../icu/i18n/shareddateformatsymbols.h | 10 +- .../third_party/icu/i18n/sharednumberformat.h | 9 +- .../third_party/icu/i18n/sharedpluralrules.h | 9 +- .../icu/third_party/icu/i18n/simpletz.cpp | 136 +- .../icu/third_party/icu/i18n/smpdtfmt.cpp | 1084 +- .../icu/third_party/icu/i18n/smpdtfst.cpp | 38 +- .../icu/third_party/icu/i18n/sortkey.cpp | 16 +- .../third_party/icu/i18n/standardplural.cpp | 48 +- .../icu/third_party/icu/i18n/standardplural.h | 2 + .../third_party/icu/i18n/string_segment.cpp | 8 +- .../icu/third_party/icu/i18n/stsearch.cpp | 483 - .../icu/third_party/icu/i18n/taiwncal.cpp | 30 +- .../icu/third_party/icu/i18n/taiwncal.h | 22 +- .../icu/third_party/icu/i18n/timezone.cpp | 528 +- .../icu/third_party/icu/i18n/titletrn.h | 184 +- .../icu/third_party/icu/i18n/tmunit.cpp | 6 +- .../icu/third_party/icu/i18n/tmutamt.cpp | 2 +- .../icu/third_party/icu/i18n/tmutfmt.cpp | 191 +- .../icu/third_party/icu/i18n/tolowtrn.h | 152 +- .../icu/third_party/icu/i18n/toupptrn.h | 152 +- .../icu/third_party/icu/i18n/translit.cpp | 1656 - .../icu/third_party/icu/i18n/transreg.h | 937 +- .../icu/third_party/icu/i18n/tridpars.h | 726 +- .../icu/third_party/icu/i18n/tzfmt.cpp | 545 +- .../icu/third_party/icu/i18n/tzgnames.cpp | 423 +- .../icu/third_party/icu/i18n/tzgnames.h | 2 +- .../icu/third_party/icu/i18n/tznames.cpp | 154 +- .../icu/third_party/icu/i18n/tznames_impl.cpp | 873 +- .../icu/third_party/icu/i18n/tznames_impl.h | 72 +- .../icu/third_party/icu/i18n/tzrule.cpp | 126 +- .../icu/third_party/icu/i18n/tztrans.cpp | 46 +- .../icu/third_party/icu/i18n/ucal.cpp | 284 +- .../icu/third_party/icu/i18n/ucln_in.cpp | 10 +- .../icu/third_party/icu/i18n/ucln_in.h | 1 + .../icu/third_party/icu/i18n/ucol.cpp | 116 +- .../icu/third_party/icu/i18n/ucol_imp.h | 4 +- .../icu/third_party/icu/i18n/ucol_res.cpp | 182 +- .../icu/third_party/icu/i18n/ucol_sit.cpp | 208 +- .../icu/third_party/icu/i18n/ucoleitr.cpp | 94 +- .../icu/third_party/icu/i18n/udat.cpp | 260 +- .../icu/i18n/udateintervalformat.cpp | 74 +- .../icu/third_party/icu/i18n/udatpg.cpp | 128 +- .../third_party/icu/i18n/ufieldpositer.cpp | 4 +- .../icu/i18n/uitercollationiterator.cpp | 26 +- .../icu/i18n/uitercollationiterator.h | 37 +- .../third_party/icu/i18n/ulistformatter.cpp | 39 +- .../icu/third_party/icu/i18n/ulocdata.cpp | 109 +- .../icu/third_party/icu/i18n/umsg.cpp | 148 +- .../icu/third_party/icu/i18n/umsg_imp.h | 28 +- .../icu/third_party/icu/i18n/unesctrn.h | 224 +- .../icu/third_party/icu/i18n/uni2name.h | 178 +- .../third_party/icu/i18n/unicode/alphaindex.h | 26 +- .../third_party/icu/i18n/unicode/basictz.h | 58 +- .../third_party/icu/i18n/unicode/calendar.h | 255 +- .../third_party/icu/i18n/unicode/choicfmt.h | 46 +- .../third_party/icu/i18n/unicode/coleitr.h | 60 +- .../icu/third_party/icu/i18n/unicode/coll.h | 48 +- .../icu/i18n/unicode/compactdecimalformat.h | 16 +- .../third_party/icu/i18n/unicode/curramt.h | 16 +- .../third_party/icu/i18n/unicode/currpinf.h | 2 +- .../third_party/icu/i18n/unicode/currunit.h | 10 +- .../third_party/icu/i18n/unicode/datefmt.h | 56 +- .../third_party/icu/i18n/unicode/dcfmtsym.h | 56 +- .../third_party/icu/i18n/unicode/decimfmt.h | 171 +- .../icu/i18n/unicode/displayoptions.h | 270 + .../third_party/icu/i18n/unicode/dtfmtsym.h | 47 +- .../third_party/icu/i18n/unicode/dtitvfmt.h | 127 +- .../third_party/icu/i18n/unicode/dtitvinf.h | 29 +- .../third_party/icu/i18n/unicode/dtptngen.h | 102 +- .../icu/third_party/icu/i18n/unicode/dtrule.h | 12 +- .../third_party/icu/i18n/unicode/fieldpos.h | 12 +- .../third_party/icu/i18n/unicode/fmtable.h | 32 +- .../icu/third_party/icu/i18n/unicode/format.h | 14 +- .../icu/i18n/unicode/formattednumber.h | 211 + .../icu/i18n/unicode/formattedvalue.h | 66 +- .../third_party/icu/i18n/unicode/fpositer.h | 2 +- .../icu/third_party/icu/i18n/unicode/gender.h | 10 +- .../third_party/icu/i18n/unicode/gregocal.h | 96 +- .../icu/i18n/unicode/listformatter.h | 99 +- .../third_party/icu/i18n/unicode/measfmt.h | 19 +- .../third_party/icu/i18n/unicode/measunit.h | 1730 +- .../third_party/icu/i18n/unicode/measure.h | 16 +- .../icu/third_party/icu/i18n/unicode/msgfmt.h | 60 +- .../icu/third_party/icu/i18n/unicode/nounit.h | 92 +- .../icu/i18n/unicode/numberformatter.h | 801 +- .../icu/i18n/unicode/numberrangeformatter.h | 296 +- .../icu/third_party/icu/i18n/unicode/numfmt.h | 89 +- .../icu/third_party/icu/i18n/unicode/numsys.h | 30 +- .../third_party/icu/i18n/unicode/plurfmt.h | 28 +- .../third_party/icu/i18n/unicode/plurrule.h | 114 +- .../icu/third_party/icu/i18n/unicode/rbnf.h | 87 +- .../icu/third_party/icu/i18n/unicode/rbtz.h | 65 +- .../icu/third_party/icu/i18n/unicode/region.h | 10 +- .../third_party/icu/i18n/unicode/reldatefmt.h | 67 +- .../i18n/unicode/scientificnumberformatter.h | 10 +- .../icu/third_party/icu/i18n/unicode/search.h | 1158 +- .../icu/third_party/icu/i18n/unicode/selfmt.h | 16 +- .../icu/i18n/unicode/simplenumberformatter.h | 329 + .../third_party/icu/i18n/unicode/simpletz.h | 60 +- .../third_party/icu/i18n/unicode/smpdtfmt.h | 120 +- .../third_party/icu/i18n/unicode/sortkey.h | 12 +- .../third_party/icu/i18n/unicode/stsearch.h | 1016 +- .../third_party/icu/i18n/unicode/tblcoll.h | 90 +- .../third_party/icu/i18n/unicode/timezone.h | 175 +- .../icu/third_party/icu/i18n/unicode/tmunit.h | 4 +- .../third_party/icu/i18n/unicode/tmutamt.h | 6 +- .../third_party/icu/i18n/unicode/tmutfmt.h | 20 +- .../third_party/icu/i18n/unicode/translit.h | 3188 +- .../icu/third_party/icu/i18n/unicode/tzfmt.h | 48 +- .../third_party/icu/i18n/unicode/tznames.h | 12 +- .../icu/third_party/icu/i18n/unicode/tzrule.h | 70 +- .../third_party/icu/i18n/unicode/tztrans.h | 2 +- .../icu/third_party/icu/i18n/unicode/ucal.h | 288 +- .../icu/third_party/icu/i18n/unicode/ucol.h | 463 +- .../third_party/icu/i18n/unicode/ucoleitr.h | 102 +- .../icu/third_party/icu/i18n/unicode/udat.h | 90 +- .../icu/i18n/unicode/udateintervalformat.h | 94 +- .../icu/third_party/icu/i18n/unicode/udatpg.h | 145 +- .../icu/i18n/unicode/udisplayoptions.h | 321 + .../icu/i18n/unicode/ufieldpositer.h | 8 +- .../icu/i18n/unicode/uformattable.h | 34 +- .../icu/i18n/unicode/uformattednumber.h | 224 + .../icu/i18n/unicode/uformattedvalue.h | 96 +- .../third_party/icu/i18n/unicode/ugender.h | 6 +- .../icu/i18n/unicode/ulistformatter.h | 116 +- .../third_party/icu/i18n/unicode/ulocdata.h | 35 +- .../icu/third_party/icu/i18n/unicode/umsg.h | 85 +- .../icu/third_party/icu/i18n/unicode/unum.h | 251 +- .../icu/i18n/unicode/unumberformatter.h | 448 +- .../icu/i18n/unicode/unumberoptions.h | 173 + .../icu/i18n/unicode/unumberrangeformatter.h | 471 + .../third_party/icu/i18n/unicode/unumsys.h | 21 +- .../icu/i18n/unicode/upluralrules.h | 45 +- .../third_party/icu/i18n/unicode/uregion.h | 26 +- .../icu/i18n/unicode/ureldatefmt.h | 1027 +- .../third_party/icu/i18n/unicode/usearch.h | 1801 +- .../icu/i18n/unicode/usimplenumberformatter.h | 305 + .../third_party/icu/i18n/unicode/utmscale.h | 6 +- .../icu/third_party/icu/i18n/unicode/utrans.h | 1317 +- .../icu/third_party/icu/i18n/unicode/vtzone.h | 58 +- .../icu/i18n/units_complexconverter.cpp | 275 + .../icu/i18n/units_complexconverter.h | 136 + .../third_party/icu/i18n/units_converter.cpp | 642 + .../third_party/icu/i18n/units_converter.h | 234 + .../icu/third_party/icu/i18n/units_data.cpp | 511 + .../icu/third_party/icu/i18n/units_data.h | 220 + .../icu/third_party/icu/i18n/units_router.cpp | 149 + .../icu/third_party/icu/i18n/units_router.h | 166 + .../icu/third_party/icu/i18n/unum.cpp | 237 +- .../icu/third_party/icu/i18n/unumsys.cpp | 4 +- .../icu/third_party/icu/i18n/upluralrules.cpp | 46 +- .../icu/third_party/icu/i18n/usearch.cpp | 4954 --- .../icu/third_party/icu/i18n/usrchimp.h | 60 +- .../icu/i18n/utf16collationiterator.cpp | 78 +- .../icu/i18n/utf16collationiterator.h | 74 +- .../icu/i18n/utf8collationiterator.cpp | 34 +- .../icu/i18n/utf8collationiterator.h | 42 +- .../icu/third_party/icu/i18n/utmscale.cpp | 60 +- .../icu/third_party/icu/i18n/vtzone.cpp | 944 +- .../icu/third_party/icu/i18n/vzone.cpp | 20 +- .../icu/third_party/icu/i18n/vzone.h | 16 +- .../icu/third_party/icu/i18n/windtfmt.cpp | 65 +- .../icu/third_party/icu/i18n/windtfmt.h | 10 +- .../icu/third_party/icu/i18n/winnmfmt.cpp | 57 +- .../icu/third_party/icu/i18n/winnmfmt.h | 10 +- .../icu/third_party/icu/i18n/wintzimpl.cpp | 26 +- .../icu/third_party/icu/i18n/wintzimpl.h | 6 +- .../icu/third_party/icu/i18n/zonemeta.cpp | 418 +- .../icu/third_party/icu/i18n/zonemeta.h | 45 +- .../icu/third_party/icu/i18n/zrule.cpp | 8 +- .../icu/third_party/icu/i18n/zrule.h | 4 - .../icu/third_party/icu/i18n/ztrans.h | 4 - .../icu/third_party/icu/stubdata/stubdata.cpp | 2 +- .../parquet/include/decode_utils.hpp | 8 +- src/duckdb/src/common/enum_util.cpp | 18 +- src/duckdb/src/common/extra_type_info.cpp | 66 +- .../src/common/operator/cast_operators.cpp | 4 +- src/duckdb/src/common/string_util.cpp | 27 + src/duckdb/src/common/types.cpp | 66 +- src/duckdb/src/common/types/bit.cpp | 150 +- src/duckdb/src/common/types/data_chunk.cpp | 24 +- .../common/types/row/tuple_data_allocator.cpp | 2 +- src/duckdb/src/common/types/value.cpp | 8 +- src/duckdb/src/common/types/vector.cpp | 101 +- .../src/execution/aggregate_hashtable.cpp | 2 +- .../src/execution/column_binding_resolver.cpp | 7 +- .../src/execution/expression_executor.cpp | 5 +- .../expression_executor/execute_function.cpp | 2 +- src/duckdb/src/execution/index/art/leaf.cpp | 9 +- .../aggregate/physical_hash_aggregate.cpp | 2 +- .../physical_perfecthash_aggregate.cpp | 4 +- .../operator/aggregate/physical_window.cpp | 4 +- .../operator/join/physical_hash_join.cpp | 12 +- .../operator/join/physical_iejoin.cpp | 6 +- .../join/physical_nested_loop_join.cpp | 6 +- .../join/physical_piecewise_merge_join.cpp | 6 +- .../operator/persistent/physical_delete.cpp | 13 +- .../operator/projection/physical_unnest.cpp | 2 +- .../scan/physical_expression_scan.cpp | 2 +- .../operator/set/physical_recursive_cte.cpp | 34 +- .../physical_plan/plan_comparison_join.cpp | 1 - .../physical_plan/plan_recursive_cte.cpp | 49 +- src/duckdb/src/function/cast/blob_cast.cpp | 2 +- .../src/function/cast/default_casts.cpp | 40 +- src/duckdb/src/function/cast_rules.cpp | 3 +- src/duckdb/src/function/function_list.cpp | 4 +- .../function/scalar/list/list_intersect.cpp | 3 - .../function/scalar/struct/struct_extract.cpp | 2 +- .../scalar/system/aggregate_export.cpp | 361 +- src/duckdb/src/function/table/arrow.cpp | 2 +- .../table/system/pragma_storage_info.cpp | 4 +- .../table/system/test_vector_types.cpp | 5 +- .../function/table/version/pragma_version.cpp | 6 +- .../include/duckdb/common/extra_type_info.hpp | 26 +- .../src/include/duckdb/common/string_util.hpp | 18 +- .../src/include/duckdb/common/types.hpp | 23 +- .../src/include/duckdb/common/types/bit.hpp | 11 +- .../duckdb/common/types/data_chunk.hpp | 3 +- .../duckdb/common/types/string_type.hpp | 6 + .../src/include/duckdb/common/types/value.hpp | 3 +- .../include/duckdb/common/windows_undefs.hpp | 8 + .../duckdb/execution/index/art/node.hpp | 30 +- .../operator/join/physical_hash_join.hpp | 6 - .../operator/set/physical_recursive_cte.hpp | 4 +- .../duckdb/function/aggregate_function.hpp | 10 +- .../function/scalar/system_functions.hpp | 4 +- .../include/duckdb/main/extension_entries.hpp | 8 +- .../parser/common_table_expression_info.hpp | 2 + .../src/include/duckdb/planner/joinside.hpp | 55 +- .../duckdb/planner/operator/logical_join.hpp | 3 - .../operator/logical_recursive_cte.hpp | 20 + .../duckdb/storage/statistics/array_stats.hpp | 4 +- .../storage/statistics/base_statistics.hpp | 1 + .../storage/statistics/geometry_stats.hpp | 2 +- .../duckdb/storage/statistics/list_stats.hpp | 4 +- .../storage/statistics/numeric_stats.hpp | 3 +- .../storage/statistics/string_stats.hpp | 3 +- .../storage/statistics/struct_stats.hpp | 4 +- .../storage/statistics/variant_stats.hpp | 3 +- .../duckdb/storage/table_storage_info.hpp | 2 +- .../compress_comparison_join.cpp | 13 +- .../rule/ordered_aggregate_optimizer.cpp | 6 + .../statistics/operator/propagate_join.cpp | 15 +- src/duckdb/src/parallel/pipeline_executor.cpp | 4 +- src/duckdb/src/parallel/task_scheduler.cpp | 45 +- src/duckdb/src/parser/query_node.cpp | 12 + .../transform/helpers/transform_cte.cpp | 13 +- .../expression/bind_operator_expression.cpp | 3 +- .../query_node/bind_recursive_cte_node.cpp | 189 +- .../planner/binder/statement/bind_delete.cpp | 4 +- src/duckdb/src/planner/joinside.cpp | 20 + src/duckdb/src/planner/logical_operator.cpp | 10 +- .../src/planner/logical_operator_visitor.cpp | 3 + .../src/planner/operator/logical_delete.cpp | 9 +- .../subquery/flatten_dependent_join.cpp | 5 +- src/duckdb/src/storage/data_table.cpp | 9 +- .../serialize_logical_operator.cpp | 4 + .../storage/serialization/serialize_nodes.cpp | 2 + .../storage/serialization/serialize_types.cpp | 40 +- .../src/storage/statistics/array_stats.cpp | 6 +- .../storage/statistics/base_statistics.cpp | 33 +- .../src/storage/statistics/geometry_stats.cpp | 37 +- .../src/storage/statistics/list_stats.cpp | 6 +- .../src/storage/statistics/numeric_stats.cpp | 10 +- .../src/storage/statistics/string_stats.cpp | 24 +- .../src/storage/statistics/struct_stats.cpp | 13 +- .../src/storage/statistics/variant_stats.cpp | 61 +- src/duckdb/src/storage/table/column_data.cpp | 2 +- src/duckdb/src/storage/write_ahead_log.cpp | 6 +- .../libpg_query/include/nodes/parsenodes.hpp | 2 +- .../libpg_query/src_backend_parser_gram.cpp | 27323 ++++++++-------- ...b_extension_icu_third_party_icu_common.cpp | 392 - .../ub_extension_icu_third_party_icu_i18n.cpp | 364 - 891 files changed, 91369 insertions(+), 115316 deletions(-) delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/brkeng.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/brkiter.cpp create mode 100644 src/duckdb/extension/icu/third_party/icu/common/charstrmap.h delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/cwchar.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/dictbe.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/dictionarydata.cpp create mode 100644 src/duckdb/extension/icu/third_party/icu/common/emojiprops.cpp create mode 100644 src/duckdb/extension/icu/third_party/icu/common/emojiprops.h delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/filteredbrk.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/icuplug.cpp create mode 100644 src/duckdb/extension/icu/third_party/icu/common/localefallback_data.h delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/locutil.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/punycode.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/rbbi.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/rbbi_cache.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/rbbidata.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/rbbinode.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/rbbirb.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/rbbiscan.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/rbbisetb.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/rbbistbl.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/rbbitblb.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/restrace.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/serv.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/servlk.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/servlkf.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/servls.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/servnotf.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/servrbf.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/servslkf.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/ubrk.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/ucasemap_titlecase_brkiter.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/ucnv.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/ucnv2022.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/ucnv_bld.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/ucnv_cb.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/ucnv_cnv.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/ucnv_ct.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/ucnv_err.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/ucnv_ext.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/ucnv_io.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/ucnv_lmb.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/ucnv_set.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/ucnv_u16.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/ucnv_u32.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/ucnv_u7.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/ucnv_u8.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/ucnvbocu.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/ucnvdisp.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/ucnvhz.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/ucnvisci.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/ucnvlat1.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/ucnvmbcs.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/ucnvscsu.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/ucnvsel.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/uidna.cpp create mode 100644 src/duckdb/extension/icu/third_party/icu/common/uniquecharstr.h delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/unistr_cnv.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/unistr_titlecase_brkiter.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/usprep.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/ustr_cnv.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/ustr_titlecase_brkiter.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/common/uts46.cpp create mode 100644 src/duckdb/extension/icu/third_party/icu/i18n/displayoptions.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/i18n/fmtable_cnv.cpp create mode 100644 src/duckdb/extension/icu/third_party/icu/i18n/iso8601cal.cpp create mode 100644 src/duckdb/extension/icu/third_party/icu/i18n/iso8601cal.h create mode 100644 src/duckdb/extension/icu/third_party/icu/i18n/measunit_extra.cpp create mode 100644 src/duckdb/extension/icu/third_party/icu/i18n/measunit_impl.h delete mode 100644 src/duckdb/extension/icu/third_party/icu/i18n/nounit.cpp create mode 100644 src/duckdb/extension/icu/third_party/icu/i18n/number_simple.cpp create mode 100644 src/duckdb/extension/icu/third_party/icu/i18n/number_symbolswrapper.cpp create mode 100644 src/duckdb/extension/icu/third_party/icu/i18n/number_usageprefs.cpp create mode 100644 src/duckdb/extension/icu/third_party/icu/i18n/number_usageprefs.h create mode 100644 src/duckdb/extension/icu/third_party/icu/i18n/numrange_capi.cpp create mode 100644 src/duckdb/extension/icu/third_party/icu/i18n/pluralranges.cpp create mode 100644 src/duckdb/extension/icu/third_party/icu/i18n/pluralranges.h delete mode 100644 src/duckdb/extension/icu/third_party/icu/i18n/reldatefmt.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/i18n/search.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/i18n/stsearch.cpp delete mode 100644 src/duckdb/extension/icu/third_party/icu/i18n/translit.cpp create mode 100644 src/duckdb/extension/icu/third_party/icu/i18n/unicode/displayoptions.h create mode 100644 src/duckdb/extension/icu/third_party/icu/i18n/unicode/formattednumber.h create mode 100644 src/duckdb/extension/icu/third_party/icu/i18n/unicode/simplenumberformatter.h create mode 100644 src/duckdb/extension/icu/third_party/icu/i18n/unicode/udisplayoptions.h create mode 100644 src/duckdb/extension/icu/third_party/icu/i18n/unicode/uformattednumber.h create mode 100644 src/duckdb/extension/icu/third_party/icu/i18n/unicode/unumberoptions.h create mode 100644 src/duckdb/extension/icu/third_party/icu/i18n/unicode/unumberrangeformatter.h create mode 100644 src/duckdb/extension/icu/third_party/icu/i18n/unicode/usimplenumberformatter.h create mode 100644 src/duckdb/extension/icu/third_party/icu/i18n/units_complexconverter.cpp create mode 100644 src/duckdb/extension/icu/third_party/icu/i18n/units_complexconverter.h create mode 100644 src/duckdb/extension/icu/third_party/icu/i18n/units_converter.cpp create mode 100644 src/duckdb/extension/icu/third_party/icu/i18n/units_converter.h create mode 100644 src/duckdb/extension/icu/third_party/icu/i18n/units_data.cpp create mode 100644 src/duckdb/extension/icu/third_party/icu/i18n/units_data.h create mode 100644 src/duckdb/extension/icu/third_party/icu/i18n/units_router.cpp create mode 100644 src/duckdb/extension/icu/third_party/icu/i18n/units_router.h delete mode 100644 src/duckdb/extension/icu/third_party/icu/i18n/usearch.cpp delete mode 100644 src/duckdb/ub_extension_icu_third_party_icu_common.cpp delete mode 100644 src/duckdb/ub_extension_icu_third_party_icu_i18n.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f01fbe90..f66f9b8da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -448,8 +448,332 @@ set(DUCKDB_SRC_FILES 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/third_party/icu/common/uinit.cpp + src/duckdb/extension/icu/third_party/icu/common/unames.cpp + src/duckdb/extension/icu/third_party/icu/common/pluralmap.cpp + src/duckdb/extension/icu/third_party/icu/common/uniset.cpp + src/duckdb/extension/icu/third_party/icu/common/uprops.cpp + src/duckdb/extension/icu/third_party/icu/common/loclikely.cpp + src/duckdb/extension/icu/third_party/icu/common/resbund.cpp + src/duckdb/extension/icu/third_party/icu/common/usc_impl.cpp + src/duckdb/extension/icu/third_party/icu/common/uset.cpp + src/duckdb/extension/icu/third_party/icu/common/emojiprops.cpp + src/duckdb/extension/icu/third_party/icu/common/utrie_swap.cpp + src/duckdb/extension/icu/third_party/icu/common/uset_props.cpp + src/duckdb/extension/icu/third_party/icu/common/ucurr.cpp + src/duckdb/extension/icu/third_party/icu/common/uloc_keytype.cpp + src/duckdb/extension/icu/third_party/icu/common/uarrsort.cpp + src/duckdb/extension/icu/third_party/icu/common/ucasemap.cpp + src/duckdb/extension/icu/third_party/icu/common/edits.cpp + src/duckdb/extension/icu/third_party/icu/common/cstr.cpp + src/duckdb/extension/icu/third_party/icu/common/unifiedcache.cpp + src/duckdb/extension/icu/third_party/icu/common/bytestrieiterator.cpp + src/duckdb/extension/icu/third_party/icu/common/ucharstrie.cpp + src/duckdb/extension/icu/third_party/icu/common/ushape.cpp + src/duckdb/extension/icu/third_party/icu/common/ustr_wcs.cpp + src/duckdb/extension/icu/third_party/icu/common/static_unicode_sets.cpp + src/duckdb/extension/icu/third_party/icu/common/ruleiter.cpp + src/duckdb/extension/icu/third_party/icu/common/schriter.cpp + src/duckdb/extension/icu/third_party/icu/common/locid.cpp + src/duckdb/extension/icu/third_party/icu/common/uiter.cpp + src/duckdb/extension/icu/third_party/icu/common/uniset_props.cpp + src/duckdb/extension/icu/third_party/icu/common/unistr_case.cpp + src/duckdb/extension/icu/third_party/icu/common/ucol_swp.cpp + src/duckdb/extension/icu/third_party/icu/common/ubidi.cpp + src/duckdb/extension/icu/third_party/icu/common/uvectr32.cpp + src/duckdb/extension/icu/third_party/icu/common/unistr_props.cpp + src/duckdb/extension/icu/third_party/icu/common/unorm.cpp + src/duckdb/extension/icu/third_party/icu/common/stringtriebuilder.cpp + src/duckdb/extension/icu/third_party/icu/common/uscript_props.cpp + src/duckdb/extension/icu/third_party/icu/common/unistr_case_locale.cpp + src/duckdb/extension/icu/third_party/icu/common/ucharstrieiterator.cpp + src/duckdb/extension/icu/third_party/icu/common/unifunct.cpp + src/duckdb/extension/icu/third_party/icu/common/patternprops.cpp + src/duckdb/extension/icu/third_party/icu/common/resbund_cnv.cpp + src/duckdb/extension/icu/third_party/icu/common/locdistance.cpp + src/duckdb/extension/icu/third_party/icu/common/utext.cpp + src/duckdb/extension/icu/third_party/icu/common/ustrcase.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/uniset_closure.cpp + src/duckdb/extension/icu/third_party/icu/common/errorcode.cpp + src/duckdb/extension/icu/third_party/icu/common/loadednormalizer2impl.cpp + src/duckdb/extension/icu/third_party/icu/common/sharedobject.cpp + src/duckdb/extension/icu/third_party/icu/common/localebuilder.cpp + src/duckdb/extension/icu/third_party/icu/common/unisetspan.cpp + src/duckdb/extension/icu/third_party/icu/common/caniter.cpp + src/duckdb/extension/icu/third_party/icu/common/dtintrv.cpp + src/duckdb/extension/icu/third_party/icu/common/unifilt.cpp + src/duckdb/extension/icu/third_party/icu/common/uhash.cpp + src/duckdb/extension/icu/third_party/icu/common/cmemory.cpp + src/duckdb/extension/icu/third_party/icu/common/uvectr64.cpp + src/duckdb/extension/icu/third_party/icu/common/wintz.cpp + src/duckdb/extension/icu/third_party/icu/common/ucharstriebuilder.cpp + src/duckdb/extension/icu/third_party/icu/common/bytesinkutil.cpp + src/duckdb/extension/icu/third_party/icu/common/characterproperties.cpp + src/duckdb/extension/icu/third_party/icu/common/normalizer2.cpp + src/duckdb/extension/icu/third_party/icu/common/icudataver.cpp + src/duckdb/extension/icu/third_party/icu/common/umapfile.cpp + src/duckdb/extension/icu/third_party/icu/common/ustrfmt.cpp + src/duckdb/extension/icu/third_party/icu/common/ubiditransform.cpp + src/duckdb/extension/icu/third_party/icu/common/uresbund.cpp + src/duckdb/extension/icu/third_party/icu/common/locdispnames.cpp + src/duckdb/extension/icu/third_party/icu/common/loclikelysubtags.cpp + src/duckdb/extension/icu/third_party/icu/common/ucptrie.cpp + src/duckdb/extension/icu/third_party/icu/common/lsr.cpp + src/duckdb/extension/icu/third_party/icu/common/uchriter.cpp + src/duckdb/extension/icu/third_party/icu/common/stringpiece.cpp + src/duckdb/extension/icu/third_party/icu/common/uinvchar.cpp + src/duckdb/extension/icu/third_party/icu/common/parsepos.cpp + src/duckdb/extension/icu/third_party/icu/common/charstr.cpp + src/duckdb/extension/icu/third_party/icu/common/utf_impl.cpp + src/duckdb/extension/icu/third_party/icu/common/normalizer2impl.cpp + src/duckdb/extension/icu/third_party/icu/common/normlzr.cpp + src/duckdb/extension/icu/third_party/icu/common/ustack.cpp + src/duckdb/extension/icu/third_party/icu/common/bytestriebuilder.cpp + src/duckdb/extension/icu/third_party/icu/common/uhash_us.cpp + src/duckdb/extension/icu/third_party/icu/common/ustring.cpp + src/duckdb/extension/icu/third_party/icu/common/utypes.cpp + src/duckdb/extension/icu/third_party/icu/common/uloc_tag.cpp + src/duckdb/extension/icu/third_party/icu/common/uobject.cpp + src/duckdb/extension/icu/third_party/icu/common/cstring.cpp + src/duckdb/extension/icu/third_party/icu/common/umutablecptrie.cpp + src/duckdb/extension/icu/third_party/icu/common/simpleformatter.cpp + src/duckdb/extension/icu/third_party/icu/common/utrie2.cpp + src/duckdb/extension/icu/third_party/icu/common/ubidi_props.cpp + src/duckdb/extension/icu/third_party/icu/common/ustrcase_locale.cpp + src/duckdb/extension/icu/third_party/icu/common/filterednormalizer2.cpp + src/duckdb/extension/icu/third_party/icu/common/ustrenum.cpp + src/duckdb/extension/icu/third_party/icu/common/util.cpp + src/duckdb/extension/icu/third_party/icu/common/putil.cpp + src/duckdb/extension/icu/third_party/icu/common/ucat.cpp + src/duckdb/extension/icu/third_party/icu/common/ubidiwrt.cpp + src/duckdb/extension/icu/third_party/icu/common/uvector.cpp + src/duckdb/extension/icu/third_party/icu/common/localeprioritylist.cpp + src/duckdb/extension/icu/third_party/icu/common/propname.cpp + src/duckdb/extension/icu/third_party/icu/common/unormcmp.cpp + src/duckdb/extension/icu/third_party/icu/common/ures_cnv.cpp + src/duckdb/extension/icu/third_party/icu/common/udatamem.cpp + src/duckdb/extension/icu/third_party/icu/common/uscript.cpp + src/duckdb/extension/icu/third_party/icu/common/ulist.cpp + src/duckdb/extension/icu/third_party/icu/common/uresdata.cpp + src/duckdb/extension/icu/third_party/icu/common/ustrtrns.cpp + src/duckdb/extension/icu/third_party/icu/common/ucmndata.cpp + src/duckdb/extension/icu/third_party/icu/common/bmpset.cpp + src/duckdb/extension/icu/third_party/icu/common/utrie.cpp + src/duckdb/extension/icu/third_party/icu/common/umutex.cpp + src/duckdb/extension/icu/third_party/icu/common/locresdata.cpp + src/duckdb/extension/icu/third_party/icu/common/resource.cpp + src/duckdb/extension/icu/third_party/icu/common/ubidiln.cpp + src/duckdb/extension/icu/third_party/icu/common/messagepattern.cpp + src/duckdb/extension/icu/third_party/icu/common/locbased.cpp + src/duckdb/extension/icu/third_party/icu/common/umath.cpp + src/duckdb/extension/icu/third_party/icu/common/ucase.cpp + src/duckdb/extension/icu/third_party/icu/common/uchar.cpp + src/duckdb/extension/icu/third_party/icu/common/util_props.cpp + src/duckdb/extension/icu/third_party/icu/common/propsvec.cpp + src/duckdb/extension/icu/third_party/icu/common/locmap.cpp + src/duckdb/extension/icu/third_party/icu/common/unistr.cpp + src/duckdb/extension/icu/third_party/icu/common/usetiter.cpp + src/duckdb/extension/icu/third_party/icu/common/bytestream.cpp + src/duckdb/extension/icu/third_party/icu/common/chariter.cpp + src/duckdb/extension/icu/third_party/icu/common/appendable.cpp + src/duckdb/extension/icu/third_party/icu/common/uloc.cpp + src/duckdb/extension/icu/third_party/icu/common/utrie2_builder.cpp + src/duckdb/extension/icu/third_party/icu/common/locavailable.cpp + src/duckdb/extension/icu/third_party/icu/common/bytestrie.cpp + src/duckdb/extension/icu/third_party/icu/common/localematcher.cpp + src/duckdb/extension/icu/third_party/icu/common/udataswp.cpp + src/duckdb/extension/icu/third_party/icu/common/uenum.cpp + src/duckdb/extension/icu/third_party/icu/common/locdspnm.cpp + src/duckdb/extension/icu/third_party/icu/common/ucln_cmn.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/units_data.cpp + src/duckdb/extension/icu/third_party/icu/i18n/decNumber.cpp + src/duckdb/extension/icu/third_party/icu/i18n/japancal.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_skeletons.cpp + src/duckdb/extension/icu/third_party/icu/i18n/listformatter.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_integerwidth.cpp + src/duckdb/extension/icu/third_party/icu/i18n/islamcal.cpp + src/duckdb/extension/icu/third_party/icu/i18n/iso8601cal.cpp + src/duckdb/extension/icu/third_party/icu/i18n/plurfmt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collation.cpp + src/duckdb/extension/icu/third_party/icu/i18n/persncal.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationdata.cpp + src/duckdb/extension/icu/third_party/icu/i18n/numrange_fluent.cpp + src/duckdb/extension/icu/third_party/icu/i18n/ucoleitr.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationfastlatinbuilder.cpp + src/duckdb/extension/icu/third_party/icu/i18n/ucal.cpp + src/duckdb/extension/icu/third_party/icu/i18n/unum.cpp + src/duckdb/extension/icu/third_party/icu/i18n/dtitvfmt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/reldtfmt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationsets.cpp + src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-fast-dtoa.cpp + src/duckdb/extension/icu/third_party/icu/i18n/ufieldpositer.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_padding.cpp + src/duckdb/extension/icu/third_party/icu/i18n/tztrans.cpp + src/duckdb/extension/icu/third_party/icu/i18n/dcfmtsym.cpp + src/duckdb/extension/icu/third_party/icu/i18n/numparse_affixes.cpp + src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-string-to-double.cpp + src/duckdb/extension/icu/third_party/icu/i18n/tzgnames.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationkeys.cpp + src/duckdb/extension/icu/third_party/icu/i18n/dtitvinf.cpp + src/duckdb/extension/icu/third_party/icu/i18n/datefmt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_modifiers.cpp + src/duckdb/extension/icu/third_party/icu/i18n/ulocdata.cpp + src/duckdb/extension/icu/third_party/icu/i18n/nfsubs.cpp + src/duckdb/extension/icu/third_party/icu/i18n/unumsys.cpp + src/duckdb/extension/icu/third_party/icu/i18n/numparse_validators.cpp + src/duckdb/extension/icu/third_party/icu/i18n/ucln_in.cpp + src/duckdb/extension/icu/third_party/icu/i18n/formatted_string_builder.cpp + src/duckdb/extension/icu/third_party/icu/i18n/uitercollationiterator.cpp + src/duckdb/extension/icu/third_party/icu/i18n/basictz.cpp + src/duckdb/extension/icu/third_party/icu/i18n/fmtable.cpp + src/duckdb/extension/icu/third_party/icu/i18n/currpinf.cpp + src/duckdb/extension/icu/third_party/icu/i18n/gender.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_currencysymbols.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_capi.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationiterator.cpp + src/duckdb/extension/icu/third_party/icu/i18n/zonemeta.cpp + src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-double-to-string.cpp + src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-strtod.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_patternmodifier.cpp + src/duckdb/extension/icu/third_party/icu/i18n/string_segment.cpp + src/duckdb/extension/icu/third_party/icu/i18n/sortkey.cpp + src/duckdb/extension/icu/third_party/icu/i18n/bocsu.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_decimalquantity.cpp + src/duckdb/extension/icu/third_party/icu/i18n/measunit.cpp + src/duckdb/extension/icu/third_party/icu/i18n/format.cpp + src/duckdb/extension/icu/third_party/icu/i18n/erarules.cpp + src/duckdb/extension/icu/third_party/icu/i18n/tzrule.cpp + src/duckdb/extension/icu/third_party/icu/i18n/olsontz.cpp + src/duckdb/extension/icu/third_party/icu/i18n/vzone.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationfcd.cpp + src/duckdb/extension/icu/third_party/icu/i18n/ucol_sit.cpp + src/duckdb/extension/icu/third_party/icu/i18n/pluralranges.cpp + src/duckdb/extension/icu/third_party/icu/i18n/numrange_capi.cpp + src/duckdb/extension/icu/third_party/icu/i18n/vtzone.cpp + src/duckdb/extension/icu/third_party/icu/i18n/winnmfmt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/tznames.cpp + src/duckdb/extension/icu/third_party/icu/i18n/ulistformatter.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationsettings.cpp + src/duckdb/extension/icu/third_party/icu/i18n/dtptngen.cpp + src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-bignum.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_fluent.cpp + src/duckdb/extension/icu/third_party/icu/i18n/standardplural.cpp + src/duckdb/extension/icu/third_party/icu/i18n/coleitr.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_symbolswrapper.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_output.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationdatareader.cpp + src/duckdb/extension/icu/third_party/icu/i18n/fphdlimp.cpp + src/duckdb/extension/icu/third_party/icu/i18n/astro.cpp + src/duckdb/extension/icu/third_party/icu/i18n/nfrule.cpp + src/duckdb/extension/icu/third_party/icu/i18n/compactdecimalformat.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationruleparser.cpp + src/duckdb/extension/icu/third_party/icu/i18n/timezone.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_utils.cpp + src/duckdb/extension/icu/third_party/icu/i18n/numparse_compositions.cpp + src/duckdb/extension/icu/third_party/icu/i18n/measfmt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/units_complexconverter.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationtailoring.cpp + src/duckdb/extension/icu/third_party/icu/i18n/tmutamt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/rbnf.cpp + src/duckdb/extension/icu/third_party/icu/i18n/numfmt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/taiwncal.cpp + src/duckdb/extension/icu/third_party/icu/i18n/gregoimp.cpp + src/duckdb/extension/icu/third_party/icu/i18n/msgfmt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/dangical.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_notation.cpp + src/duckdb/extension/icu/third_party/icu/i18n/buddhcal.cpp + src/duckdb/extension/icu/third_party/icu/i18n/choicfmt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_simple.cpp + src/duckdb/extension/icu/third_party/icu/i18n/udatpg.cpp + src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-bignum-dtoa.cpp + src/duckdb/extension/icu/third_party/icu/i18n/udat.cpp + src/duckdb/extension/icu/third_party/icu/i18n/alphaindex.cpp + src/duckdb/extension/icu/third_party/icu/i18n/currfmt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/quantityformatter.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationweights.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationdatabuilder.cpp + src/duckdb/extension/icu/third_party/icu/i18n/tznames_impl.cpp + src/duckdb/extension/icu/third_party/icu/i18n/windtfmt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/numparse_currency.cpp + src/duckdb/extension/icu/third_party/icu/i18n/hebrwcal.cpp + src/duckdb/extension/icu/third_party/icu/i18n/uregion.cpp + src/duckdb/extension/icu/third_party/icu/i18n/numsys.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationfastlatin.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationrootelements.cpp + src/duckdb/extension/icu/third_party/icu/i18n/double-conversion-cached-powers.cpp + src/duckdb/extension/icu/third_party/icu/i18n/gregocal.cpp + src/duckdb/extension/icu/third_party/icu/i18n/displayoptions.cpp + src/duckdb/extension/icu/third_party/icu/i18n/calendar.cpp + src/duckdb/extension/icu/third_party/icu/i18n/ztrans.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_longnames.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationcompare.cpp + src/duckdb/extension/icu/third_party/icu/i18n/utmscale.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_multiplier.cpp + src/duckdb/extension/icu/third_party/icu/i18n/udateintervalformat.cpp + src/duckdb/extension/icu/third_party/icu/i18n/numparse_parsednumber.cpp + src/duckdb/extension/icu/third_party/icu/i18n/zrule.cpp + src/duckdb/extension/icu/third_party/icu/i18n/numparse_decimal.cpp + src/duckdb/extension/icu/third_party/icu/i18n/fpositer.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_decimfmtprops.cpp + src/duckdb/extension/icu/third_party/icu/i18n/measunit_extra.cpp + src/duckdb/extension/icu/third_party/icu/i18n/indiancal.cpp + src/duckdb/extension/icu/third_party/icu/i18n/nfrs.cpp + src/duckdb/extension/icu/third_party/icu/i18n/utf8collationiterator.cpp + src/duckdb/extension/icu/third_party/icu/i18n/numrange_impl.cpp + src/duckdb/extension/icu/third_party/icu/i18n/formattedvalue.cpp + src/duckdb/extension/icu/third_party/icu/i18n/wintzimpl.cpp + src/duckdb/extension/icu/third_party/icu/i18n/numparse_symbols.cpp + src/duckdb/extension/icu/third_party/icu/i18n/cecal.cpp + src/duckdb/extension/icu/third_party/icu/i18n/numparse_impl.cpp + src/duckdb/extension/icu/third_party/icu/i18n/simpletz.cpp + src/duckdb/extension/icu/third_party/icu/i18n/coptccal.cpp + src/duckdb/extension/icu/third_party/icu/i18n/ucol.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_patternstring.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_mapper.cpp + src/duckdb/extension/icu/third_party/icu/i18n/upluralrules.cpp + src/duckdb/extension/icu/third_party/icu/i18n/smpdtfst.cpp + src/duckdb/extension/icu/third_party/icu/i18n/umsg.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationbuilder.cpp + src/duckdb/extension/icu/third_party/icu/i18n/formattedval_sbimpl.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_compact.cpp + src/duckdb/extension/icu/third_party/icu/i18n/currunit.cpp + src/duckdb/extension/icu/third_party/icu/i18n/curramt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_grouping.cpp + src/duckdb/extension/icu/third_party/icu/i18n/numparse_scientific.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationroot.cpp + src/duckdb/extension/icu/third_party/icu/i18n/region.cpp + src/duckdb/extension/icu/third_party/icu/i18n/tmutfmt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/scientificnumberformatter.cpp + src/duckdb/extension/icu/third_party/icu/i18n/units_router.cpp + src/duckdb/extension/icu/third_party/icu/i18n/chnsecal.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_formatimpl.cpp + src/duckdb/extension/icu/third_party/icu/i18n/smpdtfmt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_rounding.cpp + src/duckdb/extension/icu/third_party/icu/i18n/tmunit.cpp + src/duckdb/extension/icu/third_party/icu/i18n/dtfmtsym.cpp + src/duckdb/extension/icu/third_party/icu/i18n/dtrule.cpp + src/duckdb/extension/icu/third_party/icu/i18n/rulebasedcollator.cpp + src/duckdb/extension/icu/third_party/icu/i18n/decContext.cpp + src/duckdb/extension/icu/third_party/icu/i18n/formattedval_iterimpl.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_usageprefs.cpp + src/duckdb/extension/icu/third_party/icu/i18n/rbtz.cpp + src/duckdb/extension/icu/third_party/icu/i18n/collationdatawriter.cpp + src/duckdb/extension/icu/third_party/icu/i18n/tzfmt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/ethpccal.cpp + src/duckdb/extension/icu/third_party/icu/i18n/selfmt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/coll.cpp + src/duckdb/extension/icu/third_party/icu/i18n/utf16collationiterator.cpp + src/duckdb/extension/icu/third_party/icu/i18n/ucol_res.cpp + src/duckdb/extension/icu/third_party/icu/i18n/measure.cpp + src/duckdb/extension/icu/third_party/icu/i18n/number_affixutils.cpp + src/duckdb/extension/icu/third_party/icu/i18n/units_converter.cpp + src/duckdb/extension/icu/third_party/icu/i18n/plurrule.cpp + src/duckdb/extension/icu/third_party/icu/i18n/decimfmt.cpp + src/duckdb/extension/icu/third_party/icu/i18n/dayperiodrules.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 diff --git a/src/duckdb/extension/core_functions/aggregate/algebraic/avg.cpp b/src/duckdb/extension/core_functions/aggregate/algebraic/avg.cpp index 4b9a306ec..15d562f85 100644 --- a/src/duckdb/extension/core_functions/aggregate/algebraic/avg.cpp +++ b/src/duckdb/extension/core_functions/aggregate/algebraic/avg.cpp @@ -239,47 +239,59 @@ 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"); } } -LogicalType GetAvgStateType(const AggregateFunction &function) { - child_list_t children; - children.emplace_back("count", LogicalType::UBIGINT); - children.emplace_back("value", function.arguments[0]); - return LogicalType::STRUCT(std::move(children)); -} - unique_ptr BindDecimalAvg(ClientContext &context, AggregateFunction &function, vector> &arguments) { auto decimal_type = arguments[0]->return_type; function = GetAverageAggregate(decimal_type.InternalType()); function.name = "avg"; function.arguments[0] = decimal_type; - function.get_state_type = GetAvgStateType; function.SetReturnType(LogicalType::DOUBLE); return make_uniq( Hugeint::Cast(Hugeint::POWERS_OF_TEN[DecimalType::GetScale(decimal_type)])); @@ -290,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)); @@ -299,29 +312,30 @@ 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)); - - for (auto &function : avg.functions) { - function.get_state_type = GetAvgStateType; - } + LogicalType::TIME_TZ, LogicalType::TIME_TZ) + .SetStructStateExport(GetAvgStateType)); return avg; } AggregateFunction FAvgFun::GetFunction() { auto function = AggregateFunction::UnaryAggregate( - LogicalType::DOUBLE, LogicalType::DOUBLE); - function.get_state_type = GetAvgStateType; + LogicalType::DOUBLE, LogicalType::DOUBLE) + .SetStructStateExport(GetKahanAvgStateType); return function; } 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/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/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/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/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