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