]>
Commit | Line | Data |
---|---|---|
e35d0039 JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wxchar.h | |
3 | // Purpose: Declarations common to wx char/wchar_t usage (wide chars) | |
4 | // Author: Joel Farley | |
5 | // Modified by: | |
6 | // Created: 1998/06/12 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) wxWindows copyright | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_WXCHAR_H_ | |
13 | #define _WX_WXCHAR_H_ | |
14 | ||
88ac883a VZ |
15 | //#ifdef __GNUG__ |
16 | //#pragma interface "wxchar.h" | |
17 | //#endif | |
e35d0039 JS |
18 | |
19 | // only do SBCS or _UNICODE | |
20 | #if defined (_MBCS ) | |
1777b9bb | 21 | # error "MBCS is not supported by wxChar" |
e35d0039 JS |
22 | #endif |
23 | ||
853d7d3d OK |
24 | // set wxUSE_UNICODE to 1 if UNICODE or _UNICODE is defined |
25 | #if defined(_UNICODE) || defined(UNICODE) | |
1777b9bb DW |
26 | # undef wxUSE_UNICODE |
27 | # define wxUSE_UNICODE 1 | |
853d7d3d | 28 | #else |
1777b9bb DW |
29 | # ifndef wxUSE_UNICODE |
30 | # define wxUSE_UNICODE 0 | |
31 | # endif | |
853d7d3d OK |
32 | #endif |
33 | ||
34 | // and vice versa: define UNICODE and _UNICODE if wxUSE_UNICODE is 1... | |
35 | #if wxUSE_UNICODE | |
1777b9bb DW |
36 | # ifndef _UNICODE |
37 | # define _UNICODE | |
38 | # endif | |
39 | # ifndef UNICODE | |
40 | # define UNICODE | |
41 | # endif | |
853d7d3d OK |
42 | #endif |
43 | ||
34f9227c | 44 | // Windows (VC++) has broad TCHAR support |
3f4a0c5b | 45 | #if defined(__VISUALC__) && defined(__WIN32__) |
e35d0039 | 46 | |
1777b9bb | 47 | # define HAVE_WCSLEN 1 |
a23fd0e1 | 48 | |
1777b9bb | 49 | # include <tchar.h> |
73974df1 | 50 | |
1777b9bb | 51 | # if wxUSE_UNICODE // temporary - preserve binary compatibility |
e35d0039 | 52 | typedef _TCHAR wxChar; |
3f4a0c5b | 53 | typedef _TSCHAR wxSChar; |
e35d0039 | 54 | typedef _TUCHAR wxUChar; |
1777b9bb DW |
55 | # else |
56 | # define wxChar char | |
57 | # define wxSChar signed char | |
58 | # define wxUChar unsigned char | |
59 | # endif | |
81d425f6 | 60 | // wchar_t is available |
1777b9bb DW |
61 | # undef wxUSE_WCHAR_T |
62 | # define wxUSE_WCHAR_T 1 | |
e35d0039 JS |
63 | |
64 | // ctype.h functions | |
1777b9bb DW |
65 | # define wxIsalnum _istalnum |
66 | # define wxIsalpha _istalpha | |
67 | # define wxIsctrl _istctrl | |
68 | # define wxIsdigit _istdigit | |
69 | # define wxIsgraph _istgraph | |
70 | # define wxIslower _istlower | |
71 | # define wxIsprint _istprint | |
72 | # define wxIspunct _istpunct | |
73 | # define wxIsspace _istspace | |
74 | # define wxIsupper _istupper | |
75 | # define wxIsxdigit _istxdigit | |
76 | # define wxTolower _totlower | |
77 | # define wxToupper _totupper | |
e35d0039 JS |
78 | |
79 | // locale.h functons | |
1777b9bb | 80 | # define wxSetlocale _tsetlocale |
e35d0039 JS |
81 | |
82 | // string.h functions | |
1777b9bb DW |
83 | # define wxStrcat _tcscat |
84 | # define wxStrchr _tcschr | |
85 | # define wxStrcmp _tcscmp | |
86 | # define wxStrcoll _tcscoll | |
87 | # define wxStrcpy _tcscpy | |
88 | # define wxStrcspn _tcscspn | |
89 | # define wxStrftime _tcsftime | |
90 | # define wxStricmp _tcsicmp | |
91 | # define wxStrlen_ _tcslen // used in wxStrlen inline function | |
92 | # define wxStrncat _tcsncat | |
93 | # define wxStrncmp _tcsncmp | |
94 | # define wxStrncpy _tcsncpy | |
95 | # define wxStrpbrk _tcspbrk | |
96 | # define wxStrrchr _tcsrchr | |
97 | # define wxStrspn _tcsspn | |
98 | # define wxStrstr _tcsstr | |
99 | # define wxStrtod _tcstod | |
e97a90f0 | 100 | // is there a _tcstok[_r] ? |
1777b9bb DW |
101 | # define wxStrtol _tcstol |
102 | # define wxStrtoul _tcstoul | |
103 | # define wxStrxfrm _tcsxfrm | |
e35d0039 JS |
104 | |
105 | // stdio.h functions | |
1777b9bb DW |
106 | # define wxFgetc _fgettc |
107 | # define wxFgetchar _fgettchar | |
108 | # define wxFgets _fgetts | |
109 | # define wxFopen _tfopen | |
110 | # define wxFputc _fputtc | |
111 | # define wxFputchar _fputtchar | |
112 | # define wxFprintf _ftprintf | |
113 | # define wxFreopen _tfreopen | |
114 | # define wxFscanf _ftscanf | |
115 | # define wxGetc _gettc | |
116 | # define wxGetchar _gettchar | |
117 | # define wxGets _getts | |
118 | # define wxPerror _tperror | |
119 | # define wxPrintf _tprintf | |
120 | # define wxPutc _puttc | |
121 | # define wxPutchar _puttchar | |
122 | # define wxPuts _putts | |
123 | # define wxRemove _tremove | |
124 | # define wxRename _trename | |
125 | # define wxScanf _tscanf | |
126 | # define wxSprintf _stprintf | |
127 | # define wxSscanf _stscanf | |
128 | # define wxTmpnam _ttmpnam | |
129 | # define wxUngetc _tungetc | |
130 | # define wxVfprint _vftprintf | |
131 | # define wxVprintf _vtprintf | |
132 | # define wxVsscanf _vstscanf | |
133 | # define wxVsprintf _vstprintf | |
e35d0039 JS |
134 | |
135 | // stdlib.h functions | |
1777b9bb DW |
136 | # if !wxUSE_UNICODE |
137 | # define wxAtof atof | |
138 | # endif | |
139 | # define wxAtoi _ttoi | |
140 | # define wxAtol _ttol | |
141 | # define wxGetenv _tgetenv | |
142 | # define wxSystem _tsystem | |
e35d0039 JS |
143 | |
144 | // time.h functions | |
1777b9bb DW |
145 | # define wxAsctime _tasctime |
146 | # define wxCtime _tctime | |
e35d0039 JS |
147 | |
148 | // #elif defined(XXX) | |
149 | // #include XXX-specific files here | |
150 | // typeddef YYY wxChar; | |
151 | ||
152 | // translate wxZZZ names | |
153 | ||
853d7d3d OK |
154 | #elif defined(__BORLANDC__) && defined(__WIN32__) |
155 | ||
156 | // Borland C++ 4.52 doesn't have much tchar support | |
157 | // maybe Borland C++ 5.02 has, can't check right now | |
158 | // but I'll use the Win32 API instead here | |
159 | ||
1777b9bb DW |
160 | # include <tchar.h> |
161 | # if wxUSE_UNICODE // temporary - preserve binary compatibility | |
853d7d3d OK |
162 | typedef _TCHAR wxChar; |
163 | typedef _TSCHAR wxSChar; | |
164 | typedef _TUCHAR wxUChar; | |
1777b9bb DW |
165 | # else |
166 | # define wxChar char | |
167 | # define wxSChar signed char | |
168 | # define wxUChar unsigned char | |
169 | # endif | |
81d425f6 | 170 | // wchar_t is available |
1777b9bb | 171 | # undef wxUSE_WCHAR_T |
cf1d22d6 | 172 | // This test is for C++Builder |
c09f2879 | 173 | #if __BORLANDC__ >= 0x530 |
cf1d22d6 | 174 | # define wxUSE_WCHAR_T 0 |
c09f2879 | 175 | #else |
1777b9bb | 176 | # define wxUSE_WCHAR_T 1 |
cf1d22d6 JS |
177 | # define wxNEED_WCSLEN |
178 | #endif | |
1777b9bb | 179 | # define wxNEED_WX_CTYPE_H |
853d7d3d | 180 | // #define wxStrtok strtok_r // Borland C++ 4.52 doesn't have strtok_r |
1777b9bb DW |
181 | # define wxNEED_WX_STRING_H |
182 | # define wxNEED_WX_STDIO_H | |
183 | # define wxNEED_WX_STDLIB_H | |
184 | # define wxNEED_WX_TIME_H | |
853d7d3d | 185 | |
ec6f6982 DW |
186 | // VisualAge C++ V4.0 has broad tchar support |
187 | #elif defined(__VISAGECPP__) && __IBMCPP >= 400 | |
188 | ||
189 | # define HAVE_WCSLEN 1 | |
190 | ||
191 | # include <tchar.h> | |
192 | ||
193 | # if wxUSE_UNICODE // temporary - preserve binary compatibility | |
194 | typedef _TCHAR wxChar; | |
195 | typedef _TSCHAR wxSChar; | |
196 | typedef _TUCHAR wxUChar; | |
197 | # else | |
198 | # define wxChar char | |
199 | # define wxSChar signed char | |
200 | # define wxUChar unsigned char | |
201 | # endif | |
202 | // wchar_t is available | |
203 | # undef wxUSE_WCHAR_T | |
204 | # define wxUSE_WCHAR_T 1 | |
205 | ||
206 | // ctype.h functions | |
207 | # define wxIsalnum _istalnum | |
208 | # define wxIsalpha _istalpha | |
209 | # define wxIsctrl _istctrl | |
210 | # define wxIsdigit _istdigit | |
211 | # define wxIsgraph _istgraph | |
212 | # define wxIslower _istlower | |
213 | # define wxIsprint _istprint | |
214 | # define wxIspunct _istpunct | |
215 | # define wxIsspace _istspace | |
216 | # define wxIsupper _istupper | |
217 | # define wxIsxdigit _istxdigit | |
218 | # define wxTolower _totlower | |
219 | # define wxToupper _totupper | |
220 | ||
221 | // locale.h functons | |
222 | # define wxSetlocale _tsetlocale | |
223 | ||
224 | // string.h functions | |
225 | # define wxStrcat _tcscat | |
226 | # define wxStrchr _tcschr | |
227 | # define wxStrcmp _tcscmp | |
228 | # define wxStrcoll _tcscoll | |
229 | # define wxStrcpy _tcscpy | |
230 | # define wxStrcspn _tcscspn | |
231 | # define wxStrftime _tcsftime | |
232 | # define wxStricmp _tcsicmp | |
233 | # define wxStrlen_ _tcslen // used in wxStrlen inline function | |
234 | # define wxStrncat _tcsncat | |
235 | # define wxStrncmp _tcsncmp | |
236 | # define wxStrncpy _tcsncpy | |
237 | # define wxStrpbrk _tcspbrk | |
238 | # define wxStrrchr _tcsrchr | |
239 | # define wxStrspn _tcsspn | |
240 | # define wxStrstr _tcsstr | |
241 | # define wxStrtod _tcstod | |
242 | // is there a _tcstok[_r] ? | |
243 | # define wxStrtol _tcstol | |
244 | # define wxStrtoul _tcstoul | |
245 | # define wxStrxfrm _tcsxfrm | |
246 | ||
247 | // stdio.h functions | |
248 | # define wxFgetc _fgettc | |
249 | # define wxFgetchar _fgettchar | |
250 | # define wxFgets _fgetts | |
251 | # define wxFopen _tfopen | |
252 | # define wxFputc _fputtc | |
253 | # define wxFputchar _fputtchar | |
254 | # define wxFprintf _ftprintf | |
255 | # define wxFreopen _tfreopen | |
256 | # define wxFscanf _ftscanf | |
257 | # define wxGetc _gettc | |
258 | # define wxGetchar _gettchar | |
259 | # define wxGets _getts | |
260 | # define wxPerror _tperror | |
261 | # define wxPrintf _tprintf | |
262 | # define wxPutc _puttc | |
263 | # define wxPutchar _puttchar | |
264 | # define wxPuts _putts | |
265 | # define wxRemove _tremove | |
266 | # define wxRename _trename | |
267 | # define wxScanf _tscanf | |
268 | # define wxSprintf _stprintf | |
269 | # define wxSscanf _stscanf | |
270 | # define wxTmpnam _ttmpnam | |
271 | # define wxUngetc _tungetc | |
272 | # define wxVfprint _vftprintf | |
273 | # define wxVprintf _vtprintf | |
274 | # define wxVsscanf _vstscanf | |
275 | # define wxVsprintf _vstprintf | |
276 | ||
277 | // stdlib.h functions | |
278 | # if !wxUSE_UNICODE | |
279 | # define wxAtof atof | |
280 | # endif | |
281 | # define wxAtoi _ttoi | |
282 | # define wxAtol _ttol | |
283 | # define wxGetenv _tgetenv | |
284 | # define wxSystem _tsystem | |
285 | ||
286 | // time.h functions | |
287 | # define wxAsctime _tasctime | |
288 | # define wxCtime _tctime | |
289 | ||
290 | // #elif defined(XXX) | |
291 | // #include XXX-specific files here | |
292 | // typeddef YYY wxChar; | |
293 | ||
294 | // translate wxZZZ names | |
295 | ||
81d425f6 | 296 | #else//!TCHAR-aware compilers |
34f9227c | 297 | |
81d425f6 | 298 | // check whether we should include wchar.h or equivalent |
1777b9bb DW |
299 | # if wxUSE_UNICODE |
300 | # undef wxUSE_WCHAR_T | |
301 | # define wxUSE_WCHAR_T 1 // wchar_t *must* be available in Unicode mode | |
302 | # elif !defined(wxUSE_WCHAR_T) | |
303 | # if defined(__VISUALC__) && (__VISUALC__ < 900) | |
304 | # define wxUSE_WCHAR_T 0 // wchar_t is not available for MSVC++ 1.5 | |
305 | # elif defined(__UNIX__) | |
306 | # if defined(HAVE_WCSTR_H) || defined(HAVE_WCHAR_H) || defined(__FreeBSD__) | |
307 | # define wxUSE_WCHAR_T 1 | |
308 | # else | |
309 | # define wxUSE_WCHAR_T 0 | |
310 | # endif | |
311 | # elif defined(__GNUWIN32__) && !defined(__MINGW32__) // Cygwin (not Mingw32) doesn't have wcslen.h, needed in buffer.h | |
312 | # define wxUSE_WCHAR_T 0 | |
313 | # elif defined(__BORLANDC__) // WIN16 BC++ | |
314 | # define wxUSE_WCHAR_T 0 | |
315 | # elif defined(__WATCOMC__) | |
316 | # define wxUSE_WCHAR_T 0 | |
317 | # else | |
a89ae1e4 | 318 | // add additional compiler checks if this fails |
1777b9bb DW |
319 | # define wxUSE_WCHAR_T 1 |
320 | # endif | |
321 | # endif//wxUSE_UNICODE | |
322 | ||
323 | # if wxUSE_WCHAR_T | |
324 | # ifdef HAVE_WCSTR_H | |
325 | # include <wcstr.h> | |
326 | # else | |
327 | # ifndef __FreeBSD__ | |
328 | # include <wchar.h> | |
329 | # else | |
330 | # include <stdlib.h> | |
331 | # define wxNEED_WCSLEN | |
332 | # endif | |
333 | # endif | |
334 | # endif | |
65d77246 | 335 | |
34f9227c | 336 | // check whether we are doing Unicode |
1777b9bb | 337 | # if wxUSE_UNICODE |
34f9227c | 338 | |
1777b9bb | 339 | # include <wctype.h> |
34f9227c OK |
340 | |
341 | // this is probably glibc-specific | |
1777b9bb | 342 | # if defined(__WCHAR_TYPE__) |
34f9227c OK |
343 | |
344 | typedef __WCHAR_TYPE__ wxChar; | |
345 | typedef signed __WCHAR_TYPE__ wxSChar; | |
346 | typedef unsigned __WCHAR_TYPE__ wxUChar; | |
347 | ||
cdb51680 | 348 | # define _T(x) L##x |
1777b9bb DW |
349 | |
350 | // ctype.h functions (wctype.h) | |
351 | # define wxIsalnum iswalnum | |
352 | # define wxIsalpha iswalpha | |
353 | # define wxIsctrl iswcntrl | |
354 | # define wxIsdigit iswdigit | |
355 | # define wxIsgraph iswgraph | |
356 | # define wxIslower iswlower | |
357 | # define wxIsprint iswprint | |
358 | # define wxIspunct iswpunct | |
359 | # define wxIsspace iswspace | |
360 | # define wxIsupper iswupper | |
361 | # define wxIsxdigit iswxdigit | |
362 | ||
363 | # if defined(__GLIBC__) && (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0) | |
364 | // /usr/include/wctype.h incorrectly declares translations tables which | |
365 | // provokes tons of compile-time warnings - try to correct this | |
366 | # define wxTolower(wc) towctrans((wc), (wctrans_t)__ctype_tolower) | |
367 | # define wxToupper(wc) towctrans((wc), (wctrans_t)__ctype_toupper) | |
368 | # else | |
369 | # define wxTolower towlower | |
370 | # define wxToupper towupper | |
371 | # endif // gcc/!gcc | |
372 | ||
373 | // string.h functions (wchar.h) | |
374 | # define wxStrcat wcscat | |
375 | # define wxStrchr wcschr | |
376 | # define wxStrcmp wcscmp | |
377 | # define wxStrcoll wcscoll | |
378 | # define wxStrcpy wcscpy | |
379 | # define wxStrcspn wcscspn | |
380 | # define wxStrlen_ wcslen // used in wxStrlen inline function | |
381 | # define wxStrncat wcsncat | |
382 | # define wxStrncmp wcsncmp | |
383 | # define wxStrncpy wcsncpy | |
384 | # define wxStrpbrk wcspbrk | |
385 | # define wxStrrchr wcsrchr | |
386 | # define wxStrspn wcsspn | |
387 | # define wxStrstr wcsstr | |
388 | # define wxStrtod wcstod | |
389 | # define wxStrtok wcstok | |
390 | # define wxStrtol wcstol | |
391 | # define wxStrtoul wcstoul | |
392 | # define wxStrxfrm wcsxfrm | |
e35d0039 | 393 | |
34f9227c | 394 | // glibc doesn't have wc equivalents of the other stuff |
1777b9bb DW |
395 | # define wxNEED_WX_STDIO_H |
396 | # define wxNEED_WX_STDLIB_H | |
397 | # define wxNEED_WX_TIME_H | |
34f9227c | 398 | |
1777b9bb DW |
399 | # else//!glibc |
400 | # error "Please define your compiler's Unicode conventions in wxChar.h" | |
401 | # endif | |
402 | # else//!Unicode | |
e35d0039 | 403 | |
1777b9bb DW |
404 | # include <ctype.h> |
405 | # include <string.h> | |
e97a90f0 | 406 | |
e90c1d2a VZ |
407 | # if 0 // temporary - preserve binary compatibilty |
408 | typedef char wxChar; | |
409 | typedef signed char wxSChar; | |
410 | typedef unsigned char wxUChar; | |
411 | # else | |
412 | # define wxChar char | |
413 | # define wxSChar signed char | |
414 | # define wxUChar unsigned char | |
415 | # endif | |
416 | ||
417 | # ifdef __FreeBSD__ | |
cdb51680 | 418 | # undef _T |
e90c1d2a | 419 | # endif |
b4fe5125 JS |
420 | |
421 | # if !defined(__MINGW32__) || !defined(_T) | |
422 | # define _T(x) x | |
423 | # endif | |
1777b9bb DW |
424 | |
425 | // ctype.h functions | |
e90c1d2a VZ |
426 | # define wxIsalnum isalnum |
427 | # define wxIsalpha isalpha | |
428 | # define wxIsctrl isctrl | |
429 | # define wxIsdigit isdigit | |
430 | # define wxIsgraph isgraph | |
431 | # define wxIslower islower | |
432 | # define wxIsprint isprint | |
433 | # define wxIspunct ispunct | |
434 | # define wxIsspace isspace | |
435 | # define wxIsupper isupper | |
436 | # define wxIsxdigit isxdigit | |
437 | # define wxTolower tolower | |
438 | # define wxToupper toupper | |
439 | ||
440 | // locale.h functons | |
441 | # define wxSetlocale setlocale | |
442 | ||
443 | // string.h functions | |
444 | // #define wxStricmp strcasecmp | |
445 | // wxStricmp is defined below!! | |
446 | ||
447 | #ifdef HAVE_STRTOK_R | |
448 | #define wxStrtok(str, sep, last) strtok_r(str, sep, last) | |
449 | #else | |
450 | #define wxStrtok(str, sep, last) strtok(str, sep) | |
451 | #endif | |
1777b9bb DW |
452 | |
453 | // leave the rest to defaults below | |
e90c1d2a VZ |
454 | # define wxNEED_WX_STRING_H |
455 | # define wxNEED_WX_STDIO_H | |
456 | # define wxNEED_WX_STDLIB_H | |
457 | # define wxNEED_WX_TIME_H | |
1777b9bb DW |
458 | |
459 | # endif//Unicode | |
853d7d3d OK |
460 | #endif//TCHAR-aware compilers |
461 | ||
462 | // define wxStricmp for various compilers without Unicode possibilities | |
463 | #if !defined(wxStricmp) && !wxUSE_UNICODE | |
fd9811b1 | 464 | # if defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__SALFORDC__) || defined(__VISAGECPP__) || defined(__EMX__) |
1777b9bb | 465 | # define wxStricmp stricmp |
9199e66f | 466 | # define wxStrnicmp strnicmp |
585ae8cb | 467 | # elif defined(__SC__) || defined(__VISUALC__) || (defined(__MWERKS__) && defined(__INTEL__)) |
1777b9bb | 468 | # define wxStricmp _stricmp |
9199e66f | 469 | # define wxStrnicmp _strnicmp |
1777b9bb DW |
470 | # elif defined(__UNIX__) || defined(__GNUWIN32__) |
471 | # define wxStricmp strcasecmp | |
9199e66f | 472 | # define wxStrnicmp strncasecmp |
1777b9bb DW |
473 | # elif defined(__MWERKS__) && !defined(__INTEL__) |
474 | // use wxWindows' implementation | |
475 | # else | |
476 | // if you leave wxStricmp undefined, wxWindows' implementation will be used | |
477 | # error "Please define string case-insensitive compare for your OS/compiler" | |
478 | # endif | |
853d7d3d OK |
479 | #endif |
480 | ||
481 | // if we need to define for standard headers, and we're not using Unicode, | |
482 | // just define to standard C library routines | |
483 | #if !wxUSE_UNICODE | |
1777b9bb DW |
484 | # ifdef wxNEED_WX_STRING_H |
485 | # define wxStrcat strcat | |
486 | # define wxStrchr strchr | |
487 | # define wxStrcmp strcmp | |
488 | # define wxStrcoll strcoll | |
489 | # define wxStrcpy strcpy | |
490 | # define wxStrcspn strcspn | |
491 | # define wxStrdup strdup | |
492 | # define wxStrlen_ strlen // used in wxStrlen inline function | |
493 | # define wxStrncat strncat | |
494 | # define wxStrncmp strncmp | |
495 | # define wxStrncpy strncpy | |
496 | # define wxStrpbrk strpbrk | |
497 | # define wxStrrchr strrchr | |
498 | # define wxStrspn strspn | |
499 | # define wxStrstr strstr | |
500 | # define wxStrtod strtod | |
501 | # define wxStrtol strtol | |
502 | # define wxStrtoul strtoul | |
503 | # define wxStrxfrm strxfrm | |
504 | # undef wxNEED_WX_STRING_H | |
505 | # endif | |
506 | ||
507 | # ifdef wxNEED_WX_STDIO_H | |
508 | # define wxFgetc fgetc | |
509 | # define wxFgetchar fgetchar | |
510 | # define wxFgets fgets | |
511 | # define wxFopen fopen | |
512 | # define wxFputc fputc | |
513 | # define wxFputchar fputchar | |
514 | # define wxFprintf fprintf | |
515 | # define wxFreopen freopen | |
516 | # define wxFscanf fscanf | |
517 | # define wxGetc getc | |
518 | # define wxGetchar getchar | |
519 | # define wxGets gets | |
520 | # define wxPerror perror | |
521 | # define wxPrintf printf | |
522 | # define wxPutc putc | |
523 | # define wxPutchar putchar | |
524 | # define wxPuts puts | |
525 | # define wxRemove remove | |
526 | # define wxRename rename | |
527 | # define wxScanf scanf | |
528 | # define wxSprintf sprintf | |
529 | # define wxSscanf sscanf | |
530 | # define wxTmpnam tmpnam | |
531 | # define wxUngetc ungetc | |
532 | # define wxVfprint vfprintf | |
533 | # define wxVprintf vprintf | |
534 | # define wxVsscanf vsscanf | |
535 | # define wxVsprintf vsprintf | |
536 | # undef wxNEED_WX_STDIO_H | |
537 | # endif | |
538 | ||
539 | # ifdef wxNEED_WX_STDLIB_H | |
540 | # define wxAtof atof | |
541 | # define wxAtoi atoi | |
542 | # define wxAtol atol | |
543 | # define wxGetenv getenv | |
544 | # define wxSystem system | |
545 | # undef wxNEED_WX_STDLIB_H | |
546 | # endif | |
547 | ||
548 | # ifdef wxNEED_WX_TIME_H | |
549 | # define wxAsctime asctime | |
550 | # define wxCtime ctime | |
551 | # define wxStrftime strftime | |
552 | # undef wxNEED_WX_TIME_H | |
553 | # endif | |
853d7d3d | 554 | #endif //!Unicode |
e35d0039 | 555 | |
853d7d3d | 556 | #if defined(wxNEED_WCSLEN) && wxUSE_UNICODE |
1777b9bb DW |
557 | # define wcslen wxStrlen |
558 | # undef wxNEED_WCSLEN | |
853d7d3d | 559 | #endif |
e35d0039 JS |
560 | |
561 | /// checks whether the passed in pointer is NULL and if the string is empty | |
49828363 | 562 | WXDLLEXPORT inline bool wxIsEmpty(const wxChar *p) { return !p || !*p; } |
e35d0039 | 563 | |
853d7d3d | 564 | #ifndef wxNEED_WX_STRING_H |
e35d0039 | 565 | /// safe version of strlen() (returns 0 if passed NULL pointer) |
49828363 | 566 | WXDLLEXPORT inline size_t wxStrlen(const wxChar *psz) |
853d7d3d | 567 | { return psz ? wxStrlen_(psz) : 0; } |
34f9227c | 568 | #endif |
e35d0039 | 569 | |
81d425f6 | 570 | #if wxUSE_WCHAR_T |
e97a90f0 | 571 | // multibyte<->widechar conversion |
49828363 RD |
572 | WXDLLEXPORT size_t wxMB2WC(wchar_t *buf, const char *psz, size_t n); |
573 | WXDLLEXPORT size_t wxWC2MB(char *buf, const wchar_t *psz, size_t n); | |
1777b9bb DW |
574 | # if wxUSE_UNICODE |
575 | # define wxMB2WX wxMB2WC | |
576 | # define wxWX2MB wxWC2MB | |
577 | # define wxWC2WX wxStrncpy | |
578 | # define wxWX2WC wxStrncpy | |
579 | # else | |
580 | # define wxMB2WX wxStrncpy | |
581 | # define wxWX2MB wxStrncpy | |
582 | # define wxWC2WX wxWC2MB | |
583 | # define wxWX2WC wxMB2WC | |
584 | # endif | |
0f3e3e0c JS |
585 | #else |
586 | // No wxUSE_WCHAR_T: we have to do something (JACS) | |
1777b9bb DW |
587 | # define wxMB2WC wxStrncpy |
588 | # define wxWC2MB wxStrncpy | |
589 | # define wxMB2WX wxStrncpy | |
590 | # define wxWX2MB wxStrncpy | |
591 | # define wxWC2WX wxWC2MB | |
592 | # define wxWX2WC wxMB2WC | |
81d425f6 | 593 | #endif |
0f3e3e0c | 594 | |
49828363 | 595 | WXDLLEXPORT bool wxOKlibc(); // for internal use |
e97a90f0 OK |
596 | |
597 | // if libc versions are not available, use replacements defined in wxchar.cpp | |
598 | #ifndef wxStrdup | |
49828363 | 599 | WXDLLEXPORT wxChar * wxStrdup(const wxChar *psz); |
e97a90f0 OK |
600 | #endif |
601 | ||
0841bffa | 602 | #ifndef wxStricmp |
49828363 | 603 | WXDLLEXPORT int wxStricmp(const wxChar *psz1, const wxChar *psz2); |
0841bffa OK |
604 | #endif |
605 | ||
e97a90f0 | 606 | #ifndef wxStrtok |
49828363 | 607 | WXDLLEXPORT wxChar * wxStrtok(wxChar *psz, const wxChar *delim, wxChar **save_ptr); |
e97a90f0 OK |
608 | #endif |
609 | ||
610 | #ifndef wxSetlocale | |
49828363 | 611 | WXDLLEXPORT wxChar * wxSetlocale(int category, const wxChar *locale); |
e97a90f0 OK |
612 | #endif |
613 | ||
853d7d3d | 614 | #ifdef wxNEED_WCSLEN // for use in buffer.h |
49828363 | 615 | WXDLLEXPORT size_t wcslen(const wchar_t *s); |
853d7d3d OK |
616 | #endif |
617 | ||
57f6da0d | 618 | #ifdef wxNEED_WX_CTYPE_H |
49828363 RD |
619 | WXDLLEXPORT int wxIsalnum(wxChar ch); |
620 | WXDLLEXPORT int wxIsalpha(wxChar ch); | |
621 | WXDLLEXPORT int wxIsctrl(wxChar ch); | |
622 | WXDLLEXPORT int wxIsdigit(wxChar ch); | |
623 | WXDLLEXPORT int wxIsgraph(wxChar ch); | |
624 | WXDLLEXPORT int wxIslower(wxChar ch); | |
625 | WXDLLEXPORT int wxIsprint(wxChar ch); | |
626 | WXDLLEXPORT int wxIspunct(wxChar ch); | |
627 | WXDLLEXPORT int wxIsspace(wxChar ch); | |
628 | WXDLLEXPORT int wxIsupper(wxChar ch); | |
629 | WXDLLEXPORT int wxIsxdigit(wxChar ch); | |
630 | WXDLLEXPORT int wxTolower(wxChar ch); | |
631 | WXDLLEXPORT int wxToupper(wxChar ch); | |
57f6da0d OK |
632 | #endif |
633 | ||
853d7d3d | 634 | #ifdef wxNEED_WX_STRING_H |
49828363 RD |
635 | WXDLLEXPORT wxChar * wxStrcat(wxChar *dest, const wxChar *src); |
636 | WXDLLEXPORT wxChar * wxStrchr(const wxChar *s, wxChar c); | |
637 | WXDLLEXPORT int wxStrcmp(const wxChar *s1, const wxChar *s2); | |
638 | WXDLLEXPORT int wxStrcoll(const wxChar *s1, const wxChar *s2); | |
639 | WXDLLEXPORT wxChar * wxStrcpy(wxChar *dest, const wxChar *src); | |
640 | WXDLLEXPORT size_t wxStrcspn(const wxChar *s, const wxChar *reject); | |
641 | WXDLLEXPORT size_t wxStrlen(const wxChar *s); | |
642 | WXDLLEXPORT wxChar * wxStrncat(wxChar *dest, const wxChar *src, size_t n); | |
643 | WXDLLEXPORT int wxStrncmp(const wxChar *s1, const wxChar *s2, size_t n); | |
644 | WXDLLEXPORT wxChar * wxStrncpy(wxChar *dest, const wxChar *src, size_t n); | |
645 | WXDLLEXPORT wxChar * wxStrpbrk(const wxChar *s, const wxChar *accept); | |
646 | WXDLLEXPORT wxChar * wxStrrchr(const wxChar *s, wxChar c); | |
647 | WXDLLEXPORT size_t wxStrspn(const wxChar *s, const wxChar *accept); | |
648 | WXDLLEXPORT wxChar * wxStrstr(const wxChar *haystack, const wxChar *needle); | |
649 | WXDLLEXPORT double wxStrtod(const wxChar *nptr, wxChar **endptr); | |
650 | WXDLLEXPORT long int wxStrtol(const wxChar *nptr, wxChar **endptr, int base); | |
651 | WXDLLEXPORT unsigned long int wxStrtoul(const wxChar *nptr, wxChar **endptr, int base); | |
652 | WXDLLEXPORT size_t wxStrxfrm(wxChar *dest, const wxChar *src, size_t n); | |
853d7d3d OK |
653 | #endif |
654 | ||
e97a90f0 | 655 | #ifdef wxNEED_WX_STDIO_H |
1777b9bb DW |
656 | # include <stdio.h> |
657 | # include <stdarg.h> | |
e385b3ff OK |
658 | WXDLLEXPORT FILE * wxFopen(const wxChar *path, const wxChar *mode); |
659 | WXDLLEXPORT FILE * wxFreopen(const wxChar *path, const wxChar *mode, FILE *stream); | |
49828363 RD |
660 | WXDLLEXPORT int wxPrintf(const wxChar *fmt, ...); |
661 | WXDLLEXPORT int wxVprintf(const wxChar *fmt, va_list argptr); | |
662 | WXDLLEXPORT int wxFprintf(FILE *stream, const wxChar *fmt, ...); | |
663 | WXDLLEXPORT int wxVfprintf(FILE *stream, const wxChar *fmt, va_list argptr); | |
664 | WXDLLEXPORT int wxSprintf(wxChar *buf, const wxChar *fmt, ...); | |
665 | WXDLLEXPORT int wxVsprintf(wxChar *buf, const wxChar *fmt, va_list argptr); | |
666 | WXDLLEXPORT int wxSscanf(const wxChar *buf, const wxChar *fmt, ...); | |
667 | WXDLLEXPORT int wxVsscanf(const wxChar *buf, const wxChar *fmt, va_list argptr); | |
e97a90f0 OK |
668 | #endif |
669 | ||
a982ddd2 | 670 | #ifndef wxAtof |
49828363 | 671 | WXDLLEXPORT double wxAtof(const wxChar *psz); |
a982ddd2 OK |
672 | #endif |
673 | ||
674 | #ifdef wxNEED_WX_STDLIB_H | |
49828363 RD |
675 | WXDLLEXPORT int wxAtoi(const wxChar *psz); |
676 | WXDLLEXPORT long wxAtol(const wxChar *psz); | |
677 | WXDLLEXPORT wxChar * wxGetenv(const wxChar *name); | |
678 | WXDLLEXPORT int wxSystem(const wxChar *psz); | |
639a9fb5 OK |
679 | #endif |
680 | ||
e385b3ff OK |
681 | #ifdef wxNEED_WX_TIME_H |
682 | WXDLLEXPORT size_t wxStrftime(wxChar *s, size_t max, const wxChar *fmt, const struct tm *tm); | |
683 | #endif | |
684 | ||
cdb51680 VZ |
685 | // although global macros with such names are really bad, we want to have |
686 | // another name for _T() which should be used to avoid confusion between _T() | |
687 | // and _() in wxWindows sources | |
223d09f6 | 688 | #define wxT(x) _T(x) |
cdb51680 | 689 | |
e90c1d2a VZ |
690 | // a Unicode-friendly __FILE__ analog |
691 | #ifndef __TFILE__ | |
223d09f6 | 692 | #define __XFILE__(x) wxT(x) |
e90c1d2a VZ |
693 | #define __TFILE__ __XFILE__(__FILE__) |
694 | #endif | |
695 | ||
e35d0039 JS |
696 | #endif |
697 | //_WX_WXCHAR_H_ | |
1777b9bb | 698 |