diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-01-17 14:08:09 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-01-17 14:08:09 -0800 |
commit | 76ddb8091266741ae046d1b6fdeef4f782617d5b (patch) | |
tree | 21fc75bfcbdce916ab91b8a61d196ab059e082d3 /system/lib/libcxx/iostream.cpp | |
parent | 8a9fa2c6d739a53221ee717121c6f4d318abd3dd (diff) |
libc++ sources
Diffstat (limited to 'system/lib/libcxx/iostream.cpp')
-rw-r--r-- | system/lib/libcxx/iostream.cpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/system/lib/libcxx/iostream.cpp b/system/lib/libcxx/iostream.cpp new file mode 100644 index 00000000..157c3977 --- /dev/null +++ b/system/lib/libcxx/iostream.cpp @@ -0,0 +1,53 @@ +//===------------------------ iostream.cpp --------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "__std_stream" +#include "string" + +_LIBCPP_BEGIN_NAMESPACE_STD + +static __stdinbuf<char> __cin(stdin); +static __stdoutbuf<char> __cout(stdout); +static __stdoutbuf<char> __cerr(stderr); +static __stdinbuf<wchar_t> __wcin(stdin); +static __stdoutbuf<wchar_t> __wcout(stdout); +static __stdoutbuf<wchar_t> __wcerr(stderr); + +istream cin(&__cin); +ostream cout(&__cout); +ostream cerr(&__cerr); +ostream clog(&__cerr); +wistream wcin(&__wcin); +wostream wcout(&__wcout); +wostream wcerr(&__wcerr); +wostream wclog(&__wcerr); + +ios_base::Init __start_std_streams; + +ios_base::Init::Init() +{ + cin.tie(&cout); + _VSTD::unitbuf(cerr); + cerr.tie(&cout); + + wcin.tie(&wcout); + _VSTD::unitbuf(wcerr); + wcerr.tie(&wcout); +} + +ios_base::Init::~Init() +{ + cout.flush(); + clog.flush(); + + wcout.flush(); + wclog.flush(); +} + +_LIBCPP_END_NAMESPACE_STD |