]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/wxchar.cpp
final wxURI API changes. Changed Get to BuildURI to better reflect what its doing...
[wxWidgets.git] / src / common / wxchar.cpp
index 1b861219294c7e7ef90fa7375a880df9f7dbc0fc..f4739262b5373afac6438c484419f741f2d8ac12 100644 (file)
@@ -613,6 +613,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 +653,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 +1119,16 @@ WXDLLEXPORT size_t      wxInternalWcstombs (char * out, const wchar_t * in, size_t ou
 
 #include <CoreFoundation/CoreFoundation.h>
 
-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); }