2 ******************************************************************************
4 * Copyright (C) 1997-2004, International Business Machines
5 * Corporation and others. All Rights Reserved.
7 ******************************************************************************
11 * Date Name Description
12 * 05/14/98 nos Creation (content moved here from utypes.h).
13 * 06/17/99 erm Added IEEE_754
14 * 07/22/98 stephen Added IEEEremainder, max, min, trunc
15 * 08/13/98 stephen Added isNegativeInfinity, isPositiveInfinity
16 * 08/24/98 stephen Added longBitsFromDouble
17 * 03/02/99 stephen Removed openFile(). Added AS400 support.
18 * 04/15/99 stephen Converted to C
19 * 11/15/99 helena Integrated S/390 changes for IEEE support.
20 * 01/11/00 helena Added u_getVersion.
21 ******************************************************************************
29 /* Define this to 1 if your platform supports IEEE 754 floating point,
30 to 0 if it does not. */
35 /*==========================================================================*/
36 /* Platform utilities */
37 /*==========================================================================*/
40 * Platform utilities isolates the platform dependencies of the
41 * libarary. For each platform which this code is ported to, these
42 * functions may have to be re-implemented.
46 * Return the ICU data directory.
47 * The data directory is where common format ICU data files (.dat files)
48 * are loaded from. Note that normal use of the built-in ICU
49 * facilities does not require loading of an external data file;
50 * unless you are adding custom data to ICU, the data directory
51 * does not need to be set.
53 * The data directory is determined as follows:
54 * If u_setDataDirectory() has been called, that is it, otherwise
55 * if the ICU_DATA environment variable is set, use that, otherwise
56 * If a data directory was specifed at ICU build time
57 * (#define ICU_DATA_DIR "path"), use that,
58 * otherwise no data directory is available.
60 * @return the data directory, or an empty string ("") if no data directory has
65 U_STABLE
const char* U_EXPORT2
u_getDataDirectory(void);
68 * Set the ICU data directory.
69 * The data directory is where common format ICU data files (.dat files)
70 * are loaded from. Note that normal use of the built-in ICU
71 * facilities does not require loading of an external data file;
72 * unless you are adding custom data to ICU, the data directory
73 * does not need to be set.
75 * This function should be called at most once in a process, before the
76 * first ICU operation (e.g., u_init()) that will require the loading of an
78 * This function is not thread-safe. Use it before calling ICU APIs from
81 * @param directory The directory to be set.
86 U_STABLE
void U_EXPORT2
u_setDataDirectory(const char *directory
);
89 * Please use ucnv_getDefaultName() instead.
90 * Return the default codepage for this platform and locale.
91 * This function can call setlocale() on Unix platforms. Please read the
92 * platform documentation on setlocale() before calling this function.
93 * @return the default codepage for this platform
96 U_INTERNAL
const char* U_EXPORT2
uprv_getDefaultCodepage(void);
99 * Please use uloc_getDefault() instead.
100 * Return the default locale ID string by querying ths system, or
101 * zero if one cannot be found.
102 * This function can call setlocale() on Unix platforms. Please read the
103 * platform documentation on setlocale() before calling this function.
104 * @return the default locale ID string
107 U_INTERNAL
const char* U_EXPORT2
uprv_getDefaultLocaleID(void);
110 * Filesystem file and path separator characters.
111 * Example: '/' and ':' on Unix, '\\' and ';' on Windows.
115 # define U_FILE_SEP_CHAR ':'
116 # define U_FILE_ALT_SEP_CHAR ':'
117 # define U_PATH_SEP_CHAR ';'
118 # define U_FILE_SEP_STRING ":"
119 # define U_FILE_ALT_SEP_STRING ":"
120 # define U_PATH_SEP_STRING ";"
121 #elif defined(WIN32) || defined(OS2)
122 # define U_FILE_SEP_CHAR '\\'
123 # define U_FILE_ALT_SEP_CHAR '/'
124 # define U_PATH_SEP_CHAR ';'
125 # define U_FILE_SEP_STRING "\\"
126 # define U_FILE_ALT_SEP_STRING "/"
127 # define U_PATH_SEP_STRING ";"
129 # define U_FILE_SEP_CHAR '/'
130 # define U_FILE_ALT_SEP_CHAR '/'
131 # define U_PATH_SEP_CHAR ':'
132 # define U_FILE_SEP_STRING "/"
133 # define U_FILE_ALT_SEP_STRING "/"
134 # define U_PATH_SEP_STRING ":"
138 * Convert char characters to UChar characters.
139 * This utility function is useful only for "invariant characters"
140 * that are encoded in the platform default encoding.
141 * They are a small, constant subset of the encoding and include
142 * just the latin letters, digits, and some punctuation.
143 * For details, see U_CHARSET_FAMILY.
145 * @param cs Input string, points to <code>length</code>
146 * character bytes from a subset of the platform encoding.
147 * @param us Output string, points to memory for <code>length</code>
148 * Unicode characters.
149 * @param length The number of characters to convert; this may
150 * include the terminating <code>NUL</code>.
152 * @see U_CHARSET_FAMILY
155 U_STABLE
void U_EXPORT2
156 u_charsToUChars(const char *cs
, UChar
*us
, int32_t length
);
159 * Convert UChar characters to char characters.
160 * This utility function is useful only for "invariant characters"
161 * that can be encoded in the platform default encoding.
162 * They are a small, constant subset of the encoding and include
163 * just the latin letters, digits, and some punctuation.
164 * For details, see U_CHARSET_FAMILY.
166 * @param us Input string, points to <code>length</code>
167 * Unicode characters that can be encoded with the
168 * codepage-invariant subset of the platform encoding.
169 * @param cs Output string, points to memory for <code>length</code>
171 * @param length The number of characters to convert; this may
172 * include the terminating <code>NUL</code>.
174 * @see U_CHARSET_FAMILY
177 U_STABLE
void U_EXPORT2
178 u_UCharsToChars(const UChar
*us
, char *cs
, int32_t length
);