icu4c ver. bump
This commit is contained in:
@@ -39,6 +39,21 @@ def install():
|
||||
if get.buildTYPE() == "_emul32":
|
||||
pisitools.domove("/_emul32/bin/icu-config", "/usr/bin", "icu-config-32")
|
||||
pisitools.removeDir("/_emul32")
|
||||
|
||||
# pisitools.dosym("/usr/lib/libicudata.so.76.1", "/usr/lib/libicudata.so.73")
|
||||
# pisitools.dosym("/usr/lib/libicui18n.so.76.1", "/usr/lib/libicui18n.so.73")
|
||||
# pisitools.dosym("/usr/lib/libicuio.so.76.1", "/usr/lib/libicuio.so.73")
|
||||
# pisitools.dosym("/usr/lib/libicutest.so.76.1", "/usr/lib/libicutest.so.73")
|
||||
# pisitools.dosym("/usr/lib/libicutu.so.76.1", "/usr/lib/libicutu.so.73")
|
||||
# pisitools.dosym("/usr/lib/libicuuc.so.76.1", "/usr/lib/libicuuc.so.73")
|
||||
|
||||
# pisitools.dosym("/usr/lib32/libicudata.so.76.1", "/usr/lib32/libicudata.so.73")
|
||||
# pisitools.dosym("/usr/lib32/libicui18n.so.76.1", "/usr/lib32/libicui18n.so.73")
|
||||
# pisitools.dosym("/usr/lib32/libicuio.so.76.1", "/usr/lib32/libicuio.so.73")
|
||||
# pisitools.dosym("/usr/lib32/libicutest.so.76.1", "/usr/lib32/libicutest.so.73")
|
||||
# pisitools.dosym("/usr/lib32/libicutu.so.76.1", "/usr/lib32/libicutu.so.73")
|
||||
# pisitools.dosym("/usr/lib32/libicuuc.so.76.1", "/usr/lib32/libicuuc.so.73")
|
||||
|
||||
for f in shelltools.ls("%s/usr/lib32/pkgconfig" % get.installDIR()):
|
||||
pisitools.dosed("%s/usr/lib32/pkgconfig/%s" % (get.installDIR(), f), "_emul32", "usr")
|
||||
pisitools.dosed("%s/usr/lib32/icu/%s/Makefile.inc" % ( get.installDIR(), get.srcVERSION()), "_emul32", "usr")
|
||||
|
||||
+223
@@ -0,0 +1,223 @@
|
||||
From d03826cdeec4ad3fd0667f00a551e6a46272897b Mon Sep 17 00:00:00 2001
|
||||
From: Markus Scherer <markus.icu@gmail.com>
|
||||
Date: Mon, 9 Dec 2024 16:06:39 -0800
|
||||
Subject: [PATCH] ICU-22954 USet C++ iterator return std::u16string
|
||||
|
||||
---
|
||||
icu4c/source/common/unicode/uniset.h | 11 ++++---
|
||||
icu4c/source/common/unicode/uset.h | 44 ++++++++++++++-----------
|
||||
icu4c/source/test/intltest/usettest.cpp | 6 ++--
|
||||
3 files changed, 36 insertions(+), 25 deletions(-)
|
||||
|
||||
diff --git a/icu4c/source/common/unicode/uniset.h b/icu4c/source/common/unicode/uniset.h
|
||||
index d070fd631a2..5b32f3ca5d4 100644
|
||||
--- icu4c/source/common/unicode/uniset.h
|
||||
+++ icu4c/source/common/unicode/uniset.h
|
||||
@@ -1173,10 +1173,12 @@ class U_COMMON_API UnicodeSet final : public UnicodeFilter {
|
||||
inline U_HEADER_NESTED_NAMESPACE::USetStrings strings() const {
|
||||
return U_HEADER_NESTED_NAMESPACE::USetStrings(toUSet());
|
||||
}
|
||||
+#endif // U_HIDE_DRAFT_API
|
||||
|
||||
+#ifndef U_HIDE_DRAFT_API
|
||||
/**
|
||||
* Returns a C++ iterator for iterating over all of the elements of this set.
|
||||
- * Convenient all-in one iteration, but creates a UnicodeString for each
|
||||
+ * Convenient all-in one iteration, but creates a std::u16string for each
|
||||
* code point or string.
|
||||
* (Similar to how Java UnicodeSet *is an* Iterable<String>.)
|
||||
*
|
||||
@@ -1185,13 +1187,14 @@ class U_COMMON_API UnicodeSet final : public UnicodeFilter {
|
||||
* \code
|
||||
* UnicodeSet set(u"[abcçカ🚴{}{abc}{de}]", errorCode);
|
||||
* for (auto el : set) {
|
||||
+ * UnicodeString us(el);
|
||||
* std::string u8;
|
||||
- * printf("set.string length %ld \"%s\"\n", (long)el.length(), el.toUTF8String(u8).c_str());
|
||||
+ * printf("set.string length %ld \"%s\"\n", (long)us.length(), us.toUTF8String(u8).c_str());
|
||||
* }
|
||||
* \endcode
|
||||
*
|
||||
* @return an all-elements iterator.
|
||||
- * @draft ICU 76
|
||||
+ * @draft ICU 77
|
||||
* @see end
|
||||
* @see codePoints
|
||||
* @see ranges
|
||||
@@ -1203,7 +1206,7 @@ class U_COMMON_API UnicodeSet final : public UnicodeFilter {
|
||||
|
||||
/**
|
||||
* @return an exclusive-end sentinel for iterating over all of the elements of this set.
|
||||
- * @draft ICU 76
|
||||
+ * @draft ICU 77
|
||||
* @see begin
|
||||
* @see codePoints
|
||||
* @see ranges
|
||||
diff --git a/icu4c/source/common/unicode/uset.h b/icu4c/source/common/unicode/uset.h
|
||||
index c8f9b5592df..914c4c4e5de 100644
|
||||
--- icu4c/source/common/unicode/uset.h
|
||||
+++ icu4c/source/common/unicode/uset.h
|
||||
@@ -33,10 +33,11 @@
|
||||
#include "unicode/uchar.h"
|
||||
|
||||
#if U_SHOW_CPLUSPLUS_API
|
||||
+#include <string>
|
||||
#include <string_view>
|
||||
#include "unicode/char16ptr.h"
|
||||
#include "unicode/localpointer.h"
|
||||
-#include "unicode/unistr.h"
|
||||
+#include "unicode/utf16.h"
|
||||
#endif // U_SHOW_CPLUSPLUS_API
|
||||
|
||||
#ifndef USET_DEFINED
|
||||
@@ -1737,17 +1738,19 @@ class USetStrings {
|
||||
const USet *uset;
|
||||
int32_t count;
|
||||
};
|
||||
+#endif // U_HIDE_DRAFT_API
|
||||
|
||||
+#ifndef U_HIDE_DRAFT_API
|
||||
/**
|
||||
* Iterator returned by USetElements.
|
||||
- * @draft ICU 76
|
||||
+ * @draft ICU 77
|
||||
*/
|
||||
class USetElementIterator {
|
||||
public:
|
||||
- /** @draft ICU 76 */
|
||||
+ /** @draft ICU 77 */
|
||||
USetElementIterator(const USetElementIterator &other) = default;
|
||||
|
||||
- /** @draft ICU 76 */
|
||||
+ /** @draft ICU 77 */
|
||||
bool operator==(const USetElementIterator &other) const {
|
||||
// No need to compare rangeCount & end given private constructor
|
||||
// and assuming we don't compare iterators across the set being modified.
|
||||
@@ -1756,26 +1759,28 @@ class USetElementIterator {
|
||||
return uset == other.uset && c == other.c && index == other.index;
|
||||
}
|
||||
|
||||
- /** @draft ICU 76 */
|
||||
+ /** @draft ICU 77 */
|
||||
bool operator!=(const USetElementIterator &other) const { return !operator==(other); }
|
||||
|
||||
- /** @draft ICU 76 */
|
||||
- UnicodeString operator*() const {
|
||||
+ /** @draft ICU 77 */
|
||||
+ std::u16string operator*() const {
|
||||
if (c >= 0) {
|
||||
- return UnicodeString(c);
|
||||
+ return c <= 0xffff ?
|
||||
+ std::u16string({static_cast<char16_t>(c)}) :
|
||||
+ std::u16string({U16_LEAD(c), U16_TRAIL(c)});
|
||||
} else if (index < totalCount) {
|
||||
int32_t length;
|
||||
const UChar *uchars = uset_getString(uset, index - rangeCount, &length);
|
||||
// assert uchars != nullptr;
|
||||
- return UnicodeString(uchars, length);
|
||||
+ return {ConstChar16Ptr(uchars), static_cast<uint32_t>(length)};
|
||||
} else {
|
||||
- return UnicodeString();
|
||||
+ return {};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pre-increment.
|
||||
- * @draft ICU 76
|
||||
+ * @draft ICU 77
|
||||
*/
|
||||
USetElementIterator &operator++() {
|
||||
if (c < end) {
|
||||
@@ -1800,7 +1805,7 @@ class USetElementIterator {
|
||||
|
||||
/**
|
||||
* Post-increment.
|
||||
- * @draft ICU 76
|
||||
+ * @draft ICU 77
|
||||
*/
|
||||
USetElementIterator operator++(int) {
|
||||
USetElementIterator result(*this);
|
||||
@@ -1840,7 +1845,7 @@ class USetElementIterator {
|
||||
|
||||
/**
|
||||
* A C++ "range" for iterating over all of the elements of a USet.
|
||||
- * Convenient all-in one iteration, but creates a UnicodeString for each
|
||||
+ * Convenient all-in one iteration, but creates a std::u16string for each
|
||||
* code point or string.
|
||||
*
|
||||
* Code points are returned first, then empty and multi-character strings.
|
||||
@@ -1849,15 +1854,16 @@ class USetElementIterator {
|
||||
* using U_HEADER_NESTED_NAMESPACE::USetElements;
|
||||
* LocalUSetPointer uset(uset_openPattern(u"[abcçカ🚴{}{abc}{de}]", -1, &errorCode));
|
||||
* for (auto el : USetElements(uset.getAlias())) {
|
||||
+ * UnicodeString us(el);
|
||||
* std::string u8;
|
||||
- * printf("uset.string length %ld \"%s\"\n", (long)el.length(), el.toUTF8String(u8).c_str());
|
||||
+ * printf("uset.string length %ld \"%s\"\n", (long)us.length(), us.toUTF8String(u8).c_str());
|
||||
* }
|
||||
* \endcode
|
||||
*
|
||||
* C++ UnicodeSet has member functions for iteration, including begin() and end().
|
||||
*
|
||||
* @return an all-elements iterator.
|
||||
- * @draft ICU 76
|
||||
+ * @draft ICU 77
|
||||
* @see USetCodePoints
|
||||
* @see USetRanges
|
||||
* @see USetStrings
|
||||
@@ -1866,21 +1872,21 @@ class USetElements {
|
||||
public:
|
||||
/**
|
||||
* Constructs a C++ "range" object over all of the elements of the USet.
|
||||
- * @draft ICU 76
|
||||
+ * @draft ICU 77
|
||||
*/
|
||||
USetElements(const USet *uset)
|
||||
: uset(uset), rangeCount(uset_getRangeCount(uset)),
|
||||
stringCount(uset_getStringCount(uset)) {}
|
||||
|
||||
- /** @draft ICU 76 */
|
||||
+ /** @draft ICU 77 */
|
||||
USetElements(const USetElements &other) = default;
|
||||
|
||||
- /** @draft ICU 76 */
|
||||
+ /** @draft ICU 77 */
|
||||
USetElementIterator begin() const {
|
||||
return USetElementIterator(uset, 0, rangeCount, rangeCount + stringCount);
|
||||
}
|
||||
|
||||
- /** @draft ICU 76 */
|
||||
+ /** @draft ICU 77 */
|
||||
USetElementIterator end() const {
|
||||
return USetElementIterator(uset, rangeCount + stringCount, rangeCount, rangeCount + stringCount);
|
||||
}
|
||||
diff --git a/icu4c/source/test/intltest/usettest.cpp b/icu4c/source/test/intltest/usettest.cpp
|
||||
index a53e813ad2f..477639e8659 100644
|
||||
--- icu4c/source/test/intltest/usettest.cpp
|
||||
+++ icu4c/source/test/intltest/usettest.cpp
|
||||
@@ -4448,8 +4448,9 @@ void UnicodeSetTest::TestElementIterator() {
|
||||
UnicodeSet set(u"[abcçカ🚴{}{abc}{de}]", errorCode);
|
||||
UnicodeString result;
|
||||
for (auto el : set) {
|
||||
+ // UnicodeString us(el);
|
||||
// std::string u8;
|
||||
- // printf("set.string length %ld \"%s\"\n", (long)el.length(), el.toUTF8String(u8).c_str());
|
||||
+ // printf("set.string length %ld \"%s\"\n", (long)us.length(), us.toUTF8String(u8).c_str());
|
||||
result.append(u" \"").append(el).append(u'"');
|
||||
}
|
||||
assertEquals(WHERE, uR"( "a" "b" "c" "ç" "カ" "🚴" "" "abc" "de")", result);
|
||||
@@ -4463,8 +4464,9 @@ void UnicodeSetTest::TestUSetElementIterator() {
|
||||
LocalUSetPointer uset(uset_openPattern(u"[abcçカ🚴{}{abc}{de}]", -1, errorCode));
|
||||
UnicodeString result;
|
||||
for (auto el : USetElements(uset.getAlias())) {
|
||||
+ // UnicodeString us(el);
|
||||
// std::string u8;
|
||||
- // printf("uset.string length %ld \"%s\"\n", (long)el.length(), el.toUTF8String(u8).c_str());
|
||||
+ // printf("uset.string length %ld \"%s\"\n", (long)us.length(), us.toUTF8String(u8).c_str());
|
||||
result.append(u" \"").append(el).append(u'"');
|
||||
}
|
||||
assertEquals(WHERE, uR"( "a" "b" "c" "ç" "カ" "🚴" "" "abc" "de")", result);
|
||||
--
|
||||
2.47.1
|
||||
|
||||
+336
@@ -0,0 +1,336 @@
|
||||
From 8655718531e478428151162313f67432ed28cd9d Mon Sep 17 00:00:00 2001
|
||||
From: Markus Scherer <markus.icu@gmail.com>
|
||||
Date: Mon, 9 Dec 2024 18:42:23 -0800
|
||||
Subject: [PATCH] ICU-22954 U_ICU_NAMESPACE_OR_INTERNAL, header-only
|
||||
localpointer header-only parts of char16ptr.h
|
||||
|
||||
---
|
||||
icu4c/source/common/unicode/char16ptr.h | 51 ++++++++++++++++++++--
|
||||
icu4c/source/common/unicode/localpointer.h | 10 ++---
|
||||
icu4c/source/common/unicode/normlzr.h | 4 +-
|
||||
icu4c/source/common/unicode/unistr.h | 8 ++--
|
||||
icu4c/source/common/unicode/uset.h | 14 +++---
|
||||
icu4c/source/common/unicode/uversion.h | 19 +++++++-
|
||||
icu4c/source/i18n/unicode/ucol.h | 4 +-
|
||||
7 files changed, 84 insertions(+), 26 deletions(-)
|
||||
|
||||
diff --git a/icu4c/source/common/unicode/char16ptr.h b/icu4c/source/common/unicode/char16ptr.h
|
||||
index daf35cd43ba..a2722d9f463 100644
|
||||
--- icu4c/source/common/unicode/char16ptr.h
|
||||
+++ icu4c/source/common/unicode/char16ptr.h
|
||||
@@ -9,10 +9,13 @@
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
-#if U_SHOW_CPLUSPLUS_API
|
||||
+#if U_SHOW_CPLUSPLUS_API || U_SHOW_CPLUSPLUS_HEADER_API
|
||||
|
||||
#include <cstddef>
|
||||
#include <string_view>
|
||||
+#include <type_traits>
|
||||
+
|
||||
+#endif
|
||||
|
||||
/**
|
||||
* \file
|
||||
@@ -21,8 +24,6 @@
|
||||
* Also conversion functions from char16_t * to UChar * and OldUChar *.
|
||||
*/
|
||||
|
||||
-U_NAMESPACE_BEGIN
|
||||
-
|
||||
/**
|
||||
* \def U_ALIASING_BARRIER
|
||||
* Barrier for pointer anti-aliasing optimizations even across function boundaries.
|
||||
@@ -36,6 +37,11 @@ U_NAMESPACE_BEGIN
|
||||
# define U_ALIASING_BARRIER(ptr)
|
||||
#endif
|
||||
|
||||
+// ICU DLL-exported
|
||||
+#if U_SHOW_CPLUSPLUS_API
|
||||
+
|
||||
+U_NAMESPACE_BEGIN
|
||||
+
|
||||
/**
|
||||
* char16_t * wrapper with implicit conversion from distinct but bit-compatible pointer types.
|
||||
* @stable ICU 59
|
||||
@@ -251,6 +257,34 @@ const char16_t *ConstChar16Ptr::get() const { return u_.cp; }
|
||||
#endif
|
||||
/// \endcond
|
||||
|
||||
+U_NAMESPACE_END
|
||||
+
|
||||
+#endif // U_SHOW_CPLUSPLUS_API
|
||||
+
|
||||
+// Usable in header-only definitions
|
||||
+#if U_SHOW_CPLUSPLUS_API || U_SHOW_CPLUSPLUS_HEADER_API
|
||||
+
|
||||
+namespace U_ICU_NAMESPACE_OR_INTERNAL {
|
||||
+
|
||||
+#ifndef U_FORCE_HIDE_INTERNAL_API
|
||||
+/** @internal */
|
||||
+template<typename T, typename = std::enable_if_t<std::is_same_v<T, UChar>>>
|
||||
+inline const char16_t *uprv_char16PtrFromUChar(const T *p) {
|
||||
+ if constexpr (std::is_same_v<UChar, char16_t>) {
|
||||
+ return p;
|
||||
+ } else {
|
||||
+#if U_SHOW_CPLUSPLUS_API
|
||||
+ return ConstChar16Ptr(p).get();
|
||||
+#else
|
||||
+#ifdef U_ALIASING_BARRIER
|
||||
+ U_ALIASING_BARRIER(p);
|
||||
+#endif
|
||||
+ return reinterpret_cast<const char16_t *>(p);
|
||||
+#endif
|
||||
+ }
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
/**
|
||||
* Converts from const char16_t * to const UChar *.
|
||||
* Includes an aliasing barrier if available.
|
||||
@@ -307,6 +341,15 @@ inline OldUChar *toOldUCharPtr(char16_t *p) {
|
||||
return reinterpret_cast<OldUChar *>(p);
|
||||
}
|
||||
|
||||
+} // U_ICU_NAMESPACE_OR_INTERNAL
|
||||
+
|
||||
+#endif // U_SHOW_CPLUSPLUS_API || U_SHOW_CPLUSPLUS_HEADER_API
|
||||
+
|
||||
+// ICU DLL-exported
|
||||
+#if U_SHOW_CPLUSPLUS_API
|
||||
+
|
||||
+U_NAMESPACE_BEGIN
|
||||
+
|
||||
#ifndef U_FORCE_HIDE_INTERNAL_API
|
||||
/**
|
||||
* Is T convertible to a std::u16string_view or some other 16-bit string view?
|
||||
@@ -379,6 +422,6 @@ inline std::u16string_view toU16StringViewNullable(const T& text) {
|
||||
|
||||
U_NAMESPACE_END
|
||||
|
||||
-#endif /* U_SHOW_CPLUSPLUS_API */
|
||||
+#endif // U_SHOW_CPLUSPLUS_API
|
||||
|
||||
#endif // __CHAR16PTR_H__
|
||||
diff --git a/icu4c/source/common/unicode/localpointer.h b/icu4c/source/common/unicode/localpointer.h
|
||||
index 9c891bf3088..487ddb48b78 100644
|
||||
--- icu4c/source/common/unicode/localpointer.h
|
||||
+++ icu4c/source/common/unicode/localpointer.h
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
/**
|
||||
* \file
|
||||
- * \brief C++ API: "Smart pointers" for use with and in ICU4C C++ code.
|
||||
+ * \brief C++ header-only API: "Smart pointers" for use with and in ICU4C C++ code.
|
||||
*
|
||||
* These classes are inspired by
|
||||
* - std::auto_ptr
|
||||
@@ -40,11 +40,11 @@
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
-#if U_SHOW_CPLUSPLUS_API
|
||||
+#if U_SHOW_CPLUSPLUS_API || U_SHOW_CPLUSPLUS_HEADER_API
|
||||
|
||||
#include <memory>
|
||||
|
||||
-U_NAMESPACE_BEGIN
|
||||
+namespace U_ICU_NAMESPACE_OR_INTERNAL {
|
||||
|
||||
/**
|
||||
* "Smart pointer" base class; do not use directly: use LocalPointer etc.
|
||||
@@ -603,7 +603,7 @@ class LocalOpenPointer : public LocalPointerBase<Type> {
|
||||
} // namespace internal
|
||||
#endif
|
||||
|
||||
-U_NAMESPACE_END
|
||||
+} // U_ICU_NAMESPACE_OR_INTERNAL
|
||||
|
||||
-#endif /* U_SHOW_CPLUSPLUS_API */
|
||||
+#endif // U_SHOW_CPLUSPLUS_API || U_SHOW_CPLUSPLUS_HEADER_API
|
||||
#endif /* __LOCALPOINTER_H__ */
|
||||
diff --git a/icu4c/source/common/unicode/normlzr.h b/icu4c/source/common/unicode/normlzr.h
|
||||
index 0309bce5382..40848bf00ca 100644
|
||||
--- icu4c/source/common/unicode/normlzr.h
|
||||
+++ icu4c/source/common/unicode/normlzr.h
|
||||
@@ -801,8 +801,8 @@ Normalizer::compare(const UnicodeString &s1, const UnicodeString &s2,
|
||||
uint32_t options,
|
||||
UErrorCode &errorCode) {
|
||||
// all argument checking is done in unorm_compare
|
||||
- return unorm_compare(toUCharPtr(s1.getBuffer()), s1.length(),
|
||||
- toUCharPtr(s2.getBuffer()), s2.length(),
|
||||
+ return unorm_compare(U_ICU_NAMESPACE_OR_INTERNAL::toUCharPtr(s1.getBuffer()), s1.length(),
|
||||
+ U_ICU_NAMESPACE_OR_INTERNAL::toUCharPtr(s2.getBuffer()), s2.length(),
|
||||
options,
|
||||
&errorCode);
|
||||
}
|
||||
diff --git a/icu4c/source/common/unicode/unistr.h b/icu4c/source/common/unicode/unistr.h
|
||||
index 39d789fd6ef..a1901c91504 100644
|
||||
--- icu4c/source/common/unicode/unistr.h
|
||||
+++ icu4c/source/common/unicode/unistr.h
|
||||
@@ -4676,7 +4676,7 @@ UnicodeString::startsWith(const UnicodeString& srcText,
|
||||
inline UBool
|
||||
UnicodeString::startsWith(ConstChar16Ptr srcChars, int32_t srcLength) const {
|
||||
if(srcLength < 0) {
|
||||
- srcLength = u_strlen(toUCharPtr(srcChars));
|
||||
+ srcLength = u_strlen(U_ICU_NAMESPACE_OR_INTERNAL::toUCharPtr(srcChars));
|
||||
}
|
||||
return doEqualsSubstring(0, srcLength, srcChars, 0, srcLength);
|
||||
}
|
||||
@@ -4684,7 +4684,7 @@ UnicodeString::startsWith(ConstChar16Ptr srcChars, int32_t srcLength) const {
|
||||
inline UBool
|
||||
UnicodeString::startsWith(const char16_t *srcChars, int32_t srcStart, int32_t srcLength) const {
|
||||
if(srcLength < 0) {
|
||||
- srcLength = u_strlen(toUCharPtr(srcChars));
|
||||
+ srcLength = u_strlen(U_ICU_NAMESPACE_OR_INTERNAL::toUCharPtr(srcChars));
|
||||
}
|
||||
return doEqualsSubstring(0, srcLength, srcChars, srcStart, srcLength);
|
||||
}
|
||||
@@ -4707,7 +4707,7 @@ inline UBool
|
||||
UnicodeString::endsWith(ConstChar16Ptr srcChars,
|
||||
int32_t srcLength) const {
|
||||
if(srcLength < 0) {
|
||||
- srcLength = u_strlen(toUCharPtr(srcChars));
|
||||
+ srcLength = u_strlen(U_ICU_NAMESPACE_OR_INTERNAL::toUCharPtr(srcChars));
|
||||
}
|
||||
return doEqualsSubstring(length() - srcLength, srcLength, srcChars, 0, srcLength);
|
||||
}
|
||||
@@ -4717,7 +4717,7 @@ UnicodeString::endsWith(const char16_t *srcChars,
|
||||
int32_t srcStart,
|
||||
int32_t srcLength) const {
|
||||
if(srcLength < 0) {
|
||||
- srcLength = u_strlen(toUCharPtr(srcChars + srcStart));
|
||||
+ srcLength = u_strlen(U_ICU_NAMESPACE_OR_INTERNAL::toUCharPtr(srcChars + srcStart));
|
||||
}
|
||||
return doEqualsSubstring(length() - srcLength, srcLength,
|
||||
srcChars, srcStart, srcLength);
|
||||
diff --git a/icu4c/source/common/unicode/uset.h b/icu4c/source/common/unicode/uset.h
|
||||
index 914c4c4e5de..345d6244544 100644
|
||||
--- icu4c/source/common/unicode/uset.h
|
||||
+++ icu4c/source/common/unicode/uset.h
|
||||
@@ -32,13 +32,13 @@
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/uchar.h"
|
||||
|
||||
-#if U_SHOW_CPLUSPLUS_API
|
||||
+#if U_SHOW_CPLUSPLUS_API || U_SHOW_CPLUSPLUS_HEADER_API
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include "unicode/char16ptr.h"
|
||||
#include "unicode/localpointer.h"
|
||||
#include "unicode/utf16.h"
|
||||
-#endif // U_SHOW_CPLUSPLUS_API
|
||||
+#endif
|
||||
|
||||
#ifndef USET_DEFINED
|
||||
|
||||
@@ -346,9 +346,9 @@ uset_openPatternOptions(const UChar* pattern, int32_t patternLength,
|
||||
U_CAPI void U_EXPORT2
|
||||
uset_close(USet* set);
|
||||
|
||||
-#if U_SHOW_CPLUSPLUS_API
|
||||
+#if U_SHOW_CPLUSPLUS_API || U_SHOW_CPLUSPLUS_HEADER_API
|
||||
|
||||
-U_NAMESPACE_BEGIN
|
||||
+namespace U_ICU_NAMESPACE_OR_INTERNAL {
|
||||
|
||||
/**
|
||||
* \class LocalUSetPointer
|
||||
@@ -361,7 +361,7 @@ U_NAMESPACE_BEGIN
|
||||
*/
|
||||
U_DEFINE_LOCAL_OPEN_POINTER(LocalUSetPointer, USet, uset_close);
|
||||
|
||||
-U_NAMESPACE_END
|
||||
+} // U_ICU_NAMESPACE_OR_INTERNAL
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1658,7 +1658,7 @@ class USetStringIterator {
|
||||
int32_t length;
|
||||
const UChar *uchars = uset_getString(uset, index, &length);
|
||||
// assert uchars != nullptr;
|
||||
- return {ConstChar16Ptr(uchars), static_cast<uint32_t>(length)};
|
||||
+ return {uprv_char16PtrFromUChar(uchars), static_cast<size_t>(length)};
|
||||
}
|
||||
return {};
|
||||
}
|
||||
@@ -1772,7 +1772,7 @@ class USetElementIterator {
|
||||
int32_t length;
|
||||
const UChar *uchars = uset_getString(uset, index - rangeCount, &length);
|
||||
// assert uchars != nullptr;
|
||||
- return {ConstChar16Ptr(uchars), static_cast<uint32_t>(length)};
|
||||
+ return {uprv_char16PtrFromUChar(uchars), static_cast<size_t>(length)};
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
diff --git a/icu4c/source/common/unicode/uversion.h b/icu4c/source/common/unicode/uversion.h
|
||||
index 25d73a3aeb5..a29bf21efda 100644
|
||||
--- icu4c/source/common/unicode/uversion.h
|
||||
+++ icu4c/source/common/unicode/uversion.h
|
||||
@@ -125,7 +125,7 @@ typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH];
|
||||
U_NAMESPACE_USE
|
||||
# endif
|
||||
|
||||
-#ifndef U_HIDE_DRAFT_API
|
||||
+#ifndef U_FORCE_HIDE_DRAFT_API
|
||||
/**
|
||||
* \def U_HEADER_NESTED_NAMESPACE
|
||||
* Nested namespace used inside U_ICU_NAMESPACE for header-only APIs.
|
||||
@@ -150,22 +150,37 @@ typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH];
|
||||
* @draft ICU 76
|
||||
*/
|
||||
|
||||
+/**
|
||||
+ * \def U_ICU_NAMESPACE_OR_INTERNAL
|
||||
+ * Namespace used for header-only APIs that used to be regular C++ APIs.
|
||||
+ * Different when used inside ICU to prevent public use of internal instantiations.
|
||||
+ * Similar to U_HEADER_ONLY_NAMESPACE, but the public definition is the same as U_ICU_NAMESPACE.
|
||||
+ * "U_ICU_NAMESPACE" or "U_ICU_NAMESPACE::internal".
|
||||
+ *
|
||||
+ * @draft ICU 77
|
||||
+ */
|
||||
+
|
||||
// The first test is the same as for defining U_EXPORT for Windows.
|
||||
#if defined(_MSC_VER) || (UPRV_HAS_DECLSPEC_ATTRIBUTE(__dllexport__) && \
|
||||
UPRV_HAS_DECLSPEC_ATTRIBUTE(__dllimport__))
|
||||
# define U_HEADER_NESTED_NAMESPACE header
|
||||
+# define U_ICU_NAMESPACE_OR_INTERNAL U_ICU_NAMESPACE
|
||||
#elif defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || \
|
||||
defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION) || \
|
||||
defined(U_LAYOUTEX_IMPLEMENTATION) || defined(U_TOOLUTIL_IMPLEMENTATION)
|
||||
# define U_HEADER_NESTED_NAMESPACE internal
|
||||
+# define U_ICU_NAMESPACE_OR_INTERNAL U_ICU_NAMESPACE::internal
|
||||
+ namespace U_ICU_NAMESPACE_OR_INTERNAL {}
|
||||
+ using namespace U_ICU_NAMESPACE_OR_INTERNAL;
|
||||
#else
|
||||
# define U_HEADER_NESTED_NAMESPACE header
|
||||
+# define U_ICU_NAMESPACE_OR_INTERNAL U_ICU_NAMESPACE
|
||||
#endif
|
||||
|
||||
#define U_HEADER_ONLY_NAMESPACE U_ICU_NAMESPACE::U_HEADER_NESTED_NAMESPACE
|
||||
|
||||
namespace U_HEADER_ONLY_NAMESPACE {}
|
||||
-#endif // U_HIDE_DRAFT_API
|
||||
+#endif // U_FORCE_HIDE_DRAFT_API
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
diff --git a/icu4c/source/i18n/unicode/ucol.h b/icu4c/source/i18n/unicode/ucol.h
|
||||
index ae4f29c3c6c..8b6dfeaa0a8 100644
|
||||
--- icu4c/source/i18n/unicode/ucol.h
|
||||
+++ icu4c/source/i18n/unicode/ucol.h
|
||||
@@ -1572,8 +1572,8 @@ class Predicate {
|
||||
return compare(
|
||||
ucol_strcoll(
|
||||
collator,
|
||||
- toUCharPtr(lhs.getBuffer()), lhs.length(),
|
||||
- toUCharPtr(rhs.getBuffer()), rhs.length()),
|
||||
+ U_ICU_NAMESPACE_OR_INTERNAL::toUCharPtr(lhs.getBuffer()), lhs.length(),
|
||||
+ U_ICU_NAMESPACE_OR_INTERNAL::toUCharPtr(rhs.getBuffer()), rhs.length()),
|
||||
result);
|
||||
}
|
||||
|
||||
--
|
||||
2.47.1
|
||||
|
||||
+1076
File diff suppressed because it is too large
Load Diff
+546
@@ -0,0 +1,546 @@
|
||||
From e3bc073737b226f8bd47302f32f83a3993f7792a Mon Sep 17 00:00:00 2001
|
||||
From: Markus Scherer <markus.icu@gmail.com>
|
||||
Date: Thu, 12 Dec 2024 16:32:34 -0800
|
||||
Subject: [PATCH] ICU-22954 header-only-test USet C++ iterators
|
||||
|
||||
---
|
||||
icu4c/source/test/intltest/Makefile.in | 2 +-
|
||||
icu4c/source/test/intltest/intltest.vcxproj | 1 +
|
||||
.../test/intltest/intltest.vcxproj.filters | 15 +-
|
||||
icu4c/source/test/intltest/itutil.cpp | 2 +
|
||||
.../test/intltest/usetheaderonlytest.cpp | 219 ++++++++++++++++++
|
||||
icu4c/source/test/intltest/usettest.cpp | 173 +-------------
|
||||
icu4c/source/test/intltest/usettest.h | 4 -
|
||||
7 files changed, 243 insertions(+), 173 deletions(-)
|
||||
create mode 100644 icu4c/source/test/intltest/usetheaderonlytest.cpp
|
||||
|
||||
diff --git a/icu4c/source/test/intltest/Makefile.in b/icu4c/source/test/intltest/Makefile.in
|
||||
index 66956355c84..81ad5557807 100644
|
||||
--- icu4c/source/test/intltest/Makefile.in
|
||||
+++ icu4c/source/test/intltest/Makefile.in
|
||||
@@ -75,7 +75,7 @@ numbertest_parse.o numbertest_doubleconversion.o numbertest_skeletons.o \
|
||||
static_unisets_test.o numfmtdatadriventest.o numbertest_range.o erarulestest.o \
|
||||
formattedvaluetest.o formatted_string_builder_test.o numbertest_permutation.o \
|
||||
units_data_test.o units_router_test.o units_test.o displayoptions_test.o \
|
||||
-numbertest_simple.o uchar_type_build_test.o
|
||||
+numbertest_simple.o uchar_type_build_test.o usetheaderonlytest.o
|
||||
|
||||
DEPS = $(OBJECTS:.o=.d)
|
||||
|
||||
diff --git a/icu4c/source/test/intltest/intltest.vcxproj b/icu4c/source/test/intltest/intltest.vcxproj
|
||||
index 9e6480aa4e1..b58b29b3d4e 100644
|
||||
--- icu4c/source/test/intltest/intltest.vcxproj
|
||||
+++ icu4c/source/test/intltest/intltest.vcxproj
|
||||
@@ -242,6 +242,7 @@
|
||||
<ClCompile Include="units_router_test.cpp" />
|
||||
<ClCompile Include="units_test.cpp" />
|
||||
<ClCompile Include="uchar_type_build_test.cpp" />
|
||||
+ <ClCompile Include="usetheaderonlytest.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="colldata.h" />
|
||||
diff --git a/icu4c/source/test/intltest/intltest.vcxproj.filters b/icu4c/source/test/intltest/intltest.vcxproj.filters
|
||||
index f3dca92d191..d5c23d5e4cb 100644
|
||||
--- icu4c/source/test/intltest/intltest.vcxproj.filters
|
||||
+++ icu4c/source/test/intltest/intltest.vcxproj.filters
|
||||
@@ -571,9 +571,18 @@
|
||||
<ClCompile Include="uchar_type_build_test.cpp">
|
||||
<Filter>configuration</Filter>
|
||||
</ClCompile>
|
||||
- <ClCompile Include="messageformat2test.cpp" />
|
||||
- <ClCompile Include="messageformat2test_custom.cpp" />
|
||||
- <ClCompile Include="messageformat2test_read_json.cpp" />
|
||||
+ <ClCompile Include="messageformat2test.cpp">
|
||||
+ <Filter>formatting</Filter>
|
||||
+ </ClCompile>
|
||||
+ <ClCompile Include="messageformat2test_custom.cpp">
|
||||
+ <Filter>formatting</Filter>
|
||||
+ </ClCompile>
|
||||
+ <ClCompile Include="messageformat2test_read_json.cpp">
|
||||
+ <Filter>formatting</Filter>
|
||||
+ </ClCompile>
|
||||
+ <ClCompile Include="usetheaderonlytest.cpp">
|
||||
+ <Filter>misc</Filter>
|
||||
+ </ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="itrbbi.h">
|
||||
diff --git a/icu4c/source/test/intltest/itutil.cpp b/icu4c/source/test/intltest/itutil.cpp
|
||||
index ec69e20bed0..4585792126d 100644
|
||||
--- icu4c/source/test/intltest/itutil.cpp
|
||||
+++ icu4c/source/test/intltest/itutil.cpp
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "usettest.h"
|
||||
|
||||
extern IntlTest *createBytesTrieTest();
|
||||
+extern IntlTest *createUSetHeaderOnlyTest();
|
||||
extern IntlTest *createLocaleMatcherTest();
|
||||
static IntlTest *createLocalPointerTest();
|
||||
extern IntlTest *createUCharsTrieTest();
|
||||
@@ -82,6 +83,7 @@ void IntlTestUtilities::runIndexedTest( int32_t index, UBool exec, const char* &
|
||||
TESTCASE_AUTO_CLASS(LocaleBuilderTest);
|
||||
TESTCASE_AUTO_CREATE_CLASS(LocaleMatcherTest);
|
||||
TESTCASE_AUTO_CREATE_CLASS(UHashTest);
|
||||
+ TESTCASE_AUTO_CREATE_CLASS(USetHeaderOnlyTest);
|
||||
TESTCASE_AUTO_END;
|
||||
}
|
||||
|
||||
diff --git a/icu4c/source/test/intltest/usetheaderonlytest.cpp b/icu4c/source/test/intltest/usetheaderonlytest.cpp
|
||||
new file mode 100644
|
||||
index 00000000000..38bc175c174
|
||||
--- /dev/null
|
||||
+++ icu4c/source/test/intltest/usetheaderonlytest.cpp
|
||||
@@ -0,0 +1,219 @@
|
||||
+// © 2024 and later: Unicode, Inc. and others.
|
||||
+// License & terms of use: http://www.unicode.org/copyright.html
|
||||
+
|
||||
+// usetheaderonlytest.cpp
|
||||
+// created: 2024dec11 Markus W. Scherer
|
||||
+
|
||||
+#include <string>
|
||||
+
|
||||
+// Test header-only ICU C++ APIs. Do not use other ICU C++ APIs.
|
||||
+// Non-default configuration:
|
||||
+#define U_SHOW_CPLUSPLUS_API 0
|
||||
+// Default configuration:
|
||||
+// #define U_SHOW_CPLUSPLUS_HEADER_API 1
|
||||
+
|
||||
+#include "unicode/utypes.h"
|
||||
+#include "unicode/uset.h"
|
||||
+#include "unicode/utf.h"
|
||||
+#include "unicode/utf16.h"
|
||||
+#include "intltest.h"
|
||||
+
|
||||
+class USetHeaderOnlyTest : public IntlTest {
|
||||
+public:
|
||||
+ USetHeaderOnlyTest() = default;
|
||||
+
|
||||
+ void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par=nullptr) override;
|
||||
+
|
||||
+ void TestUSetCodePointIterator();
|
||||
+ void TestUSetRangeIterator();
|
||||
+ void TestUSetStringIterator();
|
||||
+ void TestUSetElementIterator();
|
||||
+};
|
||||
+
|
||||
+extern IntlTest *createUSetHeaderOnlyTest() {
|
||||
+ return new USetHeaderOnlyTest();
|
||||
+}
|
||||
+
|
||||
+void USetHeaderOnlyTest::runIndexedTest(int32_t index, UBool exec, const char *&name, char * /*par*/) {
|
||||
+ if(exec) {
|
||||
+ logln("TestSuite USetHeaderOnlyTest: ");
|
||||
+ }
|
||||
+ TESTCASE_AUTO_BEGIN;
|
||||
+ TESTCASE_AUTO(TestUSetCodePointIterator);
|
||||
+ TESTCASE_AUTO(TestUSetRangeIterator);
|
||||
+ TESTCASE_AUTO(TestUSetStringIterator);
|
||||
+ TESTCASE_AUTO(TestUSetElementIterator);
|
||||
+ TESTCASE_AUTO_END;
|
||||
+}
|
||||
+
|
||||
+std::u16string cpString(UChar32 c) {
|
||||
+ if (U_IS_BMP(c)) {
|
||||
+ return {static_cast<char16_t>(c)};
|
||||
+ } else {
|
||||
+ return {U16_LEAD(c), U16_TRAIL(c)};
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void USetHeaderOnlyTest::TestUSetCodePointIterator() {
|
||||
+ IcuTestErrorCode errorCode(*this, "TestUSetCodePointIterator");
|
||||
+ using U_HEADER_NESTED_NAMESPACE::USetCodePoints;
|
||||
+ LocalUSetPointer uset(uset_openPattern(u"[abcçカ🚴]", -1, errorCode));
|
||||
+ std::u16string result;
|
||||
+ for (UChar32 c : USetCodePoints(uset.getAlias())) {
|
||||
+ // Commented-out sample code for pasting into the API docs.
|
||||
+ // printf("uset.codePoint U+%04lx\n", (long)c);
|
||||
+ result.append(u" ").append(cpString(c));
|
||||
+ }
|
||||
+ assertEquals(WHERE, u" a b c ç カ 🚴", result);
|
||||
+
|
||||
+ USetCodePoints range1(uset.getAlias());
|
||||
+ auto range2(range1); // copy constructor
|
||||
+ auto iter = range1.begin();
|
||||
+ auto limit = range2.end();
|
||||
+ // operator* with pre- and post-increment
|
||||
+ assertEquals(WHERE, u'a', *iter);
|
||||
+ ++iter;
|
||||
+ assertEquals(WHERE, u'b', *iter);
|
||||
+ assertEquals(WHERE, u'c', *++iter);
|
||||
+ auto iter2(iter); // copy constructor
|
||||
+ assertEquals(WHERE, u'c', *iter2++);
|
||||
+ assertEquals(WHERE, u'ç', *iter2++);
|
||||
+ assertEquals(WHERE, u'カ', *iter2);
|
||||
+ assertTrue(WHERE, ++iter2 != limit);
|
||||
+ auto iter3(iter2++);
|
||||
+ assertEquals(WHERE, U'🚴', *iter3);
|
||||
+ assertTrue(WHERE, iter2 == limit);
|
||||
+}
|
||||
+
|
||||
+void USetHeaderOnlyTest::TestUSetRangeIterator() {
|
||||
+ IcuTestErrorCode errorCode(*this, "TestUSetRangeIterator");
|
||||
+ using U_HEADER_NESTED_NAMESPACE::USetRanges;
|
||||
+ using U_HEADER_NESTED_NAMESPACE::CodePointRange;
|
||||
+ LocalUSetPointer uset(uset_openPattern(u"[abcçカ🚴]", -1, errorCode));
|
||||
+ std::u16string result;
|
||||
+ for (auto [start, end] : USetRanges(uset.getAlias())) {
|
||||
+ // Commented-out sample code for pasting into the API docs.
|
||||
+ // printf("uset.range U+%04lx..U+%04lx\n", (long)start, (long)end);
|
||||
+ result.append(u" ").append(cpString(start)).append(u"-").append(cpString(end));
|
||||
+ }
|
||||
+ assertEquals(WHERE, u" a-c ç-ç カ-カ 🚴-🚴", result);
|
||||
+ result.clear();
|
||||
+ for (auto range : USetRanges(uset.getAlias())) {
|
||||
+ for (UChar32 c : range) {
|
||||
+ // Commented-out sample code for pasting into the API docs.
|
||||
+ // printf("uset.range.c U+%04lx\n", (long)c);
|
||||
+ result.append(u" ").append(cpString(c));
|
||||
+ }
|
||||
+ result.append(u" |");
|
||||
+ }
|
||||
+ assertEquals(WHERE, u" a b c | ç | カ | 🚴 |", result);
|
||||
+
|
||||
+ USetRanges range1(uset.getAlias());
|
||||
+ auto range2(range1); // copy constructor
|
||||
+ auto iter = range1.begin();
|
||||
+ auto limit = range2.end();
|
||||
+ // operator* with pre- and post-increment
|
||||
+ {
|
||||
+ auto cpRange = *iter;
|
||||
+ assertEquals(WHERE, u'a', cpRange.rangeStart);
|
||||
+ assertEquals(WHERE, u'c', cpRange.rangeEnd);
|
||||
+ assertEquals(WHERE, 3, cpRange.size());
|
||||
+ auto cpRange2(cpRange);
|
||||
+ auto cpIter = cpRange.begin();
|
||||
+ auto cpLimit = cpRange2.end();
|
||||
+ assertEquals(WHERE, u'a', *cpIter++);
|
||||
+ assertEquals(WHERE, u'b', *cpIter);
|
||||
+ assertTrue(WHERE, cpIter != cpLimit);
|
||||
+ CodePointRange::iterator cpIter2(u'b'); // public constructor
|
||||
+ assertTrue(WHERE, cpIter == cpIter2);
|
||||
+ assertEquals(WHERE, u'c', *++cpIter);
|
||||
+ assertTrue(WHERE, cpIter != cpIter2);
|
||||
+ assertTrue(WHERE, ++cpIter == cpLimit);
|
||||
+ }
|
||||
+ ++iter;
|
||||
+ auto iter2(iter); // copy constructor
|
||||
+ assertEquals(WHERE, u'ç', (*iter2).rangeStart);
|
||||
+ assertEquals(WHERE, u'ç', (*iter2).rangeEnd);
|
||||
+ assertEquals(WHERE, 1, (*iter2).size());
|
||||
+ assertEquals(WHERE, u'ç', (*iter2++).rangeStart);
|
||||
+ assertEquals(WHERE, u'カ', (*iter2).rangeStart);
|
||||
+ assertTrue(WHERE, ++iter2 != limit);
|
||||
+ auto iter3(iter2++);
|
||||
+ assertEquals(WHERE, U'🚴', (*iter3).rangeStart);
|
||||
+ assertTrue(WHERE, iter2 == limit);
|
||||
+
|
||||
+ {
|
||||
+ CodePointRange cpRange(u'h', u'k'); // public constructor
|
||||
+ // FYI: currently no operator==
|
||||
+ assertEquals(WHERE, u'h', cpRange.rangeStart);
|
||||
+ assertEquals(WHERE, u'k', cpRange.rangeEnd);
|
||||
+ assertEquals(WHERE, 4, cpRange.size());
|
||||
+ assertEquals(WHERE, u'i', *++(cpRange.begin()));
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void USetHeaderOnlyTest::TestUSetStringIterator() {
|
||||
+ IcuTestErrorCode errorCode(*this, "TestUSetStringIterator");
|
||||
+ using U_HEADER_NESTED_NAMESPACE::USetStrings;
|
||||
+ LocalUSetPointer uset(uset_openPattern(u"[abcçカ🚴{}{abc}{de}]", -1, errorCode));
|
||||
+ std::u16string result;
|
||||
+ for (auto s : USetStrings(uset.getAlias())) {
|
||||
+ // Commented-out sample code for pasting into the API docs.
|
||||
+ // Needs U_SHOW_CPLUSPLUS_API=1 for UnicodeString.
|
||||
+ // UnicodeString us(s);
|
||||
+ // std::string u8;
|
||||
+ // printf("uset.string length %ld \"%s\"\n", (long)s.length(), us.toUTF8String(u8).c_str());
|
||||
+ result.append(u" \"").append(s).append(u"\"");
|
||||
+ }
|
||||
+ assertEquals(WHERE, uR"( "" "abc" "de")", result);
|
||||
+
|
||||
+ USetStrings range1(uset.getAlias());
|
||||
+ auto range2(range1); // copy constructor
|
||||
+ auto iter = range1.begin();
|
||||
+ auto limit = range2.end();
|
||||
+ // operator* with pre- and post-increment
|
||||
+ assertEquals(WHERE, u"", *iter);
|
||||
+ assertEquals(WHERE, u"abc", *++iter);
|
||||
+ auto iter2(iter); // copy constructor
|
||||
+ assertEquals(WHERE, u"abc", *iter2++);
|
||||
+ assertTrue(WHERE, iter2 != limit);
|
||||
+ auto iter3(iter2++);
|
||||
+ assertEquals(WHERE, u"de", *iter3);
|
||||
+ assertTrue(WHERE, iter2 == limit);
|
||||
+}
|
||||
+
|
||||
+void USetHeaderOnlyTest::TestUSetElementIterator() {
|
||||
+ IcuTestErrorCode errorCode(*this, "TestUSetElementIterator");
|
||||
+ using U_HEADER_NESTED_NAMESPACE::USetElements;
|
||||
+ LocalUSetPointer uset(uset_openPattern(u"[abcçカ🚴{}{abc}{de}]", -1, errorCode));
|
||||
+ std::u16string result;
|
||||
+ for (auto el : USetElements(uset.getAlias())) {
|
||||
+ // Commented-out sample code for pasting into the API docs.
|
||||
+ // Needs U_SHOW_CPLUSPLUS_API=1 for UnicodeString.
|
||||
+ // UnicodeString us(el);
|
||||
+ // std::string u8;
|
||||
+ // printf("uset.string length %ld \"%s\"\n", (long)us.length(), us.toUTF8String(u8).c_str());
|
||||
+ result.append(u" \"").append(el).append(u"\"");
|
||||
+ }
|
||||
+ assertEquals(WHERE, uR"( "a" "b" "c" "ç" "カ" "🚴" "" "abc" "de")", result);
|
||||
+
|
||||
+ USetElements range1(uset.getAlias());
|
||||
+ auto range2(range1); // copy constructor
|
||||
+ auto iter = range1.begin();
|
||||
+ auto limit = range2.end();
|
||||
+ // operator* with pre- and post-increment
|
||||
+ assertEquals(WHERE, u"a", *iter);
|
||||
+ ++iter;
|
||||
+ assertEquals(WHERE, u"b", *iter);
|
||||
+ assertEquals(WHERE, u"c", *++iter);
|
||||
+ auto iter2(iter); // copy constructor
|
||||
+ assertEquals(WHERE, u"c", *iter2++);
|
||||
+ // skip çカ🚴
|
||||
+ ++++++iter2;
|
||||
+ assertEquals(WHERE, u"", *iter2++);
|
||||
+ assertEquals(WHERE, u"abc", *iter2);
|
||||
+ assertTrue(WHERE, ++iter2 != limit);
|
||||
+ auto iter3(iter2++);
|
||||
+ assertEquals(WHERE, u"de", *iter3);
|
||||
+ assertTrue(WHERE, iter2 == limit);
|
||||
+}
|
||||
diff --git a/icu4c/source/test/intltest/usettest.cpp b/icu4c/source/test/intltest/usettest.cpp
|
||||
index 477639e8659..9da0612b148 100644
|
||||
--- icu4c/source/test/intltest/usettest.cpp
|
||||
+++ icu4c/source/test/intltest/usettest.cpp
|
||||
@@ -107,13 +107,9 @@ UnicodeSetTest::runIndexedTest(int32_t index, UBool exec,
|
||||
TESTCASE_AUTO(TestSkipToStrings);
|
||||
TESTCASE_AUTO(TestPatternCodePointComplement);
|
||||
TESTCASE_AUTO(TestCodePointIterator);
|
||||
- TESTCASE_AUTO(TestUSetCodePointIterator);
|
||||
TESTCASE_AUTO(TestRangeIterator);
|
||||
- TESTCASE_AUTO(TestUSetRangeIterator);
|
||||
TESTCASE_AUTO(TestStringIterator);
|
||||
- TESTCASE_AUTO(TestUSetStringIterator);
|
||||
TESTCASE_AUTO(TestElementIterator);
|
||||
- TESTCASE_AUTO(TestUSetElementIterator);
|
||||
TESTCASE_AUTO_END;
|
||||
}
|
||||
|
||||
@@ -4280,37 +4276,8 @@ void UnicodeSetTest::TestCodePointIterator() {
|
||||
}
|
||||
assertEquals(WHERE, u" a b c ç カ 🚴", result);
|
||||
|
||||
- // codePoints() returns USetCodePoints for which explicit APIs are tested via USet.
|
||||
-}
|
||||
-
|
||||
-void UnicodeSetTest::TestUSetCodePointIterator() {
|
||||
- IcuTestErrorCode errorCode(*this, "TestUSetCodePointIterator");
|
||||
- using U_HEADER_NESTED_NAMESPACE::USetCodePoints;
|
||||
- LocalUSetPointer uset(uset_openPattern(u"[abcçカ🚴]", -1, errorCode));
|
||||
- UnicodeString result;
|
||||
- for (UChar32 c : USetCodePoints(uset.getAlias())) {
|
||||
- // printf("uset.codePoint U+%04lx\n", (long)c);
|
||||
- result.append(u' ').append(c);
|
||||
- }
|
||||
- assertEquals(WHERE, u" a b c ç カ 🚴", result);
|
||||
-
|
||||
- USetCodePoints range1(uset.getAlias());
|
||||
- auto range2(range1); // copy constructor
|
||||
- auto iter = range1.begin();
|
||||
- auto limit = range2.end();
|
||||
- // operator* with pre- and post-increment
|
||||
- assertEquals(WHERE, u'a', *iter);
|
||||
- ++iter;
|
||||
- assertEquals(WHERE, u'b', *iter);
|
||||
- assertEquals(WHERE, u'c', *++iter);
|
||||
- auto iter2(iter); // copy constructor
|
||||
- assertEquals(WHERE, u'c', *iter2++);
|
||||
- assertEquals(WHERE, u'ç', *iter2++);
|
||||
- assertEquals(WHERE, u'カ', *iter2);
|
||||
- assertTrue(WHERE, ++iter2 != limit);
|
||||
- auto iter3(iter2++);
|
||||
- assertEquals(WHERE, U'🚴', *iter3);
|
||||
- assertTrue(WHERE, iter2 == limit);
|
||||
+ // codePoints() returns USetCodePoints for which explicit APIs are tested via USet
|
||||
+ // in a header-only unit test file.
|
||||
}
|
||||
|
||||
void UnicodeSetTest::TestRangeIterator() {
|
||||
@@ -4332,72 +4299,8 @@ void UnicodeSetTest::TestRangeIterator() {
|
||||
}
|
||||
assertEquals(WHERE, u" a b c | ç | カ | 🚴 |", result);
|
||||
|
||||
- // ranges() returns USetRanges for which explicit APIs are tested via USet.
|
||||
-}
|
||||
-
|
||||
-void UnicodeSetTest::TestUSetRangeIterator() {
|
||||
- IcuTestErrorCode errorCode(*this, "TestUSetRangeIterator");
|
||||
- using U_HEADER_NESTED_NAMESPACE::USetRanges;
|
||||
- using U_HEADER_NESTED_NAMESPACE::CodePointRange;
|
||||
- LocalUSetPointer uset(uset_openPattern(u"[abcçカ🚴]", -1, errorCode));
|
||||
- UnicodeString result;
|
||||
- for (auto [start, end] : USetRanges(uset.getAlias())) {
|
||||
- // printf("uset.range U+%04lx..U+%04lx\n", (long)start, (long)end);
|
||||
- result.append(u' ').append(start).append(u'-').append(end);
|
||||
- }
|
||||
- assertEquals(WHERE, u" a-c ç-ç カ-カ 🚴-🚴", result);
|
||||
- result.remove();
|
||||
- for (auto range : USetRanges(uset.getAlias())) {
|
||||
- for (UChar32 c : range) {
|
||||
- // printf("uset.range.c U+%04lx\n", (long)c);
|
||||
- result.append(u' ').append(c);
|
||||
- }
|
||||
- result.append(u" |");
|
||||
- }
|
||||
- assertEquals(WHERE, u" a b c | ç | カ | 🚴 |", result);
|
||||
-
|
||||
- USetRanges range1(uset.getAlias());
|
||||
- auto range2(range1); // copy constructor
|
||||
- auto iter = range1.begin();
|
||||
- auto limit = range2.end();
|
||||
- // operator* with pre- and post-increment
|
||||
- {
|
||||
- auto cpRange = *iter;
|
||||
- assertEquals(WHERE, u'a', cpRange.rangeStart);
|
||||
- assertEquals(WHERE, u'c', cpRange.rangeEnd);
|
||||
- assertEquals(WHERE, 3, cpRange.size());
|
||||
- auto cpRange2(cpRange);
|
||||
- auto cpIter = cpRange.begin();
|
||||
- auto cpLimit = cpRange2.end();
|
||||
- assertEquals(WHERE, u'a', *cpIter++);
|
||||
- assertEquals(WHERE, u'b', *cpIter);
|
||||
- assertTrue(WHERE, cpIter != cpLimit);
|
||||
- CodePointRange::iterator cpIter2(u'b'); // public constructor
|
||||
- assertTrue(WHERE, cpIter == cpIter2);
|
||||
- assertEquals(WHERE, u'c', *++cpIter);
|
||||
- assertTrue(WHERE, cpIter != cpIter2);
|
||||
- assertTrue(WHERE, ++cpIter == cpLimit);
|
||||
- }
|
||||
- ++iter;
|
||||
- auto iter2(iter); // copy constructor
|
||||
- assertEquals(WHERE, u'ç', (*iter2).rangeStart);
|
||||
- assertEquals(WHERE, u'ç', (*iter2).rangeEnd);
|
||||
- assertEquals(WHERE, 1, (*iter2).size());
|
||||
- assertEquals(WHERE, u'ç', (*iter2++).rangeStart);
|
||||
- assertEquals(WHERE, u'カ', (*iter2).rangeStart);
|
||||
- assertTrue(WHERE, ++iter2 != limit);
|
||||
- auto iter3(iter2++);
|
||||
- assertEquals(WHERE, U'🚴', (*iter3).rangeStart);
|
||||
- assertTrue(WHERE, iter2 == limit);
|
||||
-
|
||||
- {
|
||||
- CodePointRange cpRange(u'h', u'k'); // public constructor
|
||||
- // FYI: currently no operator==
|
||||
- assertEquals(WHERE, u'h', cpRange.rangeStart);
|
||||
- assertEquals(WHERE, u'k', cpRange.rangeEnd);
|
||||
- assertEquals(WHERE, 4, cpRange.size());
|
||||
- assertEquals(WHERE, u'i', *++(cpRange.begin()));
|
||||
- }
|
||||
+ // ranges() returns USetRanges for which explicit APIs are tested via USet
|
||||
+ // in a header-only unit test file.
|
||||
}
|
||||
|
||||
void UnicodeSetTest::TestStringIterator() {
|
||||
@@ -4412,35 +4315,8 @@ void UnicodeSetTest::TestStringIterator() {
|
||||
}
|
||||
assertEquals(WHERE, uR"( "" "abc" "de")", result);
|
||||
|
||||
- // strings() returns USetStrins for which explicit APIs are tested via USet.
|
||||
-}
|
||||
-
|
||||
-void UnicodeSetTest::TestUSetStringIterator() {
|
||||
- IcuTestErrorCode errorCode(*this, "TestUSetStringIterator");
|
||||
- using U_HEADER_NESTED_NAMESPACE::USetStrings;
|
||||
- LocalUSetPointer uset(uset_openPattern(u"[abcçカ🚴{}{abc}{de}]", -1, errorCode));
|
||||
- UnicodeString result;
|
||||
- for (auto s : USetStrings(uset.getAlias())) {
|
||||
- // UnicodeString us(s);
|
||||
- // std::string u8;
|
||||
- // printf("uset.string length %ld \"%s\"\n", (long)s.length(), us.toUTF8String(u8).c_str());
|
||||
- result.append(u" \"").append(s).append(u'"');
|
||||
- }
|
||||
- assertEquals(WHERE, uR"( "" "abc" "de")", result);
|
||||
-
|
||||
- USetStrings range1(uset.getAlias());
|
||||
- auto range2(range1); // copy constructor
|
||||
- auto iter = range1.begin();
|
||||
- auto limit = range2.end();
|
||||
- // operator* with pre- and post-increment
|
||||
- assertEquals(WHERE, UnicodeString(), UnicodeString(*iter));
|
||||
- assertEquals(WHERE, u"abc", UnicodeString(*++iter));
|
||||
- auto iter2(iter); // copy constructor
|
||||
- assertEquals(WHERE, u"abc", UnicodeString(*iter2++));
|
||||
- assertTrue(WHERE, iter2 != limit);
|
||||
- auto iter3(iter2++);
|
||||
- assertEquals(WHERE, u"de", UnicodeString(*iter3));
|
||||
- assertTrue(WHERE, iter2 == limit);
|
||||
+ // strings() returns USetStrins for which explicit APIs are tested via USet
|
||||
+ // in a header-only unit test file.
|
||||
}
|
||||
|
||||
void UnicodeSetTest::TestElementIterator() {
|
||||
@@ -4455,39 +4331,6 @@ void UnicodeSetTest::TestElementIterator() {
|
||||
}
|
||||
assertEquals(WHERE, uR"( "a" "b" "c" "ç" "カ" "🚴" "" "abc" "de")", result);
|
||||
|
||||
- // begin() & end() return USetElementIterator for which explicit APIs are tested via USet.
|
||||
-}
|
||||
-
|
||||
-void UnicodeSetTest::TestUSetElementIterator() {
|
||||
- IcuTestErrorCode errorCode(*this, "TestUSetElementIterator");
|
||||
- using U_HEADER_NESTED_NAMESPACE::USetElements;
|
||||
- LocalUSetPointer uset(uset_openPattern(u"[abcçカ🚴{}{abc}{de}]", -1, errorCode));
|
||||
- UnicodeString result;
|
||||
- for (auto el : USetElements(uset.getAlias())) {
|
||||
- // UnicodeString us(el);
|
||||
- // std::string u8;
|
||||
- // printf("uset.string length %ld \"%s\"\n", (long)us.length(), us.toUTF8String(u8).c_str());
|
||||
- result.append(u" \"").append(el).append(u'"');
|
||||
- }
|
||||
- assertEquals(WHERE, uR"( "a" "b" "c" "ç" "カ" "🚴" "" "abc" "de")", result);
|
||||
-
|
||||
- USetElements range1(uset.getAlias());
|
||||
- auto range2(range1); // copy constructor
|
||||
- auto iter = range1.begin();
|
||||
- auto limit = range2.end();
|
||||
- // operator* with pre- and post-increment
|
||||
- assertEquals(WHERE, u"a", *iter);
|
||||
- ++iter;
|
||||
- assertEquals(WHERE, u"b", *iter);
|
||||
- assertEquals(WHERE, u"c", *++iter);
|
||||
- auto iter2(iter); // copy constructor
|
||||
- assertEquals(WHERE, u"c", *iter2++);
|
||||
- // skip çカ🚴
|
||||
- ++++++iter2;
|
||||
- assertEquals(WHERE, UnicodeString(), *iter2++);
|
||||
- assertEquals(WHERE, u"abc", *iter2);
|
||||
- assertTrue(WHERE, ++iter2 != limit);
|
||||
- auto iter3(iter2++);
|
||||
- assertEquals(WHERE, u"de", *iter3);
|
||||
- assertTrue(WHERE, iter2 == limit);
|
||||
+ // begin() & end() return USetElementIterator for which explicit APIs are tested via USet
|
||||
+ // in a header-only unit test file.
|
||||
}
|
||||
diff --git a/icu4c/source/test/intltest/usettest.h b/icu4c/source/test/intltest/usettest.h
|
||||
index 0127042c736..2ac22ba72e6 100644
|
||||
--- icu4c/source/test/intltest/usettest.h
|
||||
+++ icu4c/source/test/intltest/usettest.h
|
||||
@@ -106,13 +106,9 @@ class UnicodeSetTest: public IntlTest {
|
||||
void TestPatternCodePointComplement();
|
||||
|
||||
void TestCodePointIterator();
|
||||
- void TestUSetCodePointIterator();
|
||||
void TestRangeIterator();
|
||||
- void TestUSetRangeIterator();
|
||||
void TestStringIterator();
|
||||
- void TestUSetStringIterator();
|
||||
void TestElementIterator();
|
||||
- void TestUSetElementIterator();
|
||||
|
||||
private:
|
||||
|
||||
--
|
||||
2.47.1
|
||||
|
||||
+153
@@ -0,0 +1,153 @@
|
||||
From c0a3fe15d4420157fbede62470426fcf91299760 Mon Sep 17 00:00:00 2001
|
||||
From: Markus Scherer <markus.icu@gmail.com>
|
||||
Date: Mon, 23 Dec 2024 10:00:43 -0800
|
||||
Subject: [PATCH] ICU-22954 Partially revert PR #3295
|
||||
U_ICU_NAMESPACE_OR_INTERNAL, header-only localpointer
|
||||
|
||||
This partially reverts commit 3527b3d320d6ad128fbff247e31f739f6ccb7a5a.
|
||||
|
||||
Making LocalPointer header-only, with a different namespace when compiling internally,
|
||||
turned out to be problematic.
|
||||
---
|
||||
icu4c/source/common/unicode/localpointer.h | 10 +++++-----
|
||||
icu4c/source/common/unicode/normlzr.h | 4 ++--
|
||||
icu4c/source/common/unicode/unistr.h | 8 ++++----
|
||||
icu4c/source/common/unicode/uset.h | 6 +++---
|
||||
icu4c/source/i18n/unicode/ucol.h | 4 ++--
|
||||
5 files changed, 16 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/icu4c/source/common/unicode/localpointer.h b/icu4c/source/common/unicode/localpointer.h
|
||||
index 487ddb48b78..9c891bf3088 100644
|
||||
--- icu4c/source/common/unicode/localpointer.h
|
||||
+++ icu4c/source/common/unicode/localpointer.h
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
/**
|
||||
* \file
|
||||
- * \brief C++ header-only API: "Smart pointers" for use with and in ICU4C C++ code.
|
||||
+ * \brief C++ API: "Smart pointers" for use with and in ICU4C C++ code.
|
||||
*
|
||||
* These classes are inspired by
|
||||
* - std::auto_ptr
|
||||
@@ -40,11 +40,11 @@
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
-#if U_SHOW_CPLUSPLUS_API || U_SHOW_CPLUSPLUS_HEADER_API
|
||||
+#if U_SHOW_CPLUSPLUS_API
|
||||
|
||||
#include <memory>
|
||||
|
||||
-namespace U_ICU_NAMESPACE_OR_INTERNAL {
|
||||
+U_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* "Smart pointer" base class; do not use directly: use LocalPointer etc.
|
||||
@@ -603,7 +603,7 @@ class LocalOpenPointer : public LocalPointerBase<Type> {
|
||||
} // namespace internal
|
||||
#endif
|
||||
|
||||
-} // U_ICU_NAMESPACE_OR_INTERNAL
|
||||
+U_NAMESPACE_END
|
||||
|
||||
-#endif // U_SHOW_CPLUSPLUS_API || U_SHOW_CPLUSPLUS_HEADER_API
|
||||
+#endif /* U_SHOW_CPLUSPLUS_API */
|
||||
#endif /* __LOCALPOINTER_H__ */
|
||||
diff --git a/icu4c/source/common/unicode/normlzr.h b/icu4c/source/common/unicode/normlzr.h
|
||||
index 40848bf00ca..0309bce5382 100644
|
||||
--- icu4c/source/common/unicode/normlzr.h
|
||||
+++ icu4c/source/common/unicode/normlzr.h
|
||||
@@ -801,8 +801,8 @@ Normalizer::compare(const UnicodeString &s1, const UnicodeString &s2,
|
||||
uint32_t options,
|
||||
UErrorCode &errorCode) {
|
||||
// all argument checking is done in unorm_compare
|
||||
- return unorm_compare(U_ICU_NAMESPACE_OR_INTERNAL::toUCharPtr(s1.getBuffer()), s1.length(),
|
||||
- U_ICU_NAMESPACE_OR_INTERNAL::toUCharPtr(s2.getBuffer()), s2.length(),
|
||||
+ return unorm_compare(toUCharPtr(s1.getBuffer()), s1.length(),
|
||||
+ toUCharPtr(s2.getBuffer()), s2.length(),
|
||||
options,
|
||||
&errorCode);
|
||||
}
|
||||
diff --git a/icu4c/source/common/unicode/unistr.h b/icu4c/source/common/unicode/unistr.h
|
||||
index a1901c91504..39d789fd6ef 100644
|
||||
--- icu4c/source/common/unicode/unistr.h
|
||||
+++ icu4c/source/common/unicode/unistr.h
|
||||
@@ -4676,7 +4676,7 @@ UnicodeString::startsWith(const UnicodeString& srcText,
|
||||
inline UBool
|
||||
UnicodeString::startsWith(ConstChar16Ptr srcChars, int32_t srcLength) const {
|
||||
if(srcLength < 0) {
|
||||
- srcLength = u_strlen(U_ICU_NAMESPACE_OR_INTERNAL::toUCharPtr(srcChars));
|
||||
+ srcLength = u_strlen(toUCharPtr(srcChars));
|
||||
}
|
||||
return doEqualsSubstring(0, srcLength, srcChars, 0, srcLength);
|
||||
}
|
||||
@@ -4684,7 +4684,7 @@ UnicodeString::startsWith(ConstChar16Ptr srcChars, int32_t srcLength) const {
|
||||
inline UBool
|
||||
UnicodeString::startsWith(const char16_t *srcChars, int32_t srcStart, int32_t srcLength) const {
|
||||
if(srcLength < 0) {
|
||||
- srcLength = u_strlen(U_ICU_NAMESPACE_OR_INTERNAL::toUCharPtr(srcChars));
|
||||
+ srcLength = u_strlen(toUCharPtr(srcChars));
|
||||
}
|
||||
return doEqualsSubstring(0, srcLength, srcChars, srcStart, srcLength);
|
||||
}
|
||||
@@ -4707,7 +4707,7 @@ inline UBool
|
||||
UnicodeString::endsWith(ConstChar16Ptr srcChars,
|
||||
int32_t srcLength) const {
|
||||
if(srcLength < 0) {
|
||||
- srcLength = u_strlen(U_ICU_NAMESPACE_OR_INTERNAL::toUCharPtr(srcChars));
|
||||
+ srcLength = u_strlen(toUCharPtr(srcChars));
|
||||
}
|
||||
return doEqualsSubstring(length() - srcLength, srcLength, srcChars, 0, srcLength);
|
||||
}
|
||||
@@ -4717,7 +4717,7 @@ UnicodeString::endsWith(const char16_t *srcChars,
|
||||
int32_t srcStart,
|
||||
int32_t srcLength) const {
|
||||
if(srcLength < 0) {
|
||||
- srcLength = u_strlen(U_ICU_NAMESPACE_OR_INTERNAL::toUCharPtr(srcChars + srcStart));
|
||||
+ srcLength = u_strlen(toUCharPtr(srcChars + srcStart));
|
||||
}
|
||||
return doEqualsSubstring(length() - srcLength, srcLength,
|
||||
srcChars, srcStart, srcLength);
|
||||
diff --git a/icu4c/source/common/unicode/uset.h b/icu4c/source/common/unicode/uset.h
|
||||
index 345d6244544..b5333a5f5ce 100644
|
||||
--- icu4c/source/common/unicode/uset.h
|
||||
+++ icu4c/source/common/unicode/uset.h
|
||||
@@ -346,9 +346,9 @@ uset_openPatternOptions(const UChar* pattern, int32_t patternLength,
|
||||
U_CAPI void U_EXPORT2
|
||||
uset_close(USet* set);
|
||||
|
||||
-#if U_SHOW_CPLUSPLUS_API || U_SHOW_CPLUSPLUS_HEADER_API
|
||||
+#if U_SHOW_CPLUSPLUS_API
|
||||
|
||||
-namespace U_ICU_NAMESPACE_OR_INTERNAL {
|
||||
+U_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* \class LocalUSetPointer
|
||||
@@ -361,7 +361,7 @@ namespace U_ICU_NAMESPACE_OR_INTERNAL {
|
||||
*/
|
||||
U_DEFINE_LOCAL_OPEN_POINTER(LocalUSetPointer, USet, uset_close);
|
||||
|
||||
-} // U_ICU_NAMESPACE_OR_INTERNAL
|
||||
+U_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
diff --git a/icu4c/source/i18n/unicode/ucol.h b/icu4c/source/i18n/unicode/ucol.h
|
||||
index 8b6dfeaa0a8..ae4f29c3c6c 100644
|
||||
--- icu4c/source/i18n/unicode/ucol.h
|
||||
+++ icu4c/source/i18n/unicode/ucol.h
|
||||
@@ -1572,8 +1572,8 @@ class Predicate {
|
||||
return compare(
|
||||
ucol_strcoll(
|
||||
collator,
|
||||
- U_ICU_NAMESPACE_OR_INTERNAL::toUCharPtr(lhs.getBuffer()), lhs.length(),
|
||||
- U_ICU_NAMESPACE_OR_INTERNAL::toUCharPtr(rhs.getBuffer()), rhs.length()),
|
||||
+ toUCharPtr(lhs.getBuffer()), lhs.length(),
|
||||
+ toUCharPtr(rhs.getBuffer()), rhs.length()),
|
||||
result);
|
||||
}
|
||||
|
||||
--
|
||||
2.47.1
|
||||
|
||||
+119
@@ -0,0 +1,119 @@
|
||||
From b0ae845e4760a26719b2285fca3fc464cf213aee Mon Sep 17 00:00:00 2001
|
||||
From: Markus Scherer <markus.icu@gmail.com>
|
||||
Date: Mon, 23 Dec 2024 10:35:05 -0800
|
||||
Subject: [PATCH] ICU-22954 USetHeaderOnlyTest use unique_ptr
|
||||
|
||||
---
|
||||
.../test/intltest/usetheaderonlytest.cpp | 31 +++++++++++--------
|
||||
1 file changed, 18 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/icu4c/source/test/intltest/usetheaderonlytest.cpp b/icu4c/source/test/intltest/usetheaderonlytest.cpp
|
||||
index 38bc175c174..49fe420a418 100644
|
||||
--- icu4c/source/test/intltest/usetheaderonlytest.cpp
|
||||
+++ icu4c/source/test/intltest/usetheaderonlytest.cpp
|
||||
@@ -4,6 +4,7 @@
|
||||
// usetheaderonlytest.cpp
|
||||
// created: 2024dec11 Markus W. Scherer
|
||||
|
||||
+#include <memory>
|
||||
#include <string>
|
||||
|
||||
// Test header-only ICU C++ APIs. Do not use other ICU C++ APIs.
|
||||
@@ -57,16 +58,17 @@ std::u16string cpString(UChar32 c) {
|
||||
void USetHeaderOnlyTest::TestUSetCodePointIterator() {
|
||||
IcuTestErrorCode errorCode(*this, "TestUSetCodePointIterator");
|
||||
using U_HEADER_NESTED_NAMESPACE::USetCodePoints;
|
||||
- LocalUSetPointer uset(uset_openPattern(u"[abcçカ🚴]", -1, errorCode));
|
||||
+ std::unique_ptr<USet, decltype(&uset_close)> uset(
|
||||
+ uset_openPattern(u"[abcçカ🚴]", -1, errorCode), &uset_close);
|
||||
std::u16string result;
|
||||
- for (UChar32 c : USetCodePoints(uset.getAlias())) {
|
||||
+ for (UChar32 c : USetCodePoints(uset.get())) {
|
||||
// Commented-out sample code for pasting into the API docs.
|
||||
// printf("uset.codePoint U+%04lx\n", (long)c);
|
||||
result.append(u" ").append(cpString(c));
|
||||
}
|
||||
assertEquals(WHERE, u" a b c ç カ 🚴", result);
|
||||
|
||||
- USetCodePoints range1(uset.getAlias());
|
||||
+ USetCodePoints range1(uset.get());
|
||||
auto range2(range1); // copy constructor
|
||||
auto iter = range1.begin();
|
||||
auto limit = range2.end();
|
||||
@@ -89,16 +91,17 @@ void USetHeaderOnlyTest::TestUSetRangeIterator() {
|
||||
IcuTestErrorCode errorCode(*this, "TestUSetRangeIterator");
|
||||
using U_HEADER_NESTED_NAMESPACE::USetRanges;
|
||||
using U_HEADER_NESTED_NAMESPACE::CodePointRange;
|
||||
- LocalUSetPointer uset(uset_openPattern(u"[abcçカ🚴]", -1, errorCode));
|
||||
+ std::unique_ptr<USet, decltype(&uset_close)> uset(
|
||||
+ uset_openPattern(u"[abcçカ🚴]", -1, errorCode), &uset_close);
|
||||
std::u16string result;
|
||||
- for (auto [start, end] : USetRanges(uset.getAlias())) {
|
||||
+ for (auto [start, end] : USetRanges(uset.get())) {
|
||||
// Commented-out sample code for pasting into the API docs.
|
||||
// printf("uset.range U+%04lx..U+%04lx\n", (long)start, (long)end);
|
||||
result.append(u" ").append(cpString(start)).append(u"-").append(cpString(end));
|
||||
}
|
||||
assertEquals(WHERE, u" a-c ç-ç カ-カ 🚴-🚴", result);
|
||||
result.clear();
|
||||
- for (auto range : USetRanges(uset.getAlias())) {
|
||||
+ for (auto range : USetRanges(uset.get())) {
|
||||
for (UChar32 c : range) {
|
||||
// Commented-out sample code for pasting into the API docs.
|
||||
// printf("uset.range.c U+%04lx\n", (long)c);
|
||||
@@ -108,7 +111,7 @@ void USetHeaderOnlyTest::TestUSetRangeIterator() {
|
||||
}
|
||||
assertEquals(WHERE, u" a b c | ç | カ | 🚴 |", result);
|
||||
|
||||
- USetRanges range1(uset.getAlias());
|
||||
+ USetRanges range1(uset.get());
|
||||
auto range2(range1); // copy constructor
|
||||
auto iter = range1.begin();
|
||||
auto limit = range2.end();
|
||||
@@ -155,9 +158,10 @@ void USetHeaderOnlyTest::TestUSetRangeIterator() {
|
||||
void USetHeaderOnlyTest::TestUSetStringIterator() {
|
||||
IcuTestErrorCode errorCode(*this, "TestUSetStringIterator");
|
||||
using U_HEADER_NESTED_NAMESPACE::USetStrings;
|
||||
- LocalUSetPointer uset(uset_openPattern(u"[abcçカ🚴{}{abc}{de}]", -1, errorCode));
|
||||
+ std::unique_ptr<USet, decltype(&uset_close)> uset(
|
||||
+ uset_openPattern(u"[abcçカ🚴{}{abc}{de}]", -1, errorCode), &uset_close);
|
||||
std::u16string result;
|
||||
- for (auto s : USetStrings(uset.getAlias())) {
|
||||
+ for (auto s : USetStrings(uset.get())) {
|
||||
// Commented-out sample code for pasting into the API docs.
|
||||
// Needs U_SHOW_CPLUSPLUS_API=1 for UnicodeString.
|
||||
// UnicodeString us(s);
|
||||
@@ -167,7 +171,7 @@ void USetHeaderOnlyTest::TestUSetStringIterator() {
|
||||
}
|
||||
assertEquals(WHERE, uR"( "" "abc" "de")", result);
|
||||
|
||||
- USetStrings range1(uset.getAlias());
|
||||
+ USetStrings range1(uset.get());
|
||||
auto range2(range1); // copy constructor
|
||||
auto iter = range1.begin();
|
||||
auto limit = range2.end();
|
||||
@@ -185,9 +189,10 @@ void USetHeaderOnlyTest::TestUSetStringIterator() {
|
||||
void USetHeaderOnlyTest::TestUSetElementIterator() {
|
||||
IcuTestErrorCode errorCode(*this, "TestUSetElementIterator");
|
||||
using U_HEADER_NESTED_NAMESPACE::USetElements;
|
||||
- LocalUSetPointer uset(uset_openPattern(u"[abcçカ🚴{}{abc}{de}]", -1, errorCode));
|
||||
+ std::unique_ptr<USet, decltype(&uset_close)> uset(
|
||||
+ uset_openPattern(u"[abcçカ🚴{}{abc}{de}]", -1, errorCode), &uset_close);
|
||||
std::u16string result;
|
||||
- for (auto el : USetElements(uset.getAlias())) {
|
||||
+ for (auto el : USetElements(uset.get())) {
|
||||
// Commented-out sample code for pasting into the API docs.
|
||||
// Needs U_SHOW_CPLUSPLUS_API=1 for UnicodeString.
|
||||
// UnicodeString us(el);
|
||||
@@ -197,7 +202,7 @@ void USetHeaderOnlyTest::TestUSetElementIterator() {
|
||||
}
|
||||
assertEquals(WHERE, uR"( "a" "b" "c" "ç" "カ" "🚴" "" "abc" "de")", result);
|
||||
|
||||
- USetElements range1(uset.getAlias());
|
||||
+ USetElements range1(uset.get());
|
||||
auto range2(range1); // copy constructor
|
||||
auto iter = range1.begin();
|
||||
auto limit = range2.end();
|
||||
--
|
||||
2.47.1
|
||||
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
From b2a47f9aa47eeaa400018fec1849b0852ca74451 Mon Sep 17 00:00:00 2001
|
||||
From: Fredrik Roubert <roubert@google.com>
|
||||
Date: Mon, 30 Dec 2024 17:52:03 +0900
|
||||
Subject: [PATCH] ICU-22954 Delete copy & assign from IcuTestErrorCode.
|
||||
|
||||
There's no reason to ever make a copy of these objects, existing code
|
||||
that does this is doing it by mistake.
|
||||
---
|
||||
icu4c/source/test/intltest/listformattertest.cpp | 2 +-
|
||||
icu4c/source/test/intltest/listformattertest.h | 2 +-
|
||||
icu4c/source/tools/ctestfw/unicode/testlog.h | 3 +++
|
||||
3 files changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/icu4c/source/test/intltest/listformattertest.cpp b/icu4c/source/test/intltest/listformattertest.cpp
|
||||
index 592137e39dd..bd6210266b9 100644
|
||||
--- icu4c/source/test/intltest/listformattertest.cpp
|
||||
+++ icu4c/source/test/intltest/listformattertest.cpp
|
||||
@@ -618,7 +618,7 @@ void ListFormatterTest::DoTheRealListStyleTesting(
|
||||
UListFormatterType type,
|
||||
UListFormatterWidth width,
|
||||
const char* expected,
|
||||
- IcuTestErrorCode status) {
|
||||
+ IcuTestErrorCode& status) {
|
||||
|
||||
LocalPointer<ListFormatter> formatter(
|
||||
ListFormatter::createInstance(locale, type, width, status));
|
||||
diff --git a/icu4c/source/test/intltest/listformattertest.h b/icu4c/source/test/intltest/listformattertest.h
|
||||
index 2c6860c1610..65d8aedfe89 100644
|
||||
--- icu4c/source/test/intltest/listformattertest.h
|
||||
+++ icu4c/source/test/intltest/listformattertest.h
|
||||
@@ -115,7 +115,7 @@ class ListFormatterTest : public IntlTestWithFieldPosition {
|
||||
UListFormatterType type,
|
||||
UListFormatterWidth width,
|
||||
const char* expected,
|
||||
- IcuTestErrorCode status);
|
||||
+ IcuTestErrorCode& status);
|
||||
|
||||
private:
|
||||
// Reused test data.
|
||||
diff --git a/icu4c/source/tools/ctestfw/unicode/testlog.h b/icu4c/source/tools/ctestfw/unicode/testlog.h
|
||||
index 3951e729b74..a5e62e80d73 100644
|
||||
--- icu4c/source/tools/ctestfw/unicode/testlog.h
|
||||
+++ icu4c/source/tools/ctestfw/unicode/testlog.h
|
||||
@@ -37,6 +37,9 @@ class T_CTEST_EXPORT_API TestLog {
|
||||
|
||||
class T_CTEST_EXPORT_API IcuTestErrorCode {
|
||||
public:
|
||||
+ IcuTestErrorCode(const IcuTestErrorCode&) = delete;
|
||||
+ IcuTestErrorCode& operator=(const IcuTestErrorCode&) = delete;
|
||||
+
|
||||
IcuTestErrorCode(TestLog &callingTestClass, const char *callingTestName)
|
||||
: errorCode(U_ZERO_ERROR),
|
||||
testClass(callingTestClass), testName(callingTestName), scopeMessage() {}
|
||||
--
|
||||
2.47.1
|
||||
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
From df0422ed3fc945386c5633cb8f4717fdce31f9fb Mon Sep 17 00:00:00 2001
|
||||
From: Fredrik Roubert <roubert@google.com>
|
||||
Date: Mon, 30 Dec 2024 21:26:37 +0900
|
||||
Subject: [PATCH] ICU-22954 Workaround: Replace std::u16string member with
|
||||
UnicodeString&.
|
||||
|
||||
---
|
||||
icu4c/source/tools/ctestfw/tstdtmod.cpp | 12 +++++++++---
|
||||
icu4c/source/tools/ctestfw/unicode/testlog.h | 18 +++++++++++++-----
|
||||
2 files changed, 22 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/icu4c/source/tools/ctestfw/tstdtmod.cpp b/icu4c/source/tools/ctestfw/tstdtmod.cpp
|
||||
index 5a8e1ef7365..15e8913d2b8 100644
|
||||
--- icu4c/source/tools/ctestfw/tstdtmod.cpp
|
||||
+++ icu4c/source/tools/ctestfw/tstdtmod.cpp
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "unicode/tstdtmod.h"
|
||||
+#include "unicode/unistr.h"
|
||||
#include "cmemory.h"
|
||||
#include <stdio.h>
|
||||
#include "cstr.h"
|
||||
@@ -18,11 +19,17 @@
|
||||
|
||||
TestLog::~TestLog() {}
|
||||
|
||||
+IcuTestErrorCode::IcuTestErrorCode(TestLog &callingTestClass, const char *callingTestName)
|
||||
+ : errorCode(U_ZERO_ERROR),
|
||||
+ testClass(callingTestClass), testName(callingTestName), scopeMessage(*new UnicodeString) {
|
||||
+}
|
||||
+
|
||||
IcuTestErrorCode::~IcuTestErrorCode() {
|
||||
// Safe because our errlog() does not throw exceptions.
|
||||
if(isFailure()) {
|
||||
errlog(false, u"destructor: expected success", nullptr);
|
||||
}
|
||||
+ delete &scopeMessage;
|
||||
}
|
||||
|
||||
UErrorCode IcuTestErrorCode::reset() {
|
||||
@@ -119,8 +126,7 @@ UBool IcuTestErrorCode::expectErrorAndReset(UErrorCode expectedError, const char
|
||||
}
|
||||
|
||||
void IcuTestErrorCode::setScope(const char* message) {
|
||||
- UnicodeString us(message, -1, US_INV);
|
||||
- scopeMessage = us;
|
||||
+ scopeMessage.remove().append({ message, -1, US_INV });
|
||||
}
|
||||
|
||||
void IcuTestErrorCode::setScope(std::u16string_view message) {
|
||||
@@ -136,7 +142,7 @@ void IcuTestErrorCode::errlog(UBool dataErr, std::u16string_view mainMessage, co
|
||||
msg.append(u' ').append(mainMessage);
|
||||
msg.append(u" but got error: ").append(UnicodeString(errorName(), -1, US_INV));
|
||||
|
||||
- if (!scopeMessage.empty()) {
|
||||
+ if (!scopeMessage.isEmpty()) {
|
||||
msg.append(u" scope: ").append(scopeMessage);
|
||||
}
|
||||
|
||||
diff --git a/icu4c/source/tools/ctestfw/unicode/testlog.h b/icu4c/source/tools/ctestfw/unicode/testlog.h
|
||||
index a5e62e80d73..44e99954f91 100644
|
||||
--- icu4c/source/tools/ctestfw/unicode/testlog.h
|
||||
+++ icu4c/source/tools/ctestfw/unicode/testlog.h
|
||||
@@ -13,7 +13,6 @@
|
||||
#ifndef U_TESTFW_TESTLOG
|
||||
#define U_TESTFW_TESTLOG
|
||||
|
||||
-#include <string>
|
||||
#include <string_view>
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/testtype.h"
|
||||
@@ -35,14 +34,16 @@ class T_CTEST_EXPORT_API TestLog {
|
||||
// unit tests that work without U_SHOW_CPLUSPLUS_API.
|
||||
// So instead we *copy* the ErrorCode API.
|
||||
|
||||
+U_NAMESPACE_BEGIN
|
||||
+class UnicodeString;
|
||||
+U_NAMESPACE_END
|
||||
+
|
||||
class T_CTEST_EXPORT_API IcuTestErrorCode {
|
||||
public:
|
||||
IcuTestErrorCode(const IcuTestErrorCode&) = delete;
|
||||
IcuTestErrorCode& operator=(const IcuTestErrorCode&) = delete;
|
||||
|
||||
- IcuTestErrorCode(TestLog &callingTestClass, const char *callingTestName)
|
||||
- : errorCode(U_ZERO_ERROR),
|
||||
- testClass(callingTestClass), testName(callingTestName), scopeMessage() {}
|
||||
+ IcuTestErrorCode(TestLog &callingTestClass, const char *callingTestName);
|
||||
virtual ~IcuTestErrorCode();
|
||||
|
||||
// ErrorCode API
|
||||
@@ -75,7 +76,14 @@ class T_CTEST_EXPORT_API IcuTestErrorCode {
|
||||
UErrorCode errorCode;
|
||||
TestLog &testClass;
|
||||
const char *const testName;
|
||||
- std::u16string scopeMessage;
|
||||
+
|
||||
+ // It's not possible to use a UnicodeString member directly here because
|
||||
+ // that won't work without U_SHOW_CPLUSPLUS_API, but it's also not possible
|
||||
+ // to use a std::u16string member because for unknown reasons that leads to
|
||||
+ // a crash in the icu4c-windows-cygwin-gcc CI job. As a workaround, the
|
||||
+ // UnicodeString class is forward declared to make it possible to use a
|
||||
+ // reference here and then heap allocate the object in the constructor.
|
||||
+ UnicodeString& scopeMessage;
|
||||
|
||||
void errlog(UBool dataErr, std::u16string_view mainMessage, const char* extraMessage) const;
|
||||
};
|
||||
--
|
||||
2.47.1
|
||||
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
From 6f93c07a45e7fb1944fa0179591b36413312d16e Mon Sep 17 00:00:00 2001
|
||||
From: Fredrik Roubert <roubert@google.com>
|
||||
Date: Tue, 7 Jan 2025 19:15:44 +0900
|
||||
Subject: [PATCH] ICU-22954 Revert to using std::u16string instead of
|
||||
UnicodeString.
|
||||
|
||||
It seems as if icu4c-windows-cygwin-gcc only crashes if the constructor
|
||||
is defined inline, so with the exception of the constructor this commit
|
||||
reverts the code to commit 320220ef694123393a5c5d6eb6a1c7536fc57aba.
|
||||
---
|
||||
icu4c/source/tools/ctestfw/tstdtmod.cpp | 9 ++++-----
|
||||
icu4c/source/tools/ctestfw/unicode/testlog.h | 14 ++------------
|
||||
2 files changed, 6 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/icu4c/source/tools/ctestfw/tstdtmod.cpp b/icu4c/source/tools/ctestfw/tstdtmod.cpp
|
||||
index 15e8913d2b8..66ab79a7db5 100644
|
||||
--- icu4c/source/tools/ctestfw/tstdtmod.cpp
|
||||
+++ icu4c/source/tools/ctestfw/tstdtmod.cpp
|
||||
@@ -11,7 +11,6 @@
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "unicode/tstdtmod.h"
|
||||
-#include "unicode/unistr.h"
|
||||
#include "cmemory.h"
|
||||
#include <stdio.h>
|
||||
#include "cstr.h"
|
||||
@@ -21,7 +20,7 @@ TestLog::~TestLog() {}
|
||||
|
||||
IcuTestErrorCode::IcuTestErrorCode(TestLog &callingTestClass, const char *callingTestName)
|
||||
: errorCode(U_ZERO_ERROR),
|
||||
- testClass(callingTestClass), testName(callingTestName), scopeMessage(*new UnicodeString) {
|
||||
+ testClass(callingTestClass), testName(callingTestName), scopeMessage() {
|
||||
}
|
||||
|
||||
IcuTestErrorCode::~IcuTestErrorCode() {
|
||||
@@ -29,7 +28,6 @@ IcuTestErrorCode::~IcuTestErrorCode() {
|
||||
if(isFailure()) {
|
||||
errlog(false, u"destructor: expected success", nullptr);
|
||||
}
|
||||
- delete &scopeMessage;
|
||||
}
|
||||
|
||||
UErrorCode IcuTestErrorCode::reset() {
|
||||
@@ -126,7 +124,8 @@ UBool IcuTestErrorCode::expectErrorAndReset(UErrorCode expectedError, const char
|
||||
}
|
||||
|
||||
void IcuTestErrorCode::setScope(const char* message) {
|
||||
- scopeMessage.remove().append({ message, -1, US_INV });
|
||||
+ UnicodeString us(message, -1, US_INV);
|
||||
+ scopeMessage = us;
|
||||
}
|
||||
|
||||
void IcuTestErrorCode::setScope(std::u16string_view message) {
|
||||
@@ -142,7 +141,7 @@ void IcuTestErrorCode::errlog(UBool dataErr, std::u16string_view mainMessage, co
|
||||
msg.append(u' ').append(mainMessage);
|
||||
msg.append(u" but got error: ").append(UnicodeString(errorName(), -1, US_INV));
|
||||
|
||||
- if (!scopeMessage.isEmpty()) {
|
||||
+ if (!scopeMessage.empty()) {
|
||||
msg.append(u" scope: ").append(scopeMessage);
|
||||
}
|
||||
|
||||
diff --git a/icu4c/source/tools/ctestfw/unicode/testlog.h b/icu4c/source/tools/ctestfw/unicode/testlog.h
|
||||
index 44e99954f91..1b5494bc3fe 100644
|
||||
--- icu4c/source/tools/ctestfw/unicode/testlog.h
|
||||
+++ icu4c/source/tools/ctestfw/unicode/testlog.h
|
||||
@@ -13,6 +13,7 @@
|
||||
#ifndef U_TESTFW_TESTLOG
|
||||
#define U_TESTFW_TESTLOG
|
||||
|
||||
+#include <string>
|
||||
#include <string_view>
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/testtype.h"
|
||||
@@ -34,10 +35,6 @@ class T_CTEST_EXPORT_API TestLog {
|
||||
// unit tests that work without U_SHOW_CPLUSPLUS_API.
|
||||
// So instead we *copy* the ErrorCode API.
|
||||
|
||||
-U_NAMESPACE_BEGIN
|
||||
-class UnicodeString;
|
||||
-U_NAMESPACE_END
|
||||
-
|
||||
class T_CTEST_EXPORT_API IcuTestErrorCode {
|
||||
public:
|
||||
IcuTestErrorCode(const IcuTestErrorCode&) = delete;
|
||||
@@ -76,14 +73,7 @@ class T_CTEST_EXPORT_API IcuTestErrorCode {
|
||||
UErrorCode errorCode;
|
||||
TestLog &testClass;
|
||||
const char *const testName;
|
||||
-
|
||||
- // It's not possible to use a UnicodeString member directly here because
|
||||
- // that won't work without U_SHOW_CPLUSPLUS_API, but it's also not possible
|
||||
- // to use a std::u16string member because for unknown reasons that leads to
|
||||
- // a crash in the icu4c-windows-cygwin-gcc CI job. As a workaround, the
|
||||
- // UnicodeString class is forward declared to make it possible to use a
|
||||
- // reference here and then heap allocate the object in the constructor.
|
||||
- UnicodeString& scopeMessage;
|
||||
+ std::u16string scopeMessage;
|
||||
|
||||
void errlog(UBool dataErr, std::u16string_view mainMessage, const char* extraMessage) const;
|
||||
};
|
||||
--
|
||||
2.47.1
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
Description: supply manual page for program that doesn't have one
|
||||
Author: Jay Berkenbilt <qjb@debian.org>
|
||||
Bug: http://bugs.icu-project.org/trac/ticket/7554
|
||||
|
||||
diff -r -u -N icu.orig/source/tools/gennorm2/gennorm2.8.in icu/source/tools/gennorm2/gennorm2.8.in
|
||||
--- icu.orig/source/tools/gennorm2/gennorm2.8.in 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ icu/source/tools/gennorm2/gennorm2.8.in 2013-02-25 16:43:28.297062638 +0100
|
||||
@@ -0,0 +1,71 @@
|
||||
+.\" Hey, Emacs! This is -*-nroff-*- you know...
|
||||
+.\"
|
||||
+.\" gennorm2.8: manual page for the gennorm2 utility
|
||||
+.\"
|
||||
+.\" Copyright (C) 2005-2006 International Business Machines Corporation and others
|
||||
+.\"
|
||||
+.TH GENNORM2 8 "15 March 2010" "ICU MANPAGE" "ICU @VERSION@ Manual"
|
||||
+.SH NAME
|
||||
+.B gennorm2
|
||||
+\- Builds binary data file with Unicode normalization data.
|
||||
+.SH SYNOPSIS
|
||||
+.B gennorm2
|
||||
+[
|
||||
+.BR "\-h\fP, \fB\-?\fP, \fB\-\-help"
|
||||
+]
|
||||
+[
|
||||
+.BR "\-V\fP, \fB\-\-version"
|
||||
+]
|
||||
+[
|
||||
+.BR "\-c\fP, \fB\-\-copyright"
|
||||
+]
|
||||
+[
|
||||
+.BR "\-v\fP, \fB\-\-verbose"
|
||||
+]
|
||||
+[
|
||||
+.BI "\-u\fP, \fB\-\-unicode" " unicode\-version\-number"
|
||||
+]
|
||||
+[
|
||||
+.BI "\-s\fP, \fB\-\-sourcedir" " source\-directory"
|
||||
+]
|
||||
+[
|
||||
+.BI "\-o\fP, \fB\-\-output" " output\-filename"
|
||||
+]
|
||||
+.BI "\fB\-\-fast"
|
||||
+.SH DESCRIPTION
|
||||
+.B gennorm2
|
||||
+reads text files that define Unicode normalization,
|
||||
+them, and builds a binary data file.
|
||||
+.SH OPTIONS
|
||||
+.TP
|
||||
+.BR "\-h\fP, \fB\-?\fP, \fB\-\-help"
|
||||
+Print help about usage and exit.
|
||||
+.TP
|
||||
+.BR "\-V\fP, \fB\-\-version"
|
||||
+Print the version of
|
||||
+.B gennorm2
|
||||
+and exit.
|
||||
+.TP
|
||||
+.BR "\-c\fP, \fB\-\-copyright"
|
||||
+Include a copyright notice.
|
||||
+.TP
|
||||
+.BR "\-v\fP, \fB\-\-verbose"
|
||||
+Display extra informative messages during execution.
|
||||
+.TP
|
||||
+.BR "\-u\fP, \fB\-\-unicode"
|
||||
+Specify Unicode version number, such as 5.2.0.
|
||||
+.TP
|
||||
+.BI "\-s\fP, \fB\-\-sourcedir" " source\-directory"
|
||||
+Specify the input directory.
|
||||
+.TP
|
||||
+.BI "\-s\fP, \fB\-\-sourcedir" " source\-directory"
|
||||
+Set the name of the output file.
|
||||
+.TP
|
||||
+.BI "\fB\-\-fast"
|
||||
+optimize the .nrm file for fast normalization,
|
||||
+which might increase its size (Writes fully decomposed
|
||||
+regular mappings instead of delta mappings.
|
||||
+You should measure the runtime speed to make sure that
|
||||
+this is a good trade-off.)
|
||||
+.SH COPYRIGHT
|
||||
+Copyright (C) 2009-2010 International Business Machines Corporation and others
|
||||
diff -r -u -N icu.orig/source/tools/gennorm2/Makefile.in icu/source/tools/gennorm2/Makefile.in
|
||||
--- icu.orig/source/tools/gennorm2/Makefile.in 2013-01-11 01:23:32.000000000 +0100
|
||||
+++ icu/source/tools/gennorm2/Makefile.in 2013-02-25 16:43:28.296062632 +0100
|
||||
@@ -16,8 +16,13 @@
|
||||
|
||||
TARGET_STUB_NAME = gennorm2
|
||||
|
||||
+SECTION = 8
|
||||
+
|
||||
+MAN_FILES = $(TARGET_STUB_NAME).$(SECTION)
|
||||
+
|
||||
+
|
||||
## Extra files to remove for 'make clean'
|
||||
-CLEANFILES = *~ $(DEPS)
|
||||
+CLEANFILES = *~ $(DEPS) $(MAN_FILES)
|
||||
|
||||
## Target information
|
||||
TARGET = $(BINDIR)/$(TARGET_STUB_NAME)$(EXEEXT)
|
||||
@@ -44,12 +49,16 @@
|
||||
dist: dist-local
|
||||
check: all check-local
|
||||
|
||||
-all-local: $(TARGET)
|
||||
+all-local: $(TARGET) $(MAN_FILES)
|
||||
|
||||
-install-local: all-local
|
||||
+install-local: all-local install-man
|
||||
$(MKINSTALLDIRS) $(DESTDIR)$(sbindir)
|
||||
$(INSTALL) $(TARGET) $(DESTDIR)$(sbindir)
|
||||
|
||||
+install-man: $(MAN_FILES)
|
||||
+ $(MKINSTALLDIRS) $(DESTDIR)$(mandir)/man$(SECTION)
|
||||
+ $(INSTALL_DATA) $? $(DESTDIR)$(mandir)/man$(SECTION)
|
||||
+
|
||||
dist-local:
|
||||
|
||||
clean-local:
|
||||
@@ -70,6 +79,11 @@
|
||||
$(POST_BUILD_STEP)
|
||||
|
||||
|
||||
+%.$(SECTION): $(srcdir)/%.$(SECTION).in
|
||||
+ cd $(top_builddir) \
|
||||
+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
+
|
||||
+
|
||||
ifeq (,$(MAKECMDGOALS))
|
||||
-include $(DEPS)
|
||||
else
|
||||
@@ -0,0 +1,145 @@
|
||||
Description: supply manual page for program that doesn't have one
|
||||
Author: Jay Berkenbilt <qjb@debian.org>
|
||||
Bug: http://bugs.icu-project.org/trac/ticket/7665
|
||||
erAck: adapted to ICU 56.1 icu/source/tools/icuinfo/Makefile.in
|
||||
|
||||
diff -Nur orig.icu/source/tools/icuinfo/icuinfo.1.in icu/source/tools/icuinfo/icuinfo.1.in
|
||||
--- orig.icu/source/tools/icuinfo/icuinfo.1.in 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ icu/source/tools/icuinfo/icuinfo.1.in 2015-10-27 19:19:35.184056800 +0100
|
||||
@@ -0,0 +1,76 @@
|
||||
+.\" Hey, Emacs! This is -*-nroff-*- you know...
|
||||
+.\"
|
||||
+.\" icuinfo.1: manual page for the icuinfo utility
|
||||
+.\"
|
||||
+.\" Copyright (C) 2005-2006 International Business Machines Corporation and others
|
||||
+.\"
|
||||
+.TH ICUINFO 1 "1 May 2010" "ICU MANPAGE" "ICU @VERSION@ Manual"
|
||||
+.SH NAME
|
||||
+.B icuinfo
|
||||
+\- Shows some basic info about the current ICU
|
||||
+.SH SYNOPSIS
|
||||
+.B icuinfo
|
||||
+[
|
||||
+.BR "\-h\fP, \fB\-?\fP, \fB\-\-help"
|
||||
+]
|
||||
+[
|
||||
+.BR "\-V\fP, \fB\-\-version"
|
||||
+]
|
||||
+[
|
||||
+.BR "\-c\fP, \fB\-\-copyright"
|
||||
+]
|
||||
+[
|
||||
+.BI "\-i\fP, \fB\-\-icudatadir" " directory"
|
||||
+]
|
||||
+[
|
||||
+.BR "\-v\fP, \fB\-\-verbose"
|
||||
+]
|
||||
+[
|
||||
+.BI "\-L\fP, \fB\-\-list-plugins"
|
||||
+]
|
||||
+[
|
||||
+.BI "\-m\fP, \fB\-\-milisecond-time"
|
||||
+]
|
||||
+[
|
||||
+.BI "\-K\fP, \fB\-\-cleanup"
|
||||
+]
|
||||
+.SH DESCRIPTION
|
||||
+.B icuinfo
|
||||
+prints basic information about the current version of ICU.
|
||||
+.SH OPTIONS
|
||||
+.TP
|
||||
+.BR "\-h\fP, \fB\-?\fP, \fB\-\-help"
|
||||
+Print help about usage and exit.
|
||||
+.TP
|
||||
+.BR "\-V\fP, \fB\-\-version"
|
||||
+Print the version of
|
||||
+.B icuinfo
|
||||
+and exit.
|
||||
+.TP
|
||||
+.BR "\-c\fP, \fB\-\-copyright"
|
||||
+Embeds the standard ICU copyright into the
|
||||
+.IR output-file .
|
||||
+.TP
|
||||
+.BR "\-v\fP, \fB\-\-verbose"
|
||||
+Display extra informative messages during execution.
|
||||
+.TP
|
||||
+.BI "\-i\fP, \fB\-\-icudatadir" " directory"
|
||||
+Look for any necessary ICU data files in
|
||||
+.IR directory .
|
||||
+For example, the file
|
||||
+.B pnames.icu
|
||||
+must be located when ICU's data is not built as a shared library.
|
||||
+The default ICU data directory is specified by the environment variable
|
||||
+.BR ICU_DATA .
|
||||
+Most configurations of ICU do not require this argument.
|
||||
+.TP
|
||||
+.BI "\-L\fP, \fB\-\-list-plugins"
|
||||
+If specified, list and diagnose issues with ICU plugins.
|
||||
+.TP
|
||||
+.BI "\-K\fP, \fB\-\-cleanup"
|
||||
+Attempt to unload plugins before exiting.
|
||||
+.TP
|
||||
+.BI "\-m\fP, \fB\-\-milisecond-time"
|
||||
+Print the current UTC time in milliseconds.
|
||||
+.SH COPYRIGHT
|
||||
+Copyright (C) 2010 International Business Machines Corporation and others
|
||||
diff -Nur orig.icu/source/tools/icuinfo/Makefile.in icu/source/tools/icuinfo/Makefile.in
|
||||
--- orig.icu/source/tools/icuinfo/Makefile.in 2015-10-08 05:53:56.000000000 +0200
|
||||
+++ icu/source/tools/icuinfo/Makefile.in 2015-10-27 19:23:19.115509906 +0100
|
||||
@@ -14,8 +14,15 @@
|
||||
## Build directory information
|
||||
subdir = tools/icuinfo
|
||||
|
||||
+TARGET_STUB_NAME = icuinfo
|
||||
+
|
||||
+SECTION = 1
|
||||
+
|
||||
+MAN_FILES = $(TARGET_STUB_NAME).$(SECTION)
|
||||
+
|
||||
+
|
||||
## Extra files to remove for 'make clean'
|
||||
-CLEANFILES = *~ $(DEPS) $(PLUGIN_OBJECTS) $(PLUGINFILE) $(PLUGIN)
|
||||
+CLEANFILES = *~ $(DEPS) $(PLUGIN_OBJECTS) $(PLUGINFILE) $(PLUGIN) $(MAN_FILES)
|
||||
|
||||
## Target information
|
||||
TARGET = icuinfo$(EXEEXT)
|
||||
@@ -35,7 +42,8 @@
|
||||
|
||||
## List of phony targets
|
||||
.PHONY : all all-local install install-local clean clean-local \
|
||||
-distclean distclean-local dist dist-local check check-local plugin-check
|
||||
+distclean distclean-local dist dist-local check check-local plugin-check \
|
||||
+install-man
|
||||
|
||||
## Clear suffix list
|
||||
.SUFFIXES :
|
||||
@@ -48,12 +56,16 @@
|
||||
dist: dist-local
|
||||
check: all check-local
|
||||
|
||||
-all-local: $(TARGET)
|
||||
+all-local: $(TARGET) $(MAN_FILES)
|
||||
|
||||
-install-local: all-local
|
||||
+install-local: all-local install-man
|
||||
$(MKINSTALLDIRS) $(DESTDIR)$(bindir)
|
||||
$(INSTALL) $(TARGET) $(DESTDIR)$(bindir)
|
||||
|
||||
+install-man: $(MAN_FILES)
|
||||
+ $(MKINSTALLDIRS) $(DESTDIR)$(mandir)/man$(SECTION)
|
||||
+ $(INSTALL_DATA) $? $(DESTDIR)$(mandir)/man$(SECTION)
|
||||
+
|
||||
dist-local:
|
||||
|
||||
clean-local:
|
||||
@@ -103,6 +115,10 @@
|
||||
@echo "Plugins are disabled (use --enable-plugins to enable)"
|
||||
endif
|
||||
|
||||
+%.$(SECTION): $(srcdir)/%.$(SECTION).in
|
||||
+ cd $(top_builddir) \
|
||||
+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
+
|
||||
ifeq (,$(MAKECMDGOALS))
|
||||
-include $(DEPS)
|
||||
else
|
||||
@@ -14,12 +14,23 @@
|
||||
<Description>ICU is a mature, widely used set of C/C++ and Java libraries for Unicode support, software internationalization and globalization (i18n/g11n). This package contains the C/C++ libraries.</Description>
|
||||
<!-- CAUTION! This package has a great potential to break API/ABI in minor version bumps, check for a file like:
|
||||
http://source.icu-project.org/repos/icu/icu/tags/release-55-1/APIChangeReport.html -->
|
||||
<Archive sha1sum="3d94969b097189bf5479c312d9593d2d252f5a73" type="targz">https://github.com/unicode-org/icu/releases/download/release-73-2/icu4c-73_2-src.tgz</Archive>
|
||||
<Archive sha1sum="f7764341d196112573605881dbbf10e586d84841" type="targz">https://github.com/unicode-org/icu/releases/download/release-76-1/icu4c-76_1-src.tgz</Archive>
|
||||
<BuildDependencies>
|
||||
<Dependency>libgcc</Dependency>
|
||||
</BuildDependencies>
|
||||
<Patches>
|
||||
<!--Patch level="3">icu4c-58.2-fix_enumeration-1-1.patch</Patch-->
|
||||
<!-- <Patch>gennorm2-man.patch</Patch> -->
|
||||
<!-- <Patch>icuinfo-man.patch</Patch> -->
|
||||
|
||||
<Patch>fedora/0001-ICU-22954-USet-C-iterator-return-std-u16string.patch</Patch>
|
||||
<Patch>fedora/0002-ICU-22954-U_ICU_NAMESPACE_OR_INTERNAL-header-only-lo.patch</Patch>
|
||||
<Patch>fedora/0003-ICU-22954-intltest.h-IcuTestErrorCode-usable-without.patch</Patch>
|
||||
<Patch>fedora/0004-ICU-22954-header-only-test-USet-C-iterators.patch</Patch>
|
||||
<Patch>fedora/0005-ICU-22954-Partially-revert-PR-3295-U_ICU_NAMESPACE_O.patch</Patch>
|
||||
<Patch>fedora/0006-ICU-22954-USetHeaderOnlyTest-use-unique_ptr.patch</Patch>
|
||||
<Patch>fedora/0007-ICU-22954-Delete-copy-assign-from-IcuTestErrorCode.patch</Patch>
|
||||
<Patch>fedora/0008-ICU-22954-Workaround-Replace-std-u16string-member-wi.patch</Patch>
|
||||
<Patch>fedora/0009-ICU-22954-Revert-to-using-std-u16string-instead-of-U.patch</Patch>
|
||||
</Patches>
|
||||
</Source>
|
||||
|
||||
@@ -72,6 +83,13 @@
|
||||
</Package>
|
||||
|
||||
<History>
|
||||
<Update release="14">
|
||||
<Date>2025-02-23</Date>
|
||||
<Version>76.1</Version>
|
||||
<Comment>Version bump.</Comment>
|
||||
<Name>Mustafa Cinasal</Name>
|
||||
<Email>muscnsl@gmail.com</Email>
|
||||
</Update>
|
||||
<Update release="13">
|
||||
<Date>2023-10-16</Date>
|
||||
<Version>73.2</Version>
|
||||
|
||||
Reference in New Issue
Block a user