Compare commits

...
Author SHA1 Message Date
Shane F. Carr 0bd125eb45 ICU-21480 Update double-conversion 2021-03-17 19:45:13 -05:00
Jeff Genovy 8c9c14e64c ICU-21542 Have GHA output ICU4J test failures if there are any. 2021-03-17 15:19:11 -07:00
Frank Tang cec7de7a39 ICU-21537 Fix invalid free by long locale name
Do not free baseName if it is pointing to fullNameBuffer.

Better Fix
2021-03-17 10:34:27 -07:00
gnrunge 3d7ba6560e ICU-21520 Fixes typo in name of test data file; removes a regex that
evaluates to the empty string and the result files are missing the
perf test name as a result. E.g. '_Mar_16_155820.html' instead of
'unisetperf_Mar_16_155820.html'.
Not obvious why the regex was even created since it doesn't seem
necessary because the name of the caller doesn't require additional
parsing. The rpaticular code is from 2002, maybe changes in Perl
account for the issue(?)
2021-03-16 20:01:16 -07:00
Elango Cheran 2ae2f31c2f ICU-21480 Change ICU4C/J Readme update date after version change 2021-03-16 13:34:06 -07:00
Craig Cornelius bc7e2e230c ICU-21480 Scrub TODOs for completed issues 21292 and 21236
See #1652
2021-03-16 11:17:14 -07:00
Elango Cheran 2273ebbc80 ICU-21480 fix logKnownIssue number 2021-03-16 09:17:03 -07:00
Craig Cornelius 0619ea317f ICU-21480 BRS-50: updated docmain.h
See #1647
2021-03-15 15:33:05 -07:00
Yoshito Umaoka 084d8bc8e2 ICU-21480 BRS69 clean up import statements 2021-03-15 15:40:49 -04:00
Yoshito Umaoka eab1c02d42 ICU-21480 BRS69 ICU4J 69 serialization test data
Also dropped ICU4J 64 test data.
2021-03-15 15:40:27 -04:00
Yoshito Umaoka e9b4964f00 ICU-21480 BRS69 ICU4J API signature file
- Supplied missing API comment to com.ibm.icu.nubmer.Precision#trailingZeroDisplay(TrailingZeroDisplay)
- Generated API signature file for ICU4J 69.1 and added to the repository
- Delete ICU4J 59 API signature file
- Deleted unused icu4j/eclipse-build/build.properties. The folder eclipse-build was deleted, but someone worked on ICU version seemed to add it back again. Delete it again.
2021-03-15 15:40:04 -04:00
Peter Edberg 34030d911e ICU-21480 brs 69rc, adjust nonstable API macros 2021-03-15 09:43:54 -07:00
Frank Yung-Fong Tang 1732ff4144 ICU-21534 Add notice about master to main rename
See #1638
2021-03-12 11:12:18 -08:00
Craig Cornelius 0fb132a35f ICU-21480 Update ICU4C APIChangeReport files 2021-03-12 10:32:32 -08:00
Craig Cornelius e47430d917 ICU-21480 Update ICU4J APIChangeReport.html to 69 2021-03-12 10:26:20 -08:00
gnrunge 22dace7f5f ICU-21323 Automates the uconfig variation BRS tasks. The test
subsequently sets each of the UCONFIG_NO_XXX flags to '1' (exceptions apply)
and runs the ICU4C unit tests and the header test. Afterwards all
UCONFIG_NO_XXX flags are set to '1' and unit tests and header test
are executed.

To allow concurrent execution and reduce total run time, the script provides
the option to execute only the unit tests or only the header test.

ICU-21323 Split the uconfig.h variation test into two to reduce
execution time. One test now tests the variations with unit tests, the
other tests with header test.
Execution time now ranges between 45 and 58 minutes.

ICU-21323 Works in review comments.

ICU-21323 Factors in more review comments.
2021-03-11 16:25:33 -08:00
Shane F. Carr c26d99b3a6 ICU-21330 Use =0 and =1 plural forms in compact notation
See #1632
2021-03-11 17:34:35 -06:00
Peter Edberg 6c26ea21b2 ICU-21341 for getISO codes, add some CLDR-valid regions, remove some CLDR-invalid langs 2021-03-11 14:31:07 -08:00
Peter Edberg 3dd1ca10df ICU-21532 In UTimeZoneLocalOption enum, add dummy value if U_HIDE_DRAFT_API 2021-03-11 10:40:24 -08:00
Peter Edberg 8bb71362f2 ICU-21480 integrate CLDR release-39-beta to ICU trunk 2021-03-11 08:43:25 -08:00
Craig Cornelius 3218440d5a ICU-21480 Change ICU 64 draft readResolve APIs to @internal
See #1637
2021-03-10 20:23:23 -08:00
Rich Gillam e43c4e5f1b ICU-21335 Disallowed looking up resources by index in table-based resources. 2021-03-10 16:51:51 -08:00
Frank Tang 63b9a8aea8 ICU-21041 Fix fuzzer memory read error.
See #1622
2021-03-10 15:26:52 -08:00
Peter Edberg 6cdfe2dc1f ICU-21480 brs 69rc, add tests to verify that rbnf spellout is the same for no,nb 2021-03-10 13:51:32 -08:00
Hugo van der Merwe 54b896962b ICU-21123 Calculate built-in units' gender when CLDR lacks the data
See #1620
2021-03-10 20:09:51 +01:00
Elango Cheran c263b5b370 ICU-21519 Add PluralOperand 'c' as alias to 'e', parse FixedDecimal strings 2021-03-09 16:55:33 -08:00
Craig Cornelius 2f89152830 ICU-21480 BRS#18 ICU4J promotions to stable 2021-03-09 13:14:45 -08:00
Shane F. Carr 74eb9e621b ICU-21397 Allow null to unset options in Java NumberRangeFormatter 2021-03-09 15:11:20 -06:00
Yoshito Umaoka 09149bc795 ICU-21207 Remove unnecessary reflection call
The test code was written long time ago. Java 1.3 TimeZone did not have getDSTSavings() method. The test code compares DST saving of Lord_Howe between ICU and JDK, and calling getDSTSavings() through reflection for 1.3 compatibility. This is no longer necessary and replaced with regular method call.
2021-03-09 16:07:47 -05:00
Yoshito Umaoka 33104d7eab ICU-20918 ucal_openTimeZones() to call ucal_openTimeZoneIDEnumeration()
See #1630
2021-03-09 14:22:16 -05:00
Hugo van der Merwe 864682f5dd ICU-21349 Delete MeasureUnitImpl copy constructor, drop an indirection 2021-03-09 20:04:57 +01:00
Markus Scherer 767598009d ICU-21368 unit-test & fix BytesTrie jump delta encoding 2021-03-08 17:18:14 -08:00
Hugo van der Merwe 18b23fb372 ICU-21313 UserGuide: use absolute GitHub links for links outside docs/
See #1625
2021-03-09 00:29:23 +01:00
abarberenaCPDS f397c0af3d ICU-21416 Update icu4c-readme.md
Syntax error, it should be:

git clone https://github.com/unicode-org/icu.git
2021-03-08 13:57:36 -08:00
Patrick Reader 00c106179f ICU-21416 Fix markdown formatting in userguide/strings 2021-03-08 13:56:20 -08:00
Peter Edberg b11ba74dd4 ICU-21480 brs 69rc, update urename.h pass 0 2021-03-08 11:15:49 -08:00
yumaoka d80f7bbd0e ICU-21498 Improve comment in uprv_tzname 2021-03-08 09:13:55 -08:00
Yoshito Umaoka d624e5fb4b ICU-21507 Removing unused class initializer code
ICUDebug seemed to check Java version whether it's 1.4 or higher. The code referencing the version is already gone. We also no longer support Java 1.3 runtime since long time ago. Remove the unused code checking Java version.
2021-03-08 09:13:30 -08:00
Frank Tang ce640dc850 ICU-21127 Error when rbbi got unpaired surrogate char
See #1520
2021-03-05 15:45:37 -08:00
younies b1a685a676 ICU-21349 calling .usage("") should unset the existing usage
See #1614
2021-03-06 00:37:06 +01:00
Frank Tang 75874eb0eb ICU-21521 Fix cast of uprv_strcmp
See #1618
2021-03-05 14:19:51 -08:00
gnrunge 90631ab807 ICU-21323 Automates BRS test task of build and run testmap.
ICU-21323 Removes compiler flag.
2021-03-05 11:01:42 -08:00
Hugo van der Merwe 119dfa4f24 ICU-21123 Support FormattedNumber::getGender() for "short" and "narrow" formatting too
See #1617
2021-03-05 00:32:30 +01:00
Shane F. Carr b79c299f90 ICU-20886 Implement trailingZeroDisplay
See #1583
2021-03-04 08:19:59 -07:00
Yoshito Umaoka 6bfa5c02ed ICU-21369 Remove @provisional API doc tags in ICU4J 2021-03-03 23:16:52 -08:00
Frank Tang d7fd8848b7 ICU-21222 Fix Era in Interval format
See #1373
2021-03-03 17:25:19 -08:00
Rich Gillam be039c5936 ICU-21480 Promoted all @draft ICU 67 APIs to @stable ICU 67. 2021-03-03 17:21:42 -08:00
Erik Torres 1bf2aa2354 ICU-21480 BRS69RC update readmes for RC
See #1615
2021-03-03 12:41:20 -08:00
gnrunge 65c1b9e690 ICU-21323 Automates BRS testing tasks of U_CHARSET_IS_UTF8 and
U_OVERRIDE_CXX_ALLOCATION=0.
2021-03-03 11:45:02 -08:00
Jeff Genovy 1fa3419812 ICU-21480 Update GitHub pull request template to prevent autolinking example ticket number. 2021-03-02 17:17:21 -08:00
Hugo van der Merwe 56fb139fc0 ICU-20941 Port Arbitrary Units support from ICU4C to ICU4J
See #1597
2021-03-02 20:34:19 +01:00
yumaoka 53aa0505c5 ICU-21372 getOffsetFromLocal for C and C++
See #1610
2021-03-02 10:21:28 -08:00
Hugo van der Merwe c231cf7c4f ICU-21349 ICU4J units cleanup: eclipse warnings, unsuppress one warning
toString() now uses category, so @SuppressWarnings("unused") is no
longer needed.
2021-03-02 18:54:22 +01:00
Yoshito Umaoka 86d06eca8b ICU-21490 Exposing getOffsetFromLocal for ICU4J
See #1609
2021-03-02 06:42:58 -08:00
Shane F. Carr e8dfea9bb6 ICU-21493 Add more rounding modes in ICU4C
See #1575
2021-02-27 11:25:08 -07:00
Shane F. Carr d7db6c1f86 ICU-20019 Implement withSignificantDigits option
See #1598
2021-02-27 02:01:21 -07:00
Yoshito Umaoka 3688b9b824 ICU-21370 Delete folder for eclipse plug-in build 2021-02-26 16:54:01 -08:00
Craig Cornelius 1a666c1029 ICU-21179 Remove unused code in Java break engines
See #1604
2021-02-26 15:29:26 -08:00
gnrunge 735645589e ICU-21323 Adds BRS task 'test ICU4C without data' to GHA, triggered by
each pull request. This test has a high catch rate.

ICU-21323 Work in review feedback.
2021-02-26 14:19:01 -08:00
Shane F. Carr e85938bd2c ICU-21203 ICU-21198 ICU-21479 Improve docs discoverability for NumberFormatter
See #1559
2021-02-25 14:16:25 -07:00
gnrunge 2415a6c5f6 ICU-21503 Adds status checks to prevent segmentation fault when test runs
with stubdata only.

ICU-21503 Changes the no-data checks according to review feedback.
2021-02-25 12:43:54 -08:00
Peter Edberg 31182a99b4 ICU-21480 integrate CLDR release-39-alpha4 to ICU trunk 2021-02-25 10:19:57 -08:00
Hugo van der Merwe 8b48e1862c ICU-20941 Fix uninitialized values: DerivedComponents' compound0_ and compound1_ 2021-02-24 21:15:50 -08:00
Shane F. Carr 1aa0dad8e0 ICU-21484 Add SignDisplay NEGATIVE 2021-02-25 03:10:27 +01:00
Jeff Genovy f23bd25ef5 ICU-21480 Update GitHub pull request template: JIRA issue number is needed on commit messages. 2021-02-24 17:13:17 -08:00
Andy Heninger fe9734a4f3 ICU-21346 Update user guide section on initialization.
This change is narrowly focused on the initialization and cleanup / termination
of ICU. The whole user-guide section (file) needs to be reviewed for out-of-date
information, but not as part of this change.
2021-02-24 15:15:31 -08:00
Hugo van der Merwe 6e91c7552e ICU-21480 Update French unit-times pattern in unit tests 2021-02-24 23:35:29 +01:00
Peter Edberg e9bb3e440e ICU-21480 integrate CLDR release-39-alpha3 to ICU trunk 2021-02-24 10:45:42 -08:00
younies f6361ebf76 ICU-21123 Support unit inflections in ICU4J
See #1590
2021-02-24 17:27:09 +01:00
Hugo van der Merwe aebe91cdda ICU-20941 Fix ResourceTable lifetime to make ResourceTracer happy
This is a separate commit from the previous ICU-20941 commit for the
sake of documentation / future code archaeology.

See #1588
2021-02-24 09:27:39 +01:00
Hugo van der Merwe b2d97ebcb4 ICU-20941 NumberFormatter: format arbitrary compound units, with inflections
See #1588.
2021-02-24 09:27:39 +01:00
Younies Mahmoud 2138ac8a0e ICU-21349 Add extra UnitsRouter constructor that takes only CLDR unit…
See #1579
2021-02-24 03:43:50 +00:00
Younies Mahmoud c825da1d29 ICU-21349 Add extra UnitsConverter constructor that takes only CLDR unit identifiers
See #1578
2021-02-24 02:06:43 +00:00
gnrunge 0a1352ee67 ICU-21502 Adds status checks to test to prevent segementation fault when
test runs with ICU stub data only.

ICU-21502 Review comments worked in.
2021-02-23 11:48:02 -08:00
Hugo van der Merwe aa9f5bc279 ICU-21432 Fix TestInternalMeasureUnitImpl() segfaulting with bad data 2021-02-23 17:32:55 +01:00
gnrunge 1cd98069ab ICU-21487 Moves performance test data files from the icu-data repository
to the icu repository. Added Unicode copyright notice to those files
that only have the IBM copyright notice.
A complimentary PR will remove data from the icu-data repository.

ICU-21487 Adds pure test data files which have no copyright notice to the
exemption list.
2021-02-22 13:23:50 -08:00
Jeff Genovy 997f88e94a ICU-21474 Update top-level README status badge to replace Travis CI with GitHub Actions. 2021-02-22 11:05:43 -08:00
Peter Edberg cf83c5b385 ICU-21480 integrate CLDR release-39-alpha2 to ICU trunk 2021-02-19 10:53:23 -08:00
Younies Mahmoud 00cedadc92 ICU-21349 Add extra ComplexUnitsConverter constructor that takes only CLDR units Identifier
See #1586
2021-02-19 07:54:39 +01:00
Jeff Genovy 9d8a70abdc ICU-21499 Suppress warnings about non-NULL address in uprv_memcpy and uprv_memmove 2021-02-18 12:27:51 -08:00
Christoph Gohlke 4fd9b8de8d ICU-21210 Fix static builds on Windows 2021-02-18 12:24:36 -08:00
Shane F. Carr b6687af59c ICU-20421 Add span fields to NumberRangeFormatter
See #1572
2021-02-18 09:56:48 -06:00
Andy Heninger f062244cdb ICU-21492 Fix regex compile assertion failure.
A regex pattern containing nested look-behind blocks could trigger an assertion
failure during pattern compilation. The problem was caused by an off-by-one
error in the code that computes an upper bound on the match length, needed
because look-behind expressions are constrained to not have unbounded match
length.

Nested look-behind blocks come into play because, when computing the maximum
match length of an outer block, any inner look-behind blocks are skipped over -
they do not directly contribute to the length matched by the outer block. The
problem was in the code that skips over these nested look-behind blocks.
2021-02-17 18:49:55 -08:00
Shane F. Carr 352b481146 ICU-21067 Maybe fix synchronization lint in MeasureUnit.java 2021-02-17 18:35:26 -06:00
Hugo van der Merwe 1dbe70ac18 ICU-21123 Support unit inflections in ICU4C
See #1574
2021-02-17 23:36:40 +01:00
Markus Scherer 66460b9fad ICU-13702 add missing API functions
and fix a bug in Java UnicodeSet.retain(String) which added the string even if the set did not contain it before,
and some drive-by API doc fixes/clarifications
2021-02-17 10:12:10 -08:00
Peter Edberg 7159e334ff ICU-21480 integrate CLDR release 39 alpha1 to ICU trunk 2021-02-16 21:44:12 -08:00
Hugo van der Merwe dcfa2a7874 ICU-21284 Deal with remaining unit normalization TODOs
See #1580
2021-02-16 20:52:12 +01:00
Erik Torres Aguilar 9c73e15d02 ICU-21480 BRS69RC Version update and regenerate configure for v69
See #1567
2021-02-11 15:43:55 -08:00
Peter Edberg 3333fd557c ICU-21480 integrate CLDR release 39 alpha0 to ICU trunk 2021-02-10 11:58:26 -08:00
younies 916b9fad75 ICU-21349 Add UnitsConverter.getConversionInfo(...)
See #1568
2021-02-10 14:10:44 +01:00
Shane F. Carr 993e58a2c9 ICU-20888 Hide or remove old list formatter methods 2021-02-09 22:38:11 -06:00
Hugo van der Merwe 84469100c5 ICU-21306 ldml2icu: add rules for Inflections-related CLDR data
See #1566
2021-02-10 01:08:50 +01:00
Shane F. Carr 8196fc14ac ICU-21275 Remove obsolete functions from numberrangeformatter.h 2021-02-09 16:10:20 -06:00
Victor Chang 048e46674a ICU-21455 Add new API ubrk_clone() and deprecate ubrk_safeClone() 2021-02-09 08:49:55 -08:00
Hugo van der Merwe c0a490d49d ICU-21284 Correctly normalize Unit Identifiers
See #1527
2021-02-09 12:52:05 +01:00
Shane F. Carr 9ac51f21ed ICU-21351 Don't coalesce adjacent list formatter fields in ICU4J 2021-02-08 20:49:03 -06:00
Markus Scherer 790dfcf0b7 ICU-21050 add detail for when need to ifndef C++ boilerplate 2021-02-08 15:27:03 -08:00
Hugo van der Merwe 7feb300a87 ICU-21284 More MeasureFormatTest and NumberFormatterApiTest test cases
See #1530
2021-02-08 21:51:24 +01:00
Hugo van der Merwe 377dc22280 ICU-21349 Fix ICU4J reciprocal unit conversions
See #1565
2021-02-05 18:29:31 -08:00
Michael Block a138318922 ICU-21179 Clean up unused code in the RBBI dictbe
The wordsMatched conditional gave the misleading impression that only the first "first word" candidate that was followed by a dictionary word would be marked, but because the wordsMatched declaration is inside the while loop, every "first word" candidate that's followed by a dictionary word is marked (resulting in the shortest and not the longest first candidate that's followed by a second dictionary word).
2021-02-04 17:55:05 -08:00
Craig Cornelius 45b8834e7a ICU-21440 letest updated to true/false from TRUE/FALSE 2021-02-04 14:55:37 -08:00
Younies Mahmoud 412ac386f4 ICU-21349 Change UnitConverter name to UnitsConverter
See #1557
2021-02-03 14:50:04 +01:00
Hugo van der Merwe 8e69552228 ICU-21451 Implement inverse unit handling for new consumption unit preferences in CLDR
See #1550
2021-02-03 00:42:43 +01:00
Hugo van der Merwe 5dc0513b29 ICU-21472 Update ICU to support latest CLDR units updates (ofglucose, new constants)
See #1545
2021-02-02 12:34:17 +01:00
Markus Scherer 5a7a8f015c ICU-21461 uprops.h: remove unused gc macros
and some underused character constants
2021-02-01 18:45:59 -08:00
Markus Scherer 9d4beab200 ICU-13435 more RTL languages 2021-02-01 16:43:24 -08:00
Jeff Genovy 8082d0e145 ICU-21449 Infinite loop can occur with locale IDs that contain RES_PATH_SEPARATOR 2021-01-29 13:10:34 -08:00
Frank Tang b82dc88148 ICU-21466 Remove size limit of intvector
See #1537
2021-01-28 16:45:24 -08:00
Jeff Genovy 56b4630ada ICU-21473 Enable GHA CI on maint/maint* branches 2021-01-27 18:20:52 -08:00
Hugo van der Merwe 01da2732b7 ICU-21349 Improve forIdentifier docs to exclude long_unit_identifier. 2021-01-27 19:02:45 +01:00
Hugo van der Merwe 1c61c57ece ICU-21357 Support IEC Binary Prefixes in MeasureUnit
See #1474
2021-01-27 15:34:10 +01:00
yumaoka 7c412f9c8f ICU-21467 tzdata 2021a updates 2021-01-27 00:44:56 -05:00
Jeff Genovy a1a1fafb7d ICU-21465 Fix Windows Time Zone mapping when the Automatic DST setting is OFF. 2021-01-26 15:43:40 -08:00
gnrunge 3c9f5aa9b2 ICU-21464 Modifies comments to address warnings when Doxygen 1.8.20 is used to
build the ICU4C docs. Typical changes: avoid linebreaks in {@link ...}
declarations, remove duplicate @param declaration.
The document building task in GHA CI is designed to fail upon warnings but
currently still passes because GHA uses an older version of Doxygen.

ICU-21464 Fix a typo.
2021-01-26 15:13:58 -08:00
gnrunge a3e5065340 ICU-21469 Remove .travis.yml file now that continuous integration tasks have been moved to GHA. 2021-01-26 13:21:33 -08:00
gnrunge 38125f3c50 ICU-21450 Migrates ICU4C document build with doxygen from Travis CI to GHA CI. 2021-01-25 14:18:15 -08:00
George Rhoten 747f5cd924 ICU-21462 ICULocaleService.java has a race condition 2021-01-22 11:05:08 -08:00
gnrunge e5a3f2baa7 ICU-21450 Add builds for MacOS and with extra warnings to GHA CI.
ICU-21450 Fix indent.

ICU-21450 Factor in review comments.
2021-01-21 16:05:13 -08:00
Long Nguyen 6092942e23 ICU-21435 Remove -Bsymbolic flag for mingw targets 2021-01-20 11:31:49 -08:00
younies b594f4b2a9 ICU-21349 Enhance Supporting Mixed Unit (such as "inch-and-foot")
See #1363
2021-01-20 17:50:36 +01:00
gnrunge c7ea02fcca ICU-21450 Add asan check, tsan check, gcc debug build and test, gcc 8 build and
test, and ICU4C release tools buildability check GitHub Action Continuous Integration.

ICU-21450 Minor fixes from review comments.

ICU-21450 One line break was missing.
2021-01-20 08:44:43 -08:00
Younies Mahmoud 6562ac57df ICU-21349 move testConverter from C++ to Java
See #1532
2021-01-20 11:48:41 +01:00
Jeff GenovyandVictor Chang dc5ab7aa6e ICU-21427 Don't ignore already checked-in files under "tools/cldr/lib".
Co-authored-by: Victor Chang <vichang@google.com>
2021-01-19 17:08:15 -08:00
Younies Mahmoud 0895a223a3 ICU-21349 Adjust C++ MeasureUnitImpl::serialize to be as same as the Java one
See #1496
2021-01-13 22:31:05 +01:00
Victor Chang 3b1ec5032c ICU-21116 Fix ListFormatterTest on Android
Android ignores assert statement by default.
The test also failed when running with ant and on OpenJDK runtime
on release-67-1. But no longer fails on master branch.
2021-01-13 00:38:37 -06:00
Markus Scherer fc12cf095c ICU-21279 decompose (NFD/NFKD) UTF-8 with Edits
See #1518
2021-01-07 15:38:16 -08:00
yumaoka 25eb1510ec ICU-21448 Update ICU tzdata to 2020f 2021-01-06 21:44:07 -05:00
Erik Torres Aguilar bd3b202741 ICU-21018 Fix typos across repo that start with letter A
See #1506
2021-01-06 15:15:35 -08:00
Erik Torres Aguilar 6eea259143 ICU-21018 Fix typos across repo that start with letter C
See #1525
2021-01-06 15:15:26 -08:00
Markus Scherer dea5448cb1 ICU-13702 C++ UnicodeSet cleanup: use UTF-16 literals 2020-12-29 19:07:55 -08:00
Markus Scherer 67cc873789 ICU-20698 C++ Hashtable allow integer value zero 2020-12-29 13:47:17 -08:00
Markus Scherer 1863bea230 ICU-20698 UHashtable allow integer value zero 2020-12-29 10:33:33 -08:00
Markus Scherer 9963b4d62a ICU-13702 allow empty string in UnicodeSet
See #1519
2020-12-29 09:33:35 -08:00
Ken Harris fb715eab4c ICU-21416 Fix typos and formatting errors in regexp.md
See ICU-20088, which seems to be where most of them were introduced.
2020-12-16 21:15:34 -08:00
Steven R. Loomis 8d2360ae6e ICU-13837 c build: make --disable-layoutex the default
- update GitHub workflow / Azure pipeline to no longer specify layoutex

Also:
- update configure.ac that was missed in #1265 cad3903cc2 ICU-21051
- some FALSE/TRUE were missed in source/test/letest
2020-12-15 10:35:59 -06:00
Peter Edberg c023eef140 ICU-21405 brs 68.2, update urename.h 2020-12-14 13:01:30 -08:00
gnrunge ce00ef1c99 ICU-21423 Remove obsolete scriptfile bomfix.py 2020-12-14 09:47:50 -08:00
gnrunge 8078ae4937 ICU-21434 First version of a GitHub Action CI script. Contains selected CI targets
migrated from Travis CI.

ICU-21434 Shorten the GitHub Action name to ICU CI only to leave more space on the dashboard.

ICU-21434 Review comments: better name, and one line turned out to be a no-op.

ICU-21434 Fix Java JDK version setting.

ICU-21434 Sort out Java version setting.

ICU-21434 Adds an entry to icu4c/source/test/depstest/dependencies.txt to fix depstest
and enable depstest.
2020-12-11 19:12:30 -08:00
Erik Torres Aguilar 17f725fe0d ICU-21118 check that dst and src are not null in uprv_memcpy
See #1489
2020-12-10 10:59:49 -08:00
Markus Scherer 3d62b74392 ICU-20107 binary compat: APIs may move between libraries 2020-12-09 16:49:37 -08:00
inokawa bb5d29b143 ICU-21416 Fix typos in comments 2020-12-09 14:17:14 -08:00
Frank Tang d9ff1888ee ICU-21414 Fix toLanguageTag x-private
Also fix ICU-21433 forLanguageTag when there are variant and -x-
extension
2020-12-08 22:51:18 -08:00
gnrunge 563f8b550a ICU-21431 Adds a check to an ICU4C unit test to prevent a segmentation fault
if this test runs without ICU data.
2020-12-08 14:25:42 -08:00
Frank Tang c3ed0c5371 ICU-21430 propagate error code 2020-12-07 23:03:23 -08:00
Frank Tang 5f8df0d288 ICU-21406 canonicalize -T- extension
See #1491
2020-12-07 21:21:41 -08:00
yumaoka 32ba41e22f ICU-21363 Resurrect support for IBM's XL compiler
Yoshito is making this change on behalf of @datalogics-robb.
IBM's XL compiler can only support c++11 when the 'clang front end' is used.
This change modifies the configure step to use xlclang and  xlclang++
Change readme.html reference to xlC to refer to xlclang++ instead.
2020-12-07 16:13:17 -05:00
Jeff Genovy 8f787b6de9 ICU-21388 Remove test case that does nothing so that we can mark RuleBasedCollator as final. 2020-12-04 15:47:40 -08:00
Elango Cheran 0a99ef6737 ICU-21405 Update ICU4J Readme for BRS 68.2 2020-12-04 12:57:55 -08:00
Erik Torres Aguilar 89721186ab ICU-21405 BRS 68.2 Version update and regenerate configure for v68.2 2020-12-04 09:28:19 -08:00
Hugo van der Merwe 9fea015fe9 ICU-21306 Pull CLDR's compoundUnitPattern1's into ICU
See #1487
2020-12-04 10:47:19 +01:00
Hugo van der Merwe 9a28523b6e ICU-21349 ensure parser behave the same and add import test cases to Java Code
See #1493
2020-12-04 04:36:22 +04:00
Elango Cheran 73ab117a2d ICU-21310 finish converting ICU4C and ICU4J Readmes to Markdown 2020-12-03 13:12:15 -08:00
Jeff Genovy 45e98a9157 ICU-21377 Add Google Analytics to the ICU User Guide. 2020-12-03 11:57:21 -08:00
Hugo van der Merwe 14c1c0861c ICU-21349 Add update instructions for unitConstants. Plus minor fixes.
See #1480
2020-12-03 12:48:01 +01:00
Hugo van der Merwe 9c73048681 ICU-21349 Import 'Updating Measure Unit' sites page, improve formatting.
Sites page was last updated on: 21 Oct 2020.

See #1480
2020-12-03 12:48:01 +01:00
Frank Tang 63cd3a7d40 ICU-21419 Fix memory leak in AliasReplacer 2020-12-02 10:44:45 -08:00
gnrunge d0096a84e7 ICU-21243 Migrates preparseucd.py script to Python 3. Python 3 changes
the order of elements in an iterator from Python 2 with the result
that the generated data in ppucd.txt changes with respect to the selection
of a property value used to compact the output when there is a
property with equal count of the two most frequent values. This
change doesn't change the validity of the generated ppucd.txt file.

