]>
git.saurik.com Git - apple/javascriptcore.git/blob - icu/unicode/putil.h
2 ******************************************************************************
4 * Copyright (C) 1997-2009, 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 ******************************************************************************
27 #include "unicode/utypes.h"
30 * \brief C API: Platform Utilities
33 /** Define this to 1 if your platform supports IEEE 754 floating point,
34 to 0 if it does not. */
39 /*==========================================================================*/
40 /* Platform utilities */
41 /*==========================================================================*/
44 * Platform utilities isolates the platform dependencies of the
45 * libarary. For each platform which this code is ported to, these
46 * functions may have to be re-implemented.
50 * Return the ICU data directory.
51 * The data directory is where common format ICU data files (.dat files)
52 * are loaded from. Note that normal use of the built-in ICU
53 * facilities does not require loading of an external data file;
54 * unless you are adding custom data to ICU, the data directory
55 * does not need to be set.
57 * The data directory is determined as follows:
58 * If u_setDataDirectory() has been called, that is it, otherwise
59 * if the ICU_DATA environment variable is set, use that, otherwise
60 * If a data directory was specifed at ICU build time
63 * #define ICU_DATA_DIR "path"
66 * otherwise no data directory is available.
68 * @return the data directory, or an empty string ("") if no data directory has
73 U_STABLE
const char* U_EXPORT2
u_getDataDirectory(void);
76 * Set the ICU data directory.
77 * The data directory is where common format ICU data files (.dat files)
78 * are loaded from. Note that normal use of the built-in ICU
79 * facilities does not require loading of an external data file;
80 * unless you are adding custom data to ICU, the data directory
81 * does not need to be set.
83 * This function should be called at most once in a process, before the
84 * first ICU operation (e.g., u_init()) that will require the loading of an
86 * This function is not thread-safe. Use it before calling ICU APIs from
89 * @param directory The directory to be set.
94 U_STABLE
void U_EXPORT2
u_setDataDirectory(const char *directory
);
96 #if !U_CHARSET_IS_UTF8
98 * Please use ucnv_getDefaultName() instead.
99 * Return the default codepage for this platform and locale.
100 * This function can call setlocale() on Unix platforms. Please read the
101 * platform documentation on setlocale() before calling this function.
102 * @return the default codepage for this platform
105 U_INTERNAL
const char* U_EXPORT2
uprv_getDefaultCodepage(void);
109 * Please use uloc_getDefault() instead.
110 * Return the default locale ID string by querying ths system, or
111 * zero if one cannot be found.
112 * This function can call setlocale() on Unix platforms. Please read the
113 * platform documentation on setlocale() before calling this function.
114 * @return the default locale ID string
117 U_INTERNAL
const char* U_EXPORT2
uprv_getDefaultLocaleID(void);
121 * Filesystem file and path separator characters.
122 * Example: '/' and ':' on Unix, '\\' and ';' on Windows.
126 # define U_FILE_SEP_CHAR ':'
127 # define U_FILE_ALT_SEP_CHAR ':'
128 # define U_PATH_SEP_CHAR ';'
129 # define U_FILE_SEP_STRING ":"
130 # define U_FILE_ALT_SEP_STRING ":"
131 # define U_PATH_SEP_STRING ";"
132 #elif defined(WIN32) || defined(OS2)
133 # define U_FILE_SEP_CHAR '\\'
134 # define U_FILE_ALT_SEP_CHAR '/'
135 # define U_PATH_SEP_CHAR ';'
136 # define U_FILE_SEP_STRING "\\"
137 # define U_FILE_ALT_SEP_STRING "/"
138 # define U_PATH_SEP_STRING ";"
140 # define U_FILE_SEP_CHAR '/'
141 # define U_FILE_ALT_SEP_CHAR '/'
142 # define U_PATH_SEP_CHAR ':'
143 # define U_FILE_SEP_STRING "/"
144 # define U_FILE_ALT_SEP_STRING "/"
145 # define U_PATH_SEP_STRING ":"
151 * Convert char characters to UChar characters.
152 * This utility function is useful only for "invariant characters"
153 * that are encoded in the platform default encoding.
154 * They are a small, constant subset of the encoding and include
155 * just the latin letters, digits, and some punctuation.
156 * For details, see U_CHARSET_FAMILY.
158 * @param cs Input string, points to <code>length</code>
159 * character bytes from a subset of the platform encoding.
160 * @param us Output string, points to memory for <code>length</code>
161 * Unicode characters.
162 * @param length The number of characters to convert; this may
163 * include the terminating <code>NUL</code>.
165 * @see U_CHARSET_FAMILY
168 U_STABLE
void U_EXPORT2
169 u_charsToUChars(const char *cs
, UChar
*us
, int32_t length
);
172 * Convert UChar characters to char characters.
173 * This utility function is useful only for "invariant characters"
174 * that can be encoded in the platform default encoding.
175 * They are a small, constant subset of the encoding and include
176 * just the latin letters, digits, and some punctuation.
177 * For details, see U_CHARSET_FAMILY.
179 * @param us Input string, points to <code>length</code>
180 * Unicode characters that can be encoded with the
181 * codepage-invariant subset of the platform encoding.
182 * @param cs Output string, points to memory for <code>length</code>
184 * @param length The number of characters to convert; this may
185 * include the terminating <code>NUL</code>.
187 * @see U_CHARSET_FAMILY
190 U_STABLE
void U_EXPORT2
191 u_UCharsToChars(const UChar
*us
, char *cs
, int32_t length
);