From c5cf866314567dee22d7bb9ef13b56877fd9fc92 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sun, 8 Jul 2007 07:04:38 +0000 Subject: [PATCH] removed wxWCHAR_T_IS_SEPARATE_TYPE: there already was wxWCHAR_T_IS_REAL_TYPE with the exact same meaning and definition git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47230 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- configure | 4 ++-- configure.in | 4 ++-- include/wx/defs.h | 18 +++++++++++++----- include/wx/unichar.h | 28 +++++----------------------- setup.h.in | 2 +- setup.h_vms | 2 +- 6 files changed, 24 insertions(+), 34 deletions(-) diff --git a/configure b/configure index 21816299f5..326d2b578f 100755 --- a/configure +++ b/configure @@ -34140,12 +34140,12 @@ echo "${ECHO_T}$wx_cv_wchar_t_is_separate_type" >&6; } if test "$wx_cv_wchar_t_is_separate_type" = "yes"; then cat >>confdefs.h <<\_ACEOF -#define wxWCHAR_T_IS_SEPARATE_TYPE 1 +#define wxWCHAR_T_IS_REAL_TYPE 1 _ACEOF else cat >>confdefs.h <<\_ACEOF -#define wxWCHAR_T_IS_SEPARATE_TYPE 0 +#define wxWCHAR_T_IS_REAL_TYPE 0 _ACEOF fi diff --git a/configure.in b/configure.in index 8f44affcb8..aa8766954b 100644 --- a/configure.in +++ b/configure.in @@ -4430,9 +4430,9 @@ AC_CACHE_CHECK([if wchar_t is separate type], ) if test "$wx_cv_wchar_t_is_separate_type" = "yes"; then - AC_DEFINE(wxWCHAR_T_IS_SEPARATE_TYPE, 1) + AC_DEFINE(wxWCHAR_T_IS_REAL_TYPE, 1) else - AC_DEFINE(wxWCHAR_T_IS_SEPARATE_TYPE, 0) + AC_DEFINE(wxWCHAR_T_IS_REAL_TYPE, 0) fi AC_LANG_POP() dnl C++ diff --git a/include/wx/defs.h b/include/wx/defs.h index 1ffef246f7..d3dc341d61 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -1139,18 +1139,26 @@ typedef float wxFloat32; of treating it as a real fundamental type, set wxWCHAR_T_IS_REAL_TYPE to 0 for them and to 1 for all the others. */ -#if wxUSE_WCHAR_T +#ifndef wxWCHAR_T_IS_REAL_TYPE /* - VC++ typedefs wchar_t as unsigned short by default, that is unless - /Za or /Zc:wchar_t option is used in which case _WCHAR_T_DEFINED is - defined. + VC++ typedefs wchar_t as unsigned short by default until VC8, that is + unless /Za or /Zc:wchar_t option is used in which case _WCHAR_T_DEFINED + is defined. */ # if defined(__VISUALC__) && !defined(_NATIVE_WCHAR_T_DEFINED) # define wxWCHAR_T_IS_REAL_TYPE 0 # else /* compiler having standard-conforming wchar_t */ # define wxWCHAR_T_IS_REAL_TYPE 1 # endif -#endif /* wxUSE_WCHAR_T */ +#endif /* !defined(wxWCHAR_T_IS_REAL_TYPE) */ + +/* Helper macro for doing something dependent on whether wchar_t is or isn't a + typedef inside another macro. */ +#if wxWCHAR_T_IS_REAL_TYPE + #define wxIF_WCHAR_T_TYPE(x) x +#else /* !wxWCHAR_T_IS_REAL_TYPE */ + #define wxIF_WCHAR_T_TYPE(x) +#endif /* wxWCHAR_T_IS_REAL_TYPE/!wxWCHAR_T_IS_REAL_TYPE */ /* This constant should be used instead of NULL in vararg functions taking diff --git a/include/wx/unichar.h b/include/wx/unichar.h index 584b85cb4b..a7a74dec83 100644 --- a/include/wx/unichar.h +++ b/include/wx/unichar.h @@ -15,24 +15,6 @@ #include "wx/chartype.h" #include "wx/stringimpl.h" -#ifndef wxWCHAR_T_IS_SEPARATE_TYPE - // older versions of VC++ have wchar_t as typedef by default; this is - // configurable, so we have to check which behaviour is enabled - #if defined(__VISUALC__) && !defined(_NATIVE_WCHAR_T_DEFINED) - #define wxWCHAR_T_IS_SEPARATE_TYPE 0 - #else - #define wxWCHAR_T_IS_SEPARATE_TYPE 1 - #endif -#endif - -// helper macro for doing something dependent on whether wchar_t is or isn't a -// typedef inside another macro -#if wxWCHAR_T_IS_SEPARATE_TYPE - #define wxIF_WCHAR_T_TYPE(x) x -#else // !wxWCHAR_T_IS_SEPARATE_TYPE - #define wxIF_WCHAR_T_TYPE(x) -#endif // wxWCHAR_T_IS_SEPARATE_TYPE/!wxWCHAR_T_IS_SEPARATE_TYPE - class WXDLLIMPEXP_BASE wxUniCharRef; class WXDLLIMPEXP_BASE wxStringIteratorNode; @@ -54,7 +36,7 @@ public: wxUniChar(unsigned char c) { m_value = From8bit((char)c); } // Create the character from a wchar_t character value. -#if wxWCHAR_T_IS_SEPARATE_TYPE +#if wxWCHAR_T_IS_REAL_TYPE wxUniChar(wchar_t c) { m_value = c; } #endif @@ -91,7 +73,7 @@ public: // functions operator char() const { return To8bit(m_value); } operator unsigned char() const { return (unsigned char)To8bit(m_value); } -#if wxWCHAR_T_IS_SEPARATE_TYPE +#if wxWCHAR_T_IS_REAL_TYPE operator wchar_t() const { return (wchar_t)m_value; } #endif operator int() const { return (int)m_value; } @@ -118,7 +100,7 @@ public: wxUniChar& operator=(const wxUniCharRef& c); wxUniChar& operator=(char c) { m_value = From8bit(c); return *this; } wxUniChar& operator=(unsigned char c) { m_value = From8bit((char)c); return *this; } -#if wxWCHAR_T_IS_SEPARATE_TYPE +#if wxWCHAR_T_IS_REAL_TYPE wxUniChar& operator=(wchar_t c) { m_value = c; return *this; } #endif wxUniChar& operator=(int c) { m_value = c; return *this; } @@ -213,7 +195,7 @@ public: wxUniCharRef& operator=(char c) { return *this = wxUniChar(c); } wxUniCharRef& operator=(unsigned char c) { return *this = wxUniChar(c); } -#if wxWCHAR_T_IS_SEPARATE_TYPE +#if wxWCHAR_T_IS_REAL_TYPE wxUniCharRef& operator=(wchar_t c) { return *this = wxUniChar(c); } #endif wxUniCharRef& operator=(int c) { return *this = wxUniChar(c); } @@ -226,7 +208,7 @@ public: // Conversions to the same types as wxUniChar is convertible too: operator char() const { return UniChar(); } operator unsigned char() const { return UniChar(); } -#if wxWCHAR_T_IS_SEPARATE_TYPE +#if wxWCHAR_T_IS_REAL_TYPE operator wchar_t() const { return UniChar(); } #endif operator int() const { return UniChar(); } diff --git a/setup.h.in b/setup.h.in index aa7372c8e7..4426536b7c 100644 --- a/setup.h.in +++ b/setup.h.in @@ -950,7 +950,7 @@ #undef wxSIZE_T_IS_ULONG /* Define if wchar_t is distinct type in your compiler. */ -#undef wxWCHAR_T_IS_SEPARATE_TYPE +#undef wxWCHAR_T_IS_REAL_TYPE /* Define if you have the dlopen function. */ #undef HAVE_DLOPEN diff --git a/setup.h_vms b/setup.h_vms index c4adfef34b..412897fc81 100644 --- a/setup.h_vms +++ b/setup.h_vms @@ -1034,7 +1034,7 @@ typedef pid_t GPid; #undef wxSIZE_T_IS_ULONG /* Define if wchar_t is distinct type in your compiler. */ -#define wxWCHAR_T_IS_SEPARATE_TYPE 1 +#define wxWCHAR_T_IS_REAL_TYPE 1 /* Define if you have the dlopen function. */ #define HAVE_DLOPEN 1 -- 2.47.2