00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef PUTIL_H
00025 #define PUTIL_H
00026
00027 #include "unicode/utypes.h"
00028
00031 #ifndef IEEE_754
00032 # define IEEE_754 1
00033 #endif
00034
00035
00036
00037
00045
00046
00047 U_CAPI UBool U_EXPORT2 uprv_isNaN(double);
00048 U_CAPI UBool U_EXPORT2 uprv_isInfinite(double);
00049 U_CAPI UBool U_EXPORT2 uprv_isPositiveInfinity(double);
00050 U_CAPI UBool U_EXPORT2 uprv_isNegativeInfinity(double);
00051 U_CAPI double U_EXPORT2 uprv_getNaN(void);
00052 U_CAPI double U_EXPORT2 uprv_getInfinity(void);
00053
00054 U_CAPI double U_EXPORT2 uprv_trunc(double d);
00055 U_CAPI double U_EXPORT2 uprv_floor(double x);
00056 U_CAPI double U_EXPORT2 uprv_ceil(double x);
00057 U_CAPI double U_EXPORT2 uprv_fabs(double x);
00058 U_CAPI double U_EXPORT2 uprv_modf(double x, double* y);
00059 U_CAPI double U_EXPORT2 uprv_fmod(double x, double y);
00060 U_CAPI double U_EXPORT2 uprv_pow(double x, double y);
00061 U_CAPI double U_EXPORT2 uprv_pow10(int32_t x);
00062 U_CAPI double U_EXPORT2 uprv_fmax(double x, double y);
00063 U_CAPI double U_EXPORT2 uprv_fmin(double x, double y);
00064 U_CAPI int32_t U_EXPORT2 uprv_max(int32_t x, int32_t y);
00065 U_CAPI int32_t U_EXPORT2 uprv_min(int32_t x, int32_t y);
00066
00067 #if U_IS_BIG_ENDIAN
00068 # define uprv_isNegative(number) (*((signed char *)&(number))<0)
00069 #else
00070 # define uprv_isNegative(number) (*((signed char *)&(number)+sizeof(number)-1)<0)
00071 #endif
00072
00079 U_CAPI double U_EXPORT2 uprv_maxMantissa(void);
00080
00092 U_CAPI int16_t U_EXPORT2 uprv_log10(double d);
00093
00094 U_CAPI double U_EXPORT2 uprv_log(double d);
00101 U_CAPI double U_EXPORT2 uprv_round(double x);
00102
00109 U_CAPI int32_t U_EXPORT2 uprv_digitsAfterDecimal(double x);
00110
00143 U_CAPI void U_EXPORT2 uprv_tzset(void);
00144
00150 U_CAPI int32_t U_EXPORT2 uprv_timezone(void);
00151
00159 U_CAPI char* U_EXPORT2 uprv_tzname(int n);
00160
00166 U_CAPI int32_t U_EXPORT2 uprv_getUTCtime(void);
00167
00189 U_CAPI const char* U_EXPORT2 u_getDataDirectory(void);
00190
00204 U_CAPI void U_EXPORT2 u_setDataDirectory(const char *directory);
00205
00211 U_CAPI const char* U_EXPORT2 uprv_getDefaultCodepage(void);
00212
00219 U_CAPI const char* U_EXPORT2 uprv_getDefaultLocaleID(void);
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232 U_CAPI double U_EXPORT2 uprv_nextDouble(double d, UBool positive);
00233
00239 #ifdef XP_MAC
00240 # define U_FILE_SEP_CHAR ':'
00241 # define U_PATH_SEP_CHAR ';'
00242 # define U_FILE_SEP_STRING ":"
00243 # define U_PATH_SEP_STRING ";"
00244 #elif defined(WIN32) || defined(OS2)
00245 # define U_FILE_SEP_CHAR '\\'
00246 # define U_PATH_SEP_CHAR ';'
00247 # define U_FILE_SEP_STRING "\\"
00248 # define U_PATH_SEP_STRING ";"
00249 #else
00250 # define U_FILE_SEP_CHAR '/'
00251 # define U_PATH_SEP_CHAR ':'
00252 # define U_FILE_SEP_STRING "/"
00253 # define U_PATH_SEP_STRING ":"
00254 #endif
00255
00272 U_CAPI void U_EXPORT2
00273 u_charsToUChars(const char *cs, UChar *us, int32_t length);
00274
00292 U_CAPI void U_EXPORT2
00293 u_UCharsToChars(const UChar *us, char *cs, int32_t length);
00294
00295
00296 #if U_CHARSET_FAMILY==U_ASCII_FAMILY
00297 # define U_UPPER_ORDINAL(x) ((x)-'A')
00298 #elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
00299 # define U_UPPER_ORDINAL(x) (((x) < 'J') ? ((x)-'A') : \
00300 (((x) < 'S') ? ((x)-'J'+9) : \
00301 ((x)-'S'+18)))
00302 #else
00303 # error Unknown charset family!
00304 #endif
00305
00320 #ifndef U_MAX_PTR
00321 # ifdef OS390
00322 # define U_MAX_PTR(base) ((void *)0x7fffffff)
00323 # elif defined(OS400)
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336 # define U_MAX_PTR(base) ((void *)(((char *)base)-((int32_t)(base))+((int32_t)0xffefff)))
00337 # else
00338 # define U_MAX_PTR(base) ((void *)(((char *)(base)+0x7fffffff) > (char *)(base) ? ((char *)(base)+0x7fffffff) : (char *)-1))
00339 # endif
00340 #endif
00341
00342 #endif