31#if 3 == __GNUG__ && 3 > __GNUC_MINOR__ \
32 || 3 == __GNUC_MINOR__ && 1 >__GNUC_PATCHLEVEL__
36# ifndef _RWSTD_NO_EXTERN_TEMPLATE
37# define _RWSTD_NO_EXTERN_TEMPLATE
46# define STDIN_FILENO 0
47# define STDOUT_FILENO 1
48# define STDERR_FILENO 2
77# pragma warning (disable: 4073)
79# pragma init_seg (lib)
90#ifndef _RWSTD_NO_STATIC_IOSTREAM_INIT
96# ifndef _RWSTD_NO_IOSTREAM_OBJECT_REFS
103#define _RWSTD_DEFINE_STREAM_OBJECT(buftype, stream, name, ign1, ign2) \
104 _RWSTD_NAMESPACE (__rw) { \
106 static _STD::stream::char_type __rw_##name##_databuf [512]; \
108 static __rw_aligned_buffer<_STD::buftype> __rw_##name##_buffer; \
110 static __rw_aligned_buffer<_STD::stream> __rw_indestructible_##name; \
112 _RWSTD_NAMESPACE (std) { \
114 _RWSTD_EXPORT stream &name \
115 = _RWSTD_REINTERPRET_CAST (stream&, _RW::__rw_indestructible_##name); \
117 typedef void __rw_unused_typedef
119#define _OBJECT(ignore, name) name
130#define _RWSTD_DEFINE_STREAM_OBJECT(buftype, stream, name, ign1, ign2) \
131 _RWSTD_NAMESPACE (__rw) { \
133 static _STD::stream::char_type __rw_##name##_databuf [512]; \
135 static __rw_aligned_buffer<_STD::buftype> __rw_##name##_buffer; \
137 _RWSTD_NAMESPACE (std) { \
139 _RWSTD_EXPORT _RW::__rw_aligned_buffer<stream> name; \
141 _RWSTD_NAMESPACE (__rw) { \
143 static __rw_aligned_buffer<_STD::stream>& \
144 __rw_indestructible_##name = _STD::name; \
146 typedef void __rw_unused_typedef
148#define _OBJECT(type, name) _RWSTD_REINTERPRET_CAST (type&, name)
153#define _INIT(buftype, stream, name, buf, f) \
156 new (&_RW::__rw_indestructible_##name) stream \
157 (new (&_RW::__rw_##name##_buffer) buftype \
158 (f, _RW::__rw_##name##_databuf, \
159 sizeof _RW::__rw_##name##_databuf / sizeof *_RW::__rw_##name##_databuf)) \
166#define _RWSTD_DEFINE_STREAM_OBJECT(buftype, stream, name, buf, f) \
167 _RWSTD_NAMESPACE (__rw) { \
169 static _STD::stream::char_type __rw_##name##_databuf [512]; \
171 static _STD::buftype __rw_##name##_buffer (f, \
172 __rw_##name##_databuf, \
173 sizeof __rw_##name##_databuf / sizeof *__rw_##name##_databuf); \
175 _RWSTD_NAMESPACE (std) { \
177 _RWSTD_EXPORT stream name (&_RW::__rw_##buf##_buffer); \
179 typedef void __rw_unused_typedef
181#define _INIT(ign1, stream, ign3, ign4, ign5) ((stream*)0)
192#ifndef _RWSTD_NO_WCHAR_T
210#ifdef _RWSTD_NO_STATIC_IOSTREAM_INIT
215ios_base::Init __rw_stream_initializer;
221extern const void* __rw_std_streams [];
225static int __rw_ios_initcnt ;
232ios_base::Init::Init ()
254 pcin->_C_usr = &_C_usr_data::_C_std_usr_data [0];
255 pcin->_C_usr->_C_tie = pcout;
258 pcerr->_C_fmtfl |= _RW::__rw_unitbuf;
260 pcin->_C_fmtfl |= _RW::__rw_sync_stdio;
261 pcout->_C_fmtfl |= _RW::__rw_sync_stdio;
262 pcerr->_C_fmtfl |= _RW::__rw_sync_stdio;
263 pclog->_C_fmtfl |= _RW::__rw_sync_stdio;
265#if defined (_RWSTD_REENTRANT) \
266 && !defined (_RWSTD_NO_EXT_REENTRANT_IO) \
267 && !defined (_RWSTD_NO_REENTRANT_IO_DEFAULT)
278#ifndef _RWSTD_NO_WCHAR_T
293 pwcin->_C_usr = &_C_usr_data::_C_std_usr_data [1];
294 pwcin->_C_usr->_C_tie = pwcout;
297 pwcerr->_C_fmtfl |= _RW::__rw_unitbuf;
299 pwcin->_C_fmtfl |= _RW::__rw_sync_stdio;
300 pwcout->_C_fmtfl |= _RW::__rw_sync_stdio;
301 pwcerr->_C_fmtfl |= _RW::__rw_sync_stdio;
302 pwclog->_C_fmtfl |= _RW::__rw_sync_stdio;
304# if defined (_RWSTD_REENTRANT) \
305 && !defined (_RWSTD_NO_EXT_REENTRANT_IO) \
306 && !defined (_RWSTD_NO_REENTRANT_IO_DEFAULT)
320ios_base::Init::~Init ()
333 const char fmt[] =
"exception during std::%s cleanup\n";
338 _OBJECT (ostream, cout).rdbuf ()->pubsetbuf (0, 0);
341 fprintf (
stderr, fmt,
"cout");
345 _OBJECT (ostream, cerr).rdbuf ()->pubsetbuf (0, 0);
348 fprintf (
stderr, fmt,
"cerr");
352 _OBJECT (ostream, clog).rdbuf ()->pubsetbuf (0, 0);
355 fprintf (
stderr, fmt,
"clog");
359#ifndef _RWSTD_NO_WCHAR_T
364 _OBJECT (wostream, wcout).rdbuf ()->pubsetbuf (0, 0);
367 fprintf (
stderr, fmt,
"wcout");
371 _OBJECT (wostream, wcerr).rdbuf ()->pubsetbuf (0, 0);
374 fprintf (
stderr, fmt,
"wcerr");
378 _OBJECT (wostream, wclog).rdbuf ()->pubsetbuf (0, 0);
381 fprintf (
stderr, fmt,
"wclog");
#define _RWSTD_ATOMIC_PREINCREMENT(x, ignore)
#define _RWSTD_STATIC_CAST(T, x)
#define _RWSTD_NAMESPACE(name)
#define _RWSTD_ATOMIC_PREDECREMENT(x, ignore)
#define _RWSTD_ASSERT(ignore)
#define _RWSTD_DEFINE_STREAM_OBJECT(buftype, stream, name, ign1, ign2)
#define _INIT(buftype, stream, name, buf, f)
#define _OBJECT(ignore, name)