putil.h File Reference

#include "unicode/utypes.h"

Go to the source code of this file.

Defines

#define IEEE_754   1
#define uprv_isNegative(number)   (*((signed char *)&(number)+sizeof(number)-1)<0)
#define U_FILE_SEP_CHAR   '/'
 Filesystem file and path separator characters.

#define U_FILE_ALT_SEP_CHAR   '/'
#define U_PATH_SEP_CHAR   ':'
#define U_FILE_SEP_STRING   "/"
#define U_FILE_ALT_SEP_STRING   "/"
#define U_PATH_SEP_STRING   ":"
#define U_UPPER_ORDINAL(x)   ((x)-'A')
 Get the ordinal number of an uppercase invariant character.

#define U_MAX_PTR(base)   ((void *)(((char *)(base)+0x7fffffffu) > (char *)(base) ? ((char *)(base)+0x7fffffffu) : (char *)-1))
 Maximum value of a (void*) - use to indicate the limit of an 'infinite' buffer.


Functions

U_INTERNAL UBool U_EXPORT2 uprv_isNaN (double d)
 Floating point utility to determine if a double is Not a Number (NaN).

U_INTERNAL UBool U_EXPORT2 uprv_isInfinite (double d)
 Floating point utility to determine if a double has an infinite value.

U_INTERNAL UBool U_EXPORT2 uprv_isPositiveInfinity (double d)
 Floating point utility to determine if a double has a positive infinite value.

U_INTERNAL UBool U_EXPORT2 uprv_isNegativeInfinity (double d)
 Floating point utility to determine if a double has a negative infinite value.

U_INTERNAL double U_EXPORT2 uprv_getNaN (void)
 Floating point utility that returns a Not a Number (NaN) value.

U_INTERNAL double U_EXPORT2 uprv_getInfinity (void)
 Floating point utility that returns an infinite value.

U_INTERNAL double U_EXPORT2 uprv_trunc (double d)
 Floating point utility to truncate a double.

U_INTERNAL double U_EXPORT2 uprv_floor (double d)
 Floating point utility to calculate the floor of a double.

U_INTERNAL double U_EXPORT2 uprv_ceil (double d)
 Floating point utility to calculate the ceiling of a double.

U_INTERNAL double U_EXPORT2 uprv_fabs (double d)
 Floating point utility to calculate the absolute value of a double.

U_INTERNAL double U_EXPORT2 uprv_modf (double d, double *pinteger)
 Floating point utility to calculate the fractional and integer parts of a double.

U_INTERNAL double U_EXPORT2 uprv_fmod (double d, double y)
 Floating point utility to calculate the remainder of a double divided by another double.

U_INTERNAL double U_EXPORT2 uprv_pow (double d, double exponent)
 Floating point utility to calculate d to the power of exponent (d^exponent).

U_INTERNAL double U_EXPORT2 uprv_pow10 (int32_t exponent)
 Floating point utility to calculate 10 to the power of exponent (10^exponent).

U_INTERNAL double U_EXPORT2 uprv_fmax (double d, double y)
 Floating point utility to calculate the maximum value of two doubles.

U_INTERNAL double U_EXPORT2 uprv_fmin (double d, double y)
 Floating point utility to calculate the minimum value of two doubles.

U_INTERNAL int32_t U_EXPORT2 uprv_max (int32_t d, int32_t y)
 Private utility to calculate the maximum value of two integers.

U_INTERNAL int32_t U_EXPORT2 uprv_min (int32_t d, int32_t y)
 Private utility to calculate the minimum value of two integers.

U_INTERNAL double U_EXPORT2 uprv_maxMantissa (void)
 Return the largest positive number that can be represented by an integer type of arbitrary bit length.

U_INTERNAL int16_t U_EXPORT2 uprv_log10 (double d)
 Return the floor of the log base 10 of a given double.

U_INTERNAL double U_EXPORT2 uprv_log (double d)
 Floating point utility to calculate the logarithm of a double.

U_INTERNAL double U_EXPORT2 uprv_round (double x)
 Does common notion of rounding e.g.

U_INTERNAL void U_EXPORT2 uprv_tzset (void)
 Time zone utilities.

U_STABLE int32_t U_EXPORT2 uprv_timezone (void)
 Difference in seconds between coordinated universal time and local time.

U_INTERNAL char *U_EXPORT2 uprv_tzname (int n)
 tzname(0) Three-letter time-zone name derived from TZ environment variable.

U_INTERNAL int32_t U_EXPORT2 uprv_getUTCtime (void)
 Get UTC (GMT) time measured in seconds since 0:00 on 1/1/70.

U_STABLE const char *U_EXPORT2 u_getDataDirectory (void)
 Return the ICU data directory.

U_STABLE void U_EXPORT2 u_setDataDirectory (const char *directory)
 Set the ICU data directory.

