From: Ove Kaaven Date: Mon, 12 Apr 1999 20:01:51 +0000 (+0000) Subject: For non-Unicode added #include and to avoid some missing X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/e97a90f0a8a5da3d66a87bbafacb342f8352d8cd For non-Unicode added #include and to avoid some missing declaration warnings, added wxAtof, changed wxStrtok declaration, added conditional declarations for functions in wxchar.cpp git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2105 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/wxchar.h b/include/wx/wxchar.h index fda15454f2..30ce2cbe41 100644 --- a/include/wx/wxchar.h +++ b/include/wx/wxchar.h @@ -69,7 +69,7 @@ typedef _TUCHAR wxUChar; #define wxStrspn _tcsspn #define wxStrstr _tcsstr #define wxStrtod _tcstod -#define wxStrtok _tcstok +// is there a _tcstok[_r] ? #define wxStrtol _tcstol #define wxStrtoul _tcstoul #define wxStrxfrm _tcsxfrm @@ -104,6 +104,7 @@ typedef _TUCHAR wxUChar; #define wxVsprintf _vstprintf // stdlib.h functions +#define wxAtof _ttof /* does this exist? */ #define wxAtoi _ttoi #define wxAtol _ttol #define wxGetenv _tgetenv @@ -172,13 +173,18 @@ typedef unsigned __WCHAR_TYPE__ wxUChar; #define wxStrxfrm wcsxfrm // glibc doesn't have wc equivalents of the other stuff -// do we need to write wrappers for them? +#define wxNEED_WX_STDIO_H +#define wxNEED_WX_STDLIB_H +#define wxNEED_WX_TIME_H #else #error "Please define your compiler's Unicode conventions in wxChar.h" #endif #else//!Unicode +#include +#include + #if 0 // temporary - preserve binary compatibilty typedef char wxChar; typedef signed char wxSChar; @@ -216,6 +222,7 @@ typedef unsigned char wxUChar; #define wxStrcoll strcoll #define wxStrcpy strcpy #define wxStrcspn strcspn +#define wxStrdup strdup #define wxStrncat strncat #define wxStrncmp strncmp #define wxStrncpy strncpy @@ -224,7 +231,7 @@ typedef unsigned char wxUChar; #define wxStrspn strspn #define wxStrstr strstr #define wxStrtod strtod -#define wxStrtok strtok +// #define wxStrtok strtok_r // this needs a configure check #define wxStrtol strtol #define wxStrtoul strtoul #define wxStrxfrm strxfrm @@ -259,6 +266,7 @@ typedef unsigned char wxUChar; #define wxVsprintf vsprintf // stdlib.h functions +#define wxAtof atof #define wxAtoi atoi #define wxAtol atol #define wxGetenv getenv @@ -323,17 +331,46 @@ inline int WXDLLEXPORT wxStricmp(const wxChar *psz1, const wxChar *psz2) #error "Please define string case-insensitive compare for your OS/compiler" #endif // OS/compiler -/// portable strdup -inline wxChar * WXDLLEXPORT wxStrdup(const wxChar *psz) -#if !wxUSE_UNICODE - { return strdup(psz); } +// multibyte<->widechar conversion +size_t WXDLLEXPORT wxMB2WC(wchar_t *buf, const char *psz, size_t n); +size_t WXDLLEXPORT wxWC2MB(char *buf, const wchar_t *psz, size_t n); +#if wxUSE_UNICODE +#define wxMB2WX wxMB2WC +#define wxWX2MB wxWC2MB +#define wxWC2WX wxStrncpy +#define wxWX2WC wxStrncpy #else - { - size_t size = (wxStrlen(psz) + 1) * sizeof(wxChar); - wxChar *ret = (wxChar *) malloc(size); - memcpy(ret, psz, size); - return ret; - } +#define wxMB2WX wxStrncpy +#define wxWX2MB wxStrncpy +#define wxWC2WX wxWC2MB +#define wxWX2WC wxMB2WC +#endif + +// if libc versions are not available, use replacements defined in wxchar.cpp +#ifndef wxStrdup +wxChar * WXDLLEXPORT wxStrdup(const wxChar *psz); +#endif + +#ifndef wxStrtok +wxChar * WXDLLEXPORT wxStrtok(wxChar *psz, const wxChar *delim, wxChar **save_ptr); +#endif + +#ifndef wxSetlocale +wxChar * WXDLLEXPORT wxSetlocale(int category, const wxChar *locale); +#endif + +#ifdef wxNEED_WX_STDIO_H +#include +int WXDLLEXPORT wxSprintf(wxChar *buf, const wxChar *fmt, ...); +int WXDLLEXPORT wxVsprintf(wxChar *buf, const wxChar *fmt, va_list argptr); +#endif + +#ifdef wxNEED_WX_STDLIB_H +double WXDLLEXPORT wxAtof(const wxChar *psz); +int WXDLLEXPORT wxAtoi(const wxChar *psz); +long WXDLLEXPORT wxAtol(const wxChar *psz); +wxChar * WXDLLEXPORT wxGetenv(const wxChar *name); +int WXDLLEXPORT wxSystem(const wxChar *psz); #endif #endif