While at it, also migrated script parsescriptmetadata.py to Python 3.
2020-12-01 13:02:52 -08:00
younies c07264a363 ICU-21349 Make appendSingleUnit behaviour in C++ comply with Java
See #1486
2020-12-01 01:42:17 +04:00
Hugo van der Merwe 917188dc7f ICU-21306 Pull CLDR 38's unit prefixes into ICU
See #1483
2020-11-30 16:52:52 +01:00
Hugo van der Merwe 3d706fac42 ICU-21349 fix comment for CLDR identifiers
See #1481
2020-11-25 19:36:08 +04:00
Frank Tang 1aa229daff ICU-21402 replace sd and rg by subdivisionAlias
See #1475
2020-11-24 17:22:12 -08:00
Hugo van der Merwe 35e950d35f ICU-21387 measunit: check for nullptr before calling delete 2020-11-25 00:19:07 +01:00
Frank Tang 0ab995ec84 ICU-21408 Prohibit alpha4 as language inside tlang. 2020-11-24 14:16:02 -08:00
Frank Tang 275d59aa2a ICU-21410 fix int32_t overflow in listFormat
See #1479
2020-11-23 17:12:30 -08:00
Jeff Genovy 6ad0ece034 ICU-21381 AppVeyor CI Builds: Speed up the Cygwin setup download. 2020-11-19 18:09:27 -08:00
Frank Tang 916f6a0b73 ICU-21401 Fix C++ canonicalize cel-gaulish to xtg
Java is already doing so.
2020-11-19 16:48:30 -08:00
Hugo van der Merwe f7ab1f7c50 ICU-21349 Fix confusing names of exponent variables.
See #1464
2020-11-17 23:54:25 +01:00
Hugo van der Merwe 50bd7969c7 ICU-21349 Remove a potential 0/0 (=NaN). Align C++ & Java better. 2020-11-17 20:21:39 +01:00
Shane F. Carr a593239dba ICU-21389 Merge maint/maint-68 to master 2020-11-16 18:50:26 -06:00
Frank Tang ceeb53ac78 ICU-21391 Make test/perf compile 2020-11-16 15:18:35 -06:00
Shane F. Carr f48165d9cc ICU-21394 Don't use null to test for unset ICU4J NumberFormatter options
See #1466
2020-11-16 15:13:40 -06:00
Frank Tang 8251d93e82 ICU-21395 Fix UBSan breakage on 8bit of rbbi 2020-11-16 10:16:40 -08:00
younies 909f343cd6 ICU-21349 Improve MeasureUnit comparators
See #1433
2020-11-13 23:36:00 +04:00
Jeff Genovy a78b49bec9 ICU-21392 Fix Windows Time Zone detection when more than one possible zone. 2020-11-13 00:13:34 -08:00
Frank Tang 9663195189 ICU-21385 Fix assertion when setKeywordValue w/ long value.
See #1461
2020-11-12 10:00:28 -08:00
Hugo van der Merwe 7c9bad02d2 ICU-21366 testConverter: allow some double-precision error for 0.0
See #1443
2020-11-11 18:31:18 +01:00
Shane F. Carr e7f66732f8 ICU-21383 Fix memory problem in FormattedStringBuilder 2020-11-11 09:40:12 -06:00
Craig Cornelius 50f3d01553 ICU-21361 Add public PGP key 2020-11-10 13:50:58 -08:00
Frank Tang 916932648d ICU-21373 Remove wrong cast to avoid CFI 2020-11-09 15:13:59 -08:00
Corey Taylor 0912b85193 ICU-10997 Port test case for 10997 currency formatting to icu4c 2020-11-05 23:17:33 -06:00
Hugo van der Merwe 5a75375222 ICU-21349 Refactor testComplexUnitsConverter
See #1441
2020-11-04 18:07:35 +01:00
Hugo van der Merwe 710fa5aaf9 ICU-20941 Support formatting joule-per-furlong (builtin-per-builtin).
See #1409
2020-11-04 18:07:09 +01:00
Hugo van der Merwe 7c8f857da8 ICU-21356 Fix memory handling in MemoryPool::operator=()
See #1437
2020-10-29 12:14:52 +01:00
Jeff Genovy 5d81f6f9a0 ICU-21250 Update Apache Ant to 1.10.9 2020-10-27 23:51:24 -04:00
yumaoka cf88993f02 ICU-21355 Fixed UCONFIG_NO_FORMATTING=1 build issue for ICU 68.1 release. 2020-10-27 13:50:36 -04:00
Hugo van der Merwe 21dde41f9e ICU-21349 Some improvements to UnitsTest
See #1421
2020-10-27 14:23:08 +01:00
Jeff Genovy df72f8cbaf ICU-21352 ICU4C: Windows time zone detection can fail in RDP sessions with some 3rd party software and older RDP clients 2020-10-26 12:39:14 -04:00
Craig Cornelius c7024d5faa ICU-21250 Update ICU4J and ICU4C APIChangeReports
See #1431
2020-10-23 22:18:19 -07:00
Shane F. Carr 86f00ad7fb ICU-21340 Don't coalesce adjacent list formatter fields in ICU4C
See #1425
2020-10-23 20:37:07 -05:00
Rich Gillam 87643423be ICU-21343 Added code to keep us from messing up quoted literal pattern text when performing find-and-replace
operations on it.
2020-10-23 10:05:01 -07:00
Peter Edberg 97eec046df ICU-21250 integrate CLDR release-38-final0 to ICU trunk 2020-10-23 08:45:50 -07:00
yumaoka c5f182464e ICU-21350 tz database 2020d updates 2020-10-23 08:41:50 -07:00
Rich Gillam d1581238f4 ICU-21342 Made sure adjustFieldWidth() got called on the duplicated hour pattern used for UCAL_AM_PM in 24-hour patterns. 2020-10-22 21:25:55 -07:00
Frank Tang 9a82de789f ICU-21344 merge localebuilder into resourcebundle 2020-10-22 17:44:34 -07:00
younies dd87efa299 ICU-21308 Fix icu4j build for Java 7 in MeasureUnitImpl
See #1428
2020-10-22 21:31:31 +04:00
Shane F. Carr 340271c225 ICU-21334 Promote ICU4C ListFormatter openForType to stable.
Also fixes ICU-20957 and ICU-21286.
2020-10-22 01:48:50 -05:00
yumaoka 9dcac1b6ca ICU-21348 tz database 2020c updates 2020-10-21 20:29:11 -04:00
Frank Tang 9ab5487eb8 ICU-21344 Fix wrong passing of script in Locale.
Also add same unit test in Java which have no problem.
2020-10-21 16:46:01 -07:00
Shane F. Carr 766088ddb3 ICU-21333 Port fix from ICU-21258 to internal CLDR API 2020-10-21 11:16:48 -07:00
Hugo van der Merwe eb3bb792cd ICU-21339 toSkeleton: treat percent and permille correctly
See #1414
2020-10-21 19:37:14 +02:00
Hugo van der Merwe 0439cc5f7b ICU-21311 Fix code generation in MeasureUnitTest.java and use it 2020-10-20 23:52:14 +02:00
Hugo van der Merwe 1b11fae07b ICU-21337 Remove U_I18N_API from enum. 2020-10-20 19:21:27 +02:00
younies 1a4727924f ICU-21308 Fix units parser thread safety issue
See #1402
2020-10-20 20:10:47 +04:00
Peter Edberg acd571a4d2 ICU-21250 integrate CLDR release-38-beta3 to ICU trunk 2020-10-19 19:27:52 -07:00
Hugo van der Merwe 57820a495d ICU-21337 Remove U_I18N_API from enum. 2020-10-20 03:26:44 +02:00
Rich Gillam 2908e11a49 ICU-21326 Changed res_findResource() so that it doesn't try index-based lookup in a table resource if the resource ID has a leading zero
(cherry picked from commit af7ed1f6d2)
2020-10-15 14:37:36 -07:00
Jeff Genovy d672b7bd4c ICU-21336 Fix format string to use long instead of int. 2020-10-15 10:50:30 -07:00
Rich Gillam af7ed1f6d2 ICU-21326 Changed res_findResource() so that it doesn't try index-based lookup in a table resource if the resource ID has a leading zero 2020-10-14 20:24:29 -07:00
Erik Torres Aguilar 93deb0e448 ICU-21250 BRS68GA Update version numbers for 68GA and regenerate jar files
See #1404
2020-10-14 11:38:45 -07:00
Peter Edberg d1dcb69318 ICU-21249 integrate CLDR release-38-beta2 to ICU trunk 2020-10-09 14:54:02 -07:00
Peter Edberg 0583afebf3 ICU-13259 Check whether ulocdata_getDelimiter works in various locales including fr_CA 2020-10-09 10:01:30 -07:00
yumaoka 0080c0c5e7 ICU-21325 tz database 2020b updates 2020-10-09 12:49:15 -04:00
Artemkth 6e99377bc5 ICU-20677 Fixing cygwin/MSVC build
See #1398
2020-10-08 11:11:11 -07:00
Craig Cornelius a3d83dedba ICU-21249 Update instructions for generating C++ API change reports 2020-10-07 21:24:21 -07:00
Frank Tang f1a8a63f06 ICU-21316 Fix bug under different default locales
See #1399
2020-10-07 21:05:29 -07:00
Richard Gillam 5de5cabfb0 ICU-21249 Add new U_HIDE_INTERNAL_API guards 2020-10-06 10:09:18 -07:00
Markus Scherer d533fd5719 ICU-20853 undef Solaris x86 register macros where they conflict 2020-10-02 14:20:44 -07:00
Markus Scherer b74b0c957e ICU-20901 VersionInfo.compareTo() compare signed version int as unsigned 2020-10-02 13:08:47 -07:00
Norbert Runge c0d4065607 ICU-21249 Adds error code check to prevent segmentation fault if
See #1356
2020-10-02 09:57:19 -07:00
Elango Cheran 6700602974 ICU-21270 Support exponent in FixedDecimal and samples in C++ 2020-10-02 09:21:29 -07:00
Elango Cheran c4fa504fec ICU-21249 BRS68RC Remaining updates for Readmes for ICU4C and ICU4J 2020-10-01 17:57:16 -07:00
Markus Scherer ff7cc3f1a8 ICU-21249 add unumberrangeformatter.h to API docs main page 2020-10-01 15:37:42 -07:00
Craig Cornelius a61c6ff23a ICU-21249 API Change Reports for C++
See #1387
2020-10-01 12:55:49 -07:00
Jeff Genovy 6c9655060b ICU-21249 Fix warnings about uninitialized variables in locid.cpp 2020-10-01 11:57:24 -07:00
Yoshito Umaoka 9b9db682e1 ICU-21249 API signature file for ICU 68
Also fixed some API docs missing @provisional
2020-10-01 14:35:53 -04:00
Yoshito Umaoka 1d3277bfc2 ICU-21249 ICU4J 68 serialization test data 2020-10-01 13:29:02 -04:00
Yoshito Umaoka 69d1a465dc ICU-21249 Fixed warnings in last minute changes for 68RC 2020-10-01 13:28:22 -04:00
Fredrik Roubert 692005d348 ICU-20963 Remove executable bit from .clang-format file.
This configuration file was marked executable by mistake.
2020-10-01 10:58:04 -05:00
Hugo van der Merwe a84fdd0e90 ICU-21266 Support toSkeleton() for all functional Unit Formatters
See #1347
2020-10-01 02:51:27 +02:00
Hugo van der Merwe a08ac00c67 ICU-21304 Update old userguide links to unicode-org.github.io 2020-10-01 01:28:05 +02:00
Hugo van der Merwe 9cb611d09f ICU-20568 Improve negative measure handling for mixed units
See #1379
2020-10-01 00:12:09 +02:00
Jeff Genovy 75e7e0bb08 ICU-21249 Change AppVeyor to not use parallel build due to Cygwin stability issues. 2020-09-30 15:06:48 -07:00
Jeff Genovy 309852e3df ICU-21278 Add Ubuntu 20.04 build bot to CI builds. 2020-09-30 14:44:49 -07:00
Yoshito Umaoka 8caba0e6c9 ICU-21249 Fixed some coding problems found by Spotbugs
See #1382
2020-09-30 15:55:29 -04:00
yumaoka 54e7bace04 ICU-21249 Fixing java/javadoc compiler warnings.
See #1381
2020-09-30 14:10:10 -04:00
1575 changed files with 257464 additions and 74712 deletions
+9 -3
View File
@@ -4,7 +4,7 @@ image: Visual Studio 2017
platform: x64
# Don't clone the entire repo.
clone_depth: 10
clone_depth: 5
# Cache things between builds to speed things up and save bandwidth.
cache:
@@ -54,8 +54,14 @@ for:
if ( !(Test-Path "${env:CYG_CACHED_SETUP}" -NewerThan (Get-Date).AddDays(-7)) )
{
Write-Host "Cached Cygwin setup does not exist or is older than 7 days, downloading from external site."
New-Item -Force -Type Directory $env:CYG_CACHE
Invoke-WebRequest $env:CYG_URL -OutFile $env:CYG_CACHED_SETUP
Write-Host "Downloading Cygwin setup..."
$start_time = Get-Date
(New-Object System.Net.WebClient).DownloadFile($env:CYG_URL, $env:CYG_CACHED_SETUP)
Write-Output "Download took: $((Get-Date).Subtract($start_time).Seconds) second(s)."
}
- cmd: >-
%CYG_CACHED_SETUP% --no-verify --quiet-mode --no-shortcuts --no-startmenu --no-desktop --upgrade-also --only-site --site "%CYG_MIRROR%" --root "%CYG_ROOT%" --local-package-dir "%CYG_CACHE%" --packages "%CYG_PACKAGES%"
@@ -66,7 +72,7 @@ for:
- "%CYG_ROOT%\\bin\\sh -lc 'uname -a'"
build_script:
- '%CYG_ROOT%\\bin\\bash -lc "cd $(cygpath ${APPVEYOR_BUILD_FOLDER}) && cd icu4c/source && ./runConfigureICU Cygwin && make -j2 check"'
- '%CYG_ROOT%\\bin\\bash -lc "cd $(cygpath ${APPVEYOR_BUILD_FOLDER}) && cd icu4c/source && ./runConfigureICU Cygwin && make check"'
# -
# matrix:
+19 -2
View File
@@ -17,8 +17,9 @@ jobs:
displayName: 'Build and Test'
env:
BUILD: ICU4J
# exit with a non-zero status in order to make this step show as a red X in the UI.
- script: |
[ -d icu4j/out/junit-results ] && cd icu4j && cat `find out/junit-results -name "*.txt" -exec grep -l FAILED {} \;`
[ -d icu4j/out/junit-results ] && cd icu4j && cat `find out/junit-results -name "*.txt" -exec grep -l FAILED {} \;` && exit 1
condition: failed() # only run if the build fails.
displayName: 'List failures (if any)'
#-------------------------------------------------------------------------
@@ -90,12 +91,28 @@ jobs:
lfs: true
fetchDepth: 10
- script: |
export CXXFLAGS="-std=c++14 -Winvalid-constexpr" && cd icu4c/source && ./runConfigureICU --enable-debug --disable-release Linux --disable-layout --disable-layoutex && make -j2 check
export CXXFLAGS="-std=c++14 -Winvalid-constexpr" && cd icu4c/source && ./runConfigureICU --enable-debug --disable-release Linux && make -j2 check
displayName: 'Build and Test C++14'
env:
CC: clang
CXX: clang++
#-------------------------------------------------------------------------
- job: ICU4C_GCC_Ubuntu_2004
displayName: 'C: Linux GCC (Ubuntu 20.04)'
timeoutInMinutes: 30
pool:
vmImage: 'ubuntu-20.04'
steps:
- checkout: self
lfs: true
fetchDepth: 10
- script: |
cd icu4c/source && ./runConfigureICU Linux && make -j2 check
displayName: 'Build and Test'
env:
CC: gcc
CXX: g++
#-------------------------------------------------------------------------
# VS 2019 Builds
#-------------------------------------------------------------------------
- job: ICU4C_MSVC_x64_Release_Distrelease
+1 -1
View File
@@ -47,7 +47,7 @@ jobs:
displayName: 'Install valgrind'
timeoutInMinutes: 5
- script: |
cd icu4c/source && ./runConfigureICU --enable-debug Linux --disable-renaming --disable-layout --disable-layoutex && make -j2 tests
cd icu4c/source && ./runConfigureICU --enable-debug Linux --disable-renaming && make -j2 tests
displayName: 'Build'
timeoutInMinutes: 10
env:
+7
View File
@@ -27,6 +27,7 @@ KEYS
*.dat
*.DS_Store
*.doc
*.fuzz
*.gif
*.gz
*.ico
@@ -97,6 +98,12 @@ icu4j/main/tests/core/src/com/ibm/icu/dev/data/unicode/confusablesWholeScript.tx
icu4j/main/tests/core/src/com/ibm/icu/dev/data/unicode/UnicodeData.txt
icu4j/main/tests/core/src/com/ibm/icu/dev/test/duration/testdata/*
icu4j/perf-tests/data/conversion/*
icu4j/perf-tests/data/udhr/*
icu4j/perf-tests/data/collation/thesis.txt
icu4j/perf-tests/data/collation/ulyss10.txt
icu4j/perf-tests/data/collation/2drvb10.txt
icu4j/perf-tests/data/collation/vfear11a.txt
icu4j/perf-tests/data/collation/nvsbl10.txt
#
# docs
#
+10 -8
View File
@@ -1,18 +1,20 @@
<!--
Thank you for your pull request.
Thank you for your pull request!
Please see http://site.icu-project.org/processes/contribute for general
information on contributing to ICU.
You will be automatically asked to sign the contributors license before the PR is accepted.
You will be automatically asked to sign the contributors license agreement (CLA) before the PR is accepted.
- sign: https://cla-assistant.io/unicode-org/icu
- license: http://www.unicode.org/copyright.html
-->
##### Checklist
- [ ] Issue filed: https://unicode-org.atlassian.net/browse/ICU-_____
- [ ] Updated PR title and link in previous line to include Issue number
- [ ] Issue accepted
- [ ] Tests included
- [ ] Documentation is changed or added
- [ ] Required: Issue filed: https://unicode-org.atlassian.net/browse/ICU-_____
- [ ] Required: The PR title must be prefixed with a JIRA Issue number. <!-- For example: "ICU-1234 Fix xyz" -->
- [ ] Required: The PR description must include the link to the Jira Issue, for example by completing the URL in the first checklist item
- [ ] Required: Each commit message must be prefixed with a JIRA Issue number. <!-- For example: "ICU-1234 Fix xyz" -->
- [ ] Issue accepted (done by Technical Committee after discussion)
- [ ] Tests included, if applicable
- [ ] API docs and/or User Guide docs changed or added, if applicable
+272
View File
@@ -0,0 +1,272 @@
# Copyright (C) 2016 and later: Unicode, Inc. and others.
# License & terms of use: http://www.unicode.org/copyright.html
#
# GitHub Action configuration script for ICU continuous integration tasks.
name: GHA CI
on:
push:
branches:
- master
- 'maint/maint*'
pull_request:
branches: '**'
jobs:
# ICU4C docs build using doxygen..
icu4c-docs-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: ICU4C doc
run: |
sudo apt-get -y install doxygen;
cd icu4c/source;
./runConfigureICU Linux --disable-renaming;
# Fail if 'warning:' appears in doxygen's output, but ignore warnings from file Doxyfile.
# Regex note: (?! ... ) is a negative lookahead. Succeed if the pattern is not present.
set +o pipefail && make doc 2>&1 | tee doxygen.log && ( ! grep -P 'warning:(?! .* file .?Doxyfile)' doxygen.log )
# ICU4J build and unit test
icu4j-build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout and setup
uses: actions/checkout@v2
with:
lfs: true
- name: Checkout lfs objects
run: git lfs pull
- uses: actions/setup-java@v1
with:
java-version: '11'
- name: ICU4J
run: |
cd icu4j;
ant init;
ant check;
- name: List failures (if any)
run: |
[ -d icu4j/out/junit-results ] && cd icu4j && cat `find out/junit-results -name "*.txt" -exec grep -l FAILED {} \;`;
if: ${{ failure() }}
# gcc debug build.
# Includes dependency checker.
# Note - the dependency checker needs to be run on both a debug and an optimized build.
# This one (gcc) for debug, and linux clang (see job below) for optimized.
#
# Test both out-of-source and in-source builds. This one (gcc) for out-of-source,
# and linux clang (below) for in-source.
#
# Invokes test/hdrtst to check public headers compliance.
gcc-debug-build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: ICU4C with gcc
env:
PREFIX: /tmp/icu-prefix
run: |
mkdir build;
cd build;
../icu4c/source/runConfigureICU --enable-debug --disable-release Linux/gcc --prefix=$PREFIX --enable-tracing;
make -j2;
make -j2 check;
( cd ../icu4c/source/test/depstest && ./depstest.py ../../../../build/ );
make install;
PATH=$PREFIX/bin:$PATH make -C test/hdrtst check
# clang release build with some options to enforce useful constraints.
# Includes dependency checker on an in-source, optimized build.
# Includes checking @draft etc. API tags vs. ifndef guards like
# U_HIDE_DRAFT_API and U_FORCE_HIDE_DRAFT_API.
# (FORCE guards make this tool pass but won't compile to working code.
# See the testtagsguards.sh script for details.)
clang-release-build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: ICU4C with clang
env:
CPPFLAGS: -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1
CFLAGS: -Wimplicit-fallthrough
CXXFLAGS: -Wimplicit-fallthrough
run: |
sudo apt-get -y install doxygen;
cd icu4c/source;
./runConfigureICU Linux;
make -j 2;
make -j 2 check;
( cd test/depstest && python3 depstest.py ../../../source/ );
( cd .. && source/test/hdrtst/testtagsguards.sh );
make dist
# Out of source build with gcc 10, c++14, and extra warnings; executes icuinfo.
gcc-10-stdlib14:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: ICU4C with gcc 10 and c++14 and extra warnings.
env:
PREFIX: /tmp/icu-prefix
CC: gcc-10
CXX: g++-10
CXXFLAGS: -std=c++14 -Wextra
run: |
mkdir build;
cd build;
../icu4c/source/runConfigureICU Linux --disable-layout --disable-layoutex --prefix=$PREFIX;
make -j2;
make -j2 check;
make install;
cd $PREFIX/bin;
LD_LIBRARY_PATH=../lib ./icuinfo
# Clang Linux with address sanitizer.
clang-asan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: ICU4C with clang and asan
run: |
cd icu4c/source;
./runConfigureICU --enable-debug --disable-release Linux --disable-renaming --enable-tracing;
make -j2;
make -j2 check
env:
CPPFLAGS: -fsanitize=address
LDFLAGS: -fsanitize=address
# Clang Linux with thread sanitizer.
clang-tsan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: ICU4C with clang and tsan
run: |
cd icu4c/source;
./runConfigureICU --enable-debug --disable-release Linux --disable-renaming
make -j2;
make -j2 -C test;
make -j2 -C test/intltest check
env:
INTLTEST_OPTS: utility/MultithreadTest
CPPFLAGS: -fsanitize=thread
LDFLAGS: -fsanitize=thread
# MacOS with clang
macos-clang:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: ICU4C with clang on MacOS
run: |
cd icu4c/source;
PYTHON=python3 ./runConfigureICU MacOSX;
make -j2 check
# Run ICU4C tests with stubdata.
run-with-stubdata:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: ICU4C tests with stubdata
run: |
cd icu4c/source;
./runConfigureICU Linux;
make -j2 check;
rm lib/libicudata.so*;
cp -P stubdata/libicudata.so* lib;
cd test/cintltst;
echo 'Running ICU4C cintltst with stubdata.';
# Note: 'Elapsed Time: ' is printed by makefile upon final success.
CINTLTST_OPTS=-w make check 2>&1 | grep 'Elapsed Time: ';
cd ../intltest;
echo 'Running ICU4C intltest with stubdata.';
INTLTEST_OPTS=-w make check 2>&1 | grep 'Elapsed Time: '
# Test U_CHARSET_IS_UTF8
u-charset-is-utf8-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
cd icu4c/source;
./runConfigureICU Linux CPPFLAGS="-DU_CHARSET_IS_UTF8=1";
make -j2 check
# Test U_OVERRIDE_CXX_ALLOCATION-is-0-test
u-override-cxx-allocation-is-0-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
cd icu4c/source;
./runConfigureICU Linux CPPFLAGS="-DU_OVERRIDE_CXX_ALLOCATION=0";
make clean;
make -j2 check
# Build and run testmap
testmap:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
cd icu4c/source;
./runConfigureICU Linux;
make -j2 check;
CONFIG_FILES=test/testmap/Makefile ./config.status;
cd test/testmap;
make check | grep '*** PASS PASS PASS, test PASSED!!!!!!!!'
# Copyright scan
copyright-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: perl tools/scripts/cpysearch/cpyscan.pl
# Check compilation of internal headers.
internal-header-compilation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: cd icu4c/source; test/hdrtst/testinternalheaders.sh
# Check source files for valid UTF-8 and for absence of BOM.
valid-UTF-8-and-no-BOM-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: tools/scripts/icu-file-utf8-check.py
# Verify icu4c release tools buildability.
icu4c-release-tools:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: mvn -f tools/release/java/pom.xml package dependency:analyze
# Run unit tests with UCONFIG_NO_XXX variations.
uconfig_variation-check-unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: python3 tools/scripts/uconfig_vars_test.py -u
# Run header tests with UCONFIG_NO_XXX variations.
uconfig_variation-check-all-header-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: python3 tools/scripts/uconfig_vars_test.py -p
-203
View File
@@ -1,203 +0,0 @@
matrix:
include:
# ICU4C Docs Build
# TODO: publish the latest built docs from master on GitHub pages.
# See https://gist.github.com/vidavidorra/548ffbcdae99d752da02 for ideas.
- name: "c: docs"
dist: xenial
language: cpp
addons:
apt:
update: true
packages:
- doxygen
before_script:
- cd icu4c/source
- ./runConfigureICU Linux --disable-renaming
script:
# fail if 'warning:' appears in doxygen's output, but ignore warnings from file Doxyfile.
# The Doxygen version from Travis is down-rev, and doesn't recognize some options
# in the Doxyfile config file.
# Regex note: (?! ... ) is a negative lookahead. Succeed if the pattern is not present.
- set +o pipefail && make doc 2>&1 | tee doxygen.log && ( ! grep -P 'warning:(?! .* file Doxyfile)' doxygen.log )
- name: "j"
language: java
addons:
apt:
packages:
- ant
- ant-optional
env: BUILD=ICU4J
before_script:
- cd icu4j
- ant init
script:
- ant check
after_failure:
- cat `find out/junit-results -name "*.txt" -exec grep -l FAILED {} \;`
- name: "c: linux gcc 8 Wextra"
dist: bionic
language: cpp
addons:
apt:
packages:
- g++-8
env: PREFIX=/tmp/icu-prefix CC=gcc-8 CXX=g++-8 CXXFLAGS="-Wextra"
before_script:
- mkdir build
- cd build
- ../icu4c/source/runConfigureICU Linux --disable-debug --enable-release --disable-layoutex --prefix="${PREFIX}" || (tail -100 config.log ; false)
- make -j2
script:
- make -j2 check
- make install
- PATH="${PREFIX}/bin:$PATH" make -C test/hdrtst check
# gcc debug build.
# Includes dependency checker.
# Note - the dependency checker needs to be run on both a debug and an optimized build.
# This one (gcc) for debug, and linux clang (below) for optimized.
#
# Test both out-of-source and in-source builds. This one (gcc) for out-of-source,
# and linux clang (below) for in-source.
#
# Invokes test/hdrtst to check public headers compliance.
- name: "c: linux gcc (debug)"
dist: xenial
language: cpp
compiler: gcc
env: PREFIX=/tmp/icu-prefix
before_script:
- mkdir build
- cd build
- ../icu4c/source/runConfigureICU --enable-debug --disable-release Linux --prefix="${PREFIX}" --enable-tracing
- make -j2
script:
- make -j2 check
- ( cd ../icu4c/source/test/depstest && ./depstest.py ../../../../build/ )
- make install
- PATH="${PREFIX}/bin:$PATH" make -C test/hdrtst check
# clang release build with some options to enforce useful constraints.
# Includes dependency checker on an in-source, optimized build.
# Includes checking @draft etc. API tags vs. ifndef guards like
# U_HIDE_DRAFT_API and U_FORCE_HIDE_DRAFT_API.
# (FORCE guards make this tool pass but won't compile to working code.
# See the testtagsguards.sh script for details.)
- name: "c: linux clang"
dist: xenial
language: cpp
env:
- CPPFLAGS="-DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1"
- CFLAGS="-Wimplicit-fallthrough"
- CXXFLAGS="-Wimplicit-fallthrough"
compiler: clang
before_install:
- sudo apt-get -y install doxygen # for make dist
before_script:
- cd icu4c/source
- ./runConfigureICU Linux
- make -j2
script:
- make -j2 check
- ( cd test/depstest && python3 depstest.py ../../../source/ )
- ( cd .. && source/test/hdrtst/testtagsguards.sh )
- make dist # not sure if this is -j safe everywhere.
- name: "c: osx clang"
language: cpp
env: BUILD=MACINTOSH
os: osx
compiler: clang
# Use the macOS target to test Python 2 in data build script.
# TODO(ICU-20301): Change this back to the default Python version 3.
script: cd icu4c/source && PYTHON=python2 ./runConfigureICU MacOSX && make -j2 check
# out of source gcc 8 build with c++14, runs icuinfo
- name: "c: linux gcc 8 c++14"
dist: bionic
language: cpp
addons:
apt:
packages:
- g++-8
env: PREFIX=/tmp/icu-prefix CC=gcc-8 CXX=g++-8 CXXFLAGS="-std=c++14"
before_script:
- mkdir build && cd build
- ../icu4c/source/runConfigureICU Linux --disable-layout --disable-layoutex --prefix="${PREFIX}"
- make -j2
script:
- make -j2 check && make install
- cd "${PREFIX}/bin" && LD_LIBRARY_PATH=../lib ./icuinfo
# Clang Linux with address sanitizer.
# Note - the 'sudo: true' option forces Travis to use a Virtual machine on GCE instead of
# a Container on EC2 or Packet. Asan builds of ICU fail otherwise.
- name: "c: linux asan (debug)"
language: cpp
env:
- CPPFLAGS="-fsanitize=address"
- LDFLAGS="-fsanitize=address"
os: linux
dist: xenial
sudo: true
compiler: clang
before_script:
- cd icu4c/source
- ./runConfigureICU --enable-debug --disable-release Linux --disable-renaming --enable-tracing
- make -j2
script:
- make -j2 check
# Clang Linux with thread sanitizer.
#
- name: "c: linux tsan (debug)"
language: cpp
env:
- INTLTEST_OPTS="utility/MultithreadTest"
- CPPFLAGS="-fsanitize=thread"
- LDFLAGS=-fsanitize=thread
os: linux
dist: xenial
sudo: true
compiler: clang
script:
- cd icu4c/source
- ./runConfigureICU --enable-debug --disable-release Linux --disable-renaming
- make -j2
- make -j2 -C test
- make -j2 -C test/intltest check
# copyright scan / future linter
- name: "lint"
script:
- perl tools/scripts/cpysearch/cpyscan.pl
- name: "j: icu4c release tools"
language: "java"
script:
- mvn -f tools/release/java/pom.xml package dependency:analyze
cache:
directories:
- $HOME/.m2
# Check compilation of internal headers.
- name: "internal header compilation check"
language: cpp
os: linux
before_script:
- cd icu4c/source
script:
- test/hdrtst/testinternalheaders.sh
# Check source files for valid UTF-8 and for absence of BOM.
- name: "UTF-8 and BOM check"
os: linux
script:
- tools/scripts/icu-file-utf8-check.py
+62
View File
@@ -898,3 +898,65 @@ eCVlKx7ws8kC/oPcNgwoqs8XdHPNHUr+MGWcoib4Fo+KhijYGIM0XNfc1fWRPDCm
DH2mVgW7fxtB1JdUbJPU1i9vzAONu6ZKyrK4d6/MTGduyO+zZISqVKS7eg==
=DEHc
-----END PGP PUBLIC KEY BLOCK-----
pub rsa3072 2020-10-14 [SC]
0E51E7F06EF719FBD072782A5F56E5AFA63CCD33
uid [ultimate] Craig Cornelius (For use with ICU releases) <ccornelius@google.com>
sig 3 5F56E5AFA63CCD33 2020-10-14 Craig Cornelius (For use with ICU releases) <ccornelius@google.com>
sig 3 9B432B27D1BA20D7 2020-10-14 Fredrik Roubert <fredrik@roubert.name>
sub rsa3072 2020-10-14 [E]
sig 5F56E5AFA63CCD33 2020-10-14 Craig Cornelius (For use with ICU releases) <ccornelius@google.com>
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQGNBF+HGz4BDAC00mXlPPgW5JI9ECxI9juSX/xpzAhM/2NvXzc4Smq7efJMzwvp
PkfBwdfLavred6rxqjVfXJZuPL4rAY2fKBiMq2ANBRsx6t0Bl1jbZbI/MGb18Qcl
5EQ/n1I0WslugsZpSX7crj2A+bO42BRWOgroQdpLTrdTjdeS774MaOvt7i3S2Cy/
YT+U6ysrz0F7wWdiOMUftHEBOrXPJ0s7P3bJGDYsca0sV1o5EmefQWh7cymhroHQ
UzUnsthmU0Qv8BQ7xc7zsCBrJR0V0ryMww8u/mLexz7i+W522olx78Vj887yC//l
lAZYI+ORG9hTr3QvcVaF/FaZsbwrA3FPKB+LFWQr/CFa0eSuXWoY5u2g3aL5KoCy
G/l7x7YlMx7Rw+65YIssZYv39AiZEU3nei+qsaneNc8v6HTX39mMXVdMc5/iWV6A
pBo+1+wTgaOWMFf5zOg38DyzdQaDz6TNoAgwHbQhz7MDHqLZssy2U/ATnqAPi/Xf
8oGmQtTh/8zupCsAEQEAAbRDQ3JhaWcgQ29ybmVsaXVzIChGb3IgdXNlIHdpdGgg
SUNVIHJlbGVhc2VzKSA8Y2Nvcm5lbGl1c0Bnb29nbGUuY29tPokBzgQTAQoAOBYh
BA5R5/Bu9xn70HJ4Kl9W5a+mPM0zBQJfhxs+AhsDBQsJCAcCBhUKCQgLAgQWAgMB
Ah4BAheAAAoJEF9W5a+mPM0zJ5IL/2XJ6VHdSdMstzjpnCDjQTYuhFkwEfGSlMrh
NTZftoQ1qYXuU8DKISgEo1OlguuK61xePn5wl8BfT6XfF2XCZpVUah2fom1m9ZAI
2gkt/Bwn1ulBKQd3NQpAQKPSKzOVJ+0BBOoBCwoCy+hHr8oeRJGgxz+j8aux10IV
OHviRkBizx0vnVcy3dN41QLNvtq2cZcKig68sAJPM3t4//co89pH3kjKzBFVCqxF
+INFyaGMyhT1zEhEYB+o6fvYGS4zX9qGRpLzx64beA84DZRmv6aLvjwzhSfA74Ey
f+FLiAMYae1opWLS+to54WEB5hK2Ak251PqOfWCuR1KVGmQaa4sabT3uQQ4bRh6Y
yGSXD9qSRJC/W2vNRwkEnKrjwFgH6w2XgHpVLlJiC6Ir7U57AkCfUDVdRCcWQoGN
ZTuPIHfoj7IehJgR8NZvbHAWViC3FP9DZEm+1druAbc62PngbTUlF6zJrZ/zl90s
kDg8cNNhQtCdgDKdL/cZwBm/G8RzUIkCMwQTAQgAHRYhBP+pEpoYDXZbelvqHJtD
KyfRuiDXBQJfhzz/AAoJEJtDKyfRuiDXegYQALsvJzFyxsYUsgr7VYTlyEmjLx2k
S87toZTgD4zDHprjGT/mRQvzKaMqgp6cwGtnGYLbJi3W17E6ykMk523CWfrqAbqV
RpMH6nQvxNEbjHCAOAlXZc2zk78lqHkd+UePpDW0Lzwllyf5AK/hf9AvHGZlRSij
OZEpvRIinwczPcKCyy1RdwO2aeKyjrk98e8SKjpjdl/OXFiuWpLWUXJE/QOkIwbk
lwUUgHQuauuKZFDDu1T4AGBEAv5yUWU7m6PMa0riGQ7m1pSvTVX9wmV0KgkQ3/sW
VDqYf3X1VL/NVt4GUBAFTCw04Xzqdb94ERlYde5yFn/wJm7Pnv5pDIlxvGvL+uA6
e9oGc7msHA2PQipDaAPcvmDT6IQLLuhmO9PA85vZ8egGjKKBey5FE+zRrowWfsLm
WRXeBPohHjHY2KRto3onFJM4JEydKLtpBAGQ04NAGAhth3opd3jpaPSu6u4rhx4i
HLiBoJzsWtRTE0lTAeA6Wm0MoH9JQQEt4rgi5kd9BcYMsDfZiR9Fsq2FwEkPwFbi
1sSNaxW5BWYFKSBhYHOkAFzsxRrD1OAj/anPO/QYfRUu08hUyYi1StTa/0zZ+Cf3
NY/Q3YJLe/6PJrzxv4wnE7QZs5OSUDaTqL9kOB1mDz6Z3iLnPeOnkBuL6JFF5IUv
lc9Y1w/UOFefZgGguQGNBF+HGz4BDADO2pKzANvXFSpT5IeMCcAvOIAf8vgJpO84
BnjQ9/PgiOZMmQW03TIdrY+9wKATOxvUTpC7G+070M438UwlGJX86zjY7CxX+xdi
yqL9ArK5QJlvaXSvhx1qcArgLIiW+X3qs/U/Y/qXOINS2gZUSYaMBnWHuXutIXSQ
Liqi3l662nSPvKi7WjpHgi87TV2zG+B9xF23AxMZWth/0vtIevIheoB8vk0mJoos
8Hmx1qknknDqICT/Flnxm9f1UyDOY+IwWMRyvZZUr+r08vg7qg0TIHkYeMwRMovn
TZcAPoNvFT1yHsxTdf7mA1yTHCymBvP5aUuXh+FJ+tfPmKGvz65bs0VmlcU10Kl+
EntF7TniVhCp/QB5M8MA6HKM0zxORFMGZ7xnV9gu6nRPcR+8PvEFxY2wgEcf7pfj
6wGdS+Pri/dK3+53abE8RLi/aJW+wi2XNd/aRWjpSC2KBmHUk17Zgp3Jb6Iijb+e
7bcTf+REXgi0+PskNaeCyU4LzStZCwUAEQEAAYkBtgQYAQoAIBYhBA5R5/Bu9xn7
0HJ4Kl9W5a+mPM0zBQJfhxs+AhsMAAoJEF9W5a+mPM0zULYL/27+ED5a8s43q24Z
COQQPZflXy+0MnzW4Fwj9f7WsxD/fkj651p/MoRVmugytRti3T8+A4ULUuKxatCZ
+Q+SIobXbWHD0H+hVosBohU6HmWX5Nbyi18wk5YDNWzN4n0duhv6lb4tn3M9utX9
WdQWnudXNjKzddNiixalc5eU9vMEpEnwKLcmZ/efSimqfGXldMjTw+FIh6wHhBcn
uVXQqj/+Ie20l4RXt6VxUltZwaQJnH6nf/4T1B4sllNo6Sz8RHjnrc+SjuIREaga
nRNZ0BF6aAj6qk9RTlkmBGiAdmvtCuGRqqsG2i8OrTv0xArCGEs13Vv5BE6JfZI/
YdzPuq2u0JM9dsEM6v3LLxhlfxxOmM9OZM4+GBP+JMB3TydK8t7vfLW0kDRvymVM
uVrQ13BH7D1TWlzM7jN1dToIySXIjGRcMpqT/2LqYDwHfrJCdQZGKDBl5vNWXwNs
OC7PFtJwtXNl8p7Jvk3lplU5rNSSkTF8hSFgtxu4cpJ5VAY8nQ==
=FdGa
-----END PGP PUBLIC KEY BLOCK-----
+4 -1
View File
@@ -10,11 +10,14 @@ The ICU project is under the stewardship of [The Unicode Consortium](https://www
![ICU Logo](./tools/images/iculogo_64.png)
### 🔴🔴🔴 Special Notice About Branch Renaming 🔴🔴🔴
We plan to rename the `master` branch to `main` branch around March 24-25, 2021. You may need to rename your branch in your local git repo and change your normal git command to reflect the changes after that. See also https://github.com/github/renaming
### Build Status (`master` branch)
Build | Status
------|-------
TravisCI | [![Build Status](https://travis-ci.org/unicode-org/icu.svg?branch=master)](https://travis-ci.org/unicode-org/icu)
GitHub Actions | [![GHA CI](https://github.com/unicode-org/icu/workflows/GHA%20CI/badge.svg)](https://github.com/unicode-org/icu/actions?query=workflow%3A%22GHA+CI%22)
Azure Pipelines | [![Build Status](https://dev.azure.com/ms/icu/_apis/build/status/unicode-org/CI?branchName=master)](https://dev.azure.com/ms/icu/_build/latest?definitionId=360&branchName=master)
Azure Pipelines (Exhaustive Tests) | [![Build Status](https://dev.azure.com/ms/icu/_apis/build/status/unicode-org/CI-Exhaustive-Main?branchName=master)](https://dev.azure.com/ms/icu/_build/latest?definitionId=361&branchName=master)
Azure Pipelines (Valgrind ICU4C) | [![Build Status](https://dev.azure.com/ms/icu/_apis/build/status/unicode-org/CI-Valgrind-Main?branchName=master)](https://dev.azure.com/ms/icu/_build/latest?definitionId=362&branchName=master)
+14 -12
View File
@@ -1,7 +1,7 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (6.0.3.2)
activesupport (6.0.3.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
@@ -17,17 +17,18 @@ GEM
commonmarker (0.17.13)
ruby-enum (~> 0.5)
concurrent-ruby (1.1.7)
dnsruby (1.61.4)
dnsruby (1.61.5)
simpleidn (~> 0.1)
em-websocket (0.5.1)
em-websocket (0.5.2)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
ethon (0.12.0)
ffi (>= 1.3.0)
eventmachine (1.2.7)
execjs (2.7.0)
faraday (1.0.1)
faraday (1.1.0)
multipart-post (>= 1.2, < 3)
ruby2_keywords
ffi (1.13.1)
forwardable-extended (2.6.0)
gemoji (3.0.1)
@@ -94,7 +95,7 @@ GEM
i18n (~> 0.7)
jekyll-sass-converter (~> 1.0)
jekyll-watch (~> 2.0)
kramdown (>=1.17, < 3)
kramdown (>= 1.17, < 3)
liquid (~> 4.0)
mercenary (~> 0.3.3)
pathutil (~> 0.9)
@@ -192,7 +193,7 @@ GEM
gemoji (~> 3.0)
html-pipeline (~> 2.2)
jekyll (>= 3.0, < 5.0)
just-the-docs (0.3.1)
just-the-docs (0.3.3)
jekyll (>= 3.8.5)
jekyll-seo-tag (~> 2.0)
rake (>= 12.3.1, < 13.1.0)
@@ -201,7 +202,7 @@ GEM
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liquid (4.0.3)
listen (3.2.1)
listen (3.3.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.3.6)
@@ -210,11 +211,11 @@ GEM
jekyll (>= 3.5, < 5.0)
jekyll-feed (~> 0.9)
jekyll-seo-tag (~> 2.1)
minitest (5.14.1)
minitest (5.14.2)
multipart-post (2.1.1)
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
octokit (4.18.0)
octokit (4.19.0)
faraday (>= 0.9)
sawyer (~> 0.8.0, >= 0.5.3)
pathutil (0.16.2)
@@ -224,10 +225,11 @@ GEM
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
rexml (3.2.4)
rexml (3.2.4)
rouge (3.19.0)
ruby-enum (0.8.0)
i18n
ruby2_keywords (0.0.2)
rubyzip (2.3.0)
safe_yaml (1.0.5)
sass (3.7.4)
@@ -245,13 +247,13 @@ GEM
thread_safe (0.3.6)
typhoeus (1.4.0)
ethon (>= 0.9.0)
tzinfo (1.2.7)
tzinfo (1.2.8)
thread_safe (~> 0.1)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.7)
unicode-display_width (1.7.0)
zeitwerk (2.4.0)
zeitwerk (2.4.1)
PLATFORMS
ruby
+4
View File
@@ -93,3 +93,7 @@ gh_edit_view_mode: "tree"
exclude:
- Gemfile
- Gemfile.lock
# Google Analytics
ga_tracking: UA-7670256-1
ga_tracking_anonymize_ip: true # Use GDPR compliant Google Analytics settings
+2 -1
View File
@@ -18,5 +18,6 @@
initial bad system performance when a new build is launched.
NOTE:
Run the [`./runConfigureICU` command](http://userguide.icu-project.org/icufaq)
Run the
[`./runConfigureICU` command](https://unicode-org.github.io/icu/userguide/icufaq)
before building `icu4c` from VSCode.
@@ -0,0 +1,133 @@
<!--
© 2020 and later: Unicode, Inc. and others.
License & terms of use: http://www.unicode.org/copyright.html
-->
# Updating Measure Unit with new CLDR data
This document explains how to update the C++ and Java version of the MeasureUnit
class with new CLDR data.
Code is generated by running MeasureUnitTest.java unit tests, which writes
generated code to System.out. Two ways to access this:
1. Within **eclipse**:
- Open MeasureUnitTest.java, run it by clicking on the green play button on
menu bar.
- Copy the generated code from the eclipse console to the clipboard.
2. With **ant**:
- Run: `ant checkTest
-Dtestclass='com.ibm.icu.dev.test.format.MeasureUnitTest'`
- Open the checkTest output: `out/junit-results/checkTest/html/index.html`
- Navigate to "System.out" at the bottom of the MeasureUnitTest page to find
the generated code, and copy to the clipboard.
After syncing CLDR data with ICU do the following. This documentation assumes
that you are updating the MeasureUnit clases for ICU 68.
* Check out
$GIT_ROOT/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/MeasureUnitTest.java
* Open MeasureUnitTest.java.
* Find the `testZZZ` test, its code should all be commented out. This test will
execute last and will run the desired code.
Make sure DRAFT_VERSIONS at top of MeasureUnitTest.java is set correctly.
These are the ICU versions that have draft methods.
## Update MeasureUnit.java
* Change `testZZZ` to run `generateConstants(“68”); // ICU 68.`
* Run MeasureUnitTest.java, copy the generated code (see instructions above).
* Open MeasureUnit.java:
$GIT_ROOT/icu4j/main/classes/core/src/com/ibm/icu/util/MeasureUnit.java
* Look for line containing:
`// Start generated MeasureUnit constants`
* Look for line containing:
`// End generated MeasureUnit constants`
* Replace all the generated code in between with the contents of the clipboard
* Run the MeasureUnitTest.java to ensure that the new code is backward
compatible. These compatibility tests are called something like
`TestCompatible65`, which tests backward compatibility with ICU 65.
* Create a compatibility test for ICU 68. Change `testZZZ` to run
`generateBackwardCompatibilityTest(“68”)`
* Run tests.
* Copy generated test (see instructions above) into MeasureUnitTest.java
* Run tests again to ensure that new code is backward compatible with itself
## Update ICU4C
* checkout ICU4C
### Update measunit.h
* Change testZZZ to run `generateCXXHConstants(“68”); // ICU 68`.
* Run MeasureUnitTest.java, copy the generated code (see instructions above).
* Open $GIT_ROOT/icu4c/source/i18n/unicode/measunit.h. Look for line containing:
`// Start generated createXXX methods`
* Look for line:
`// End generated createXXX methods`
* Replace all the generated code in between with the contents of the clipboard
### Update measunit.cpp
* Change testZZZ to run generateCXXConstants();
* Run MeasureUnitTest.java, copy the generated code (see instructions above).
* Open $GIT_ROOT/icu4c/source/i18n/measunit.cpp. Look for line containing:
`// Start generated code for measunit.cpp`
* Look for lines
`// End generated code for measunit.cpp`
* Replace all the generated code in between with the contents of the clipboard
### Run C++ tests
* Run `./intltest format/MeasureFormatTest` from `test/intltest` to ensure new
code is backward compatible.
* Create a compatibility test for ICU 68. Change `testZZZ` in eclipse to run
`generateCXXBackwardCompatibilityTest(“68”)`
* Run tests.
* Copy generated test (see instructions above) into
$GIT_ROOT/icu4c/source/test/intltest/measfmttest.cpp. Make other necessary
changes to make test compile. You can find these changes by searching for
`TestCompatible65()`
* Run tests again to ensure that new code is backward compatible with itself
## Finishing changes
These last changes are necessary to permanently record the ICU version number of
any new measure units. Without these changes any new functions for this release
will be considered new for the next release too.
* Change `testZZZ` to run `updateJAVAVersions(“68”);`
* Run MeasureUnitTest.java, copy the generated code (see instructions above).
* Append the clipboard contents to the values of the JAVA_VERSIONS variable
near the top of MeasureUnitTest.java.
**Important:** what you are copying are just the new functions for the current
ICU version, in this case 68. Therefore append, do not replace.
## Updating units.txt and unitConstants
The standard ldml2icu process is used to update ICU's resource files (see
[cldr-icu-readme.txt](https://github.com/unicode-org/icu/blob/master/icu4c/source/data/cldr-icu-readme.txt)).
CLDR's units.xml defines conversion rates in terms of some constants defined in
`unitConstants`.
For efficiency and simplicity, ICU does not read `unitConstants` from the
resource file. If any new constants are added, some code changes would be
needed. This would be caught by `testUnitConstantFreshness` unit test in
`units_test.cpp`.
They are hard-coded:
* Java: `UnitConverter.java` has the constant names in
`UnitConverter.Factor.addEntity()` and constant values in
`UnitConverter.Factor.getConversionRate()`.
* C++: `units_converter.cpp` has the constant names in
`addSingleFactorConstant()`, with the constant values in `double
constantsValues[]` in the `units_converter.h` header file.
+1 -1
View File
@@ -143,7 +143,7 @@ UErrorCode status = U_ZERO_ERROR;
UDate time;
Calendar *cal1, *cal2;
// Create a new Gregorian Calendar.
cal1 = Calendar::createInstance("en_US@calender=gregorian", status);
cal1 = Calendar::createInstance("en_US@calendar=gregorian", status);
if (U_FAILURE(status)) {
printf("Error creating Gregorian calendar.\n");
return;
+109 -55
View File
@@ -206,35 +206,92 @@ service objects, organized according to locale. Then, if a particular locale's
formatter is in high demand, that formatter can be used, and then returned to
the pool.
#### ICU Memory Usage
### ICU Memory Usage
ICU4C APIs are designed to allow separate heaps for its libraries vs. the
application. This is achieved by providing functions to allocate and release
objects owned by ICU4C using only ICU4C library functions. For more details see
the Memory Usage section in the [Coding Guidelines](dev/codingguidelines.md).
the Memory Usage section in the [Coding Guidelines](dev/codingguidelines.md#memory-usage).
#### ICU Initialization and Termination
### ICU4C Initialization and Termination
The ICU library does not normally require any explicit initialization prior to
use. An application begins use simply by calling any ICU API in the usual way.
(There is one exception to this, described below.)
There are, however, a few functions affecting ICU's configuration, that, if used,
must be called first, before other use of ICU in a process. These are outlined below.
In C++ programs, ICU objects and APIs may safely be used during static
initialization of other application-defined classes or objects. There are no
order-of-initialization problems between ICU and static objects from other
libraries because ICU does not rely on C++ static object initialization for its
normal operation.
1. `u_setMemoryFunctions()`. This function replaces the standard library heap
allocation functions used by ICU with alternate versions, provided by the
application. If it is needed, `u_setMemoryFunctions()` must be called first, before
any other use of ICU. This functionality is not commonly used.
When an application is terminating, it may optionally call the function
`u_cleanup(void)`, which will free any heap storage that has been allocated and
held by the ICU library. The main benefit of `u_cleanup()` occurs when using
memory leak checking tools while debugging or testing an application. Without
`u_cleanup()`, memory being held by the ICU library will be reported as leaks.
2. ICU Data Locating Functions, `u_setCommonData()`, `u_setDataDirectory()`, and
`u_setAppData()`. One or more of these functions will be required when ICU is
configured to load its data directly from files rather than taking it from the
default data DLL, and the files are not in the default location. Again, this is
not common. See [ICU Data](icudata#icu-data-directory).
(For some platforms, the configure option `--enable-auto-cleanup` (or
defining the option `UCLN_NO_AUTO_CLEANUP` to 0) will add code which
automatically cleans up ICU when its shared library is unloaded. See comments in
`ucln_imp.h`)
3. Sanity check that ICU is functioning and able to access data. This is
important because configuration or installation problems that leave ICU unable
to load its data do occur, and the resulting failures can be confusing.
Since not all ICU APIs have UErrorCode parameters, in the absence of data they
may sometimes silently return incorrect results.
The function `ulocdata_getCLDRVersion()` is suitable; it is small and light
weight, requires data, and reports the error in the absence of data.
When an application is terminating it should call the function `u_cleanup()`,
which frees all heap storage and other system resources that are held internally
by the ICU library. While the use of `u_cleanup()` is not strictly required,
failure to call it will cause memory leak checking tools to report problems for
resources being held by ICU library.
Before calling `u_cleanup()`, all ICU objects that were created by the
application must be deleted, and all ICU services (plain C APIs) must be closed.
For some platforms the configure option `--enable-auto-cleanup`, or defining
the option `UCLN_NO_AUTO_CLEANUP` to 0, will add code which automatically cleans
up ICU when its shared library is unloaded. See comments in `ucln_imp.h`
#### C++ Static Initialization and Destruction
The ICU library itself does not rely on C++ static initializers, meaning that
applications will not encounter order-of-initialization problems from the use of
ICU.
There are, however, some significant limitations for applications that make use
of ICU at C++ static initialization time:
1. `u_setMemoryFunctions()` and the data locating functions, if needed, must
still be called before any other use of ICU. Which includes any use during the
construction of static objects.
2. `u_cleanup()` can only be called after all other ICU-using objects have been
deleted. Finding a suitable time and place for the call to `u_cleanup()` may be
difficult, however. Refer to the C++ literature on the order of static
initialization and destruction.
3. Destruction of static objects that are scoped to a code block. These, by the
conventions of C++, are lazily initialized when the code block is first entered,
so there are no issues during static initialization. But object destruction
happens when the program terminates, leaving the problem of where to call
`u_cleanup()`, as discussed above.
#### Dynamically Loading and Unloading ICU
Applications may arrange to dynamically load the ICU library when it is needed,
and unload it when through, repeating the process as required. The specific
details for loading and unloading, and accessing such libraries, are operating
system dependent.
For ICU to be used in this way, before unloading, all ICU objects and services
must be closed or deleted, and `u_cleanup()` must be called.
On Windows, the loading and unloading of ICU should never be done inside
[DllMain](https://docs.microsoft.com/en-us/windows/win32/dlls/dllmain). Loading
one of the ICU libraries can cause other libraries or files to be loaded,
leading to potential dead-lock.
#### Initializing ICU in Multithreaded Environments
@@ -251,45 +308,13 @@ ICU. This situation will arise only when ALL of the following conditions occur:
To safely initialize the ICU library when all of the above conditions apply, the
application must explicitly arrange for a first-use of ICU from a single thread
before the multi-threaded use of ICU begins (see below for basic steps in safely
initializing the ICU library). A convenient ICU operation for this purpose is
`uloc_getDefault()` , declared in the header file `unicode/uloc.h`.
before the multi-threaded use of ICU begins. A convenient ICU operation for this
purpose is `uloc_getDefault()`, declared in the header file `unicode/uloc.h`.
#### Steps in Safely Initializing ICU in Single and Multi-threaded Environments
> :point_right: **Note**: The status of this situation needs further
investigation. See issue
[ICU-21380](https://unicode-org.atlassian.net/browse/ICU-21380)
1. If needed, certain data loading functions, such as `u_setCommonData()`,
`u_setAppData()`, and `u_setDataDirectory()`, must be called before any other
ICU function. In addition there are some other heap, mutex, and trace
functions, such as `u_setMemoryFunctions()` and `u_setMutexFunctions()`, which
also must be called during the initial and unused state of ICU.
2. Next, `u_init()` can be called to ensure proper loading and initialization of
data that are required internally by various ICU functions. Explicit use of
this function is needed in a multi-threaded application by the main thread.
Each subsequent thread does not need to call `u_init()` again after the main
thread has successfully executed this function. In a single threaded
program, calls to this function is not needed but
recommended.
3. After the successful initialization of ICU, normal use of ICU, whether using
multiple threads or just a single one, is permitted.
4. When the application is done using ICU, the individual threads must cease
all ICU services leaving only the main thread.
5. After all but the main thread have released ICU, `u_cleanup()` can be called.
The releasing of the individual threads to ICU is necessary because
`u_cleanup()` is not thread safe. In addition, all ICU items, including
collators, resource bundles, and converters, must be closed before calling
this function. `u_cleanup()` will free/delete all memory owned by the ICU
libraries returning them to their original load state. Generally, this
function should be called only once just before an application exits.
However, applications needing to dynamically load and unload the ICU
libraries can call this function just before the library unloads.
`u_cleanup()` also clears any ICU heap functions, mutex functions, or trace
functions that may haven been set for the process. If ICU is to be
reinitialized after calling `u_cleanup()`, these runtime override functions
will need to be setup again if they are still required. Great care needs to
be exercised when using `u_cleanup()` and should only be implemented by those
who know what they are doing. In any event, if the application doesn't exit
and requires ICU again after correctly calling `u_cleanup()`, go back to step
(1).
### Error Handling
@@ -776,6 +801,8 @@ For example, here is how an API might be tagged in various versions:
### ICU Binary Compatibility
*Using ICU as an Operating System Level Library*
ICU4C may be configured for use as a system library in an environment where
applications that are built with one version of ICU must continue to run without
change with later versions of the ICU shared library.
@@ -788,6 +815,7 @@ Here are the requirements for enabling binary compatibility for ICU4C:
4. Applications must be built using an ICU that was configured for binary
compatibility.
5. Use ICU version 3.0 or later.
6. Provide both “common” and “i18n” libraries, or build a combined library.
**Stable APIs Only.** APIs in the ICU library that are tagged as being stable
will be maintained in future versions of the library. Stable functions will
@@ -840,6 +868,32 @@ libraries that resulted from the `–-disable-renaming` ICU build
beginning with ICU version 3.0. Older versions of ICU (2.8 and earlier) do not
provide for binary compatibility between versions.
**Provide both “common” and “i18n” libraries, or build a combined library.**
It is rare but possible that services/APIs move from one library to another.
For example, many years ago we moved the BreakIterator APIs from i18n to common,
so that word titlecasing functions no longer needed separate code to find
titlecasing or word break opportunities.
More recently, the ListFormatter moved from the common library to i18n
when its features grew beyond primitive patterns to also support
FieldPosition and FormattedValue features.
There is also a third, “io” library.
It is possible that some of its functionality may be moved to the i18n or common
libraries.
(A likely candidate might be `operator<<(std::ostream& stream, const UnicodeString& s)`,
although there are no actual plans to do so at the time of this writing.)
One can build a combined library which provides the exports from
both the “common” and “i18n” libraries,
in order to provide a single library for linking against.
This may be needed for some platforms where there is a strong relationship
between an API and the library that implements it.
For example, on Windows platforms, attempting to find an API that has been moved
with a `LoadLibrary`/`GetProcAddress` approach will fail,
unless you are using a combined library.
#### Linking against multiple versions of ICU4C
This section is intended to aid software developers who are implementing or
+6 -2
View File
@@ -295,8 +295,12 @@ We do not `#ifndef` APIs where that would be problematic:
struct/class fields, virtual methods)
* enum constants where that would modify the numeric values of following
constants
* C++ class boilerplate (e.g., default/copy constructors) because otherwise
the compiler would create public ones
* actually, best to use `#ifndef` together with explicitly defining the
numeric value of the next constant
* C++ class boilerplate (e.g., default/copy constructors), if
the compiler would auto-create public functions to replace `#ifndef`’ed ones
* For example, the compiler automatically creates a default constructor if
the class does not specify any other constructors.
* private class members
* definitions in internal/test/tools header files (that would be pointless;
they should probably not have API tags in the first place)
+2 -2
View File
@@ -41,7 +41,7 @@ synchronization primitives.
**Low Level Atomics**, a set of platform or compiler dependent typedefs and
inlines. Provided in the internal header file
[`umutex.h`](../../../../icu4c/source/common/umutex.h).
[`umutex.h`](https://github.com/unicode-org/icu/blob/master/icu4c/source/common/umutex.h).
| Type/Function | Description |
|---------------------------------------------------------|-------------------------------------------------------------------------------|
@@ -71,7 +71,7 @@ Provided in a .cpp file.
`UInitOnce` and `umtx_initOnce()` are used internally by ICU for thread-safe
one-time initialization. Their implementation is split into a
platform-independent part (contained in
[`umutex.h`](../../../../icu4c/source/common/umutex.h)),
[`umutex.h`](https://github.com/unicode-org/icu/blob/master/icu4c/source/common/umutex.h)),
and the pair of platform-dependent implementation functions listed above.
**Build Setup**
+1 -1
View File
@@ -50,7 +50,7 @@ implementations](custom.md) for other platforms.
The functions and types listed below are intended for use throughout the ICU
library code, where ever synchronization is required. They are defined in the
internal header
[umutex.h](../../../../icu4c/source/common/umutex.h).
[umutex.h](https://github.com/unicode-org/icu/blob/master/icu4c/source/common/umutex.h).
All synchronization within ICU4C implementation code must use these, and avoid
direct use of functions provided by a particular operating system or compiler.
+2 -5
View File
@@ -22,11 +22,6 @@ License & terms of use: http://www.unicode.org/copyright.html
## Overview
> :construction: **TODO**: Adjust this page for use of GitHub Markdown (since 2020)
rather than Google Sites.
See the [migration page](https://docs.google.com/document/d/1uK91cxv1amCrt75TBw1PlCC5wZhJH_w3dW_8unWL9EQ/edit)
for details and tips.
This version of the ICU User Guide is generated directly from the Markdown
files in the `/docs` directory of the main repository. In particular, the
Markdown files are customized to work with the Jekyll static site generator,
@@ -94,6 +89,7 @@ should be lowercased.
> :point_right: **Note**: Notes should be made by starting the line with the
following Markdown:
~~~
> :point_right: **Note**:
~~~
@@ -102,6 +98,7 @@ following Markdown:
"TODO" items should be marked by starting the line with the
following Markdown:
~~~
> :construction: **TODO**:
~~~
+1 -1
View File
@@ -13,7 +13,7 @@ License & terms of use: http://www.unicode.org/copyright.html
# Formatting Numbers
Since ICU 60, the recommended mechanism for formatting numbers is
[`NumberFormatter`](https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/numberformatter_8h.html)
[`NumberFormatter`](https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/numberformatter_8h.html#details)
([Java](https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/number/NumberFormatter.html)). `NumberFormatter` supports the formatting of:
- Decimal Formatting
+1 -1
View File
@@ -128,7 +128,7 @@ Rulesets are invoked by first applying negative and fractional rules, and then
using a recursive process. It starts by finding the rule whose range includes
the current value and applying that rule. If the rule so directs, it emits text,
including text obtained by recursing on new values as directed by the rule. As
you can see, the rules are designed to accomodate recursive processing of
you can see, the rules are designed to accommodate recursive processing of
numbers, and so are best suited for formatting numbers in ways that are
inherently recursive.
@@ -30,50 +30,52 @@ definitions, but are equivalent to the same modes used in Java's JDK.
This chart shows the values -2.0 through 2.0 in increments of 0.1, and shows the
resulting ICU format when formatted with no decimal digits.
| # | CEILING | FLOOR | DOWN | UP | HALFEVEN | HALFDOWN | HALFUP | # |
|------|---------|-------|------|----|----------|----------|--------|------|
| -2.0 | -2 | -2 | -2 | -2 | -2 | -2 | -2 | -2.0 |
| -1.9 | -1 | -2 | -1 | -2 | -2 | -2 | -2 | -1.9 |
| -1.8 | -1 | -2 | -1 | -2 | -2 | -2 | -2 | -1.8 |
| -1.7 | -1 | -2 | -1 | -2 | -2 | -2 | -2 | -1.7 |
| -1.6 | -1 | -2 | -1 | -2 | -2 | -2 | -2 | -1.6 |
| -1.5 | -1 | -2 | -1 | -2 | -2 | -1 | -2 | -1.5 |
| -1.4 | -1 | -2 | -1 | -2 | -1 | -1 | -1 | -1.4 |
| -1.3 | -1 | -2 | -1 | -2 | -1 | -1 | -1 | -1.3 |
| -1.2 | -1 | -2 | -1 | -2 | -1 | -1 | -1 | -1.2 |
| -1.1 | -1 | -2 | -1 | -2 | -1 | -1 | -1 | -1.1 |
| -1.0 | -1 | -1 | -1 | -1 | -1 | -1 | -1 | -1.0 |
| -0.9 | -0 | -1 | -0 | -1 | -1 | -1 | -1 | -0.9 |
| -0.8 | -0 | -1 | -0 | -1 | -1 | -1 | -1 | -0.8 |
| -0.7 | -0 | -1 | -0 | -1 | -1 | -1 | -1 | -0.7 |
| -0.6 | -0 | -1 | -0 | -1 | -1 | -1 | -1 | -0.6 |
| -0.5 | -0 | -1 | -0 | -1 | -0 | -0 | -1 | -0.5 |
| -0.4 | -0 | -1 | -0 | -1 | -0 | -0 | -0 | -0.4 |
| -0.3 | -0 | -1 | -0 | -1 | -0 | -0 | -0 | -0.3 |
| -0.2 | -0 | -1 | -0 | -1 | -0 | -0 | -0 | -0.2 |
| -0.1 | -0 | -1 | -0 | -1 | -0 | -0 | -0 | -0.1 |
| 0.0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.0 |
| 0.1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0.1 |
| 0.2 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0.2 |
| 0.3 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0.3 |
| 0.4 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0.4 |
| 0.5 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 0.5 |
| 0.6 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 0.6 |
| 0.7 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 0.7 |
| 0.8 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 0.8 |
| 0.9 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 0.9 |
| 1.0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1.0 |
| 1.1 | 2 | 1 | 1 | 2 | 1 | 1 | 1 | 1.1 |
| 1.2 | 2 | 1 | 1 | 2 | 1 | 1 | 1 | 1.2 |
| 1.3 | 2 | 1 | 1 | 2 | 1 | 1 | 1 | 1.3 |
| 1.4 | 2 | 1 | 1 | 2 | 1 | 1 | 1 | 1.4 |
| 1.5 | 2 | 1 | 1 | 2 | 2 | 1 | 2 | 1.5 |
| 1.6 | 2 | 1 | 1 | 2 | 2 | 2 | 2 | 1.6 |
| 1.7 | 2 | 1 | 1 | 2 | 2 | 2 | 2 | 1.7 |
| 1.8 | 2 | 1 | 1 | 2 | 2 | 2 | 2 | 1.8 |
| 1.9 | 2 | 1 | 1 | 2 | 2 | 2 | 2 | 1.9 |
| 2.0 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2.0 |
| # | CEILING | FLOOR | DOWN | UP | HALFEVEN | HALFDOWN | HALFUP | # |
*Note: Some of the options below are not available in ICU4J because we use the JDK RoundingMode.*
| # | CEILING | FLOOR | DOWN | UP | HALFEVEN | HALFODD | HALFCEILING | HALFFLOOR | HALFDOWN | HALFUP | # |
|------|---------|-------|------|----|----------|---------|-------------|-----------|----------|--------|------|
| -2.0 | -2 | -2 | -2 | -2 | -2 | -2 | -2 | -2 | -2 | -2 | -2.0 |
| -1.9 | -1 | -2 | -1 | -2 | -2 | -2 | -2 | -2 | -2 | -2 | -1.9 |
| -1.8 | -1 | -2 | -1 | -2 | -2 | -2 | -2 | -2 | -2 | -2 | -1.8 |
| -1.7 | -1 | -2 | -1 | -2 | -2 | -2 | -2 | -2 | -2 | -2 | -1.7 |
| -1.6 | -1 | -2 | -1 | -2 | -2 | -2 | -2 | -2 | -2 | -2 | -1.6 |
| -1.5 | -1 | -2 | -1 | -2 | -2 | -1 | -1 | -2 | -1 | -2 | -1.5 |
| -1.4 | -1 | -2 | -1 | -2 | -1 | -1 | -1 | -1 | -1 | -1 | -1.4 |
| -1.3 | -1 | -2 | -1 | -2 | -1 | -1 | -1 | -1 | -1 | -1 | -1.3 |
| -1.2 | -1 | -2 | -1 | -2 | -1 | -1 | -1 | -1 | -1 | -1 | -1.2 |
| -1.1 | -1 | -2 | -1 | -2 | -1 | -1 | -1 | -1 | -1 | -1 | -1.1 |
| -1.0 | -1 | -1 | -1 | -1 | -1 | -1 | -1 | -1 | -1 | -1 | -1.0 |
| -0.9 | -0 | -1 | -0 | -1 | -1 | -1 | -1 | -1 | -1 | -1 | -0.9 |
| -0.8 | -0 | -1 | -0 | -1 | -1 | -1 | -1 | -1 | -1 | -1 | -0.8 |
| -0.7 | -0 | -1 | -0 | -1 | -1 | -1 | -1 | -1 | -1 | -1 | -0.7 |
| -0.6 | -0 | -1 | -0 | -1 | -1 | -1 | -1 | -1 | -1 | -1 | -0.6 |
| -0.5 | -0 | -1 | -0 | -1 | -0 | -1 | -0 | -1 | -0 | -1 | -0.5 |
| -0.4 | -0 | -1 | -0 | -1 | -0 | -0 | -0 | -0 | -0 | -0 | -0.4 |
| -0.3 | -0 | -1 | -0 | -1 | -0 | -0 | -0 | -0 | -0 | -0 | -0.3 |
| -0.2 | -0 | -1 | -0 | -1 | -0 | -0 | -0 | -0 | -0 | -0 | -0.2 |
| -0.1 | -0 | -1 | -0 | -1 | -0 | -0 | -0 | -0 | -0 | -0 | -0.1 |
| 0.0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.0 |
| 0.1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0.1 |
| 0.2 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 |
| 0.3 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0.3 |
| 0.4 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 |
| 0.5 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 0.5 |
| 0.6 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0.6 |
| 0.7 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0.7 |
| 0.8 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0.8 |
| 0.9 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0.9 |
| 1.0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1.0 |
| 1.1 | 2 | 1 | 1 | 2 | 1 | 1 | 1 | 1 | 1 | 1 | 1.1 |
| 1.2 | 2 | 1 | 1 | 2 | 1 | 1 | 1 | 1 | 1 | 1 | 1.2 |
| 1.3 | 2 | 1 | 1 | 2 | 1 | 1 | 1 | 1 | 1 | 1 | 1.3 |
| 1.4 | 2 | 1 | 1 | 2 | 1 | 1 | 1 | 1 | 1 | 1 | 1.4 |
| 1.5 | 2 | 1 | 1 | 2 | 2 | 1 | 2 | 1 | 1 | 2 | 1.5 |
| 1.6 | 2 | 1 | 1 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 1.6 |
| 1.7 | 2 | 1 | 1 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 1.7 |
| 1.8 | 2 | 1 | 1 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 1.8 |
| 1.9 | 2 | 1 | 1 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 1.9 |
| 2.0 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2.0 |
| # | CEILING | FLOOR | DOWN | UP | HALFEVEN | HALFODD | HALFCEILING | HALFFLOOR | HALFDOWN | HALFUP | # |
### Half Even
@@ -84,6 +86,10 @@ default mode specified for IEEE 754 floating point operations.
Also known as ties-to-even, round-to-nearest, RN or RNE.
### Half Odd
Similar to Half Even, but rounds ties to the nearest odd number instead of even number.
### Half Down
Values exactly on the 0.5 (half) mark are rounded down (next smaller absolute
@@ -106,6 +112,16 @@ removed.
All values are rounded towards the next greater absolute value (away from zero).
### Half Ceiling
Values exactly on the 0.5 (half) mark are rounded toward positive infinity (+∞).
This is the default rounding mode in ECMAScript. In CSS, it is known as "nearest".
### Half Floor
Values exactly on the 0.5 (half) mark are rounded towards negative infinity (-∞).
### Ceiling
All values are rounded towards positive infinity (+∞). Also known as RI for
@@ -219,20 +219,26 @@ symbols.
Note that the stem `.` is considered valid and is equivalent to `precision-integer`.
Fraction-precision stems accept a single optional option: the minimum or
maximum number of significant digits. This allows you to combine fraction
precision with certain significant digits capabilities. The following are
examples:
Fraction-precision stems accept a single optional option: a number of significant digits.
The options here correspond to the API functions on `FractionPrecision`. Some options
require specifying `r` or `s` for relaxed mode or strict mode. For more information, see
the API docs for UNumberRoundingPriority.
| Skeleton | Explanation | Equivalent C++ Code |
|---|---|---|
| `.##/@@@*` | At most 2 fraction digits, but guarantee <br/> at least 3 significant digits | `Precision::maxFraction(2)` <br/> `.withMinDigits(3)` |
| `.##/@##r` | Same as above | `Precision::maxFraction(2)` <br/> `.withSignificantDigits(1, 3, RELAXED)` |
| `.##/@@@r` | Same as above, but pad trailing zeros <br/> to at least 3 significant digits | `Precision::maxFraction(2)` <br/> `.withSignificantDigits(3, 3, RELAXED)` |
| `.00/@##` | Exactly 2 fraction digits, but do not <br/> display more than 3 significant digits | `Precision::fixedFraction(2)` <br/> `.withMaxDigits(3)` |
| `.00/@##s` | Same as above | `Precision::fixedFraction(2)` <br/> `.withSignificantDigits(1, 3, STRICT)` |
| `.00/@##s` | Same as above, but pad trailing zeros <br/> to at least 3 significant digits | `Precision::fixedFraction(2)` <br/> `.withSignificantDigits(3, 3, STRICT)` |
Precisely, the option starts with one or more `@` symbols. Then it contains
either a `*`, for `::withMinDigits`, or one or more `#` symbols, for
`::withMaxDigits`. If a `#` symbol is present, there must be only one `@`
symbol.
Precisely, the option follows the syntax of the significant digits stem (see below),
but one of the following must be true:
- Option has one or more `@`s followed by the wildcard character (`withMinDigits`)
- Option has exactly one `@` followed by zero or more `#`s (`withMaxDigits`)
- Option has one or more `@`s followed by zero or more `#`s and ends in `s` or `r` (`withSignificantDigits`)
#### Significant Digits Precision
@@ -251,6 +257,16 @@ digits. Then it contains either a `*`, for unlimited maximum significant
digits, or zero or more `#` symbols, which implies the minimum significant
digits when added to the `@` symbols.
#### Trailing Zero Display
***Starting with ICU 69***, a new option called `trailingZeroDisplay` was added.
To enable this in an ICU number skeleton, append `/w` to any precision token:
| Skeleton | Explanation | Equivalent C++ Code |
|---|---|---|
| `.00/w` | Exactly 2 fraction digits, but hide <br/> them if they are all 0 | `Precision::fixedFraction(2)` <br/> `.trailingZeroDisplay(` <br/> `UNUM_TRAILING_ZERO_HIDE_IF_WHOLE)` |
| `precision-curren` <br/> `cy-standard/w` | Currency rounding, but hide <br/> fraction digits if they are all 0 | `Precision::currency(UCURR_USAGE_STANDARD)` <br/> `.trailingZeroDisplay(` <br/> `UNUM_TRAILING_ZERO_HIDE_IF_WHOLE)` |
#### Wildcard Character
***Prior to ICU 67***, the symbol `+` was used for unlimited precision, instead
@@ -349,6 +365,8 @@ The following stems specify sign display:
- `sign-accounting-always` or `()!` (concise)
- `sign-except-zero` or `+?` (concise)
- `sign-accounting-except-zero` or `()?` (concise)
- `sign-negative` or `+-` (concise)
- `sign-accounting-negative` or `()-` (concise)
For more details, see
[`UNumberSignDisplay`](https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/unumberformatter_8h.html).
File diff suppressed because it is too large Load Diff
@@ -124,5 +124,5 @@ available. See the table below for each configuration in detail.
|:---|:---:|:---:|:---|
|`com.ibm.icu.impl.javaspi.ICULocaleServiceProvider.enableIcuVariants`|`"true"` or `"false"`|`"true"`|Whether if Locales with ICU's variant suffix will be included in `getAvailableLocales`. The current Java SE 6 locale sensitive service does not allow user provided provider implementations to override locales supported by JRE itself. When this property is `"true"` (default), ICU4J Locale Service Provider includes Locales with the suffix (`com.ibm.icu.impl.javaspi.ICULocaleServiceProvider.icuVariantSuffix`) in the variant field. For example, the ICU4J provider includes locales fr_FR and fr_FR_ICU4J in the available locale list. So JDK API user can still access the internationalization service object created by the ICU4J provider by the special locale fr_FR_ICU4J|
|`com.ibm.icu.impl.javaspi.ICULocaleServiceProvider.icuVariantSuffix`|*Any String*|`"ICU4J"` (49 or later) `"ICU"` (before 49)|Suffix string used in Locale's variant field to specify the ICU implementation.|
|`com.ibm.icu.impl.javaspi.ICULocaleServiceProvider.enableIso3Languages`|`"true"` or `"false"`|`"true"`|Whether if 3-letter language locales are included in `getAvailabeLocales`. Use of 3-letter language codes in `java.util.Locale` is not supported by the API reference document. However, the implementation does not check the length of language code, so there is no practical problem with it.|
|`com.ibm.icu.impl.javaspi.ICULocaleServiceProvider.enableIso3Languages`|`"true"` or `"false"`|`"true"`|Whether if 3-letter language locales are included in `getAvailableLocales`. Use of 3-letter language codes in `java.util.Locale` is not supported by the API reference document. However, the implementation does not check the length of language code, so there is no practical problem with it.|
|`com.ibm.icu.impl.javaspi.ICULocaleServiceProvider.useDecimalFormat`|`"true"` or `"false"`|`"false"`|Whether if `java.text.DecimalFormat` subclass is used for `NumberFormat#getXXXInstance`. `DecimalFormat#format(Object,StringBuffer,FieldPosition)` is declared as final, so ICU cannot override the implementation. As a result, some number types such as `BigInteger`/`BigDecimal` are not handled by the ICU implementation. If a client expects `NumberFormat#getXXXInstance` returns a `DecimalFormat` (for example, need to manipulate decimal format patterns), he/she can set true to this setting. However, in this case, `BigInteger`/`BigDecimal` support is not done by ICU's implementation.|
+454
View File
@@ -0,0 +1,454 @@
---
layout: default
title: ICU4J Readme
nav_order: 8
parent: ICU
---
<!--
© 2020 and later: Unicode, Inc. and others.
License & terms of use: http://www.unicode.org/copyright.html
-->
# ICU4J Readme
{: .no_toc }
## Contents
{: .no_toc .text-delta }
1. TOC
{:toc}
---
## Introduction to ICU4J
The International Components for Unicode (ICU) library provides robust and full-featured Unicode services on a wide variety of platforms. ICU supports the most current version of the Unicode standard, including support for supplementary characters (needed for GB 18030 repertoire support).
Java provides a strong foundation for global programs, and IBM and the ICU team played a key role in providing globalization technology to Java. But because of its long release schedule, Java cannot always keep up with evolving standards. The ICU team continues to extend Java's Unicode and internationalization support, focusing on improving performance, keeping current with the Unicode standard, and providing richer APIs, while remaining as compatible as possible with the original Java text and internationalization API design.
ICU4J is an add-on to the regular JRE that provides:
* [Collation](https://unicode-org.github.io/icu/userguide/collation) – rule-based, up-to-date Unicode Collation Algorithm (UCA) sorting order
    For fast multilingual string comparison; faster and more complete than the J2SE implementation
* [Charset Detection](https://unicode-org.github.io/icu/userguide/conversion/detection) – Recognition of various single and multibyte charsets
    Useful for recognizing untagged text data
* [UnicodeSet](https://unicode-org.github.io/icu/userguide/strings/unicodeset) – standard set operations optimized for sets of Unicode characters
    UnicodeSets can be built from string patterns using any Unicode properties.
* [Transforms](https://unicode-org.github.io/icu/userguide/transforms) – a flexible mechanism for Unicode text conversions
    Including Full/Halfwidth conversions, Normalization, Case conversions, Hex conversions, and transliterations between scripts (50+ pairs)
* [Unicode Normalization](https://unicode-org.github.io/icu/userguide/transforms/normalization) – NFC, NFD, NFKD, NFKC
    For canonical text representations, needed for XML and the net
* [International Calendars](https://unicode-org.github.io/icu/userguide/datetime/calendar) – Arabic, Buddhist, Chinese, Hebrew, Japanese, Ethiopic, Islamic, Coptic and other calendars
    Required for correct presentation of dates in certain countries
* [Date Format Enhancements](https://unicode-org.github.io/icu/userguide/format_parse/datetime) – Date/time pattern generator, Relative date formatting, etc.
    Enhancements to the normal Java date formatting.
* [Number Format Enhancements](https://unicode-org.github.io/icu/userguide/format_parse/numbers) – Scientific Notation, Spelled-out, Compact decimal format, etc.
    Enhancements to the normal Java number formatting. The spell-out format is used for checks and similar documents
* [Enhanced Word-Break Detection](https://unicode-org.github.io/icu/userguide/boundaryanalysis) – Rule-based, supports Thai, Khmer, Chinese, etc.
    Required for correct support of Thai
* [Unicode Text Compression](https://unicode-org.github.io/icu/userguide/conversion/compression) – Standard compression of Unicode text
    Suitable for large numbers of small fields, where LZW and similar schemes do not apply
* [Charset Conversion](https://unicode-org.github.io/icu/userguide/conversion) – Conversion to and from different charsets.
    Plugs into Java CharsetProvider Service Provider Interface (SPI)
> :point_right: **Note:** We continue to provide assistance to Java, and in some cases, ICU4J support has been rolled into a later release of Java. For example, BCP47 language tag support including Unicode locale extensions is now in Java 7\. However, the most current and complete version is always found in ICU4J.
## What Is New In The Current Release?
See the [ICU download page](http://site.icu-project.org/download/) to find the subpage for the current release, including any other changes, bug fixes, known issues, changes to supported platforms and build environments, and migration issues for existing applications migrating from previous ICU releases.
The subpage for the current release will also include an API Change Report, both for ICU4C and ICU4J, for a complete list of APIs added, removed, or changed in this release.
The list of API changes since the previous ICU4J release is available [here](https://htmlpreview.github.io/?https://raw.githubusercontent.com/unicode-org/icu/master/icu4j/APIChangeReport.html).
Changes in previous releases can also be found the main [ICU download page](http://site.icu-project.org/download) in its version-specific subpages.
## License Information
The ICU projects (ICU4C and ICU4J) are hosted by the [Unicode Consortium](http://www.unicode.org/). The ICU binary and source files are distributed under the [UNICODE DATA FILES AND SOFTWARE LICENSE](http://www.unicode.org/copyright.html). The full copy of the license and third party software licenses are available in [LICENSE](https://github.com/unicode-org/icu/blob/master/icu4j/main/shared/licenses/LICENSE) file included in this package.
## Platform Dependencies
The minimum Java runtime version supported by ICU4J 68 is version 7\. Java runtime version 6 is not supported.
ICU4J since version 63 depend on J2SE 7 functionality. Therefore, ICU4J only runs on JRE version 7 or later. ICU4J 68 is tested on JRE 7, 8, 9, 10 and 11.
## How to Download ICU4J
There are a few different ways to download the ICU4J releases.
* **Official Release:**
If you want to use ICU4J (as opposed to developing it), your best bet is to download an official, packaged version of the ICU4J library files. These versions are tested more thoroughly than day-to-day development builds, and they are packaged in jar files for convenient download.
* [ICU Download page](http://www.icu-project.org/download/)
* Maven repository:
~~~
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j</artifactId>
<version>68.1</version>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j-charset</artifactId>
<version>68.1</version>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j-localespi</artifactId>
<version>68.1</version>
</dependency>
~~~
* **GitHub Source Repository:**
If you are interested in developing features, patches, or bug fixes for ICU4J, you should probably be working with the latest version of the ICU4J source code. You will need to clone and checkout the code from our GitHub repository to ensure that you have the most recent version of all of the files. There are several ways to do this. Please follow the directions that are contained on the [Source Repository page](http://www.icu-project.org/repository/) for details.
For more details on how to download ICU4J directly from the web site, please see the ICU download page at [http://www.icu-project.org/download/](http://www.icu-project.org/download/)
## The Structure and Contents of ICU4J
Below, all directory paths are relative to the directory where the ICU4J source archive is extracted.
### Information and build files
| Path | Description |
|------------------------------|-----------------------------------------------------------------------------------------|
| readme.html | A description of ICU4J (International Components for Unicode for Java) |
| build.html | The main Ant build file for ICU4J. See [How to Install and Build](#how-to-install-and-build) for more information |
| main/shared/licenses/LICENSE | ICU license |
### ICU4J runtime class files
| Path | Sub-component Name | Build Dependencies | Public API Packages | Description |
|-------------------------|--------------------|---------------------------|---------------------|---------------|
| `main/classes/charset` | `icu4j-charset` | `icu4j-core` | `com.ibm.icu.charset` | Implementation of `java.nio.charset.spi.CharsetProvider`. This sub-component is shipped as `icu4j-charset.jar` along with ICU charset converter data files. |
| `main/classes/collate` | `icu4j-collate` | `icu4j-core` | `com.ibm.icu.text` <br/> `com.ibm.icu.util` | Collator APIs and implementation. Also includes some public API classes that depend on Collator. This sub-component is packaged as a part of `icu4j.jar`. |
| `main/classes/core` | `icu4j-core` | n/a | `com.ibm.icu.lang` <br/> `com.ibm.icu.math` <br/> `com.ibm.icu.text` <br/> `com.ibm.icu.util` | ICU core API classes and implementation. This sub-component is packaged as a part of `icu4j.jar`. |
| `main/classes/currdata` | `icu4j-currdata` | `icu4j-core` | n/a | No public API classes. Provides access to currency display data. This sub-component is packaged as a part of `icu4j.jar`. |
| `main/classes/langdata` | `icu4j-langdata` | `icu4j-core` | n/a | No public API classes. Provides access to language display data. This sub-component is packaged as a part of `icu4j.jar`. |
| `main/classes/localespi` | `icu4j-localespi` | `icu4j-core` <br/> `icu4j-collate` | n/a | Implementation of various locale-sensitive service providers defined in `java.text.spi` and `java.util.spi` in J2SE 6.0 or later Java releases. This sub-component is shipped as `icu4j-localespi.jar`. |
| `main/classes/regiondata` | `icu4j-regiondata` | `icu4j-core` | n/a | No public API classes. Provides access to region display data. This sub-component is packaged as a part of `icu4j.jar`. |
| `main/classes/translit` | `icu4j-translit` | `icu4j-core` | `com.ibm.icu.text` | Transliterator APIs and implementation. This sub-component is packaged as a part of `icu4j.jar`. |
### ICU4J unit test files
| Path | Sub-component Name | Runtime Dependencies | Description |
|-------------------------------------------|---------------------------------|--------------------------------------------------------------------------------------------------------------|-------------------------------------------------|
| `main/tests/charset` | `icu4j-charset-tests` | `icu4j-charset` <br/> `icu4j-core` <br/> `icu4j-test-framework` | Test suite for charset sub-component. |
| `main/tests/collate` | `icu4j-collate-tests` | `icu4j-collate` <br/> `icu4j-core` <br/> `icu4j-test-framework` | Test suite for collate sub-component. |
| `main/tests/core` | `icu4j-core-tests` | `icu4j-core` <br/> `icu4j-currdata` <br/> `icu4j-langdata` <br/> `icu4j-regiondata` <br/> `icu4j-test-framework` | Test suite for core sub-component. |
| `main/tests/framework` | `icu4j-test-framework` | `icu4j-core` | Common ICU4J unit test framework and utilities. |
| `main/tests/localespi` | `icu4j-localespi-tests` | `icu4j-core` <br/> `icu4j-collate` <br/> `icu4j-currdata` <br/> `icu4j-langdata` <br/> `icu4j-localespi` <br/> `icu4j-regiondata` <br/> `icu4j-test-framework` | Test suite for localespi sub-component. |
| `main/tests/packaging` | `icu4j-packaging-tests` | `icu4j-core` <br/> `icu4j-test-framework` | Test suite for sub-component packaging. |
| `main/tests/translit` | `icu4j-translit-tests` | `icu4j-core` <br/> `icu4j-translit` <br/> `icu4j-test-framework` | Test suite for translit sub-component. |
### Others
<table>
<tr>
<th>Path</th>
<th>Description</th>
</tr>
<tr>
<td><code>main/shared</code></td>
<td>Files shared by ICU4J sub-components under the <code>main</code> directory including: <ul> <li>ICU4J runtime data archive (icudata.jar).</li> <li>ICU4J unit test data archive (testdata.jar).</li> <li>Shared Ant build script and configuration files.</li> <li>License files.</li></ul> </td>
</tr>
<tr>
<td><code>demos</code></td>
<td>ICU4J demo programs.</td>
</tr>
<tr>
<td><code>perf-tests</code></td>
<td>ICU4J performance test files.</td>
</tr>
<tr>
<td><code>tools</code></td>
<td>ICU4J tools including: <ul> <li>Custom JavaDoc taglets used for generating ICU4J API references.</li> <li>API report tool and data.</li> <li>Other independent utilities used for ICU4J development.</li> </ul></td>
</tr>
<tr>
<td><code>lib</code></td>
<td>Folder used for downloading depedency libraries. <br/> <b>Note:</b> ICU4J runtime libraries do not depend on any external libraries other than JDK. These dependencies are for testing (such as JUnit). </td>
</tr>
</table>
## Where to get Documentation
The [ICU user's guide](https://unicode-org.github.io/icu/userguide/) contains lots of general information about ICU, in its C, C++, and Java incarnations.
The complete API documentation for ICU4J (javadoc) is available on the ICU4J web site, and can be built from the sources:
* [Index to all ICU4J API](https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/)
* [Charset Detector](https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/text/CharsetDetector.html) – Detection of charset from a byte stream
* International Calendars – [Buddhist](https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/util/BuddhistCalendar.html), [Chinese](https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/util/ChineseCalendar.html), [Coptic](https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/util/CopticCalendar.html), [Ethiopic](https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/util/EthiopicCalendar.html), [Gregorian](https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/util/GregorianCalendar.html), [Hebrew](https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/util/HebrewCalendar.html), [Indian](https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/util/IndianCalendar.html), [Islamic](https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/util/IslamicCalendar.html), [Japanese](https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/util/JapaneseCalendar.html), Persian, Dangi.
* Time Zone Enhancements – [Time zone transition and rule detection](https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/util/BasicTimeZone.html), [iCalendar VTIMEZONE formatting and parsing](https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/util/VTimeZone.html), [Custom time zones constructed by user defined rules](https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/util/RuleBasedTimeZone.html).
* Date Format Enhancements – [Date/Time Pattern Generator](https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/text/DateTimePatternGenerator.html), [Date Interval Format](https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/text/DateIntervalFormat.html), [Duration Format](https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/text/DurationFormat.html).
* [Unicode Normalization](https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/text/Normalizer.html) – Canonical text representation for W3C.
* [Number Format Enhancements](https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/text/NumberFormat.html) – Scientific Notation, Spelled out.
* [Enhanced word-break detection](https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/text/BreakIterator.html) – Rule-based, supports Thai
* [Transliteration](https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/text/Transliterator.html) – A general framework for converting text from one format to another, e.g. Cyrillic to Latin, or Hex to Unicode.
* Unicode Text [Compression](https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/text/UnicodeCompressor.html) & [Decompression](https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/text/UnicodeDecompressor.html) – 2:1 compression on English Unicode text.
* Collation – [Rule-based sorting](https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/text/RuleBasedCollator.html), [Efficient multi-lingual searching](https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/text/StringSearch.html), [Alphabetic indexing](https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/text/AlphabeticIndex.html)
## How to Install and Build
To install ICU4J, simply place the pre-built jar file `icu4j.jar` on your Java `CLASSPATH`. If you need Charset API support please also place `icu4j-charset.jar` on your class path along with `icu4j.jar`.
To build ICU4J, you will need JDK 7 or later (JDK 8 is the reference environment for this release) and the Apache Ant version 1.9 or later. It's recommended to install both the JDK and Ant somewhere _outside_the ICU4J directory. For example, on Linux you might install these in `/usr/local`.
* Install JDK 8.
* Install the [Apache Ant](https://ant.apache.org/) 1.9 or later.
* Set environment variables `JAVA_HOME`, `ANT_HOME` and `PATH`, for example:
~~~
set JAVA_HOME=C:\jdk1.8.0
set ANT_HOME=C:\apache-ant
set PATH=%JAVA_HOME%\bin;%ANT_HOME%\bin;%PATH%
~~~
Once the JDK and Ant are configured, run the desired target defined in `build.xml`. The default target is `jar` which compiles ICU4J library class files and create ICU4J jar files. For example:
~~~
C:\icu4j>ant
Buildfile: C:\icu4j\build.xml
info:
[echo] ----- Build Environment Information -------------------
[echo] Java Home: C:\jdk1.8.0\jre
[echo] Java Version: 1.8.0_181
[echo] Ant Home: C:\apache-ant
[echo] Ant Version: Apache Ant(TM) version 1.10.1 compiled on February 2 2017
[echo] OS: Windows 10
[echo] OS Version: 10.0
[echo] OS Arch: amd64
[echo] Host: ICUDEV
[echo] -------------------------------------------------------
core:
@compile:
[echo] build-local: ../../shared/../../build-local.properties
[echo] --- java compiler arguments ------------------------
[echo] source dir: C:\icu4j\main\classes\core/src
[echo] output dir: C:\icu4j\main\classes\core/out/bin
[echo] bootclasspath:
[echo] classpath:
[echo] source: 1.7
[echo] target: 1.7
[echo] debug: on
[echo] encoding: UTF-8
[echo] compiler arg: -Xlint:all,-deprecation,-dep-ann,-options,-overrides
[echo] ----------------------------------------------------
[mkdir] Created dir: C:\icu4j\main\classes\core\out\bin
[javac] Compiling 470 source files to C:\icu4j\main\classes\core\out\bin
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
compile:
@copy:
[copy] Copying 24 files to C:\icu4j\main\classes\core\out\bin
set-icuconfig-datapath:
copy-data:
[unjar] Expanding: C:\icu4j\main\shared\data\icudata.jar into C:\icu4j\main\
classes\core\out\bin
[unjar] Expanding: C:\icu4j\main\shared\data\icutzdata.jar into C:\icu4j\mai
n\classes\core\out\bin
...
...
...
localespi:
@compile:
[echo] build-local: ../../shared/../../build-local.properties
[echo] --- java compiler arguments ------------------------
[echo] source dir: C:\icu4j\main\classes\localespi/src
[echo] output dir: C:\icu4j\main\classes\localespi/out/bin
[echo] bootclasspath:
[echo] classpath: C:\icu4j\main\classes\core\out\lib\icu4j-core.jar;C:
\icu4j\main\classes\collate\out\lib\icu4j-collate.jar
[echo] source: 1.7
[echo] target: 1.7
[echo] debug: on
[echo] encoding: UTF-8
[echo] compiler arg: -Xlint:all,-deprecation,-dep-ann,-options
[echo] ----------------------------------------------------
[mkdir] Created dir: C:\icu4j\main\classes\localespi\out\bin
[javac] Compiling 22 source files to C:\icu4j\main\classes\localespi\out\bin
compile:
@copy:
[copy] Copying 11 files to C:\icu4j\main\classes\localespi\out\bin
copy:
@jar:
[mkdir] Created dir: C:\icu4j\main\classes\localespi\out\lib
[copy] Copying 1 file to C:\icu4j\main\classes\localespi\out
[jar] Building jar: C:\icu4j\main\classes\localespi\out\lib\icu4j-localesp
i.jar
jar:
@src-jar:
[jar] Building jar: C:\icu4j\main\classes\localespi\out\lib\icu4j-localesp
i-src.jar
src-jar:
build:
jar:
[copy] Copying 1 file to C:\icu4j
[copy] Copying 1 file to C:\icu4j
BUILD SUCCESSFUL
Total time: 30 seconds
~~~
> :point_right: **Note**: The above output is an example. The numbers are likely to be different with the current version ICU4J.
The following are some targets that you can provide to `ant`. For more targets run `ant -projecthelp` or see the build.xml file.
| **jar (default)** | Create ICU4J runtime library jar archives (`icu4j.jar`, `icu4j-charset.jar` and `icu4j-localespi.jar`) in the root ICU4J directory. |
| **check** | Build all ICU4J runtime library classes and corresponding unit test cases, then run the tests. |
| **clean** | Remove all build output files. |
| **main** | Build all ICU4J runtime library sub-components (under the directory `main/classes`). |
| **tests** | Build all ICU4J unit test sub-components (under the directory `main/tests`) and their dependencies. |
| **tools** | Build the tools. |
| **docs** | Run javadoc over the ICU4J runtime library files, generating an HTML documentation tree in the subdirectory `doc`. |
| **jarDocs** | Create ICU4J doc jar archive (`icu4jdocs.jar`) containing API reference docs in the root ICU4J directory. |
| **jarDemos** | Create ICU4J demo jar archive (`icu4jdemos.jar`) in the root ICU4J directory. |
For more information, read the Ant documentation and the **build.xml** file.
> :point_right: **Note**: If you get an OutOfMemoryError when you are running <tt>"ant check"</tt>, you can set the heap size of the jvm by setting the environment variable JVM_OPTIONS to the appropriate java options.
> :point_right: **Note**: **Eclipse users:** See the ICU4J site for information on [how to configure Eclipse](http://site.icu-project.org/setup/eclipse) to build and develop ICU4J on Eclipse IDE.
> :point_right: **Note**: To install and configure ICU4J Locale Service Provider, please refer the user guide page [ICU4J Locale Service Provider](https://unicode-org.github.io/icu/userguide/icu4j-locale-service-provider).
## Trying Out ICU4J
> :point_right: **Note**: the demos provided with ICU4J are for the most part undocumented. This list can show you where to look, but you'll have to experiment a bit. The demos are **unsupported** and may change or disappear without notice.
The icu4j.jar file contains only the ICU4J runtime library classes, not the demo classes, so unless you build ICU4J there is little to try out.
### Charset
To try out the **Charset** package, build **icu4j.jar** and **icu4j-charset.jar** using the `jar` target. You can use the charsets by placing these files on your classpath.
~~~
java -cp $icu4j_root/icu4j.jar:$icu4j_root/icu4j-charset.jar <your program>
~~~
### Other demos
The other demo programs are **not supported** and exist only to let you experiment with the ICU4J classes. First, build ICU4J using `ant jarDemos`. Then launch the demos as below:
~~~
java -jar $icu4j_root/icu4jdemos.jar
~~~
## ICU4J Resource Information
Starting with release 2.1, ICU4J includes its own resource information which is completely independent of the JRE resource information. (Note, ICU4J 2.8 to 3.4, time zone information depends on the underlying JRE). The ICU4J resource information is equivalent to the information in ICU4C and many resources are, in fact, the same binary files that ICU4C uses.
By default the ICU4J distribution includes all of the standard resource information. It is located under the directory com/ibm/icu/impl/data. Depending on the service, the data is in different locations and in different formats.
> :point_right: **Note**: This will continue to change from release to release, so clients should not depend on the exact organization of the data in ICU4J.
* The primary **locale data** is under the directory `icudt68b`, as a set of `".res"` files whose names are the locale identifiers. Locale naming is documented the `com.ibm.icu.util.ULocale` class, and the use of these names in searching for resources is documented in `com.ibm.icu.util.UResourceBundle`.
* The **break iterator data** is under the directory `icudt68b/brkitr`, as a set of `".res"`, `".brk"` and `".dict"` files.
* The **collation data** is under the directory `icudt68b/coll`, as a set of `".res"` files.
* The **currency display name data** is under the directory `icudt68b/curr`, as a set of `".res"` files.
* The **language display name data** is under the directory `icudt68b/lang`, as a set of `".res"` files.
* The **rule-based number format data** is under the directory `icudt68b/rbnf`, as a set of `".res"` files.
* The **region display name data** is under the directory `icudt68b/region`, as a set of `".res"` files.
* The **rule-based transliterator data** is under the directory `icudt68b/translit`, as a set of `".res"` files.
* The **measurement unit data** is under the directory `icudt68b/unit`, as a set of `".res"` files.
* The **time zone display name data** is under the directory `icudt68b/zone`, as a set of `".res"` files.
* The **character property data** and default **unicode collation algorithm (UCA) data** is found under the directory `icudt68b`, as a set of `".icu"` files.
* The **normalization data** is found under the directory `icudt68b`, as a set of `".nrm"` files.
* The **character set converter data** is under the directory `icudt68b`, as a set of `".cnv"` files. These files are currently included only in icu-charset.jar.
* The **time zone rule data** is under the directory `icudt68b`, as `zoneinfo64.res`.
* The **holiday data** is under the directory `icudt68b`, as a set of `".class"` files, named `"HolidayBundle_"` followed by the locale ID.
Some of the data files alias or otherwise reference data from other data files. One reason for this is because some locale names have changed. For example, `he_IL` used to be `iw_IL`. In order to support both names but not duplicate the data, one of the resource files refers to the other file's data. In other cases, a file may alias a portion of another file's data in order to save space. Currently ICU4J provides no tool for revealing these dependencies.
> :point_right: **Note**: Java's `Locale` class silently converts the language code `"he"` to `"iw"` when you construct the Locale (for versions of Java through Java 5). Thus Java cannot be used to locate resources that use the `"he"` language code. ICU, on the other hand, does not perform this conversion in ULocale, and instead uses aliasing in the locale data to represent the same set of data under different locale ids.
Resource files that use locale ids form a hierarchy, with up to four levels: a root, language, region (country), and variant. Searches for locale data attempt to match as far down the hierarchy as possible, for example, `"he_IL"` will match `he_IL`, but `"he_US"` will match `he` (since there is no `US` variant for he, and `"xx_YY` will match root (the default fallback locale) since there is no `xx` language code in the locale hierarchy. Again, see `java.util.ResourceBundle` for more information.
**Currently ICU4J provides no tool for revealing these dependencies** between data files, so trimming the data directly in the ICU4J project is a hit-or-miss affair. The key point when you remove data is to make sure to remove all dependencies on that data as well. For example, if you remove `he.res`, you need to remove `he_IL.res`, since it is lower in the hierarchy, and you must remove iw.res, since it references `he.res`, and `iw_IL.res`, since it depends on it (and also references `he_IL.res`).
Unfortunately, the jar tool in the JDK provides no way to remove items from a jar file. Thus you have to extract the resources, remove the ones you don't want, and then create a new jar file with the remaining resources. See the jar tool information for how to do this. Before 'rejaring' the files, be sure to thoroughly test your application with the remaining resources, making sure each required resource is present.
### Using additional resource files with ICU4J
> :warning: **Warning: Resource file formats can change across releases of ICU4J!**
>
> The format of ICU4J resources is not part of the API. Clients who develop their own resources for use with ICU4J should be prepared to regenerate them when they move to new releases of ICU4J.
We are still developing ICU4J's resource mechanism. Currently it is not possible to mix icu's new binary `.res` resources with traditional java-style `.class` or `.txt` resources. We might allow for this in a future release, but since the resource data and format is not formally supported, you run the risk of incompatibilities with future releases of ICU4J.
Resource data in ICU4J is checked in to the repository as a jar file containing the resource binaries, `$icu4j_root/main/shared/data/icudata.jar`. This means that inspecting the contents of these resources is difficult. They currently are compiled from ICU4C `.txt` file data. You can view the contents of the ICU4C text resource files to understand the contents of the ICU4J resources.
The files in `icudata.jar` get extracted to `com/ibm/icu/impl/data` in the build output directory by some build targets.
### Building ICU4J Resources from ICU4C
ICU4J data is built by ICU4C tools. Please see [`icu4j-readme.txt`](https://github.com/unicode-org/icu/blob/master/icu4c/source/data/icu4j-readme.txt) in `icu4c/source/data` for the procedures.
#### Generating Data from CLDR
> :point_right: **Note**: This procedure assumes that all 3 sources are present
> :point_right: **Note**: The following example was written using the example of the CLDR 38 release which was released in conjunction with the ICU 68.1 release
1. Checkout or download CLDR version `release-38`
2. Checkout ICU with tag `release-68-1`
3. cd to icu4c/source/data directory
4. Follow the instructions in [`icu4c/source/data/cldr-icu-readme.txt`](https://github.com/unicode-org/icu/blob/master/icu4c/source/data/cldr-icu-readme.txt)
5. Rebuild ICU4C with the newly generated data.
6. Run ICU4C tests to verify that the new data is good.
7. Build ICU4J data from ICU4C data by following the procedures in [`icu4j/source/data/icu4j-readme.txt`](https://github.com/unicode-org/icu/blob/master/icu4c/source/data/icu4j-readme.txt)
8. cd to `icu4j` dir
9. Build and test icu4j
## About ICU4J Time Zone
ICU4J library includes the latest time zone data, as of the release date. However, time zone data is frequently updated in response to changes made by local governments around the world. If you need to update the time zone data, please refer the ICU user guide topic [Updating the Time Zone Data](https://unicode-org.github.io/icu/userguide/datetime/timezone#updating-the-time-zone-data).
You can optionally configure ICU4J date and time service classes to use underlying JDK TimeZone implementation (see the ICU4J API reference [TimeZone](https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/util/TimeZone.html) for the details). When this configuration is enabled, ICU's own time zone data won't be used and you have to get time zone data patches from the JRE vendor.
## Where to Find More Information
[http://www.icu-project.org/](http://www.icu-project.org/) is the home page of International Components for Unicode development project
## Submitting Comments, Requesting Features and Reporting Bugs
Your comments are important to making ICU4J successful. We are committed to investigate any bug reports or suggestions, and will use your feedback to help plan future releases.
To submit comments, request features and report bugs, please see [ICU bug database information](http://site.icu-project.org/bugs) or contact us through the [ICU Support mailing list](http://site.icu-project.org/contacts). While we are not able to respond individually to each comment, we do review all comments.
## Thank you for your interest in ICU4J!
* * *
© 2016 and later: Unicode, Inc. and others.
License & terms of use: [http://www.unicode.org/copyright.html](http://www.unicode.org/copyright.html)
+1 -1
View File
@@ -610,7 +610,7 @@ files are not in such a directory, derb fails with U_MISSING_RESOURCE_ERROR.
of the filter rules matters a great deal in how effective your data size
reduction can be, and the wildcard `*` can sometimes produce behavior that is
tricky to reason about. For example, these three lists of filter rules look
similar on first glance but acutally produce different output:
similar on first glance but actually produce different output:
<table>
<tr>
+142 -82
View File
@@ -768,91 +768,131 @@ loadable data objects.)
#### ICU.dat package files
* Source format: (list of files provided as input to the icupkg tool, or
on the gencmn tool command line)
* Binary format: .dat: [source/tools/toolutil/pkg_gencmn.cpp](../../icu4c/source/tools/toolutil/pkg_gencmn.cpp)
* Generator tool: [icupkg](../../icu4c/source/tools/icupkg) or
[gencmn](../../icu4c/source/tools/gencmn)
* Binary format: .dat:
[source/tools/toolutil/pkg_gencmn.cpp](https://github.com/unicode-org/icu/blob/master/icu4c/source/tools/toolutil/pkg_gencmn.cpp)
* Generator tool:
[icupkg](https://github.com/unicode-org/icu/blob/master/icu4c/source/tools/icupkg)
or
[gencmn](https://github.com/unicode-org/icu/blob/master/icu4c/source/tools/gencmn)
#### Resource bundles
* Source format: .txt: [icuhtml/design/bnf_rb.txt](https://github.com/unicode-org/icu-docs/blob/master/design/bnf_rb.txt)
* Binary format: .res: [source/common/uresdata.h](../../icu4c/source/common/uresdata.h)
* Generator tool: [genrb](../../icu4c/source/tools/genrb)
* Source format: .txt:
[icuhtml/design/bnf_rb.txt](https://github.com/unicode-org/icu-docs/blob/master/design/bnf_rb.txt)
* Binary format: .res:
[source/common/uresdata.h](https://github.com/unicode-org/icu/blob/master/icu4c/source/common/uresdata.h)
* Generator tool:
[genrb](https://github.com/unicode-org/icu/blob/master/icu4c/source/tools/genrb)
#### Unicode conversion mapping tables
* Source format: .ucm: [Conversion Data chapter](conversion/data.md)
* Binary format: .cnv: [source/common/ucnvmbcs.h](../../icu4c/source/common/ucnvmbcs.h)
* Generator tool: [makeconv](../../icu4c/source/tools/makeconv)
* Binary format: .cnv:
[source/common/ucnvmbcs.h](https://github.com/unicode-org/icu/blob/master/icu4c/source/common/ucnvmbcs.h)
* Generator tool:
[makeconv](https://github.com/unicode-org/icu/blob/master/icu4c/source/tools/makeconv)
#### Conversion (charset) aliases
* Source format: [source/data/mappings/convrtrs.txt](../../icu4c/source/data/mappings/convrtrs.txt):
contains format description. The command "uconv -l --canon"
will also generate the alias table from the currently used
copy of ICU.
* Binary format: cnvalias.icu: [source/common/ucnv_io.cpp](../../icu4c/source/common/ucnv_io.cpp)
* Generator tool: [gencnval](../../icu4c/source/tools/gencnval)
* Source format:
[source/data/mappings/convrtrs.txt](https://github.com/unicode-org/icu/blob/master/icu4c/source/data/mappings/convrtrs.txt):
contains format description. The command "uconv -l --canon" will also
generate the alias table from the currently used copy of ICU.
* Binary format: cnvalias.icu:
[source/common/ucnv_io.cpp](https://github.com/unicode-org/icu/blob/master/icu4c/source/common/ucnv_io.cpp)
* Generator tool:
[gencnval](https://github.com/unicode-org/icu/blob/master/icu4c/source/tools/gencnval)
#### Unicode Character Data (Properties; for Java only: hardcoded in C common library)
* Source format: [source/data/unidata/ppucd.txt](../../icu4c/source/data/unidata/ppucd.txt):
[Preparsed UCD](http://site.icu-project.org/design/props/ppucd)
* Binary format: uprops.icu: [tools/unicode/c/genprops/corepropsbuilder.cpp](../../tools/unicode/c/genprops/corepropsbuilder.cpp)
* Generator tool: [genprops](../../tools/unicode/c/genprops)
* Source format:
[source/data/unidata/ppucd.txt](https://github.com/unicode-org/icu/blob/master/icu4c/source/data/unidata/ppucd.txt):
[Preparsed UCD](http://site.icu-project.org/design/props/ppucd)
* Binary format: uprops.icu:
[tools/unicode/c/genprops/corepropsbuilder.cpp](https://github.com/unicode-org/icu/blob/master/tools/unicode/c/genprops/corepropsbuilder.cpp)
* Generator tool:
[genprops](https://github.com/unicode-org/icu/blob/master/tools/unicode/c/genprops)
#### Unicode Character Data (Case mappings; for Java only: hardcoded in C common library)
* Source format: [source/data/unidata/*.txt](../../icu4c/source/data/unidata):
[Unicode Character Database](http://www.unicode.org/onlinedat/online.html)
* Binary format: ucase.icu: [tools/unicode/c/genprops/casepropsbuilder.cpp](../../tools/unicode/c/genprops/casepropsbuilder.cpp)
* Generator tool: [genprops](../../tools/unicode/c/genprops)
* Source format:
[source/data/unidata/*.txt](https://github.com/unicode-org/icu/blob/master/icu4c/source/data/unidata):
[Unicode Character Database](http://www.unicode.org/onlinedat/online.html)
* Binary format: ucase.icu:
[tools/unicode/c/genprops/casepropsbuilder.cpp](https://github.com/unicode-org/icu/blob/master/tools/unicode/c/genprops/casepropsbuilder.cpp)
* Generator tool:
[genprops](https://github.com/unicode-org/icu/blob/master/tools/unicode/c/genprops)
#### Unicode Character Data (BiDi, and Arabic shaping; for Java only: hardcoded in C common library)
* Source format: [source/data/unidata/*.txt](../../icu4c/source/data/unidata):
[Unicode Character Database](http://www.unicode.org/onlinedat/online.html)
* Binary format: ubidi.icu: [tools/unicode/c/genprops/bidipropsbuilder.cpp](../../tools/unicode/c/genprops/bidipropsbuilder.cpp)
* Generator tool: [genprops](../../tools/unicode/c/genprops)
* Source format:
[source/data/unidata/*.txt](https://github.com/unicode-org/icu/blob/master/icu4c/source/data/unidata):
[Unicode Character Database](http://www.unicode.org/onlinedat/online.html)
* Binary format: ubidi.icu:
[tools/unicode/c/genprops/bidipropsbuilder.cpp](https://github.com/unicode-org/icu/blob/master/tools/unicode/c/genprops/bidipropsbuilder.cpp)
* Generator tool:
[genprops](https://github.com/unicode-org/icu/blob/master/tools/unicode/c/genprops)
#### Unicode Character Data (Normalization since ICU 4.4) & custom normalization data
* Source format: [source/data/unidata/norm2/*.tx](../../icu4c/source/data/unidata/norm2):
Files derived from the [Unicode Character Database](http://www.unicode.org/onlinedat/online.html),
or custom data.
* Binary format: .nrm: [source/common/normalizer2impl.h](../../icu4c/source/common/normalizer2impl.h)
* Generator tool: [gennorm2](../../icu4c/source/tools/gennorm2)
* Source format:
[source/data/unidata/norm2/*.tx](https://github.com/unicode-org/icu/blob/master/icu4c/source/data/unidata/norm2):
Files derived from the [Unicode Character
Database](http://www.unicode.org/onlinedat/online.html), or custom data.
* Binary format: .nrm:
[source/common/normalizer2impl.h](https://github.com/unicode-org/icu/blob/master/icu4c/source/common/normalizer2impl.h)
* Generator tool:
[gennorm2](https://github.com/unicode-org/icu/blob/master/icu4c/source/tools/gennorm2)
#### Unicode Character Data (Character names)
* Source format: [source/data/unidata/UnicodeData.txt](../../icu4c/source/data/unidata/UnicodeData.txt):
[Unicode Character Database](http://www.unicode.org/onlinedat/online.html)
* Binary format: unames.icu: [tools/unicode/c/genprops/namespropsbuilder.cpp](../../tools/unicode/c/genprops/namespropsbuilder.cpp)
* Generator tool: [genprops](../../tools/unicode/c/genprops)
* Source format:
[source/data/unidata/UnicodeData.txt](https://github.com/unicode-org/icu/blob/master/icu4c/source/data/unidata/UnicodeData.txt):
[Unicode Character Database](http://www.unicode.org/onlinedat/online.html)
* Binary format: unames.icu:
[tools/unicode/c/genprops/namespropsbuilder.cpp](https://github.com/unicode-org/icu/blob/master/tools/unicode/c/genprops/namespropsbuilder.cpp)
* Generator tool:
[genprops](https://github.com/unicode-org/icu/blob/master/tools/unicode/c/genprops)
#### Unicode Character Data (Property [value] aliases since ICU 4.8; for Java only: hardcoded in C common library since ICU 4.8)
* Source format: [UCD Property*Aliases.txt](http://www.unicode.org/Public/UNIDATA/):
[Unicode Character Database](http://www.unicode.org/onlinedat/online.html)
* Binary format: pnames.icu: [source/common/propname.h](../../icu4c/source/common/propname.h)
* Generator tool: [genprops](../../tools/unicode/c/genprops)
* Binary format: pnames.icu:
[source/common/propname.h](https://github.com/unicode-org/icu/blob/master/icu4c/source/common/propname.h)
* Generator tool:
[genprops](https://github.com/unicode-org/icu/blob/master/tools/unicode/c/genprops)
#### Unicode Character Data (Text layout properties since ICU 64)
* Source format: [source/data/unidata/ppucd.txt](../../icu4c/source/data/unidata/ppucd.txt):
[Preparsed UCD](http://site.icu-project.org/design/props/ppucd)
* Binary format: ulayout.icu: [tools/unicode/c/genprops/layoutpropsbuilder.cpp](../../tools/unicode/c/genprops/layoutpropsbuilder.cpp)
* Generator tool: [genprops](../../tools/unicode/c/genprops)
* Source format:
[source/data/unidata/ppucd.txt](https://github.com/unicode-org/icu/blob/master/icu4c/source/data/unidata/ppucd.txt):
[Preparsed UCD](http://site.icu-project.org/design/props/ppucd)
* Binary format: ulayout.icu:
[tools/unicode/c/genprops/layoutpropsbuilder.cpp](https://github.com/unicode-org/icu/blob/master/tools/unicode/c/genprops/layoutpropsbuilder.cpp)
* Generator tool:
[genprops](https://github.com/unicode-org/icu/blob/master/tools/unicode/c/genprops)
#### Collation data (root collation & tailorings; ICU 53 & later)
* Source format: Original data from allkeys_CLDR.txt in [CLDR Root Collation Data Files](http://www.unicode.org/reports/tr35/tr35-collation.html#Root_Data_Files)
processed into [source/data/unidata/FractionalUCA.txt](../../icu4c/source/data/unidata/FractionalUCA.txt) by
[tool at unicode.org maintained by Mark Davis](https://sites.google.com/site/unicodetools/#TOC-UCA)
(call the Main class with option writeFractionalUCA);
source tailorings (text rules) in [source/data/coll/*.txt](../../icu4c/source/data/coll) resource bundles:
[Collation Customization chapter](collation/customization/index.md).
* Source format: Original data from allkeys_CLDR.txt in
[CLDR Root Collation Data Files](http://www.unicode.org/reports/tr35/tr35-collation.html#Root_Data_Files)
processed into
[source/data/unidata/FractionalUCA.txt](https://github.com/unicode-org/icu/blob/master/icu4c/source/data/unidata/FractionalUCA.txt)
by
[tool at unicode.org maintained by Mark Davis](https://sites.google.com/site/unicodetools/#TOC-UCA)
(call the Main class with option writeFractionalUCA); source tailorings (text rules) in
[source/data/coll/*.txt](https://github.com/unicode-org/icu/blob/master/icu4c/source/data/coll)
resource bundles: [Collation Customization chapter](collation/customization/index.md).
* Binary format: ucadata.icu & binary tailorings in resource bundles:
[source/i18n/collationdatareader.h](../../icu4c/source/i18n/collationdatareader.h)
* Generator tool: [genuca](../../tools/unicode/c/genuca), [genrb](../../icu4c/source/tools/genrb)
[source/i18n/collationdatareader.h](https://github.com/unicode-org/icu/blob/master/icu4c/source/i18n/collationdatareader.h)
* Generator tool:
[genuca](https://github.com/unicode-org/icu/blob/master/tools/unicode/c/genuca),
[genrb](https://github.com/unicode-org/icu/blob/master/icu4c/source/tools/genrb)
#### Rule-based break iterator data
* Source format: .txt: [Boundary Analysis chapter](boundaryanalysis/index.md)
* Binary format: .brk: [source/common/rbbidata.h](../../icu4c/source/common/rbbidata.h)
* Generator tool: [genbrk](../../icu4c/source/tools/genbrk)
* Binary format: .brk:
[source/common/rbbidata.h](https://github.com/unicode-org/icu/blob/master/icu4c/source/common/rbbidata.h)
* Generator tool:
[genbrk](https://github.com/unicode-org/icu/blob/master/icu4c/source/tools/genbrk)
#### Dictionary-based break iterator data (ICU 50 & later)
* Source format: txt: [gendict.cpp comments](../../icu4c/source/tools/gendict/gendict.cpp)
* Binary format: .dict: see [source/common/dictionarydata.h](../../icu4c/source/common/dictionarydata.h
* Generator tool: [gendict](../../icu4c/source/tools/gendict)
* Source format: txt: [gendict.cpp
comments](https://github.com/unicode-org/icu/blob/master/icu4c/source/tools/gendict/gendict.cpp)
* Binary format: .dict: see
[source/common/dictionarydata.h](https://github.com/unicode-org/icu/blob/master/icu4c/source/common/dictionarydata.h
* Generator tool:
[gendict](https://github.com/unicode-org/icu/blob/master/icu4c/source/tools/gendict)
#### Rule-based transform (transliterator) data
* Source format: .txt (in resource bundles): [Transform Rule Tutorial chapter](transforms/general/rules.md)
@@ -860,28 +900,37 @@ loadable data objects.)
* Generator tool: Does not apply
#### Time zone data (ICU 4.4 & later)
* Source format: [source/data/misc/zoneinfo64.txt](../../icu4c/source/data/misc/zoneinfo64.txt):
* Source format:
[source/data/misc/zoneinfo64.txt](https://github.com/unicode-org/icu/blob/master/icu4c/source/data/misc/zoneinfo64.txt):
ftp://elsie.nci.nih.gov/pub/ tzdata<year><rev>.tar.gz
* Binary format: zoneinfo64.res (generated by genrb and [tzcode tools](../../icu4c/source/tools/tzcode/readme.txt)).
* Binary format: zoneinfo64.res (generated by genrb and
[tzcode tools](https://github.com/unicode-org/icu/blob/master/icu4c/source/tools/tzcode/readme.txt)).
* Generator tool: Does not apply
#### StringPrep profile data
* Source format: [source/data/sprep/rfc3491.txt](../../icu4c/source/data/sprep/rfc3491.txt):
* Binary format: .spp: [source/tools/gensprep/store.c](../../icu4c/source/tools/gensprep/store.c)
* Generator tool: [gensprep](../../icu4c/source/tools/gensprep)
* Source format:
[source/data/sprep/rfc3491.txt](https://github.com/unicode-org/icu/blob/master/icu4c/source/data/sprep/rfc3491.txt):
* Binary format: .spp:
[source/tools/gensprep/store.c](https://github.com/unicode-org/icu/blob/master/icu4c/source/tools/gensprep/store.c)
* Generator tool:
[gensprep](https://github.com/unicode-org/icu/blob/master/icu4c/source/tools/gensprep)
#### Confusables data
* Source format: [source/data/unidata/confusables.txt](../../icu4c/source/data/unidata/confusables.txt),
[source/data/unidata/confusablesWholeScript.txt](../../icu4c/source/data/unidata/confusablesWholeScript.txt)
* Binary format: .spp: [confusables.cfu: source/i18n/uspoof_impl.h](../../icu4c/source/i18n/uspoof_impl.h)
* Generator tool: [gencfu](../../icu4c/source/tools/gencfu)
* Source format:
[source/data/unidata/confusables.txt](https://github.com/unicode-org/icu/blob/master/icu4c/source/data/unidata/confusables.txt),
[source/data/unidata/confusablesWholeScript.txt](https://github.com/unicode-org/icu/blob/master/icu4c/source/data/unidata/confusablesWholeScript.txt)
* Binary format: .spp:
[confusables.cfu: source/i18n/uspoof_impl.h](https://github.com/unicode-org/icu/blob/master/icu4c/source/i18n/uspoof_impl.h)
* Generator tool: [gencfu](https://github.com/unicode-org/icu/blob/master/icu4c/source/tools/gencfu)
### Public Data Files (old versions)
#### Unicode Character Data (Normalization before ICU 4.4; for Java only: was hardcoded in C common library)
* Source format: [source/data/unidata/*.txt]((../../icu4c/source/data/unidata):
[Unicode Character Database](http://www.unicode.org/onlinedat/online.html)
* Binary format: unorm.icu: [source/common/unormimp.h](../../icu4c/source/common/unormimp.h)
* Source format:
[source/data/unidata/*.txt]((https://github.com/unicode-org/icu/blob/master/icu4c/source/data/unidata):
[Unicode Character Database](http://www.unicode.org/onlinedat/online.html)
* Binary format: unorm.icu:
[source/common/unormimp.h](https://github.com/unicode-org/icu/blob/master/icu4c/source/common/unormimp.h)
* Generator tool: gennorm
#### Unicode Character Data (Property [value] aliases before ICU 4.8)
@@ -892,12 +941,15 @@ loadable data objects.)
#### Collation data (UCA, code points to weights; ICU 52 & earlier)
* Source format: Same as in ICU 53
* Binary format: ucadata.icu & binary tailorings in resource bundles: source/i18n/ucol_imp.h (ICU 52)
* Generator tool: [genuca](../../tools/unicode/c/genuca), [genrb](../../icu4c/source/tools/genrb)
* Generator tool:
[genuca](https://github.com/unicode-org/icu/blob/master/tools/unicode/c/genuca),
[genrb](https://github.com/unicode-org/icu/blob/master/icu4c/source/tools/genrb)
#### Collation data (Inverse UCA, weights->code points; ICU 52 & earlier)
* Source format: Processed from FractionalUCA.txt like ICU 52 ucadata.icu
* Binary format: invuca.icu: source/i18n/ucol_imp.h (ICU 52)
* Generator tool: [genuca](../../tools/unicode/c/genuca)
* Generator tool:
[genuca](https://github.com/unicode-org/icu/blob/master/tools/unicode/c/genuca)
#### Dictionary-based break iterator data (ICU 49 & earlier)
* Source format: .txt: genctd.cpp comments
@@ -906,48 +958,56 @@ loadable data objects.)
#### Time zone data (Before ICU 4.4)
* Source format: .source/data/misc/zoneinfo.txt (ICU 4.2): ftp://elsie.nci.nih.gov/pub/ tzdata<year><rev>.tar.gz
* Binary format: zoneinfo64.res (generated by genrb and [tzcode tools](../../icu4c/source/tools/tzcode/readme.txt)).
* Binary format: zoneinfo64.res (generated by genrb and
[tzcode tools](https://github.com/unicode-org/icu/blob/master/icu4c/source/tools/tzcode/readme.txt)).
* Generator tool: Does not apply
### Non-File API Binary Data
#### Converter selector data
* Source format: none
* Binary format: [source/common/ucnvsel.cpp](../../icu4c/source/common/ucnvsel.cpp)
* Generator tool: [ucnvsel_open()](../../icu4c/source/common/ucnvsel.cpp)
* Binary format:
[source/common/ucnvsel.cpp](https://github.com/unicode-org/icu/blob/master/icu4c/source/common/ucnvsel.cpp)
* Generator tool:
[ucnvsel_open()](https://github.com/unicode-org/icu/blob/master/icu4c/source/common/ucnvsel.cpp)
### Test-Only Data Files
#### test.icu (for udata API testing)
* Source format: none (fixed output from gentest when not using -r or -j options)
* Binary format: test.icu: see `createData()`
in [source/tools/gentest/gentest.c](../../icu4c/source/tools/gentest/gentest.c)
* Generator tool: [gentest](../../icu4c/source/tools/gentest/gentest.c)
* Binary format: test.icu: see `createData()` in
[source/tools/gentest/gentest.c](https://github.com/unicode-org/icu/blob/master/icu4c/source/tools/gentest/gentest.c)
* Generator tool:
[gentest](https://github.com/unicode-org/icu/blob/master/icu4c/source/tools/gentest/gentest.c)
### Other Data Structures
#### UCPTrie (C)/CodePointTrie (Java) (maps code points to integers)
* Source format: (public builder API)
* Binary format: [ICU Code Point Tries design doc](http://site.icu-project.org/design/struct/utrie),
[icu4c/source/common/ucptrie_impl.h](../../icu4c/source/common/ucptrie_impl.h)
* Binary format:
[ICU Code Point Tries design doc](http://site.icu-project.org/design/struct/utrie),
[icu4c/source/common/ucptrie_impl.h](https://github.com/unicode-org/icu/blob/master/icu4c/source/common/ucptrie_impl.h)
* Generator tool: (builder class)
#### UTrie2 (C)/Trie2 (Java) (maps code points to integers)
* Source format: (internal builder API)
* Binary format: [ICU Code Point Tries design doc](http://site.icu-project.org/design/struct/utrie),
[icu4c/source/common/utrie2_impl.h](../../icu4c/source/common/utrie2_impl.h)
* Binary format:
[ICU Code Point Tries design doc](http://site.icu-project.org/design/struct/utrie),
[icu4c/source/common/utrie2_impl.h](https://github.com/unicode-org/icu/blob/master/icu4c/source/common/utrie2_impl.h)
* Generator tool: (builder class)
#### BytesTrie (maps byte sequences to 32-bit integers)
* Source format: (public builder API)
* Binary format: [BytesTrie design doc](http://site.icu-project.org/design/struct/tries/bytestrie),
[icu4c/source/common/unicode/bytestrie.h](../../icu4c/source/common/unicode/bytestrie.h)
* Binary format:
[BytesTrie design doc](http://site.icu-project.org/design/struct/tries/bytestrie),
[icu4c/source/common/unicode/bytestrie.h](https://github.com/unicode-org/icu/blob/master/icu4c/source/common/unicode/bytestrie.h)
* Generator tool: (builder class)
#### UCharsTrie (C++)/CharsTrie (Java) (maps 16-bit-Unicode strings to 32-bit integers)
* Source format: (public builder API)
* Binary format: [UCharsTrie design doc](http://site.icu-project.org/design/struct/tries/ucharstrie),
[icu4c/source/common/unicode/ucharstrie.h](../../icu4c/source/common/unicode/ucharstrie.h)
* Binary format:
[UCharsTrie design doc](http://site.icu-project.org/design/struct/tries/ucharstrie),
[icu4c/source/common/unicode/ucharstrie.h](https://github.com/unicode-org/icu/blob/master/icu4c/source/common/unicode/ucharstrie.h)
* Generator tool: (builder class)
## ICU4J Resource Information
+1 -1
View File
@@ -130,7 +130,7 @@ upgrade-friendly.
item changes, new support is added, or if a country changes its currency.
Try not to depend on specific translations, or be prepared to change test
cases. Also, a newer version may support additional translations,
currencies, types of calenders
currencies, types of calendars
* **Building/Deploying your Application (ICU4C):** ICU4C usually builds with
symbol renaming (See:
[binary compatibility](../design#icu-binary-compatibility)
+16 -9
View File
@@ -259,7 +259,7 @@ result is a `ResourceBundle` object. Remarks about informational codes are also
valid for the C++ APIs.
> :point_right: **Note**: All the data accessing examples in the following
> sections use ICU's
> sections use ICU's
> [root](https://github.com/unicode-org/icu/blob/master/icu4c/source/data/locales/root.txt)
> resource bundle.
@@ -336,7 +336,8 @@ In order to be able to distinguish between resources, one needs to know the type
of the resource at hand. To find this out, use the
`UResType ures_getType(UResourceBundle* resourceBundle)` API, or the C++ analog
`UResType getType(void)`. The `UResType` is an enumeration defined in the
[unicode/ures.h](../../../icu4c/source/common/unicode/ures.h) header file.
[unicode/ures.h](https://github.com/unicode-org/icu/blob/master/icu4c/source/common/unicode/ures.h)
header file.
> :point_right: **Note**: Indexes of resources in tables do not necessarily
> correspond to the order of items in a table. Due to the way binary structure is
@@ -549,7 +550,7 @@ Gets the number of items in a resource. Simple resources always return size 1.
| C++ | `UResType getType(void)` |
Gets the type of the resource. For a list of resource types, see:
[unicode/ures.h](../../../icu4c/source/common/unicode/ures.h)
[unicode/ures.h](https://github.com/unicode-org/icu/blob/master/icu4c/source/common/unicode/ures.h)
| Language | API |
| -------- | ------------------------------------------------ |
@@ -665,7 +666,8 @@ root {
}
```
Binary format is described in the [uresdata.h](../../../icu4c/source/common/uresdata.h)
Binary format is described in the
[uresdata.h](https://github.com/unicode-org/icu/blob/master/icu4c/source/common/uresdata.h)
header file.
### Resources Syntax
@@ -743,8 +745,11 @@ aVeryLongString:string {
```
For more examples on syntax, take a look at our resource files for
[locales](../../../icu4c/source/data/locales) and [test data](../../../icu4c/source/test/testdata),
especially at the [testtypes resource bundle](../../../icu4c/source/test/testdata/testtypes.txt).
[locales](https://github.com/unicode-org/icu/blob/master/icu4c/source/data/locales)
and
[test data](https://github.com/unicode-org/icu/blob/master/icu4c/source/test/testdata),
especially at the
[testtypes resource bundle](https://github.com/unicode-org/icu/blob/master/icu4c/source/test/testdata/testtypes.txt).
### Making Your Own Resource Bundles
@@ -795,9 +800,11 @@ steps:
Rolling out your own data takes some practice, especially if you want to package
it all together. You might want to take a look at how we package data. Good
places to start (except of course ICU's own [data](../../../icu4c/source/data/))
are [source/test/testdata/](../../../icu4c/source/test/testdata/) and
[source/samples/ufortune/resources/](../../../icu4c/source/samples/ufortune/resources/)
places to start (except of course ICU's own
[data](https://github.com/unicode-org/icu/blob/master/icu4c/source/data/)) are
[source/test/testdata/](https://github.com/unicode-org/icu/blob/master/icu4c/source/test/testdata/)
and
[source/samples/ufortune/resources/](https://github.com/unicode-org/icu/blob/master/icu4c/source/samples/ufortune/resources/)
directories.
Also, here is a sample Windows batch file that does compiling and packing of
+2 -1
View File
@@ -120,7 +120,8 @@ data to be installed and removed without rebuilding ICU. For details, see the
(This section assumes the reader is familiar with ICU version numbers (§) as
covered in the [Design](../design.md) chapter, and filename conventions for
libraries in the [ReadMe](../../../icu4c/readme.html#HowToPackage)
libraries in the
[ReadMe](https://github.com/unicode-org/icu/blob/master/icu4c/readme.html#HowToPackage)
.)
### POSIX Library Names
+3 -3
View File
@@ -55,7 +55,7 @@ uninstall themselves before they are removed from memory and unloaded.
The current plugin API is documented as
[icuplug.h](https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/icuplug_8h.html)
Some sample plugins are available at:
[testplug.c](../../../icu4c/source/tools/icuinfo/testplug.c)
[testplug.c](https://github.com/unicode-org/icu/blob/master/icu4c/source/tools/icuinfo/testplug.c)
Here is a simple, trivial plugin:
```c
@@ -92,7 +92,7 @@ SHOULD call `uplug_setPlugName` to indicate a human readable plugin name.
## Configuration
You can see a sample configuration file here:
[icuplugins_windows_sample.txt](../../../icu4c/source/tools/icuinfo/icuplugins_windows_sample.txt)
[icuplugins_windows_sample.txt](https://github.com/unicode-org/icu/blob/master/icu4c/source/tools/icuinfo/icuplugins_windows_sample.txt)
At ICU startup time, the environment variable "ICU_PLUGINS" will be
queried for a directory name. If it is not set, the #define
`DEFAULT_ICU_PLUGINS` will be checked for a default value.
@@ -182,4 +182,4 @@ plugin| /lib/plugins/libplugin.dylib:myPluginLow
config| x=4
Default locale is en_US
Default converter is UTF-8.
```
```
+3 -3
View File
@@ -177,7 +177,7 @@ UTF-8 and UTF-32 are supported with converters (ucnv.h), macros (utf.h), and
convenience functions (ustring.h), but only a subset of APIs works with UTF-8
directly as string encoding form.
**See the **[**UTF-8**](utf-8.md)** subpage for details about working with
**See the [UTF-8](utf-8.md) subpage for details about working with
UTF-8.** Some of the following sections apply to UTF-8 APIs as well; for example
sections about handling lengths and overflows.
@@ -280,13 +280,13 @@ Strings are either terminated with a NUL character (code point 0, U+0000) or
their length is specified. In the latter case, it is possible to have one or
more NUL characters inside the string.
**Input string **arguments are typically passed with two parameters: The (const)
**Input string** arguments are typically passed with two parameters: The (const)
`UChar *` pointer and an int32_t length argument. If the length is -1 then the
string must be NUL-terminated and the ICU function will call the u_strlen()
method or treat it equivalently. If the input string contains embedded NUL
characters, then the length must be specified.
**Output string **arguments are typically passed with a destination `UChar *`
**Output string** arguments are typically passed with a destination `UChar *`
pointer and an int32_t capacity argument and the function returns the length of
the output as an int32_t. There is also almost always a UErrorCode argument.
Essentially, a `UChar[]` array is passed in with its start and the number of
+9 -9
View File
@@ -160,14 +160,14 @@ complete a complete description of the API.
| . | ✓ | | Match any character.
| ^ | ✓ | | Match at the beginning of a line.
| $ | ✓ | | Match at the end of a line. Line terminating characters are \\u000a, \\u000b, \\u000c, \\u000d, \\u0085, \\u2028, \\u2029 and the sequence \\u000d \\u000a.
| \\ | ✓ | | Quotes the following character. Characters that must be quoted to be treated as literals are \* ? + \[ ( ) { } ^ $ | \\ .
| \\ | ✓ | | Quotes the following character. Characters that must be quoted to be treated as literals are \* ? + \[ ( ) { } ^ $ \| \\ .
| \\ | | ✓ | Quotes the following character. Characters that must be quoted to be treated as literals are \[ \] \\ Characters that may need to be quoted, depending on the context are - &
## Regular Expression Operators
| Operator | Description
|:--------------|:---------------------------------------------------------------|
| `\|` | Alternation. A\|B matches either A or B.
| `|` | Alternation. A\|B matches either A or B.
| `*` | Match 0 or more times. Match as many times as possible.
| `+` | Match 1 or more times. Match as many times as possible.
| `?` | Match zero or one times. Prefer one.
@@ -193,7 +193,7 @@ complete a complete description of the API.
| `(?= ...)` | Look-ahead assertion. True if the parenthesized pattern matches at the current input position, but does not advance the input position.
| `(?! ...)` | Negative look-ahead assertion. True if the parenthesized pattern does not match at the current input position. Does not advance the input position.
| `(?<= ...)` | Look-behind assertion. True if the parenthesized pattern matches text preceding the current input position, with the last character of the match being the input character just before the current position. Does not alter the input position. The length of possible strings matched by the look-behind pattern must not be unbounded (no \* or + operators.)
| `(?<\! ...)` | Negative Look-behind assertion. True if the parenthesized pattern does not match text preceding the current input position, with the last character of the match being the input character just before the current position. Does not alter the input position. The length of possible strings matched by the look-behind pattern must not be unbounded (no \* or + operators.)
| `(?<! ...)` | Negative Look-behind assertion. True if the parenthesized pattern does not match text preceding the current input position, with the last character of the match being the input character just before the current position. Does not alter the input position. The length of possible strings matched by the look-behind pattern must not be unbounded (no \* or + operators.)
| `(?<name>...)` | Named capture group. The <angle brackets> are literal - they appear in the pattern.
| `(?ismwx-ismwx:...)` | Flag settings. Evaluate the parenthesized expression with the specified flags enabled or -disabled.
| `(?ismwx-ismwx)` | Flag settings. Change the flag settings. Changes apply to the portion of the pattern following the setting. For example, (?i) changes to a case insensitive match.
@@ -211,7 +211,7 @@ complete a complete description of the API.
| `[\p{numeric_value=9}]` | Match all numbers with a numeric value of 9. Any Unicode Property may be used in set expressions.
| `[\p{Letter}&&\p{script=cyrillic}]` | Logical AND or intersection. Match the set of all Cyrillic letters.
| `[\p{Letter}--\p{script=latin}]` | Subtraction. Match all non-Latin letters.
| `[[a-z][A-Z][0-9]]` `[a-zA-Z0-9]]` | Implicit Logical OR or Union of Sets. The examples match ASCII letters and digits. The two forms are equivalent.
| `[[a-z][A-Z][0-9]]` `[a-zA-Z0-9]` | Implicit Logical OR or Union of Sets. The examples match ASCII letters and digits. The two forms are equivalent.
| `[:script=Greek:]` | Alternate POSIX-like syntax for properties. Equivalent to \\p{script=Greek}.
## Case Insensitive Matching
@@ -441,8 +441,8 @@ Examples from actual bug reports,
The pattern
(?:[A-Za-z0-9]+[._]?){1,}[A-Za-z0-9]+\@(?:(?:[A-Za-z0-9]+[-]?){1,}[A-Za-z0-9]+\.){1,}`
^^^^^^^^^^^ `
(?:[A-Za-z0-9]+[._]?){1,}[A-Za-z0-9]+\@(?:(?:[A-Za-z0-9]+[-]?){1,}[A-Za-z0-9]+\.){1,}
^^^^^^^^^^^
and the text
@@ -452,11 +452,11 @@ cause an infinite loop.
The problem is in the region marked with `^^^^^^^^^^`. The `"[._]?"` term can be ignored, because
it need not match anything. `{1,}` is the same as `+`. So we effectively have
`(?:\[A-Za-z0-9\]+)+`, which is trouble.
`(?:[A-Za-z0-9]+)+`, which is trouble.
The initial part of the expression can be recast as
`[A-Za-z0-9\]+([._][A-Za-z0-9]+)*`
`[A-Za-z0-9]+([._][A-Za-z0-9]+)*`
which matches the same thing. The nested `+` and `*` qualifiers do not cause a
problem because the `[._]` term is not optional and contains no characters that
@@ -504,7 +504,7 @@ processes, can be a problem with some regular expression packages.
implementation, which was based on ICU UnicodeSet pattern syntax.
* The property expression `\p{punct}` differs in what it matches. Java matches
matches any of ```!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~```. From that list,
ICU omits ```$+<=>^\`|~``` &nbsp; &nbsp;
ICU omits ```$+<=>^`|~``` &nbsp; &nbsp;
ICU follows the recommendations from Unicode UTS-18,
<http://www.unicode.org/reports/tr18/#Compatibility_Properties>. See also
<https://unicode-org.atlassian.net/browse/ICU-20095>.
+13 -3
View File
@@ -25,15 +25,25 @@ Here are a few examples of sets:
| `[abc123]` | The six characters a,b,c,1,2 and 3 |
| `[\p{Letter}]` | All characters with the Unicode General Category of Letter. |
String Values In addition to being a set of characters (of Unicode code points),
### String Values
In addition to being a set of characters (of Unicode code points),
a UnicodeSet may also contain string values. Conceptually, the UnicodeSet is
always a set of strings, not a set of characters, although in many common use
cases the strings are all of length one, which reduces to being a set of
characters.
This concept can be confusing when first encountered, probably because similar
set constructs from other environments (regular expressions) can only contain
characters.
set constructs from other environments
(e.g., character classes in most regular expression implementations)
can only contain characters.
Until ICU 68, it was not possible for a UnicodeSet to contain the empty string.
In Java, an exception was thrown. In C++, the empty string was silently ignored.
Starting with ICU 69 [ICU-13702](https://unicode-org.atlassian.net/browse/ICU-13702)
the empty string is supported as a set element;
however, it is ignored in matching functions such as `span(string)`.
## UnicodeSet Patterns
+11 -10
View File
@@ -28,7 +28,7 @@ vice versa (such as an English letter with a Hebrew address nested within it.)
The predominant direction is called the global orientation.
Languages involving bidirectional text are used mainly in the Middle East. They
include Arabic, Urdu, Farsi, Hebrew, and Yiddish.
include Arabic, Urdu, Persian, Hebrew, and Yiddish.
In such a language, the general flow of text proceeds horizontally from right to
left, but numbers are written from left to right, the same way as they are
@@ -43,18 +43,19 @@ Engines". *
## Countries with Languages that Require Bidirectional Scripting
There are over 300 million people who depend on bidirectional scripts, including
Farsi and Urdu which share the same script as Arabic, but have additional
characters.
There are over 600 million people whose languages are written right-to-left, including
Persian and Urdu which use the Arabic script with additional characters.
| Language | Number of Countries |
| Language | Countries (examples) |
|----------|------------------------------------------------------|
| Arabic | 18 |
| Farsi | 1 (Iran) |
| Urdu | 2 (India, Pakistan) |
| Hebrew | 1 (Israel) |
| Yiddish | Israel, North America, South America, Russia, Europe |
| Arabic | Egypt, Jordan, Morocco, Saudi Arabia, ... Middle East & North Africa |
| Persian | Iran, Afghanistan |
| Urdu | India, Pakistan |
| Hebrew | Israel |
| Yiddish | Israel, North America, South America, Russia, Europe |
This list of languages is far from complete. Other languages with RTL scripts include
Divehi (Maldives), Kurdish (Iraq), Kashmiri (India), Sindhi (Pakistan and India), Uighur (China), and Pashto (Afghanistan), etc.
## Logical Order versus Visual Order
+396 -2175
View File
File diff suppressed because it is too large Load Diff
+222 -819
View File
File diff suppressed because it is too large Load Diff
+17 -16
View File
@@ -3,7 +3,7 @@
<html lang="en-US" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
<head>
<title>ReadMe for ICU 68.1</title>
<title>ReadMe for ICU 69.1</title>
<meta name="COPYRIGHT" content=
"Copyright (C) 2016 and later: Unicode, Inc. and others. License &amp; terms of use: http://www.unicode.org/copyright.html"/>
<!-- meta name="COPYRIGHT" content=
@@ -23,8 +23,8 @@
milestone - if the release note is a milestone release
-->
<body>
<!-- <body class="rc"> -->
<!-- <body> -->
<body class="rc">
<p class="only-draft"><b>Note:</b> This is a draft readme.</p>
<h1>
@@ -33,7 +33,7 @@
<span class="only-rc">Release Candidate</span>
<!-- <span class="only-milestone">(Milestone Release)</span> -->
<span class="only-milestone">(Preview Release)</span>
<abbr title="International Components for Unicode">ICU</abbr> 68.1 ReadMe
<abbr title="International Components for Unicode">ICU</abbr> 69.1 ReadMe
</h1>
<!-- Most of the time we shouldn't need to comment/uncomment this paragraph, just change the body class -->
@@ -47,7 +47,7 @@
<p class="note only-rc">This is a release candidate version of ICU4C.
It is not recommended for production use.</p>
<p>Last updated: 2020-Aug-27<br/>
<p>Last updated: 2021-Mar-16<br/>
Copyright &copy; 2016 and later: Unicode, Inc. and others. License &amp; terms of use:
<a href="http://www.unicode.org/copyright.html">http://www.unicode.org/copyright.html</a><br/>
Copyright &copy; 1997-2016 International Business Machines Corporation and others.
@@ -185,20 +185,21 @@
<td>FAQ - Frequently Asked Questions about ICU</td>
<td><a href=
"http://userguide.icu-project.org/icufaq">http://userguide.icu-project.org/icufaq</a></td>
"https://unicode-org.github.io/icu/userguide/icufaq">https://unicode-org.github.io/icu/userguide/icufaq</a></td>
</tr>
<tr>
<td>ICU User's Guide</td>
<td><a href=
"http://userguide.icu-project.org/">http://userguide.icu-project.org/</a></td>
"https://unicode-org.github.io/icu/userguide/">https://unicode-org.github.io/icu/userguide/</a></td>
</tr>
<tr>
<td>How To Use ICU</td>
<td><a href="http://userguide.icu-project.org/howtouseicu">http://userguide.icu-project.org/howtouseicu</a></td>
<td><a href=
"https://unicode-org.github.io/icu/userguide/howtouseicu">https://unicode-org.github.io/icu/userguide/howtouseicu</a></td>
</tr>
<tr>
@@ -236,7 +237,7 @@
<h2><a name="News" href="#News" id="News">What Is New In This Release?</a></h2>
<p>See the <a href="http://site.icu-project.org/download/68">ICU 68 download page</a>
<p>See the <a href="http://site.icu-project.org/download/69">ICU 69 download page</a>
for more information on this release, including any other changes, bug fixes, known issues,
changes to supported platforms and build environments,
and migration issues for existing applications migrating from previous ICU releases.</p>
@@ -284,7 +285,7 @@
<p>In the descriptions below, <strong><i>&lt;ICU&gt;</i></strong> is the full
path name of the ICU directory (the top level directory from the distribution
archives) in your file system. You can also view the <a href=
"http://userguide.icu-project.org/design">ICU Architectural
"https://unicode-org.github.io/icu/userguide/design">ICU Architectural
Design</a> section of the User's Guide to see which libraries you need for
your software product. You need at least the data (<code>[lib]icudt</code>)
and the common (<code>[lib]icuuc</code>) libraries in order to use ICU.</p>
@@ -443,7 +444,7 @@
environment variable to the out/ or the out/build/ directories, but
this is generally discouraged because most people set it incorrectly.
You can view the <a href=
"http://userguide.icu-project.org/icudata">ICU Data
"https://unicode-org.github.io/icu/userguide/icudata">ICU Data
Management</a> section of the ICU User's Guide for details.</p>
</td>
</tr>
@@ -687,7 +688,7 @@
It may be hard if ICU is shipped with
another shared library (such as the Xerces-C++ XML parser)
which does not control <code>main()</code>.<br />
See the <a href="http://userguide.icu-project.org/icudata">User Guide ICU Data</a>
See the <a href="https://unicode-org.github.io/icu/userguide/icudata">User Guide ICU Data</a>
chapter for more details.<br />
If possible, we recommend building the .dat package.
Specify <code>--with-data-packaging=archive</code>
@@ -723,7 +724,7 @@
<p>If ICU is installed as a system-level library, there are further
opportunities and restrictions to consider.
For details, see the <em>Using ICU as an Operating System Level Library</em>
section of the <a href="http://userguide.icu-project.org/design">User Guide ICU Architectural Design</a> chapter.</p>
section of the <a href="https://unicode-org.github.io/icu/userguide/design">User Guide ICU Architectural Design</a> chapter.</p>
<ul>
<li><b>Data path:</b> For a system-level library, it is best to load
ICU data from the .dat package file because the file system path
@@ -1507,7 +1508,7 @@ gnumake</pre>
operating systems that do not have a standard C++ ABI (name mangling) for
compilers, it is recommended to do this special packaging anyway. More
details on customizing ICU are available in the <a href=
"http://userguide.icu-project.org/">User's Guide</a>. The <a href=
"https://unicode-org.github.io/icu/userguide/">User's Guide</a>. The <a href=
"#SourceCode">ICU Source Code Organization</a> section of this readme.html
gives a more complete description of the libraries.</p>
@@ -1536,7 +1537,7 @@ gnumake</pre>
<td>Data required by the Common and I18n libraries. There are many ways
to package and <a href=
"http://userguide.icu-project.org/icudata">customize this
"https://unicode-org.github.io/icu/userguide/icudata">customize this
data</a>, but by default this is all you need.</td>
</tr>
@@ -1790,7 +1791,7 @@ gnumake</pre>
<p>Data files can be built on a different platform when both platforms share
the same endianness and the same charset family. This assertion does not
include platform dependent DLLs/shared/static libraries. For details see the
User Guide <a href="http://userguide.icu-project.org/icudata">ICU
User Guide <a href="https://unicode-org.github.io/icu/userguide/icudata">ICU
Data</a> chapter.</p>
<p>ICU 3.6 removes the requirement that ICU be completely built in the native
Executable → Regular
View File
+1 -1
View File
@@ -1677,7 +1677,7 @@ COMPACT_LATEX = NO
# The default value is: a4.
# This tag requires that the tag GENERATE_LATEX is set to YES.
PAPER_TYPE = a4wide
PAPER_TYPE = a4
# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
# that should be included in the LaTeX output. The package can be specified just
+17 -9
View File
@@ -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
+32
View File
@@ -141,6 +141,38 @@ 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,
+3
View File
@@ -127,6 +127,9 @@ public:
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().
+60 -9
View File
@@ -31,14 +31,63 @@
#include <stddef.h>
#include <string.h>
#include "unicode/localpointer.h"
#include "uassert.h"
#if U_DEBUG && defined(UPRV_MALLOC_COUNT)
#include <stdio.h>
#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
@@ -725,9 +774,14 @@ public:
}
MemoryPool& operator=(MemoryPool&& other) U_NOEXCEPT {
fCount = other.fCount;
fPool = std::move(other.fPool);
other.fCount = 0;
// 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;
}
@@ -796,9 +850,6 @@ protected:
template<typename T, int32_t stackCapacity = 8>
class MaybeStackVector : protected MemoryPool<T, stackCapacity> {
public:
using MemoryPool<T, stackCapacity>::MemoryPool;
using MemoryPool<T, stackCapacity>::operator=;
template<typename... Args>
T* emplaceBack(Args&&... args) {
return this->create(args...);
+2 -2
View File
@@ -58,7 +58,7 @@
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
</ClCompile>
<Link>
<OutputFile>..\..\$(IcuBinOutputDir)\icuuc68d.dll</OutputFile>
<OutputFile>..\..\$(IcuBinOutputDir)\icuuc69d.dll</OutputFile>
<ProgramDatabaseFile>.\..\..\$(IcuLibOutputDir)\icuucd.pdb</ProgramDatabaseFile>
<ImportLibrary>..\..\$(IcuLibOutputDir)\icuucd.lib</ImportLibrary>
</Link>
@@ -70,7 +70,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
</ClCompile>
<Link>
<OutputFile>..\..\$(IcuBinOutputDir)\icuuc68.dll</OutputFile>
<OutputFile>..\..\$(IcuBinOutputDir)\icuuc69.dll</OutputFile>
<ProgramDatabaseFile>.\..\..\$(IcuLibOutputDir)\icuuc.pdb</ProgramDatabaseFile>
<ImportLibrary>..\..\$(IcuLibOutputDir)\icuuc.lib</ImportLibrary>
</Link>
+2 -2
View File
@@ -125,7 +125,7 @@
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<AdditionalDependencies>vccorlib.lib;msvcrt.lib;vcruntime.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>..\..\$(IcuBinOutputDir)\icuuc68.dll</OutputFile>
<OutputFile>..\..\$(IcuBinOutputDir)\icuuc69.dll</OutputFile>
<ProgramDatabaseFile>.\..\..\$(IcuLibOutputDir)\icuuc.pdb</ProgramDatabaseFile>
<ImportLibrary>..\..\$(IcuLibOutputDir)\icuuc.lib</ImportLibrary>
</Link>
@@ -148,7 +148,7 @@
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>vccorlibd.lib;msvcrtd.lib;vcruntimed.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>..\..\$(IcuBinOutputDir)\icuuc68d.dll</OutputFile>
<OutputFile>..\..\$(IcuBinOutputDir)\icuuc69d.dll</OutputFile>
<ProgramDatabaseFile>.\..\..\$(IcuLibOutputDir)\icuucd.pdb</ProgramDatabaseFile>
<ImportLibrary>..\..\$(IcuLibOutputDir)\icuucd.lib</ImportLibrary>
</Link>
+8 -24
View File
@@ -265,13 +265,9 @@ ThaiBreakEngine::divideUpDictionaryRange( UText *text,
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;
}
// Followed by another dictionary word; mark first word as a good candidate
words[wordsFound%THAI_LOOKAHEAD].markCurrent();
// If we're already at the end of the range, we're done
if ((int32_t)utext_getNativeIndex(text) >= rangeEnd) {
@@ -503,13 +499,9 @@ LaoBreakEngine::divideUpDictionaryRange( UText *text,
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;
}
// Followed by another dictionary word; mark first word as a good candidate
words[wordsFound%LAO_LOOKAHEAD].markCurrent();
// If we're already at the end of the range, we're done
if ((int32_t)utext_getNativeIndex(text) >= rangeEnd) {
@@ -699,13 +691,9 @@ BurmeseBreakEngine::divideUpDictionaryRange( UText *text,
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;
}
// Followed by another dictionary word; mark first word as a good candidate
words[wordsFound%BURMESE_LOOKAHEAD].markCurrent();
// If we're already at the end of the range, we're done
if ((int32_t)utext_getNativeIndex(text) >= rangeEnd) {
@@ -908,13 +896,9 @@ KhmerBreakEngine::divideUpDictionaryRange( UText *text,
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;
}
// Followed by another dictionary word; mark first word as a good candidate
words[wordsFound % KHMER_LOOKAHEAD].markCurrent();
// If we're already at the end of the range, we're done
if ((int32_t)utext_getNativeIndex(text) >= rangeEnd) {
+19
View File
@@ -85,16 +85,22 @@ public:
inline int32_t puti(const UnicodeString& key, int32_t value, UErrorCode& status);
inline int32_t putiAllowZero(const UnicodeString& key, int32_t value, UErrorCode& status);
inline void* get(const UnicodeString& key) const;
inline int32_t geti(const UnicodeString& key) const;
inline int32_t getiAndFound(const UnicodeString& key, UBool &found) const;
inline void* remove(const UnicodeString& key);
inline int32_t removei(const UnicodeString& key);
inline void removeAll(void);
inline UBool containsKey(const UnicodeString& key) const;
inline const UHashElement* find(const UnicodeString& key) const;
/**
@@ -203,6 +209,11 @@ inline int32_t Hashtable::puti(const UnicodeString& key, int32_t value, UErrorCo
return uhash_puti(hash, new UnicodeString(key), value, &status);
}
inline int32_t Hashtable::putiAllowZero(const UnicodeString& key, int32_t value,
UErrorCode& status) {
return uhash_putiAllowZero(hash, new UnicodeString(key), value, &status);
}
inline void* Hashtable::get(const UnicodeString& key) const {
return uhash_get(hash, &key);
}
@@ -211,6 +222,10 @@ inline int32_t Hashtable::geti(const UnicodeString& key) const {
return uhash_geti(hash, &key);
}
inline int32_t Hashtable::getiAndFound(const UnicodeString& key, UBool &found) const {
return uhash_getiAndFound(hash, &key, &found);
}
inline void* Hashtable::remove(const UnicodeString& key) {
return uhash_remove(hash, &key);
}
@@ -219,6 +234,10 @@ inline int32_t Hashtable::removei(const UnicodeString& key) {
return uhash_removei(hash, &key);
}
inline UBool Hashtable::containsKey(const UnicodeString& key) const {
return uhash_containsKey(hash, &key);
}
inline const UHashElement* Hashtable::find(const UnicodeString& key) const {
return uhash_find(hash, &key);
}
+5 -7
View File
@@ -345,9 +345,8 @@ UBool compareLSRs(const UHashTok t1, const UHashTok t2) {
int32_t LocaleMatcher::putIfAbsent(const LSR &lsr, int32_t i, int32_t suppLength,
UErrorCode &errorCode) {
if (U_FAILURE(errorCode)) { return suppLength; }
int32_t index = uhash_geti(supportedLsrToIndex, &lsr);
if (index == 0) {
uhash_puti(supportedLsrToIndex, const_cast<LSR *>(&lsr), i + 1, &errorCode);
if (!uhash_containsKey(supportedLsrToIndex, &lsr)) {
uhash_putiAllowZero(supportedLsrToIndex, const_cast<LSR *>(&lsr), i, &errorCode);
if (U_SUCCESS(errorCode)) {
supportedLSRs[suppLength] = &lsr;
supportedIndexes[suppLength++] = i;
@@ -685,12 +684,11 @@ int32_t LocaleMatcher::getBestSuppIndex(LSR desiredLSR, LocaleLsrIterator *remai
int32_t bestSupportedLsrIndex = -1;
for (int32_t bestShiftedDistance = LocaleDistance::shiftDistance(thresholdDistance);;) {
// Quick check for exact maximized LSR.
// Returns suppIndex+1 where 0 means not found.
if (supportedLsrToIndex != nullptr) {
desiredLSR.setHashCode();
int32_t index = uhash_geti(supportedLsrToIndex, &desiredLSR);
if (index != 0) {
int32_t suppIndex = index - 1;
UBool found = false;
int32_t suppIndex = uhash_getiAndFound(supportedLsrToIndex, &desiredLSR, &found);
if (found) {
if (remainingIter != nullptr) {
remainingIter->rememberCurrent(desiredIndex, errorCode);
}
+6 -5
View File
@@ -187,17 +187,18 @@ bool LocalePriorityList::add(const Locale &locale, int32_t weight, UErrorCode &e
if (U_FAILURE(errorCode)) { return false; }
}
LocalPointer<Locale> 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();
+1 -1
View File
@@ -698,7 +698,7 @@ 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;
for (; p < plimit; p++) {
+259 -30
View File
@@ -35,6 +35,7 @@
#include "unicode/bytestream.h"
#include "unicode/locid.h"
#include "unicode/localebuilder.h"
#include "unicode/strenum.h"
#include "unicode/stringpiece.h"
#include "unicode/uloc.h"
@@ -253,7 +254,7 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(Locale)
Locale::~Locale()
{
if (baseName != fullName) {
if ((baseName != fullName) && (baseName != fullNameBuffer)) {
uprv_free(baseName);
}
baseName = NULL;
@@ -465,7 +466,7 @@ Locale& Locale::operator=(const Locale& other) {
}
Locale& Locale::operator=(Locale&& other) U_NOEXCEPT {
if (baseName != fullName) uprv_free(baseName);
if ((baseName != fullName) && (baseName != fullNameBuffer)) uprv_free(baseName);
if (fullName != fullNameBuffer) uprv_free(fullName);
if (other.fullName == other.fullNameBuffer) {
@@ -523,7 +524,7 @@ static const char* const KNOWN_CANONICALIZED[] = {
"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", "or", "or_IN", "pa", "pa_IN", "pl", "pl_PL", "ps", "ps_AF",
"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",
@@ -626,6 +627,17 @@ private:
LocalMemory<const char*>& types,
LocalMemory<int32_t>& 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<const char*>& types,
LocalMemory<int32_t>& replacementIndexes,
int32_t &length, UErrorCode &status);
};
/**
@@ -646,6 +658,7 @@ public:
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();
@@ -657,11 +670,13 @@ private:
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) {
}
@@ -675,6 +690,7 @@ private:
CharStringMap script;
CharStringMap territory;
CharStringMap variant;
CharStringMap subdivision;
CharString* strings;
friend class AliasDataBuilder;
@@ -865,6 +881,34 @@ AliasDataBuilder::readVariantAlias(
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<const char*>& types,
LocalMemory<int32_t>& 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 UnicodeString&) { },
status);
}
/**
* Initializes the alias data from the ICU resource bundles. The alias data
* contains alias of language, country, script and variants.
@@ -904,12 +948,14 @@ AliasDataBuilder::build(UErrorCode &status) {
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;
variantLength = 0, subdivisionLength = 0;
// Read the languageAlias into languageTypes, languageReplacementIndexes
// and strings
@@ -954,6 +1000,16 @@ AliasDataBuilder::build(UErrorCode &status) {
variantReplacementIndexes,
variantLength, status);
// Read the subdivisionAlias into subdivisionTypes, subdivisionReplacementIndexes
// and strings
LocalMemory<const char*> subdivisionTypes;
LocalMemory<int32_t> subdivisionReplacementIndexes;
readSubdivisionAlias(subdivisionAlias.getAlias(),
&strings,
subdivisionTypes,
subdivisionReplacementIndexes,
subdivisionLength, status);
if (U_FAILURE(status)) {
return nullptr;
}
@@ -993,6 +1049,14 @@ AliasDataBuilder::build(UErrorCode &status) {
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;
}
@@ -1003,6 +1067,7 @@ AliasDataBuilder::build(UErrorCode &status) {
std::move(scriptMap),
std::move(territoryMap),
std::move(variantMap),
std::move(subdivisionMap),
strings.orphanCharStrings());
if (data == nullptr) {
@@ -1028,7 +1093,7 @@ public:
// 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);
const Locale& locale, CharString& out, UErrorCode& status);
private:
const char* language;
@@ -1104,6 +1169,14 @@ private:
// 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&
@@ -1252,11 +1325,11 @@ AliasReplacer::replaceLanguage(
continue;
}
const char* replacedLanguage;
const char* replacedScript;
const char* replacedRegion;
const char* replacedVariant;
const char* replacedExtensions;
const char* replacedLanguage = nullptr;
const char* replacedScript = nullptr;
const char* replacedRegion = nullptr;
const char* replacedVariant = nullptr;
const char* replacedExtensions = nullptr;
parseLanguageReplacement(replacement,
replacedLanguage,
replacedScript,
@@ -1266,7 +1339,7 @@ AliasReplacer::replaceLanguage(
toBeFreed,
status);
replacedLanguage =
uprv_strcmp(replacedLanguage, "und") == 0 ?
(replacedLanguage != nullptr && uprv_strcmp(replacedLanguage, "und") == 0) ?
language : replacedLanguage;
replacedScript = deleteOrReplace(script, nullptr, replacedScript);
replacedRegion = deleteOrReplace(region, searchRegion, replacedRegion);
@@ -1293,7 +1366,6 @@ AliasReplacer::replaceLanguage(
}
}
if (replacedExtensions != nullptr) {
// TODO(ICU-21292)
// DO NOTHING
// UTS35 does not specifiy what should we do if we have extensions in the
// replacement. Currently we know only the following 4 "BCP47 LegacyRules" have
@@ -1333,10 +1405,16 @@ AliasReplacer::replaceTerritory(UVector& toBeFreed, UErrorCode& status)
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.
Locale l(language, nullptr, script);
// 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();
CharString* item = nullptr;
LocalPointer<CharString> item;
if (likelyRegion != nullptr && uprv_strlen(likelyRegion) > 0) {
size_t len = uprv_strlen(likelyRegion);
const char* foundInReplacement = uprv_strstr(replacement,
@@ -1348,20 +1426,22 @@ AliasReplacer::replaceTerritory(UVector& toBeFreed, UErrorCode& status)
*(foundInReplacement-1) == ' ');
U_ASSERT(foundInReplacement[len] == ' ' ||
foundInReplacement[len] == '\0');
item = new CharString(foundInReplacement, (int32_t)len, status);
item.adoptInsteadAndCheckErrorCode(
new CharString(foundInReplacement, (int32_t)len, status), status);
}
}
if (item == nullptr) {
item = new CharString(replacement,
(int32_t)(firstSpace - replacement), status);
if (item.isNull() && U_SUCCESS(status)) {
item.adoptInsteadAndCheckErrorCode(
new CharString(replacement,
(int32_t)(firstSpace - replacement), status), status);
}
if (U_FAILURE(status)) { return false; }
if (item == nullptr) {
if (item.isNull()) {
status = U_MEMORY_ALLOCATION_ERROR;
return false;
}
replacedRegion = item->data();
toBeFreed.addElement(item, status);
toBeFreed.addElement(item.orphan(), status);
}
U_ASSERT(!same(region, replacedRegion));
region = replacedRegion;
@@ -1426,6 +1506,103 @@ AliasReplacer::replaceVariant(UErrorCode& status)
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);
// Ignore len == 2, see CLDR-14312
if (3 <= len && len <= 8) {
output.append(replacement, (int32_t)len, 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 NULL-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 : (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;
}
const char* nextTKey = ultag_getTKeyStart(tvalue);
if (nextTKey != nullptr) {
*((char*)(nextTKey-1)) = '\0'; // NULL 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) -> int8_t {
// uprv_strcmp return int and in some platform, such as arm64-v8a,
// it may return positive values > 127 which cause the casted value
// of int8_t negative.
int res = uprv_strcmp(
(const char*)e1.pointer, (const char*)e2.pointer);
return (res == 0) ? 0 : ((res > 0) ? 1 : -1);
}, 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, '-');
// Split the "tkey-tvalue" pair string so that we can canonicalize the tvalue.
U_ASSERT(tvalue != nullptr);
*((char*)tvalue++) = '\0'; // NULL 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)
@@ -1444,13 +1621,17 @@ AliasReplacer::outputToString(
out.append(SEP_CHAR, status);
}
variants.sort([](UElement e1, UElement e2) -> int8_t {
return uprv_strcmp(
// uprv_strcmp return int and in some platform, such as arm64-v8a,
// it may return positive values > 127 which cause the casted value
// of int8_t negative.
int res = uprv_strcmp(
(const char*)e1.pointer, (const char*)e2.pointer);
return (res == 0) ? 0 : ((res > 0) ? 1 : -1);
}, status);
int32_t variantsStart = out.length();
for (int32_t i = 0; i < variants.size(); i++) {
out.append(SEP_CHAR, status)
.append((const char*)((UVector*)variants.elementAt(i)),
.append((const char*)(variants.elementAt(i)),
status);
}
T_CString_toUpperCase(out.data() + variantsStart);
@@ -1467,7 +1648,7 @@ AliasReplacer::outputToString(
}
bool
AliasReplacer::replace(const Locale& locale, CharString& out, UErrorCode status)
AliasReplacer::replace(const Locale& locale, CharString& out, UErrorCode& status)
{
data = AliasData::singleton(status);
if (U_FAILURE(status)) {
@@ -1488,7 +1669,6 @@ AliasReplacer::replace(const Locale& locale, CharString& out, UErrorCode status)
region = nullptr;
}
const char* variantsStr = locale.getVariant();
const char* extensionsStr = locale_getKeywordsStart(locale.getName());
CharString variantsBuff(variantsStr, -1, status);
if (!variantsBuff.isEmpty()) {
if (U_FAILURE(status)) { return false; }
@@ -1507,8 +1687,12 @@ AliasReplacer::replace(const Locale& locale, CharString& out, UErrorCode status)
// Sort the variants
variants.sort([](UElement e1, UElement e2) -> int8_t {
return uprv_strcmp(
// uprv_strcmp return int and in some platform, such as arm64-v8a,
// it may return positive values > 127 which cause the casted value
// of int8_t negative.
int res = uprv_strcmp(
(const char*)e1.pointer, (const char*)e2.pointer);
return (res == 0) ? 0 : ((res > 0) ? 1 : -1);
}, status);
// A changed count to assert when loop too many times.
@@ -1552,11 +1736,52 @@ AliasReplacer::replace(const Locale& locale, CharString& out, UErrorCode status)
if (U_FAILURE(status)) { return false; }
// Nothing changed and we know the order of the vaiants are not change
// because we have no variant or only one.
if (changed == 0 && variants.size() <= 1) {
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<icu::StringEnumeration> 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)) {
@@ -1564,8 +1789,6 @@ AliasReplacer::replace(const Locale& locale, CharString& out, UErrorCode status)
}
// If the tag is not changed, return.
if (uprv_strcmp(out.data(), locale.getName()) == 0) {
U_ASSERT(changed == 0);
U_ASSERT(variants.size() > 1);
out.clear();
return false;
}
@@ -1627,7 +1850,7 @@ Locale& Locale::init(const char* localeID, UBool canonicalize)
{
fIsBogus = FALSE;
/* Free our current storage */
if (baseName != fullName) {
if ((baseName != fullName) && (baseName != fullNameBuffer)) {
uprv_free(baseName);
}
baseName = NULL;
@@ -1663,6 +1886,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) {
@@ -1816,7 +2040,7 @@ Locale::hashCode() const
void
Locale::setToBogus() {
/* Free our current storage */
if(baseName != fullName) {
if((baseName != fullName) && (baseName != fullNameBuffer)) {
uprv_free(baseName);
}
baseName = NULL;
@@ -2450,9 +2674,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);
@@ -2469,6 +2697,7 @@ Locale::setKeywordValue(const char* keywordName, const char* keywordValue, UErro
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);
}
+2 -1
View File
@@ -320,7 +320,8 @@ XLikelySubtags::~XLikelySubtags() {
LSR XLikelySubtags::makeMaximizedLsrFrom(const Locale &locale, UErrorCode &errorCode) const {
const char *name = locale.getName();
if (uprv_isAtSign(name[0]) && name[1] == 'x' && name[2] == '=') { // name.startsWith("@x=")
// Private use language tag x-subtag-subtag...
// Private use language tag x-subtag-subtag... which CLDR changes to
// und-x-subtag-subtag...
return LSR(name, "", "", LSR::EXPLICIT_LSR);
}
return makeMaximizedLsr(locale.getLanguage(), locale.getScript(), locale.getCountry(),
+59 -23
View File
@@ -38,7 +38,7 @@ public:
virtual UnicodeString &
normalize(const UnicodeString &src,
UnicodeString &dest,
UErrorCode &errorCode) const {
UErrorCode &errorCode) const U_OVERRIDE {
if(U_FAILURE(errorCode)) {
dest.setToBogus();
return dest;
@@ -64,13 +64,13 @@ public:
virtual UnicodeString &
normalizeSecondAndAppend(UnicodeString &first,
const UnicodeString &second,
UErrorCode &errorCode) const {
UErrorCode &errorCode) const U_OVERRIDE {
return normalizeSecondAndAppend(first, second, true, errorCode);
}
virtual UnicodeString &
append(UnicodeString &first,
const UnicodeString &second,
UErrorCode &errorCode) const {
UErrorCode &errorCode) const U_OVERRIDE {
return normalizeSecondAndAppend(first, second, false, errorCode);
}
UnicodeString &
@@ -107,7 +107,7 @@ public:
UnicodeString &safeMiddle,
ReorderingBuffer &buffer, UErrorCode &errorCode) const = 0;
virtual UBool
getDecomposition(UChar32 c, UnicodeString &decomposition) const {
getDecomposition(UChar32 c, UnicodeString &decomposition) const U_OVERRIDE {
UChar buffer[4];
int32_t length;
const UChar *d=impl.getDecomposition(c, buffer, length);
@@ -122,7 +122,7 @@ public:
return true;
}
virtual UBool
getRawDecomposition(UChar32 c, UnicodeString &decomposition) const {
getRawDecomposition(UChar32 c, UnicodeString &decomposition) const U_OVERRIDE {
UChar buffer[30];
int32_t length;
const UChar *d=impl.getRawDecomposition(c, buffer, length);
@@ -137,18 +137,18 @@ public:
return true;
}
virtual UChar32
composePair(UChar32 a, UChar32 b) const {
composePair(UChar32 a, UChar32 b) const U_OVERRIDE {
return impl.composePair(a, b);
}
virtual uint8_t
getCombiningClass(UChar32 c) const {
getCombiningClass(UChar32 c) const U_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 U_OVERRIDE {
if(U_FAILURE(errorCode)) {
return false;
}
@@ -161,11 +161,11 @@ public:
return sLimit==spanQuickCheckYes(sArray, sLimit, errorCode);
}
virtual UNormalizationCheckResult
quickCheck(const UnicodeString &s, UErrorCode &errorCode) const {
quickCheck(const UnicodeString &s, UErrorCode &errorCode) const U_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 U_OVERRIDE {
if(U_FAILURE(errorCode)) {
return 0;
}
@@ -194,27 +194,57 @@ public:
private:
virtual void
normalize(const UChar *src, const UChar *limit,
ReorderingBuffer &buffer, UErrorCode &errorCode) const {
ReorderingBuffer &buffer, UErrorCode &errorCode) const U_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,
UnicodeString &safeMiddle,
ReorderingBuffer &buffer, UErrorCode &errorCode) const {
ReorderingBuffer &buffer, UErrorCode &errorCode) const U_OVERRIDE {
impl.decomposeAndAppend(src, limit, doNormalize, safeMiddle, buffer, errorCode);
}
void
normalizeUTF8(uint32_t options, StringPiece src, ByteSink &sink,
Edits *edits, UErrorCode &errorCode) const U_OVERRIDE {
if (U_FAILURE(errorCode)) {
return;
}
if (edits != nullptr && (options & U_EDITS_NO_RESET) == 0) {
edits->reset();
}
const uint8_t *s = reinterpret_cast<const uint8_t *>(src.data());
impl.decomposeUTF8(options, s, s + src.length(), &sink, edits, errorCode);
sink.Flush();
}
virtual UBool
isNormalizedUTF8(StringPiece sp, UErrorCode &errorCode) const U_OVERRIDE {
if(U_FAILURE(errorCode)) {
return false;
}
const uint8_t *s = reinterpret_cast<const uint8_t *>(sp.data());
const uint8_t *sLimit = s + sp.length();
return sLimit == impl.decomposeUTF8(0, s, sLimit, nullptr, nullptr, errorCode);
}
virtual const UChar *
spanQuickCheckYes(const UChar *src, const UChar *limit, UErrorCode &errorCode) const {
spanQuickCheckYes(const UChar *src, const UChar *limit, UErrorCode &errorCode) const U_OVERRIDE {
return impl.decompose(src, limit, NULL, errorCode);
}
using Normalizer2WithImpl::spanQuickCheckYes; // Avoid warning about hiding base class function.
virtual UNormalizationCheckResult getQuickCheck(UChar32 c) const {
virtual UNormalizationCheckResult getQuickCheck(UChar32 c) const U_OVERRIDE {
return impl.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 U_OVERRIDE {
return impl.hasDecompBoundaryBefore(c);
}
virtual UBool hasBoundaryAfter(UChar32 c) const U_OVERRIDE {
return impl.hasDecompBoundaryAfter(c);
}
virtual UBool isInert(UChar32 c) const U_OVERRIDE {
return impl.isDecompInert(c);
}
};
class ComposeNormalizer2 : public Normalizer2WithImpl {
@@ -321,24 +351,30 @@ public:
private:
virtual void
normalize(const UChar *src, const UChar *limit,
ReorderingBuffer &buffer, UErrorCode &errorCode) const {
ReorderingBuffer &buffer, UErrorCode &errorCode) const U_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,
UnicodeString &safeMiddle,
ReorderingBuffer &buffer, UErrorCode &errorCode) const {
ReorderingBuffer &buffer, UErrorCode &errorCode) const U_OVERRIDE {
impl.makeFCDAndAppend(src, limit, doNormalize, safeMiddle, buffer, errorCode);
}
virtual const UChar *
spanQuickCheckYes(const UChar *src, const UChar *limit, UErrorCode &errorCode) const {
spanQuickCheckYes(const UChar *src, const UChar *limit, UErrorCode &errorCode) const U_OVERRIDE {
return impl.makeFCD(src, limit, NULL, 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 U_OVERRIDE {
return impl.hasFCDBoundaryBefore(c);
}
virtual UBool hasBoundaryAfter(UChar32 c) const U_OVERRIDE {
return impl.hasFCDBoundaryAfter(c);
}
virtual UBool isInert(UChar32 c) const U_OVERRIDE {
return impl.isFCDInert(c);
}
};
struct Norm2AllModes : public UMemory {
+143 -9
View File
@@ -731,9 +731,131 @@ UBool Normalizer2Impl::decompose(UChar32 c, uint16_t norm16,
return buffer.append((const UChar *)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,11 +928,15 @@ Normalizer2Impl::decomposeShort(const uint8_t *src, const uint8_t *limit,
} else {
leadCC = 0;
}
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;
}
}
@@ -1954,10 +2088,10 @@ 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;
+10 -1
View File
@@ -491,6 +491,12 @@ public:
UnicodeString &safeMiddle,
ReorderingBuffer &buffer,
UErrorCode &errorCode) const;
/** 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 UChar *src, const UChar *limit,
UBool onlyContiguous,
UBool doCompose,
@@ -649,6 +655,9 @@ private:
UChar32 minNeedDataCP,
ReorderingBuffer *buffer,
UErrorCode &errorCode) const;
enum StopAt { STOP_AT_LIMIT, STOP_AT_DECOMP_BOUNDARY, STOP_AT_COMP_BOUNDARY };
const UChar *decomposeShort(const UChar *src, const UChar *limit,
UBool stopAtCompBoundary, UBool onlyContiguous,
ReorderingBuffer &buffer, UErrorCode &errorCode) const;
@@ -656,7 +665,7 @@ private:
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);
+1 -1
View File
@@ -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,
+2 -2
View File
@@ -81,7 +81,7 @@
#include <float.h>
#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
@@ -1139,7 +1139,7 @@ uprv_tzname(int n)
#endif
if (tzid != NULL && 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
) {
+1 -1
View File
@@ -527,7 +527,7 @@ U_CAPI 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
*
+1 -1
View File
@@ -812,7 +812,7 @@ int32_t RuleBasedBreakIterator::handleNext() {
}
#endif
// handleNext alway sets the break tag value.
// handleNext always sets the break tag value.
// Set the default for it.
fRuleStatusIndex = 0;
+1 -1
View File
@@ -258,7 +258,7 @@ void RuleBasedBreakIterator::BreakCache::preceding(int32_t startPos, UErrorCode
previous(status);
} else {
// seek() leaves the BreakCache positioned at the preceding boundary
// if the requested position is between two bounaries.
// if the requested position is between two boundaries.
// current() pushes the BreakCache position out to the BreakIterator itself.
U_ASSERT(startPos > fTextIdx);
current();
+5 -1
View File
@@ -284,7 +284,7 @@ UBool RBBIRuleScanner::doParseActions(int32_t action)
case doEndAssign:
{
// We have reached the end of an assignement statement.
// We have reached the end of an assignment statement.
// Current scan char is the ';' that terminates the assignment.
// Terminate expression, leaves expression parse tree rooted in TOS node.
@@ -856,6 +856,10 @@ UChar32 RBBIRuleScanner::nextCharLL() {
return (UChar32)-1;
}
ch = fRB->fRules.char32At(fNextIndex);
if (U_IS_SURROGATE(ch)) {
error(U_ILLEGAL_CHAR_FOUND);
return U_SENTINEL;
}
fNextIndex = fRB->fRules.moveIndex32(fNextIndex, 1);
if (ch == chCR ||
+11 -9
View File
@@ -151,7 +151,7 @@ void RBBITableBuilder::buildForwardTable() {
//
// calculate the functions nullable, firstpos, lastpos and followpos on
// nodes in the parse tree.
// See the alogrithm description in Aho.
// See the algorithm description in Aho.
// Understanding how this works by looking at the code alone will be
// nearly impossible.
//
@@ -1402,12 +1402,13 @@ void RBBITableBuilder::exportTable(void *where) {
U_ASSERT (sd->fAccepting <= 255);
U_ASSERT (sd->fLookAhead <= 255);
U_ASSERT (0 <= sd->fTagsIdx && sd->fTagsIdx <= 255);
row->r8.fAccepting = sd->fAccepting;
row->r8.fLookAhead = sd->fLookAhead;
row->r8.fTagsIdx = sd->fTagsIdx;
RBBIStateTableRow8 *r8 = (RBBIStateTableRow8*)row;
r8->fAccepting = sd->fAccepting;
r8->fLookAhead = sd->fLookAhead;
r8->fTagsIdx = sd->fTagsIdx;
for (col=0; col<catCount; col++) {
U_ASSERT (sd->fDtran->elementAti(col) <= kMaxStateFor8BitsTable);
row->r8.fNextState[col] = sd->fDtran->elementAti(col);
r8->fNextState[col] = sd->fDtran->elementAti(col);
}
} else {
U_ASSERT (sd->fAccepting <= 0xffff);
@@ -1603,12 +1604,13 @@ void RBBITableBuilder::exportSafeTable(void *where) {
UnicodeString *rowString = (UnicodeString *)fSafeTable->elementAt(state);
RBBIStateTableRow *row = (RBBIStateTableRow *)(table->fTableData + state*table->fRowLen);
if (use8BitsForSafeTable()) {
row->r8.fAccepting = 0;
row->r8.fLookAhead = 0;
row->r8.fTagsIdx = 0;
RBBIStateTableRow8 *r8 = (RBBIStateTableRow8*)row;
r8->fAccepting = 0;
r8->fLookAhead = 0;
r8->fTagsIdx = 0;
for (col=0; col<catCount; col++) {
U_ASSERT(rowString->charAt(col) <= kMaxStateFor8BitsTable);
row->r8.fNextState[col] = static_cast<uint8_t>(rowString->charAt(col));
r8->fNextState[col] = static_cast<uint8_t>(rowString->charAt(col));
}
} else {
row->r16.fAccepting = 0;
+4 -2
View File
@@ -274,8 +274,10 @@ public:
*
* @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.
+3
View File
@@ -54,6 +54,9 @@ void ResourceTracer::traceOpen() const {
CharString& ResourceTracer::getFilePath(CharString& output, UErrorCode& status) const {
if (fResB) {
// Note: if you get a segfault around here, check that ResourceTable and
// ResourceArray instances outlive ResourceValue instances referring to
// their contents:
output.append(fResB->fData->fPath, status);
output.append('/', status);
output.append(fResB->fData->fName, status);
+2 -2
View File
@@ -82,7 +82,7 @@ public:
/**
* 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 @@ public:
/**
* 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);
+8
View File
@@ -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;
+12
View File
@@ -174,6 +174,18 @@ ubrk_safeClone(
return (UBreakIterator *)newBI;
}
U_CAPI UBreakIterator * U_EXPORT2
ubrk_clone(const UBreakIterator *bi, UErrorCode *status) {
if (U_FAILURE(*status)) {
return nullptr;
}
BreakIterator *newBI = ((BreakIterator *)bi)->clone();
if (newBI == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
return nullptr;
}
return (UBreakIterator *)newBI;
}
U_CAPI void U_EXPORT2
+1 -1
View File
@@ -681,7 +681,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
+20 -18
View File
@@ -194,7 +194,7 @@ u_isISOControl(UChar32 c) {
/* Some control characters that are used as space. */
#define IS_THAT_CONTROL_SPACE(c) \
(c<=0x9f && ((c>=TAB && c<=CR) || (c>=0x1c && c <=0x1f) || c==NL))
(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) \
@@ -677,14 +677,14 @@ uchar_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode) {
sa->add(sa->set, CR+1); /* range TAB..CR */
sa->add(sa->set, 0x1c);
sa->add(sa->set, 0x1f+1);
USET_ADD_CP_AND_NEXT(sa, NL);
USET_ADD_CP_AND_NEXT(sa, 0x85); // NEXT LINE (NEL)
/* add for u_isIDIgnorable() what was not added above */
sa->add(sa->set, DEL); /* range DEL..NBSP-1, NBSP added below */
sa->add(sa->set, 0x7f); /* range DEL..NBSP-1, NBSP added below */
sa->add(sa->set, HAIRSP);
sa->add(sa->set, RLM+1);
sa->add(sa->set, INHSWAP);
sa->add(sa->set, NOMDIG+1);
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 */
@@ -693,23 +693,25 @@ uchar_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode) {
USET_ADD_CP_AND_NEXT(sa, NNBSP);
/* add for u_digit() */
sa->add(sa->set, U_a);
sa->add(sa->set, U_z+1);
sa->add(sa->set, U_A);
sa->add(sa->set, U_Z+1);
sa->add(sa->set, U_FW_a);
sa->add(sa->set, U_FW_z+1);
sa->add(sa->set, U_FW_A);
sa->add(sa->set, U_FW_Z+1);
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, U_f+1);
sa->add(sa->set, U_F+1);
sa->add(sa->set, U_FW_f+1);
sa->add(sa->set, U_FW_F+1);
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, WJ); /* range WJ..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);
+3 -3
View File
@@ -820,7 +820,7 @@ getKey_2022(char c,int32_t* key,int32_t* offset){
return INVALID_2022;
}
/*runs through a state machine to determine the escape sequence - codepage correspondance
/*runs through a state machine to determine the escape sequence - codepage correspondence
*/
static void
changeState_2022(UConverter* _this,
@@ -1424,7 +1424,7 @@ toUnicodeCallback(UConverter *cnv,
* 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
* ISO-8859-7 : alias to ibm-9409 mapping table
*/
/* preference order of JP charsets */
@@ -2324,7 +2324,7 @@ endloop:
/***************************************************************
* 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
* at the beginning 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
+1 -1
View File
@@ -427,7 +427,7 @@ getAlgorithmicTypeFromName(const char *realName)
#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 */
/* Will always be called with the cnvCacheMutex already being held */
/* by the calling function. */
/* Stores the shared data in the SHARED_DATA_HASHTABLE
* @param data The shared data
+1 -1
View File
@@ -321,7 +321,7 @@ UCNV_FROM_U_CALLBACK_ESCAPE (
case UCNV_PRV_ESCAPE_CSS2:
valueString[valueStringLength++] = (UChar) UNICODE_RS_CODEPOINT; /* adding \ */
valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, codePoint, 16, 0);
/* Always add space character, becase the next character might be whitespace,
/* Always add space character, because the next character might be whitespace,
which would erroneously be considered the termination of the escape sequence. */
valueString[valueStringLength++] = (UChar) UNICODE_SPACE_CODEPOINT;
break;
+2 -2
View File
@@ -81,7 +81,7 @@
[G] D1 [D2]
That is, a sometimes-optional 'group' byte, followed by 1 and sometimes 2
data bytes. The maximum size of a LMBCS chjaracter is 3 bytes:
data bytes. The maximum size of a LMBCS character is 3 bytes:
*/
#define ULMBCS_CHARSIZE_MAX 3
/*
@@ -164,7 +164,7 @@ beginning of internal 'system' range names: */
/* Then we needed a place to put all the other ansi control characters
that must be moved to different values because LMBCS reserves those
values for other purposes. To represent the control characters, we start
with a first byte of 0xF & add the control chaarcter value as the
with a first byte of 0xF & add the control character value as the
second byte */
#define ULMBCS_GRP_CTRL 0x0F
+1 -1
View File
@@ -814,7 +814,7 @@ const UConverterSharedData _UTF7Data=
* the use of "~" in some servers as a home directory indicator.
*
* 5) UTF-7 permits multiple alternate forms to represent the same
* string; in particular, printable US-ASCII chararacters can be
* string; in particular, printable US-ASCII characters can be
* represented in encoded form.
*
* In modified UTF-7, printable US-ASCII characters except for "&"
+3 -3
View File
@@ -992,7 +992,7 @@ UConverter_fromUnicode_ISCII_OFFSETS_LOGIC(
if (converterData->currentDeltaFromUnicode == PNJ_DELTA) {
if (sourceChar == PNJ_TIPPI) {
/* Make sure Tippi is converterd to Bindi. */
/* Make sure Tippi is converted to Bindi. */
sourceChar = PNJ_BINDI;
} else if (sourceChar == PNJ_ADHAK) {
/* This is for consonant cluster handling. */
@@ -1147,7 +1147,7 @@ static const uint16_t lookupTable[][2]={
/* is the code point valid in current script? */ \
if(sourceChar> ASCII_END && \
(validityTable[(targetUniChar & 0x7F)] & data->currentMaskToUnicode)==0){ \
/* Vocallic RR is assigne in ISCII Telugu and Unicode */ \
/* Vocallic RR is assigned in ISCII Telugu and Unicode */ \
if(data->currentDeltaToUnicode!=(TELUGU_DELTA) || \
targetUniChar!=VOCALLIC_RR){ \
targetUniChar=missingCharMarker; \
@@ -1272,7 +1272,7 @@ UConverter_toUnicode_ISCII_OFFSETS_LOGIC(UConverterToUnicodeArgs *args, UErrorCo
goto CALLBACK;
} else if (*contextCharToUnicode==ISCII_INV) {
if (sourceChar==ISCII_HALANT) {
targetUniChar = 0x0020; /* replace with space accoding to Indic FAQ */
targetUniChar = 0x0020; /* replace with space according to Indic FAQ */
} else {
targetUniChar = ZWJ;
}
+2 -2
View File
@@ -844,7 +844,7 @@ 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;
@@ -1530,7 +1530,7 @@ uprv_parseCurrency(const char* locale,
int32_t max = 0;
int32_t matchIndex = -1;
// case in-sensitive comparision against currency names
// case in-sensitive comparison against currency names
searchCurrencyName(currencyNames, total_currency_name_count,
upperText, textLen, partialMatchLen, &max, &matchIndex);
+78 -3
View File
@@ -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
@@ -479,8 +481,9 @@ _uhash_put(UHashtable *hash,
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) {
if ((hint & HINT_VALUE_POINTER) ?
value.pointer == NULL :
value.integer == 0 && (hint & HINT_ALLOW_ZERO) == 0) {
/* Disallow storage of NULL values, since NULL is returned by
* get() to indicate an absent key. Storing NULL == removing.
*/
@@ -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;
}
@@ -785,6 +837,29 @@ uhash_removeAll(UHashtable *hash) {
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;
+94 -1
View File
@@ -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
@@ -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
+41 -22
View File
@@ -143,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",
@@ -166,9 +166,9 @@ 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",
"th", "ti", "tig", "tiv", "tk", "tkl", "tkr",
"tlh", "tli", "tly", "tmh", "tn", "to", "tog", "tpi",
"tr", "tru", "trv", "ts", "tsd", "tsi", "tt", "ttt",
"tum", "tvl", "tw", "twq", "ty", "tyv", "tzm",
@@ -181,7 +181,7 @@ static const char * const LANGUAGES[] = {
"za", "zap", "zbl", "zea", "zen", "zgh", "zh", "zu",
"zun", "zxx", "zza",
NULL,
"in", "iw", "ji", "jw", "sh", /* obsolete language codes */
"in", "iw", "ji", "jw", "mo", "sh", "swc", "tl", /* obsolete language codes */
NULL
};
@@ -260,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",
@@ -283,9 +283,9 @@ 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",
"tha", "tir", "tig", "tiv", "tuk", "tkl", "tkr",
"tlh", "tli", "tly", "tmh", "tsn", "ton", "tog", "tpi",
"tur", "tru", "trv", "tso", "tsd", "tsi", "tat", "ttt",
"tum", "tvl", "twi", "twq", "tah", "tyv", "tzm",
@@ -298,8 +298,8 @@ static const char * const LANGUAGES_3[] = {
"zha", "zap", "zbl", "zea", "zen", "zgh", "zho", "zul",
"zun", "zxx", "zza",
NULL,
/* "in", "iw", "ji", "jw", "sh", */
"ind", "heb", "yid", "jaw", "srp",
/* "in", "iw", "ji", "jw", "mo", "sh", "swc", "tl", */
"ind", "heb", "yid", "jaw", "mol", "srp", "swc", "tgl",
NULL
};
@@ -334,13 +334,13 @@ static const char * const COUNTRIES[] = {
"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",
"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",
@@ -357,7 +357,7 @@ 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",
"WS", "XK", "YE", "YT", "ZA", "ZM", "ZW",
NULL,
"AN", "BU", "CS", "FX", "RO", "SU", "TP", "YD", "YU", "ZR", /* obsolete country codes */
NULL
@@ -397,10 +397,10 @@ static const char * const COUNTRIES_3[] = {
"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",
/* "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", */
@@ -409,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", */
@@ -443,8 +443,8 @@ 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",
/* "WS", "XK", "YE", "YT", "ZA", "ZM", "ZW", */
"WSM", "XXK", "YEM", "MYT", "ZAF", "ZMB", "ZWE",
NULL,
/* "AN", "BU", "CS", "FX", "RO", "SU", "TP", "YD", "YU", "ZR" */
"ANT", "BUR", "SCG", "FXX", "ROM", "SUN", "TMP", "YMD", "YUG", "ZAR",
@@ -877,6 +877,9 @@ uloc_setKeywordValue(const char* keywordName,
if(U_FAILURE(*status)) {
return -1;
}
if (*status == U_STRING_NOT_TERMINATED_WARNING) {
*status = U_ZERO_ERROR;
}
if (keywordName == NULL || keywordName[0] == 0 || bufferCapacity <= 1) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
@@ -914,6 +917,7 @@ uloc_setKeywordValue(const char* keywordName,
startSearchHere = (char*)locale_getKeywordsStart(buffer);
if(startSearchHere == NULL || (startSearchHere[1]==0)) {
if(keywordValueLen == 0) { /* no keywords = nothing to remove */
U_ASSERT(*status != U_STRING_NOT_TERMINATED_WARNING);
return bufLen;
}
@@ -933,6 +937,7 @@ uloc_setKeywordValue(const char* keywordName,
startSearchHere += keywordNameLen;
*startSearchHere++ = '=';
uprv_strcpy(startSearchHere, keywordValueBuffer);
U_ASSERT(*status != U_STRING_NOT_TERMINATED_WARNING);
return needLen;
} /* end shortcut - no @ */
@@ -1047,13 +1052,27 @@ 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;
}
// needLen = length of the part before '@'
needLen = (int32_t)(startSearchHere - buffer);
return needLen + updatedKeysAndValues.extract(
// 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 + appendLength;
}
needLen += updatedKeysAndValues.extract(
startSearchHere, bufferCapacity - needLen, *status);
U_ASSERT(*status != U_STRING_NOT_TERMINATED_WARNING);
return needLen;
}
/* ### ID parsing implementation **************************************************/
+1 -1
View File
@@ -271,7 +271,7 @@ initFromResourceBundle(UErrorCode& sts) {
if (U_FAILURE(sts)) {
break;
}
// check if this is an alias of canoncal legacy type
// check if this is an alias of canonical legacy type
if (uprv_compareInvWithUChar(NULL, legacyTypeId, -1, to, toLen) == 0) {
const char* from = ures_getKey(typeAliasDataEntry.getAlias());
if (isTZ) {
+31 -10
View File
@@ -129,7 +129,6 @@ static const char* const LEGACY[] = {
// 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",
@@ -647,6 +646,22 @@ _isTKey(const char* s, int32_t len)
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, sep - result)) {
return result;
}
result = ++sep;
}
if (_isTKey(result, -1)) {
return result;
}
return nullptr;
}
static UBool
_isTValue(const char* s, int32_t len)
{
@@ -671,9 +686,13 @@ _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;
}
@@ -1775,11 +1794,6 @@ _appendKeywords(ULanguageTag* langtag, icu::ByteSink& sink, UErrorCode* status)
return;
}
/* Determine if variants already exists */
if (ultag_getVariantsSize(langtag)) {
posixVariant = TRUE;
}
n = ultag_getExtensionsSize(langtag);
/* resolve locale keywords and reordering keys */
@@ -1787,6 +1801,11 @@ _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;
@@ -2028,7 +2047,10 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta
*status = U_MEMORY_ALLOCATION_ERROR;
return NULL;
}
uprv_memcpy(tagBuf, tag, tagLen);
if (tagLen > 0) {
uprv_memcpy(tagBuf, tag, tagLen);
}
*(tagBuf + tagLen) = 0;
/* create a ULanguageTag */
@@ -2692,8 +2714,7 @@ ulocimp_toLanguageTag(const char* localeID,
if (U_SUCCESS(tmpStatus)) {
if (ultag_isPrivateuseValueSubtags(buf.data(), buf.length())) {
/* return private use only tag */
static const char PREFIX[] = { PRIVATEUSE, SEP };
sink.Append(PREFIX, sizeof(PREFIX));
sink.Append("und-x-", 6);
sink.Append(buf.data(), buf.length());
done = TRUE;
} else if (strict) {
+3
View File
@@ -286,6 +286,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);
+2 -4
View File
@@ -71,7 +71,6 @@ public:
*/
virtual void Append(const char* bytes, int32_t n) = 0;
#ifndef U_HIDE_DRAFT_API
/**
* Appends n bytes to this. Same as Append().
* Call AppendU8() with u8"string literals" which are const char * in C++11
@@ -81,7 +80,7 @@ public:
*
* @param bytes the pointer to the bytes
* @param n the number of bytes; must be non-negative
* @draft ICU 67
* @stable ICU 67
*/
inline void AppendU8(const char* bytes, int32_t n) {
Append(bytes, n);
@@ -97,13 +96,12 @@ public:
*
* @param bytes the pointer to the bytes
* @param n the number of bytes; must be non-negative
* @draft ICU 67
* @stable ICU 67
*/
inline void AppendU8(const char8_t* bytes, int32_t n) {
Append(reinterpret_cast<const char*>(bytes), n);
}
#endif
#endif // U_HIDE_DRAFT_API
/**
* Returns a writable buffer for appending and writes the buffer's capacity to
+3
View File
@@ -30,6 +30,8 @@
#include "unicode/uobject.h"
#include "unicode/ustringtrie.h"
class BytesTrieTest;
U_NAMESPACE_BEGIN
class ByteSink;
@@ -378,6 +380,7 @@ public:
private:
friend class BytesTrieBuilder;
friend class ::BytesTrieTest;
/**
* Constructs a BytesTrie reader instance.
@@ -30,6 +30,8 @@
#include "unicode/stringpiece.h"
#include "unicode/stringtriebuilder.h"
class BytesTrieTest;
U_NAMESPACE_BEGIN
class BytesTrieElement;
@@ -125,6 +127,8 @@ public:
BytesTrieBuilder &clear();
private:
friend class ::BytesTrieTest;
BytesTrieBuilder(const BytesTrieBuilder &other); // no copy constructor
BytesTrieBuilder &operator=(const BytesTrieBuilder &other); // no assignment operator
@@ -168,6 +172,7 @@ private:
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);
static int32_t internalEncodeDelta(int32_t i, char intBytes[]);
CharString *strings; // Pointer not object so we need not #include internal charstr.h.
BytesTrieElement *elements;
+14 -9
View File
@@ -15,7 +15,7 @@
* \file
* \brief (Non API- contains Doxygen definitions)
*
* This file contains documentation for Doxygen and doesnot have
* This file contains documentation for Doxygen and does not have
* any significance with respect to C or C++ API
*/
@@ -53,10 +53,10 @@
*
* <h2>Architecture (User's Guide)</h2>
* <ul>
* <li><a href="http://userguide.icu-project.org/">Introduction</a></li>
* <li><a href="http://userguide.icu-project.org/i18n">Internationalization</a></li>
* <li><a href="http://userguide.icu-project.org/design">Locale Model, Multithreading, Error Handling, etc.</a></li>
* <li><a href="http://userguide.icu-project.org/conversion">Conversion</a></li>
* <li><a href="https://unicode-org.github.io/icu/userguide/">Introduction</a></li>
* <li><a href="https://unicode-org.github.io/icu/userguide/i18n">Internationalization</a></li>
* <li><a href="https://unicode-org.github.io/icu/userguide/design">Locale Model, Multithreading, Error Handling, etc.</a></li>
* <li><a href="https://unicode-org.github.io/icu/userguide/conversion">Conversion</a></li>
* </ul>
*
* <hr>
@@ -74,7 +74,7 @@
* </tr>
* <tr>
* <td>Strings and Character Iteration</td>
* <td>ustring.h, utf8.h, utf16.h, UText, UCharIterator</td>
* <td>ustring.h, utf8.h, utf16.h, icu::StringPiece, UText, UCharIterator, icu::ByteSink</td>
* <td>icu::UnicodeString, icu::CharacterIterator, icu::Appendable, icu::StringPiece,icu::ByteSink</td>
* </tr>
* <tr>
@@ -128,9 +128,9 @@
* <td>icu::Normalizer2</td>
* </tr>
* <tr>
* <td>Calendars</td>
* <td>Calendars and Time Zones</td>
* <td>ucal.h</td>
* <td>icu::Calendar</td>
* <td>icu::Calendar, icu::TimeZone</td>
* </tr>
* <tr>
* <td>Date and Time Formatting</td>
@@ -143,13 +143,18 @@
* <td>icu::MessageFormat</td>
* </tr>
* <tr>
* <td>List Formatting</td>
* <td>ulistformatter.h</td>
* <td>icu::ListFormatter</td>
* </tr>
* <tr>
* <td>Number Formatting<br/>(includes currency and unit formatting)</td>
* <td>unumberformatter.h, unum.h</td>
* <td>icu::number::NumberFormatter (ICU 60+) or icu::NumberFormat (older versions)</td>
* </tr>
* <tr>
* <td>Number Range Formatting<br />(includes currency and unit ranges)</td>
* <td>(no C API)</td>
* <td>unumberrangeformatter.h</td>
* <td>icu::number::NumberRangeFormatter</td>
* </tr>
* <tr>
+3 -4
View File
@@ -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;
/** @} */
+5 -11
View File
@@ -91,8 +91,6 @@ enum ULocMatchDemotion {
typedef enum ULocMatchDemotion ULocMatchDemotion;
#endif
#ifndef U_FORCE_HIDE_DRAFT_API
/**
* 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.
@@ -108,20 +106,20 @@ typedef enum ULocMatchDemotion ULocMatchDemotion;
* but not if it is merely a fallback.
*
* @see LocaleMatcher::Builder#setDirection(ULocMatchDirection)
* @draft ICU 67
* @stable ICU 67
*/
enum ULocMatchDirection {
/**
* Locale matching includes one-way matches such as Breton→French. (default)
*
* @draft ICU 67
* @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.
*
* @draft ICU 67
* @stable ICU 67
*/
ULOCMATCH_DIRECTION_ONLY_TWO_WAY
};
@@ -129,8 +127,6 @@ enum ULocMatchDirection {
typedef enum ULocMatchDirection ULocMatchDirection;
#endif
#endif // U_FORCE_HIDE_DRAFT_API
struct UHashtable;
U_NAMESPACE_BEGIN
@@ -463,14 +459,13 @@ public:
*/
Builder &setDemotionPerDesiredLocale(ULocMatchDemotion demotion);
#ifndef U_HIDE_DRAFT_API
/**
* Option for whether to include or ignore one-way (fallback) match data.
* By default, they are included.
*
* @param direction the match direction to set.
* @return this Builder object
* @draft ICU 67
* @stable ICU 67
*/
Builder &setDirection(ULocMatchDirection direction) {
if (U_SUCCESS(errorCode_)) {
@@ -478,7 +473,6 @@ public:
}
return *this;
}
#endif // U_HIDE_DRAFT_API
#ifndef U_HIDE_DRAFT_API
/**
@@ -704,7 +698,7 @@ private:
LSR *lsrs;
int32_t supportedLocalesLength;
// These are in preference order: 1. Default locale 2. paradigm locales 3. others.
UHashtable *supportedLsrToIndex; // Map<LSR, Integer> stores index+1 because 0 is "not found"
UHashtable *supportedLsrToIndex; // Map<LSR, Integer>
// 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;
+1 -3
View File
@@ -571,15 +571,13 @@ public:
*/
void minimizeSubtags(UErrorCode& status);
#ifndef U_HIDE_DRAFT_API
/**
* Canonicalize the locale ID of this object according to CLDR.
* @param status the status code
* @draft ICU 67
* @stable ICU 67
* @see createCanonical
*/
void canonicalize(UErrorCode& status);
#endif // U_HIDE_DRAFT_API
/**
* Gets the list of keywords for the specified locale.
+10 -18
View File
@@ -225,10 +225,8 @@ public:
* Normalizes a UTF-8 string and optionally records how source substrings
* relate to changed and unchanged result substrings.
*
* Currently implemented completely only for "compose" modes,
* such as for NFC, NFKC, and NFKC_Casefold
* (UNORM2_COMPOSE and UNORM2_COMPOSE_CONTIGUOUS).
* Otherwise currently converts to & from UTF-16 and does not support edits.
* Implemented completely for all built-in modes except for FCD.
* The base class implementation converts to & from UTF-16 and does not support edits.
*
* @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET.
* @param src Source UTF-8 string.
@@ -381,11 +379,9 @@ public:
* resolves to "yes" or "no" to provide a definitive result,
* at the cost of doing more work in those cases.
*
* This works for all normalization modes,
* but it is currently optimized for UTF-8 only for "compose" modes,
* such as for NFC, NFKC, and NFKC_Casefold
* (UNORM2_COMPOSE and UNORM2_COMPOSE_CONTIGUOUS).
* For other modes it currently converts to UTF-16 and calls isNormalized().
* This works for all normalization modes.
* It is optimized for UTF-8 for all built-in modes except for FCD.
* The base class implementation converts to UTF-16 and calls isNormalized().
*
* @param s UTF-8 input string
* @param errorCode Standard ICU error code. Its input value must
@@ -543,10 +539,8 @@ public:
* Normalizes a UTF-8 string and optionally records how source substrings
* relate to changed and unchanged result substrings.
*
* Currently implemented completely only for "compose" modes,
* such as for NFC, NFKC, and NFKC_Casefold
* (UNORM2_COMPOSE and UNORM2_COMPOSE_CONTIGUOUS).
* Otherwise currently converts to & from UTF-16 and does not support edits.
* Implemented completely for most built-in modes except for FCD.
* The base class implementation converts to & from UTF-16 and does not support edits.
*
* @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET.
* @param src Source UTF-8 string.
@@ -676,11 +670,9 @@ public:
* resolves to "yes" or "no" to provide a definitive result,
* at the cost of doing more work in those cases.
*
* This works for all normalization modes,
* but it is currently optimized for UTF-8 only for "compose" modes,
* such as for NFC, NFKC, and NFKC_Casefold
* (UNORM2_COMPOSE and UNORM2_COMPOSE_CONTIGUOUS).
* For other modes it currently converts to UTF-16 and calls isNormalized().
* This works for all normalization modes.
* It is optimized for UTF-8 for all built-in modes except for FCD.
* The base class implementation converts to UTF-16 and calls isNormalized().
*
* @param s UTF-8 input string
* @param errorCode Standard ICU error code. Its input value must
+1 -1
View File
@@ -880,6 +880,6 @@ namespace std {
#else
# define U_CALLCONV_FPTR
#endif
/* @} */
/** @} */
#endif // _PLATFORM_H
+8 -18
View File
@@ -75,12 +75,11 @@ class U_COMMON_API StringPiece : public UMemory {
* @stable ICU 4.2
*/
StringPiece(const char* str);
#ifndef U_HIDE_DRAFT_API
#if defined(__cpp_char8_t) || defined(U_IN_DOXYGEN)
/**
* Constructs from a NUL-terminated const char8_t * pointer.
* @param str a NUL-terminated const char8_t * pointer
* @draft ICU 67
* @stable ICU 67
*/
StringPiece(const char8_t* str) : StringPiece(reinterpret_cast<const char*>(str)) {}
#endif
@@ -88,10 +87,9 @@ class U_COMMON_API StringPiece : public UMemory {
* Constructs an empty StringPiece.
* Needed for type disambiguation from multiple other overloads.
* @param p nullptr
* @draft ICU 67
* @stable ICU 67
*/
StringPiece(std::nullptr_t p) : ptr_(p), length_(0) {}
#endif // U_HIDE_DRAFT_API
/**
* Constructs from a std::string.
@@ -99,17 +97,15 @@ class U_COMMON_API StringPiece : public UMemory {
*/
StringPiece(const std::string& str)
: ptr_(str.data()), length_(static_cast<int32_t>(str.size())) { }
#ifndef U_HIDE_DRAFT_API
#if defined(__cpp_lib_char8_t) || defined(U_IN_DOXYGEN)
/**
* Constructs from a std::u8string.
* @draft ICU 67
* @stable ICU 67
*/
StringPiece(const std::u8string& str)
: ptr_(reinterpret_cast<const char*>(str.data())),
length_(static_cast<int32_t>(str.size())) { }
#endif
#endif // U_HIDE_DRAFT_API
/**
* Constructs from some other implementation of a string piece class, from any
@@ -152,18 +148,16 @@ class U_COMMON_API StringPiece : public UMemory {
* @stable ICU 4.2
*/
StringPiece(const char* offset, int32_t len) : ptr_(offset), length_(len) { }
#ifndef U_HIDE_DRAFT_API
#if defined(__cpp_char8_t) || defined(U_IN_DOXYGEN)
/**
* Constructs from a const char8_t * pointer and a specified length.
* @param str a const char8_t * pointer (need not be terminated)
* @param len the length of the string; must be non-negative
* @draft ICU 67
* @stable ICU 67
*/
StringPiece(const char8_t* str, int32_t len) :
StringPiece(reinterpret_cast<const char*>(str), len) {}
#endif
#endif // U_HIDE_DRAFT_API
/**
* Substring of another StringPiece.
@@ -233,13 +227,12 @@ class U_COMMON_API StringPiece : public UMemory {
*/
void set(const char* str);
#ifndef U_HIDE_DRAFT_API
#if defined(__cpp_char8_t) || defined(U_IN_DOXYGEN)
/**
* Resets the stringpiece to refer to new data.
* @param xdata pointer the new string data. Need not be NUL-terminated.
* @param len the length of the new data
* @draft ICU 67
* @stable ICU 67
*/
inline void set(const char8_t* xdata, int32_t len) {
set(reinterpret_cast<const char*>(xdata), len);
@@ -248,13 +241,12 @@ class U_COMMON_API StringPiece : public UMemory {
/**
* Resets the stringpiece to refer to new data.
* @param str a pointer to a NUL-terminated string.
* @draft ICU 67
* @stable ICU 67
*/
inline void set(const char8_t* str) {
set(reinterpret_cast<const char*>(str));
}
#endif
#endif // U_HIDE_DRAFT_API
/**
* Removes the first n string units.
@@ -286,13 +278,12 @@ class U_COMMON_API StringPiece : public UMemory {
}
}
#ifndef U_HIDE_DRAFT_API
/**
* Searches the StringPiece for the given search string (needle);
* @param needle The string for which to search.
* @param offset Where to start searching within this string (haystack).
* @return The offset of needle in haystack, or -1 if not found.
* @draft ICU 67
* @stable ICU 67
*/
int32_t find(StringPiece needle, int32_t offset);
@@ -301,10 +292,9 @@ class U_COMMON_API StringPiece : public UMemory {
* similar to std::string::compare().
* @param other The string to compare to.
* @return below zero if this < other; above zero if this > other; 0 if this == other.
* @draft ICU 67
* @stable ICU 67
*/
int32_t compare(StringPiece other);
#endif // U_HIDE_DRAFT_API
/**
* Maximum integer, used as a default value for substring methods.
+20 -1
View File
@@ -296,6 +296,8 @@ 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
@@ -312,7 +314,7 @@ ubrk_openBinaryRules(const uint8_t *binaryRules, int32_t rulesLength,
* @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
* @deprecated ICU 69 Use ubrk_clone() instead.
*/
U_CAPI UBreakIterator * U_EXPORT2
ubrk_safeClone(
@@ -321,6 +323,23 @@ ubrk_safeClone(
int32_t *pBufferSize,
UErrorCode *status);
#endif /* U_HIDE_DEPRECATED_API */
#ifndef U_HIDE_DRAFT_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
* @draft ICU 69
*/
U_CAPI UBreakIterator * U_EXPORT2
ubrk_clone(const UBreakIterator *bi,
UErrorCode *status);
#endif // U_HIDE_DRAFT_API
#ifndef U_HIDE_DEPRECATED_API
/**
+2 -2
View File
@@ -1699,10 +1699,10 @@ ucnv_countAvailable(void);
/**
* Gets the canonical converter name of the specified converter from a list of
* all available converters contaied in the alias file. All converters
* all available converters contained in the alias file. All converters
* in this list can be opened.
*
* @param n the index to a converter available on the system (in the range <TT>[0..ucnv_countAvaiable()]</TT>)
* @param n the index to a converter available on the system (in the range <TT>[0..ucnv_countAvailable()]</TT>)
* @return a pointer a string (library owned), or <TT>NULL</TT> if the index is out of bounds.
* @see ucnv_countAvailable
* @stable ICU 2.0
+2 -2
View File
@@ -45,11 +45,11 @@
* from the serialized form.
*/
struct UConverterSelector;
/**
* @{
* The selector data structure
* Typedef for selector data structure.
*/
struct UConverterSelector;
typedef struct UConverterSelector UConverterSelector;
/** @} */
+2 -2
View File
@@ -306,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/icudata
*
* 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.
@@ -353,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/icudata
*
* The format of this data is that of the icu common data file, like 'icudt26l.dat'
* or the corresponding shared library (DLL) file.
+2 -2
View File
@@ -40,8 +40,8 @@ U_NAMESPACE_BEGIN
*
* <code>UnicodeFilter</code> 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.
*
* <p>Note: UnicodeFilter currently stubs out two pure virtual methods
+41 -25
View File
@@ -178,8 +178,6 @@ class RuleCharacterIterator;
* Unicode property
* </table>
*
* <p><b>Warning</b>: you cannot add an empty string ("") to a UnicodeSet.</p>
*
* <p><b>Formal syntax</b></p>
*
* \htmlonly<blockquote>\endhtmlonly
@@ -601,7 +599,7 @@ public:
/**
* 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
@@ -1077,7 +1075,7 @@ public:
/**
* 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 <code>end > start</code>
* the call leaves this set unchanged. If <code>start > end</code>
* 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 +1093,9 @@ public:
* 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 +1105,8 @@ public:
* present. If this set already contains the multicharacter,
* the call leaves this set unchanged.
* Thus "ch" => {"ch"}
* <br><b>Warning: you cannot add an empty string ("") to a UnicodeSet.</b>
* A frozen set will not be modified.
*
* @param s the source string
* @return this object, for chaining
* @stable ICU 2.4
@@ -1124,8 +1125,8 @@ public:
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 +1136,6 @@ public:
/**
* 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 +1145,6 @@ public:
/**
* 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 +1154,6 @@ public:
/**
* 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 +1163,7 @@ public:
/**
* Makes a set from a multicharacter string. Thus "ch" => {"ch"}
* <br><b>Warning: you cannot add an empty string ("") to a UnicodeSet.</b>
*
* @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 +1183,13 @@ public:
/**
* Retain only the elements in this set that are contained in the
* specified range. If <code>end > start</code> then an empty range is
* specified range. If <code>start > end</code> 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 +1198,31 @@ public:
/**
* 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);
#ifndef U_HIDE_DRAFT_API
/**
* 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
* @draft ICU 69
*/
UnicodeSet& retain(const UnicodeString &s);
#endif // U_HIDE_DRAFT_API
/**
* Removes the specified range from this set if it is present.
* The set will not contain the specified range once the call
* returns. If <code>end > start</code> then an empty range is
* returns. If <code>start > end</code> then an empty range is
* removed, leaving the set unchanged.
* A frozen set will not be modified.
*
@@ -1226,6 +1239,9 @@ public:
* 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);
@@ -1253,15 +1269,13 @@ public:
/**
* 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 <code>end > start</code>
* added if it is not in this set. If <code>start > end</code>
* 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 +1285,18 @@ public:
* 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.
* <br><b>Warning: you cannot add an empty string ("") to a UnicodeSet.</b>
* 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

Some files were not shown because too many files have changed in this diff Show More