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