From 28ffb1f22f0602b059b11f50bc306b4b9fc7859b Mon Sep 17 00:00:00 2001 From: Jouk Jansen Date: Fri, 15 Jun 2007 12:52:25 +0000 Subject: [PATCH] Committing in . Changes to make OpenVMS compile WX Modified Files: wxWidgets/include/wx/wxcrt.h wxWidgets/include/wx/wxcrtbase.h wxWidgets/src/common/wxcrt.cpp git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46476 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/wxcrt.h | 7 ++++--- include/wx/wxcrtbase.h | 6 ++++-- src/common/wxcrt.cpp | 42 +++++++++++++++++++++++++++++++++++++----- 3 files changed, 45 insertions(+), 10 deletions(-) diff --git a/include/wx/wxcrt.h b/include/wx/wxcrt.h index a32b170bbf..f8a5f592d4 100644 --- a/include/wx/wxcrt.h +++ b/include/wx/wxcrt.h @@ -420,11 +420,12 @@ WX_STRCMP_FUNC(wxStricmp, wxCRT_StricmpA, wxCRT_StricmpW, wxStricmp_String) // call in wxStrcoll_String()), so we have to forward-declare the template // and implement it below WX_STRCMP_FUNC. OTOH, this fails to compile with VC6, // so we do it for GCC only. -#ifdef __GNUG__ +// The same is needed for HP CXX on OpenVMS +#if defined( __GNUG__ ) || defined( __VMS ) template inline int wxStrcoll_String(const wxString& s1, const T& s2); WX_STRCMP_FUNC(wxStrcoll, wxCRT_StrcollA, wxCRT_StrcollW, wxStrcoll_String) -#endif // __GNUG__ +#endif // __GNUG__ or __VMS template inline int wxStrcoll_String(const wxString& s1, const T& s2) @@ -440,7 +441,7 @@ inline int wxStrcoll_String(const wxString& s1, const T& s2) #endif } -#ifndef __GNUG__ +#if !defined( __GNUG__ ) && !defined( __VMS ) // this is exactly the same WX_STRCMP_FUNC line as above wxStrcoll_String<> WX_STRCMP_FUNC(wxStrcoll, wxCRT_StrcollA, wxCRT_StrcollW, wxStrcoll_String) #endif diff --git a/include/wx/wxcrtbase.h b/include/wx/wxcrtbase.h index ec38214dfc..224d31155f 100644 --- a/include/wx/wxcrtbase.h +++ b/include/wx/wxcrtbase.h @@ -174,7 +174,7 @@ WXDLLIMPEXP_BASE void *calloc( size_t num, size_t size ); /* Almost all compiler have strdup(), but not quite all: CodeWarrior under Mac and VC++ for Windows CE don't provide it; additionally, gcc under - Mac doesn't have wcsdup: */ + Mac and OpenVMS do not have wcsdup: */ #if defined(__VISUALC__) && __VISUALC__ >= 1400 #define wxCRT_StrdupA _strdup #elif !(defined(__MWERKS__) && defined(__WXMAC__)) && !defined(__WXWINCE__) @@ -182,7 +182,7 @@ WXDLLIMPEXP_BASE void *calloc( size_t num, size_t size ); #endif #if defined(__WINDOWS__) #define wxCRT_StrdupW _wcsdup - #elif !defined(__DARWIN__) + #elif !defined(__DARWIN__) && !defined( __VMS ) #define wxCRT_StrdupW wcsdup #endif #else @@ -541,7 +541,9 @@ WXDLLIMPEXP_BASE wchar_t * wxCRT_GetenvW(const wchar_t *name); #define wxCRT_AtolW _wtol /* _wtof doesn't exist */ #else +#ifndef __VMS #define wxCRT_AtofW(s) wcstof(s, NULL) +#endif #define wxCRT_AtolW(s) wcstol(s, NULL, 10) /* wcstoi doesn't exist */ #endif diff --git a/src/common/wxcrt.cpp b/src/common/wxcrt.cpp index d0568f1c8a..2f84583445 100644 --- a/src/common/wxcrt.cpp +++ b/src/common/wxcrt.cpp @@ -600,8 +600,16 @@ int wxCRT_ScanfW(const wchar_t *format, ...) va_list argptr; va_start(argptr, format); - int ret = vwscanf(wxFormatConverter(format), argptr); - +#ifdef __VMS +#if (__DECCXX_VER >= 70100000) && !defined(__STD_CFRONT) && !defined( __NONAMESPACE_STD ) + int ret = std::vwscanf(wxFormatConverter(format), argptr); +#else + int ret = vwscanf(wxFormatConverter(format), argptr); +#endif +#else + int ret = vwscanf(wxFormatConverter(format), argptr); +#endif + va_end(argptr); return ret; @@ -614,7 +622,15 @@ int wxCRT_SscanfW(const wchar_t *str, const wchar_t *format, ...) va_list argptr; va_start(argptr, format); - int ret = vswscanf(str, wxFormatConverter(format), argptr); +#ifdef __VMS +#if (__DECCXX_VER >= 70100000) && !defined(__STD_CFRONT) && !defined( __NONAMESPACE_STD ) + int ret = std::vswscanf(str, wxFormatConverter(format), argptr); +#else + int ret = vswscanf(str, wxFormatConverter(format), argptr); +#endif +#else + int ret = vswscanf(str, wxFormatConverter(format), argptr); +#endif va_end(argptr); @@ -627,7 +643,15 @@ int wxCRT_FscanfW(FILE *stream, const wchar_t *format, ...) { va_list argptr; va_start(argptr, format); - int ret = vfwscanf(stream, wxFormatConverter(format), argptr); +#ifdef __VMS +#if (__DECCXX_VER >= 70100000) && !defined(__STD_CFRONT) && !defined( __NONAMESPACE_STD ) + int ret = std::vfwscanf(stream, wxFormatConverter(format), argptr); +#else + int ret = vfwscanf(stream, wxFormatConverter(format), argptr); +#endif +#else + int ret = vfwscanf(stream, wxFormatConverter(format), argptr); +#endif va_end(argptr); @@ -638,7 +662,15 @@ int wxCRT_FscanfW(FILE *stream, const wchar_t *format, ...) #ifndef wxCRT_VsscanfW int wxCRT_VsscanfW(const wchar_t *str, const wchar_t *format, va_list argptr) { - return vswscanf(str, wxFormatConverter(format), argptr); +#ifdef __VMS +#if (__DECCXX_VER >= 70100000) && !defined(__STD_CFRONT) && !defined( __NONAMESPACE_STD ) + return std::vswscanf(str, wxFormatConverter(format), argptr); +#else + return vswscanf(str, wxFormatConverter(format), argptr); +#endif +#else + return vswscanf(str, wxFormatConverter(format), argptr); +#endif } #endif -- 2.45.2