|
|
|
1 |
|
/* yvals.h values header for Microsoft C/C++ */ |
2 |
|
#pragma once |
3 |
|
#ifndef _YVALS |
4 |
|
#define _YVALS |
5 |
|
|
6 |
|
#include <crtdefs.h> |
7 |
|
|
8 |
|
#ifdef _MSC_VER |
9 |
|
#pragma pack(push,_CRT_PACKING) |
10 |
|
#endif /* _MSC_VER */ |
11 |
|
|
12 |
|
#define _CPPLIB_VER 505 |
13 |
|
|
14 |
|
#if !defined(_HAS_TR1) |
15 |
|
#define _HAS_TR1 1 /* enable TR1 extensions */ |
16 |
|
#endif /* !defined(_HAS_TR1) */ |
17 |
|
|
18 |
|
/* Note on use of "deprecate": |
19 |
|
* Various places in this header and other headers use __declspec(deprecate) or macros that have the term DEPRECATE in them. |
20 |
|
* We use deprecate here ONLY to signal the compiler to emit a warning about these items. The use of deprecate |
21 |
|
* should NOT be taken to imply that any standard committee has deprecated these functions from the relevant standards. |
22 |
|
* In fact, these functions are NOT deprecated from the standard. |
23 |
|
* |
24 |
|
* Full details can be found in our documentation by searching for "Checked Iterators". |
25 |
|
*/ |
26 |
|
|
27 |
|
#define __PURE_APPDOMAIN_GLOBAL |
28 |
|
|
29 |
|
#ifndef __CRTDECL |
30 |
|
#if defined(_M_CEE_PURE) || defined(MRTDLL) |
31 |
|
#define __CRTDECL __clrcall |
32 |
|
#else |
33 |
|
#define __CRTDECL __cdecl |
34 |
|
#endif |
35 |
|
#endif |
36 |
|
|
37 |
|
#ifndef __CLR_OR_THIS_CALL |
38 |
|
#if defined(MRTDLL) || defined(_M_CEE_PURE) |
39 |
|
#define __CLR_OR_THIS_CALL __clrcall |
40 |
|
#else |
41 |
|
#define __CLR_OR_THIS_CALL |
42 |
|
#endif |
43 |
|
#endif |
44 |
|
|
45 |
|
#ifndef __CLRCALL_OR_CDECL |
46 |
|
#if defined(MRTDLL) || defined(_M_CEE_PURE) |
47 |
|
#define __CLRCALL_OR_CDECL __clrcall |
48 |
|
#else |
49 |
|
#define __CLRCALL_OR_CDECL __cdecl |
50 |
|
#endif |
51 |
|
#endif |
52 |
|
|
53 |
|
#ifndef __CLRCALL_PURE_OR_CDECL |
54 |
|
#if defined(_M_CEE_PURE) |
55 |
|
#define __CLRCALL_PURE_OR_CDECL __clrcall |
56 |
|
#else |
57 |
|
#define __CLRCALL_PURE_OR_CDECL __cdecl |
58 |
|
#endif |
59 |
|
#endif |
60 |
|
|
61 |
|
/* NAMING PROPERTIES */ |
62 |
|
#define _WIN32_C_LIB 1 |
63 |
|
|
64 |
|
/* THREAD AND LOCALE CONTROL */ |
65 |
|
#define _MULTI_THREAD 1 /* nontrivial locks if multithreaded */ |
66 |
|
#define _IOSTREAM_OP_LOCKS 1 /* lock iostream operations */ |
67 |
|
#define _GLOBAL_LOCALE 0 /* 0 for per-thread locales, 1 for shared */ |
68 |
|
|
69 |
|
/* THREAD-LOCAL STORAGE */ |
70 |
|
#define _COMPILER_TLS 1 /* 1 if compiler supports TLS directly */ |
71 |
|
#if _MULTI_THREAD |
72 |
|
#define _TLS_QUAL __declspec(thread) /* TLS qualifier, if any */ |
73 |
|
|
74 |
|
#else /* _MULTI_THREAD */ |
75 |
|
#define _TLS_QUAL |
76 |
|
#endif /* _MULTI_THREAD */ |
77 |
|
|
78 |
|
#ifndef _HAS_EXCEPTIONS |
79 |
|
#define _HAS_EXCEPTIONS 1 /* predefine as 0 to disable exceptions */ |
80 |
|
#endif /* _HAS_EXCEPTIONS */ |
81 |
|
|
82 |
|
#ifndef _HAS_NAMESPACE |
83 |
|
#define _HAS_NAMESPACE 1 /* predefine as 0 to disable exceptions */ |
84 |
|
#endif /* _HAS_NAMESPACE */ |
85 |
|
|
86 |
|
#ifndef _HAS_IMMUTABLE_SETS |
87 |
|
#define _HAS_IMMUTABLE_SETS 0 |
88 |
|
#endif /* _HAS_IMMUTABLE_SETS */ |
89 |
|
|
90 |
|
#ifndef _HAS_STRICT_CONFORMANCE |
91 |
|
#define _HAS_STRICT_CONFORMANCE 0 |
92 |
|
#endif /* _HAS_STRICT_CONFORMANCE */ |
93 |
|
|
94 |
|
#ifndef _HAS_TRADITIONAL_STL |
95 |
|
#define _HAS_TRADITIONAL_STL 0 |
96 |
|
#endif /* _HAS_TRADITIONAL_STL */ |
97 |
|
|
98 |
|
#ifdef _MSC_VER |
99 |
|
#define _GLOBAL_USING 1 |
100 |
|
#endif |
101 |
|
|
102 |
|
#if !defined (_HAS_ITERATOR_DEBUGGING) |
103 |
|
#if defined (_DEBUG) |
104 |
|
#define _HAS_ITERATOR_DEBUGGING 1 /* for range checks, etc. */ |
105 |
|
#else |
106 |
|
#define _HAS_ITERATOR_DEBUGGING 0 |
107 |
|
#endif /* defined (_DEBUG) */ |
108 |
|
#else |
109 |
|
#if !defined (_DEBUG) && _HAS_ITERATOR_DEBUGGING != 0 |
110 |
|
#include <crtwrn.h> |
111 |
|
#pragma _CRT_WARNING( _NO_ITERATOR_DEBUGGING ) |
112 |
|
#undef _HAS_ITERATOR_DEBUGGING |
113 |
|
#define _HAS_ITERATOR_DEBUGGING 0 |
114 |
|
#endif |
115 |
|
#endif /* !defined (_HAS_ITERATOR_DEBUGGING) */ |
116 |
|
|
117 |
|
/* _SECURE_CRT definitions */ |
118 |
|
|
119 |
|
#define __STR2WSTR(str) L##str |
120 |
|
#define _STR2WSTR(str) __STR2WSTR(str) |
121 |
|
|
122 |
|
#define __FILEW__ _STR2WSTR(__FILE__) |
123 |
|
#define __FUNCTIONW__ _STR2WSTR(__FUNCTION__) |
124 |
|
|
125 |
|
/* _SECURE_SCL switches: default values */ |
126 |
|
|
127 |
|
#if !defined (_SECURE_SCL) |
128 |
|
#define _SECURE_SCL 1 |
129 |
|
#endif |
130 |
|
|
131 |
|
/* See note on use of deprecate at the top of this file */ |
132 |
|
#if !defined(_SCL_SECURE_NO_WARNINGS) && defined(_SCL_SECURE_NO_DEPRECATE) |
133 |
|
#define _SCL_SECURE_NO_WARNINGS |
134 |
|
#endif |
135 |
|
|
136 |
|
#if !defined (_SECURE_SCL_DEPRECATE) |
137 |
|
#if defined(_SCL_SECURE_NO_WARNINGS) |
138 |
|
#define _SECURE_SCL_DEPRECATE 0 |
139 |
|
#else |
140 |
|
#define _SECURE_SCL_DEPRECATE 1 |
141 |
|
#endif |
142 |
|
#endif |
143 |
|
|
144 |
|
#if !defined (_SECURE_SCL_THROWS) |
145 |
|
#define _SECURE_SCL_THROWS 0 |
146 |
|
#endif |
147 |
|
|
148 |
|
/* _SECURE_SCL switches: helper macros */ |
149 |
|
/* See note on use of deprecate at the top of this file */ |
150 |
|
|
151 |
|
#if _SECURE_SCL_DEPRECATE |
152 |
|
#define _SCL_CHECKED_ALGORITHM_WARN \ |
153 |
|
_CRT_DEPRECATE_TEXT( \ |
154 |
|
"Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. " \ |
155 |
|
"To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'") |
156 |
|
#else |
157 |
|
#define _SCL_CHECKED_ALGORITHM_WARN |
158 |
|
#endif |
159 |
|
|
160 |
|
#if _SECURE_SCL && _SECURE_SCL_DEPRECATE |
161 |
|
#define _SCL_INSECURE_DEPRECATE \ |
162 |
|
_CRT_DEPRECATE_TEXT( \ |
163 |
|
"Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. " \ |
164 |
|
"To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'") |
165 |
|
#else |
166 |
|
#define _SCL_INSECURE_DEPRECATE |
167 |
|
#endif |
168 |
|
|
169 |
|
/* |
170 |
|
* Assert in debug builds. |
171 |
|
* set errno and return |
172 |
|
* |
173 |
|
*/ |
174 |
|
#ifdef _DEBUG |
175 |
|
|
176 |
|
#ifndef _SCL_SECURE_INVALID_PARAMETER |
177 |
|
#define _SCL_SECURE_INVALID_PARAMETER(expr) ::_invalid_parameter(__STR2WSTR(#expr), __FUNCTIONW__, __FILEW__, __LINE__, 0) |
178 |
|
#endif |
179 |
|
|
180 |
|
#else |
181 |
|
|
182 |
|
#ifndef _SCL_SECURE_INVALID_PARAMETER |
183 |
|
#define _SCL_SECURE_INVALID_PARAMETER(expr) ::_invalid_parameter_noinfo() |
184 |
|
#endif |
185 |
|
|
186 |
|
#endif |
187 |
|
|
188 |
|
#if _SECURE_SCL_THROWS |
189 |
|
|
190 |
|
#define _SCL_SECURE_INVALID_ARGUMENT_NO_ASSERT _Xinvarg() |
191 |
|
#define _SCL_SECURE_OUT_OF_RANGE_NO_ASSERT _Xran() |
192 |
|
|
193 |
|
#else /* _SECURE_SCL_THROWS */ |
194 |
|
|
195 |
|
#define _SCL_SECURE_INVALID_ARGUMENT_NO_ASSERT _SCL_SECURE_INVALID_PARAMETER("invalid argument") |
196 |
|
#define _SCL_SECURE_OUT_OF_RANGE_NO_ASSERT _SCL_SECURE_INVALID_PARAMETER("out of range") |
197 |
|
|
198 |
|
#endif /* _SECURE_SCL_THROWS */ |
199 |
|
|
200 |
|
#define _SCL_SECURE_ALWAYS_VALIDATE(cond) \ |
201 |
|
{ \ |
202 |
|
if (!(cond)) \ |
203 |
|
{ \ |
204 |
|
_ASSERTE((#cond, 0)); \ |
205 |
|
_SCL_SECURE_INVALID_ARGUMENT_NO_ASSERT; \ |
206 |
|
} \ |
207 |
|
__analysis_assume(cond); \ |
208 |
|
} |
209 |
|
|
210 |
|
#define _SCL_SECURE_ALWAYS_VALIDATE_RANGE(cond) \ |
211 |
|
{ \ |
212 |
|
if (!(cond)) \ |
213 |
|
{ \ |
214 |
|
_ASSERTE((#cond, 0)); \ |
215 |
|
_SCL_SECURE_OUT_OF_RANGE_NO_ASSERT; \ |
216 |
|
} \ |
217 |
|
__analysis_assume(cond); \ |
218 |
|
} |
219 |
|
|
220 |
|
// validation a la Secure CRT |
221 |
|
#define _SCL_SECURE_CRT_VALIDATE(cond, retvalue) \ |
222 |
|
{ \ |
223 |
|
if (!(cond)) \ |
224 |
|
{ \ |
225 |
|
_ASSERTE((#cond, 0)); \ |
226 |
|
_SCL_SECURE_INVALID_PARAMETER(cond); \ |
227 |
|
return (retvalue); \ |
228 |
|
} \ |
229 |
|
} |
230 |
|
|
231 |
|
#if _SECURE_SCL |
232 |
|
|
233 |
|
#define _SCL_SECURE_VALIDATE(cond) \ |
234 |
|
{ \ |
235 |
|
if (!(cond)) \ |
236 |
|
{ \ |
237 |
|
_ASSERTE((#cond, 0)); \ |
238 |
|
_SCL_SECURE_INVALID_ARGUMENT_NO_ASSERT; \ |
239 |
|
} \ |
240 |
|
__analysis_assume(cond); \ |
241 |
|
} |
242 |
|
|
243 |
|
#define _SCL_SECURE_VALIDATE_RANGE(cond) \ |
244 |
|
{ \ |
245 |
|
if (!(cond)) \ |
246 |
|
{ \ |
247 |
|
_ASSERTE((#cond, 0)); \ |
248 |
|
_SCL_SECURE_OUT_OF_RANGE_NO_ASSERT; \ |
249 |
|
} \ |
250 |
|
__analysis_assume(cond); \ |
251 |
|
} |
252 |
|
|
253 |
|
#define _SCL_SECURE_INVALID_ARGUMENT \ |
254 |
|
{ \ |
255 |
|
_ASSERTE(("Standard C++ Libraries Invalid Argument", 0)); \ |
256 |
|
_SCL_SECURE_INVALID_ARGUMENT_NO_ASSERT; \ |
257 |
|
} |
258 |
|
#define _SCL_SECURE_OUT_OF_RANGE \ |
259 |
|
{ \ |
260 |
|
_ASSERTE(("Standard C++ Libraries Out of Range", 0)); \ |
261 |
|
_SCL_SECURE_OUT_OF_RANGE_NO_ASSERT; \ |
262 |
|
} |
263 |
|
|
264 |
|
#define _SCL_SECURE_MOVE(func, dst, size, src, count) func((dst), (size), (src), (count)) |
265 |
|
#define _SCL_SECURE_COPY(func, dst, size, src, count) func((dst), (size), (src), (count)) |
266 |
|
|
267 |
|
#else /* _SECURE_SCL */ |
268 |
|
|
269 |
|
/* when users disable _SECURE_SCL to get performance, we don't want analysis warnings from SCL headers */ |
270 |
|
#if _HAS_ITERATOR_DEBUGGING |
271 |
|
#define _SCL_SECURE_VALIDATE(cond) __analysis_assume(cond) |
272 |
|
#define _SCL_SECURE_VALIDATE_RANGE(cond) __analysis_assume(cond) |
273 |
|
#else |
274 |
|
#define _SCL_SECURE_VALIDATE(cond) |
275 |
|
#define _SCL_SECURE_VALIDATE_RANGE(cond) |
276 |
|
#endif |
277 |
|
|
278 |
|
#define _SCL_SECURE_INVALID_ARGUMENT |
279 |
|
#define _SCL_SECURE_OUT_OF_RANGE |
280 |
|
|
281 |
|
#define _SCL_SECURE_MOVE(func, dst, size, src, count) func((dst), (src), (count)) |
282 |
|
#define _SCL_SECURE_COPY(func, dst, size, src, count) func((dst), (src), (count)) |
283 |
|
|
284 |
|
#endif /* _SECURE_SCL */ |
285 |
|
|
286 |
|
/* _SECURE_VALIDATION is the name of the bool template argument used to define iterators |
287 |
|
with secure validation selectively turned on or off (for an example, see the std::list |
288 |
|
iterators). Notice that all the _SCL_SECURE_TRAITS_* validation macros are almost identical |
289 |
|
to the _SCL_SECURE_* macros defined above. The only difference is the: |
290 |
|
|
291 |
|
if (_SECURE_VALIDATION) { } |
292 |
|
|
293 |
|
statement, which will statically evaluate to true or false. With optimizations on, the |
294 |
|
compiler will optimize the check away. |
295 |
|
*/ |
296 |
|
#define _SECURE_VALIDATION _Secure_validation |
297 |
|
|
298 |
|
#if _SECURE_SCL |
299 |
|
|
300 |
|
#define _SECURE_VALIDATION_DEFAULT true |
301 |
|
|
302 |
|
#define _SCL_SECURE_TRAITS_VALIDATE(cond) \ |
303 |
|
{ \ |
304 |
|
__pragma(warning(push)); \ |
305 |
|
__pragma(warning(disable: 4127)); \ |
306 |
|
if (_SECURE_VALIDATION) \ |
307 |
|
{ \ |
308 |
|
_SCL_SECURE_VALIDATE(cond) \ |
309 |
|
} \ |
310 |
|
__pragma(warning(pop)); \ |
311 |
|
} |
312 |
|
|
313 |
|
#define _SCL_SECURE_TRAITS_VALIDATE_RANGE(cond) \ |
314 |
|
{ \ |
315 |
|
__pragma(warning(push)); \ |
316 |
|
__pragma(warning(disable: 4127)); \ |
317 |
|
if (_SECURE_VALIDATION) \ |
318 |
|
{ \ |
319 |
|
_SCL_SECURE_VALIDATE_RANGE(cond) \ |
320 |
|
} \ |
321 |
|
__pragma(warning(pop)); \ |
322 |
|
} |
333 |
|
} |
334 |
|
|
335 |
|
#define _SCL_SECURE_TRAITS_OUT_OF_RANGE \ |
336 |
|
{ \ |
337 |
|
__pragma(warning(push)); \ |
338 |
|
__pragma(warning(disable: 4127)); \ |
339 |
|
if (_SECURE_VALIDATION) \ |
340 |
|
{ \ |
341 |
|
_SCL_SECURE_OUT_OF_RANGE \ |
342 |
|
} \ |
343 |
|
__pragma(warning(pop)); \ |
344 |
|
} |
345 |
|
|
346 |
|
#else |
347 |
|
|
348 |
|
#define _SECURE_VALIDATION_DEFAULT false |
349 |
|
|
350 |
|
#define _SCL_SECURE_TRAITS_VALIDATE(cond) |
351 |
|
#define _SCL_SECURE_TRAITS_VALIDATE_RANGE(cond) |
352 |
|
|
353 |
|
#define _SCL_SECURE_TRAITS_INVALID_ARGUMENT |
354 |
|
#define _SCL_SECURE_TRAITS_OUT_OF_RANGE |
355 |
|
|
356 |
|
#endif |
357 |
|
|
358 |
|
#if __STDC_WANT_SECURE_LIB__ |
359 |
|
#define _CRT_SECURE_MEMCPY(dest, destsize, source, count) ::memcpy_s((dest), (destsize), (source), (count)) |
360 |
|
#define _CRT_SECURE_MEMMOVE(dest, destsize, source, count) ::memmove_s((dest), (destsize), (source), (count)) |
361 |
|
#define _CRT_SECURE_WMEMCPY(dest, destsize, source, count) ::wmemcpy_s((dest), (destsize), (source), (count)) |
362 |
|
#define _CRT_SECURE_WMEMMOVE(dest, destsize, source, count) ::wmemmove_s((dest), (destsize), (source), (count)) |
363 |
|
#else |
364 |
|
#define _CRT_SECURE_MEMCPY(dest, destsize, source, count) ::memcpy((dest), (source), (count)) |
365 |
|
#define _CRT_SECURE_MEMMOVE(dest, destsize, source, count) ::memmove((dest), (source), (count)) |
366 |
|
#define _CRT_SECURE_WMEMCPY(dest, destsize, source, count) ::wmemcpy((dest), (source), (count)) |
367 |
|
#define _CRT_SECURE_WMEMMOVE(dest, destsize, source, count) ::wmemmove((dest), (source), (count)) |
368 |
|
#endif |
369 |
|
|
370 |
|
#include <use_ansi.h> |
371 |
|
|
372 |
|
#ifndef _VC6SP2 |
373 |
|
#define _VC6SP2 0 /* define as 1 to fix linker errors with V6.0 SP2 */ |
374 |
|
#endif /* _VC6SP2 */ |
375 |
|
|
376 |
|
#if defined(_M_CEE) && defined(_STATIC_CPPLIB) |
377 |
|
#include <crtwrn.h> |
378 |
|
#pragma _CRT_WARNING( _CLR_AND_STATIC_CPPLIB ) |
379 |
|
#endif |
380 |
|
|
381 |
|
/* Define _CRTIMP2 */ |
382 |
|
#ifndef _CRTIMP2 |
383 |
|
|
384 |
|
#if defined(_DLL) && !defined(_STATIC_CPPLIB) |
385 |
|
#define _CRTIMP2 __declspec(dllimport) |
386 |
|
|
387 |
|
#else /* ndef _DLL && !STATIC_CPPLIB */ |
388 |
|
#define _CRTIMP2 |
389 |
|
#endif /* _DLL && !STATIC_CPPLIB */ |
390 |
|
|
391 |
|
#endif /* _CRTIMP2 */ |
392 |
|
|
393 |
|
/* Define _CRTIMP2_NCEEPURE */ |
394 |
|
#ifndef _CRTIMP2_NCEEPURE |
395 |
|
#if defined(_M_CEE_PURE) |
396 |
|
#define _CRTIMP2_NCEEPURE |
397 |
|
#else |
398 |
|
#define _CRTIMP2_NCEEPURE _CRTIMP2 |
399 |
|
#endif |
400 |
|
#endif |
401 |
|
|
402 |
|
#ifndef _MRTIMP |
403 |
|
#define _MRTIMP __declspec(dllimport) |
404 |
|
#endif /* _MRTIMP */ |
405 |
|
|
406 |
|
/* Define _MRTIMP2 */ |
407 |
|
#ifndef _MRTIMP2 |
408 |
|
|
409 |
|
#if defined(_DLL) && !defined(_STATIC_CPPLIB) |
410 |
|
#define _MRTIMP2 __declspec(dllimport) |
411 |
|
|
412 |
|
#else /* ndef _DLL && !STATIC_CPPLIB */ |
413 |
|
#define _MRTIMP2 |
414 |
|
#endif /* _DLL && !STATIC_CPPLIB */ |
415 |
|
|
416 |
|
#endif /* _MRTIMP2 */ |
417 |
|
|
418 |
|
/* Define _MRTIMP2_NPURE */ |
419 |
|
#ifndef _MRTIMP2_NPURE |
420 |
|
|
421 |
|
#if defined(_DLL) && defined(_M_CEE_PURE) |
422 |
|
#define _MRTIMP2_NPURE __declspec(dllimport) |
423 |
|
|
424 |
|
#else |
425 |
|
#define _MRTIMP2_NPURE |
426 |
|
#endif |
427 |
|
|
428 |
|
#endif /* _MRTIMP2_NPURE */ |
429 |
|
|
430 |
|
/* Define _MRTIMP2_NCEE */ |
431 |
|
#ifndef _MRTIMP2_NCEE |
432 |
|
#if defined(_M_CEE) |
433 |
|
#define _MRTIMP2_NCEE |
434 |
|
#else |
435 |
|
#define _MRTIMP2_NCEE _MRTIMP2 |
436 |
|
#endif |
437 |
|
#endif |
438 |
|
|
439 |
|
/* Define _MRTIMP2_NCEEPURE */ |
440 |
|
#ifndef _MRTIMP2_NCEEPURE |
441 |
|
#if defined(_M_CEE_PURE) |
442 |
|
#define _MRTIMP2_NCEEPURE |
443 |
|
#else |
444 |
|
#define _MRTIMP2_NCEEPURE _MRTIMP2 |
445 |
|
#endif |
446 |
|
#endif |
447 |
|
|
448 |
|
/* Define _MRTIMP2_NPURE_NCEEPURE */ |
449 |
|
#ifndef _MRTIMP2_NPURE_NCEEPURE |
450 |
|
#if defined(_M_CEE_PURE) |
451 |
|
#define _MRTIMP2_NPURE_NCEEPURE |
452 |
|
#else |
453 |
|
#define _MRTIMP2_NPURE_NCEEPURE _MRTIMP2_NPURE |
454 |
|
#endif |
455 |
|
#endif |
456 |
|
|
457 |
|
#if defined(_DLL) && !defined(_STATIC_CPPLIB) && !defined(_M_CEE_PURE) |
458 |
|
#define _DLL_CPPLIB |
459 |
|
#endif |
460 |
|
|
461 |
|
#ifndef _CRTIMP2_PURE |
462 |
|
#ifdef _M_CEE_PURE |
463 |
|
#define _CRTIMP2_PURE |
464 |
|
#else |
465 |
|
#define _CRTIMP2_PURE _CRTIMP2 |
466 |
|
#endif |
467 |
|
#endif |
468 |
|
|
469 |
|
#if !defined(_CRTDATA2) |
470 |
|
#define _CRTDATA2 _CRTIMP2 |
471 |
|
#endif |
472 |
|
|
473 |
|
|
474 |
|
#define _DEPRECATED _CRT_DEPRECATE_TEXT("This is an obsolete part of the Standard C++ Library Implementation. Do not use it.") |
475 |
|
|
476 |
|
|
477 |
|
|
478 |
|
/* NAMESPACE */ |
479 |
|
|
480 |
|
#if defined(__cplusplus) |
481 |
|
#define _STD_BEGIN namespace std { |
482 |
|
#define _STD_END } |
483 |
|
#define _STD ::std:: |
484 |
|
|
485 |
|
/* |
486 |
|
We use the stdext (standard extension) namespace to contain extensions that are not part of the current standard |
487 |
|
*/ |
488 |
|
#define _STDEXT_BEGIN namespace stdext { |
489 |
|
#define _STDEXT_END } |
490 |
|
#define _STDEXT ::stdext:: |
491 |
|
|
492 |
|
#ifdef _STD_USING |
493 |
|
#define _C_STD_BEGIN namespace std { /* only if *.c compiled as C++ */ |
494 |
|
#define _C_STD_END } |
495 |
|
#define _CSTD ::std:: |
496 |
|
|
497 |
|
#else /* _STD_USING */ |
498 |
|
/* #define _GLOBAL_USING *.h in global namespace, c* imports to std */ |
499 |
|
|
500 |
|
#define _C_STD_BEGIN |
501 |
|
#define _C_STD_END |
502 |
|
#define _CSTD :: |
503 |
|
#endif /* _STD_USING */ |
504 |
|
|
505 |
|
#define _C_LIB_DECL extern "C" { /* C has extern "C" linkage */ |
506 |
|
#define _END_C_LIB_DECL } |
507 |
|
#define _EXTERN_C extern "C" { |
508 |
|
#define _END_EXTERN_C } |
509 |
|
|
510 |
|
#else /* __cplusplus */ |
511 |
|
#define _STD_BEGIN |
512 |
|
#define _STD_END |
513 |
|
#define _STD |
514 |
|
|
515 |
|
#define _C_STD_BEGIN |
516 |
|
#define _C_STD_END |
517 |
|
#define _CSTD |
518 |
|
|
519 |
|
#define _C_LIB_DECL |
520 |
|
#define _END_C_LIB_DECL |
521 |
|
#define _EXTERN_C |
522 |
|
#define _END_EXTERN_C |
523 |
|
#endif /* __cplusplus */ |
524 |
|
|
525 |
|
#define _Restrict restrict |
526 |
|
|
527 |
|
#ifdef __cplusplus |
528 |
|
_STD_BEGIN |
529 |
|
typedef bool _Bool; |
530 |
|
_STD_END |
531 |
|
#endif /* __cplusplus */ |
532 |
|
|
533 |
|
/* VC++ COMPILER PARAMETERS */ |
534 |
|
#define _LONGLONG __int64 |
535 |
|
#define _ULONGLONG unsigned __int64 |
536 |
|
#define _LLONG_MAX 0x7fffffffffffffff |
537 |
|
#define _ULLONG_MAX 0xffffffffffffffff |
538 |
|
|
539 |
|
/* INTEGER PROPERTIES */ |
540 |
|
#define _C2 1 /* 0 if not 2's complement */ |
541 |
|
|
542 |
|
#define _MAX_EXP_DIG 8 /* for parsing numerics */ |
543 |
|
#define _MAX_INT_DIG 32 |
544 |
|
#define _MAX_SIG_DIG 36 |
545 |
|
|
546 |
|
typedef _LONGLONG _Longlong; |
547 |
|
typedef _ULONGLONG _ULonglong; |
548 |
|
|
549 |
|
/* STDIO PROPERTIES */ |
550 |
|
#define _Filet _iobuf |
551 |
|
|
552 |
|
#ifndef _FPOS_T_DEFINED |
553 |
|
#define _FPOSOFF(fp) ((long)(fp)) |
554 |
|
#endif /* _FPOS_T_DEFINED */ |
555 |
|
|
556 |
|
#define _IOBASE _base |
557 |
|
#define _IOPTR _ptr |
558 |
|
#define _IOCNT _cnt |
559 |
|
|
560 |
|
/* MULTITHREAD PROPERTIES */ |
561 |
|
/* LOCK MACROS */ |
562 |
|
#define _LOCK_LOCALE 0 |
563 |
|
#define _LOCK_MALLOC 1 |
564 |
|
#define _LOCK_STREAM 2 |
565 |
|
#define _LOCK_DEBUG 3 |
566 |
|
#define _MAX_LOCK 4 /* one more than highest lock number */ |
567 |
|
|
568 |
|
#ifdef __cplusplus |
569 |
|
_STD_BEGIN |
570 |
|
// CLASS _Lockit |
571 |
|
|
572 |
|
// warning 4412 is benign here |
573 |
|
#pragma warning(push) |
574 |
|
#pragma warning(disable:4412) |
575 |
|
class _CRTIMP2_PURE _Lockit |
576 |
|
{ // lock while object in existence -- MUST NEST |
577 |
|
public: |
578 |
|
#if _MULTI_THREAD |
579 |
|
|
580 |
|
#if defined(_M_CEE_PURE) || defined(MRTDLL) |
581 |
|
explicit __CLR_OR_THIS_CALL _Lockit() // set default lock |
582 |
|
: _Locktype(0) |
583 |
|
{ |
584 |
|
_Lockit_ctor(this); |
585 |
|
} |
586 |
|
explicit __CLR_OR_THIS_CALL _Lockit(int _Kind) // set the lock |
587 |
|
{ |
588 |
|
_Lockit_ctor(this, _Kind); |
589 |
|
} |
590 |
|
__CLR_OR_THIS_CALL ~_Lockit() // clear the lock |
591 |
|
{ |
592 |
|
_Lockit_dtor(this); |
593 |
|
} |
594 |
|
#else |
595 |
|
explicit __thiscall _Lockit(); // set default lock |
596 |
|
explicit __thiscall _Lockit(int); // set the lock |
597 |
|
__thiscall ~_Lockit(); // clear the lock |
598 |
|
#endif |
599 |
|
|
600 |
|
static _MRTIMP2_NPURE void __cdecl _Lockit_ctor(int); |
601 |
|
static _MRTIMP2_NPURE void __cdecl _Lockit_dtor(int); |
602 |
|
|
603 |
|
private: |
604 |
|
static _MRTIMP2_NPURE void __cdecl _Lockit_ctor(_Lockit *); |
605 |
|
static _MRTIMP2_NPURE void __cdecl _Lockit_ctor(_Lockit *, int); |
606 |
|
static _MRTIMP2_NPURE void __cdecl _Lockit_dtor(_Lockit *); |
607 |
|
|
608 |
|
__CLR_OR_THIS_CALL _Lockit(const _Lockit&); // not defined |
609 |
|
_Lockit& __CLR_OR_THIS_CALL operator=(const _Lockit&); // not defined |
610 |
|
|
611 |
|
int _Locktype; |
612 |
|
|
613 |
|
#else /* _MULTI_THREAD */ |
614 |
|
|
615 |
|
explicit _Lockit() |
616 |
|
{ // do nothing |
617 |
|
} |
618 |
|
|
619 |
|
explicit _Lockit(int) |
620 |
|
{ // do nothing |
621 |
|
} |
622 |
|
|
623 |
|
~_Lockit() |
624 |
|
{ // do nothing |
625 |
|
} |
626 |
|
#endif /* _MULTI_THREAD */ |
627 |
|
|
628 |
|
}; |
629 |
|
|
630 |
|
#ifdef _M_CEE |
631 |
|
|
632 |
|
class _CRTIMP2_PURE _EmptyLockit |
633 |
|
{ // empty lock class used for bin compat |
634 |
|
public: |
635 |
|
#if _MULTI_THREAD |
636 |
|
|
637 |
|
private: |
638 |
|
int _Locktype; |
639 |
|
|
640 |
|
#else /* _MULTI_THREAD */ |
641 |
|
|
642 |
|
#endif /* _MULTI_THREAD */ |
643 |
|
}; |
644 |
|
|
645 |
|
#if defined(__cplusplus_cli) |
646 |
|
#define _M_CEE_FINALLY finally |
647 |
|
#else |
648 |
|
#define _M_CEE_FINALLY __finally |
649 |
|
#endif |
650 |
|
|
651 |
|
#define _BEGIN_LOCK(_Kind) \ |
652 |
|
{ \ |
653 |
|
typedef int _TmpTestType; \ |
654 |
|
__if_exists(_TmpTestType::ToString) \ |
655 |
|
{ \ |
656 |
|
bool _MustReleaseLock = false; \ |
657 |
|
int _LockKind = _Kind; \ |
658 |
|
System::Runtime::CompilerServices::RuntimeHelpers::PrepareConstrainedRegions(); \ |
659 |
|
try \ |
660 |
|
} \ |
661 |
|
{ \ |
662 |
|
__if_exists(_TmpTestType::ToString) \ |
663 |
|
{ \ |
664 |
|
System::Runtime::CompilerServices::RuntimeHelpers::PrepareConstrainedRegions(); \ |
665 |
|
try { } _M_CEE_FINALLY \ |
666 |
|
{ \ |
667 |
|
_STD _Lockit::_Lockit_ctor(_LockKind); \ |
668 |
|
_MustReleaseLock = true; \ |
669 |
|
} \ |
670 |
|
} \ |
671 |
|
__if_not_exists(_TmpTestType::ToString) \ |
672 |
|
{ \ |
673 |
|
_STD _Lockit _Lock(_Kind); \ |
674 |
|
} |
675 |
|
|
676 |
|
#define _END_LOCK() \ |
677 |
|
} \ |
678 |
|
__if_exists(_TmpTestType::ToString) \ |
679 |
|
{ \ |
680 |
|
_M_CEE_FINALLY \ |
681 |
|
{ \ |
682 |
|
if (_MustReleaseLock) \ |
683 |
|
{ \ |
684 |
|
_STD _Lockit::_Lockit_dtor(_LockKind); \ |
685 |
|
} \ |
686 |
|
} \ |
687 |
|
} \ |
688 |
|
} |
689 |
|
|
690 |
|
#define _BEGIN_LOCINFO(_VarName) \ |
691 |
|
_BEGIN_LOCK(_LOCK_LOCALE) \ |
692 |
|
_Locinfo _VarName; |
693 |
|
|
694 |
|
#define _END_LOCINFO() \ |
695 |
|
_END_LOCK() \ |
696 |
|
|
697 |
|
#define _RELIABILITY_CONTRACT \ |
698 |
|
[System::Runtime::ConstrainedExecution::ReliabilityContract( \ |
699 |
|
System::Runtime::ConstrainedExecution::Consistency::WillNotCorruptState, \ |
700 |
|
System::Runtime::ConstrainedExecution::Cer::Success)] |
701 |
|
|
702 |
|
#else |
703 |
|
|
704 |
|
#define _BEGIN_LOCK(_Kind) \ |
705 |
|
{ \ |
706 |
|
_STD _Lockit _Lock(_Kind); |
707 |
|
|
708 |
|
#define _END_LOCK() \ |
709 |
|
} |
710 |
|
|
711 |
|
#define _BEGIN_LOCINFO(_VarName) \ |
712 |
|
{ \ |
713 |
|
_Locinfo _VarName; |
714 |
|
|
715 |
|
#define _END_LOCINFO() \ |
716 |
|
} |
717 |
|
|
718 |
|
#define _RELIABILITY_CONTRACT |
719 |
|
|
720 |
|
#endif |
721 |
|
|
722 |
|
class _CRTIMP2_PURE _Mutex |
723 |
|
{ // lock under program control |
724 |
|
public: |
725 |
|
|
726 |
|
#if _MULTI_THREAD |
727 |
|
|
728 |
|
#if defined(_M_CEE_PURE) || defined(MRTDLL) |
729 |
|
__CLR_OR_THIS_CALL _Mutex() |
730 |
|
{ |
731 |
|
_Mutex_ctor(this); |
732 |
|
} |
733 |
|
__CLR_OR_THIS_CALL ~_Mutex() |
734 |
|
{ |
735 |
|
_Mutex_dtor(this); |
736 |
|
} |
737 |
|
void __CLR_OR_THIS_CALL _Lock() |
738 |
|
{ |
739 |
|
_Mutex_Lock(this); |
740 |
|
} |
741 |
|
void __CLR_OR_THIS_CALL _Unlock() |
742 |
|
{ |
743 |
|
_Mutex_Unlock(this); |
744 |
|
} |
745 |
|
#else |
746 |
|
__thiscall _Mutex(); |
747 |
|
__thiscall ~_Mutex(); |
748 |
|
void __thiscall _Lock(); |
749 |
|
void __thiscall _Unlock(); |
750 |
|
#endif |
751 |
|
|
752 |
|
private: |
753 |
|
static _MRTIMP2_NPURE_NCEEPURE void __CLRCALL_PURE_OR_CDECL _Mutex_ctor(_Mutex *); |
754 |
|
static _MRTIMP2_NPURE_NCEEPURE void __CLRCALL_PURE_OR_CDECL _Mutex_dtor(_Mutex *); |
755 |
|
static _MRTIMP2_NPURE_NCEEPURE void __CLRCALL_PURE_OR_CDECL _Mutex_Lock(_Mutex *); |
756 |
|
static _MRTIMP2_NPURE_NCEEPURE void __CLRCALL_PURE_OR_CDECL _Mutex_Unlock(_Mutex *); |
757 |
|
|
758 |
|
__CLR_OR_THIS_CALL _Mutex(const _Mutex&); // not defined |
759 |
|
_Mutex& __CLR_OR_THIS_CALL operator=(const _Mutex&); // not defined |
760 |
|
void *_Mtx; |
761 |
|
|
762 |
|
#else /* _MULTI_THREAD */ |
763 |
|
void _Lock() |
764 |
|
{ // do nothing |
765 |
|
} |
766 |
|
|
767 |
|
void _Unlock() |
768 |
|
{ // do nothing |
769 |
|
} |
770 |
|
#endif /* _MULTI_THREAD */ |
771 |
|
|
772 |
|
}; |
773 |
|
|
774 |
|
class _CRTIMP2_PURE _Init_locks |
775 |
|
{ // initialize mutexes |
776 |
|
public: |
777 |
|
|
778 |
|
#if _MULTI_THREAD |
779 |
|
|
780 |
|
#if defined(_M_CEE_PURE) || defined(MRTDLL) |
781 |
|
__CLR_OR_THIS_CALL _Init_locks() |
782 |
|
{ |
783 |
|
_Init_locks_ctor(this); |
784 |
|
} |
785 |
|
__CLR_OR_THIS_CALL ~_Init_locks() |
786 |
|
{ |
787 |
|
_Init_locks_dtor(this); |
788 |
|
} |
789 |
|
#else |
790 |
|
__thiscall _Init_locks(); |
791 |
|
__thiscall ~_Init_locks(); |
792 |
|
#endif |
793 |
|
|
794 |
|
private: |
795 |
|
static _MRTIMP2_NPURE void __cdecl _Init_locks_ctor(_Init_locks *); |
796 |
|
static _MRTIMP2_NPURE void __cdecl _Init_locks_dtor(_Init_locks *); |
797 |
|
|
798 |
|
#else /* _MULTI_THREAD */ |
799 |
|
_Init_locks() |
800 |
|
{ // do nothing |
801 |
|
} |
802 |
|
|
803 |
|
~_Init_locks() |
804 |
|
{ // do nothing |
805 |
|
} |
806 |
|
#endif /* _MULTI_THREAD */ |
807 |
|
|
808 |
|
}; |
809 |
|
#pragma warning(pop) |
810 |
|
_STD_END |
811 |
|
#endif /* __cplusplus */ |
812 |
|
|
813 |
|
#ifndef _RELIABILITY_CONTRACT |
814 |
|
#define _RELIABILITY_CONTRACT |
815 |
|
#endif |
816 |
|
|
817 |
|
/* MISCELLANEOUS MACROS AND TYPES */ |
818 |
|
_C_STD_BEGIN |
819 |
|
_MRTIMP2 void __cdecl _Atexit(void (__cdecl *)(void)); |
820 |
|
|
821 |
|
typedef int _Mbstatet; |
822 |
|
|
823 |
|
#define _ATEXIT_T void |
824 |
|
#define _Mbstinit(x) mbstate_t x = {0} |
825 |
|
_C_STD_END |
826 |
|
|
827 |
|
#ifdef _MSC_VER |
828 |
|
#define _EXTERN_TEMPLATE template |
829 |
|
#define _THROW_BAD_ALLOC _THROW1(...) |
830 |
|
#pragma pack(pop) |
831 |
|
#endif /* _MSC_VER */ |
832 |
|
|
833 |
|
#endif /* _YVALS */ |
834 |
|
|
835 |
|
|
836 |
|
/* |
837 |
|
* Copyright (c) 1992-2008 by P.J. Plauger. ALL RIGHTS RESERVED. |
838 |
|
* Consult your license regarding permissions and restrictions. |
839 |
|
V5.05:0009 */ |
840 |
|
|
841 |
|
|
842 |
|
|
|
|
|