diff options
Diffstat (limited to 'system/lib/libcxx/iostream.cpp')
-rw-r--r-- | system/lib/libcxx/iostream.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/system/lib/libcxx/iostream.cpp b/system/lib/libcxx/iostream.cpp index f5b959b4..7fc71df4 100644 --- a/system/lib/libcxx/iostream.cpp +++ b/system/lib/libcxx/iostream.cpp @@ -13,6 +13,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD +static mbstate_t state_types[6] = {}; + _ALIGNAS_TYPE (__stdinbuf<char> ) static char __cin [sizeof(__stdinbuf <char>)]; _ALIGNAS_TYPE (__stdoutbuf<char>) static char __cout[sizeof(__stdoutbuf<char>)]; _ALIGNAS_TYPE (__stdoutbuf<char>) static char __cerr[sizeof(__stdoutbuf<char>)]; @@ -33,17 +35,17 @@ ios_base::Init __start_std_streams; ios_base::Init::Init() { - istream* cin_ptr = ::new(cin) istream(::new(__cin) __stdinbuf <char>(stdin) ); - ostream* cout_ptr = ::new(cout) ostream(::new(__cout) __stdoutbuf<char>(stdout)); - ostream* cerr_ptr = ::new(cerr) ostream(::new(__cerr) __stdoutbuf<char>(stderr)); + istream* cin_ptr = ::new(cin) istream(::new(__cin) __stdinbuf <char>(stdin, state_types+0) ); + ostream* cout_ptr = ::new(cout) ostream(::new(__cout) __stdoutbuf<char>(stdout, state_types+1)); + ostream* cerr_ptr = ::new(cerr) ostream(::new(__cerr) __stdoutbuf<char>(stderr, state_types+2)); ::new(clog) ostream(cerr_ptr->rdbuf()); cin_ptr->tie(cout_ptr); _VSTD::unitbuf(*cerr_ptr); cerr_ptr->tie(cout_ptr); - wistream* wcin_ptr = ::new(wcin) wistream(::new(__wcin) __stdinbuf <wchar_t>(stdin) ); - wostream* wcout_ptr = ::new(wcout) wostream(::new(__wcout) __stdoutbuf<wchar_t>(stdout)); - wostream* wcerr_ptr = ::new(wcerr) wostream(::new(__wcerr) __stdoutbuf<wchar_t>(stderr)); + wistream* wcin_ptr = ::new(wcin) wistream(::new(__wcin) __stdinbuf <wchar_t>(stdin, state_types+3) ); + wostream* wcout_ptr = ::new(wcout) wostream(::new(__wcout) __stdoutbuf<wchar_t>(stdout, state_types+4)); + wostream* wcerr_ptr = ::new(wcerr) wostream(::new(__wcerr) __stdoutbuf<wchar_t>(stderr, state_types+5)); ::new(wclog) wostream(wcerr_ptr->rdbuf()); wcin_ptr->tie(wcout_ptr); _VSTD::unitbuf(*wcerr_ptr); |