|
1 /* |
|
2 * File to have Windows CE Toolkit for VC++ 5.0 working with STLport |
|
3 * 09 - 03 - 1999 |
|
4 * Origin : Giuseppe Govi - g.govi@iol.it |
|
5 */ |
|
6 |
|
7 #ifndef _STLP_WINCE_H |
|
8 #define _STLP_WINCE_H |
|
9 |
|
10 // this flag is being used by STLport |
|
11 # define _STLP_WINCE |
|
12 |
|
13 #ifndef _MT // Always threaded in CE |
|
14 #define _MT |
|
15 #endif |
|
16 |
|
17 #define _STLP_NO_NATIVE_MBSTATE_T |
|
18 #define _STLP_NO_TYPEINFO |
|
19 #define _STLP_NO_BAD_ALLOC |
|
20 #define _STLP_NO_NEW_NEW_HEADER |
|
21 #define _STLP_OWN_IOSTREAMS |
|
22 |
|
23 // tell other parts no threads are there |
|
24 # define _STLP_NO_THREADS 1 |
|
25 |
|
26 // not all new-style headers are available... |
|
27 # define _STLP_HAS_NO_NEW_C_HEADERS |
|
28 |
|
29 # undef _STLP_HAS_NO_EXCEPTIONS |
|
30 # define _STLP_HAS_NO_EXCEPTIONS |
|
31 # undef _STLP_NO_EXCEPTION_HEADER |
|
32 # define _STLP_NO_EXCEPTION_HEADER |
|
33 |
|
34 // we have to use malloc instead of new |
|
35 # undef _STLP_USE_NEWALLOC |
|
36 # define _STLP_USE_MALLOC |
|
37 |
|
38 //# ifdef _STLP_MSVC |
|
39 //# pragma warning (disable: 4786) |
|
40 //# endif |
|
41 |
|
42 #ifdef _STLP_WINCE_USE_OUTPUTDEBUGSTRING |
|
43 #define _STLP_WINCE_TRACE(msg) OutputDebugString(msg) |
|
44 #else |
|
45 #define _STLP_WINCE_TRACE(msg) MessageBox(NULL,(msg),NULL,MB_OK) |
|
46 #endif |
|
47 |
|
48 #ifndef __THROW_BAD_ALLOC |
|
49 #define __THROW_BAD_ALLOC _STLP_WINCE_TRACE(L"out of memory"); ExitThread(1) |
|
50 #endif |
|
51 |
|
52 #ifndef _SIZE_T_DEFINED |
|
53 typedef unsigned int size_t; |
|
54 #define _SIZE_T_DEFINED |
|
55 #endif |
|
56 |
|
57 #ifndef _WCHAR_T_DEFINED |
|
58 typedef unsigned short wchar_t; |
|
59 #define _WCHAR_T_DEFINED |
|
60 #endif |
|
61 |
|
62 #ifndef _TIME_T_DEFINED |
|
63 typedef unsigned long time_t; |
|
64 #define _TIME_T_DEFINED |
|
65 #endif |
|
66 |
|
67 //ptrdiff_t is not defined in Windows CE SDK |
|
68 #ifndef _PTRDIFF_T_DEFINED |
|
69 typedef int ptrdiff_t; |
|
70 #define _PTRDIFF_T_DEFINED |
|
71 #endif |
|
72 |
|
73 //clock_t is not defined in Windows CE SDK |
|
74 #ifndef _CLOCK_T_DEFINED |
|
75 typedef long clock_t; |
|
76 #define _CLOCK_T_DEFINED |
|
77 #endif |
|
78 |
|
79 //struct tm is not defined in Windows CE SDK |
|
80 #ifndef _TM_DEFINED |
|
81 struct tm { |
|
82 int tm_sec; /* seconds after the minute - [0,59] */ |
|
83 int tm_min; /* minutes after the hour - [0,59] */ |
|
84 int tm_hour; /* hours since midnight - [0,23] */ |
|
85 int tm_mday; /* day of the month - [1,31] */ |
|
86 int tm_mon; /* months since January - [0,11] */ |
|
87 int tm_year; /* years since 1900 */ |
|
88 int tm_wday; /* days since Sunday - [0,6] */ |
|
89 int tm_yday; /* days since January 1 - [0,365] */ |
|
90 int tm_isdst; /* daylight savings time flag */ |
|
91 }; |
|
92 #define _TM_DEFINED |
|
93 #endif |
|
94 |
|
95 // Some useful routines that are missing in Windows CE SDK |
|
96 #ifdef __cplusplus |
|
97 extern "C" |
|
98 { |
|
99 #endif |
|
100 |
|
101 char * __cdecl getenv(const char *); |
|
102 struct tm * __cdecl gmtime(const time_t *); |
|
103 int __cdecl remove(const char *); |
|
104 int __cdecl rename(const char *, const char *); |
|
105 time_t __cdecl time(time_t *); |
|
106 |
|
107 #if (_WIN32_WCE < 300) |
|
108 char * __cdecl strrchr(const char *, int); |
|
109 #endif |
|
110 |
|
111 #ifdef __cplusplus |
|
112 } |
|
113 |
|
114 #ifndef __PLACEMENT_NEW_INLINE |
|
115 inline void *__cdecl operator new(size_t, void *_P) { return (_P); } |
|
116 #define __PLACEMENT_NEW_INLINE |
|
117 #endif |
|
118 |
|
119 // Only defined as macros in Windows CE SDK |
|
120 #include _STLP_NATIVE_C_HEADER(ctype.h) |
|
121 |
|
122 #if (_WIN32_WCE < 300) // Only wide chars for older versions |
|
123 #define _isctype iswctype |
|
124 #endif |
|
125 |
|
126 inline int (isalpha)(int c) { return _isctype(c, _ALPHA); } |
|
127 inline int (isupper)(int c) { return _isctype(c, _UPPER); } |
|
128 inline int (islower)(int c) { return _isctype(c, _LOWER); } |
|
129 inline int (isdigit)(int c) { return _isctype(c, _DIGIT); } |
|
130 inline int (isxdigit)(int c) { return _isctype(c, _HEX); } |
|
131 inline int (isspace)(int c) { return _isctype(c, _SPACE); } |
|
132 inline int (ispunct)(int c) { return _isctype(c, _PUNCT); } |
|
133 inline int (isalnum)(int c) { return _isctype(c, _ALPHA|_DIGIT); } |
|
134 inline int (isprint)(int c) { return _isctype(c, _BLANK|_PUNCT|_ALPHA|_DIGIT); } |
|
135 inline int (isgraph)(int c) { return _isctype(c, _PUNCT|_ALPHA|_DIGIT); } |
|
136 inline int (iscntrl)(int c) { return _isctype(c, _CONTROL); } |
|
137 inline int (isascii)(int c) { return ((unsigned)(c) < 0x80); } |
|
138 |
|
139 #undef _isctype |
|
140 |
|
141 inline int (iswalpha)(int c) { return iswctype(c, _ALPHA); } |
|
142 inline int (iswupper)(int c) { return iswctype(c, _UPPER); } |
|
143 inline int (iswlower)(int c) { return iswctype(c, _LOWER); } |
|
144 inline int (iswdigit)(int c) { return iswctype(c, _DIGIT); } |
|
145 inline int (iswxdigit)(int c) { return iswctype(c, _HEX); } |
|
146 inline int (iswspace)(int c) { return iswctype(c, _SPACE); } |
|
147 inline int (iswpunct)(int c) { return iswctype(c, _PUNCT); } |
|
148 inline int (iswalnum)(int c) { return iswctype(c, _ALPHA|_DIGIT); } |
|
149 inline int (iswprint)(int c) { return iswctype(c, _BLANK|_PUNCT|_ALPHA|_DIGIT); } |
|
150 inline int (iswgraph)(int c) { return iswctype(c, _PUNCT|_ALPHA|_DIGIT); } |
|
151 inline int (iswcntrl)(int c) { return iswctype(c, _CONTROL); } |
|
152 inline int (iswascii)(int c) { return ((unsigned)(c) < 0x80); } |
|
153 |
|
154 #endif /* __cplusplus */ |
|
155 |
|
156 #if !defined(WIN32_LEAN_AND_MEAN) // Minimise windows includes |
|
157 #define WIN32_LEAN_AND_MEAN |
|
158 #endif |
|
159 #if !defined(VC_EXTRALEAN) |
|
160 #define VC_EXTRALEAN |
|
161 #endif |
|
162 #if !defined(STRICT) |
|
163 #define STRICT |
|
164 #endif |
|
165 #if !defined(NOMINMAX) |
|
166 #define NOMINMAX |
|
167 #endif |
|
168 |
|
169 #ifndef __WINDOWS__ |
|
170 #include <windows.h> |
|
171 #endif |
|
172 |
|
173 #ifndef _ABORT_DEFINED |
|
174 # define _STLP_ABORT() TerminateProcess(GetCurrentProcess(), 0) |
|
175 # define _ABORT_DEFINED |
|
176 #endif |
|
177 |
|
178 #ifndef _ASSERT_DEFINED |
|
179 # define assert(expr) _STLP_ASSERT(expr) |
|
180 # define _ASSERT_DEFINED |
|
181 #endif |
|
182 |
|
183 // they say it's needed |
|
184 # include <windows.h> |
|
185 |
|
186 #endif /* _STLP_WCE_H */ |
|
187 |
|
188 |