5353#include "pal_compiler.h"
5454
5555#if !defined(STATIC_ICU )
56+ // ucol_setVariableTop is a deprecated function on the newer ICU versions and ucol_setMaxVariable should be used instead.
57+ // As can run against ICU versions which not supported ucol_setMaxVariable, we'll dynamically try to get the pointer to ucol_setVariableTop
58+ // when we couldn't get a pointer to ucol_setMaxVariable.
59+ typedef uint32_t (* ucol_setVariableTop_func )(UCollator * coll , const UChar * varTop , int32_t len , UErrorCode * status );
60+ extern ucol_setVariableTop_func ucol_setVariableTop_ptr ;
5661
5762#if !defined(TARGET_ANDROID )
5863// (U_ICU_VERSION_MAJOR_NUM < 52)
5964// The following APIs are not supported in the ICU versions less than 52. We need to define them manually.
6065// We have to do runtime check before using the pointers to these APIs. That is why these are listed in the FOR_ALL_OPTIONAL_ICU_FUNCTIONS list.
66+ U_CAPI void U_EXPORT2 ucol_setMaxVariable (UCollator * coll , UColReorderCode group , UErrorCode * pErrorCode );
6167U_CAPI int32_t U_EXPORT2 ucal_getTimeZoneIDForWindowsID (const UChar * winid , int32_t len , const char * region , UChar * id , int32_t idCapacity , UErrorCode * status );
6268U_CAPI int32_t U_EXPORT2 ucal_getWindowsTimeZoneID (const UChar * id , int32_t len , UChar * winid , int32_t winidCapacity , UErrorCode * status );
6369#endif
@@ -164,15 +170,6 @@ U_CAPI int32_t U_EXPORT2 ucal_getWindowsTimeZoneID(const UChar* id, int32_t len,
164170 PER_FUNCTION_BLOCK(usearch_setPattern, libicui18n, true) \
165171 PER_FUNCTION_BLOCK(usearch_setText, libicui18n, true)
166172
167- #if HAVE_SET_MAX_VARIABLE
168- #define FOR_ALL_SET_VARIABLE_ICU_FUNCTIONS \
169- PER_FUNCTION_BLOCK(ucol_setMaxVariable, libicui18n, true)
170- #else
171-
172- #define FOR_ALL_SET_VARIABLE_ICU_FUNCTIONS \
173- PER_FUNCTION_BLOCK(ucol_setVariableTop, libicui18n, true)
174- #endif
175-
176173#if defined(TARGET_WINDOWS )
177174#define FOR_ALL_OS_CONDITIONAL_ICU_FUNCTIONS \
178175 PER_FUNCTION_BLOCK(ucurr_forLocale, libicuuc, true) \
@@ -195,11 +192,11 @@ U_CAPI int32_t U_EXPORT2 ucal_getWindowsTimeZoneID(const UChar* id, int32_t len,
195192// Otherwise, we'll just not provide the functionality to users which needed these APIs.
196193#define FOR_ALL_OPTIONAL_ICU_FUNCTIONS \
197194 PER_FUNCTION_BLOCK(ucal_getWindowsTimeZoneID, libicui18n, false) \
198- PER_FUNCTION_BLOCK(ucal_getTimeZoneIDForWindowsID, libicui18n, false)
195+ PER_FUNCTION_BLOCK(ucal_getTimeZoneIDForWindowsID, libicui18n, false) \
196+ PER_FUNCTION_BLOCK(ucol_setMaxVariable, libicui18n, false)
199197
200198#define FOR_ALL_ICU_FUNCTIONS \
201199 FOR_ALL_UNCONDITIONAL_ICU_FUNCTIONS \
202- FOR_ALL_SET_VARIABLE_ICU_FUNCTIONS \
203200 FOR_ALL_OPTIONAL_ICU_FUNCTIONS \
204201 FOR_ALL_OS_CONDITIONAL_ICU_FUNCTIONS
205202
@@ -249,11 +246,7 @@ FOR_ALL_ICU_FUNCTIONS
249246#define ucol_openRules (...) ucol_openRules_ptr(__VA_ARGS__)
250247#define ucol_safeClone (...) ucol_safeClone_ptr(__VA_ARGS__)
251248#define ucol_setAttribute (...) ucol_setAttribute_ptr(__VA_ARGS__)
252- #if HAVE_SET_MAX_VARIABLE
253249#define ucol_setMaxVariable (...) ucol_setMaxVariable_ptr(__VA_ARGS__)
254- #else
255- #define ucol_setVariableTop (...) ucol_setVariableTop_ptr(__VA_ARGS__)
256- #endif
257250#define ucol_strcoll (...) ucol_strcoll_ptr(__VA_ARGS__)
258251#define ucurr_forLocale (...) ucurr_forLocale_ptr(__VA_ARGS__)
259252#define ucurr_getName (...) ucurr_getName_ptr(__VA_ARGS__)
0 commit comments