1/* 2 * File to have Microsoft eMbedded Visual C++ 3.0 and .NET working with STLport 3 * May 2004 4 * Origin : Zdenek Nemec - zero@mapfactor.com 5 * Michael Fink - vividos@users.sourceforge.net 6 */ 7 8#ifndef _STLP_EVC_H 9#define _STLP_EVC_H 10 11#define _STLP_COMPILER "eMbedded Visual C++" 12 13// This flag is being used by STLport to support 14// old-fashioned Windows CE SDK (see stl_wince.h) 15// do not use with eMebedded Visual C++ 3 or 4! 16#ifdef _STLP_WINCE 17# undef _STLP_WINCE 18#endif 19 20/* Compiler dependent define. The following defines may be available: 21 * _STLP_WCE_EVC3 when compiling under eMbedded Visual C++ 3 22 * _STLP_WCE_NET when compiling under eMbedded Visual C++ .NET 23 * _STLP_WCE always defined when compiling with one of the above 24 */ 25#undef _STLP_WCE_EVC3 26#undef _STLP_WCE_NET 27 28#if (_WIN32_WCE > 300) 29# define _STLP_WCE_NET UNDER_CE 30#elif (_WIN32_WCE == 300) 31# define _STLP_WCE_EVC3 UNDER_CE 32#else 33# error No support for Windows CE below 3.0! 34#endif 35 36// This is defined for all platforms using Windows CE 37#define _STLP_WCE 38 39/* All Windows CE versions up to at least version 5 are little-endian, even 40 * if the hardware (like e.g. MIPS) can be configured for big-endian, too. */ 41#define _STLP_LITTLE_ENDIAN 42 43// Ensure _DEBUG is defined. 44#if defined (DEBUG) && !defined (_DEBUG) 45# define _DEBUG 46#endif 47 48// inherit all msvc6 options 49#include <stl/config/_msvc.h> 50 51// CE up to at least version 5 has no C locale support 52#define _STLP_NO_LOCALE_SUPPORT 53 54#if _WIN32_WCE >= 420 55 // SDKs built with PB5 have terminate&co in namespace std... 56# define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_STD 57# define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_STD 58 // ...and new_handler/set_new_handler in the global namespace. 59# define _STLP_GLOBAL_NEW_HANDLER 1 60#endif 61 62// Always threaded in eMbedded Visual C++ 3.0 and .NET 63#ifndef _MT 64# define _MT 65#endif 66 67// we don't have a static native runtime library 68#undef _STLP_USING_CROSS_NATIVE_RUNTIME_LIB 69 70#if _WIN32_WCE < 400 71// no long double under CE3 and older 72# define _STLP_NO_LONG_DOUBLE 73#endif 74 75// no *f and *l math functions available 76#define _STLP_NO_VENDOR_MATH_F 77#define _STLP_NO_VENDOR_MATH_L 78 79/* 80 * Redirect cout, cerr and clog: 81 * If defined redirect cout, cerr and clog to 82 * files stdout.txt, stderr.txt and stdlog.txt 83 */ 84//# define _STLP_REDIRECT_STDSTREAMS 85 86/* 87 * Static class members may generate LNK1179: 88 * Wrong COMDAT packing may cause LNK1179 error. 89 * For details see http://groups.google.com/groups?th=8a05c82c4ffee280 90 * example P78. This define is not used/needed at this moment 91 * but may came handy in future... 92 */ 93//# define _STLP_STATIC_MEMBERS_BUG 94 95// Use wide-string interface of windows native functions (CreateFile...). 96// Note that this should be defined all the time while under CE. 97#if defined (UNICODE) 98# define _STLP_USE_WIDE_INTERFACE 99#endif 100 101// Force exception std to std instead of __std_alias. 102#if defined (__cplusplus) && !defined (_STLP_HAS_NO_NAMESPACES) 103# ifdef _STLP_VENDOR_EXCEPT_STD 104# undef _STLP_VENDOR_EXCEPT_STD 105# endif 106# define _STLP_VENDOR_EXCEPT_STD std 107#endif 108 109// short string optimization bug under evc3, evc4 using ARM compiler 110#if _MSC_VER < 1400 && (defined (ARM) || defined (_ARM_)) 111# define _STLP_DONT_USE_SHORT_STRING_OPTIM 112#endif 113 114// when using MFC, disable another placement new declaration, since there is one in wcealt.h 115#if !defined (__BUILDING_STLPORT) && defined (_MFC_VER) 116# define __PLACEMENT_NEW_INLINE 117#endif 118 119// threads 120#undef _REENTRANT 121#define _REENTRANT 122#undef _NOTHREADS 123 124// Use old fashioned headers (ctime vs. time.h). 125#undef _STLP_NO_NEW_C_HEADERS 126#define _STLP_NO_NEW_C_HEADERS 127 128// exception handling support: only on evc4 and user added /GX to project settings 129#if defined (_STLP_WCE_EVC3) || !defined (_CPPUNWIND) 130# define _STLP_NO_EXCEPTION_HEADER 131# define _STLP_NO_EXCEPTIONS 132# undef _STLP_USE_EXCEPTIONS 133# ifndef _STLP_THROW_BAD_ALLOC 134# define _STLP_THROW_BAD_ALLOC { _STLP_WINCE_TRACE(L"out of memory"); ExitThread(1); } 135# endif 136#endif 137 138#define _STLP_WINCE_TRACE(msg) OutputDebugString(msg) 139 140/* 141 * eMbedded Visual C++ .NET specific settings 142 */ 143#if defined (_STLP_WCE_NET) 144 145// evc4 has no locale and time support 146# define _STLP_NO_LOCALE_SUPPORT 147# define _STLP_NO_TIME_SUPPORT 148 149// ptrdiff_t is not defined in evc4 headers 150# ifndef _PTRDIFF_T_DEFINED 151 typedef int ptrdiff_t; 152# define _PTRDIFF_T_DEFINED 153# endif 154 155/* 156 * Helper macros for including the native headers in cases where a file with 157 * the same name also exists in the STLport include folder. The idea behind 158 * this is that we first go up one directory and then down into a dir that 159 * is only present in the native install but not in STLport. 160 * 161 */ 162# if !defined (_STLP_NATIVE_INCLUDE_PATH) 163# if defined (_X86_) 164# if defined (_STLP_WCE_TARGET_PROC_SUBTYPE_EMULATOR) 165# define _STLP_NATIVE_INCLUDE_PATH ../Emulator 166# else 167# define _STLP_NATIVE_INCLUDE_PATH ../X86 168# endif 169# elif defined (_ARM_) 170# if _MSC_VER < 1400 171 // eVC3/4 172# if defined (ARMV4) 173# define _STLP_NATIVE_INCLUDE_PATH ../Armv4 174# elif defined (ARMV4I) 175# define _STLP_NATIVE_INCLUDE_PATH ../Armv4i 176# elif defined (ARMV4T) 177# define _STLP_NATIVE_INCLUDE_PATH ../Armv4t 178# else 179# error Unknown ARM SDK. 180# endif 181# else 182 // VC8 crosscompiling for CE 183# if defined (ARMV4) 184 // VC8 bundled Pocket PC 2003 SDK don't have a target CPU subfolder. 185# if defined(WIN32_PLATFORM_PSPC) 186# define _STLP_NATIVE_INCLUDE_PATH ../Include 187# else 188# define _STLP_NATIVE_INCLUDE_PATH ../Armv4 189# endif 190# elif defined(ARMV4I) || defined(ARMV4T) 191# define _STLP_NATIVE_INCLUDE_PATH ../Armv4i 192# else 193# error Unknown ARM SDK. 194# endif 195# endif 196# elif defined (_MIPS_) 197# if defined (MIPS16) 198# define _STLP_NATIVE_INCLUDE_PATH ../mips16 199# elif defined (MIPSII) 200# define _STLP_NATIVE_INCLUDE_PATH ../mipsII 201# elif defined (MIPSII_FP) 202# define _STLP_NATIVE_INCLUDE_PATH ../mipsII_fp 203# elif defined (MIPSIV) 204# define _STLP_NATIVE_INCLUDE_PATH ../mipsIV 205# elif defined (MIPSIV_FP) 206# define _STLP_NATIVE_INCLUDE_PATH ../mipsIV_fp 207# else 208# error Unknown MIPS SDK. 209# endif 210# elif defined (SHx) 211# if defined (SH3) 212# define _STLP_NATIVE_INCLUDE_PATH ../sh3 213# elif defined (SH4) 214# define _STLP_NATIVE_INCLUDE_PATH ../sh4 215# else 216# error Unknown SHx SDK. 217# endif 218# else 219# error Unknown SDK. 220# endif 221# endif /* !_STLP_NATIVE_INCLUDE_PATH */ 222 223/* Workaround when using MFCCE and using <new> together: MFCCE's wcealt.h doesn't 224 * check for __PLACEMENT_NEW_INLINE before defining operator new, so when <new> 225 * defines the operatore before, there will be an error C2084: 226 * "function 'void *__cdecl operator new(unsigned int,void *)' already has a body". 227 */ 228# ifdef _STLP_USE_MFC 229# define __PLACEMENT_NEW_INLINE 230# endif 231 232#endif /* _STLP_WCE_NET */ 233 234/* 235 * eMbedded Visual C++ 3.0 specific settings 236 */ 237#if defined (_STLP_WCE_EVC3) 238 239# define _STLP_NO_NATIVE_MBSTATE_T 240 241// evc3 has no locale and time support 242# define _STLP_NO_LOCALE_SUPPORT 243# define _STLP_NO_TIME_SUPPORT 244 245// evc3 has new, but no explicit header 246# define _STLP_NO_NEW_HEADER 247# define _STLP_NO_NEW_NEW_HEADER 248 249// evc3 has no bad_alloc and no typeinfo 250# undef _STLP_NO_BAD_ALLOC 251# define _STLP_NO_BAD_ALLOC 252 253# undef _STLP_NO_TYPEINFO 254# define _STLP_NO_TYPEINFO 255 256// missing things in eMbedded Visual C++ 3.0 headers 257# ifndef _SIZE_T_DEFINED 258 typedef unsigned int size_t; 259# define _SIZE_T_DEFINED 260# endif 261 262# ifndef _WCHAR_T_DEFINED 263 typedef unsigned short wchar_t; 264# define _WCHAR_T_DEFINED 265# endif 266 267// ptrdiff_t is not defined in evc3 headers 268# ifndef _PTRDIFF_T_DEFINED 269 typedef int ptrdiff_t; 270# define _PTRDIFF_T_DEFINED 271# endif 272 273// clock_t is not defined in evc3 headers 274# ifndef _CLOCK_T_DEFINED 275 typedef long clock_t; 276# define _CLOCK_T_DEFINED 277# endif 278 279// Struct tm is not defined in evc3 headers 280# ifndef _TM_DEFINED 281struct tm { 282 int tm_sec; /* seconds after the minute - [0,59] */ 283 int tm_min; /* minutes after the hour - [0,59] */ 284 int tm_hour; /* hours since midnight - [0,23] */ 285 int tm_mday; /* day of the month - [1,31] */ 286 int tm_mon; /* months since January - [0,11] */ 287 int tm_year; /* years since 1900 */ 288 int tm_wday; /* days since Sunday - [0,6] */ 289 int tm_yday; /* days since January 1 - [0,365] */ 290 int tm_isdst; /* daylight savings time flag */ 291}; 292# define _TM_DEFINED 293# endif 294 295// define placement new and delete operator 296// note: when MFCCE headers are included first, don't define the new operator, 297// since it was already defined in wcealt.h 298# ifdef __cplusplus 299# ifndef __PLACEMENT_NEW_INLINE 300# ifndef _MFC_VER 301inline void *__cdecl operator new(size_t, void *_P) { return (_P); } 302# endif /* _MFC_VER */ 303inline void __cdecl operator delete(void *, void *) { return; } 304# define __PLACEMENT_NEW_INLINE 305# endif 306# endif /* __cplusplus */ 307 308// evc3 doesn't have native wide functions, e.g. fgetwc, wmemmove 309# define _STLP_NO_NATIVE_WIDE_FUNCTIONS 310 311// evc3 doesn't have assert.h 312# ifndef _ASSERT_DEFINED 313# define assert(expr) _STLP_ASSERT(expr) 314# define _ASSERT_DEFINED 315# endif 316 317#endif /* _STLP_WCE_EVC3 */ 318 319/* 320 * original call: TerminateProcess(GetCurrentProcess(), 0); 321 * we substitute the GetCurrentProcess() with the result of the inline function 322 * defined in kfuncs.h, since we then can avoid including <windows.h> at all. 323 * all needed Win32 API functions are defined in <stl/_windows.h> 324 */ 325#ifndef _ABORT_DEFINED 326# define _STLP_ABORT() TerminateProcess(reinterpret_cast<HANDLE>(66), 0) 327# define _ABORT_DEFINED 328#endif 329 330// Notice: windows.h isn't included here anymore; all needed defines are in 331// stl/_windows.h now 332 333#endif /* _STLP_EVC_H */ 334