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