// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "wxchar.h"
#endif
}
#endif // wxSnprintf_
+#if defined(__DMC__)
+ /* Digital Mars adds count to _stprintf (C99) so convert */
+ #if wxUSE_UNICODE
+ int wxSprintf (wchar_t * __RESTRICT s, const wchar_t * __RESTRICT format, ... )
+ {
+ va_list arglist;
+
+ va_start( arglist, format );
+ int iLen = swprintf ( s, -1, format, arglist );
+ va_end( arglist );
+ return iLen ;
+ }
+
+ #endif // wxUSE_UNICODE
+
+#endif //__DMC__
+
// ----------------------------------------------------------------------------
// implement the standard IO functions for wide char if libc doesn't have them
// ----------------------------------------------------------------------------
if ( rc != -1 )
{
// we can't do much better without Unicode support in libc...
- if ( fprintf(stream, "%s", s.mb_str()) == -1 )
+ if ( fprintf(stream, "%s", (const char*)s.mb_str() ) == -1 )
return -1;
}
// precision?
if ( *format == _T('.') )
{
- SkipDigits(&format);
+ CopyFmtChar(*format++);
+ if ( *format == _T('*') )
+ CopyFmtChar(*format++);
+ else
+ SkipDigits(&format);
}
// next we can have a size modifier
case _T('c'):
case _T('s'):
// %c -> %lc but %hc stays %hc and %lc is still %lc
- switch ( size )
- {
- case Default:
- InsertFmtChar(_T('l'));
- break;
-
- case Short:
- CopyFmtChar(_T('h'));
- break;
-
- case Long:
- ;
- }
+ if ( size == Default)
+ InsertFmtChar(_T('l'));
// fall through
default:
// nothing special to do
+ if ( size != Default )
+ CopyFmtChar(*(format - 1));
CopyFmtChar(*format++);
}
}
#define wxFormatConverter(x) (x)
#endif // wxNEED_PRINTF_CONVERSION/!wxNEED_PRINTF_CONVERSION
+#ifdef __WXDEBUG__
+// For testing the format converter
+wxString wxConvertFormat(const wxChar *format)
+{
+ return wxString(wxFormatConverter(format));
+}
+#endif
+
// ----------------------------------------------------------------------------
// wxPrintf(), wxScanf() and relatives
// ----------------------------------------------------------------------------
WXDLLEXPORT int wxIsalnum(wxChar ch) { return IsCharAlphaNumeric(ch); }
WXDLLEXPORT int wxIsalpha(wxChar ch) { return IsCharAlpha(ch); }
-WXDLLEXPORT int wxIsctrl(wxChar ch) { return wxMSW_ctype(ch) & C1_CNTRL; }
+WXDLLEXPORT int wxIscntrl(wxChar ch) { return wxMSW_ctype(ch) & C1_CNTRL; }
WXDLLEXPORT int wxIsdigit(wxChar ch) { return wxMSW_ctype(ch) & C1_DIGIT; }
WXDLLEXPORT int wxIsgraph(wxChar ch) { return wxMSW_ctype(ch) & (C1_DIGIT|C1_PUNCT|C1_ALPHA); }
WXDLLEXPORT int wxIslower(wxChar ch) { return IsCharLower(ch); }
}
#endif // wxNEED_WX_STRING_H
-#if defined(__WXMAC__) && !defined(__DARWIN__)
-WXDLLEXPORT FILE * wxFopen(const wxChar *path, const wxChar *mode)
-{
- return fopen( wxMacStringToCString(path), mode );
-}
-
-WXDLLEXPORT FILE * wxFreopen(const wxChar *path, const wxChar *mode, FILE *stream)
-{
- return freopen( wxMacStringToCString(path), mode, stream );
-}
-
-WXDLLEXPORT int wxRemove(const wxChar *path)
-{
- return remove( wxMacStringToCString(path) );
-}
-
-WXDLLEXPORT int wxRename(const wxChar *oldpath, const wxChar *newpath)
-{
- return rename( wxMacStringToCString(oldpath), wxMacStringToCString(newpath) );
-}
-#endif
-
#ifdef wxNEED_WX_STDIO_H
WXDLLEXPORT FILE * wxFopen(const wxChar *path, const wxChar *mode)
{
// printf( "home %s\n", val );
// convert it,
-#ifdef wxUSE_UNICODE
+#if wxUSE_UNICODE
data = (wxObject *)new wxString(val, wxConvLocal);
#else
data = (wxObject *)new wxString(val);
}
#endif
-#if (defined(__MWERKS__) && !defined(__MACH__)) || defined(__WXWINCE__)
+#if (defined(__MWERKS__) && !defined(__MACH__)) || (defined(__WXWINCE__) && _WIN32_WCE <= 211)
+
int isascii( int c )
{
return ( c >= 0 && c < 128 );
}
#endif
-#if defined(__WXWINCE__)
+#if defined(__WXWINCE__) && (_WIN32_WCE <= 211)
+#if (_WIN32_WCE < 300)
void *calloc( size_t num, size_t size )
{
void** ptr = (void **)malloc(num * size);
memset( ptr, 0, num * size);
return ptr;
}
+#endif
int isspace(int c)
{
return (c == ' ');
}
+
#endif
+