X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/31907d03078c41ac09b2ff36267e980c57410f72..1d73f41603de8103218a8460792f244230c6a7b1:/src/common/wxchar.cpp diff --git a/src/common/wxchar.cpp b/src/common/wxchar.cpp index 7e6c8f21f4..d8772fce24 100644 --- a/src/common/wxchar.cpp +++ b/src/common/wxchar.cpp @@ -9,7 +9,7 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "wxchar.h" #endif @@ -30,8 +30,13 @@ #include #include #include -#include + +#ifndef __WXWINCE__ #include +#include +#else +#include "wx/msw/wince/time.h" +#endif #ifndef WX_PRECOMP #include "wx/defs.h" @@ -51,6 +56,10 @@ using namespace std ; #endif +#ifdef __WXMAC__ + #include "wx/mac/private.h" +#endif + #if wxUSE_WCHAR_T size_t WXDLLEXPORT wxMB2WC(wchar_t *buf, const char *psz, size_t n) { @@ -1005,7 +1014,8 @@ int WXDLLEXPORT wxStricmp(const wxChar *psz1, const wxChar *psz2) #ifndef wxStricmp int WXDLLEXPORT wxStrnicmp(const wxChar *s1, const wxChar *s2, size_t n) { - register wxChar c1, c2; + // initialize the variables just to suppress stupid gcc warning + register wxChar c1 = 0, c2 = 0; while (n && ((c1 = wxTolower(*s1)) == (c2 = wxTolower(*s2)) ) && c1) n--, s1++, s2++; if (n) { if (c1 < c2) return -1; @@ -1195,6 +1205,28 @@ WXDLLEXPORT long int wxStrtol(const wxChar *nptr, wxChar **endptr, int base) } #endif // wxNEED_WX_STRING_H +#if defined(__WXMAC__) && !defined(__DARWIN__) && !defined(wxUSE_UNICODE) +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) { @@ -1228,7 +1260,16 @@ WXDLLEXPORT int wxRename(const wxChar *oldpath, const wxChar *newpath) #ifndef wxAtof double WXDLLEXPORT wxAtof(const wxChar *psz) { - return atof(wxConvLocal.cWX2MB(psz)); +#ifdef __WXWINCE__ + double d; + wxString str(psz); + if (str.ToDouble(& d)) + return d; + else + return 0.0; +#else + return atof(wxConvLocal.cWX2MB(psz)); +#endif } #endif @@ -1347,3 +1388,42 @@ WXDLLEXPORT wxChar * wxStrtok(wxChar *psz, const wxChar *delim, wxChar **save_pt #endif // wxStrtok +// ---------------------------------------------------------------------------- +// missing C RTL functions +// ---------------------------------------------------------------------------- + +#if (defined(__MWERKS__) && !defined(__MACH__) && (__MSL__ < 0x00008000)) || \ + defined(__WXWINCE__) +char *strdup(const char *s) +{ + char *dest = (char*) malloc( strlen( s ) + 1 ) ; + if ( dest ) + strcpy( dest , s ) ; + return dest ; +} +#endif + +#if (defined(__MWERKS__) && !defined(__MACH__)) || (defined(__WXWINCE__) && _WIN32_WCE <= 211) + +int isascii( int c ) +{ + return ( c >= 0 && c < 128 ); +} +#endif + +#if defined(__WXWINCE__) +void *calloc( size_t num, size_t size ) +{ + void** ptr = (void **)malloc(num * size); + memset( ptr, 0, num * size); + return ptr; +} + +#if (_WIN32_WCE <= 211) +int isspace(int c) +{ + return (c == ' '); +} +#endif + +#endif