U_INTERNAL const char *U_EXPORT2 uprv_getDefaultCodepage (void)
 Please use ucnv_getDefaultName() instead.

U_INTERNAL const char *U_EXPORT2 uprv_getDefaultLocaleID (void)
 Please use uloc_getDefault() instead.

U_INTERNAL UBool U_EXPORT2 uprv_pathIsAbsolute (const char *path)
 Determine whether a pathname is absolute or not, as defined by the platform.

U_STABLE void U_EXPORT2 u_charsToUChars (const char *cs, UChar *us, int32_t length)
 Convert char characters to UChar characters.

U_STABLE void U_EXPORT2 u_UCharsToChars (const UChar *us, char *cs, int32_t length)
 Convert UChar characters to char characters.

U_INTERNAL UBool U_EXPORT2 uprv_isInvariantString (const char *s, int32_t length)
 Check if a char string only contains invariant characters.

U_INTERNAL UBool U_EXPORT2 uprv_isInvariantUString (const UChar *s, int32_t length)
 Check if a Unicode string only contains invariant characters.


Define Documentation

#define IEEE_754   1
 

Definition at line 32 of file putil.h.

#define U_FILE_ALT_SEP_CHAR   '/'
 

Definition at line 391 of file putil.h.

#define U_FILE_ALT_SEP_STRING   "/"
 

Definition at line 394 of file putil.h.

#define U_FILE_SEP_CHAR   '/'
 

Filesystem file and path separator characters.

Example: '/' and ':' on Unix, '\' and ';' on Windows.

Stable:
ICU 2.0

Definition at line 390 of file putil.h.

#define U_FILE_SEP_STRING   "/"
 

Definition at line 393 of file putil.h.

#define U_MAX_PTR base   )     ((void *)(((char *)(base)+0x7fffffffu) > (char *)(base) ? ((char *)(base)+0x7fffffffu) : (char *)-1))
 

Maximum value of a (void*) - use to indicate the limit of an 'infinite' buffer.

In fact, buffer sizes must not exceed 2GB so that the difference between the buffer limit and the buffer start can be expressed in an int32_t.

The definition of U_MAX_PTR must fulfill the following conditions:

  • return the largest possible pointer greater than base
  • return a valid pointer according to the machine architecture (AS/400, 64-bit, etc.)
  • avoid wrapping around at high addresses
  • make sure that the returned pointer is not farther from base than 0x7fffffff

Parameters:
base The beginning of a buffer to find the maximum offset from
Internal:
Do not use. This API is for interal use only.

Definition at line 530 of file putil.h.

#define U_PATH_SEP_CHAR   ':'
 

Definition at line 392 of file putil.h.

#define U_PATH_SEP_STRING   ":"
 

Definition at line 395 of file putil.h.

#define U_UPPER_ORDINAL  )     ((x)-'A')
 

Get the ordinal number of an uppercase invariant character.

Internal:
Do not use. This API is for interal use only.

Definition at line 487 of file putil.h.

#define uprv_isNegative number   )     (*((signed char *)&(number)+sizeof(number)-1)<0)
 

Definition at line 176 of file putil.h.


Function Documentation

U_STABLE void U_EXPORT2 u_charsToUChars const char *  cs,
UChar us,
int32_t  length
 

Convert char characters to UChar characters.

This utility function is useful only for "invariant characters" that are encoded in the platform default encoding. They are a small, constant subset of the encoding and include just the latin letters, digits, and some punctuation. For details, see utypes.h .

Parameters:
cs Input string, points to length character bytes from a subset of the platform encoding.
us Output string, points to memory for length Unicode characters.
length The number of characters to convert; this may include the terminating NUL.
Stable:
ICU 2.0

U_STABLE const char* U_EXPORT2 u_getDataDirectory void   ) 
 

Return the ICU data directory.

The data directory is where common format ICU data files (.dat files) are loaded from. Note that normal use of the built-in ICU facilities does not require loading of an external data file; unless you are adding custom data to ICU, the data directory does not need to be set.

The data directory is determined as follows: If u_setDataDirectory() has been called, that is it, otherwise if the ICU_DATA environment variable is set, use that, otherwise If a data directory was specifed at ICU build time (#define ICU_DATA_DIR "path"), use that, otherwise no data directory is available.

Returns:
the data directory, or an empty string ("") if no data directory has been specified.
Stable:
ICU 2.0

U_STABLE void U_EXPORT2 u_setDataDirectory const char *  directory  ) 
 

Set the ICU data directory.

The data directory is where common format ICU data files (.dat files) are loaded from. Note that normal use of the built-in ICU facilities does not require loading of an external data file; unless you are adding custom data to ICU, the data directory does not need to be set.

This function should be called at most once in a process, before the first ICU operation (e.g., u_init()) that will require the loading of an ICU data file. This function is not thread-safe. Use it before calling ICU APIs from multiple threads.

