+ /*
+ There are 2 unrelated problems with these functions under Mac:
+ a) Metrowerks MSL CRT implements them strictly in C99 sense and
+ doesn't support (very common) extension of allowing to call
+ mbstowcs(NULL, ...) which makes it pretty useless as you can't
+ know the size of the needed buffer
+ b) OS X <= 10.2 declares and even defined these functions but
+ doesn't really implement them -- they always return an error
+
+ So use our own replacements in both cases.
+ */
+ #if defined(__MWERKS__) && defined(__MSL__)
+ #define wxNEED_WX_MBSTOWCS
+ #endif
+
+ #ifdef __DARWIN__
+ #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_2
+ #define wxNEED_WX_MBSTOWCS
+ #endif
+ #endif
+
+ #ifdef wxNEED_WX_MBSTOWCS
+ /* even though they are defined and "implemented", they are bad and just
+ stubs so we need our own - we need these even in ANSI builds!! */
+ WXDLLIMPEXP_BASE size_t wxMbstowcs (wchar_t *, const char *, size_t);
+ WXDLLIMPEXP_BASE size_t wxWcstombs (char *, const wchar_t *, size_t);
+ #else
+ #define wxMbstowcs mbstowcs
+ #define wxWcstombs wcstombs
+ #endif
+
+ /*
+ The system C library on Mac OS X 10.2 and below does not support
+ unicode: in other words all wide-character functions such as towupper et
+ al. do simply not exist so we need to provide our own in that context,
+ except for the wchar_t definition/typedef itself.
+
+ We need to do this for both project builder and CodeWarrior as
+ the latter uses the system C library in Mach builds for wide character
+ support, which as mentioned does not exist on 10.2 and below.
+ */
+ #if wxUSE_UNICODE && \
+ defined(__DARWIN__) && \
+ ( MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_2 )
+ /* we need everything! */
+ #define wxNEED_WX_STRING_H
+ #define wxNEED_WX_CTYPE_H
+
+ #define wxFgetchar(c) wxFgetc(c, stdin)
+ #define wxFputc wxPutc
+ #define wxFputchar(c) wxPutc(c, stdout)
+ #define wxGetc wxFgetc
+ #define wxGetchar(c) wxFgetc(c, stdin)
+
+ #include <stdio.h>
+
+ #define wxNEED_FGETC
+ #define wxNEED_FGETS
+ #define wxNEED_GETS
+ #define wxNEED_UNGETC
+
+ #define wxNEED_FPUTS
+ #define wxNEED_PUTS
+ #define wxNEED_PUTC
+
+ int wxFputs(const wxChar *ch, FILE *stream);
+ int wxPuts(const wxChar *ws);
+ int wxPutc(wxChar ch, FILE *stream);
+
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+ WXDLLIMPEXP_BASE size_t wxStrlen_(const wxChar *s);
+ #ifdef __cplusplus
+ }
+ #endif
+
+ #define wxPutchar(wch) wxPutc(wch, stdout)
+
+ #define wxNEED_PRINTF_CONVERSION
+ #define wxNEED_WX_STDIO_H
+ #define wxNEED_WX_STDLIB_H
+ #define wxNEED_WX_TIME_H
+
+ #elif wxUSE_UNICODE