1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Declarations common to wx char/wchar_t usage (wide chars)
4 // Author: Joel Farley, Ove Kåven
5 // Modified by: Vadim Zeitlin, Robert Roebling
8 // Copyright: (c) 1998-2002 wxWindows dev team
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #if defined(__GNUG__) && !defined(__APPLE__)
16 #pragma interface "wxchar.h"
19 // ----------------------------------------------------------------------------
20 // first deal with Unicode setting: wxUSE_UNICODE should be defined as 0 or 1
21 // and is used by wxWindows, _UNICODE and/or UNICODE may be defined or used by
22 // the system headers so bring these settings in sync
23 // ----------------------------------------------------------------------------
25 // set wxUSE_UNICODE to 1 if UNICODE or _UNICODE is defined
26 #if defined(_UNICODE) || defined(UNICODE)
28 #define wxUSE_UNICODE 1
31 #define wxUSE_UNICODE 0
35 // and vice versa: define UNICODE and _UNICODE if wxUSE_UNICODE is 1...
45 // check whether we have wchar_t
46 #if !defined(wxUSE_WCHAR_T)
47 #if defined(__WIN16__)
48 // no wchar_t under Win16 regadrless of compiler used
49 #define wxUSE_WCHAR_T 0
50 #elif defined(__UNIX__)
51 #if defined(HAVE_WCSTR_H) || defined(HAVE_WCHAR_H) || defined(__FreeBSD__) || defined(__DARWIN__)
52 #define wxUSE_WCHAR_T 1
54 #define wxUSE_WCHAR_T 0
56 #elif defined(__GNUWIN32__) && !defined(__MINGW32__)
57 #define wxUSE_WCHAR_T 0
58 #elif defined(__WATCOMC__)
59 #define wxUSE_WCHAR_T 0
60 #elif defined(__VISAGECPP__) && (__IBMCPP__ < 400)
61 #define wxUSE_WCHAR_T 0
63 // add additional compiler checks if this fails
64 #define wxUSE_WCHAR_T 1
66 #endif // !defined(wxUSE_WCHAR_T)
68 // Unicode support requires wchar_t
69 #if wxUSE_UNICODE && !wxUSE_WCHAR_T
70 #error "wchar_t must be available in Unicode build"
73 // ----------------------------------------------------------------------------
74 // standard headers we need here
76 // NB: don't include any wxWindows headers here because almost of them include
78 // ----------------------------------------------------------------------------
80 // Required for wxPrintf() etc
83 // non Unix compilers which do have wchar.h (but not tchar.h which is included
84 // below and which includes wchar.h anyhow)
85 #if defined(__MWERKS__) || defined(__VISAGECPP__)
94 #elif defined(HAVE_WCSTR_H)
95 // old compilers have relevant declarations here
97 #elif defined(__FreeBSD__) || defined(__DARWIN__) || defined(__EMX__)
98 // include stdlib.h for wchar_t
100 #endif // HAVE_WCHAR_H
101 #endif // wxUSE_WCHAR_T
103 // ----------------------------------------------------------------------------
104 // define wxHAVE_TCHAR_SUPPORT for the compilers which support the TCHAR type
105 // mapped to either char or wchar_t depending on the ASCII/Unicode mode and have
106 // the function mapping _tfoo() -> foo() or wfoo()
107 // ----------------------------------------------------------------------------
109 // VC++ and BC++ starting with 5.2 have TCHAR support
111 #define wxHAVE_TCHAR_SUPPORT
112 #elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x520)
113 #define wxHAVE_TCHAR_SUPPORT
115 #elif defined(__MINGW32__) && wxCHECK_W32API_VERSION( 1, 0 )
116 #define wxHAVE_TCHAR_SUPPORT
120 #elif 0 && defined(__VISAGECPP__) && (__IBMCPP__ >= 400)
121 // VZ: the old VisualAge definitions were completely wrong and had no
122 // chance at all to work in Unicode build anyhow so let's pretend that
123 // VisualAge does _not_ support TCHAR for the moment (as indicated by
124 // "0 &&" above) until someone really has time to delve into Unicode
127 // VisualAge 4.0+ supports TCHAR
128 #define wxHAVE_TCHAR_SUPPORT
129 #endif // compilers with (good) TCHAR support
131 #ifdef wxHAVE_TCHAR_SUPPORT
132 // get TCHAR definition if we've got it
135 // we surely do have wchar_t if we have TCHAR
136 #ifndef wxUSE_WCHAR_T
137 #define wxUSE_WCHAR_T 1
138 #endif // !defined(wxUSE_WCHAR_T)
140 // and we also do have wcslen()
144 #endif // wxHAVE_TCHAR_SUPPORT
146 // ----------------------------------------------------------------------------
147 // define wxChar type
148 // ----------------------------------------------------------------------------
150 // TODO: define wxCharInt to be equal to either int or wint_t?
154 typedef signed char wxSChar
;
155 typedef unsigned char wxUChar
;
157 // VZ: note that VC++ defines _T[SU]CHAR simply as wchar_t and not as
158 // signed/unsigned version of it which (a) makes sense to me (unlike
159 // char wchar_t is always unsigned) and (b) was how the previous
160 // definitions worked so keep it like this
162 // GNU libc has __WCHAR_TYPE__ which requires special treatment, see
164 #if !defined(__WCHAR_TYPE__) || \
165 (!defined(__GNUC__) || wxCHECK_GCC_VERSION(2, 96))
167 typedef wchar_t wxChar
;
168 typedef wchar_t wxSChar
;
169 typedef wchar_t wxUChar
;
170 #else // __WCHAR_TYPE__ and gcc < 2.96
171 // VS: wxWindows used to define wxChar as __WCHAR_TYPE__ here. However,
172 // this doesn't work with new GCC 3.x compilers because wchar_t is
173 // C++'s builtin type in the new standard. OTOH, old compilers (GCC
174 // 2.x) won't accept new definition of wx{S,U}Char, therefore we
175 // have to define wxChar conditionally depending on detected
176 // compiler & compiler version.
177 // with old definition of wxChar.
178 typedef __WCHAR_TYPE__ wxChar
;
179 typedef __WCHAR_TYPE__ wxSChar
;
180 typedef __WCHAR_TYPE__ wxUChar
;
181 #endif // __WCHAR_TYPE__
182 #endif // ASCII/Unicode
184 // ----------------------------------------------------------------------------
185 // define _T() and related macros
186 // ----------------------------------------------------------------------------
188 // BSD systems define _T() to be something different in ctype.h, override it
189 #if defined(__FreeBSD__) || defined(__DARWIN__)
194 // could already be defined by tchar.h (it's quasi standard)
200 #endif // ASCII/Unicode
201 #endif // !defined(_T)
203 // although global macros with such names are normally bad, we want to have
204 // another name for _T() which should be used to avoid confusion between _T()
205 // and _() in wxWindows sources
208 // Unicode-friendly __FILE__, __DATE__ and __TIME__ analogs
210 #define __XFILE__(x) wxT(x)
211 #define __TFILE__ __XFILE__(__FILE__)
215 #define __XDATE__(x) wxT(x)
216 #define __TDATE__ __XDATE__(__DATE__)
220 #define __XTIME__(x) wxT(x)
221 #define __TTIME__ __XTIME__(__TIME__)
224 // ----------------------------------------------------------------------------
225 // define wxFoo() function for each standard foo() function whose signature
226 // (exceptionally including the return type) includes any mention of char:
227 // wxFoo() is going to be a Unicode-friendly version of foo(), i.e. will have
228 // the same signature but with char replaced by wxChar which allows us to use
229 // it in Unicode build as well
230 // ----------------------------------------------------------------------------
232 #ifdef wxHAVE_TCHAR_SUPPORT
236 #define wxIsalnum _istalnum
237 #define wxIsalpha _istalpha
238 #define wxIsctrl _istctrl
239 #define wxIsdigit _istdigit
240 #define wxIsgraph _istgraph
241 #define wxIslower _istlower
242 #define wxIsprint _istprint
243 #define wxIspunct _istpunct
244 #define wxIsspace _istspace
245 #define wxIsupper _istupper
246 #define wxIsxdigit _istxdigit
247 #define wxTolower _totlower
248 #define wxToupper _totupper
251 #define wxSetlocale _tsetlocale
253 // string.h functions
254 #define wxStrcat _tcscat
255 #define wxStrchr _tcschr
256 #define wxStrcmp _tcscmp
257 #define wxStrcoll _tcscoll
258 #define wxStrcpy _tcscpy
259 #define wxStrcspn _tcscspn
260 #define wxStrftime _tcsftime
261 #define wxStricmp _tcsicmp
262 #define wxStrnicmp _tcsnicmp
263 #define wxStrlen_ _tcslen // used in wxStrlen inline function
264 #define wxStrncat _tcsncat
265 #define wxStrncmp _tcsncmp
266 #define wxStrncpy _tcsncpy
267 #define wxStrpbrk _tcspbrk
268 #define wxStrrchr _tcsrchr
269 #define wxStrspn _tcsspn
270 #define wxStrstr _tcsstr
271 #define wxStrtod _tcstod
272 #define wxStrtol _tcstol
273 #define wxStrtoul _tcstoul
274 #define wxStrxfrm _tcsxfrm
277 #define wxFgetc _fgettc
278 #define wxFgetchar _fgettchar
279 #define wxFgets _fgetts
280 #define wxFopen _tfopen
281 #define wxFputc _fputtc
282 #define wxFputchar _fputtchar
283 #define wxFprintf _ftprintf
284 #define wxFputs _fputts
285 #define wxFreopen _tfreopen
286 #define wxFscanf _ftscanf
287 #define wxGetc _gettc
288 #define wxGetchar _gettchar
289 #define wxGets _getts
290 #define wxPerror _tperror
291 #define wxPrintf _tprintf
292 #define wxPutc _puttc
293 #define wxPutchar _puttchar
294 #define wxPuts _putts
295 #define wxScanf _tscanf
296 #define wxSprintf _stprintf
297 #define wxSscanf _stscanf
298 #define wxTmpnam _ttmpnam
299 #define wxUngetc _tungetc
300 #define wxVfprintf _vftprintf
301 #define wxVprintf _vtprintf
302 #define wxVsscanf _vstscanf
303 #define wxVsprintf _vstprintf
305 // special case: not all TCHAR-aware compilers have those
306 #if defined(__VISUALC__) || \
307 (defined(__BORLANDC__) && __BORLANDC__ >= 0x540)
308 #define wxVsnprintf_ _vsntprintf
309 #define wxSnprintf_ _sntprintf
312 // special case: these functions are missing under Win9x with Unicows so we
313 // have to implement them ourselves
314 #if wxUSE_UNICODE_MSLU
315 #define wxRemove wxMSLU__tremove
316 #define wxRename wxMSLU__trename
318 #define wxRemove _tremove
319 #define wxRename _trename
322 // stdlib.h functions
325 // #define wxAtof _tttof -- notice that there is no such thing (why?)
326 #define wxGetenv _tgetenv
327 #define wxSystem _tsystem
330 #define wxAsctime _tasctime
331 #define wxCtime _tctime
332 #else // !TCHAR-aware compilers
336 // this is probably glibc-specific
337 #if defined(__WCHAR_TYPE__)
338 // ctype.h functions (wctype.h)
339 #define wxIsalnum iswalnum
340 #define wxIsalpha iswalpha
341 #define wxIsctrl iswcntrl
342 #define wxIsdigit iswdigit
343 #define wxIsgraph iswgraph
344 #define wxIslower iswlower
345 #define wxIsprint iswprint
346 #define wxIspunct iswpunct
347 #define wxIsspace iswspace
348 #define wxIsupper iswupper
349 #define wxIsxdigit iswxdigit
351 #if defined(__GLIBC__) && (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0)
352 // /usr/include/wctype.h incorrectly declares translations
353 // tables which provokes tons of compile-time warnings -- try
355 #define wxTolower(wc) towctrans((wc), (wctrans_t)__ctype_tolower)
356 #define wxToupper(wc) towctrans((wc), (wctrans_t)__ctype_toupper)
358 #define wxTolower towlower
359 #define wxToupper towupper
362 // string.h functions (wchar.h)
363 #define wxStrcat wcscat
364 #define wxStrchr wcschr
365 #define wxStrcmp wcscmp
366 #define wxStrcoll wcscoll
367 #define wxStrcpy wcscpy
368 #define wxStrcspn wcscspn
369 #define wxStrlen_ wxWcslen // wxStrlen_() is used in wxStrlen()
370 #define wxStrncat wcsncat
371 #define wxStrncmp wcsncmp
372 #define wxStrncpy wcsncpy
373 #define wxStrpbrk wcspbrk
374 #define wxStrrchr wcsrchr
375 #define wxStrspn wcsspn
376 #define wxStrstr wcsstr
377 #define wxStrtod wcstod
378 #define wxStrtol wcstol
379 #define wxStrtoul wcstoul
380 #define wxStrxfrm wcsxfrm
382 #define wxFgetc fgetwc
383 #define wxFgetchar fgetwchar
384 #define wxFgets fgetws
385 #define wxFputc fputwc
386 #define wxFputchar fputwchar
388 #define wxGetchar getwchar
390 #define wxUngetc ungetwc
394 #define wxPutchar wputchar
396 #define wxFputs fputws
398 #define wxNEED_FPUTWC
402 int wxFputs(const wxChar
*ch
, FILE *stream
);
403 int wxPutc(wxChar ch
, FILE *stream
);
405 #define wxPuts(ws) wxFputs(ws, stdout)
406 #define wxPutchar(wch) wxPutc(wch, stdout)
409 // we need %s to %ls conversion for printf and scanf etc
410 #define wxNEED_PRINTF_CONVERSION
412 // glibc doesn't have wide char equivalents of the other stuff so
413 // use our own versions
414 #define wxNEED_WX_STDIO_H
415 #define wxNEED_WX_STDLIB_H
416 #define wxNEED_WX_TIME_H
418 #error "Please define wide character functions for your environment"
425 #define wxIsalnum isalnum
426 #define wxIsalpha isalpha
427 #define wxIsctrl isctrl
428 #define wxIsdigit isdigit
429 #define wxIsgraph isgraph
430 #define wxIslower islower
431 #define wxIsprint isprint
432 #define wxIspunct ispunct
433 #define wxIsspace isspace
434 #define wxIsupper isupper
435 #define wxIsxdigit isxdigit
436 #define wxTolower tolower
437 #define wxToupper toupper
440 #define wxSetlocale setlocale
442 // string.h functions
443 #define wxStrcat strcat
444 #define wxStrchr strchr
445 #define wxStrcmp strcmp
446 #define wxStrcoll strcoll
447 #define wxStrcpy strcpy
448 #define wxStrcspn strcspn
449 #if !defined(__MWERKS__) || !defined(__WXMAC__)
450 #define wxStrdup strdup
452 // wxStricmp and wxStrnicmp are defined below
453 #define wxStrlen_ strlen // used in wxStrlen inline function
454 #define wxStrncat strncat
455 #define wxStrncmp strncmp
456 #define wxStrncpy strncpy
457 #define wxStrpbrk strpbrk
458 #define wxStrrchr strrchr
459 #define wxStrspn strspn
460 #define wxStrstr strstr
461 #define wxStrtod strtod
463 #define wxStrtok(str, sep, last) strtok_r(str, sep, last)
465 #define wxStrtol strtol
466 #define wxStrtoul strtoul
467 #define wxStrxfrm strxfrm
470 #define wxFopen fopen
471 #define wxFreopen freopen
472 #define wxPerror perror
473 #define wxRemove remove
474 #define wxRename rename
475 #define wxTmpnam tmpnam
477 #define wxFgetc fgetc
478 #define wxFgetchar fgetchar
479 #define wxFgets fgets
480 #define wxFputc fputc
481 #define wxFputchar fputchar
482 #define wxFprintf fprintf
483 #define wxFscanf fscanf
485 #define wxGetchar getchar
487 #define wxPrintf printf
489 #define wxPutchar putchar
491 #define wxScanf scanf
492 #define wxSprintf sprintf
493 #define wxSscanf sscanf
494 #define wxUngetc ungetc
495 #define wxVfprintf vfprintf
496 #define wxVprintf vprintf
497 #define wxVsscanf vsscanf
498 #define wxVsprintf vsprintf
500 // stdlib.h functions
504 #define wxGetenv getenv
505 #define wxSystem system
508 #define wxAsctime asctime
509 #define wxCtime ctime
510 #define wxStrftime strftime
511 #endif // Unicode/ASCII
512 #endif // TCHAR-aware compilers/the others
514 // ----------------------------------------------------------------------------
515 // various special cases
516 // ----------------------------------------------------------------------------
518 // define wxStricmp and wxStrnicmp for various compilers
520 // note that in Unicode mode we definitely are going to need our own version
521 #if !defined(wxStricmp) && !wxUSE_UNICODE
522 #if defined(__BORLANDC__) || defined(__WATCOMC__) || \
523 defined(__SALFORDC__) || defined(__VISAGECPP__) || \
524 defined(__EMX__) || defined(__DJGPP__)
525 #define wxStricmp stricmp
526 #define wxStrnicmp strnicmp
527 #elif defined(__SC__) || defined(__VISUALC__) || \
528 (defined(__MWERKS__) && defined(__INTEL__))
529 #define wxStricmp _stricmp
530 #define wxStrnicmp _strnicmp
531 #elif defined(__UNIX__) || defined(__GNUWIN32__)
532 #define wxStricmp strcasecmp
533 #define wxStrnicmp strncasecmp
534 // #else -- use wxWindows implementation
536 #endif // !defined(wxStricmp)
538 // define wxWcslen() which should be always available if wxUSE_WCHAR_T == 1 (as
539 // it's used in wx/buffer.h -- and also might be used just below by wxStrlen()
540 // when wxStrlen_() is #define'd as wxWcslen so do it before defining wxStrlen)
543 #define wxWcslen wcslen
545 inline size_t wxWcslen(const wchar_t *s
)
554 #endif // wxUSE_WCHAR_T
556 // checks whether the passed in pointer is NULL and if the string is empty
557 inline bool wxIsEmpty(const wxChar
*p
) { return !p
|| !*p
; }
559 // safe version of strlen() (returns 0 if passed NULL pointer)
560 inline size_t wxStrlen(const wxChar
*psz
) { return psz
? wxStrlen_(psz
) : 0; }
562 WXDLLEXPORT
bool wxOKlibc(); // for internal use
564 // ----------------------------------------------------------------------------
565 // printf() family saga
566 // ----------------------------------------------------------------------------
569 First of all, we always want to define safe snprintf() function to be used
570 instead of sprintf(). Some compilers already have it (or rather vsnprintf()
571 which we really need...), otherwise we implement it using our own printf()
574 We define function with a trailing underscore here because the real one is a
575 wrapper around it as explained below
579 #if defined(HAVE__VSNWPRINTF)
580 #define wxVsnprintf_ _vsnwprintf
581 /* MinGW?MSVCRT has the wrong vswprintf */
582 #elif defined(HAVE_VSWPRINTF) && !defined(__MINGW32__)
583 #define wxVsnprintf_ vswprintf
586 // all versions of CodeWarrior supported by wxWindows apparently have
588 #if defined(HAVE_VSNPRINTF) || defined(__MWERKS__)
589 // assume we have snprintf() too if we have vsnprintf()
590 #define wxVsnprintf_ vsnprintf
591 #define wxSnprintf_ snprintf
594 #endif // wxVsnprintf_ not defined yet
597 // no [v]snprintf(), cook our own
598 WXDLLEXPORT
int wxSnprintf_(wxChar
*buf
, size_t len
, const wxChar
*format
,
599 ...) ATTRIBUTE_PRINTF_3
;
602 WXDLLEXPORT
int wxVsnprintf_(wxChar
*buf
, size_t len
, const wxChar
*format
,
607 In Unicode mode we need to have all standard functions such as wprintf() and
608 so on but not all systems have them so use our own implementations in this
611 #if wxUSE_UNICODE && !defined(wxHAVE_TCHAR_SUPPORT) && !defined(HAVE_WPRINTF)
612 #define wxNEED_WPRINTF
616 More Unicode complications: although both ANSI C and C++ define a number of
617 wide character functions such as wprintf(), not all environments have them.
618 Worse, those which do have different behaviours: under Windows, %s format
619 specifier changes its meaning in Unicode build and expects a Unicode string
620 while under Unix/POSIX it still means an ASCII string even for wprintf() and
621 %ls has to be used for wide strings.
623 We choose to always emulate Windows behaviour as more useful for us so even
624 if we have wprintf() we still must wrap it in a non trivial wxPrintf().
626 However, if we don't have any vswprintf() at all we don't need to redefine
627 anything as our own wxVsnprintf_() already behaves as needed.
630 #undef wxNEED_PRINTF_CONVERSION
633 #if defined(wxNEED_PRINTF_CONVERSION) || defined(wxNEED_WPRINTF)
634 // we need to implement all wide character printf and scanf functions
635 // either because we don't have them at all or because they don't have the
638 #include <stdio.h> // for FILE
640 int wxScanf( const wxChar
*format
, ... ) ATTRIBUTE_PRINTF_1
;
641 int wxSscanf( const wxChar
*str
, const wxChar
*format
, ... ) ATTRIBUTE_PRINTF_2
;
642 int wxFscanf( FILE *stream
, const wxChar
*format
, ... ) ATTRIBUTE_PRINTF_2
;
643 int wxVsscanf( const wxChar
*str
, const wxChar
*format
, va_list ap
);
644 int wxPrintf( const wxChar
*format
, ... ) ATTRIBUTE_PRINTF_1
;
645 int wxSprintf( wxChar
*str
, const wxChar
*format
, ... ) ATTRIBUTE_PRINTF_2
;
646 int wxFprintf( FILE *stream
, const wxChar
*format
, ... ) ATTRIBUTE_PRINTF_2
;
647 int wxVfprintf( FILE *stream
, const wxChar
*format
, va_list ap
);
648 int wxVprintf( const wxChar
*format
, va_list ap
);
649 int wxVsprintf( wxChar
*str
, const wxChar
*format
, va_list ap
);
650 #endif // wxNEED_PRINTF_CONVERSION
652 // these 2 can be simply mapped to the versions with underscore at the end
653 // if we don't have to do the conversion
654 #ifdef wxNEED_PRINTF_CONVERSION
655 int wxSnprintf( wxChar
*str
, size_t size
, const wxChar
*format
, ... ) ATTRIBUTE_PRINTF_3
;
656 int wxVsnprintf( wxChar
*str
, size_t size
, const wxChar
*format
, va_list ap
);
658 #define wxSnprintf wxSnprintf_
659 #define wxVsnprintf wxVsnprintf_
662 // ----------------------------------------------------------------------------
663 // various functions which might not be available in libc and for which we
664 // provide our own replacements in wxchar.cpp
665 // ----------------------------------------------------------------------------
669 // VZ: note that this is never defined currently
670 #ifdef wxNEED_WX_CTYPE_H
671 WXDLLEXPORT
int wxIsalnum(wxChar ch
);
672 WXDLLEXPORT
int wxIsalpha(wxChar ch
);
673 WXDLLEXPORT
int wxIsctrl(wxChar ch
);
674 WXDLLEXPORT
int wxIsdigit(wxChar ch
);
675 WXDLLEXPORT
int wxIsgraph(wxChar ch
);
676 WXDLLEXPORT
int wxIslower(wxChar ch
);
677 WXDLLEXPORT
int wxIsprint(wxChar ch
);
678 WXDLLEXPORT
int wxIspunct(wxChar ch
);
679 WXDLLEXPORT
int wxIsspace(wxChar ch
);
680 WXDLLEXPORT
int wxIsupper(wxChar ch
);
681 WXDLLEXPORT
int wxIsxdigit(wxChar ch
);
682 WXDLLEXPORT
int wxTolower(wxChar ch
);
683 WXDLLEXPORT
int wxToupper(wxChar ch
);
684 #endif // wxNEED_WX_CTYPE_H
686 // under VC++ 6.0 isspace() returns 1 for 8 bit chars which completely breaks
687 // the file parsing -- this may be true for 5.0 as well, update #ifdef then
688 #if defined(__VISUALC__) && (__VISUALC__ >= 1200) && !wxUSE_UNICODE
690 #define wxIsspace(c) ((((unsigned)c) < 128) && isspace(c))
694 // string.h functions
696 // VZ: this is never defined neither currently
697 #ifdef wxNEED_WX_STRING_H
698 WXDLLEXPORT wxChar
* wxStrcat(wxChar
*dest
, const wxChar
*src
);
699 WXDLLEXPORT
const wxChar
* wxStrchr(const wxChar
*s
, wxChar c
);
700 WXDLLEXPORT wxChar
* wxStrchr(wxChar
*s
, wxChar c
)
701 { return (wxChar
*)wxStrchr((const wxChar
*)s
, c
); }
702 WXDLLEXPORT
int wxStrcmp(const wxChar
*s1
, const wxChar
*s2
);
703 WXDLLEXPORT
int wxStrcoll(const wxChar
*s1
, const wxChar
*s2
);
704 WXDLLEXPORT wxChar
* wxStrcpy(wxChar
*dest
, const wxChar
*src
);
705 WXDLLEXPORT
size_t wxStrcspn(const wxChar
*s
, const wxChar
*reject
);
706 WXDLLEXPORT
size_t wxStrlen(const wxChar
*s
);
707 WXDLLEXPORT wxChar
* wxStrncat(wxChar
*dest
, const wxChar
*src
, size_t n
);
708 WXDLLEXPORT
int wxStrncmp(const wxChar
*s1
, const wxChar
*s2
, size_t n
);
709 WXDLLEXPORT wxChar
* wxStrncpy(wxChar
*dest
, const wxChar
*src
, size_t n
);
710 WXDLLEXPORT
const wxChar
* wxStrpbrk(const wxChar
*s
, const wxChar
*accept
);
711 WXDLLEXPORT wxChar
* wxStrpbrk(wxChar
*s
, const wxChar
*accept
)
712 { return (wxChar
*)wxStrpbrk((const wxChar
*)s
, accept
); }
713 WXDLLEXPORT
const wxChar
* wxStrrchr(const wxChar
*s
, wxChar c
);
714 WXDLLEXPORT wxChar
* wxStrrchr(wxChar
*s
, wxChar c
)
715 { return (wxChar
*)wxStrrchr((const wxChar
*)s
, c
); }
716 WXDLLEXPORT
size_t wxStrspn(const wxChar
*s
, const wxChar
*accept
);
717 WXDLLEXPORT
const wxChar
* wxStrstr(const wxChar
*haystack
, const wxChar
*needle
);
718 WXDLLEXPORT wxChar
*wxStrstr(wxChar
*haystack
, const wxChar
*needle
)
719 { return (wxChar
*)wxStrstr((const wxChar
*)haystack
, needle
); }
720 WXDLLEXPORT
double wxStrtod(const wxChar
*nptr
, wxChar
**endptr
);
721 WXDLLEXPORT
long int wxStrtol(const wxChar
*nptr
, wxChar
**endptr
, int base
);
722 WXDLLEXPORT
unsigned long int wxStrtoul(const wxChar
*nptr
, wxChar
**endptr
, int base
);
723 WXDLLEXPORT
size_t wxStrxfrm(wxChar
*dest
, const wxChar
*src
, size_t n
);
724 #endif // wxNEED_WX_STRING_H
727 WXDLLEXPORT wxChar
* wxStrdup(const wxChar
*psz
);
731 WXDLLEXPORT
int wxStricmp(const wxChar
*psz1
, const wxChar
*psz2
);
735 WXDLLEXPORT
int wxStrnicmp(const wxChar
*psz1
, const wxChar
*psz2
, size_t len
);
739 WXDLLEXPORT wxChar
* wxStrtok(wxChar
*psz
, const wxChar
*delim
, wxChar
**save_ptr
);
743 class WXDLLEXPORT wxWCharBuffer
;
744 WXDLLEXPORT wxWCharBuffer
wxSetlocale(int category
, const wxChar
*locale
);
748 #ifdef wxNEED_WX_STDIO_H
750 WXDLLEXPORT
FILE * wxFopen(const wxChar
*path
, const wxChar
*mode
);
751 WXDLLEXPORT
FILE * wxFreopen(const wxChar
*path
, const wxChar
*mode
, FILE *stream
);
752 WXDLLEXPORT
int wxRemove(const wxChar
*path
);
753 WXDLLEXPORT
int wxRename(const wxChar
*oldpath
, const wxChar
*newpath
);
755 // *printf() family is handled separately
756 #endif // wxNEED_WX_STDIO_H
759 // stdlib.h functions
761 WXDLLEXPORT
double wxAtof(const wxChar
*psz
);
764 #ifdef wxNEED_WX_STDLIB_H
765 WXDLLEXPORT
int wxAtoi(const wxChar
*psz
);
766 WXDLLEXPORT
long wxAtol(const wxChar
*psz
);
767 WXDLLEXPORT wxChar
* wxGetenv(const wxChar
*name
);
768 WXDLLEXPORT
int wxSystem(const wxChar
*psz
);
773 #ifdef wxNEED_WX_TIME_H
774 WXDLLEXPORT
size_t wxStrftime(wxChar
*s
, size_t max
,
775 const wxChar
*fmt
, const struct tm
*tm
);
776 #endif // wxNEED_WX_TIME_H
778 // ----------------------------------------------------------------------------
779 // multibyte to wide char conversion functions and macros
780 // ----------------------------------------------------------------------------
783 // multibyte<->widechar conversion
784 WXDLLEXPORT
size_t wxMB2WC(wchar_t *buf
, const char *psz
, size_t n
);
785 WXDLLEXPORT
size_t wxWC2MB(char *buf
, const wchar_t *psz
, size_t n
);
788 #define wxMB2WX wxMB2WC
789 #define wxWX2MB wxWC2MB
790 #define wxWC2WX wxStrncpy
791 #define wxWX2WC wxStrncpy
793 #define wxMB2WX wxStrncpy
794 #define wxWX2MB wxStrncpy
795 #define wxWC2WX wxWC2MB
796 #define wxWX2WC wxMB2WC
798 #else // !wxUSE_UNICODE
799 // No wxUSE_WCHAR_T: we have to do something (JACS)
800 #define wxMB2WC wxStrncpy
801 #define wxWC2MB wxStrncpy
802 #define wxMB2WX wxStrncpy
803 #define wxWX2MB wxStrncpy
804 #define wxWC2WX wxWC2MB
805 #define wxWX2WC wxMB2WC
808 #endif //_WX_WXCHAR_H_