1 cwchar |
1 /* |
|
2 * © Portions copyright (c) 2006-2007 Nokia Corporation. All rights reserved. |
|
3 * |
|
4 * Copyright (c) 1999 |
|
5 * Boris Fomitchev |
|
6 * |
|
7 * This material is provided "as is", with absolutely no warranty expressed |
|
8 * or implied. Any use is at your own risk. |
|
9 * |
|
10 * Permission to use or copy this software for any purpose is hereby granted |
|
11 * without fee, provided the above notices are retained on all copies. |
|
12 * Permission to modify the code and to distribute modified code is granted, |
|
13 * provided the above notices are retained, and a notice that the code was |
|
14 * modified is included with the above copyright notice. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef _STLP_CWCHAR |
|
19 # define _STLP_CWCHAR |
|
20 |
|
21 # ifndef _STLP_OUTERMOST_HEADER_ID |
|
22 # define _STLP_OUTERMOST_HEADER_ID 0x120 |
|
23 # include <stl/_prolog.h> |
|
24 # endif |
|
25 |
|
26 # ifdef __GNUC__ |
|
27 # include <cstddef> |
|
28 # endif |
|
29 |
|
30 # if ! defined (_STLP_WINCE) |
|
31 |
|
32 # if defined (__BORLANDC__) && (__BORLANDC__ >= 0x530 ) && ! defined (_STLP_OWN_IOSTREAMS) |
|
33 /* Borland defines this stuff here */ |
|
34 # include <iosfwd> |
|
35 # endif |
|
36 |
|
37 # if ! defined (_STLP_NO_CWCHAR) && defined (_STLP_USE_NEW_C_HEADERS) |
|
38 # include _STLP_NATIVE_CPP_C_HEADER(cwchar) |
|
39 |
|
40 # elif defined (__MRC__) || (defined (__SC__) && !defined (__DMC__)) || defined (__BORLANDC__) || defined(__FreeBSD__) || (defined (__GNUC__) && defined (__APPLE__) || defined( __Lynx__ )) || defined (__SYMBIAN32__) || defined (__WINS__) || defined (_STLP_NO_WCHAR_T) |
|
41 |
|
42 #ifdef __SYMBIAN32__ |
|
43 # include <stddef.h> |
|
44 #else |
|
45 # include _STLP_NATIVE_C_HEADER(stddef.h) |
|
46 #endif |
|
47 |
|
48 # if defined (__FreeBSD__) || defined (__Lynx__) || defined (__WINS__) || defined (__SYMBIAN32__) |
|
49 # ifndef _WINT_T |
|
50 #ifdef __SYMBIAN32__ |
|
51 # include <wchar.h> |
|
52 #else |
|
53 # include _STLP_NATIVE_C_HEADER(wchar.h) |
|
54 #endif |
|
55 # define _WINT_T |
|
56 # endif /* _WINT_T */ |
|
57 # endif |
|
58 |
|
59 # else |
|
60 # include _STLP_NATIVE_C_HEADER(wchar.h) |
|
61 |
|
62 # if defined(__sun) && (defined(_XOPEN_SOURCE) || (_XOPEN_VERSION - 0 == 4)) |
|
63 extern wint_t btowc(); |
|
64 extern int fwprintf(); |
|
65 extern int fwscanf(); |
|
66 extern int fwide(); |
|
67 extern int mbsinit(); |
|
68 extern size_t mbrlen(); |
|
69 extern size_t mbrtowc(); |
|
70 extern size_t mbsrtowcs(); |
|
71 extern int swprintf(); |
|
72 extern int swscanf(); |
|
73 extern int vfwprintf(); |
|
74 extern int vwprintf(); |
|
75 extern int vswprintf(); |
|
76 extern size_t wcrtomb(); |
|
77 extern size_t wcsrtombs(); |
|
78 extern wchar_t *wcsstr(); |
|
79 extern int wctob(); |
|
80 extern wchar_t *wmemchr(); |
|
81 extern int wmemcmp(); |
|
82 extern wchar_t *wmemcpy(); |
|
83 extern wchar_t *wmemmove(); |
|
84 extern wchar_t *wmemset(); |
|
85 extern int wprintf(); |
|
86 extern int wscanf(); |
|
87 # endif |
|
88 # endif |
|
89 |
|
90 #if defined(__MSL__) && __MSL__ <= 0x51FF /* dwa 2/28/99 - not yet implemented by MSL */ |
|
91 # define _STLP_WCHAR_MSL_EXCLUDE 1 |
|
92 namespace std |
|
93 { |
|
94 extern "C" size_t wcsftime(wchar_t * str, size_t max_size, const wchar_t * format_str, const struct tm * timeptr); |
|
95 } |
|
96 # define _STLP_NO_MBSTATE_T 1 |
|
97 #elif defined (__BORLANDC__) |
|
98 # ifdef _STLP_OWN_IOSTREAMS |
|
99 # define _STLP_NO_NATIVE_MBSTATE_T |
|
100 # endif |
|
101 # define _STLP_WCHAR_BORLAND_EXCLUDE 1 |
|
102 # if (__BORLANDC__ < 0x540 ) |
|
103 # define _STLP_NO_MBSTATE_T 1 |
|
104 # define _STLP_WCHAR_SUNPRO_EXCLUDE |
|
105 # endif |
|
106 #endif |
|
107 |
|
108 #ifndef _STLP_CWCHAR_H |
|
109 # include <stl/_cwchar.h> |
|
110 #endif |
|
111 |
|
112 # ifdef _STLP_IMPORT_VENDOR_CSTD |
|
113 |
|
114 #if defined (__SUNPRO_CC) && defined (_STLP_NO_OWN_IOSTREAMS) && !defined (_STLP_HAS_NO_NEW_C_HEADERS) |
|
115 using _STLP_VENDOR_CSTD::wint_t; |
|
116 #endif |
|
117 |
|
118 _STLP_BEGIN_NAMESPACE |
|
119 # ifdef _STLP_NO_WCHAR_T |
|
120 typedef int wint_t; |
|
121 # else |
|
122 // gcc 3.0 has a glitch : wint_t only sucked into the global namespace if _GLIBCPP_USE_WCHAR_T is defined |
|
123 # if defined (__GNUC__) && ! defined (_GLIBCPP_USE_WCHAR_T) |
|
124 using ::wint_t; |
|
125 # else |
|
126 using _STLP_VENDOR_CSTD::wint_t; |
|
127 # endif |
|
128 # endif |
|
129 |
|
130 |
|
131 using _STLP_VENDOR_CSTD::size_t; |
|
132 |
|
133 # if !defined (_STLP_NO_NATIVE_MBSTATE_T) && ! defined (_STLP_USE_OWN_MBSTATE_T) |
|
134 using _STLP_VENDOR_MB_NAMESPACE::mbstate_t; |
|
135 |
|
136 # if !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) && !defined(_STLP_WCHAR_BORLAND_EXCLUDE) \ |
|
137 && (!defined(__MSL__) || __MSL__ > 0x6001) |
|
138 # if ! (defined (__KCC) || defined (__GNUC__)) |
|
139 using _STLP_VENDOR_MB_NAMESPACE::btowc; |
|
140 # if (!defined(__MSL__) || __MSL__ > 0x7001) |
|
141 using _STLP_VENDOR_MB_NAMESPACE::mbsinit; |
|
142 # endif |
|
143 # endif |
|
144 # if ! defined (__GNUC__) |
|
145 using _STLP_VENDOR_MB_NAMESPACE::mbrlen; |
|
146 using _STLP_VENDOR_MB_NAMESPACE::mbrtowc; |
|
147 using _STLP_VENDOR_MB_NAMESPACE::mbsrtowcs; |
|
148 using _STLP_VENDOR_MB_NAMESPACE::wcrtomb; |
|
149 using _STLP_VENDOR_MB_NAMESPACE::wcsrtombs; |
|
150 # endif |
|
151 # endif /* BORLAND && !__MSL__ || __MSL__ > 0x6001 */ |
|
152 |
|
153 # endif /* _STLP_NO_NATIVE_MBSTATE_T */ |
|
154 |
|
155 # if !defined (_STLP_NO_NATIVE_WIDE_FUNCTIONS) && ! defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) |
|
156 |
|
157 # if !defined (_STLP_WCHAR_BORLAND_EXCLUDE) && ! defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) |
|
158 using _STLP_VENDOR_CSTD::fgetwc; |
|
159 using _STLP_VENDOR_CSTD::fgetws; |
|
160 using _STLP_VENDOR_CSTD::fputwc; |
|
161 using _STLP_VENDOR_CSTD::fputws; |
|
162 # endif |
|
163 |
|
164 # if !( defined (_STLP_WCHAR_SUNPRO_EXCLUDE) || defined (_STLP_WCHAR_BORLAND_EXCLUDE) \ |
|
165 || defined(_STLP_WCHAR_HPACC_EXCLUDE) ) |
|
166 # ifndef __DECCXX |
|
167 using _STLP_VENDOR_CSTD::fwide; |
|
168 # endif |
|
169 using _STLP_VENDOR_CSTD::fwprintf; |
|
170 using _STLP_VENDOR_CSTD::fwscanf; |
|
171 using _STLP_VENDOR_CSTD::getwchar; |
|
172 # endif |
|
173 |
|
174 # ifndef _STLP_WCHAR_BORLAND_EXCLUDE |
|
175 using _STLP_VENDOR_CSTD::getwc; |
|
176 using _STLP_VENDOR_CSTD::ungetwc; |
|
177 |
|
178 using _STLP_VENDOR_CSTD::putwc; |
|
179 using _STLP_VENDOR_CSTD::putwchar; |
|
180 # endif |
|
181 |
|
182 # if !( defined (_STLP_WCHAR_SUNPRO_EXCLUDE) || defined (_STLP_WCHAR_BORLAND_EXCLUDE)\ |
|
183 || defined(_STLP_WCHAR_HPACC_EXCLUDE) ) |
|
184 using _STLP_VENDOR_CSTD::swprintf; |
|
185 using _STLP_VENDOR_CSTD::swscanf; |
|
186 using _STLP_VENDOR_CSTD::vfwprintf; |
|
187 using _STLP_VENDOR_CSTD::vwprintf; |
|
188 using _STLP_VENDOR_CSTD::vswprintf; |
|
189 |
|
190 # if !defined(__MSL__) || __MSL__ > 0x7001 |
|
191 using _STLP_VENDOR_CSTD::wcsftime; |
|
192 # endif |
|
193 using _STLP_VENDOR_CSTD::wcstok; |
|
194 |
|
195 # endif |
|
196 |
|
197 # if !(defined (__BORLANDC__) && (__BORLANDC__ < 0x540)) |
|
198 using _STLP_VENDOR_CSTD::wcscat; |
|
199 using _STLP_VENDOR_CSTD::wcsrchr; |
|
200 using _STLP_VENDOR_CSTD::wcscmp; |
|
201 using _STLP_VENDOR_CSTD::wcscoll; |
|
202 |
|
203 using _STLP_VENDOR_CSTD::wcscpy; |
|
204 using _STLP_VENDOR_CSTD::wcscspn; |
|
205 |
|
206 using _STLP_VENDOR_CSTD::wcslen; |
|
207 using _STLP_VENDOR_CSTD::wcsncat; |
|
208 using _STLP_VENDOR_CSTD::wcsncmp; |
|
209 using _STLP_VENDOR_CSTD::wcsncpy; |
|
210 using _STLP_VENDOR_CSTD::wcspbrk; |
|
211 using _STLP_VENDOR_CSTD::wcschr; |
|
212 |
|
213 using _STLP_VENDOR_CSTD::wcsspn; |
|
214 using _STLP_VENDOR_CSTD::wcsxfrm; |
|
215 |
|
216 # endif |
|
217 |
|
218 # if !defined (_STLP_WCHAR_BORLAND_EXCLUDE) |
|
219 |
|
220 using _STLP_VENDOR_CSTD::wcstod; |
|
221 using _STLP_VENDOR_CSTD::wcstol; |
|
222 |
|
223 # endif |
|
224 |
|
225 #ifdef __SYMBIAN32__ |
|
226 |
|
227 using _STLP_VENDOR_CSTD::wcstoul; |
|
228 |
|
229 #endif //__SYMBIAN32__ |
|
230 |
|
231 # if !( defined (_STLP_WCHAR_SUNPRO_EXCLUDE) || defined(_STLP_WCHAR_HPACC_EXCLUDE) ) |
|
232 |
|
233 using _STLP_VENDOR_CSTD::wcsstr; |
|
234 using _STLP_VENDOR_CSTD::wmemchr; |
|
235 |
|
236 # if !defined (_STLP_WCHAR_BORLAND_EXCLUDE) |
|
237 |
|
238 #ifndef __DMC__ |
|
239 using _STLP_VENDOR_CSTD::wctob; |
|
240 using _STLP_VENDOR_CSTD::wmemcmp; |
|
241 #endif |
|
242 using _STLP_VENDOR_CSTD::wmemmove; |
|
243 using _STLP_VENDOR_CSTD::wprintf; |
|
244 using _STLP_VENDOR_CSTD::wscanf; |
|
245 |
|
246 # endif |
|
247 |
|
248 using _STLP_VENDOR_CSTD::wmemcpy; |
|
249 using _STLP_VENDOR_CSTD::wmemset; |
|
250 # endif |
|
251 |
|
252 # endif /* _STLP_NO_NATIVE_WIDE_FUNCTIONS */ |
|
253 _STLP_END_NAMESPACE |
|
254 # endif /* _STLP_IMPORT_VENDOR_CSTD */ |
|
255 |
|
256 # undef _STLP_WCHAR_SUNPRO_EXCLUDE |
|
257 # undef _STLP_WCHAR_MSL_EXCLUDE |
|
258 |
|
259 # endif /* WINCE */ |
|
260 |
|
261 # if (_STLP_OUTERMOST_HEADER_ID == 0x120) |
|
262 # include <stl/_epilog.h> |
|
263 # undef _STLP_OUTERMOST_HEADER_ID |
|
264 # endif |
|
265 |
|
266 #endif /* _STLP_CWCHAR */ |
|
267 |