Parameters:
directory The directory to be set.
See also:
u_init
Stable:
ICU 2.0

U_STABLE void U_EXPORT2 u_UCharsToChars const UChar us,
char *  cs,
int32_t  length
 

Convert UChar characters to char characters.

This utility function is useful only for "invariant characters" that can be encoded in the platform default encoding. They are a small, constant subset of the encoding and include just the latin letters, digits, and some punctuation. For details, see utypes.h .

Parameters:
us Input string, points to length Unicode characters that can be encoded with the codepage-invariant subset of the platform encoding.
cs Output string, points to memory for length character bytes.
length The number of characters to convert; this may include the terminating NUL.
Stable:
ICU 2.0

U_INTERNAL double U_EXPORT2 uprv_ceil double  d  ) 
 

Floating point utility to calculate the ceiling of a double.

Internal:
Do not use. This API is for interal use only.

U_INTERNAL double U_EXPORT2 uprv_fabs double  d  ) 
 

Floating point utility to calculate the absolute value of a double.

Internal:
Do not use. This API is for interal use only.

U_INTERNAL double U_EXPORT2 uprv_floor double  d  ) 
 

Floating point utility to calculate the floor of a double.

Internal:
Do not use. This API is for interal use only.

U_INTERNAL double U_EXPORT2 uprv_fmax double  d,
double  y
 

Floating point utility to calculate the maximum value of two doubles.

Internal:
Do not use. This API is for interal use only.

U_INTERNAL double U_EXPORT2 uprv_fmin double  d,
double  y
 

Floating point utility to calculate the minimum value of two doubles.

Internal:
Do not use. This API is for interal use only.

U_INTERNAL double U_EXPORT2 uprv_fmod double  d,
double  y
 

Floating point utility to calculate the remainder of a double divided by another double.

Internal:
Do not use. This API is for interal use only.

U_INTERNAL const char* U_EXPORT2 uprv_getDefaultCodepage void   ) 
 

Please use ucnv_getDefaultName() instead.

Return the default codepage for this platform and locale. This function can call setlocale() on Unix platforms. Please read the platform documentation on setlocale() before calling this function.

Returns:
the default codepage for this platform
Internal:
Do not use. This API is for interal use only.

U_INTERNAL const char* U_EXPORT2 uprv_getDefaultLocaleID void   ) 
 

Please use uloc_getDefault() instead.

Return the default locale ID string by querying ths system, or zero if one cannot be found. This function can call setlocale() on Unix platforms. Please read the platform documentation on setlocale() before calling this function.

Returns:
the default locale ID string
Internal:
Do not use. This API is for interal use only.

U_INTERNAL double U_EXPORT2 uprv_getInfinity void   ) 
 

Floating point utility that returns an infinite value.

Internal:
Do not use. This API is for interal use only.

U_INTERNAL double U_EXPORT2 uprv_getNaN void   ) 
 

Floating point utility that returns a Not a Number (NaN) value.

Internal:
Do not use. This API is for interal use only.

U_INTERNAL int32_t U_EXPORT2 uprv_getUTCtime void   ) 
 

Get UTC (GMT) time measured in seconds since 0:00 on 1/1/70.

Returns:
the UTC time measured in seconds
Internal:
Do not use. This API is for interal use only.

U_INTERNAL UBool U_EXPORT2 uprv_isInfinite double  d  ) 
 

Floating point utility to determine if a double has an infinite value.

Internal:
Do not use. This API is for interal use only.

U_INTERNAL UBool U_EXPORT2 uprv_isInvariantString const char *  s,
int32_t  length
 

Check if a char string only contains invariant characters.

See utypes.h for details.

Parameters:
s Input string pointer.
length Length of the string, can be -1 if NUL-terminated.
Returns:
TRUE if s contains only invariant characters.
Internal:
Do not use. This API is for interal use only. (ICU 2.8)

U_INTERNAL UBool U_EXPORT2 uprv_isInvariantUString const UChar s,
int32_t  length
 

Check if a Unicode string only contains invariant characters.

See utypes.h for details.

Parameters:
s Input string pointer.
length Length of the string, can be -1 if NUL-terminated.
Returns:
TRUE if s contains only invariant characters.
Internal:
Do not use. This API is for interal use only. (ICU 2.8)

U_INTERNAL UBool U_EXPORT2 uprv_isNaN double  d  ) 
 

Floating point utility to determine if a double is Not a Number (NaN).

Internal:
Do not use. This API is for interal use only.

U_INTERNAL UBool U_EXPORT2 uprv_isNegativeInfinity double  d  ) 
 

Floating point utility to determine if a double has a negative infinite value.

Internal:
Do not use. This API is for interal use only.

U_INTERNAL UBool U_EXPORT2 uprv_isPositiveInfinity double  d  ) 
 

