putilimp.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616
  1. // © 2016 and later: Unicode, Inc. and others.
  2. // License & terms of use: http://www.unicode.org/copyright.html
  3. /*
  4. ******************************************************************************
  5. *
  6. * Copyright (C) 1997-2016, International Business Machines
  7. * Corporation and others. All Rights Reserved.
  8. *
  9. ******************************************************************************
  10. *
  11. * FILE NAME : putilimp.h
  12. *
  13. * Date Name Description
  14. * 10/17/04 grhoten Move internal functions from putil.h to this file.
  15. ******************************************************************************
  16. */
  17. #ifndef PUTILIMP_H
  18. #define PUTILIMP_H
  19. #include "unicode/utypes.h"
  20. #include "unicode/putil.h"
  21. /**
  22. * \def U_SIGNED_RIGHT_SHIFT_IS_ARITHMETIC
  23. * Nearly all CPUs and compilers implement a right-shift of a signed integer
  24. * as an Arithmetic Shift Right which copies the sign bit (the Most Significant Bit (MSB))
  25. * into the vacated bits (sign extension).
  26. * For example, (int32_t)0xfff5fff3>>4 becomes 0xffff5fff and -1>>1=-1.
  27. *
  28. * This can be useful for storing a signed value in the upper bits
  29. * and another bit field in the lower bits.
  30. * The signed value can be retrieved by simple right-shifting.
  31. *
  32. * This is consistent with the Java language.
  33. *
  34. * However, the C standard allows compilers to implement a right-shift of a signed integer
  35. * as a Logical Shift Right which copies a 0 into the vacated bits.
  36. * For example, (int32_t)0xfff5fff3>>4 becomes 0x0fff5fff and -1>>1=0x7fffffff.
  37. *
  38. * Code that depends on the natural behavior should be guarded with this macro,
  39. * with an alternate path for unusual platforms.
  40. * @internal
  41. */
  42. #ifdef U_SIGNED_RIGHT_SHIFT_IS_ARITHMETIC
  43. /* Use the predefined value. */
  44. #else
  45. /*
  46. * Nearly all CPUs & compilers implement a right-shift of a signed integer
  47. * as an Arithmetic Shift Right (with sign extension).
  48. */
  49. # define U_SIGNED_RIGHT_SHIFT_IS_ARITHMETIC 1
  50. #endif
  51. /** Define this to 1 if your platform supports IEEE 754 floating point,
  52. to 0 if it does not. */
  53. #ifndef IEEE_754
  54. # define IEEE_754 1
  55. #endif
  56. /**
  57. * uintptr_t is an optional part of the standard definitions in stdint.h.
  58. * The opengroup.org documentation for stdint.h says
  59. * "On XSI-conformant systems, the intptr_t and uintptr_t types are required;
  60. * otherwise, they are optional."
  61. * We assume that when uintptr_t is defined, UINTPTR_MAX is defined as well.
  62. *
  63. * Do not use ptrdiff_t since it is signed. size_t is unsigned.
  64. */
  65. /* TODO: This check fails on some z environments. Filed a ticket #9357 for this. */
  66. #if !defined(__intptr_t_defined) && !defined(UINTPTR_MAX) && (U_PLATFORM != U_PF_OS390)
  67. typedef size_t uintptr_t;
  68. #endif
  69. /*===========================================================================*/
  70. /** @{ Information about POSIX support */
  71. /*===========================================================================*/
  72. #ifdef U_HAVE_NL_LANGINFO_CODESET
  73. /* Use the predefined value. */
  74. #elif U_PLATFORM_USES_ONLY_WIN32_API || U_PLATFORM == U_PF_ANDROID || U_PLATFORM == U_PF_QNX
  75. # define U_HAVE_NL_LANGINFO_CODESET 0
  76. #else
  77. # define U_HAVE_NL_LANGINFO_CODESET 1
  78. #endif
  79. #ifdef U_NL_LANGINFO_CODESET
  80. /* Use the predefined value. */
  81. #elif !U_HAVE_NL_LANGINFO_CODESET
  82. # define U_NL_LANGINFO_CODESET -1
  83. #elif U_PLATFORM == U_PF_OS400
  84. /* not defined */
  85. #else
  86. # define U_NL_LANGINFO_CODESET CODESET
  87. #endif
  88. #if defined(U_TZSET) || defined(U_HAVE_TZSET)
  89. /* Use the predefined value. */
  90. #elif U_PLATFORM_USES_ONLY_WIN32_API
  91. // UWP doesn't support tzset or environment variables for tz
  92. #if U_PLATFORM_HAS_WINUWP_API == 0
  93. # define U_TZSET _tzset
  94. #endif
  95. #elif U_PLATFORM == U_PF_OS400
  96. /* not defined */
  97. #else
  98. # define U_TZSET tzset
  99. #endif
  100. #if defined(U_TIMEZONE) || defined(U_HAVE_TIMEZONE)
  101. /* Use the predefined value. */
  102. #elif U_PLATFORM == U_PF_ANDROID
  103. # define U_TIMEZONE timezone
  104. #elif defined(__UCLIBC__)
  105. // uClibc does not have __timezone or _timezone.
  106. #elif defined(_NEWLIB_VERSION)
  107. # define U_TIMEZONE _timezone
  108. #elif defined(__GLIBC__)
  109. // glibc
  110. # define U_TIMEZONE __timezone
  111. #elif U_PLATFORM_IS_LINUX_BASED
  112. // not defined
  113. #elif U_PLATFORM_USES_ONLY_WIN32_API
  114. # define U_TIMEZONE _timezone
  115. #elif U_PLATFORM == U_PF_BSD && !defined(__NetBSD__)
  116. /* not defined */
  117. #elif U_PLATFORM == U_PF_OS400
  118. /* not defined */
  119. #elif U_PLATFORM == U_PF_IPHONE
  120. /* not defined */
  121. #else
  122. # define U_TIMEZONE timezone
  123. #endif
  124. #if defined(U_TZNAME) || defined(U_HAVE_TZNAME)
  125. /* Use the predefined value. */
  126. #elif U_PLATFORM_USES_ONLY_WIN32_API
  127. /* not usable on all windows platforms */
  128. #if U_PLATFORM_HAS_WINUWP_API == 0
  129. # define U_TZNAME _tzname
  130. #endif
  131. #elif U_PLATFORM == U_PF_OS400
  132. /* not defined */
  133. #else
  134. # define U_TZNAME tzname
  135. #endif
  136. #ifdef U_HAVE_MMAP
  137. /* Use the predefined value. */
  138. #elif U_PLATFORM_USES_ONLY_WIN32_API
  139. # define U_HAVE_MMAP 0
  140. #else
  141. # define U_HAVE_MMAP 1
  142. #endif
  143. #ifdef U_HAVE_POPEN
  144. /* Use the predefined value. */
  145. #elif U_PLATFORM_USES_ONLY_WIN32_API
  146. # define U_HAVE_POPEN 0
  147. #elif U_PLATFORM == U_PF_OS400
  148. # define U_HAVE_POPEN 0
  149. #else
  150. # define U_HAVE_POPEN 1
  151. #endif
  152. /**
  153. * \def U_HAVE_DIRENT_H
  154. * Defines whether dirent.h is available.
  155. * @internal
  156. */
  157. #ifdef U_HAVE_DIRENT_H
  158. /* Use the predefined value. */
  159. #elif U_PLATFORM_USES_ONLY_WIN32_API
  160. # define U_HAVE_DIRENT_H 0
  161. #else
  162. # define U_HAVE_DIRENT_H 1
  163. #endif
  164. /** @} */
  165. /*===========================================================================*/
  166. /** @{ Programs used by ICU code */
  167. /*===========================================================================*/
  168. /**
  169. * \def U_MAKE_IS_NMAKE
  170. * Defines whether the "make" program is Windows nmake.
  171. */
  172. #ifdef U_MAKE_IS_NMAKE
  173. /* Use the predefined value. */
  174. #elif U_PLATFORM == U_PF_WINDOWS
  175. # define U_MAKE_IS_NMAKE 1
  176. #else
  177. # define U_MAKE_IS_NMAKE 0
  178. #endif
  179. /** @} */
  180. /*==========================================================================*/
  181. /* Platform utilities */
  182. /*==========================================================================*/
  183. /**
  184. * Platform utilities isolates the platform dependencies of the
  185. * library. For each platform which this code is ported to, these
  186. * functions may have to be re-implemented.
  187. */
  188. /**
  189. * Floating point utility to determine if a double is Not a Number (NaN).
  190. * @internal
  191. */
  192. U_CAPI UBool U_EXPORT2 uprv_isNaN(double d);
  193. /**
  194. * Floating point utility to determine if a double has an infinite value.
  195. * @internal
  196. */
  197. U_CAPI UBool U_EXPORT2 uprv_isInfinite(double d);
  198. /**
  199. * Floating point utility to determine if a double has a positive infinite value.
  200. * @internal
  201. */
  202. U_CAPI UBool U_EXPORT2 uprv_isPositiveInfinity(double d);
  203. /**
  204. * Floating point utility to determine if a double has a negative infinite value.
  205. * @internal
  206. */
  207. U_CAPI UBool U_EXPORT2 uprv_isNegativeInfinity(double d);
  208. /**
  209. * Floating point utility that returns a Not a Number (NaN) value.
  210. * @internal
  211. */
  212. U_CAPI double U_EXPORT2 uprv_getNaN(void);
  213. /**
  214. * Floating point utility that returns an infinite value.
  215. * @internal
  216. */
  217. U_CAPI double U_EXPORT2 uprv_getInfinity(void);
  218. /**
  219. * Floating point utility to truncate a double.
  220. * @internal
  221. */
  222. U_CAPI double U_EXPORT2 uprv_trunc(double d);
  223. /**
  224. * Floating point utility to calculate the floor of a double.
  225. * @internal
  226. */
  227. U_CAPI double U_EXPORT2 uprv_floor(double d);
  228. /**
  229. * Floating point utility to calculate the ceiling of a double.
  230. * @internal
  231. */
  232. U_CAPI double U_EXPORT2 uprv_ceil(double d);
  233. /**
  234. * Floating point utility to calculate the absolute value of a double.
  235. * @internal
  236. */
  237. U_CAPI double U_EXPORT2 uprv_fabs(double d);
  238. /**
  239. * Floating point utility to calculate the fractional and integer parts of a double.
  240. * @internal
  241. */
  242. U_CAPI double U_EXPORT2 uprv_modf(double d, double* pinteger);
  243. /**
  244. * Floating point utility to calculate the remainder of a double divided by another double.
  245. * @internal
  246. */
  247. U_CAPI double U_EXPORT2 uprv_fmod(double d, double y);
  248. /**
  249. * Floating point utility to calculate d to the power of exponent (d^exponent).
  250. * @internal
  251. */
  252. U_CAPI double U_EXPORT2 uprv_pow(double d, double exponent);
  253. /**
  254. * Floating point utility to calculate 10 to the power of exponent (10^exponent).
  255. * @internal
  256. */
  257. U_CAPI double U_EXPORT2 uprv_pow10(int32_t exponent);
  258. /**
  259. * Floating point utility to calculate the maximum value of two doubles.
  260. * @internal
  261. */
  262. U_CAPI double U_EXPORT2 uprv_fmax(double d, double y);
  263. /**
  264. * Floating point utility to calculate the minimum value of two doubles.
  265. * @internal
  266. */
  267. U_CAPI double U_EXPORT2 uprv_fmin(double d, double y);
  268. /**
  269. * Private utility to calculate the maximum value of two integers.
  270. * @internal
  271. */
  272. U_CAPI int32_t U_EXPORT2 uprv_max(int32_t d, int32_t y);
  273. /**
  274. * Private utility to calculate the minimum value of two integers.
  275. * @internal
  276. */
  277. U_CAPI int32_t U_EXPORT2 uprv_min(int32_t d, int32_t y);
  278. #if U_IS_BIG_ENDIAN
  279. # define uprv_isNegative(number) (*((signed char *)&(number))<0)
  280. #else
  281. # define uprv_isNegative(number) (*((signed char *)&(number)+sizeof(number)-1)<0)
  282. #endif
  283. /**
  284. * Return the largest positive number that can be represented by an integer
  285. * type of arbitrary bit length.
  286. * @internal
  287. */
  288. U_CAPI double U_EXPORT2 uprv_maxMantissa(void);
  289. /**
  290. * Floating point utility to calculate the logarithm of a double.
  291. * @internal
  292. */
  293. U_CAPI double U_EXPORT2 uprv_log(double d);
  294. /**
  295. * Does common notion of rounding e.g. uprv_floor(x + 0.5);
  296. * @param x the double number
  297. * @return the rounded double
  298. * @internal
  299. */
  300. U_CAPI double U_EXPORT2 uprv_round(double x);
  301. /**
  302. * Adds the signed integers a and b, storing the result in res.
  303. * Checks for signed integer overflow.
  304. * Similar to the GCC/Clang extension __builtin_add_overflow
  305. *
  306. * @param a The first operand.
  307. * @param b The second operand.
  308. * @param res a + b
  309. * @return true if overflow occurred; false if no overflow occurred.
  310. * @internal
  311. */
  312. U_CAPI UBool U_EXPORT2 uprv_add32_overflow(int32_t a, int32_t b, int32_t* res);
  313. /**
  314. * Multiplies the signed integers a and b, storing the result in res.
  315. * Checks for signed integer overflow.
  316. * Similar to the GCC/Clang extension __builtin_mul_overflow
  317. *
  318. * @param a The first multiplicand.
  319. * @param b The second multiplicand.
  320. * @param res a * b
  321. * @return true if overflow occurred; false if no overflow occurred.
  322. * @internal
  323. */
  324. U_CAPI UBool U_EXPORT2 uprv_mul32_overflow(int32_t a, int32_t b, int32_t* res);
  325. #if 0
  326. /**
  327. * Returns the number of digits after the decimal point in a double number x.
  328. *
  329. * @param x the double number
  330. * @return the number of digits after the decimal point in a double number x.
  331. * @internal
  332. */
  333. /*U_CAPI int32_t U_EXPORT2 uprv_digitsAfterDecimal(double x);*/
  334. #endif
  335. #if !U_CHARSET_IS_UTF8
  336. /**
  337. * Please use ucnv_getDefaultName() instead.
  338. * Return the default codepage for this platform and locale.
  339. * This function can call setlocale() on Unix platforms. Please read the
  340. * platform documentation on setlocale() before calling this function.
  341. * @return the default codepage for this platform
  342. * @internal
  343. */
  344. U_CAPI const char* U_EXPORT2 uprv_getDefaultCodepage(void);
  345. #endif
  346. /**
  347. * Please use uloc_getDefault() instead.
  348. * Return the default locale ID string by querying the system, or
  349. * zero if one cannot be found.
  350. * This function can call setlocale() on Unix platforms. Please read the
  351. * platform documentation on setlocale() before calling this function.
  352. * @return the default locale ID string
  353. * @internal
  354. */
  355. U_CAPI const char* U_EXPORT2 uprv_getDefaultLocaleID(void);
  356. /**
  357. * Time zone utilities
  358. *
  359. * Wrappers for C runtime library functions relating to timezones.
  360. * The t_tzset() function (similar to tzset) uses the current setting
  361. * of the environment variable TZ to assign values to three global
  362. * variables: daylight, timezone, and tzname. These variables have the
  363. * following meanings, and are declared in &lt;time.h&gt;.
  364. *
  365. * daylight Nonzero if daylight-saving-time zone (DST) is specified
  366. * in TZ; otherwise, 0. Default value is 1.
  367. * timezone Difference in seconds between coordinated universal
  368. * time and local time. E.g., -28,800 for PST (GMT-8hrs)
  369. * tzname(0) Three-letter time-zone name derived from TZ environment
  370. * variable. E.g., "PST".
  371. * tzname(1) Three-letter DST zone name derived from TZ environment
  372. * variable. E.g., "PDT". If DST zone is omitted from TZ,
  373. * tzname(1) is an empty string.
  374. *
  375. * Notes: For example, to set the TZ environment variable to correspond
  376. * to the current time zone in Germany, you can use one of the
  377. * following statements:
  378. *
  379. * set TZ=GST1GDT
  380. * set TZ=GST+1GDT
  381. *
  382. * If the TZ value is not set, t_tzset() attempts to use the time zone
  383. * information specified by the operating system. Under Windows NT
  384. * and Windows 95, this information is specified in the Control Panel's
  385. * Date/Time application.
  386. * @internal
  387. */
  388. U_CAPI void U_EXPORT2 uprv_tzset(void);
  389. /**
  390. * Difference in seconds between coordinated universal
  391. * time and local time. E.g., -28,800 for PST (GMT-8hrs)
  392. * @return the difference in seconds between coordinated universal time and local time.
  393. * @internal
  394. */
  395. U_CAPI int32_t U_EXPORT2 uprv_timezone(void);
  396. /**
  397. * tzname(0) Three-letter time-zone name derived from TZ environment
  398. * variable. E.g., "PST".
  399. * tzname(1) Three-letter DST zone name derived from TZ environment
  400. * variable. E.g., "PDT". If DST zone is omitted from TZ,
  401. * tzname(1) is an empty string.
  402. * @internal
  403. */
  404. U_CAPI const char* U_EXPORT2 uprv_tzname(int n);
  405. /**
  406. * Reset the global tzname cache.
  407. * @internal
  408. */
  409. U_CAPI void uprv_tzname_clear_cache(void);
  410. /**
  411. * Get UTC (GMT) time measured in milliseconds since 0:00 on 1/1/1970.
  412. * This function is affected by 'faketime' and should be the bottleneck for all user-visible ICU time functions.
  413. * @return the UTC time measured in milliseconds
  414. * @internal
  415. */
  416. U_CAPI UDate U_EXPORT2 uprv_getUTCtime(void);
  417. /**
  418. * Get UTC (GMT) time measured in milliseconds since 0:00 on 1/1/1970.
  419. * This function is not affected by 'faketime', so it should only be used by low level test functions- not by anything that
  420. * exposes time to the end user.
  421. * @return the UTC time measured in milliseconds
  422. * @internal
  423. */
  424. U_CAPI UDate U_EXPORT2 uprv_getRawUTCtime(void);
  425. /**
  426. * Determine whether a pathname is absolute or not, as defined by the platform.
  427. * @param path Pathname to test
  428. * @return true if the path is absolute
  429. * @internal (ICU 3.0)
  430. */
  431. U_CAPI UBool U_EXPORT2 uprv_pathIsAbsolute(const char *path);
  432. /**
  433. * Use U_MAX_PTR instead of this function.
  434. * @param void pointer to test
  435. * @return the largest possible pointer greater than the base
  436. * @internal (ICU 3.8)
  437. */
  438. U_CAPI void * U_EXPORT2 uprv_maximumPtr(void *base);
  439. /**
  440. * Maximum value of a (void*) - use to indicate the limit of an 'infinite' buffer.
  441. * In fact, buffer sizes must not exceed 2GB so that the difference between
  442. * the buffer limit and the buffer start can be expressed in an int32_t.
  443. *
  444. * The definition of U_MAX_PTR must fulfill the following conditions:
  445. * - return the largest possible pointer greater than base
  446. * - return a valid pointer according to the machine architecture (AS/400, 64-bit, etc.)
  447. * - avoid wrapping around at high addresses
  448. * - make sure that the returned pointer is not farther from base than 0x7fffffff bytes
  449. *
  450. * @param base The beginning of a buffer to find the maximum offset from
  451. * @internal
  452. */
  453. #ifndef U_MAX_PTR
  454. # if U_PLATFORM == U_PF_OS390 && !defined(_LP64)
  455. /* We have 31-bit pointers. */
  456. # define U_MAX_PTR(base) ((void *)0x7fffffff)
  457. # elif U_PLATFORM == U_PF_OS400
  458. # define U_MAX_PTR(base) uprv_maximumPtr((void *)base)
  459. # elif 0
  460. /*
  461. * For platforms where pointers are scalar values (which is normal, but unlike i5/OS)
  462. * but that do not define uintptr_t.
  463. *
  464. * However, this does not work on modern compilers:
  465. * The C++ standard does not define pointer overflow, and allows compilers to
  466. * assume that p+u>p for any pointer p and any integer u>0.
  467. * Thus, modern compilers optimize away the ">" comparison.
  468. * (See ICU tickets #7187 and #8096.)
  469. */
  470. # define U_MAX_PTR(base) \
  471. ((void *)(((char *)(base)+0x7fffffffu) > (char *)(base) \
  472. ? ((char *)(base)+0x7fffffffu) \
  473. : (char *)-1))
  474. # else
  475. /* Default version. C++ standard compliant for scalar pointers. */
  476. # define U_MAX_PTR(base) \
  477. ((void *)(((uintptr_t)(base)+0x7fffffffu) > (uintptr_t)(base) \
  478. ? ((uintptr_t)(base)+0x7fffffffu) \
  479. : (uintptr_t)-1))
  480. # endif
  481. #endif
  482. #ifdef __cplusplus
  483. /**
  484. * Pin a buffer capacity such that doing pointer arithmetic
  485. * on the destination pointer and capacity cannot overflow.
  486. *
  487. * The pinned capacity must fulfill the following conditions (for positive capacities):
  488. * - dest + capacity is a valid pointer according to the machine architecture (AS/400, 64-bit, etc.)
  489. * - (dest + capacity) >= dest
  490. * - The size (in bytes) of T[capacity] does not exceed 0x7fffffff
  491. *
  492. * @param dest the destination buffer pointer.
  493. * @param capacity the requested buffer capacity, in units of type T.
  494. * @return the pinned capacity.
  495. * @internal
  496. */
  497. template <typename T>
  498. inline int32_t pinCapacity(T *dest, int32_t capacity) {
  499. if (capacity <= 0) { return capacity; }
  500. uintptr_t destInt = (uintptr_t)dest;
  501. uintptr_t maxInt;
  502. # if U_PLATFORM == U_PF_OS390 && !defined(_LP64)
  503. // We have 31-bit pointers.
  504. maxInt = 0x7fffffff;
  505. # elif U_PLATFORM == U_PF_OS400
  506. maxInt = (uintptr_t)uprv_maximumPtr((void *)dest);
  507. # else
  508. maxInt = destInt + 0x7fffffffu;
  509. if (maxInt < destInt) {
  510. // Less than 2GB to the end of the address space.
  511. // Pin to that to prevent address overflow.
  512. maxInt = (uintptr_t)-1;
  513. }
  514. # endif
  515. uintptr_t maxBytes = maxInt - destInt; // max. 2GB
  516. int32_t maxCapacity = (int32_t)(maxBytes / sizeof(T));
  517. return capacity <= maxCapacity ? capacity : maxCapacity;
  518. }
  519. #endif // __cplusplus
  520. /* Dynamic Library Functions */
  521. typedef void (UVoidFunction)(void);
  522. #if U_ENABLE_DYLOAD
  523. /**
  524. * Load a library
  525. * @internal (ICU 4.4)
  526. */
  527. U_CAPI void * U_EXPORT2 uprv_dl_open(const char *libName, UErrorCode *status);
  528. /**
  529. * Close a library
  530. * @internal (ICU 4.4)
  531. */
  532. U_CAPI void U_EXPORT2 uprv_dl_close( void *lib, UErrorCode *status);
  533. /**
  534. * Extract a symbol from a library (function)
  535. * @internal (ICU 4.8)
  536. */
  537. U_CAPI UVoidFunction* U_EXPORT2 uprv_dlsym_func( void *lib, const char *symbolName, UErrorCode *status);
  538. /**
  539. * Extract a symbol from a library (function)
  540. * Not implemented, no clients.
  541. * @internal
  542. */
  543. /* U_CAPI void * U_EXPORT2 uprv_dlsym_data( void *lib, const char *symbolName, UErrorCode *status); */
  544. #endif
  545. /**
  546. * Define malloc and related functions
  547. * @internal
  548. */
  549. #if U_PLATFORM == U_PF_OS400
  550. # define uprv_default_malloc(x) _C_TS_malloc(x)
  551. # define uprv_default_realloc(x,y) _C_TS_realloc(x,y)
  552. # define uprv_default_free(x) _C_TS_free(x)
  553. /* also _C_TS_calloc(x) */
  554. #else
  555. /* C defaults */
  556. # define uprv_default_malloc(x) malloc(x)
  557. # define uprv_default_realloc(x,y) realloc(x,y)
  558. # define uprv_default_free(x) free(x)
  559. #endif
  560. #endif