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 // Almost all compiler have strdup(), but not quite all: CodeWarrior under Mac
84 // and VC++ for Windows CE don't provide it
85 #if !(defined(__MWERKS__) && defined(__WXMAC__)) && !defined(__WXWINCE__)
86 // use #define, not inline wrapper, as it is tested with #ifndef below
87 #define wxStrdupA strdup
90 // non Unix compilers which do have wchar.h (but not tchar.h which is included
91 // below and which includes wchar.h anyhow).
92 // Actually MinGW has tchar.h, but it does not include wchar.h
93 #if defined(__MWERKS__) || defined(__VISAGECPP__) || defined(__MINGW32__)
101 // the current (as of Nov 2002) version of cygwin has a bug in its
102 // wchar.h -- there is no extern "C" around the declarations in it and
103 // this results in linking errors later; also, at least on some
104 // Cygwin versions, wchar.h requires sys/types.h
106 #include <sys/types.h>
113 #elif defined(HAVE_WCSTR_H)
114 // old compilers have relevant declarations here
116 #elif defined(__FreeBSD__) || defined(__DARWIN__) || defined(__EMX__)
117 // include stdlib.h for wchar_t
119 #endif // HAVE_WCHAR_H
120 #endif // wxUSE_WCHAR_T
122 // ----------------------------------------------------------------------------
123 // define wxHAVE_TCHAR_SUPPORT for the compilers which support the TCHAR type
124 // mapped to either char or wchar_t depending on the ASCII/Unicode mode and have
125 // the function mapping _tfoo() -> foo() or wfoo()
126 // ----------------------------------------------------------------------------
128 // VC++ and BC++ starting with 5.2 have TCHAR support
130 #define wxHAVE_TCHAR_SUPPORT
131 #elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x520)
132 #define wxHAVE_TCHAR_SUPPORT
134 #elif defined(__MINGW32__) && wxCHECK_W32API_VERSION( 1, 0 )
135 #define wxHAVE_TCHAR_SUPPORT
139 #elif 0 && defined(__VISAGECPP__) && (__IBMCPP__ >= 400)
140 // VZ: the old VisualAge definitions were completely wrong and had no
141 // chance at all to work in Unicode build anyhow so let's pretend that
142 // VisualAge does _not_ support TCHAR for the moment (as indicated by
143 // "0 &&" above) until someone really has time to delve into Unicode
146 // VisualAge 4.0+ supports TCHAR
147 #define wxHAVE_TCHAR_SUPPORT
148 #endif // compilers with (good) TCHAR support
150 #ifdef wxHAVE_TCHAR_SUPPORT
151 // get TCHAR definition if we've got it
154 // we surely do have wchar_t if we have TCHAR
155 #ifndef wxUSE_WCHAR_T
156 #define wxUSE_WCHAR_T 1
157 #endif // !defined(wxUSE_WCHAR_T)
159 // and we also do have wcslen()
163 #endif // wxHAVE_TCHAR_SUPPORT
165 // ----------------------------------------------------------------------------
166 // define wxChar type
167 // ----------------------------------------------------------------------------
169 // TODO: define wxCharInt to be equal to either int or wint_t?
173 typedef signed char wxSChar
;
174 typedef unsigned char wxUChar
;
176 // VZ: note that VC++ defines _T[SU]CHAR simply as wchar_t and not as
177 // signed/unsigned version of it which (a) makes sense to me (unlike
178 // char wchar_t is always unsigned) and (b) was how the previous
179 // definitions worked so keep it like this
181 // GNU libc has __WCHAR_TYPE__ which requires special treatment, see
183 #if !defined(__WCHAR_TYPE__) || \
184 (!defined(__GNUC__) || wxCHECK_GCC_VERSION(2, 96))
186 typedef wchar_t wxChar
;
187 typedef wchar_t wxSChar
;
188 typedef wchar_t wxUChar
;
189 #else // __WCHAR_TYPE__ and gcc < 2.96
190 // VS: wxWindows used to define wxChar as __WCHAR_TYPE__ here. However,
191 // this doesn't work with new GCC 3.x compilers because wchar_t is
192 // C++'s builtin type in the new standard. OTOH, old compilers (GCC
193 // 2.x) won't accept new definition of wx{S,U}Char, therefore we
194 // have to define wxChar conditionally depending on detected
195 // compiler & compiler version.
196 // with old definition of wxChar.
197 typedef __WCHAR_TYPE__ wxChar
;
198 typedef __WCHAR_TYPE__ wxSChar
;
199 typedef __WCHAR_TYPE__ wxUChar
;
200 #endif // __WCHAR_TYPE__
201 #endif // ASCII/Unicode
203 // ----------------------------------------------------------------------------
204 // define _T() and related macros
205 // ----------------------------------------------------------------------------
207 // BSD systems define _T() to be something different in ctype.h, override it
208 #if defined(__FreeBSD__) || defined(__DARWIN__)
213 // could already be defined by tchar.h (it's quasi standard)
219 #endif // ASCII/Unicode
220 #endif // !defined(_T)
222 // although global macros with such names are normally bad, we want to have
223 // another name for _T() which should be used to avoid confusion between _T()
224 // and _() in wxWindows sources
227 // Unicode-friendly __FILE__, __DATE__ and __TIME__ analogs
229 #define __XFILE__(x) wxT(x)
230 #define __TFILE__ __XFILE__(__FILE__)
234 #define __XDATE__(x) wxT(x)
235 #define __TDATE__ __XDATE__(__DATE__)
239 #define __XTIME__(x) wxT(x)
240 #define __TTIME__ __XTIME__(__TIME__)
243 // ----------------------------------------------------------------------------
244 // define wxFoo() function for each standard foo() function whose signature
245 // (exceptionally including the return type) includes any mention of char:
246 // wxFoo() is going to be a Unicode-friendly version of foo(), i.e. will have
247 // the same signature but with char replaced by wxChar which allows us to use
248 // it in Unicode build as well
249 // ----------------------------------------------------------------------------
251 #ifdef wxHAVE_TCHAR_SUPPORT
255 #define wxIsalnum _istalnum
256 #define wxIsalpha _istalpha
257 #define wxIsctrl _istctrl
258 #define wxIsdigit _istdigit
259 #define wxIsgraph _istgraph
260 #define wxIslower _istlower
261 #define wxIsprint _istprint
262 #define wxIspunct _istpunct
263 #define wxIsspace _istspace
264 #define wxIsupper _istupper
265 #define wxIsxdigit _istxdigit
266 #define wxTolower _totlower
267 #define wxToupper _totupper
270 #define wxSetlocale _tsetlocale
272 // string.h functions
273 #define wxStrcat _tcscat
274 #define wxStrchr _tcschr
275 #define wxStrcmp _tcscmp
276 #define wxStrcoll _tcscoll
277 #define wxStrcpy _tcscpy
278 #define wxStrcspn _tcscspn
279 #define wxStrdupW _wcsdup // notice the 'W'!
280 #define wxStrftime _tcsftime
281 #define wxStricmp _tcsicmp
282 #define wxStrnicmp _tcsnicmp
283 #define wxStrlen_ _tcslen // used in wxStrlen inline function
284 #define wxStrncat _tcsncat
285 #define wxStrncmp _tcsncmp
286 #define wxStrncpy _tcsncpy
287 #define wxStrpbrk _tcspbrk
288 #define wxStrrchr _tcsrchr
289 #define wxStrspn _tcsspn
290 #define wxStrstr _tcsstr
291 #define wxStrtod _tcstod
292 #define wxStrtol _tcstol
293 #define wxStrtoul _tcstoul
294 #define wxStrxfrm _tcsxfrm
297 #define wxFgetc _fgettc
298 #define wxFgetchar _fgettchar
299 #define wxFgets _fgetts
300 #define wxFopen _tfopen
301 #define wxFputc _fputtc
302 #define wxFputchar _fputtchar
303 #define wxFprintf _ftprintf
304 #define wxFputs _fputts
305 #define wxFreopen _tfreopen
306 #define wxFscanf _ftscanf
307 #define wxGetc _gettc
308 #define wxGetchar _gettchar
309 #define wxGets _getts
310 #define wxPerror _tperror
311 #define wxPrintf _tprintf
312 #define wxPutc _puttc
313 #define wxPutchar _puttchar
314 #define wxPuts _putts
315 #define wxScanf _tscanf
316 #define wxSprintf _stprintf
317 #define wxSscanf _stscanf
318 #define wxTmpnam _ttmpnam
319 #define wxUngetc _tungetc
320 #define wxVfprintf _vftprintf
321 #define wxVprintf _vtprintf
322 #define wxVsscanf _vstscanf
323 #define wxVsprintf _vstprintf
325 // special case: not all TCHAR-aware compilers have those
326 #if defined(__VISUALC__) || \
327 (defined(__BORLANDC__) && __BORLANDC__ >= 0x540)
328 #define wxVsnprintf_ _vsntprintf
329 #define wxSnprintf_ _sntprintf
332 // special case: these functions are missing under Win9x with Unicows so we
333 // have to implement them ourselves
334 #if wxUSE_UNICODE_MSLU
335 #define wxRemove wxMSLU__tremove
336 #define wxRename wxMSLU__trename
338 #define wxRemove _tremove
339 #define wxRename _trename
342 // stdlib.h functions
345 // #define wxAtof _tttof -- notice that there is no such thing (why?)
346 #define wxGetenv _tgetenv
347 #define wxSystem _tsystem
350 #define wxAsctime _tasctime
351 #define wxCtime _tctime
352 #else // !TCHAR-aware compilers
356 // this is probably glibc-specific
357 #if defined(__WCHAR_TYPE__)
358 // ctype.h functions (wctype.h)
359 #define wxIsalnum iswalnum
360 #define wxIsalpha iswalpha
361 #define wxIsctrl iswcntrl
362 #define wxIsdigit iswdigit
363 #define wxIsgraph iswgraph
364 #define wxIslower iswlower
365 #define wxIsprint iswprint
366 #define wxIspunct iswpunct
367 #define wxIsspace iswspace
368 #define wxIsupper iswupper
369 #define wxIsxdigit iswxdigit
371 #if defined(__GLIBC__) && (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0)
372 // /usr/include/wctype.h incorrectly declares translations
373 // tables which provokes tons of compile-time warnings -- try
375 #define wxTolower(wc) towctrans((wc), (wctrans_t)__ctype_tolower)
376 #define wxToupper(wc) towctrans((wc), (wctrans_t)__ctype_toupper)
378 #define wxTolower towlower
379 #define wxToupper towupper
382 // string.h functions (wchar.h)
383 #define wxStrcat wcscat
384 #define wxStrchr wcschr
385 #define wxStrcmp wcscmp
386 #define wxStrcoll wcscoll
387 #define wxStrcpy wcscpy
388 #define wxStrcspn wcscspn
389 #define wxStrlen_ wxWcslen // wxStrlen_() is used in wxStrlen()
390 #define wxStrncat wcsncat
391 #define wxStrncmp wcsncmp
392 #define wxStrncpy wcsncpy
393 #define wxStrpbrk wcspbrk
394 #define wxStrrchr wcsrchr
395 #define wxStrspn wcsspn
396 #define wxStrstr wcsstr
397 #define wxStrtod wcstod
398 #define wxStrtol wcstol
399 #define wxStrtoul wcstoul
400 #define wxStrxfrm wcsxfrm
402 #define wxFgetc fgetwc
403 #define wxFgetchar fgetwchar
404 #define wxFgets fgetws
405 #define wxFputc fputwc
406 #define wxFputchar fputwchar
408 #define wxGetchar getwchar
410 #define wxUngetc ungetwc
414 #define wxPutchar wputchar
416 #define wxFputs fputws
418 #define wxNEED_FPUTWC
422 int wxFputs(const wxChar
*ch
, FILE *stream
);
423 int wxPutc(wxChar ch
, FILE *stream
);
425 #define wxPuts(ws) wxFputs(ws, stdout)
426 #define wxPutchar(wch) wxPutc(wch, stdout)
429 // we need %s to %ls conversion for printf and scanf etc
430 #define wxNEED_PRINTF_CONVERSION
432 // glibc doesn't have wide char equivalents of the other stuff so
433 // use our own versions
434 #define wxNEED_WX_STDIO_H
435 #define wxNEED_WX_STDLIB_H
436 #define wxNEED_WX_TIME_H
438 #error "Please define wide character functions for your environment"
445 #define wxIsalnum isalnum
446 #define wxIsalpha isalpha
447 #define wxIsctrl isctrl
448 #define wxIsdigit isdigit
449 #define wxIsgraph isgraph
450 #define wxIslower islower
451 #define wxIsprint isprint
452 #define wxIspunct ispunct
453 #define wxIsspace isspace
454 #define wxIsupper isupper
455 #define wxIsxdigit isxdigit
456 #define wxTolower tolower
457 #define wxToupper toupper
460 #define wxSetlocale setlocale
462 // string.h functions
463 #define wxStrcat strcat
464 #define wxStrchr strchr
465 #define wxStrcmp strcmp
466 #define wxStrcoll strcoll
467 #define wxStrcpy strcpy
468 #define wxStrcspn strcspn
470 // wxStricmp and wxStrnicmp are defined below
471 #define wxStrlen_ strlen // used in wxStrlen inline function
472 #define wxStrncat strncat
473 #define wxStrncmp strncmp
474 #define wxStrncpy strncpy
475 #define wxStrpbrk strpbrk
476 #define wxStrrchr strrchr
477 #define wxStrspn strspn
478 #define wxStrstr strstr
479 #define wxStrtod strtod
481 #define wxStrtok(str, sep, last) strtok_r(str, sep, last)
483 #define wxStrtol strtol
484 #define wxStrtoul strtoul
485 #define wxStrxfrm strxfrm
488 #define wxFopen fopen
489 #define wxFreopen freopen
490 #define wxPerror perror
491 #define wxRemove remove
492 #define wxRename rename
493 #define wxTmpnam tmpnam
495 #define wxFgetc fgetc
496 #define wxFgetchar fgetchar
497 #define wxFgets fgets
498 #define wxFputc fputc
499 #define wxFputchar fputchar
500 #define wxFprintf fprintf
501 #define wxFscanf fscanf
503 #define wxGetchar getchar
505 #define wxPrintf printf
507 #define wxPutchar putchar
509 #define wxScanf scanf
510 #define wxSprintf sprintf
511 #define wxSscanf sscanf
512 #define wxUngetc ungetc
513 #define wxVfprintf vfprintf
514 #define wxVprintf vprintf
515 #define wxVsscanf vsscanf
516 #define wxVsprintf vsprintf
518 // stdlib.h functions
522 #define wxGetenv getenv
523 #define wxSystem system
526 #define wxAsctime asctime
527 #define wxCtime ctime
528 #define wxStrftime strftime
529 #endif // Unicode/ASCII
530 #endif // TCHAR-aware compilers/the others
532 // ----------------------------------------------------------------------------
533 // various special cases
534 // ----------------------------------------------------------------------------
536 // define wxStricmp and wxStrnicmp for various compilers
538 // note that in Unicode mode we definitely are going to need our own version
539 #if !defined(wxStricmp) && !wxUSE_UNICODE
540 #if defined(__BORLANDC__) || defined(__WATCOMC__) || \
541 defined(__SALFORDC__) || defined(__VISAGECPP__) || \
542 defined(__EMX__) || defined(__DJGPP__)
543 #define wxStricmp stricmp
544 #define wxStrnicmp strnicmp
545 #elif defined(__SC__) || defined(__VISUALC__) || \
546 (defined(__MWERKS__) && defined(__INTEL__))
547 #define wxStricmp _stricmp
548 #define wxStrnicmp _strnicmp
549 #elif defined(__UNIX__) || defined(__GNUWIN32__)
550 #define wxStricmp strcasecmp
551 #define wxStrnicmp strncasecmp
552 // #else -- use wxWindows implementation
554 #endif // !defined(wxStricmp)
556 // define wxWcslen() which should be always available if wxUSE_WCHAR_T == 1 (as
557 // it's used in wx/buffer.h -- and also might be used just below by wxStrlen()
558 // when wxStrlen_() is #define'd as wxWcslen so do it before defining wxStrlen)
561 #define wxWcslen wcslen
563 inline size_t wxWcslen(const wchar_t *s
)
572 #endif // wxUSE_WCHAR_T
574 // checks whether the passed in pointer is NULL and if the string is empty
575 inline bool wxIsEmpty(const wxChar
*p
) { return !p
|| !*p
; }
577 // safe version of strlen() (returns 0 if passed NULL pointer)
578 inline size_t wxStrlen(const wxChar
*psz
) { return psz
? wxStrlen_(psz
) : 0; }
580 // each of strdup() and wcsdup() may or may not be available but we need both
581 // of them anyhow for wx/buffer.h so we define the missing one(s) in
582 // wxchar.cpp and so we should always have both wxStrdupA and wxStrdupW
583 // defined -- if this is somehow not the case in some situations, please
584 // correct that and not the lines here
586 #define wxStrdup wxStrdupW
588 #define wxStrdup wxStrdupA
591 WXDLLEXPORT
bool wxOKlibc(); // for internal use
593 // ----------------------------------------------------------------------------
594 // printf() family saga
595 // ----------------------------------------------------------------------------
598 For some systems vsnprintf() exists in the system libraries but not in the
599 headers, so we need to declare it ourselves to be able to use it.
601 #if defined(HAVE_VSNPRINTF) && !defined(HAVE_VSNPRINTF_DECL)
603 int vsnprintf(char *str
, size_t size
, const char *format
, va_list ap
);
604 #endif // !HAVE_VSNPRINTF_DECL
607 First of all, we always want to define safe snprintf() function to be used
608 instead of sprintf(). Some compilers already have it (or rather vsnprintf()
609 which we really need...), otherwise we implement it using our own printf()
612 We define function with a trailing underscore here because the real one is a
613 wrapper around it as explained below
617 #if defined(HAVE__VSNWPRINTF)
618 #define wxVsnprintf_ _vsnwprintf
619 /* MinGW?MSVCRT has the wrong vswprintf */
620 #elif defined(HAVE_VSWPRINTF) && !defined(__MINGW32__)
621 #define wxVsnprintf_ vswprintf
624 // all versions of CodeWarrior supported by wxWindows apparently have
626 #if defined(HAVE_VSNPRINTF) || defined(__MWERKS__)
627 // assume we have snprintf() too if we have vsnprintf()
628 #define wxVsnprintf_ vsnprintf
629 #define wxSnprintf_ snprintf
632 #endif // wxVsnprintf_ not defined yet
635 // no [v]snprintf(), cook our own
636 WXDLLEXPORT
int wxSnprintf_(wxChar
*buf
, size_t len
, const wxChar
*format
,
637 ...) ATTRIBUTE_PRINTF_3
;
640 WXDLLEXPORT
int wxVsnprintf_(wxChar
*buf
, size_t len
, const wxChar
*format
,
645 In Unicode mode we need to have all standard functions such as wprintf() and
646 so on but not all systems have them so use our own implementations in this
649 #if wxUSE_UNICODE && !defined(wxHAVE_TCHAR_SUPPORT) && !defined(HAVE_WPRINTF)
650 #define wxNEED_WPRINTF
654 More Unicode complications: although both ANSI C and C++ define a number of
655 wide character functions such as wprintf(), not all environments have them.
656 Worse, those which do have different behaviours: under Windows, %s format
657 specifier changes its meaning in Unicode build and expects a Unicode string
658 while under Unix/POSIX it still means an ASCII string even for wprintf() and
659 %ls has to be used for wide strings.
661 We choose to always emulate Windows behaviour as more useful for us so even
662 if we have wprintf() we still must wrap it in a non trivial wxPrintf().
664 However, if we don't have any vswprintf() at all we don't need to redefine
665 anything as our own wxVsnprintf_() already behaves as needed.
668 #undef wxNEED_PRINTF_CONVERSION
671 #if defined(wxNEED_PRINTF_CONVERSION) || defined(wxNEED_WPRINTF)
672 // we need to implement all wide character printf and scanf functions
673 // either because we don't have them at all or because they don't have the
676 #include <stdio.h> // for FILE
678 int wxScanf( const wxChar
*format
, ... ) ATTRIBUTE_PRINTF_1
;
679 int wxSscanf( const wxChar
*str
, const wxChar
*format
, ... ) ATTRIBUTE_PRINTF_2
;
680 int wxFscanf( FILE *stream
, const wxChar
*format
, ... ) ATTRIBUTE_PRINTF_2
;
681 int wxVsscanf( const wxChar
*str
, const wxChar
*format
, va_list ap
);
682 int wxPrintf( const wxChar
*format
, ... ) ATTRIBUTE_PRINTF_1
;
683 int wxSprintf( wxChar
*str
, const wxChar
*format
, ... ) ATTRIBUTE_PRINTF_2
;
684 int wxFprintf( FILE *stream
, const wxChar
*format
, ... ) ATTRIBUTE_PRINTF_2
;
685 int wxVfprintf( FILE *stream
, const wxChar
*format
, va_list ap
);
686 int wxVprintf( const wxChar
*format
, va_list ap
);
687 int wxVsprintf( wxChar
*str
, const wxChar
*format
, va_list ap
);
688 #endif // wxNEED_PRINTF_CONVERSION
690 // these 2 can be simply mapped to the versions with underscore at the end
691 // if we don't have to do the conversion
692 #ifdef wxNEED_PRINTF_CONVERSION
693 int wxSnprintf( wxChar
*str
, size_t size
, const wxChar
*format
, ... ) ATTRIBUTE_PRINTF_3
;
694 int wxVsnprintf( wxChar
*str
, size_t size
, const wxChar
*format
, va_list ap
);
696 #define wxSnprintf wxSnprintf_
697 #define wxVsnprintf wxVsnprintf_
700 // ----------------------------------------------------------------------------
701 // various functions which might not be available in libc and for which we
702 // provide our own replacements in wxchar.cpp
703 // ----------------------------------------------------------------------------
707 // VZ: note that this is never defined currently
708 #ifdef wxNEED_WX_CTYPE_H
709 WXDLLEXPORT
int wxIsalnum(wxChar ch
);
710 WXDLLEXPORT
int wxIsalpha(wxChar ch
);
711 WXDLLEXPORT
int wxIsctrl(wxChar ch
);
712 WXDLLEXPORT
int wxIsdigit(wxChar ch
);
713 WXDLLEXPORT
int wxIsgraph(wxChar ch
);
714 WXDLLEXPORT
int wxIslower(wxChar ch
);
715 WXDLLEXPORT
int wxIsprint(wxChar ch
);
716 WXDLLEXPORT
int wxIspunct(wxChar ch
);
717 WXDLLEXPORT
int wxIsspace(wxChar ch
);
718 WXDLLEXPORT
int wxIsupper(wxChar ch
);
719 WXDLLEXPORT
int wxIsxdigit(wxChar ch
);
720 WXDLLEXPORT
int wxTolower(wxChar ch
);
721 WXDLLEXPORT
int wxToupper(wxChar ch
);
722 #endif // wxNEED_WX_CTYPE_H
724 // under VC++ 6.0 isspace() returns 1 for 8 bit chars which completely breaks
725 // the file parsing -- this may be true for 5.0 as well, update #ifdef then
726 #if defined(__VISUALC__) && (__VISUALC__ >= 1200) && !wxUSE_UNICODE
728 #define wxIsspace(c) ((((unsigned)c) < 128) && isspace(c))
732 // string.h functions
734 // VZ: this is never defined neither currently
735 #ifdef wxNEED_WX_STRING_H
736 WXDLLEXPORT wxChar
* wxStrcat(wxChar
*dest
, const wxChar
*src
);
737 WXDLLEXPORT
const wxChar
* wxStrchr(const wxChar
*s
, wxChar c
);
738 WXDLLEXPORT wxChar
* wxStrchr(wxChar
*s
, wxChar c
)
739 { return (wxChar
*)wxStrchr((const wxChar
*)s
, c
); }
740 WXDLLEXPORT
int wxStrcmp(const wxChar
*s1
, const wxChar
*s2
);
741 WXDLLEXPORT
int wxStrcoll(const wxChar
*s1
, const wxChar
*s2
);
742 WXDLLEXPORT wxChar
* wxStrcpy(wxChar
*dest
, const wxChar
*src
);
743 WXDLLEXPORT
size_t wxStrcspn(const wxChar
*s
, const wxChar
*reject
);
744 WXDLLEXPORT
size_t wxStrlen(const wxChar
*s
);
745 WXDLLEXPORT wxChar
* wxStrncat(wxChar
*dest
, const wxChar
*src
, size_t n
);
746 WXDLLEXPORT
int wxStrncmp(const wxChar
*s1
, const wxChar
*s2
, size_t n
);
747 WXDLLEXPORT wxChar
* wxStrncpy(wxChar
*dest
, const wxChar
*src
, size_t n
);
748 WXDLLEXPORT
const wxChar
* wxStrpbrk(const wxChar
*s
, const wxChar
*accept
);
749 WXDLLEXPORT wxChar
* wxStrpbrk(wxChar
*s
, const wxChar
*accept
)
750 { return (wxChar
*)wxStrpbrk((const wxChar
*)s
, accept
); }
751 WXDLLEXPORT
const wxChar
* wxStrrchr(const wxChar
*s
, wxChar c
);
752 WXDLLEXPORT wxChar
* wxStrrchr(wxChar
*s
, wxChar c
)
753 { return (wxChar
*)wxStrrchr((const wxChar
*)s
, c
); }
754 WXDLLEXPORT
size_t wxStrspn(const wxChar
*s
, const wxChar
*accept
);
755 WXDLLEXPORT
const wxChar
* wxStrstr(const wxChar
*haystack
, const wxChar
*needle
);
756 WXDLLEXPORT wxChar
*wxStrstr(wxChar
*haystack
, const wxChar
*needle
)
757 { return (wxChar
*)wxStrstr((const wxChar
*)haystack
, needle
); }
758 WXDLLEXPORT
double wxStrtod(const wxChar
*nptr
, wxChar
**endptr
);
759 WXDLLEXPORT
long int wxStrtol(const wxChar
*nptr
, wxChar
**endptr
, int base
);
760 WXDLLEXPORT
unsigned long int wxStrtoul(const wxChar
*nptr
, wxChar
**endptr
, int base
);
761 WXDLLEXPORT
size_t wxStrxfrm(wxChar
*dest
, const wxChar
*src
, size_t n
);
762 #endif // wxNEED_WX_STRING_H
765 WXDLLEXPORT
char *wxStrdupA(const char *psz
);
769 WXDLLEXPORT
wchar_t *wxStrdupW(const wchar_t *pwz
);
773 WXDLLEXPORT
int wxStricmp(const wxChar
*psz1
, const wxChar
*psz2
);
777 WXDLLEXPORT
int wxStrnicmp(const wxChar
*psz1
, const wxChar
*psz2
, size_t len
);
781 WXDLLEXPORT wxChar
* wxStrtok(wxChar
*psz
, const wxChar
*delim
, wxChar
**save_ptr
);
785 class WXDLLEXPORT wxWCharBuffer
;
786 WXDLLEXPORT wxWCharBuffer
wxSetlocale(int category
, const wxChar
*locale
);
790 #ifdef wxNEED_WX_STDIO_H
792 WXDLLEXPORT
FILE * wxFopen(const wxChar
*path
, const wxChar
*mode
);
793 WXDLLEXPORT
FILE * wxFreopen(const wxChar
*path
, const wxChar
*mode
, FILE *stream
);
794 WXDLLEXPORT
int wxRemove(const wxChar
*path
);
795 WXDLLEXPORT
int wxRename(const wxChar
*oldpath
, const wxChar
*newpath
);
797 // *printf() family is handled separately
798 #endif // wxNEED_WX_STDIO_H
801 // stdlib.h functions
803 WXDLLEXPORT
double wxAtof(const wxChar
*psz
);
806 #ifdef wxNEED_WX_STDLIB_H
807 WXDLLEXPORT
int wxAtoi(const wxChar
*psz
);
808 WXDLLEXPORT
long wxAtol(const wxChar
*psz
);
809 WXDLLEXPORT wxChar
* wxGetenv(const wxChar
*name
);
810 WXDLLEXPORT
int wxSystem(const wxChar
*psz
);
815 #ifdef wxNEED_WX_TIME_H
816 WXDLLEXPORT
size_t wxStrftime(wxChar
*s
, size_t max
,
817 const wxChar
*fmt
, const struct tm
*tm
);
818 #endif // wxNEED_WX_TIME_H
820 // ----------------------------------------------------------------------------
821 // multibyte to wide char conversion functions and macros
822 // ----------------------------------------------------------------------------
825 // multibyte<->widechar conversion
826 WXDLLEXPORT
size_t wxMB2WC(wchar_t *buf
, const char *psz
, size_t n
);
827 WXDLLEXPORT
size_t wxWC2MB(char *buf
, const wchar_t *psz
, size_t n
);
830 #define wxMB2WX wxMB2WC
831 #define wxWX2MB wxWC2MB
832 #define wxWC2WX wxStrncpy
833 #define wxWX2WC wxStrncpy
835 #define wxMB2WX wxStrncpy
836 #define wxWX2MB wxStrncpy
837 #define wxWC2WX wxWC2MB
838 #define wxWX2WC wxMB2WC
840 #else // !wxUSE_UNICODE
841 // No wxUSE_WCHAR_T: we have to do something (JACS)
842 #define wxMB2WC wxStrncpy
843 #define wxWC2MB wxStrncpy
844 #define wxMB2WX wxStrncpy
845 #define wxWX2MB wxStrncpy
846 #define wxWC2WX wxWC2MB
847 #define wxWX2WC wxMB2WC
850 #endif //_WX_WXCHAR_H_