Floating point utility to determine if a double has a positive infinite value.

Internal:
Do not use. This API is for interal use only.

U_INTERNAL double U_EXPORT2 uprv_log double  d  ) 
 

Floating point utility to calculate the logarithm of a double.

Internal:
Do not use. This API is for interal use only.

U_INTERNAL int16_t U_EXPORT2 uprv_log10 double  d  ) 
 

Return the floor of the log base 10 of a given double.

This method compensates for inaccuracies which arise naturally when computing logs, and always gives the correct value. The parameter must be positive and finite. (Thanks to Alan Liu for supplying this function.)

Parameters:
d the double value to apply the common log function for.
Returns:
the log of value d.
Internal:
Do not use. This API is for interal use only.

U_INTERNAL int32_t U_EXPORT2 uprv_max int32_t  d,
int32_t  y
 

Private utility to calculate the maximum value of two integers.

Internal:
Do not use. This API is for interal use only.

U_INTERNAL double U_EXPORT2 uprv_maxMantissa void   ) 
 

Return the largest positive number that can be represented by an integer type of arbitrary bit length.

Internal:
Do not use. This API is for interal use only.

U_INTERNAL int32_t U_EXPORT2 uprv_min int32_t  d,
int32_t  y
 

Private utility to calculate the minimum value of two integers.

Internal:
Do not use. This API is for interal use only.

U_INTERNAL double U_EXPORT2 uprv_modf double  d,
double *  pinteger
 

Floating point utility to calculate the fractional and integer parts of a double.

Internal:
Do not use. This API is for interal use only.

U_INTERNAL UBool U_EXPORT2 uprv_pathIsAbsolute const char *  path  ) 
 

Determine whether a pathname is absolute or not, as defined by the platform.

Parameters:
path Pathname to test
Returns:
TRUE if the path is absolute
Internal:
Do not use. This API is for interal use only. (ICU 3.0)

U_INTERNAL double U_EXPORT2 uprv_pow double  d,
double  exponent
 

Floating point utility to calculate d to the power of exponent (d^exponent).

Internal:
Do not use. This API is for interal use only.

U_INTERNAL double U_EXPORT2 uprv_pow10 int32_t  exponent  ) 
 

Floating point utility to calculate 10 to the power of exponent (10^exponent).

Internal:
Do not use. This API is for interal use only.

U_INTERNAL double U_EXPORT2 uprv_round double  x  ) 
 

Does common notion of rounding e.g.

uprv_floor(x + 0.5);

Parameters:
x the double number
Returns:
the rounded double
Internal:
Do not use. This API is for interal use only.

U_STABLE int32_t U_EXPORT2 uprv_timezone void   ) 
 

Difference in seconds between coordinated universal time and local time.

E.g., -28,800 for PST (GMT-8hrs)

Returns:
the difference in seconds between coordinated universal time and local time.
Internal:
Do not use. This API is for interal use only.

U_INTERNAL double U_EXPORT2 uprv_trunc double  d  ) 
 

Floating point utility to truncate a double.

Internal:
Do not use. This API is for interal use only.

U_INTERNAL char* U_EXPORT2 uprv_tzname int  n  ) 
 

tzname(0) Three-letter time-zone name derived from TZ environment variable.

E.g., "PST". tzname(1) Three-letter DST zone name derived from TZ environment variable. E.g., "PDT". If DST zone is omitted from TZ, tzname(1) is an empty string.

Internal:
Do not use. This API is for interal use only.

U_INTERNAL void U_EXPORT2 uprv_tzset void   ) 
 

Time zone utilities.

Wrappers for C runtime library functions relating to timezones. The t_tzset() function (similar to tzset) uses the current setting of the environment variable TZ to assign values to three global variables: daylight, timezone, and tzname. These variables have the following meanings, and are declared in <time.h>.

daylight Nonzero if daylight-saving-time zone (DST) is specified in TZ; otherwise, 0. Default value is 1. timezone Difference in seconds between coordinated universal time and local time. E.g., -28,800 for PST (GMT-8hrs) tzname(0) Three-letter time-zone name derived from TZ environment variable. E.g., "PST". tzname(1) Three-letter DST zone name derived from TZ environment variable. E.g., "PDT". If DST zone is omitted from TZ, tzname(1) is an empty string.

Notes: For example, to set the TZ environment variable to correspond to the current time zone in Germany, you can use one of the following statements:

set TZ=GST1GDT set TZ=GST+1GDT

If the TZ value is not set, t_tzset() attempts to use the time zone information specified by the operating system. Under Windows NT and Windows 95, this information is specified in the Control Panel’s Date/Time application.

Internal:
Do not use. This API is for interal use only.


Generated on Fri Jun 18 12:36:05 2004 for ICU by doxygen 1.3.7