Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
_defs.h
Go to the documentation of this file.
1
32#ifndef _RWSTD_RW_DEFS_H_INCLUDED
33#define _RWSTD_RW_DEFS_H_INCLUDED
34
35#ifndef _RWSTD_RW_CONFIG_H_INCLUDED
36# include <rw/_config.h>
37#endif //_RWSTD_RW_CONFIG_H_INCLUDED
38
39
40// provide definitions for C++ versions of standard C headers
41// if a header is not available its name is #defined to the name of
42// this file (it's harmless and avoids polluting code with
43// tons of ugly platform-specific #ifdefs)
44#ifndef _RWSTD_NO_NEW_HEADER
45
46# define _RWSTD_CASSERT <cassert>
47# define _RWSTD_CCTYPE <cctype>
48# define _RWSTD_CERRNO <cerrno>
49# define _RWSTD_CFLOAT <cfloat>
50# define _RWSTD_CISO646 <ciso646>
51# define _RWSTD_CLIMITS <climits>
52# define _RWSTD_CLOCALE <clocale>
53# define _RWSTD_CMATH <cmath>
54# define _RWSTD_CSETJMP <csetjmp>
55# define _RWSTD_CSIGNAL <csignal>
56
57# ifdef _RWSTD_EDG_ECCP
58 // HACK: fool the vanilla EDG front-end into actually #including
59 // the file (it normally doesn't and treats <cstdarg> specially)
60# define _RWSTD_CSTDARG <ansi/cstdarg>
61# else // if !defined (_RWSTD_EDG_ECCP)
62# define _RWSTD_CSTDARG <cstdarg>
63# endif // _RWSTD_EDG_ECCP
64
65# define _RWSTD_CSTDDEF <cstddef>
66# define _RWSTD_CSTDIO <cstdio>
67# define _RWSTD_CSTDLIB <cstdlib>
68# define _RWSTD_CSTRING <cstring>
69# define _RWSTD_CTIME <ctime>
70
71# ifndef _RWSTD_NO_WCHAR_H
72# define _RWSTD_CWCHAR <cwchar>
73# else
74# define _RWSTD_CWCHAR <rw/_defs.h>
75# endif // _RWSTD_NO_WCHAR_H
76
77# ifndef _RWSTD_NO_WCTYPE_H
78# define _RWSTD_CWCTYPE <cwctype>
79# else
80# define _RWSTD_CWCTYPE <rw/_defs.h>
81# endif // _RWSTD_NO_WCTYPE_H
82
83#else // if defined (_RWSTD_NO_NEW_HEADER)
84
85# define _RWSTD_CASSERT "assert.h"
86# define _RWSTD_CCTYPE <ctype.h>
87# define _RWSTD_CERRNO "errno.h"
88# define _RWSTD_CFLOAT <float.h>
89# define _RWSTD_CISO646 <iso646.h>
90# define _RWSTD_CLIMITS <limits.h>
91# define _RWSTD_CLOCALE <locale.h>
92# define _RWSTD_CMATH <math.h>
93# define _RWSTD_CSETJMP "setjmp.h"
94# define _RWSTD_CSIGNAL <signal.h>
95# define _RWSTD_CSTDARG <stdarg.h>
96# define _RWSTD_CSTDDEF <stddef.h>
97# define _RWSTD_CSTDIO <stdio.h>
98# define _RWSTD_CSTDLIB <stdlib.h>
99# define _RWSTD_CSTRING <string.h>
100# define _RWSTD_CTIME <time.h>
101
102# ifndef _RWSTD_NO_WCHAR_H
103# define _RWSTD_CWCHAR <wchar.h>
104# else
105# define _RWSTD_CWCHAR <rw/_defs.h>
106# endif // _RWSTD_NO_WCHAR_H
107
108# ifndef _RWSTD_NO_WCTYPE_H
109# define _RWSTD_CWCTYPE <wctype.h>
110# else
111# define _RWSTD_CWCTYPE <rw/_defs.h>
112# endif // _RWSTD_NO_WCTYPE_H
113
114#endif // _RWSTD_NO_NEW_HEADER
115
116
117#if defined(_WIN64)
118# define _RWSTD_SYS_TYPES_H <basetsd.h>
119#elif defined(_WIN32)
120# define _RWSTD_SYS_TYPES_H <rw/_defs.h>
121#else
122# define _RWSTD_SYS_TYPES_H <sys/types.h>
123#endif // _WIN32
124
125// provide default #definitions of ANSI C library headers
126#if defined (_M_IA64)
127 // IA64/Itanium SDK paths
128# if !defined (_RWSTD_NO_ASSERT_H) && !defined (_RWSTD_ANSI_C_ASSERT_H)
129 // pathname quoted in order to prevent the assert macro
130 // from expanding in the include directive
131# define _RWSTD_ANSI_C_ASSERT_H "../include/crt/assert.h"
132# endif
133# if !defined (_RWSTD_NO_CTYPE_H) && !defined (_RWSTD_ANSI_C_CTYPE_H)
134# define _RWSTD_ANSI_C_CTYPE_H <../include/crt/ctype.h>
135# endif
136# if !defined (_RWSTD_NO_ERRNO_H) && !defined (_RWSTD_ANSI_C_ERRNO_H)
137 // pathname quoted in order to prevent the errno macro
138 // from expanding in the include directive
139# define _RWSTD_ANSI_C_ERRNO_H "../include/crt/errno.h"
140# endif
141# if !defined (_RWSTD_NO_FLOAT_H) && !defined (_RWSTD_ANSI_C_FLOAT_H)
142# define _RWSTD_ANSI_C_FLOAT_H <../include/crt/float.h>
143# endif
144# if !defined (_RWSTD_NO_ISO646_H) && !defined (_RWSTD_ANSI_C_ISO646_H)
145# define _RWSTD_ANSI_C_ISO646_H <../include/crt/iso646.h>
146# endif // _RWSTD_NO_ASSERT_H && _RWSTD_ANSI_C_ASSERT_H
147
148# if !defined (_RWSTD_ANSI_C_LIMITS_H)
149# if !defined (_RWSTD_NO_LIMITS_H)
150# define _RWSTD_ANSI_C_LIMITS_H <../include/crt/limits.h>
151# else
152# define _RWSTD_ANSI_C_LIMITS_H <rw/_defs.h>
153# endif
154# endif // _RWSTD_ANSI_C_LIMITS_H
155
156# if !defined (_RWSTD_NO_LOCALE_H) && !defined (_RWSTD_ANSI_C_LOCALE_H)
157# define _RWSTD_ANSI_C_LOCALE_H <../include/crt/locale.h>
158# endif
159# if !defined (_RWSTD_NO_MATH_H) && !defined (_RWSTD_ANSI_C_MATH_H)
160# define _RWSTD_ANSI_C_MATH_H <../include/crt/math.h>
161# endif
162# if !defined (_RWSTD_NO_SETJMP_H) && !defined (_RWSTD_ANSI_C_SETJMP_H)
163 // pathname quoted in order to prevent the setjmp macro
164 // from expanding in the include directive
165# define _RWSTD_ANSI_C_SETJMP_H "../include/crt/setjmp.h"
166# endif
167# if !defined (_RWSTD_NO_SIGNAL_H) && !defined (_RWSTD_ANSI_C_SIGNAL_H)
168# define _RWSTD_ANSI_C_SIGNAL_H <../include/crt/signal.h>
169# endif
170# if !defined (_RWSTD_NO_STDARG_H) && !defined (_RWSTD_ANSI_C_STDARG_H)
171# define _RWSTD_ANSI_C_STDARG_H <../include/crt/stdarg.h>
172# endif
173# if !defined (_RWSTD_NO_STDDEF_H) && !defined (_RWSTD_ANSI_C_STDDEF_H)
174# define _RWSTD_ANSI_C_STDDEF_H <../include/crt/stddef.h>
175# endif
176# if !defined (_RWSTD_NO_STDIO_H) && !defined (_RWSTD_ANSI_C_STDIO_H)
177# define _RWSTD_ANSI_C_STDIO_H <../include/crt/stdio.h>
178# endif
179# if !defined (_RWSTD_NO_STDLIB_H) && !defined (_RWSTD_ANSI_C_STDLIB_H)
180# define _RWSTD_ANSI_C_STDLIB_H <../include/crt/stdlib.h>
181# endif
182# if !defined (_RWSTD_NO_STRING_H) && !defined (_RWSTD_ANSI_C_STRING_H)
183# define _RWSTD_ANSI_C_STRING_H <../include/crt/string.h>
184# endif
185# if !defined (_RWSTD_NO_TIME_H) && !defined (_RWSTD_ANSI_C_TIME_H)
186# define _RWSTD_ANSI_C_TIME_H <../include/crt/time.h>
187# endif
188# if !defined (_RWSTD_NO_WCHAR_H) && !defined (_RWSTD_ANSI_C_WCHAR_H)
189# define _RWSTD_ANSI_C_WCHAR_H <../include/crt/wchar.h>
190# endif
191
192# if !defined (_RWSTD_ANSI_C_WCTYPE_H)
193# if !defined (_RWSTD_NO_WCTYPE_H)
194# define _RWSTD_ANSI_C_WCTYPE_H <../include/crt/wctype.h>
195# else
196# define _RWSTD_ANSI_C_WCTYPE_H <rw/_defs.h>
197# endif
198# endif // _RWSTD_ANSI_C_WCTYPE_H
199
200#elif !defined (_RWSTD_NO_FORCE_RELATIVE_PATHS)
201
202# undef _RWSTD_ANSI_C_ASSERT_H
203 // pathname quoted in order to prevent the assert macro
204 // from expanding in the include directive
205# define _RWSTD_ANSI_C_ASSERT_H "../include/assert.h"
206# undef _RWSTD_ANSI_C_CTYPE_H
207# define _RWSTD_ANSI_C_CTYPE_H <../include/ctype.h>
208# undef _RWSTD_ANSI_C_ERRNO_H
209 // pathname quoted in order to prevent the errno macro
210 // from expanding in the include directive
211# define _RWSTD_ANSI_C_ERRNO_H "../include/errno.h"
212# undef _RWSTD_ANSI_C_FLOAT_H
213# define _RWSTD_ANSI_C_FLOAT_H <../include/float.h>
214# undef _RWSTD_ANSI_C_ISO646_H
215# define _RWSTD_ANSI_C_ISO646_H <../include/iso646.h>
216
217# undef _RWSTD_ANSI_C_LIMITS_H
218# ifndef _RWSTD_ANSI_C_LIMITS_H
219# define _RWSTD_ANSI_C_LIMITS_H <../include/limits.h>
220# else
221# define _RWSTD_ANSI_C_LIMITS_H <rw/_defs.h>
222# endif
223
224# undef _RWSTD_ANSI_C_LOCALE_H
225# define _RWSTD_ANSI_C_LOCALE_H <../include/locale.h>
226# undef _RWSTD_ANSI_C_MATH_H
227# define _RWSTD_ANSI_C_MATH_H <../include/math.h>
228# undef _RWSTD_ANSI_C_SETJMP_H
229 // pathname quoted in order to prevent the setjmp macro
230 // from expanding in the include directive
231# define _RWSTD_ANSI_C_SETJMP_H "../include/setjmp.h"
232# undef _RWSTD_ANSI_C_SIGNAL_H
233# define _RWSTD_ANSI_C_SIGNAL_H <../include/signal.h>
234# undef _RWSTD_ANSI_C_STDARG_H
235# define _RWSTD_ANSI_C_STDARG_H <../include/stdarg.h>
236# undef _RWSTD_ANSI_C_STDDEF_H
237# define _RWSTD_ANSI_C_STDDEF_H <../include/stddef.h>
238# undef _RWSTD_ANSI_C_STDIO_H
239# define _RWSTD_ANSI_C_STDIO_H <../include/stdio.h>
240# undef _RWSTD_ANSI_C_STDLIB_H
241# define _RWSTD_ANSI_C_STDLIB_H <../include/stdlib.h>
242# undef _RWSTD_ANSI_C_STRING_H
243# define _RWSTD_ANSI_C_STRING_H <../include/string.h>
244# undef _RWSTD_ANSI_C_TIME_H
245# define _RWSTD_ANSI_C_TIME_H <../include/time.h>
246
247# undef _RWSTD_ANSI_C_WCHAR_H
248# ifndef _RWSTD_NO_WCHAR_H
249# define _RWSTD_ANSI_C_WCHAR_H <../include/wchar.h>
250# else
251# define _RWSTD_ANSI_C_WCHAR_H <rw/_defs.h>
252# endif
253
254# undef _RWSTD_ANSI_C_WCTYPE_H
255# ifndef _RWSTD_NO_WCTYPE_H
256# define _RWSTD_ANSI_C_WCTYPE_H <../include/wctype.h>
257# else
258# define _RWSTD_ANSI_C_WCTYPE_H <rw/_defs.h>
259# endif
260
261#elif defined (_RWSTD_USE_USR_INCLUDE_HEADERS)
262
263# if !defined (_RWSTD_NO_ASSERT_H) && !defined (_RWSTD_ANSI_C_ASSERT_H)
264 // pathname quoted in order to prevent the assert macro
265 // from expanding in the include directive
266# define _RWSTD_ANSI_C_ASSERT_H "/usr/include/assert.h"
267# endif
268# if !defined (_RWSTD_NO_CTYPE_H) && !defined (_RWSTD_ANSI_C_CTYPE_H)
269# define _RWSTD_ANSI_C_CTYPE_H </usr/include/ctype.h>
270# endif
271# if !defined (_RWSTD_NO_ERRNO_H) && !defined (_RWSTD_ANSI_C_ERRNO_H)
272 // pathname quoted in order to prevent the errno macro
273 // from expanding in the include directive
274# define _RWSTD_ANSI_C_ERRNO_H "/usr/include/errno.h"
275# endif
276# if !defined (_RWSTD_NO_FLOAT_H) && !defined (_RWSTD_ANSI_C_FLOAT_H)
277# define _RWSTD_ANSI_C_FLOAT_H </usr/include/float.h>
278# endif
279# if !defined (_RWSTD_NO_ISO646_H) && !defined (_RWSTD_ANSI_C_ISO646_H)
280# define _RWSTD_ANSI_C_ISO646_H </usr/include/iso646.h>
281# endif // _RWSTD_NO_ASSERT_H && _RWSTD_ANSI_C_ASSERT_H
282
283# if !defined (_RWSTD_ANSI_C_LIMITS_H)
284# if !defined (_RWSTD_NO_LIMITS_H)
285# define _RWSTD_ANSI_C_LIMITS_H </usr/include/limits.h>
286# else
287# define _RWSTD_ANSI_C_LIMITS_H <rw/_defs.h>
288# endif
289# endif // _RWSTD_ANSI_C_LIMITS_H
290
291# if !defined (_RWSTD_NO_LOCALE_H) && !defined (_RWSTD_ANSI_C_LOCALE_H)
292# define _RWSTD_ANSI_C_LOCALE_H </usr/include/locale.h>
293# endif
294# if !defined (_RWSTD_NO_MATH_H) && !defined (_RWSTD_ANSI_C_MATH_H)
295# define _RWSTD_ANSI_C_MATH_H </usr/include/math.h>
296# endif
297# if !defined (_RWSTD_NO_SETJMP_H) && !defined (_RWSTD_ANSI_C_SETJMP_H)
298 // pathname quoted in order to prevent the setjmp macro
299 // from expanding in the include directive
300# define _RWSTD_ANSI_C_SETJMP_H "/usr/include/setjmp.h"
301# endif
302# if !defined (_RWSTD_NO_SIGNAL_H) && !defined (_RWSTD_ANSI_C_SIGNAL_H)
303# define _RWSTD_ANSI_C_SIGNAL_H </usr/include/signal.h>
304# endif
305# if !defined (_RWSTD_NO_STDARG_H) && !defined (_RWSTD_ANSI_C_STDARG_H)
306# define _RWSTD_ANSI_C_STDARG_H </usr/include/stdarg.h>
307# endif
308# if !defined (_RWSTD_NO_STDDEF_H) && !defined (_RWSTD_ANSI_C_STDDEF_H)
309# define _RWSTD_ANSI_C_STDDEF_H </usr/include/stddef.h>
310# endif
311# if !defined (_RWSTD_NO_STDIO_H) && !defined (_RWSTD_ANSI_C_STDIO_H)
312# define _RWSTD_ANSI_C_STDIO_H </usr/include/stdio.h>
313# endif
314# if !defined (_RWSTD_NO_STDLIB_H) && !defined (_RWSTD_ANSI_C_STDLIB_H)
315# define _RWSTD_ANSI_C_STDLIB_H </usr/include/stdlib.h>
316# endif
317# if !defined (_RWSTD_NO_STRING_H) && !defined (_RWSTD_ANSI_C_STRING_H)
318# define _RWSTD_ANSI_C_STRING_H </usr/include/string.h>
319# endif
320# if !defined (_RWSTD_NO_TIME_H) && !defined (_RWSTD_ANSI_C_TIME_H)
321# define _RWSTD_ANSI_C_TIME_H </usr/include/time.h>
322# endif
323# if !defined (_RWSTD_NO_WCHAR_H) && !defined (_RWSTD_ANSI_C_WCHAR_H)
324# define _RWSTD_ANSI_C_WCHAR_H </usr/include/wchar.h>
325# endif
326
327# if !defined (_RWSTD_ANSI_C_WCTYPE_H)
328# if !defined (_RWSTD_NO_WCTYPE_H)
329# define _RWSTD_ANSI_C_WCTYPE_H </usr/include/wctype.h>
330# else
331# define _RWSTD_ANSI_C_WCTYPE_H <rw/_defs.h>
332# endif
333# endif // _RWSTD_ANSI_C_WCTYPE_H
334
335#else // if !_WIN64 && !_RWSTD_USE_USR_INCLUDE_HEADERS
336
337# if !defined (_RWSTD_NO_ASSERT_H) && !defined (_RWSTD_ANSI_C_ASSERT_H)
338 // pathname quoted in order to prevent the assert macro
339 // from expanding in the include directive
340# define _RWSTD_ANSI_C_ASSERT_H "../include/assert.h"
341# endif
342# if !defined (_RWSTD_NO_CTYPE_H) && !defined (_RWSTD_ANSI_C_CTYPE_H)
343# define _RWSTD_ANSI_C_CTYPE_H <../include/ctype.h>
344# endif
345# if !defined (_RWSTD_NO_ERRNO_H) && !defined (_RWSTD_ANSI_C_ERRNO_H)
346 // pathname quoted in order to prevent the errno macro
347 // from expanding in the include directive
348# define _RWSTD_ANSI_C_ERRNO_H "../include/errno.h"
349# endif
350# if !defined (_RWSTD_NO_FLOAT_H) && !defined (_RWSTD_ANSI_C_FLOAT_H)
351# define _RWSTD_ANSI_C_FLOAT_H <../include/float.h>
352# endif
353# if !defined (_RWSTD_NO_ISO646_H) && !defined (_RWSTD_ANSI_C_ISO646_H)
354# define _RWSTD_ANSI_C_ISO646_H <../include/iso646.h>
355# endif // _RWSTD_NO_ASSERT_H && _RWSTD_ANSI_C_ASSERT_H
356
357# if !defined (_RWSTD_ANSI_C_LIMITS_H)
358# if !defined (_RWSTD_NO_LIMITS_H)
359# define _RWSTD_ANSI_C_LIMITS_H <../include/limits.h>
360# else
361# define _RWSTD_ANSI_C_LIMITS_H <rw/_defs.h>
362# endif
363# endif // _RWSTD_ANSI_C_LIMITS_H
364
365# if !defined (_RWSTD_NO_LOCALE_H) && !defined (_RWSTD_ANSI_C_LOCALE_H)
366# define _RWSTD_ANSI_C_LOCALE_H <../include/locale.h>
367# endif
368# if !defined (_RWSTD_NO_MATH_H) && !defined (_RWSTD_ANSI_C_MATH_H)
369# define _RWSTD_ANSI_C_MATH_H <../include/math.h>
370# endif
371# if !defined (_RWSTD_NO_SETJMP_H) && !defined (_RWSTD_ANSI_C_SETJMP_H)
372 // pathname quoted in order to prevent the setjmp macro
373 // from expanding in the include directive
374# define _RWSTD_ANSI_C_SETJMP_H "../include/setjmp.h"
375# endif
376# if !defined (_RWSTD_NO_SIGNAL_H) && !defined (_RWSTD_ANSI_C_SIGNAL_H)
377# define _RWSTD_ANSI_C_SIGNAL_H <../include/signal.h>
378# endif
379# if !defined (_RWSTD_NO_STDARG_H) && !defined (_RWSTD_ANSI_C_STDARG_H)
380# define _RWSTD_ANSI_C_STDARG_H <../include/stdarg.h>
381# endif
382# if !defined (_RWSTD_NO_STDDEF_H) && !defined (_RWSTD_ANSI_C_STDDEF_H)
383# define _RWSTD_ANSI_C_STDDEF_H <../include/stddef.h>
384# endif
385# if !defined (_RWSTD_NO_STDIO_H) && !defined (_RWSTD_ANSI_C_STDIO_H)
386# define _RWSTD_ANSI_C_STDIO_H <../include/stdio.h>
387# endif
388# if !defined (_RWSTD_NO_STDLIB_H) && !defined (_RWSTD_ANSI_C_STDLIB_H)
389# define _RWSTD_ANSI_C_STDLIB_H <../include/stdlib.h>
390# endif
391# if !defined (_RWSTD_NO_STRING_H) && !defined (_RWSTD_ANSI_C_STRING_H)
392# define _RWSTD_ANSI_C_STRING_H <../include/string.h>
393# endif
394# if !defined (_RWSTD_NO_TIME_H) && !defined (_RWSTD_ANSI_C_TIME_H)
395# define _RWSTD_ANSI_C_TIME_H <../include/time.h>
396# endif
397# if !defined (_RWSTD_NO_WCHAR_H) && !defined (_RWSTD_ANSI_C_WCHAR_H)
398# define _RWSTD_ANSI_C_WCHAR_H <../include/wchar.h>
399# endif
400
401# if !defined (_RWSTD_ANSI_C_WCTYPE_H)
402# if !defined (_RWSTD_NO_WCTYPE_H)
403# define _RWSTD_ANSI_C_WCTYPE_H <../include/wctype.h>
404# else
405# define _RWSTD_ANSI_C_WCTYPE_H <rw/_defs.h>
406# endif
407# endif // _RWSTD_ANSI_C_WCTYPE_H
408#endif // !_WIN64
409
410
411
412// These macros tune the speed vs. space optimization of container
413// performance with regard to allocation of memory. These have been tuned
414// with speed efficiency as a primary conern. Space efficiency was
415// considered, but was secondary. (refer to Onyx QA Entry #4920)
416//
417// The ratio parameter must be above one for an amortized constant time
418// algorithm. Lowering the ratio will lower rapidity and improve space
419// efficiency. This effect will be most noticeable when working with
420// containers of few elements (few being less than 32 for the general case)
421// If your use case is with containers that typically have many elements
422// lowering the ratio will have less effect on rapidity.
423//
424// The minimum elements parameter refers to minimum amount of additional
425// capacity requested (in number of elements) when more memory is needed.
426// Rapidity with containers of few elements will be affected most noticeably
427// as this amount this is lowered.
428//
429// For strings, the specializations on char and wchar_t were seen as an
430// exploitable common case, and have their own more specialized template
431// function overloads in the string header. These are tweakable here
432// with the STRING version of these macros.
433//
434#if !defined (_RWSTD_RATIO_DIVIDER)
435# define _RWSTD_RATIO_DIVIDER 1000U
436#endif
437
438#if !defined(_RWSTD_MINIMUM_NEW_CAPACITY)
439# define _RWSTD_MINIMUM_NEW_CAPACITY 32U
440#endif
441
442#if !defined(_RWSTD_NEW_CAPACITY_RATIO)
443 // using long doubles to eliminate bogus warnings on g++ 2.95.2/sparc
444 // (-W -O2/3 only): warning: overflow on truncation to integer
445# define _RWSTD_NEW_CAPACITY_RATIO 1618U
446#endif
447
448#if !defined(_RWSTD_MINIMUM_STRING_CAPACITY)
449# define _RWSTD_MINIMUM_STRING_CAPACITY 128U
450#endif
451
452#if !defined(_RWSTD_STRING_CAPACITY_RATIO)
453# define _RWSTD_STRING_CAPACITY_RATIO 1618U
454#endif
455
456#if !defined (_RWSTD_MINIMUM_STRINGBUF_CAPACITY)
457# define _RWSTD_MINIMUM_STRINGBUF_CAPACITY 512
458#endif // _RWSTD_MINIMUM_STRINGBUF_CAPACITY
459
460// working around an HP aCC bug (PR #25354 and 22610)
461#if !defined (__HP_aCC)
462# define _RWSTD_NEW_CAPACITY(ignore, what, from) \
463 _RW::__rw_new_capacity (from, what)
464#else
465# define _RWSTD_NEW_CAPACITY(T, what, from) \
466 _RW::__rw_new_capacity<T>(from, what)
467#endif // HP aCC
468
469// set up MSVC DLL export/import directives
470// _DLL - defined by the compiler when either -MD or -MDd is used
471// RWDLL - defined for all Rogue Wave(R) products built as shared libs
472// _RWSHARED - defined for libstd built/used as a shared lib
473#if defined (_MSC_VER) && (defined (RWDLL) || defined (_RWSHARED))
474
475# ifdef _RWSTD_LIB_SRC
476# define _RWSTD_EXPORT __declspec (dllexport)
477# else
478# define _RWSTD_EXPORT __declspec (dllimport)
479# endif // _RWSTD_LIB_SRC
480
481# define _RWSTD_CLASS_EXPORT _RWSTD_EXPORT
482# define _RWSTD_MEMBER_EXPORT /* empty */
483#else
484 // disable MSVC hacks
485# define _RWSTD_EXPORT /* empty */
486# define _RWSTD_CLASS_EXPORT /* empty */
487# define _RWSTD_MEMBER_EXPORT /* empty */
488#endif // _MSC_VER
489
490#ifdef _RWSTD_NO_BOOL
491# define bool int
492# define false 0
493# define true 1
494#endif // _RWSTD_NO_BOOL
495
496
497#ifndef _RWSTD_NO_EXPORT
498# define _EXPORT export
499#else
500# define _EXPORT /* empty */
501#endif
502
503
504#ifndef _RWSTD_NO_MUTABLE
505# define _MUTABLE mutable
506#else
507# define _MUTABLE /* empty */
508#endif
509
510
511//
512// Macro for forming or omitting default template arguments in constructors
513//
514
515#ifndef _RWSTD_NO_DEFAULT_TEMPLATE_ARGS
516# define _RWSTD_DEFAULT_ARG(n) = n
517#else
518# define _RWSTD_DEFAULT_ARG(n)
519#endif
520
521
522
523// Work around a bug in MSVC (see PR# 28547); used in basic_string
524#if !defined (_MSC_VER) || _MSC_VER < 1300
525# define _RWSTD_REDECLARED_DEFAULT(arg) = arg
526#else // if !(!defined (_MSC_VER) || (_MSC_VER < 1300))
527# define _RWSTD_REDECLARED_DEFAULT(ignore)
528#endif // !defined (_MSC_VER) || (_MSC_VER < 1300)
529
530
531// Macro for casting, using either the "old" method
532// or the new C++ cast system
533#ifndef _RWSTD_NO_STATIC_CAST
534# define _RWSTD_STATIC_CAST(T, x) static_cast< T >(x)
535# define _RWSTD_REINTERPRET_CAST(T, x) reinterpret_cast< T >(x)
536# define _RWSTD_CONST_CAST(T, x) const_cast< T >(x)
537#else // if defined (_RWSTD_NO_STATIC_CAST)
538# define _RWSTD_STATIC_CAST(T, x) ((T)x)
539# define _RWSTD_REINTERPRET_CAST(T, x) ((T)x)
540# define _RWSTD_CONST_CAST(T, x) ((T)x)
541#endif // _RWSTD_NO_STATIC_CAST
542
543#ifndef _RWSTD_NO_DYNAMIC_CAST
544# define _RWSTD_DYNAMIC_CAST(T, x) dynamic_cast< T >(x)
545#else // if defined (_RWSTD_NO_DYNAMIC_CAST)
546# define _RWSTD_DYNAMIC_CAST(T, x) ((T)x)
547#endif // _RWSTD_NO_DYNAMIC_CAST
548
549//
550// Macros for the new template specialization syntax
551//
552
553#ifdef _RWSTD_NO_NEW_FUNC_TEMPLATE_SYNTAX
554# define _RWSTD_SPECIALIZED_FUNCTION
555#else
556# define _RWSTD_SPECIALIZED_FUNCTION template<>
557#endif
558
559#ifdef _RWSTD_NO_NEW_CLASS_TEMPLATE_SYNTAX
560# define _RWSTD_SPECIALIZED_CLASS
561#else
562# define _RWSTD_SPECIALIZED_CLASS template<>
563#endif
564
565// for compilers or environments that do not support namespaces
566#ifndef _RWSTD_NO_NAMESPACE
567# define _RWSTD_NAMESPACE(name) namespace name
568# define _USING(name) using name
569
570# undef _STD
571# define _STD std
572# define _RW __rw
573
574#else // if defined (_RWSTD_NO_NAMESPACE)
575# define _RWSTD_NAMESPACE(ignore) extern "C++"
576# define _USING(ignore) typedef void __rw_unused_type
577
578# undef _STD
579# define _STD
580# define _RW
581#endif // _RWSTD_NO_NAMESPACE
582
583//
584// for compilers that don't like specialized friends
585// such as operator== in template classes
586//
587#ifdef _RWSTD_NO_SPECIALIZED_FRIEND
588# ifdef __TURBOC__
589# define _RWSTD_SPECIALIZED_FRIEND(name) (_STD::name)
590# else // if !defined (__TURBOC__)
591# define _RWSTD_SPECIALIZED_FRIEND(name) name
592# endif // __TURBOC__
593#else // if defined (_RWSTD_NO_SPECIALIZED_FRIEND)
594# ifdef __TURBOC__
595# define _RWSTD_SPECIALIZED_FRIEND(name) (_STD::name)
596# else // if !defined (__TURBOC__)
597 // the space between `name' and `<>' is necessary
598 // to prevent ..._FRIEND (operator<) from expanding into operator<<>
599 // (only the GNU preprocessor inserts a space)
600# define _RWSTD_SPECIALIZED_FRIEND(name) name <>
601# endif // __TURBOC__
602#endif // _RWSTD_NO_SPECIALIZED_FRIEND
603
604
605//
606// If compiler supports member and default templates then it supports
607// the _RWSTD_ALLOCATOR
608//
609#ifndef _RWSTD_NO_SIMPLE_DEFAULT_TEMPLATES
610# define _RWSTD_ALLOCATOR
611#endif
612
613
614#define _RWSTD_MB_CUR_MAX 16 // FIXME: must be determined dynamically
615
616// helper macros for token pasting
617#define _RWSTD_DO_PASTE(a, b) a ## b
618#define _RWSTD_PASTE(a, b) _RWSTD_DO_PASTE (a, b)
619
620#ifdef _RWSTD_REENTRANT
621// synchronizes access by all objects holding the same mutex
622# define _RWSTD_MT_GUARD(mutex) \
623 _RW::__rw_guard _RWSTD_PASTE (__guard, __LINE__) (mutex)
624
625// synchronizes access by all threads holding the same mutex
626# define _RWSTD_MT_STATIC_GUARD(type) \
627 typedef _RW::__rw_type<type,__LINE__> _UniqueType; \
628 _RWSTD_MT_CLASS_GUARD(_UniqueType)
629
630// synchronizes access by all objects of the same type
631# define _RWSTD_MT_CLASS_GUARD(type) \
632 _RWSTD_MT_GUARD (_RW::__rw_get_static_mutex ((type*)0))
633
634# define _RWSTD_ATOMIC_PREINCREMENT(x, mutex) \
635 _RW::__rw_atomic_preincrement (x, mutex)
636
637# define _RWSTD_ATOMIC_PREDECREMENT(x, mutex) \
638 _RW::__rw_atomic_predecrement (x, mutex)
639
640# define _RWSTD_ATOMIC_SWAP(x, y, mutex) \
641 _RW::__rw_atomic_exchange (x, y, mutex)
642
643# ifndef _RWSTD_NO_EXT_REENTRANT_IO
644// conditional swap used in iostreams
645# define _RWSTD_ATOMIC_IO_SWAP(x, y, mutex) \
646 ((this->flags () & _RWSTD_IOS_NOLOCK) ? \
647 _RW::__rw_ordinary_exchange (x, y) \
648 : _RW::__rw_atomic_exchange (x, y, mutex))
649
650# else // if defined (_RWSTD_NO_EXT_REENTRANT_IO)
651# define _RWSTD_ATOMIC_IO_SWAP(x, y, mutex) \
652 _RWSTD_ATOMIC_SWAP(x, y, mutex)
653# endif // _RWSTD_NO_EXT_REENTRANT_IO
654
655# if defined (_PA_RISC2_0)
656
657# define _RWSTD_STRING_ATOMIC_PREINCREMENT(x, mutex) \
658 _RW::__rw_string_atomic_preincrement (x, mutex)
659
660# define _RWSTD_STRING_ATOMIC_PREDECREMENT(x, mutex) \
661 _RW::__rw_string_atomic_predecrement (x, mutex)
662
663# define _RWSTD_STRING_ATOMIC_SWAP(x, y, mutex) \
664 _RW::__rw_string_atomic_exchange (x, y, mutex)
665
666# else // if !_PA_RISC2_0
667# define _RWSTD_STRING_ATOMIC_PREINCREMENT(x, mutex) \
668 _RWSTD_ATOMIC_PREINCREMENT (x, mutex)
669# define _RWSTD_STRING_ATOMIC_PREDECREMENT(x, mutex) \
670 _RWSTD_ATOMIC_PREDECREMENT (x, mutex)
671# define _RWSTD_STRING_ATOMIC_SWAP(x, y, mutex) \
672 _RWSTD_ATOMIC_SWAP (x, y, mutex)
673# endif // !_PA_RISC2_0
674
675 // thread-local storage
676# ifndef _RWSTD_NO_TLS
677# ifndef _RWSTD_THREAD
678 // if the macro isn't yet #defined (e.g., in _config.h)
679 // use the generally accepted (e.g., HP aCC, gcc, SunPro)
680 // __thread extension
681# define _RWSTD_THREAD __thread
682# endif // _RWSTD_THREAD
683
684# define _RWSTD_THREAD_PREINCREMENT(x, ignore) \
685 (++(x))
686# define _RWSTD_THREAD_PREDECREMENT(x, ignore) \
687 (--(x))
688# define _RWSTD_THREAD_SWAP(x, y, ignore) \
689 _RW::__rw_ordinary_exchange (x, y)
690
691# endif // _RWSTD_NO_TLS
692
693#else // if !defined _RWSTD_REENTRANT
694
695# define _RWSTD_MT_GUARD(ignore) ((void)0)
696# define _RWSTD_MT_STATIC_GUARD(name) _RWSTD_MT_GUARD (name)
697# define _RWSTD_MT_CLASS_GUARD(type) _RWSTD_MT_GUARD (type)
698
699# define _RWSTD_ATOMIC_PREINCREMENT(x, ignore) ++(x)
700# define _RWSTD_ATOMIC_PREDECREMENT(x, ignore) --(x)
701# define _RWSTD_ATOMIC_SWAP(x, y, ignore) \
702 _RW::__rw_atomic_exchange ((x), (y), false)
703
704# define _RWSTD_ATOMIC_IO_SWAP(x, y, ignore) \
705 _RW::__rw_ordinary_exchange ((x), (y))
706
707# define _RWSTD_STRING_ATOMIC_PREINCREMENT(x, mutex) \
708 _RWSTD_ATOMIC_PREINCREMENT(x, mutex)
709# define _RWSTD_STRING_ATOMIC_PREDECREMENT(x, mutex) \
710 _RWSTD_ATOMIC_PREDECREMENT(x, mutex)
711# define _RWSTD_STRING_ATOMIC_SWAP(x, y, mutex) \
712 _RWSTD_ATOMIC_SWAP(x, y, mutex)
713
714#endif // _RWSTD_REENTRANT
715
716// thread-local storage declaration
717#ifndef _RWSTD_THREAD
718# define _RWSTD_THREAD /* empty */
719#endif // _RWSTD_THREAD
720
721// thread-local storage manipulation
722#ifndef _RWSTD_THREAD_PREINCREMENT
723# define _RWSTD_THREAD_PREINCREMENT(x, mutex) \
724 _RWSTD_ATOMIC_PREINCREMENT (x, mutex)
725#endif // _RWSTD_THREAD_PREINCREMENT
726
727#ifndef _RWSTD_THREAD_PREDECREMENT
728# define _RWSTD_THREAD_PREDECREMENT(x, mutex) \
729 _RWSTD_ATOMIC_PREDECREMENT (x, mutex)
730#endif // _RWSTD_THREAD_PREDECREMENT
731
732#ifndef _RWSTD_THREAD_SWAP
733# define _RWSTD_THREAD_SWAP(x, y, ignore) \
734 _RWSTD_ATOMIC_SWAP (x, y, mutex)
735#endif // _RWSTD_THREAD_SWAP
736
737// macro for qualifying C library names in the std namespace
738#ifndef _RWSTD_NO_LIBC_IN_STD
739# ifndef _RWSTD_NO_NAMESPACE
740# define _RWSTD_C std
741# else
742# define _RWSTD_C /* empty */
743# endif // _RWSTD_NO_LIBC_IN_STD
744#else
745# define _RWSTD_C /* empty */
746#endif
747
748#define _RWSTD_INVALID_FILE_DESC -1
749#define _RWSTD_INVALID_FILE_PTR 0
750
751#ifndef _RWSTD_NO_NATIVE_IO
752# define _RWSTD_INVALID_FILE -1
753# define _RWSTD_INVALID_OPENMODE -1
754#else
755# define _RWSTD_INVALID_FILE (FILE*)0
756# define _RWSTD_INVALID_OPENMODE 0
757#endif // _RWSTD_NO_NATIVE_IO
758
759
760// std::streamoff and std::streamsize defined in <ios>
761#define _RWSTD_STREAMOFF _RWSTD_PTRDIFF_T
762#define _RWSTD_STREAMSIZE _RWSTD_PTRDIFF_T
763
764
765// std::ios_base static const data members' values
766#define _RWSTD_IOS_BOOLALPHA 0x00001
767#define _RWSTD_IOS_DEC 0x00002
768#define _RWSTD_IOS_FIXED 0x00004
769#define _RWSTD_IOS_HEX 0x00008
770#define _RWSTD_IOS_INTERNAL 0x00010
771#define _RWSTD_IOS_LEFT 0x00020
772#define _RWSTD_IOS_OCT 0x00040
773#define _RWSTD_IOS_RIGHT 0x00080
774#define _RWSTD_IOS_SCIENTIFIC 0x00100
775#define _RWSTD_IOS_SHOWBASE 0x00200
776#define _RWSTD_IOS_SHOWPOINT 0x00400
777#define _RWSTD_IOS_SHOWPOS 0x00800
778#define _RWSTD_IOS_SKIPWS 0x01000
779#define _RWSTD_IOS_UNITBUF 0x02000
780#define _RWSTD_IOS_UPPERCASE 0x04000
781#define _RWSTD_IOS_BIN 0x08000
782// NOLOCK[BUF] used rather than LOCK[BUF] to maintain functional compatibility
783// with release 2.2 (which was always safe when these bits were cleared)
784#define _RWSTD_IOS_NOLOCK 0x10000
785#define _RWSTD_IOS_NOLOCKBUF 0x20000
786// SYNC_STDIO is set for stream objects that may need to be synchronized
787// with stdio (by default the standard iostream objects such as cout)
788#define _RWSTD_IOS_SYNC_STDIO 0x40000
789
790#define _RWSTD_IOS_FLOATFIELD (_RWSTD_IOS_FIXED | _RWSTD_IOS_SCIENTIFIC)
791
792#define _RWSTD_IOS_ADJUSTFIELD \
793 (_RWSTD_IOS_LEFT | _RWSTD_IOS_RIGHT | _RWSTD_IOS_INTERNAL)
794
795#ifndef _RWSTD_NO_EXT_BIN_IO
796# define _RWSTD_IOS_BASEFIELD \
797 (_RWSTD_IOS_DEC | _RWSTD_IOS_HEX | _RWSTD_IOS_OCT | _RWSTD_IOS_BIN)
798#else
799# define _RWSTD_IOS_BASEFIELD \
800 (_RWSTD_IOS_DEC | _RWSTD_IOS_HEX | _RWSTD_IOS_OCT)
801#endif // _RWSTD_NO_EXT_BIN_IO
802
803// offset of most significant bits where numeric base is stored
804#define _RWSTD_IOS_BASEMASK 63
805#define _RWSTD_IOS_BASEOFF 26
806
807#define _RWSTD_IOS_GOODBIT 0x00
808#define _RWSTD_IOS_BADBIT 0x01
809#define _RWSTD_IOS_EOFBIT 0x02
810#define _RWSTD_IOS_FAILBIT 0x04
811#define _RWSTD_IOS_NOTHROW 0x08 // prevents clear() from throwing
812#define _RWSTD_IOS_RETHROW 0x10 // clear() rethrows if appropriate
813
814// ios_base::openmode constants
815#define _RWSTD_IOS_APP 0x01
816#define _RWSTD_IOS_BINARY 0x02
817#define _RWSTD_IOS_IN 0x04
818#define _RWSTD_IOS_OUT 0x08
819#define _RWSTD_IOS_TRUNC 0x10
820#define _RWSTD_IOS_ATE 0x20
821#define _RWSTD_IOS_NOCREATE 0x40 // filebuf extension
822#define _RWSTD_IOS_NOREPLACE 0x80 // filebuf extension
823#define _RWSTD_IOS_STDIO 0x100 // filebuf extension
824#define _RWSTD_IOS_NATIVE 0x200 // filebuf extension
825
826#define _RWSTD_IOS_OPENMODE_MASK \
827 ( _RWSTD_IOS_APP | _RWSTD_IOS_BINARY \
828 | _RWSTD_IOS_IN | _RWSTD_IOS_OUT \
829 | _RWSTD_IOS_TRUNC | _RWSTD_IOS_ATE \
830 | _RWSTD_IOS_NOCREATE | _RWSTD_IOS_NOREPLACE \
831 | _RWSTD_IOS_STDIO | _RWSTD_IOS_NATIVE)
832
833#if !defined (_RWSTD_NO_STATIC_IOSTREAM_INIT) \
834 && !defined (_RWSTD_NO_IOSTREAM_OBJECT_REFS)
835 // standard iostream objects are references
836# define _RWSTD_IOSTREAM_OBJECT(name) &name
837#else
838 // standard iostream objects are declared to be real objects
839 // they may be implemented as real objects of the same type
840 // that get destroyed during program lifetime or as objects
841 // of some POD type that do not get destroyed at all
842# define _RWSTD_IOSTREAM_OBJECT(name) name
843#endif // _RWSTD_NO_STATIC_IOSTREAM_INIT && !_RWSTD_NO_IOSTREAM_OBJECT_REFS
844
845
846// exceptions can be completely disabled (bodies of catch blocks are still
847// compiled but will be removed by the optimizing stage of the compiler)
848// this approach reveals any errors even if _RWSTD_NO_EXCEPTIONS is #defined
849#ifndef _RWSTD_NO_EXCEPTIONS
850# define _TRY try
851# define _CATCH(ex) catch (ex)
852# define _THROW(ex) throw ex
853# define _RETHROW throw
854#else // if defined (_RWSTD_NO_EXCEPTIONS)
855# define _TRY
856# define _CATCH(ignore) while (0)
857# define _THROW(ignore) ((void)0)
858# define _RETHROW ((void)0)
859#endif // _RWSTD_NO_EXCEPTIONS
860
861
862// for compilers that can't handle standard allocators we provide four
863// workarounds: _RWSTD_REBIND, used in place of _Allocator::rebind, allows
864// containers to use the same allocator for different data types
865// _RWSTD_ALLOC_TYPE is required to "rebind", or rather wrap, the user
866// supplied non-conforming allocator in allocator_interface so that the
867// container need not be aware of the allocator's special properties (namely
868// the fact that the allocator allocates in terms of bytes rather than
869// elemements)
870//
871// _RWSTD_VALUE_ALLOC creates a temporary allocator_interface wrapper
872// from the given parameter (usually *this) when allocating values in
873// the sequence containers with non-conforming allocators.
874// _RWSTD_VALUE_ALLOC_CAST casts the given container to a reference to
875// a value allocator, allowing access to inherited allocator members
876// outside of the class. For non-conforming compilers, this macro is
877// equivalent to _RWSTD_VALUE_ALLOC.
878//
879// NOTE: the spaces around type below are necessary to prevent errors
880// if `to' is a template-id and the preprocessor doesn't put
881// the spaces there automatically (GNU does, Sun does not)
882#ifdef _RWSTD_ALLOCATOR
883# ifndef _RWSTD_NO_DEPENDENT_TEMPLATE
884# define _RWSTD_REBIND(from, to) \
885 typename from::template rebind < to >::other
886# else
887# define _RWSTD_REBIND(from, to) \
888 typename from:: rebind < to >::other
889# endif // _RWSTD_NO_DEPENDENT_TEMPLATE
890
891# define _RWSTD_ALLOC_TYPE(Allocator, ignore) \
892 Allocator
893# define _RWSTD_VALUE_ALLOC(ignore, object, call) \
894 (object).allocator_type::call
895# define _RWSTD_VALUE_ALLOC_CAST(rvalue) \
896 _RWSTD_STATIC_CAST (allocator_type&, rvalue)
897#else // if !defined (_RWSTD_ALLOCATOR)
898# define _RWSTD_REBIND(from, to) \
899 _STD::allocator_interface < from, to >
900# define _RWSTD_ALLOC_TYPE(Allocator, T) \
901 _RWSTD_REBIND (Allocator, T)
902# define _RWSTD_VALUE_ALLOC(Allocator, object, call) \
903 Allocator (object).call
904# define _RWSTD_VALUE_ALLOC_CAST(rvalue) \
905 _C_value_alloc_type (rvalue)
906#endif // _RWSTD_ALLOCATOR
907
908
909// for compilers that can't deal with template functions parametrized
910// on the function's return type (as opposed to function arguments)
911//
912// NOTE: the spaces around type below are necessary to prevent errors
913// if `type' is a template-id and the preprocessor doesn't put
914// the spaces there automatically (GNU does, Sun does not)
915#ifndef _RWSTD_NO_TEMPLATE_ON_RETURN_TYPE
916
917# define _STD_HAS_FACET(type, arg) _STD::has_facet < type >(arg)
918# define _HAS_FACET(type, arg) has_facet < type >(arg)
919
920# define _STD_USE_FACET(type, arg) _STD::use_facet < type >(arg)
921# define _USE_FACET(type, arg) use_facet < type >(arg)
922
923# define _GET_TEMP_BUFFER(type, size) get_temporary_buffer < type >(size)
924#else // if defined (_RWSTD_NO_TEMPLATE_ON_RETURN_TYPE)
925
926# define _STD_HAS_FACET(type, arg) _STD::has_facet (arg, (type*)(0))
927# define _HAS_FACET(type, arg) has_facet (arg, (type*)(0))
928
929# define _STD_USE_FACET(type, arg) _STD::use_facet (arg, (type*)(0))
930# define _USE_FACET(type, arg) use_facet (arg, (type*)(0))
931
932# define _GET_TEMP_BUFFER(type, size) get_temporary_buffer (size, (type*)0)
933#endif // _RWSTD_NO_TEMPLATE_ON_RETURN_TYPE
934
935// working around g++ 2.95.2 -fno-honor-std inability to use std::use_facet
936#if defined (__GNUG__) && __GNUC__ <= 2 && __GNUC_MINOR__ < 97 \
937 && defined (_RWSTD_NO_HONOR_STD)
938 // use_facet is introduced into namespace _RW via a using declaration
939# undef _STD_HAS_FACET
940# define _STD_HAS_FACET(type, arg) _HAS_FACET (type, arg)
941
942# undef _STD_USE_FACET
943# define _STD_USE_FACET(type, arg) _USE_FACET (type, arg)
944#endif // // __GNUG__ >= 2.97 || !_RWSTD_NO_HONOR_STD
945
946// support for building the new locale (v.3)
947#ifndef _RWSTD_NO_TEMPLATE_ON_RETURN_TYPE
948# ifndef _RWSTD_NO_HONOR_STD
949# define _RWSTD_USE_FACET(type, arg) _STD::use_facet< type >(arg)
950# else
951# define _RWSTD_USE_FACET(type, arg) use_facet< type >(arg)
952# endif
953#else // if defined (_RWSTD_NO_TEMPLATE_ON_RETURN_TYPE)
954# ifndef _RWSTD_NO_HONOR_STD
955# define _RWSTD_USE_FACET(type, arg) _STD::use_facet(arg, (type*)(0))
956# else
957# define _RWSTD_USE_FACET(type, arg) use_facet(arg, (type*)(0))
958# endif
959#endif // _RWSTD_NO_TEMPLATE_ON_RETURN_TYPE
960
961
962#ifndef _RWSTD_NO_NONCLASS_ARROW_RETURN
963 // expected signature: "_TypeT* operator->()"
964 // and/or: "const _TypeT* operator->() const"
965# define _RWSTD_OPERATOR_ARROW(signature) signature { return &**this; }
966#else
967# define _RWSTD_OPERATOR_ARROW(ignore)
968#endif // _RWSTD_NO_NONCLASS_ARROW_RETURN
969
970
971// to prevent warnings about unused arguments
972#define _RWSTD_UNUSED(arg) ((void)&arg)
973
974
975// allows all externs to be declared/defined only in headers
976// and defined just by first #defining _RWSTD_DEFINE_EXTERNS
977// and then #including the header in a .cpp file
978#ifndef _RWSTD_DEFINE_EXTERNS
979# define _RWSTD_EXTERN(decl, ignore) extern decl
980#else
981# define _RWSTD_EXTERN(decl, value) extern decl = value
982#endif // _RWSTD_DEFINE_EXTERNS
983
984
985// allows static const integral or enum class members to be initialized
986// inside the class and defined (w/o being initialized) outside
987// of the class (as required by 9.4.2, p4)
988#ifndef _RWSTD_NO_STATIC_CONST_MEMBER_INIT
989# define _RWSTD_STATIC_CONST(type, init) static const type init
990# ifndef _RWSTD_NO_STATIC_CONST_MEMBER_DEFINITION
991# define _RWSTD_DEFINE_STATIC_CONST(decl) decl
992# else // if defined (_RWSTD_NO_STATIC_CONST_MEMBER_DEFINITION)
993 // disable defintion of static const integral members
994 // to work around compiler bugs such as those in MSVC
995 // or Intel C++/Windows that cause multiple definition
996 // linker errors (see PR #26562 and #30260)
997# define _RWSTD_DEFINE_STATIC_CONST(ignore) /* empty */
998# endif // _RWSTD_NO_STATIC_CONST_MEMBER_DEFINITION
999#else // if defined (_RWSTD_NO_STATIC_CONST_MEMBER_INIT)
1000# define _RWSTD_STATIC_CONST(ignore, init) enum { init }
1001# define _RWSTD_DEFINE_STATIC_CONST(ignore) /* empty */
1002#endif // _RWSTD_NO_STATIC_CONST_MEMBER_INIT
1003
1004#ifndef _RWSTD_NO_STATICS_IN_TEMPLATE
1005# define _RWSTD_INTERNAL static
1006#else // if defined (_RWSTD_NO_STATICS_IN_TEMPLATE)
1007 // symbols declared static cannot be referenced from
1008 // template (e.g., SunPro 5.3 -- see PR #25961)
1009# define _RWSTD_INTERNAL /* static */
1010#endif // _RWSTD_NO_STATICS_IN_TEMPLATE
1011
1012
1013// Selection of vendor dependent "format" string argument to wcsftime()
1014#ifndef _RWSTD_NO_WCSFTIME
1015 // 7.24.5.1 of C99 - wcsftime()'s 3rd arg is const wchar* [restrict]
1016 // HP-UX 11 (and perhaps others) still uses const char*
1017# ifndef _RWSTD_NO_WCSFTIME_WCHAR_T_FMAT
1018# define _RWSTD_FMT_TYPE(arg) const wchar_t* arg
1019# define _RWSTD_FMT_ASSGN(str) L##str
1020# else
1021# define _RWSTD_FMT_TYPE(arg) const char* arg
1022# define _RWSTD_FMT_ASSGN(str) str
1023# endif
1024#else // if defined (_RWSTD_NO_WCSFTIME)
1025# define _RWSTD_FMT_TYPE(arg) const char* arg
1026# define _RWSTD_FMT_ASSGN(str) str
1027#endif // _RWSTD_NO_WCSFTIME
1028
1029
1030// _Iterator typedefs
1031// (note that you must use a semi-colon at the end of this macro)
1032#define _RWSTD_ITERATOR_TYPES(_Iterator) \
1033 typedef typename _Iterator::difference_type difference_type; \
1034 typedef typename _Iterator::value_type value_type; \
1035 typedef typename _Iterator::pointer pointer; \
1036 typedef typename _Iterator::reference reference; \
1037 typedef typename _Iterator::iterator_category iterator_category
1038
1039// helpers making working w/o iterator_traits transparent
1040#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
1041
1042# define _RWSTD_VALUE_TYPE(iterT) \
1043 (typename _STD::iterator_traits< iterT >::value_type*)0
1044# define _RWSTD_DIFFERENCE_TYPE(iterT) \
1045 (typename _STD::iterator_traits< iterT >::difference_type*)0
1046
1047# if defined (SNI) || defined (__SUNPRO_CC) && __SUNPRO_CC <= 0x530
1048 // hacking around the inability of Siemens CDS++ and SunPro 5.3
1049 // to use the ctor syntax for type-dependent nested type names
1050# define _RWSTD_ITERATOR_CATEGORY(iterT, ignore) \
1051 (const typename _STD::iterator_traits< iterT >::iterator_category&) \
1052 (_STD::forward_iterator_tag ())
1053
1054# else
1055# define _RWSTD_ITERATOR_CATEGORY(iterT, ignore) \
1056 typename _STD::iterator_traits< iterT >::iterator_category ()
1057# endif
1058
1059# define _RWSTD_REVERSE_ITERATOR(iterT, ign1, ign2, ign3) \
1060 _STD::reverse_iterator<iterT>
1061
1062#else // if defined (_RWSTD_NO_CLASS_PARTIAL_SPEC)
1063
1064# define _RWSTD_VALUE_TYPE(iterT) __value_type ((iterT*)0)
1065 // assume default ctor is defined and accessible
1066# define _RWSTD_DIFFERENCE_TYPE(iterT) \
1067 _STD::__distance_type (iterT ())
1068 // macro cannot use the default ctor to construct a temporary
1069 // with the type of the first argument since the default ctor
1070 // may not exist or be accessible (e.g., istream_iterator<>)
1071# define _RWSTD_ITERATOR_CATEGORY(ignore, iter) \
1072 _STD::__iterator_category (iter)
1073
1074# define _RWSTD_REVERSE_ITERATOR(iterT, Ref, Ptr, Tag) \
1075 _STD::reverse_iterator<iterT, _STD::Tag, value_type, \
1076 Ref, Ptr, difference_type>
1077
1078#endif // _RWSTD_NO_CLASS_PARTIAL_SPEC
1079
1080// Use -D_RWSTDDEBUG to compile a version of the libraries to debug
1081// user code. This will perform pre- and post-condition checks but
1082// will produce larger code and run more slowly. This option affects
1083// the binary compatibility of generated code.
1084
1085#if defined (_RWSTDDEBUG)
1086# ifndef _RWSTD_NO_PRETTY_FUNCTION
1087 // gcc, HP aCC, and Intel C++ all support __PRETTY_FUNCTION__
1088# define _RWSTD_ASSERT(expr) \
1089 ((expr) ? (void)0 : _RW::__rw_assert_fail (#expr, __FILE__, __LINE__, \
1090 __PRETTY_FUNCTION__))
1091# elif !defined (_RWSTD_NO_FUNC)
1092 // C99 specifies the __func__ special identifier
1093# define _RWSTD_ASSERT(expr) \
1094 ((expr) ? (void)0 : _RW::__rw_assert_fail (#expr, __FILE__, __LINE__, \
1095 __func__))
1096# elif defined (__FUNCSIG__)
1097 // MSVC macro
1098# define _RWSTD_ASSERT(expr) \
1099 ((expr) ? (void)0 : _RW::__rw_assert_fail (#expr, __FILE__, __LINE__, \
1100 __FUNCSIG__))
1101# else // if _RWSTD_NO_PRETTY_FUNCTION && _RWSTD_NO_FUNC
1102# define _RWSTD_ASSERT(expr) \
1103 ((expr) ? (void)0 : _RW::__rw_assert_fail (#expr, __FILE__, __LINE__, 0))
1104# endif
1105#elif defined (_RWSTD_ASSUME)
1106# define _RWSTD_ASSERT(expr) _RWSTD_ASSUME (expr)
1107#else // if !defined (_RWSTDDEBUG)
1108# define _RWSTD_ASSERT(ignore) ((void)0)
1109#endif // _RWSTDDEBUG
1110
1111#ifndef _RWSTD_ASSUME
1112 // must be #defined after _RWSTD_ASSERT
1113# define _RWSTD_ASSUME(expr) _RWSTD_ASSERT (expr)
1114#endif // _RWSTD_ASSUME
1115
1116#define _RWSTD_STR(x) #x
1117#define _RWSTD_STRSTR(x) _RWSTD_STR(x)
1118
1119#ifndef _RWSTD_NO_PRETTY_FUNCTION
1120# define _RWSTD_FUNC(ignore) _RWSTD_FILE_LINE, __PRETTY_FUNCTION__
1121#elif !defined (_RWSTD_NO_FUNC)
1122# define _RWSTD_FUNC(ignore) _RWSTD_FILE_LINE, __func__
1123#elif defined (__FUNCSIG__)
1124# define _RWSTD_FUNC(ignore) _RWSTD_FILE_LINE, __FUNCSIG__
1125#else
1126# define _RWSTD_FUNC(name) _RWSTD_FILE_LINE, name
1127#endif
1128
1129#define _RWSTD_FILE_LINE __FILE__ ":" _RWSTD_STRSTR (__LINE__)
1130
1131#if !defined (__DECCXX_VER) || __DECCXX_VER > 60290024
1132# define _RWSTD_REQUIRES(pred, args) (pred) ? (void)0 : _RW::__rw_throw args
1133#else
1134 // working around a DEC cxx bug
1135# define _RWSTD_REQUIRES(pred, args) if (pred) ; else _RW::__rw_throw args
1136#endif
1137
1138
1139// function exception specification
1140#if !defined (_RWSTD_NO_EXCEPTIONS) \
1141 && !defined (_RWSTD_NO_EXCEPTION_SPECIFICATION)
1142 // type_id_list is a possibly empty parenthesized list
1143 //of comma-separated type-id's
1144# define _THROWS(type_id_list) throw type_id_list
1145#else // if _RWSTD_NO_EXCEPTIONS || _RWSTD_NO_EXCEPTION_SPECIFICATION
1146# define _THROWS(ignore) /* empty */
1147#endif // !_RWSTD_NO_EXCEPTIONS && !_RWSTD_NO_EXCEPTION_SPECIFICATION
1148
1149
1150// function exception specification on extern "C" libc functions
1151#ifndef _RWSTD_NO_LIBC_EXCEPTION_SPEC
1152# define _LIBC_THROWS(/* empty */) throw ()
1153#else
1154# define _LIBC_THROWS(/* empty */) /* empty */
1155#endif // _RWSTD_NO_LIBC_EXCEPTION_SPEC
1156
1157
1158// function exception specification on operator new
1159#ifndef _RWSTD_NO_EXCEPTION_SPECIFICATION_ON_NEW
1160# define _NEW_THROWS(args) _THROWS (args)
1161#else
1162# define _NEW_THROWS(ignore) /* empty */
1163#endif // _RWSTD_NO_EXCEPTION_SPECIFICATION_ON_NEW
1164
1165
1166#ifndef _RWSTD_ATTRIBUTE_NORETURN
1167 // gcc (and others) __attribute__ ((noreturn))
1168# define _RWSTD_ATTRIBUTE_NORETURN /* empty */
1169#endif // _RWSTD_ATTR_NORETURN
1170
1171
1172#ifdef _RWSTD_ATTRIBUTE_NOTHROW
1173 // gcc (and others) __attribute__ ((nothrow))
1174# define _RWSTD_DECLARE_NOTHROW _RWSTD_ATTRIBUTE_NOTHROW
1175 // attributes cannot appear on function definitions
1176# define _RWSTD_DEFINE_NOTHROW /* empty */
1177#else
1178 // make the macro usable even when it doesn't do anything
1179# define _RWSTD_ATTRIBUTE_NOTHROW /* empty */
1180 // emulate using empty exception specifications which must
1181 // be specified for both declarations and definitions
1182# define _RWSTD_DECLARE_NOTHROW _THROWS(())
1183# define _RWSTD_DEFINE_NOTHROW _THROWS(())
1184#endif // _RWSTD_ATTR_NORETURN
1185
1186
1187// compile-time assertion - asserts constant expressions during
1188// compilation with no runtime overhead; failed assertions are reported
1189// as compilation errors
1190
1192
1193// file may be #included from within an extern "C" block
1194extern "C++" {
1195
1196template <bool __b>
1197struct __rw_compile_assert;
1198
1200struct __rw_compile_assert<true> { enum { _C_ok }; };
1201
1202#define _RWSTD_COMPILE_ASSERT(const_expr) \
1203 ((void)_RW::__rw_compile_assert<(const_expr)>::_C_ok)
1204
1205// called for failed assertions
1206void _RWSTD_EXPORT
1207__rw_assert_fail (const char*, const char*, int, const char*)
1209
1210
1211
1212#ifdef __SUNPRO_CC
1213 // help Sun C++ optimizer generate better code
1214# pragma does_not_return (__rw_assert_fail)
1215#endif // __SUNPRO_CC
1216
1217} // extern "C++"
1218
1219} // namespace __rw
1220
1221
1222// for convenience
1223#if !defined (_RWSTD_NO_CLASS_PARTIAL_SPEC) \
1224 && (!defined (__SUNPRO_CC) || __SUNPRO_CC > 0x540)
1225# define _DISTANCE(first, last, ignore) _STD::distance (first, last)
1226#else
1227// working around a SunPro 5.{3,4} bug (see PR #25958)
1228# define _DISTANCE(first, last, type) _RW::__rw_distance (first, last, type())
1229#endif // _RWSTD_NO_CLASS_PARTIAL_SPEC
1230
1231
1232// enable only in debug mode and only id partial class specialization
1233// is supported; prevent multiple definition of _RWSTD_NO_DEBUG_ITER
1234#if defined(_RWSTDDEBUG) && !defined (_RWSTD_NO_CLASS_PARTIAL_SPEC) \
1235 && !defined (_RWSTD_NO_DEBUG_ITER) && !defined (SNI)
1236# define _RWSTD_ASSERT_RANGE(first, last) \
1237 _RWSTD_ASSERT (_RW::__rw_valid_range (first, last))
1238# define _RWSTD_ASSERT_IN_RANGE(it, first, last) \
1239 _RWSTD_ASSERT (_RW::__rw_in_range (it, first, last))
1240# define _RWSTD_ASSERT_DEREF(it) \
1241 _RWSTD_ASSERT (_RW::__rw_dereferenceable (it))
1242#else
1243# ifndef _RWSTD_NO_DEBUG_ITER
1244# define _RWSTD_NO_DEBUG_ITER
1245# endif // _RWSTD_NO_DEBUG_ITER
1246
1247# define _RWSTD_ASSERT_RANGE(ign1, ign2) ((void)0)
1248# define _RWSTD_ASSERT_IN_RANGE(ign1, ign2, ign3) ((void)0)
1249# define _RWSTD_ASSERT_DEREF(ignore) ((void)0)
1250#endif // _RWSTDDEBUG && _RWSTD_NO_CLASS_PARTIAL_SPEC
1251
1252
1253// convenience macro to get the "real" iterator embedded in __rw_debug_iter<>
1254#ifndef _RWSTD_NO_DEBUG_ITER
1255# define _ITER_BASE(it) ((it).base ())
1256#else // if defined (_RWSTD_NO_DEBUG_ITER)
1257# define _ITER_BASE(it) (it)
1258#endif // _RWSTD_NO_DEBUG_ITER
1259
1260
1261// will use the deduced native type rather than the typedef to prevent
1262// conflicts caused by inconsistent definition of wint_t (gcc 2.95.2/AIX)
1263#ifndef _RWSTD_WINT_T
1264 // hardcode if wint_t is not available in <wchar.h>
1265 // used by std::traits and std::basic_[i|o]stream
1266# define _RWSTD_WINT_T int
1267#endif // _RWSTD_WINT_T
1268
1269
1270// used by std::traits and std::basic_[i|o]stream,
1271// required to be int by 21.1.3.1, p2
1272#define _RWSTD_INT_T int
1273
1274
1275// ssize_t is defined by POSIX.1
1276#ifndef _RWSTD_SSIZE_T
1277# ifdef _WIN64
1278# define _RWSTD_SSIZE_T SSIZE_T
1279# else
1280# define _RWSTD_SSIZE_T long
1281# endif
1282#endif // _RWSTD_SSIZE_T
1283
1284// _RWSTD_UWCHAR_INT_T is "unsigned wchar_t"
1285#ifndef _RWSTD_UWCHAR_INT_T
1286# if _RWSTD_CHAR_SIZE == _RWSTD_WCHAR_SIZE
1287# define _RWSTD_UWCHAR_INT_T unsigned char
1288# elif _RWSTD_SHRT_SIZE == _RWSTD_WCHAR_SIZE
1289# define _RWSTD_UWCHAR_INT_T unsigned short
1290# elif _RWSTD_INT_SIZE == _RWSTD_WCHAR_SIZE
1291# define _RWSTD_UWCHAR_INT_T unsigned int
1292# else
1293# define _RWSTD_UWCHAR_INT_T _RWSTD_SIZE_T
1294# endif
1295#endif // _RWSTD_UWCHAR_INT_T
1296
1297
1298#if defined(SNI)
1299# define _RWSTD_USING_SNI(name) _USING(__SNI::name)
1300# if defined(_RWSTD_STRICT_ANSI)
1301# define fileno(p) (int) ((p)->_file)
1302# endif
1303#else
1304# define _RWSTD_USING_SNI(ignore) typedef void __rw_unused_type
1305#endif
1306
1307
1308#ifndef _RWSTD_TMPBUF_SIZE
1309# define _RWSTD_TMPBUF_SIZE 4096
1310#endif
1311
1312#ifndef _RWSTD_NO_STRTOLL
1313# define _STRTOLL strtoll
1314#else
1315 // libc has no strtoll, use strtol instead
1316# define _STRTOLL (_RWSTD_LONG_LONG)strtol
1317#endif // _RWSTD_NO_STRTOLL
1318
1319
1320#ifndef _RWSTD_NO_STRTOULL
1321# define _STRTOULL strtoull
1322#else
1323 // libc has no strtoull, use strtoul instead
1324# define _STRTOULL (unsigned _RWSTD_LONG_LONG)strtoul
1325#endif // _RWSTD_NO_STRTOULL
1326
1327
1328#ifdef _RWSTD_LIB_SRC
1329# define _RWSTD_TI_EXPORT /* empty */
1330#else // #ifndef _RWSTD_LIB_SRC
1331# define _RWSTD_TI_EXPORT _RWSTD_EXPORT
1332#endif // _RWSTD_LIB_SRC
1333
1334
1335#if defined (_RWSTD_INSTANTIATE_TEMPLATES) \
1336 && !defined (_RWSTD_NO_EXPLICIT_INSTANTIATION) \
1337 && !defined (_RWSTD_NO_INSTANTIATE)
1338
1339# define _RWSTD_INSTANTIATE(name, type) \
1340 ( _RWSTD_INSTANTIATE ## name \
1341 && _RWSTD_INSTANTIATE ## type \
1342 && !_RWSTD_NO ## type)
1343
1344# define _RWSTD_INSTANTIATE_1(arg) template arg
1345# define _RWSTD_INSTANTIATE_2(a1, a2) template a1, a2
1346# define _RWSTD_INSTANTIATE_3(a1, a2, a3) template a1, a2, a3
1347
1348# undef _RWSTD_TI_EXPORT
1349# define _RWSTD_TI_EXPORT _RWSTD_EXPORT
1350
1351# ifdef _RWSTD_NO_FUNCTION_EXPLICIT_INSTANTIATION
1352 // replace explicit function template instantiations with
1353 // declarations of explicit function template specializations
1354# define _RWSTD_INSTANTIATE_FUN_1(ignore) \
1355 typedef void __rw_unused_type
1356# define _RWSTD_INSTANTIATE_FUN_2(ign1, ign2) \
1357 typedef void __rw_unused_type
1358# define _RWSTD_INSTANTIATE_FUN_3(ign1, ign2, ign3) \
1359 typedef void __rw_unused_type
1360# endif // _RWSTD_NO_FUNCTION_EXPLICIT_INSTANTIATION
1361#elif defined (_MSC_VER) \
1362 && !defined (_RWSTD_NO_EXPLICIT_INSTANTIATION) \
1363 && !defined (_RWSTD_NO_INSTANTIATE)
1364
1365# define _RWSTD_INSTANTIATE(ign1, type) (!_RWSTD_NO ## type)
1366# define _RWSTD_INSTANTIATE_1(arg) extern template arg
1367# define _RWSTD_INSTANTIATE_2(a1, a2) extern template a1, a2
1368# define _RWSTD_INSTANTIATE_3(a1, a2, a3) extern template a1, a2, a3
1369#elif !defined (_RWSTD_NO_EXTERN_TEMPLATE)
1370 // use the extern template extension to declare template
1371 // specializations that are explicitly instantiated in
1372 // source (.cpp) files
1373# define _RWSTD_INSTANTIATE(ign1, type) (!_RWSTD_NO ## type)
1374# define _RWSTD_INSTANTIATE_1(arg) extern template arg
1375# define _RWSTD_INSTANTIATE_2(a1, a2) extern template a1, a2
1376# define _RWSTD_INSTANTIATE_3(a1, a2, a3) extern template a1, a2, a3
1377
1378# ifndef _RWSTD_NO_FUNCTION_EXPLICIT_INSTANTIATION
1379# ifdef _RWSTD_NO_EXTERN_FUNCTION_TEMPLATE
1380 // explicit instantiation of function templates enabled
1381 // but extern template declarations of function template
1382 // instantiations are disabled, use declarations of
1383 // explicit function template specializations instead
1384# define _RWSTD_INSTANTIATE_FUN_1(arg) template<> arg
1385# define _RWSTD_INSTANTIATE_FUN_2(a1, a2) template<> a1, a2
1386# define _RWSTD_INSTANTIATE_FUN_3(a1, a2, a3) template<> a1, a2, a3
1387# endif // _RWSTD_NO_EXTERN_FUNCTION_TEMPLATE
1388# else // if defined (_RWSTD_NO_FUNCTION_EXPLICIT_INSTANTIATION)
1389 // function templates not explicitly instantiated
1390
1391 // FIXME: this probably won't work since both class template
1392 // and (non-member) function templates are defined in the same
1393 // implementation (.c or .cc) files
1394# define _RWSTD_INSTANTIATE_FUN_1(ignore) \
1395 typedef void __rw_unused_type
1396# define _RWSTD_INSTANTIATE_FUN_2(ign1, ign2) \
1397 typedef void __rw_unused_type
1398# define _RWSTD_INSTANTIATE_FUN_3(ign1, ign2, ign3) \
1399 typedef void __rw_unused_type
1400# endif // _RWSTD_NO_FUNCTION_EXPLICIT_INSTANTIATION
1401#else
1402# define _RWSTD_INSTANTIATE(ign1, ign2) 0
1403# define _RWSTD_INSTANTIATE_1(ignore) typedef void __rw_unused_type
1404# define _RWSTD_INSTANTIATE_2(ign1, ign2) typedef void __rw_unused_type
1405# define _RWSTD_INSTANTIATE_3(ign1, ign2, ign3) typedef void __rw_unused_type
1406#endif // _RWSTD_INSTANTIATE_TEMPLATES
1407
1408#ifndef _RWSTD_INSTANTIATE_FUN_1
1409 // default to the same definition as _RWSTD_INSTANTIATE_{1,2,3}
1410# define _RWSTD_INSTANTIATE_FUN_1(arg) _RWSTD_INSTANTIATE_1 (arg)
1411# define _RWSTD_INSTANTIATE_FUN_2(a1, a2) _RWSTD_INSTANTIATE_2 (a1, a2)
1412# define _RWSTD_INSTANTIATE_FUN_3(a1, a2, a3) _RWSTD_INSTANTIATE_3 (a1, a2, a3)
1413#endif // _RWSTD_INSTANTIATE_FUN_1
1414
1415
1416#ifndef _RWSTD_NO_STD_UNCAUGHT_EXCEPTION
1417 // function defined in namespace std in compiler support library
1418# define _UNCAUGHT_EXCEPTION() _STD::uncaught_exception()
1419#elif !defined (_RWSTD_NO_GLOBAL_UNCAUGHT_EXCEPTION)
1420 // function defined in global namespace in compiler support library
1421# define _UNCAUGHT_EXCEPTION() uncaught_exception()
1422#else // if NO_STD_UNCAUGHT_EXCEPTION && NO_GLOBAL_UNCAUGHT_EXCEPTION
1423 // function not defined in compiler support library
1424# define _UNCAUGHT_EXCEPTION() true
1425#endif // NO_STD_UNCAUGHT_EXCEPTION && NO_GLOBAL_UNCAUGHT_EXCEPTION
1426
1427
1428#ifdef _RWSTD_NO_EXTERN_TEMPLATE_BEFORE_DEFINITION
1429# ifndef _RWSTD_NO_EXPLICIT_INSTANTIATION_BEFORE_DEFINITION
1430# define _RWSTD_NO_EXPLICIT_INSTANTIATION_BEFORE_DEFINITION
1431# endif // _RWSTD_NO_EXPLICIT_INSTANTIATION_BEFORE_DEFINITION
1432#endif // _RWSTD_NO_EXTERN_TEMPLATE_BEFORE_DEFINITION
1433
1434
1435// allows for efficient compilation of the library sources without
1436// support for implicit inclusion: only specializations explicitly
1437// instantiated in the library are available
1438#if defined _RWSTD_NO_IMPLICIT_INCLUSION \
1439 && ( !defined (_RWSTD_NO_TEMPLATE_DEFINITIONS) \
1440 || defined (_RWSTD_NO_EXPLICIT_INSTANTIATION) \
1441 || defined (_RWSTD_NO_IMPLICIT_INSTANTIATION) \
1442 || defined (_RWSTD_NO_INSTANTIATE))
1443
1444# ifndef _RWSTD_LIB_SRC
1445 // this block is active when using (as opposed to compiling)
1446 // the library headers and sources
1447
1448# define _RWSTD_DEFINE_TEMPLATE(name) !_RWSTD_NO ## name ## _DEFINITION
1449 // when implicit inclusion is not enabled, determines whether extern
1450 // template declarations for the corresponding explicit instantiation
1451 // directives for library templates may appear lexically before their
1452 // complete definitions (i.e., before the .cc file that corresponds
1453 // to each header) has been #included
1454# ifndef _RWSTD_NO_EXPLICIT_INSTANTIATION_BEFORE_DEFINITION
1455 // note that the _FIRST() and _LAST() macros cannot be #defined
1456 // in terms of the generic macro above because the name argument
1457 // would end up getting expanded too early (i.e., before the
1458 // token concatenation)
1459# define _RWSTD_DEFINE_TEMPLATE_FIRST(ignore) 0
1460# define _RWSTD_DEFINE_TEMPLATE_LAST(name) \
1461 !_RWSTD_NO ## name ## _DEFINITION
1462# else
1463# define _RWSTD_DEFINE_TEMPLATE_FIRST(name) \
1464 !_RWSTD_NO ## name ## _DEFINITION
1465# define _RWSTD_DEFINE_TEMPLATE_LAST(ignore) 0
1466# endif
1467# elif !defined (_RWSTD_NO_EXPLICIT_INSTANTIATION) \
1468 && !defined (_RWSTD_NO_IMPLICIT_INSTANTIATION) \
1469 && !defined (_RWSTD_NO_EXPLICIT_INSTANTIATION_WITH_IMPLICIT_INCLUSION)
1470 // this block is active when compiling (as opposed to using)
1471 // the library headers and sources and implicit inclusion
1472 // is being emulated
1473
1474# define _RWSTD_DEFINE_TEMPLATE(name) _RWSTD_INSTANTIATE ## name
1475# ifndef _RWSTD_NO_EXPLICIT_INSTANTIATION_BEFORE_DEFINITION
1476# define _RWSTD_DEFINE_TEMPLATE_FIRST(ignore) 0
1477# define _RWSTD_DEFINE_TEMPLATE_LAST(name) _RWSTD_INSTANTIATE ## name
1478# else
1479# define _RWSTD_DEFINE_TEMPLATE_FIRST(name) _RWSTD_INSTANTIATE ## name
1480# define _RWSTD_DEFINE_TEMPLATE_LAST(ignore) 0
1481# endif // _RWSTD_NO_EXPLICIT_INSTANTIATION_BEFORE_DEFINITION
1482# else // if no explicit instantiation (or with implicit inclusion)
1483 // this block is active when compiling (as opposed to using)
1484 // the library headers and sources and implicit inclusion is
1485 // not being emulated
1486
1487# define _RWSTD_DEFINE_TEMPLATE(ignore) 1
1488# ifndef _RWSTD_NO_EXPLICIT_INSTANTIATION_BEFORE_DEFINITION
1489# define _RWSTD_DEFINE_TEMPLATE_FIRST(ignore) 0
1490# define _RWSTD_DEFINE_TEMPLATE_LAST(ignore) 1
1491# else // if defined (_RWSTD_NO_EXPLICIT_INSTANTIATION_BEFORE_DEFINITION)
1492# define _RWSTD_DEFINE_TEMPLATE_FIRST(ignore) 1
1493# define _RWSTD_DEFINE_TEMPLATE_LAST(ignore) 0
1494# endif // _RWSTD_NO_EXPLICIT_INSTANTIATION_BEFORE_DEFINITION
1495# endif // explicit instantiation (with implicit inclusion)
1496#else
1497# ifndef _RWSTD_NO_EXPLICIT_INSTANTIATION_WITH_IMPLICIT_INCLUSION
1498 // when implicit inclusion is enabled or being emulated,
1499 // prevent out-of line non-member template functions or
1500 // out-of-line member functions of class templates (i.e.,
1501 // those defined in .c and .cc files) from being #included
1502 // in translation units
1503# define _RWSTD_DEFINE_TEMPLATE(ignore) 0
1504# define _RWSTD_DEFINE_TEMPLATE_FIRST(ignore) 0
1505# define _RWSTD_DEFINE_TEMPLATE_LAST(ignore) 0
1506# else // if defined (NO_EXPLICIT_INSTANTIATION_WITH_IMPLICIT_INCLUSION)
1507# ifndef _RWSTD_LIB_SRC
1508# define _RWSTD_DEFINE_TEMPLATE(ignore) 0
1509# define _RWSTD_DEFINE_TEMPLATE_FIRST(ignore) 0
1510# define _RWSTD_DEFINE_TEMPLATE_LAST(ignore) 0
1511# else // if defined (_RWSTD_LIB_SRC)
1512# define _RWSTD_DEFINE_TEMPLATE(name) _RWSTD_INSTANTIATE ## name
1513# ifndef _RWSTD_NO_EXPLICIT_INSTANTIATION_BEFORE_DEFINITION
1514# define _RWSTD_DEFINE_TEMPLATE_FIRST(ignore) 0
1515# define _RWSTD_DEFINE_TEMPLATE_LAST(name) _RWSTD_INSTANTIATE ## name
1516# else
1517# define _RWSTD_DEFINE_TEMPLATE_FIRST(name) _RWSTD_INSTANTIATE ## name
1518# define _RWSTD_DEFINE_TEMPLATE_LAST(ignore) 0
1519# endif // _RWSTD_NO_EXPLICIT_INSTANTIATION_BEFORE_DEFINITION
1520# endif // _RWSTD_LIB_SRC
1521# endif // _RWSTD_NO_EXPLICIT_INSTANTIATION_WITH_IMPLICIT_INCLUSION
1522#endif
1523
1524
1525// define if neither wctrans() function declaration exists
1526// (temporary until a reliable wctrans_t test is put in place)
1527#if !defined (_RWSTD_NO_WCTRANS_T)
1528# if defined (_RWSTD_NO_WCTRANS) && defined (_RWSTD_NO_TOWCTRANS)
1529# define _RWSTD_NO_WCTRANS_T
1530# endif
1531#endif // _RWSTD_NO_WCTRANS_T
1532
1533
1534#ifndef _RWSTD_NO_SPECIALIZATION_ON_RETURN_TYPE
1535# define _RWSTD_DUMMY_ARG(ignore)
1536#else
1537# ifndef _RWSTD_NO_DUMMY_DEFAULT_ARG
1538 // use a dummy argument with a default value to simulate
1539 // the effect of a function template whose template argument
1540 // only appears in its return type (and not in the function
1541 // argument list)
1542# define _RWSTD_DUMMY_ARG(T) , T
1543# else // if defined (_RWSTD_NO_DUMMY_DEFAULT_ARG)
1544# define _RWSTD_DUMMY_ARG(ignore)
1545# endif // _RWSTD_NO_DUMMY_DEFAULT_ARG
1546#endif // _RWSTD_NO_SPECIALIZATION_ON_RETURN_TYPE
1547
1548// helpers to make referring to the iterators easier
1549#define _RWSTD_ISTREAMBUF_ITER(T) \
1550 _STD::istreambuf_iterator<T, _STD::char_traits<T > >
1551
1552#define _RWSTD_OSTREAMBUF_ITER(T) \
1553 _STD::ostreambuf_iterator<T, _STD::char_traits<T > >
1554
1555// introduce namespace std so that "using namespace std;" always works
1557} // namespace std
1558
1559
1560// each standard facet's static id member is explicitly instantiated
1561// (when extern template is available) or explicitly specialized
1562// (when member explicit specialization is implemented) for the char
1563// and wchar_t specializations to guarantee at most one definition
1564// of each in a program (in case the compiler doesn't provide such
1565// a guarantee; e.g., MSVC or VisualAge on AIX don't)
1566#ifdef _RWSTD_NO_EXTERN_TEMPLATE
1567# ifdef _RWSTD_NO_EXPLICIT_MEMBER_SPECIALIZATION
1568# ifndef _RWSTD_NO_SPECIALIZED_FACET_ID
1569# define _RWSTD_NO_SPECIALIZED_FACET_ID
1570# endif // _RWSTD_NO_SPECIALIZED_FACET_ID
1571# endif // _RWSTD_NO_EXPLICIT_MEMBER_SPECIALIZATION
1572#else // if !defined (_RWSTD_NO_EXTERN_TEMPLATE)
1573 // no need to explicitly specialize the members when extern
1574 // template is available since they are explicitly instantiated
1575 // in the library
1576# ifndef _RWSTD_NO_SPECIALIZED_FACET_ID
1577# define _RWSTD_NO_SPECIALIZED_FACET_ID
1578# endif // _RWSTD_NO_SPECIALIZED_FACET_ID
1579#endif // _RWSTD_NO_EXTERN_TEMPLATE
1580
1581
1582// configuration for container class templates and their member
1583// function templates
1584# define _RWSTD_ASSIGN_RANGE(first, last, tag) \
1585 _C_assign_range (first, last, tag)
1586# define _RWSTD_INSERT_RANGE(it, first, last, tag) \
1587 _C_insert_range (it, first, last, tag)
1588
1589
1590#if 2 < __GNUG__
1591 // use gcc builtin by default
1592# define _RWSTD_VA_COPY(va_dst, va_src) \
1593 __builtin_va_copy (va_dst, va_src)
1594#elif defined (va_copy) || !defined _RWSTD_NO_VA_COPY
1595 // either va_copy() is already #defined (because <stdarg.h>
1596 // is already #included), or it was detected at configuration
1597# define _RWSTD_VA_COPY(va_dst, va_src) \
1598 va_copy (va_dst, va_src)
1599#elif defined (_RWSTD_NO_VA_LIST_ARRAY)
1600 // va_list is not an array, use ordinary assignment to copy
1601# define _RWSTD_VA_COPY(va_dst, va_src) \
1602 va_dst = va_src
1603#else // if defined (_RWSTD_NO_VA_LIST_ARRAY)
1604 // va_list is an array, use memcpy()
1605# define _RWSTD_VA_COPY(va_dst, va_src) \
1606 memcpy (va_dst, va_src, sizeof (va_list))
1607#endif // _RWSTD_NO_VA_LIST_ARRAY
1608
1609
1610// disable aligned type traits if compiler support is not
1611// configured
1612#if !defined (_RWSTD_TT_ALIGN_OF) \
1613 || !defined (_RWSTD_TT_ALIGNED_POD) \
1614 || !defined (_RWSTD_TT_MAX_ALIGNMENT)
1615# ifndef _RWSTD_NO_ALIGN_TRAITS
1616# define _RWSTD_NO_ALIGN_TRAITS
1617# endif
1618#endif
1619
1620#endif // _RWSTD_RW_DEFS_H_INCLUDED
#define _RWSTD_EXPORT
Definition _defs.h:485
#define _RWSTD_NAMESPACE(name)
Definition _defs.h:567
#define _RWSTD_DECLARE_NOTHROW
Definition _defs.h:1182
#define _RWSTD_SPECIALIZED_CLASS
Definition _defs.h:562
#define _RWSTD_ATTRIBUTE_NORETURN
Definition _defs.h:1168
Definition json.h:5363
#define true
Definition stdbool.h:25