X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/30261041bc8350cc1a5eeaf1478fe15d0e2d40c7..93c2f401e9955dc37df1f8dbfea7881c676b8ddb:/src/common/wxchar.cpp diff --git a/src/common/wxchar.cpp b/src/common/wxchar.cpp index 1b86121929..9db633db07 100644 --- a/src/common/wxchar.cpp +++ b/src/common/wxchar.cpp @@ -53,6 +53,7 @@ #endif #if defined(__MWERKS__) && __MSL__ >= 0x6000 +namespace std {} using namespace std ; #endif @@ -613,6 +614,22 @@ int wxFputs(const wchar_t *ws, FILE *stream) } #endif // wxNEED_FPUTS +#ifdef wxNEED_PUTS +int wxPuts(const wxChar *ws) +{ + int rc = wxFputs(ws, stdout); + if ( rc != -1 ) + { + if ( wxFputs(L"\n", stdout) == -1 ) + return -1; + + rc++; + } + + return rc; +} +#endif // wxNEED_PUTS + #ifdef wxNEED_PUTC int /* not wint_t */ wxPutc(wchar_t wc, FILE *stream) { @@ -637,9 +654,19 @@ int vwscanf(const wxChar *format, va_list argptr) int vswscanf(const wxChar *ws, const wxChar *format, va_list argptr) { - wxFAIL_MSG( _T("TODO") ); - - return -1; + // The best we can do without proper Unicode support in glibc is to + // convert the strings into MB representation and run ANSI version + // of the function. This doesn't work with %c and %s because of difference + // in size of char and wchar_t, though. + + wxCHECK_MSG( wxStrstr(format, _T("%s")) == NULL, -1, + _T("incomplete vswscanf implementation doesn't allow %s") ); + wxCHECK_MSG( wxStrstr(format, _T("%c")) == NULL, -1, + _T("incomplete vswscanf implementation doesn't allow %c") ); + + va_list argcopy; + wxVaCopy(argcopy, argptr); + return vsscanf(wxConvLibc.cWX2MB(ws), wxConvLibc.cWX2MB(format), argcopy); } int vfwscanf(FILE *stream, const wxChar *format, va_list argptr) @@ -1093,16 +1120,16 @@ WXDLLEXPORT size_t wxInternalWcstombs (char * out, const wchar_t * in, size_t ou #include -CFCharacterSetRef cfalnumset = CFCharacterSetGetPredefined(kCFCharacterSetAlphaNumeric); -CFCharacterSetRef cfalphaset = CFCharacterSetGetPredefined(kCFCharacterSetLetter); -CFCharacterSetRef cfcntrlset = CFCharacterSetGetPredefined(kCFCharacterSetControl); -CFCharacterSetRef cfdigitset = CFCharacterSetGetPredefined(kCFCharacterSetDecimalDigit); +#define cfalnumset CFCharacterSetGetPredefined(kCFCharacterSetAlphaNumeric) +#define cfalphaset CFCharacterSetGetPredefined(kCFCharacterSetLetter) +#define cfcntrlset CFCharacterSetGetPredefined(kCFCharacterSetControl) +#define cfdigitset CFCharacterSetGetPredefined(kCFCharacterSetDecimalDigit) //CFCharacterSetRef cfgraphset = kCFCharacterSetControl && !' ' -CFCharacterSetRef cflowerset = CFCharacterSetGetPredefined(kCFCharacterSetLowercaseLetter); +#define cflowerset CFCharacterSetGetPredefined(kCFCharacterSetLowercaseLetter) //CFCharacterSetRef cfprintset = !kCFCharacterSetControl -CFCharacterSetRef cfpunctset = CFCharacterSetGetPredefined(kCFCharacterSetPunctuation); -CFCharacterSetRef cfspaceset = CFCharacterSetGetPredefined(kCFCharacterSetWhitespaceAndNewline); -CFCharacterSetRef cfupperset = CFCharacterSetGetPredefined(kCFCharacterSetUppercaseLetter); +#define cfpunctset CFCharacterSetGetPredefined(kCFCharacterSetPunctuation) +#define cfspaceset CFCharacterSetGetPredefined(kCFCharacterSetWhitespaceAndNewline) +#define cfupperset CFCharacterSetGetPredefined(kCFCharacterSetUppercaseLetter) WXDLLEXPORT int wxIsalnum(wxChar ch) { return CFCharacterSetIsCharacterMember(cfalnumset, ch); } WXDLLEXPORT int wxIsalpha(wxChar ch) { return CFCharacterSetIsCharacterMember(cfalphaset, ch); }