diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-12-17 11:00:58 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-12-17 11:00:58 -0800 |
commit | 1865466edfe091cae376735359b665479021dca2 (patch) | |
tree | 8699a9a72673526646cd4d878516d32c8b968756 | |
parent | 3c17526474d054acb9aa616d5af95103f040b2d2 (diff) |
support for std::endl and cout << ints
-rw-r--r-- | src/library.js | 10 | ||||
-rw-r--r-- | system/include/libcxx/ostream | 2 | ||||
-rw-r--r-- | tests/runner.py | 4 |
3 files changed, 14 insertions, 2 deletions
diff --git a/src/library.js b/src/library.js index ba9ef0f8..1747155f 100644 --- a/src/library.js +++ b/src/library.js @@ -4320,6 +4320,16 @@ LibraryManager.library = { _fputs(str, _stdout); // XXX stderr etc. }, + _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEi__deps: ['fputs', '$libcxx'], + _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEi: function(stream, num) { + _fputs(allocate(intArrayFromString(num.toString()), 'i8', ALLOC_STACK), _stdout); + }, + + _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEPFRS3_S4_E__deps: ['fputc', '$libcxx'], + _ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEPFRS3_S4_E: function(stream, x) { + _fputc('\n'.charCodeAt(0), _stdout); + }, + // glibc _ZNSt8ios_base4InitC1Ev: function() { diff --git a/system/include/libcxx/ostream b/system/include/libcxx/ostream index dd28e686..f7cbb8a2 100644 --- a/system/include/libcxx/ostream +++ b/system/include/libcxx/ostream @@ -1181,6 +1181,7 @@ basic_ostream<_CharT, _Traits>::seekp(off_type __off, ios_base::seekdir __dir) return *this; } +*/ template <class _CharT, class _Traits> inline _LIBCPP_INLINE_VISIBILITY basic_ostream<_CharT, _Traits>& @@ -1209,6 +1210,7 @@ flush(basic_ostream<_CharT, _Traits>& __os) return __os; } +/* #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class _Stream, class _Tp> diff --git a/tests/runner.py b/tests/runner.py index 41064d43..e7793685 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -3482,12 +3482,12 @@ at function.:blag int main() { - std::cout << "hello world"; + std::cout << "hello world" << std::endl << 77 << "." << std::endl; return 0; } ''' - self.do_run(src, 'hello world') + self.do_run(src, 'hello world\n77.\n') def test_stdvec(self): src = ''' |