- support of [Strings.LanguageID]-sections for inf-files added in setupapi
[reactos.git] / reactos / nls / 3rdparty / icu / source / common / unicode / putil.h
1 /*
2 ******************************************************************************
3 *
4 * Copyright (C) 1997-2005, International Business Machines
5 * Corporation and others. All Rights Reserved.
6 *
7 ******************************************************************************
8 *
9 * FILE NAME : putil.h
10 *
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 ******************************************************************************
22 */
23
24 #ifndef PUTIL_H
25 #define PUTIL_H
26
27 #include "unicode/utypes.h"
28 /**
29 * \file
30 * \brief C API: Platform Utilities
31 */
32
33 /* Define this to 1 if your platform supports IEEE 754 floating point,
34 to 0 if it does not. */
35 #ifndef IEEE_754
36 # define IEEE_754 1
37 #endif
38
39 /*==========================================================================*/
40 /* Platform utilities */
41 /*==========================================================================*/
42
43 /**
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.
47 */
48
49 /**
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.
56 *
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
61 * (#define ICU_DATA_DIR "path"), use that,
62 * otherwise no data directory is available.
63 *
64 * @return the data directory, or an empty string ("") if no data directory has
65 * been specified.
66 *
67 * @stable ICU 2.0
68 */
69 U_STABLE const char* U_EXPORT2 u_getDataDirectory(void);
70
71 /**
72 * Set the ICU data directory.
73 * The data directory is where common format ICU data files (.dat files)
74 * are loaded from. Note that normal use of the built-in ICU
75 * facilities does not require loading of an external data file;
76 * unless you are adding custom data to ICU, the data directory
77 * does not need to be set.
78 *
79 * This function should be called at most once in a process, before the
80 * first ICU operation (e.g., u_init()) that will require the loading of an
81 * ICU data file.
82 * This function is not thread-safe. Use it before calling ICU APIs from
83 * multiple threads.
84 *
85 * @param directory The directory to be set.
86 *
87 * @see u_init
88 * @stable ICU 2.0
89 */
90 U_STABLE void U_EXPORT2 u_setDataDirectory(const char *directory);
91
92 /**
93 * Please use ucnv_getDefaultName() instead.
94 * Return the default codepage for this platform and locale.
95 * This function can call setlocale() on Unix platforms. Please read the
96 * platform documentation on setlocale() before calling this function.
97 * @return the default codepage for this platform
98 * @internal
99 */
100 U_INTERNAL const char* U_EXPORT2 uprv_getDefaultCodepage(void);
101
102 /**
103 * Please use uloc_getDefault() instead.
104 * Return the default locale ID string by querying ths system, or
105 * zero if one cannot be found.
106 * This function can call setlocale() on Unix platforms. Please read the
107 * platform documentation on setlocale() before calling this function.
108 * @return the default locale ID string
109 * @internal
110 */
111 U_INTERNAL const char* U_EXPORT2 uprv_getDefaultLocaleID(void);
112
113 /**
114 * Filesystem file and path separator characters.
115 * Example: '/' and ':' on Unix, '\\' and ';' on Windows.
116 * @stable ICU 2.0
117 */
118 #ifdef XP_MAC
119 # define U_FILE_SEP_CHAR ':'
120 # define U_FILE_ALT_SEP_CHAR ':'
121 # define U_PATH_SEP_CHAR ';'
122 # define U_FILE_SEP_STRING ":"
123 # define U_FILE_ALT_SEP_STRING ":"
124 # define U_PATH_SEP_STRING ";"
125 #elif defined(U_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 #else
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 ":"
139 #endif
140
141 /**
142 * Convert char characters to UChar characters.
143 * This utility function is useful only for "invariant characters"
144 * that are encoded in the platform default encoding.
145 * They are a small, constant subset of the encoding and include
146 * just the latin letters, digits, and some punctuation.
147 * For details, see U_CHARSET_FAMILY.
148 *
149 * @param cs Input string, points to <code>length</code>
150 * character bytes from a subset of the platform encoding.
151 * @param us Output string, points to memory for <code>length</code>
152 * Unicode characters.
153 * @param length The number of characters to convert; this may
154 * include the terminating <code>NUL</code>.
155 *
156 * @see U_CHARSET_FAMILY
157 * @stable ICU 2.0
158 */
159 U_STABLE void U_EXPORT2
160 u_charsToUChars(const char *cs, UChar *us, int32_t length);
161
162 /**
163 * Convert UChar characters to char characters.
164 * This utility function is useful only for "invariant characters"
165 * that can be encoded in the platform default encoding.
166 * They are a small, constant subset of the encoding and include
167 * just the latin letters, digits, and some punctuation.
168 * For details, see U_CHARSET_FAMILY.
169 *
170 * @param us Input string, points to <code>length</code>
171 * Unicode characters that can be encoded with the
172 * codepage-invariant subset of the platform encoding.
173 * @param cs Output string, points to memory for <code>length</code>
174 * character bytes.
175 * @param length The number of characters to convert; this may
176 * include the terminating <code>NUL</code>.
177 *
178 * @see U_CHARSET_FAMILY
179 * @stable ICU 2.0
180 */
181 U_STABLE void U_EXPORT2
182 u_UCharsToChars(const UChar *us, char *cs, int32_t length);
183
184 #endif