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