williamr@2: /* williamr@2: * File to have Microsoft eMbedded Visual C++ 3.0 and .NET working with STLport williamr@2: * May 2004 williamr@2: * Origin : Zdenek Nemec - zero@mapfactor.com williamr@2: * Michael Fink - vividos@users.sourceforge.net williamr@2: */ williamr@2: williamr@2: #ifndef _STLP_EVC_H williamr@2: #define _STLP_EVC_H williamr@2: williamr@2: #define _STLP_COMPILER "eMbedded Visual C++" williamr@2: williamr@2: // This flag is being used by STLport to support williamr@2: // old-fashioned Windows CE SDK (see stl_wince.h) williamr@2: // do not use with eMebedded Visual C++ 3 or 4! williamr@2: #ifdef _STLP_WINCE williamr@2: # undef _STLP_WINCE williamr@2: #endif williamr@2: williamr@2: /* Compiler dependent define. The following defines may be available: williamr@2: * _STLP_WCE_EVC3 when compiling under eMbedded Visual C++ 3 williamr@2: * _STLP_WCE_NET when compiling under eMbedded Visual C++ .NET williamr@2: * _STLP_WCE always defined when compiling with one of the above williamr@2: */ williamr@2: #undef _STLP_WCE_EVC3 williamr@2: #undef _STLP_WCE_NET williamr@2: williamr@2: #if (_WIN32_WCE > 300) williamr@2: # define _STLP_WCE_NET UNDER_CE williamr@2: #elif (_WIN32_WCE == 300) williamr@2: # define _STLP_WCE_EVC3 UNDER_CE williamr@2: #else williamr@2: # error No support for Windows CE below 3.0! williamr@2: #endif williamr@2: williamr@2: // This is defined for all platforms using Windows CE williamr@2: #define _STLP_WCE williamr@2: williamr@2: /* All Windows CE versions up to at least version 5 are little-endian, even williamr@2: * if the hardware (like e.g. MIPS) can be configured for big-endian, too. */ williamr@2: #define _STLP_LITTLE_ENDIAN williamr@2: williamr@2: // Ensure _DEBUG is defined. williamr@2: #if defined (DEBUG) && !defined (_DEBUG) williamr@2: # define _DEBUG williamr@2: #endif williamr@2: williamr@2: // in evc3/4, on ARM, check that _STLP_DEBUG is not defined williamr@2: // the ARM compiler has a bug that prevents that debug mode from working williamr@2: #if _WIN32_WCE < 500 && defined(ARM) && defined(_STLP_DEBUG) williamr@2: # error _STLP_DEBUG mode is not supported in evc3 and evc4 on the ARM platform! williamr@2: #endif williamr@2: williamr@2: // inherit all msvc6 options williamr@2: #include williamr@2: williamr@2: // CE up to at least version 5 has no C locale support williamr@2: #define _STLP_NO_LOCALE_SUPPORT williamr@2: williamr@2: #if _WIN32_WCE >= 0x500 williamr@2: // SDKs built with PB5 have terminate&co in namespace std... williamr@2: # define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_STD williamr@2: # define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_STD williamr@2: // ...and new_handler/set_new_handler in the global namespace. williamr@2: # define _STLP_GLOBAL_NEW_HANDLER 1 williamr@2: #endif williamr@2: williamr@2: // Always threaded in eMbedded Visual C++ 3.0 and .NET williamr@2: #ifndef _MT williamr@2: # define _MT williamr@2: #endif williamr@2: williamr@2: // we don't have a static native runtime library williamr@2: #undef _STLP_USING_CROSS_NATIVE_RUNTIME_LIB williamr@2: williamr@2: #if _WIN32_WCE < 400 williamr@2: // no long double under CE3 and older williamr@2: # define _STLP_NO_LONG_DOUBLE williamr@2: #endif williamr@2: williamr@2: // no *f and *l math functions available williamr@2: #define _STLP_NO_VENDOR_MATH_F williamr@2: #define _STLP_NO_VENDOR_MATH_L williamr@2: williamr@2: /* williamr@2: * Redirect cout, cerr and clog: williamr@2: * If defined redirect cout, cerr and clog to williamr@2: * files stdout.txt, stderr.txt and stdlog.txt williamr@2: */ williamr@2: //# define _STLP_REDIRECT_STDSTREAMS williamr@2: williamr@2: /* williamr@2: * Static class members may generate LNK1179: williamr@2: * Wrong COMDAT packing may cause LNK1179 error. williamr@2: * For details see http://groups.google.com/groups?th=8a05c82c4ffee280 williamr@2: * example P78. This define is not used/needed at this moment williamr@2: * but may came handy in future... williamr@2: */ williamr@2: //# define _STLP_STATIC_MEMBERS_BUG williamr@2: williamr@2: // Use wide-string interface of windows native functions (CreateFile...). williamr@2: // Note that this should be defined all the time while under CE. williamr@2: #if defined (UNICODE) williamr@2: # define _STLP_USE_WIDE_INTERFACE williamr@2: #endif williamr@2: williamr@2: // Force exception std to std instead of __std_alias. williamr@2: #if defined (__cplusplus) && !defined (_STLP_HAS_NO_NAMESPACES) williamr@2: # ifdef _STLP_VENDOR_EXCEPT_STD williamr@2: # undef _STLP_VENDOR_EXCEPT_STD williamr@2: # endif williamr@2: # define _STLP_VENDOR_EXCEPT_STD std williamr@2: #endif williamr@2: williamr@2: // short string optimization bug under evc3, evc4 using ARM compiler williamr@2: #if _MSC_VER<1400 && (defined (ARM) || defined (_ARM_)) williamr@2: # define _STLP_DONT_USE_SHORT_STRING_OPTIM williamr@2: #endif williamr@2: williamr@2: // when using MFC, disable another placement new declaration, since there is one in wcealt.h williamr@2: #if !defined (__BUILDING_STLPORT) && defined (_MFC_VER) williamr@2: # define __PLACEMENT_NEW_INLINE williamr@2: #endif williamr@2: williamr@2: // threads williamr@2: #undef _REENTRANT williamr@2: #define _REENTRANT williamr@2: #undef _NOTHREADS williamr@2: williamr@2: // Use old fashioned headers (ctime vs. time.h). williamr@2: #undef _STLP_NO_NEW_C_HEADERS williamr@2: #define _STLP_NO_NEW_C_HEADERS williamr@2: williamr@2: // exception handling support: only on evc4 and user added /GX to project settings williamr@2: #if defined (_STLP_WCE_EVC3) || !defined (_CPPUNWIND) williamr@2: # define _STLP_NO_EXCEPTION_HEADER williamr@2: # define _STLP_NO_EXCEPTIONS williamr@2: # undef _STLP_USE_EXCEPTIONS williamr@2: # ifndef __THROW_BAD_ALLOC williamr@2: # define __THROW_BAD_ALLOC { _STLP_WINCE_TRACE(L"out of memory"); ExitThread(1); } williamr@2: # endif williamr@2: #endif williamr@2: williamr@2: #define _STLP_WINCE_TRACE(msg) OutputDebugString(msg) williamr@2: williamr@2: /* williamr@2: * eMbedded Visual C++ .NET specific settings williamr@2: */ williamr@2: #if defined (_STLP_WCE_NET) williamr@2: williamr@2: // evc4 has no locale and time support williamr@2: # define _STLP_NO_LOCALE_SUPPORT williamr@2: # define _STLP_NO_TIME_SUPPORT williamr@2: williamr@2: // ptrdiff_t is not defined in evc4 headers williamr@2: # ifndef _PTRDIFF_T_DEFINED williamr@2: typedef int ptrdiff_t; williamr@2: # define _PTRDIFF_T_DEFINED williamr@2: # endif williamr@2: williamr@2: /* williamr@2: * Helper macros for including the native headers in cases where a file with williamr@2: * the same name also exists in the STLport include folder. The idea behind williamr@2: * this is that we first go up one directory and then down into a dir that williamr@2: * is only present in the native install but not in STLport. williamr@2: * williamr@2: */ williamr@2: # if !defined (_STLP_NATIVE_INCLUDE_PATH) williamr@2: # if defined (_X86_) williamr@2: # if defined (_STLP_WCE_TARGET_PROC_SUBTYPE_EMULATOR) williamr@2: # define _STLP_NATIVE_INCLUDE_PATH ../Emulator williamr@2: # else williamr@2: # define _STLP_NATIVE_INCLUDE_PATH ../X86 williamr@2: # endif williamr@2: # elif defined (_ARM_) williamr@2: # if _MSC_VER < 1400 williamr@2: // eVC3/4 williamr@2: # if defined (ARMV4) williamr@2: # define _STLP_NATIVE_INCLUDE_PATH ../Armv4 williamr@2: # elif defined (ARMV4I) williamr@2: # define _STLP_NATIVE_INCLUDE_PATH ../Armv4i williamr@2: # elif defined (ARMV4T) williamr@2: # define _STLP_NATIVE_INCLUDE_PATH ../Armv4t williamr@2: # else williamr@2: # error Unknown ARM SDK. williamr@2: # endif williamr@2: # else williamr@2: // VC8 crosscompiling for CE williamr@2: # if defined (ARMV4) williamr@2: # define _STLP_NATIVE_INCLUDE_PATH ../Armv4 williamr@2: # elif defined(ARMV4I) || defined(ARMV4T) williamr@2: # define _STLP_NATIVE_INCLUDE_PATH ../Armv4i williamr@2: # else williamr@2: # error Unknown ARM SDK. williamr@2: # endif williamr@2: # endif williamr@2: # elif defined (_MIPS_) williamr@2: # if defined (MIPS16) williamr@2: # define _STLP_NATIVE_INCLUDE_PATH ../mips16 williamr@2: # elif defined (MIPSII) williamr@2: # define _STLP_NATIVE_INCLUDE_PATH ../mipsII williamr@2: # elif defined (MIPSII_FP) williamr@2: # define _STLP_NATIVE_INCLUDE_PATH ../mipsII_fp williamr@2: # elif defined (MIPSIV) williamr@2: # define _STLP_NATIVE_INCLUDE_PATH ../mipsIV williamr@2: # elif defined (MIPSIV_FP) williamr@2: # define _STLP_NATIVE_INCLUDE_PATH ../mipsIV_fp williamr@2: # else williamr@2: # error Unknown MIPS SDK. williamr@2: # endif williamr@2: # elif defined (SHx) williamr@2: # if defined (SH3) williamr@2: # define _STLP_NATIVE_INCLUDE_PATH ../sh3 williamr@2: # elif defined (SH4) williamr@2: # define _STLP_NATIVE_INCLUDE_PATH ../sh4 williamr@2: # else williamr@2: # error Unknown SHx SDK. williamr@2: # endif williamr@2: # else williamr@2: # error Unknown SDK. williamr@2: # endif williamr@2: # endif /* !_STLP_NATIVE_INCLUDE_PATH */ williamr@2: williamr@2: /* Workaround when using MFCCE and using together: MFCCE's wcealt.h doesn't williamr@2: * check for __PLACEMENT_NEW_INLINE before defining operator new, so when williamr@2: * defines the operatore before, there will be an error C2084: williamr@2: * "function 'void *__cdecl operator new(unsigned int,void *)' already has a body". williamr@2: */ williamr@2: # ifdef _STLP_USE_MFC williamr@2: # define __PLACEMENT_NEW_INLINE williamr@2: # endif williamr@2: williamr@2: #endif /* _STLP_WCE_NET */ williamr@2: williamr@2: /* Workaround in _windows.h needs native headers access macros williamr@2: * to be defined */ williamr@2: #include williamr@2: williamr@2: /* williamr@2: * eMbedded Visual C++ 3.0 specific settings williamr@2: */ williamr@2: #if defined (_STLP_WCE_EVC3) williamr@2: williamr@2: # define _STLP_NO_NATIVE_MBSTATE_T williamr@2: williamr@2: // evc3 has no locale and time support williamr@2: # define _STLP_NO_LOCALE_SUPPORT williamr@2: # define _STLP_NO_TIME_SUPPORT williamr@2: williamr@2: // evc3 has new, but no explicit header williamr@2: # define _STLP_NO_NEW_HEADER williamr@2: # define _STLP_NO_NEW_NEW_HEADER williamr@2: williamr@2: // evc3 has no bad_alloc and no typeinfo williamr@2: # undef _STLP_NO_BAD_ALLOC williamr@2: # define _STLP_NO_BAD_ALLOC williamr@2: williamr@2: # undef _STLP_NO_TYPEINFO williamr@2: # define _STLP_NO_TYPEINFO williamr@2: williamr@2: // missing things in eMbedded Visual C++ 3.0 headers williamr@2: # ifndef _SIZE_T_DEFINED williamr@2: typedef unsigned int size_t; williamr@2: # define _SIZE_T_DEFINED williamr@2: # endif williamr@2: williamr@2: # ifndef _WCHAR_T_DEFINED williamr@2: typedef unsigned short wchar_t; williamr@2: # define _WCHAR_T_DEFINED williamr@2: # endif williamr@2: williamr@2: // ptrdiff_t is not defined in evc3 headers williamr@2: # ifndef _PTRDIFF_T_DEFINED williamr@2: typedef int ptrdiff_t; williamr@2: # define _PTRDIFF_T_DEFINED williamr@2: # endif williamr@2: williamr@2: // clock_t is not defined in evc3 headers williamr@2: # ifndef _CLOCK_T_DEFINED williamr@2: typedef long clock_t; williamr@2: # define _CLOCK_T_DEFINED williamr@2: # endif williamr@2: williamr@2: // Struct tm is not defined in evc3 headers williamr@2: # ifndef _TM_DEFINED williamr@2: struct tm { williamr@2: int tm_sec; /* seconds after the minute - [0,59] */ williamr@2: int tm_min; /* minutes after the hour - [0,59] */ williamr@2: int tm_hour; /* hours since midnight - [0,23] */ williamr@2: int tm_mday; /* day of the month - [1,31] */ williamr@2: int tm_mon; /* months since January - [0,11] */ williamr@2: int tm_year; /* years since 1900 */ williamr@2: int tm_wday; /* days since Sunday - [0,6] */ williamr@2: int tm_yday; /* days since January 1 - [0,365] */ williamr@2: int tm_isdst; /* daylight savings time flag */ williamr@2: }; williamr@2: # define _TM_DEFINED williamr@2: # endif williamr@2: williamr@2: // define placement new and delete operator williamr@2: // note: when MFCCE headers are included first, don't define the new operator, williamr@2: // since it was already defined in wcealt.h williamr@2: # ifdef __cplusplus williamr@2: # ifndef __PLACEMENT_NEW_INLINE williamr@2: # ifndef _MFC_VER williamr@2: inline void *__cdecl operator new(size_t, void *_P) { return (_P); } williamr@2: # endif /* _MFC_VER */ williamr@2: inline void __cdecl operator delete(void *, void *) { return; } williamr@2: # define __PLACEMENT_NEW_INLINE williamr@2: # endif williamr@2: # endif /* __cplusplus */ williamr@2: williamr@2: // evc3 doesn't have native wide functions, e.g. fgetwc, wmemmove williamr@2: # define _STLP_NO_NATIVE_WIDE_FUNCTIONS williamr@2: williamr@2: // evc3 doesn't have assert.h williamr@2: # ifndef _ASSERT_DEFINED williamr@2: # define assert(expr) _STLP_ASSERT(expr) williamr@2: # define _ASSERT_DEFINED williamr@2: # endif williamr@2: williamr@2: #endif /* _STLP_WCE_EVC3 */ williamr@2: williamr@2: // Minimize windows.h includes williamr@2: #if !defined (WIN32_LEAN_AND_MEAN) williamr@2: # define WIN32_LEAN_AND_MEAN williamr@2: #endif williamr@2: #if !defined (VC_EXTRALEAN) williamr@2: # define VC_EXTRALEAN williamr@2: #endif williamr@2: #if !defined (STRICT) williamr@2: # define STRICT williamr@2: #endif williamr@2: williamr@2: // Don't let windows.h define its min and max macros. williamr@2: #if !defined (NOMINMAX) williamr@2: # define NOMINMAX williamr@2: #endif williamr@2: williamr@2: /* williamr@2: * original call: TerminateProcess(GetCurrentProcess(), 0); williamr@2: * we substitute the GetCurrentProcess() with the result of the inline function williamr@2: * defined in kfuncs.h, since we then can avoid including at all. williamr@2: * all needed Win32 API functions are defined in williamr@2: */ williamr@2: #ifndef _ABORT_DEFINED williamr@2: # define _STLP_ABORT() TerminateProcess(reinterpret_cast(66), 0) williamr@2: # define _ABORT_DEFINED williamr@2: #endif williamr@2: williamr@2: // Notice: windows.h isn't included here anymore; all needed defines are in williamr@2: // stl/_windows.h now williamr@2: williamr@2: #endif /* _STLP_EVC_H */