GeezerVison is showing github.com — deps: update to ICU 67.1 · nodejs/node@331f0b3
File treeExpand file treeCollapse file tree Open diff view settings Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboard +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | ICU sources - auto generated by shrink-icu-src.py | 2 | 2 |
| 3 | 3 | This directory contains the ICU subset used by --with-intl=full-icu | 4 | | -It is a strict subset of ICU 66 source files with the following exception(s): | 5 | | -* deps/icu-small/source/data/in/icudt66l.dat.bz2 : compressed data file | | 4 | +It is a strict subset of ICU 67 source files with the following exception(s): | | 5 | +* deps/icu-small/source/data/in/icudt67l.dat.bz2 : compressed data file | 6 | 6 |
| 7 | 7 |
| 8 | 8 | To rebuild this directory, see ../../tools/icu/README.md |
Collapse file Copy file name to clipboardExpand all lines: deps/icu-small/source/common/brkiter.cpp +27-8Lines changed: 27 additions & 8 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 38 | 38 | #include "uresimp.h" | 39 | 39 | #include "uassert.h" | 40 | 40 | #include "ubrkimpl.h" | | 41 | +#include "utracimp.h" | 41 | 42 | #include "charstr.h" | 42 | 43 |
| 43 | 44 | // ***************************************************************************** | @@ -412,28 +413,41 @@ BreakIterator::makeInstance(const Locale& loc, int32_t kind, UErrorCode& status) | 412 | 413 | BreakIterator *result = NULL; | 413 | 414 | switch (kind) { | 414 | 415 | case UBRK_CHARACTER: | 415 | | - result = BreakIterator::buildInstance(loc, "grapheme", status); | | 416 | + { | | 417 | + UTRACE_ENTRY(UTRACE_UBRK_CREATE_CHARACTER); | | 418 | + result = BreakIterator::buildInstance(loc, "grapheme", status); | | 419 | + UTRACE_EXIT_STATUS(status); | | 420 | + } | 416 | 421 | break; | 417 | 422 | case UBRK_WORD: | 418 | | - result = BreakIterator::buildInstance(loc, "word", status); | | 423 | + { | | 424 | + UTRACE_ENTRY(UTRACE_UBRK_CREATE_WORD); | | 425 | + result = BreakIterator::buildInstance(loc, "word", status); | | 426 | + UTRACE_EXIT_STATUS(status); | | 427 | + } | 419 | 428 | break; | 420 | 429 | case UBRK_LINE: | 421 | | - uprv_strcpy(lbType, "line"); | 422 | 430 | { | | 431 | + UTRACE_ENTRY(UTRACE_UBRK_CREATE_LINE); | | 432 | + uprv_strcpy(lbType, "line"); | 423 | 433 | char lbKeyValue[kKeyValueLenMax] = {0}; | 424 | 434 | UErrorCode kvStatus = U_ZERO_ERROR; | 425 | 435 | int32_t kLen = loc.getKeywordValue("lb", lbKeyValue, kKeyValueLenMax, kvStatus); | 426 | 436 | if (U_SUCCESS(kvStatus) && kLen > 0 && (uprv_strcmp(lbKeyValue,"strict")==0 || uprv_strcmp(lbKeyValue,"normal")==0 || uprv_strcmp(lbKeyValue,"loose")==0)) { | 427 | 437 | uprv_strcat(lbType, "_"); | 428 | 438 | uprv_strcat(lbType, lbKeyValue); | 429 | 439 | } | | 440 | + result = BreakIterator::buildInstance(loc, lbType, status); | | 441 | + | | 442 | + UTRACE_DATA1(UTRACE_INFO, "lb=%s", lbKeyValue); | | 443 | + UTRACE_EXIT_STATUS(status); | 430 | 444 | } | 431 | | - result = BreakIterator::buildInstance(loc, lbType, status); | 432 | 445 | break; | 433 | 446 | case UBRK_SENTENCE: | 434 | | - result = BreakIterator::buildInstance(loc, "sentence", status); | 435 | | -#if !UCONFIG_NO_FILTERED_BREAK_ITERATION | 436 | 447 | { | | 448 | + UTRACE_ENTRY(UTRACE_UBRK_CREATE_SENTENCE); | | 449 | + result = BreakIterator::buildInstance(loc, "sentence", status); | | 450 | +#if !UCONFIG_NO_FILTERED_BREAK_ITERATION | 437 | 451 | char ssKeyValue[kKeyValueLenMax] = {0}; | 438 | 452 | UErrorCode kvStatus = U_ZERO_ERROR; | 439 | 453 | int32_t kLen = loc.getKeywordValue("ss", ssKeyValue, kKeyValueLenMax, kvStatus); | @@ -444,11 +458,16 @@ BreakIterator::makeInstance(const Locale& loc, int32_t kind, UErrorCode& status) | 444 | 458 | delete fbiBuilder; | 445 | 459 | } | 446 | 460 | } | 447 | | - } | 448 | 461 | #endif | | 462 | + UTRACE_EXIT_STATUS(status); | | 463 | + } | 449 | 464 | break; | 450 | 465 | case UBRK_TITLE: | 451 | | - result = BreakIterator::buildInstance(loc, "title", status); | | 466 | + { | | 467 | + UTRACE_ENTRY(UTRACE_UBRK_CREATE_TITLE); | | 468 | + result = BreakIterator::buildInstance(loc, "title", status); | | 469 | + UTRACE_EXIT_STATUS(status); | | 470 | + } | 452 | 471 | break; | 453 | 472 | default: | 454 | 473 | status = U_ILLEGAL_ARGUMENT_ERROR; | |
Collapse file Copy file name to clipboardExpand all lines: deps/icu-small/source/common/cmemory.h +102-18Lines changed: 102 additions & 18 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -274,7 +274,10 @@ inline T *LocalMemory<T>::allocateInsteadAndCopy(int32_t newCapacity, int32_t le | 274 | 274 | * | 275 | 275 | * WARNING: MaybeStackArray only works with primitive (plain-old data) types. | 276 | 276 | * It does NOT know how to call a destructor! If you work with classes with | 277 | | - * destructors, consider LocalArray in localpointer.h or MemoryPool. | | 277 | + * destructors, consider: | | 278 | + * | | 279 | + * - LocalArray in localpointer.h if you know the length ahead of time | | 280 | + * - MaybeStackVector if you know the length at runtime | 278 | 281 | */ | 279 | 282 | template<typename T, int32_t stackCapacity> | 280 | 283 | class MaybeStackArray { | @@ -684,26 +687,26 @@ inline H *MaybeStackHeaderAndArray<H, T, stackCapacity>::orphanOrClone(int32_t l | 684 | 687 | template<typename T, int32_t stackCapacity = 8> | 685 | 688 | class MemoryPool : public UMemory { | 686 | 689 | public: | 687 | | - MemoryPool() : count(0), pool() {} | | 690 | + MemoryPool() : fCount(0), fPool() {} | 688 | 691 |
| 689 | 692 | ~MemoryPool() { | 690 | | - for (int32_t i = 0; i < count; ++i) { | 691 | | - delete pool[i]; | | 693 | + for (int32_t i = 0; i < fCount; ++i) { | | 694 | + delete fPool[i]; | 692 | 695 | } | 693 | 696 | } | 694 | 697 |
| 695 | 698 | MemoryPool(const MemoryPool&) = delete; | 696 | 699 | MemoryPool& operator=(const MemoryPool&) = delete; | 697 | 700 |
| 698 | | - MemoryPool(MemoryPool&& other) U_NOEXCEPT : count(other.count), | 699 | | - pool(std::move(other.pool)) { | 700 | | - other.count = 0; | | 701 | + MemoryPool(MemoryPool&& other) U_NOEXCEPT : fCount(other.fCount), | | 702 | + fPool(std::move(other.fPool)) { | | 703 | + other.fCount = 0; | 701 | 704 | } | 702 | 705 |
| 703 | 706 | MemoryPool& operator=(MemoryPool&& other) U_NOEXCEPT { | 704 | | - count = other.count; | 705 | | - pool = std::move(other.pool); | 706 | | - other.count = 0; | | 707 | + fCount = other.fCount; | | 708 | + fPool = std::move(other.fPool); | | 709 | + other.fCount = 0; | 707 | 710 | return *this; | 708 | 711 | } | 709 | 712 |
| @@ -716,20 +719,101 @@ class MemoryPool : public UMemory { | 716 | 719 | */ | 717 | 720 | template<typename... Args> | 718 | 721 | T* create(Args&&... args) { | 719 | | - int32_t capacity = pool.getCapacity(); | 720 | | - if (count == capacity && | 721 | | - pool.resize(capacity == stackCapacity ? 4 * capacity : 2 * capacity, | 722 | | - capacity) == nullptr) { | | 722 | + int32_t capacity = fPool.getCapacity(); | | 723 | + if (fCount == capacity && | | 724 | + fPool.resize(capacity == stackCapacity ? 4 * capacity : 2 * capacity, | | 725 | + capacity) == nullptr) { | 723 | 726 | return nullptr; | 724 | 727 | } | 725 | | - return pool[count++] = new T(std::forward<Args>(args)...); | | 728 | + return fPool[fCount++] = new T(std::forward<Args>(args)...); | 726 | 729 | } | 727 | 730 |
| 728 | | -private: | 729 | | - int32_t count; | 730 | | - MaybeStackArray<T*, stackCapacity> pool; | | 731 | + /** | | 732 | + * @return Number of elements that have been allocated. | | 733 | + */ | | 734 | + int32_t count() const { | | 735 | + return fCount; | | 736 | + } | | 737 | + | | 738 | +protected: | | 739 | + int32_t fCount; | | 740 | + MaybeStackArray<T*, stackCapacity> fPool; | | 741 | +}; | | 742 | + | | 743 | +/** | | 744 | + * An internal Vector-like implementation based on MemoryPool. | | 745 | + * | | 746 | + * Heap-allocates each element and stores pointers. | | 747 | + * | | 748 | + * To append an item to the vector, use emplaceBack. | | 749 | + * | | 750 | + * MaybeStackVector<MyType> vector; | | 751 | + * MyType* element = vector.emplaceBack(); | | 752 | + * if (!element) { | | 753 | + * status = U_MEMORY_ALLOCATION_ERROR; | | 754 | + * } | | 755 | + * // do stuff with element | | 756 | + * | | 757 | + * To loop over the vector, use a for loop with indices: | | 758 | + * | | 759 | + * for (int32_t i = 0; i < vector.length(); i++) { | | 760 | + * MyType* element = vector[i]; | | 761 | + * } | | 762 | + */ | | 763 | +template<typename T, int32_t stackCapacity = 8> | | 764 | +class MaybeStackVector : protected MemoryPool<T, stackCapacity> { | | 765 | +public: | | 766 | + using MemoryPool<T, stackCapacity>::MemoryPool; | | 767 | + using MemoryPool<T, stackCapacity>::operator=; | | 768 | + | | 769 | + template<typename... Args> | | 770 | + T* emplaceBack(Args&&... args) { | | 771 | + return this->create(args...); | | 772 | + } | | 773 | + | | 774 | + int32_t length() const { | | 775 | + return this->fCount; | | 776 | + } | | 777 | + | | 778 | + T** getAlias() { | | 779 | + return this->fPool.getAlias(); | | 780 | + } | | 781 | + | | 782 | + /** | | 783 | + * Array item access (read-only). | | 784 | + * No index bounds check. | | 785 | + * @param i array index | | 786 | + * @return reference to the array item | | 787 | + */ | | 788 | + const T* operator[](ptrdiff_t i) const { | | 789 | + return this->fPool[i]; | | 790 | + } | | 791 | + | | 792 | + /** | | 793 | + * Array item access (writable). | | 794 | + * No index bounds check. | | 795 | + * @param i array index | | 796 | + * @return reference to the array item | | 797 | + */ | | 798 | + T* operator[](ptrdiff_t i) { | | 799 | + return this->fPool[i]; | | 800 | + } | | 801 | + | | 802 | + /** | | 803 | + * Append all the items from another MaybeStackVector to this one. | | 804 | + */ | | 805 | + void appendAll(const MaybeStackVector& other, UErrorCode& status) { | | 806 | + for (int32_t i = 0; i < other.fCount; i++) { | | 807 | + T* item = emplaceBack(*other[i]); | | 808 | + if (!item) { | | 809 | + status = U_MEMORY_ALLOCATION_ERROR; | | 810 | + return; | | 811 | + } | | 812 | + } | | 813 | + } | 731 | 814 | }; | 732 | 815 |
| | 816 | + | 733 | 817 | U_NAMESPACE_END | 734 | 818 |
| 735 | 819 | #endif /* __cplusplus */ | |
Collapse file Copy file name to clipboardExpand all lines: deps/icu-small/source/common/cstring.h +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 52 | 52 | U_CAPI UBool U_EXPORT2 | 53 | 53 | uprv_isASCIILetter(char c); | 54 | 54 |
| | 55 | +// NOTE: For u_asciiToUpper that takes a UChar, see ustr_imp.h | | 56 | + | 55 | 57 | U_CAPI char U_EXPORT2 | 56 | 58 | uprv_toupper(char c); | 57 | 59 |
| |
Collapse file Copy file name to clipboardExpand all lines: deps/icu-small/source/common/dictbe.cpp +16Lines changed: 16 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 18 | 18 | #include "unicode/uniset.h" | 19 | 19 | #include "unicode/chariter.h" | 20 | 20 | #include "unicode/ubrk.h" | | 21 | +#include "utracimp.h" | 21 | 22 | #include "uvectr32.h" | 22 | 23 | #include "uvector.h" | 23 | 24 | #include "uassert.h" | @@ -194,6 +195,8 @@ ThaiBreakEngine::ThaiBreakEngine(DictionaryMatcher *adoptDictionary, UErrorCode | 194 | 195 | : DictionaryBreakEngine(), | 195 | 196 | fDictionary(adoptDictionary) | 196 | 197 | { | | 198 | + UTRACE_ENTRY(UTRACE_UBRK_CREATE_BREAK_ENGINE); | | 199 | + UTRACE_DATA1(UTRACE_INFO, "dictbe=%s", "Thai"); | 197 | 200 | fThaiWordSet.applyPattern(UNICODE_STRING_SIMPLE("[[:Thai:]&[:LineBreak=SA:]]"), status); | 198 | 201 | if (U_SUCCESS(status)) { | 199 | 202 | setCharacters(fThaiWordSet); | @@ -213,6 +216,7 @@ ThaiBreakEngine::ThaiBreakEngine(DictionaryMatcher *adoptDictionary, UErrorCode | 213 | 216 | fEndWordSet.compact(); | 214 | 217 | fBeginWordSet.compact(); | 215 | 218 | fSuffixSet.compact(); | | 219 | + UTRACE_EXIT_STATUS(status); | 216 | 220 | } | 217 | 221 |
| 218 | 222 | ThaiBreakEngine::~ThaiBreakEngine() { | @@ -436,6 +440,8 @@ LaoBreakEngine::LaoBreakEngine(DictionaryMatcher *adoptDictionary, UErrorCode &s | 436 | 440 | : DictionaryBreakEngine(), | 437 | 441 | fDictionary(adoptDictionary) | 438 | 442 | { | | 443 | + UTRACE_ENTRY(UTRACE_UBRK_CREATE_BREAK_ENGINE); | | 444 | + UTRACE_DATA1(UTRACE_INFO, "dictbe=%s", "Laoo"); | 439 | 445 | fLaoWordSet.applyPattern(UNICODE_STRING_SIMPLE("[[:Laoo:]&[:LineBreak=SA:]]"), status); | 440 | 446 | if (U_SUCCESS(status)) { | 441 | 447 | setCharacters(fLaoWordSet); | @@ -452,6 +458,7 @@ LaoBreakEngine::LaoBreakEngine(DictionaryMatcher *adoptDictionary, UErrorCode &s | 452 | 458 | fMarkSet.compact(); | 453 | 459 | fEndWordSet.compact(); | 454 | 460 | fBeginWordSet.compact(); | | 461 | + UTRACE_EXIT_STATUS(status); | 455 | 462 | } | 456 | 463 |
| 457 | 464 | LaoBreakEngine::~LaoBreakEngine() { | @@ -632,6 +639,8 @@ BurmeseBreakEngine::BurmeseBreakEngine(DictionaryMatcher *adoptDictionary, UErro | 632 | 639 | : DictionaryBreakEngine(), | 633 | 640 | fDictionary(adoptDictionary) | 634 | 641 | { | | 642 | + UTRACE_ENTRY(UTRACE_UBRK_CREATE_BREAK_ENGINE); | | 643 | + UTRACE_DATA1(UTRACE_INFO, "dictbe=%s", "Mymr"); | 635 | 644 | fBurmeseWordSet.applyPattern(UNICODE_STRING_SIMPLE("[[:Mymr:]&[:LineBreak=SA:]]"), status); | 636 | 645 | if (U_SUCCESS(status)) { | 637 | 646 | setCharacters(fBurmeseWordSet); | @@ -645,6 +654,7 @@ BurmeseBreakEngine::BurmeseBreakEngine(DictionaryMatcher *adoptDictionary, UErro | 645 | 654 | fMarkSet.compact(); | 646 | 655 | fEndWordSet.compact(); | 647 | 656 | fBeginWordSet.compact(); | | 657 | + UTRACE_EXIT_STATUS(status); | 648 | 658 | } | 649 | 659 |
| 650 | 660 | BurmeseBreakEngine::~BurmeseBreakEngine() { | @@ -825,6 +835,8 @@ KhmerBreakEngine::KhmerBreakEngine(DictionaryMatcher *adoptDictionary, UErrorCod | 825 | 835 | : DictionaryBreakEngine(), | 826 | 836 | fDictionary(adoptDictionary) | 827 | 837 | { | | 838 | + UTRACE_ENTRY(UTRACE_UBRK_CREATE_BREAK_ENGINE); | | 839 | + UTRACE_DATA1(UTRACE_INFO, "dictbe=%s", "Khmr"); | 828 | 840 | fKhmerWordSet.applyPattern(UNICODE_STRING_SIMPLE("[[:Khmr:]&[:LineBreak=SA:]]"), status); | 829 | 841 | if (U_SUCCESS(status)) { | 830 | 842 | setCharacters(fKhmerWordSet); | @@ -850,6 +862,7 @@ KhmerBreakEngine::KhmerBreakEngine(DictionaryMatcher *adoptDictionary, UErrorCod | 850 | 862 | fEndWordSet.compact(); | 851 | 863 | fBeginWordSet.compact(); | 852 | 864 | // fSuffixSet.compact(); | | 865 | + UTRACE_EXIT_STATUS(status); | 853 | 866 | } | 854 | 867 |
| 855 | 868 | KhmerBreakEngine::~KhmerBreakEngine() { | @@ -1045,6 +1058,8 @@ KhmerBreakEngine::divideUpDictionaryRange( UText *text, | 1045 | 1058 | static const uint32_t kuint32max = 0xFFFFFFFF; | 1046 | 1059 | CjkBreakEngine::CjkBreakEngine(DictionaryMatcher *adoptDictionary, LanguageType type, UErrorCode &status) | 1047 | 1060 | : DictionaryBreakEngine(), fDictionary(adoptDictionary) { | | 1061 | + UTRACE_ENTRY(UTRACE_UBRK_CREATE_BREAK_ENGINE); | | 1062 | + UTRACE_DATA1(UTRACE_INFO, "dictbe=%s", "Hani"); | 1048 | 1063 | // Korean dictionary only includes Hangul syllables | 1049 | 1064 | fHangulWordSet.applyPattern(UNICODE_STRING_SIMPLE("[\\uac00-\\ud7a3]"), status); | 1050 | 1065 | fHanWordSet.applyPattern(UNICODE_STRING_SIMPLE("[:Han:]"), status); | @@ -1066,6 +1081,7 @@ CjkBreakEngine::CjkBreakEngine(DictionaryMatcher *adoptDictionary, LanguageType | 1066 | 1081 | setCharacters(cjSet); | 1067 | 1082 | } | 1068 | 1083 | } | | 1084 | + UTRACE_EXIT_STATUS(status); | 1069 | 1085 | } | 1070 | 1086 |
| 1071 | 1087 | CjkBreakEngine::~CjkBreakEngine(){ | |
|