From 0fe3068e3b47285bb5c21d6b19cf76ededffc68f Mon Sep 17 00:00:00 2001 From: bkoz Date: Thu, 7 Dec 2006 09:35:57 +0000 Subject: 2006-12-06 Benjamin Kosnik * include/Makefile.am (std_headers_rename): Remove. (c_base_headers_rename): Remove. (std_headers): Adjust to true names. (c_base_headers): Adjust to true names. (stamp-c_base, stamp_std, stamp_c_base_extra): Adjust. * configure: Regenerate. * include/Makefile.in: Regenerate. * include/std/std_algorithm.h: To... * include/std/std_bitset.h: To... * include/std/std_complex.h: To... * include/std/std_deque.h: To... * include/std/std_fstream.h: To... * include/std/std_functional.h: To... * include/std/std_iomanip.h: To... * include/std/std_iosfwd.h: To... * include/std/std_ios.h: To... * include/std/std_iostream.h: To... * include/std/std_istream.h: To... * include/std/std_iterator.h: To... * include/std/std_limits.h: To... * include/std/std_list.h: To... * include/std/std_locale.h: To... * include/std/std_map.h: To... * include/std/std_memory.h: To... * include/std/std_numeric.h: To... * include/std/std_ostream.h: To... * include/std/std_queue.h: To... * include/std/std_set.h: To... * include/std/std_sstream.h: To... * include/std/std_stack.h: To... * include/std/std_stdexcept.h: To... * include/std/std_streambuf.h: To... * include/std/std_string.h: To... * include/std/std_utility.h: To... * include/std/std_valarray.h: To... * include/std/std_vector.h: To... * include/std/algorithm: ...this. * include/std/bitset: ...this. * include/std/complex: ...this. * include/std/deque: ...this. * include/std/fstream: ...this. * include/std/functional: ...this. * include/std/iomanip: ...this. * include/std/iosfwd: ...this. * include/std/ios: ...this. * include/std/iostream: ...this. * include/std/istream: ...this. * include/std/iterator: ...this. * include/std/limits: ...this. * include/std/list: ...this. * include/std/locale: ...this. * include/std/map: ...this. * include/std/memory: ...this. * include/std/numeric: ...this. * include/std/ostream: ...this. * include/std/queue: ...this. * include/std/set: ...this. * include/std/sstream: ...this. * include/std/stack: ...this. * include/std/stdexcept: ...this. * include/std/streambuf: ...this. * include/std/string: ...this. * include/std/utility: ...this. * include/std/valarray: ...this. * include/std/vector: ...this. * include/c_std/std_cassert.h: To... * include/c_std/std_cctype.h: To... * include/c_std/std_cerrno.h: To... * include/c_std/std_cfloat.h: To... * include/c_std/std_ciso646.h: To... * include/c_std/std_climits.h: To... * include/c_std/std_clocale.h: To... * include/c_std/std_cmath.h: To... * include/c_std/std_csetjmp.h: To... * include/c_std/std_csignal.h: To... * include/c_std/std_cstdarg.h: To... * include/c_std/std_cstddef.h: To... * include/c_std/std_cstdio.h: To... * include/c_std/std_cstdlib.h: To... * include/c_std/std_cstring.h: To... * include/c_std/std_ctime.h: To... * include/c_std/std_cwchar.h: To... * include/c_std/std_cwctype.h: To... * include/c_std/cassert: ...this. * include/c_std/cctype: ...this. * include/c_std/cerrno: ...this. * include/c_std/cfloat: ...this. * include/c_std/ciso646: ...this. * include/c_std/climits: ...this. * include/c_std/clocale: ...this. * include/c_std/cmath: ...this. * include/c_std/csetjmp: ...this. * include/c_std/csignal: ...this. * include/c_std/cstdarg: ...this. * include/c_std/cstddef: ...this. * include/c_std/cstdio: ...this. * include/c_std/cstdlib: ...this. * include/c_std/cstring: ...this. * include/c_std/ctime: ...this. * include/c_std/cwchar: ...this. * include/c_std/cwctype: ...this. * include/c/std_cassert.h: To... * include/c/std_cctype.h: To... * include/c/std_cerrno.h: To... * include/c/std_cfloat.h: To... * include/c/std_ciso646.h: To... * include/c/std_climits.h: To... * include/c/std_clocale.h: To... * include/c/std_cmath.h: To... * include/c/std_csetjmp.h: To... * include/c/std_csignal.h: To... * include/c/std_cstdarg.h: To... * include/c/std_cstddef.h: To... * include/c/std_cstdio.h: To... * include/c/std_cstdlib.h: To... * include/c/std_cstring.h: To... * include/c/std_ctime.h: To... * include/c/std_cwchar.h: To... * include/c/std_cwctype.h: To... * include/c/cassert: ...this. * include/c/cctype: ...this. * include/c/cerrno: ...this. * include/c/cfloat: ...this. * include/c/ciso646: ...this. * include/c/climits: ...this. * include/c/clocale: ...this. * include/c/cmath: ...this. * include/c/csetjmp: ...this. * include/c/csignal: ...this. * include/c/cstdarg: ...this. * include/c/cstddef: ...this. * include/c/cstdio: ...this. * include/c/cstdlib: ...this. * include/c/cstring: ...this. * include/c/ctime: ...this. * include/c/cwchar: ...this. * include/c/cwctype: ...this. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@119611 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 143 +++ libstdc++-v3/configure | 42 +- libstdc++-v3/include/Makefile.am | 189 ++-- libstdc++-v3/include/Makefile.in | 191 ++-- libstdc++-v3/include/c/cassert | 38 + libstdc++-v3/include/c/cctype | 41 + libstdc++-v3/include/c/cerrno | 55 ++ libstdc++-v3/include/c/cfloat | 41 + libstdc++-v3/include/c/ciso646 | 37 + libstdc++-v3/include/c/climits | 41 + libstdc++-v3/include/c/clocale | 41 + libstdc++-v3/include/c/cmath | 124 +++ libstdc++-v3/include/c/csetjmp | 49 + libstdc++-v3/include/c/csignal | 41 + libstdc++-v3/include/c/cstdarg | 42 + libstdc++-v3/include/c/cstddef | 45 + libstdc++-v3/include/c/cstdio | 84 ++ libstdc++-v3/include/c/cstdlib | 41 + libstdc++-v3/include/c/cstring | 41 + libstdc++-v3/include/c/ctime | 41 + libstdc++-v3/include/c/cwchar | 62 ++ libstdc++-v3/include/c/cwctype | 45 + libstdc++-v3/include/c/std_cassert.h | 38 - libstdc++-v3/include/c/std_cctype.h | 41 - libstdc++-v3/include/c/std_cerrno.h | 55 -- libstdc++-v3/include/c/std_cfloat.h | 41 - libstdc++-v3/include/c/std_ciso646.h | 37 - libstdc++-v3/include/c/std_climits.h | 41 - libstdc++-v3/include/c/std_clocale.h | 41 - libstdc++-v3/include/c/std_cmath.h | 124 --- libstdc++-v3/include/c/std_csetjmp.h | 49 - libstdc++-v3/include/c/std_csignal.h | 41 - libstdc++-v3/include/c/std_cstdarg.h | 42 - libstdc++-v3/include/c/std_cstddef.h | 45 - libstdc++-v3/include/c/std_cstdio.h | 84 -- libstdc++-v3/include/c/std_cstdlib.h | 41 - libstdc++-v3/include/c/std_cstring.h | 41 - libstdc++-v3/include/c/std_ctime.h | 41 - libstdc++-v3/include/c/std_cwchar.h | 62 -- libstdc++-v3/include/c/std_cwctype.h | 45 - libstdc++-v3/include/c_std/cassert | 49 + libstdc++-v3/include/c_std/cctype | 86 ++ libstdc++-v3/include/c_std/cerrno | 57 ++ libstdc++-v3/include/c_std/cfloat | 52 + libstdc++-v3/include/c_std/ciso646 | 38 + libstdc++-v3/include/c_std/climits | 52 + libstdc++-v3/include/c_std/clocale | 65 ++ libstdc++-v3/include/c_std/cmath | 600 ++++++++++++ libstdc++-v3/include/c_std/csetjmp | 68 ++ libstdc++-v3/include/c_std/csignal | 64 ++ libstdc++-v3/include/c_std/cstdarg | 64 ++ libstdc++-v3/include/c_std/cstddef | 60 ++ libstdc++-v3/include/c_std/cstdio | 191 ++++ libstdc++-v3/include/c_std/cstdlib | 227 +++++ libstdc++-v3/include/c_std/cstring | 130 +++ libstdc++-v3/include/c_std/ctime | 82 ++ libstdc++-v3/include/c_std/cwchar | 280 ++++++ libstdc++-v3/include/c_std/cwctype | 112 +++ libstdc++-v3/include/c_std/std_cassert.h | 49 - libstdc++-v3/include/c_std/std_cctype.h | 86 -- libstdc++-v3/include/c_std/std_cerrno.h | 57 -- libstdc++-v3/include/c_std/std_cfloat.h | 52 - libstdc++-v3/include/c_std/std_ciso646.h | 38 - libstdc++-v3/include/c_std/std_climits.h | 52 - libstdc++-v3/include/c_std/std_clocale.h | 65 -- libstdc++-v3/include/c_std/std_cmath.h | 600 ------------ libstdc++-v3/include/c_std/std_csetjmp.h | 68 -- libstdc++-v3/include/c_std/std_csignal.h | 64 -- libstdc++-v3/include/c_std/std_cstdarg.h | 64 -- libstdc++-v3/include/c_std/std_cstddef.h | 60 -- libstdc++-v3/include/c_std/std_cstdio.h | 191 ---- libstdc++-v3/include/c_std/std_cstdlib.h | 227 ----- libstdc++-v3/include/c_std/std_cstring.h | 130 --- libstdc++-v3/include/c_std/std_ctime.h | 82 -- libstdc++-v3/include/c_std/std_cwchar.h | 280 ------ libstdc++-v3/include/c_std/std_cwctype.h | 112 --- libstdc++-v3/include/std/algorithm | 70 ++ libstdc++-v3/include/std/bitset | 1344 ++++++++++++++++++++++++++ libstdc++-v3/include/std/complex | 1489 +++++++++++++++++++++++++++++ libstdc++-v3/include/std/deque | 80 ++ libstdc++-v3/include/std/fstream | 786 +++++++++++++++ libstdc++-v3/include/std/functional | 57 ++ libstdc++-v3/include/std/iomanip | 300 ++++++ libstdc++-v3/include/std/ios | 52 + libstdc++-v3/include/std/iosfwd | 168 ++++ libstdc++-v3/include/std/iostream | 81 ++ libstdc++-v3/include/std/istream | 848 ++++++++++++++++ libstdc++-v3/include/std/iterator | 75 ++ libstdc++-v3/include/std/limits | 1160 ++++++++++++++++++++++ libstdc++-v3/include/std/list | 81 ++ libstdc++-v3/include/std/locale | 48 + libstdc++-v3/include/std/map | 73 ++ libstdc++-v3/include/std/memory | 374 ++++++++ libstdc++-v3/include/std/numeric | 71 ++ libstdc++-v3/include/std/ostream | 613 ++++++++++++ libstdc++-v3/include/std/queue | 77 ++ libstdc++-v3/include/std/set | 73 ++ libstdc++-v3/include/std/sstream | 591 ++++++++++++ libstdc++-v3/include/std/stack | 72 ++ libstdc++-v3/include/std/std_algorithm.h | 70 -- libstdc++-v3/include/std/std_bitset.h | 1344 -------------------------- libstdc++-v3/include/std/std_complex.h | 1489 ----------------------------- libstdc++-v3/include/std/std_deque.h | 80 -- libstdc++-v3/include/std/std_fstream.h | 786 --------------- libstdc++-v3/include/std/std_functional.h | 57 -- libstdc++-v3/include/std/std_iomanip.h | 300 ------ libstdc++-v3/include/std/std_ios.h | 52 - libstdc++-v3/include/std/std_iosfwd.h | 168 ---- libstdc++-v3/include/std/std_iostream.h | 81 -- libstdc++-v3/include/std/std_istream.h | 848 ---------------- libstdc++-v3/include/std/std_iterator.h | 75 -- libstdc++-v3/include/std/std_limits.h | 1160 ---------------------- libstdc++-v3/include/std/std_list.h | 81 -- libstdc++-v3/include/std/std_locale.h | 48 - libstdc++-v3/include/std/std_map.h | 73 -- libstdc++-v3/include/std/std_memory.h | 374 -------- libstdc++-v3/include/std/std_numeric.h | 71 -- libstdc++-v3/include/std/std_ostream.h | 613 ------------ libstdc++-v3/include/std/std_queue.h | 77 -- libstdc++-v3/include/std/std_set.h | 73 -- libstdc++-v3/include/std/std_sstream.h | 591 ------------ libstdc++-v3/include/std/std_stack.h | 72 -- libstdc++-v3/include/std/std_stdexcept.h | 148 --- libstdc++-v3/include/std/std_streambuf.h | 823 ---------------- libstdc++-v3/include/std/std_string.h | 59 -- libstdc++-v3/include/std/std_utility.h | 69 -- libstdc++-v3/include/std/std_valarray.h | 1026 -------------------- libstdc++-v3/include/std/std_vector.h | 82 -- libstdc++-v3/include/std/stdexcept | 148 +++ libstdc++-v3/include/std/streambuf | 823 ++++++++++++++++ libstdc++-v3/include/std/string | 59 ++ libstdc++-v3/include/std/utility | 69 ++ libstdc++-v3/include/std/valarray | 1026 ++++++++++++++++++++ libstdc++-v3/include/std/vector | 82 ++ 134 files changed, 14263 insertions(+), 14254 deletions(-) create mode 100644 libstdc++-v3/include/c/cassert create mode 100644 libstdc++-v3/include/c/cctype create mode 100644 libstdc++-v3/include/c/cerrno create mode 100644 libstdc++-v3/include/c/cfloat create mode 100644 libstdc++-v3/include/c/ciso646 create mode 100644 libstdc++-v3/include/c/climits create mode 100644 libstdc++-v3/include/c/clocale create mode 100644 libstdc++-v3/include/c/cmath create mode 100644 libstdc++-v3/include/c/csetjmp create mode 100644 libstdc++-v3/include/c/csignal create mode 100644 libstdc++-v3/include/c/cstdarg create mode 100644 libstdc++-v3/include/c/cstddef create mode 100644 libstdc++-v3/include/c/cstdio create mode 100644 libstdc++-v3/include/c/cstdlib create mode 100644 libstdc++-v3/include/c/cstring create mode 100644 libstdc++-v3/include/c/ctime create mode 100644 libstdc++-v3/include/c/cwchar create mode 100644 libstdc++-v3/include/c/cwctype delete mode 100644 libstdc++-v3/include/c/std_cassert.h delete mode 100644 libstdc++-v3/include/c/std_cctype.h delete mode 100644 libstdc++-v3/include/c/std_cerrno.h delete mode 100644 libstdc++-v3/include/c/std_cfloat.h delete mode 100644 libstdc++-v3/include/c/std_ciso646.h delete mode 100644 libstdc++-v3/include/c/std_climits.h delete mode 100644 libstdc++-v3/include/c/std_clocale.h delete mode 100644 libstdc++-v3/include/c/std_cmath.h delete mode 100644 libstdc++-v3/include/c/std_csetjmp.h delete mode 100644 libstdc++-v3/include/c/std_csignal.h delete mode 100644 libstdc++-v3/include/c/std_cstdarg.h delete mode 100644 libstdc++-v3/include/c/std_cstddef.h delete mode 100644 libstdc++-v3/include/c/std_cstdio.h delete mode 100644 libstdc++-v3/include/c/std_cstdlib.h delete mode 100644 libstdc++-v3/include/c/std_cstring.h delete mode 100644 libstdc++-v3/include/c/std_ctime.h delete mode 100644 libstdc++-v3/include/c/std_cwchar.h delete mode 100644 libstdc++-v3/include/c/std_cwctype.h create mode 100644 libstdc++-v3/include/c_std/cassert create mode 100644 libstdc++-v3/include/c_std/cctype create mode 100644 libstdc++-v3/include/c_std/cerrno create mode 100644 libstdc++-v3/include/c_std/cfloat create mode 100644 libstdc++-v3/include/c_std/ciso646 create mode 100644 libstdc++-v3/include/c_std/climits create mode 100644 libstdc++-v3/include/c_std/clocale create mode 100644 libstdc++-v3/include/c_std/cmath create mode 100644 libstdc++-v3/include/c_std/csetjmp create mode 100644 libstdc++-v3/include/c_std/csignal create mode 100644 libstdc++-v3/include/c_std/cstdarg create mode 100644 libstdc++-v3/include/c_std/cstddef create mode 100644 libstdc++-v3/include/c_std/cstdio create mode 100644 libstdc++-v3/include/c_std/cstdlib create mode 100644 libstdc++-v3/include/c_std/cstring create mode 100644 libstdc++-v3/include/c_std/ctime create mode 100644 libstdc++-v3/include/c_std/cwchar create mode 100644 libstdc++-v3/include/c_std/cwctype delete mode 100644 libstdc++-v3/include/c_std/std_cassert.h delete mode 100644 libstdc++-v3/include/c_std/std_cctype.h delete mode 100644 libstdc++-v3/include/c_std/std_cerrno.h delete mode 100644 libstdc++-v3/include/c_std/std_cfloat.h delete mode 100644 libstdc++-v3/include/c_std/std_ciso646.h delete mode 100644 libstdc++-v3/include/c_std/std_climits.h delete mode 100644 libstdc++-v3/include/c_std/std_clocale.h delete mode 100644 libstdc++-v3/include/c_std/std_cmath.h delete mode 100644 libstdc++-v3/include/c_std/std_csetjmp.h delete mode 100644 libstdc++-v3/include/c_std/std_csignal.h delete mode 100644 libstdc++-v3/include/c_std/std_cstdarg.h delete mode 100644 libstdc++-v3/include/c_std/std_cstddef.h delete mode 100644 libstdc++-v3/include/c_std/std_cstdio.h delete mode 100644 libstdc++-v3/include/c_std/std_cstdlib.h delete mode 100644 libstdc++-v3/include/c_std/std_cstring.h delete mode 100644 libstdc++-v3/include/c_std/std_ctime.h delete mode 100644 libstdc++-v3/include/c_std/std_cwchar.h delete mode 100644 libstdc++-v3/include/c_std/std_cwctype.h create mode 100644 libstdc++-v3/include/std/algorithm create mode 100644 libstdc++-v3/include/std/bitset create mode 100644 libstdc++-v3/include/std/complex create mode 100644 libstdc++-v3/include/std/deque create mode 100644 libstdc++-v3/include/std/fstream create mode 100644 libstdc++-v3/include/std/functional create mode 100644 libstdc++-v3/include/std/iomanip create mode 100644 libstdc++-v3/include/std/ios create mode 100644 libstdc++-v3/include/std/iosfwd create mode 100644 libstdc++-v3/include/std/iostream create mode 100644 libstdc++-v3/include/std/istream create mode 100644 libstdc++-v3/include/std/iterator create mode 100644 libstdc++-v3/include/std/limits create mode 100644 libstdc++-v3/include/std/list create mode 100644 libstdc++-v3/include/std/locale create mode 100644 libstdc++-v3/include/std/map create mode 100644 libstdc++-v3/include/std/memory create mode 100644 libstdc++-v3/include/std/numeric create mode 100644 libstdc++-v3/include/std/ostream create mode 100644 libstdc++-v3/include/std/queue create mode 100644 libstdc++-v3/include/std/set create mode 100644 libstdc++-v3/include/std/sstream create mode 100644 libstdc++-v3/include/std/stack delete mode 100644 libstdc++-v3/include/std/std_algorithm.h delete mode 100644 libstdc++-v3/include/std/std_bitset.h delete mode 100644 libstdc++-v3/include/std/std_complex.h delete mode 100644 libstdc++-v3/include/std/std_deque.h delete mode 100644 libstdc++-v3/include/std/std_fstream.h delete mode 100644 libstdc++-v3/include/std/std_functional.h delete mode 100644 libstdc++-v3/include/std/std_iomanip.h delete mode 100644 libstdc++-v3/include/std/std_ios.h delete mode 100644 libstdc++-v3/include/std/std_iosfwd.h delete mode 100644 libstdc++-v3/include/std/std_iostream.h delete mode 100644 libstdc++-v3/include/std/std_istream.h delete mode 100644 libstdc++-v3/include/std/std_iterator.h delete mode 100644 libstdc++-v3/include/std/std_limits.h delete mode 100644 libstdc++-v3/include/std/std_list.h delete mode 100644 libstdc++-v3/include/std/std_locale.h delete mode 100644 libstdc++-v3/include/std/std_map.h delete mode 100644 libstdc++-v3/include/std/std_memory.h delete mode 100644 libstdc++-v3/include/std/std_numeric.h delete mode 100644 libstdc++-v3/include/std/std_ostream.h delete mode 100644 libstdc++-v3/include/std/std_queue.h delete mode 100644 libstdc++-v3/include/std/std_set.h delete mode 100644 libstdc++-v3/include/std/std_sstream.h delete mode 100644 libstdc++-v3/include/std/std_stack.h delete mode 100644 libstdc++-v3/include/std/std_stdexcept.h delete mode 100644 libstdc++-v3/include/std/std_streambuf.h delete mode 100644 libstdc++-v3/include/std/std_string.h delete mode 100644 libstdc++-v3/include/std/std_utility.h delete mode 100644 libstdc++-v3/include/std/std_valarray.h delete mode 100644 libstdc++-v3/include/std/std_vector.h create mode 100644 libstdc++-v3/include/std/stdexcept create mode 100644 libstdc++-v3/include/std/streambuf create mode 100644 libstdc++-v3/include/std/string create mode 100644 libstdc++-v3/include/std/utility create mode 100644 libstdc++-v3/include/std/valarray create mode 100644 libstdc++-v3/include/std/vector diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index e6de196160e..faebf37301d 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,146 @@ +2006-12-06 Benjamin Kosnik + + * include/Makefile.am (std_headers_rename): Remove. + (c_base_headers_rename): Remove. + (std_headers): Adjust to true names. + (c_base_headers): Adjust to true names. + (stamp-c_base, stamp_std, stamp_c_base_extra): Adjust. + * configure: Regenerate. + * include/Makefile.in: Regenerate. + + * include/std/std_algorithm.h: To... + * include/std/std_bitset.h: To... + * include/std/std_complex.h: To... + * include/std/std_deque.h: To... + * include/std/std_fstream.h: To... + * include/std/std_functional.h: To... + * include/std/std_iomanip.h: To... + * include/std/std_iosfwd.h: To... + * include/std/std_ios.h: To... + * include/std/std_iostream.h: To... + * include/std/std_istream.h: To... + * include/std/std_iterator.h: To... + * include/std/std_limits.h: To... + * include/std/std_list.h: To... + * include/std/std_locale.h: To... + * include/std/std_map.h: To... + * include/std/std_memory.h: To... + * include/std/std_numeric.h: To... + * include/std/std_ostream.h: To... + * include/std/std_queue.h: To... + * include/std/std_set.h: To... + * include/std/std_sstream.h: To... + * include/std/std_stack.h: To... + * include/std/std_stdexcept.h: To... + * include/std/std_streambuf.h: To... + * include/std/std_string.h: To... + * include/std/std_utility.h: To... + * include/std/std_valarray.h: To... + * include/std/std_vector.h: To... + * include/std/algorithm: ...this. + * include/std/bitset: ...this. + * include/std/complex: ...this. + * include/std/deque: ...this. + * include/std/fstream: ...this. + * include/std/functional: ...this. + * include/std/iomanip: ...this. + * include/std/iosfwd: ...this. + * include/std/ios: ...this. + * include/std/iostream: ...this. + * include/std/istream: ...this. + * include/std/iterator: ...this. + * include/std/limits: ...this. + * include/std/list: ...this. + * include/std/locale: ...this. + * include/std/map: ...this. + * include/std/memory: ...this. + * include/std/numeric: ...this. + * include/std/ostream: ...this. + * include/std/queue: ...this. + * include/std/set: ...this. + * include/std/sstream: ...this. + * include/std/stack: ...this. + * include/std/stdexcept: ...this. + * include/std/streambuf: ...this. + * include/std/string: ...this. + * include/std/utility: ...this. + * include/std/valarray: ...this. + * include/std/vector: ...this. + + * include/c_std/std_cassert.h: To... + * include/c_std/std_cctype.h: To... + * include/c_std/std_cerrno.h: To... + * include/c_std/std_cfloat.h: To... + * include/c_std/std_ciso646.h: To... + * include/c_std/std_climits.h: To... + * include/c_std/std_clocale.h: To... + * include/c_std/std_cmath.h: To... + * include/c_std/std_csetjmp.h: To... + * include/c_std/std_csignal.h: To... + * include/c_std/std_cstdarg.h: To... + * include/c_std/std_cstddef.h: To... + * include/c_std/std_cstdio.h: To... + * include/c_std/std_cstdlib.h: To... + * include/c_std/std_cstring.h: To... + * include/c_std/std_ctime.h: To... + * include/c_std/std_cwchar.h: To... + * include/c_std/std_cwctype.h: To... + * include/c_std/cassert: ...this. + * include/c_std/cctype: ...this. + * include/c_std/cerrno: ...this. + * include/c_std/cfloat: ...this. + * include/c_std/ciso646: ...this. + * include/c_std/climits: ...this. + * include/c_std/clocale: ...this. + * include/c_std/cmath: ...this. + * include/c_std/csetjmp: ...this. + * include/c_std/csignal: ...this. + * include/c_std/cstdarg: ...this. + * include/c_std/cstddef: ...this. + * include/c_std/cstdio: ...this. + * include/c_std/cstdlib: ...this. + * include/c_std/cstring: ...this. + * include/c_std/ctime: ...this. + * include/c_std/cwchar: ...this. + * include/c_std/cwctype: ...this. + + * include/c/std_cassert.h: To... + * include/c/std_cctype.h: To... + * include/c/std_cerrno.h: To... + * include/c/std_cfloat.h: To... + * include/c/std_ciso646.h: To... + * include/c/std_climits.h: To... + * include/c/std_clocale.h: To... + * include/c/std_cmath.h: To... + * include/c/std_csetjmp.h: To... + * include/c/std_csignal.h: To... + * include/c/std_cstdarg.h: To... + * include/c/std_cstddef.h: To... + * include/c/std_cstdio.h: To... + * include/c/std_cstdlib.h: To... + * include/c/std_cstring.h: To... + * include/c/std_ctime.h: To... + * include/c/std_cwchar.h: To... + * include/c/std_cwctype.h: To... + * include/c/cassert: ...this. + * include/c/cctype: ...this. + * include/c/cerrno: ...this. + * include/c/cfloat: ...this. + * include/c/ciso646: ...this. + * include/c/climits: ...this. + * include/c/clocale: ...this. + * include/c/cmath: ...this. + * include/c/csetjmp: ...this. + * include/c/csignal: ...this. + * include/c/cstdarg: ...this. + * include/c/cstddef: ...this. + * include/c/cstdio: ...this. + * include/c/cstdlib: ...this. + * include/c/cstring: ...this. + * include/c/ctime: ...this. + * include/c/cwchar: ...this. + * include/c/cwctype: ...this. + 2006-12-05 Benjamin Kosnik * include/bits/localefwd.h: Consistent @file placement, use diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index 0979f650b36..ae4e09e15dc 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -31326,39 +31326,9 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - save_LDFLAGS="$LDFLAGS" + save_LDFLAGS="$LDFLAGS" LDFLAGS="-static $LDFLAGS" - if test x$gcc_no_link = xyes; then - { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5 -echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;} - { (exit 1); exit 1; }; } -fi -cat >conftest.$ac_ext <<_ACEOF -int main() { return 0; } -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - if test "$cross_compiling" = yes; then + if test "$cross_compiling" = yes; then { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling See \`config.log' for more details." >&5 echo "$as_me: error: cannot run test program while cross compiling @@ -31390,14 +31360,6 @@ have_tls=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -have_tls=yes -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" else echo "$as_me: program exited with status $ac_status" >&5 diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am index d260e8ea96d..a025da1acea 100644 --- a/libstdc++-v3/include/Makefile.am +++ b/libstdc++-v3/include/Makefile.am @@ -28,66 +28,35 @@ include $(top_srcdir)/fragment.am std_srcdir = ${glibcxx_srcdir}/include/std std_builddir = . std_headers = \ - ${std_srcdir}/std_algorithm.h \ - ${std_srcdir}/std_bitset.h \ - ${std_srcdir}/std_complex.h \ - ${std_srcdir}/std_deque.h \ - ${std_srcdir}/std_fstream.h \ - ${std_srcdir}/std_functional.h \ - ${std_srcdir}/std_iomanip.h \ - ${std_srcdir}/std_ios.h \ - ${std_srcdir}/std_iosfwd.h \ - ${std_srcdir}/std_iostream.h \ - ${std_srcdir}/std_istream.h \ - ${std_srcdir}/std_iterator.h \ - ${std_srcdir}/std_limits.h \ - ${std_srcdir}/std_list.h \ - ${std_srcdir}/std_locale.h \ - ${std_srcdir}/std_map.h \ - ${std_srcdir}/std_memory.h \ - ${std_srcdir}/std_numeric.h \ - ${std_srcdir}/std_ostream.h \ - ${std_srcdir}/std_queue.h \ - ${std_srcdir}/std_set.h \ - ${std_srcdir}/std_sstream.h \ - ${std_srcdir}/std_stack.h \ - ${std_srcdir}/std_stdexcept.h \ - ${std_srcdir}/std_streambuf.h \ - ${std_srcdir}/std_string.h \ - ${std_srcdir}/std_utility.h \ - ${std_srcdir}/std_valarray.h \ - ${std_srcdir}/std_vector.h -# Renamed at build time. -std_headers_rename = \ - algorithm \ - bitset \ - complex \ - deque \ - fstream \ - functional \ - iomanip \ - ios \ - iosfwd \ - iostream \ - istream \ - iterator \ - limits \ - list \ - locale \ - map \ - memory \ - numeric \ - ostream \ - queue \ - set \ - sstream \ - stack \ - stdexcept \ - streambuf \ - string \ - utility \ - valarray \ - vector + ${std_srcdir}/algorithm \ + ${std_srcdir}/bitset \ + ${std_srcdir}/complex \ + ${std_srcdir}/deque \ + ${std_srcdir}/fstream \ + ${std_srcdir}/functional \ + ${std_srcdir}/iomanip \ + ${std_srcdir}/ios \ + ${std_srcdir}/iosfwd \ + ${std_srcdir}/iostream \ + ${std_srcdir}/istream \ + ${std_srcdir}/iterator \ + ${std_srcdir}/limits \ + ${std_srcdir}/list \ + ${std_srcdir}/locale \ + ${std_srcdir}/map \ + ${std_srcdir}/memory \ + ${std_srcdir}/numeric \ + ${std_srcdir}/ostream \ + ${std_srcdir}/queue \ + ${std_srcdir}/set \ + ${std_srcdir}/sstream \ + ${std_srcdir}/stack \ + ${std_srcdir}/stdexcept \ + ${std_srcdir}/streambuf \ + ${std_srcdir}/string \ + ${std_srcdir}/utility \ + ${std_srcdir}/valarray \ + ${std_srcdir}/vector bits_srcdir = ${glibcxx_srcdir}/include/bits bits_builddir = ./bits @@ -614,43 +583,24 @@ tr1_headers = \ c_base_srcdir = $(C_INCLUDE_DIR) c_base_builddir = . c_base_headers = \ - ${c_base_srcdir}/std_cassert.h \ - ${c_base_srcdir}/std_cctype.h \ - ${c_base_srcdir}/std_cerrno.h \ - ${c_base_srcdir}/std_cfloat.h \ - ${c_base_srcdir}/std_ciso646.h \ - ${c_base_srcdir}/std_climits.h \ - ${c_base_srcdir}/std_clocale.h \ - ${c_base_srcdir}/std_cmath.h \ - ${c_base_srcdir}/std_csetjmp.h \ - ${c_base_srcdir}/std_csignal.h \ - ${c_base_srcdir}/std_cstdarg.h \ - ${c_base_srcdir}/std_cstddef.h \ - ${c_base_srcdir}/std_cstdio.h \ - ${c_base_srcdir}/std_cstdlib.h \ - ${c_base_srcdir}/std_cstring.h \ - ${c_base_srcdir}/std_ctime.h \ - ${c_base_srcdir}/std_cwchar.h \ - ${c_base_srcdir}/std_cwctype.h -c_base_headers_rename = \ - cassert \ - cctype \ - cerrno \ - cfloat \ - ciso646 \ - climits \ - clocale \ - cmath \ - csetjmp \ - csignal \ - cstdarg \ - cstddef \ - cstdio \ - cstdlib \ - cstring \ - ctime \ - cwchar \ - cwctype + ${c_base_srcdir}/cassert \ + ${c_base_srcdir}/cctype \ + ${c_base_srcdir}/cerrno \ + ${c_base_srcdir}/cfloat \ + ${c_base_srcdir}/ciso646 \ + ${c_base_srcdir}/climits \ + ${c_base_srcdir}/clocale \ + ${c_base_srcdir}/cmath \ + ${c_base_srcdir}/csetjmp \ + ${c_base_srcdir}/csignal \ + ${c_base_srcdir}/cstdarg \ + ${c_base_srcdir}/cstddef \ + ${c_base_srcdir}/cstdio \ + ${c_base_srcdir}/cstdlib \ + ${c_base_srcdir}/cstring \ + ${c_base_srcdir}/ctime \ + ${c_base_srcdir}/cwchar \ + ${c_base_srcdir}/cwctype # "C" compatibility headers. c_compatibility_srcdir = ${glibcxx_srcdir}/include/c_compatibility @@ -794,8 +744,9 @@ endif # List of all timestamp files. By keeping only one copy of this list, both # CLEANFILES and all-local are kept up-to-date. allstamped = \ - stamp-std stamp-bits stamp-c_base stamp-c_compatibility \ - stamp-backward stamp-ext stamp-pb stamp-tr1 stamp-debug stamp-host + stamp-std stamp-bits stamp-c_base stamp-c_base_extra \ + stamp-c_compatibility stamp-backward stamp-ext stamp-pb \ + stamp-tr1 stamp-debug stamp-host # List of all files that are created by explicit building, editing, or # catenation. @@ -814,10 +765,7 @@ stamp-std: ${std_headers} mkdir -p ${std_builddir} ;\ fi ;\ if [ ! -f stamp-std ]; then \ - (cd ${std_builddir} && for h in $?; do \ - build_name=`echo $$h | sed -e 's,.*/std_,,' -e 's,\.h$$,,'` ;\ - $(LN_S) $$h ./$${build_name} || true ;\ - done) ;\ + (cd ${std_builddir} && $(LN_S) $? . || true) ;\ fi ;\ $(STAMP) stamp-std @@ -830,21 +778,24 @@ stamp-bits: ${bits_headers} fi ;\ $(STAMP) stamp-bits -stamp-c_base: stamp-bits ${c_base_headers} ${c_base_headers_extra} +stamp-c_base: ${c_base_headers} @if [ ! -d "${c_base_builddir}" ]; then \ mkdir -p ${c_base_builddir} ;\ fi ;\ if [ ! -f stamp-c_base ]; then \ - (cd ${c_base_builddir} && for h in ${c_base_headers}; do \ - build_name=`echo $$h | sed -e 's,.*/std_,,' -e 's,\.h$$,,'` ;\ - $(LN_S) $$h ./$${build_name} || true ;\ - done) ;\ - if [ ! -z "${c_base_headers_extra}" ]; then \ - (cd ${bits_builddir} && $(LN_S) ${c_base_headers_extra} . || true) ;\ - fi ;\ + (cd ${c_base_builddir} && $(LN_S) $? . || true) ;\ fi ;\ $(STAMP) stamp-c_base +stamp-c_base_extra: ${c_base_headers_extra} + @if [ ! -d "${bits_builddir}" ]; then \ + mkdir -p ${bits_builddir} ;\ + fi ;\ + if [ ! -f stamp-c_base_extra ]; then \ + (cd ${bits_builddir} && $(LN_S) $? . || true) ;\ + fi ;\ + $(STAMP) stamp-c_base_extra + stamp-c_compatibility: ${c_compatibility_headers_extra} @if [ ! -d "${c_compatibility_builddir}" ]; then \ mkdir -p ${c_compatibility_builddir} ;\ @@ -1160,8 +1111,8 @@ install-headers: for file in ${tr1_headers}; do \ $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${tr1_builddir}; done $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${c_base_builddir} - for file in ${c_base_headers_rename}; do \ - $(INSTALL_DATA) ${c_base_builddir}/$${file} $(DESTDIR)${gxx_include_dir}/${c_base_builddir}; done + for file in ${c_base_headers}; do \ + $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${c_base_builddir}; done c_base_headers_extra_install='$(c_base_headers_extra)';\ for file in $$c_base_headers_extra_install; do \ $(INSTALL_DATA) $$file $(DESTDIR)${gxx_include_dir}/${bits_builddir}; done @@ -1169,8 +1120,8 @@ install-headers: for file in $$c_compatibility_headers_install; do \ $(INSTALL_DATA) $$file $(DESTDIR)${gxx_include_dir}; done $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${std_builddir} - for file in ${std_headers_rename}; do \ - $(INSTALL_DATA) ${std_builddir}/$${file} $(DESTDIR)${gxx_include_dir}/${std_builddir}; done + for file in ${std_headers}; do \ + $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${std_builddir}; done $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${debug_builddir} for file in ${debug_headers}; do \ $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${debug_builddir}; done @@ -1201,6 +1152,8 @@ clean-local: # developer tries to create them via make in the include build # directory. (This is more of an example of how this kind of rule can # be made.) -.PRECIOUS: $(std_headers_rename) $(c_base_headers_rename) -$(std_headers_rename): ; @: -$(c_base_headers_rename): ; @: +.PRECIOUS: $(std_headers) $(c_base_headers) $(tr1_headers) $(ext_headers) +$(std_headers): ; @: +$(c_base_headers): ; @: +$(tr1_headers): ; @: +$(ext_headers): ; @: diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in index 80b1cebcb45..3d4f0fe2851 100644 --- a/libstdc++-v3/include/Makefile.in +++ b/libstdc++-v3/include/Makefile.in @@ -253,67 +253,35 @@ AM_CPPFLAGS = $(GLIBCXX_INCLUDES) std_srcdir = ${glibcxx_srcdir}/include/std std_builddir = . std_headers = \ - ${std_srcdir}/std_algorithm.h \ - ${std_srcdir}/std_bitset.h \ - ${std_srcdir}/std_complex.h \ - ${std_srcdir}/std_deque.h \ - ${std_srcdir}/std_fstream.h \ - ${std_srcdir}/std_functional.h \ - ${std_srcdir}/std_iomanip.h \ - ${std_srcdir}/std_ios.h \ - ${std_srcdir}/std_iosfwd.h \ - ${std_srcdir}/std_iostream.h \ - ${std_srcdir}/std_istream.h \ - ${std_srcdir}/std_iterator.h \ - ${std_srcdir}/std_limits.h \ - ${std_srcdir}/std_list.h \ - ${std_srcdir}/std_locale.h \ - ${std_srcdir}/std_map.h \ - ${std_srcdir}/std_memory.h \ - ${std_srcdir}/std_numeric.h \ - ${std_srcdir}/std_ostream.h \ - ${std_srcdir}/std_queue.h \ - ${std_srcdir}/std_set.h \ - ${std_srcdir}/std_sstream.h \ - ${std_srcdir}/std_stack.h \ - ${std_srcdir}/std_stdexcept.h \ - ${std_srcdir}/std_streambuf.h \ - ${std_srcdir}/std_string.h \ - ${std_srcdir}/std_utility.h \ - ${std_srcdir}/std_valarray.h \ - ${std_srcdir}/std_vector.h - -# Renamed at build time. -std_headers_rename = \ - algorithm \ - bitset \ - complex \ - deque \ - fstream \ - functional \ - iomanip \ - ios \ - iosfwd \ - iostream \ - istream \ - iterator \ - limits \ - list \ - locale \ - map \ - memory \ - numeric \ - ostream \ - queue \ - set \ - sstream \ - stack \ - stdexcept \ - streambuf \ - string \ - utility \ - valarray \ - vector + ${std_srcdir}/algorithm \ + ${std_srcdir}/bitset \ + ${std_srcdir}/complex \ + ${std_srcdir}/deque \ + ${std_srcdir}/fstream \ + ${std_srcdir}/functional \ + ${std_srcdir}/iomanip \ + ${std_srcdir}/ios \ + ${std_srcdir}/iosfwd \ + ${std_srcdir}/iostream \ + ${std_srcdir}/istream \ + ${std_srcdir}/iterator \ + ${std_srcdir}/limits \ + ${std_srcdir}/list \ + ${std_srcdir}/locale \ + ${std_srcdir}/map \ + ${std_srcdir}/memory \ + ${std_srcdir}/numeric \ + ${std_srcdir}/ostream \ + ${std_srcdir}/queue \ + ${std_srcdir}/set \ + ${std_srcdir}/sstream \ + ${std_srcdir}/stack \ + ${std_srcdir}/stdexcept \ + ${std_srcdir}/streambuf \ + ${std_srcdir}/string \ + ${std_srcdir}/utility \ + ${std_srcdir}/valarray \ + ${std_srcdir}/vector bits_srcdir = ${glibcxx_srcdir}/include/bits bits_builddir = ./bits @@ -835,44 +803,24 @@ tr1_headers = \ c_base_srcdir = $(C_INCLUDE_DIR) c_base_builddir = . c_base_headers = \ - ${c_base_srcdir}/std_cassert.h \ - ${c_base_srcdir}/std_cctype.h \ - ${c_base_srcdir}/std_cerrno.h \ - ${c_base_srcdir}/std_cfloat.h \ - ${c_base_srcdir}/std_ciso646.h \ - ${c_base_srcdir}/std_climits.h \ - ${c_base_srcdir}/std_clocale.h \ - ${c_base_srcdir}/std_cmath.h \ - ${c_base_srcdir}/std_csetjmp.h \ - ${c_base_srcdir}/std_csignal.h \ - ${c_base_srcdir}/std_cstdarg.h \ - ${c_base_srcdir}/std_cstddef.h \ - ${c_base_srcdir}/std_cstdio.h \ - ${c_base_srcdir}/std_cstdlib.h \ - ${c_base_srcdir}/std_cstring.h \ - ${c_base_srcdir}/std_ctime.h \ - ${c_base_srcdir}/std_cwchar.h \ - ${c_base_srcdir}/std_cwctype.h - -c_base_headers_rename = \ - cassert \ - cctype \ - cerrno \ - cfloat \ - ciso646 \ - climits \ - clocale \ - cmath \ - csetjmp \ - csignal \ - cstdarg \ - cstddef \ - cstdio \ - cstdlib \ - cstring \ - ctime \ - cwchar \ - cwctype + ${c_base_srcdir}/cassert \ + ${c_base_srcdir}/cctype \ + ${c_base_srcdir}/cerrno \ + ${c_base_srcdir}/cfloat \ + ${c_base_srcdir}/ciso646 \ + ${c_base_srcdir}/climits \ + ${c_base_srcdir}/clocale \ + ${c_base_srcdir}/cmath \ + ${c_base_srcdir}/csetjmp \ + ${c_base_srcdir}/csignal \ + ${c_base_srcdir}/cstdarg \ + ${c_base_srcdir}/cstddef \ + ${c_base_srcdir}/cstdio \ + ${c_base_srcdir}/cstdlib \ + ${c_base_srcdir}/cstring \ + ${c_base_srcdir}/ctime \ + ${c_base_srcdir}/cwchar \ + ${c_base_srcdir}/cwctype # "C" compatibility headers. @@ -1007,8 +955,9 @@ PCHFLAGS = -Winvalid-pch -Wno-deprecated -x c++-header $(CXXFLAGS) # List of all timestamp files. By keeping only one copy of this list, both # CLEANFILES and all-local are kept up-to-date. allstamped = \ - stamp-std stamp-bits stamp-c_base stamp-c_compatibility \ - stamp-backward stamp-ext stamp-pb stamp-tr1 stamp-debug stamp-host + stamp-std stamp-bits stamp-c_base stamp-c_base_extra \ + stamp-c_compatibility stamp-backward stamp-ext stamp-pb \ + stamp-tr1 stamp-debug stamp-host # List of all files that are created by explicit building, editing, or @@ -1197,10 +1146,7 @@ stamp-std: ${std_headers} mkdir -p ${std_builddir} ;\ fi ;\ if [ ! -f stamp-std ]; then \ - (cd ${std_builddir} && for h in $?; do \ - build_name=`echo $$h | sed -e 's,.*/std_,,' -e 's,\.h$$,,'` ;\ - $(LN_S) $$h ./$${build_name} || true ;\ - done) ;\ + (cd ${std_builddir} && $(LN_S) $? . || true) ;\ fi ;\ $(STAMP) stamp-std @@ -1213,21 +1159,24 @@ stamp-bits: ${bits_headers} fi ;\ $(STAMP) stamp-bits -stamp-c_base: stamp-bits ${c_base_headers} ${c_base_headers_extra} +stamp-c_base: ${c_base_headers} @if [ ! -d "${c_base_builddir}" ]; then \ mkdir -p ${c_base_builddir} ;\ fi ;\ if [ ! -f stamp-c_base ]; then \ - (cd ${c_base_builddir} && for h in ${c_base_headers}; do \ - build_name=`echo $$h | sed -e 's,.*/std_,,' -e 's,\.h$$,,'` ;\ - $(LN_S) $$h ./$${build_name} || true ;\ - done) ;\ - if [ ! -z "${c_base_headers_extra}" ]; then \ - (cd ${bits_builddir} && $(LN_S) ${c_base_headers_extra} . || true) ;\ - fi ;\ + (cd ${c_base_builddir} && $(LN_S) $? . || true) ;\ fi ;\ $(STAMP) stamp-c_base +stamp-c_base_extra: ${c_base_headers_extra} + @if [ ! -d "${bits_builddir}" ]; then \ + mkdir -p ${bits_builddir} ;\ + fi ;\ + if [ ! -f stamp-c_base_extra ]; then \ + (cd ${bits_builddir} && $(LN_S) $? . || true) ;\ + fi ;\ + $(STAMP) stamp-c_base_extra + stamp-c_compatibility: ${c_compatibility_headers_extra} @if [ ! -d "${c_compatibility_builddir}" ]; then \ mkdir -p ${c_compatibility_builddir} ;\ @@ -1531,8 +1480,8 @@ install-headers: for file in ${tr1_headers}; do \ $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${tr1_builddir}; done $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${c_base_builddir} - for file in ${c_base_headers_rename}; do \ - $(INSTALL_DATA) ${c_base_builddir}/$${file} $(DESTDIR)${gxx_include_dir}/${c_base_builddir}; done + for file in ${c_base_headers}; do \ + $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${c_base_builddir}; done c_base_headers_extra_install='$(c_base_headers_extra)';\ for file in $$c_base_headers_extra_install; do \ $(INSTALL_DATA) $$file $(DESTDIR)${gxx_include_dir}/${bits_builddir}; done @@ -1540,8 +1489,8 @@ install-headers: for file in $$c_compatibility_headers_install; do \ $(INSTALL_DATA) $$file $(DESTDIR)${gxx_include_dir}; done $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${std_builddir} - for file in ${std_headers_rename}; do \ - $(INSTALL_DATA) ${std_builddir}/$${file} $(DESTDIR)${gxx_include_dir}/${std_builddir}; done + for file in ${std_headers}; do \ + $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${std_builddir}; done $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${debug_builddir} for file in ${debug_headers}; do \ $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${debug_builddir}; done @@ -1569,9 +1518,11 @@ clean-local: # developer tries to create them via make in the include build # directory. (This is more of an example of how this kind of rule can # be made.) -.PRECIOUS: $(std_headers_rename) $(c_base_headers_rename) -$(std_headers_rename): ; @: -$(c_base_headers_rename): ; @: +.PRECIOUS: $(std_headers) $(c_base_headers) $(tr1_headers) $(ext_headers) +$(std_headers): ; @: +$(c_base_headers): ; @: +$(tr1_headers): ; @: +$(ext_headers): ; @: # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/libstdc++-v3/include/c/cassert b/libstdc++-v3/include/c/cassert new file mode 100644 index 00000000000..873eeef6ba5 --- /dev/null +++ b/libstdc++-v3/include/c/cassert @@ -0,0 +1,38 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 2000, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 19.2 Assertions +// + +// No include guards on this header... + +#pragma GCC system_header + +#include_next diff --git a/libstdc++-v3/include/c/cctype b/libstdc++-v3/include/c/cctype new file mode 100644 index 00000000000..103dd379bbe --- /dev/null +++ b/libstdc++-v3/include/c/cctype @@ -0,0 +1,41 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: +// + +#ifndef _GLIBCXX_CCTYPE +#define _GLIBCXX_CCTYPE 1 + +#pragma GCC system_header + +#include_next + +#endif diff --git a/libstdc++-v3/include/c/cerrno b/libstdc++-v3/include/c/cerrno new file mode 100644 index 00000000000..e27c3619dfd --- /dev/null +++ b/libstdc++-v3/include/c/cerrno @@ -0,0 +1,55 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file cerrno + * This is a Standard C++ Library file. You should @c #include this file + * in your programs, rather than any of the "*.h" implementation files. + * + * This is the C++ version of the Standard C Library header @c errno.h, + * and its contents are (mostly) the same as that header, but are all + * contained in the namespace @c std. + */ + +// +// ISO C++ 14882: 19.3 Error numbers +// + +#ifndef _GLIBCXX_CERRNO +#define _GLIBCXX_CERRNO 1 + +#pragma GCC system_header + +#include_next + +// Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998 +#ifndef errno +#define errno errno +#endif + +#endif diff --git a/libstdc++-v3/include/c/cfloat b/libstdc++-v3/include/c/cfloat new file mode 100644 index 00000000000..3cf6b9b0b97 --- /dev/null +++ b/libstdc++-v3/include/c/cfloat @@ -0,0 +1,41 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 18.2.2 Implementation properties: C library +// + +#ifndef _GLIBCXX_CFLOAT +#define _GLIBCXX_CFLOAT 1 + +#pragma GCC system_header + +#include_next + +#endif diff --git a/libstdc++-v3/include/c/ciso646 b/libstdc++-v3/include/c/ciso646 new file mode 100644 index 00000000000..4ffd3bb1a9b --- /dev/null +++ b/libstdc++-v3/include/c/ciso646 @@ -0,0 +1,37 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 2001 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file ciso646 + * This is a Standard C++ Library file. You should @c #include this file + * in your programs, rather than any of the "*.h" implementation files. + * + * This is the C++ version of the Standard C Library header @c iso646.h, + * and its contents are (mostly) the same as that header, but are all + * contained in the namespace @c std. + */ diff --git a/libstdc++-v3/include/c/climits b/libstdc++-v3/include/c/climits new file mode 100644 index 00000000000..ca9db692e6d --- /dev/null +++ b/libstdc++-v3/include/c/climits @@ -0,0 +1,41 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 18.2.2 Implementation properties: C library +// + +#ifndef _GLIBCXX_CLIMITS +#define _GLIBCXX_CLIMITS 1 + +#pragma GCC system_header + +#include_next + +#endif diff --git a/libstdc++-v3/include/c/clocale b/libstdc++-v3/include/c/clocale new file mode 100644 index 00000000000..7642222b2e6 --- /dev/null +++ b/libstdc++-v3/include/c/clocale @@ -0,0 +1,41 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 18.2.2 Implementation properties: C library +// + +#ifndef _GLIBCXX_CLOCALE +#define _GLIBCXX_CLOCALE 1 + +#pragma GCC system_header + +#include_next + +#endif diff --git a/libstdc++-v3/include/c/cmath b/libstdc++-v3/include/c/cmath new file mode 100644 index 00000000000..18c1fb2e5b2 --- /dev/null +++ b/libstdc++-v3/include/c/cmath @@ -0,0 +1,124 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 26.5 C library +// + +#ifndef _GLIBCXX_CMATH +#define _GLIBCXX_CMATH 1 + +#pragma GCC system_header + +#include + +#include_next + +// Get rid of those macros defined in in lieu of real functions. +#undef abs +#undef div +#undef acos +#undef asin +#undef atan +#undef atan2 +#undef ceil +#undef cos +#undef cosh +#undef exp +#undef fabs +#undef floor +#undef fmod +#undef frexp +#undef ldexp +#undef log +#undef log10 +#undef modf +#undef pow +#undef sin +#undef sinh +#undef sqrt +#undef tan +#undef tanh + +#undef fpclassify +#undef isfinite +#undef isinf +#undef isnan +#undef isnormal +#undef signbit +#undef isgreater +#undef isgreaterequal +#undef isless +#undef islessequal +#undef islessgreater +#undef isunordered + +namespace std +{ + inline double + abs(double __x) + { return __builtin_fabs(__x); } + + inline float + abs(float __x) + { return __builtin_fabsf(__x); } + + inline long double + abs(long double __x) + { return __builtin_fabsl(__x); } + +#if _GLIBCXX_HAVE_MODFF + inline float + modf(float __x, float* __iptr) { return modff(__x, __iptr); } +#else + inline float + modf(float __x, float* __iptr) + { + double __tmp; + double __res = modf(static_cast(__x), &__tmp); + *__iptr = static_cast(__tmp); + return __res; + } +#endif + +#if _GLIBCXX_HAVE_MODFL + inline long double + modf(long double __x, long double* __iptr) { return modfl(__x, __iptr); } +#else + inline long double + modf(long double __x, long double* __iptr) + { + double __tmp; + double __res = modf(static_cast(__x), &__tmp); + * __iptr = static_cast(__tmp); + return __res; + } +#endif +} +#endif diff --git a/libstdc++-v3/include/c/csetjmp b/libstdc++-v3/include/c/csetjmp new file mode 100644 index 00000000000..1926bccfbba --- /dev/null +++ b/libstdc++-v3/include/c/csetjmp @@ -0,0 +1,49 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 20.4.6 C library +// + +#ifndef _GLIBCXX_CSETJMP +#define _GLIBCXX_CSETJMP 1 + +#pragma GCC system_header + +#include_next + +// Get rid of those macros defined in in lieu of real functions. +#undef longjmp + +// Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998 +#ifndef setjmp +#define setjmp(env) std::setjmp (env) +#endif + +#endif diff --git a/libstdc++-v3/include/c/csignal b/libstdc++-v3/include/c/csignal new file mode 100644 index 00000000000..37bacaecae6 --- /dev/null +++ b/libstdc++-v3/include/c/csignal @@ -0,0 +1,41 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 20.4.6 C library +// + +#ifndef _GLIBCXX_CSIGNAL +#define _GLIBCXX_CSIGNAL 1 + +#pragma GCC system_header + +#include_next + +#endif diff --git a/libstdc++-v3/include/c/cstdarg b/libstdc++-v3/include/c/cstdarg new file mode 100644 index 00000000000..00aa001d43c --- /dev/null +++ b/libstdc++-v3/include/c/cstdarg @@ -0,0 +1,42 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 20.4.6 C library +// + +#ifndef _GLIBCXX_CSTDARG +#define _GLIBCXX_CSTDARG 1 + +#pragma GCC system_header + +#undef __need___va_list +#include_next + +#endif diff --git a/libstdc++-v3/include/c/cstddef b/libstdc++-v3/include/c/cstddef new file mode 100644 index 00000000000..33269af6ba0 --- /dev/null +++ b/libstdc++-v3/include/c/cstddef @@ -0,0 +1,45 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 18.1 Types +// + +#ifndef _GLIBCXX_CSTDDEF +#define _GLIBCXX_CSTDDEF 1 + +#pragma GCC system_header + +#define __need_size_t +#define __need_ptrdiff_t +#define __need_NULL +#define __need_offsetof +#include_next + +#endif diff --git a/libstdc++-v3/include/c/cstdio b/libstdc++-v3/include/c/cstdio new file mode 100644 index 00000000000..5cb8bcfcf97 --- /dev/null +++ b/libstdc++-v3/include/c/cstdio @@ -0,0 +1,84 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 27.8.2 C Library files +// + +#ifndef _GLIBCXX_CSTDIO +#define _GLIBCXX_CSTDIO 1 + +#pragma GCC system_header + +#include_next + +// Get rid of those macros defined in in lieu of real functions. +#undef clearerr +#undef fclose +#undef feof +#undef ferror +#undef fflush +#undef fgetc +#undef fgetpos +#undef fgets +#undef fopen +#undef fprintf +#undef fputc +#undef fputs +#undef fread +#undef freopen +#undef fscanf +#undef fseek +#undef fsetpos +#undef ftell +#undef fwrite +#undef getc +#undef getchar +#undef gets +#undef perror +#undef printf +#undef putc +#undef putchar +#undef puts +#undef remove +#undef rename +#undef rewind +#undef scanf +#undef setbuf +#undef setvbuf +#undef sprintf +#undef sscanf +#undef tmpfile +#undef tmpnam +#undef ungetc +#undef vfprintf +#undef vprintf +#undef vsprintf + +#endif diff --git a/libstdc++-v3/include/c/cstdlib b/libstdc++-v3/include/c/cstdlib new file mode 100644 index 00000000000..85f5bf76207 --- /dev/null +++ b/libstdc++-v3/include/c/cstdlib @@ -0,0 +1,41 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 20.4.6 C library +// + +#ifndef _GLIBCXX_CSTDLIB +#define _GLIBCXX_CSTDLIB 1 + +#pragma GCC system_header + +#include_next + +#endif diff --git a/libstdc++-v3/include/c/cstring b/libstdc++-v3/include/c/cstring new file mode 100644 index 00000000000..ed7719c317e --- /dev/null +++ b/libstdc++-v3/include/c/cstring @@ -0,0 +1,41 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 2000, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 20.4.6 C library +// + +#ifndef _GLIBCXX_CSTRING +#define _GLIBCXX_CSTRING 1 + +#pragma GCC system_header + +#include_next + +#endif diff --git a/libstdc++-v3/include/c/ctime b/libstdc++-v3/include/c/ctime new file mode 100644 index 00000000000..1d2bd3fd4e1 --- /dev/null +++ b/libstdc++-v3/include/c/ctime @@ -0,0 +1,41 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 20.5 Date and time +// + +#ifndef _GLIBCXX_CTIME +#define _GLIBCXX_CTIME 1 + +#pragma GCC system_header + +#include_next + +#endif diff --git a/libstdc++-v3/include/c/cwchar b/libstdc++-v3/include/c/cwchar new file mode 100644 index 00000000000..69576b5035b --- /dev/null +++ b/libstdc++-v3/include/c/cwchar @@ -0,0 +1,62 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 21.4 +// + +#ifndef _GLIBCXX_CWCHAR +#define _GLIBCXX_CWCHAR 1 + +#pragma GCC system_header + +#include +#include +#include + +#if _GLIBCXX_HAVE_WCHAR_H +#include_next +#endif + +// Need to do a bit of trickery here with mbstate_t as char_traits +// assumes it is in wchar.h, regardless of wchar_t specializations. +#ifndef _GLIBCXX_HAVE_MBSTATE_T +namespace std +{ + extern "C" + { + typedef struct + { + int __fill[6]; + } mbstate_t; + } +} +#endif + +#endif diff --git a/libstdc++-v3/include/c/cwctype b/libstdc++-v3/include/c/cwctype new file mode 100644 index 00000000000..a91676006e3 --- /dev/null +++ b/libstdc++-v3/include/c/cwctype @@ -0,0 +1,45 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: +// + +#ifndef _GLIBCXX_CWCTYPE +#define _GLIBCXX_CWCTYPE 1 + +#pragma GCC system_header + +#include + +#if _GLIBCXX_HAVE_WCTYPE_H +#include_next +#endif + +#endif diff --git a/libstdc++-v3/include/c/std_cassert.h b/libstdc++-v3/include/c/std_cassert.h deleted file mode 100644 index 873eeef6ba5..00000000000 --- a/libstdc++-v3/include/c/std_cassert.h +++ /dev/null @@ -1,38 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 2000, 2002 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -// -// ISO C++ 14882: 19.2 Assertions -// - -// No include guards on this header... - -#pragma GCC system_header - -#include_next diff --git a/libstdc++-v3/include/c/std_cctype.h b/libstdc++-v3/include/c/std_cctype.h deleted file mode 100644 index 103dd379bbe..00000000000 --- a/libstdc++-v3/include/c/std_cctype.h +++ /dev/null @@ -1,41 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -// -// ISO C++ 14882: -// - -#ifndef _GLIBCXX_CCTYPE -#define _GLIBCXX_CCTYPE 1 - -#pragma GCC system_header - -#include_next - -#endif diff --git a/libstdc++-v3/include/c/std_cerrno.h b/libstdc++-v3/include/c/std_cerrno.h deleted file mode 100644 index e27c3619dfd..00000000000 --- a/libstdc++-v3/include/c/std_cerrno.h +++ /dev/null @@ -1,55 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/** @file cerrno - * This is a Standard C++ Library file. You should @c #include this file - * in your programs, rather than any of the "*.h" implementation files. - * - * This is the C++ version of the Standard C Library header @c errno.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std. - */ - -// -// ISO C++ 14882: 19.3 Error numbers -// - -#ifndef _GLIBCXX_CERRNO -#define _GLIBCXX_CERRNO 1 - -#pragma GCC system_header - -#include_next - -// Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998 -#ifndef errno -#define errno errno -#endif - -#endif diff --git a/libstdc++-v3/include/c/std_cfloat.h b/libstdc++-v3/include/c/std_cfloat.h deleted file mode 100644 index 3cf6b9b0b97..00000000000 --- a/libstdc++-v3/include/c/std_cfloat.h +++ /dev/null @@ -1,41 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -// -// ISO C++ 14882: 18.2.2 Implementation properties: C library -// - -#ifndef _GLIBCXX_CFLOAT -#define _GLIBCXX_CFLOAT 1 - -#pragma GCC system_header - -#include_next - -#endif diff --git a/libstdc++-v3/include/c/std_ciso646.h b/libstdc++-v3/include/c/std_ciso646.h deleted file mode 100644 index 4ffd3bb1a9b..00000000000 --- a/libstdc++-v3/include/c/std_ciso646.h +++ /dev/null @@ -1,37 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 2001 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/** @file ciso646 - * This is a Standard C++ Library file. You should @c #include this file - * in your programs, rather than any of the "*.h" implementation files. - * - * This is the C++ version of the Standard C Library header @c iso646.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std. - */ diff --git a/libstdc++-v3/include/c/std_climits.h b/libstdc++-v3/include/c/std_climits.h deleted file mode 100644 index ca9db692e6d..00000000000 --- a/libstdc++-v3/include/c/std_climits.h +++ /dev/null @@ -1,41 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -// -// ISO C++ 14882: 18.2.2 Implementation properties: C library -// - -#ifndef _GLIBCXX_CLIMITS -#define _GLIBCXX_CLIMITS 1 - -#pragma GCC system_header - -#include_next - -#endif diff --git a/libstdc++-v3/include/c/std_clocale.h b/libstdc++-v3/include/c/std_clocale.h deleted file mode 100644 index 7642222b2e6..00000000000 --- a/libstdc++-v3/include/c/std_clocale.h +++ /dev/null @@ -1,41 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -// -// ISO C++ 14882: 18.2.2 Implementation properties: C library -// - -#ifndef _GLIBCXX_CLOCALE -#define _GLIBCXX_CLOCALE 1 - -#pragma GCC system_header - -#include_next - -#endif diff --git a/libstdc++-v3/include/c/std_cmath.h b/libstdc++-v3/include/c/std_cmath.h deleted file mode 100644 index 18c1fb2e5b2..00000000000 --- a/libstdc++-v3/include/c/std_cmath.h +++ /dev/null @@ -1,124 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -// -// ISO C++ 14882: 26.5 C library -// - -#ifndef _GLIBCXX_CMATH -#define _GLIBCXX_CMATH 1 - -#pragma GCC system_header - -#include - -#include_next - -// Get rid of those macros defined in in lieu of real functions. -#undef abs -#undef div -#undef acos -#undef asin -#undef atan -#undef atan2 -#undef ceil -#undef cos -#undef cosh -#undef exp -#undef fabs -#undef floor -#undef fmod -#undef frexp -#undef ldexp -#undef log -#undef log10 -#undef modf -#undef pow -#undef sin -#undef sinh -#undef sqrt -#undef tan -#undef tanh - -#undef fpclassify -#undef isfinite -#undef isinf -#undef isnan -#undef isnormal -#undef signbit -#undef isgreater -#undef isgreaterequal -#undef isless -#undef islessequal -#undef islessgreater -#undef isunordered - -namespace std -{ - inline double - abs(double __x) - { return __builtin_fabs(__x); } - - inline float - abs(float __x) - { return __builtin_fabsf(__x); } - - inline long double - abs(long double __x) - { return __builtin_fabsl(__x); } - -#if _GLIBCXX_HAVE_MODFF - inline float - modf(float __x, float* __iptr) { return modff(__x, __iptr); } -#else - inline float - modf(float __x, float* __iptr) - { - double __tmp; - double __res = modf(static_cast(__x), &__tmp); - *__iptr = static_cast(__tmp); - return __res; - } -#endif - -#if _GLIBCXX_HAVE_MODFL - inline long double - modf(long double __x, long double* __iptr) { return modfl(__x, __iptr); } -#else - inline long double - modf(long double __x, long double* __iptr) - { - double __tmp; - double __res = modf(static_cast(__x), &__tmp); - * __iptr = static_cast(__tmp); - return __res; - } -#endif -} -#endif diff --git a/libstdc++-v3/include/c/std_csetjmp.h b/libstdc++-v3/include/c/std_csetjmp.h deleted file mode 100644 index 1926bccfbba..00000000000 --- a/libstdc++-v3/include/c/std_csetjmp.h +++ /dev/null @@ -1,49 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -// -// ISO C++ 14882: 20.4.6 C library -// - -#ifndef _GLIBCXX_CSETJMP -#define _GLIBCXX_CSETJMP 1 - -#pragma GCC system_header - -#include_next - -// Get rid of those macros defined in in lieu of real functions. -#undef longjmp - -// Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998 -#ifndef setjmp -#define setjmp(env) std::setjmp (env) -#endif - -#endif diff --git a/libstdc++-v3/include/c/std_csignal.h b/libstdc++-v3/include/c/std_csignal.h deleted file mode 100644 index 37bacaecae6..00000000000 --- a/libstdc++-v3/include/c/std_csignal.h +++ /dev/null @@ -1,41 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -// -// ISO C++ 14882: 20.4.6 C library -// - -#ifndef _GLIBCXX_CSIGNAL -#define _GLIBCXX_CSIGNAL 1 - -#pragma GCC system_header - -#include_next - -#endif diff --git a/libstdc++-v3/include/c/std_cstdarg.h b/libstdc++-v3/include/c/std_cstdarg.h deleted file mode 100644 index 00aa001d43c..00000000000 --- a/libstdc++-v3/include/c/std_cstdarg.h +++ /dev/null @@ -1,42 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -// -// ISO C++ 14882: 20.4.6 C library -// - -#ifndef _GLIBCXX_CSTDARG -#define _GLIBCXX_CSTDARG 1 - -#pragma GCC system_header - -#undef __need___va_list -#include_next - -#endif diff --git a/libstdc++-v3/include/c/std_cstddef.h b/libstdc++-v3/include/c/std_cstddef.h deleted file mode 100644 index 33269af6ba0..00000000000 --- a/libstdc++-v3/include/c/std_cstddef.h +++ /dev/null @@ -1,45 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -// -// ISO C++ 14882: 18.1 Types -// - -#ifndef _GLIBCXX_CSTDDEF -#define _GLIBCXX_CSTDDEF 1 - -#pragma GCC system_header - -#define __need_size_t -#define __need_ptrdiff_t -#define __need_NULL -#define __need_offsetof -#include_next - -#endif diff --git a/libstdc++-v3/include/c/std_cstdio.h b/libstdc++-v3/include/c/std_cstdio.h deleted file mode 100644 index 5cb8bcfcf97..00000000000 --- a/libstdc++-v3/include/c/std_cstdio.h +++ /dev/null @@ -1,84 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -// -// ISO C++ 14882: 27.8.2 C Library files -// - -#ifndef _GLIBCXX_CSTDIO -#define _GLIBCXX_CSTDIO 1 - -#pragma GCC system_header - -#include_next - -// Get rid of those macros defined in in lieu of real functions. -#undef clearerr -#undef fclose -#undef feof -#undef ferror -#undef fflush -#undef fgetc -#undef fgetpos -#undef fgets -#undef fopen -#undef fprintf -#undef fputc -#undef fputs -#undef fread -#undef freopen -#undef fscanf -#undef fseek -#undef fsetpos -#undef ftell -#undef fwrite -#undef getc -#undef getchar -#undef gets -#undef perror -#undef printf -#undef putc -#undef putchar -#undef puts -#undef remove -#undef rename -#undef rewind -#undef scanf -#undef setbuf -#undef setvbuf -#undef sprintf -#undef sscanf -#undef tmpfile -#undef tmpnam -#undef ungetc -#undef vfprintf -#undef vprintf -#undef vsprintf - -#endif diff --git a/libstdc++-v3/include/c/std_cstdlib.h b/libstdc++-v3/include/c/std_cstdlib.h deleted file mode 100644 index 85f5bf76207..00000000000 --- a/libstdc++-v3/include/c/std_cstdlib.h +++ /dev/null @@ -1,41 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -// -// ISO C++ 14882: 20.4.6 C library -// - -#ifndef _GLIBCXX_CSTDLIB -#define _GLIBCXX_CSTDLIB 1 - -#pragma GCC system_header - -#include_next - -#endif diff --git a/libstdc++-v3/include/c/std_cstring.h b/libstdc++-v3/include/c/std_cstring.h deleted file mode 100644 index ed7719c317e..00000000000 --- a/libstdc++-v3/include/c/std_cstring.h +++ /dev/null @@ -1,41 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 2000, 2002 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -// -// ISO C++ 14882: 20.4.6 C library -// - -#ifndef _GLIBCXX_CSTRING -#define _GLIBCXX_CSTRING 1 - -#pragma GCC system_header - -#include_next - -#endif diff --git a/libstdc++-v3/include/c/std_ctime.h b/libstdc++-v3/include/c/std_ctime.h deleted file mode 100644 index 1d2bd3fd4e1..00000000000 --- a/libstdc++-v3/include/c/std_ctime.h +++ /dev/null @@ -1,41 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -// -// ISO C++ 14882: 20.5 Date and time -// - -#ifndef _GLIBCXX_CTIME -#define _GLIBCXX_CTIME 1 - -#pragma GCC system_header - -#include_next - -#endif diff --git a/libstdc++-v3/include/c/std_cwchar.h b/libstdc++-v3/include/c/std_cwchar.h deleted file mode 100644 index 69576b5035b..00000000000 --- a/libstdc++-v3/include/c/std_cwchar.h +++ /dev/null @@ -1,62 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -// -// ISO C++ 14882: 21.4 -// - -#ifndef _GLIBCXX_CWCHAR -#define _GLIBCXX_CWCHAR 1 - -#pragma GCC system_header - -#include -#include -#include - -#if _GLIBCXX_HAVE_WCHAR_H -#include_next -#endif - -// Need to do a bit of trickery here with mbstate_t as char_traits -// assumes it is in wchar.h, regardless of wchar_t specializations. -#ifndef _GLIBCXX_HAVE_MBSTATE_T -namespace std -{ - extern "C" - { - typedef struct - { - int __fill[6]; - } mbstate_t; - } -} -#endif - -#endif diff --git a/libstdc++-v3/include/c/std_cwctype.h b/libstdc++-v3/include/c/std_cwctype.h deleted file mode 100644 index a91676006e3..00000000000 --- a/libstdc++-v3/include/c/std_cwctype.h +++ /dev/null @@ -1,45 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -// -// ISO C++ 14882: -// - -#ifndef _GLIBCXX_CWCTYPE -#define _GLIBCXX_CWCTYPE 1 - -#pragma GCC system_header - -#include - -#if _GLIBCXX_HAVE_WCTYPE_H -#include_next -#endif - -#endif diff --git a/libstdc++-v3/include/c_std/cassert b/libstdc++-v3/include/c_std/cassert new file mode 100644 index 00000000000..0e5c77a082d --- /dev/null +++ b/libstdc++-v3/include/c_std/cassert @@ -0,0 +1,49 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file cassert + * This is a Standard C++ Library file. You should @c #include this file + * in your programs, rather than any of the "*.h" implementation files. + * + * This is the C++ version of the Standard C Library header @c assert.h, + * and its contents are (mostly) the same as that header, but are all + * contained in the namespace @c std (except for names which are defined + * as macros in C). + */ + +// +// ISO C++ 14882: 19.2 Assertions +// + +// No include guards on this header... + +#pragma GCC system_header + +#include diff --git a/libstdc++-v3/include/c_std/cctype b/libstdc++-v3/include/c_std/cctype new file mode 100644 index 00000000000..61a55cb73a4 --- /dev/null +++ b/libstdc++-v3/include/c_std/cctype @@ -0,0 +1,86 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file include/cctype + * This is a Standard C++ Library file. You should @c #include this file + * in your programs, rather than any of the "*.h" implementation files. + * + * This is the C++ version of the Standard C Library header @c ctype.h, + * and its contents are (mostly) the same as that header, but are all + * contained in the namespace @c std (except for names which are defined + * as macros in C). + */ + +// +// ISO C++ 14882: +// + +#ifndef _GLIBCXX_CCTYPE +#define _GLIBCXX_CCTYPE 1 + +#pragma GCC system_header + +#include +#include + +// Get rid of those macros defined in in lieu of real functions. +#undef isalnum +#undef isalpha +#undef iscntrl +#undef isdigit +#undef isgraph +#undef islower +#undef isprint +#undef ispunct +#undef isspace +#undef isupper +#undef isxdigit +#undef tolower +#undef toupper + +_GLIBCXX_BEGIN_NAMESPACE(std) + + using ::isalnum; + using ::isalpha; + using ::iscntrl; + using ::isdigit; + using ::isgraph; + using ::islower; + using ::isprint; + using ::ispunct; + using ::isspace; + using ::isupper; + using ::isxdigit; + using ::tolower; + using ::toupper; + +_GLIBCXX_END_NAMESPACE + +#endif diff --git a/libstdc++-v3/include/c_std/cerrno b/libstdc++-v3/include/c_std/cerrno new file mode 100644 index 00000000000..e597b8fbd73 --- /dev/null +++ b/libstdc++-v3/include/c_std/cerrno @@ -0,0 +1,57 @@ +// The -*- C++ -*- forwarding header. + +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file cerrno + * This is a Standard C++ Library file. You should @c #include this file + * in your programs, rather than any of the "*.h" implementation files. + * + * This is the C++ version of the Standard C Library header @c errno.h, + * and its contents are (mostly) the same as that header, but are all + * contained in the namespace @c std (except for names which are defined + * as macros in C). + */ + +// +// ISO C++ 14882: 19.3 Error numbers +// + +#ifndef _GLIBCXX_CERRNO +#define _GLIBCXX_CERRNO 1 + +#pragma GCC system_header + +#include + +// Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998 +#ifndef errno +#define errno errno +#endif + +#endif diff --git a/libstdc++-v3/include/c_std/cfloat b/libstdc++-v3/include/c_std/cfloat new file mode 100644 index 00000000000..2b514491cf8 --- /dev/null +++ b/libstdc++-v3/include/c_std/cfloat @@ -0,0 +1,52 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file include/cfloat + * This is a Standard C++ Library file. You should @c #include this file + * in your programs, rather than any of the "*.h" implementation files. + * + * This is the C++ version of the Standard C Library header @c float.h, + * and its contents are (mostly) the same as that header, but are all + * contained in the namespace @c std (except for names which are defined + * as macros in C). + */ + +// +// ISO C++ 14882: 18.2.2 Implementation properties: C library +// + +#ifndef _GLIBCXX_CFLOAT +#define _GLIBCXX_CFLOAT 1 + +#pragma GCC system_header + +#include + +#endif diff --git a/libstdc++-v3/include/c_std/ciso646 b/libstdc++-v3/include/c_std/ciso646 new file mode 100644 index 00000000000..3e391b41030 --- /dev/null +++ b/libstdc++-v3/include/c_std/ciso646 @@ -0,0 +1,38 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file ciso646 + * This is a Standard C++ Library file. You should @c #include this file + * in your programs, rather than any of the "*.h" implementation files. + * + * This is the C++ version of the Standard C Library header @c iso646.h, + * and its contents are (mostly) the same as that header, but are all + * contained in the namespace @c std (except for names which are defined + * as macros in C). + */ diff --git a/libstdc++-v3/include/c_std/climits b/libstdc++-v3/include/c_std/climits new file mode 100644 index 00000000000..e85869f0679 --- /dev/null +++ b/libstdc++-v3/include/c_std/climits @@ -0,0 +1,52 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file include/climits + * This is a Standard C++ Library file. You should @c #include this file + * in your programs, rather than any of the "*.h" implementation files. + * + * This is the C++ version of the Standard C Library header @c limits.h, + * and its contents are (mostly) the same as that header, but are all + * contained in the namespace @c std (except for names which are defined + * as macros in C). + */ + +// +// ISO C++ 14882: 18.2.2 Implementation properties: C library +// + +#ifndef _GLIBCXX_CLIMITS +#define _GLIBCXX_CLIMITS 1 + +#pragma GCC system_header + +#include + +#endif diff --git a/libstdc++-v3/include/c_std/clocale b/libstdc++-v3/include/c_std/clocale new file mode 100644 index 00000000000..51e6440bfee --- /dev/null +++ b/libstdc++-v3/include/c_std/clocale @@ -0,0 +1,65 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file clocale + * This is a Standard C++ Library file. You should @c #include this file + * in your programs, rather than any of the "*.h" implementation files. + * + * This is the C++ version of the Standard C Library header @c locale.h, + * and its contents are (mostly) the same as that header, but are all + * contained in the namespace @c std (except for names which are defined + * as macros in C). + */ + +// +// ISO C++ 14882: 18.2.2 Implementation properties: C library +// + +#ifndef _GLIBCXX_CLOCALE +#define _GLIBCXX_CLOCALE 1 + +#pragma GCC system_header + +#include +#include + +// Get rid of those macros defined in in lieu of real functions. +#undef setlocale +#undef localeconv + +_GLIBCXX_BEGIN_NAMESPACE(std) + + using ::lconv; + using ::setlocale; + using ::localeconv; + +_GLIBCXX_END_NAMESPACE + +#endif diff --git a/libstdc++-v3/include/c_std/cmath b/libstdc++-v3/include/c_std/cmath new file mode 100644 index 00000000000..897290ac089 --- /dev/null +++ b/libstdc++-v3/include/c_std/cmath @@ -0,0 +1,600 @@ +// -*- C++ -*- C forwarding header. + +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file include/cmath + * This is a Standard C++ Library file. You should @c #include this file + * in your programs, rather than any of the "*.h" implementation files. + * + * This is the C++ version of the Standard C Library header @c math.h, + * and its contents are (mostly) the same as that header, but are all + * contained in the namespace @c std (except for names which are defined + * as macros in C). + */ + +// +// ISO C++ 14882: 26.5 C library +// + +#ifndef _GLIBCXX_CMATH +#define _GLIBCXX_CMATH 1 + +#pragma GCC system_header + +#include +#include +#include + +#include + +// Get rid of those macros defined in in lieu of real functions. +#undef abs +#undef div +#undef acos +#undef asin +#undef atan +#undef atan2 +#undef ceil +#undef cos +#undef cosh +#undef exp +#undef fabs +#undef floor +#undef fmod +#undef frexp +#undef ldexp +#undef log +#undef log10 +#undef modf +#undef pow +#undef sin +#undef sinh +#undef sqrt +#undef tan +#undef tanh + +_GLIBCXX_BEGIN_NAMESPACE(std) + + // Forward declaration of a helper function. This really should be + // an `exported' forward declaration. + template _Tp __cmath_power(_Tp, unsigned int); + + inline double + abs(double __x) + { return __builtin_fabs(__x); } + + inline float + abs(float __x) + { return __builtin_fabsf(__x); } + + inline long double + abs(long double __x) + { return __builtin_fabsl(__x); } + + using ::acos; + + inline float + acos(float __x) + { return __builtin_acosf(__x); } + + inline long double + acos(long double __x) + { return __builtin_acosl(__x); } + + template + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type + acos(_Tp __x) + { return __builtin_acos(__x); } + + using ::asin; + + inline float + asin(float __x) + { return __builtin_asinf(__x); } + + inline long double + asin(long double __x) + { return __builtin_asinl(__x); } + + template + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type + asin(_Tp __x) + { return __builtin_asin(__x); } + + using ::atan; + + inline float + atan(float __x) + { return __builtin_atanf(__x); } + + inline long double + atan(long double __x) + { return __builtin_atanl(__x); } + + template + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type + atan(_Tp __x) + { return __builtin_atan(__x); } + + using ::atan2; + + inline float + atan2(float __y, float __x) + { return __builtin_atan2f(__y, __x); } + + inline long double + atan2(long double __y, long double __x) + { return __builtin_atan2l(__y, __x); } + + template + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value + && __is_integer<_Up>::__value, + double>::__type + atan2(_Tp __y, _Up __x) + { return __builtin_atan2(__y, __x); } + + using ::ceil; + + inline float + ceil(float __x) + { return __builtin_ceilf(__x); } + + inline long double + ceil(long double __x) + { return __builtin_ceill(__x); } + + template + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type + ceil(_Tp __x) + { return __builtin_ceil(__x); } + + using ::cos; + + inline float + cos(float __x) + { return __builtin_cosf(__x); } + + inline long double + cos(long double __x) + { return __builtin_cosl(__x); } + + template + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type + cos(_Tp __x) + { return __builtin_cos(__x); } + + using ::cosh; + + inline float + cosh(float __x) + { return __builtin_coshf(__x); } + + inline long double + cosh(long double __x) + { return __builtin_coshl(__x); } + + template + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type + cosh(_Tp __x) + { return __builtin_cosh(__x); } + + using ::exp; + + inline float + exp(float __x) + { return __builtin_expf(__x); } + + inline long double + exp(long double __x) + { return __builtin_expl(__x); } + + template + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type + exp(_Tp __x) + { return __builtin_exp(__x); } + + using ::fabs; + + inline float + fabs(float __x) + { return __builtin_fabsf(__x); } + + inline long double + fabs(long double __x) + { return __builtin_fabsl(__x); } + + template + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type + fabs(_Tp __x) + { return __builtin_fabs(__x); } + + using ::floor; + + inline float + floor(float __x) + { return __builtin_floorf(__x); } + + inline long double + floor(long double __x) + { return __builtin_floorl(__x); } + + template + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type + floor(_Tp __x) + { return __builtin_floor(__x); } + + using ::fmod; + + inline float + fmod(float __x, float __y) + { return __builtin_fmodf(__x, __y); } + + inline long double + fmod(long double __x, long double __y) + { return __builtin_fmodl(__x, __y); } + + using ::frexp; + + inline float + frexp(float __x, int* __exp) + { return __builtin_frexpf(__x, __exp); } + + inline long double + frexp(long double __x, int* __exp) + { return __builtin_frexpl(__x, __exp); } + + template + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type + frexp(_Tp __x, int* __exp) + { return __builtin_frexp(__x, __exp); } + + using ::ldexp; + + inline float + ldexp(float __x, int __exp) + { return __builtin_ldexpf(__x, __exp); } + + inline long double + ldexp(long double __x, int __exp) + { return __builtin_ldexpl(__x, __exp); } + + template + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type + ldexp(_Tp __x, int __exp) + { return __builtin_ldexp(__x, __exp); } + + using ::log; + + inline float + log(float __x) + { return __builtin_logf(__x); } + + inline long double + log(long double __x) + { return __builtin_logl(__x); } + + template + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type + log(_Tp __x) + { return __builtin_log(__x); } + + using ::log10; + + inline float + log10(float __x) + { return __builtin_log10f(__x); } + + inline long double + log10(long double __x) + { return __builtin_log10l(__x); } + + template + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type + log10(_Tp __x) + { return __builtin_log10(__x); } + + using ::modf; + + inline float + modf(float __x, float* __iptr) + { return __builtin_modff(__x, __iptr); } + + inline long double + modf(long double __x, long double* __iptr) + { return __builtin_modfl(__x, __iptr); } + + template + inline _Tp + __pow_helper(_Tp __x, int __n) + { + return __n < 0 + ? _Tp(1)/__cmath_power(__x, -__n) + : __cmath_power(__x, __n); + } + + using ::pow; + + inline float + pow(float __x, float __y) + { return __builtin_powf(__x, __y); } + + inline long double + pow(long double __x, long double __y) + { return __builtin_powl(__x, __y); } + + inline double + pow(double __x, int __i) + { return __builtin_powi(__x, __i); } + + inline float + pow(float __x, int __n) + { return __builtin_powif(__x, __n); } + + inline long double + pow(long double __x, int __n) + { return __builtin_powil(__x, __n); } + + using ::sin; + + inline float + sin(float __x) + { return __builtin_sinf(__x); } + + inline long double + sin(long double __x) + { return __builtin_sinl(__x); } + + template + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type + sin(_Tp __x) + { return __builtin_sin(__x); } + + using ::sinh; + + inline float + sinh(float __x) + { return __builtin_sinhf(__x); } + + inline long double + sinh(long double __x) + { return __builtin_sinhl(__x); } + + template + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type + sinh(_Tp __x) + { return __builtin_sinh(__x); } + + using ::sqrt; + + inline float + sqrt(float __x) + { return __builtin_sqrtf(__x); } + + inline long double + sqrt(long double __x) + { return __builtin_sqrtl(__x); } + + template + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type + sqrt(_Tp __x) + { return __builtin_sqrt(__x); } + + using ::tan; + + inline float + tan(float __x) + { return __builtin_tanf(__x); } + + inline long double + tan(long double __x) + { return __builtin_tanl(__x); } + + template + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type + tan(_Tp __x) + { return __builtin_tan(__x); } + + using ::tanh; + + inline float + tanh(float __x) + { return __builtin_tanhf(__x); } + + inline long double + tanh(long double __x) + { return __builtin_tanhl(__x); } + + template + inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, + double>::__type + tanh(_Tp __x) + { return __builtin_tanh(__x); } + +_GLIBCXX_END_NAMESPACE + +#if _GLIBCXX_USE_C99_MATH +#if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC +// These are possible macros imported from C99-land. For strict +// conformance, remove possible C99-injected names from the global +// namespace, and sequester them in the __gnu_cxx extension namespace. + +_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) + + template + inline int + __capture_fpclassify(_Tp __f) { return fpclassify(__f); } + + template + inline int + __capture_isfinite(_Tp __f) { return isfinite(__f); } + + template + inline int + __capture_isinf(_Tp __f) { return isinf(__f); } + + template + inline int + __capture_isnan(_Tp __f) { return isnan(__f); } + + template + inline int + __capture_isnormal(_Tp __f) { return isnormal(__f); } + + template + inline int + __capture_signbit(_Tp __f) { return signbit(__f); } + + template + inline int + __capture_isgreater(_Tp __f1, _Tp __f2) + { return isgreater(__f1, __f2); } + + template + inline int + __capture_isgreaterequal(_Tp __f1, _Tp __f2) + { return isgreaterequal(__f1, __f2); } + + template + inline int + __capture_isless(_Tp __f1, _Tp __f2) { return isless(__f1, __f2); } + + template + inline int + __capture_islessequal(_Tp __f1, _Tp __f2) + { return islessequal(__f1, __f2); } + + template + inline int + __capture_islessgreater(_Tp __f1, _Tp __f2) + { return islessgreater(__f1, __f2); } + + template + inline int + __capture_isunordered(_Tp __f1, _Tp __f2) + { return isunordered(__f1, __f2); } + +_GLIBCXX_END_NAMESPACE + +// Only undefine the C99 FP macros, if actually captured for namespace movement +#undef fpclassify +#undef isfinite +#undef isinf +#undef isnan +#undef isnormal +#undef signbit +#undef isgreater +#undef isgreaterequal +#undef isless +#undef islessequal +#undef islessgreater +#undef isunordered + +_GLIBCXX_BEGIN_NAMESPACE(std) + + template + inline int + fpclassify(_Tp __f) { return ::__gnu_cxx::__capture_fpclassify(__f); } + + template + inline int + isfinite(_Tp __f) { return ::__gnu_cxx::__capture_isfinite(__f); } + + template + inline int + isinf(_Tp __f) { return ::__gnu_cxx::__capture_isinf(__f); } + + template + inline int + isnan(_Tp __f) { return ::__gnu_cxx::__capture_isnan(__f); } + + template + inline int + isnormal(_Tp __f) { return ::__gnu_cxx::__capture_isnormal(__f); } + + template + inline int + signbit(_Tp __f) { return ::__gnu_cxx::__capture_signbit(__f); } + + template + inline int + isgreater(_Tp __f1, _Tp __f2) + { return ::__gnu_cxx::__capture_isgreater(__f1, __f2); } + + template + inline int + isgreaterequal(_Tp __f1, _Tp __f2) + { return ::__gnu_cxx::__capture_isgreaterequal(__f1, __f2); } + + template + inline int + isless(_Tp __f1, _Tp __f2) + { return ::__gnu_cxx::__capture_isless(__f1, __f2); } + + template + inline int + islessequal(_Tp __f1, _Tp __f2) + { return ::__gnu_cxx::__capture_islessequal(__f1, __f2); } + + template + inline int + islessgreater(_Tp __f1, _Tp __f2) + { return ::__gnu_cxx::__capture_islessgreater(__f1, __f2); } + + template + inline int + isunordered(_Tp __f1, _Tp __f2) + { return ::__gnu_cxx::__capture_isunordered(__f1, __f2); } + +_GLIBCXX_END_NAMESPACE + +#endif /* _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC */ +#endif + +#ifndef _GLIBCXX_EXPORT_TEMPLATE +# include +#endif + +#endif diff --git a/libstdc++-v3/include/c_std/csetjmp b/libstdc++-v3/include/c_std/csetjmp new file mode 100644 index 00000000000..946e7e3c032 --- /dev/null +++ b/libstdc++-v3/include/c_std/csetjmp @@ -0,0 +1,68 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file csetjmp + * This is a Standard C++ Library file. You should @c #include this file + * in your programs, rather than any of the "*.h" implementation files. + * + * This is the C++ version of the Standard C Library header @c setjmp.h, + * and its contents are (mostly) the same as that header, but are all + * contained in the namespace @c std (except for names which are defined + * as macros in C). + */ + +// +// ISO C++ 14882: 20.4.6 C library +// + +#ifndef _GLIBCXX_CSETJMP +#define _GLIBCXX_CSETJMP 1 + +#pragma GCC system_header + +#include +#include + +// Get rid of those macros defined in in lieu of real functions. +#undef longjmp + +// Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998 +#ifndef setjmp +#define setjmp(env) setjmp (env) +#endif + +_GLIBCXX_BEGIN_NAMESPACE(std) + + using ::jmp_buf; + using ::longjmp; + +_GLIBCXX_END_NAMESPACE + +#endif diff --git a/libstdc++-v3/include/c_std/csignal b/libstdc++-v3/include/c_std/csignal new file mode 100644 index 00000000000..0ce5e2f77db --- /dev/null +++ b/libstdc++-v3/include/c_std/csignal @@ -0,0 +1,64 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file csignal + * This is a Standard C++ Library file. You should @c #include this file + * in your programs, rather than any of the "*.h" implementation files. + * + * This is the C++ version of the Standard C Library header @c signal.h, + * and its contents are (mostly) the same as that header, but are all + * contained in the namespace @c std (except for names which are defined + * as macros in C). + */ + +// +// ISO C++ 14882: 20.4.6 C library +// + +#ifndef _GLIBCXX_CSIGNAL +#define _GLIBCXX_CSIGNAL 1 + +#pragma GCC system_header + +#include +#include + +// Get rid of those macros defined in in lieu of real functions. +#undef raise + +_GLIBCXX_BEGIN_NAMESPACE(std) + + using ::sig_atomic_t; + using ::signal; + using ::raise; + +_GLIBCXX_END_NAMESPACE + +#endif diff --git a/libstdc++-v3/include/c_std/cstdarg b/libstdc++-v3/include/c_std/cstdarg new file mode 100644 index 00000000000..53c29c843a2 --- /dev/null +++ b/libstdc++-v3/include/c_std/cstdarg @@ -0,0 +1,64 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file include/cstdarg + * This is a Standard C++ Library file. You should @c #include this file + * in your programs, rather than any of the "*.h" implementation files. + * + * This is the C++ version of the Standard C Library header @c stdarg.h, + * and its contents are (mostly) the same as that header, but are all + * contained in the namespace @c std (except for names which are defined + * as macros in C). + */ + +// +// ISO C++ 14882: 20.4.6 C library +// + +#ifndef _GLIBCXX_CSTDARG +#define _GLIBCXX_CSTDARG 1 + +#pragma GCC system_header + +#include +#include + +// Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998 +#ifndef va_end +#define va_end(ap) va_end (ap) +#endif + +_GLIBCXX_BEGIN_NAMESPACE(std) + + using ::va_list; + +_GLIBCXX_END_NAMESPACE + +#endif diff --git a/libstdc++-v3/include/c_std/cstddef b/libstdc++-v3/include/c_std/cstddef new file mode 100644 index 00000000000..bfa8388d563 --- /dev/null +++ b/libstdc++-v3/include/c_std/cstddef @@ -0,0 +1,60 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file cstddef + * This is a Standard C++ Library file. You should @c #include this file + * in your programs, rather than any of the "*.h" implementation files. + * + * This is the C++ version of the Standard C Library header @c stddef.h, + * and its contents are (mostly) the same as that header, but are all + * contained in the namespace @c std (except for names which are defined + * as macros in C). + */ + +// +// ISO C++ 14882: 18.1 Types +// + +#ifndef _GLIBCXX_CSTDDEF +#define _GLIBCXX_CSTDDEF 1 + +#pragma GCC system_header + +#include +#include + +_GLIBCXX_BEGIN_NAMESPACE(std) + + using ::ptrdiff_t; + using ::size_t; + +_GLIBCXX_END_NAMESPACE + +#endif diff --git a/libstdc++-v3/include/c_std/cstdio b/libstdc++-v3/include/c_std/cstdio new file mode 100644 index 00000000000..3935ef4f17e --- /dev/null +++ b/libstdc++-v3/include/c_std/cstdio @@ -0,0 +1,191 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file include/cstdio + * This is a Standard C++ Library file. You should @c #include this file + * in your programs, rather than any of the "*.h" implementation files. + * + * This is the C++ version of the Standard C Library header @c stdio.h, + * and its contents are (mostly) the same as that header, but are all + * contained in the namespace @c std (except for names which are defined + * as macros in C). + */ + +// +// ISO C++ 14882: 27.8.2 C Library files +// + +#ifndef _GLIBCXX_CSTDIO +#define _GLIBCXX_CSTDIO 1 + +#pragma GCC system_header + +#include +#include + +#include + +// Get rid of those macros defined in in lieu of real functions. +#undef clearerr +#undef fclose +#undef feof +#undef ferror +#undef fflush +#undef fgetc +#undef fgetpos +#undef fgets +#undef fopen +#undef fprintf +#undef fputc +#undef fputs +#undef fread +#undef freopen +#undef fscanf +#undef fseek +#undef fsetpos +#undef ftell +#undef fwrite +#undef getc +#undef getchar +#undef gets +#undef perror +#undef printf +#undef putc +#undef putchar +#undef puts +#undef remove +#undef rename +#undef rewind +#undef scanf +#undef setbuf +#undef setvbuf +#undef sprintf +#undef sscanf +#undef tmpfile +#undef tmpnam +#undef ungetc +#undef vfprintf +#undef vprintf +#undef vsprintf + +_GLIBCXX_BEGIN_NAMESPACE(std) + + using ::FILE; + using ::fpos_t; + + using ::clearerr; + using ::fclose; + using ::feof; + using ::ferror; + using ::fflush; + using ::fgetc; + using ::fgetpos; + using ::fgets; + using ::fopen; + using ::fprintf; + using ::fputc; + using ::fputs; + using ::fread; + using ::freopen; + using ::fscanf; + using ::fseek; + using ::fsetpos; + using ::ftell; + using ::fwrite; + using ::getc; + using ::getchar; + using ::gets; + using ::perror; + using ::printf; + using ::putc; + using ::putchar; + using ::puts; + using ::remove; + using ::rename; + using ::rewind; + using ::scanf; + using ::setbuf; + using ::setvbuf; + using ::sprintf; + using ::sscanf; + using ::tmpfile; + using ::tmpnam; + using ::ungetc; + using ::vfprintf; + using ::vprintf; + using ::vsprintf; + +_GLIBCXX_END_NAMESPACE + +#if _GLIBCXX_USE_C99 + +#undef snprintf +#undef vfscanf +#undef vscanf +#undef vsnprintf +#undef vsscanf + +_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) + +#if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC + extern "C" int + (snprintf)(char * restrict, size_t, const char * restrict, ...); + extern "C" int + (vfscanf)(FILE * restrict, const char * restrict, __gnuc_va_list); + extern "C" int (vscanf)(const char * restrict, __gnuc_va_list); + extern "C" int + (vsnprintf)(char * restrict, size_t, const char * restrict, __gnuc_va_list); + extern "C" int + (vsscanf)(const char * restrict, const char * restrict, __gnuc_va_list); +#endif + +#if !_GLIBCXX_USE_C99_DYNAMIC + using ::snprintf; + using ::vfscanf; + using ::vscanf; + using ::vsnprintf; + using ::vsscanf; +#endif + +_GLIBCXX_END_NAMESPACE + +_GLIBCXX_BEGIN_NAMESPACE(std) + + using ::__gnu_cxx::snprintf; + using ::__gnu_cxx::vfscanf; + using ::__gnu_cxx::vscanf; + using ::__gnu_cxx::vsnprintf; + using ::__gnu_cxx::vsscanf; + +_GLIBCXX_END_NAMESPACE + +#endif + +#endif diff --git a/libstdc++-v3/include/c_std/cstdlib b/libstdc++-v3/include/c_std/cstdlib new file mode 100644 index 00000000000..5c3d586c0e6 --- /dev/null +++ b/libstdc++-v3/include/c_std/cstdlib @@ -0,0 +1,227 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file include/cstdlib + * This is a Standard C++ Library file. You should @c #include this file + * in your programs, rather than any of the "*.h" implementation files. + * + * This is the C++ version of the Standard C Library header @c stdlib.h, + * and its contents are (mostly) the same as that header, but are all + * contained in the namespace @c std (except for names which are defined + * as macros in C). + */ + +// +// ISO C++ 14882: 20.4.6 C library +// + +#ifndef _GLIBCXX_CSTDLIB +#define _GLIBCXX_CSTDLIB 1 + +#pragma GCC system_header + +#include +#include + +#if !_GLIBCXX_HOSTED +// The C standard does not require a freestanding implementation to +// provide . However, the C++ standard does still require +// -- but only the functionality mentioned in +// [lib.support.start.term]. + +#define EXIT_SUCCESS 0 +#define EXIT_FAILURE 1 + +_GLIBCXX_BEGIN_NAMESPACE(std) + + extern "C" void abort(void); + extern "C" int atexit(void (*)()); + extern "C" void exit(int); + +_GLIBCXX_END_NAMESPACE + +#else + +#include + +// Get rid of those macros defined in in lieu of real functions. +#undef abort +#undef abs +#undef atexit +#undef atof +#undef atoi +#undef atol +#undef bsearch +#undef calloc +#undef div +#undef exit +#undef free +#undef getenv +#undef labs +#undef ldiv +#undef malloc +#undef mblen +#undef mbstowcs +#undef mbtowc +#undef qsort +#undef rand +#undef realloc +#undef srand +#undef strtod +#undef strtol +#undef strtoul +#undef system +#undef wcstombs +#undef wctomb + +_GLIBCXX_BEGIN_NAMESPACE(std) + + using ::div_t; + using ::ldiv_t; + + using ::abort; + using ::abs; + using ::atexit; + using ::atof; + using ::atoi; + using ::atol; + using ::bsearch; + using ::calloc; + using ::div; + using ::exit; + using ::free; + using ::getenv; + using ::labs; + using ::ldiv; + using ::malloc; +#ifdef _GLIBCXX_HAVE_MBSTATE_T + using ::mblen; + using ::mbstowcs; + using ::mbtowc; +#endif // _GLIBCXX_HAVE_MBSTATE_T + using ::qsort; + using ::rand; + using ::realloc; + using ::srand; + using ::strtod; + using ::strtol; + using ::strtoul; + using ::system; +#ifdef _GLIBCXX_USE_WCHAR_T + using ::wcstombs; + using ::wctomb; +#endif // _GLIBCXX_USE_WCHAR_T + + inline long + abs(long __i) { return labs(__i); } + + inline ldiv_t + div(long __i, long __j) { return ldiv(__i, __j); } + +_GLIBCXX_END_NAMESPACE + +#if _GLIBCXX_USE_C99 + +#undef _Exit +#undef llabs +#undef lldiv +#undef atoll +#undef strtoll +#undef strtoull +#undef strtof +#undef strtold + +_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) + +#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC + using ::lldiv_t; +#endif +#if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC + extern "C" void (_Exit)(int); +#endif +#if !_GLIBCXX_USE_C99_DYNAMIC + using ::_Exit; +#endif + + inline long long + abs(long long __x) { return __x >= 0 ? __x : -__x; } + +#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC + using ::llabs; + + inline lldiv_t + div(long long __n, long long __d) + { lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; } + + using ::lldiv; +#endif + +#if _GLIBCXX_USE_C99_LONG_LONG_CHECK || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC + extern "C" long long int (atoll)(const char *); + extern "C" long long int + (strtoll)(const char * restrict, char ** restrict, int); + extern "C" unsigned long long int + (strtoull)(const char * restrict, char ** restrict, int); +#endif +#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC + using ::atoll; + using ::strtoll; + using ::strtoull; +#endif + using ::strtof; + using ::strtold; + +_GLIBCXX_END_NAMESPACE + +_GLIBCXX_BEGIN_NAMESPACE(std) + +#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC + using ::__gnu_cxx::lldiv_t; +#endif + using ::__gnu_cxx::_Exit; + using ::__gnu_cxx::abs; +#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC + using ::__gnu_cxx::llabs; + using ::__gnu_cxx::div; + using ::__gnu_cxx::lldiv; +#endif + using ::__gnu_cxx::atoll; + using ::__gnu_cxx::strtof; + using ::__gnu_cxx::strtoll; + using ::__gnu_cxx::strtoull; + using ::__gnu_cxx::strtold; + +_GLIBCXX_END_NAMESPACE + +#endif // _GLIBCXX_USE_C99 + +#endif // !_GLIBCXX_HOSTED + +#endif diff --git a/libstdc++-v3/include/c_std/cstring b/libstdc++-v3/include/c_std/cstring new file mode 100644 index 00000000000..5fef6b0086e --- /dev/null +++ b/libstdc++-v3/include/c_std/cstring @@ -0,0 +1,130 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file cstring + * This is a Standard C++ Library file. You should @c #include this file + * in your programs, rather than any of the "*.h" implementation files. + * + * This is the C++ version of the Standard C Library header @c string.h, + * and its contents are (mostly) the same as that header, but are all + * contained in the namespace @c std (except for names which are defined + * as macros in C). + */ + +// +// ISO C++ 14882: 20.4.6 C library +// + +#ifndef _GLIBCXX_CSTRING +#define _GLIBCXX_CSTRING 1 + +#pragma GCC system_header + +#include +#include +#include + +// Get rid of those macros defined in in lieu of real functions. +#undef memcpy +#undef memmove +#undef strcpy +#undef strncpy +#undef strcat +#undef strncat +#undef memcmp +#undef strcmp +#undef strcoll +#undef strncmp +#undef strxfrm +#undef memchr +#undef strchr +#undef strcspn +#undef strpbrk +#undef strrchr +#undef strspn +#undef strstr +#undef strtok +#undef memset +#undef strerror +#undef strlen + +_GLIBCXX_BEGIN_NAMESPACE(std) + + using ::memcpy; + using ::memmove; + using ::strcpy; + using ::strncpy; + using ::strcat; + using ::strncat; + using ::memcmp; + using ::strcmp; + using ::strcoll; + using ::strncmp; + using ::strxfrm; + using ::strcspn; + using ::strspn; + using ::strtok; + using ::memset; + using ::strerror; + using ::strlen; + + using ::memchr; + + inline void* + memchr(void* __p, int __c, size_t __n) + { return memchr(const_cast(__p), __c, __n); } + + using ::strchr; + + inline char* + strchr(char* __s1, int __n) + { return __builtin_strchr(const_cast(__s1), __n); } + + using ::strpbrk; + + inline char* + strpbrk(char* __s1, const char* __s2) + { return __builtin_strpbrk(const_cast(__s1), __s2); } + + using ::strrchr; + + inline char* + strrchr(char* __s1, int __n) + { return __builtin_strrchr(const_cast(__s1), __n); } + + using ::strstr; + + inline char* + strstr(char* __s1, const char* __s2) + { return __builtin_strstr(const_cast(__s1), __s2); } + +_GLIBCXX_END_NAMESPACE + +#endif diff --git a/libstdc++-v3/include/c_std/ctime b/libstdc++-v3/include/c_std/ctime new file mode 100644 index 00000000000..9f7f15c7979 --- /dev/null +++ b/libstdc++-v3/include/c_std/ctime @@ -0,0 +1,82 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file include/ctime + * This is a Standard C++ Library file. You should @c #include this file + * in your programs, rather than any of the "*.h" implementation files. + * + * This is the C++ version of the Standard C Library header @c time.h, + * and its contents are (mostly) the same as that header, but are all + * contained in the namespace @c std (except for names which are defined + * as macros in C). + */ + +// +// ISO C++ 14882: 20.5 Date and time +// + +#ifndef _GLIBCXX_CTIME +#define _GLIBCXX_CTIME 1 + +#pragma GCC system_header + +#include +#include + +// Get rid of those macros defined in in lieu of real functions. +#undef clock +#undef difftime +#undef mktime +#undef time +#undef asctime +#undef ctime +#undef gmtime +#undef localtime +#undef strftime + +_GLIBCXX_BEGIN_NAMESPACE(std) + + using ::clock_t; + using ::time_t; + using ::tm; + + using ::clock; + using ::difftime; + using ::mktime; + using ::time; + using ::asctime; + using ::ctime; + using ::gmtime; + using ::localtime; + using ::strftime; + +_GLIBCXX_END_NAMESPACE + +#endif diff --git a/libstdc++-v3/include/c_std/cwchar b/libstdc++-v3/include/c_std/cwchar new file mode 100644 index 00000000000..20cb8041e79 --- /dev/null +++ b/libstdc++-v3/include/c_std/cwchar @@ -0,0 +1,280 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file include/cwchar + * This is a Standard C++ Library file. You should @c #include this file + * in your programs, rather than any of the "*.h" implementation files. + * + * This is the C++ version of the Standard C Library header @c wchar.h, + * and its contents are (mostly) the same as that header, but are all + * contained in the namespace @c std (except for names which are defined + * as macros in C). + */ + +// +// ISO C++ 14882: 21.4 +// + +#ifndef _GLIBCXX_CWCHAR +#define _GLIBCXX_CWCHAR 1 + +#pragma GCC system_header + +#include +#include +#include + +#if _GLIBCXX_HAVE_WCHAR_H +#include +#endif + +// Need to do a bit of trickery here with mbstate_t as char_traits +// assumes it is in wchar.h, regardless of wchar_t specializations. +#ifndef _GLIBCXX_HAVE_MBSTATE_T +extern "C" +{ + typedef struct + { + int __fill[6]; + } mbstate_t; +} +#endif + +_GLIBCXX_BEGIN_NAMESPACE(std) + + using ::mbstate_t; + +_GLIBCXX_END_NAMESPACE + +// Get rid of those macros defined in in lieu of real functions. +#undef btowc +#undef fgetwc +#undef fgetws +#undef fputwc +#undef fputws +#undef fwide +#undef fwprintf +#undef fwscanf +#undef getwc +#undef getwchar +#undef mbrlen +#undef mbrtowc +#undef mbsinit +#undef mbsrtowcs +#undef putwc +#undef putwchar +#undef swprintf +#undef swscanf +#undef ungetwc +#undef vfwprintf +#if _GLIBCXX_HAVE_VFWSCANF +# undef vfwscanf +#endif +#undef vswprintf +#if _GLIBCXX_HAVE_VSWSCANF +# undef vswscanf +#endif +#undef vwprintf +#if _GLIBCXX_HAVE_VWSCANF +# undef vwscanf +#endif +#undef wcrtomb +#undef wcscat +#undef wcschr +#undef wcscmp +#undef wcscoll +#undef wcscpy +#undef wcscspn +#undef wcsftime +#undef wcslen +#undef wcsncat +#undef wcsncmp +#undef wcsncpy +#undef wcspbrk +#undef wcsrchr +#undef wcsrtombs +#undef wcsspn +#undef wcsstr +#undef wcstod +#if _GLIBCXX_HAVE_WCSTOF +# undef wcstof +#endif +#undef wcstok +#undef wcstol +#undef wcstoul +#undef wcsxfrm +#undef wctob +#undef wmemchr +#undef wmemcmp +#undef wmemcpy +#undef wmemmove +#undef wmemset +#undef wprintf +#undef wscanf + +#if _GLIBCXX_USE_WCHAR_T + +_GLIBCXX_BEGIN_NAMESPACE(std) + + using ::wint_t; + + using ::btowc; + using ::fgetwc; + using ::fgetws; + using ::fputwc; + using ::fputws; + using ::fwide; + using ::fwprintf; + using ::fwscanf; + using ::getwc; + using ::getwchar; + using ::mbrlen; + using ::mbrtowc; + using ::mbsinit; + using ::mbsrtowcs; + using ::putwc; + using ::putwchar; + using ::swprintf; + using ::swscanf; + using ::ungetwc; + using ::vfwprintf; +#if _GLIBCXX_HAVE_VFWSCANF + using ::vfwscanf; +#endif + using ::vswprintf; +#if _GLIBCXX_HAVE_VSWSCANF + using ::vswscanf; +#endif + using ::vwprintf; +#if _GLIBCXX_HAVE_VWSCANF + using ::vwscanf; +#endif + using ::wcrtomb; + using ::wcscat; + using ::wcscmp; + using ::wcscoll; + using ::wcscpy; + using ::wcscspn; + using ::wcsftime; + using ::wcslen; + using ::wcsncat; + using ::wcsncmp; + using ::wcsncpy; + using ::wcsrtombs; + using ::wcsspn; + using ::wcstod; +#if _GLIBCXX_HAVE_WCSTOF + using ::wcstof; +#endif + using ::wcstok; + using ::wcstol; + using ::wcstoul; + using ::wcsxfrm; + using ::wctob; + using ::wmemcmp; + using ::wmemcpy; + using ::wmemmove; + using ::wmemset; + using ::wprintf; + using ::wscanf; + + using ::wcschr; + + inline wchar_t* + wcschr(wchar_t* __p, wchar_t __c) + { return wcschr(const_cast(__p), __c); } + + using ::wcspbrk; + + inline wchar_t* + wcspbrk(wchar_t* __s1, const wchar_t* __s2) + { return wcspbrk(const_cast(__s1), __s2); } + + using ::wcsrchr; + + inline wchar_t* + wcsrchr(wchar_t* __p, wchar_t __c) + { return wcsrchr(const_cast(__p), __c); } + + using ::wcsstr; + + inline wchar_t* + wcsstr(wchar_t* __s1, const wchar_t* __s2) + { return wcsstr(const_cast(__s1), __s2); } + + using ::wmemchr; + + inline wchar_t* + wmemchr(wchar_t* __p, wchar_t __c, size_t __n) + { return wmemchr(const_cast(__p), __c, __n); } + +_GLIBCXX_END_NAMESPACE + +#if _GLIBCXX_USE_C99 + +#undef wcstold +#undef wcstoll +#undef wcstoull + +_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) + +#if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC + extern "C" long double + (wcstold)(const wchar_t * restrict, wchar_t ** restrict); +#endif +#if !_GLIBCXX_USE_C99_DYNAMIC + using ::wcstold; +#endif +#if _GLIBCXX_USE_C99_LONG_LONG_CHECK || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC + extern "C" long long int + (wcstoll)(const wchar_t * restrict, wchar_t ** restrict, int); + extern "C" unsigned long long int + (wcstoull)(const wchar_t * restrict, wchar_t ** restrict, int); +#endif +#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC + using ::wcstoll; + using ::wcstoull; +#endif + +_GLIBCXX_END_NAMESPACE + +_GLIBCXX_BEGIN_NAMESPACE(std) + + using ::__gnu_cxx::wcstold; + using ::__gnu_cxx::wcstoll; + using ::__gnu_cxx::wcstoull; + +_GLIBCXX_END_NAMESPACE + +#endif + +#endif //_GLIBCXX_USE_WCHAR_T + +#endif diff --git a/libstdc++-v3/include/c_std/cwctype b/libstdc++-v3/include/c_std/cwctype new file mode 100644 index 00000000000..dd0032f3dd6 --- /dev/null +++ b/libstdc++-v3/include/c_std/cwctype @@ -0,0 +1,112 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file include/cwctype + * This is a Standard C++ Library file. You should @c #include this file + * in your programs, rather than any of the "*.h" implementation files. + * + * This is the C++ version of the Standard C Library header @c wctype.h, + * and its contents are (mostly) the same as that header, but are all + * contained in the namespace @c std (except for names which are defined + * as macros in C). + */ + +// +// ISO C++ 14882: +// + +#ifndef _GLIBCXX_CWCTYPE +#define _GLIBCXX_CWCTYPE 1 + +#pragma GCC system_header + +#include + +#if _GLIBCXX_HAVE_WCTYPE_H +#include +#endif + +// Get rid of those macros defined in in lieu of real functions. +#undef iswalnum +#undef iswalpha +#if _GLIBCXX_HAVE_ISWBLANK +# undef iswblank +#endif +#undef iswcntrl +#undef iswctype +#undef iswdigit +#undef iswgraph +#undef iswlower +#undef iswprint +#undef iswpunct +#undef iswspace +#undef iswupper +#undef iswxdigit +#undef towctrans +#undef towlower +#undef towupper +#undef wctrans +#undef wctype + +#if _GLIBCXX_USE_WCHAR_T + +_GLIBCXX_BEGIN_NAMESPACE(std) + + using ::wint_t; // cwchar + + using ::wctype_t; + using ::wctrans_t; + + using ::iswalnum; + using ::iswalpha; +#if _GLIBCXX_HAVE_ISWBLANK + using ::iswblank; +#endif + using ::iswcntrl; + using ::iswctype; + using ::iswdigit; + using ::iswgraph; + using ::iswlower; + using ::iswprint; + using ::iswpunct; + using ::iswspace; + using ::iswupper; + using ::iswxdigit; + using ::towctrans; + using ::towlower; + using ::towupper; + using ::wctrans; + using ::wctype; + +_GLIBCXX_END_NAMESPACE + +#endif //_GLIBCXX_USE_WCHAR_T + +#endif diff --git a/libstdc++-v3/include/c_std/std_cassert.h b/libstdc++-v3/include/c_std/std_cassert.h deleted file mode 100644 index 0e5c77a082d..00000000000 --- a/libstdc++-v3/include/c_std/std_cassert.h +++ /dev/null @@ -1,49 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/** @file cassert - * This is a Standard C++ Library file. You should @c #include this file - * in your programs, rather than any of the "*.h" implementation files. - * - * This is the C++ version of the Standard C Library header @c assert.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: 19.2 Assertions -// - -// No include guards on this header... - -#pragma GCC system_header - -#include diff --git a/libstdc++-v3/include/c_std/std_cctype.h b/libstdc++-v3/include/c_std/std_cctype.h deleted file mode 100644 index 61a55cb73a4..00000000000 --- a/libstdc++-v3/include/c_std/std_cctype.h +++ /dev/null @@ -1,86 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/** @file include/cctype - * This is a Standard C++ Library file. You should @c #include this file - * in your programs, rather than any of the "*.h" implementation files. - * - * This is the C++ version of the Standard C Library header @c ctype.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: -// - -#ifndef _GLIBCXX_CCTYPE -#define _GLIBCXX_CCTYPE 1 - -#pragma GCC system_header - -#include -#include - -// Get rid of those macros defined in in lieu of real functions. -#undef isalnum -#undef isalpha -#undef iscntrl -#undef isdigit -#undef isgraph -#undef islower -#undef isprint -#undef ispunct -#undef isspace -#undef isupper -#undef isxdigit -#undef tolower -#undef toupper - -_GLIBCXX_BEGIN_NAMESPACE(std) - - using ::isalnum; - using ::isalpha; - using ::iscntrl; - using ::isdigit; - using ::isgraph; - using ::islower; - using ::isprint; - using ::ispunct; - using ::isspace; - using ::isupper; - using ::isxdigit; - using ::tolower; - using ::toupper; - -_GLIBCXX_END_NAMESPACE - -#endif diff --git a/libstdc++-v3/include/c_std/std_cerrno.h b/libstdc++-v3/include/c_std/std_cerrno.h deleted file mode 100644 index e597b8fbd73..00000000000 --- a/libstdc++-v3/include/c_std/std_cerrno.h +++ /dev/null @@ -1,57 +0,0 @@ -// The -*- C++ -*- forwarding header. - -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/** @file cerrno - * This is a Standard C++ Library file. You should @c #include this file - * in your programs, rather than any of the "*.h" implementation files. - * - * This is the C++ version of the Standard C Library header @c errno.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: 19.3 Error numbers -// - -#ifndef _GLIBCXX_CERRNO -#define _GLIBCXX_CERRNO 1 - -#pragma GCC system_header - -#include - -// Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998 -#ifndef errno -#define errno errno -#endif - -#endif diff --git a/libstdc++-v3/include/c_std/std_cfloat.h b/libstdc++-v3/include/c_std/std_cfloat.h deleted file mode 100644 index 2b514491cf8..00000000000 --- a/libstdc++-v3/include/c_std/std_cfloat.h +++ /dev/null @@ -1,52 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/** @file include/cfloat - * This is a Standard C++ Library file. You should @c #include this file - * in your programs, rather than any of the "*.h" implementation files. - * - * This is the C++ version of the Standard C Library header @c float.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: 18.2.2 Implementation properties: C library -// - -#ifndef _GLIBCXX_CFLOAT -#define _GLIBCXX_CFLOAT 1 - -#pragma GCC system_header - -#include - -#endif diff --git a/libstdc++-v3/include/c_std/std_ciso646.h b/libstdc++-v3/include/c_std/std_ciso646.h deleted file mode 100644 index 3e391b41030..00000000000 --- a/libstdc++-v3/include/c_std/std_ciso646.h +++ /dev/null @@ -1,38 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/** @file ciso646 - * This is a Standard C++ Library file. You should @c #include this file - * in your programs, rather than any of the "*.h" implementation files. - * - * This is the C++ version of the Standard C Library header @c iso646.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ diff --git a/libstdc++-v3/include/c_std/std_climits.h b/libstdc++-v3/include/c_std/std_climits.h deleted file mode 100644 index e85869f0679..00000000000 --- a/libstdc++-v3/include/c_std/std_climits.h +++ /dev/null @@ -1,52 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/** @file include/climits - * This is a Standard C++ Library file. You should @c #include this file - * in your programs, rather than any of the "*.h" implementation files. - * - * This is the C++ version of the Standard C Library header @c limits.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: 18.2.2 Implementation properties: C library -// - -#ifndef _GLIBCXX_CLIMITS -#define _GLIBCXX_CLIMITS 1 - -#pragma GCC system_header - -#include - -#endif diff --git a/libstdc++-v3/include/c_std/std_clocale.h b/libstdc++-v3/include/c_std/std_clocale.h deleted file mode 100644 index 51e6440bfee..00000000000 --- a/libstdc++-v3/include/c_std/std_clocale.h +++ /dev/null @@ -1,65 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/** @file clocale - * This is a Standard C++ Library file. You should @c #include this file - * in your programs, rather than any of the "*.h" implementation files. - * - * This is the C++ version of the Standard C Library header @c locale.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: 18.2.2 Implementation properties: C library -// - -#ifndef _GLIBCXX_CLOCALE -#define _GLIBCXX_CLOCALE 1 - -#pragma GCC system_header - -#include -#include - -// Get rid of those macros defined in in lieu of real functions. -#undef setlocale -#undef localeconv - -_GLIBCXX_BEGIN_NAMESPACE(std) - - using ::lconv; - using ::setlocale; - using ::localeconv; - -_GLIBCXX_END_NAMESPACE - -#endif diff --git a/libstdc++-v3/include/c_std/std_cmath.h b/libstdc++-v3/include/c_std/std_cmath.h deleted file mode 100644 index 897290ac089..00000000000 --- a/libstdc++-v3/include/c_std/std_cmath.h +++ /dev/null @@ -1,600 +0,0 @@ -// -*- C++ -*- C forwarding header. - -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/** @file include/cmath - * This is a Standard C++ Library file. You should @c #include this file - * in your programs, rather than any of the "*.h" implementation files. - * - * This is the C++ version of the Standard C Library header @c math.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: 26.5 C library -// - -#ifndef _GLIBCXX_CMATH -#define _GLIBCXX_CMATH 1 - -#pragma GCC system_header - -#include -#include -#include - -#include - -// Get rid of those macros defined in in lieu of real functions. -#undef abs -#undef div -#undef acos -#undef asin -#undef atan -#undef atan2 -#undef ceil -#undef cos -#undef cosh -#undef exp -#undef fabs -#undef floor -#undef fmod -#undef frexp -#undef ldexp -#undef log -#undef log10 -#undef modf -#undef pow -#undef sin -#undef sinh -#undef sqrt -#undef tan -#undef tanh - -_GLIBCXX_BEGIN_NAMESPACE(std) - - // Forward declaration of a helper function. This really should be - // an `exported' forward declaration. - template _Tp __cmath_power(_Tp, unsigned int); - - inline double - abs(double __x) - { return __builtin_fabs(__x); } - - inline float - abs(float __x) - { return __builtin_fabsf(__x); } - - inline long double - abs(long double __x) - { return __builtin_fabsl(__x); } - - using ::acos; - - inline float - acos(float __x) - { return __builtin_acosf(__x); } - - inline long double - acos(long double __x) - { return __builtin_acosl(__x); } - - template - inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - acos(_Tp __x) - { return __builtin_acos(__x); } - - using ::asin; - - inline float - asin(float __x) - { return __builtin_asinf(__x); } - - inline long double - asin(long double __x) - { return __builtin_asinl(__x); } - - template - inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - asin(_Tp __x) - { return __builtin_asin(__x); } - - using ::atan; - - inline float - atan(float __x) - { return __builtin_atanf(__x); } - - inline long double - atan(long double __x) - { return __builtin_atanl(__x); } - - template - inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - atan(_Tp __x) - { return __builtin_atan(__x); } - - using ::atan2; - - inline float - atan2(float __y, float __x) - { return __builtin_atan2f(__y, __x); } - - inline long double - atan2(long double __y, long double __x) - { return __builtin_atan2l(__y, __x); } - - template - inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value - && __is_integer<_Up>::__value, - double>::__type - atan2(_Tp __y, _Up __x) - { return __builtin_atan2(__y, __x); } - - using ::ceil; - - inline float - ceil(float __x) - { return __builtin_ceilf(__x); } - - inline long double - ceil(long double __x) - { return __builtin_ceill(__x); } - - template - inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - ceil(_Tp __x) - { return __builtin_ceil(__x); } - - using ::cos; - - inline float - cos(float __x) - { return __builtin_cosf(__x); } - - inline long double - cos(long double __x) - { return __builtin_cosl(__x); } - - template - inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - cos(_Tp __x) - { return __builtin_cos(__x); } - - using ::cosh; - - inline float - cosh(float __x) - { return __builtin_coshf(__x); } - - inline long double - cosh(long double __x) - { return __builtin_coshl(__x); } - - template - inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - cosh(_Tp __x) - { return __builtin_cosh(__x); } - - using ::exp; - - inline float - exp(float __x) - { return __builtin_expf(__x); } - - inline long double - exp(long double __x) - { return __builtin_expl(__x); } - - template - inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - exp(_Tp __x) - { return __builtin_exp(__x); } - - using ::fabs; - - inline float - fabs(float __x) - { return __builtin_fabsf(__x); } - - inline long double - fabs(long double __x) - { return __builtin_fabsl(__x); } - - template - inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - fabs(_Tp __x) - { return __builtin_fabs(__x); } - - using ::floor; - - inline float - floor(float __x) - { return __builtin_floorf(__x); } - - inline long double - floor(long double __x) - { return __builtin_floorl(__x); } - - template - inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - floor(_Tp __x) - { return __builtin_floor(__x); } - - using ::fmod; - - inline float - fmod(float __x, float __y) - { return __builtin_fmodf(__x, __y); } - - inline long double - fmod(long double __x, long double __y) - { return __builtin_fmodl(__x, __y); } - - using ::frexp; - - inline float - frexp(float __x, int* __exp) - { return __builtin_frexpf(__x, __exp); } - - inline long double - frexp(long double __x, int* __exp) - { return __builtin_frexpl(__x, __exp); } - - template - inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - frexp(_Tp __x, int* __exp) - { return __builtin_frexp(__x, __exp); } - - using ::ldexp; - - inline float - ldexp(float __x, int __exp) - { return __builtin_ldexpf(__x, __exp); } - - inline long double - ldexp(long double __x, int __exp) - { return __builtin_ldexpl(__x, __exp); } - - template - inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - ldexp(_Tp __x, int __exp) - { return __builtin_ldexp(__x, __exp); } - - using ::log; - - inline float - log(float __x) - { return __builtin_logf(__x); } - - inline long double - log(long double __x) - { return __builtin_logl(__x); } - - template - inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - log(_Tp __x) - { return __builtin_log(__x); } - - using ::log10; - - inline float - log10(float __x) - { return __builtin_log10f(__x); } - - inline long double - log10(long double __x) - { return __builtin_log10l(__x); } - - template - inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - log10(_Tp __x) - { return __builtin_log10(__x); } - - using ::modf; - - inline float - modf(float __x, float* __iptr) - { return __builtin_modff(__x, __iptr); } - - inline long double - modf(long double __x, long double* __iptr) - { return __builtin_modfl(__x, __iptr); } - - template - inline _Tp - __pow_helper(_Tp __x, int __n) - { - return __n < 0 - ? _Tp(1)/__cmath_power(__x, -__n) - : __cmath_power(__x, __n); - } - - using ::pow; - - inline float - pow(float __x, float __y) - { return __builtin_powf(__x, __y); } - - inline long double - pow(long double __x, long double __y) - { return __builtin_powl(__x, __y); } - - inline double - pow(double __x, int __i) - { return __builtin_powi(__x, __i); } - - inline float - pow(float __x, int __n) - { return __builtin_powif(__x, __n); } - - inline long double - pow(long double __x, int __n) - { return __builtin_powil(__x, __n); } - - using ::sin; - - inline float - sin(float __x) - { return __builtin_sinf(__x); } - - inline long double - sin(long double __x) - { return __builtin_sinl(__x); } - - template - inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - sin(_Tp __x) - { return __builtin_sin(__x); } - - using ::sinh; - - inline float - sinh(float __x) - { return __builtin_sinhf(__x); } - - inline long double - sinh(long double __x) - { return __builtin_sinhl(__x); } - - template - inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - sinh(_Tp __x) - { return __builtin_sinh(__x); } - - using ::sqrt; - - inline float - sqrt(float __x) - { return __builtin_sqrtf(__x); } - - inline long double - sqrt(long double __x) - { return __builtin_sqrtl(__x); } - - template - inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - sqrt(_Tp __x) - { return __builtin_sqrt(__x); } - - using ::tan; - - inline float - tan(float __x) - { return __builtin_tanf(__x); } - - inline long double - tan(long double __x) - { return __builtin_tanl(__x); } - - template - inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - tan(_Tp __x) - { return __builtin_tan(__x); } - - using ::tanh; - - inline float - tanh(float __x) - { return __builtin_tanhf(__x); } - - inline long double - tanh(long double __x) - { return __builtin_tanhl(__x); } - - template - inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, - double>::__type - tanh(_Tp __x) - { return __builtin_tanh(__x); } - -_GLIBCXX_END_NAMESPACE - -#if _GLIBCXX_USE_C99_MATH -#if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC -// These are possible macros imported from C99-land. For strict -// conformance, remove possible C99-injected names from the global -// namespace, and sequester them in the __gnu_cxx extension namespace. - -_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) - - template - inline int - __capture_fpclassify(_Tp __f) { return fpclassify(__f); } - - template - inline int - __capture_isfinite(_Tp __f) { return isfinite(__f); } - - template - inline int - __capture_isinf(_Tp __f) { return isinf(__f); } - - template - inline int - __capture_isnan(_Tp __f) { return isnan(__f); } - - template - inline int - __capture_isnormal(_Tp __f) { return isnormal(__f); } - - template - inline int - __capture_signbit(_Tp __f) { return signbit(__f); } - - template - inline int - __capture_isgreater(_Tp __f1, _Tp __f2) - { return isgreater(__f1, __f2); } - - template - inline int - __capture_isgreaterequal(_Tp __f1, _Tp __f2) - { return isgreaterequal(__f1, __f2); } - - template - inline int - __capture_isless(_Tp __f1, _Tp __f2) { return isless(__f1, __f2); } - - template - inline int - __capture_islessequal(_Tp __f1, _Tp __f2) - { return islessequal(__f1, __f2); } - - template - inline int - __capture_islessgreater(_Tp __f1, _Tp __f2) - { return islessgreater(__f1, __f2); } - - template - inline int - __capture_isunordered(_Tp __f1, _Tp __f2) - { return isunordered(__f1, __f2); } - -_GLIBCXX_END_NAMESPACE - -// Only undefine the C99 FP macros, if actually captured for namespace movement -#undef fpclassify -#undef isfinite -#undef isinf -#undef isnan -#undef isnormal -#undef signbit -#undef isgreater -#undef isgreaterequal -#undef isless -#undef islessequal -#undef islessgreater -#undef isunordered - -_GLIBCXX_BEGIN_NAMESPACE(std) - - template - inline int - fpclassify(_Tp __f) { return ::__gnu_cxx::__capture_fpclassify(__f); } - - template - inline int - isfinite(_Tp __f) { return ::__gnu_cxx::__capture_isfinite(__f); } - - template - inline int - isinf(_Tp __f) { return ::__gnu_cxx::__capture_isinf(__f); } - - template - inline int - isnan(_Tp __f) { return ::__gnu_cxx::__capture_isnan(__f); } - - template - inline int - isnormal(_Tp __f) { return ::__gnu_cxx::__capture_isnormal(__f); } - - template - inline int - signbit(_Tp __f) { return ::__gnu_cxx::__capture_signbit(__f); } - - template - inline int - isgreater(_Tp __f1, _Tp __f2) - { return ::__gnu_cxx::__capture_isgreater(__f1, __f2); } - - template - inline int - isgreaterequal(_Tp __f1, _Tp __f2) - { return ::__gnu_cxx::__capture_isgreaterequal(__f1, __f2); } - - template - inline int - isless(_Tp __f1, _Tp __f2) - { return ::__gnu_cxx::__capture_isless(__f1, __f2); } - - template - inline int - islessequal(_Tp __f1, _Tp __f2) - { return ::__gnu_cxx::__capture_islessequal(__f1, __f2); } - - template - inline int - islessgreater(_Tp __f1, _Tp __f2) - { return ::__gnu_cxx::__capture_islessgreater(__f1, __f2); } - - template - inline int - isunordered(_Tp __f1, _Tp __f2) - { return ::__gnu_cxx::__capture_isunordered(__f1, __f2); } - -_GLIBCXX_END_NAMESPACE - -#endif /* _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC */ -#endif - -#ifndef _GLIBCXX_EXPORT_TEMPLATE -# include -#endif - -#endif diff --git a/libstdc++-v3/include/c_std/std_csetjmp.h b/libstdc++-v3/include/c_std/std_csetjmp.h deleted file mode 100644 index 946e7e3c032..00000000000 --- a/libstdc++-v3/include/c_std/std_csetjmp.h +++ /dev/null @@ -1,68 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/** @file csetjmp - * This is a Standard C++ Library file. You should @c #include this file - * in your programs, rather than any of the "*.h" implementation files. - * - * This is the C++ version of the Standard C Library header @c setjmp.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: 20.4.6 C library -// - -#ifndef _GLIBCXX_CSETJMP -#define _GLIBCXX_CSETJMP 1 - -#pragma GCC system_header - -#include -#include - -// Get rid of those macros defined in in lieu of real functions. -#undef longjmp - -// Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998 -#ifndef setjmp -#define setjmp(env) setjmp (env) -#endif - -_GLIBCXX_BEGIN_NAMESPACE(std) - - using ::jmp_buf; - using ::longjmp; - -_GLIBCXX_END_NAMESPACE - -#endif diff --git a/libstdc++-v3/include/c_std/std_csignal.h b/libstdc++-v3/include/c_std/std_csignal.h deleted file mode 100644 index 0ce5e2f77db..00000000000 --- a/libstdc++-v3/include/c_std/std_csignal.h +++ /dev/null @@ -1,64 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/** @file csignal - * This is a Standard C++ Library file. You should @c #include this file - * in your programs, rather than any of the "*.h" implementation files. - * - * This is the C++ version of the Standard C Library header @c signal.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: 20.4.6 C library -// - -#ifndef _GLIBCXX_CSIGNAL -#define _GLIBCXX_CSIGNAL 1 - -#pragma GCC system_header - -#include -#include - -// Get rid of those macros defined in in lieu of real functions. -#undef raise - -_GLIBCXX_BEGIN_NAMESPACE(std) - - using ::sig_atomic_t; - using ::signal; - using ::raise; - -_GLIBCXX_END_NAMESPACE - -#endif diff --git a/libstdc++-v3/include/c_std/std_cstdarg.h b/libstdc++-v3/include/c_std/std_cstdarg.h deleted file mode 100644 index 53c29c843a2..00000000000 --- a/libstdc++-v3/include/c_std/std_cstdarg.h +++ /dev/null @@ -1,64 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/** @file include/cstdarg - * This is a Standard C++ Library file. You should @c #include this file - * in your programs, rather than any of the "*.h" implementation files. - * - * This is the C++ version of the Standard C Library header @c stdarg.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: 20.4.6 C library -// - -#ifndef _GLIBCXX_CSTDARG -#define _GLIBCXX_CSTDARG 1 - -#pragma GCC system_header - -#include -#include - -// Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998 -#ifndef va_end -#define va_end(ap) va_end (ap) -#endif - -_GLIBCXX_BEGIN_NAMESPACE(std) - - using ::va_list; - -_GLIBCXX_END_NAMESPACE - -#endif diff --git a/libstdc++-v3/include/c_std/std_cstddef.h b/libstdc++-v3/include/c_std/std_cstddef.h deleted file mode 100644 index bfa8388d563..00000000000 --- a/libstdc++-v3/include/c_std/std_cstddef.h +++ /dev/null @@ -1,60 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/** @file cstddef - * This is a Standard C++ Library file. You should @c #include this file - * in your programs, rather than any of the "*.h" implementation files. - * - * This is the C++ version of the Standard C Library header @c stddef.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: 18.1 Types -// - -#ifndef _GLIBCXX_CSTDDEF -#define _GLIBCXX_CSTDDEF 1 - -#pragma GCC system_header - -#include -#include - -_GLIBCXX_BEGIN_NAMESPACE(std) - - using ::ptrdiff_t; - using ::size_t; - -_GLIBCXX_END_NAMESPACE - -#endif diff --git a/libstdc++-v3/include/c_std/std_cstdio.h b/libstdc++-v3/include/c_std/std_cstdio.h deleted file mode 100644 index 3935ef4f17e..00000000000 --- a/libstdc++-v3/include/c_std/std_cstdio.h +++ /dev/null @@ -1,191 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/** @file include/cstdio - * This is a Standard C++ Library file. You should @c #include this file - * in your programs, rather than any of the "*.h" implementation files. - * - * This is the C++ version of the Standard C Library header @c stdio.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: 27.8.2 C Library files -// - -#ifndef _GLIBCXX_CSTDIO -#define _GLIBCXX_CSTDIO 1 - -#pragma GCC system_header - -#include -#include - -#include - -// Get rid of those macros defined in in lieu of real functions. -#undef clearerr -#undef fclose -#undef feof -#undef ferror -#undef fflush -#undef fgetc -#undef fgetpos -#undef fgets -#undef fopen -#undef fprintf -#undef fputc -#undef fputs -#undef fread -#undef freopen -#undef fscanf -#undef fseek -#undef fsetpos -#undef ftell -#undef fwrite -#undef getc -#undef getchar -#undef gets -#undef perror -#undef printf -#undef putc -#undef putchar -#undef puts -#undef remove -#undef rename -#undef rewind -#undef scanf -#undef setbuf -#undef setvbuf -#undef sprintf -#undef sscanf -#undef tmpfile -#undef tmpnam -#undef ungetc -#undef vfprintf -#undef vprintf -#undef vsprintf - -_GLIBCXX_BEGIN_NAMESPACE(std) - - using ::FILE; - using ::fpos_t; - - using ::clearerr; - using ::fclose; - using ::feof; - using ::ferror; - using ::fflush; - using ::fgetc; - using ::fgetpos; - using ::fgets; - using ::fopen; - using ::fprintf; - using ::fputc; - using ::fputs; - using ::fread; - using ::freopen; - using ::fscanf; - using ::fseek; - using ::fsetpos; - using ::ftell; - using ::fwrite; - using ::getc; - using ::getchar; - using ::gets; - using ::perror; - using ::printf; - using ::putc; - using ::putchar; - using ::puts; - using ::remove; - using ::rename; - using ::rewind; - using ::scanf; - using ::setbuf; - using ::setvbuf; - using ::sprintf; - using ::sscanf; - using ::tmpfile; - using ::tmpnam; - using ::ungetc; - using ::vfprintf; - using ::vprintf; - using ::vsprintf; - -_GLIBCXX_END_NAMESPACE - -#if _GLIBCXX_USE_C99 - -#undef snprintf -#undef vfscanf -#undef vscanf -#undef vsnprintf -#undef vsscanf - -_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) - -#if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC - extern "C" int - (snprintf)(char * restrict, size_t, const char * restrict, ...); - extern "C" int - (vfscanf)(FILE * restrict, const char * restrict, __gnuc_va_list); - extern "C" int (vscanf)(const char * restrict, __gnuc_va_list); - extern "C" int - (vsnprintf)(char * restrict, size_t, const char * restrict, __gnuc_va_list); - extern "C" int - (vsscanf)(const char * restrict, const char * restrict, __gnuc_va_list); -#endif - -#if !_GLIBCXX_USE_C99_DYNAMIC - using ::snprintf; - using ::vfscanf; - using ::vscanf; - using ::vsnprintf; - using ::vsscanf; -#endif - -_GLIBCXX_END_NAMESPACE - -_GLIBCXX_BEGIN_NAMESPACE(std) - - using ::__gnu_cxx::snprintf; - using ::__gnu_cxx::vfscanf; - using ::__gnu_cxx::vscanf; - using ::__gnu_cxx::vsnprintf; - using ::__gnu_cxx::vsscanf; - -_GLIBCXX_END_NAMESPACE - -#endif - -#endif diff --git a/libstdc++-v3/include/c_std/std_cstdlib.h b/libstdc++-v3/include/c_std/std_cstdlib.h deleted file mode 100644 index 5c3d586c0e6..00000000000 --- a/libstdc++-v3/include/c_std/std_cstdlib.h +++ /dev/null @@ -1,227 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/** @file include/cstdlib - * This is a Standard C++ Library file. You should @c #include this file - * in your programs, rather than any of the "*.h" implementation files. - * - * This is the C++ version of the Standard C Library header @c stdlib.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: 20.4.6 C library -// - -#ifndef _GLIBCXX_CSTDLIB -#define _GLIBCXX_CSTDLIB 1 - -#pragma GCC system_header - -#include -#include - -#if !_GLIBCXX_HOSTED -// The C standard does not require a freestanding implementation to -// provide . However, the C++ standard does still require -// -- but only the functionality mentioned in -// [lib.support.start.term]. - -#define EXIT_SUCCESS 0 -#define EXIT_FAILURE 1 - -_GLIBCXX_BEGIN_NAMESPACE(std) - - extern "C" void abort(void); - extern "C" int atexit(void (*)()); - extern "C" void exit(int); - -_GLIBCXX_END_NAMESPACE - -#else - -#include - -// Get rid of those macros defined in in lieu of real functions. -#undef abort -#undef abs -#undef atexit -#undef atof -#undef atoi -#undef atol -#undef bsearch -#undef calloc -#undef div -#undef exit -#undef free -#undef getenv -#undef labs -#undef ldiv -#undef malloc -#undef mblen -#undef mbstowcs -#undef mbtowc -#undef qsort -#undef rand -#undef realloc -#undef srand -#undef strtod -#undef strtol -#undef strtoul -#undef system -#undef wcstombs -#undef wctomb - -_GLIBCXX_BEGIN_NAMESPACE(std) - - using ::div_t; - using ::ldiv_t; - - using ::abort; - using ::abs; - using ::atexit; - using ::atof; - using ::atoi; - using ::atol; - using ::bsearch; - using ::calloc; - using ::div; - using ::exit; - using ::free; - using ::getenv; - using ::labs; - using ::ldiv; - using ::malloc; -#ifdef _GLIBCXX_HAVE_MBSTATE_T - using ::mblen; - using ::mbstowcs; - using ::mbtowc; -#endif // _GLIBCXX_HAVE_MBSTATE_T - using ::qsort; - using ::rand; - using ::realloc; - using ::srand; - using ::strtod; - using ::strtol; - using ::strtoul; - using ::system; -#ifdef _GLIBCXX_USE_WCHAR_T - using ::wcstombs; - using ::wctomb; -#endif // _GLIBCXX_USE_WCHAR_T - - inline long - abs(long __i) { return labs(__i); } - - inline ldiv_t - div(long __i, long __j) { return ldiv(__i, __j); } - -_GLIBCXX_END_NAMESPACE - -#if _GLIBCXX_USE_C99 - -#undef _Exit -#undef llabs -#undef lldiv -#undef atoll -#undef strtoll -#undef strtoull -#undef strtof -#undef strtold - -_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) - -#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC - using ::lldiv_t; -#endif -#if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC - extern "C" void (_Exit)(int); -#endif -#if !_GLIBCXX_USE_C99_DYNAMIC - using ::_Exit; -#endif - - inline long long - abs(long long __x) { return __x >= 0 ? __x : -__x; } - -#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC - using ::llabs; - - inline lldiv_t - div(long long __n, long long __d) - { lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; } - - using ::lldiv; -#endif - -#if _GLIBCXX_USE_C99_LONG_LONG_CHECK || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC - extern "C" long long int (atoll)(const char *); - extern "C" long long int - (strtoll)(const char * restrict, char ** restrict, int); - extern "C" unsigned long long int - (strtoull)(const char * restrict, char ** restrict, int); -#endif -#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC - using ::atoll; - using ::strtoll; - using ::strtoull; -#endif - using ::strtof; - using ::strtold; - -_GLIBCXX_END_NAMESPACE - -_GLIBCXX_BEGIN_NAMESPACE(std) - -#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC - using ::__gnu_cxx::lldiv_t; -#endif - using ::__gnu_cxx::_Exit; - using ::__gnu_cxx::abs; -#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC - using ::__gnu_cxx::llabs; - using ::__gnu_cxx::div; - using ::__gnu_cxx::lldiv; -#endif - using ::__gnu_cxx::atoll; - using ::__gnu_cxx::strtof; - using ::__gnu_cxx::strtoll; - using ::__gnu_cxx::strtoull; - using ::__gnu_cxx::strtold; - -_GLIBCXX_END_NAMESPACE - -#endif // _GLIBCXX_USE_C99 - -#endif // !_GLIBCXX_HOSTED - -#endif diff --git a/libstdc++-v3/include/c_std/std_cstring.h b/libstdc++-v3/include/c_std/std_cstring.h deleted file mode 100644 index 5fef6b0086e..00000000000 --- a/libstdc++-v3/include/c_std/std_cstring.h +++ /dev/null @@ -1,130 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/** @file cstring - * This is a Standard C++ Library file. You should @c #include this file - * in your programs, rather than any of the "*.h" implementation files. - * - * This is the C++ version of the Standard C Library header @c string.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: 20.4.6 C library -// - -#ifndef _GLIBCXX_CSTRING -#define _GLIBCXX_CSTRING 1 - -#pragma GCC system_header - -#include -#include -#include - -// Get rid of those macros defined in in lieu of real functions. -#undef memcpy -#undef memmove -#undef strcpy -#undef strncpy -#undef strcat -#undef strncat -#undef memcmp -#undef strcmp -#undef strcoll -#undef strncmp -#undef strxfrm -#undef memchr -#undef strchr -#undef strcspn -#undef strpbrk -#undef strrchr -#undef strspn -#undef strstr -#undef strtok -#undef memset -#undef strerror -#undef strlen - -_GLIBCXX_BEGIN_NAMESPACE(std) - - using ::memcpy; - using ::memmove; - using ::strcpy; - using ::strncpy; - using ::strcat; - using ::strncat; - using ::memcmp; - using ::strcmp; - using ::strcoll; - using ::strncmp; - using ::strxfrm; - using ::strcspn; - using ::strspn; - using ::strtok; - using ::memset; - using ::strerror; - using ::strlen; - - using ::memchr; - - inline void* - memchr(void* __p, int __c, size_t __n) - { return memchr(const_cast(__p), __c, __n); } - - using ::strchr; - - inline char* - strchr(char* __s1, int __n) - { return __builtin_strchr(const_cast(__s1), __n); } - - using ::strpbrk; - - inline char* - strpbrk(char* __s1, const char* __s2) - { return __builtin_strpbrk(const_cast(__s1), __s2); } - - using ::strrchr; - - inline char* - strrchr(char* __s1, int __n) - { return __builtin_strrchr(const_cast(__s1), __n); } - - using ::strstr; - - inline char* - strstr(char* __s1, const char* __s2) - { return __builtin_strstr(const_cast(__s1), __s2); } - -_GLIBCXX_END_NAMESPACE - -#endif diff --git a/libstdc++-v3/include/c_std/std_ctime.h b/libstdc++-v3/include/c_std/std_ctime.h deleted file mode 100644 index 9f7f15c7979..00000000000 --- a/libstdc++-v3/include/c_std/std_ctime.h +++ /dev/null @@ -1,82 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/** @file include/ctime - * This is a Standard C++ Library file. You should @c #include this file - * in your programs, rather than any of the "*.h" implementation files. - * - * This is the C++ version of the Standard C Library header @c time.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: 20.5 Date and time -// - -#ifndef _GLIBCXX_CTIME -#define _GLIBCXX_CTIME 1 - -#pragma GCC system_header - -#include -#include - -// Get rid of those macros defined in in lieu of real functions. -#undef clock -#undef difftime -#undef mktime -#undef time -#undef asctime -#undef ctime -#undef gmtime -#undef localtime -#undef strftime - -_GLIBCXX_BEGIN_NAMESPACE(std) - - using ::clock_t; - using ::time_t; - using ::tm; - - using ::clock; - using ::difftime; - using ::mktime; - using ::time; - using ::asctime; - using ::ctime; - using ::gmtime; - using ::localtime; - using ::strftime; - -_GLIBCXX_END_NAMESPACE - -#endif diff --git a/libstdc++-v3/include/c_std/std_cwchar.h b/libstdc++-v3/include/c_std/std_cwchar.h deleted file mode 100644 index 20cb8041e79..00000000000 --- a/libstdc++-v3/include/c_std/std_cwchar.h +++ /dev/null @@ -1,280 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/** @file include/cwchar - * This is a Standard C++ Library file. You should @c #include this file - * in your programs, rather than any of the "*.h" implementation files. - * - * This is the C++ version of the Standard C Library header @c wchar.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: 21.4 -// - -#ifndef _GLIBCXX_CWCHAR -#define _GLIBCXX_CWCHAR 1 - -#pragma GCC system_header - -#include -#include -#include - -#if _GLIBCXX_HAVE_WCHAR_H -#include -#endif - -// Need to do a bit of trickery here with mbstate_t as char_traits -// assumes it is in wchar.h, regardless of wchar_t specializations. -#ifndef _GLIBCXX_HAVE_MBSTATE_T -extern "C" -{ - typedef struct - { - int __fill[6]; - } mbstate_t; -} -#endif - -_GLIBCXX_BEGIN_NAMESPACE(std) - - using ::mbstate_t; - -_GLIBCXX_END_NAMESPACE - -// Get rid of those macros defined in in lieu of real functions. -#undef btowc -#undef fgetwc -#undef fgetws -#undef fputwc -#undef fputws -#undef fwide -#undef fwprintf -#undef fwscanf -#undef getwc -#undef getwchar -#undef mbrlen -#undef mbrtowc -#undef mbsinit -#undef mbsrtowcs -#undef putwc -#undef putwchar -#undef swprintf -#undef swscanf -#undef ungetwc -#undef vfwprintf -#if _GLIBCXX_HAVE_VFWSCANF -# undef vfwscanf -#endif -#undef vswprintf -#if _GLIBCXX_HAVE_VSWSCANF -# undef vswscanf -#endif -#undef vwprintf -#if _GLIBCXX_HAVE_VWSCANF -# undef vwscanf -#endif -#undef wcrtomb -#undef wcscat -#undef wcschr -#undef wcscmp -#undef wcscoll -#undef wcscpy -#undef wcscspn -#undef wcsftime -#undef wcslen -#undef wcsncat -#undef wcsncmp -#undef wcsncpy -#undef wcspbrk -#undef wcsrchr -#undef wcsrtombs -#undef wcsspn -#undef wcsstr -#undef wcstod -#if _GLIBCXX_HAVE_WCSTOF -# undef wcstof -#endif -#undef wcstok -#undef wcstol -#undef wcstoul -#undef wcsxfrm -#undef wctob -#undef wmemchr -#undef wmemcmp -#undef wmemcpy -#undef wmemmove -#undef wmemset -#undef wprintf -#undef wscanf - -#if _GLIBCXX_USE_WCHAR_T - -_GLIBCXX_BEGIN_NAMESPACE(std) - - using ::wint_t; - - using ::btowc; - using ::fgetwc; - using ::fgetws; - using ::fputwc; - using ::fputws; - using ::fwide; - using ::fwprintf; - using ::fwscanf; - using ::getwc; - using ::getwchar; - using ::mbrlen; - using ::mbrtowc; - using ::mbsinit; - using ::mbsrtowcs; - using ::putwc; - using ::putwchar; - using ::swprintf; - using ::swscanf; - using ::ungetwc; - using ::vfwprintf; -#if _GLIBCXX_HAVE_VFWSCANF - using ::vfwscanf; -#endif - using ::vswprintf; -#if _GLIBCXX_HAVE_VSWSCANF - using ::vswscanf; -#endif - using ::vwprintf; -#if _GLIBCXX_HAVE_VWSCANF - using ::vwscanf; -#endif - using ::wcrtomb; - using ::wcscat; - using ::wcscmp; - using ::wcscoll; - using ::wcscpy; - using ::wcscspn; - using ::wcsftime; - using ::wcslen; - using ::wcsncat; - using ::wcsncmp; - using ::wcsncpy; - using ::wcsrtombs; - using ::wcsspn; - using ::wcstod; -#if _GLIBCXX_HAVE_WCSTOF - using ::wcstof; -#endif - using ::wcstok; - using ::wcstol; - using ::wcstoul; - using ::wcsxfrm; - using ::wctob; - using ::wmemcmp; - using ::wmemcpy; - using ::wmemmove; - using ::wmemset; - using ::wprintf; - using ::wscanf; - - using ::wcschr; - - inline wchar_t* - wcschr(wchar_t* __p, wchar_t __c) - { return wcschr(const_cast(__p), __c); } - - using ::wcspbrk; - - inline wchar_t* - wcspbrk(wchar_t* __s1, const wchar_t* __s2) - { return wcspbrk(const_cast(__s1), __s2); } - - using ::wcsrchr; - - inline wchar_t* - wcsrchr(wchar_t* __p, wchar_t __c) - { return wcsrchr(const_cast(__p), __c); } - - using ::wcsstr; - - inline wchar_t* - wcsstr(wchar_t* __s1, const wchar_t* __s2) - { return wcsstr(const_cast(__s1), __s2); } - - using ::wmemchr; - - inline wchar_t* - wmemchr(wchar_t* __p, wchar_t __c, size_t __n) - { return wmemchr(const_cast(__p), __c, __n); } - -_GLIBCXX_END_NAMESPACE - -#if _GLIBCXX_USE_C99 - -#undef wcstold -#undef wcstoll -#undef wcstoull - -_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) - -#if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC - extern "C" long double - (wcstold)(const wchar_t * restrict, wchar_t ** restrict); -#endif -#if !_GLIBCXX_USE_C99_DYNAMIC - using ::wcstold; -#endif -#if _GLIBCXX_USE_C99_LONG_LONG_CHECK || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC - extern "C" long long int - (wcstoll)(const wchar_t * restrict, wchar_t ** restrict, int); - extern "C" unsigned long long int - (wcstoull)(const wchar_t * restrict, wchar_t ** restrict, int); -#endif -#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC - using ::wcstoll; - using ::wcstoull; -#endif - -_GLIBCXX_END_NAMESPACE - -_GLIBCXX_BEGIN_NAMESPACE(std) - - using ::__gnu_cxx::wcstold; - using ::__gnu_cxx::wcstoll; - using ::__gnu_cxx::wcstoull; - -_GLIBCXX_END_NAMESPACE - -#endif - -#endif //_GLIBCXX_USE_WCHAR_T - -#endif diff --git a/libstdc++-v3/include/c_std/std_cwctype.h b/libstdc++-v3/include/c_std/std_cwctype.h deleted file mode 100644 index dd0032f3dd6..00000000000 --- a/libstdc++-v3/include/c_std/std_cwctype.h +++ /dev/null @@ -1,112 +0,0 @@ -// -*- C++ -*- forwarding header. - -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/** @file include/cwctype - * This is a Standard C++ Library file. You should @c #include this file - * in your programs, rather than any of the "*.h" implementation files. - * - * This is the C++ version of the Standard C Library header @c wctype.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: -// - -#ifndef _GLIBCXX_CWCTYPE -#define _GLIBCXX_CWCTYPE 1 - -#pragma GCC system_header - -#include - -#if _GLIBCXX_HAVE_WCTYPE_H -#include -#endif - -// Get rid of those macros defined in in lieu of real functions. -#undef iswalnum -#undef iswalpha -#if _GLIBCXX_HAVE_ISWBLANK -# undef iswblank -#endif -#undef iswcntrl -#undef iswctype -#undef iswdigit -#undef iswgraph -#undef iswlower -#undef iswprint -#undef iswpunct -#undef iswspace -#undef iswupper -#undef iswxdigit -#undef towctrans -#undef towlower -#undef towupper -#undef wctrans -#undef wctype - -#if _GLIBCXX_USE_WCHAR_T - -_GLIBCXX_BEGIN_NAMESPACE(std) - - using ::wint_t; // cwchar - - using ::wctype_t; - using ::wctrans_t; - - using ::iswalnum; - using ::iswalpha; -#if _GLIBCXX_HAVE_ISWBLANK - using ::iswblank; -#endif - using ::iswcntrl; - using ::iswctype; - using ::iswdigit; - using ::iswgraph; - using ::iswlower; - using ::iswprint; - using ::iswpunct; - using ::iswspace; - using ::iswupper; - using ::iswxdigit; - using ::towctrans; - using ::towlower; - using ::towupper; - using ::wctrans; - using ::wctype; - -_GLIBCXX_END_NAMESPACE - -#endif //_GLIBCXX_USE_WCHAR_T - -#endif diff --git a/libstdc++-v3/include/std/algorithm b/libstdc++-v3/include/std/algorithm new file mode 100644 index 00000000000..7ffbf97369e --- /dev/null +++ b/libstdc++-v3/include/std/algorithm @@ -0,0 +1,70 @@ +// -*- C++ -*- + +// Copyright (C) 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file include/algorithm + * This is a Standard C++ Library header. + */ + +#ifndef _GLIBCXX_ALGORITHM +#define _GLIBCXX_ALGORITHM 1 + +#pragma GCC system_header + +#include +#include +#include +#include + +#endif /* _GLIBCXX_ALGORITHM */ diff --git a/libstdc++-v3/include/std/bitset b/libstdc++-v3/include/std/bitset new file mode 100644 index 00000000000..860e775cc6b --- /dev/null +++ b/libstdc++-v3/include/std/bitset @@ -0,0 +1,1344 @@ +// -*- C++ -*- + +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/* + * Copyright (c) 1998 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file include/bitset + * This is a Standard C++ Library header. + */ + +#ifndef _GLIBCXX_BITSET +#define _GLIBCXX_BITSET 1 + +#pragma GCC system_header + +#include // For size_t +#include // For memset +#include // For numeric_limits +#include +#include // For invalid_argument, out_of_range, + // overflow_error +#include // For ostream (operator<<) +#include // For istream (operator>>) + +#define _GLIBCXX_BITSET_BITS_PER_WORD numeric_limits::digits +#define _GLIBCXX_BITSET_WORDS(__n) \ + ((__n) < 1 ? 0 : ((__n) + _GLIBCXX_BITSET_BITS_PER_WORD - 1) \ + / _GLIBCXX_BITSET_BITS_PER_WORD) + +_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) + + /** + * @if maint + * Base class, general case. It is a class inveriant that _Nw will be + * nonnegative. + * + * See documentation for bitset. + * @endif + */ + template + struct _Base_bitset + { + typedef unsigned long _WordT; + + /// 0 is the least significant word. + _WordT _M_w[_Nw]; + + _Base_bitset() + { _M_do_reset(); } + + _Base_bitset(unsigned long __val) + { + _M_do_reset(); + _M_w[0] = __val; + } + + static size_t + _S_whichword(size_t __pos ) + { return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; } + + static size_t + _S_whichbyte(size_t __pos ) + { return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; } + + static size_t + _S_whichbit(size_t __pos ) + { return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; } + + static _WordT + _S_maskbit(size_t __pos ) + { return (static_cast<_WordT>(1)) << _S_whichbit(__pos); } + + _WordT& + _M_getword(size_t __pos) + { return _M_w[_S_whichword(__pos)]; } + + _WordT + _M_getword(size_t __pos) const + { return _M_w[_S_whichword(__pos)]; } + + _WordT& + _M_hiword() + { return _M_w[_Nw - 1]; } + + _WordT + _M_hiword() const + { return _M_w[_Nw - 1]; } + + void + _M_do_and(const _Base_bitset<_Nw>& __x) + { + for (size_t __i = 0; __i < _Nw; __i++) + _M_w[__i] &= __x._M_w[__i]; + } + + void + _M_do_or(const _Base_bitset<_Nw>& __x) + { + for (size_t __i = 0; __i < _Nw; __i++) + _M_w[__i] |= __x._M_w[__i]; + } + + void + _M_do_xor(const _Base_bitset<_Nw>& __x) + { + for (size_t __i = 0; __i < _Nw; __i++) + _M_w[__i] ^= __x._M_w[__i]; + } + + void + _M_do_left_shift(size_t __shift); + + void + _M_do_right_shift(size_t __shift); + + void + _M_do_flip() + { + for (size_t __i = 0; __i < _Nw; __i++) + _M_w[__i] = ~_M_w[__i]; + } + + void + _M_do_set() + { + for (size_t __i = 0; __i < _Nw; __i++) + _M_w[__i] = ~static_cast<_WordT>(0); + } + + void + _M_do_reset() + { std::memset(_M_w, 0, _Nw * sizeof(_WordT)); } + + bool + _M_is_equal(const _Base_bitset<_Nw>& __x) const + { + for (size_t __i = 0; __i < _Nw; ++__i) + { + if (_M_w[__i] != __x._M_w[__i]) + return false; + } + return true; + } + + bool + _M_is_any() const + { + for (size_t __i = 0; __i < _Nw; __i++) + { + if (_M_w[__i] != static_cast<_WordT>(0)) + return true; + } + return false; + } + + size_t + _M_do_count() const + { + size_t __result = 0; + for (size_t __i = 0; __i < _Nw; __i++) + __result += __builtin_popcountl(_M_w[__i]); + return __result; + } + + unsigned long + _M_do_to_ulong() const; + + // find first "on" bit + size_t + _M_do_find_first(size_t __not_found) const; + + // find the next "on" bit that follows "prev" + size_t + _M_do_find_next(size_t __prev, size_t __not_found) const; + }; + + // Definitions of non-inline functions from _Base_bitset. + template + void + _Base_bitset<_Nw>::_M_do_left_shift(size_t __shift) + { + if (__builtin_expect(__shift != 0, 1)) + { + const size_t __wshift = __shift / _GLIBCXX_BITSET_BITS_PER_WORD; + const size_t __offset = __shift % _GLIBCXX_BITSET_BITS_PER_WORD; + + if (__offset == 0) + for (size_t __n = _Nw - 1; __n >= __wshift; --__n) + _M_w[__n] = _M_w[__n - __wshift]; + else + { + const size_t __sub_offset = (_GLIBCXX_BITSET_BITS_PER_WORD + - __offset); + for (size_t __n = _Nw - 1; __n > __wshift; --__n) + _M_w[__n] = ((_M_w[__n - __wshift] << __offset) + | (_M_w[__n - __wshift - 1] >> __sub_offset)); + _M_w[__wshift] = _M_w[0] << __offset; + } + + std::fill(_M_w + 0, _M_w + __wshift, static_cast<_WordT>(0)); + } + } + + template + void + _Base_bitset<_Nw>::_M_do_right_shift(size_t __shift) + { + if (__builtin_expect(__shift != 0, 1)) + { + const size_t __wshift = __shift / _GLIBCXX_BITSET_BITS_PER_WORD; + const size_t __offset = __shift % _GLIBCXX_BITSET_BITS_PER_WORD; + const size_t __limit = _Nw - __wshift - 1; + + if (__offset == 0) + for (size_t __n = 0; __n <= __limit; ++__n) + _M_w[__n] = _M_w[__n + __wshift]; + else + { + const size_t __sub_offset = (_GLIBCXX_BITSET_BITS_PER_WORD + - __offset); + for (size_t __n = 0; __n < __limit; ++__n) + _M_w[__n] = ((_M_w[__n + __wshift] >> __offset) + | (_M_w[__n + __wshift + 1] << __sub_offset)); + _M_w[__limit] = _M_w[_Nw-1] >> __offset; + } + + std::fill(_M_w + __limit + 1, _M_w + _Nw, static_cast<_WordT>(0)); + } + } + + template + unsigned long + _Base_bitset<_Nw>::_M_do_to_ulong() const + { + for (size_t __i = 1; __i < _Nw; ++__i) + if (_M_w[__i]) + __throw_overflow_error(__N("_Base_bitset::_M_do_to_ulong")); + return _M_w[0]; + } + + template + size_t + _Base_bitset<_Nw>::_M_do_find_first(size_t __not_found) const + { + for (size_t __i = 0; __i < _Nw; __i++) + { + _WordT __thisword = _M_w[__i]; + if (__thisword != static_cast<_WordT>(0)) + return (__i * _GLIBCXX_BITSET_BITS_PER_WORD + + __builtin_ctzl(__thisword)); + } + // not found, so return an indication of failure. + return __not_found; + } + + template + size_t + _Base_bitset<_Nw>::_M_do_find_next(size_t __prev, size_t __not_found) const + { + // make bound inclusive + ++__prev; + + // check out of bounds + if (__prev >= _Nw * _GLIBCXX_BITSET_BITS_PER_WORD) + return __not_found; + + // search first word + size_t __i = _S_whichword(__prev); + _WordT __thisword = _M_w[__i]; + + // mask off bits below bound + __thisword &= (~static_cast<_WordT>(0)) << _S_whichbit(__prev); + + if (__thisword != static_cast<_WordT>(0)) + return (__i * _GLIBCXX_BITSET_BITS_PER_WORD + + __builtin_ctzl(__thisword)); + + // check subsequent words + __i++; + for (; __i < _Nw; __i++) + { + __thisword = _M_w[__i]; + if (__thisword != static_cast<_WordT>(0)) + return (__i * _GLIBCXX_BITSET_BITS_PER_WORD + + __builtin_ctzl(__thisword)); + } + // not found, so return an indication of failure. + return __not_found; + } // end _M_do_find_next + + /** + * @if maint + * Base class, specialization for a single word. + * + * See documentation for bitset. + * @endif + */ + template<> + struct _Base_bitset<1> + { + typedef unsigned long _WordT; + _WordT _M_w; + + _Base_bitset(void) + : _M_w(0) + { } + + _Base_bitset(unsigned long __val) + : _M_w(__val) + { } + + static size_t + _S_whichword(size_t __pos ) + { return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; } + + static size_t + _S_whichbyte(size_t __pos ) + { return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; } + + static size_t + _S_whichbit(size_t __pos ) + { return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; } + + static _WordT + _S_maskbit(size_t __pos ) + { return (static_cast<_WordT>(1)) << _S_whichbit(__pos); } + + _WordT& + _M_getword(size_t) + { return _M_w; } + + _WordT + _M_getword(size_t) const + { return _M_w; } + + _WordT& + _M_hiword() + { return _M_w; } + + _WordT + _M_hiword() const + { return _M_w; } + + void + _M_do_and(const _Base_bitset<1>& __x) + { _M_w &= __x._M_w; } + + void + _M_do_or(const _Base_bitset<1>& __x) + { _M_w |= __x._M_w; } + + void + _M_do_xor(const _Base_bitset<1>& __x) + { _M_w ^= __x._M_w; } + + void + _M_do_left_shift(size_t __shift) + { _M_w <<= __shift; } + + void + _M_do_right_shift(size_t __shift) + { _M_w >>= __shift; } + + void + _M_do_flip() + { _M_w = ~_M_w; } + + void + _M_do_set() + { _M_w = ~static_cast<_WordT>(0); } + + void + _M_do_reset() + { _M_w = 0; } + + bool + _M_is_equal(const _Base_bitset<1>& __x) const + { return _M_w == __x._M_w; } + + bool + _M_is_any() const + { return _M_w != 0; } + + size_t + _M_do_count() const + { return __builtin_popcountl(_M_w); } + + unsigned long + _M_do_to_ulong() const + { return _M_w; } + + size_t + _M_do_find_first(size_t __not_found) const + { + if (_M_w != 0) + return __builtin_ctzl(_M_w); + else + return __not_found; + } + + // find the next "on" bit that follows "prev" + size_t + _M_do_find_next(size_t __prev, size_t __not_found) const + { + ++__prev; + if (__prev >= ((size_t) _GLIBCXX_BITSET_BITS_PER_WORD)) + return __not_found; + + _WordT __x = _M_w >> __prev; + if (__x != 0) + return __builtin_ctzl(__x) + __prev; + else + return __not_found; + } + }; + + /** + * @if maint + * Base class, specialization for no storage (zero-length %bitset). + * + * See documentation for bitset. + * @endif + */ + template<> + struct _Base_bitset<0> + { + typedef unsigned long _WordT; + + _Base_bitset() + { } + + _Base_bitset(unsigned long) + { } + + static size_t + _S_whichword(size_t __pos ) + { return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; } + + static size_t + _S_whichbyte(size_t __pos ) + { return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; } + + static size_t + _S_whichbit(size_t __pos ) + { return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; } + + static _WordT + _S_maskbit(size_t __pos ) + { return (static_cast<_WordT>(1)) << _S_whichbit(__pos); } + + // This would normally give access to the data. The bounds-checking + // in the bitset class will prevent the user from getting this far, + // but (1) it must still return an lvalue to compile, and (2) the + // user might call _Unchecked_set directly, in which case this /needs/ + // to fail. Let's not penalize zero-length users unless they actually + // make an unchecked call; all the memory ugliness is therefore + // localized to this single should-never-get-this-far function. + _WordT& + _M_getword(size_t) const + { + __throw_out_of_range(__N("_Base_bitset::_M_getword")); + return *new _WordT; + } + + _WordT + _M_hiword() const + { return 0; } + + void + _M_do_and(const _Base_bitset<0>&) + { } + + void + _M_do_or(const _Base_bitset<0>&) + { } + + void + _M_do_xor(const _Base_bitset<0>&) + { } + + void + _M_do_left_shift(size_t) + { } + + void + _M_do_right_shift(size_t) + { } + + void + _M_do_flip() + { } + + void + _M_do_set() + { } + + void + _M_do_reset() + { } + + // Are all empty bitsets equal to each other? Are they equal to + // themselves? How to compare a thing which has no state? What is + // the sound of one zero-length bitset clapping? + bool + _M_is_equal(const _Base_bitset<0>&) const + { return true; } + + bool + _M_is_any() const + { return false; } + + size_t + _M_do_count() const + { return 0; } + + unsigned long + _M_do_to_ulong() const + { return 0; } + + // Normally "not found" is the size, but that could also be + // misinterpreted as an index in this corner case. Oh well. + size_t + _M_do_find_first(size_t) const + { return 0; } + + size_t + _M_do_find_next(size_t, size_t) const + { return 0; } + }; + + + // Helper class to zero out the unused high-order bits in the highest word. + template + struct _Sanitize + { + static void _S_do_sanitize(unsigned long& __val) + { __val &= ~((~static_cast(0)) << _Extrabits); } + }; + + template<> + struct _Sanitize<0> + { static void _S_do_sanitize(unsigned long) {} }; + + /** + * @brief The %bitset class represents a @e fixed-size sequence of bits. + * + * @ingroup Containers + * + * (Note that %bitset does @e not meet the formal requirements of a + * container. Mainly, it lacks iterators.) + * + * The template argument, @a Nb, may be any non-negative number, + * specifying the number of bits (e.g., "0", "12", "1024*1024"). + * + * In the general unoptimized case, storage is allocated in word-sized + * blocks. Let B be the number of bits in a word, then (Nb+(B-1))/B + * words will be used for storage. B - Nb%B bits are unused. (They are + * the high-order bits in the highest word.) It is a class invariant + * that those unused bits are always zero. + * + * If you think of %bitset as "a simple array of bits," be aware that + * your mental picture is reversed: a %bitset behaves the same way as + * bits in integers do, with the bit at index 0 in the "least significant + * / right-hand" position, and the bit at index Nb-1 in the "most + * significant / left-hand" position. Thus, unlike other containers, a + * %bitset's index "counts from right to left," to put it very loosely. + * + * This behavior is preserved when translating to and from strings. For + * example, the first line of the following program probably prints + * "b('a') is 0001100001" on a modern ASCII system. + * + * @code + * #include + * #include + * #include + * + * using namespace std; + * + * int main() + * { + * long a = 'a'; + * bitset<10> b(a); + * + * cout << "b('a') is " << b << endl; + * + * ostringstream s; + * s << b; + * string str = s.str(); + * cout << "index 3 in the string is " << str[3] << " but\n" + * << "index 3 in the bitset is " << b[3] << endl; + * } + * @endcode + * + * Also see http://gcc.gnu.org/onlinedocs/libstdc++/ext/sgiexts.html#ch23 + * for a description of extensions. + * + * @if maint + * Most of the actual code isn't contained in %bitset<> itself, but in the + * base class _Base_bitset. The base class works with whole words, not with + * individual bits. This allows us to specialize _Base_bitset for the + * important special case where the %bitset is only a single word. + * + * Extra confusion can result due to the fact that the storage for + * _Base_bitset @e is a regular array, and is indexed as such. This is + * carefully encapsulated. + * @endif + */ + template + class bitset + : private _Base_bitset<_GLIBCXX_BITSET_WORDS(_Nb)> + { + private: + typedef _Base_bitset<_GLIBCXX_BITSET_WORDS(_Nb)> _Base; + typedef unsigned long _WordT; + + void + _M_do_sanitize() + { + _Sanitize<_Nb % _GLIBCXX_BITSET_BITS_PER_WORD>:: + _S_do_sanitize(this->_M_hiword()); + } + + public: + /** + * This encapsulates the concept of a single bit. An instance of this + * class is a proxy for an actual bit; this way the individual bit + * operations are done as faster word-size bitwise instructions. + * + * Most users will never need to use this class directly; conversions + * to and from bool are automatic and should be transparent. Overloaded + * operators help to preserve the illusion. + * + * (On a typical system, this "bit %reference" is 64 times the size of + * an actual bit. Ha.) + */ + class reference + { + friend class bitset; + + _WordT *_M_wp; + size_t _M_bpos; + + // left undefined + reference(); + + public: + reference(bitset& __b, size_t __pos) + { + _M_wp = &__b._M_getword(__pos); + _M_bpos = _Base::_S_whichbit(__pos); + } + + ~reference() + { } + + // For b[i] = __x; + reference& + operator=(bool __x) + { + if (__x) + *_M_wp |= _Base::_S_maskbit(_M_bpos); + else + *_M_wp &= ~_Base::_S_maskbit(_M_bpos); + return *this; + } + + // For b[i] = b[__j]; + reference& + operator=(const reference& __j) + { + if ((*(__j._M_wp) & _Base::_S_maskbit(__j._M_bpos))) + *_M_wp |= _Base::_S_maskbit(_M_bpos); + else + *_M_wp &= ~_Base::_S_maskbit(_M_bpos); + return *this; + } + + // Flips the bit + bool + operator~() const + { return (*(_M_wp) & _Base::_S_maskbit(_M_bpos)) == 0; } + + // For __x = b[i]; + operator bool() const + { return (*(_M_wp) & _Base::_S_maskbit(_M_bpos)) != 0; } + + // For b[i].flip(); + reference& + flip() + { + *_M_wp ^= _Base::_S_maskbit(_M_bpos); + return *this; + } + }; + friend class reference; + + // 23.3.5.1 constructors: + /// All bits set to zero. + bitset() + { } + + /// Initial bits bitwise-copied from a single word (others set to zero). + bitset(unsigned long __val) + : _Base(__val) + { _M_do_sanitize(); } + + /** + * @brief Use a subset of a string. + * @param s A string of '0' and '1' characters. + * @param position Index of the first character in @a s to use; + * defaults to zero. + * @throw std::out_of_range If @a pos is bigger the size of @a s. + * @throw std::invalid_argument If a character appears in the string + * which is neither '0' nor '1'. + */ + template + explicit + bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __s, + size_t __position = 0) + : _Base() + { + if (__position > __s.size()) + __throw_out_of_range(__N("bitset::bitset initial position " + "not valid")); + _M_copy_from_string(__s, __position, + std::basic_string<_CharT, _Traits, _Alloc>::npos); + } + + /** + * @brief Use a subset of a string. + * @param s A string of '0' and '1' characters. + * @param position Index of the first character in @a s to use. + * @param n The number of characters to copy. + * @throw std::out_of_range If @a pos is bigger the size of @a s. + * @throw std::invalid_argument If a character appears in the string + * which is neither '0' nor '1'. + */ + template + bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __s, + size_t __position, size_t __n) + : _Base() + { + if (__position > __s.size()) + __throw_out_of_range(__N("bitset::bitset initial position " + "not valid")); + _M_copy_from_string(__s, __position, __n); + } + + // 23.3.5.2 bitset operations: + //@{ + /** + * @brief Operations on bitsets. + * @param rhs A same-sized bitset. + * + * These should be self-explanatory. + */ + bitset<_Nb>& + operator&=(const bitset<_Nb>& __rhs) + { + this->_M_do_and(__rhs); + return *this; + } + + bitset<_Nb>& + operator|=(const bitset<_Nb>& __rhs) + { + this->_M_do_or(__rhs); + return *this; + } + + bitset<_Nb>& + operator^=(const bitset<_Nb>& __rhs) + { + this->_M_do_xor(__rhs); + return *this; + } + //@} + + //@{ + /** + * @brief Operations on bitsets. + * @param position The number of places to shift. + * + * These should be self-explanatory. + */ + bitset<_Nb>& + operator<<=(size_t __position) + { + if (__builtin_expect(__position < _Nb, 1)) + { + this->_M_do_left_shift(__position); + this->_M_do_sanitize(); + } + else + this->_M_do_reset(); + return *this; + } + + bitset<_Nb>& + operator>>=(size_t __position) + { + if (__builtin_expect(__position < _Nb, 1)) + { + this->_M_do_right_shift(__position); + this->_M_do_sanitize(); + } + else + this->_M_do_reset(); + return *this; + } + //@} + + //@{ + /** + * These versions of single-bit set, reset, flip, and test are + * extensions from the SGI version. They do no range checking. + * @ingroup SGIextensions + */ + bitset<_Nb>& + _Unchecked_set(size_t __pos) + { + this->_M_getword(__pos) |= _Base::_S_maskbit(__pos); + return *this; + } + + bitset<_Nb>& + _Unchecked_set(size_t __pos, int __val) + { + if (__val) + this->_M_getword(__pos) |= _Base::_S_maskbit(__pos); + else + this->_M_getword(__pos) &= ~_Base::_S_maskbit(__pos); + return *this; + } + + bitset<_Nb>& + _Unchecked_reset(size_t __pos) + { + this->_M_getword(__pos) &= ~_Base::_S_maskbit(__pos); + return *this; + } + + bitset<_Nb>& + _Unchecked_flip(size_t __pos) + { + this->_M_getword(__pos) ^= _Base::_S_maskbit(__pos); + return *this; + } + + bool + _Unchecked_test(size_t __pos) const + { return ((this->_M_getword(__pos) & _Base::_S_maskbit(__pos)) + != static_cast<_WordT>(0)); } + //@} + + // Set, reset, and flip. + /** + * @brief Sets every bit to true. + */ + bitset<_Nb>& + set() + { + this->_M_do_set(); + this->_M_do_sanitize(); + return *this; + } + + /** + * @brief Sets a given bit to a particular value. + * @param position The index of the bit. + * @param val Either true or false, defaults to true. + * @throw std::out_of_range If @a pos is bigger the size of the %set. + */ + bitset<_Nb>& + set(size_t __position, bool __val = true) + { + if (__position >= _Nb) + __throw_out_of_range(__N("bitset::set")); + return _Unchecked_set(__position, __val); + } + + /** + * @brief Sets every bit to false. + */ + bitset<_Nb>& + reset() + { + this->_M_do_reset(); + return *this; + } + + /** + * @brief Sets a given bit to false. + * @param position The index of the bit. + * @throw std::out_of_range If @a pos is bigger the size of the %set. + * + * Same as writing @c set(pos,false). + */ + bitset<_Nb>& + reset(size_t __position) + { + if (__position >= _Nb) + __throw_out_of_range(__N("bitset::reset")); + return _Unchecked_reset(__position); + } + + /** + * @brief Toggles every bit to its opposite value. + */ + bitset<_Nb>& + flip() + { + this->_M_do_flip(); + this->_M_do_sanitize(); + return *this; + } + + /** + * @brief Toggles a given bit to its opposite value. + * @param position The index of the bit. + * @throw std::out_of_range If @a pos is bigger the size of the %set. + */ + bitset<_Nb>& + flip(size_t __position) + { + if (__position >= _Nb) + __throw_out_of_range(__N("bitset::flip")); + return _Unchecked_flip(__position); + } + + /// See the no-argument flip(). + bitset<_Nb> + operator~() const + { return bitset<_Nb>(*this).flip(); } + + //@{ + /** + * @brief Array-indexing support. + * @param position Index into the %bitset. + * @return A bool for a 'const %bitset'. For non-const bitsets, an + * instance of the reference proxy class. + * @note These operators do no range checking and throw no exceptions, + * as required by DR 11 to the standard. + * + * @if maint + * _GLIBCXX_RESOLVE_LIB_DEFECTS Note that this implementation already + * resolves DR 11 (items 1 and 2), but does not do the range-checking + * required by that DR's resolution. -pme + * The DR has since been changed: range-checking is a precondition + * (users' responsibility), and these functions must not throw. -pme + * @endif + */ + reference + operator[](size_t __position) + { return reference(*this,__position); } + + bool + operator[](size_t __position) const + { return _Unchecked_test(__position); } + //@} + + /** + * @brief Retuns a numerical interpretation of the %bitset. + * @return The integral equivalent of the bits. + * @throw std::overflow_error If there are too many bits to be + * represented in an @c unsigned @c long. + */ + unsigned long + to_ulong() const + { return this->_M_do_to_ulong(); } + + /** + * @brief Retuns a character interpretation of the %bitset. + * @return The string equivalent of the bits. + * + * Note the ordering of the bits: decreasing character positions + * correspond to increasing bit positions (see the main class notes for + * an example). + */ + template + std::basic_string<_CharT, _Traits, _Alloc> + to_string() const + { + std::basic_string<_CharT, _Traits, _Alloc> __result; + _M_copy_to_string(__result); + return __result; + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 434. bitset::to_string() hard to use. + template + std::basic_string<_CharT, _Traits, std::allocator<_CharT> > + to_string() const + { return to_string<_CharT, _Traits, std::allocator<_CharT> >(); } + + template + std::basic_string<_CharT, std::char_traits<_CharT>, + std::allocator<_CharT> > + to_string() const + { + return to_string<_CharT, std::char_traits<_CharT>, + std::allocator<_CharT> >(); + } + + std::basic_string, std::allocator > + to_string() const + { + return to_string, + std::allocator >(); + } + + // Helper functions for string operations. + template + void + _M_copy_from_string(const std::basic_string<_CharT, + _Traits, _Alloc>& __s, + size_t, size_t); + + template + void + _M_copy_to_string(std::basic_string<_CharT, _Traits, _Alloc>&) const; + + /// Returns the number of bits which are set. + size_t + count() const + { return this->_M_do_count(); } + + /// Returns the total number of bits. + size_t + size() const + { return _Nb; } + + //@{ + /// These comparisons for equality/inequality are, well, @e bitwise. + bool + operator==(const bitset<_Nb>& __rhs) const + { return this->_M_is_equal(__rhs); } + + bool + operator!=(const bitset<_Nb>& __rhs) const + { return !this->_M_is_equal(__rhs); } + //@} + + /** + * @brief Tests the value of a bit. + * @param position The index of a bit. + * @return The value at @a pos. + * @throw std::out_of_range If @a pos is bigger the size of the %set. + */ + bool + test(size_t __position) const + { + if (__position >= _Nb) + __throw_out_of_range(__N("bitset::test")); + return _Unchecked_test(__position); + } + + /** + * @brief Tests whether any of the bits are on. + * @return True if at least one bit is set. + */ + bool + any() const + { return this->_M_is_any(); } + + /** + * @brief Tests whether any of the bits are on. + * @return True if none of the bits are set. + */ + bool + none() const + { return !this->_M_is_any(); } + + //@{ + /// Self-explanatory. + bitset<_Nb> + operator<<(size_t __position) const + { return bitset<_Nb>(*this) <<= __position; } + + bitset<_Nb> + operator>>(size_t __position) const + { return bitset<_Nb>(*this) >>= __position; } + //@} + + /** + * @brief Finds the index of the first "on" bit. + * @return The index of the first bit set, or size() if not found. + * @ingroup SGIextensions + * @sa _Find_next + */ + size_t + _Find_first() const + { return this->_M_do_find_first(_Nb); } + + /** + * @brief Finds the index of the next "on" bit after prev. + * @return The index of the next bit set, or size() if not found. + * @param prev Where to start searching. + * @ingroup SGIextensions + * @sa _Find_first + */ + size_t + _Find_next(size_t __prev ) const + { return this->_M_do_find_next(__prev, _Nb); } + }; + + // Definitions of non-inline member functions. + template + template + void + bitset<_Nb>:: + _M_copy_from_string(const std::basic_string<_CharT, _Traits, + _Alloc>& __s, size_t __pos, size_t __n) + { + reset(); + const size_t __nbits = std::min(_Nb, std::min(__n, __s.size() - __pos)); + for (size_t __i = __nbits; __i > 0; --__i) + { + switch(__s[__pos + __nbits - __i]) + { + case '0': + break; + case '1': + _Unchecked_set(__i - 1); + break; + default: + __throw_invalid_argument(__N("bitset::_M_copy_from_string")); + } + } + } + + template + template + void + bitset<_Nb>:: + _M_copy_to_string(std::basic_string<_CharT, _Traits, _Alloc>& __s) const + { + __s.assign(_Nb, '0'); + for (size_t __i = _Nb; __i > 0; --__i) + if (_Unchecked_test(__i - 1)) + __s[_Nb - __i] = '1'; + } + + // 23.3.5.3 bitset operations: + //@{ + /** + * @brief Global bitwise operations on bitsets. + * @param x A bitset. + * @param y A bitset of the same size as @a x. + * @return A new bitset. + * + * These should be self-explanatory. + */ + template + inline bitset<_Nb> + operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y) + { + bitset<_Nb> __result(__x); + __result &= __y; + return __result; + } + + template + inline bitset<_Nb> + operator|(const bitset<_Nb>& __x, const bitset<_Nb>& __y) + { + bitset<_Nb> __result(__x); + __result |= __y; + return __result; + } + + template + inline bitset<_Nb> + operator^(const bitset<_Nb>& __x, const bitset<_Nb>& __y) + { + bitset<_Nb> __result(__x); + __result ^= __y; + return __result; + } + //@} + + //@{ + /** + * @brief Global I/O operators for bitsets. + * + * Direct I/O between streams and bitsets is supported. Output is + * straightforward. Input will skip whitespace, only accept '0' and '1' + * characters, and will only extract as many digits as the %bitset will + * hold. + */ + template + std::basic_istream<_CharT, _Traits>& + operator>>(std::basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x) + { + typedef typename _Traits::char_type char_type; + std::basic_string<_CharT, _Traits> __tmp; + __tmp.reserve(_Nb); + + std::ios_base::iostate __state = std::ios_base::goodbit; + typename std::basic_istream<_CharT, _Traits>::sentry __sentry(__is); + if (__sentry) + { + try + { + basic_streambuf<_CharT, _Traits>* __buf = __is.rdbuf(); + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 303. Bitset input operator underspecified + const char_type __zero = __is.widen('0'); + const char_type __one = __is.widen('1'); + for (size_t __i = _Nb; __i > 0; --__i) + { + static typename _Traits::int_type __eof = _Traits::eof(); + + typename _Traits::int_type __c1 = __buf->sbumpc(); + if (_Traits::eq_int_type(__c1, __eof)) + { + __state |= std::ios_base::eofbit; + break; + } + else + { + const char_type __c2 = _Traits::to_char_type(__c1); + if (__c2 == __zero) + __tmp.push_back('0'); + else if (__c2 == __one) + __tmp.push_back('1'); + else if (_Traits::eq_int_type(__buf->sputbackc(__c2), + __eof)) + { + __state |= std::ios_base::failbit; + break; + } + } + } + } + catch(...) + { __is._M_setstate(std::ios_base::badbit); } + } + + if (__tmp.empty() && _Nb) + __state |= std::ios_base::failbit; + else + __x._M_copy_from_string(__tmp, static_cast(0), _Nb); + if (__state) + __is.setstate(__state); + return __is; + } + + template + std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>& __os, + const bitset<_Nb>& __x) + { + std::basic_string<_CharT, _Traits> __tmp; + __x._M_copy_to_string(__tmp); + return __os << __tmp; + } + + // Specializations for zero-sized bitsets, to avoid "unsigned comparison + // with zero" warnings. + template<> + inline bitset<0>& + bitset<0>:: + set(size_t, bool) + { + __throw_out_of_range(__N("bitset::set")); + return *this; + } + + template<> + inline bitset<0>& + bitset<0>:: + reset(size_t) + { + __throw_out_of_range(__N("bitset::reset")); + return *this; + } + + template<> + inline bitset<0>& + bitset<0>:: + flip(size_t) + { + __throw_out_of_range(__N("bitset::flip")); + return *this; + } + + template<> + inline bool + bitset<0>:: + test(size_t) const + { + __throw_out_of_range(__N("bitset::test")); + return false; + } + //@} + +_GLIBCXX_END_NESTED_NAMESPACE + +#undef _GLIBCXX_BITSET_WORDS +#undef _GLIBCXX_BITSET_BITS_PER_WORD + +#ifdef _GLIBCXX_DEBUG +# include +#endif + +#endif /* _GLIBCXX_BITSET */ diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex new file mode 100644 index 00000000000..26f31f6150f --- /dev/null +++ b/libstdc++-v3/include/std/complex @@ -0,0 +1,1489 @@ +// The template and inlines for the -*- C++ -*- complex number classes. + +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file complex + * This is a Standard C++ Library header. + */ + +// +// ISO C++ 14882: 26.2 Complex Numbers +// Note: this is not a conforming implementation. +// Initially implemented by Ulrich Drepper +// Improved by Gabriel Dos Reis +// + +#ifndef _GLIBCXX_COMPLEX +#define _GLIBCXX_COMPLEX 1 + +#pragma GCC system_header + +#include +#include +#include +#include + +_GLIBCXX_BEGIN_NAMESPACE(std) + + // Forward declarations. + template class complex; + template<> class complex; + template<> class complex; + template<> class complex; + + /// Return magnitude of @a z. + template _Tp abs(const complex<_Tp>&); + /// Return phase angle of @a z. + template _Tp arg(const complex<_Tp>&); + /// Return @a z magnitude squared. + template _Tp norm(const complex<_Tp>&); + + /// Return complex conjugate of @a z. + template complex<_Tp> conj(const complex<_Tp>&); + /// Return complex with magnitude @a rho and angle @a theta. + template complex<_Tp> polar(const _Tp&, const _Tp& = 0); + + // Transcendentals: + /// Return complex cosine of @a z. + template complex<_Tp> cos(const complex<_Tp>&); + /// Return complex hyperbolic cosine of @a z. + template complex<_Tp> cosh(const complex<_Tp>&); + /// Return complex base e exponential of @a z. + template complex<_Tp> exp(const complex<_Tp>&); + /// Return complex natural logarithm of @a z. + template complex<_Tp> log(const complex<_Tp>&); + /// Return complex base 10 logarithm of @a z. + template complex<_Tp> log10(const complex<_Tp>&); + /// Return complex cosine of @a z. + template complex<_Tp> pow(const complex<_Tp>&, int); + /// Return @a x to the @a y'th power. + template complex<_Tp> pow(const complex<_Tp>&, const _Tp&); + /// Return @a x to the @a y'th power. + template complex<_Tp> pow(const complex<_Tp>&, + const complex<_Tp>&); + /// Return @a x to the @a y'th power. + template complex<_Tp> pow(const _Tp&, const complex<_Tp>&); + /// Return complex sine of @a z. + template complex<_Tp> sin(const complex<_Tp>&); + /// Return complex hyperbolic sine of @a z. + template complex<_Tp> sinh(const complex<_Tp>&); + /// Return complex square root of @a z. + template complex<_Tp> sqrt(const complex<_Tp>&); + /// Return complex tangent of @a z. + template complex<_Tp> tan(const complex<_Tp>&); + /// Return complex hyperbolic tangent of @a z. + template complex<_Tp> tanh(const complex<_Tp>&); + //@} + + + // 26.2.2 Primary template class complex + /** + * Template to represent complex numbers. + * + * Specializations for float, double, and long double are part of the + * library. Results with any other type are not guaranteed. + * + * @param Tp Type of real and imaginary values. + */ + template + struct complex + { + /// Value typedef. + typedef _Tp value_type; + + /// Default constructor. First parameter is x, second parameter is y. + /// Unspecified parameters default to 0. + complex(const _Tp& = _Tp(), const _Tp & = _Tp()); + + // Lets the compiler synthesize the copy constructor + // complex (const complex<_Tp>&); + /// Copy constructor. + template + complex(const complex<_Up>&); + + /// Return real part of complex number. + _Tp& real(); + /// Return real part of complex number. + const _Tp& real() const; + /// Return imaginary part of complex number. + _Tp& imag(); + /// Return imaginary part of complex number. + const _Tp& imag() const; + + /// Assign this complex number to scalar @a t. + complex<_Tp>& operator=(const _Tp&); + /// Add @a t to this complex number. + complex<_Tp>& operator+=(const _Tp&); + /// Subtract @a t from this complex number. + complex<_Tp>& operator-=(const _Tp&); + /// Multiply this complex number by @a t. + complex<_Tp>& operator*=(const _Tp&); + /// Divide this complex number by @a t. + complex<_Tp>& operator/=(const _Tp&); + + // Lets the compiler synthesize the + // copy and assignment operator + // complex<_Tp>& operator= (const complex<_Tp>&); + /// Assign this complex number to complex @a z. + template + complex<_Tp>& operator=(const complex<_Up>&); + /// Add @a z to this complex number. + template + complex<_Tp>& operator+=(const complex<_Up>&); + /// Subtract @a z from this complex number. + template + complex<_Tp>& operator-=(const complex<_Up>&); + /// Multiply this complex number by @a z. + template + complex<_Tp>& operator*=(const complex<_Up>&); + /// Divide this complex number by @a z. + template + complex<_Tp>& operator/=(const complex<_Up>&); + + const complex& __rep() const; + + private: + _Tp _M_real; + _Tp _M_imag; + }; + + template + inline _Tp& + complex<_Tp>::real() { return _M_real; } + + template + inline const _Tp& + complex<_Tp>::real() const { return _M_real; } + + template + inline _Tp& + complex<_Tp>::imag() { return _M_imag; } + + template + inline const _Tp& + complex<_Tp>::imag() const { return _M_imag; } + + template + inline + complex<_Tp>::complex(const _Tp& __r, const _Tp& __i) + : _M_real(__r), _M_imag(__i) { } + + template + template + inline + complex<_Tp>::complex(const complex<_Up>& __z) + : _M_real(__z.real()), _M_imag(__z.imag()) { } + + template + complex<_Tp>& + complex<_Tp>::operator=(const _Tp& __t) + { + _M_real = __t; + _M_imag = _Tp(); + return *this; + } + + // 26.2.5/1 + template + inline complex<_Tp>& + complex<_Tp>::operator+=(const _Tp& __t) + { + _M_real += __t; + return *this; + } + + // 26.2.5/3 + template + inline complex<_Tp>& + complex<_Tp>::operator-=(const _Tp& __t) + { + _M_real -= __t; + return *this; + } + + // 26.2.5/5 + template + complex<_Tp>& + complex<_Tp>::operator*=(const _Tp& __t) + { + _M_real *= __t; + _M_imag *= __t; + return *this; + } + + // 26.2.5/7 + template + complex<_Tp>& + complex<_Tp>::operator/=(const _Tp& __t) + { + _M_real /= __t; + _M_imag /= __t; + return *this; + } + + template + template + complex<_Tp>& + complex<_Tp>::operator=(const complex<_Up>& __z) + { + _M_real = __z.real(); + _M_imag = __z.imag(); + return *this; + } + + // 26.2.5/9 + template + template + complex<_Tp>& + complex<_Tp>::operator+=(const complex<_Up>& __z) + { + _M_real += __z.real(); + _M_imag += __z.imag(); + return *this; + } + + // 26.2.5/11 + template + template + complex<_Tp>& + complex<_Tp>::operator-=(const complex<_Up>& __z) + { + _M_real -= __z.real(); + _M_imag -= __z.imag(); + return *this; + } + + // 26.2.5/13 + // XXX: This is a grammar school implementation. + template + template + complex<_Tp>& + complex<_Tp>::operator*=(const complex<_Up>& __z) + { + const _Tp __r = _M_real * __z.real() - _M_imag * __z.imag(); + _M_imag = _M_real * __z.imag() + _M_imag * __z.real(); + _M_real = __r; + return *this; + } + + // 26.2.5/15 + // XXX: This is a grammar school implementation. + template + template + complex<_Tp>& + complex<_Tp>::operator/=(const complex<_Up>& __z) + { + const _Tp __r = _M_real * __z.real() + _M_imag * __z.imag(); + const _Tp __n = std::norm(__z); + _M_imag = (_M_imag * __z.real() - _M_real * __z.imag()) / __n; + _M_real = __r / __n; + return *this; + } + + template + inline const complex<_Tp>& + complex<_Tp>::__rep() const { return *this; } + + // Operators: + //@{ + /// Return new complex value @a x plus @a y. + template + inline complex<_Tp> + operator+(const complex<_Tp>& __x, const complex<_Tp>& __y) + { + complex<_Tp> __r = __x; + __r += __y; + return __r; + } + + template + inline complex<_Tp> + operator+(const complex<_Tp>& __x, const _Tp& __y) + { + complex<_Tp> __r = __x; + __r.real() += __y; + return __r; + } + + template + inline complex<_Tp> + operator+(const _Tp& __x, const complex<_Tp>& __y) + { + complex<_Tp> __r = __y; + __r.real() += __x; + return __r; + } + //@} + + //@{ + /// Return new complex value @a x minus @a y. + template + inline complex<_Tp> + operator-(const complex<_Tp>& __x, const complex<_Tp>& __y) + { + complex<_Tp> __r = __x; + __r -= __y; + return __r; + } + + template + inline complex<_Tp> + operator-(const complex<_Tp>& __x, const _Tp& __y) + { + complex<_Tp> __r = __x; + __r.real() -= __y; + return __r; + } + + template + inline complex<_Tp> + operator-(const _Tp& __x, const complex<_Tp>& __y) + { + complex<_Tp> __r(__x, -__y.imag()); + __r.real() -= __y.real(); + return __r; + } + //@} + + //@{ + /// Return new complex value @a x times @a y. + template + inline complex<_Tp> + operator*(const complex<_Tp>& __x, const complex<_Tp>& __y) + { + complex<_Tp> __r = __x; + __r *= __y; + return __r; + } + + template + inline complex<_Tp> + operator*(const complex<_Tp>& __x, const _Tp& __y) + { + complex<_Tp> __r = __x; + __r *= __y; + return __r; + } + + template + inline complex<_Tp> + operator*(const _Tp& __x, const complex<_Tp>& __y) + { + complex<_Tp> __r = __y; + __r *= __x; + return __r; + } + //@} + + //@{ + /// Return new complex value @a x divided by @a y. + template + inline complex<_Tp> + operator/(const complex<_Tp>& __x, const complex<_Tp>& __y) + { + complex<_Tp> __r = __x; + __r /= __y; + return __r; + } + + template + inline complex<_Tp> + operator/(const complex<_Tp>& __x, const _Tp& __y) + { + complex<_Tp> __r = __x; + __r /= __y; + return __r; + } + + template + inline complex<_Tp> + operator/(const _Tp& __x, const complex<_Tp>& __y) + { + complex<_Tp> __r = __x; + __r /= __y; + return __r; + } + //@} + + /// Return @a x. + template + inline complex<_Tp> + operator+(const complex<_Tp>& __x) + { return __x; } + + /// Return complex negation of @a x. + template + inline complex<_Tp> + operator-(const complex<_Tp>& __x) + { return complex<_Tp>(-__x.real(), -__x.imag()); } + + //@{ + /// Return true if @a x is equal to @a y. + template + inline bool + operator==(const complex<_Tp>& __x, const complex<_Tp>& __y) + { return __x.real() == __y.real() && __x.imag() == __y.imag(); } + + template + inline bool + operator==(const complex<_Tp>& __x, const _Tp& __y) + { return __x.real() == __y && __x.imag() == _Tp(); } + + template + inline bool + operator==(const _Tp& __x, const complex<_Tp>& __y) + { return __x == __y.real() && _Tp() == __y.imag(); } + //@} + + //@{ + /// Return false if @a x is equal to @a y. + template + inline bool + operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y) + { return __x.real() != __y.real() || __x.imag() != __y.imag(); } + + template + inline bool + operator!=(const complex<_Tp>& __x, const _Tp& __y) + { return __x.real() != __y || __x.imag() != _Tp(); } + + template + inline bool + operator!=(const _Tp& __x, const complex<_Tp>& __y) + { return __x != __y.real() || _Tp() != __y.imag(); } + //@} + + /// Extraction operator for complex values. + template + basic_istream<_CharT, _Traits>& + operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x) + { + _Tp __re_x, __im_x; + _CharT __ch; + __is >> __ch; + if (__ch == '(') + { + __is >> __re_x >> __ch; + if (__ch == ',') + { + __is >> __im_x >> __ch; + if (__ch == ')') + __x = complex<_Tp>(__re_x, __im_x); + else + __is.setstate(ios_base::failbit); + } + else if (__ch == ')') + __x = __re_x; + else + __is.setstate(ios_base::failbit); + } + else + { + __is.putback(__ch); + __is >> __re_x; + __x = __re_x; + } + return __is; + } + + /// Insertion operator for complex values. + template + basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x) + { + basic_ostringstream<_CharT, _Traits> __s; + __s.flags(__os.flags()); + __s.imbue(__os.getloc()); + __s.precision(__os.precision()); + __s << '(' << __x.real() << ',' << __x.imag() << ')'; + return __os << __s.str(); + } + + // Values + template + inline _Tp& + real(complex<_Tp>& __z) + { return __z.real(); } + + template + inline const _Tp& + real(const complex<_Tp>& __z) + { return __z.real(); } + + template + inline _Tp& + imag(complex<_Tp>& __z) + { return __z.imag(); } + + template + inline const _Tp& + imag(const complex<_Tp>& __z) + { return __z.imag(); } + + // 26.2.7/3 abs(__z): Returns the magnitude of __z. + template + inline _Tp + __complex_abs(const complex<_Tp>& __z) + { + _Tp __x = __z.real(); + _Tp __y = __z.imag(); + const _Tp __s = std::max(abs(__x), abs(__y)); + if (__s == _Tp()) // well ... + return __s; + __x /= __s; + __y /= __s; + return __s * sqrt(__x * __x + __y * __y); + } + +#if _GLIBCXX_USE_C99_COMPLEX + inline float + __complex_abs(__complex__ float __z) { return __builtin_cabsf(__z); } + + inline double + __complex_abs(__complex__ double __z) { return __builtin_cabs(__z); } + + inline long double + __complex_abs(const __complex__ long double& __z) + { return __builtin_cabsl(__z); } + + template + inline _Tp + abs(const complex<_Tp>& __z) { return __complex_abs(__z.__rep()); } +#else + template + inline _Tp + abs(const complex<_Tp>& __z) { return __complex_abs(__z); } +#endif + + + // 26.2.7/4: arg(__z): Returns the phase angle of __z. + template + inline _Tp + __complex_arg(const complex<_Tp>& __z) + { return atan2(__z.imag(), __z.real()); } + +#if _GLIBCXX_USE_C99_COMPLEX + inline float + __complex_arg(__complex__ float __z) { return __builtin_cargf(__z); } + + inline double + __complex_arg(__complex__ double __z) { return __builtin_carg(__z); } + + inline long double + __complex_arg(const __complex__ long double& __z) + { return __builtin_cargl(__z); } + + template + inline _Tp + arg(const complex<_Tp>& __z) { return __complex_arg(__z.__rep()); } +#else + template + inline _Tp + arg(const complex<_Tp>& __z) { return __complex_arg(__z); } +#endif + + // 26.2.7/5: norm(__z) returns the squared magintude of __z. + // As defined, norm() is -not- a norm is the common mathematical + // sens used in numerics. The helper class _Norm_helper<> tries to + // distinguish between builtin floating point and the rest, so as + // to deliver an answer as close as possible to the real value. + template + struct _Norm_helper + { + template + static inline _Tp _S_do_it(const complex<_Tp>& __z) + { + const _Tp __x = __z.real(); + const _Tp __y = __z.imag(); + return __x * __x + __y * __y; + } + }; + + template<> + struct _Norm_helper + { + template + static inline _Tp _S_do_it(const complex<_Tp>& __z) + { + _Tp __res = std::abs(__z); + return __res * __res; + } + }; + + template + inline _Tp + norm(const complex<_Tp>& __z) + { + return _Norm_helper<__is_floating<_Tp>::__value + && !_GLIBCXX_FAST_MATH>::_S_do_it(__z); + } + + template + inline complex<_Tp> + polar(const _Tp& __rho, const _Tp& __theta) + { return complex<_Tp>(__rho * cos(__theta), __rho * sin(__theta)); } + + template + inline complex<_Tp> + conj(const complex<_Tp>& __z) + { return complex<_Tp>(__z.real(), -__z.imag()); } + + // Transcendentals + + // 26.2.8/1 cos(__z): Returns the cosine of __z. + template + inline complex<_Tp> + __complex_cos(const complex<_Tp>& __z) + { + const _Tp __x = __z.real(); + const _Tp __y = __z.imag(); + return complex<_Tp>(cos(__x) * cosh(__y), -sin(__x) * sinh(__y)); + } + +#if _GLIBCXX_USE_C99_COMPLEX + inline __complex__ float + __complex_cos(__complex__ float __z) { return __builtin_ccosf(__z); } + + inline __complex__ double + __complex_cos(__complex__ double __z) { return __builtin_ccos(__z); } + + inline __complex__ long double + __complex_cos(const __complex__ long double& __z) + { return __builtin_ccosl(__z); } + + template + inline complex<_Tp> + cos(const complex<_Tp>& __z) { return __complex_cos(__z.__rep()); } +#else + template + inline complex<_Tp> + cos(const complex<_Tp>& __z) { return __complex_cos(__z); } +#endif + + // 26.2.8/2 cosh(__z): Returns the hyperbolic cosine of __z. + template + inline complex<_Tp> + __complex_cosh(const complex<_Tp>& __z) + { + const _Tp __x = __z.real(); + const _Tp __y = __z.imag(); + return complex<_Tp>(cosh(__x) * cos(__y), sinh(__x) * sin(__y)); + } + +#if _GLIBCXX_USE_C99_COMPLEX + inline __complex__ float + __complex_cosh(__complex__ float __z) { return __builtin_ccoshf(__z); } + + inline __complex__ double + __complex_cosh(__complex__ double __z) { return __builtin_ccosh(__z); } + + inline __complex__ long double + __complex_cosh(const __complex__ long double& __z) + { return __builtin_ccoshl(__z); } + + template + inline complex<_Tp> + cosh(const complex<_Tp>& __z) { return __complex_cosh(__z.__rep()); } +#else + template + inline complex<_Tp> + cosh(const complex<_Tp>& __z) { return __complex_cosh(__z); } +#endif + + // 26.2.8/3 exp(__z): Returns the complex base e exponential of x + template + inline complex<_Tp> + __complex_exp(const complex<_Tp>& __z) + { return std::polar(exp(__z.real()), __z.imag()); } + +#if _GLIBCXX_USE_C99_COMPLEX + inline __complex__ float + __complex_exp(__complex__ float __z) { return __builtin_cexpf(__z); } + + inline __complex__ double + __complex_exp(__complex__ double __z) { return __builtin_cexp(__z); } + + inline __complex__ long double + __complex_exp(const __complex__ long double& __z) + { return __builtin_cexpl(__z); } + + template + inline complex<_Tp> + exp(const complex<_Tp>& __z) { return __complex_exp(__z.__rep()); } +#else + template + inline complex<_Tp> + exp(const complex<_Tp>& __z) { return __complex_exp(__z); } +#endif + + // 26.2.8/5 log(__z): Reurns the natural complex logaritm of __z. + // The branch cut is along the negative axis. + template + inline complex<_Tp> + __complex_log(const complex<_Tp>& __z) + { return complex<_Tp>(log(std::abs(__z)), std::arg(__z)); } + +#if _GLIBCXX_USE_C99_COMPLEX + inline __complex__ float + __complex_log(__complex__ float __z) { return __builtin_clogf(__z); } + + inline __complex__ double + __complex_log(__complex__ double __z) { return __builtin_clog(__z); } + + inline __complex__ long double + __complex_log(const __complex__ long double& __z) + { return __builtin_clogl(__z); } + + template + inline complex<_Tp> + log(const complex<_Tp>& __z) { return __complex_log(__z.__rep()); } +#else + template + inline complex<_Tp> + log(const complex<_Tp>& __z) { return __complex_log(__z); } +#endif + + template + inline complex<_Tp> + log10(const complex<_Tp>& __z) + { return std::log(__z) / log(_Tp(10.0)); } + + // 26.2.8/10 sin(__z): Returns the sine of __z. + template + inline complex<_Tp> + __complex_sin(const complex<_Tp>& __z) + { + const _Tp __x = __z.real(); + const _Tp __y = __z.imag(); + return complex<_Tp>(sin(__x) * cosh(__y), cos(__x) * sinh(__y)); + } + +#if _GLIBCXX_USE_C99_COMPLEX + inline __complex__ float + __complex_sin(__complex__ float __z) { return __builtin_csinf(__z); } + + inline __complex__ double + __complex_sin(__complex__ double __z) { return __builtin_csin(__z); } + + inline __complex__ long double + __complex_sin(const __complex__ long double& __z) + { return __builtin_csinl(__z); } + + template + inline complex<_Tp> + sin(const complex<_Tp>& __z) { return __complex_sin(__z.__rep()); } +#else + template + inline complex<_Tp> + sin(const complex<_Tp>& __z) { return __complex_sin(__z); } +#endif + + // 26.2.8/11 sinh(__z): Returns the hyperbolic sine of __z. + template + inline complex<_Tp> + __complex_sinh(const complex<_Tp>& __z) + { + const _Tp __x = __z.real(); + const _Tp __y = __z.imag(); + return complex<_Tp>(sinh(__x) * cos(__y), cosh(__x) * sin(__y)); + } + +#if _GLIBCXX_USE_C99_COMPLEX + inline __complex__ float + __complex_sinh(__complex__ float __z) { return __builtin_csinhf(__z); } + + inline __complex__ double + __complex_sinh(__complex__ double __z) { return __builtin_csinh(__z); } + + inline __complex__ long double + __complex_sinh(const __complex__ long double& __z) + { return __builtin_csinhl(__z); } + + template + inline complex<_Tp> + sinh(const complex<_Tp>& __z) { return __complex_sinh(__z.__rep()); } +#else + template + inline complex<_Tp> + sinh(const complex<_Tp>& __z) { return __complex_sinh(__z); } +#endif + + // 26.2.8/13 sqrt(__z): Returns the complex square root of __z. + // The branch cut is on the negative axis. + template + complex<_Tp> + __complex_sqrt(const complex<_Tp>& __z) + { + _Tp __x = __z.real(); + _Tp __y = __z.imag(); + + if (__x == _Tp()) + { + _Tp __t = sqrt(abs(__y) / 2); + return complex<_Tp>(__t, __y < _Tp() ? -__t : __t); + } + else + { + _Tp __t = sqrt(2 * (std::abs(__z) + abs(__x))); + _Tp __u = __t / 2; + return __x > _Tp() + ? complex<_Tp>(__u, __y / __t) + : complex<_Tp>(abs(__y) / __t, __y < _Tp() ? -__u : __u); + } + } + +#if _GLIBCXX_USE_C99_COMPLEX + inline __complex__ float + __complex_sqrt(__complex__ float __z) { return __builtin_csqrtf(__z); } + + inline __complex__ double + __complex_sqrt(__complex__ double __z) { return __builtin_csqrt(__z); } + + inline __complex__ long double + __complex_sqrt(const __complex__ long double& __z) + { return __builtin_csqrtl(__z); } + + template + inline complex<_Tp> + sqrt(const complex<_Tp>& __z) { return __complex_sqrt(__z.__rep()); } +#else + template + inline complex<_Tp> + sqrt(const complex<_Tp>& __z) { return __complex_sqrt(__z); } +#endif + + // 26.2.8/14 tan(__z): Return the complex tangent of __z. + + template + inline complex<_Tp> + __complex_tan(const complex<_Tp>& __z) + { return std::sin(__z) / std::cos(__z); } + +#if _GLIBCXX_USE_C99_COMPLEX + inline __complex__ float + __complex_tan(__complex__ float __z) { return __builtin_ctanf(__z); } + + inline __complex__ double + __complex_tan(__complex__ double __z) { return __builtin_ctan(__z); } + + inline __complex__ long double + __complex_tan(const __complex__ long double& __z) + { return __builtin_ctanl(__z); } + + template + inline complex<_Tp> + tan(const complex<_Tp>& __z) { return __complex_tan(__z.__rep()); } +#else + template + inline complex<_Tp> + tan(const complex<_Tp>& __z) { return __complex_tan(__z); } +#endif + + + // 26.2.8/15 tanh(__z): Returns the hyperbolic tangent of __z. + + template + inline complex<_Tp> + __complex_tanh(const complex<_Tp>& __z) + { return std::sinh(__z) / std::cosh(__z); } + +#if _GLIBCXX_USE_C99_COMPLEX + inline __complex__ float + __complex_tanh(__complex__ float __z) { return __builtin_ctanhf(__z); } + + inline __complex__ double + __complex_tanh(__complex__ double __z) { return __builtin_ctanh(__z); } + + inline __complex__ long double + __complex_tanh(const __complex__ long double& __z) + { return __builtin_ctanhl(__z); } + + template + inline complex<_Tp> + tanh(const complex<_Tp>& __z) { return __complex_tanh(__z.__rep()); } +#else + template + inline complex<_Tp> + tanh(const complex<_Tp>& __z) { return __complex_tanh(__z); } +#endif + + + // 26.2.8/9 pow(__x, __y): Returns the complex power base of __x + // raised to the __y-th power. The branch + // cut is on the negative axis. + template + inline complex<_Tp> + pow(const complex<_Tp>& __z, int __n) + { return std::__pow_helper(__z, __n); } + + template + complex<_Tp> + pow(const complex<_Tp>& __x, const _Tp& __y) + { +#ifndef _GLIBCXX_USE_C99_COMPLEX + if (__x == _Tp()) + return _Tp(); +#endif + if (__x.imag() == _Tp() && __x.real() > _Tp()) + return pow(__x.real(), __y); + + complex<_Tp> __t = std::log(__x); + return std::polar(exp(__y * __t.real()), __y * __t.imag()); + } + + template + inline complex<_Tp> + __complex_pow(const complex<_Tp>& __x, const complex<_Tp>& __y) + { return __x == _Tp() ? _Tp() : std::exp(__y * std::log(__x)); } + +#if _GLIBCXX_USE_C99_COMPLEX + inline __complex__ float + __complex_pow(__complex__ float __x, __complex__ float __y) + { return __builtin_cpowf(__x, __y); } + + inline __complex__ double + __complex_pow(__complex__ double __x, __complex__ double __y) + { return __builtin_cpow(__x, __y); } + + inline __complex__ long double + __complex_pow(const __complex__ long double& __x, + const __complex__ long double& __y) + { return __builtin_cpowl(__x, __y); } + + template + inline complex<_Tp> + pow(const complex<_Tp>& __x, const complex<_Tp>& __y) + { return __complex_pow(__x.__rep(), __y.__rep()); } +#else + template + inline complex<_Tp> + pow(const complex<_Tp>& __x, const complex<_Tp>& __y) + { return __complex_pow(__x, __y); } +#endif + + template + inline complex<_Tp> + pow(const _Tp& __x, const complex<_Tp>& __y) + { + return __x > _Tp() ? std::polar(pow(__x, __y.real()), + __y.imag() * log(__x)) + : std::pow(complex<_Tp>(__x, _Tp()), __y); + } + + // 26.2.3 complex specializations + // complex specialization + template<> + struct complex + { + typedef float value_type; + typedef __complex__ float _ComplexT; + + complex(_ComplexT __z) : _M_value(__z) { } + + complex(float = 0.0f, float = 0.0f); + + explicit complex(const complex&); + explicit complex(const complex&); + + float& real(); + const float& real() const; + float& imag(); + const float& imag() const; + + complex& operator=(float); + complex& operator+=(float); + complex& operator-=(float); + complex& operator*=(float); + complex& operator/=(float); + + // Let's the compiler synthetize the copy and assignment + // operator. It always does a pretty good job. + // complex& operator= (const complex&); + template + complex&operator=(const complex<_Tp>&); + template + complex& operator+=(const complex<_Tp>&); + template + complex& operator-=(const complex<_Tp>&); + template + complex& operator*=(const complex<_Tp>&); + template + complex&operator/=(const complex<_Tp>&); + + const _ComplexT& __rep() const { return _M_value; } + + private: + _ComplexT _M_value; + }; + + inline float& + complex::real() + { return __real__ _M_value; } + + inline const float& + complex::real() const + { return __real__ _M_value; } + + inline float& + complex::imag() + { return __imag__ _M_value; } + + inline const float& + complex::imag() const + { return __imag__ _M_value; } + + inline + complex::complex(float r, float i) + { + __real__ _M_value = r; + __imag__ _M_value = i; + } + + inline complex& + complex::operator=(float __f) + { + __real__ _M_value = __f; + __imag__ _M_value = 0.0f; + return *this; + } + + inline complex& + complex::operator+=(float __f) + { + __real__ _M_value += __f; + return *this; + } + + inline complex& + complex::operator-=(float __f) + { + __real__ _M_value -= __f; + return *this; + } + + inline complex& + complex::operator*=(float __f) + { + _M_value *= __f; + return *this; + } + + inline complex& + complex::operator/=(float __f) + { + _M_value /= __f; + return *this; + } + + template + inline complex& + complex::operator=(const complex<_Tp>& __z) + { + __real__ _M_value = __z.real(); + __imag__ _M_value = __z.imag(); + return *this; + } + + template + inline complex& + complex::operator+=(const complex<_Tp>& __z) + { + __real__ _M_value += __z.real(); + __imag__ _M_value += __z.imag(); + return *this; + } + + template + inline complex& + complex::operator-=(const complex<_Tp>& __z) + { + __real__ _M_value -= __z.real(); + __imag__ _M_value -= __z.imag(); + return *this; + } + + template + inline complex& + complex::operator*=(const complex<_Tp>& __z) + { + _ComplexT __t; + __real__ __t = __z.real(); + __imag__ __t = __z.imag(); + _M_value *= __t; + return *this; + } + + template + inline complex& + complex::operator/=(const complex<_Tp>& __z) + { + _ComplexT __t; + __real__ __t = __z.real(); + __imag__ __t = __z.imag(); + _M_value /= __t; + return *this; + } + + // 26.2.3 complex specializations + // complex specialization + template<> + struct complex + { + typedef double value_type; + typedef __complex__ double _ComplexT; + + complex(_ComplexT __z) : _M_value(__z) { } + + complex(double = 0.0, double = 0.0); + + complex(const complex&); + explicit complex(const complex&); + + double& real(); + const double& real() const; + double& imag(); + const double& imag() const; + + complex& operator=(double); + complex& operator+=(double); + complex& operator-=(double); + complex& operator*=(double); + complex& operator/=(double); + + // The compiler will synthetize this, efficiently. + // complex& operator= (const complex&); + template + complex& operator=(const complex<_Tp>&); + template + complex& operator+=(const complex<_Tp>&); + template + complex& operator-=(const complex<_Tp>&); + template + complex& operator*=(const complex<_Tp>&); + template + complex& operator/=(const complex<_Tp>&); + + const _ComplexT& __rep() const { return _M_value; } + + private: + _ComplexT _M_value; + }; + + inline double& + complex::real() + { return __real__ _M_value; } + + inline const double& + complex::real() const + { return __real__ _M_value; } + + inline double& + complex::imag() + { return __imag__ _M_value; } + + inline const double& + complex::imag() const + { return __imag__ _M_value; } + + inline + complex::complex(double __r, double __i) + { + __real__ _M_value = __r; + __imag__ _M_value = __i; + } + + inline complex& + complex::operator=(double __d) + { + __real__ _M_value = __d; + __imag__ _M_value = 0.0; + return *this; + } + + inline complex& + complex::operator+=(double __d) + { + __real__ _M_value += __d; + return *this; + } + + inline complex& + complex::operator-=(double __d) + { + __real__ _M_value -= __d; + return *this; + } + + inline complex& + complex::operator*=(double __d) + { + _M_value *= __d; + return *this; + } + + inline complex& + complex::operator/=(double __d) + { + _M_value /= __d; + return *this; + } + + template + inline complex& + complex::operator=(const complex<_Tp>& __z) + { + __real__ _M_value = __z.real(); + __imag__ _M_value = __z.imag(); + return *this; + } + + template + inline complex& + complex::operator+=(const complex<_Tp>& __z) + { + __real__ _M_value += __z.real(); + __imag__ _M_value += __z.imag(); + return *this; + } + + template + inline complex& + complex::operator-=(const complex<_Tp>& __z) + { + __real__ _M_value -= __z.real(); + __imag__ _M_value -= __z.imag(); + return *this; + } + + template + inline complex& + complex::operator*=(const complex<_Tp>& __z) + { + _ComplexT __t; + __real__ __t = __z.real(); + __imag__ __t = __z.imag(); + _M_value *= __t; + return *this; + } + + template + inline complex& + complex::operator/=(const complex<_Tp>& __z) + { + _ComplexT __t; + __real__ __t = __z.real(); + __imag__ __t = __z.imag(); + _M_value /= __t; + return *this; + } + + // 26.2.3 complex specializations + // complex specialization + template<> + struct complex + { + typedef long double value_type; + typedef __complex__ long double _ComplexT; + + complex(_ComplexT __z) : _M_value(__z) { } + + complex(long double = 0.0L, long double = 0.0L); + + complex(const complex&); + complex(const complex&); + + long double& real(); + const long double& real() const; + long double& imag(); + const long double& imag() const; + + complex& operator= (long double); + complex& operator+= (long double); + complex& operator-= (long double); + complex& operator*= (long double); + complex& operator/= (long double); + + // The compiler knows how to do this efficiently + // complex& operator= (const complex&); + template + complex& operator=(const complex<_Tp>&); + template + complex& operator+=(const complex<_Tp>&); + template + complex& operator-=(const complex<_Tp>&); + template + complex& operator*=(const complex<_Tp>&); + template + complex& operator/=(const complex<_Tp>&); + + const _ComplexT& __rep() const { return _M_value; } + + private: + _ComplexT _M_value; + }; + + inline + complex::complex(long double __r, long double __i) + { + __real__ _M_value = __r; + __imag__ _M_value = __i; + } + + inline long double& + complex::real() + { return __real__ _M_value; } + + inline const long double& + complex::real() const + { return __real__ _M_value; } + + inline long double& + complex::imag() + { return __imag__ _M_value; } + + inline const long double& + complex::imag() const + { return __imag__ _M_value; } + + inline complex& + complex::operator=(long double __r) + { + __real__ _M_value = __r; + __imag__ _M_value = 0.0L; + return *this; + } + + inline complex& + complex::operator+=(long double __r) + { + __real__ _M_value += __r; + return *this; + } + + inline complex& + complex::operator-=(long double __r) + { + __real__ _M_value -= __r; + return *this; + } + + inline complex& + complex::operator*=(long double __r) + { + _M_value *= __r; + return *this; + } + + inline complex& + complex::operator/=(long double __r) + { + _M_value /= __r; + return *this; + } + + template + inline complex& + complex::operator=(const complex<_Tp>& __z) + { + __real__ _M_value = __z.real(); + __imag__ _M_value = __z.imag(); + return *this; + } + + template + inline complex& + complex::operator+=(const complex<_Tp>& __z) + { + __real__ _M_value += __z.real(); + __imag__ _M_value += __z.imag(); + return *this; + } + + template + inline complex& + complex::operator-=(const complex<_Tp>& __z) + { + __real__ _M_value -= __z.real(); + __imag__ _M_value -= __z.imag(); + return *this; + } + + template + inline complex& + complex::operator*=(const complex<_Tp>& __z) + { + _ComplexT __t; + __real__ __t = __z.real(); + __imag__ __t = __z.imag(); + _M_value *= __t; + return *this; + } + + template + inline complex& + complex::operator/=(const complex<_Tp>& __z) + { + _ComplexT __t; + __real__ __t = __z.real(); + __imag__ __t = __z.imag(); + _M_value /= __t; + return *this; + } + + // These bits have to be at the end of this file, so that the + // specializations have all been defined. + // ??? No, they have to be there because of compiler limitation at + // inlining. It suffices that class specializations be defined. + inline + complex::complex(const complex& __z) + : _M_value(__z.__rep()) { } + + inline + complex::complex(const complex& __z) + : _M_value(__z.__rep()) { } + + inline + complex::complex(const complex& __z) + : _M_value(__z.__rep()) { } + + inline + complex::complex(const complex& __z) + : _M_value(__z.__rep()) { } + + inline + complex::complex(const complex& __z) + : _M_value(__z.__rep()) { } + + inline + complex::complex(const complex& __z) + : _M_value(__z.__rep()) { } + +_GLIBCXX_END_NAMESPACE + +#endif /* _GLIBCXX_COMPLEX */ diff --git a/libstdc++-v3/include/std/deque b/libstdc++-v3/include/std/deque new file mode 100644 index 00000000000..57c6e4347ad --- /dev/null +++ b/libstdc++-v3/include/std/deque @@ -0,0 +1,80 @@ +// -*- C++ -*- + +// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file include/deque + * This is a Standard C++ Library header. + */ + +#ifndef _GLIBCXX_DEQUE +#define _GLIBCXX_DEQUE 1 + +#pragma GCC system_header + +#include +#include +#include +#include +#include +#include + +#ifndef _GLIBCXX_EXPORT_TEMPLATE +# include +#endif + +#ifdef _GLIBCXX_DEBUG +# include +#endif + +#endif /* _GLIBCXX_DEQUE */ diff --git a/libstdc++-v3/include/std/fstream b/libstdc++-v3/include/std/fstream new file mode 100644 index 00000000000..f664f2de9f4 --- /dev/null +++ b/libstdc++-v3/include/std/fstream @@ -0,0 +1,786 @@ +// File based streams -*- C++ -*- + +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file fstream + * This is a Standard C++ Library header. + */ + +// +// ISO C++ 14882: 27.8 File-based streams +// + +#ifndef _GLIBCXX_FSTREAM +#define _GLIBCXX_FSTREAM 1 + +#pragma GCC system_header + +#include +#include +#include // For codecvt +#include // For SEEK_SET, SEEK_CUR, SEEK_END, BUFSIZ +#include +#include + +_GLIBCXX_BEGIN_NAMESPACE(std) + + // [27.8.1.1] template class basic_filebuf + /** + * @brief The actual work of input and output (for files). + * + * This class associates both its input and output sequence with an + * external disk file, and maintains a joint file position for both + * sequences. Many of its sematics are described in terms of similar + * behavior in the Standard C Library's @c FILE streams. + */ + // Requirements on traits_type, specific to this class: + // traits_type::pos_type must be fpos + // traits_type::off_type must be streamoff + // traits_type::state_type must be Assignable and DefaultConstructable, + // and traits_type::state_type() must be the initial state for codecvt. + template + class basic_filebuf : public basic_streambuf<_CharT, _Traits> + { + public: + // Types: + typedef _CharT char_type; + typedef _Traits traits_type; + typedef typename traits_type::int_type int_type; + typedef typename traits_type::pos_type pos_type; + typedef typename traits_type::off_type off_type; + + typedef basic_streambuf __streambuf_type; + typedef basic_filebuf __filebuf_type; + typedef __basic_file __file_type; + typedef typename traits_type::state_type __state_type; + typedef codecvt __codecvt_type; + + friend class ios_base; // For sync_with_stdio. + + protected: + // Data Members: + // MT lock inherited from libio or other low-level io library. + __c_lock _M_lock; + + // External buffer. + __file_type _M_file; + + /** + * @if maint + * Place to stash in || out || in | out settings for current filebuf. + * @endif + */ + ios_base::openmode _M_mode; + + // Beginning state type for codecvt. + __state_type _M_state_beg; + + // During output, the state that corresponds to pptr(), + // during input, the state that corresponds to egptr() and + // _M_ext_next. + __state_type _M_state_cur; + + // Not used for output. During input, the state that corresponds + // to eback() and _M_ext_buf. + __state_type _M_state_last; + + /** + * @if maint + * Pointer to the beginning of internal buffer. + * @endif + */ + char_type* _M_buf; + + /** + * @if maint + * Actual size of internal buffer. This number is equal to the size + * of the put area + 1 position, reserved for the overflow char of + * a full area. + * @endif + */ + size_t _M_buf_size; + + // Set iff _M_buf is allocated memory from _M_allocate_internal_buffer. + bool _M_buf_allocated; + + /** + * @if maint + * _M_reading == false && _M_writing == false for 'uncommitted' mode; + * _M_reading == true for 'read' mode; + * _M_writing == true for 'write' mode; + * + * NB: _M_reading == true && _M_writing == true is unused. + * @endif + */ + bool _M_reading; + bool _M_writing; + + //@{ + /** + * @if maint + * Necessary bits for putback buffer management. + * + * @note pbacks of over one character are not currently supported. + * @endif + */ + char_type _M_pback; + char_type* _M_pback_cur_save; + char_type* _M_pback_end_save; + bool _M_pback_init; + //@} + + // Cached codecvt facet. + const __codecvt_type* _M_codecvt; + + /** + * @if maint + * Buffer for external characters. Used for input when + * codecvt::always_noconv() == false. When valid, this corresponds + * to eback(). + * @endif + */ + char* _M_ext_buf; + + /** + * @if maint + * Size of buffer held by _M_ext_buf. + * @endif + */ + streamsize _M_ext_buf_size; + + /** + * @if maint + * Pointers into the buffer held by _M_ext_buf that delimit a + * subsequence of bytes that have been read but not yet converted. + * When valid, _M_ext_next corresponds to egptr(). + * @endif + */ + const char* _M_ext_next; + char* _M_ext_end; + + /** + * @if maint + * Initializes pback buffers, and moves normal buffers to safety. + * Assumptions: + * _M_in_cur has already been moved back + * @endif + */ + void + _M_create_pback() + { + if (!_M_pback_init) + { + _M_pback_cur_save = this->gptr(); + _M_pback_end_save = this->egptr(); + this->setg(&_M_pback, &_M_pback, &_M_pback + 1); + _M_pback_init = true; + } + } + + /** + * @if maint + * Deactivates pback buffer contents, and restores normal buffer. + * Assumptions: + * The pback buffer has only moved forward. + * @endif + */ + void + _M_destroy_pback() throw() + { + if (_M_pback_init) + { + // Length _M_in_cur moved in the pback buffer. + _M_pback_cur_save += this->gptr() != this->eback(); + this->setg(_M_buf, _M_pback_cur_save, _M_pback_end_save); + _M_pback_init = false; + } + } + + public: + // Constructors/destructor: + /** + * @brief Does not open any files. + * + * The default constructor initializes the parent class using its + * own default ctor. + */ + basic_filebuf(); + + /** + * @brief The destructor closes the file first. + */ + virtual + ~basic_filebuf() + { this->close(); } + + // Members: + /** + * @brief Returns true if the external file is open. + */ + bool + is_open() const throw() + { return _M_file.is_open(); } + + /** + * @brief Opens an external file. + * @param s The name of the file. + * @param mode The open mode flags. + * @return @c this on success, NULL on failure + * + * If a file is already open, this function immediately fails. + * Otherwise it tries to open the file named @a s using the flags + * given in @a mode. + * + * [Table 92 gives the relation between openmode combinations and the + * equivalent fopen() flags, but the table has not been copied yet.] + */ + __filebuf_type* + open(const char* __s, ios_base::openmode __mode); + + /** + * @brief Closes the currently associated file. + * @return @c this on success, NULL on failure + * + * If no file is currently open, this function immediately fails. + * + * If a "put buffer area" exists, @c overflow(eof) is called to flush + * all the characters. The file is then closed. + * + * If any operations fail, this function also fails. + */ + __filebuf_type* + close() throw(); + + protected: + void + _M_allocate_internal_buffer(); + + void + _M_destroy_internal_buffer() throw(); + + // [27.8.1.4] overridden virtual functions + virtual streamsize + showmanyc(); + + // Stroustrup, 1998, p. 628 + // underflow() and uflow() functions are called to get the next + // charater from the real input source when the buffer is empty. + // Buffered input uses underflow() + + virtual int_type + underflow(); + + virtual int_type + pbackfail(int_type __c = _Traits::eof()); + + // Stroustrup, 1998, p 648 + // The overflow() function is called to transfer characters to the + // real output destination when the buffer is full. A call to + // overflow(c) outputs the contents of the buffer plus the + // character c. + // 27.5.2.4.5 + // Consume some sequence of the characters in the pending sequence. + virtual int_type + overflow(int_type __c = _Traits::eof()); + + // Convert internal byte sequence to external, char-based + // sequence via codecvt. + bool + _M_convert_to_external(char_type*, streamsize); + + /** + * @brief Manipulates the buffer. + * @param s Pointer to a buffer area. + * @param n Size of @a s. + * @return @c this + * + * If no file has been opened, and both @a s and @a n are zero, then + * the stream becomes unbuffered. Otherwise, @c s is used as a + * buffer; see + * http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#2 + * for more. + */ + virtual __streambuf_type* + setbuf(char_type* __s, streamsize __n); + + virtual pos_type + seekoff(off_type __off, ios_base::seekdir __way, + ios_base::openmode __mode = ios_base::in | ios_base::out); + + virtual pos_type + seekpos(pos_type __pos, + ios_base::openmode __mode = ios_base::in | ios_base::out); + + // Common code for seekoff and seekpos + pos_type + _M_seek(off_type __off, ios_base::seekdir __way, __state_type __state); + + virtual int + sync(); + + virtual void + imbue(const locale& __loc); + + virtual streamsize + xsgetn(char_type* __s, streamsize __n); + + virtual streamsize + xsputn(const char_type* __s, streamsize __n); + + // Flushes output buffer, then writes unshift sequence. + bool + _M_terminate_output(); + + /** + * @if maint + * This function sets the pointers of the internal buffer, both get + * and put areas. Typically: + * + * __off == egptr() - eback() upon underflow/uflow ('read' mode); + * __off == 0 upon overflow ('write' mode); + * __off == -1 upon open, setbuf, seekoff/pos ('uncommitted' mode). + * + * NB: epptr() - pbase() == _M_buf_size - 1, since _M_buf_size + * reflects the actual allocated memory and the last cell is reserved + * for the overflow char of a full put area. + * @endif + */ + void + _M_set_buffer(streamsize __off) + { + const bool __testin = _M_mode & ios_base::in; + const bool __testout = _M_mode & ios_base::out; + + if (__testin && __off > 0) + this->setg(_M_buf, _M_buf, _M_buf + __off); + else + this->setg(_M_buf, _M_buf, _M_buf); + + if (__testout && __off == 0 && _M_buf_size > 1 ) + this->setp(_M_buf, _M_buf + _M_buf_size - 1); + else + this->setp(NULL, NULL); + } + }; + + // [27.8.1.5] Template class basic_ifstream + /** + * @brief Controlling input for files. + * + * This class supports reading from named files, using the inherited + * functions from std::basic_istream. To control the associated + * sequence, an instance of std::basic_filebuf is used, which this page + * refers to as @c sb. + */ + template + class basic_ifstream : public basic_istream<_CharT, _Traits> + { + public: + // Types: + typedef _CharT char_type; + typedef _Traits traits_type; + typedef typename traits_type::int_type int_type; + typedef typename traits_type::pos_type pos_type; + typedef typename traits_type::off_type off_type; + + // Non-standard types: + typedef basic_filebuf __filebuf_type; + typedef basic_istream __istream_type; + + private: + __filebuf_type _M_filebuf; + + public: + // Constructors/Destructors: + /** + * @brief Default constructor. + * + * Initializes @c sb using its default constructor, and passes + * @c &sb to the base class initializer. Does not open any files + * (you haven't given it a filename to open). + */ + basic_ifstream() : __istream_type(), _M_filebuf() + { this->init(&_M_filebuf); } + + /** + * @brief Create an input file stream. + * @param s Null terminated string specifying the filename. + * @param mode Open file in specified mode (see std::ios_base). + * + * @c ios_base::in is automatically included in @a mode. + * + * Tip: When using std::string to hold the filename, you must use + * .c_str() before passing it to this constructor. + */ + explicit + basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in) + : __istream_type(), _M_filebuf() + { + this->init(&_M_filebuf); + this->open(__s, __mode); + } + + /** + * @brief The destructor does nothing. + * + * The file is closed by the filebuf object, not the formatting + * stream. + */ + ~basic_ifstream() + { } + + // Members: + /** + * @brief Accessing the underlying buffer. + * @return The current basic_filebuf buffer. + * + * This hides both signatures of std::basic_ios::rdbuf(). + */ + __filebuf_type* + rdbuf() const + { return const_cast<__filebuf_type*>(&_M_filebuf); } + + /** + * @brief Wrapper to test for an open file. + * @return @c rdbuf()->is_open() + */ + bool + is_open() + { return _M_filebuf.is_open(); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 365. Lack of const-qualification in clause 27 + bool + is_open() const + { return _M_filebuf.is_open(); } + + /** + * @brief Opens an external file. + * @param s The name of the file. + * @param mode The open mode flags. + * + * Calls @c std::basic_filebuf::open(s,mode|in). If that function + * fails, @c failbit is set in the stream's error state. + * + * Tip: When using std::string to hold the filename, you must use + * .c_str() before passing it to this constructor. + */ + void + open(const char* __s, ios_base::openmode __mode = ios_base::in) + { + if (!_M_filebuf.open(__s, __mode | ios_base::in)) + this->setstate(ios_base::failbit); + else + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 409. Closing an fstream should clear error state + this->clear(); + } + + /** + * @brief Close the file. + * + * Calls @c std::basic_filebuf::close(). If that function + * fails, @c failbit is set in the stream's error state. + */ + void + close() + { + if (!_M_filebuf.close()) + this->setstate(ios_base::failbit); + } + }; + + + // [27.8.1.8] Template class basic_ofstream + /** + * @brief Controlling output for files. + * + * This class supports reading from named files, using the inherited + * functions from std::basic_ostream. To control the associated + * sequence, an instance of std::basic_filebuf is used, which this page + * refers to as @c sb. + */ + template + class basic_ofstream : public basic_ostream<_CharT,_Traits> + { + public: + // Types: + typedef _CharT char_type; + typedef _Traits traits_type; + typedef typename traits_type::int_type int_type; + typedef typename traits_type::pos_type pos_type; + typedef typename traits_type::off_type off_type; + + // Non-standard types: + typedef basic_filebuf __filebuf_type; + typedef basic_ostream __ostream_type; + + private: + __filebuf_type _M_filebuf; + + public: + // Constructors: + /** + * @brief Default constructor. + * + * Initializes @c sb using its default constructor, and passes + * @c &sb to the base class initializer. Does not open any files + * (you haven't given it a filename to open). + */ + basic_ofstream(): __ostream_type(), _M_filebuf() + { this->init(&_M_filebuf); } + + /** + * @brief Create an output file stream. + * @param s Null terminated string specifying the filename. + * @param mode Open file in specified mode (see std::ios_base). + * + * @c ios_base::out|ios_base::trunc is automatically included in + * @a mode. + * + * Tip: When using std::string to hold the filename, you must use + * .c_str() before passing it to this constructor. + */ + explicit + basic_ofstream(const char* __s, + ios_base::openmode __mode = ios_base::out|ios_base::trunc) + : __ostream_type(), _M_filebuf() + { + this->init(&_M_filebuf); + this->open(__s, __mode); + } + + /** + * @brief The destructor does nothing. + * + * The file is closed by the filebuf object, not the formatting + * stream. + */ + ~basic_ofstream() + { } + + // Members: + /** + * @brief Accessing the underlying buffer. + * @return The current basic_filebuf buffer. + * + * This hides both signatures of std::basic_ios::rdbuf(). + */ + __filebuf_type* + rdbuf() const + { return const_cast<__filebuf_type*>(&_M_filebuf); } + + /** + * @brief Wrapper to test for an open file. + * @return @c rdbuf()->is_open() + */ + bool + is_open() + { return _M_filebuf.is_open(); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 365. Lack of const-qualification in clause 27 + bool + is_open() const + { return _M_filebuf.is_open(); } + + /** + * @brief Opens an external file. + * @param s The name of the file. + * @param mode The open mode flags. + * + * Calls @c std::basic_filebuf::open(s,mode|out|trunc). If that + * function fails, @c failbit is set in the stream's error state. + * + * Tip: When using std::string to hold the filename, you must use + * .c_str() before passing it to this constructor. + */ + void + open(const char* __s, + ios_base::openmode __mode = ios_base::out | ios_base::trunc) + { + if (!_M_filebuf.open(__s, __mode | ios_base::out)) + this->setstate(ios_base::failbit); + else + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 409. Closing an fstream should clear error state + this->clear(); + } + + /** + * @brief Close the file. + * + * Calls @c std::basic_filebuf::close(). If that function + * fails, @c failbit is set in the stream's error state. + */ + void + close() + { + if (!_M_filebuf.close()) + this->setstate(ios_base::failbit); + } + }; + + + // [27.8.1.11] Template class basic_fstream + /** + * @brief Controlling intput and output for files. + * + * This class supports reading from and writing to named files, using + * the inherited functions from std::basic_iostream. To control the + * associated sequence, an instance of std::basic_filebuf is used, which + * this page refers to as @c sb. + */ + template + class basic_fstream : public basic_iostream<_CharT, _Traits> + { + public: + // Types: + typedef _CharT char_type; + typedef _Traits traits_type; + typedef typename traits_type::int_type int_type; + typedef typename traits_type::pos_type pos_type; + typedef typename traits_type::off_type off_type; + + // Non-standard types: + typedef basic_filebuf __filebuf_type; + typedef basic_ios __ios_type; + typedef basic_iostream __iostream_type; + + private: + __filebuf_type _M_filebuf; + + public: + // Constructors/destructor: + /** + * @brief Default constructor. + * + * Initializes @c sb using its default constructor, and passes + * @c &sb to the base class initializer. Does not open any files + * (you haven't given it a filename to open). + */ + basic_fstream() + : __iostream_type(), _M_filebuf() + { this->init(&_M_filebuf); } + + /** + * @brief Create an input/output file stream. + * @param s Null terminated string specifying the filename. + * @param mode Open file in specified mode (see std::ios_base). + * + * Tip: When using std::string to hold the filename, you must use + * .c_str() before passing it to this constructor. + */ + explicit + basic_fstream(const char* __s, + ios_base::openmode __mode = ios_base::in | ios_base::out) + : __iostream_type(NULL), _M_filebuf() + { + this->init(&_M_filebuf); + this->open(__s, __mode); + } + + /** + * @brief The destructor does nothing. + * + * The file is closed by the filebuf object, not the formatting + * stream. + */ + ~basic_fstream() + { } + + // Members: + /** + * @brief Accessing the underlying buffer. + * @return The current basic_filebuf buffer. + * + * This hides both signatures of std::basic_ios::rdbuf(). + */ + __filebuf_type* + rdbuf() const + { return const_cast<__filebuf_type*>(&_M_filebuf); } + + /** + * @brief Wrapper to test for an open file. + * @return @c rdbuf()->is_open() + */ + bool + is_open() + { return _M_filebuf.is_open(); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 365. Lack of const-qualification in clause 27 + bool + is_open() const + { return _M_filebuf.is_open(); } + + /** + * @brief Opens an external file. + * @param s The name of the file. + * @param mode The open mode flags. + * + * Calls @c std::basic_filebuf::open(s,mode). If that + * function fails, @c failbit is set in the stream's error state. + * + * Tip: When using std::string to hold the filename, you must use + * .c_str() before passing it to this constructor. + */ + void + open(const char* __s, + ios_base::openmode __mode = ios_base::in | ios_base::out) + { + if (!_M_filebuf.open(__s, __mode)) + this->setstate(ios_base::failbit); + else + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 409. Closing an fstream should clear error state + this->clear(); + } + + /** + * @brief Close the file. + * + * Calls @c std::basic_filebuf::close(). If that function + * fails, @c failbit is set in the stream's error state. + */ + void + close() + { + if (!_M_filebuf.close()) + this->setstate(ios_base::failbit); + } + }; + +_GLIBCXX_END_NAMESPACE + +#ifndef _GLIBCXX_EXPORT_TEMPLATE +# include +#endif + +#endif /* _GLIBCXX_FSTREAM */ diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional new file mode 100644 index 00000000000..feadaa2252a --- /dev/null +++ b/libstdc++-v3/include/std/functional @@ -0,0 +1,57 @@ +// -*- C++ -*- + +// Copyright (C) 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/* + * Copyright (c) 1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + */ + +/** @file include/functional + * This is a Standard C++ Library header. + */ + +#ifndef _GLIBCXX_FUNCTIONAL +#define _GLIBCXX_FUNCTIONAL 1 + +#pragma GCC system_header + +#include +#include +#include + +#endif /* _GLIBCXX_FUNCTIONAL */ diff --git a/libstdc++-v3/include/std/iomanip b/libstdc++-v3/include/std/iomanip new file mode 100644 index 00000000000..13b21d579bd --- /dev/null +++ b/libstdc++-v3/include/std/iomanip @@ -0,0 +1,300 @@ +// Standard stream manipulators -*- C++ -*- + +// Copyright (C) 1997, 1998, 1999, 2001, 2002, 2003, 2005 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file iomanip + * This is a Standard C++ Library header. + */ + +// +// ISO C++ 14882: 27.6.3 Standard manipulators +// + +#ifndef _GLIBCXX_IOMANIP +#define _GLIBCXX_IOMANIP 1 + +#pragma GCC system_header + +#include +#include +#include + +_GLIBCXX_BEGIN_NAMESPACE(std) + + // [27.6.3] standard manipulators + // Also see DR 183. + + struct _Resetiosflags { ios_base::fmtflags _M_mask; }; + + /** + * @brief Manipulator for @c setf. + * @param mask A format flags mask. + * + * Sent to a stream object, this manipulator resets the specified flags, + * via @e stream.setf(0,mask). + */ + inline _Resetiosflags + resetiosflags(ios_base::fmtflags __mask) + { + _Resetiosflags __x; + __x._M_mask = __mask; + return __x; + } + + template + inline basic_istream<_CharT,_Traits>& + operator>>(basic_istream<_CharT,_Traits>& __is, _Resetiosflags __f) + { + __is.setf(ios_base::fmtflags(0), __f._M_mask); + return __is; + } + + template + inline basic_ostream<_CharT,_Traits>& + operator<<(basic_ostream<_CharT,_Traits>& __os, _Resetiosflags __f) + { + __os.setf(ios_base::fmtflags(0), __f._M_mask); + return __os; + } + + + struct _Setiosflags { ios_base::fmtflags _M_mask; }; + + /** + * @brief Manipulator for @c setf. + * @param mask A format flags mask. + * + * Sent to a stream object, this manipulator sets the format flags + * to @a mask. + */ + inline _Setiosflags + setiosflags(ios_base::fmtflags __mask) + { + _Setiosflags __x; + __x._M_mask = __mask; + return __x; + } + + template + inline basic_istream<_CharT,_Traits>& + operator>>(basic_istream<_CharT,_Traits>& __is, _Setiosflags __f) + { + __is.setf(__f._M_mask); + return __is; + } + + template + inline basic_ostream<_CharT,_Traits>& + operator<<(basic_ostream<_CharT,_Traits>& __os, _Setiosflags __f) + { + __os.setf(__f._M_mask); + return __os; + } + + + struct _Setbase { int _M_base; }; + + /** + * @brief Manipulator for @c setf. + * @param base A numeric base. + * + * Sent to a stream object, this manipulator changes the + * @c ios_base::basefield flags to @c oct, @c dec, or @c hex when @a base + * is 8, 10, or 16, accordingly, and to 0 if @a base is any other value. + */ + inline _Setbase + setbase(int __base) + { + _Setbase __x; + __x._M_base = __base; + return __x; + } + + template + inline basic_istream<_CharT,_Traits>& + operator>>(basic_istream<_CharT,_Traits>& __is, _Setbase __f) + { + __is.setf(__f._M_base == 8 ? ios_base::oct : + __f._M_base == 10 ? ios_base::dec : + __f._M_base == 16 ? ios_base::hex : + ios_base::fmtflags(0), ios_base::basefield); + return __is; + } + + template + inline basic_ostream<_CharT,_Traits>& + operator<<(basic_ostream<_CharT,_Traits>& __os, _Setbase __f) + { + __os.setf(__f._M_base == 8 ? ios_base::oct : + __f._M_base == 10 ? ios_base::dec : + __f._M_base == 16 ? ios_base::hex : + ios_base::fmtflags(0), ios_base::basefield); + return __os; + } + + + template + struct _Setfill { _CharT _M_c; }; + + /** + * @brief Manipulator for @c fill. + * @param c The new fill character. + * + * Sent to a stream object, this manipulator calls @c fill(c) for that + * object. + */ + template + inline _Setfill<_CharT> + setfill(_CharT __c) + { + _Setfill<_CharT> __x; + __x._M_c = __c; + return __x; + } + + template + inline basic_istream<_CharT,_Traits>& + operator>>(basic_istream<_CharT,_Traits>& __is, _Setfill<_CharT> __f) + { + __is.fill(__f._M_c); + return __is; + } + + template + inline basic_ostream<_CharT,_Traits>& + operator<<(basic_ostream<_CharT,_Traits>& __os, _Setfill<_CharT> __f) + { + __os.fill(__f._M_c); + return __os; + } + + + struct _Setprecision { int _M_n; }; + + /** + * @brief Manipulator for @c precision. + * @param n The new precision. + * + * Sent to a stream object, this manipulator calls @c precision(n) for + * that object. + */ + inline _Setprecision + setprecision(int __n) + { + _Setprecision __x; + __x._M_n = __n; + return __x; + } + + template + inline basic_istream<_CharT,_Traits>& + operator>>(basic_istream<_CharT,_Traits>& __is, _Setprecision __f) + { + __is.precision(__f._M_n); + return __is; + } + + template + inline basic_ostream<_CharT,_Traits>& + operator<<(basic_ostream<_CharT,_Traits>& __os, _Setprecision __f) + { + __os.precision(__f._M_n); + return __os; + } + + + struct _Setw { int _M_n; }; + + /** + * @brief Manipulator for @c width. + * @param n The new width. + * + * Sent to a stream object, this manipulator calls @c width(n) for + * that object. + */ + inline _Setw + setw(int __n) + { + _Setw __x; + __x._M_n = __n; + return __x; + } + + template + inline basic_istream<_CharT,_Traits>& + operator>>(basic_istream<_CharT,_Traits>& __is, _Setw __f) + { + __is.width(__f._M_n); + return __is; + } + + template + inline basic_ostream<_CharT,_Traits>& + operator<<(basic_ostream<_CharT,_Traits>& __os, _Setw __f) + { + __os.width(__f._M_n); + return __os; + } + + // Inhibit implicit instantiations for required instantiations, + // which are defined via explicit instantiations elsewhere. + // NB: This syntax is a GNU extension. +#if _GLIBCXX_EXTERN_TEMPLATE + extern template ostream& operator<<(ostream&, _Setfill); + extern template ostream& operator<<(ostream&, _Setiosflags); + extern template ostream& operator<<(ostream&, _Resetiosflags); + extern template ostream& operator<<(ostream&, _Setbase); + extern template ostream& operator<<(ostream&, _Setprecision); + extern template ostream& operator<<(ostream&, _Setw); + extern template istream& operator>>(istream&, _Setfill); + extern template istream& operator>>(istream&, _Setiosflags); + extern template istream& operator>>(istream&, _Resetiosflags); + extern template istream& operator>>(istream&, _Setbase); + extern template istream& operator>>(istream&, _Setprecision); + extern template istream& operator>>(istream&, _Setw); + +#ifdef _GLIBCXX_USE_WCHAR_T + extern template wostream& operator<<(wostream&, _Setfill); + extern template wostream& operator<<(wostream&, _Setiosflags); + extern template wostream& operator<<(wostream&, _Resetiosflags); + extern template wostream& operator<<(wostream&, _Setbase); + extern template wostream& operator<<(wostream&, _Setprecision); + extern template wostream& operator<<(wostream&, _Setw); + extern template wistream& operator>>(wistream&, _Setfill); + extern template wistream& operator>>(wistream&, _Setiosflags); + extern template wistream& operator>>(wistream&, _Resetiosflags); + extern template wistream& operator>>(wistream&, _Setbase); + extern template wistream& operator>>(wistream&, _Setprecision); + extern template wistream& operator>>(wistream&, _Setw); +#endif +#endif + +_GLIBCXX_END_NAMESPACE + +#endif /* _GLIBCXX_IOMANIP */ diff --git a/libstdc++-v3/include/std/ios b/libstdc++-v3/include/std/ios new file mode 100644 index 00000000000..f081115e9b7 --- /dev/null +++ b/libstdc++-v3/include/std/ios @@ -0,0 +1,52 @@ +// Iostreams base classes -*- C++ -*- + +// Copyright (C) 1997, 1998, 1999, 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file ios + * This is a Standard C++ Library header. + */ + +// +// ISO C++ 14882: 27.4 Iostreams base classes +// + +#ifndef _GLIBCXX_IOS +#define _GLIBCXX_IOS 1 + +#pragma GCC system_header + +#include +#include // For ios_base::failure +#include // For char_traits, streamoff, streamsize, fpos +#include // For SEEK_SET, SEEK_CUR, SEEK_END +#include // For class locale +#include // For ios_base declarations. +#include +#include + +#endif /* _GLIBCXX_IOS */ diff --git a/libstdc++-v3/include/std/iosfwd b/libstdc++-v3/include/std/iosfwd new file mode 100644 index 00000000000..a4d0c3fdf19 --- /dev/null +++ b/libstdc++-v3/include/std/iosfwd @@ -0,0 +1,168 @@ +// Forwarding declarations -*- C++ -*- + +// Copyright (C) 1997, 1998, 1999, 2001, 2002, 2003, 2005 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file iosfwd + * This is a Standard C++ Library header. + */ + +// +// ISO C++ 14882: 27.2 Forward declarations +// + +#ifndef _GLIBCXX_IOSFWD +#define _GLIBCXX_IOSFWD 1 + +#pragma GCC system_header + +#include +#include +#include +#include // For isspace, etc. +#include // For string forward declarations. +#include +#include + +_GLIBCXX_BEGIN_NAMESPACE(std) + + template > + class basic_ios; + + template > + class basic_streambuf; + + template > + class basic_istream; + + template > + class basic_ostream; + + template > + class basic_iostream; + + template, + typename _Alloc = allocator<_CharT> > + class basic_stringbuf; + + template, + typename _Alloc = allocator<_CharT> > + class basic_istringstream; + + template, + typename _Alloc = allocator<_CharT> > + class basic_ostringstream; + + template, + typename _Alloc = allocator<_CharT> > + class basic_stringstream; + + template > + class basic_filebuf; + + template > + class basic_ifstream; + + template > + class basic_ofstream; + + template > + class basic_fstream; + + template > + class istreambuf_iterator; + + template > + class ostreambuf_iterator; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // Not included. (??? Apparently no LWG number?) + class ios_base; + + /** + * @defgroup s27_2_iosfwd I/O Forward Declarations + * + * Nearly all of the I/O classes are parameterized on the type of + * characters they read and write. (The major exception is ios_base at + * the top of the hierarchy.) This is a change from pre-Standard + * streams, which were not templates. + * + * For ease of use and compatibility, all of the basic_* I/O-related + * classes are given typedef names for both of the builtin character + * widths (wide and narrow). The typedefs are the same as the + * pre-Standard names, for example: + * + * @code + * typedef basic_ifstream ifstream; + * @endcode + * + * Because properly forward-declaring these classes can be difficult, you + * should not do it yourself. Instead, include the <iosfwd> + * header, which contains only declarations of all the I/O classes as + * well as the typedefs. Trying to forward-declare the typedefs + * themselves (e.g., "class ostream;") is not valid ISO C++. + * + * For more specific declarations, see + * http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#10 + * + * @{ + */ + typedef basic_ios ios; ///< @isiosfwd + typedef basic_streambuf streambuf; ///< @isiosfwd + typedef basic_istream istream; ///< @isiosfwd + typedef basic_ostream ostream; ///< @isiosfwd + typedef basic_iostream iostream; ///< @isiosfwd + typedef basic_stringbuf stringbuf; ///< @isiosfwd + typedef basic_istringstream istringstream; ///< @isiosfwd + typedef basic_ostringstream ostringstream; ///< @isiosfwd + typedef basic_stringstream stringstream; ///< @isiosfwd + typedef basic_filebuf filebuf; ///< @isiosfwd + typedef basic_ifstream ifstream; ///< @isiosfwd + typedef basic_ofstream ofstream; ///< @isiosfwd + typedef basic_fstream fstream; ///< @isiosfwd + +#ifdef _GLIBCXX_USE_WCHAR_T + typedef basic_ios wios; ///< @isiosfwd + typedef basic_streambuf wstreambuf; ///< @isiosfwd + typedef basic_istream wistream; ///< @isiosfwd + typedef basic_ostream wostream; ///< @isiosfwd + typedef basic_iostream wiostream; ///< @isiosfwd + typedef basic_stringbuf wstringbuf; ///< @isiosfwd + typedef basic_istringstream wistringstream; ///< @isiosfwd + typedef basic_ostringstream wostringstream; ///< @isiosfwd + typedef basic_stringstream wstringstream; ///< @isiosfwd + typedef basic_filebuf wfilebuf; ///< @isiosfwd + typedef basic_ifstream wifstream; ///< @isiosfwd + typedef basic_ofstream wofstream; ///< @isiosfwd + typedef basic_fstream wfstream; ///< @isiosfwd +#endif + /** @} */ + +_GLIBCXX_END_NAMESPACE + +#endif /* _GLIBCXX_IOSFWD */ diff --git a/libstdc++-v3/include/std/iostream b/libstdc++-v3/include/std/iostream new file mode 100644 index 00000000000..0ff0da2177f --- /dev/null +++ b/libstdc++-v3/include/std/iostream @@ -0,0 +1,81 @@ +// Standard iostream objects -*- C++ -*- + +// Copyright (C) 1997, 1998, 1999, 2001, 2002, 2005 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file iostream + * This is a Standard C++ Library header. + */ + +// +// ISO C++ 14882: 27.3 Standard iostream objects +// + +#ifndef _GLIBCXX_IOSTREAM +#define _GLIBCXX_IOSTREAM 1 + +#pragma GCC system_header + +#include +#include +#include + +_GLIBCXX_BEGIN_NAMESPACE(std) + + /** + * @name Standard Stream Objects + * + * The <iostream> header declares the eight standard stream + * objects. For other declarations, see + * http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#10 and the + * @link s27_2_iosfwd I/O forward declarations @endlink + * + * They are required by default to cooperate with the global C library's + * @c FILE streams, and to be available during program startup and + * termination. For more information, see the HOWTO linked to above. + */ + //@{ + extern istream cin; ///< Linked to standard input + extern ostream cout; ///< Linked to standard output + extern ostream cerr; ///< Linked to standard error (unbuffered) + extern ostream clog; ///< Linked to standard error (buffered) + +#ifdef _GLIBCXX_USE_WCHAR_T + extern wistream wcin; ///< Linked to standard input + extern wostream wcout; ///< Linked to standard output + extern wostream wcerr; ///< Linked to standard error (unbuffered) + extern wostream wclog; ///< Linked to standard error (buffered) +#endif + //@} + + // For construction of filebuffers for cout, cin, cerr, clog et. al. + static ios_base::Init __ioinit; + +_GLIBCXX_END_NAMESPACE + +#endif /* _GLIBCXX_IOSTREAM */ diff --git a/libstdc++-v3/include/std/istream b/libstdc++-v3/include/std/istream new file mode 100644 index 00000000000..e81c9cd9252 --- /dev/null +++ b/libstdc++-v3/include/std/istream @@ -0,0 +1,848 @@ +// Input streams -*- C++ -*- + +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 27.6.1 Input streams +// + +/** @file istream + * This is a Standard C++ Library header. + */ + +#ifndef _GLIBCXX_ISTREAM +#define _GLIBCXX_ISTREAM 1 + +#pragma GCC system_header + +#include +#include // For numeric_limits + +_GLIBCXX_BEGIN_NAMESPACE(std) + + // [27.6.1.1] Template class basic_istream + /** + * @brief Controlling input. + * + * This is the base class for all input streams. It provides text + * formatting of all builtin types, and communicates with any class + * derived from basic_streambuf to do the actual input. + */ + template + class basic_istream : virtual public basic_ios<_CharT, _Traits> + { + public: + // Types (inherited from basic_ios (27.4.4)): + typedef _CharT char_type; + typedef typename _Traits::int_type int_type; + typedef typename _Traits::pos_type pos_type; + typedef typename _Traits::off_type off_type; + typedef _Traits traits_type; + + // Non-standard Types: + typedef basic_streambuf<_CharT, _Traits> __streambuf_type; + typedef basic_ios<_CharT, _Traits> __ios_type; + typedef basic_istream<_CharT, _Traits> __istream_type; + typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> > + __num_get_type; + typedef ctype<_CharT> __ctype_type; + + template + friend basic_istream<_CharT2, _Traits2>& + operator>>(basic_istream<_CharT2, _Traits2>&, _CharT2&); + + template + friend basic_istream<_CharT2, _Traits2>& + operator>>(basic_istream<_CharT2, _Traits2>&, _CharT2*); + + protected: + // Data Members: + /** + * @if maint + * The number of characters extracted in the previous unformatted + * function; see gcount(). + * @endif + */ + streamsize _M_gcount; + + public: + // [27.6.1.1.1] constructor/destructor + /** + * @brief Base constructor. + * + * This ctor is almost never called by the user directly, rather from + * derived classes' initialization lists, which pass a pointer to + * their own stream buffer. + */ + explicit + basic_istream(__streambuf_type* __sb): _M_gcount(streamsize(0)) + { this->init(__sb); } + + /** + * @brief Base destructor. + * + * This does very little apart from providing a virtual base dtor. + */ + virtual + ~basic_istream() + { _M_gcount = streamsize(0); } + + // [27.6.1.1.2] prefix/suffix + class sentry; + friend class sentry; + + // [27.6.1.2] formatted input + // [27.6.1.2.3] basic_istream::operator>> + //@{ + /** + * @brief Interface for manipulators. + * + * Manuipulators such as @c std::ws and @c std::dec use these + * functions in constructs like "std::cin >> std::ws". For more + * information, see the iomanip header. + */ + __istream_type& + operator>>(__istream_type& (*__pf)(__istream_type&)) + { return __pf(*this); } + + __istream_type& + operator>>(__ios_type& (*__pf)(__ios_type&)) + { + __pf(*this); + return *this; + } + + __istream_type& + operator>>(ios_base& (*__pf)(ios_base&)) + { + __pf(*this); + return *this; + } + //@} + + // [27.6.1.2.2] arithmetic extractors + /** + * @name Arithmetic Extractors + * + * All the @c operator>> functions (aka formatted input + * functions) have some common behavior. Each starts by + * constructing a temporary object of type std::basic_istream::sentry + * with the second argument (noskipws) set to false. This has several + * effects, concluding with the setting of a status flag; see the + * sentry documentation for more. + * + * If the sentry status is good, the function tries to extract + * whatever data is appropriate for the type of the argument. + * + * If an exception is thrown during extraction, ios_base::badbit + * will be turned on in the stream's error state without causing an + * ios_base::failure to be thrown. The original exception will then + * be rethrown. + */ + //@{ + /** + * @brief Basic arithmetic extractors + * @param A variable of builtin type. + * @return @c *this if successful + * + * These functions use the stream's current locale (specifically, the + * @c num_get facet) to parse the input data. + */ + __istream_type& + operator>>(bool& __n) + { return _M_extract(__n); } + + __istream_type& + operator>>(short& __n); + + __istream_type& + operator>>(unsigned short& __n) + { return _M_extract(__n); } + + __istream_type& + operator>>(int& __n); + + __istream_type& + operator>>(unsigned int& __n) + { return _M_extract(__n); } + + __istream_type& + operator>>(long& __n) + { return _M_extract(__n); } + + __istream_type& + operator>>(unsigned long& __n) + { return _M_extract(__n); } + +#ifdef _GLIBCXX_USE_LONG_LONG + __istream_type& + operator>>(long long& __n) + { return _M_extract(__n); } + + __istream_type& + operator>>(unsigned long long& __n) + { return _M_extract(__n); } +#endif + + __istream_type& + operator>>(float& __f) + { return _M_extract(__f); } + + __istream_type& + operator>>(double& __f) + { return _M_extract(__f); } + + __istream_type& + operator>>(long double& __f) + { return _M_extract(__f); } + + __istream_type& + operator>>(void*& __p) + { return _M_extract(__p); } + + /** + * @brief Extracting into another streambuf. + * @param sb A pointer to a streambuf + * + * This function behaves like one of the basic arithmetic extractors, + * in that it also constructs a sentry object and has the same error + * handling behavior. + * + * If @a sb is NULL, the stream will set failbit in its error state. + * + * Characters are extracted from this stream and inserted into the + * @a sb streambuf until one of the following occurs: + * + * - the input stream reaches end-of-file, + * - insertion into the output buffer fails (in this case, the + * character that would have been inserted is not extracted), or + * - an exception occurs (and in this case is caught) + * + * If the function inserts no characters, failbit is set. + */ + __istream_type& + operator>>(__streambuf_type* __sb); + //@} + + // [27.6.1.3] unformatted input + /** + * @brief Character counting + * @return The number of characters extracted by the previous + * unformatted input function dispatched for this stream. + */ + streamsize + gcount() const + { return _M_gcount; } + + /** + * @name Unformatted Input Functions + * + * All the unformatted input functions have some common behavior. + * Each starts by constructing a temporary object of type + * std::basic_istream::sentry with the second argument (noskipws) + * set to true. This has several effects, concluding with the + * setting of a status flag; see the sentry documentation for more. + * + * If the sentry status is good, the function tries to extract + * whatever data is appropriate for the type of the argument. + * + * The number of characters extracted is stored for later retrieval + * by gcount(). + * + * If an exception is thrown during extraction, ios_base::badbit + * will be turned on in the stream's error state without causing an + * ios_base::failure to be thrown. The original exception will then + * be rethrown. + */ + //@{ + /** + * @brief Simple extraction. + * @return A character, or eof(). + * + * Tries to extract a character. If none are available, sets failbit + * and returns traits::eof(). + */ + int_type + get(); + + /** + * @brief Simple extraction. + * @param c The character in which to store data. + * @return *this + * + * Tries to extract a character and store it in @a c. If none are + * available, sets failbit and returns traits::eof(). + * + * @note This function is not overloaded on signed char and + * unsigned char. + */ + __istream_type& + get(char_type& __c); + + /** + * @brief Simple multiple-character extraction. + * @param s Pointer to an array. + * @param n Maximum number of characters to store in @a s. + * @param delim A "stop" character. + * @return *this + * + * Characters are extracted and stored into @a s until one of the + * following happens: + * + * - @c n-1 characters are stored + * - the input sequence reaches EOF + * - the next character equals @a delim, in which case the character + * is not extracted + * + * If no characters are stored, failbit is set in the stream's error + * state. + * + * In any case, a null character is stored into the next location in + * the array. + * + * @note This function is not overloaded on signed char and + * unsigned char. + */ + __istream_type& + get(char_type* __s, streamsize __n, char_type __delim); + + /** + * @brief Simple multiple-character extraction. + * @param s Pointer to an array. + * @param n Maximum number of characters to store in @a s. + * @return *this + * + * Returns @c get(s,n,widen('\n')). + */ + __istream_type& + get(char_type* __s, streamsize __n) + { return this->get(__s, __n, this->widen('\n')); } + + /** + * @brief Extraction into another streambuf. + * @param sb A streambuf in which to store data. + * @param delim A "stop" character. + * @return *this + * + * Characters are extracted and inserted into @a sb until one of the + * following happens: + * + * - the input sequence reaches EOF + * - insertion into the output buffer fails (in this case, the + * character that would have been inserted is not extracted) + * - the next character equals @a delim (in this case, the character + * is not extracted) + * - an exception occurs (and in this case is caught) + * + * If no characters are stored, failbit is set in the stream's error + * state. + */ + __istream_type& + get(__streambuf_type& __sb, char_type __delim); + + /** + * @brief Extraction into another streambuf. + * @param sb A streambuf in which to store data. + * @return *this + * + * Returns @c get(sb,widen('\n')). + */ + __istream_type& + get(__streambuf_type& __sb) + { return this->get(__sb, this->widen('\n')); } + + /** + * @brief String extraction. + * @param s A character array in which to store the data. + * @param n Maximum number of characters to extract. + * @param delim A "stop" character. + * @return *this + * + * Extracts and stores characters into @a s until one of the + * following happens. Note that these criteria are required to be + * tested in the order listed here, to allow an input line to exactly + * fill the @a s array without setting failbit. + * + * -# the input sequence reaches end-of-file, in which case eofbit + * is set in the stream error state + * -# the next character equals @c delim, in which case the character + * is extracted (and therefore counted in @c gcount()) but not stored + * -# @c n-1 characters are stored, in which case failbit is set + * in the stream error state + * + * If no characters are extracted, failbit is set. (An empty line of + * input should therefore not cause failbit to be set.) + * + * In any case, a null character is stored in the next location in + * the array. + */ + __istream_type& + getline(char_type* __s, streamsize __n, char_type __delim); + + /** + * @brief String extraction. + * @param s A character array in which to store the data. + * @param n Maximum number of characters to extract. + * @return *this + * + * Returns @c getline(s,n,widen('\n')). + */ + __istream_type& + getline(char_type* __s, streamsize __n) + { return this->getline(__s, __n, this->widen('\n')); } + + /** + * @brief Discarding characters + * @param n Number of characters to discard. + * @param delim A "stop" character. + * @return *this + * + * Extracts characters and throws them away until one of the + * following happens: + * - if @a n @c != @c std::numeric_limits::max(), @a n + * characters are extracted + * - the input sequence reaches end-of-file + * - the next character equals @a delim (in this case, the character + * is extracted); note that this condition will never occur if + * @a delim equals @c traits::eof(). + * + * NB: Provide three overloads, instead of the single function + * (with defaults) mandated by the Standard: this leads to a + * better performing implementation, while still conforming to + * the Standard. + */ + __istream_type& + ignore(); + + __istream_type& + ignore(streamsize __n); + + __istream_type& + ignore(streamsize __n, int_type __delim); + + /** + * @brief Looking ahead in the stream + * @return The next character, or eof(). + * + * If, after constructing the sentry object, @c good() is false, + * returns @c traits::eof(). Otherwise reads but does not extract + * the next input character. + */ + int_type + peek(); + + /** + * @brief Extraction without delimiters. + * @param s A character array. + * @param n Maximum number of characters to store. + * @return *this + * + * If the stream state is @c good(), extracts characters and stores + * them into @a s until one of the following happens: + * - @a n characters are stored + * - the input sequence reaches end-of-file, in which case the error + * state is set to @c failbit|eofbit. + * + * @note This function is not overloaded on signed char and + * unsigned char. + */ + __istream_type& + read(char_type* __s, streamsize __n); + + /** + * @brief Extraction until the buffer is exhausted, but no more. + * @param s A character array. + * @param n Maximum number of characters to store. + * @return The number of characters extracted. + * + * Extracts characters and stores them into @a s depending on the + * number of characters remaining in the streambuf's buffer, + * @c rdbuf()->in_avail(), called @c A here: + * - if @c A @c == @c -1, sets eofbit and extracts no characters + * - if @c A @c == @c 0, extracts no characters + * - if @c A @c > @c 0, extracts @c min(A,n) + * + * The goal is to empty the current buffer, and to not request any + * more from the external input sequence controlled by the streambuf. + */ + streamsize + readsome(char_type* __s, streamsize __n); + + /** + * @brief Unextracting a single character. + * @param c The character to push back into the input stream. + * @return *this + * + * If @c rdbuf() is not null, calls @c rdbuf()->sputbackc(c). + * + * If @c rdbuf() is null or if @c sputbackc() fails, sets badbit in + * the error state. + * + * @note Since no characters are extracted, the next call to + * @c gcount() will return 0, as required by DR 60. + */ + __istream_type& + putback(char_type __c); + + /** + * @brief Unextracting the previous character. + * @return *this + * + * If @c rdbuf() is not null, calls @c rdbuf()->sungetc(c). + * + * If @c rdbuf() is null or if @c sungetc() fails, sets badbit in + * the error state. + * + * @note Since no characters are extracted, the next call to + * @c gcount() will return 0, as required by DR 60. + */ + __istream_type& + unget(); + + /** + * @brief Synchronizing the stream buffer. + * @return 0 on success, -1 on failure + * + * If @c rdbuf() is a null pointer, returns -1. + * + * Otherwise, calls @c rdbuf()->pubsync(), and if that returns -1, + * sets badbit and returns -1. + * + * Otherwise, returns 0. + * + * @note This function does not count the number of characters + * extracted, if any, and therefore does not affect the next + * call to @c gcount(). + */ + int + sync(); + + /** + * @brief Getting the current read position. + * @return A file position object. + * + * If @c fail() is not false, returns @c pos_type(-1) to indicate + * failure. Otherwise returns @c rdbuf()->pubseekoff(0,cur,in). + * + * @note This function does not count the number of characters + * extracted, if any, and therefore does not affect the next + * call to @c gcount(). + */ + pos_type + tellg(); + + /** + * @brief Changing the current read position. + * @param pos A file position object. + * @return *this + * + * If @c fail() is not true, calls @c rdbuf()->pubseekpos(pos). If + * that function fails, sets failbit. + * + * @note This function does not count the number of characters + * extracted, if any, and therefore does not affect the next + * call to @c gcount(). + */ + __istream_type& + seekg(pos_type); + + /** + * @brief Changing the current read position. + * @param off A file offset object. + * @param dir The direction in which to seek. + * @return *this + * + * If @c fail() is not true, calls @c rdbuf()->pubseekoff(off,dir). + * If that function fails, sets failbit. + * + * @note This function does not count the number of characters + * extracted, if any, and therefore does not affect the next + * call to @c gcount(). + */ + __istream_type& + seekg(off_type, ios_base::seekdir); + //@} + + protected: + explicit + basic_istream(): _M_gcount(streamsize(0)) { } + + template + __istream_type& + _M_extract(_ValueT& __v); + }; + + // Explicit specialization declarations, defined in src/istream.cc. + template<> + basic_istream& + basic_istream:: + getline(char_type* __s, streamsize __n, char_type __delim); + + template<> + basic_istream& + basic_istream:: + ignore(streamsize __n); + + template<> + basic_istream& + basic_istream:: + ignore(streamsize __n, int_type __delim); + +#ifdef _GLIBCXX_USE_WCHAR_T + template<> + basic_istream& + basic_istream:: + getline(char_type* __s, streamsize __n, char_type __delim); + + template<> + basic_istream& + basic_istream:: + ignore(streamsize __n); + + template<> + basic_istream& + basic_istream:: + ignore(streamsize __n, int_type __delim); +#endif + + /** + * @brief Performs setup work for input streams. + * + * Objects of this class are created before all of the standard + * extractors are run. It is responsible for "exception-safe prefix and + * suffix operations," although only prefix actions are currently required + * by the standard. Additional actions may be added by the + * implementation, and we list them in + * http://gcc.gnu.org/onlinedocs/libstdc++/17_intro/howto.html#5 + * under [27.6] notes. + */ + template + class basic_istream<_CharT, _Traits>::sentry + { + public: + /// Easy access to dependant types. + typedef _Traits traits_type; + typedef basic_streambuf<_CharT, _Traits> __streambuf_type; + typedef basic_istream<_CharT, _Traits> __istream_type; + typedef typename __istream_type::__ctype_type __ctype_type; + typedef typename _Traits::int_type __int_type; + + /** + * @brief The constructor performs all the work. + * @param is The input stream to guard. + * @param noskipws Whether to consume whitespace or not. + * + * If the stream state is good (@a is.good() is true), then the + * following actions are performed, otherwise the sentry state is + * false ("not okay") and failbit is set in the stream state. + * + * The sentry's preparatory actions are: + * + * -# if the stream is tied to an output stream, @c is.tie()->flush() + * is called to synchronize the output sequence + * -# if @a noskipws is false, and @c ios_base::skipws is set in + * @c is.flags(), the sentry extracts and discards whitespace + * characters from the stream. The currently imbued locale is + * used to determine whether each character is whitespace. + * + * If the stream state is still good, then the sentry state becomes + * true ("okay"). + */ + explicit + sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws = false); + + /** + * @brief Quick status checking. + * @return The sentry state. + * + * For ease of use, sentries may be converted to booleans. The + * return value is that of the sentry state (true == okay). + */ + operator bool() const + { return _M_ok; } + + private: + bool _M_ok; + }; + + // [27.6.1.2.3] character extraction templates + //@{ + /** + * @brief Character extractors + * @param in An input stream. + * @param c A character reference. + * @return in + * + * Behaves like one of the formatted arithmetic extractors described in + * std::basic_istream. After constructing a sentry object with good + * status, this function extracts a character (if one is available) and + * stores it in @a c. Otherwise, sets failbit in the input stream. + */ + template + basic_istream<_CharT, _Traits>& + operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c); + + template + inline basic_istream& + operator>>(basic_istream& __in, unsigned char& __c) + { return (__in >> reinterpret_cast(__c)); } + + template + inline basic_istream& + operator>>(basic_istream& __in, signed char& __c) + { return (__in >> reinterpret_cast(__c)); } + //@} + + //@{ + /** + * @brief Character string extractors + * @param in An input stream. + * @param s A pointer to a character array. + * @return in + * + * Behaves like one of the formatted arithmetic extractors described in + * std::basic_istream. After constructing a sentry object with good + * status, this function extracts up to @c n characters and stores them + * into the array starting at @a s. @c n is defined as: + * + * - if @c width() is greater than zero, @c n is width() + * - otherwise @c n is "the number of elements of the largest array of + * @c char_type that can store a terminating @c eos." [27.6.1.2.3]/6 + * + * Characters are extracted and stored until one of the following happens: + * - @c n-1 characters are stored + * - EOF is reached + * - the next character is whitespace according to the current locale + * - the next character is a null byte (i.e., @c charT() ) + * + * @c width(0) is then called for the input stream. + * + * If no characters are extracted, sets failbit. + */ + template + basic_istream<_CharT, _Traits>& + operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s); + + // Explicit specialization declaration, defined in src/istream.cc. + template<> + basic_istream& + operator>>(basic_istream& __in, char* __s); + + template + inline basic_istream& + operator>>(basic_istream& __in, unsigned char* __s) + { return (__in >> reinterpret_cast(__s)); } + + template + inline basic_istream& + operator>>(basic_istream& __in, signed char* __s) + { return (__in >> reinterpret_cast(__s)); } + //@} + + // 27.6.1.5 Template class basic_iostream + /** + * @brief Merging istream and ostream capabilities. + * + * This class multiply inherits from the input and output stream classes + * simply to provide a single interface. + */ + template + class basic_iostream + : public basic_istream<_CharT, _Traits>, + public basic_ostream<_CharT, _Traits> + { + public: + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 271. basic_iostream missing typedefs + // Types (inherited): + typedef _CharT char_type; + typedef typename _Traits::int_type int_type; + typedef typename _Traits::pos_type pos_type; + typedef typename _Traits::off_type off_type; + typedef _Traits traits_type; + + // Non-standard Types: + typedef basic_istream<_CharT, _Traits> __istream_type; + typedef basic_ostream<_CharT, _Traits> __ostream_type; + + /** + * @brief Constructor does nothing. + * + * Both of the parent classes are initialized with the same + * streambuf pointer passed to this constructor. + */ + explicit + basic_iostream(basic_streambuf<_CharT, _Traits>* __sb) + : __istream_type(), __ostream_type() + { this->init(__sb); } + + /** + * @brief Destructor does nothing. + */ + virtual + ~basic_iostream() { } + + protected: + explicit + basic_iostream() : __istream_type(), __ostream_type() + { } + }; + + // [27.6.1.4] standard basic_istream manipulators + /** + * @brief Quick and easy way to eat whitespace + * + * This manipulator extracts whitespace characters, stopping when the + * next character is non-whitespace, or when the input sequence is empty. + * If the sequence is empty, @c eofbit is set in the stream, but not + * @c failbit. + * + * The current locale is used to distinguish whitespace characters. + * + * Example: + * @code + * MyClass mc; + * + * std::cin >> std::ws >> mc; + * @endcode + * will skip leading whitespace before calling operator>> on cin and your + * object. Note that the same effect can be achieved by creating a + * std::basic_istream::sentry inside your definition of operator>>. + */ + template + basic_istream<_CharT, _Traits>& + ws(basic_istream<_CharT, _Traits>& __is); + +_GLIBCXX_END_NAMESPACE + +#ifndef _GLIBCXX_EXPORT_TEMPLATE +# include +#endif + +#endif /* _GLIBCXX_ISTREAM */ diff --git a/libstdc++-v3/include/std/iterator b/libstdc++-v3/include/std/iterator new file mode 100644 index 00000000000..f0317b44a7c --- /dev/null +++ b/libstdc++-v3/include/std/iterator @@ -0,0 +1,75 @@ +// -*- C++ -*- + +// Copyright (C) 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file include/iterator + * This is a Standard C++ Library header. + */ + +#ifndef _GLIBCXX_ITERATOR +#define _GLIBCXX_ITERATOR 1 + +#pragma GCC system_header + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif /* _GLIBCXX_ITERATOR */ diff --git a/libstdc++-v3/include/std/limits b/libstdc++-v3/include/std/limits new file mode 100644 index 00000000000..d1211fdb59e --- /dev/null +++ b/libstdc++-v3/include/std/limits @@ -0,0 +1,1160 @@ +// The template and inlines for the numeric_limits classes. -*- C++ -*- + +// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file limits + * This is a Standard C++ Library header. + */ + +// Note: this is not a conforming implementation. +// Written by Gabriel Dos Reis + +// +// ISO 14882:1998 +// 18.2.1 +// + +#ifndef _GLIBCXX_NUMERIC_LIMITS +#define _GLIBCXX_NUMERIC_LIMITS 1 + +#pragma GCC system_header + +#include + +// +// The numeric_limits<> traits document implementation-defined aspects +// of fundamental arithmetic data types (integers and floating points). +// From Standard C++ point of view, there are 13 such types: +// * integers +// bool (1) +// char, signed char, unsigned char (3) +// short, unsigned short (2) +// int, unsigned (2) +// long, unsigned long (2) +// +// * floating points +// float (1) +// double (1) +// long double (1) +// +// GNU C++ undertstands (where supported by the host C-library) +// * integer +// long long, unsigned long long (2) +// +// which brings us to 15 fundamental arithmetic data types in GNU C++. +// +// +// Since a numeric_limits<> is a bit tricky to get right, we rely on +// an interface composed of macros which should be defined in config/os +// or config/cpu when they differ from the generic (read arbitrary) +// definitions given here. +// + +// These values can be overridden in the target configuration file. +// The default values are appropriate for many 32-bit targets. + +// GCC only intrinsicly supports modulo integral types. The only remaining +// integral exceptional values is division by zero. Only targets that do not +// signal division by zero in some "hard to ignore" way should use false. +#ifndef __glibcxx_integral_traps +# define __glibcxx_integral_traps true +#endif + +// float +// + +// Default values. Should be overriden in configuration files if necessary. + +#ifndef __glibcxx_float_has_denorm_loss +# define __glibcxx_float_has_denorm_loss false +#endif +#ifndef __glibcxx_float_traps +# define __glibcxx_float_traps false +#endif +#ifndef __glibcxx_float_tinyness_before +# define __glibcxx_float_tinyness_before false +#endif + +// double + +// Default values. Should be overriden in configuration files if necessary. + +#ifndef __glibcxx_double_has_denorm_loss +# define __glibcxx_double_has_denorm_loss false +#endif +#ifndef __glibcxx_double_traps +# define __glibcxx_double_traps false +#endif +#ifndef __glibcxx_double_tinyness_before +# define __glibcxx_double_tinyness_before false +#endif + +// long double + +// Default values. Should be overriden in configuration files if necessary. + +#ifndef __glibcxx_long_double_has_denorm_loss +# define __glibcxx_long_double_has_denorm_loss false +#endif +#ifndef __glibcxx_long_double_traps +# define __glibcxx_long_double_traps false +#endif +#ifndef __glibcxx_long_double_tinyness_before +# define __glibcxx_long_double_tinyness_before false +#endif + +// You should not need to define any macros below this point. + +#define __glibcxx_signed(T) ((T)(-1) < 0) + +#define __glibcxx_min(T) \ + (__glibcxx_signed (T) ? (T)1 << __glibcxx_digits (T) : (T)0) + +#define __glibcxx_max(T) \ + (__glibcxx_signed (T) ? ((T)1 << __glibcxx_digits (T)) - 1 : ~(T)0) + +#define __glibcxx_digits(T) \ + (sizeof(T) * __CHAR_BIT__ - __glibcxx_signed (T)) + +// The fraction 643/2136 approximates log10(2) to 7 significant digits. +#define __glibcxx_digits10(T) \ + (__glibcxx_digits (T) * 643 / 2136) + + +_GLIBCXX_BEGIN_NAMESPACE(std) + + /** + * @brief Describes the rounding style for floating-point types. + * + * This is used in the std::numeric_limits class. + */ + enum float_round_style + { + round_indeterminate = -1, ///< Self-explanatory. + round_toward_zero = 0, ///< Self-explanatory. + round_to_nearest = 1, ///< To the nearest representable value. + round_toward_infinity = 2, ///< Self-explanatory. + round_toward_neg_infinity = 3 ///< Self-explanatory. + }; + + /** + * @brief Describes the denormalization for floating-point types. + * + * These values represent the presence or absence of a variable number + * of exponent bits. This type is used in the std::numeric_limits class. + */ + enum float_denorm_style + { + /// Indeterminate at compile time whether denormalized values are allowed. + denorm_indeterminate = -1, + /// The type does not allow denormalized values. + denorm_absent = 0, + /// The type allows denormalized values. + denorm_present = 1 + }; + + /** + * @brief Part of std::numeric_limits. + * + * The @c static @c const members are usable as integral constant + * expressions. + * + * @note This is a seperate class for purposes of efficiency; you + * should only access these members as part of an instantiation + * of the std::numeric_limits class. + */ + struct __numeric_limits_base + { + /** This will be true for all fundamental types (which have + specializations), and false for everything else. */ + static const bool is_specialized = false; + + /** The number of @c radix digits that be represented without change: for + integer types, the number of non-sign bits in the mantissa; for + floating types, the number of @c radix digits in the mantissa. */ + static const int digits = 0; + /** The number of base 10 digits that can be represented without change. */ + static const int digits10 = 0; + /** True if the type is signed. */ + static const bool is_signed = false; + /** True if the type is integer. + * @if maint + * Is this supposed to be "if the type is integral"? + * @endif + */ + static const bool is_integer = false; + /** True if the type uses an exact representation. "All integer types are + exact, but not all exact types are integer. For example, rational and + fixed-exponent representations are exact but not integer." + [18.2.1.2]/15 */ + static const bool is_exact = false; + /** For integer types, specifies the base of the representation. For + floating types, specifies the base of the exponent representation. */ + static const int radix = 0; + + /** The minimum negative integer such that @c radix raised to the power of + (one less than that integer) is a normalized floating point number. */ + static const int min_exponent = 0; + /** The minimum negative integer such that 10 raised to that power is in + the range of normalized floating point numbers. */ + static const int min_exponent10 = 0; + /** The maximum positive integer such that @c radix raised to the power of + (one less than that integer) is a representable finite floating point + number. */ + static const int max_exponent = 0; + /** The maximum positive integer such that 10 raised to that power is in + the range of representable finite floating point numbers. */ + static const int max_exponent10 = 0; + + /** True if the type has a representation for positive infinity. */ + static const bool has_infinity = false; + /** True if the type has a representation for a quiet (non-signaling) + "Not a Number." */ + static const bool has_quiet_NaN = false; + /** True if the type has a representation for a signaling + "Not a Number." */ + static const bool has_signaling_NaN = false; + /** See std::float_denorm_style for more information. */ + static const float_denorm_style has_denorm = denorm_absent; + /** "True if loss of accuracy is detected as a denormalization loss, + rather than as an inexact result." [18.2.1.2]/42 */ + static const bool has_denorm_loss = false; + + /** True if-and-only-if the type adheres to the IEC 559 standard, also + known as IEEE 754. (Only makes sense for floating point types.) */ + static const bool is_iec559 = false; + /** "True if the set of values representable by the type is finite. All + built-in types are bounded, this member would be false for arbitrary + precision types." [18.2.1.2]/54 */ + static const bool is_bounded = false; + /** True if the type is @e modulo, that is, if it is possible to add two + positive numbers and have a result that wraps around to a third number + that is less. Typically false for floating types, true for unsigned + integers, and true for signed integers. */ + static const bool is_modulo = false; + + /** True if trapping is implemented for this type. */ + static const bool traps = false; + /** True if tinyness is detected before rounding. (see IEC 559) */ + static const bool tinyness_before = false; + /** See std::float_round_style for more information. This is only + meaningful for floating types; integer types will all be + round_toward_zero. */ + static const float_round_style round_style = round_toward_zero; + }; + + /** + * @brief Properties of fundamental types. + * + * This class allows a program to obtain information about the + * representation of a fundamental type on a given platform. For + * non-fundamental types, the functions will return 0 and the data + * members will all be @c false. + * + * @if maint + * _GLIBCXX_RESOLVE_LIB_DEFECTS: DRs 201 and 184 (hi Gaby!) are + * noted, but not incorporated in this documented (yet). + * @endif + */ + template + struct numeric_limits : public __numeric_limits_base + { + /** The minimum finite value, or for floating types with + denormalization, the minimum positive normalized value. */ + static _Tp min() throw() { return static_cast<_Tp>(0); } + /** The maximum finite value. */ + static _Tp max() throw() { return static_cast<_Tp>(0); } + /** The @e machine @e epsilon: the difference between 1 and the least + value greater than 1 that is representable. */ + static _Tp epsilon() throw() { return static_cast<_Tp>(0); } + /** The maximum rounding error measurement (see LIA-1). */ + static _Tp round_error() throw() { return static_cast<_Tp>(0); } + /** The representation of positive infinity, if @c has_infinity. */ + static _Tp infinity() throw() { return static_cast<_Tp>(0); } + /** The representation of a quiet "Not a Number," if @c has_quiet_NaN. */ + static _Tp quiet_NaN() throw() { return static_cast<_Tp>(0); } + /** The representation of a signaling "Not a Number," if + @c has_signaling_NaN. */ + static _Tp signaling_NaN() throw() { return static_cast<_Tp>(0); } + /** The minimum positive denormalized value. For types where + @c has_denorm is false, this is the minimum positive normalized + value. */ + static _Tp denorm_min() throw() { return static_cast<_Tp>(0); } + }; + + // Now there follow 15 explicit specializations. Yes, 15. Make sure + // you get the count right. + + /// numeric_limits specialization. + template<> + struct numeric_limits + { + static const bool is_specialized = true; + + static bool min() throw() + { return false; } + static bool max() throw() + { return true; } + + static const int digits = 1; + static const int digits10 = 0; + static const bool is_signed = false; + static const bool is_integer = true; + static const bool is_exact = true; + static const int radix = 2; + static bool epsilon() throw() + { return false; } + static bool round_error() throw() + { return false; } + + static const int min_exponent = 0; + static const int min_exponent10 = 0; + static const int max_exponent = 0; + static const int max_exponent10 = 0; + + static const bool has_infinity = false; + static const bool has_quiet_NaN = false; + static const bool has_signaling_NaN = false; + static const float_denorm_style has_denorm = denorm_absent; + static const bool has_denorm_loss = false; + + static bool infinity() throw() + { return false; } + static bool quiet_NaN() throw() + { return false; } + static bool signaling_NaN() throw() + { return false; } + static bool denorm_min() throw() + { return false; } + + static const bool is_iec559 = false; + static const bool is_bounded = true; + static const bool is_modulo = false; + + // It is not clear what it means for a boolean type to trap. + // This is a DR on the LWG issue list. Here, I use integer + // promotion semantics. + static const bool traps = __glibcxx_integral_traps; + static const bool tinyness_before = false; + static const float_round_style round_style = round_toward_zero; + }; + + /// numeric_limits specialization. + template<> + struct numeric_limits + { + static const bool is_specialized = true; + + static char min() throw() + { return __glibcxx_min(char); } + static char max() throw() + { return __glibcxx_max(char); } + + static const int digits = __glibcxx_digits (char); + static const int digits10 = __glibcxx_digits10 (char); + static const bool is_signed = __glibcxx_signed (char); + static const bool is_integer = true; + static const bool is_exact = true; + static const int radix = 2; + static char epsilon() throw() + { return 0; } + static char round_error() throw() + { return 0; } + + static const int min_exponent = 0; + static const int min_exponent10 = 0; + static const int max_exponent = 0; + static const int max_exponent10 = 0; + + static const bool has_infinity = false; + static const bool has_quiet_NaN = false; + static const bool has_signaling_NaN = false; + static const float_denorm_style has_denorm = denorm_absent; + static const bool has_denorm_loss = false; + + static char infinity() throw() + { return char(); } + static char quiet_NaN() throw() + { return char(); } + static char signaling_NaN() throw() + { return char(); } + static char denorm_min() throw() + { return static_cast(0); } + + static const bool is_iec559 = false; + static const bool is_bounded = true; + static const bool is_modulo = true; + + static const bool traps = __glibcxx_integral_traps; + static const bool tinyness_before = false; + static const float_round_style round_style = round_toward_zero; + }; + + /// numeric_limits specialization. + template<> + struct numeric_limits + { + static const bool is_specialized = true; + + static signed char min() throw() + { return -__SCHAR_MAX__ - 1; } + static signed char max() throw() + { return __SCHAR_MAX__; } + + static const int digits = __glibcxx_digits (signed char); + static const int digits10 = __glibcxx_digits10 (signed char); + static const bool is_signed = true; + static const bool is_integer = true; + static const bool is_exact = true; + static const int radix = 2; + static signed char epsilon() throw() + { return 0; } + static signed char round_error() throw() + { return 0; } + + static const int min_exponent = 0; + static const int min_exponent10 = 0; + static const int max_exponent = 0; + static const int max_exponent10 = 0; + + static const bool has_infinity = false; + static const bool has_quiet_NaN = false; + static const bool has_signaling_NaN = false; + static const float_denorm_style has_denorm = denorm_absent; + static const bool has_denorm_loss = false; + + static signed char infinity() throw() + { return static_cast(0); } + static signed char quiet_NaN() throw() + { return static_cast(0); } + static signed char signaling_NaN() throw() + { return static_cast(0); } + static signed char denorm_min() throw() + { return static_cast(0); } + + static const bool is_iec559 = false; + static const bool is_bounded = true; + static const bool is_modulo = true; + + static const bool traps = __glibcxx_integral_traps; + static const bool tinyness_before = false; + static const float_round_style round_style = round_toward_zero; + }; + + /// numeric_limits specialization. + template<> + struct numeric_limits + { + static const bool is_specialized = true; + + static unsigned char min() throw() + { return 0; } + static unsigned char max() throw() + { return __SCHAR_MAX__ * 2U + 1; } + + static const int digits = __glibcxx_digits (unsigned char); + static const int digits10 = __glibcxx_digits10 (unsigned char); + static const bool is_signed = false; + static const bool is_integer = true; + static const bool is_exact = true; + static const int radix = 2; + static unsigned char epsilon() throw() + { return 0; } + static unsigned char round_error() throw() + { return 0; } + + static const int min_exponent = 0; + static const int min_exponent10 = 0; + static const int max_exponent = 0; + static const int max_exponent10 = 0; + + static const bool has_infinity = false; + static const bool has_quiet_NaN = false; + static const bool has_signaling_NaN = false; + static const float_denorm_style has_denorm = denorm_absent; + static const bool has_denorm_loss = false; + + static unsigned char infinity() throw() + { return static_cast(0); } + static unsigned char quiet_NaN() throw() + { return static_cast(0); } + static unsigned char signaling_NaN() throw() + { return static_cast(0); } + static unsigned char denorm_min() throw() + { return static_cast(0); } + + static const bool is_iec559 = false; + static const bool is_bounded = true; + static const bool is_modulo = true; + + static const bool traps = __glibcxx_integral_traps; + static const bool tinyness_before = false; + static const float_round_style round_style = round_toward_zero; + }; + + /// numeric_limits specialization. + template<> + struct numeric_limits + { + static const bool is_specialized = true; + + static wchar_t min() throw() + { return __glibcxx_min (wchar_t); } + static wchar_t max() throw() + { return __glibcxx_max (wchar_t); } + + static const int digits = __glibcxx_digits (wchar_t); + static const int digits10 = __glibcxx_digits10 (wchar_t); + static const bool is_signed = __glibcxx_signed (wchar_t); + static const bool is_integer = true; + static const bool is_exact = true; + static const int radix = 2; + static wchar_t epsilon() throw() + { return 0; } + static wchar_t round_error() throw() + { return 0; } + + static const int min_exponent = 0; + static const int min_exponent10 = 0; + static const int max_exponent = 0; + static const int max_exponent10 = 0; + + static const bool has_infinity = false; + static const bool has_quiet_NaN = false; + static const bool has_signaling_NaN = false; + static const float_denorm_style has_denorm = denorm_absent; + static const bool has_denorm_loss = false; + + static wchar_t infinity() throw() + { return wchar_t(); } + static wchar_t quiet_NaN() throw() + { return wchar_t(); } + static wchar_t signaling_NaN() throw() + { return wchar_t(); } + static wchar_t denorm_min() throw() + { return wchar_t(); } + + static const bool is_iec559 = false; + static const bool is_bounded = true; + static const bool is_modulo = true; + + static const bool traps = __glibcxx_integral_traps; + static const bool tinyness_before = false; + static const float_round_style round_style = round_toward_zero; + }; + + /// numeric_limits specialization. + template<> + struct numeric_limits + { + static const bool is_specialized = true; + + static short min() throw() + { return -__SHRT_MAX__ - 1; } + static short max() throw() + { return __SHRT_MAX__; } + + static const int digits = __glibcxx_digits (short); + static const int digits10 = __glibcxx_digits10 (short); + static const bool is_signed = true; + static const bool is_integer = true; + static const bool is_exact = true; + static const int radix = 2; + static short epsilon() throw() + { return 0; } + static short round_error() throw() + { return 0; } + + static const int min_exponent = 0; + static const int min_exponent10 = 0; + static const int max_exponent = 0; + static const int max_exponent10 = 0; + + static const bool has_infinity = false; + static const bool has_quiet_NaN = false; + static const bool has_signaling_NaN = false; + static const float_denorm_style has_denorm = denorm_absent; + static const bool has_denorm_loss = false; + + static short infinity() throw() + { return short(); } + static short quiet_NaN() throw() + { return short(); } + static short signaling_NaN() throw() + { return short(); } + static short denorm_min() throw() + { return short(); } + + static const bool is_iec559 = false; + static const bool is_bounded = true; + static const bool is_modulo = true; + + static const bool traps = __glibcxx_integral_traps; + static const bool tinyness_before = false; + static const float_round_style round_style = round_toward_zero; + }; + + /// numeric_limits specialization. + template<> + struct numeric_limits + { + static const bool is_specialized = true; + + static unsigned short min() throw() + { return 0; } + static unsigned short max() throw() + { return __SHRT_MAX__ * 2U + 1; } + + static const int digits = __glibcxx_digits (unsigned short); + static const int digits10 = __glibcxx_digits10 (unsigned short); + static const bool is_signed = false; + static const bool is_integer = true; + static const bool is_exact = true; + static const int radix = 2; + static unsigned short epsilon() throw() + { return 0; } + static unsigned short round_error() throw() + { return 0; } + + static const int min_exponent = 0; + static const int min_exponent10 = 0; + static const int max_exponent = 0; + static const int max_exponent10 = 0; + + static const bool has_infinity = false; + static const bool has_quiet_NaN = false; + static const bool has_signaling_NaN = false; + static const float_denorm_style has_denorm = denorm_absent; + static const bool has_denorm_loss = false; + + static unsigned short infinity() throw() + { return static_cast(0); } + static unsigned short quiet_NaN() throw() + { return static_cast(0); } + static unsigned short signaling_NaN() throw() + { return static_cast(0); } + static unsigned short denorm_min() throw() + { return static_cast(0); } + + static const bool is_iec559 = false; + static const bool is_bounded = true; + static const bool is_modulo = true; + + static const bool traps = __glibcxx_integral_traps; + static const bool tinyness_before = false; + static const float_round_style round_style = round_toward_zero; + }; + + /// numeric_limits specialization. + template<> + struct numeric_limits + { + static const bool is_specialized = true; + + static int min() throw() + { return -__INT_MAX__ - 1; } + static int max() throw() + { return __INT_MAX__; } + + static const int digits = __glibcxx_digits (int); + static const int digits10 = __glibcxx_digits10 (int); + static const bool is_signed = true; + static const bool is_integer = true; + static const bool is_exact = true; + static const int radix = 2; + static int epsilon() throw() + { return 0; } + static int round_error() throw() + { return 0; } + + static const int min_exponent = 0; + static const int min_exponent10 = 0; + static const int max_exponent = 0; + static const int max_exponent10 = 0; + + static const bool has_infinity = false; + static const bool has_quiet_NaN = false; + static const bool has_signaling_NaN = false; + static const float_denorm_style has_denorm = denorm_absent; + static const bool has_denorm_loss = false; + + static int infinity() throw() + { return static_cast(0); } + static int quiet_NaN() throw() + { return static_cast(0); } + static int signaling_NaN() throw() + { return static_cast(0); } + static int denorm_min() throw() + { return static_cast(0); } + + static const bool is_iec559 = false; + static const bool is_bounded = true; + static const bool is_modulo = true; + + static const bool traps = __glibcxx_integral_traps; + static const bool tinyness_before = false; + static const float_round_style round_style = round_toward_zero; + }; + + /// numeric_limits specialization. + template<> + struct numeric_limits + { + static const bool is_specialized = true; + + static unsigned int min() throw() + { return 0; } + static unsigned int max() throw() + { return __INT_MAX__ * 2U + 1; } + + static const int digits = __glibcxx_digits (unsigned int); + static const int digits10 = __glibcxx_digits10 (unsigned int); + static const bool is_signed = false; + static const bool is_integer = true; + static const bool is_exact = true; + static const int radix = 2; + static unsigned int epsilon() throw() + { return 0; } + static unsigned int round_error() throw() + { return 0; } + + static const int min_exponent = 0; + static const int min_exponent10 = 0; + static const int max_exponent = 0; + static const int max_exponent10 = 0; + + static const bool has_infinity = false; + static const bool has_quiet_NaN = false; + static const bool has_signaling_NaN = false; + static const float_denorm_style has_denorm = denorm_absent; + static const bool has_denorm_loss = false; + + static unsigned int infinity() throw() + { return static_cast(0); } + static unsigned int quiet_NaN() throw() + { return static_cast(0); } + static unsigned int signaling_NaN() throw() + { return static_cast(0); } + static unsigned int denorm_min() throw() + { return static_cast(0); } + + static const bool is_iec559 = false; + static const bool is_bounded = true; + static const bool is_modulo = true; + + static const bool traps = __glibcxx_integral_traps; + static const bool tinyness_before = false; + static const float_round_style round_style = round_toward_zero; + }; + + /// numeric_limits specialization. + template<> + struct numeric_limits + { + static const bool is_specialized = true; + + static long min() throw() + { return -__LONG_MAX__ - 1; } + static long max() throw() + { return __LONG_MAX__; } + + static const int digits = __glibcxx_digits (long); + static const int digits10 = __glibcxx_digits10 (long); + static const bool is_signed = true; + static const bool is_integer = true; + static const bool is_exact = true; + static const int radix = 2; + static long epsilon() throw() + { return 0; } + static long round_error() throw() + { return 0; } + + static const int min_exponent = 0; + static const int min_exponent10 = 0; + static const int max_exponent = 0; + static const int max_exponent10 = 0; + + static const bool has_infinity = false; + static const bool has_quiet_NaN = false; + static const bool has_signaling_NaN = false; + static const float_denorm_style has_denorm = denorm_absent; + static const bool has_denorm_loss = false; + + static long infinity() throw() + { return static_cast(0); } + static long quiet_NaN() throw() + { return static_cast(0); } + static long signaling_NaN() throw() + { return static_cast(0); } + static long denorm_min() throw() + { return static_cast(0); } + + static const bool is_iec559 = false; + static const bool is_bounded = true; + static const bool is_modulo = true; + + static const bool traps = __glibcxx_integral_traps; + static const bool tinyness_before = false; + static const float_round_style round_style = round_toward_zero; + }; + + /// numeric_limits specialization. + template<> + struct numeric_limits + { + static const bool is_specialized = true; + + static unsigned long min() throw() + { return 0; } + static unsigned long max() throw() + { return __LONG_MAX__ * 2UL + 1; } + + static const int digits = __glibcxx_digits (unsigned long); + static const int digits10 = __glibcxx_digits10 (unsigned long); + static const bool is_signed = false; + static const bool is_integer = true; + static const bool is_exact = true; + static const int radix = 2; + static unsigned long epsilon() throw() + { return 0; } + static unsigned long round_error() throw() + { return 0; } + + static const int min_exponent = 0; + static const int min_exponent10 = 0; + static const int max_exponent = 0; + static const int max_exponent10 = 0; + + static const bool has_infinity = false; + static const bool has_quiet_NaN = false; + static const bool has_signaling_NaN = false; + static const float_denorm_style has_denorm = denorm_absent; + static const bool has_denorm_loss = false; + + static unsigned long infinity() throw() + { return static_cast(0); } + static unsigned long quiet_NaN() throw() + { return static_cast(0); } + static unsigned long signaling_NaN() throw() + { return static_cast(0); } + static unsigned long denorm_min() throw() + { return static_cast(0); } + + static const bool is_iec559 = false; + static const bool is_bounded = true; + static const bool is_modulo = true; + + static const bool traps = __glibcxx_integral_traps; + static const bool tinyness_before = false; + static const float_round_style round_style = round_toward_zero; + }; + + /// numeric_limits specialization. + template<> + struct numeric_limits + { + static const bool is_specialized = true; + + static long long min() throw() + { return -__LONG_LONG_MAX__ - 1; } + static long long max() throw() + { return __LONG_LONG_MAX__; } + + static const int digits = __glibcxx_digits (long long); + static const int digits10 = __glibcxx_digits10 (long long); + static const bool is_signed = true; + static const bool is_integer = true; + static const bool is_exact = true; + static const int radix = 2; + static long long epsilon() throw() + { return 0; } + static long long round_error() throw() + { return 0; } + + static const int min_exponent = 0; + static const int min_exponent10 = 0; + static const int max_exponent = 0; + static const int max_exponent10 = 0; + + static const bool has_infinity = false; + static const bool has_quiet_NaN = false; + static const bool has_signaling_NaN = false; + static const float_denorm_style has_denorm = denorm_absent; + static const bool has_denorm_loss = false; + + static long long infinity() throw() + { return static_cast(0); } + static long long quiet_NaN() throw() + { return static_cast(0); } + static long long signaling_NaN() throw() + { return static_cast(0); } + static long long denorm_min() throw() + { return static_cast(0); } + + static const bool is_iec559 = false; + static const bool is_bounded = true; + static const bool is_modulo = true; + + static const bool traps = __glibcxx_integral_traps; + static const bool tinyness_before = false; + static const float_round_style round_style = round_toward_zero; + }; + + /// numeric_limits specialization. + template<> + struct numeric_limits + { + static const bool is_specialized = true; + + static unsigned long long min() throw() + { return 0; } + static unsigned long long max() throw() + { return __LONG_LONG_MAX__ * 2ULL + 1; } + + static const int digits = __glibcxx_digits (unsigned long long); + static const int digits10 = __glibcxx_digits10 (unsigned long long); + static const bool is_signed = false; + static const bool is_integer = true; + static const bool is_exact = true; + static const int radix = 2; + static unsigned long long epsilon() throw() + { return 0; } + static unsigned long long round_error() throw() + { return 0; } + + static const int min_exponent = 0; + static const int min_exponent10 = 0; + static const int max_exponent = 0; + static const int max_exponent10 = 0; + + static const bool has_infinity = false; + static const bool has_quiet_NaN = false; + static const bool has_signaling_NaN = false; + static const float_denorm_style has_denorm = denorm_absent; + static const bool has_denorm_loss = false; + + static unsigned long long infinity() throw() + { return static_cast(0); } + static unsigned long long quiet_NaN() throw() + { return static_cast(0); } + static unsigned long long signaling_NaN() throw() + { return static_cast(0); } + static unsigned long long denorm_min() throw() + { return static_cast(0); } + + static const bool is_iec559 = false; + static const bool is_bounded = true; + static const bool is_modulo = true; + + static const bool traps = __glibcxx_integral_traps; + static const bool tinyness_before = false; + static const float_round_style round_style = round_toward_zero; + }; + + /// numeric_limits specialization. + template<> + struct numeric_limits + { + static const bool is_specialized = true; + + static float min() throw() + { return __FLT_MIN__; } + static float max() throw() + { return __FLT_MAX__; } + + static const int digits = __FLT_MANT_DIG__; + static const int digits10 = __FLT_DIG__; + static const bool is_signed = true; + static const bool is_integer = false; + static const bool is_exact = false; + static const int radix = __FLT_RADIX__; + static float epsilon() throw() + { return __FLT_EPSILON__; } + static float round_error() throw() + { return 0.5F; } + + static const int min_exponent = __FLT_MIN_EXP__; + static const int min_exponent10 = __FLT_MIN_10_EXP__; + static const int max_exponent = __FLT_MAX_EXP__; + static const int max_exponent10 = __FLT_MAX_10_EXP__; + + static const bool has_infinity = __FLT_HAS_INFINITY__; + static const bool has_quiet_NaN = __FLT_HAS_QUIET_NAN__; + static const bool has_signaling_NaN = has_quiet_NaN; + static const float_denorm_style has_denorm + = bool(__FLT_HAS_DENORM__) ? denorm_present : denorm_absent; + static const bool has_denorm_loss = __glibcxx_float_has_denorm_loss; + + static float infinity() throw() + { return __builtin_huge_valf (); } + static float quiet_NaN() throw() + { return __builtin_nanf (""); } + static float signaling_NaN() throw() + { return __builtin_nansf (""); } + static float denorm_min() throw() + { return __FLT_DENORM_MIN__; } + + static const bool is_iec559 + = has_infinity && has_quiet_NaN && has_denorm == denorm_present; + static const bool is_bounded = true; + static const bool is_modulo = false; + + static const bool traps = __glibcxx_float_traps; + static const bool tinyness_before = __glibcxx_float_tinyness_before; + static const float_round_style round_style = round_to_nearest; + }; + +#undef __glibcxx_float_has_denorm_loss +#undef __glibcxx_float_traps +#undef __glibcxx_float_tinyness_before + + /// numeric_limits specialization. + template<> + struct numeric_limits + { + static const bool is_specialized = true; + + static double min() throw() + { return __DBL_MIN__; } + static double max() throw() + { return __DBL_MAX__; } + + static const int digits = __DBL_MANT_DIG__; + static const int digits10 = __DBL_DIG__; + static const bool is_signed = true; + static const bool is_integer = false; + static const bool is_exact = false; + static const int radix = __FLT_RADIX__; + static double epsilon() throw() + { return __DBL_EPSILON__; } + static double round_error() throw() + { return 0.5; } + + static const int min_exponent = __DBL_MIN_EXP__; + static const int min_exponent10 = __DBL_MIN_10_EXP__; + static const int max_exponent = __DBL_MAX_EXP__; + static const int max_exponent10 = __DBL_MAX_10_EXP__; + + static const bool has_infinity = __DBL_HAS_INFINITY__; + static const bool has_quiet_NaN = __DBL_HAS_QUIET_NAN__; + static const bool has_signaling_NaN = has_quiet_NaN; + static const float_denorm_style has_denorm + = bool(__DBL_HAS_DENORM__) ? denorm_present : denorm_absent; + static const bool has_denorm_loss = __glibcxx_double_has_denorm_loss; + + static double infinity() throw() + { return __builtin_huge_val(); } + static double quiet_NaN() throw() + { return __builtin_nan (""); } + static double signaling_NaN() throw() + { return __builtin_nans (""); } + static double denorm_min() throw() + { return __DBL_DENORM_MIN__; } + + static const bool is_iec559 + = has_infinity && has_quiet_NaN && has_denorm == denorm_present; + static const bool is_bounded = true; + static const bool is_modulo = false; + + static const bool traps = __glibcxx_double_traps; + static const bool tinyness_before = __glibcxx_double_tinyness_before; + static const float_round_style round_style = round_to_nearest; + }; + +#undef __glibcxx_double_has_denorm_loss +#undef __glibcxx_double_traps +#undef __glibcxx_double_tinyness_before + + /// numeric_limits specialization. + template<> + struct numeric_limits + { + static const bool is_specialized = true; + + static long double min() throw() + { return __LDBL_MIN__; } + static long double max() throw() + { return __LDBL_MAX__; } + + static const int digits = __LDBL_MANT_DIG__; + static const int digits10 = __LDBL_DIG__; + static const bool is_signed = true; + static const bool is_integer = false; + static const bool is_exact = false; + static const int radix = __FLT_RADIX__; + static long double epsilon() throw() + { return __LDBL_EPSILON__; } + static long double round_error() throw() + { return 0.5L; } + + static const int min_exponent = __LDBL_MIN_EXP__; + static const int min_exponent10 = __LDBL_MIN_10_EXP__; + static const int max_exponent = __LDBL_MAX_EXP__; + static const int max_exponent10 = __LDBL_MAX_10_EXP__; + + static const bool has_infinity = __LDBL_HAS_INFINITY__; + static const bool has_quiet_NaN = __LDBL_HAS_QUIET_NAN__; + static const bool has_signaling_NaN = has_quiet_NaN; + static const float_denorm_style has_denorm + = bool(__LDBL_HAS_DENORM__) ? denorm_present : denorm_absent; + static const bool has_denorm_loss + = __glibcxx_long_double_has_denorm_loss; + + static long double infinity() throw() + { return __builtin_huge_vall (); } + static long double quiet_NaN() throw() + { return __builtin_nanl (""); } + static long double signaling_NaN() throw() + { return __builtin_nansl (""); } + static long double denorm_min() throw() + { return __LDBL_DENORM_MIN__; } + + static const bool is_iec559 + = has_infinity && has_quiet_NaN && has_denorm == denorm_present; + static const bool is_bounded = true; + static const bool is_modulo = false; + + static const bool traps = __glibcxx_long_double_traps; + static const bool tinyness_before = __glibcxx_long_double_tinyness_before; + static const float_round_style round_style = round_to_nearest; + }; + +#undef __glibcxx_long_double_has_denorm_loss +#undef __glibcxx_long_double_traps +#undef __glibcxx_long_double_tinyness_before + +_GLIBCXX_END_NAMESPACE + +#undef __glibcxx_signed +#undef __glibcxx_min +#undef __glibcxx_max +#undef __glibcxx_digits +#undef __glibcxx_digits10 + +#endif // _GLIBCXX_NUMERIC_LIMITS diff --git a/libstdc++-v3/include/std/list b/libstdc++-v3/include/std/list new file mode 100644 index 00000000000..b46f65417ec --- /dev/null +++ b/libstdc++-v3/include/std/list @@ -0,0 +1,81 @@ +// -*- C++ -*- + +// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file include/list + * This is a Standard C++ Library header. + */ + +#ifndef _GLIBCXX_LIST +#define _GLIBCXX_LIST 1 + +#pragma GCC system_header + +#include +#include +#include +#include +#include +#include + +#ifndef _GLIBCXX_EXPORT_TEMPLATE +# include +#endif + +#ifdef _GLIBCXX_DEBUG +# include +#endif + +#endif /* _GLIBCXX_LIST */ + diff --git a/libstdc++-v3/include/std/locale b/libstdc++-v3/include/std/locale new file mode 100644 index 00000000000..5223f90c878 --- /dev/null +++ b/libstdc++-v3/include/std/locale @@ -0,0 +1,48 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 1997, 1998, 1999, 2002, 2003 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// +// ISO C++ 14882: 22.1 Locales +// + +/** @file locale + * This is a Standard C++ Library header. + */ + +#ifndef _GLIBCXX_LOCALE +#define _GLIBCXX_LOCALE 1 + +#pragma GCC system_header + +#include +#include +#include +#include + +#endif /* _GLIBCXX_LOCALE */ diff --git a/libstdc++-v3/include/std/map b/libstdc++-v3/include/std/map new file mode 100644 index 00000000000..a7e8f9c2107 --- /dev/null +++ b/libstdc++-v3/include/std/map @@ -0,0 +1,73 @@ +// -*- C++ -*- + +// Copyright (C) 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file include/map + * This is a Standard C++ Library header. + */ + +#ifndef _GLIBCXX_MAP +#define _GLIBCXX_MAP 1 + +#pragma GCC system_header + +#include +#include +#include + +#ifdef _GLIBCXX_DEBUG +# include +#endif + +#endif /* _GLIBCXX_MAP */ diff --git a/libstdc++-v3/include/std/memory b/libstdc++-v3/include/std/memory new file mode 100644 index 00000000000..b57a94f4bbd --- /dev/null +++ b/libstdc++-v3/include/std/memory @@ -0,0 +1,374 @@ +// -*- C++ -*- + +// Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/* + * Copyright (c) 1997-1999 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + */ + +/** @file include/memory + * This is a Standard C++ Library header. + */ + +#ifndef _GLIBCXX_MEMORY +#define _GLIBCXX_MEMORY 1 + +#pragma GCC system_header + +#include +#include +#include +#include //for iterator_traits +#include +#include +#include +#include + +_GLIBCXX_BEGIN_NAMESPACE(std) + + /** + * @if maint + * This is a helper function. The unused second parameter exists to + * permit the real get_temporary_buffer to use template parameter deduction. + * + * XXX This should perhaps use the pool. + * @endif + */ + template + pair<_Tp*, ptrdiff_t> + __get_temporary_buffer(ptrdiff_t __len, _Tp*) + { + const ptrdiff_t __max = numeric_limits::max() / sizeof(_Tp); + if (__len > __max) + __len = __max; + + while (__len > 0) + { + _Tp* __tmp = static_cast<_Tp*>(::operator new(__len * sizeof(_Tp), + nothrow)); + if (__tmp != 0) + return pair<_Tp*, ptrdiff_t>(__tmp, __len); + __len /= 2; + } + return pair<_Tp*, ptrdiff_t>(static_cast<_Tp*>(0), 0); + } + + /** + * @brief Allocates a temporary buffer. + * @param len The number of objects of type Tp. + * @return See full description. + * + * Reinventing the wheel, but this time with prettier spokes! + * + * This function tries to obtain storage for @c len adjacent Tp + * objects. The objects themselves are not constructed, of course. + * A pair<> is returned containing "the buffer s address and + * capacity (in the units of sizeof(Tp)), or a pair of 0 values if + * no storage can be obtained." Note that the capacity obtained + * may be less than that requested if the memory is unavailable; + * you should compare len with the .second return value. + * + * Provides the nothrow exception guarantee. + */ + template + inline pair<_Tp*, ptrdiff_t> + get_temporary_buffer(ptrdiff_t __len) + { return std::__get_temporary_buffer(__len, static_cast<_Tp*>(0)); } + + /** + * @brief The companion to get_temporary_buffer(). + * @param p A buffer previously allocated by get_temporary_buffer. + * @return None. + * + * Frees the memory pointed to by p. + */ + template + void + return_temporary_buffer(_Tp* __p) + { ::operator delete(__p, nothrow); } + + /** + * A wrapper class to provide auto_ptr with reference semantics. + * For example, an auto_ptr can be assigned (or constructed from) + * the result of a function which returns an auto_ptr by value. + * + * All the auto_ptr_ref stuff should happen behind the scenes. + */ + template + struct auto_ptr_ref + { + _Tp1* _M_ptr; + + explicit + auto_ptr_ref(_Tp1* __p): _M_ptr(__p) { } + }; + + + /** + * @brief A simple smart pointer providing strict ownership semantics. + * + * The Standard says: + *
+   *  An @c auto_ptr owns the object it holds a pointer to.  Copying
+   *  an @c auto_ptr copies the pointer and transfers ownership to the
+   *  destination.  If more than one @c auto_ptr owns the same object
+   *  at the same time the behavior of the program is undefined.
+   *
+   *  The uses of @c auto_ptr include providing temporary
+   *  exception-safety for dynamically allocated memory, passing
+   *  ownership of dynamically allocated memory to a function, and
+   *  returning dynamically allocated memory from a function.  @c
+   *  auto_ptr does not meet the CopyConstructible and Assignable
+   *  requirements for Standard Library container elements and thus
+   *  instantiating a Standard Library container with an @c auto_ptr
+   *  results in undefined behavior.
+   *  
+ * Quoted from [20.4.5]/3. + * + * Good examples of what can and cannot be done with auto_ptr can + * be found in the libstdc++ testsuite. + * + * @if maint + * _GLIBCXX_RESOLVE_LIB_DEFECTS + * 127. auto_ptr<> conversion issues + * These resolutions have all been incorporated. + * @endif + */ + template + class auto_ptr + { + private: + _Tp* _M_ptr; + + public: + /// The pointed-to type. + typedef _Tp element_type; + + /** + * @brief An %auto_ptr is usually constructed from a raw pointer. + * @param p A pointer (defaults to NULL). + * + * This object now @e owns the object pointed to by @a p. + */ + explicit + auto_ptr(element_type* __p = 0) throw() : _M_ptr(__p) { } + + /** + * @brief An %auto_ptr can be constructed from another %auto_ptr. + * @param a Another %auto_ptr of the same type. + * + * This object now @e owns the object previously owned by @a a, + * which has given up ownsership. + */ + auto_ptr(auto_ptr& __a) throw() : _M_ptr(__a.release()) { } + + /** + * @brief An %auto_ptr can be constructed from another %auto_ptr. + * @param a Another %auto_ptr of a different but related type. + * + * A pointer-to-Tp1 must be convertible to a + * pointer-to-Tp/element_type. + * + * This object now @e owns the object previously owned by @a a, + * which has given up ownsership. + */ + template + auto_ptr(auto_ptr<_Tp1>& __a) throw() : _M_ptr(__a.release()) { } + + /** + * @brief %auto_ptr assignment operator. + * @param a Another %auto_ptr of the same type. + * + * This object now @e owns the object previously owned by @a a, + * which has given up ownsership. The object that this one @e + * used to own and track has been deleted. + */ + auto_ptr& + operator=(auto_ptr& __a) throw() + { + reset(__a.release()); + return *this; + } + + /** + * @brief %auto_ptr assignment operator. + * @param a Another %auto_ptr of a different but related type. + * + * A pointer-to-Tp1 must be convertible to a pointer-to-Tp/element_type. + * + * This object now @e owns the object previously owned by @a a, + * which has given up ownsership. The object that this one @e + * used to own and track has been deleted. + */ + template + auto_ptr& + operator=(auto_ptr<_Tp1>& __a) throw() + { + reset(__a.release()); + return *this; + } + + /** + * When the %auto_ptr goes out of scope, the object it owns is + * deleted. If it no longer owns anything (i.e., @c get() is + * @c NULL), then this has no effect. + * + * @if maint + * The C++ standard says there is supposed to be an empty throw + * specification here, but omitting it is standard conforming. Its + * presence can be detected only if _Tp::~_Tp() throws, but this is + * prohibited. [17.4.3.6]/2 + * @endif + */ + ~auto_ptr() { delete _M_ptr; } + + /** + * @brief Smart pointer dereferencing. + * + * If this %auto_ptr no longer owns anything, then this + * operation will crash. (For a smart pointer, "no longer owns + * anything" is the same as being a null pointer, and you know + * what happens when you dereference one of those...) + */ + element_type& + operator*() const throw() + { + _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0); + return *_M_ptr; + } + + /** + * @brief Smart pointer dereferencing. + * + * This returns the pointer itself, which the language then will + * automatically cause to be dereferenced. + */ + element_type* + operator->() const throw() + { + _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0); + return _M_ptr; + } + + /** + * @brief Bypassing the smart pointer. + * @return The raw pointer being managed. + * + * You can get a copy of the pointer that this object owns, for + * situations such as passing to a function which only accepts + * a raw pointer. + * + * @note This %auto_ptr still owns the memory. + */ + element_type* + get() const throw() { return _M_ptr; } + + /** + * @brief Bypassing the smart pointer. + * @return The raw pointer being managed. + * + * You can get a copy of the pointer that this object owns, for + * situations such as passing to a function which only accepts + * a raw pointer. + * + * @note This %auto_ptr no longer owns the memory. When this object + * goes out of scope, nothing will happen. + */ + element_type* + release() throw() + { + element_type* __tmp = _M_ptr; + _M_ptr = 0; + return __tmp; + } + + /** + * @brief Forcibly deletes the managed object. + * @param p A pointer (defaults to NULL). + * + * This object now @e owns the object pointed to by @a p. The + * previous object has been deleted. + */ + void + reset(element_type* __p = 0) throw() + { + if (__p != _M_ptr) + { + delete _M_ptr; + _M_ptr = __p; + } + } + + /** + * @brief Automatic conversions + * + * These operations convert an %auto_ptr into and from an auto_ptr_ref + * automatically as needed. This allows constructs such as + * @code + * auto_ptr func_returning_auto_ptr(.....); + * ... + * auto_ptr ptr = func_returning_auto_ptr(.....); + * @endcode + */ + auto_ptr(auto_ptr_ref __ref) throw() + : _M_ptr(__ref._M_ptr) { } + + auto_ptr& + operator=(auto_ptr_ref __ref) throw() + { + if (__ref._M_ptr != this->get()) + { + delete _M_ptr; + _M_ptr = __ref._M_ptr; + } + return *this; + } + + template + operator auto_ptr_ref<_Tp1>() throw() + { return auto_ptr_ref<_Tp1>(this->release()); } + + template + operator auto_ptr<_Tp1>() throw() + { return auto_ptr<_Tp1>(this->release()); } + }; + +_GLIBCXX_END_NAMESPACE + +#endif /* _GLIBCXX_MEMORY */ diff --git a/libstdc++-v3/include/std/numeric b/libstdc++-v3/include/std/numeric new file mode 100644 index 00000000000..03f82dd6ab0 --- /dev/null +++ b/libstdc++-v3/include/std/numeric @@ -0,0 +1,71 @@ +// -*- C++ -*- + +// Copyright (C) 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file include/numeric + * This is a Standard C++ Library header. + */ + +#ifndef _GLIBCXX_NUMERIC +#define _GLIBCXX_NUMERIC 1 + +#pragma GCC system_header + +#include +#include +#include +#include +#include + +#endif /* _GLIBCXX_NUMERIC */ diff --git a/libstdc++-v3/include/std/ostream b/libstdc++-v3/include/std/ostream new file mode 100644 index 00000000000..e97b7a4b410 --- /dev/null +++ b/libstdc++-v3/include/std/ostream @@ -0,0 +1,613 @@ +// Output streams -*- C++ -*- + +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file ostream + * This is a Standard C++ Library header. + */ + +// +// ISO C++ 14882: 27.6.2 Output streams +// + +#ifndef _GLIBCXX_OSTREAM +#define _GLIBCXX_OSTREAM 1 + +#pragma GCC system_header + +#include + +_GLIBCXX_BEGIN_NAMESPACE(std) + + // [27.6.2.1] Template class basic_ostream + /** + * @brief Controlling output. + * + * This is the base class for all output streams. It provides text + * formatting of all builtin types, and communicates with any class + * derived from basic_streambuf to do the actual output. + */ + template + class basic_ostream : virtual public basic_ios<_CharT, _Traits> + { + public: + // Types (inherited from basic_ios (27.4.4)): + typedef _CharT char_type; + typedef typename _Traits::int_type int_type; + typedef typename _Traits::pos_type pos_type; + typedef typename _Traits::off_type off_type; + typedef _Traits traits_type; + + // Non-standard Types: + typedef basic_streambuf<_CharT, _Traits> __streambuf_type; + typedef basic_ios<_CharT, _Traits> __ios_type; + typedef basic_ostream<_CharT, _Traits> __ostream_type; + typedef num_put<_CharT, ostreambuf_iterator<_CharT, _Traits> > + __num_put_type; + typedef ctype<_CharT> __ctype_type; + + template + friend basic_ostream<_CharT2, _Traits2>& + operator<<(basic_ostream<_CharT2, _Traits2>&, _CharT2); + + template + friend basic_ostream& + operator<<(basic_ostream&, char); + + template + friend basic_ostream<_CharT2, _Traits2>& + operator<<(basic_ostream<_CharT2, _Traits2>&, const _CharT2*); + + template + friend basic_ostream& + operator<<(basic_ostream&, const char*); + + template + friend basic_ostream<_CharT2, _Traits2>& + operator<<(basic_ostream<_CharT2, _Traits2>&, const char*); + + template + friend basic_ostream<_CharT2, _Traits2>& + operator<<(basic_ostream<_CharT2, _Traits2>&, + const basic_string<_CharT2, _Traits2, _Alloc>&); + + // [27.6.2.2] constructor/destructor + /** + * @brief Base constructor. + * + * This ctor is almost never called by the user directly, rather from + * derived classes' initialization lists, which pass a pointer to + * their own stream buffer. + */ + explicit + basic_ostream(__streambuf_type* __sb) + { this->init(__sb); } + + /** + * @brief Base destructor. + * + * This does very little apart from providing a virtual base dtor. + */ + virtual + ~basic_ostream() { } + + // [27.6.2.3] prefix/suffix + class sentry; + friend class sentry; + + // [27.6.2.5] formatted output + // [27.6.2.5.3] basic_ostream::operator<< + //@{ + /** + * @brief Interface for manipulators. + * + * Manuipulators such as @c std::endl and @c std::hex use these + * functions in constructs like "std::cout << std::endl". For more + * information, see the iomanip header. + */ + __ostream_type& + operator<<(__ostream_type& (*__pf)(__ostream_type&)) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 60. What is a formatted input function? + // The inserters for manipulators are *not* formatted output functions. + return __pf(*this); + } + + __ostream_type& + operator<<(__ios_type& (*__pf)(__ios_type&)) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 60. What is a formatted input function? + // The inserters for manipulators are *not* formatted output functions. + __pf(*this); + return *this; + } + + __ostream_type& + operator<<(ios_base& (*__pf) (ios_base&)) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 60. What is a formatted input function? + // The inserters for manipulators are *not* formatted output functions. + __pf(*this); + return *this; + } + //@} + + // [27.6.2.5.2] arithmetic inserters + /** + * @name Arithmetic Inserters + * + * All the @c operator<< functions (aka formatted output + * functions) have some common behavior. Each starts by + * constructing a temporary object of type std::basic_ostream::sentry. + * This can have several effects, concluding with the setting of a + * status flag; see the sentry documentation for more. + * + * If the sentry status is good, the function tries to generate + * whatever data is appropriate for the type of the argument. + * + * If an exception is thrown during insertion, ios_base::badbit + * will be turned on in the stream's error state without causing an + * ios_base::failure to be thrown. The original exception will then + * be rethrown. + */ + //@{ + /** + * @brief Basic arithmetic inserters + * @param A variable of builtin type. + * @return @c *this if successful + * + * These functions use the stream's current locale (specifically, the + * @c num_get facet) to perform numeric formatting. + */ + __ostream_type& + operator<<(long __n) + { return _M_insert(__n); } + + __ostream_type& + operator<<(unsigned long __n) + { return _M_insert(__n); } + + __ostream_type& + operator<<(bool __n) + { return _M_insert(__n); } + + __ostream_type& + operator<<(short __n); + + __ostream_type& + operator<<(unsigned short __n) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 117. basic_ostream uses nonexistent num_put member functions. + return _M_insert(static_cast(__n)); + } + + __ostream_type& + operator<<(int __n); + + __ostream_type& + operator<<(unsigned int __n) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 117. basic_ostream uses nonexistent num_put member functions. + return _M_insert(static_cast(__n)); + } + +#ifdef _GLIBCXX_USE_LONG_LONG + __ostream_type& + operator<<(long long __n) + { return _M_insert(__n); } + + __ostream_type& + operator<<(unsigned long long __n) + { return _M_insert(__n); } +#endif + + __ostream_type& + operator<<(double __f) + { return _M_insert(__f); } + + __ostream_type& + operator<<(float __f) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 117. basic_ostream uses nonexistent num_put member functions. + return _M_insert(static_cast(__f)); + } + + __ostream_type& + operator<<(long double __f) + { return _M_insert(__f); } + + __ostream_type& + operator<<(const void* __p) + { return _M_insert(__p); } + + /** + * @brief Extracting from another streambuf. + * @param sb A pointer to a streambuf + * + * This function behaves like one of the basic arithmetic extractors, + * in that it also constructs a sentry object and has the same error + * handling behavior. + * + * If @a sb is NULL, the stream will set failbit in its error state. + * + * Characters are extracted from @a sb and inserted into @c *this + * until one of the following occurs: + * + * - the input stream reaches end-of-file, + * - insertion into the output sequence fails (in this case, the + * character that would have been inserted is not extracted), or + * - an exception occurs while getting a character from @a sb, which + * sets failbit in the error state + * + * If the function inserts no characters, failbit is set. + */ + __ostream_type& + operator<<(__streambuf_type* __sb); + //@} + + // [27.6.2.6] unformatted output functions + /** + * @name Unformatted Output Functions + * + * All the unformatted output functions have some common behavior. + * Each starts by constructing a temporary object of type + * std::basic_ostream::sentry. This has several effects, concluding + * with the setting of a status flag; see the sentry documentation + * for more. + * + * If the sentry status is good, the function tries to generate + * whatever data is appropriate for the type of the argument. + * + * If an exception is thrown during insertion, ios_base::badbit + * will be turned on in the stream's error state. If badbit is on in + * the stream's exceptions mask, the exception will be rethrown + * without completing its actions. + */ + //@{ + /** + * @brief Simple insertion. + * @param c The character to insert. + * @return *this + * + * Tries to insert @a c. + * + * @note This function is not overloaded on signed char and + * unsigned char. + */ + __ostream_type& + put(char_type __c); + + // Core write functionality, without sentry. + void + _M_write(const char_type* __s, streamsize __n) + { + const streamsize __put = this->rdbuf()->sputn(__s, __n); + if (__put != __n) + this->setstate(ios_base::badbit); + } + + void + _M_write(char_type __c, streamsize __n) + { + for (; __n > 0; --__n) + { + const int_type __put = this->rdbuf()->sputc(__c); + if (traits_type::eq_int_type(__put, traits_type::eof())) + { + this->setstate(ios_base::badbit); + break; + } + } + } + + /** + * @brief Character string insertion. + * @param s The array to insert. + * @param n Maximum number of characters to insert. + * @return *this + * + * Characters are copied from @a s and inserted into the stream until + * one of the following happens: + * + * - @a n characters are inserted + * - inserting into the output sequence fails (in this case, badbit + * will be set in the stream's error state) + * + * @note This function is not overloaded on signed char and + * unsigned char. + */ + __ostream_type& + write(const char_type* __s, streamsize __n); + //@} + + /** + * @brief Synchronizing the stream buffer. + * @return *this + * + * If @c rdbuf() is a null pointer, changes nothing. + * + * Otherwise, calls @c rdbuf()->pubsync(), and if that returns -1, + * sets badbit. + */ + __ostream_type& + flush(); + + // [27.6.2.4] seek members + /** + * @brief Getting the current write position. + * @return A file position object. + * + * If @c fail() is not false, returns @c pos_type(-1) to indicate + * failure. Otherwise returns @c rdbuf()->pubseekoff(0,cur,out). + */ + pos_type + tellp(); + + /** + * @brief Changing the current write position. + * @param pos A file position object. + * @return *this + * + * If @c fail() is not true, calls @c rdbuf()->pubseekpos(pos). If + * that function fails, sets failbit. + */ + __ostream_type& + seekp(pos_type); + + /** + * @brief Changing the current write position. + * @param off A file offset object. + * @param dir The direction in which to seek. + * @return *this + * + * If @c fail() is not true, calls @c rdbuf()->pubseekoff(off,dir). + * If that function fails, sets failbit. + */ + __ostream_type& + seekp(off_type, ios_base::seekdir); + + protected: + explicit + basic_ostream() { } + + template + __ostream_type& + _M_insert(_ValueT __v); + + __ostream_type& + _M_insert(const char_type* __s, streamsize __n); + }; + + /** + * @brief Performs setup work for output streams. + * + * Objects of this class are created before all of the standard + * inserters are run. It is responsible for "exception-safe prefix and + * suffix operations." Additional actions may be added by the + * implementation, and we list them in + * http://gcc.gnu.org/onlinedocs/libstdc++/17_intro/howto.html#5 + * under [27.6] notes. + */ + template + class basic_ostream<_CharT, _Traits>::sentry + { + // Data Members: + bool _M_ok; + basic_ostream<_CharT, _Traits>& _M_os; + + public: + /** + * @brief The constructor performs preparatory work. + * @param os The output stream to guard. + * + * If the stream state is good (@a os.good() is true), then if the + * stream is tied to another output stream, @c is.tie()->flush() + * is called to synchronize the output sequences. + * + * If the stream state is still good, then the sentry state becomes + * true ("okay"). + */ + explicit + sentry(basic_ostream<_CharT, _Traits>& __os); + + /** + * @brief Possibly flushes the stream. + * + * If @c ios_base::unitbuf is set in @c os.flags(), and + * @c std::uncaught_exception() is true, the sentry destructor calls + * @c flush() on the output stream. + */ + ~sentry() + { + // XXX MT + if (_M_os.flags() & ios_base::unitbuf && !uncaught_exception()) + { + // Can't call flush directly or else will get into recursive lock. + if (_M_os.rdbuf() && _M_os.rdbuf()->pubsync() == -1) + _M_os.setstate(ios_base::badbit); + } + } + + /** + * @brief Quick status checking. + * @return The sentry state. + * + * For ease of use, sentries may be converted to booleans. The + * return value is that of the sentry state (true == okay). + */ + operator bool() const + { return _M_ok; } + }; + + // [27.6.2.5.4] character insertion templates + //@{ + /** + * @brief Character inserters + * @param out An output stream. + * @param c A character. + * @return out + * + * Behaves like one of the formatted arithmetic inserters described in + * std::basic_ostream. After constructing a sentry object with good + * status, this function inserts a single character and any required + * padding (as determined by [22.2.2.2.2]). @c out.width(0) is then + * called. + * + * If @a c is of type @c char and the character type of the stream is not + * @c char, the character is widened before insertion. + */ + template + inline basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c) + { return __out._M_insert(&__c, 1); } + + template + inline basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __out, char __c) + { return (__out << __out.widen(__c)); } + + // Specialization + template + inline basic_ostream& + operator<<(basic_ostream& __out, char __c) + { return __out._M_insert(&__c, 1); } + + // Signed and unsigned + template + inline basic_ostream& + operator<<(basic_ostream& __out, signed char __c) + { return (__out << static_cast(__c)); } + + template + inline basic_ostream& + operator<<(basic_ostream& __out, unsigned char __c) + { return (__out << static_cast(__c)); } + //@} + + //@{ + /** + * @brief String inserters + * @param out An output stream. + * @param s A character string. + * @return out + * @pre @a s must be a non-NULL pointer + * + * Behaves like one of the formatted arithmetic inserters described in + * std::basic_ostream. After constructing a sentry object with good + * status, this function inserts @c traits::length(s) characters starting + * at @a s, widened if necessary, followed by any required padding (as + * determined by [22.2.2.2.2]). @c out.width(0) is then called. + */ + template + inline basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s) + { + if (!__s) + __out.setstate(ios_base::badbit); + else + __out._M_insert(__s, static_cast(_Traits::length(__s))); + return __out; + } + + template + basic_ostream<_CharT, _Traits> & + operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s); + + // Partial specializationss + template + inline basic_ostream& + operator<<(basic_ostream& __out, const char* __s) + { + if (!__s) + __out.setstate(ios_base::badbit); + else + __out._M_insert(__s, static_cast(_Traits::length(__s))); + return __out; + } + + // Signed and unsigned + template + inline basic_ostream& + operator<<(basic_ostream& __out, const signed char* __s) + { return (__out << reinterpret_cast(__s)); } + + template + inline basic_ostream & + operator<<(basic_ostream& __out, const unsigned char* __s) + { return (__out << reinterpret_cast(__s)); } + //@} + + // [27.6.2.7] standard basic_ostream manipulators + /** + * @brief Write a newline and flush the stream. + * + * This manipulator is often mistakenly used when a simple newline is + * desired, leading to poor buffering performance. See + * http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#2 for more + * on this subject. + */ + template + inline basic_ostream<_CharT, _Traits>& + endl(basic_ostream<_CharT, _Traits>& __os) + { return flush(__os.put(__os.widen('\n'))); } + + /** + * @brief Write a null character into the output sequence. + * + * "Null character" is @c CharT() by definition. For CharT of @c char, + * this correctly writes the ASCII @c NUL character string terminator. + */ + template + inline basic_ostream<_CharT, _Traits>& + ends(basic_ostream<_CharT, _Traits>& __os) + { return __os.put(_CharT()); } + + /** + * @brief Flushes the output stream. + * + * This manipulator simply calls the stream's @c flush() member function. + */ + template + inline basic_ostream<_CharT, _Traits>& + flush(basic_ostream<_CharT, _Traits>& __os) + { return __os.flush(); } + +_GLIBCXX_END_NAMESPACE + +#ifndef _GLIBCXX_EXPORT_TEMPLATE +# include +#endif + +#endif /* _GLIBCXX_OSTREAM */ diff --git a/libstdc++-v3/include/std/queue b/libstdc++-v3/include/std/queue new file mode 100644 index 00000000000..1242a06160b --- /dev/null +++ b/libstdc++-v3/include/std/queue @@ -0,0 +1,77 @@ +// -*- C++ -*- + +// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file include/queue + * This is a Standard C++ Library header. + */ + +#ifndef _GLIBCXX_QUEUE +#define _GLIBCXX_QUEUE 1 + +#pragma GCC system_header + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif /* _GLIBCXX_QUEUE */ diff --git a/libstdc++-v3/include/std/set b/libstdc++-v3/include/std/set new file mode 100644 index 00000000000..65ebe8a10cc --- /dev/null +++ b/libstdc++-v3/include/std/set @@ -0,0 +1,73 @@ +// -*- C++ -*- + +// Copyright (C) 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file include/set + * This is a Standard C++ Library header. + */ + +#ifndef _GLIBCXX_SET +#define _GLIBCXX_SET 1 + +#pragma GCC system_header + +#include +#include +#include + +#ifdef _GLIBCXX_DEBUG +# include +#endif + +#endif /* _GLIBCXX_SET */ diff --git a/libstdc++-v3/include/std/sstream b/libstdc++-v3/include/std/sstream new file mode 100644 index 00000000000..a09815c1945 --- /dev/null +++ b/libstdc++-v3/include/std/sstream @@ -0,0 +1,591 @@ +// String based streams -*- C++ -*- + +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file sstream + * This is a Standard C++ Library header. + */ + +// +// ISO C++ 14882: 27.7 String-based streams +// + +#ifndef _GLIBCXX_SSTREAM +#define _GLIBCXX_SSTREAM 1 + +#pragma GCC system_header + +#include +#include + +_GLIBCXX_BEGIN_NAMESPACE(std) + + // [27.7.1] template class basic_stringbuf + /** + * @brief The actual work of input and output (for std::string). + * + * This class associates either or both of its input and output sequences + * with a sequence of characters, which can be initialized from, or made + * available as, a @c std::basic_string. (Paraphrased from [27.7.1]/1.) + * + * For this class, open modes (of type @c ios_base::openmode) have + * @c in set if the input sequence can be read, and @c out set if the + * output sequence can be written. + */ + template + class basic_stringbuf : public basic_streambuf<_CharT, _Traits> + { + public: + // Types: + typedef _CharT char_type; + typedef _Traits traits_type; + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 251. basic_stringbuf missing allocator_type + typedef _Alloc allocator_type; + typedef typename traits_type::int_type int_type; + typedef typename traits_type::pos_type pos_type; + typedef typename traits_type::off_type off_type; + + typedef basic_streambuf __streambuf_type; + typedef basic_string __string_type; + typedef typename __string_type::size_type __size_type; + + protected: + /** + * @if maint + * Place to stash in || out || in | out settings for current stringbuf. + * @endif + */ + ios_base::openmode _M_mode; + + // Data Members: + __string_type _M_string; + + public: + // Constructors: + /** + * @brief Starts with an empty string buffer. + * @param mode Whether the buffer can read, or write, or both. + * + * The default constructor initializes the parent class using its + * own default ctor. + */ + explicit + basic_stringbuf(ios_base::openmode __mode = ios_base::in | ios_base::out) + : __streambuf_type(), _M_mode(__mode), _M_string() + { } + + /** + * @brief Starts with an existing string buffer. + * @param str A string to copy as a starting buffer. + * @param mode Whether the buffer can read, or write, or both. + * + * This constructor initializes the parent class using its + * own default ctor. + */ + explicit + basic_stringbuf(const __string_type& __str, + ios_base::openmode __mode = ios_base::in | ios_base::out) + : __streambuf_type(), _M_mode(), _M_string(__str.data(), __str.size()) + { _M_stringbuf_init(__mode); } + + // Get and set: + /** + * @brief Copying out the string buffer. + * @return A copy of one of the underlying sequences. + * + * "If the buffer is only created in input mode, the underlying + * character sequence is equal to the input sequence; otherwise, it + * is equal to the output sequence." [27.7.1.2]/1 + */ + __string_type + str() const + { + __string_type __ret; + if (this->pptr()) + { + // The current egptr() may not be the actual string end. + if (this->pptr() > this->egptr()) + __ret = __string_type(this->pbase(), this->pptr()); + else + __ret = __string_type(this->pbase(), this->egptr()); + } + else + __ret = _M_string; + return __ret; + } + + /** + * @brief Setting a new buffer. + * @param s The string to use as a new sequence. + * + * Deallocates any previous stored sequence, then copies @a s to + * use as a new one. + */ + void + str(const __string_type& __s) + { + // Cannot use _M_string = __s, since v3 strings are COW. + _M_string.assign(__s.data(), __s.size()); + _M_stringbuf_init(_M_mode); + } + + protected: + // Common initialization code goes here. + void + _M_stringbuf_init(ios_base::openmode __mode) + { + _M_mode = __mode; + __size_type __len = 0; + if (_M_mode & (ios_base::ate | ios_base::app)) + __len = _M_string.size(); + _M_sync(const_cast(_M_string.data()), 0, __len); + } + + virtual streamsize + showmanyc() + { + streamsize __ret = -1; + if (_M_mode & ios_base::in) + { + _M_update_egptr(); + __ret = this->egptr() - this->gptr(); + } + return __ret; + } + + virtual int_type + underflow(); + + virtual int_type + pbackfail(int_type __c = traits_type::eof()); + + virtual int_type + overflow(int_type __c = traits_type::eof()); + + /** + * @brief Manipulates the buffer. + * @param s Pointer to a buffer area. + * @param n Size of @a s. + * @return @c this + * + * If no buffer has already been created, and both @a s and @a n are + * non-zero, then @c s is used as a buffer; see + * http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#2 + * for more. + */ + virtual __streambuf_type* + setbuf(char_type* __s, streamsize __n) + { + if (__s && __n >= 0) + { + // This is implementation-defined behavior, and assumes + // that an external char_type array of length __n exists + // and has been pre-allocated. If this is not the case, + // things will quickly blow up. + + // Step 1: Destroy the current internal array. + _M_string.clear(); + + // Step 2: Use the external array. + _M_sync(__s, __n, 0); + } + return this; + } + + virtual pos_type + seekoff(off_type __off, ios_base::seekdir __way, + ios_base::openmode __mode = ios_base::in | ios_base::out); + + virtual pos_type + seekpos(pos_type __sp, + ios_base::openmode __mode = ios_base::in | ios_base::out); + + // Internal function for correctly updating the internal buffer + // for a particular _M_string, due to initialization or re-sizing + // of an existing _M_string. + void + _M_sync(char_type* __base, __size_type __i, __size_type __o); + + // Internal function for correctly updating egptr() to the actual + // string end. + void + _M_update_egptr() + { + const bool __testin = _M_mode & ios_base::in; + if (this->pptr() && this->pptr() > this->egptr()) + if (__testin) + this->setg(this->eback(), this->gptr(), this->pptr()); + else + this->setg(this->pptr(), this->pptr(), this->pptr()); + } + }; + + + // [27.7.2] Template class basic_istringstream + /** + * @brief Controlling input for std::string. + * + * This class supports reading from objects of type std::basic_string, + * using the inherited functions from std::basic_istream. To control + * the associated sequence, an instance of std::basic_stringbuf is used, + * which this page refers to as @c sb. + */ + template + class basic_istringstream : public basic_istream<_CharT, _Traits> + { + public: + // Types: + typedef _CharT char_type; + typedef _Traits traits_type; + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 251. basic_stringbuf missing allocator_type + typedef _Alloc allocator_type; + typedef typename traits_type::int_type int_type; + typedef typename traits_type::pos_type pos_type; + typedef typename traits_type::off_type off_type; + + // Non-standard types: + typedef basic_string<_CharT, _Traits, _Alloc> __string_type; + typedef basic_stringbuf<_CharT, _Traits, _Alloc> __stringbuf_type; + typedef basic_istream __istream_type; + + private: + __stringbuf_type _M_stringbuf; + + public: + // Constructors: + /** + * @brief Default constructor starts with an empty string buffer. + * @param mode Whether the buffer can read, or write, or both. + * + * @c ios_base::in is automatically included in @a mode. + * + * Initializes @c sb using @c mode|in, and passes @c &sb to the base + * class initializer. Does not allocate any buffer. + * + * @if maint + * That's a lie. We initialize the base class with NULL, because the + * string class does its own memory management. + * @endif + */ + explicit + basic_istringstream(ios_base::openmode __mode = ios_base::in) + : __istream_type(), _M_stringbuf(__mode | ios_base::in) + { this->init(&_M_stringbuf); } + + /** + * @brief Starts with an existing string buffer. + * @param str A string to copy as a starting buffer. + * @param mode Whether the buffer can read, or write, or both. + * + * @c ios_base::in is automatically included in @a mode. + * + * Initializes @c sb using @a str and @c mode|in, and passes @c &sb + * to the base class initializer. + * + * @if maint + * That's a lie. We initialize the base class with NULL, because the + * string class does its own memory management. + * @endif + */ + explicit + basic_istringstream(const __string_type& __str, + ios_base::openmode __mode = ios_base::in) + : __istream_type(), _M_stringbuf(__str, __mode | ios_base::in) + { this->init(&_M_stringbuf); } + + /** + * @brief The destructor does nothing. + * + * The buffer is deallocated by the stringbuf object, not the + * formatting stream. + */ + ~basic_istringstream() + { } + + // Members: + /** + * @brief Accessing the underlying buffer. + * @return The current basic_stringbuf buffer. + * + * This hides both signatures of std::basic_ios::rdbuf(). + */ + __stringbuf_type* + rdbuf() const + { return const_cast<__stringbuf_type*>(&_M_stringbuf); } + + /** + * @brief Copying out the string buffer. + * @return @c rdbuf()->str() + */ + __string_type + str() const + { return _M_stringbuf.str(); } + + /** + * @brief Setting a new buffer. + * @param s The string to use as a new sequence. + * + * Calls @c rdbuf()->str(s). + */ + void + str(const __string_type& __s) + { _M_stringbuf.str(__s); } + }; + + + // [27.7.3] Template class basic_ostringstream + /** + * @brief Controlling output for std::string. + * + * This class supports writing to objects of type std::basic_string, + * using the inherited functions from std::basic_ostream. To control + * the associated sequence, an instance of std::basic_stringbuf is used, + * which this page refers to as @c sb. + */ + template + class basic_ostringstream : public basic_ostream<_CharT, _Traits> + { + public: + // Types: + typedef _CharT char_type; + typedef _Traits traits_type; + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 251. basic_stringbuf missing allocator_type + typedef _Alloc allocator_type; + typedef typename traits_type::int_type int_type; + typedef typename traits_type::pos_type pos_type; + typedef typename traits_type::off_type off_type; + + // Non-standard types: + typedef basic_string<_CharT, _Traits, _Alloc> __string_type; + typedef basic_stringbuf<_CharT, _Traits, _Alloc> __stringbuf_type; + typedef basic_ostream __ostream_type; + + private: + __stringbuf_type _M_stringbuf; + + public: + // Constructors/destructor: + /** + * @brief Default constructor starts with an empty string buffer. + * @param mode Whether the buffer can read, or write, or both. + * + * @c ios_base::out is automatically included in @a mode. + * + * Initializes @c sb using @c mode|out, and passes @c &sb to the base + * class initializer. Does not allocate any buffer. + * + * @if maint + * That's a lie. We initialize the base class with NULL, because the + * string class does its own memory management. + * @endif + */ + explicit + basic_ostringstream(ios_base::openmode __mode = ios_base::out) + : __ostream_type(), _M_stringbuf(__mode | ios_base::out) + { this->init(&_M_stringbuf); } + + /** + * @brief Starts with an existing string buffer. + * @param str A string to copy as a starting buffer. + * @param mode Whether the buffer can read, or write, or both. + * + * @c ios_base::out is automatically included in @a mode. + * + * Initializes @c sb using @a str and @c mode|out, and passes @c &sb + * to the base class initializer. + * + * @if maint + * That's a lie. We initialize the base class with NULL, because the + * string class does its own memory management. + * @endif + */ + explicit + basic_ostringstream(const __string_type& __str, + ios_base::openmode __mode = ios_base::out) + : __ostream_type(), _M_stringbuf(__str, __mode | ios_base::out) + { this->init(&_M_stringbuf); } + + /** + * @brief The destructor does nothing. + * + * The buffer is deallocated by the stringbuf object, not the + * formatting stream. + */ + ~basic_ostringstream() + { } + + // Members: + /** + * @brief Accessing the underlying buffer. + * @return The current basic_stringbuf buffer. + * + * This hides both signatures of std::basic_ios::rdbuf(). + */ + __stringbuf_type* + rdbuf() const + { return const_cast<__stringbuf_type*>(&_M_stringbuf); } + + /** + * @brief Copying out the string buffer. + * @return @c rdbuf()->str() + */ + __string_type + str() const + { return _M_stringbuf.str(); } + + /** + * @brief Setting a new buffer. + * @param s The string to use as a new sequence. + * + * Calls @c rdbuf()->str(s). + */ + void + str(const __string_type& __s) + { _M_stringbuf.str(__s); } + }; + + + // [27.7.4] Template class basic_stringstream + /** + * @brief Controlling input and output for std::string. + * + * This class supports reading from and writing to objects of type + * std::basic_string, using the inherited functions from + * std::basic_iostream. To control the associated sequence, an instance + * of std::basic_stringbuf is used, which this page refers to as @c sb. + */ + template + class basic_stringstream : public basic_iostream<_CharT, _Traits> + { + public: + // Types: + typedef _CharT char_type; + typedef _Traits traits_type; + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 251. basic_stringbuf missing allocator_type + typedef _Alloc allocator_type; + typedef typename traits_type::int_type int_type; + typedef typename traits_type::pos_type pos_type; + typedef typename traits_type::off_type off_type; + + // Non-standard Types: + typedef basic_string<_CharT, _Traits, _Alloc> __string_type; + typedef basic_stringbuf<_CharT, _Traits, _Alloc> __stringbuf_type; + typedef basic_iostream __iostream_type; + + private: + __stringbuf_type _M_stringbuf; + + public: + // Constructors/destructors + /** + * @brief Default constructor starts with an empty string buffer. + * @param mode Whether the buffer can read, or write, or both. + * + * Initializes @c sb using @c mode, and passes @c &sb to the base + * class initializer. Does not allocate any buffer. + * + * @if maint + * That's a lie. We initialize the base class with NULL, because the + * string class does its own memory management. + * @endif + */ + explicit + basic_stringstream(ios_base::openmode __m = ios_base::out | ios_base::in) + : __iostream_type(), _M_stringbuf(__m) + { this->init(&_M_stringbuf); } + + /** + * @brief Starts with an existing string buffer. + * @param str A string to copy as a starting buffer. + * @param mode Whether the buffer can read, or write, or both. + * + * Initializes @c sb using @a str and @c mode, and passes @c &sb + * to the base class initializer. + * + * @if maint + * That's a lie. We initialize the base class with NULL, because the + * string class does its own memory management. + * @endif + */ + explicit + basic_stringstream(const __string_type& __str, + ios_base::openmode __m = ios_base::out | ios_base::in) + : __iostream_type(), _M_stringbuf(__str, __m) + { this->init(&_M_stringbuf); } + + /** + * @brief The destructor does nothing. + * + * The buffer is deallocated by the stringbuf object, not the + * formatting stream. + */ + ~basic_stringstream() + { } + + // Members: + /** + * @brief Accessing the underlying buffer. + * @return The current basic_stringbuf buffer. + * + * This hides both signatures of std::basic_ios::rdbuf(). + */ + __stringbuf_type* + rdbuf() const + { return const_cast<__stringbuf_type*>(&_M_stringbuf); } + + /** + * @brief Copying out the string buffer. + * @return @c rdbuf()->str() + */ + __string_type + str() const + { return _M_stringbuf.str(); } + + /** + * @brief Setting a new buffer. + * @param s The string to use as a new sequence. + * + * Calls @c rdbuf()->str(s). + */ + void + str(const __string_type& __s) + { _M_stringbuf.str(__s); } + }; + +_GLIBCXX_END_NAMESPACE + +#ifndef _GLIBCXX_EXPORT_TEMPLATE +# include +#endif + +#endif /* _GLIBCXX_SSTREAM */ diff --git a/libstdc++-v3/include/std/stack b/libstdc++-v3/include/std/stack new file mode 100644 index 00000000000..396f62e6100 --- /dev/null +++ b/libstdc++-v3/include/std/stack @@ -0,0 +1,72 @@ +// -*- C++ -*- + +// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file include/stack + * This is a Standard C++ Library header. + */ + +#ifndef _GLIBCXX_STACK +#define _GLIBCXX_STACK 1 + +#pragma GCC system_header + +#include +#include +#include +#include +#include +#include + +#endif /* _GLIBCXX_STACK */ diff --git a/libstdc++-v3/include/std/std_algorithm.h b/libstdc++-v3/include/std/std_algorithm.h deleted file mode 100644 index 7ffbf97369e..00000000000 --- a/libstdc++-v3/include/std/std_algorithm.h +++ /dev/null @@ -1,70 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2001, 2002 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file include/algorithm - * This is a Standard C++ Library header. - */ - -#ifndef _GLIBCXX_ALGORITHM -#define _GLIBCXX_ALGORITHM 1 - -#pragma GCC system_header - -#include -#include -#include -#include - -#endif /* _GLIBCXX_ALGORITHM */ diff --git a/libstdc++-v3/include/std/std_bitset.h b/libstdc++-v3/include/std/std_bitset.h deleted file mode 100644 index 860e775cc6b..00000000000 --- a/libstdc++-v3/include/std/std_bitset.h +++ /dev/null @@ -1,1344 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/* - * Copyright (c) 1998 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file include/bitset - * This is a Standard C++ Library header. - */ - -#ifndef _GLIBCXX_BITSET -#define _GLIBCXX_BITSET 1 - -#pragma GCC system_header - -#include // For size_t -#include // For memset -#include // For numeric_limits -#include -#include // For invalid_argument, out_of_range, - // overflow_error -#include // For ostream (operator<<) -#include // For istream (operator>>) - -#define _GLIBCXX_BITSET_BITS_PER_WORD numeric_limits::digits -#define _GLIBCXX_BITSET_WORDS(__n) \ - ((__n) < 1 ? 0 : ((__n) + _GLIBCXX_BITSET_BITS_PER_WORD - 1) \ - / _GLIBCXX_BITSET_BITS_PER_WORD) - -_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) - - /** - * @if maint - * Base class, general case. It is a class inveriant that _Nw will be - * nonnegative. - * - * See documentation for bitset. - * @endif - */ - template - struct _Base_bitset - { - typedef unsigned long _WordT; - - /// 0 is the least significant word. - _WordT _M_w[_Nw]; - - _Base_bitset() - { _M_do_reset(); } - - _Base_bitset(unsigned long __val) - { - _M_do_reset(); - _M_w[0] = __val; - } - - static size_t - _S_whichword(size_t __pos ) - { return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; } - - static size_t - _S_whichbyte(size_t __pos ) - { return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; } - - static size_t - _S_whichbit(size_t __pos ) - { return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; } - - static _WordT - _S_maskbit(size_t __pos ) - { return (static_cast<_WordT>(1)) << _S_whichbit(__pos); } - - _WordT& - _M_getword(size_t __pos) - { return _M_w[_S_whichword(__pos)]; } - - _WordT - _M_getword(size_t __pos) const - { return _M_w[_S_whichword(__pos)]; } - - _WordT& - _M_hiword() - { return _M_w[_Nw - 1]; } - - _WordT - _M_hiword() const - { return _M_w[_Nw - 1]; } - - void - _M_do_and(const _Base_bitset<_Nw>& __x) - { - for (size_t __i = 0; __i < _Nw; __i++) - _M_w[__i] &= __x._M_w[__i]; - } - - void - _M_do_or(const _Base_bitset<_Nw>& __x) - { - for (size_t __i = 0; __i < _Nw; __i++) - _M_w[__i] |= __x._M_w[__i]; - } - - void - _M_do_xor(const _Base_bitset<_Nw>& __x) - { - for (size_t __i = 0; __i < _Nw; __i++) - _M_w[__i] ^= __x._M_w[__i]; - } - - void - _M_do_left_shift(size_t __shift); - - void - _M_do_right_shift(size_t __shift); - - void - _M_do_flip() - { - for (size_t __i = 0; __i < _Nw; __i++) - _M_w[__i] = ~_M_w[__i]; - } - - void - _M_do_set() - { - for (size_t __i = 0; __i < _Nw; __i++) - _M_w[__i] = ~static_cast<_WordT>(0); - } - - void - _M_do_reset() - { std::memset(_M_w, 0, _Nw * sizeof(_WordT)); } - - bool - _M_is_equal(const _Base_bitset<_Nw>& __x) const - { - for (size_t __i = 0; __i < _Nw; ++__i) - { - if (_M_w[__i] != __x._M_w[__i]) - return false; - } - return true; - } - - bool - _M_is_any() const - { - for (size_t __i = 0; __i < _Nw; __i++) - { - if (_M_w[__i] != static_cast<_WordT>(0)) - return true; - } - return false; - } - - size_t - _M_do_count() const - { - size_t __result = 0; - for (size_t __i = 0; __i < _Nw; __i++) - __result += __builtin_popcountl(_M_w[__i]); - return __result; - } - - unsigned long - _M_do_to_ulong() const; - - // find first "on" bit - size_t - _M_do_find_first(size_t __not_found) const; - - // find the next "on" bit that follows "prev" - size_t - _M_do_find_next(size_t __prev, size_t __not_found) const; - }; - - // Definitions of non-inline functions from _Base_bitset. - template - void - _Base_bitset<_Nw>::_M_do_left_shift(size_t __shift) - { - if (__builtin_expect(__shift != 0, 1)) - { - const size_t __wshift = __shift / _GLIBCXX_BITSET_BITS_PER_WORD; - const size_t __offset = __shift % _GLIBCXX_BITSET_BITS_PER_WORD; - - if (__offset == 0) - for (size_t __n = _Nw - 1; __n >= __wshift; --__n) - _M_w[__n] = _M_w[__n - __wshift]; - else - { - const size_t __sub_offset = (_GLIBCXX_BITSET_BITS_PER_WORD - - __offset); - for (size_t __n = _Nw - 1; __n > __wshift; --__n) - _M_w[__n] = ((_M_w[__n - __wshift] << __offset) - | (_M_w[__n - __wshift - 1] >> __sub_offset)); - _M_w[__wshift] = _M_w[0] << __offset; - } - - std::fill(_M_w + 0, _M_w + __wshift, static_cast<_WordT>(0)); - } - } - - template - void - _Base_bitset<_Nw>::_M_do_right_shift(size_t __shift) - { - if (__builtin_expect(__shift != 0, 1)) - { - const size_t __wshift = __shift / _GLIBCXX_BITSET_BITS_PER_WORD; - const size_t __offset = __shift % _GLIBCXX_BITSET_BITS_PER_WORD; - const size_t __limit = _Nw - __wshift - 1; - - if (__offset == 0) - for (size_t __n = 0; __n <= __limit; ++__n) - _M_w[__n] = _M_w[__n + __wshift]; - else - { - const size_t __sub_offset = (_GLIBCXX_BITSET_BITS_PER_WORD - - __offset); - for (size_t __n = 0; __n < __limit; ++__n) - _M_w[__n] = ((_M_w[__n + __wshift] >> __offset) - | (_M_w[__n + __wshift + 1] << __sub_offset)); - _M_w[__limit] = _M_w[_Nw-1] >> __offset; - } - - std::fill(_M_w + __limit + 1, _M_w + _Nw, static_cast<_WordT>(0)); - } - } - - template - unsigned long - _Base_bitset<_Nw>::_M_do_to_ulong() const - { - for (size_t __i = 1; __i < _Nw; ++__i) - if (_M_w[__i]) - __throw_overflow_error(__N("_Base_bitset::_M_do_to_ulong")); - return _M_w[0]; - } - - template - size_t - _Base_bitset<_Nw>::_M_do_find_first(size_t __not_found) const - { - for (size_t __i = 0; __i < _Nw; __i++) - { - _WordT __thisword = _M_w[__i]; - if (__thisword != static_cast<_WordT>(0)) - return (__i * _GLIBCXX_BITSET_BITS_PER_WORD - + __builtin_ctzl(__thisword)); - } - // not found, so return an indication of failure. - return __not_found; - } - - template - size_t - _Base_bitset<_Nw>::_M_do_find_next(size_t __prev, size_t __not_found) const - { - // make bound inclusive - ++__prev; - - // check out of bounds - if (__prev >= _Nw * _GLIBCXX_BITSET_BITS_PER_WORD) - return __not_found; - - // search first word - size_t __i = _S_whichword(__prev); - _WordT __thisword = _M_w[__i]; - - // mask off bits below bound - __thisword &= (~static_cast<_WordT>(0)) << _S_whichbit(__prev); - - if (__thisword != static_cast<_WordT>(0)) - return (__i * _GLIBCXX_BITSET_BITS_PER_WORD - + __builtin_ctzl(__thisword)); - - // check subsequent words - __i++; - for (; __i < _Nw; __i++) - { - __thisword = _M_w[__i]; - if (__thisword != static_cast<_WordT>(0)) - return (__i * _GLIBCXX_BITSET_BITS_PER_WORD - + __builtin_ctzl(__thisword)); - } - // not found, so return an indication of failure. - return __not_found; - } // end _M_do_find_next - - /** - * @if maint - * Base class, specialization for a single word. - * - * See documentation for bitset. - * @endif - */ - template<> - struct _Base_bitset<1> - { - typedef unsigned long _WordT; - _WordT _M_w; - - _Base_bitset(void) - : _M_w(0) - { } - - _Base_bitset(unsigned long __val) - : _M_w(__val) - { } - - static size_t - _S_whichword(size_t __pos ) - { return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; } - - static size_t - _S_whichbyte(size_t __pos ) - { return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; } - - static size_t - _S_whichbit(size_t __pos ) - { return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; } - - static _WordT - _S_maskbit(size_t __pos ) - { return (static_cast<_WordT>(1)) << _S_whichbit(__pos); } - - _WordT& - _M_getword(size_t) - { return _M_w; } - - _WordT - _M_getword(size_t) const - { return _M_w; } - - _WordT& - _M_hiword() - { return _M_w; } - - _WordT - _M_hiword() const - { return _M_w; } - - void - _M_do_and(const _Base_bitset<1>& __x) - { _M_w &= __x._M_w; } - - void - _M_do_or(const _Base_bitset<1>& __x) - { _M_w |= __x._M_w; } - - void - _M_do_xor(const _Base_bitset<1>& __x) - { _M_w ^= __x._M_w; } - - void - _M_do_left_shift(size_t __shift) - { _M_w <<= __shift; } - - void - _M_do_right_shift(size_t __shift) - { _M_w >>= __shift; } - - void - _M_do_flip() - { _M_w = ~_M_w; } - - void - _M_do_set() - { _M_w = ~static_cast<_WordT>(0); } - - void - _M_do_reset() - { _M_w = 0; } - - bool - _M_is_equal(const _Base_bitset<1>& __x) const - { return _M_w == __x._M_w; } - - bool - _M_is_any() const - { return _M_w != 0; } - - size_t - _M_do_count() const - { return __builtin_popcountl(_M_w); } - - unsigned long - _M_do_to_ulong() const - { return _M_w; } - - size_t - _M_do_find_first(size_t __not_found) const - { - if (_M_w != 0) - return __builtin_ctzl(_M_w); - else - return __not_found; - } - - // find the next "on" bit that follows "prev" - size_t - _M_do_find_next(size_t __prev, size_t __not_found) const - { - ++__prev; - if (__prev >= ((size_t) _GLIBCXX_BITSET_BITS_PER_WORD)) - return __not_found; - - _WordT __x = _M_w >> __prev; - if (__x != 0) - return __builtin_ctzl(__x) + __prev; - else - return __not_found; - } - }; - - /** - * @if maint - * Base class, specialization for no storage (zero-length %bitset). - * - * See documentation for bitset. - * @endif - */ - template<> - struct _Base_bitset<0> - { - typedef unsigned long _WordT; - - _Base_bitset() - { } - - _Base_bitset(unsigned long) - { } - - static size_t - _S_whichword(size_t __pos ) - { return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; } - - static size_t - _S_whichbyte(size_t __pos ) - { return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; } - - static size_t - _S_whichbit(size_t __pos ) - { return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; } - - static _WordT - _S_maskbit(size_t __pos ) - { return (static_cast<_WordT>(1)) << _S_whichbit(__pos); } - - // This would normally give access to the data. The bounds-checking - // in the bitset class will prevent the user from getting this far, - // but (1) it must still return an lvalue to compile, and (2) the - // user might call _Unchecked_set directly, in which case this /needs/ - // to fail. Let's not penalize zero-length users unless they actually - // make an unchecked call; all the memory ugliness is therefore - // localized to this single should-never-get-this-far function. - _WordT& - _M_getword(size_t) const - { - __throw_out_of_range(__N("_Base_bitset::_M_getword")); - return *new _WordT; - } - - _WordT - _M_hiword() const - { return 0; } - - void - _M_do_and(const _Base_bitset<0>&) - { } - - void - _M_do_or(const _Base_bitset<0>&) - { } - - void - _M_do_xor(const _Base_bitset<0>&) - { } - - void - _M_do_left_shift(size_t) - { } - - void - _M_do_right_shift(size_t) - { } - - void - _M_do_flip() - { } - - void - _M_do_set() - { } - - void - _M_do_reset() - { } - - // Are all empty bitsets equal to each other? Are they equal to - // themselves? How to compare a thing which has no state? What is - // the sound of one zero-length bitset clapping? - bool - _M_is_equal(const _Base_bitset<0>&) const - { return true; } - - bool - _M_is_any() const - { return false; } - - size_t - _M_do_count() const - { return 0; } - - unsigned long - _M_do_to_ulong() const - { return 0; } - - // Normally "not found" is the size, but that could also be - // misinterpreted as an index in this corner case. Oh well. - size_t - _M_do_find_first(size_t) const - { return 0; } - - size_t - _M_do_find_next(size_t, size_t) const - { return 0; } - }; - - - // Helper class to zero out the unused high-order bits in the highest word. - template - struct _Sanitize - { - static void _S_do_sanitize(unsigned long& __val) - { __val &= ~((~static_cast(0)) << _Extrabits); } - }; - - template<> - struct _Sanitize<0> - { static void _S_do_sanitize(unsigned long) {} }; - - /** - * @brief The %bitset class represents a @e fixed-size sequence of bits. - * - * @ingroup Containers - * - * (Note that %bitset does @e not meet the formal requirements of a - * container. Mainly, it lacks iterators.) - * - * The template argument, @a Nb, may be any non-negative number, - * specifying the number of bits (e.g., "0", "12", "1024*1024"). - * - * In the general unoptimized case, storage is allocated in word-sized - * blocks. Let B be the number of bits in a word, then (Nb+(B-1))/B - * words will be used for storage. B - Nb%B bits are unused. (They are - * the high-order bits in the highest word.) It is a class invariant - * that those unused bits are always zero. - * - * If you think of %bitset as "a simple array of bits," be aware that - * your mental picture is reversed: a %bitset behaves the same way as - * bits in integers do, with the bit at index 0 in the "least significant - * / right-hand" position, and the bit at index Nb-1 in the "most - * significant / left-hand" position. Thus, unlike other containers, a - * %bitset's index "counts from right to left," to put it very loosely. - * - * This behavior is preserved when translating to and from strings. For - * example, the first line of the following program probably prints - * "b('a') is 0001100001" on a modern ASCII system. - * - * @code - * #include - * #include - * #include - * - * using namespace std; - * - * int main() - * { - * long a = 'a'; - * bitset<10> b(a); - * - * cout << "b('a') is " << b << endl; - * - * ostringstream s; - * s << b; - * string str = s.str(); - * cout << "index 3 in the string is " << str[3] << " but\n" - * << "index 3 in the bitset is " << b[3] << endl; - * } - * @endcode - * - * Also see http://gcc.gnu.org/onlinedocs/libstdc++/ext/sgiexts.html#ch23 - * for a description of extensions. - * - * @if maint - * Most of the actual code isn't contained in %bitset<> itself, but in the - * base class _Base_bitset. The base class works with whole words, not with - * individual bits. This allows us to specialize _Base_bitset for the - * important special case where the %bitset is only a single word. - * - * Extra confusion can result due to the fact that the storage for - * _Base_bitset @e is a regular array, and is indexed as such. This is - * carefully encapsulated. - * @endif - */ - template - class bitset - : private _Base_bitset<_GLIBCXX_BITSET_WORDS(_Nb)> - { - private: - typedef _Base_bitset<_GLIBCXX_BITSET_WORDS(_Nb)> _Base; - typedef unsigned long _WordT; - - void - _M_do_sanitize() - { - _Sanitize<_Nb % _GLIBCXX_BITSET_BITS_PER_WORD>:: - _S_do_sanitize(this->_M_hiword()); - } - - public: - /** - * This encapsulates the concept of a single bit. An instance of this - * class is a proxy for an actual bit; this way the individual bit - * operations are done as faster word-size bitwise instructions. - * - * Most users will never need to use this class directly; conversions - * to and from bool are automatic and should be transparent. Overloaded - * operators help to preserve the illusion. - * - * (On a typical system, this "bit %reference" is 64 times the size of - * an actual bit. Ha.) - */ - class reference - { - friend class bitset; - - _WordT *_M_wp; - size_t _M_bpos; - - // left undefined - reference(); - - public: - reference(bitset& __b, size_t __pos) - { - _M_wp = &__b._M_getword(__pos); - _M_bpos = _Base::_S_whichbit(__pos); - } - - ~reference() - { } - - // For b[i] = __x; - reference& - operator=(bool __x) - { - if (__x) - *_M_wp |= _Base::_S_maskbit(_M_bpos); - else - *_M_wp &= ~_Base::_S_maskbit(_M_bpos); - return *this; - } - - // For b[i] = b[__j]; - reference& - operator=(const reference& __j) - { - if ((*(__j._M_wp) & _Base::_S_maskbit(__j._M_bpos))) - *_M_wp |= _Base::_S_maskbit(_M_bpos); - else - *_M_wp &= ~_Base::_S_maskbit(_M_bpos); - return *this; - } - - // Flips the bit - bool - operator~() const - { return (*(_M_wp) & _Base::_S_maskbit(_M_bpos)) == 0; } - - // For __x = b[i]; - operator bool() const - { return (*(_M_wp) & _Base::_S_maskbit(_M_bpos)) != 0; } - - // For b[i].flip(); - reference& - flip() - { - *_M_wp ^= _Base::_S_maskbit(_M_bpos); - return *this; - } - }; - friend class reference; - - // 23.3.5.1 constructors: - /// All bits set to zero. - bitset() - { } - - /// Initial bits bitwise-copied from a single word (others set to zero). - bitset(unsigned long __val) - : _Base(__val) - { _M_do_sanitize(); } - - /** - * @brief Use a subset of a string. - * @param s A string of '0' and '1' characters. - * @param position Index of the first character in @a s to use; - * defaults to zero. - * @throw std::out_of_range If @a pos is bigger the size of @a s. - * @throw std::invalid_argument If a character appears in the string - * which is neither '0' nor '1'. - */ - template - explicit - bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __s, - size_t __position = 0) - : _Base() - { - if (__position > __s.size()) - __throw_out_of_range(__N("bitset::bitset initial position " - "not valid")); - _M_copy_from_string(__s, __position, - std::basic_string<_CharT, _Traits, _Alloc>::npos); - } - - /** - * @brief Use a subset of a string. - * @param s A string of '0' and '1' characters. - * @param position Index of the first character in @a s to use. - * @param n The number of characters to copy. - * @throw std::out_of_range If @a pos is bigger the size of @a s. - * @throw std::invalid_argument If a character appears in the string - * which is neither '0' nor '1'. - */ - template - bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __s, - size_t __position, size_t __n) - : _Base() - { - if (__position > __s.size()) - __throw_out_of_range(__N("bitset::bitset initial position " - "not valid")); - _M_copy_from_string(__s, __position, __n); - } - - // 23.3.5.2 bitset operations: - //@{ - /** - * @brief Operations on bitsets. - * @param rhs A same-sized bitset. - * - * These should be self-explanatory. - */ - bitset<_Nb>& - operator&=(const bitset<_Nb>& __rhs) - { - this->_M_do_and(__rhs); - return *this; - } - - bitset<_Nb>& - operator|=(const bitset<_Nb>& __rhs) - { - this->_M_do_or(__rhs); - return *this; - } - - bitset<_Nb>& - operator^=(const bitset<_Nb>& __rhs) - { - this->_M_do_xor(__rhs); - return *this; - } - //@} - - //@{ - /** - * @brief Operations on bitsets. - * @param position The number of places to shift. - * - * These should be self-explanatory. - */ - bitset<_Nb>& - operator<<=(size_t __position) - { - if (__builtin_expect(__position < _Nb, 1)) - { - this->_M_do_left_shift(__position); - this->_M_do_sanitize(); - } - else - this->_M_do_reset(); - return *this; - } - - bitset<_Nb>& - operator>>=(size_t __position) - { - if (__builtin_expect(__position < _Nb, 1)) - { - this->_M_do_right_shift(__position); - this->_M_do_sanitize(); - } - else - this->_M_do_reset(); - return *this; - } - //@} - - //@{ - /** - * These versions of single-bit set, reset, flip, and test are - * extensions from the SGI version. They do no range checking. - * @ingroup SGIextensions - */ - bitset<_Nb>& - _Unchecked_set(size_t __pos) - { - this->_M_getword(__pos) |= _Base::_S_maskbit(__pos); - return *this; - } - - bitset<_Nb>& - _Unchecked_set(size_t __pos, int __val) - { - if (__val) - this->_M_getword(__pos) |= _Base::_S_maskbit(__pos); - else - this->_M_getword(__pos) &= ~_Base::_S_maskbit(__pos); - return *this; - } - - bitset<_Nb>& - _Unchecked_reset(size_t __pos) - { - this->_M_getword(__pos) &= ~_Base::_S_maskbit(__pos); - return *this; - } - - bitset<_Nb>& - _Unchecked_flip(size_t __pos) - { - this->_M_getword(__pos) ^= _Base::_S_maskbit(__pos); - return *this; - } - - bool - _Unchecked_test(size_t __pos) const - { return ((this->_M_getword(__pos) & _Base::_S_maskbit(__pos)) - != static_cast<_WordT>(0)); } - //@} - - // Set, reset, and flip. - /** - * @brief Sets every bit to true. - */ - bitset<_Nb>& - set() - { - this->_M_do_set(); - this->_M_do_sanitize(); - return *this; - } - - /** - * @brief Sets a given bit to a particular value. - * @param position The index of the bit. - * @param val Either true or false, defaults to true. - * @throw std::out_of_range If @a pos is bigger the size of the %set. - */ - bitset<_Nb>& - set(size_t __position, bool __val = true) - { - if (__position >= _Nb) - __throw_out_of_range(__N("bitset::set")); - return _Unchecked_set(__position, __val); - } - - /** - * @brief Sets every bit to false. - */ - bitset<_Nb>& - reset() - { - this->_M_do_reset(); - return *this; - } - - /** - * @brief Sets a given bit to false. - * @param position The index of the bit. - * @throw std::out_of_range If @a pos is bigger the size of the %set. - * - * Same as writing @c set(pos,false). - */ - bitset<_Nb>& - reset(size_t __position) - { - if (__position >= _Nb) - __throw_out_of_range(__N("bitset::reset")); - return _Unchecked_reset(__position); - } - - /** - * @brief Toggles every bit to its opposite value. - */ - bitset<_Nb>& - flip() - { - this->_M_do_flip(); - this->_M_do_sanitize(); - return *this; - } - - /** - * @brief Toggles a given bit to its opposite value. - * @param position The index of the bit. - * @throw std::out_of_range If @a pos is bigger the size of the %set. - */ - bitset<_Nb>& - flip(size_t __position) - { - if (__position >= _Nb) - __throw_out_of_range(__N("bitset::flip")); - return _Unchecked_flip(__position); - } - - /// See the no-argument flip(). - bitset<_Nb> - operator~() const - { return bitset<_Nb>(*this).flip(); } - - //@{ - /** - * @brief Array-indexing support. - * @param position Index into the %bitset. - * @return A bool for a 'const %bitset'. For non-const bitsets, an - * instance of the reference proxy class. - * @note These operators do no range checking and throw no exceptions, - * as required by DR 11 to the standard. - * - * @if maint - * _GLIBCXX_RESOLVE_LIB_DEFECTS Note that this implementation already - * resolves DR 11 (items 1 and 2), but does not do the range-checking - * required by that DR's resolution. -pme - * The DR has since been changed: range-checking is a precondition - * (users' responsibility), and these functions must not throw. -pme - * @endif - */ - reference - operator[](size_t __position) - { return reference(*this,__position); } - - bool - operator[](size_t __position) const - { return _Unchecked_test(__position); } - //@} - - /** - * @brief Retuns a numerical interpretation of the %bitset. - * @return The integral equivalent of the bits. - * @throw std::overflow_error If there are too many bits to be - * represented in an @c unsigned @c long. - */ - unsigned long - to_ulong() const - { return this->_M_do_to_ulong(); } - - /** - * @brief Retuns a character interpretation of the %bitset. - * @return The string equivalent of the bits. - * - * Note the ordering of the bits: decreasing character positions - * correspond to increasing bit positions (see the main class notes for - * an example). - */ - template - std::basic_string<_CharT, _Traits, _Alloc> - to_string() const - { - std::basic_string<_CharT, _Traits, _Alloc> __result; - _M_copy_to_string(__result); - return __result; - } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 434. bitset::to_string() hard to use. - template - std::basic_string<_CharT, _Traits, std::allocator<_CharT> > - to_string() const - { return to_string<_CharT, _Traits, std::allocator<_CharT> >(); } - - template - std::basic_string<_CharT, std::char_traits<_CharT>, - std::allocator<_CharT> > - to_string() const - { - return to_string<_CharT, std::char_traits<_CharT>, - std::allocator<_CharT> >(); - } - - std::basic_string, std::allocator > - to_string() const - { - return to_string, - std::allocator >(); - } - - // Helper functions for string operations. - template - void - _M_copy_from_string(const std::basic_string<_CharT, - _Traits, _Alloc>& __s, - size_t, size_t); - - template - void - _M_copy_to_string(std::basic_string<_CharT, _Traits, _Alloc>&) const; - - /// Returns the number of bits which are set. - size_t - count() const - { return this->_M_do_count(); } - - /// Returns the total number of bits. - size_t - size() const - { return _Nb; } - - //@{ - /// These comparisons for equality/inequality are, well, @e bitwise. - bool - operator==(const bitset<_Nb>& __rhs) const - { return this->_M_is_equal(__rhs); } - - bool - operator!=(const bitset<_Nb>& __rhs) const - { return !this->_M_is_equal(__rhs); } - //@} - - /** - * @brief Tests the value of a bit. - * @param position The index of a bit. - * @return The value at @a pos. - * @throw std::out_of_range If @a pos is bigger the size of the %set. - */ - bool - test(size_t __position) const - { - if (__position >= _Nb) - __throw_out_of_range(__N("bitset::test")); - return _Unchecked_test(__position); - } - - /** - * @brief Tests whether any of the bits are on. - * @return True if at least one bit is set. - */ - bool - any() const - { return this->_M_is_any(); } - - /** - * @brief Tests whether any of the bits are on. - * @return True if none of the bits are set. - */ - bool - none() const - { return !this->_M_is_any(); } - - //@{ - /// Self-explanatory. - bitset<_Nb> - operator<<(size_t __position) const - { return bitset<_Nb>(*this) <<= __position; } - - bitset<_Nb> - operator>>(size_t __position) const - { return bitset<_Nb>(*this) >>= __position; } - //@} - - /** - * @brief Finds the index of the first "on" bit. - * @return The index of the first bit set, or size() if not found. - * @ingroup SGIextensions - * @sa _Find_next - */ - size_t - _Find_first() const - { return this->_M_do_find_first(_Nb); } - - /** - * @brief Finds the index of the next "on" bit after prev. - * @return The index of the next bit set, or size() if not found. - * @param prev Where to start searching. - * @ingroup SGIextensions - * @sa _Find_first - */ - size_t - _Find_next(size_t __prev ) const - { return this->_M_do_find_next(__prev, _Nb); } - }; - - // Definitions of non-inline member functions. - template - template - void - bitset<_Nb>:: - _M_copy_from_string(const std::basic_string<_CharT, _Traits, - _Alloc>& __s, size_t __pos, size_t __n) - { - reset(); - const size_t __nbits = std::min(_Nb, std::min(__n, __s.size() - __pos)); - for (size_t __i = __nbits; __i > 0; --__i) - { - switch(__s[__pos + __nbits - __i]) - { - case '0': - break; - case '1': - _Unchecked_set(__i - 1); - break; - default: - __throw_invalid_argument(__N("bitset::_M_copy_from_string")); - } - } - } - - template - template - void - bitset<_Nb>:: - _M_copy_to_string(std::basic_string<_CharT, _Traits, _Alloc>& __s) const - { - __s.assign(_Nb, '0'); - for (size_t __i = _Nb; __i > 0; --__i) - if (_Unchecked_test(__i - 1)) - __s[_Nb - __i] = '1'; - } - - // 23.3.5.3 bitset operations: - //@{ - /** - * @brief Global bitwise operations on bitsets. - * @param x A bitset. - * @param y A bitset of the same size as @a x. - * @return A new bitset. - * - * These should be self-explanatory. - */ - template - inline bitset<_Nb> - operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y) - { - bitset<_Nb> __result(__x); - __result &= __y; - return __result; - } - - template - inline bitset<_Nb> - operator|(const bitset<_Nb>& __x, const bitset<_Nb>& __y) - { - bitset<_Nb> __result(__x); - __result |= __y; - return __result; - } - - template - inline bitset<_Nb> - operator^(const bitset<_Nb>& __x, const bitset<_Nb>& __y) - { - bitset<_Nb> __result(__x); - __result ^= __y; - return __result; - } - //@} - - //@{ - /** - * @brief Global I/O operators for bitsets. - * - * Direct I/O between streams and bitsets is supported. Output is - * straightforward. Input will skip whitespace, only accept '0' and '1' - * characters, and will only extract as many digits as the %bitset will - * hold. - */ - template - std::basic_istream<_CharT, _Traits>& - operator>>(std::basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x) - { - typedef typename _Traits::char_type char_type; - std::basic_string<_CharT, _Traits> __tmp; - __tmp.reserve(_Nb); - - std::ios_base::iostate __state = std::ios_base::goodbit; - typename std::basic_istream<_CharT, _Traits>::sentry __sentry(__is); - if (__sentry) - { - try - { - basic_streambuf<_CharT, _Traits>* __buf = __is.rdbuf(); - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 303. Bitset input operator underspecified - const char_type __zero = __is.widen('0'); - const char_type __one = __is.widen('1'); - for (size_t __i = _Nb; __i > 0; --__i) - { - static typename _Traits::int_type __eof = _Traits::eof(); - - typename _Traits::int_type __c1 = __buf->sbumpc(); - if (_Traits::eq_int_type(__c1, __eof)) - { - __state |= std::ios_base::eofbit; - break; - } - else - { - const char_type __c2 = _Traits::to_char_type(__c1); - if (__c2 == __zero) - __tmp.push_back('0'); - else if (__c2 == __one) - __tmp.push_back('1'); - else if (_Traits::eq_int_type(__buf->sputbackc(__c2), - __eof)) - { - __state |= std::ios_base::failbit; - break; - } - } - } - } - catch(...) - { __is._M_setstate(std::ios_base::badbit); } - } - - if (__tmp.empty() && _Nb) - __state |= std::ios_base::failbit; - else - __x._M_copy_from_string(__tmp, static_cast(0), _Nb); - if (__state) - __is.setstate(__state); - return __is; - } - - template - std::basic_ostream<_CharT, _Traits>& - operator<<(std::basic_ostream<_CharT, _Traits>& __os, - const bitset<_Nb>& __x) - { - std::basic_string<_CharT, _Traits> __tmp; - __x._M_copy_to_string(__tmp); - return __os << __tmp; - } - - // Specializations for zero-sized bitsets, to avoid "unsigned comparison - // with zero" warnings. - template<> - inline bitset<0>& - bitset<0>:: - set(size_t, bool) - { - __throw_out_of_range(__N("bitset::set")); - return *this; - } - - template<> - inline bitset<0>& - bitset<0>:: - reset(size_t) - { - __throw_out_of_range(__N("bitset::reset")); - return *this; - } - - template<> - inline bitset<0>& - bitset<0>:: - flip(size_t) - { - __throw_out_of_range(__N("bitset::flip")); - return *this; - } - - template<> - inline bool - bitset<0>:: - test(size_t) const - { - __throw_out_of_range(__N("bitset::test")); - return false; - } - //@} - -_GLIBCXX_END_NESTED_NAMESPACE - -#undef _GLIBCXX_BITSET_WORDS -#undef _GLIBCXX_BITSET_BITS_PER_WORD - -#ifdef _GLIBCXX_DEBUG -# include -#endif - -#endif /* _GLIBCXX_BITSET */ diff --git a/libstdc++-v3/include/std/std_complex.h b/libstdc++-v3/include/std/std_complex.h deleted file mode 100644 index 26f31f6150f..00000000000 --- a/libstdc++-v3/include/std/std_complex.h +++ /dev/null @@ -1,1489 +0,0 @@ -// The template and inlines for the -*- C++ -*- complex number classes. - -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/** @file complex - * This is a Standard C++ Library header. - */ - -// -// ISO C++ 14882: 26.2 Complex Numbers -// Note: this is not a conforming implementation. -// Initially implemented by Ulrich Drepper -// Improved by Gabriel Dos Reis -// - -#ifndef _GLIBCXX_COMPLEX -#define _GLIBCXX_COMPLEX 1 - -#pragma GCC system_header - -#include -#include -#include -#include - -_GLIBCXX_BEGIN_NAMESPACE(std) - - // Forward declarations. - template class complex; - template<> class complex; - template<> class complex; - template<> class complex; - - /// Return magnitude of @a z. - template _Tp abs(const complex<_Tp>&); - /// Return phase angle of @a z. - template _Tp arg(const complex<_Tp>&); - /// Return @a z magnitude squared. - template _Tp norm(const complex<_Tp>&); - - /// Return complex conjugate of @a z. - template complex<_Tp> conj(const complex<_Tp>&); - /// Return complex with magnitude @a rho and angle @a theta. - template complex<_Tp> polar(const _Tp&, const _Tp& = 0); - - // Transcendentals: - /// Return complex cosine of @a z. - template complex<_Tp> cos(const complex<_Tp>&); - /// Return complex hyperbolic cosine of @a z. - template complex<_Tp> cosh(const complex<_Tp>&); - /// Return complex base e exponential of @a z. - template complex<_Tp> exp(const complex<_Tp>&); - /// Return complex natural logarithm of @a z. - template complex<_Tp> log(const complex<_Tp>&); - /// Return complex base 10 logarithm of @a z. - template complex<_Tp> log10(const complex<_Tp>&); - /// Return complex cosine of @a z. - template complex<_Tp> pow(const complex<_Tp>&, int); - /// Return @a x to the @a y'th power. - template complex<_Tp> pow(const complex<_Tp>&, const _Tp&); - /// Return @a x to the @a y'th power. - template complex<_Tp> pow(const complex<_Tp>&, - const complex<_Tp>&); - /// Return @a x to the @a y'th power. - template complex<_Tp> pow(const _Tp&, const complex<_Tp>&); - /// Return complex sine of @a z. - template complex<_Tp> sin(const complex<_Tp>&); - /// Return complex hyperbolic sine of @a z. - template complex<_Tp> sinh(const complex<_Tp>&); - /// Return complex square root of @a z. - template complex<_Tp> sqrt(const complex<_Tp>&); - /// Return complex tangent of @a z. - template complex<_Tp> tan(const complex<_Tp>&); - /// Return complex hyperbolic tangent of @a z. - template complex<_Tp> tanh(const complex<_Tp>&); - //@} - - - // 26.2.2 Primary template class complex - /** - * Template to represent complex numbers. - * - * Specializations for float, double, and long double are part of the - * library. Results with any other type are not guaranteed. - * - * @param Tp Type of real and imaginary values. - */ - template - struct complex - { - /// Value typedef. - typedef _Tp value_type; - - /// Default constructor. First parameter is x, second parameter is y. - /// Unspecified parameters default to 0. - complex(const _Tp& = _Tp(), const _Tp & = _Tp()); - - // Lets the compiler synthesize the copy constructor - // complex (const complex<_Tp>&); - /// Copy constructor. - template - complex(const complex<_Up>&); - - /// Return real part of complex number. - _Tp& real(); - /// Return real part of complex number. - const _Tp& real() const; - /// Return imaginary part of complex number. - _Tp& imag(); - /// Return imaginary part of complex number. - const _Tp& imag() const; - - /// Assign this complex number to scalar @a t. - complex<_Tp>& operator=(const _Tp&); - /// Add @a t to this complex number. - complex<_Tp>& operator+=(const _Tp&); - /// Subtract @a t from this complex number. - complex<_Tp>& operator-=(const _Tp&); - /// Multiply this complex number by @a t. - complex<_Tp>& operator*=(const _Tp&); - /// Divide this complex number by @a t. - complex<_Tp>& operator/=(const _Tp&); - - // Lets the compiler synthesize the - // copy and assignment operator - // complex<_Tp>& operator= (const complex<_Tp>&); - /// Assign this complex number to complex @a z. - template - complex<_Tp>& operator=(const complex<_Up>&); - /// Add @a z to this complex number. - template - complex<_Tp>& operator+=(const complex<_Up>&); - /// Subtract @a z from this complex number. - template - complex<_Tp>& operator-=(const complex<_Up>&); - /// Multiply this complex number by @a z. - template - complex<_Tp>& operator*=(const complex<_Up>&); - /// Divide this complex number by @a z. - template - complex<_Tp>& operator/=(const complex<_Up>&); - - const complex& __rep() const; - - private: - _Tp _M_real; - _Tp _M_imag; - }; - - template - inline _Tp& - complex<_Tp>::real() { return _M_real; } - - template - inline const _Tp& - complex<_Tp>::real() const { return _M_real; } - - template - inline _Tp& - complex<_Tp>::imag() { return _M_imag; } - - template - inline const _Tp& - complex<_Tp>::imag() const { return _M_imag; } - - template - inline - complex<_Tp>::complex(const _Tp& __r, const _Tp& __i) - : _M_real(__r), _M_imag(__i) { } - - template - template - inline - complex<_Tp>::complex(const complex<_Up>& __z) - : _M_real(__z.real()), _M_imag(__z.imag()) { } - - template - complex<_Tp>& - complex<_Tp>::operator=(const _Tp& __t) - { - _M_real = __t; - _M_imag = _Tp(); - return *this; - } - - // 26.2.5/1 - template - inline complex<_Tp>& - complex<_Tp>::operator+=(const _Tp& __t) - { - _M_real += __t; - return *this; - } - - // 26.2.5/3 - template - inline complex<_Tp>& - complex<_Tp>::operator-=(const _Tp& __t) - { - _M_real -= __t; - return *this; - } - - // 26.2.5/5 - template - complex<_Tp>& - complex<_Tp>::operator*=(const _Tp& __t) - { - _M_real *= __t; - _M_imag *= __t; - return *this; - } - - // 26.2.5/7 - template - complex<_Tp>& - complex<_Tp>::operator/=(const _Tp& __t) - { - _M_real /= __t; - _M_imag /= __t; - return *this; - } - - template - template - complex<_Tp>& - complex<_Tp>::operator=(const complex<_Up>& __z) - { - _M_real = __z.real(); - _M_imag = __z.imag(); - return *this; - } - - // 26.2.5/9 - template - template - complex<_Tp>& - complex<_Tp>::operator+=(const complex<_Up>& __z) - { - _M_real += __z.real(); - _M_imag += __z.imag(); - return *this; - } - - // 26.2.5/11 - template - template - complex<_Tp>& - complex<_Tp>::operator-=(const complex<_Up>& __z) - { - _M_real -= __z.real(); - _M_imag -= __z.imag(); - return *this; - } - - // 26.2.5/13 - // XXX: This is a grammar school implementation. - template - template - complex<_Tp>& - complex<_Tp>::operator*=(const complex<_Up>& __z) - { - const _Tp __r = _M_real * __z.real() - _M_imag * __z.imag(); - _M_imag = _M_real * __z.imag() + _M_imag * __z.real(); - _M_real = __r; - return *this; - } - - // 26.2.5/15 - // XXX: This is a grammar school implementation. - template - template - complex<_Tp>& - complex<_Tp>::operator/=(const complex<_Up>& __z) - { - const _Tp __r = _M_real * __z.real() + _M_imag * __z.imag(); - const _Tp __n = std::norm(__z); - _M_imag = (_M_imag * __z.real() - _M_real * __z.imag()) / __n; - _M_real = __r / __n; - return *this; - } - - template - inline const complex<_Tp>& - complex<_Tp>::__rep() const { return *this; } - - // Operators: - //@{ - /// Return new complex value @a x plus @a y. - template - inline complex<_Tp> - operator+(const complex<_Tp>& __x, const complex<_Tp>& __y) - { - complex<_Tp> __r = __x; - __r += __y; - return __r; - } - - template - inline complex<_Tp> - operator+(const complex<_Tp>& __x, const _Tp& __y) - { - complex<_Tp> __r = __x; - __r.real() += __y; - return __r; - } - - template - inline complex<_Tp> - operator+(const _Tp& __x, const complex<_Tp>& __y) - { - complex<_Tp> __r = __y; - __r.real() += __x; - return __r; - } - //@} - - //@{ - /// Return new complex value @a x minus @a y. - template - inline complex<_Tp> - operator-(const complex<_Tp>& __x, const complex<_Tp>& __y) - { - complex<_Tp> __r = __x; - __r -= __y; - return __r; - } - - template - inline complex<_Tp> - operator-(const complex<_Tp>& __x, const _Tp& __y) - { - complex<_Tp> __r = __x; - __r.real() -= __y; - return __r; - } - - template - inline complex<_Tp> - operator-(const _Tp& __x, const complex<_Tp>& __y) - { - complex<_Tp> __r(__x, -__y.imag()); - __r.real() -= __y.real(); - return __r; - } - //@} - - //@{ - /// Return new complex value @a x times @a y. - template - inline complex<_Tp> - operator*(const complex<_Tp>& __x, const complex<_Tp>& __y) - { - complex<_Tp> __r = __x; - __r *= __y; - return __r; - } - - template - inline complex<_Tp> - operator*(const complex<_Tp>& __x, const _Tp& __y) - { - complex<_Tp> __r = __x; - __r *= __y; - return __r; - } - - template - inline complex<_Tp> - operator*(const _Tp& __x, const complex<_Tp>& __y) - { - complex<_Tp> __r = __y; - __r *= __x; - return __r; - } - //@} - - //@{ - /// Return new complex value @a x divided by @a y. - template - inline complex<_Tp> - operator/(const complex<_Tp>& __x, const complex<_Tp>& __y) - { - complex<_Tp> __r = __x; - __r /= __y; - return __r; - } - - template - inline complex<_Tp> - operator/(const complex<_Tp>& __x, const _Tp& __y) - { - complex<_Tp> __r = __x; - __r /= __y; - return __r; - } - - template - inline complex<_Tp> - operator/(const _Tp& __x, const complex<_Tp>& __y) - { - complex<_Tp> __r = __x; - __r /= __y; - return __r; - } - //@} - - /// Return @a x. - template - inline complex<_Tp> - operator+(const complex<_Tp>& __x) - { return __x; } - - /// Return complex negation of @a x. - template - inline complex<_Tp> - operator-(const complex<_Tp>& __x) - { return complex<_Tp>(-__x.real(), -__x.imag()); } - - //@{ - /// Return true if @a x is equal to @a y. - template - inline bool - operator==(const complex<_Tp>& __x, const complex<_Tp>& __y) - { return __x.real() == __y.real() && __x.imag() == __y.imag(); } - - template - inline bool - operator==(const complex<_Tp>& __x, const _Tp& __y) - { return __x.real() == __y && __x.imag() == _Tp(); } - - template - inline bool - operator==(const _Tp& __x, const complex<_Tp>& __y) - { return __x == __y.real() && _Tp() == __y.imag(); } - //@} - - //@{ - /// Return false if @a x is equal to @a y. - template - inline bool - operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y) - { return __x.real() != __y.real() || __x.imag() != __y.imag(); } - - template - inline bool - operator!=(const complex<_Tp>& __x, const _Tp& __y) - { return __x.real() != __y || __x.imag() != _Tp(); } - - template - inline bool - operator!=(const _Tp& __x, const complex<_Tp>& __y) - { return __x != __y.real() || _Tp() != __y.imag(); } - //@} - - /// Extraction operator for complex values. - template - basic_istream<_CharT, _Traits>& - operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x) - { - _Tp __re_x, __im_x; - _CharT __ch; - __is >> __ch; - if (__ch == '(') - { - __is >> __re_x >> __ch; - if (__ch == ',') - { - __is >> __im_x >> __ch; - if (__ch == ')') - __x = complex<_Tp>(__re_x, __im_x); - else - __is.setstate(ios_base::failbit); - } - else if (__ch == ')') - __x = __re_x; - else - __is.setstate(ios_base::failbit); - } - else - { - __is.putback(__ch); - __is >> __re_x; - __x = __re_x; - } - return __is; - } - - /// Insertion operator for complex values. - template - basic_ostream<_CharT, _Traits>& - operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x) - { - basic_ostringstream<_CharT, _Traits> __s; - __s.flags(__os.flags()); - __s.imbue(__os.getloc()); - __s.precision(__os.precision()); - __s << '(' << __x.real() << ',' << __x.imag() << ')'; - return __os << __s.str(); - } - - // Values - template - inline _Tp& - real(complex<_Tp>& __z) - { return __z.real(); } - - template - inline const _Tp& - real(const complex<_Tp>& __z) - { return __z.real(); } - - template - inline _Tp& - imag(complex<_Tp>& __z) - { return __z.imag(); } - - template - inline const _Tp& - imag(const complex<_Tp>& __z) - { return __z.imag(); } - - // 26.2.7/3 abs(__z): Returns the magnitude of __z. - template - inline _Tp - __complex_abs(const complex<_Tp>& __z) - { - _Tp __x = __z.real(); - _Tp __y = __z.imag(); - const _Tp __s = std::max(abs(__x), abs(__y)); - if (__s == _Tp()) // well ... - return __s; - __x /= __s; - __y /= __s; - return __s * sqrt(__x * __x + __y * __y); - } - -#if _GLIBCXX_USE_C99_COMPLEX - inline float - __complex_abs(__complex__ float __z) { return __builtin_cabsf(__z); } - - inline double - __complex_abs(__complex__ double __z) { return __builtin_cabs(__z); } - - inline long double - __complex_abs(const __complex__ long double& __z) - { return __builtin_cabsl(__z); } - - template - inline _Tp - abs(const complex<_Tp>& __z) { return __complex_abs(__z.__rep()); } -#else - template - inline _Tp - abs(const complex<_Tp>& __z) { return __complex_abs(__z); } -#endif - - - // 26.2.7/4: arg(__z): Returns the phase angle of __z. - template - inline _Tp - __complex_arg(const complex<_Tp>& __z) - { return atan2(__z.imag(), __z.real()); } - -#if _GLIBCXX_USE_C99_COMPLEX - inline float - __complex_arg(__complex__ float __z) { return __builtin_cargf(__z); } - - inline double - __complex_arg(__complex__ double __z) { return __builtin_carg(__z); } - - inline long double - __complex_arg(const __complex__ long double& __z) - { return __builtin_cargl(__z); } - - template - inline _Tp - arg(const complex<_Tp>& __z) { return __complex_arg(__z.__rep()); } -#else - template - inline _Tp - arg(const complex<_Tp>& __z) { return __complex_arg(__z); } -#endif - - // 26.2.7/5: norm(__z) returns the squared magintude of __z. - // As defined, norm() is -not- a norm is the common mathematical - // sens used in numerics. The helper class _Norm_helper<> tries to - // distinguish between builtin floating point and the rest, so as - // to deliver an answer as close as possible to the real value. - template - struct _Norm_helper - { - template - static inline _Tp _S_do_it(const complex<_Tp>& __z) - { - const _Tp __x = __z.real(); - const _Tp __y = __z.imag(); - return __x * __x + __y * __y; - } - }; - - template<> - struct _Norm_helper - { - template - static inline _Tp _S_do_it(const complex<_Tp>& __z) - { - _Tp __res = std::abs(__z); - return __res * __res; - } - }; - - template - inline _Tp - norm(const complex<_Tp>& __z) - { - return _Norm_helper<__is_floating<_Tp>::__value - && !_GLIBCXX_FAST_MATH>::_S_do_it(__z); - } - - template - inline complex<_Tp> - polar(const _Tp& __rho, const _Tp& __theta) - { return complex<_Tp>(__rho * cos(__theta), __rho * sin(__theta)); } - - template - inline complex<_Tp> - conj(const complex<_Tp>& __z) - { return complex<_Tp>(__z.real(), -__z.imag()); } - - // Transcendentals - - // 26.2.8/1 cos(__z): Returns the cosine of __z. - template - inline complex<_Tp> - __complex_cos(const complex<_Tp>& __z) - { - const _Tp __x = __z.real(); - const _Tp __y = __z.imag(); - return complex<_Tp>(cos(__x) * cosh(__y), -sin(__x) * sinh(__y)); - } - -#if _GLIBCXX_USE_C99_COMPLEX - inline __complex__ float - __complex_cos(__complex__ float __z) { return __builtin_ccosf(__z); } - - inline __complex__ double - __complex_cos(__complex__ double __z) { return __builtin_ccos(__z); } - - inline __complex__ long double - __complex_cos(const __complex__ long double& __z) - { return __builtin_ccosl(__z); } - - template - inline complex<_Tp> - cos(const complex<_Tp>& __z) { return __complex_cos(__z.__rep()); } -#else - template - inline complex<_Tp> - cos(const complex<_Tp>& __z) { return __complex_cos(__z); } -#endif - - // 26.2.8/2 cosh(__z): Returns the hyperbolic cosine of __z. - template - inline complex<_Tp> - __complex_cosh(const complex<_Tp>& __z) - { - const _Tp __x = __z.real(); - const _Tp __y = __z.imag(); - return complex<_Tp>(cosh(__x) * cos(__y), sinh(__x) * sin(__y)); - } - -#if _GLIBCXX_USE_C99_COMPLEX - inline __complex__ float - __complex_cosh(__complex__ float __z) { return __builtin_ccoshf(__z); } - - inline __complex__ double - __complex_cosh(__complex__ double __z) { return __builtin_ccosh(__z); } - - inline __complex__ long double - __complex_cosh(const __complex__ long double& __z) - { return __builtin_ccoshl(__z); } - - template - inline complex<_Tp> - cosh(const complex<_Tp>& __z) { return __complex_cosh(__z.__rep()); } -#else - template - inline complex<_Tp> - cosh(const complex<_Tp>& __z) { return __complex_cosh(__z); } -#endif - - // 26.2.8/3 exp(__z): Returns the complex base e exponential of x - template - inline complex<_Tp> - __complex_exp(const complex<_Tp>& __z) - { return std::polar(exp(__z.real()), __z.imag()); } - -#if _GLIBCXX_USE_C99_COMPLEX - inline __complex__ float - __complex_exp(__complex__ float __z) { return __builtin_cexpf(__z); } - - inline __complex__ double - __complex_exp(__complex__ double __z) { return __builtin_cexp(__z); } - - inline __complex__ long double - __complex_exp(const __complex__ long double& __z) - { return __builtin_cexpl(__z); } - - template - inline complex<_Tp> - exp(const complex<_Tp>& __z) { return __complex_exp(__z.__rep()); } -#else - template - inline complex<_Tp> - exp(const complex<_Tp>& __z) { return __complex_exp(__z); } -#endif - - // 26.2.8/5 log(__z): Reurns the natural complex logaritm of __z. - // The branch cut is along the negative axis. - template - inline complex<_Tp> - __complex_log(const complex<_Tp>& __z) - { return complex<_Tp>(log(std::abs(__z)), std::arg(__z)); } - -#if _GLIBCXX_USE_C99_COMPLEX - inline __complex__ float - __complex_log(__complex__ float __z) { return __builtin_clogf(__z); } - - inline __complex__ double - __complex_log(__complex__ double __z) { return __builtin_clog(__z); } - - inline __complex__ long double - __complex_log(const __complex__ long double& __z) - { return __builtin_clogl(__z); } - - template - inline complex<_Tp> - log(const complex<_Tp>& __z) { return __complex_log(__z.__rep()); } -#else - template - inline complex<_Tp> - log(const complex<_Tp>& __z) { return __complex_log(__z); } -#endif - - template - inline complex<_Tp> - log10(const complex<_Tp>& __z) - { return std::log(__z) / log(_Tp(10.0)); } - - // 26.2.8/10 sin(__z): Returns the sine of __z. - template - inline complex<_Tp> - __complex_sin(const complex<_Tp>& __z) - { - const _Tp __x = __z.real(); - const _Tp __y = __z.imag(); - return complex<_Tp>(sin(__x) * cosh(__y), cos(__x) * sinh(__y)); - } - -#if _GLIBCXX_USE_C99_COMPLEX - inline __complex__ float - __complex_sin(__complex__ float __z) { return __builtin_csinf(__z); } - - inline __complex__ double - __complex_sin(__complex__ double __z) { return __builtin_csin(__z); } - - inline __complex__ long double - __complex_sin(const __complex__ long double& __z) - { return __builtin_csinl(__z); } - - template - inline complex<_Tp> - sin(const complex<_Tp>& __z) { return __complex_sin(__z.__rep()); } -#else - template - inline complex<_Tp> - sin(const complex<_Tp>& __z) { return __complex_sin(__z); } -#endif - - // 26.2.8/11 sinh(__z): Returns the hyperbolic sine of __z. - template - inline complex<_Tp> - __complex_sinh(const complex<_Tp>& __z) - { - const _Tp __x = __z.real(); - const _Tp __y = __z.imag(); - return complex<_Tp>(sinh(__x) * cos(__y), cosh(__x) * sin(__y)); - } - -#if _GLIBCXX_USE_C99_COMPLEX - inline __complex__ float - __complex_sinh(__complex__ float __z) { return __builtin_csinhf(__z); } - - inline __complex__ double - __complex_sinh(__complex__ double __z) { return __builtin_csinh(__z); } - - inline __complex__ long double - __complex_sinh(const __complex__ long double& __z) - { return __builtin_csinhl(__z); } - - template - inline complex<_Tp> - sinh(const complex<_Tp>& __z) { return __complex_sinh(__z.__rep()); } -#else - template - inline complex<_Tp> - sinh(const complex<_Tp>& __z) { return __complex_sinh(__z); } -#endif - - // 26.2.8/13 sqrt(__z): Returns the complex square root of __z. - // The branch cut is on the negative axis. - template - complex<_Tp> - __complex_sqrt(const complex<_Tp>& __z) - { - _Tp __x = __z.real(); - _Tp __y = __z.imag(); - - if (__x == _Tp()) - { - _Tp __t = sqrt(abs(__y) / 2); - return complex<_Tp>(__t, __y < _Tp() ? -__t : __t); - } - else - { - _Tp __t = sqrt(2 * (std::abs(__z) + abs(__x))); - _Tp __u = __t / 2; - return __x > _Tp() - ? complex<_Tp>(__u, __y / __t) - : complex<_Tp>(abs(__y) / __t, __y < _Tp() ? -__u : __u); - } - } - -#if _GLIBCXX_USE_C99_COMPLEX - inline __complex__ float - __complex_sqrt(__complex__ float __z) { return __builtin_csqrtf(__z); } - - inline __complex__ double - __complex_sqrt(__complex__ double __z) { return __builtin_csqrt(__z); } - - inline __complex__ long double - __complex_sqrt(const __complex__ long double& __z) - { return __builtin_csqrtl(__z); } - - template - inline complex<_Tp> - sqrt(const complex<_Tp>& __z) { return __complex_sqrt(__z.__rep()); } -#else - template - inline complex<_Tp> - sqrt(const complex<_Tp>& __z) { return __complex_sqrt(__z); } -#endif - - // 26.2.8/14 tan(__z): Return the complex tangent of __z. - - template - inline complex<_Tp> - __complex_tan(const complex<_Tp>& __z) - { return std::sin(__z) / std::cos(__z); } - -#if _GLIBCXX_USE_C99_COMPLEX - inline __complex__ float - __complex_tan(__complex__ float __z) { return __builtin_ctanf(__z); } - - inline __complex__ double - __complex_tan(__complex__ double __z) { return __builtin_ctan(__z); } - - inline __complex__ long double - __complex_tan(const __complex__ long double& __z) - { return __builtin_ctanl(__z); } - - template - inline complex<_Tp> - tan(const complex<_Tp>& __z) { return __complex_tan(__z.__rep()); } -#else - template - inline complex<_Tp> - tan(const complex<_Tp>& __z) { return __complex_tan(__z); } -#endif - - - // 26.2.8/15 tanh(__z): Returns the hyperbolic tangent of __z. - - template - inline complex<_Tp> - __complex_tanh(const complex<_Tp>& __z) - { return std::sinh(__z) / std::cosh(__z); } - -#if _GLIBCXX_USE_C99_COMPLEX - inline __complex__ float - __complex_tanh(__complex__ float __z) { return __builtin_ctanhf(__z); } - - inline __complex__ double - __complex_tanh(__complex__ double __z) { return __builtin_ctanh(__z); } - - inline __complex__ long double - __complex_tanh(const __complex__ long double& __z) - { return __builtin_ctanhl(__z); } - - template - inline complex<_Tp> - tanh(const complex<_Tp>& __z) { return __complex_tanh(__z.__rep()); } -#else - template - inline complex<_Tp> - tanh(const complex<_Tp>& __z) { return __complex_tanh(__z); } -#endif - - - // 26.2.8/9 pow(__x, __y): Returns the complex power base of __x - // raised to the __y-th power. The branch - // cut is on the negative axis. - template - inline complex<_Tp> - pow(const complex<_Tp>& __z, int __n) - { return std::__pow_helper(__z, __n); } - - template - complex<_Tp> - pow(const complex<_Tp>& __x, const _Tp& __y) - { -#ifndef _GLIBCXX_USE_C99_COMPLEX - if (__x == _Tp()) - return _Tp(); -#endif - if (__x.imag() == _Tp() && __x.real() > _Tp()) - return pow(__x.real(), __y); - - complex<_Tp> __t = std::log(__x); - return std::polar(exp(__y * __t.real()), __y * __t.imag()); - } - - template - inline complex<_Tp> - __complex_pow(const complex<_Tp>& __x, const complex<_Tp>& __y) - { return __x == _Tp() ? _Tp() : std::exp(__y * std::log(__x)); } - -#if _GLIBCXX_USE_C99_COMPLEX - inline __complex__ float - __complex_pow(__complex__ float __x, __complex__ float __y) - { return __builtin_cpowf(__x, __y); } - - inline __complex__ double - __complex_pow(__complex__ double __x, __complex__ double __y) - { return __builtin_cpow(__x, __y); } - - inline __complex__ long double - __complex_pow(const __complex__ long double& __x, - const __complex__ long double& __y) - { return __builtin_cpowl(__x, __y); } - - template - inline complex<_Tp> - pow(const complex<_Tp>& __x, const complex<_Tp>& __y) - { return __complex_pow(__x.__rep(), __y.__rep()); } -#else - template - inline complex<_Tp> - pow(const complex<_Tp>& __x, const complex<_Tp>& __y) - { return __complex_pow(__x, __y); } -#endif - - template - inline complex<_Tp> - pow(const _Tp& __x, const complex<_Tp>& __y) - { - return __x > _Tp() ? std::polar(pow(__x, __y.real()), - __y.imag() * log(__x)) - : std::pow(complex<_Tp>(__x, _Tp()), __y); - } - - // 26.2.3 complex specializations - // complex specialization - template<> - struct complex - { - typedef float value_type; - typedef __complex__ float _ComplexT; - - complex(_ComplexT __z) : _M_value(__z) { } - - complex(float = 0.0f, float = 0.0f); - - explicit complex(const complex&); - explicit complex(const complex&); - - float& real(); - const float& real() const; - float& imag(); - const float& imag() const; - - complex& operator=(float); - complex& operator+=(float); - complex& operator-=(float); - complex& operator*=(float); - complex& operator/=(float); - - // Let's the compiler synthetize the copy and assignment - // operator. It always does a pretty good job. - // complex& operator= (const complex&); - template - complex&operator=(const complex<_Tp>&); - template - complex& operator+=(const complex<_Tp>&); - template - complex& operator-=(const complex<_Tp>&); - template - complex& operator*=(const complex<_Tp>&); - template - complex&operator/=(const complex<_Tp>&); - - const _ComplexT& __rep() const { return _M_value; } - - private: - _ComplexT _M_value; - }; - - inline float& - complex::real() - { return __real__ _M_value; } - - inline const float& - complex::real() const - { return __real__ _M_value; } - - inline float& - complex::imag() - { return __imag__ _M_value; } - - inline const float& - complex::imag() const - { return __imag__ _M_value; } - - inline - complex::complex(float r, float i) - { - __real__ _M_value = r; - __imag__ _M_value = i; - } - - inline complex& - complex::operator=(float __f) - { - __real__ _M_value = __f; - __imag__ _M_value = 0.0f; - return *this; - } - - inline complex& - complex::operator+=(float __f) - { - __real__ _M_value += __f; - return *this; - } - - inline complex& - complex::operator-=(float __f) - { - __real__ _M_value -= __f; - return *this; - } - - inline complex& - complex::operator*=(float __f) - { - _M_value *= __f; - return *this; - } - - inline complex& - complex::operator/=(float __f) - { - _M_value /= __f; - return *this; - } - - template - inline complex& - complex::operator=(const complex<_Tp>& __z) - { - __real__ _M_value = __z.real(); - __imag__ _M_value = __z.imag(); - return *this; - } - - template - inline complex& - complex::operator+=(const complex<_Tp>& __z) - { - __real__ _M_value += __z.real(); - __imag__ _M_value += __z.imag(); - return *this; - } - - template - inline complex& - complex::operator-=(const complex<_Tp>& __z) - { - __real__ _M_value -= __z.real(); - __imag__ _M_value -= __z.imag(); - return *this; - } - - template - inline complex& - complex::operator*=(const complex<_Tp>& __z) - { - _ComplexT __t; - __real__ __t = __z.real(); - __imag__ __t = __z.imag(); - _M_value *= __t; - return *this; - } - - template - inline complex& - complex::operator/=(const complex<_Tp>& __z) - { - _ComplexT __t; - __real__ __t = __z.real(); - __imag__ __t = __z.imag(); - _M_value /= __t; - return *this; - } - - // 26.2.3 complex specializations - // complex specialization - template<> - struct complex - { - typedef double value_type; - typedef __complex__ double _ComplexT; - - complex(_ComplexT __z) : _M_value(__z) { } - - complex(double = 0.0, double = 0.0); - - complex(const complex&); - explicit complex(const complex&); - - double& real(); - const double& real() const; - double& imag(); - const double& imag() const; - - complex& operator=(double); - complex& operator+=(double); - complex& operator-=(double); - complex& operator*=(double); - complex& operator/=(double); - - // The compiler will synthetize this, efficiently. - // complex& operator= (const complex&); - template - complex& operator=(const complex<_Tp>&); - template - complex& operator+=(const complex<_Tp>&); - template - complex& operator-=(const complex<_Tp>&); - template - complex& operator*=(const complex<_Tp>&); - template - complex& operator/=(const complex<_Tp>&); - - const _ComplexT& __rep() const { return _M_value; } - - private: - _ComplexT _M_value; - }; - - inline double& - complex::real() - { return __real__ _M_value; } - - inline const double& - complex::real() const - { return __real__ _M_value; } - - inline double& - complex::imag() - { return __imag__ _M_value; } - - inline const double& - complex::imag() const - { return __imag__ _M_value; } - - inline - complex::complex(double __r, double __i) - { - __real__ _M_value = __r; - __imag__ _M_value = __i; - } - - inline complex& - complex::operator=(double __d) - { - __real__ _M_value = __d; - __imag__ _M_value = 0.0; - return *this; - } - - inline complex& - complex::operator+=(double __d) - { - __real__ _M_value += __d; - return *this; - } - - inline complex& - complex::operator-=(double __d) - { - __real__ _M_value -= __d; - return *this; - } - - inline complex& - complex::operator*=(double __d) - { - _M_value *= __d; - return *this; - } - - inline complex& - complex::operator/=(double __d) - { - _M_value /= __d; - return *this; - } - - template - inline complex& - complex::operator=(const complex<_Tp>& __z) - { - __real__ _M_value = __z.real(); - __imag__ _M_value = __z.imag(); - return *this; - } - - template - inline complex& - complex::operator+=(const complex<_Tp>& __z) - { - __real__ _M_value += __z.real(); - __imag__ _M_value += __z.imag(); - return *this; - } - - template - inline complex& - complex::operator-=(const complex<_Tp>& __z) - { - __real__ _M_value -= __z.real(); - __imag__ _M_value -= __z.imag(); - return *this; - } - - template - inline complex& - complex::operator*=(const complex<_Tp>& __z) - { - _ComplexT __t; - __real__ __t = __z.real(); - __imag__ __t = __z.imag(); - _M_value *= __t; - return *this; - } - - template - inline complex& - complex::operator/=(const complex<_Tp>& __z) - { - _ComplexT __t; - __real__ __t = __z.real(); - __imag__ __t = __z.imag(); - _M_value /= __t; - return *this; - } - - // 26.2.3 complex specializations - // complex specialization - template<> - struct complex - { - typedef long double value_type; - typedef __complex__ long double _ComplexT; - - complex(_ComplexT __z) : _M_value(__z) { } - - complex(long double = 0.0L, long double = 0.0L); - - complex(const complex&); - complex(const complex&); - - long double& real(); - const long double& real() const; - long double& imag(); - const long double& imag() const; - - complex& operator= (long double); - complex& operator+= (long double); - complex& operator-= (long double); - complex& operator*= (long double); - complex& operator/= (long double); - - // The compiler knows how to do this efficiently - // complex& operator= (const complex&); - template - complex& operator=(const complex<_Tp>&); - template - complex& operator+=(const complex<_Tp>&); - template - complex& operator-=(const complex<_Tp>&); - template - complex& operator*=(const complex<_Tp>&); - template - complex& operator/=(const complex<_Tp>&); - - const _ComplexT& __rep() const { return _M_value; } - - private: - _ComplexT _M_value; - }; - - inline - complex::complex(long double __r, long double __i) - { - __real__ _M_value = __r; - __imag__ _M_value = __i; - } - - inline long double& - complex::real() - { return __real__ _M_value; } - - inline const long double& - complex::real() const - { return __real__ _M_value; } - - inline long double& - complex::imag() - { return __imag__ _M_value; } - - inline const long double& - complex::imag() const - { return __imag__ _M_value; } - - inline complex& - complex::operator=(long double __r) - { - __real__ _M_value = __r; - __imag__ _M_value = 0.0L; - return *this; - } - - inline complex& - complex::operator+=(long double __r) - { - __real__ _M_value += __r; - return *this; - } - - inline complex& - complex::operator-=(long double __r) - { - __real__ _M_value -= __r; - return *this; - } - - inline complex& - complex::operator*=(long double __r) - { - _M_value *= __r; - return *this; - } - - inline complex& - complex::operator/=(long double __r) - { - _M_value /= __r; - return *this; - } - - template - inline complex& - complex::operator=(const complex<_Tp>& __z) - { - __real__ _M_value = __z.real(); - __imag__ _M_value = __z.imag(); - return *this; - } - - template - inline complex& - complex::operator+=(const complex<_Tp>& __z) - { - __real__ _M_value += __z.real(); - __imag__ _M_value += __z.imag(); - return *this; - } - - template - inline complex& - complex::operator-=(const complex<_Tp>& __z) - { - __real__ _M_value -= __z.real(); - __imag__ _M_value -= __z.imag(); - return *this; - } - - template - inline complex& - complex::operator*=(const complex<_Tp>& __z) - { - _ComplexT __t; - __real__ __t = __z.real(); - __imag__ __t = __z.imag(); - _M_value *= __t; - return *this; - } - - template - inline complex& - complex::operator/=(const complex<_Tp>& __z) - { - _ComplexT __t; - __real__ __t = __z.real(); - __imag__ __t = __z.imag(); - _M_value /= __t; - return *this; - } - - // These bits have to be at the end of this file, so that the - // specializations have all been defined. - // ??? No, they have to be there because of compiler limitation at - // inlining. It suffices that class specializations be defined. - inline - complex::complex(const complex& __z) - : _M_value(__z.__rep()) { } - - inline - complex::complex(const complex& __z) - : _M_value(__z.__rep()) { } - - inline - complex::complex(const complex& __z) - : _M_value(__z.__rep()) { } - - inline - complex::complex(const complex& __z) - : _M_value(__z.__rep()) { } - - inline - complex::complex(const complex& __z) - : _M_value(__z.__rep()) { } - - inline - complex::complex(const complex& __z) - : _M_value(__z.__rep()) { } - -_GLIBCXX_END_NAMESPACE - -#endif /* _GLIBCXX_COMPLEX */ diff --git a/libstdc++-v3/include/std/std_deque.h b/libstdc++-v3/include/std/std_deque.h deleted file mode 100644 index 57c6e4347ad..00000000000 --- a/libstdc++-v3/include/std/std_deque.h +++ /dev/null @@ -1,80 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file include/deque - * This is a Standard C++ Library header. - */ - -#ifndef _GLIBCXX_DEQUE -#define _GLIBCXX_DEQUE 1 - -#pragma GCC system_header - -#include -#include -#include -#include -#include -#include - -#ifndef _GLIBCXX_EXPORT_TEMPLATE -# include -#endif - -#ifdef _GLIBCXX_DEBUG -# include -#endif - -#endif /* _GLIBCXX_DEQUE */ diff --git a/libstdc++-v3/include/std/std_fstream.h b/libstdc++-v3/include/std/std_fstream.h deleted file mode 100644 index f664f2de9f4..00000000000 --- a/libstdc++-v3/include/std/std_fstream.h +++ /dev/null @@ -1,786 +0,0 @@ -// File based streams -*- C++ -*- - -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/** @file fstream - * This is a Standard C++ Library header. - */ - -// -// ISO C++ 14882: 27.8 File-based streams -// - -#ifndef _GLIBCXX_FSTREAM -#define _GLIBCXX_FSTREAM 1 - -#pragma GCC system_header - -#include -#include -#include // For codecvt -#include // For SEEK_SET, SEEK_CUR, SEEK_END, BUFSIZ -#include -#include - -_GLIBCXX_BEGIN_NAMESPACE(std) - - // [27.8.1.1] template class basic_filebuf - /** - * @brief The actual work of input and output (for files). - * - * This class associates both its input and output sequence with an - * external disk file, and maintains a joint file position for both - * sequences. Many of its sematics are described in terms of similar - * behavior in the Standard C Library's @c FILE streams. - */ - // Requirements on traits_type, specific to this class: - // traits_type::pos_type must be fpos - // traits_type::off_type must be streamoff - // traits_type::state_type must be Assignable and DefaultConstructable, - // and traits_type::state_type() must be the initial state for codecvt. - template - class basic_filebuf : public basic_streambuf<_CharT, _Traits> - { - public: - // Types: - typedef _CharT char_type; - typedef _Traits traits_type; - typedef typename traits_type::int_type int_type; - typedef typename traits_type::pos_type pos_type; - typedef typename traits_type::off_type off_type; - - typedef basic_streambuf __streambuf_type; - typedef basic_filebuf __filebuf_type; - typedef __basic_file __file_type; - typedef typename traits_type::state_type __state_type; - typedef codecvt __codecvt_type; - - friend class ios_base; // For sync_with_stdio. - - protected: - // Data Members: - // MT lock inherited from libio or other low-level io library. - __c_lock _M_lock; - - // External buffer. - __file_type _M_file; - - /** - * @if maint - * Place to stash in || out || in | out settings for current filebuf. - * @endif - */ - ios_base::openmode _M_mode; - - // Beginning state type for codecvt. - __state_type _M_state_beg; - - // During output, the state that corresponds to pptr(), - // during input, the state that corresponds to egptr() and - // _M_ext_next. - __state_type _M_state_cur; - - // Not used for output. During input, the state that corresponds - // to eback() and _M_ext_buf. - __state_type _M_state_last; - - /** - * @if maint - * Pointer to the beginning of internal buffer. - * @endif - */ - char_type* _M_buf; - - /** - * @if maint - * Actual size of internal buffer. This number is equal to the size - * of the put area + 1 position, reserved for the overflow char of - * a full area. - * @endif - */ - size_t _M_buf_size; - - // Set iff _M_buf is allocated memory from _M_allocate_internal_buffer. - bool _M_buf_allocated; - - /** - * @if maint - * _M_reading == false && _M_writing == false for 'uncommitted' mode; - * _M_reading == true for 'read' mode; - * _M_writing == true for 'write' mode; - * - * NB: _M_reading == true && _M_writing == true is unused. - * @endif - */ - bool _M_reading; - bool _M_writing; - - //@{ - /** - * @if maint - * Necessary bits for putback buffer management. - * - * @note pbacks of over one character are not currently supported. - * @endif - */ - char_type _M_pback; - char_type* _M_pback_cur_save; - char_type* _M_pback_end_save; - bool _M_pback_init; - //@} - - // Cached codecvt facet. - const __codecvt_type* _M_codecvt; - - /** - * @if maint - * Buffer for external characters. Used for input when - * codecvt::always_noconv() == false. When valid, this corresponds - * to eback(). - * @endif - */ - char* _M_ext_buf; - - /** - * @if maint - * Size of buffer held by _M_ext_buf. - * @endif - */ - streamsize _M_ext_buf_size; - - /** - * @if maint - * Pointers into the buffer held by _M_ext_buf that delimit a - * subsequence of bytes that have been read but not yet converted. - * When valid, _M_ext_next corresponds to egptr(). - * @endif - */ - const char* _M_ext_next; - char* _M_ext_end; - - /** - * @if maint - * Initializes pback buffers, and moves normal buffers to safety. - * Assumptions: - * _M_in_cur has already been moved back - * @endif - */ - void - _M_create_pback() - { - if (!_M_pback_init) - { - _M_pback_cur_save = this->gptr(); - _M_pback_end_save = this->egptr(); - this->setg(&_M_pback, &_M_pback, &_M_pback + 1); - _M_pback_init = true; - } - } - - /** - * @if maint - * Deactivates pback buffer contents, and restores normal buffer. - * Assumptions: - * The pback buffer has only moved forward. - * @endif - */ - void - _M_destroy_pback() throw() - { - if (_M_pback_init) - { - // Length _M_in_cur moved in the pback buffer. - _M_pback_cur_save += this->gptr() != this->eback(); - this->setg(_M_buf, _M_pback_cur_save, _M_pback_end_save); - _M_pback_init = false; - } - } - - public: - // Constructors/destructor: - /** - * @brief Does not open any files. - * - * The default constructor initializes the parent class using its - * own default ctor. - */ - basic_filebuf(); - - /** - * @brief The destructor closes the file first. - */ - virtual - ~basic_filebuf() - { this->close(); } - - // Members: - /** - * @brief Returns true if the external file is open. - */ - bool - is_open() const throw() - { return _M_file.is_open(); } - - /** - * @brief Opens an external file. - * @param s The name of the file. - * @param mode The open mode flags. - * @return @c this on success, NULL on failure - * - * If a file is already open, this function immediately fails. - * Otherwise it tries to open the file named @a s using the flags - * given in @a mode. - * - * [Table 92 gives the relation between openmode combinations and the - * equivalent fopen() flags, but the table has not been copied yet.] - */ - __filebuf_type* - open(const char* __s, ios_base::openmode __mode); - - /** - * @brief Closes the currently associated file. - * @return @c this on success, NULL on failure - * - * If no file is currently open, this function immediately fails. - * - * If a "put buffer area" exists, @c overflow(eof) is called to flush - * all the characters. The file is then closed. - * - * If any operations fail, this function also fails. - */ - __filebuf_type* - close() throw(); - - protected: - void - _M_allocate_internal_buffer(); - - void - _M_destroy_internal_buffer() throw(); - - // [27.8.1.4] overridden virtual functions - virtual streamsize - showmanyc(); - - // Stroustrup, 1998, p. 628 - // underflow() and uflow() functions are called to get the next - // charater from the real input source when the buffer is empty. - // Buffered input uses underflow() - - virtual int_type - underflow(); - - virtual int_type - pbackfail(int_type __c = _Traits::eof()); - - // Stroustrup, 1998, p 648 - // The overflow() function is called to transfer characters to the - // real output destination when the buffer is full. A call to - // overflow(c) outputs the contents of the buffer plus the - // character c. - // 27.5.2.4.5 - // Consume some sequence of the characters in the pending sequence. - virtual int_type - overflow(int_type __c = _Traits::eof()); - - // Convert internal byte sequence to external, char-based - // sequence via codecvt. - bool - _M_convert_to_external(char_type*, streamsize); - - /** - * @brief Manipulates the buffer. - * @param s Pointer to a buffer area. - * @param n Size of @a s. - * @return @c this - * - * If no file has been opened, and both @a s and @a n are zero, then - * the stream becomes unbuffered. Otherwise, @c s is used as a - * buffer; see - * http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#2 - * for more. - */ - virtual __streambuf_type* - setbuf(char_type* __s, streamsize __n); - - virtual pos_type - seekoff(off_type __off, ios_base::seekdir __way, - ios_base::openmode __mode = ios_base::in | ios_base::out); - - virtual pos_type - seekpos(pos_type __pos, - ios_base::openmode __mode = ios_base::in | ios_base::out); - - // Common code for seekoff and seekpos - pos_type - _M_seek(off_type __off, ios_base::seekdir __way, __state_type __state); - - virtual int - sync(); - - virtual void - imbue(const locale& __loc); - - virtual streamsize - xsgetn(char_type* __s, streamsize __n); - - virtual streamsize - xsputn(const char_type* __s, streamsize __n); - - // Flushes output buffer, then writes unshift sequence. - bool - _M_terminate_output(); - - /** - * @if maint - * This function sets the pointers of the internal buffer, both get - * and put areas. Typically: - * - * __off == egptr() - eback() upon underflow/uflow ('read' mode); - * __off == 0 upon overflow ('write' mode); - * __off == -1 upon open, setbuf, seekoff/pos ('uncommitted' mode). - * - * NB: epptr() - pbase() == _M_buf_size - 1, since _M_buf_size - * reflects the actual allocated memory and the last cell is reserved - * for the overflow char of a full put area. - * @endif - */ - void - _M_set_buffer(streamsize __off) - { - const bool __testin = _M_mode & ios_base::in; - const bool __testout = _M_mode & ios_base::out; - - if (__testin && __off > 0) - this->setg(_M_buf, _M_buf, _M_buf + __off); - else - this->setg(_M_buf, _M_buf, _M_buf); - - if (__testout && __off == 0 && _M_buf_size > 1 ) - this->setp(_M_buf, _M_buf + _M_buf_size - 1); - else - this->setp(NULL, NULL); - } - }; - - // [27.8.1.5] Template class basic_ifstream - /** - * @brief Controlling input for files. - * - * This class supports reading from named files, using the inherited - * functions from std::basic_istream. To control the associated - * sequence, an instance of std::basic_filebuf is used, which this page - * refers to as @c sb. - */ - template - class basic_ifstream : public basic_istream<_CharT, _Traits> - { - public: - // Types: - typedef _CharT char_type; - typedef _Traits traits_type; - typedef typename traits_type::int_type int_type; - typedef typename traits_type::pos_type pos_type; - typedef typename traits_type::off_type off_type; - - // Non-standard types: - typedef basic_filebuf __filebuf_type; - typedef basic_istream __istream_type; - - private: - __filebuf_type _M_filebuf; - - public: - // Constructors/Destructors: - /** - * @brief Default constructor. - * - * Initializes @c sb using its default constructor, and passes - * @c &sb to the base class initializer. Does not open any files - * (you haven't given it a filename to open). - */ - basic_ifstream() : __istream_type(), _M_filebuf() - { this->init(&_M_filebuf); } - - /** - * @brief Create an input file stream. - * @param s Null terminated string specifying the filename. - * @param mode Open file in specified mode (see std::ios_base). - * - * @c ios_base::in is automatically included in @a mode. - * - * Tip: When using std::string to hold the filename, you must use - * .c_str() before passing it to this constructor. - */ - explicit - basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in) - : __istream_type(), _M_filebuf() - { - this->init(&_M_filebuf); - this->open(__s, __mode); - } - - /** - * @brief The destructor does nothing. - * - * The file is closed by the filebuf object, not the formatting - * stream. - */ - ~basic_ifstream() - { } - - // Members: - /** - * @brief Accessing the underlying buffer. - * @return The current basic_filebuf buffer. - * - * This hides both signatures of std::basic_ios::rdbuf(). - */ - __filebuf_type* - rdbuf() const - { return const_cast<__filebuf_type*>(&_M_filebuf); } - - /** - * @brief Wrapper to test for an open file. - * @return @c rdbuf()->is_open() - */ - bool - is_open() - { return _M_filebuf.is_open(); } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 365. Lack of const-qualification in clause 27 - bool - is_open() const - { return _M_filebuf.is_open(); } - - /** - * @brief Opens an external file. - * @param s The name of the file. - * @param mode The open mode flags. - * - * Calls @c std::basic_filebuf::open(s,mode|in). If that function - * fails, @c failbit is set in the stream's error state. - * - * Tip: When using std::string to hold the filename, you must use - * .c_str() before passing it to this constructor. - */ - void - open(const char* __s, ios_base::openmode __mode = ios_base::in) - { - if (!_M_filebuf.open(__s, __mode | ios_base::in)) - this->setstate(ios_base::failbit); - else - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 409. Closing an fstream should clear error state - this->clear(); - } - - /** - * @brief Close the file. - * - * Calls @c std::basic_filebuf::close(). If that function - * fails, @c failbit is set in the stream's error state. - */ - void - close() - { - if (!_M_filebuf.close()) - this->setstate(ios_base::failbit); - } - }; - - - // [27.8.1.8] Template class basic_ofstream - /** - * @brief Controlling output for files. - * - * This class supports reading from named files, using the inherited - * functions from std::basic_ostream. To control the associated - * sequence, an instance of std::basic_filebuf is used, which this page - * refers to as @c sb. - */ - template - class basic_ofstream : public basic_ostream<_CharT,_Traits> - { - public: - // Types: - typedef _CharT char_type; - typedef _Traits traits_type; - typedef typename traits_type::int_type int_type; - typedef typename traits_type::pos_type pos_type; - typedef typename traits_type::off_type off_type; - - // Non-standard types: - typedef basic_filebuf __filebuf_type; - typedef basic_ostream __ostream_type; - - private: - __filebuf_type _M_filebuf; - - public: - // Constructors: - /** - * @brief Default constructor. - * - * Initializes @c sb using its default constructor, and passes - * @c &sb to the base class initializer. Does not open any files - * (you haven't given it a filename to open). - */ - basic_ofstream(): __ostream_type(), _M_filebuf() - { this->init(&_M_filebuf); } - - /** - * @brief Create an output file stream. - * @param s Null terminated string specifying the filename. - * @param mode Open file in specified mode (see std::ios_base). - * - * @c ios_base::out|ios_base::trunc is automatically included in - * @a mode. - * - * Tip: When using std::string to hold the filename, you must use - * .c_str() before passing it to this constructor. - */ - explicit - basic_ofstream(const char* __s, - ios_base::openmode __mode = ios_base::out|ios_base::trunc) - : __ostream_type(), _M_filebuf() - { - this->init(&_M_filebuf); - this->open(__s, __mode); - } - - /** - * @brief The destructor does nothing. - * - * The file is closed by the filebuf object, not the formatting - * stream. - */ - ~basic_ofstream() - { } - - // Members: - /** - * @brief Accessing the underlying buffer. - * @return The current basic_filebuf buffer. - * - * This hides both signatures of std::basic_ios::rdbuf(). - */ - __filebuf_type* - rdbuf() const - { return const_cast<__filebuf_type*>(&_M_filebuf); } - - /** - * @brief Wrapper to test for an open file. - * @return @c rdbuf()->is_open() - */ - bool - is_open() - { return _M_filebuf.is_open(); } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 365. Lack of const-qualification in clause 27 - bool - is_open() const - { return _M_filebuf.is_open(); } - - /** - * @brief Opens an external file. - * @param s The name of the file. - * @param mode The open mode flags. - * - * Calls @c std::basic_filebuf::open(s,mode|out|trunc). If that - * function fails, @c failbit is set in the stream's error state. - * - * Tip: When using std::string to hold the filename, you must use - * .c_str() before passing it to this constructor. - */ - void - open(const char* __s, - ios_base::openmode __mode = ios_base::out | ios_base::trunc) - { - if (!_M_filebuf.open(__s, __mode | ios_base::out)) - this->setstate(ios_base::failbit); - else - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 409. Closing an fstream should clear error state - this->clear(); - } - - /** - * @brief Close the file. - * - * Calls @c std::basic_filebuf::close(). If that function - * fails, @c failbit is set in the stream's error state. - */ - void - close() - { - if (!_M_filebuf.close()) - this->setstate(ios_base::failbit); - } - }; - - - // [27.8.1.11] Template class basic_fstream - /** - * @brief Controlling intput and output for files. - * - * This class supports reading from and writing to named files, using - * the inherited functions from std::basic_iostream. To control the - * associated sequence, an instance of std::basic_filebuf is used, which - * this page refers to as @c sb. - */ - template - class basic_fstream : public basic_iostream<_CharT, _Traits> - { - public: - // Types: - typedef _CharT char_type; - typedef _Traits traits_type; - typedef typename traits_type::int_type int_type; - typedef typename traits_type::pos_type pos_type; - typedef typename traits_type::off_type off_type; - - // Non-standard types: - typedef basic_filebuf __filebuf_type; - typedef basic_ios __ios_type; - typedef basic_iostream __iostream_type; - - private: - __filebuf_type _M_filebuf; - - public: - // Constructors/destructor: - /** - * @brief Default constructor. - * - * Initializes @c sb using its default constructor, and passes - * @c &sb to the base class initializer. Does not open any files - * (you haven't given it a filename to open). - */ - basic_fstream() - : __iostream_type(), _M_filebuf() - { this->init(&_M_filebuf); } - - /** - * @brief Create an input/output file stream. - * @param s Null terminated string specifying the filename. - * @param mode Open file in specified mode (see std::ios_base). - * - * Tip: When using std::string to hold the filename, you must use - * .c_str() before passing it to this constructor. - */ - explicit - basic_fstream(const char* __s, - ios_base::openmode __mode = ios_base::in | ios_base::out) - : __iostream_type(NULL), _M_filebuf() - { - this->init(&_M_filebuf); - this->open(__s, __mode); - } - - /** - * @brief The destructor does nothing. - * - * The file is closed by the filebuf object, not the formatting - * stream. - */ - ~basic_fstream() - { } - - // Members: - /** - * @brief Accessing the underlying buffer. - * @return The current basic_filebuf buffer. - * - * This hides both signatures of std::basic_ios::rdbuf(). - */ - __filebuf_type* - rdbuf() const - { return const_cast<__filebuf_type*>(&_M_filebuf); } - - /** - * @brief Wrapper to test for an open file. - * @return @c rdbuf()->is_open() - */ - bool - is_open() - { return _M_filebuf.is_open(); } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 365. Lack of const-qualification in clause 27 - bool - is_open() const - { return _M_filebuf.is_open(); } - - /** - * @brief Opens an external file. - * @param s The name of the file. - * @param mode The open mode flags. - * - * Calls @c std::basic_filebuf::open(s,mode). If that - * function fails, @c failbit is set in the stream's error state. - * - * Tip: When using std::string to hold the filename, you must use - * .c_str() before passing it to this constructor. - */ - void - open(const char* __s, - ios_base::openmode __mode = ios_base::in | ios_base::out) - { - if (!_M_filebuf.open(__s, __mode)) - this->setstate(ios_base::failbit); - else - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 409. Closing an fstream should clear error state - this->clear(); - } - - /** - * @brief Close the file. - * - * Calls @c std::basic_filebuf::close(). If that function - * fails, @c failbit is set in the stream's error state. - */ - void - close() - { - if (!_M_filebuf.close()) - this->setstate(ios_base::failbit); - } - }; - -_GLIBCXX_END_NAMESPACE - -#ifndef _GLIBCXX_EXPORT_TEMPLATE -# include -#endif - -#endif /* _GLIBCXX_FSTREAM */ diff --git a/libstdc++-v3/include/std/std_functional.h b/libstdc++-v3/include/std/std_functional.h deleted file mode 100644 index feadaa2252a..00000000000 --- a/libstdc++-v3/include/std/std_functional.h +++ /dev/null @@ -1,57 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2001, 2002 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/* - * Copyright (c) 1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -/** @file include/functional - * This is a Standard C++ Library header. - */ - -#ifndef _GLIBCXX_FUNCTIONAL -#define _GLIBCXX_FUNCTIONAL 1 - -#pragma GCC system_header - -#include -#include -#include - -#endif /* _GLIBCXX_FUNCTIONAL */ diff --git a/libstdc++-v3/include/std/std_iomanip.h b/libstdc++-v3/include/std/std_iomanip.h deleted file mode 100644 index 13b21d579bd..00000000000 --- a/libstdc++-v3/include/std/std_iomanip.h +++ /dev/null @@ -1,300 +0,0 @@ -// Standard stream manipulators -*- C++ -*- - -// Copyright (C) 1997, 1998, 1999, 2001, 2002, 2003, 2005 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/** @file iomanip - * This is a Standard C++ Library header. - */ - -// -// ISO C++ 14882: 27.6.3 Standard manipulators -// - -#ifndef _GLIBCXX_IOMANIP -#define _GLIBCXX_IOMANIP 1 - -#pragma GCC system_header - -#include -#include -#include - -_GLIBCXX_BEGIN_NAMESPACE(std) - - // [27.6.3] standard manipulators - // Also see DR 183. - - struct _Resetiosflags { ios_base::fmtflags _M_mask; }; - - /** - * @brief Manipulator for @c setf. - * @param mask A format flags mask. - * - * Sent to a stream object, this manipulator resets the specified flags, - * via @e stream.setf(0,mask). - */ - inline _Resetiosflags - resetiosflags(ios_base::fmtflags __mask) - { - _Resetiosflags __x; - __x._M_mask = __mask; - return __x; - } - - template - inline basic_istream<_CharT,_Traits>& - operator>>(basic_istream<_CharT,_Traits>& __is, _Resetiosflags __f) - { - __is.setf(ios_base::fmtflags(0), __f._M_mask); - return __is; - } - - template - inline basic_ostream<_CharT,_Traits>& - operator<<(basic_ostream<_CharT,_Traits>& __os, _Resetiosflags __f) - { - __os.setf(ios_base::fmtflags(0), __f._M_mask); - return __os; - } - - - struct _Setiosflags { ios_base::fmtflags _M_mask; }; - - /** - * @brief Manipulator for @c setf. - * @param mask A format flags mask. - * - * Sent to a stream object, this manipulator sets the format flags - * to @a mask. - */ - inline _Setiosflags - setiosflags(ios_base::fmtflags __mask) - { - _Setiosflags __x; - __x._M_mask = __mask; - return __x; - } - - template - inline basic_istream<_CharT,_Traits>& - operator>>(basic_istream<_CharT,_Traits>& __is, _Setiosflags __f) - { - __is.setf(__f._M_mask); - return __is; - } - - template - inline basic_ostream<_CharT,_Traits>& - operator<<(basic_ostream<_CharT,_Traits>& __os, _Setiosflags __f) - { - __os.setf(__f._M_mask); - return __os; - } - - - struct _Setbase { int _M_base; }; - - /** - * @brief Manipulator for @c setf. - * @param base A numeric base. - * - * Sent to a stream object, this manipulator changes the - * @c ios_base::basefield flags to @c oct, @c dec, or @c hex when @a base - * is 8, 10, or 16, accordingly, and to 0 if @a base is any other value. - */ - inline _Setbase - setbase(int __base) - { - _Setbase __x; - __x._M_base = __base; - return __x; - } - - template - inline basic_istream<_CharT,_Traits>& - operator>>(basic_istream<_CharT,_Traits>& __is, _Setbase __f) - { - __is.setf(__f._M_base == 8 ? ios_base::oct : - __f._M_base == 10 ? ios_base::dec : - __f._M_base == 16 ? ios_base::hex : - ios_base::fmtflags(0), ios_base::basefield); - return __is; - } - - template - inline basic_ostream<_CharT,_Traits>& - operator<<(basic_ostream<_CharT,_Traits>& __os, _Setbase __f) - { - __os.setf(__f._M_base == 8 ? ios_base::oct : - __f._M_base == 10 ? ios_base::dec : - __f._M_base == 16 ? ios_base::hex : - ios_base::fmtflags(0), ios_base::basefield); - return __os; - } - - - template - struct _Setfill { _CharT _M_c; }; - - /** - * @brief Manipulator for @c fill. - * @param c The new fill character. - * - * Sent to a stream object, this manipulator calls @c fill(c) for that - * object. - */ - template - inline _Setfill<_CharT> - setfill(_CharT __c) - { - _Setfill<_CharT> __x; - __x._M_c = __c; - return __x; - } - - template - inline basic_istream<_CharT,_Traits>& - operator>>(basic_istream<_CharT,_Traits>& __is, _Setfill<_CharT> __f) - { - __is.fill(__f._M_c); - return __is; - } - - template - inline basic_ostream<_CharT,_Traits>& - operator<<(basic_ostream<_CharT,_Traits>& __os, _Setfill<_CharT> __f) - { - __os.fill(__f._M_c); - return __os; - } - - - struct _Setprecision { int _M_n; }; - - /** - * @brief Manipulator for @c precision. - * @param n The new precision. - * - * Sent to a stream object, this manipulator calls @c precision(n) for - * that object. - */ - inline _Setprecision - setprecision(int __n) - { - _Setprecision __x; - __x._M_n = __n; - return __x; - } - - template - inline basic_istream<_CharT,_Traits>& - operator>>(basic_istream<_CharT,_Traits>& __is, _Setprecision __f) - { - __is.precision(__f._M_n); - return __is; - } - - template - inline basic_ostream<_CharT,_Traits>& - operator<<(basic_ostream<_CharT,_Traits>& __os, _Setprecision __f) - { - __os.precision(__f._M_n); - return __os; - } - - - struct _Setw { int _M_n; }; - - /** - * @brief Manipulator for @c width. - * @param n The new width. - * - * Sent to a stream object, this manipulator calls @c width(n) for - * that object. - */ - inline _Setw - setw(int __n) - { - _Setw __x; - __x._M_n = __n; - return __x; - } - - template - inline basic_istream<_CharT,_Traits>& - operator>>(basic_istream<_CharT,_Traits>& __is, _Setw __f) - { - __is.width(__f._M_n); - return __is; - } - - template - inline basic_ostream<_CharT,_Traits>& - operator<<(basic_ostream<_CharT,_Traits>& __os, _Setw __f) - { - __os.width(__f._M_n); - return __os; - } - - // Inhibit implicit instantiations for required instantiations, - // which are defined via explicit instantiations elsewhere. - // NB: This syntax is a GNU extension. -#if _GLIBCXX_EXTERN_TEMPLATE - extern template ostream& operator<<(ostream&, _Setfill); - extern template ostream& operator<<(ostream&, _Setiosflags); - extern template ostream& operator<<(ostream&, _Resetiosflags); - extern template ostream& operator<<(ostream&, _Setbase); - extern template ostream& operator<<(ostream&, _Setprecision); - extern template ostream& operator<<(ostream&, _Setw); - extern template istream& operator>>(istream&, _Setfill); - extern template istream& operator>>(istream&, _Setiosflags); - extern template istream& operator>>(istream&, _Resetiosflags); - extern template istream& operator>>(istream&, _Setbase); - extern template istream& operator>>(istream&, _Setprecision); - extern template istream& operator>>(istream&, _Setw); - -#ifdef _GLIBCXX_USE_WCHAR_T - extern template wostream& operator<<(wostream&, _Setfill); - extern template wostream& operator<<(wostream&, _Setiosflags); - extern template wostream& operator<<(wostream&, _Resetiosflags); - extern template wostream& operator<<(wostream&, _Setbase); - extern template wostream& operator<<(wostream&, _Setprecision); - extern template wostream& operator<<(wostream&, _Setw); - extern template wistream& operator>>(wistream&, _Setfill); - extern template wistream& operator>>(wistream&, _Setiosflags); - extern template wistream& operator>>(wistream&, _Resetiosflags); - extern template wistream& operator>>(wistream&, _Setbase); - extern template wistream& operator>>(wistream&, _Setprecision); - extern template wistream& operator>>(wistream&, _Setw); -#endif -#endif - -_GLIBCXX_END_NAMESPACE - -#endif /* _GLIBCXX_IOMANIP */ diff --git a/libstdc++-v3/include/std/std_ios.h b/libstdc++-v3/include/std/std_ios.h deleted file mode 100644 index f081115e9b7..00000000000 --- a/libstdc++-v3/include/std/std_ios.h +++ /dev/null @@ -1,52 +0,0 @@ -// Iostreams base classes -*- C++ -*- - -// Copyright (C) 1997, 1998, 1999, 2001, 2002 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/** @file ios - * This is a Standard C++ Library header. - */ - -// -// ISO C++ 14882: 27.4 Iostreams base classes -// - -#ifndef _GLIBCXX_IOS -#define _GLIBCXX_IOS 1 - -#pragma GCC system_header - -#include -#include // For ios_base::failure -#include // For char_traits, streamoff, streamsize, fpos -#include // For SEEK_SET, SEEK_CUR, SEEK_END -#include // For class locale -#include // For ios_base declarations. -#include -#include - -#endif /* _GLIBCXX_IOS */ diff --git a/libstdc++-v3/include/std/std_iosfwd.h b/libstdc++-v3/include/std/std_iosfwd.h deleted file mode 100644 index a4d0c3fdf19..00000000000 --- a/libstdc++-v3/include/std/std_iosfwd.h +++ /dev/null @@ -1,168 +0,0 @@ -// Forwarding declarations -*- C++ -*- - -// Copyright (C) 1997, 1998, 1999, 2001, 2002, 2003, 2005 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/** @file iosfwd - * This is a Standard C++ Library header. - */ - -// -// ISO C++ 14882: 27.2 Forward declarations -// - -#ifndef _GLIBCXX_IOSFWD -#define _GLIBCXX_IOSFWD 1 - -#pragma GCC system_header - -#include -#include -#include -#include // For isspace, etc. -#include // For string forward declarations. -#include -#include - -_GLIBCXX_BEGIN_NAMESPACE(std) - - template > - class basic_ios; - - template > - class basic_streambuf; - - template > - class basic_istream; - - template > - class basic_ostream; - - template > - class basic_iostream; - - template, - typename _Alloc = allocator<_CharT> > - class basic_stringbuf; - - template, - typename _Alloc = allocator<_CharT> > - class basic_istringstream; - - template, - typename _Alloc = allocator<_CharT> > - class basic_ostringstream; - - template, - typename _Alloc = allocator<_CharT> > - class basic_stringstream; - - template > - class basic_filebuf; - - template > - class basic_ifstream; - - template > - class basic_ofstream; - - template > - class basic_fstream; - - template > - class istreambuf_iterator; - - template > - class ostreambuf_iterator; - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // Not included. (??? Apparently no LWG number?) - class ios_base; - - /** - * @defgroup s27_2_iosfwd I/O Forward Declarations - * - * Nearly all of the I/O classes are parameterized on the type of - * characters they read and write. (The major exception is ios_base at - * the top of the hierarchy.) This is a change from pre-Standard - * streams, which were not templates. - * - * For ease of use and compatibility, all of the basic_* I/O-related - * classes are given typedef names for both of the builtin character - * widths (wide and narrow). The typedefs are the same as the - * pre-Standard names, for example: - * - * @code - * typedef basic_ifstream ifstream; - * @endcode - * - * Because properly forward-declaring these classes can be difficult, you - * should not do it yourself. Instead, include the <iosfwd> - * header, which contains only declarations of all the I/O classes as - * well as the typedefs. Trying to forward-declare the typedefs - * themselves (e.g., "class ostream;") is not valid ISO C++. - * - * For more specific declarations, see - * http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#10 - * - * @{ - */ - typedef basic_ios ios; ///< @isiosfwd - typedef basic_streambuf streambuf; ///< @isiosfwd - typedef basic_istream istream; ///< @isiosfwd - typedef basic_ostream ostream; ///< @isiosfwd - typedef basic_iostream iostream; ///< @isiosfwd - typedef basic_stringbuf stringbuf; ///< @isiosfwd - typedef basic_istringstream istringstream; ///< @isiosfwd - typedef basic_ostringstream ostringstream; ///< @isiosfwd - typedef basic_stringstream stringstream; ///< @isiosfwd - typedef basic_filebuf filebuf; ///< @isiosfwd - typedef basic_ifstream ifstream; ///< @isiosfwd - typedef basic_ofstream ofstream; ///< @isiosfwd - typedef basic_fstream fstream; ///< @isiosfwd - -#ifdef _GLIBCXX_USE_WCHAR_T - typedef basic_ios wios; ///< @isiosfwd - typedef basic_streambuf wstreambuf; ///< @isiosfwd - typedef basic_istream wistream; ///< @isiosfwd - typedef basic_ostream wostream; ///< @isiosfwd - typedef basic_iostream wiostream; ///< @isiosfwd - typedef basic_stringbuf wstringbuf; ///< @isiosfwd - typedef basic_istringstream wistringstream; ///< @isiosfwd - typedef basic_ostringstream wostringstream; ///< @isiosfwd - typedef basic_stringstream wstringstream; ///< @isiosfwd - typedef basic_filebuf wfilebuf; ///< @isiosfwd - typedef basic_ifstream wifstream; ///< @isiosfwd - typedef basic_ofstream wofstream; ///< @isiosfwd - typedef basic_fstream wfstream; ///< @isiosfwd -#endif - /** @} */ - -_GLIBCXX_END_NAMESPACE - -#endif /* _GLIBCXX_IOSFWD */ diff --git a/libstdc++-v3/include/std/std_iostream.h b/libstdc++-v3/include/std/std_iostream.h deleted file mode 100644 index 0ff0da2177f..00000000000 --- a/libstdc++-v3/include/std/std_iostream.h +++ /dev/null @@ -1,81 +0,0 @@ -// Standard iostream objects -*- C++ -*- - -// Copyright (C) 1997, 1998, 1999, 2001, 2002, 2005 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/** @file iostream - * This is a Standard C++ Library header. - */ - -// -// ISO C++ 14882: 27.3 Standard iostream objects -// - -#ifndef _GLIBCXX_IOSTREAM -#define _GLIBCXX_IOSTREAM 1 - -#pragma GCC system_header - -#include -#include -#include - -_GLIBCXX_BEGIN_NAMESPACE(std) - - /** - * @name Standard Stream Objects - * - * The <iostream> header declares the eight standard stream - * objects. For other declarations, see - * http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#10 and the - * @link s27_2_iosfwd I/O forward declarations @endlink - * - * They are required by default to cooperate with the global C library's - * @c FILE streams, and to be available during program startup and - * termination. For more information, see the HOWTO linked to above. - */ - //@{ - extern istream cin; ///< Linked to standard input - extern ostream cout; ///< Linked to standard output - extern ostream cerr; ///< Linked to standard error (unbuffered) - extern ostream clog; ///< Linked to standard error (buffered) - -#ifdef _GLIBCXX_USE_WCHAR_T - extern wistream wcin; ///< Linked to standard input - extern wostream wcout; ///< Linked to standard output - extern wostream wcerr; ///< Linked to standard error (unbuffered) - extern wostream wclog; ///< Linked to standard error (buffered) -#endif - //@} - - // For construction of filebuffers for cout, cin, cerr, clog et. al. - static ios_base::Init __ioinit; - -_GLIBCXX_END_NAMESPACE - -#endif /* _GLIBCXX_IOSTREAM */ diff --git a/libstdc++-v3/include/std/std_istream.h b/libstdc++-v3/include/std/std_istream.h deleted file mode 100644 index e81c9cd9252..00000000000 --- a/libstdc++-v3/include/std/std_istream.h +++ /dev/null @@ -1,848 +0,0 @@ -// Input streams -*- C++ -*- - -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -// -// ISO C++ 14882: 27.6.1 Input streams -// - -/** @file istream - * This is a Standard C++ Library header. - */ - -#ifndef _GLIBCXX_ISTREAM -#define _GLIBCXX_ISTREAM 1 - -#pragma GCC system_header - -#include -#include // For numeric_limits - -_GLIBCXX_BEGIN_NAMESPACE(std) - - // [27.6.1.1] Template class basic_istream - /** - * @brief Controlling input. - * - * This is the base class for all input streams. It provides text - * formatting of all builtin types, and communicates with any class - * derived from basic_streambuf to do the actual input. - */ - template - class basic_istream : virtual public basic_ios<_CharT, _Traits> - { - public: - // Types (inherited from basic_ios (27.4.4)): - typedef _CharT char_type; - typedef typename _Traits::int_type int_type; - typedef typename _Traits::pos_type pos_type; - typedef typename _Traits::off_type off_type; - typedef _Traits traits_type; - - // Non-standard Types: - typedef basic_streambuf<_CharT, _Traits> __streambuf_type; - typedef basic_ios<_CharT, _Traits> __ios_type; - typedef basic_istream<_CharT, _Traits> __istream_type; - typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> > - __num_get_type; - typedef ctype<_CharT> __ctype_type; - - template - friend basic_istream<_CharT2, _Traits2>& - operator>>(basic_istream<_CharT2, _Traits2>&, _CharT2&); - - template - friend basic_istream<_CharT2, _Traits2>& - operator>>(basic_istream<_CharT2, _Traits2>&, _CharT2*); - - protected: - // Data Members: - /** - * @if maint - * The number of characters extracted in the previous unformatted - * function; see gcount(). - * @endif - */ - streamsize _M_gcount; - - public: - // [27.6.1.1.1] constructor/destructor - /** - * @brief Base constructor. - * - * This ctor is almost never called by the user directly, rather from - * derived classes' initialization lists, which pass a pointer to - * their own stream buffer. - */ - explicit - basic_istream(__streambuf_type* __sb): _M_gcount(streamsize(0)) - { this->init(__sb); } - - /** - * @brief Base destructor. - * - * This does very little apart from providing a virtual base dtor. - */ - virtual - ~basic_istream() - { _M_gcount = streamsize(0); } - - // [27.6.1.1.2] prefix/suffix - class sentry; - friend class sentry; - - // [27.6.1.2] formatted input - // [27.6.1.2.3] basic_istream::operator>> - //@{ - /** - * @brief Interface for manipulators. - * - * Manuipulators such as @c std::ws and @c std::dec use these - * functions in constructs like "std::cin >> std::ws". For more - * information, see the iomanip header. - */ - __istream_type& - operator>>(__istream_type& (*__pf)(__istream_type&)) - { return __pf(*this); } - - __istream_type& - operator>>(__ios_type& (*__pf)(__ios_type&)) - { - __pf(*this); - return *this; - } - - __istream_type& - operator>>(ios_base& (*__pf)(ios_base&)) - { - __pf(*this); - return *this; - } - //@} - - // [27.6.1.2.2] arithmetic extractors - /** - * @name Arithmetic Extractors - * - * All the @c operator>> functions (aka formatted input - * functions) have some common behavior. Each starts by - * constructing a temporary object of type std::basic_istream::sentry - * with the second argument (noskipws) set to false. This has several - * effects, concluding with the setting of a status flag; see the - * sentry documentation for more. - * - * If the sentry status is good, the function tries to extract - * whatever data is appropriate for the type of the argument. - * - * If an exception is thrown during extraction, ios_base::badbit - * will be turned on in the stream's error state without causing an - * ios_base::failure to be thrown. The original exception will then - * be rethrown. - */ - //@{ - /** - * @brief Basic arithmetic extractors - * @param A variable of builtin type. - * @return @c *this if successful - * - * These functions use the stream's current locale (specifically, the - * @c num_get facet) to parse the input data. - */ - __istream_type& - operator>>(bool& __n) - { return _M_extract(__n); } - - __istream_type& - operator>>(short& __n); - - __istream_type& - operator>>(unsigned short& __n) - { return _M_extract(__n); } - - __istream_type& - operator>>(int& __n); - - __istream_type& - operator>>(unsigned int& __n) - { return _M_extract(__n); } - - __istream_type& - operator>>(long& __n) - { return _M_extract(__n); } - - __istream_type& - operator>>(unsigned long& __n) - { return _M_extract(__n); } - -#ifdef _GLIBCXX_USE_LONG_LONG - __istream_type& - operator>>(long long& __n) - { return _M_extract(__n); } - - __istream_type& - operator>>(unsigned long long& __n) - { return _M_extract(__n); } -#endif - - __istream_type& - operator>>(float& __f) - { return _M_extract(__f); } - - __istream_type& - operator>>(double& __f) - { return _M_extract(__f); } - - __istream_type& - operator>>(long double& __f) - { return _M_extract(__f); } - - __istream_type& - operator>>(void*& __p) - { return _M_extract(__p); } - - /** - * @brief Extracting into another streambuf. - * @param sb A pointer to a streambuf - * - * This function behaves like one of the basic arithmetic extractors, - * in that it also constructs a sentry object and has the same error - * handling behavior. - * - * If @a sb is NULL, the stream will set failbit in its error state. - * - * Characters are extracted from this stream and inserted into the - * @a sb streambuf until one of the following occurs: - * - * - the input stream reaches end-of-file, - * - insertion into the output buffer fails (in this case, the - * character that would have been inserted is not extracted), or - * - an exception occurs (and in this case is caught) - * - * If the function inserts no characters, failbit is set. - */ - __istream_type& - operator>>(__streambuf_type* __sb); - //@} - - // [27.6.1.3] unformatted input - /** - * @brief Character counting - * @return The number of characters extracted by the previous - * unformatted input function dispatched for this stream. - */ - streamsize - gcount() const - { return _M_gcount; } - - /** - * @name Unformatted Input Functions - * - * All the unformatted input functions have some common behavior. - * Each starts by constructing a temporary object of type - * std::basic_istream::sentry with the second argument (noskipws) - * set to true. This has several effects, concluding with the - * setting of a status flag; see the sentry documentation for more. - * - * If the sentry status is good, the function tries to extract - * whatever data is appropriate for the type of the argument. - * - * The number of characters extracted is stored for later retrieval - * by gcount(). - * - * If an exception is thrown during extraction, ios_base::badbit - * will be turned on in the stream's error state without causing an - * ios_base::failure to be thrown. The original exception will then - * be rethrown. - */ - //@{ - /** - * @brief Simple extraction. - * @return A character, or eof(). - * - * Tries to extract a character. If none are available, sets failbit - * and returns traits::eof(). - */ - int_type - get(); - - /** - * @brief Simple extraction. - * @param c The character in which to store data. - * @return *this - * - * Tries to extract a character and store it in @a c. If none are - * available, sets failbit and returns traits::eof(). - * - * @note This function is not overloaded on signed char and - * unsigned char. - */ - __istream_type& - get(char_type& __c); - - /** - * @brief Simple multiple-character extraction. - * @param s Pointer to an array. - * @param n Maximum number of characters to store in @a s. - * @param delim A "stop" character. - * @return *this - * - * Characters are extracted and stored into @a s until one of the - * following happens: - * - * - @c n-1 characters are stored - * - the input sequence reaches EOF - * - the next character equals @a delim, in which case the character - * is not extracted - * - * If no characters are stored, failbit is set in the stream's error - * state. - * - * In any case, a null character is stored into the next location in - * the array. - * - * @note This function is not overloaded on signed char and - * unsigned char. - */ - __istream_type& - get(char_type* __s, streamsize __n, char_type __delim); - - /** - * @brief Simple multiple-character extraction. - * @param s Pointer to an array. - * @param n Maximum number of characters to store in @a s. - * @return *this - * - * Returns @c get(s,n,widen('\n')). - */ - __istream_type& - get(char_type* __s, streamsize __n) - { return this->get(__s, __n, this->widen('\n')); } - - /** - * @brief Extraction into another streambuf. - * @param sb A streambuf in which to store data. - * @param delim A "stop" character. - * @return *this - * - * Characters are extracted and inserted into @a sb until one of the - * following happens: - * - * - the input sequence reaches EOF - * - insertion into the output buffer fails (in this case, the - * character that would have been inserted is not extracted) - * - the next character equals @a delim (in this case, the character - * is not extracted) - * - an exception occurs (and in this case is caught) - * - * If no characters are stored, failbit is set in the stream's error - * state. - */ - __istream_type& - get(__streambuf_type& __sb, char_type __delim); - - /** - * @brief Extraction into another streambuf. - * @param sb A streambuf in which to store data. - * @return *this - * - * Returns @c get(sb,widen('\n')). - */ - __istream_type& - get(__streambuf_type& __sb) - { return this->get(__sb, this->widen('\n')); } - - /** - * @brief String extraction. - * @param s A character array in which to store the data. - * @param n Maximum number of characters to extract. - * @param delim A "stop" character. - * @return *this - * - * Extracts and stores characters into @a s until one of the - * following happens. Note that these criteria are required to be - * tested in the order listed here, to allow an input line to exactly - * fill the @a s array without setting failbit. - * - * -# the input sequence reaches end-of-file, in which case eofbit - * is set in the stream error state - * -# the next character equals @c delim, in which case the character - * is extracted (and therefore counted in @c gcount()) but not stored - * -# @c n-1 characters are stored, in which case failbit is set - * in the stream error state - * - * If no characters are extracted, failbit is set. (An empty line of - * input should therefore not cause failbit to be set.) - * - * In any case, a null character is stored in the next location in - * the array. - */ - __istream_type& - getline(char_type* __s, streamsize __n, char_type __delim); - - /** - * @brief String extraction. - * @param s A character array in which to store the data. - * @param n Maximum number of characters to extract. - * @return *this - * - * Returns @c getline(s,n,widen('\n')). - */ - __istream_type& - getline(char_type* __s, streamsize __n) - { return this->getline(__s, __n, this->widen('\n')); } - - /** - * @brief Discarding characters - * @param n Number of characters to discard. - * @param delim A "stop" character. - * @return *this - * - * Extracts characters and throws them away until one of the - * following happens: - * - if @a n @c != @c std::numeric_limits::max(), @a n - * characters are extracted - * - the input sequence reaches end-of-file - * - the next character equals @a delim (in this case, the character - * is extracted); note that this condition will never occur if - * @a delim equals @c traits::eof(). - * - * NB: Provide three overloads, instead of the single function - * (with defaults) mandated by the Standard: this leads to a - * better performing implementation, while still conforming to - * the Standard. - */ - __istream_type& - ignore(); - - __istream_type& - ignore(streamsize __n); - - __istream_type& - ignore(streamsize __n, int_type __delim); - - /** - * @brief Looking ahead in the stream - * @return The next character, or eof(). - * - * If, after constructing the sentry object, @c good() is false, - * returns @c traits::eof(). Otherwise reads but does not extract - * the next input character. - */ - int_type - peek(); - - /** - * @brief Extraction without delimiters. - * @param s A character array. - * @param n Maximum number of characters to store. - * @return *this - * - * If the stream state is @c good(), extracts characters and stores - * them into @a s until one of the following happens: - * - @a n characters are stored - * - the input sequence reaches end-of-file, in which case the error - * state is set to @c failbit|eofbit. - * - * @note This function is not overloaded on signed char and - * unsigned char. - */ - __istream_type& - read(char_type* __s, streamsize __n); - - /** - * @brief Extraction until the buffer is exhausted, but no more. - * @param s A character array. - * @param n Maximum number of characters to store. - * @return The number of characters extracted. - * - * Extracts characters and stores them into @a s depending on the - * number of characters remaining in the streambuf's buffer, - * @c rdbuf()->in_avail(), called @c A here: - * - if @c A @c == @c -1, sets eofbit and extracts no characters - * - if @c A @c == @c 0, extracts no characters - * - if @c A @c > @c 0, extracts @c min(A,n) - * - * The goal is to empty the current buffer, and to not request any - * more from the external input sequence controlled by the streambuf. - */ - streamsize - readsome(char_type* __s, streamsize __n); - - /** - * @brief Unextracting a single character. - * @param c The character to push back into the input stream. - * @return *this - * - * If @c rdbuf() is not null, calls @c rdbuf()->sputbackc(c). - * - * If @c rdbuf() is null or if @c sputbackc() fails, sets badbit in - * the error state. - * - * @note Since no characters are extracted, the next call to - * @c gcount() will return 0, as required by DR 60. - */ - __istream_type& - putback(char_type __c); - - /** - * @brief Unextracting the previous character. - * @return *this - * - * If @c rdbuf() is not null, calls @c rdbuf()->sungetc(c). - * - * If @c rdbuf() is null or if @c sungetc() fails, sets badbit in - * the error state. - * - * @note Since no characters are extracted, the next call to - * @c gcount() will return 0, as required by DR 60. - */ - __istream_type& - unget(); - - /** - * @brief Synchronizing the stream buffer. - * @return 0 on success, -1 on failure - * - * If @c rdbuf() is a null pointer, returns -1. - * - * Otherwise, calls @c rdbuf()->pubsync(), and if that returns -1, - * sets badbit and returns -1. - * - * Otherwise, returns 0. - * - * @note This function does not count the number of characters - * extracted, if any, and therefore does not affect the next - * call to @c gcount(). - */ - int - sync(); - - /** - * @brief Getting the current read position. - * @return A file position object. - * - * If @c fail() is not false, returns @c pos_type(-1) to indicate - * failure. Otherwise returns @c rdbuf()->pubseekoff(0,cur,in). - * - * @note This function does not count the number of characters - * extracted, if any, and therefore does not affect the next - * call to @c gcount(). - */ - pos_type - tellg(); - - /** - * @brief Changing the current read position. - * @param pos A file position object. - * @return *this - * - * If @c fail() is not true, calls @c rdbuf()->pubseekpos(pos). If - * that function fails, sets failbit. - * - * @note This function does not count the number of characters - * extracted, if any, and therefore does not affect the next - * call to @c gcount(). - */ - __istream_type& - seekg(pos_type); - - /** - * @brief Changing the current read position. - * @param off A file offset object. - * @param dir The direction in which to seek. - * @return *this - * - * If @c fail() is not true, calls @c rdbuf()->pubseekoff(off,dir). - * If that function fails, sets failbit. - * - * @note This function does not count the number of characters - * extracted, if any, and therefore does not affect the next - * call to @c gcount(). - */ - __istream_type& - seekg(off_type, ios_base::seekdir); - //@} - - protected: - explicit - basic_istream(): _M_gcount(streamsize(0)) { } - - template - __istream_type& - _M_extract(_ValueT& __v); - }; - - // Explicit specialization declarations, defined in src/istream.cc. - template<> - basic_istream& - basic_istream:: - getline(char_type* __s, streamsize __n, char_type __delim); - - template<> - basic_istream& - basic_istream:: - ignore(streamsize __n); - - template<> - basic_istream& - basic_istream:: - ignore(streamsize __n, int_type __delim); - -#ifdef _GLIBCXX_USE_WCHAR_T - template<> - basic_istream& - basic_istream:: - getline(char_type* __s, streamsize __n, char_type __delim); - - template<> - basic_istream& - basic_istream:: - ignore(streamsize __n); - - template<> - basic_istream& - basic_istream:: - ignore(streamsize __n, int_type __delim); -#endif - - /** - * @brief Performs setup work for input streams. - * - * Objects of this class are created before all of the standard - * extractors are run. It is responsible for "exception-safe prefix and - * suffix operations," although only prefix actions are currently required - * by the standard. Additional actions may be added by the - * implementation, and we list them in - * http://gcc.gnu.org/onlinedocs/libstdc++/17_intro/howto.html#5 - * under [27.6] notes. - */ - template - class basic_istream<_CharT, _Traits>::sentry - { - public: - /// Easy access to dependant types. - typedef _Traits traits_type; - typedef basic_streambuf<_CharT, _Traits> __streambuf_type; - typedef basic_istream<_CharT, _Traits> __istream_type; - typedef typename __istream_type::__ctype_type __ctype_type; - typedef typename _Traits::int_type __int_type; - - /** - * @brief The constructor performs all the work. - * @param is The input stream to guard. - * @param noskipws Whether to consume whitespace or not. - * - * If the stream state is good (@a is.good() is true), then the - * following actions are performed, otherwise the sentry state is - * false ("not okay") and failbit is set in the stream state. - * - * The sentry's preparatory actions are: - * - * -# if the stream is tied to an output stream, @c is.tie()->flush() - * is called to synchronize the output sequence - * -# if @a noskipws is false, and @c ios_base::skipws is set in - * @c is.flags(), the sentry extracts and discards whitespace - * characters from the stream. The currently imbued locale is - * used to determine whether each character is whitespace. - * - * If the stream state is still good, then the sentry state becomes - * true ("okay"). - */ - explicit - sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws = false); - - /** - * @brief Quick status checking. - * @return The sentry state. - * - * For ease of use, sentries may be converted to booleans. The - * return value is that of the sentry state (true == okay). - */ - operator bool() const - { return _M_ok; } - - private: - bool _M_ok; - }; - - // [27.6.1.2.3] character extraction templates - //@{ - /** - * @brief Character extractors - * @param in An input stream. - * @param c A character reference. - * @return in - * - * Behaves like one of the formatted arithmetic extractors described in - * std::basic_istream. After constructing a sentry object with good - * status, this function extracts a character (if one is available) and - * stores it in @a c. Otherwise, sets failbit in the input stream. - */ - template - basic_istream<_CharT, _Traits>& - operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c); - - template - inline basic_istream& - operator>>(basic_istream& __in, unsigned char& __c) - { return (__in >> reinterpret_cast(__c)); } - - template - inline basic_istream& - operator>>(basic_istream& __in, signed char& __c) - { return (__in >> reinterpret_cast(__c)); } - //@} - - //@{ - /** - * @brief Character string extractors - * @param in An input stream. - * @param s A pointer to a character array. - * @return in - * - * Behaves like one of the formatted arithmetic extractors described in - * std::basic_istream. After constructing a sentry object with good - * status, this function extracts up to @c n characters and stores them - * into the array starting at @a s. @c n is defined as: - * - * - if @c width() is greater than zero, @c n is width() - * - otherwise @c n is "the number of elements of the largest array of - * @c char_type that can store a terminating @c eos." [27.6.1.2.3]/6 - * - * Characters are extracted and stored until one of the following happens: - * - @c n-1 characters are stored - * - EOF is reached - * - the next character is whitespace according to the current locale - * - the next character is a null byte (i.e., @c charT() ) - * - * @c width(0) is then called for the input stream. - * - * If no characters are extracted, sets failbit. - */ - template - basic_istream<_CharT, _Traits>& - operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s); - - // Explicit specialization declaration, defined in src/istream.cc. - template<> - basic_istream& - operator>>(basic_istream& __in, char* __s); - - template - inline basic_istream& - operator>>(basic_istream& __in, unsigned char* __s) - { return (__in >> reinterpret_cast(__s)); } - - template - inline basic_istream& - operator>>(basic_istream& __in, signed char* __s) - { return (__in >> reinterpret_cast(__s)); } - //@} - - // 27.6.1.5 Template class basic_iostream - /** - * @brief Merging istream and ostream capabilities. - * - * This class multiply inherits from the input and output stream classes - * simply to provide a single interface. - */ - template - class basic_iostream - : public basic_istream<_CharT, _Traits>, - public basic_ostream<_CharT, _Traits> - { - public: - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 271. basic_iostream missing typedefs - // Types (inherited): - typedef _CharT char_type; - typedef typename _Traits::int_type int_type; - typedef typename _Traits::pos_type pos_type; - typedef typename _Traits::off_type off_type; - typedef _Traits traits_type; - - // Non-standard Types: - typedef basic_istream<_CharT, _Traits> __istream_type; - typedef basic_ostream<_CharT, _Traits> __ostream_type; - - /** - * @brief Constructor does nothing. - * - * Both of the parent classes are initialized with the same - * streambuf pointer passed to this constructor. - */ - explicit - basic_iostream(basic_streambuf<_CharT, _Traits>* __sb) - : __istream_type(), __ostream_type() - { this->init(__sb); } - - /** - * @brief Destructor does nothing. - */ - virtual - ~basic_iostream() { } - - protected: - explicit - basic_iostream() : __istream_type(), __ostream_type() - { } - }; - - // [27.6.1.4] standard basic_istream manipulators - /** - * @brief Quick and easy way to eat whitespace - * - * This manipulator extracts whitespace characters, stopping when the - * next character is non-whitespace, or when the input sequence is empty. - * If the sequence is empty, @c eofbit is set in the stream, but not - * @c failbit. - * - * The current locale is used to distinguish whitespace characters. - * - * Example: - * @code - * MyClass mc; - * - * std::cin >> std::ws >> mc; - * @endcode - * will skip leading whitespace before calling operator>> on cin and your - * object. Note that the same effect can be achieved by creating a - * std::basic_istream::sentry inside your definition of operator>>. - */ - template - basic_istream<_CharT, _Traits>& - ws(basic_istream<_CharT, _Traits>& __is); - -_GLIBCXX_END_NAMESPACE - -#ifndef _GLIBCXX_EXPORT_TEMPLATE -# include -#endif - -#endif /* _GLIBCXX_ISTREAM */ diff --git a/libstdc++-v3/include/std/std_iterator.h b/libstdc++-v3/include/std/std_iterator.h deleted file mode 100644 index f0317b44a7c..00000000000 --- a/libstdc++-v3/include/std/std_iterator.h +++ /dev/null @@ -1,75 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2001, 2002 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file include/iterator - * This is a Standard C++ Library header. - */ - -#ifndef _GLIBCXX_ITERATOR -#define _GLIBCXX_ITERATOR 1 - -#pragma GCC system_header - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif /* _GLIBCXX_ITERATOR */ diff --git a/libstdc++-v3/include/std/std_limits.h b/libstdc++-v3/include/std/std_limits.h deleted file mode 100644 index d1211fdb59e..00000000000 --- a/libstdc++-v3/include/std/std_limits.h +++ /dev/null @@ -1,1160 +0,0 @@ -// The template and inlines for the numeric_limits classes. -*- C++ -*- - -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/** @file limits - * This is a Standard C++ Library header. - */ - -// Note: this is not a conforming implementation. -// Written by Gabriel Dos Reis - -// -// ISO 14882:1998 -// 18.2.1 -// - -#ifndef _GLIBCXX_NUMERIC_LIMITS -#define _GLIBCXX_NUMERIC_LIMITS 1 - -#pragma GCC system_header - -#include - -// -// The numeric_limits<> traits document implementation-defined aspects -// of fundamental arithmetic data types (integers and floating points). -// From Standard C++ point of view, there are 13 such types: -// * integers -// bool (1) -// char, signed char, unsigned char (3) -// short, unsigned short (2) -// int, unsigned (2) -// long, unsigned long (2) -// -// * floating points -// float (1) -// double (1) -// long double (1) -// -// GNU C++ undertstands (where supported by the host C-library) -// * integer -// long long, unsigned long long (2) -// -// which brings us to 15 fundamental arithmetic data types in GNU C++. -// -// -// Since a numeric_limits<> is a bit tricky to get right, we rely on -// an interface composed of macros which should be defined in config/os -// or config/cpu when they differ from the generic (read arbitrary) -// definitions given here. -// - -// These values can be overridden in the target configuration file. -// The default values are appropriate for many 32-bit targets. - -// GCC only intrinsicly supports modulo integral types. The only remaining -// integral exceptional values is division by zero. Only targets that do not -// signal division by zero in some "hard to ignore" way should use false. -#ifndef __glibcxx_integral_traps -# define __glibcxx_integral_traps true -#endif - -// float -// - -// Default values. Should be overriden in configuration files if necessary. - -#ifndef __glibcxx_float_has_denorm_loss -# define __glibcxx_float_has_denorm_loss false -#endif -#ifndef __glibcxx_float_traps -# define __glibcxx_float_traps false -#endif -#ifndef __glibcxx_float_tinyness_before -# define __glibcxx_float_tinyness_before false -#endif - -// double - -// Default values. Should be overriden in configuration files if necessary. - -#ifndef __glibcxx_double_has_denorm_loss -# define __glibcxx_double_has_denorm_loss false -#endif -#ifndef __glibcxx_double_traps -# define __glibcxx_double_traps false -#endif -#ifndef __glibcxx_double_tinyness_before -# define __glibcxx_double_tinyness_before false -#endif - -// long double - -// Default values. Should be overriden in configuration files if necessary. - -#ifndef __glibcxx_long_double_has_denorm_loss -# define __glibcxx_long_double_has_denorm_loss false -#endif -#ifndef __glibcxx_long_double_traps -# define __glibcxx_long_double_traps false -#endif -#ifndef __glibcxx_long_double_tinyness_before -# define __glibcxx_long_double_tinyness_before false -#endif - -// You should not need to define any macros below this point. - -#define __glibcxx_signed(T) ((T)(-1) < 0) - -#define __glibcxx_min(T) \ - (__glibcxx_signed (T) ? (T)1 << __glibcxx_digits (T) : (T)0) - -#define __glibcxx_max(T) \ - (__glibcxx_signed (T) ? ((T)1 << __glibcxx_digits (T)) - 1 : ~(T)0) - -#define __glibcxx_digits(T) \ - (sizeof(T) * __CHAR_BIT__ - __glibcxx_signed (T)) - -// The fraction 643/2136 approximates log10(2) to 7 significant digits. -#define __glibcxx_digits10(T) \ - (__glibcxx_digits (T) * 643 / 2136) - - -_GLIBCXX_BEGIN_NAMESPACE(std) - - /** - * @brief Describes the rounding style for floating-point types. - * - * This is used in the std::numeric_limits class. - */ - enum float_round_style - { - round_indeterminate = -1, ///< Self-explanatory. - round_toward_zero = 0, ///< Self-explanatory. - round_to_nearest = 1, ///< To the nearest representable value. - round_toward_infinity = 2, ///< Self-explanatory. - round_toward_neg_infinity = 3 ///< Self-explanatory. - }; - - /** - * @brief Describes the denormalization for floating-point types. - * - * These values represent the presence or absence of a variable number - * of exponent bits. This type is used in the std::numeric_limits class. - */ - enum float_denorm_style - { - /// Indeterminate at compile time whether denormalized values are allowed. - denorm_indeterminate = -1, - /// The type does not allow denormalized values. - denorm_absent = 0, - /// The type allows denormalized values. - denorm_present = 1 - }; - - /** - * @brief Part of std::numeric_limits. - * - * The @c static @c const members are usable as integral constant - * expressions. - * - * @note This is a seperate class for purposes of efficiency; you - * should only access these members as part of an instantiation - * of the std::numeric_limits class. - */ - struct __numeric_limits_base - { - /** This will be true for all fundamental types (which have - specializations), and false for everything else. */ - static const bool is_specialized = false; - - /** The number of @c radix digits that be represented without change: for - integer types, the number of non-sign bits in the mantissa; for - floating types, the number of @c radix digits in the mantissa. */ - static const int digits = 0; - /** The number of base 10 digits that can be represented without change. */ - static const int digits10 = 0; - /** True if the type is signed. */ - static const bool is_signed = false; - /** True if the type is integer. - * @if maint - * Is this supposed to be "if the type is integral"? - * @endif - */ - static const bool is_integer = false; - /** True if the type uses an exact representation. "All integer types are - exact, but not all exact types are integer. For example, rational and - fixed-exponent representations are exact but not integer." - [18.2.1.2]/15 */ - static const bool is_exact = false; - /** For integer types, specifies the base of the representation. For - floating types, specifies the base of the exponent representation. */ - static const int radix = 0; - - /** The minimum negative integer such that @c radix raised to the power of - (one less than that integer) is a normalized floating point number. */ - static const int min_exponent = 0; - /** The minimum negative integer such that 10 raised to that power is in - the range of normalized floating point numbers. */ - static const int min_exponent10 = 0; - /** The maximum positive integer such that @c radix raised to the power of - (one less than that integer) is a representable finite floating point - number. */ - static const int max_exponent = 0; - /** The maximum positive integer such that 10 raised to that power is in - the range of representable finite floating point numbers. */ - static const int max_exponent10 = 0; - - /** True if the type has a representation for positive infinity. */ - static const bool has_infinity = false; - /** True if the type has a representation for a quiet (non-signaling) - "Not a Number." */ - static const bool has_quiet_NaN = false; - /** True if the type has a representation for a signaling - "Not a Number." */ - static const bool has_signaling_NaN = false; - /** See std::float_denorm_style for more information. */ - static const float_denorm_style has_denorm = denorm_absent; - /** "True if loss of accuracy is detected as a denormalization loss, - rather than as an inexact result." [18.2.1.2]/42 */ - static const bool has_denorm_loss = false; - - /** True if-and-only-if the type adheres to the IEC 559 standard, also - known as IEEE 754. (Only makes sense for floating point types.) */ - static const bool is_iec559 = false; - /** "True if the set of values representable by the type is finite. All - built-in types are bounded, this member would be false for arbitrary - precision types." [18.2.1.2]/54 */ - static const bool is_bounded = false; - /** True if the type is @e modulo, that is, if it is possible to add two - positive numbers and have a result that wraps around to a third number - that is less. Typically false for floating types, true for unsigned - integers, and true for signed integers. */ - static const bool is_modulo = false; - - /** True if trapping is implemented for this type. */ - static const bool traps = false; - /** True if tinyness is detected before rounding. (see IEC 559) */ - static const bool tinyness_before = false; - /** See std::float_round_style for more information. This is only - meaningful for floating types; integer types will all be - round_toward_zero. */ - static const float_round_style round_style = round_toward_zero; - }; - - /** - * @brief Properties of fundamental types. - * - * This class allows a program to obtain information about the - * representation of a fundamental type on a given platform. For - * non-fundamental types, the functions will return 0 and the data - * members will all be @c false. - * - * @if maint - * _GLIBCXX_RESOLVE_LIB_DEFECTS: DRs 201 and 184 (hi Gaby!) are - * noted, but not incorporated in this documented (yet). - * @endif - */ - template - struct numeric_limits : public __numeric_limits_base - { - /** The minimum finite value, or for floating types with - denormalization, the minimum positive normalized value. */ - static _Tp min() throw() { return static_cast<_Tp>(0); } - /** The maximum finite value. */ - static _Tp max() throw() { return static_cast<_Tp>(0); } - /** The @e machine @e epsilon: the difference between 1 and the least - value greater than 1 that is representable. */ - static _Tp epsilon() throw() { return static_cast<_Tp>(0); } - /** The maximum rounding error measurement (see LIA-1). */ - static _Tp round_error() throw() { return static_cast<_Tp>(0); } - /** The representation of positive infinity, if @c has_infinity. */ - static _Tp infinity() throw() { return static_cast<_Tp>(0); } - /** The representation of a quiet "Not a Number," if @c has_quiet_NaN. */ - static _Tp quiet_NaN() throw() { return static_cast<_Tp>(0); } - /** The representation of a signaling "Not a Number," if - @c has_signaling_NaN. */ - static _Tp signaling_NaN() throw() { return static_cast<_Tp>(0); } - /** The minimum positive denormalized value. For types where - @c has_denorm is false, this is the minimum positive normalized - value. */ - static _Tp denorm_min() throw() { return static_cast<_Tp>(0); } - }; - - // Now there follow 15 explicit specializations. Yes, 15. Make sure - // you get the count right. - - /// numeric_limits specialization. - template<> - struct numeric_limits - { - static const bool is_specialized = true; - - static bool min() throw() - { return false; } - static bool max() throw() - { return true; } - - static const int digits = 1; - static const int digits10 = 0; - static const bool is_signed = false; - static const bool is_integer = true; - static const bool is_exact = true; - static const int radix = 2; - static bool epsilon() throw() - { return false; } - static bool round_error() throw() - { return false; } - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static bool infinity() throw() - { return false; } - static bool quiet_NaN() throw() - { return false; } - static bool signaling_NaN() throw() - { return false; } - static bool denorm_min() throw() - { return false; } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = false; - - // It is not clear what it means for a boolean type to trap. - // This is a DR on the LWG issue list. Here, I use integer - // promotion semantics. - static const bool traps = __glibcxx_integral_traps; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; - }; - - /// numeric_limits specialization. - template<> - struct numeric_limits - { - static const bool is_specialized = true; - - static char min() throw() - { return __glibcxx_min(char); } - static char max() throw() - { return __glibcxx_max(char); } - - static const int digits = __glibcxx_digits (char); - static const int digits10 = __glibcxx_digits10 (char); - static const bool is_signed = __glibcxx_signed (char); - static const bool is_integer = true; - static const bool is_exact = true; - static const int radix = 2; - static char epsilon() throw() - { return 0; } - static char round_error() throw() - { return 0; } - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static char infinity() throw() - { return char(); } - static char quiet_NaN() throw() - { return char(); } - static char signaling_NaN() throw() - { return char(); } - static char denorm_min() throw() - { return static_cast(0); } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = true; - - static const bool traps = __glibcxx_integral_traps; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; - }; - - /// numeric_limits specialization. - template<> - struct numeric_limits - { - static const bool is_specialized = true; - - static signed char min() throw() - { return -__SCHAR_MAX__ - 1; } - static signed char max() throw() - { return __SCHAR_MAX__; } - - static const int digits = __glibcxx_digits (signed char); - static const int digits10 = __glibcxx_digits10 (signed char); - static const bool is_signed = true; - static const bool is_integer = true; - static const bool is_exact = true; - static const int radix = 2; - static signed char epsilon() throw() - { return 0; } - static signed char round_error() throw() - { return 0; } - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static signed char infinity() throw() - { return static_cast(0); } - static signed char quiet_NaN() throw() - { return static_cast(0); } - static signed char signaling_NaN() throw() - { return static_cast(0); } - static signed char denorm_min() throw() - { return static_cast(0); } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = true; - - static const bool traps = __glibcxx_integral_traps; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; - }; - - /// numeric_limits specialization. - template<> - struct numeric_limits - { - static const bool is_specialized = true; - - static unsigned char min() throw() - { return 0; } - static unsigned char max() throw() - { return __SCHAR_MAX__ * 2U + 1; } - - static const int digits = __glibcxx_digits (unsigned char); - static const int digits10 = __glibcxx_digits10 (unsigned char); - static const bool is_signed = false; - static const bool is_integer = true; - static const bool is_exact = true; - static const int radix = 2; - static unsigned char epsilon() throw() - { return 0; } - static unsigned char round_error() throw() - { return 0; } - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static unsigned char infinity() throw() - { return static_cast(0); } - static unsigned char quiet_NaN() throw() - { return static_cast(0); } - static unsigned char signaling_NaN() throw() - { return static_cast(0); } - static unsigned char denorm_min() throw() - { return static_cast(0); } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = true; - - static const bool traps = __glibcxx_integral_traps; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; - }; - - /// numeric_limits specialization. - template<> - struct numeric_limits - { - static const bool is_specialized = true; - - static wchar_t min() throw() - { return __glibcxx_min (wchar_t); } - static wchar_t max() throw() - { return __glibcxx_max (wchar_t); } - - static const int digits = __glibcxx_digits (wchar_t); - static const int digits10 = __glibcxx_digits10 (wchar_t); - static const bool is_signed = __glibcxx_signed (wchar_t); - static const bool is_integer = true; - static const bool is_exact = true; - static const int radix = 2; - static wchar_t epsilon() throw() - { return 0; } - static wchar_t round_error() throw() - { return 0; } - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static wchar_t infinity() throw() - { return wchar_t(); } - static wchar_t quiet_NaN() throw() - { return wchar_t(); } - static wchar_t signaling_NaN() throw() - { return wchar_t(); } - static wchar_t denorm_min() throw() - { return wchar_t(); } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = true; - - static const bool traps = __glibcxx_integral_traps; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; - }; - - /// numeric_limits specialization. - template<> - struct numeric_limits - { - static const bool is_specialized = true; - - static short min() throw() - { return -__SHRT_MAX__ - 1; } - static short max() throw() - { return __SHRT_MAX__; } - - static const int digits = __glibcxx_digits (short); - static const int digits10 = __glibcxx_digits10 (short); - static const bool is_signed = true; - static const bool is_integer = true; - static const bool is_exact = true; - static const int radix = 2; - static short epsilon() throw() - { return 0; } - static short round_error() throw() - { return 0; } - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static short infinity() throw() - { return short(); } - static short quiet_NaN() throw() - { return short(); } - static short signaling_NaN() throw() - { return short(); } - static short denorm_min() throw() - { return short(); } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = true; - - static const bool traps = __glibcxx_integral_traps; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; - }; - - /// numeric_limits specialization. - template<> - struct numeric_limits - { - static const bool is_specialized = true; - - static unsigned short min() throw() - { return 0; } - static unsigned short max() throw() - { return __SHRT_MAX__ * 2U + 1; } - - static const int digits = __glibcxx_digits (unsigned short); - static const int digits10 = __glibcxx_digits10 (unsigned short); - static const bool is_signed = false; - static const bool is_integer = true; - static const bool is_exact = true; - static const int radix = 2; - static unsigned short epsilon() throw() - { return 0; } - static unsigned short round_error() throw() - { return 0; } - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static unsigned short infinity() throw() - { return static_cast(0); } - static unsigned short quiet_NaN() throw() - { return static_cast(0); } - static unsigned short signaling_NaN() throw() - { return static_cast(0); } - static unsigned short denorm_min() throw() - { return static_cast(0); } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = true; - - static const bool traps = __glibcxx_integral_traps; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; - }; - - /// numeric_limits specialization. - template<> - struct numeric_limits - { - static const bool is_specialized = true; - - static int min() throw() - { return -__INT_MAX__ - 1; } - static int max() throw() - { return __INT_MAX__; } - - static const int digits = __glibcxx_digits (int); - static const int digits10 = __glibcxx_digits10 (int); - static const bool is_signed = true; - static const bool is_integer = true; - static const bool is_exact = true; - static const int radix = 2; - static int epsilon() throw() - { return 0; } - static int round_error() throw() - { return 0; } - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static int infinity() throw() - { return static_cast(0); } - static int quiet_NaN() throw() - { return static_cast(0); } - static int signaling_NaN() throw() - { return static_cast(0); } - static int denorm_min() throw() - { return static_cast(0); } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = true; - - static const bool traps = __glibcxx_integral_traps; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; - }; - - /// numeric_limits specialization. - template<> - struct numeric_limits - { - static const bool is_specialized = true; - - static unsigned int min() throw() - { return 0; } - static unsigned int max() throw() - { return __INT_MAX__ * 2U + 1; } - - static const int digits = __glibcxx_digits (unsigned int); - static const int digits10 = __glibcxx_digits10 (unsigned int); - static const bool is_signed = false; - static const bool is_integer = true; - static const bool is_exact = true; - static const int radix = 2; - static unsigned int epsilon() throw() - { return 0; } - static unsigned int round_error() throw() - { return 0; } - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static unsigned int infinity() throw() - { return static_cast(0); } - static unsigned int quiet_NaN() throw() - { return static_cast(0); } - static unsigned int signaling_NaN() throw() - { return static_cast(0); } - static unsigned int denorm_min() throw() - { return static_cast(0); } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = true; - - static const bool traps = __glibcxx_integral_traps; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; - }; - - /// numeric_limits specialization. - template<> - struct numeric_limits - { - static const bool is_specialized = true; - - static long min() throw() - { return -__LONG_MAX__ - 1; } - static long max() throw() - { return __LONG_MAX__; } - - static const int digits = __glibcxx_digits (long); - static const int digits10 = __glibcxx_digits10 (long); - static const bool is_signed = true; - static const bool is_integer = true; - static const bool is_exact = true; - static const int radix = 2; - static long epsilon() throw() - { return 0; } - static long round_error() throw() - { return 0; } - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static long infinity() throw() - { return static_cast(0); } - static long quiet_NaN() throw() - { return static_cast(0); } - static long signaling_NaN() throw() - { return static_cast(0); } - static long denorm_min() throw() - { return static_cast(0); } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = true; - - static const bool traps = __glibcxx_integral_traps; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; - }; - - /// numeric_limits specialization. - template<> - struct numeric_limits - { - static const bool is_specialized = true; - - static unsigned long min() throw() - { return 0; } - static unsigned long max() throw() - { return __LONG_MAX__ * 2UL + 1; } - - static const int digits = __glibcxx_digits (unsigned long); - static const int digits10 = __glibcxx_digits10 (unsigned long); - static const bool is_signed = false; - static const bool is_integer = true; - static const bool is_exact = true; - static const int radix = 2; - static unsigned long epsilon() throw() - { return 0; } - static unsigned long round_error() throw() - { return 0; } - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static unsigned long infinity() throw() - { return static_cast(0); } - static unsigned long quiet_NaN() throw() - { return static_cast(0); } - static unsigned long signaling_NaN() throw() - { return static_cast(0); } - static unsigned long denorm_min() throw() - { return static_cast(0); } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = true; - - static const bool traps = __glibcxx_integral_traps; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; - }; - - /// numeric_limits specialization. - template<> - struct numeric_limits - { - static const bool is_specialized = true; - - static long long min() throw() - { return -__LONG_LONG_MAX__ - 1; } - static long long max() throw() - { return __LONG_LONG_MAX__; } - - static const int digits = __glibcxx_digits (long long); - static const int digits10 = __glibcxx_digits10 (long long); - static const bool is_signed = true; - static const bool is_integer = true; - static const bool is_exact = true; - static const int radix = 2; - static long long epsilon() throw() - { return 0; } - static long long round_error() throw() - { return 0; } - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static long long infinity() throw() - { return static_cast(0); } - static long long quiet_NaN() throw() - { return static_cast(0); } - static long long signaling_NaN() throw() - { return static_cast(0); } - static long long denorm_min() throw() - { return static_cast(0); } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = true; - - static const bool traps = __glibcxx_integral_traps; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; - }; - - /// numeric_limits specialization. - template<> - struct numeric_limits - { - static const bool is_specialized = true; - - static unsigned long long min() throw() - { return 0; } - static unsigned long long max() throw() - { return __LONG_LONG_MAX__ * 2ULL + 1; } - - static const int digits = __glibcxx_digits (unsigned long long); - static const int digits10 = __glibcxx_digits10 (unsigned long long); - static const bool is_signed = false; - static const bool is_integer = true; - static const bool is_exact = true; - static const int radix = 2; - static unsigned long long epsilon() throw() - { return 0; } - static unsigned long long round_error() throw() - { return 0; } - - static const int min_exponent = 0; - static const int min_exponent10 = 0; - static const int max_exponent = 0; - static const int max_exponent10 = 0; - - static const bool has_infinity = false; - static const bool has_quiet_NaN = false; - static const bool has_signaling_NaN = false; - static const float_denorm_style has_denorm = denorm_absent; - static const bool has_denorm_loss = false; - - static unsigned long long infinity() throw() - { return static_cast(0); } - static unsigned long long quiet_NaN() throw() - { return static_cast(0); } - static unsigned long long signaling_NaN() throw() - { return static_cast(0); } - static unsigned long long denorm_min() throw() - { return static_cast(0); } - - static const bool is_iec559 = false; - static const bool is_bounded = true; - static const bool is_modulo = true; - - static const bool traps = __glibcxx_integral_traps; - static const bool tinyness_before = false; - static const float_round_style round_style = round_toward_zero; - }; - - /// numeric_limits specialization. - template<> - struct numeric_limits - { - static const bool is_specialized = true; - - static float min() throw() - { return __FLT_MIN__; } - static float max() throw() - { return __FLT_MAX__; } - - static const int digits = __FLT_MANT_DIG__; - static const int digits10 = __FLT_DIG__; - static const bool is_signed = true; - static const bool is_integer = false; - static const bool is_exact = false; - static const int radix = __FLT_RADIX__; - static float epsilon() throw() - { return __FLT_EPSILON__; } - static float round_error() throw() - { return 0.5F; } - - static const int min_exponent = __FLT_MIN_EXP__; - static const int min_exponent10 = __FLT_MIN_10_EXP__; - static const int max_exponent = __FLT_MAX_EXP__; - static const int max_exponent10 = __FLT_MAX_10_EXP__; - - static const bool has_infinity = __FLT_HAS_INFINITY__; - static const bool has_quiet_NaN = __FLT_HAS_QUIET_NAN__; - static const bool has_signaling_NaN = has_quiet_NaN; - static const float_denorm_style has_denorm - = bool(__FLT_HAS_DENORM__) ? denorm_present : denorm_absent; - static const bool has_denorm_loss = __glibcxx_float_has_denorm_loss; - - static float infinity() throw() - { return __builtin_huge_valf (); } - static float quiet_NaN() throw() - { return __builtin_nanf (""); } - static float signaling_NaN() throw() - { return __builtin_nansf (""); } - static float denorm_min() throw() - { return __FLT_DENORM_MIN__; } - - static const bool is_iec559 - = has_infinity && has_quiet_NaN && has_denorm == denorm_present; - static const bool is_bounded = true; - static const bool is_modulo = false; - - static const bool traps = __glibcxx_float_traps; - static const bool tinyness_before = __glibcxx_float_tinyness_before; - static const float_round_style round_style = round_to_nearest; - }; - -#undef __glibcxx_float_has_denorm_loss -#undef __glibcxx_float_traps -#undef __glibcxx_float_tinyness_before - - /// numeric_limits specialization. - template<> - struct numeric_limits - { - static const bool is_specialized = true; - - static double min() throw() - { return __DBL_MIN__; } - static double max() throw() - { return __DBL_MAX__; } - - static const int digits = __DBL_MANT_DIG__; - static const int digits10 = __DBL_DIG__; - static const bool is_signed = true; - static const bool is_integer = false; - static const bool is_exact = false; - static const int radix = __FLT_RADIX__; - static double epsilon() throw() - { return __DBL_EPSILON__; } - static double round_error() throw() - { return 0.5; } - - static const int min_exponent = __DBL_MIN_EXP__; - static const int min_exponent10 = __DBL_MIN_10_EXP__; - static const int max_exponent = __DBL_MAX_EXP__; - static const int max_exponent10 = __DBL_MAX_10_EXP__; - - static const bool has_infinity = __DBL_HAS_INFINITY__; - static const bool has_quiet_NaN = __DBL_HAS_QUIET_NAN__; - static const bool has_signaling_NaN = has_quiet_NaN; - static const float_denorm_style has_denorm - = bool(__DBL_HAS_DENORM__) ? denorm_present : denorm_absent; - static const bool has_denorm_loss = __glibcxx_double_has_denorm_loss; - - static double infinity() throw() - { return __builtin_huge_val(); } - static double quiet_NaN() throw() - { return __builtin_nan (""); } - static double signaling_NaN() throw() - { return __builtin_nans (""); } - static double denorm_min() throw() - { return __DBL_DENORM_MIN__; } - - static const bool is_iec559 - = has_infinity && has_quiet_NaN && has_denorm == denorm_present; - static const bool is_bounded = true; - static const bool is_modulo = false; - - static const bool traps = __glibcxx_double_traps; - static const bool tinyness_before = __glibcxx_double_tinyness_before; - static const float_round_style round_style = round_to_nearest; - }; - -#undef __glibcxx_double_has_denorm_loss -#undef __glibcxx_double_traps -#undef __glibcxx_double_tinyness_before - - /// numeric_limits specialization. - template<> - struct numeric_limits - { - static const bool is_specialized = true; - - static long double min() throw() - { return __LDBL_MIN__; } - static long double max() throw() - { return __LDBL_MAX__; } - - static const int digits = __LDBL_MANT_DIG__; - static const int digits10 = __LDBL_DIG__; - static const bool is_signed = true; - static const bool is_integer = false; - static const bool is_exact = false; - static const int radix = __FLT_RADIX__; - static long double epsilon() throw() - { return __LDBL_EPSILON__; } - static long double round_error() throw() - { return 0.5L; } - - static const int min_exponent = __LDBL_MIN_EXP__; - static const int min_exponent10 = __LDBL_MIN_10_EXP__; - static const int max_exponent = __LDBL_MAX_EXP__; - static const int max_exponent10 = __LDBL_MAX_10_EXP__; - - static const bool has_infinity = __LDBL_HAS_INFINITY__; - static const bool has_quiet_NaN = __LDBL_HAS_QUIET_NAN__; - static const bool has_signaling_NaN = has_quiet_NaN; - static const float_denorm_style has_denorm - = bool(__LDBL_HAS_DENORM__) ? denorm_present : denorm_absent; - static const bool has_denorm_loss - = __glibcxx_long_double_has_denorm_loss; - - static long double infinity() throw() - { return __builtin_huge_vall (); } - static long double quiet_NaN() throw() - { return __builtin_nanl (""); } - static long double signaling_NaN() throw() - { return __builtin_nansl (""); } - static long double denorm_min() throw() - { return __LDBL_DENORM_MIN__; } - - static const bool is_iec559 - = has_infinity && has_quiet_NaN && has_denorm == denorm_present; - static const bool is_bounded = true; - static const bool is_modulo = false; - - static const bool traps = __glibcxx_long_double_traps; - static const bool tinyness_before = __glibcxx_long_double_tinyness_before; - static const float_round_style round_style = round_to_nearest; - }; - -#undef __glibcxx_long_double_has_denorm_loss -#undef __glibcxx_long_double_traps -#undef __glibcxx_long_double_tinyness_before - -_GLIBCXX_END_NAMESPACE - -#undef __glibcxx_signed -#undef __glibcxx_min -#undef __glibcxx_max -#undef __glibcxx_digits -#undef __glibcxx_digits10 - -#endif // _GLIBCXX_NUMERIC_LIMITS diff --git a/libstdc++-v3/include/std/std_list.h b/libstdc++-v3/include/std/std_list.h deleted file mode 100644 index b46f65417ec..00000000000 --- a/libstdc++-v3/include/std/std_list.h +++ /dev/null @@ -1,81 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file include/list - * This is a Standard C++ Library header. - */ - -#ifndef _GLIBCXX_LIST -#define _GLIBCXX_LIST 1 - -#pragma GCC system_header - -#include -#include -#include -#include -#include -#include - -#ifndef _GLIBCXX_EXPORT_TEMPLATE -# include -#endif - -#ifdef _GLIBCXX_DEBUG -# include -#endif - -#endif /* _GLIBCXX_LIST */ - diff --git a/libstdc++-v3/include/std/std_locale.h b/libstdc++-v3/include/std/std_locale.h deleted file mode 100644 index 5223f90c878..00000000000 --- a/libstdc++-v3/include/std/std_locale.h +++ /dev/null @@ -1,48 +0,0 @@ -// Locale support -*- C++ -*- - -// Copyright (C) 1997, 1998, 1999, 2002, 2003 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -// -// ISO C++ 14882: 22.1 Locales -// - -/** @file locale - * This is a Standard C++ Library header. - */ - -#ifndef _GLIBCXX_LOCALE -#define _GLIBCXX_LOCALE 1 - -#pragma GCC system_header - -#include -#include -#include -#include - -#endif /* _GLIBCXX_LOCALE */ diff --git a/libstdc++-v3/include/std/std_map.h b/libstdc++-v3/include/std/std_map.h deleted file mode 100644 index a7e8f9c2107..00000000000 --- a/libstdc++-v3/include/std/std_map.h +++ /dev/null @@ -1,73 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2001, 2002 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file include/map - * This is a Standard C++ Library header. - */ - -#ifndef _GLIBCXX_MAP -#define _GLIBCXX_MAP 1 - -#pragma GCC system_header - -#include -#include -#include - -#ifdef _GLIBCXX_DEBUG -# include -#endif - -#endif /* _GLIBCXX_MAP */ diff --git a/libstdc++-v3/include/std/std_memory.h b/libstdc++-v3/include/std/std_memory.h deleted file mode 100644 index b57a94f4bbd..00000000000 --- a/libstdc++-v3/include/std/std_memory.h +++ /dev/null @@ -1,374 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/* - * Copyright (c) 1997-1999 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -/** @file include/memory - * This is a Standard C++ Library header. - */ - -#ifndef _GLIBCXX_MEMORY -#define _GLIBCXX_MEMORY 1 - -#pragma GCC system_header - -#include -#include -#include -#include //for iterator_traits -#include -#include -#include -#include - -_GLIBCXX_BEGIN_NAMESPACE(std) - - /** - * @if maint - * This is a helper function. The unused second parameter exists to - * permit the real get_temporary_buffer to use template parameter deduction. - * - * XXX This should perhaps use the pool. - * @endif - */ - template - pair<_Tp*, ptrdiff_t> - __get_temporary_buffer(ptrdiff_t __len, _Tp*) - { - const ptrdiff_t __max = numeric_limits::max() / sizeof(_Tp); - if (__len > __max) - __len = __max; - - while (__len > 0) - { - _Tp* __tmp = static_cast<_Tp*>(::operator new(__len * sizeof(_Tp), - nothrow)); - if (__tmp != 0) - return pair<_Tp*, ptrdiff_t>(__tmp, __len); - __len /= 2; - } - return pair<_Tp*, ptrdiff_t>(static_cast<_Tp*>(0), 0); - } - - /** - * @brief Allocates a temporary buffer. - * @param len The number of objects of type Tp. - * @return See full description. - * - * Reinventing the wheel, but this time with prettier spokes! - * - * This function tries to obtain storage for @c len adjacent Tp - * objects. The objects themselves are not constructed, of course. - * A pair<> is returned containing "the buffer s address and - * capacity (in the units of sizeof(Tp)), or a pair of 0 values if - * no storage can be obtained." Note that the capacity obtained - * may be less than that requested if the memory is unavailable; - * you should compare len with the .second return value. - * - * Provides the nothrow exception guarantee. - */ - template - inline pair<_Tp*, ptrdiff_t> - get_temporary_buffer(ptrdiff_t __len) - { return std::__get_temporary_buffer(__len, static_cast<_Tp*>(0)); } - - /** - * @brief The companion to get_temporary_buffer(). - * @param p A buffer previously allocated by get_temporary_buffer. - * @return None. - * - * Frees the memory pointed to by p. - */ - template - void - return_temporary_buffer(_Tp* __p) - { ::operator delete(__p, nothrow); } - - /** - * A wrapper class to provide auto_ptr with reference semantics. - * For example, an auto_ptr can be assigned (or constructed from) - * the result of a function which returns an auto_ptr by value. - * - * All the auto_ptr_ref stuff should happen behind the scenes. - */ - template - struct auto_ptr_ref - { - _Tp1* _M_ptr; - - explicit - auto_ptr_ref(_Tp1* __p): _M_ptr(__p) { } - }; - - - /** - * @brief A simple smart pointer providing strict ownership semantics. - * - * The Standard says: - *
-   *  An @c auto_ptr owns the object it holds a pointer to.  Copying
-   *  an @c auto_ptr copies the pointer and transfers ownership to the
-   *  destination.  If more than one @c auto_ptr owns the same object
-   *  at the same time the behavior of the program is undefined.
-   *
-   *  The uses of @c auto_ptr include providing temporary
-   *  exception-safety for dynamically allocated memory, passing
-   *  ownership of dynamically allocated memory to a function, and
-   *  returning dynamically allocated memory from a function.  @c
-   *  auto_ptr does not meet the CopyConstructible and Assignable
-   *  requirements for Standard Library container elements and thus
-   *  instantiating a Standard Library container with an @c auto_ptr
-   *  results in undefined behavior.
-   *  
- * Quoted from [20.4.5]/3. - * - * Good examples of what can and cannot be done with auto_ptr can - * be found in the libstdc++ testsuite. - * - * @if maint - * _GLIBCXX_RESOLVE_LIB_DEFECTS - * 127. auto_ptr<> conversion issues - * These resolutions have all been incorporated. - * @endif - */ - template - class auto_ptr - { - private: - _Tp* _M_ptr; - - public: - /// The pointed-to type. - typedef _Tp element_type; - - /** - * @brief An %auto_ptr is usually constructed from a raw pointer. - * @param p A pointer (defaults to NULL). - * - * This object now @e owns the object pointed to by @a p. - */ - explicit - auto_ptr(element_type* __p = 0) throw() : _M_ptr(__p) { } - - /** - * @brief An %auto_ptr can be constructed from another %auto_ptr. - * @param a Another %auto_ptr of the same type. - * - * This object now @e owns the object previously owned by @a a, - * which has given up ownsership. - */ - auto_ptr(auto_ptr& __a) throw() : _M_ptr(__a.release()) { } - - /** - * @brief An %auto_ptr can be constructed from another %auto_ptr. - * @param a Another %auto_ptr of a different but related type. - * - * A pointer-to-Tp1 must be convertible to a - * pointer-to-Tp/element_type. - * - * This object now @e owns the object previously owned by @a a, - * which has given up ownsership. - */ - template - auto_ptr(auto_ptr<_Tp1>& __a) throw() : _M_ptr(__a.release()) { } - - /** - * @brief %auto_ptr assignment operator. - * @param a Another %auto_ptr of the same type. - * - * This object now @e owns the object previously owned by @a a, - * which has given up ownsership. The object that this one @e - * used to own and track has been deleted. - */ - auto_ptr& - operator=(auto_ptr& __a) throw() - { - reset(__a.release()); - return *this; - } - - /** - * @brief %auto_ptr assignment operator. - * @param a Another %auto_ptr of a different but related type. - * - * A pointer-to-Tp1 must be convertible to a pointer-to-Tp/element_type. - * - * This object now @e owns the object previously owned by @a a, - * which has given up ownsership. The object that this one @e - * used to own and track has been deleted. - */ - template - auto_ptr& - operator=(auto_ptr<_Tp1>& __a) throw() - { - reset(__a.release()); - return *this; - } - - /** - * When the %auto_ptr goes out of scope, the object it owns is - * deleted. If it no longer owns anything (i.e., @c get() is - * @c NULL), then this has no effect. - * - * @if maint - * The C++ standard says there is supposed to be an empty throw - * specification here, but omitting it is standard conforming. Its - * presence can be detected only if _Tp::~_Tp() throws, but this is - * prohibited. [17.4.3.6]/2 - * @endif - */ - ~auto_ptr() { delete _M_ptr; } - - /** - * @brief Smart pointer dereferencing. - * - * If this %auto_ptr no longer owns anything, then this - * operation will crash. (For a smart pointer, "no longer owns - * anything" is the same as being a null pointer, and you know - * what happens when you dereference one of those...) - */ - element_type& - operator*() const throw() - { - _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0); - return *_M_ptr; - } - - /** - * @brief Smart pointer dereferencing. - * - * This returns the pointer itself, which the language then will - * automatically cause to be dereferenced. - */ - element_type* - operator->() const throw() - { - _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0); - return _M_ptr; - } - - /** - * @brief Bypassing the smart pointer. - * @return The raw pointer being managed. - * - * You can get a copy of the pointer that this object owns, for - * situations such as passing to a function which only accepts - * a raw pointer. - * - * @note This %auto_ptr still owns the memory. - */ - element_type* - get() const throw() { return _M_ptr; } - - /** - * @brief Bypassing the smart pointer. - * @return The raw pointer being managed. - * - * You can get a copy of the pointer that this object owns, for - * situations such as passing to a function which only accepts - * a raw pointer. - * - * @note This %auto_ptr no longer owns the memory. When this object - * goes out of scope, nothing will happen. - */ - element_type* - release() throw() - { - element_type* __tmp = _M_ptr; - _M_ptr = 0; - return __tmp; - } - - /** - * @brief Forcibly deletes the managed object. - * @param p A pointer (defaults to NULL). - * - * This object now @e owns the object pointed to by @a p. The - * previous object has been deleted. - */ - void - reset(element_type* __p = 0) throw() - { - if (__p != _M_ptr) - { - delete _M_ptr; - _M_ptr = __p; - } - } - - /** - * @brief Automatic conversions - * - * These operations convert an %auto_ptr into and from an auto_ptr_ref - * automatically as needed. This allows constructs such as - * @code - * auto_ptr func_returning_auto_ptr(.....); - * ... - * auto_ptr ptr = func_returning_auto_ptr(.....); - * @endcode - */ - auto_ptr(auto_ptr_ref __ref) throw() - : _M_ptr(__ref._M_ptr) { } - - auto_ptr& - operator=(auto_ptr_ref __ref) throw() - { - if (__ref._M_ptr != this->get()) - { - delete _M_ptr; - _M_ptr = __ref._M_ptr; - } - return *this; - } - - template - operator auto_ptr_ref<_Tp1>() throw() - { return auto_ptr_ref<_Tp1>(this->release()); } - - template - operator auto_ptr<_Tp1>() throw() - { return auto_ptr<_Tp1>(this->release()); } - }; - -_GLIBCXX_END_NAMESPACE - -#endif /* _GLIBCXX_MEMORY */ diff --git a/libstdc++-v3/include/std/std_numeric.h b/libstdc++-v3/include/std/std_numeric.h deleted file mode 100644 index 03f82dd6ab0..00000000000 --- a/libstdc++-v3/include/std/std_numeric.h +++ /dev/null @@ -1,71 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2001, 2002 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file include/numeric - * This is a Standard C++ Library header. - */ - -#ifndef _GLIBCXX_NUMERIC -#define _GLIBCXX_NUMERIC 1 - -#pragma GCC system_header - -#include -#include -#include -#include -#include - -#endif /* _GLIBCXX_NUMERIC */ diff --git a/libstdc++-v3/include/std/std_ostream.h b/libstdc++-v3/include/std/std_ostream.h deleted file mode 100644 index e97b7a4b410..00000000000 --- a/libstdc++-v3/include/std/std_ostream.h +++ /dev/null @@ -1,613 +0,0 @@ -// Output streams -*- C++ -*- - -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/** @file ostream - * This is a Standard C++ Library header. - */ - -// -// ISO C++ 14882: 27.6.2 Output streams -// - -#ifndef _GLIBCXX_OSTREAM -#define _GLIBCXX_OSTREAM 1 - -#pragma GCC system_header - -#include - -_GLIBCXX_BEGIN_NAMESPACE(std) - - // [27.6.2.1] Template class basic_ostream - /** - * @brief Controlling output. - * - * This is the base class for all output streams. It provides text - * formatting of all builtin types, and communicates with any class - * derived from basic_streambuf to do the actual output. - */ - template - class basic_ostream : virtual public basic_ios<_CharT, _Traits> - { - public: - // Types (inherited from basic_ios (27.4.4)): - typedef _CharT char_type; - typedef typename _Traits::int_type int_type; - typedef typename _Traits::pos_type pos_type; - typedef typename _Traits::off_type off_type; - typedef _Traits traits_type; - - // Non-standard Types: - typedef basic_streambuf<_CharT, _Traits> __streambuf_type; - typedef basic_ios<_CharT, _Traits> __ios_type; - typedef basic_ostream<_CharT, _Traits> __ostream_type; - typedef num_put<_CharT, ostreambuf_iterator<_CharT, _Traits> > - __num_put_type; - typedef ctype<_CharT> __ctype_type; - - template - friend basic_ostream<_CharT2, _Traits2>& - operator<<(basic_ostream<_CharT2, _Traits2>&, _CharT2); - - template - friend basic_ostream& - operator<<(basic_ostream&, char); - - template - friend basic_ostream<_CharT2, _Traits2>& - operator<<(basic_ostream<_CharT2, _Traits2>&, const _CharT2*); - - template - friend basic_ostream& - operator<<(basic_ostream&, const char*); - - template - friend basic_ostream<_CharT2, _Traits2>& - operator<<(basic_ostream<_CharT2, _Traits2>&, const char*); - - template - friend basic_ostream<_CharT2, _Traits2>& - operator<<(basic_ostream<_CharT2, _Traits2>&, - const basic_string<_CharT2, _Traits2, _Alloc>&); - - // [27.6.2.2] constructor/destructor - /** - * @brief Base constructor. - * - * This ctor is almost never called by the user directly, rather from - * derived classes' initialization lists, which pass a pointer to - * their own stream buffer. - */ - explicit - basic_ostream(__streambuf_type* __sb) - { this->init(__sb); } - - /** - * @brief Base destructor. - * - * This does very little apart from providing a virtual base dtor. - */ - virtual - ~basic_ostream() { } - - // [27.6.2.3] prefix/suffix - class sentry; - friend class sentry; - - // [27.6.2.5] formatted output - // [27.6.2.5.3] basic_ostream::operator<< - //@{ - /** - * @brief Interface for manipulators. - * - * Manuipulators such as @c std::endl and @c std::hex use these - * functions in constructs like "std::cout << std::endl". For more - * information, see the iomanip header. - */ - __ostream_type& - operator<<(__ostream_type& (*__pf)(__ostream_type&)) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 60. What is a formatted input function? - // The inserters for manipulators are *not* formatted output functions. - return __pf(*this); - } - - __ostream_type& - operator<<(__ios_type& (*__pf)(__ios_type&)) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 60. What is a formatted input function? - // The inserters for manipulators are *not* formatted output functions. - __pf(*this); - return *this; - } - - __ostream_type& - operator<<(ios_base& (*__pf) (ios_base&)) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 60. What is a formatted input function? - // The inserters for manipulators are *not* formatted output functions. - __pf(*this); - return *this; - } - //@} - - // [27.6.2.5.2] arithmetic inserters - /** - * @name Arithmetic Inserters - * - * All the @c operator<< functions (aka formatted output - * functions) have some common behavior. Each starts by - * constructing a temporary object of type std::basic_ostream::sentry. - * This can have several effects, concluding with the setting of a - * status flag; see the sentry documentation for more. - * - * If the sentry status is good, the function tries to generate - * whatever data is appropriate for the type of the argument. - * - * If an exception is thrown during insertion, ios_base::badbit - * will be turned on in the stream's error state without causing an - * ios_base::failure to be thrown. The original exception will then - * be rethrown. - */ - //@{ - /** - * @brief Basic arithmetic inserters - * @param A variable of builtin type. - * @return @c *this if successful - * - * These functions use the stream's current locale (specifically, the - * @c num_get facet) to perform numeric formatting. - */ - __ostream_type& - operator<<(long __n) - { return _M_insert(__n); } - - __ostream_type& - operator<<(unsigned long __n) - { return _M_insert(__n); } - - __ostream_type& - operator<<(bool __n) - { return _M_insert(__n); } - - __ostream_type& - operator<<(short __n); - - __ostream_type& - operator<<(unsigned short __n) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 117. basic_ostream uses nonexistent num_put member functions. - return _M_insert(static_cast(__n)); - } - - __ostream_type& - operator<<(int __n); - - __ostream_type& - operator<<(unsigned int __n) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 117. basic_ostream uses nonexistent num_put member functions. - return _M_insert(static_cast(__n)); - } - -#ifdef _GLIBCXX_USE_LONG_LONG - __ostream_type& - operator<<(long long __n) - { return _M_insert(__n); } - - __ostream_type& - operator<<(unsigned long long __n) - { return _M_insert(__n); } -#endif - - __ostream_type& - operator<<(double __f) - { return _M_insert(__f); } - - __ostream_type& - operator<<(float __f) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 117. basic_ostream uses nonexistent num_put member functions. - return _M_insert(static_cast(__f)); - } - - __ostream_type& - operator<<(long double __f) - { return _M_insert(__f); } - - __ostream_type& - operator<<(const void* __p) - { return _M_insert(__p); } - - /** - * @brief Extracting from another streambuf. - * @param sb A pointer to a streambuf - * - * This function behaves like one of the basic arithmetic extractors, - * in that it also constructs a sentry object and has the same error - * handling behavior. - * - * If @a sb is NULL, the stream will set failbit in its error state. - * - * Characters are extracted from @a sb and inserted into @c *this - * until one of the following occurs: - * - * - the input stream reaches end-of-file, - * - insertion into the output sequence fails (in this case, the - * character that would have been inserted is not extracted), or - * - an exception occurs while getting a character from @a sb, which - * sets failbit in the error state - * - * If the function inserts no characters, failbit is set. - */ - __ostream_type& - operator<<(__streambuf_type* __sb); - //@} - - // [27.6.2.6] unformatted output functions - /** - * @name Unformatted Output Functions - * - * All the unformatted output functions have some common behavior. - * Each starts by constructing a temporary object of type - * std::basic_ostream::sentry. This has several effects, concluding - * with the setting of a status flag; see the sentry documentation - * for more. - * - * If the sentry status is good, the function tries to generate - * whatever data is appropriate for the type of the argument. - * - * If an exception is thrown during insertion, ios_base::badbit - * will be turned on in the stream's error state. If badbit is on in - * the stream's exceptions mask, the exception will be rethrown - * without completing its actions. - */ - //@{ - /** - * @brief Simple insertion. - * @param c The character to insert. - * @return *this - * - * Tries to insert @a c. - * - * @note This function is not overloaded on signed char and - * unsigned char. - */ - __ostream_type& - put(char_type __c); - - // Core write functionality, without sentry. - void - _M_write(const char_type* __s, streamsize __n) - { - const streamsize __put = this->rdbuf()->sputn(__s, __n); - if (__put != __n) - this->setstate(ios_base::badbit); - } - - void - _M_write(char_type __c, streamsize __n) - { - for (; __n > 0; --__n) - { - const int_type __put = this->rdbuf()->sputc(__c); - if (traits_type::eq_int_type(__put, traits_type::eof())) - { - this->setstate(ios_base::badbit); - break; - } - } - } - - /** - * @brief Character string insertion. - * @param s The array to insert. - * @param n Maximum number of characters to insert. - * @return *this - * - * Characters are copied from @a s and inserted into the stream until - * one of the following happens: - * - * - @a n characters are inserted - * - inserting into the output sequence fails (in this case, badbit - * will be set in the stream's error state) - * - * @note This function is not overloaded on signed char and - * unsigned char. - */ - __ostream_type& - write(const char_type* __s, streamsize __n); - //@} - - /** - * @brief Synchronizing the stream buffer. - * @return *this - * - * If @c rdbuf() is a null pointer, changes nothing. - * - * Otherwise, calls @c rdbuf()->pubsync(), and if that returns -1, - * sets badbit. - */ - __ostream_type& - flush(); - - // [27.6.2.4] seek members - /** - * @brief Getting the current write position. - * @return A file position object. - * - * If @c fail() is not false, returns @c pos_type(-1) to indicate - * failure. Otherwise returns @c rdbuf()->pubseekoff(0,cur,out). - */ - pos_type - tellp(); - - /** - * @brief Changing the current write position. - * @param pos A file position object. - * @return *this - * - * If @c fail() is not true, calls @c rdbuf()->pubseekpos(pos). If - * that function fails, sets failbit. - */ - __ostream_type& - seekp(pos_type); - - /** - * @brief Changing the current write position. - * @param off A file offset object. - * @param dir The direction in which to seek. - * @return *this - * - * If @c fail() is not true, calls @c rdbuf()->pubseekoff(off,dir). - * If that function fails, sets failbit. - */ - __ostream_type& - seekp(off_type, ios_base::seekdir); - - protected: - explicit - basic_ostream() { } - - template - __ostream_type& - _M_insert(_ValueT __v); - - __ostream_type& - _M_insert(const char_type* __s, streamsize __n); - }; - - /** - * @brief Performs setup work for output streams. - * - * Objects of this class are created before all of the standard - * inserters are run. It is responsible for "exception-safe prefix and - * suffix operations." Additional actions may be added by the - * implementation, and we list them in - * http://gcc.gnu.org/onlinedocs/libstdc++/17_intro/howto.html#5 - * under [27.6] notes. - */ - template - class basic_ostream<_CharT, _Traits>::sentry - { - // Data Members: - bool _M_ok; - basic_ostream<_CharT, _Traits>& _M_os; - - public: - /** - * @brief The constructor performs preparatory work. - * @param os The output stream to guard. - * - * If the stream state is good (@a os.good() is true), then if the - * stream is tied to another output stream, @c is.tie()->flush() - * is called to synchronize the output sequences. - * - * If the stream state is still good, then the sentry state becomes - * true ("okay"). - */ - explicit - sentry(basic_ostream<_CharT, _Traits>& __os); - - /** - * @brief Possibly flushes the stream. - * - * If @c ios_base::unitbuf is set in @c os.flags(), and - * @c std::uncaught_exception() is true, the sentry destructor calls - * @c flush() on the output stream. - */ - ~sentry() - { - // XXX MT - if (_M_os.flags() & ios_base::unitbuf && !uncaught_exception()) - { - // Can't call flush directly or else will get into recursive lock. - if (_M_os.rdbuf() && _M_os.rdbuf()->pubsync() == -1) - _M_os.setstate(ios_base::badbit); - } - } - - /** - * @brief Quick status checking. - * @return The sentry state. - * - * For ease of use, sentries may be converted to booleans. The - * return value is that of the sentry state (true == okay). - */ - operator bool() const - { return _M_ok; } - }; - - // [27.6.2.5.4] character insertion templates - //@{ - /** - * @brief Character inserters - * @param out An output stream. - * @param c A character. - * @return out - * - * Behaves like one of the formatted arithmetic inserters described in - * std::basic_ostream. After constructing a sentry object with good - * status, this function inserts a single character and any required - * padding (as determined by [22.2.2.2.2]). @c out.width(0) is then - * called. - * - * If @a c is of type @c char and the character type of the stream is not - * @c char, the character is widened before insertion. - */ - template - inline basic_ostream<_CharT, _Traits>& - operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c) - { return __out._M_insert(&__c, 1); } - - template - inline basic_ostream<_CharT, _Traits>& - operator<<(basic_ostream<_CharT, _Traits>& __out, char __c) - { return (__out << __out.widen(__c)); } - - // Specialization - template - inline basic_ostream& - operator<<(basic_ostream& __out, char __c) - { return __out._M_insert(&__c, 1); } - - // Signed and unsigned - template - inline basic_ostream& - operator<<(basic_ostream& __out, signed char __c) - { return (__out << static_cast(__c)); } - - template - inline basic_ostream& - operator<<(basic_ostream& __out, unsigned char __c) - { return (__out << static_cast(__c)); } - //@} - - //@{ - /** - * @brief String inserters - * @param out An output stream. - * @param s A character string. - * @return out - * @pre @a s must be a non-NULL pointer - * - * Behaves like one of the formatted arithmetic inserters described in - * std::basic_ostream. After constructing a sentry object with good - * status, this function inserts @c traits::length(s) characters starting - * at @a s, widened if necessary, followed by any required padding (as - * determined by [22.2.2.2.2]). @c out.width(0) is then called. - */ - template - inline basic_ostream<_CharT, _Traits>& - operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s) - { - if (!__s) - __out.setstate(ios_base::badbit); - else - __out._M_insert(__s, static_cast(_Traits::length(__s))); - return __out; - } - - template - basic_ostream<_CharT, _Traits> & - operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s); - - // Partial specializationss - template - inline basic_ostream& - operator<<(basic_ostream& __out, const char* __s) - { - if (!__s) - __out.setstate(ios_base::badbit); - else - __out._M_insert(__s, static_cast(_Traits::length(__s))); - return __out; - } - - // Signed and unsigned - template - inline basic_ostream& - operator<<(basic_ostream& __out, const signed char* __s) - { return (__out << reinterpret_cast(__s)); } - - template - inline basic_ostream & - operator<<(basic_ostream& __out, const unsigned char* __s) - { return (__out << reinterpret_cast(__s)); } - //@} - - // [27.6.2.7] standard basic_ostream manipulators - /** - * @brief Write a newline and flush the stream. - * - * This manipulator is often mistakenly used when a simple newline is - * desired, leading to poor buffering performance. See - * http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#2 for more - * on this subject. - */ - template - inline basic_ostream<_CharT, _Traits>& - endl(basic_ostream<_CharT, _Traits>& __os) - { return flush(__os.put(__os.widen('\n'))); } - - /** - * @brief Write a null character into the output sequence. - * - * "Null character" is @c CharT() by definition. For CharT of @c char, - * this correctly writes the ASCII @c NUL character string terminator. - */ - template - inline basic_ostream<_CharT, _Traits>& - ends(basic_ostream<_CharT, _Traits>& __os) - { return __os.put(_CharT()); } - - /** - * @brief Flushes the output stream. - * - * This manipulator simply calls the stream's @c flush() member function. - */ - template - inline basic_ostream<_CharT, _Traits>& - flush(basic_ostream<_CharT, _Traits>& __os) - { return __os.flush(); } - -_GLIBCXX_END_NAMESPACE - -#ifndef _GLIBCXX_EXPORT_TEMPLATE -# include -#endif - -#endif /* _GLIBCXX_OSTREAM */ diff --git a/libstdc++-v3/include/std/std_queue.h b/libstdc++-v3/include/std/std_queue.h deleted file mode 100644 index 1242a06160b..00000000000 --- a/libstdc++-v3/include/std/std_queue.h +++ /dev/null @@ -1,77 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file include/queue - * This is a Standard C++ Library header. - */ - -#ifndef _GLIBCXX_QUEUE -#define _GLIBCXX_QUEUE 1 - -#pragma GCC system_header - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif /* _GLIBCXX_QUEUE */ diff --git a/libstdc++-v3/include/std/std_set.h b/libstdc++-v3/include/std/std_set.h deleted file mode 100644 index 65ebe8a10cc..00000000000 --- a/libstdc++-v3/include/std/std_set.h +++ /dev/null @@ -1,73 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2001, 2002 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file include/set - * This is a Standard C++ Library header. - */ - -#ifndef _GLIBCXX_SET -#define _GLIBCXX_SET 1 - -#pragma GCC system_header - -#include -#include -#include - -#ifdef _GLIBCXX_DEBUG -# include -#endif - -#endif /* _GLIBCXX_SET */ diff --git a/libstdc++-v3/include/std/std_sstream.h b/libstdc++-v3/include/std/std_sstream.h deleted file mode 100644 index a09815c1945..00000000000 --- a/libstdc++-v3/include/std/std_sstream.h +++ /dev/null @@ -1,591 +0,0 @@ -// String based streams -*- C++ -*- - -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/** @file sstream - * This is a Standard C++ Library header. - */ - -// -// ISO C++ 14882: 27.7 String-based streams -// - -#ifndef _GLIBCXX_SSTREAM -#define _GLIBCXX_SSTREAM 1 - -#pragma GCC system_header - -#include -#include - -_GLIBCXX_BEGIN_NAMESPACE(std) - - // [27.7.1] template class basic_stringbuf - /** - * @brief The actual work of input and output (for std::string). - * - * This class associates either or both of its input and output sequences - * with a sequence of characters, which can be initialized from, or made - * available as, a @c std::basic_string. (Paraphrased from [27.7.1]/1.) - * - * For this class, open modes (of type @c ios_base::openmode) have - * @c in set if the input sequence can be read, and @c out set if the - * output sequence can be written. - */ - template - class basic_stringbuf : public basic_streambuf<_CharT, _Traits> - { - public: - // Types: - typedef _CharT char_type; - typedef _Traits traits_type; - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 251. basic_stringbuf missing allocator_type - typedef _Alloc allocator_type; - typedef typename traits_type::int_type int_type; - typedef typename traits_type::pos_type pos_type; - typedef typename traits_type::off_type off_type; - - typedef basic_streambuf __streambuf_type; - typedef basic_string __string_type; - typedef typename __string_type::size_type __size_type; - - protected: - /** - * @if maint - * Place to stash in || out || in | out settings for current stringbuf. - * @endif - */ - ios_base::openmode _M_mode; - - // Data Members: - __string_type _M_string; - - public: - // Constructors: - /** - * @brief Starts with an empty string buffer. - * @param mode Whether the buffer can read, or write, or both. - * - * The default constructor initializes the parent class using its - * own default ctor. - */ - explicit - basic_stringbuf(ios_base::openmode __mode = ios_base::in | ios_base::out) - : __streambuf_type(), _M_mode(__mode), _M_string() - { } - - /** - * @brief Starts with an existing string buffer. - * @param str A string to copy as a starting buffer. - * @param mode Whether the buffer can read, or write, or both. - * - * This constructor initializes the parent class using its - * own default ctor. - */ - explicit - basic_stringbuf(const __string_type& __str, - ios_base::openmode __mode = ios_base::in | ios_base::out) - : __streambuf_type(), _M_mode(), _M_string(__str.data(), __str.size()) - { _M_stringbuf_init(__mode); } - - // Get and set: - /** - * @brief Copying out the string buffer. - * @return A copy of one of the underlying sequences. - * - * "If the buffer is only created in input mode, the underlying - * character sequence is equal to the input sequence; otherwise, it - * is equal to the output sequence." [27.7.1.2]/1 - */ - __string_type - str() const - { - __string_type __ret; - if (this->pptr()) - { - // The current egptr() may not be the actual string end. - if (this->pptr() > this->egptr()) - __ret = __string_type(this->pbase(), this->pptr()); - else - __ret = __string_type(this->pbase(), this->egptr()); - } - else - __ret = _M_string; - return __ret; - } - - /** - * @brief Setting a new buffer. - * @param s The string to use as a new sequence. - * - * Deallocates any previous stored sequence, then copies @a s to - * use as a new one. - */ - void - str(const __string_type& __s) - { - // Cannot use _M_string = __s, since v3 strings are COW. - _M_string.assign(__s.data(), __s.size()); - _M_stringbuf_init(_M_mode); - } - - protected: - // Common initialization code goes here. - void - _M_stringbuf_init(ios_base::openmode __mode) - { - _M_mode = __mode; - __size_type __len = 0; - if (_M_mode & (ios_base::ate | ios_base::app)) - __len = _M_string.size(); - _M_sync(const_cast(_M_string.data()), 0, __len); - } - - virtual streamsize - showmanyc() - { - streamsize __ret = -1; - if (_M_mode & ios_base::in) - { - _M_update_egptr(); - __ret = this->egptr() - this->gptr(); - } - return __ret; - } - - virtual int_type - underflow(); - - virtual int_type - pbackfail(int_type __c = traits_type::eof()); - - virtual int_type - overflow(int_type __c = traits_type::eof()); - - /** - * @brief Manipulates the buffer. - * @param s Pointer to a buffer area. - * @param n Size of @a s. - * @return @c this - * - * If no buffer has already been created, and both @a s and @a n are - * non-zero, then @c s is used as a buffer; see - * http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#2 - * for more. - */ - virtual __streambuf_type* - setbuf(char_type* __s, streamsize __n) - { - if (__s && __n >= 0) - { - // This is implementation-defined behavior, and assumes - // that an external char_type array of length __n exists - // and has been pre-allocated. If this is not the case, - // things will quickly blow up. - - // Step 1: Destroy the current internal array. - _M_string.clear(); - - // Step 2: Use the external array. - _M_sync(__s, __n, 0); - } - return this; - } - - virtual pos_type - seekoff(off_type __off, ios_base::seekdir __way, - ios_base::openmode __mode = ios_base::in | ios_base::out); - - virtual pos_type - seekpos(pos_type __sp, - ios_base::openmode __mode = ios_base::in | ios_base::out); - - // Internal function for correctly updating the internal buffer - // for a particular _M_string, due to initialization or re-sizing - // of an existing _M_string. - void - _M_sync(char_type* __base, __size_type __i, __size_type __o); - - // Internal function for correctly updating egptr() to the actual - // string end. - void - _M_update_egptr() - { - const bool __testin = _M_mode & ios_base::in; - if (this->pptr() && this->pptr() > this->egptr()) - if (__testin) - this->setg(this->eback(), this->gptr(), this->pptr()); - else - this->setg(this->pptr(), this->pptr(), this->pptr()); - } - }; - - - // [27.7.2] Template class basic_istringstream - /** - * @brief Controlling input for std::string. - * - * This class supports reading from objects of type std::basic_string, - * using the inherited functions from std::basic_istream. To control - * the associated sequence, an instance of std::basic_stringbuf is used, - * which this page refers to as @c sb. - */ - template - class basic_istringstream : public basic_istream<_CharT, _Traits> - { - public: - // Types: - typedef _CharT char_type; - typedef _Traits traits_type; - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 251. basic_stringbuf missing allocator_type - typedef _Alloc allocator_type; - typedef typename traits_type::int_type int_type; - typedef typename traits_type::pos_type pos_type; - typedef typename traits_type::off_type off_type; - - // Non-standard types: - typedef basic_string<_CharT, _Traits, _Alloc> __string_type; - typedef basic_stringbuf<_CharT, _Traits, _Alloc> __stringbuf_type; - typedef basic_istream __istream_type; - - private: - __stringbuf_type _M_stringbuf; - - public: - // Constructors: - /** - * @brief Default constructor starts with an empty string buffer. - * @param mode Whether the buffer can read, or write, or both. - * - * @c ios_base::in is automatically included in @a mode. - * - * Initializes @c sb using @c mode|in, and passes @c &sb to the base - * class initializer. Does not allocate any buffer. - * - * @if maint - * That's a lie. We initialize the base class with NULL, because the - * string class does its own memory management. - * @endif - */ - explicit - basic_istringstream(ios_base::openmode __mode = ios_base::in) - : __istream_type(), _M_stringbuf(__mode | ios_base::in) - { this->init(&_M_stringbuf); } - - /** - * @brief Starts with an existing string buffer. - * @param str A string to copy as a starting buffer. - * @param mode Whether the buffer can read, or write, or both. - * - * @c ios_base::in is automatically included in @a mode. - * - * Initializes @c sb using @a str and @c mode|in, and passes @c &sb - * to the base class initializer. - * - * @if maint - * That's a lie. We initialize the base class with NULL, because the - * string class does its own memory management. - * @endif - */ - explicit - basic_istringstream(const __string_type& __str, - ios_base::openmode __mode = ios_base::in) - : __istream_type(), _M_stringbuf(__str, __mode | ios_base::in) - { this->init(&_M_stringbuf); } - - /** - * @brief The destructor does nothing. - * - * The buffer is deallocated by the stringbuf object, not the - * formatting stream. - */ - ~basic_istringstream() - { } - - // Members: - /** - * @brief Accessing the underlying buffer. - * @return The current basic_stringbuf buffer. - * - * This hides both signatures of std::basic_ios::rdbuf(). - */ - __stringbuf_type* - rdbuf() const - { return const_cast<__stringbuf_type*>(&_M_stringbuf); } - - /** - * @brief Copying out the string buffer. - * @return @c rdbuf()->str() - */ - __string_type - str() const - { return _M_stringbuf.str(); } - - /** - * @brief Setting a new buffer. - * @param s The string to use as a new sequence. - * - * Calls @c rdbuf()->str(s). - */ - void - str(const __string_type& __s) - { _M_stringbuf.str(__s); } - }; - - - // [27.7.3] Template class basic_ostringstream - /** - * @brief Controlling output for std::string. - * - * This class supports writing to objects of type std::basic_string, - * using the inherited functions from std::basic_ostream. To control - * the associated sequence, an instance of std::basic_stringbuf is used, - * which this page refers to as @c sb. - */ - template - class basic_ostringstream : public basic_ostream<_CharT, _Traits> - { - public: - // Types: - typedef _CharT char_type; - typedef _Traits traits_type; - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 251. basic_stringbuf missing allocator_type - typedef _Alloc allocator_type; - typedef typename traits_type::int_type int_type; - typedef typename traits_type::pos_type pos_type; - typedef typename traits_type::off_type off_type; - - // Non-standard types: - typedef basic_string<_CharT, _Traits, _Alloc> __string_type; - typedef basic_stringbuf<_CharT, _Traits, _Alloc> __stringbuf_type; - typedef basic_ostream __ostream_type; - - private: - __stringbuf_type _M_stringbuf; - - public: - // Constructors/destructor: - /** - * @brief Default constructor starts with an empty string buffer. - * @param mode Whether the buffer can read, or write, or both. - * - * @c ios_base::out is automatically included in @a mode. - * - * Initializes @c sb using @c mode|out, and passes @c &sb to the base - * class initializer. Does not allocate any buffer. - * - * @if maint - * That's a lie. We initialize the base class with NULL, because the - * string class does its own memory management. - * @endif - */ - explicit - basic_ostringstream(ios_base::openmode __mode = ios_base::out) - : __ostream_type(), _M_stringbuf(__mode | ios_base::out) - { this->init(&_M_stringbuf); } - - /** - * @brief Starts with an existing string buffer. - * @param str A string to copy as a starting buffer. - * @param mode Whether the buffer can read, or write, or both. - * - * @c ios_base::out is automatically included in @a mode. - * - * Initializes @c sb using @a str and @c mode|out, and passes @c &sb - * to the base class initializer. - * - * @if maint - * That's a lie. We initialize the base class with NULL, because the - * string class does its own memory management. - * @endif - */ - explicit - basic_ostringstream(const __string_type& __str, - ios_base::openmode __mode = ios_base::out) - : __ostream_type(), _M_stringbuf(__str, __mode | ios_base::out) - { this->init(&_M_stringbuf); } - - /** - * @brief The destructor does nothing. - * - * The buffer is deallocated by the stringbuf object, not the - * formatting stream. - */ - ~basic_ostringstream() - { } - - // Members: - /** - * @brief Accessing the underlying buffer. - * @return The current basic_stringbuf buffer. - * - * This hides both signatures of std::basic_ios::rdbuf(). - */ - __stringbuf_type* - rdbuf() const - { return const_cast<__stringbuf_type*>(&_M_stringbuf); } - - /** - * @brief Copying out the string buffer. - * @return @c rdbuf()->str() - */ - __string_type - str() const - { return _M_stringbuf.str(); } - - /** - * @brief Setting a new buffer. - * @param s The string to use as a new sequence. - * - * Calls @c rdbuf()->str(s). - */ - void - str(const __string_type& __s) - { _M_stringbuf.str(__s); } - }; - - - // [27.7.4] Template class basic_stringstream - /** - * @brief Controlling input and output for std::string. - * - * This class supports reading from and writing to objects of type - * std::basic_string, using the inherited functions from - * std::basic_iostream. To control the associated sequence, an instance - * of std::basic_stringbuf is used, which this page refers to as @c sb. - */ - template - class basic_stringstream : public basic_iostream<_CharT, _Traits> - { - public: - // Types: - typedef _CharT char_type; - typedef _Traits traits_type; - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 251. basic_stringbuf missing allocator_type - typedef _Alloc allocator_type; - typedef typename traits_type::int_type int_type; - typedef typename traits_type::pos_type pos_type; - typedef typename traits_type::off_type off_type; - - // Non-standard Types: - typedef basic_string<_CharT, _Traits, _Alloc> __string_type; - typedef basic_stringbuf<_CharT, _Traits, _Alloc> __stringbuf_type; - typedef basic_iostream __iostream_type; - - private: - __stringbuf_type _M_stringbuf; - - public: - // Constructors/destructors - /** - * @brief Default constructor starts with an empty string buffer. - * @param mode Whether the buffer can read, or write, or both. - * - * Initializes @c sb using @c mode, and passes @c &sb to the base - * class initializer. Does not allocate any buffer. - * - * @if maint - * That's a lie. We initialize the base class with NULL, because the - * string class does its own memory management. - * @endif - */ - explicit - basic_stringstream(ios_base::openmode __m = ios_base::out | ios_base::in) - : __iostream_type(), _M_stringbuf(__m) - { this->init(&_M_stringbuf); } - - /** - * @brief Starts with an existing string buffer. - * @param str A string to copy as a starting buffer. - * @param mode Whether the buffer can read, or write, or both. - * - * Initializes @c sb using @a str and @c mode, and passes @c &sb - * to the base class initializer. - * - * @if maint - * That's a lie. We initialize the base class with NULL, because the - * string class does its own memory management. - * @endif - */ - explicit - basic_stringstream(const __string_type& __str, - ios_base::openmode __m = ios_base::out | ios_base::in) - : __iostream_type(), _M_stringbuf(__str, __m) - { this->init(&_M_stringbuf); } - - /** - * @brief The destructor does nothing. - * - * The buffer is deallocated by the stringbuf object, not the - * formatting stream. - */ - ~basic_stringstream() - { } - - // Members: - /** - * @brief Accessing the underlying buffer. - * @return The current basic_stringbuf buffer. - * - * This hides both signatures of std::basic_ios::rdbuf(). - */ - __stringbuf_type* - rdbuf() const - { return const_cast<__stringbuf_type*>(&_M_stringbuf); } - - /** - * @brief Copying out the string buffer. - * @return @c rdbuf()->str() - */ - __string_type - str() const - { return _M_stringbuf.str(); } - - /** - * @brief Setting a new buffer. - * @param s The string to use as a new sequence. - * - * Calls @c rdbuf()->str(s). - */ - void - str(const __string_type& __s) - { _M_stringbuf.str(__s); } - }; - -_GLIBCXX_END_NAMESPACE - -#ifndef _GLIBCXX_EXPORT_TEMPLATE -# include -#endif - -#endif /* _GLIBCXX_SSTREAM */ diff --git a/libstdc++-v3/include/std/std_stack.h b/libstdc++-v3/include/std/std_stack.h deleted file mode 100644 index 396f62e6100..00000000000 --- a/libstdc++-v3/include/std/std_stack.h +++ /dev/null @@ -1,72 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file include/stack - * This is a Standard C++ Library header. - */ - -#ifndef _GLIBCXX_STACK -#define _GLIBCXX_STACK 1 - -#pragma GCC system_header - -#include -#include -#include -#include -#include -#include - -#endif /* _GLIBCXX_STACK */ diff --git a/libstdc++-v3/include/std/std_stdexcept.h b/libstdc++-v3/include/std/std_stdexcept.h deleted file mode 100644 index 2d56b3817d4..00000000000 --- a/libstdc++-v3/include/std/std_stdexcept.h +++ /dev/null @@ -1,148 +0,0 @@ -// Standard exception classes -*- C++ -*- - -// Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/** @file stdexcept - * This is a Standard C++ Library header. - */ - -// -// ISO C++ 19.1 Exception classes -// - -#ifndef _GLIBCXX_STDEXCEPT -#define _GLIBCXX_STDEXCEPT 1 - -#pragma GCC system_header - -#include -#include - -_GLIBCXX_BEGIN_NAMESPACE(std) - - /** Logic errors represent problems in the internal logic of a program; - * in theory, these are preventable, and even detectable before the - * program runs (e.g., violations of class invariants). - * @brief One of two subclasses of exception. - */ - class logic_error : public exception - { - string _M_msg; - - public: - /** Takes a character string describing the error. */ - explicit - logic_error(const string& __arg); - - virtual - ~logic_error() throw(); - - /** Returns a C-style character string describing the general cause of - * the current error (the same string passed to the ctor). */ - virtual const char* - what() const throw(); - }; - - /** Thrown by the library, or by you, to report domain errors (domain in - * the mathmatical sense). */ - class domain_error : public logic_error - { - public: - explicit domain_error(const string& __arg); - }; - - /** Thrown to report invalid arguments to functions. */ - class invalid_argument : public logic_error - { - public: - explicit invalid_argument(const string& __arg); - }; - - /** Thrown when an object is constructed that would exceed its maximum - * permitted size (e.g., a basic_string instance). */ - class length_error : public logic_error - { - public: - explicit length_error(const string& __arg); - }; - - /** This represents an argument whose value is not within the expected - * range (e.g., boundary checks in basic_string). */ - class out_of_range : public logic_error - { - public: - explicit out_of_range(const string& __arg); - }; - - /** Runtime errors represent problems outside the scope of a program; - * they cannot be easily predicted and can generally only be caught as - * the program executes. - * @brief One of two subclasses of exception. - */ - class runtime_error : public exception - { - string _M_msg; - - public: - /** Takes a character string describing the error. */ - explicit - runtime_error(const string& __arg); - - virtual - ~runtime_error() throw(); - - /** Returns a C-style character string describing the general cause of - * the current error (the same string passed to the ctor). */ - virtual const char* - what() const throw(); - }; - - /** Thrown to indicate range errors in internal computations. */ - class range_error : public runtime_error - { - public: - explicit range_error(const string& __arg); - }; - - /** Thrown to indicate arithmetic overflow. */ - class overflow_error : public runtime_error - { - public: - explicit overflow_error(const string& __arg); - }; - - /** Thrown to indicate arithmetic underflow. */ - class underflow_error : public runtime_error - { - public: - explicit underflow_error(const string& __arg); - }; - -_GLIBCXX_END_NAMESPACE - -#endif /* _GLIBCXX_STDEXCEPT */ diff --git a/libstdc++-v3/include/std/std_streambuf.h b/libstdc++-v3/include/std/std_streambuf.h deleted file mode 100644 index 9de7907120f..00000000000 --- a/libstdc++-v3/include/std/std_streambuf.h +++ /dev/null @@ -1,823 +0,0 @@ -// Stream buffer classes -*- C++ -*- - -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/** @file streambuf - * This is a Standard C++ Library header. - */ - -// -// ISO C++ 14882: 27.5 Stream buffers -// - -#ifndef _GLIBXX_STREAMBUF -#define _GLIBXX_STREAMBUF 1 - -#pragma GCC system_header - -#include -#include -#include -#include -#include -#include - -_GLIBCXX_BEGIN_NAMESPACE(std) - - /** - * @if maint - * Does stuff. - * @endif - */ - template - streamsize - __copy_streambufs_eof(basic_streambuf<_CharT, _Traits>*, - basic_streambuf<_CharT, _Traits>*, bool&); - - /** - * @brief The actual work of input and output (interface). - * - * This is a base class. Derived stream buffers each control a - * pair of character sequences: one for input, and one for output. - * - * Section [27.5.1] of the standard describes the requirements and - * behavior of stream buffer classes. That section (three paragraphs) - * is reproduced here, for simplicity and accuracy. - * - * -# Stream buffers can impose various constraints on the sequences - * they control. Some constraints are: - * - The controlled input sequence can be not readable. - * - The controlled output sequence can be not writable. - * - The controlled sequences can be associated with the contents of - * other representations for character sequences, such as external - * files. - * - The controlled sequences can support operations @e directly to or - * from associated sequences. - * - The controlled sequences can impose limitations on how the - * program can read characters from a sequence, write characters to - * a sequence, put characters back into an input sequence, or alter - * the stream position. - * . - * -# Each sequence is characterized by three pointers which, if non-null, - * all point into the same @c charT array object. The array object - * represents, at any moment, a (sub)sequence of characters from the - * sequence. Operations performed on a sequence alter the values - * stored in these pointers, perform reads and writes directly to or - * from associated sequences, and alter "the stream position" and - * conversion state as needed to maintain this subsequence relationship. - * The three pointers are: - * - the beginning pointer, or lowest element address in the - * array (called @e xbeg here); - * - the next pointer, or next element address that is a - * current candidate for reading or writing (called @e xnext here); - * - the end pointer, or first element address beyond the - * end of the array (called @e xend here). - * . - * -# The following semantic constraints shall always apply for any set - * of three pointers for a sequence, using the pointer names given - * immediately above: - * - If @e xnext is not a null pointer, then @e xbeg and @e xend shall - * also be non-null pointers into the same @c charT array, as - * described above; otherwise, @e xbeg and @e xend shall also be null. - * - If @e xnext is not a null pointer and @e xnext < @e xend for an - * output sequence, then a write position is available. - * In this case, @e *xnext shall be assignable as the next element - * to write (to put, or to store a character value, into the sequence). - * - If @e xnext is not a null pointer and @e xbeg < @e xnext for an - * input sequence, then a putback position is available. - * In this case, @e xnext[-1] shall have a defined value and is the - * next (preceding) element to store a character that is put back - * into the input sequence. - * - If @e xnext is not a null pointer and @e xnext< @e xend for an - * input sequence, then a read position is available. - * In this case, @e *xnext shall have a defined value and is the - * next element to read (to get, or to obtain a character value, - * from the sequence). - */ - template - class basic_streambuf - { - public: - //@{ - /** - * These are standard types. They permit a standardized way of - * referring to names of (or names dependant on) the template - * parameters, which are specific to the implementation. - */ - typedef _CharT char_type; - typedef _Traits traits_type; - typedef typename traits_type::int_type int_type; - typedef typename traits_type::pos_type pos_type; - typedef typename traits_type::off_type off_type; - //@} - - //@{ - /** - * @if maint - * This is a non-standard type. - * @endif - */ - typedef basic_streambuf __streambuf_type; - //@} - - friend class basic_ios; - friend class basic_istream; - friend class basic_ostream; - friend class istreambuf_iterator; - friend class ostreambuf_iterator; - - friend streamsize - __copy_streambufs_eof<>(__streambuf_type*, __streambuf_type*, bool&); - - template - friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, - _CharT2*>::__type - __copy_aux(istreambuf_iterator<_CharT2>, - istreambuf_iterator<_CharT2>, _CharT2*); - - template - friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, - istreambuf_iterator<_CharT2> >::__type - find(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>, - const _CharT2&); - - template - friend basic_istream<_CharT2, _Traits2>& - operator>>(basic_istream<_CharT2, _Traits2>&, _CharT2*); - - template - friend basic_istream<_CharT2, _Traits2>& - operator>>(basic_istream<_CharT2, _Traits2>&, - basic_string<_CharT2, _Traits2, _Alloc>&); - - template - friend basic_istream<_CharT2, _Traits2>& - getline(basic_istream<_CharT2, _Traits2>&, - basic_string<_CharT2, _Traits2, _Alloc>&, _CharT2); - - protected: - //@{ - /** - * @if maint - * This is based on _IO_FILE, just reordered to be more consistent, - * and is intended to be the most minimal abstraction for an - * internal buffer. - * - get == input == read - * - put == output == write - * @endif - */ - char_type* _M_in_beg; // Start of get area. - char_type* _M_in_cur; // Current read area. - char_type* _M_in_end; // End of get area. - char_type* _M_out_beg; // Start of put area. - char_type* _M_out_cur; // Current put area. - char_type* _M_out_end; // End of put area. - - /** - * @if maint - * Current locale setting. - * @endif - */ - locale _M_buf_locale; - - public: - /// Destructor deallocates no buffer space. - virtual - ~basic_streambuf() - { } - - // [27.5.2.2.1] locales - /** - * @brief Entry point for imbue(). - * @param loc The new locale. - * @return The previous locale. - * - * Calls the derived imbue(loc). - */ - locale - pubimbue(const locale &__loc) - { - locale __tmp(this->getloc()); - this->imbue(__loc); - _M_buf_locale = __loc; - return __tmp; - } - - /** - * @brief Locale access. - * @return The current locale in effect. - * - * If pubimbue(loc) has been called, then the most recent @c loc - * is returned. Otherwise the global locale in effect at the time - * of construction is returned. - */ - locale - getloc() const - { return _M_buf_locale; } - - // [27.5.2.2.2] buffer management and positioning - //@{ - /** - * @brief Entry points for derived buffer functions. - * - * The public versions of @c pubfoo dispatch to the protected - * derived @c foo member functions, passing the arguments (if any) - * and returning the result unchanged. - */ - __streambuf_type* - pubsetbuf(char_type* __s, streamsize __n) - { return this->setbuf(__s, __n); } - - pos_type - pubseekoff(off_type __off, ios_base::seekdir __way, - ios_base::openmode __mode = ios_base::in | ios_base::out) - { return this->seekoff(__off, __way, __mode); } - - pos_type - pubseekpos(pos_type __sp, - ios_base::openmode __mode = ios_base::in | ios_base::out) - { return this->seekpos(__sp, __mode); } - - int - pubsync() { return this->sync(); } - //@} - - // [27.5.2.2.3] get area - /** - * @brief Looking ahead into the stream. - * @return The number of characters available. - * - * If a read position is available, returns the number of characters - * available for reading before the buffer must be refilled. - * Otherwise returns the derived @c showmanyc(). - */ - streamsize - in_avail() - { - const streamsize __ret = this->egptr() - this->gptr(); - return __ret ? __ret : this->showmanyc(); - } - - /** - * @brief Getting the next character. - * @return The next character, or eof. - * - * Calls @c sbumpc(), and if that function returns - * @c traits::eof(), so does this function. Otherwise, @c sgetc(). - */ - int_type - snextc() - { - int_type __ret = traits_type::eof(); - if (__builtin_expect(!traits_type::eq_int_type(this->sbumpc(), - __ret), true)) - __ret = this->sgetc(); - return __ret; - } - - /** - * @brief Getting the next character. - * @return The next character, or eof. - * - * If the input read position is available, returns that character - * and increments the read pointer, otherwise calls and returns - * @c uflow(). - */ - int_type - sbumpc() - { - int_type __ret; - if (__builtin_expect(this->gptr() < this->egptr(), true)) - { - __ret = traits_type::to_int_type(*this->gptr()); - this->gbump(1); - } - else - __ret = this->uflow(); - return __ret; - } - - /** - * @brief Getting the next character. - * @return The next character, or eof. - * - * If the input read position is available, returns that character, - * otherwise calls and returns @c underflow(). Does not move the - * read position after fetching the character. - */ - int_type - sgetc() - { - int_type __ret; - if (__builtin_expect(this->gptr() < this->egptr(), true)) - __ret = traits_type::to_int_type(*this->gptr()); - else - __ret = this->underflow(); - return __ret; - } - - /** - * @brief Entry point for xsgetn. - * @param s A buffer area. - * @param n A count. - * - * Returns xsgetn(s,n). The effect is to fill @a s[0] through - * @a s[n-1] with characters from the input sequence, if possible. - */ - streamsize - sgetn(char_type* __s, streamsize __n) - { return this->xsgetn(__s, __n); } - - // [27.5.2.2.4] putback - /** - * @brief Pushing characters back into the input stream. - * @param c The character to push back. - * @return The previous character, if possible. - * - * Similar to sungetc(), but @a c is pushed onto the stream instead - * of "the previous character". If successful, the next character - * fetched from the input stream will be @a c. - */ - int_type - sputbackc(char_type __c) - { - int_type __ret; - const bool __testpos = this->eback() < this->gptr(); - if (__builtin_expect(!__testpos || - !traits_type::eq(__c, this->gptr()[-1]), false)) - __ret = this->pbackfail(traits_type::to_int_type(__c)); - else - { - this->gbump(-1); - __ret = traits_type::to_int_type(*this->gptr()); - } - return __ret; - } - - /** - * @brief Moving backwards in the input stream. - * @return The previous character, if possible. - * - * If a putback position is available, this function decrements the - * input pointer and returns that character. Otherwise, calls and - * returns pbackfail(). The effect is to "unget" the last character - * "gotten". - */ - int_type - sungetc() - { - int_type __ret; - if (__builtin_expect(this->eback() < this->gptr(), true)) - { - this->gbump(-1); - __ret = traits_type::to_int_type(*this->gptr()); - } - else - __ret = this->pbackfail(); - return __ret; - } - - // [27.5.2.2.5] put area - /** - * @brief Entry point for all single-character output functions. - * @param c A character to output. - * @return @a c, if possible. - * - * One of two public output functions. - * - * If a write position is available for the output sequence (i.e., - * the buffer is not full), stores @a c in that position, increments - * the position, and returns @c traits::to_int_type(c). If a write - * position is not available, returns @c overflow(c). - */ - int_type - sputc(char_type __c) - { - int_type __ret; - if (__builtin_expect(this->pptr() < this->epptr(), true)) - { - *this->pptr() = __c; - this->pbump(1); - __ret = traits_type::to_int_type(__c); - } - else - __ret = this->overflow(traits_type::to_int_type(__c)); - return __ret; - } - - /** - * @brief Entry point for all single-character output functions. - * @param s A buffer read area. - * @param n A count. - * - * One of two public output functions. - * - * - * Returns xsputn(s,n). The effect is to write @a s[0] through - * @a s[n-1] to the output sequence, if possible. - */ - streamsize - sputn(const char_type* __s, streamsize __n) - { return this->xsputn(__s, __n); } - - protected: - /** - * @brief Base constructor. - * - * Only called from derived constructors, and sets up all the - * buffer data to zero, including the pointers described in the - * basic_streambuf class description. Note that, as a result, - * - the class starts with no read nor write positions available, - * - this is not an error - */ - basic_streambuf() - : _M_in_beg(0), _M_in_cur(0), _M_in_end(0), - _M_out_beg(0), _M_out_cur(0), _M_out_end(0), - _M_buf_locale(locale()) - { } - - // [27.5.2.3.1] get area access - //@{ - /** - * @brief Access to the get area. - * - * These functions are only available to other protected functions, - * including derived classes. - * - * - eback() returns the beginning pointer for the input sequence - * - gptr() returns the next pointer for the input sequence - * - egptr() returns the end pointer for the input sequence - */ - char_type* - eback() const { return _M_in_beg; } - - char_type* - gptr() const { return _M_in_cur; } - - char_type* - egptr() const { return _M_in_end; } - //@} - - /** - * @brief Moving the read position. - * @param n The delta by which to move. - * - * This just advances the read position without returning any data. - */ - void - gbump(int __n) { _M_in_cur += __n; } - - /** - * @brief Setting the three read area pointers. - * @param gbeg A pointer. - * @param gnext A pointer. - * @param gend A pointer. - * @post @a gbeg == @c eback(), @a gnext == @c gptr(), and - * @a gend == @c egptr() - */ - void - setg(char_type* __gbeg, char_type* __gnext, char_type* __gend) - { - _M_in_beg = __gbeg; - _M_in_cur = __gnext; - _M_in_end = __gend; - } - - // [27.5.2.3.2] put area access - //@{ - /** - * @brief Access to the put area. - * - * These functions are only available to other protected functions, - * including derived classes. - * - * - pbase() returns the beginning pointer for the output sequence - * - pptr() returns the next pointer for the output sequence - * - epptr() returns the end pointer for the output sequence - */ - char_type* - pbase() const { return _M_out_beg; } - - char_type* - pptr() const { return _M_out_cur; } - - char_type* - epptr() const { return _M_out_end; } - //@} - - /** - * @brief Moving the write position. - * @param n The delta by which to move. - * - * This just advances the write position without returning any data. - */ - void - pbump(int __n) { _M_out_cur += __n; } - - /** - * @brief Setting the three write area pointers. - * @param pbeg A pointer. - * @param pend A pointer. - * @post @a pbeg == @c pbase(), @a pbeg == @c pptr(), and - * @a pend == @c epptr() - */ - void - setp(char_type* __pbeg, char_type* __pend) - { - _M_out_beg = _M_out_cur = __pbeg; - _M_out_end = __pend; - } - - // [27.5.2.4] virtual functions - // [27.5.2.4.1] locales - /** - * @brief Changes translations. - * @param loc A new locale. - * - * Translations done during I/O which depend on the current locale - * are changed by this call. The standard adds, "Between invocations - * of this function a class derived from streambuf can safely cache - * results of calls to locale functions and to members of facets - * so obtained." - * - * @note Base class version does nothing. - */ - virtual void - imbue(const locale&) - { } - - // [27.5.2.4.2] buffer management and positioning - /** - * @brief Maniuplates the buffer. - * - * Each derived class provides its own appropriate behavior. See - * the next-to-last paragraph of - * http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#2 for - * more on this function. - * - * @note Base class version does nothing, returns @c this. - */ - virtual basic_streambuf* - setbuf(char_type*, streamsize) - { return this; } - - /** - * @brief Alters the stream positions. - * - * Each derived class provides its own appropriate behavior. - * @note Base class version does nothing, returns a @c pos_type - * that represents an invalid stream position. - */ - virtual pos_type - seekoff(off_type, ios_base::seekdir, - ios_base::openmode /*__mode*/ = ios_base::in | ios_base::out) - { return pos_type(off_type(-1)); } - - /** - * @brief Alters the stream positions. - * - * Each derived class provides its own appropriate behavior. - * @note Base class version does nothing, returns a @c pos_type - * that represents an invalid stream position. - */ - virtual pos_type - seekpos(pos_type, - ios_base::openmode /*__mode*/ = ios_base::in | ios_base::out) - { return pos_type(off_type(-1)); } - - /** - * @brief Synchronizes the buffer arrays with the controlled sequences. - * @return -1 on failure. - * - * Each derived class provides its own appropriate behavior, - * including the definition of "failure". - * @note Base class version does nothing, returns zero. - */ - virtual int - sync() { return 0; } - - // [27.5.2.4.3] get area - /** - * @brief Investigating the data available. - * @return An estimate of the number of characters available in the - * input sequence, or -1. - * - * "If it returns a positive value, then successive calls to - * @c underflow() will not return @c traits::eof() until at least that - * number of characters have been supplied. If @c showmanyc() - * returns -1, then calls to @c underflow() or @c uflow() will fail." - * [27.5.2.4.3]/1 - * - * @note Base class version does nothing, returns zero. - * @note The standard adds that "the intention is not only that the - * calls [to underflow or uflow] will not return @c eof() but - * that they will return "immediately". - * @note The standard adds that "the morphemes of @c showmanyc are - * "es-how-many-see", not "show-manic". - */ - virtual streamsize - showmanyc() { return 0; } - - /** - * @brief Multiple character extraction. - * @param s A buffer area. - * @param n Maximum number of characters to assign. - * @return The number of characters assigned. - * - * Fills @a s[0] through @a s[n-1] with characters from the input - * sequence, as if by @c sbumpc(). Stops when either @a n characters - * have been copied, or when @c traits::eof() would be copied. - * - * It is expected that derived classes provide a more efficient - * implementation by overriding this definition. - */ - virtual streamsize - xsgetn(char_type* __s, streamsize __n); - - /** - * @brief Fetches more data from the controlled sequence. - * @return The first character from the pending sequence. - * - * Informally, this function is called when the input buffer is - * exhausted (or does not exist, as buffering need not actually be - * done). If a buffer exists, it is "refilled". In either case, the - * next available character is returned, or @c traits::eof() to - * indicate a null pending sequence. - * - * For a formal definiton of the pending sequence, see a good text - * such as Langer & Kreft, or [27.5.2.4.3]/7-14. - * - * A functioning input streambuf can be created by overriding only - * this function (no buffer area will be used). For an example, see - * http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#6 - * - * @note Base class version does nothing, returns eof(). - */ - virtual int_type - underflow() - { return traits_type::eof(); } - - /** - * @brief Fetches more data from the controlled sequence. - * @return The first character from the pending sequence. - * - * Informally, this function does the same thing as @c underflow(), - * and in fact is required to call that function. It also returns - * the new character, like @c underflow() does. However, this - * function also moves the read position forward by one. - */ - virtual int_type - uflow() - { - int_type __ret = traits_type::eof(); - const bool __testeof = traits_type::eq_int_type(this->underflow(), - __ret); - if (!__testeof) - { - __ret = traits_type::to_int_type(*this->gptr()); - this->gbump(1); - } - return __ret; - } - - // [27.5.2.4.4] putback - /** - * @brief Tries to back up the input sequence. - * @param c The character to be inserted back into the sequence. - * @return eof() on failure, "some other value" on success - * @post The constraints of @c gptr(), @c eback(), and @c pptr() - * are the same as for @c underflow(). - * - * @note Base class version does nothing, returns eof(). - */ - virtual int_type - pbackfail(int_type /* __c */ = traits_type::eof()) - { return traits_type::eof(); } - - // Put area: - /** - * @brief Multiple character insertion. - * @param s A buffer area. - * @param n Maximum number of characters to write. - * @return The number of characters written. - * - * Writes @a s[0] through @a s[n-1] to the output sequence, as if - * by @c sputc(). Stops when either @a n characters have been - * copied, or when @c sputc() would return @c traits::eof(). - * - * It is expected that derived classes provide a more efficient - * implementation by overriding this definition. - */ - virtual streamsize - xsputn(const char_type* __s, streamsize __n); - - /** - * @brief Consumes data from the buffer; writes to the - * controlled sequence. - * @param c An additional character to consume. - * @return eof() to indicate failure, something else (usually - * @a c, or not_eof()) - * - * Informally, this function is called when the output buffer is full - * (or does not exist, as buffering need not actually be done). If a - * buffer exists, it is "consumed", with "some effect" on the - * controlled sequence. (Typically, the buffer is written out to the - * sequence verbatim.) In either case, the character @a c is also - * written out, if @a c is not @c eof(). - * - * For a formal definiton of this function, see a good text - * such as Langer & Kreft, or [27.5.2.4.5]/3-7. - * - * A functioning output streambuf can be created by overriding only - * this function (no buffer area will be used). - * - * @note Base class version does nothing, returns eof(). - */ - virtual int_type - overflow(int_type /* __c */ = traits_type::eof()) - { return traits_type::eof(); } - -#ifdef _GLIBCXX_DEPRECATED - // Annex D.6 - public: - /** - * @brief Tosses a character. - * - * Advances the read pointer, ignoring the character that would have - * been read. - * - * See http://gcc.gnu.org/ml/libstdc++/2002-05/msg00168.html - * - * @note This function has been deprecated by the standard. You - * must define @c _GLIBCXX_DEPRECATED to make this visible; see - * c++config.h. - */ - void - stossc() - { - if (this->gptr() < this->egptr()) - this->gbump(1); - else - this->uflow(); - } -#endif - - private: - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // Side effect of DR 50. - basic_streambuf(const __streambuf_type& __sb) - : _M_in_beg(__sb._M_in_beg), _M_in_cur(__sb._M_in_cur), - _M_in_end(__sb._M_in_end), _M_out_beg(__sb._M_out_beg), - _M_out_cur(__sb._M_out_cur), _M_out_end(__sb._M_out_cur), - _M_buf_locale(__sb._M_buf_locale) - { } - - __streambuf_type& - operator=(const __streambuf_type&) { return *this; }; - }; - - // Explicit specialization declarations, defined in src/streambuf.cc. - template<> - streamsize - __copy_streambufs_eof(basic_streambuf* __sbin, - basic_streambuf* __sbout, bool& __ineof); -#ifdef _GLIBCXX_USE_WCHAR_T - template<> - streamsize - __copy_streambufs_eof(basic_streambuf* __sbin, - basic_streambuf* __sbout, bool& __ineof); -#endif - -_GLIBCXX_END_NAMESPACE - -#ifndef _GLIBCXX_EXPORT_TEMPLATE -# include -#endif - -#endif /* _GLIBCXX_STREAMBUF */ diff --git a/libstdc++-v3/include/std/std_string.h b/libstdc++-v3/include/std/std_string.h deleted file mode 100644 index c38d5257515..00000000000 --- a/libstdc++-v3/include/std/std_string.h +++ /dev/null @@ -1,59 +0,0 @@ -// Components for manipulating sequences of characters -*- C++ -*- - -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/** @file include/string - * This is a Standard C++ Library header. - */ - -// -// ISO C++ 14882: 21 Strings library -// - -#ifndef _GLIBCXX_STRING -#define _GLIBCXX_STRING 1 - -#pragma GCC system_header - -#include -#include -#include -#include // For allocator. -#include -#include // For operators >>, <<, and getline decls. -#include -#include // For less -#include - -#ifndef _GLIBCXX_EXPORT_TEMPLATE -# include // for find_if -# include -#endif - -#endif /* _GLIBCXX_STRING */ diff --git a/libstdc++-v3/include/std/std_utility.h b/libstdc++-v3/include/std/std_utility.h deleted file mode 100644 index 84c9131d82b..00000000000 --- a/libstdc++-v3/include/std/std_utility.h +++ /dev/null @@ -1,69 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2001, 2002 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996,1997 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file include/utility - * This is a Standard C++ Library header. - */ - -#ifndef _GLIBCXX_UTILITY -#define _GLIBCXX_UTILITY 1 - -#pragma GCC system_header - -#include -#include -#include - -#endif /* _GLIBCXX_UTILITY */ diff --git a/libstdc++-v3/include/std/std_valarray.h b/libstdc++-v3/include/std/std_valarray.h deleted file mode 100644 index 91b1637c712..00000000000 --- a/libstdc++-v3/include/std/std_valarray.h +++ /dev/null @@ -1,1026 +0,0 @@ -// The template and inlines for the -*- C++ -*- valarray class. - -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006 -// Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/** @file valarray - * This is a Standard C++ Library header. - */ - -// Written by Gabriel Dos Reis - -#ifndef _GLIBCXX_VALARRAY -#define _GLIBCXX_VALARRAY 1 - -#pragma GCC system_header - -#include -#include -#include -#include -#include -#include -#include - -_GLIBCXX_BEGIN_NAMESPACE(std) - - template - class _Expr; - - template - class _ValArray; - - template class _Meta, class _Dom> - struct _UnClos; - - template class _Meta1, - template class _Meta2, - class _Dom1, class _Dom2> - class _BinClos; - - template class _Meta, class _Dom> - class _SClos; - - template class _Meta, class _Dom> - class _GClos; - - template class _Meta, class _Dom> - class _IClos; - - template class _Meta, class _Dom> - class _ValFunClos; - - template class _Meta, class _Dom> - class _RefFunClos; - - template class valarray; // An array of type _Tp - class slice; // BLAS-like slice out of an array - template class slice_array; - class gslice; // generalized slice out of an array - template class gslice_array; - template class mask_array; // masked array - template class indirect_array; // indirected array - -_GLIBCXX_END_NAMESPACE - -#include -#include - -_GLIBCXX_BEGIN_NAMESPACE(std) - - /** - * @brief Smart array designed to support numeric processing. - * - * A valarray is an array that provides constraints intended to allow for - * effective optimization of numeric array processing by reducing the - * aliasing that can result from pointer representations. It represents a - * one-dimensional array from which different multidimensional subsets can - * be accessed and modified. - * - * @param Tp Type of object in the array. - */ - template - class valarray - { - template - struct _UnaryOp - { - typedef typename __fun<_Op, _Tp>::result_type __rt; - typedef _Expr<_UnClos<_Op, _ValArray, _Tp>, __rt> _Rt; - }; - public: - typedef _Tp value_type; - - // _lib.valarray.cons_ construct/destroy: - /// Construct an empty array. - valarray(); - - /// Construct an array with @a n elements. - explicit valarray(size_t); - - /// Construct an array with @a n elements initialized to @a t. - valarray(const _Tp&, size_t); - - /// Construct an array initialized to the first @a n elements of @a t. - valarray(const _Tp* __restrict__, size_t); - - /// Copy constructor. - valarray(const valarray&); - - /// Construct an array with the same size and values in @a sa. - valarray(const slice_array<_Tp>&); - - /// Construct an array with the same size and values in @a ga. - valarray(const gslice_array<_Tp>&); - - /// Construct an array with the same size and values in @a ma. - valarray(const mask_array<_Tp>&); - - /// Construct an array with the same size and values in @a ia. - valarray(const indirect_array<_Tp>&); - - template - valarray(const _Expr<_Dom, _Tp>& __e); - - ~valarray(); - - // _lib.valarray.assign_ assignment: - /** - * @brief Assign elements to an array. - * - * Assign elements of array to values in @a v. Results are undefined - * if @a v does not have the same size as this array. - * - * @param v Valarray to get values from. - */ - valarray<_Tp>& operator=(const valarray<_Tp>&); - - /** - * @brief Assign elements to a value. - * - * Assign all elements of array to @a t. - * - * @param t Value for elements. - */ - valarray<_Tp>& operator=(const _Tp&); - - /** - * @brief Assign elements to an array subset. - * - * Assign elements of array to values in @a sa. Results are undefined - * if @a sa does not have the same size as this array. - * - * @param sa Array slice to get values from. - */ - valarray<_Tp>& operator=(const slice_array<_Tp>&); - - /** - * @brief Assign elements to an array subset. - * - * Assign elements of array to values in @a ga. Results are undefined - * if @a ga does not have the same size as this array. - * - * @param ga Array slice to get values from. - */ - valarray<_Tp>& operator=(const gslice_array<_Tp>&); - - /** - * @brief Assign elements to an array subset. - * - * Assign elements of array to values in @a ma. Results are undefined - * if @a ma does not have the same size as this array. - * - * @param ma Array slice to get values from. - */ - valarray<_Tp>& operator=(const mask_array<_Tp>&); - - /** - * @brief Assign elements to an array subset. - * - * Assign elements of array to values in @a ia. Results are undefined - * if @a ia does not have the same size as this array. - * - * @param ia Array slice to get values from. - */ - valarray<_Tp>& operator=(const indirect_array<_Tp>&); - - template valarray<_Tp>& - operator= (const _Expr<_Dom, _Tp>&); - - // _lib.valarray.access_ element access: - /** - * Return a reference to the i'th array element. - * - * @param i Index of element to return. - * @return Reference to the i'th element. - */ - _Tp& operator[](size_t); - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 389. Const overload of valarray::operator[] returns by value. - const _Tp& operator[](size_t) const; - - // _lib.valarray.sub_ subset operations: - /** - * @brief Return an array subset. - * - * Returns a new valarray containing the elements of the array - * indicated by the slice argument. The new valarray has the same size - * as the input slice. @see slice. - * - * @param s The source slice. - * @return New valarray containing elements in @a s. - */ - _Expr<_SClos<_ValArray, _Tp>, _Tp> operator[](slice) const; - - /** - * @brief Return a reference to an array subset. - * - * Returns a new valarray containing the elements of the array - * indicated by the slice argument. The new valarray has the same size - * as the input slice. @see slice. - * - * @param s The source slice. - * @return New valarray containing elements in @a s. - */ - slice_array<_Tp> operator[](slice); - - /** - * @brief Return an array subset. - * - * Returns a slice_array referencing the elements of the array - * indicated by the slice argument. @see gslice. - * - * @param s The source slice. - * @return Slice_array referencing elements indicated by @a s. - */ - _Expr<_GClos<_ValArray, _Tp>, _Tp> operator[](const gslice&) const; - - /** - * @brief Return a reference to an array subset. - * - * Returns a new valarray containing the elements of the array - * indicated by the gslice argument. The new valarray has - * the same size as the input gslice. @see gslice. - * - * @param s The source gslice. - * @return New valarray containing elements in @a s. - */ - gslice_array<_Tp> operator[](const gslice&); - - /** - * @brief Return an array subset. - * - * Returns a new valarray containing the elements of the array - * indicated by the argument. The input is a valarray of bool which - * represents a bitmask indicating which elements should be copied into - * the new valarray. Each element of the array is added to the return - * valarray if the corresponding element of the argument is true. - * - * @param m The valarray bitmask. - * @return New valarray containing elements indicated by @a m. - */ - valarray<_Tp> operator[](const valarray&) const; - - /** - * @brief Return a reference to an array subset. - * - * Returns a new mask_array referencing the elements of the array - * indicated by the argument. The input is a valarray of bool which - * represents a bitmask indicating which elements are part of the - * subset. Elements of the array are part of the subset if the - * corresponding element of the argument is true. - * - * @param m The valarray bitmask. - * @return New valarray containing elements indicated by @a m. - */ - mask_array<_Tp> operator[](const valarray&); - - /** - * @brief Return an array subset. - * - * Returns a new valarray containing the elements of the array - * indicated by the argument. The elements in the argument are - * interpreted as the indices of elements of this valarray to copy to - * the return valarray. - * - * @param i The valarray element index list. - * @return New valarray containing elements in @a s. - */ - _Expr<_IClos<_ValArray, _Tp>, _Tp> - operator[](const valarray&) const; - - /** - * @brief Return a reference to an array subset. - * - * Returns an indirect_array referencing the elements of the array - * indicated by the argument. The elements in the argument are - * interpreted as the indices of elements of this valarray to include - * in the subset. The returned indirect_array refers to these - * elements. - * - * @param i The valarray element index list. - * @return Indirect_array referencing elements in @a i. - */ - indirect_array<_Tp> operator[](const valarray&); - - // _lib.valarray.unary_ unary operators: - /// Return a new valarray by applying unary + to each element. - typename _UnaryOp<__unary_plus>::_Rt operator+() const; - - /// Return a new valarray by applying unary - to each element. - typename _UnaryOp<__negate>::_Rt operator-() const; - - /// Return a new valarray by applying unary ~ to each element. - typename _UnaryOp<__bitwise_not>::_Rt operator~() const; - - /// Return a new valarray by applying unary ! to each element. - typename _UnaryOp<__logical_not>::_Rt operator!() const; - - // _lib.valarray.cassign_ computed assignment: - /// Multiply each element of array by @a t. - valarray<_Tp>& operator*=(const _Tp&); - - /// Divide each element of array by @a t. - valarray<_Tp>& operator/=(const _Tp&); - - /// Set each element e of array to e % @a t. - valarray<_Tp>& operator%=(const _Tp&); - - /// Add @a t to each element of array. - valarray<_Tp>& operator+=(const _Tp&); - - /// Subtract @a t to each element of array. - valarray<_Tp>& operator-=(const _Tp&); - - /// Set each element e of array to e ^ @a t. - valarray<_Tp>& operator^=(const _Tp&); - - /// Set each element e of array to e & @a t. - valarray<_Tp>& operator&=(const _Tp&); - - /// Set each element e of array to e | @a t. - valarray<_Tp>& operator|=(const _Tp&); - - /// Left shift each element e of array by @a t bits. - valarray<_Tp>& operator<<=(const _Tp&); - - /// Right shift each element e of array by @a t bits. - valarray<_Tp>& operator>>=(const _Tp&); - - /// Multiply elements of array by corresponding elements of @a v. - valarray<_Tp>& operator*=(const valarray<_Tp>&); - - /// Divide elements of array by corresponding elements of @a v. - valarray<_Tp>& operator/=(const valarray<_Tp>&); - - /// Modulo elements of array by corresponding elements of @a v. - valarray<_Tp>& operator%=(const valarray<_Tp>&); - - /// Add corresponding elements of @a v to elements of array. - valarray<_Tp>& operator+=(const valarray<_Tp>&); - - /// Subtract corresponding elements of @a v from elements of array. - valarray<_Tp>& operator-=(const valarray<_Tp>&); - - /// Logical xor corresponding elements of @a v with elements of array. - valarray<_Tp>& operator^=(const valarray<_Tp>&); - - /// Logical or corresponding elements of @a v with elements of array. - valarray<_Tp>& operator|=(const valarray<_Tp>&); - - /// Logical and corresponding elements of @a v with elements of array. - valarray<_Tp>& operator&=(const valarray<_Tp>&); - - /// Left shift elements of array by corresponding elements of @a v. - valarray<_Tp>& operator<<=(const valarray<_Tp>&); - - /// Right shift elements of array by corresponding elements of @a v. - valarray<_Tp>& operator>>=(const valarray<_Tp>&); - - template - valarray<_Tp>& operator*=(const _Expr<_Dom, _Tp>&); - template - valarray<_Tp>& operator/=(const _Expr<_Dom, _Tp>&); - template - valarray<_Tp>& operator%=(const _Expr<_Dom, _Tp>&); - template - valarray<_Tp>& operator+=(const _Expr<_Dom, _Tp>&); - template - valarray<_Tp>& operator-=(const _Expr<_Dom, _Tp>&); - template - valarray<_Tp>& operator^=(const _Expr<_Dom, _Tp>&); - template - valarray<_Tp>& operator|=(const _Expr<_Dom, _Tp>&); - template - valarray<_Tp>& operator&=(const _Expr<_Dom, _Tp>&); - template - valarray<_Tp>& operator<<=(const _Expr<_Dom, _Tp>&); - template - valarray<_Tp>& operator>>=(const _Expr<_Dom, _Tp>&); - - // _lib.valarray.members_ member functions: - /// Return the number of elements in array. - size_t size() const; - - /** - * @brief Return the sum of all elements in the array. - * - * Accumulates the sum of all elements into a Tp using +=. The order - * of adding the elements is unspecified. - */ - _Tp sum() const; - - /// Return the minimum element using operator<(). - _Tp min() const; - - /// Return the maximum element using operator<(). - _Tp max() const; - - /** - * @brief Return a shifted array. - * - * A new valarray is constructed as a copy of this array with elements - * in shifted positions. For an element with index i, the new position - * is i - n. The new valarray has the same size as the current one. - * New elements without a value are set to 0. Elements whose new - * position is outside the bounds of the array are discarded. - * - * Positive arguments shift toward index 0, discarding elements [0, n). - * Negative arguments discard elements from the top of the array. - * - * @param n Number of element positions to shift. - * @return New valarray with elements in shifted positions. - */ - valarray<_Tp> shift (int) const; - - /** - * @brief Return a rotated array. - * - * A new valarray is constructed as a copy of this array with elements - * in shifted positions. For an element with index i, the new position - * is (i - n) % size(). The new valarray has the same size as the - * current one. Elements that are shifted beyond the array bounds are - * shifted into the other end of the array. No elements are lost. - * - * Positive arguments shift toward index 0, wrapping around the top. - * Negative arguments shift towards the top, wrapping around to 0. - * - * @param n Number of element positions to rotate. - * @return New valarray with elements in shifted positions. - */ - valarray<_Tp> cshift(int) const; - - /** - * @brief Apply a function to the array. - * - * Returns a new valarray with elements assigned to the result of - * applying func to the corresponding element of this array. The new - * array has the same size as this one. - * - * @param func Function of Tp returning Tp to apply. - * @return New valarray with transformed elements. - */ - _Expr<_ValFunClos<_ValArray, _Tp>, _Tp> apply(_Tp func(_Tp)) const; - - /** - * @brief Apply a function to the array. - * - * Returns a new valarray with elements assigned to the result of - * applying func to the corresponding element of this array. The new - * array has the same size as this one. - * - * @param func Function of const Tp& returning Tp to apply. - * @return New valarray with transformed elements. - */ - _Expr<_RefFunClos<_ValArray, _Tp>, _Tp> apply(_Tp func(const _Tp&)) const; - - /** - * @brief Resize array. - * - * Resize this array to @a size and set all elements to @a c. All - * references and iterators are invalidated. - * - * @param size New array size. - * @param c New value for all elements. - */ - void resize(size_t __size, _Tp __c = _Tp()); - - private: - size_t _M_size; - _Tp* __restrict__ _M_data; - - friend class _Array<_Tp>; - }; - - template - inline const _Tp& - valarray<_Tp>::operator[](size_t __i) const - { - __glibcxx_requires_subscript(__i); - return _M_data[__i]; - } - - template - inline _Tp& - valarray<_Tp>::operator[](size_t __i) - { - __glibcxx_requires_subscript(__i); - return _M_data[__i]; - } - -_GLIBCXX_END_NAMESPACE - -#include -#include -#include -#include -#include -#include - -_GLIBCXX_BEGIN_NAMESPACE(std) - - template - inline - valarray<_Tp>::valarray() : _M_size(0), _M_data(0) {} - - template - inline - valarray<_Tp>::valarray(size_t __n) - : _M_size(__n), _M_data(__valarray_get_storage<_Tp>(__n)) - { std::__valarray_default_construct(_M_data, _M_data + __n); } - - template - inline - valarray<_Tp>::valarray(const _Tp& __t, size_t __n) - : _M_size(__n), _M_data(__valarray_get_storage<_Tp>(__n)) - { std::__valarray_fill_construct(_M_data, _M_data + __n, __t); } - - template - inline - valarray<_Tp>::valarray(const _Tp* __restrict__ __p, size_t __n) - : _M_size(__n), _M_data(__valarray_get_storage<_Tp>(__n)) - { - _GLIBCXX_DEBUG_ASSERT(__p != 0 || __n == 0); - std::__valarray_copy_construct(__p, __p + __n, _M_data); - } - - template - inline - valarray<_Tp>::valarray(const valarray<_Tp>& __v) - : _M_size(__v._M_size), _M_data(__valarray_get_storage<_Tp>(__v._M_size)) - { std::__valarray_copy_construct(__v._M_data, __v._M_data + _M_size, - _M_data); } - - template - inline - valarray<_Tp>::valarray(const slice_array<_Tp>& __sa) - : _M_size(__sa._M_sz), _M_data(__valarray_get_storage<_Tp>(__sa._M_sz)) - { - std::__valarray_copy_construct - (__sa._M_array, __sa._M_sz, __sa._M_stride, _Array<_Tp>(_M_data)); - } - - template - inline - valarray<_Tp>::valarray(const gslice_array<_Tp>& __ga) - : _M_size(__ga._M_index.size()), - _M_data(__valarray_get_storage<_Tp>(_M_size)) - { - std::__valarray_copy_construct - (__ga._M_array, _Array(__ga._M_index), - _Array<_Tp>(_M_data), _M_size); - } - - template - inline - valarray<_Tp>::valarray(const mask_array<_Tp>& __ma) - : _M_size(__ma._M_sz), _M_data(__valarray_get_storage<_Tp>(__ma._M_sz)) - { - std::__valarray_copy_construct - (__ma._M_array, __ma._M_mask, _Array<_Tp>(_M_data), _M_size); - } - - template - inline - valarray<_Tp>::valarray(const indirect_array<_Tp>& __ia) - : _M_size(__ia._M_sz), _M_data(__valarray_get_storage<_Tp>(__ia._M_sz)) - { - std::__valarray_copy_construct - (__ia._M_array, __ia._M_index, _Array<_Tp>(_M_data), _M_size); - } - - template template - inline - valarray<_Tp>::valarray(const _Expr<_Dom, _Tp>& __e) - : _M_size(__e.size()), _M_data(__valarray_get_storage<_Tp>(_M_size)) - { std::__valarray_copy_construct(__e, _M_size, _Array<_Tp>(_M_data)); } - - template - inline - valarray<_Tp>::~valarray() - { - std::__valarray_destroy_elements(_M_data, _M_data + _M_size); - std::__valarray_release_memory(_M_data); - } - - template - inline valarray<_Tp>& - valarray<_Tp>::operator=(const valarray<_Tp>& __v) - { - _GLIBCXX_DEBUG_ASSERT(_M_size == __v._M_size); - std::__valarray_copy(__v._M_data, _M_size, _M_data); - return *this; - } - - template - inline valarray<_Tp>& - valarray<_Tp>::operator=(const _Tp& __t) - { - std::__valarray_fill(_M_data, _M_size, __t); - return *this; - } - - template - inline valarray<_Tp>& - valarray<_Tp>::operator=(const slice_array<_Tp>& __sa) - { - _GLIBCXX_DEBUG_ASSERT(_M_size == __sa._M_sz); - std::__valarray_copy(__sa._M_array, __sa._M_sz, - __sa._M_stride, _Array<_Tp>(_M_data)); - return *this; - } - - template - inline valarray<_Tp>& - valarray<_Tp>::operator=(const gslice_array<_Tp>& __ga) - { - _GLIBCXX_DEBUG_ASSERT(_M_size == __ga._M_index.size()); - std::__valarray_copy(__ga._M_array, _Array(__ga._M_index), - _Array<_Tp>(_M_data), _M_size); - return *this; - } - - template - inline valarray<_Tp>& - valarray<_Tp>::operator=(const mask_array<_Tp>& __ma) - { - _GLIBCXX_DEBUG_ASSERT(_M_size == __ma._M_sz); - std::__valarray_copy(__ma._M_array, __ma._M_mask, - _Array<_Tp>(_M_data), _M_size); - return *this; - } - - template - inline valarray<_Tp>& - valarray<_Tp>::operator=(const indirect_array<_Tp>& __ia) - { - _GLIBCXX_DEBUG_ASSERT(_M_size == __ia._M_sz); - std::__valarray_copy(__ia._M_array, __ia._M_index, - _Array<_Tp>(_M_data), _M_size); - return *this; - } - - template template - inline valarray<_Tp>& - valarray<_Tp>::operator=(const _Expr<_Dom, _Tp>& __e) - { - _GLIBCXX_DEBUG_ASSERT(_M_size == __e.size()); - std::__valarray_copy(__e, _M_size, _Array<_Tp>(_M_data)); - return *this; - } - - template - inline _Expr<_SClos<_ValArray,_Tp>, _Tp> - valarray<_Tp>::operator[](slice __s) const - { - typedef _SClos<_ValArray,_Tp> _Closure; - return _Expr<_Closure, _Tp>(_Closure (_Array<_Tp>(_M_data), __s)); - } - - template - inline slice_array<_Tp> - valarray<_Tp>::operator[](slice __s) - { return slice_array<_Tp>(_Array<_Tp>(_M_data), __s); } - - template - inline _Expr<_GClos<_ValArray,_Tp>, _Tp> - valarray<_Tp>::operator[](const gslice& __gs) const - { - typedef _GClos<_ValArray,_Tp> _Closure; - return _Expr<_Closure, _Tp> - (_Closure(_Array<_Tp>(_M_data), __gs._M_index->_M_index)); - } - - template - inline gslice_array<_Tp> - valarray<_Tp>::operator[](const gslice& __gs) - { - return gslice_array<_Tp> - (_Array<_Tp>(_M_data), __gs._M_index->_M_index); - } - - template - inline valarray<_Tp> - valarray<_Tp>::operator[](const valarray& __m) const - { - size_t __s = 0; - size_t __e = __m.size(); - for (size_t __i=0; __i<__e; ++__i) - if (__m[__i]) ++__s; - return valarray<_Tp>(mask_array<_Tp>(_Array<_Tp>(_M_data), __s, - _Array (__m))); - } - - template - inline mask_array<_Tp> - valarray<_Tp>::operator[](const valarray& __m) - { - size_t __s = 0; - size_t __e = __m.size(); - for (size_t __i=0; __i<__e; ++__i) - if (__m[__i]) ++__s; - return mask_array<_Tp>(_Array<_Tp>(_M_data), __s, _Array(__m)); - } - - template - inline _Expr<_IClos<_ValArray,_Tp>, _Tp> - valarray<_Tp>::operator[](const valarray& __i) const - { - typedef _IClos<_ValArray,_Tp> _Closure; - return _Expr<_Closure, _Tp>(_Closure(*this, __i)); - } - - template - inline indirect_array<_Tp> - valarray<_Tp>::operator[](const valarray& __i) - { - return indirect_array<_Tp>(_Array<_Tp>(_M_data), __i.size(), - _Array(__i)); - } - - template - inline size_t - valarray<_Tp>::size() const - { return _M_size; } - - template - inline _Tp - valarray<_Tp>::sum() const - { - _GLIBCXX_DEBUG_ASSERT(_M_size > 0); - return std::__valarray_sum(_M_data, _M_data + _M_size); - } - - template - inline valarray<_Tp> - valarray<_Tp>::shift(int __n) const - { - valarray<_Tp> __ret; - _Tp* __restrict__ __tmp_M_data = - std::__valarray_get_storage<_Tp>(_M_size); - - if (__n == 0) // no shift - std::__valarray_copy_construct(_M_data, _M_data + _M_size, - __tmp_M_data); - else if (__n > 0) // __n > 0: shift left - { - if (size_t(__n) > _M_size) - std::__valarray_default_construct(__tmp_M_data, - __tmp_M_data + __n); - else - { - std::__valarray_copy_construct(_M_data + __n, - _M_data + _M_size, - __tmp_M_data); - std::__valarray_default_construct(__tmp_M_data + _M_size - __n, - __tmp_M_data + _M_size); - } - } - else // __n < 0: shift right - { - std::__valarray_copy_construct(_M_data, _M_data + _M_size + __n, - __tmp_M_data - __n); - std::__valarray_default_construct(__tmp_M_data, - __tmp_M_data - __n); - } - - __ret._M_size = _M_size; - __ret._M_data = __tmp_M_data; - return __ret; - } - - template - inline valarray<_Tp> - valarray<_Tp>::cshift(int __n) const - { - valarray<_Tp> __ret; - _Tp* __restrict__ __tmp_M_data = - std::__valarray_get_storage<_Tp>(_M_size); - - if (__n == 0) // no cshift - std::__valarray_copy_construct(_M_data, _M_data + _M_size, - __tmp_M_data); - else if (__n > 0) // cshift left - { - std::__valarray_copy_construct(_M_data, _M_data + __n, - __tmp_M_data + _M_size - __n); - std::__valarray_copy_construct(_M_data + __n, _M_data + _M_size, - __tmp_M_data); - } - else // cshift right - { - std::__valarray_copy_construct - (_M_data + _M_size + __n, _M_data + _M_size, __tmp_M_data); - std::__valarray_copy_construct - (_M_data, _M_data + _M_size + __n, __tmp_M_data - __n); - } - - __ret._M_size = _M_size; - __ret._M_data = __tmp_M_data; - return __ret; - } - - template - inline void - valarray<_Tp>::resize(size_t __n, _Tp __c) - { - // This complication is so to make valarray > work - // even though it is not required by the standard. Nobody should - // be saying valarray > anyway. See the specs. - std::__valarray_destroy_elements(_M_data, _M_data + _M_size); - if (_M_size != __n) - { - std::__valarray_release_memory(_M_data); - _M_size = __n; - _M_data = __valarray_get_storage<_Tp>(__n); - } - std::__valarray_fill_construct(_M_data, _M_data + __n, __c); - } - - template - inline _Tp - valarray<_Tp>::min() const - { - _GLIBCXX_DEBUG_ASSERT(_M_size > 0); - return *std::min_element(_M_data, _M_data+_M_size); - } - - template - inline _Tp - valarray<_Tp>::max() const - { - _GLIBCXX_DEBUG_ASSERT(_M_size > 0); - return *std::max_element(_M_data, _M_data+_M_size); - } - - template - inline _Expr<_ValFunClos<_ValArray, _Tp>, _Tp> - valarray<_Tp>::apply(_Tp func(_Tp)) const - { - typedef _ValFunClos<_ValArray, _Tp> _Closure; - return _Expr<_Closure, _Tp>(_Closure(*this, func)); - } - - template - inline _Expr<_RefFunClos<_ValArray, _Tp>, _Tp> - valarray<_Tp>::apply(_Tp func(const _Tp &)) const - { - typedef _RefFunClos<_ValArray, _Tp> _Closure; - return _Expr<_Closure, _Tp>(_Closure(*this, func)); - } - -#define _DEFINE_VALARRAY_UNARY_OPERATOR(_Op, _Name) \ - template \ - inline typename valarray<_Tp>::template _UnaryOp<_Name>::_Rt \ - valarray<_Tp>::operator _Op() const \ - { \ - typedef _UnClos<_Name, _ValArray, _Tp> _Closure; \ - typedef typename __fun<_Name, _Tp>::result_type _Rt; \ - return _Expr<_Closure, _Rt>(_Closure(*this)); \ - } - - _DEFINE_VALARRAY_UNARY_OPERATOR(+, __unary_plus) - _DEFINE_VALARRAY_UNARY_OPERATOR(-, __negate) - _DEFINE_VALARRAY_UNARY_OPERATOR(~, __bitwise_not) - _DEFINE_VALARRAY_UNARY_OPERATOR (!, __logical_not) - -#undef _DEFINE_VALARRAY_UNARY_OPERATOR - -#define _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(_Op, _Name) \ - template \ - inline valarray<_Tp>& \ - valarray<_Tp>::operator _Op##=(const _Tp &__t) \ - { \ - _Array_augmented_##_Name(_Array<_Tp>(_M_data), _M_size, __t); \ - return *this; \ - } \ - \ - template \ - inline valarray<_Tp>& \ - valarray<_Tp>::operator _Op##=(const valarray<_Tp> &__v) \ - { \ - _GLIBCXX_DEBUG_ASSERT(_M_size == __v._M_size); \ - _Array_augmented_##_Name(_Array<_Tp>(_M_data), _M_size, \ - _Array<_Tp>(__v._M_data)); \ - return *this; \ - } - -_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(+, __plus) -_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(-, __minus) -_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(*, __multiplies) -_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(/, __divides) -_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(%, __modulus) -_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(^, __bitwise_xor) -_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(&, __bitwise_and) -_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(|, __bitwise_or) -_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(<<, __shift_left) -_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(>>, __shift_right) - -#undef _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT - -#define _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(_Op, _Name) \ - template template \ - inline valarray<_Tp>& \ - valarray<_Tp>::operator _Op##=(const _Expr<_Dom, _Tp>& __e) \ - { \ - _Array_augmented_##_Name(_Array<_Tp>(_M_data), __e, _M_size); \ - return *this; \ - } - -_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(+, __plus) -_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(-, __minus) -_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(*, __multiplies) -_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(/, __divides) -_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(%, __modulus) -_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(^, __bitwise_xor) -_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(&, __bitwise_and) -_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(|, __bitwise_or) -_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(<<, __shift_left) -_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(>>, __shift_right) - -#undef _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT - - -#define _DEFINE_BINARY_OPERATOR(_Op, _Name) \ - template \ - inline _Expr<_BinClos<_Name, _ValArray, _ValArray, _Tp, _Tp>, \ - typename __fun<_Name, _Tp>::result_type> \ - operator _Op(const valarray<_Tp>& __v, const valarray<_Tp>& __w) \ - { \ - _GLIBCXX_DEBUG_ASSERT(__v.size() == __w.size()); \ - typedef _BinClos<_Name, _ValArray, _ValArray, _Tp, _Tp> _Closure; \ - typedef typename __fun<_Name, _Tp>::result_type _Rt; \ - return _Expr<_Closure, _Rt>(_Closure(__v, __w)); \ - } \ - \ - template \ - inline _Expr<_BinClos<_Name, _ValArray,_Constant, _Tp, _Tp>, \ - typename __fun<_Name, _Tp>::result_type> \ - operator _Op(const valarray<_Tp>& __v, const _Tp& __t) \ - { \ - typedef _BinClos<_Name, _ValArray, _Constant, _Tp, _Tp> _Closure; \ - typedef typename __fun<_Name, _Tp>::result_type _Rt; \ - return _Expr<_Closure, _Rt>(_Closure(__v, __t)); \ - } \ - \ - template \ - inline _Expr<_BinClos<_Name, _Constant, _ValArray, _Tp, _Tp>, \ - typename __fun<_Name, _Tp>::result_type> \ - operator _Op(const _Tp& __t, const valarray<_Tp>& __v) \ - { \ - typedef _BinClos<_Name, _Constant, _ValArray, _Tp, _Tp> _Closure; \ - typedef typename __fun<_Name, _Tp>::result_type _Rt; \ - return _Expr<_Closure, _Tp>(_Closure(__t, __v)); \ - } - -_DEFINE_BINARY_OPERATOR(+, __plus) -_DEFINE_BINARY_OPERATOR(-, __minus) -_DEFINE_BINARY_OPERATOR(*, __multiplies) -_DEFINE_BINARY_OPERATOR(/, __divides) -_DEFINE_BINARY_OPERATOR(%, __modulus) -_DEFINE_BINARY_OPERATOR(^, __bitwise_xor) -_DEFINE_BINARY_OPERATOR(&, __bitwise_and) -_DEFINE_BINARY_OPERATOR(|, __bitwise_or) -_DEFINE_BINARY_OPERATOR(<<, __shift_left) -_DEFINE_BINARY_OPERATOR(>>, __shift_right) -_DEFINE_BINARY_OPERATOR(&&, __logical_and) -_DEFINE_BINARY_OPERATOR(||, __logical_or) -_DEFINE_BINARY_OPERATOR(==, __equal_to) -_DEFINE_BINARY_OPERATOR(!=, __not_equal_to) -_DEFINE_BINARY_OPERATOR(<, __less) -_DEFINE_BINARY_OPERATOR(>, __greater) -_DEFINE_BINARY_OPERATOR(<=, __less_equal) -_DEFINE_BINARY_OPERATOR(>=, __greater_equal) - -#undef _DEFINE_BINARY_OPERATOR - -_GLIBCXX_END_NAMESPACE - -#endif /* _GLIBCXX_VALARRAY */ diff --git a/libstdc++-v3/include/std/std_vector.h b/libstdc++-v3/include/std/std_vector.h deleted file mode 100644 index a4a527eea03..00000000000 --- a/libstdc++-v3/include/std/std_vector.h +++ /dev/null @@ -1,82 +0,0 @@ -// -*- C++ -*- - -// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -/* - * - * Copyright (c) 1994 - * Hewlett-Packard Company - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Hewlett-Packard Company makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * - * Copyright (c) 1996 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/** @file include/vector - * This is a Standard C++ Library header. - */ - -#ifndef _GLIBCXX_VECTOR -#define _GLIBCXX_VECTOR 1 - -#pragma GCC system_header - -#include -#include -#include -#include -#include -#include -#include - -#ifndef _GLIBCXX_EXPORT_TEMPLATE -# include -#endif - -#ifdef _GLIBCXX_DEBUG -# include -#endif - -#endif /* _GLIBCXX_VECTOR */ - diff --git a/libstdc++-v3/include/std/stdexcept b/libstdc++-v3/include/std/stdexcept new file mode 100644 index 00000000000..2d56b3817d4 --- /dev/null +++ b/libstdc++-v3/include/std/stdexcept @@ -0,0 +1,148 @@ +// Standard exception classes -*- C++ -*- + +// Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file stdexcept + * This is a Standard C++ Library header. + */ + +// +// ISO C++ 19.1 Exception classes +// + +#ifndef _GLIBCXX_STDEXCEPT +#define _GLIBCXX_STDEXCEPT 1 + +#pragma GCC system_header + +#include +#include + +_GLIBCXX_BEGIN_NAMESPACE(std) + + /** Logic errors represent problems in the internal logic of a program; + * in theory, these are preventable, and even detectable before the + * program runs (e.g., violations of class invariants). + * @brief One of two subclasses of exception. + */ + class logic_error : public exception + { + string _M_msg; + + public: + /** Takes a character string describing the error. */ + explicit + logic_error(const string& __arg); + + virtual + ~logic_error() throw(); + + /** Returns a C-style character string describing the general cause of + * the current error (the same string passed to the ctor). */ + virtual const char* + what() const throw(); + }; + + /** Thrown by the library, or by you, to report domain errors (domain in + * the mathmatical sense). */ + class domain_error : public logic_error + { + public: + explicit domain_error(const string& __arg); + }; + + /** Thrown to report invalid arguments to functions. */ + class invalid_argument : public logic_error + { + public: + explicit invalid_argument(const string& __arg); + }; + + /** Thrown when an object is constructed that would exceed its maximum + * permitted size (e.g., a basic_string instance). */ + class length_error : public logic_error + { + public: + explicit length_error(const string& __arg); + }; + + /** This represents an argument whose value is not within the expected + * range (e.g., boundary checks in basic_string). */ + class out_of_range : public logic_error + { + public: + explicit out_of_range(const string& __arg); + }; + + /** Runtime errors represent problems outside the scope of a program; + * they cannot be easily predicted and can generally only be caught as + * the program executes. + * @brief One of two subclasses of exception. + */ + class runtime_error : public exception + { + string _M_msg; + + public: + /** Takes a character string describing the error. */ + explicit + runtime_error(const string& __arg); + + virtual + ~runtime_error() throw(); + + /** Returns a C-style character string describing the general cause of + * the current error (the same string passed to the ctor). */ + virtual const char* + what() const throw(); + }; + + /** Thrown to indicate range errors in internal computations. */ + class range_error : public runtime_error + { + public: + explicit range_error(const string& __arg); + }; + + /** Thrown to indicate arithmetic overflow. */ + class overflow_error : public runtime_error + { + public: + explicit overflow_error(const string& __arg); + }; + + /** Thrown to indicate arithmetic underflow. */ + class underflow_error : public runtime_error + { + public: + explicit underflow_error(const string& __arg); + }; + +_GLIBCXX_END_NAMESPACE + +#endif /* _GLIBCXX_STDEXCEPT */ diff --git a/libstdc++-v3/include/std/streambuf b/libstdc++-v3/include/std/streambuf new file mode 100644 index 00000000000..9de7907120f --- /dev/null +++ b/libstdc++-v3/include/std/streambuf @@ -0,0 +1,823 @@ +// Stream buffer classes -*- C++ -*- + +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file streambuf + * This is a Standard C++ Library header. + */ + +// +// ISO C++ 14882: 27.5 Stream buffers +// + +#ifndef _GLIBXX_STREAMBUF +#define _GLIBXX_STREAMBUF 1 + +#pragma GCC system_header + +#include +#include +#include +#include +#include +#include + +_GLIBCXX_BEGIN_NAMESPACE(std) + + /** + * @if maint + * Does stuff. + * @endif + */ + template + streamsize + __copy_streambufs_eof(basic_streambuf<_CharT, _Traits>*, + basic_streambuf<_CharT, _Traits>*, bool&); + + /** + * @brief The actual work of input and output (interface). + * + * This is a base class. Derived stream buffers each control a + * pair of character sequences: one for input, and one for output. + * + * Section [27.5.1] of the standard describes the requirements and + * behavior of stream buffer classes. That section (three paragraphs) + * is reproduced here, for simplicity and accuracy. + * + * -# Stream buffers can impose various constraints on the sequences + * they control. Some constraints are: + * - The controlled input sequence can be not readable. + * - The controlled output sequence can be not writable. + * - The controlled sequences can be associated with the contents of + * other representations for character sequences, such as external + * files. + * - The controlled sequences can support operations @e directly to or + * from associated sequences. + * - The controlled sequences can impose limitations on how the + * program can read characters from a sequence, write characters to + * a sequence, put characters back into an input sequence, or alter + * the stream position. + * . + * -# Each sequence is characterized by three pointers which, if non-null, + * all point into the same @c charT array object. The array object + * represents, at any moment, a (sub)sequence of characters from the + * sequence. Operations performed on a sequence alter the values + * stored in these pointers, perform reads and writes directly to or + * from associated sequences, and alter "the stream position" and + * conversion state as needed to maintain this subsequence relationship. + * The three pointers are: + * - the beginning pointer, or lowest element address in the + * array (called @e xbeg here); + * - the next pointer, or next element address that is a + * current candidate for reading or writing (called @e xnext here); + * - the end pointer, or first element address beyond the + * end of the array (called @e xend here). + * . + * -# The following semantic constraints shall always apply for any set + * of three pointers for a sequence, using the pointer names given + * immediately above: + * - If @e xnext is not a null pointer, then @e xbeg and @e xend shall + * also be non-null pointers into the same @c charT array, as + * described above; otherwise, @e xbeg and @e xend shall also be null. + * - If @e xnext is not a null pointer and @e xnext < @e xend for an + * output sequence, then a write position is available. + * In this case, @e *xnext shall be assignable as the next element + * to write (to put, or to store a character value, into the sequence). + * - If @e xnext is not a null pointer and @e xbeg < @e xnext for an + * input sequence, then a putback position is available. + * In this case, @e xnext[-1] shall have a defined value and is the + * next (preceding) element to store a character that is put back + * into the input sequence. + * - If @e xnext is not a null pointer and @e xnext< @e xend for an + * input sequence, then a read position is available. + * In this case, @e *xnext shall have a defined value and is the + * next element to read (to get, or to obtain a character value, + * from the sequence). + */ + template + class basic_streambuf + { + public: + //@{ + /** + * These are standard types. They permit a standardized way of + * referring to names of (or names dependant on) the template + * parameters, which are specific to the implementation. + */ + typedef _CharT char_type; + typedef _Traits traits_type; + typedef typename traits_type::int_type int_type; + typedef typename traits_type::pos_type pos_type; + typedef typename traits_type::off_type off_type; + //@} + + //@{ + /** + * @if maint + * This is a non-standard type. + * @endif + */ + typedef basic_streambuf __streambuf_type; + //@} + + friend class basic_ios; + friend class basic_istream; + friend class basic_ostream; + friend class istreambuf_iterator; + friend class ostreambuf_iterator; + + friend streamsize + __copy_streambufs_eof<>(__streambuf_type*, __streambuf_type*, bool&); + + template + friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, + _CharT2*>::__type + __copy_aux(istreambuf_iterator<_CharT2>, + istreambuf_iterator<_CharT2>, _CharT2*); + + template + friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, + istreambuf_iterator<_CharT2> >::__type + find(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>, + const _CharT2&); + + template + friend basic_istream<_CharT2, _Traits2>& + operator>>(basic_istream<_CharT2, _Traits2>&, _CharT2*); + + template + friend basic_istream<_CharT2, _Traits2>& + operator>>(basic_istream<_CharT2, _Traits2>&, + basic_string<_CharT2, _Traits2, _Alloc>&); + + template + friend basic_istream<_CharT2, _Traits2>& + getline(basic_istream<_CharT2, _Traits2>&, + basic_string<_CharT2, _Traits2, _Alloc>&, _CharT2); + + protected: + //@{ + /** + * @if maint + * This is based on _IO_FILE, just reordered to be more consistent, + * and is intended to be the most minimal abstraction for an + * internal buffer. + * - get == input == read + * - put == output == write + * @endif + */ + char_type* _M_in_beg; // Start of get area. + char_type* _M_in_cur; // Current read area. + char_type* _M_in_end; // End of get area. + char_type* _M_out_beg; // Start of put area. + char_type* _M_out_cur; // Current put area. + char_type* _M_out_end; // End of put area. + + /** + * @if maint + * Current locale setting. + * @endif + */ + locale _M_buf_locale; + + public: + /// Destructor deallocates no buffer space. + virtual + ~basic_streambuf() + { } + + // [27.5.2.2.1] locales + /** + * @brief Entry point for imbue(). + * @param loc The new locale. + * @return The previous locale. + * + * Calls the derived imbue(loc). + */ + locale + pubimbue(const locale &__loc) + { + locale __tmp(this->getloc()); + this->imbue(__loc); + _M_buf_locale = __loc; + return __tmp; + } + + /** + * @brief Locale access. + * @return The current locale in effect. + * + * If pubimbue(loc) has been called, then the most recent @c loc + * is returned. Otherwise the global locale in effect at the time + * of construction is returned. + */ + locale + getloc() const + { return _M_buf_locale; } + + // [27.5.2.2.2] buffer management and positioning + //@{ + /** + * @brief Entry points for derived buffer functions. + * + * The public versions of @c pubfoo dispatch to the protected + * derived @c foo member functions, passing the arguments (if any) + * and returning the result unchanged. + */ + __streambuf_type* + pubsetbuf(char_type* __s, streamsize __n) + { return this->setbuf(__s, __n); } + + pos_type + pubseekoff(off_type __off, ios_base::seekdir __way, + ios_base::openmode __mode = ios_base::in | ios_base::out) + { return this->seekoff(__off, __way, __mode); } + + pos_type + pubseekpos(pos_type __sp, + ios_base::openmode __mode = ios_base::in | ios_base::out) + { return this->seekpos(__sp, __mode); } + + int + pubsync() { return this->sync(); } + //@} + + // [27.5.2.2.3] get area + /** + * @brief Looking ahead into the stream. + * @return The number of characters available. + * + * If a read position is available, returns the number of characters + * available for reading before the buffer must be refilled. + * Otherwise returns the derived @c showmanyc(). + */ + streamsize + in_avail() + { + const streamsize __ret = this->egptr() - this->gptr(); + return __ret ? __ret : this->showmanyc(); + } + + /** + * @brief Getting the next character. + * @return The next character, or eof. + * + * Calls @c sbumpc(), and if that function returns + * @c traits::eof(), so does this function. Otherwise, @c sgetc(). + */ + int_type + snextc() + { + int_type __ret = traits_type::eof(); + if (__builtin_expect(!traits_type::eq_int_type(this->sbumpc(), + __ret), true)) + __ret = this->sgetc(); + return __ret; + } + + /** + * @brief Getting the next character. + * @return The next character, or eof. + * + * If the input read position is available, returns that character + * and increments the read pointer, otherwise calls and returns + * @c uflow(). + */ + int_type + sbumpc() + { + int_type __ret; + if (__builtin_expect(this->gptr() < this->egptr(), true)) + { + __ret = traits_type::to_int_type(*this->gptr()); + this->gbump(1); + } + else + __ret = this->uflow(); + return __ret; + } + + /** + * @brief Getting the next character. + * @return The next character, or eof. + * + * If the input read position is available, returns that character, + * otherwise calls and returns @c underflow(). Does not move the + * read position after fetching the character. + */ + int_type + sgetc() + { + int_type __ret; + if (__builtin_expect(this->gptr() < this->egptr(), true)) + __ret = traits_type::to_int_type(*this->gptr()); + else + __ret = this->underflow(); + return __ret; + } + + /** + * @brief Entry point for xsgetn. + * @param s A buffer area. + * @param n A count. + * + * Returns xsgetn(s,n). The effect is to fill @a s[0] through + * @a s[n-1] with characters from the input sequence, if possible. + */ + streamsize + sgetn(char_type* __s, streamsize __n) + { return this->xsgetn(__s, __n); } + + // [27.5.2.2.4] putback + /** + * @brief Pushing characters back into the input stream. + * @param c The character to push back. + * @return The previous character, if possible. + * + * Similar to sungetc(), but @a c is pushed onto the stream instead + * of "the previous character". If successful, the next character + * fetched from the input stream will be @a c. + */ + int_type + sputbackc(char_type __c) + { + int_type __ret; + const bool __testpos = this->eback() < this->gptr(); + if (__builtin_expect(!__testpos || + !traits_type::eq(__c, this->gptr()[-1]), false)) + __ret = this->pbackfail(traits_type::to_int_type(__c)); + else + { + this->gbump(-1); + __ret = traits_type::to_int_type(*this->gptr()); + } + return __ret; + } + + /** + * @brief Moving backwards in the input stream. + * @return The previous character, if possible. + * + * If a putback position is available, this function decrements the + * input pointer and returns that character. Otherwise, calls and + * returns pbackfail(). The effect is to "unget" the last character + * "gotten". + */ + int_type + sungetc() + { + int_type __ret; + if (__builtin_expect(this->eback() < this->gptr(), true)) + { + this->gbump(-1); + __ret = traits_type::to_int_type(*this->gptr()); + } + else + __ret = this->pbackfail(); + return __ret; + } + + // [27.5.2.2.5] put area + /** + * @brief Entry point for all single-character output functions. + * @param c A character to output. + * @return @a c, if possible. + * + * One of two public output functions. + * + * If a write position is available for the output sequence (i.e., + * the buffer is not full), stores @a c in that position, increments + * the position, and returns @c traits::to_int_type(c). If a write + * position is not available, returns @c overflow(c). + */ + int_type + sputc(char_type __c) + { + int_type __ret; + if (__builtin_expect(this->pptr() < this->epptr(), true)) + { + *this->pptr() = __c; + this->pbump(1); + __ret = traits_type::to_int_type(__c); + } + else + __ret = this->overflow(traits_type::to_int_type(__c)); + return __ret; + } + + /** + * @brief Entry point for all single-character output functions. + * @param s A buffer read area. + * @param n A count. + * + * One of two public output functions. + * + * + * Returns xsputn(s,n). The effect is to write @a s[0] through + * @a s[n-1] to the output sequence, if possible. + */ + streamsize + sputn(const char_type* __s, streamsize __n) + { return this->xsputn(__s, __n); } + + protected: + /** + * @brief Base constructor. + * + * Only called from derived constructors, and sets up all the + * buffer data to zero, including the pointers described in the + * basic_streambuf class description. Note that, as a result, + * - the class starts with no read nor write positions available, + * - this is not an error + */ + basic_streambuf() + : _M_in_beg(0), _M_in_cur(0), _M_in_end(0), + _M_out_beg(0), _M_out_cur(0), _M_out_end(0), + _M_buf_locale(locale()) + { } + + // [27.5.2.3.1] get area access + //@{ + /** + * @brief Access to the get area. + * + * These functions are only available to other protected functions, + * including derived classes. + * + * - eback() returns the beginning pointer for the input sequence + * - gptr() returns the next pointer for the input sequence + * - egptr() returns the end pointer for the input sequence + */ + char_type* + eback() const { return _M_in_beg; } + + char_type* + gptr() const { return _M_in_cur; } + + char_type* + egptr() const { return _M_in_end; } + //@} + + /** + * @brief Moving the read position. + * @param n The delta by which to move. + * + * This just advances the read position without returning any data. + */ + void + gbump(int __n) { _M_in_cur += __n; } + + /** + * @brief Setting the three read area pointers. + * @param gbeg A pointer. + * @param gnext A pointer. + * @param gend A pointer. + * @post @a gbeg == @c eback(), @a gnext == @c gptr(), and + * @a gend == @c egptr() + */ + void + setg(char_type* __gbeg, char_type* __gnext, char_type* __gend) + { + _M_in_beg = __gbeg; + _M_in_cur = __gnext; + _M_in_end = __gend; + } + + // [27.5.2.3.2] put area access + //@{ + /** + * @brief Access to the put area. + * + * These functions are only available to other protected functions, + * including derived classes. + * + * - pbase() returns the beginning pointer for the output sequence + * - pptr() returns the next pointer for the output sequence + * - epptr() returns the end pointer for the output sequence + */ + char_type* + pbase() const { return _M_out_beg; } + + char_type* + pptr() const { return _M_out_cur; } + + char_type* + epptr() const { return _M_out_end; } + //@} + + /** + * @brief Moving the write position. + * @param n The delta by which to move. + * + * This just advances the write position without returning any data. + */ + void + pbump(int __n) { _M_out_cur += __n; } + + /** + * @brief Setting the three write area pointers. + * @param pbeg A pointer. + * @param pend A pointer. + * @post @a pbeg == @c pbase(), @a pbeg == @c pptr(), and + * @a pend == @c epptr() + */ + void + setp(char_type* __pbeg, char_type* __pend) + { + _M_out_beg = _M_out_cur = __pbeg; + _M_out_end = __pend; + } + + // [27.5.2.4] virtual functions + // [27.5.2.4.1] locales + /** + * @brief Changes translations. + * @param loc A new locale. + * + * Translations done during I/O which depend on the current locale + * are changed by this call. The standard adds, "Between invocations + * of this function a class derived from streambuf can safely cache + * results of calls to locale functions and to members of facets + * so obtained." + * + * @note Base class version does nothing. + */ + virtual void + imbue(const locale&) + { } + + // [27.5.2.4.2] buffer management and positioning + /** + * @brief Maniuplates the buffer. + * + * Each derived class provides its own appropriate behavior. See + * the next-to-last paragraph of + * http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#2 for + * more on this function. + * + * @note Base class version does nothing, returns @c this. + */ + virtual basic_streambuf* + setbuf(char_type*, streamsize) + { return this; } + + /** + * @brief Alters the stream positions. + * + * Each derived class provides its own appropriate behavior. + * @note Base class version does nothing, returns a @c pos_type + * that represents an invalid stream position. + */ + virtual pos_type + seekoff(off_type, ios_base::seekdir, + ios_base::openmode /*__mode*/ = ios_base::in | ios_base::out) + { return pos_type(off_type(-1)); } + + /** + * @brief Alters the stream positions. + * + * Each derived class provides its own appropriate behavior. + * @note Base class version does nothing, returns a @c pos_type + * that represents an invalid stream position. + */ + virtual pos_type + seekpos(pos_type, + ios_base::openmode /*__mode*/ = ios_base::in | ios_base::out) + { return pos_type(off_type(-1)); } + + /** + * @brief Synchronizes the buffer arrays with the controlled sequences. + * @return -1 on failure. + * + * Each derived class provides its own appropriate behavior, + * including the definition of "failure". + * @note Base class version does nothing, returns zero. + */ + virtual int + sync() { return 0; } + + // [27.5.2.4.3] get area + /** + * @brief Investigating the data available. + * @return An estimate of the number of characters available in the + * input sequence, or -1. + * + * "If it returns a positive value, then successive calls to + * @c underflow() will not return @c traits::eof() until at least that + * number of characters have been supplied. If @c showmanyc() + * returns -1, then calls to @c underflow() or @c uflow() will fail." + * [27.5.2.4.3]/1 + * + * @note Base class version does nothing, returns zero. + * @note The standard adds that "the intention is not only that the + * calls [to underflow or uflow] will not return @c eof() but + * that they will return "immediately". + * @note The standard adds that "the morphemes of @c showmanyc are + * "es-how-many-see", not "show-manic". + */ + virtual streamsize + showmanyc() { return 0; } + + /** + * @brief Multiple character extraction. + * @param s A buffer area. + * @param n Maximum number of characters to assign. + * @return The number of characters assigned. + * + * Fills @a s[0] through @a s[n-1] with characters from the input + * sequence, as if by @c sbumpc(). Stops when either @a n characters + * have been copied, or when @c traits::eof() would be copied. + * + * It is expected that derived classes provide a more efficient + * implementation by overriding this definition. + */ + virtual streamsize + xsgetn(char_type* __s, streamsize __n); + + /** + * @brief Fetches more data from the controlled sequence. + * @return The first character from the pending sequence. + * + * Informally, this function is called when the input buffer is + * exhausted (or does not exist, as buffering need not actually be + * done). If a buffer exists, it is "refilled". In either case, the + * next available character is returned, or @c traits::eof() to + * indicate a null pending sequence. + * + * For a formal definiton of the pending sequence, see a good text + * such as Langer & Kreft, or [27.5.2.4.3]/7-14. + * + * A functioning input streambuf can be created by overriding only + * this function (no buffer area will be used). For an example, see + * http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#6 + * + * @note Base class version does nothing, returns eof(). + */ + virtual int_type + underflow() + { return traits_type::eof(); } + + /** + * @brief Fetches more data from the controlled sequence. + * @return The first character from the pending sequence. + * + * Informally, this function does the same thing as @c underflow(), + * and in fact is required to call that function. It also returns + * the new character, like @c underflow() does. However, this + * function also moves the read position forward by one. + */ + virtual int_type + uflow() + { + int_type __ret = traits_type::eof(); + const bool __testeof = traits_type::eq_int_type(this->underflow(), + __ret); + if (!__testeof) + { + __ret = traits_type::to_int_type(*this->gptr()); + this->gbump(1); + } + return __ret; + } + + // [27.5.2.4.4] putback + /** + * @brief Tries to back up the input sequence. + * @param c The character to be inserted back into the sequence. + * @return eof() on failure, "some other value" on success + * @post The constraints of @c gptr(), @c eback(), and @c pptr() + * are the same as for @c underflow(). + * + * @note Base class version does nothing, returns eof(). + */ + virtual int_type + pbackfail(int_type /* __c */ = traits_type::eof()) + { return traits_type::eof(); } + + // Put area: + /** + * @brief Multiple character insertion. + * @param s A buffer area. + * @param n Maximum number of characters to write. + * @return The number of characters written. + * + * Writes @a s[0] through @a s[n-1] to the output sequence, as if + * by @c sputc(). Stops when either @a n characters have been + * copied, or when @c sputc() would return @c traits::eof(). + * + * It is expected that derived classes provide a more efficient + * implementation by overriding this definition. + */ + virtual streamsize + xsputn(const char_type* __s, streamsize __n); + + /** + * @brief Consumes data from the buffer; writes to the + * controlled sequence. + * @param c An additional character to consume. + * @return eof() to indicate failure, something else (usually + * @a c, or not_eof()) + * + * Informally, this function is called when the output buffer is full + * (or does not exist, as buffering need not actually be done). If a + * buffer exists, it is "consumed", with "some effect" on the + * controlled sequence. (Typically, the buffer is written out to the + * sequence verbatim.) In either case, the character @a c is also + * written out, if @a c is not @c eof(). + * + * For a formal definiton of this function, see a good text + * such as Langer & Kreft, or [27.5.2.4.5]/3-7. + * + * A functioning output streambuf can be created by overriding only + * this function (no buffer area will be used). + * + * @note Base class version does nothing, returns eof(). + */ + virtual int_type + overflow(int_type /* __c */ = traits_type::eof()) + { return traits_type::eof(); } + +#ifdef _GLIBCXX_DEPRECATED + // Annex D.6 + public: + /** + * @brief Tosses a character. + * + * Advances the read pointer, ignoring the character that would have + * been read. + * + * See http://gcc.gnu.org/ml/libstdc++/2002-05/msg00168.html + * + * @note This function has been deprecated by the standard. You + * must define @c _GLIBCXX_DEPRECATED to make this visible; see + * c++config.h. + */ + void + stossc() + { + if (this->gptr() < this->egptr()) + this->gbump(1); + else + this->uflow(); + } +#endif + + private: + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // Side effect of DR 50. + basic_streambuf(const __streambuf_type& __sb) + : _M_in_beg(__sb._M_in_beg), _M_in_cur(__sb._M_in_cur), + _M_in_end(__sb._M_in_end), _M_out_beg(__sb._M_out_beg), + _M_out_cur(__sb._M_out_cur), _M_out_end(__sb._M_out_cur), + _M_buf_locale(__sb._M_buf_locale) + { } + + __streambuf_type& + operator=(const __streambuf_type&) { return *this; }; + }; + + // Explicit specialization declarations, defined in src/streambuf.cc. + template<> + streamsize + __copy_streambufs_eof(basic_streambuf* __sbin, + basic_streambuf* __sbout, bool& __ineof); +#ifdef _GLIBCXX_USE_WCHAR_T + template<> + streamsize + __copy_streambufs_eof(basic_streambuf* __sbin, + basic_streambuf* __sbout, bool& __ineof); +#endif + +_GLIBCXX_END_NAMESPACE + +#ifndef _GLIBCXX_EXPORT_TEMPLATE +# include +#endif + +#endif /* _GLIBCXX_STREAMBUF */ diff --git a/libstdc++-v3/include/std/string b/libstdc++-v3/include/std/string new file mode 100644 index 00000000000..c38d5257515 --- /dev/null +++ b/libstdc++-v3/include/std/string @@ -0,0 +1,59 @@ +// Components for manipulating sequences of characters -*- C++ -*- + +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file include/string + * This is a Standard C++ Library header. + */ + +// +// ISO C++ 14882: 21 Strings library +// + +#ifndef _GLIBCXX_STRING +#define _GLIBCXX_STRING 1 + +#pragma GCC system_header + +#include +#include +#include +#include // For allocator. +#include +#include // For operators >>, <<, and getline decls. +#include +#include // For less +#include + +#ifndef _GLIBCXX_EXPORT_TEMPLATE +# include // for find_if +# include +#endif + +#endif /* _GLIBCXX_STRING */ diff --git a/libstdc++-v3/include/std/utility b/libstdc++-v3/include/std/utility new file mode 100644 index 00000000000..84c9131d82b --- /dev/null +++ b/libstdc++-v3/include/std/utility @@ -0,0 +1,69 @@ +// -*- C++ -*- + +// Copyright (C) 2001, 2002 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file include/utility + * This is a Standard C++ Library header. + */ + +#ifndef _GLIBCXX_UTILITY +#define _GLIBCXX_UTILITY 1 + +#pragma GCC system_header + +#include +#include +#include + +#endif /* _GLIBCXX_UTILITY */ diff --git a/libstdc++-v3/include/std/valarray b/libstdc++-v3/include/std/valarray new file mode 100644 index 00000000000..91b1637c712 --- /dev/null +++ b/libstdc++-v3/include/std/valarray @@ -0,0 +1,1026 @@ +// The template and inlines for the -*- C++ -*- valarray class. + +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/** @file valarray + * This is a Standard C++ Library header. + */ + +// Written by Gabriel Dos Reis + +#ifndef _GLIBCXX_VALARRAY +#define _GLIBCXX_VALARRAY 1 + +#pragma GCC system_header + +#include +#include +#include +#include +#include +#include +#include + +_GLIBCXX_BEGIN_NAMESPACE(std) + + template + class _Expr; + + template + class _ValArray; + + template class _Meta, class _Dom> + struct _UnClos; + + template class _Meta1, + template class _Meta2, + class _Dom1, class _Dom2> + class _BinClos; + + template class _Meta, class _Dom> + class _SClos; + + template class _Meta, class _Dom> + class _GClos; + + template class _Meta, class _Dom> + class _IClos; + + template class _Meta, class _Dom> + class _ValFunClos; + + template class _Meta, class _Dom> + class _RefFunClos; + + template class valarray; // An array of type _Tp + class slice; // BLAS-like slice out of an array + template class slice_array; + class gslice; // generalized slice out of an array + template class gslice_array; + template class mask_array; // masked array + template class indirect_array; // indirected array + +_GLIBCXX_END_NAMESPACE + +#include +#include + +_GLIBCXX_BEGIN_NAMESPACE(std) + + /** + * @brief Smart array designed to support numeric processing. + * + * A valarray is an array that provides constraints intended to allow for + * effective optimization of numeric array processing by reducing the + * aliasing that can result from pointer representations. It represents a + * one-dimensional array from which different multidimensional subsets can + * be accessed and modified. + * + * @param Tp Type of object in the array. + */ + template + class valarray + { + template + struct _UnaryOp + { + typedef typename __fun<_Op, _Tp>::result_type __rt; + typedef _Expr<_UnClos<_Op, _ValArray, _Tp>, __rt> _Rt; + }; + public: + typedef _Tp value_type; + + // _lib.valarray.cons_ construct/destroy: + /// Construct an empty array. + valarray(); + + /// Construct an array with @a n elements. + explicit valarray(size_t); + + /// Construct an array with @a n elements initialized to @a t. + valarray(const _Tp&, size_t); + + /// Construct an array initialized to the first @a n elements of @a t. + valarray(const _Tp* __restrict__, size_t); + + /// Copy constructor. + valarray(const valarray&); + + /// Construct an array with the same size and values in @a sa. + valarray(const slice_array<_Tp>&); + + /// Construct an array with the same size and values in @a ga. + valarray(const gslice_array<_Tp>&); + + /// Construct an array with the same size and values in @a ma. + valarray(const mask_array<_Tp>&); + + /// Construct an array with the same size and values in @a ia. + valarray(const indirect_array<_Tp>&); + + template + valarray(const _Expr<_Dom, _Tp>& __e); + + ~valarray(); + + // _lib.valarray.assign_ assignment: + /** + * @brief Assign elements to an array. + * + * Assign elements of array to values in @a v. Results are undefined + * if @a v does not have the same size as this array. + * + * @param v Valarray to get values from. + */ + valarray<_Tp>& operator=(const valarray<_Tp>&); + + /** + * @brief Assign elements to a value. + * + * Assign all elements of array to @a t. + * + * @param t Value for elements. + */ + valarray<_Tp>& operator=(const _Tp&); + + /** + * @brief Assign elements to an array subset. + * + * Assign elements of array to values in @a sa. Results are undefined + * if @a sa does not have the same size as this array. + * + * @param sa Array slice to get values from. + */ + valarray<_Tp>& operator=(const slice_array<_Tp>&); + + /** + * @brief Assign elements to an array subset. + * + * Assign elements of array to values in @a ga. Results are undefined + * if @a ga does not have the same size as this array. + * + * @param ga Array slice to get values from. + */ + valarray<_Tp>& operator=(const gslice_array<_Tp>&); + + /** + * @brief Assign elements to an array subset. + * + * Assign elements of array to values in @a ma. Results are undefined + * if @a ma does not have the same size as this array. + * + * @param ma Array slice to get values from. + */ + valarray<_Tp>& operator=(const mask_array<_Tp>&); + + /** + * @brief Assign elements to an array subset. + * + * Assign elements of array to values in @a ia. Results are undefined + * if @a ia does not have the same size as this array. + * + * @param ia Array slice to get values from. + */ + valarray<_Tp>& operator=(const indirect_array<_Tp>&); + + template valarray<_Tp>& + operator= (const _Expr<_Dom, _Tp>&); + + // _lib.valarray.access_ element access: + /** + * Return a reference to the i'th array element. + * + * @param i Index of element to return. + * @return Reference to the i'th element. + */ + _Tp& operator[](size_t); + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 389. Const overload of valarray::operator[] returns by value. + const _Tp& operator[](size_t) const; + + // _lib.valarray.sub_ subset operations: + /** + * @brief Return an array subset. + * + * Returns a new valarray containing the elements of the array + * indicated by the slice argument. The new valarray has the same size + * as the input slice. @see slice. + * + * @param s The source slice. + * @return New valarray containing elements in @a s. + */ + _Expr<_SClos<_ValArray, _Tp>, _Tp> operator[](slice) const; + + /** + * @brief Return a reference to an array subset. + * + * Returns a new valarray containing the elements of the array + * indicated by the slice argument. The new valarray has the same size + * as the input slice. @see slice. + * + * @param s The source slice. + * @return New valarray containing elements in @a s. + */ + slice_array<_Tp> operator[](slice); + + /** + * @brief Return an array subset. + * + * Returns a slice_array referencing the elements of the array + * indicated by the slice argument. @see gslice. + * + * @param s The source slice. + * @return Slice_array referencing elements indicated by @a s. + */ + _Expr<_GClos<_ValArray, _Tp>, _Tp> operator[](const gslice&) const; + + /** + * @brief Return a reference to an array subset. + * + * Returns a new valarray containing the elements of the array + * indicated by the gslice argument. The new valarray has + * the same size as the input gslice. @see gslice. + * + * @param s The source gslice. + * @return New valarray containing elements in @a s. + */ + gslice_array<_Tp> operator[](const gslice&); + + /** + * @brief Return an array subset. + * + * Returns a new valarray containing the elements of the array + * indicated by the argument. The input is a valarray of bool which + * represents a bitmask indicating which elements should be copied into + * the new valarray. Each element of the array is added to the return + * valarray if the corresponding element of the argument is true. + * + * @param m The valarray bitmask. + * @return New valarray containing elements indicated by @a m. + */ + valarray<_Tp> operator[](const valarray&) const; + + /** + * @brief Return a reference to an array subset. + * + * Returns a new mask_array referencing the elements of the array + * indicated by the argument. The input is a valarray of bool which + * represents a bitmask indicating which elements are part of the + * subset. Elements of the array are part of the subset if the + * corresponding element of the argument is true. + * + * @param m The valarray bitmask. + * @return New valarray containing elements indicated by @a m. + */ + mask_array<_Tp> operator[](const valarray&); + + /** + * @brief Return an array subset. + * + * Returns a new valarray containing the elements of the array + * indicated by the argument. The elements in the argument are + * interpreted as the indices of elements of this valarray to copy to + * the return valarray. + * + * @param i The valarray element index list. + * @return New valarray containing elements in @a s. + */ + _Expr<_IClos<_ValArray, _Tp>, _Tp> + operator[](const valarray&) const; + + /** + * @brief Return a reference to an array subset. + * + * Returns an indirect_array referencing the elements of the array + * indicated by the argument. The elements in the argument are + * interpreted as the indices of elements of this valarray to include + * in the subset. The returned indirect_array refers to these + * elements. + * + * @param i The valarray element index list. + * @return Indirect_array referencing elements in @a i. + */ + indirect_array<_Tp> operator[](const valarray&); + + // _lib.valarray.unary_ unary operators: + /// Return a new valarray by applying unary + to each element. + typename _UnaryOp<__unary_plus>::_Rt operator+() const; + + /// Return a new valarray by applying unary - to each element. + typename _UnaryOp<__negate>::_Rt operator-() const; + + /// Return a new valarray by applying unary ~ to each element. + typename _UnaryOp<__bitwise_not>::_Rt operator~() const; + + /// Return a new valarray by applying unary ! to each element. + typename _UnaryOp<__logical_not>::_Rt operator!() const; + + // _lib.valarray.cassign_ computed assignment: + /// Multiply each element of array by @a t. + valarray<_Tp>& operator*=(const _Tp&); + + /// Divide each element of array by @a t. + valarray<_Tp>& operator/=(const _Tp&); + + /// Set each element e of array to e % @a t. + valarray<_Tp>& operator%=(const _Tp&); + + /// Add @a t to each element of array. + valarray<_Tp>& operator+=(const _Tp&); + + /// Subtract @a t to each element of array. + valarray<_Tp>& operator-=(const _Tp&); + + /// Set each element e of array to e ^ @a t. + valarray<_Tp>& operator^=(const _Tp&); + + /// Set each element e of array to e & @a t. + valarray<_Tp>& operator&=(const _Tp&); + + /// Set each element e of array to e | @a t. + valarray<_Tp>& operator|=(const _Tp&); + + /// Left shift each element e of array by @a t bits. + valarray<_Tp>& operator<<=(const _Tp&); + + /// Right shift each element e of array by @a t bits. + valarray<_Tp>& operator>>=(const _Tp&); + + /// Multiply elements of array by corresponding elements of @a v. + valarray<_Tp>& operator*=(const valarray<_Tp>&); + + /// Divide elements of array by corresponding elements of @a v. + valarray<_Tp>& operator/=(const valarray<_Tp>&); + + /// Modulo elements of array by corresponding elements of @a v. + valarray<_Tp>& operator%=(const valarray<_Tp>&); + + /// Add corresponding elements of @a v to elements of array. + valarray<_Tp>& operator+=(const valarray<_Tp>&); + + /// Subtract corresponding elements of @a v from elements of array. + valarray<_Tp>& operator-=(const valarray<_Tp>&); + + /// Logical xor corresponding elements of @a v with elements of array. + valarray<_Tp>& operator^=(const valarray<_Tp>&); + + /// Logical or corresponding elements of @a v with elements of array. + valarray<_Tp>& operator|=(const valarray<_Tp>&); + + /// Logical and corresponding elements of @a v with elements of array. + valarray<_Tp>& operator&=(const valarray<_Tp>&); + + /// Left shift elements of array by corresponding elements of @a v. + valarray<_Tp>& operator<<=(const valarray<_Tp>&); + + /// Right shift elements of array by corresponding elements of @a v. + valarray<_Tp>& operator>>=(const valarray<_Tp>&); + + template + valarray<_Tp>& operator*=(const _Expr<_Dom, _Tp>&); + template + valarray<_Tp>& operator/=(const _Expr<_Dom, _Tp>&); + template + valarray<_Tp>& operator%=(const _Expr<_Dom, _Tp>&); + template + valarray<_Tp>& operator+=(const _Expr<_Dom, _Tp>&); + template + valarray<_Tp>& operator-=(const _Expr<_Dom, _Tp>&); + template + valarray<_Tp>& operator^=(const _Expr<_Dom, _Tp>&); + template + valarray<_Tp>& operator|=(const _Expr<_Dom, _Tp>&); + template + valarray<_Tp>& operator&=(const _Expr<_Dom, _Tp>&); + template + valarray<_Tp>& operator<<=(const _Expr<_Dom, _Tp>&); + template + valarray<_Tp>& operator>>=(const _Expr<_Dom, _Tp>&); + + // _lib.valarray.members_ member functions: + /// Return the number of elements in array. + size_t size() const; + + /** + * @brief Return the sum of all elements in the array. + * + * Accumulates the sum of all elements into a Tp using +=. The order + * of adding the elements is unspecified. + */ + _Tp sum() const; + + /// Return the minimum element using operator<(). + _Tp min() const; + + /// Return the maximum element using operator<(). + _Tp max() const; + + /** + * @brief Return a shifted array. + * + * A new valarray is constructed as a copy of this array with elements + * in shifted positions. For an element with index i, the new position + * is i - n. The new valarray has the same size as the current one. + * New elements without a value are set to 0. Elements whose new + * position is outside the bounds of the array are discarded. + * + * Positive arguments shift toward index 0, discarding elements [0, n). + * Negative arguments discard elements from the top of the array. + * + * @param n Number of element positions to shift. + * @return New valarray with elements in shifted positions. + */ + valarray<_Tp> shift (int) const; + + /** + * @brief Return a rotated array. + * + * A new valarray is constructed as a copy of this array with elements + * in shifted positions. For an element with index i, the new position + * is (i - n) % size(). The new valarray has the same size as the + * current one. Elements that are shifted beyond the array bounds are + * shifted into the other end of the array. No elements are lost. + * + * Positive arguments shift toward index 0, wrapping around the top. + * Negative arguments shift towards the top, wrapping around to 0. + * + * @param n Number of element positions to rotate. + * @return New valarray with elements in shifted positions. + */ + valarray<_Tp> cshift(int) const; + + /** + * @brief Apply a function to the array. + * + * Returns a new valarray with elements assigned to the result of + * applying func to the corresponding element of this array. The new + * array has the same size as this one. + * + * @param func Function of Tp returning Tp to apply. + * @return New valarray with transformed elements. + */ + _Expr<_ValFunClos<_ValArray, _Tp>, _Tp> apply(_Tp func(_Tp)) const; + + /** + * @brief Apply a function to the array. + * + * Returns a new valarray with elements assigned to the result of + * applying func to the corresponding element of this array. The new + * array has the same size as this one. + * + * @param func Function of const Tp& returning Tp to apply. + * @return New valarray with transformed elements. + */ + _Expr<_RefFunClos<_ValArray, _Tp>, _Tp> apply(_Tp func(const _Tp&)) const; + + /** + * @brief Resize array. + * + * Resize this array to @a size and set all elements to @a c. All + * references and iterators are invalidated. + * + * @param size New array size. + * @param c New value for all elements. + */ + void resize(size_t __size, _Tp __c = _Tp()); + + private: + size_t _M_size; + _Tp* __restrict__ _M_data; + + friend class _Array<_Tp>; + }; + + template + inline const _Tp& + valarray<_Tp>::operator[](size_t __i) const + { + __glibcxx_requires_subscript(__i); + return _M_data[__i]; + } + + template + inline _Tp& + valarray<_Tp>::operator[](size_t __i) + { + __glibcxx_requires_subscript(__i); + return _M_data[__i]; + } + +_GLIBCXX_END_NAMESPACE + +#include +#include +#include +#include +#include +#include + +_GLIBCXX_BEGIN_NAMESPACE(std) + + template + inline + valarray<_Tp>::valarray() : _M_size(0), _M_data(0) {} + + template + inline + valarray<_Tp>::valarray(size_t __n) + : _M_size(__n), _M_data(__valarray_get_storage<_Tp>(__n)) + { std::__valarray_default_construct(_M_data, _M_data + __n); } + + template + inline + valarray<_Tp>::valarray(const _Tp& __t, size_t __n) + : _M_size(__n), _M_data(__valarray_get_storage<_Tp>(__n)) + { std::__valarray_fill_construct(_M_data, _M_data + __n, __t); } + + template + inline + valarray<_Tp>::valarray(const _Tp* __restrict__ __p, size_t __n) + : _M_size(__n), _M_data(__valarray_get_storage<_Tp>(__n)) + { + _GLIBCXX_DEBUG_ASSERT(__p != 0 || __n == 0); + std::__valarray_copy_construct(__p, __p + __n, _M_data); + } + + template + inline + valarray<_Tp>::valarray(const valarray<_Tp>& __v) + : _M_size(__v._M_size), _M_data(__valarray_get_storage<_Tp>(__v._M_size)) + { std::__valarray_copy_construct(__v._M_data, __v._M_data + _M_size, + _M_data); } + + template + inline + valarray<_Tp>::valarray(const slice_array<_Tp>& __sa) + : _M_size(__sa._M_sz), _M_data(__valarray_get_storage<_Tp>(__sa._M_sz)) + { + std::__valarray_copy_construct + (__sa._M_array, __sa._M_sz, __sa._M_stride, _Array<_Tp>(_M_data)); + } + + template + inline + valarray<_Tp>::valarray(const gslice_array<_Tp>& __ga) + : _M_size(__ga._M_index.size()), + _M_data(__valarray_get_storage<_Tp>(_M_size)) + { + std::__valarray_copy_construct + (__ga._M_array, _Array(__ga._M_index), + _Array<_Tp>(_M_data), _M_size); + } + + template + inline + valarray<_Tp>::valarray(const mask_array<_Tp>& __ma) + : _M_size(__ma._M_sz), _M_data(__valarray_get_storage<_Tp>(__ma._M_sz)) + { + std::__valarray_copy_construct + (__ma._M_array, __ma._M_mask, _Array<_Tp>(_M_data), _M_size); + } + + template + inline + valarray<_Tp>::valarray(const indirect_array<_Tp>& __ia) + : _M_size(__ia._M_sz), _M_data(__valarray_get_storage<_Tp>(__ia._M_sz)) + { + std::__valarray_copy_construct + (__ia._M_array, __ia._M_index, _Array<_Tp>(_M_data), _M_size); + } + + template template + inline + valarray<_Tp>::valarray(const _Expr<_Dom, _Tp>& __e) + : _M_size(__e.size()), _M_data(__valarray_get_storage<_Tp>(_M_size)) + { std::__valarray_copy_construct(__e, _M_size, _Array<_Tp>(_M_data)); } + + template + inline + valarray<_Tp>::~valarray() + { + std::__valarray_destroy_elements(_M_data, _M_data + _M_size); + std::__valarray_release_memory(_M_data); + } + + template + inline valarray<_Tp>& + valarray<_Tp>::operator=(const valarray<_Tp>& __v) + { + _GLIBCXX_DEBUG_ASSERT(_M_size == __v._M_size); + std::__valarray_copy(__v._M_data, _M_size, _M_data); + return *this; + } + + template + inline valarray<_Tp>& + valarray<_Tp>::operator=(const _Tp& __t) + { + std::__valarray_fill(_M_data, _M_size, __t); + return *this; + } + + template + inline valarray<_Tp>& + valarray<_Tp>::operator=(const slice_array<_Tp>& __sa) + { + _GLIBCXX_DEBUG_ASSERT(_M_size == __sa._M_sz); + std::__valarray_copy(__sa._M_array, __sa._M_sz, + __sa._M_stride, _Array<_Tp>(_M_data)); + return *this; + } + + template + inline valarray<_Tp>& + valarray<_Tp>::operator=(const gslice_array<_Tp>& __ga) + { + _GLIBCXX_DEBUG_ASSERT(_M_size == __ga._M_index.size()); + std::__valarray_copy(__ga._M_array, _Array(__ga._M_index), + _Array<_Tp>(_M_data), _M_size); + return *this; + } + + template + inline valarray<_Tp>& + valarray<_Tp>::operator=(const mask_array<_Tp>& __ma) + { + _GLIBCXX_DEBUG_ASSERT(_M_size == __ma._M_sz); + std::__valarray_copy(__ma._M_array, __ma._M_mask, + _Array<_Tp>(_M_data), _M_size); + return *this; + } + + template + inline valarray<_Tp>& + valarray<_Tp>::operator=(const indirect_array<_Tp>& __ia) + { + _GLIBCXX_DEBUG_ASSERT(_M_size == __ia._M_sz); + std::__valarray_copy(__ia._M_array, __ia._M_index, + _Array<_Tp>(_M_data), _M_size); + return *this; + } + + template template + inline valarray<_Tp>& + valarray<_Tp>::operator=(const _Expr<_Dom, _Tp>& __e) + { + _GLIBCXX_DEBUG_ASSERT(_M_size == __e.size()); + std::__valarray_copy(__e, _M_size, _Array<_Tp>(_M_data)); + return *this; + } + + template + inline _Expr<_SClos<_ValArray,_Tp>, _Tp> + valarray<_Tp>::operator[](slice __s) const + { + typedef _SClos<_ValArray,_Tp> _Closure; + return _Expr<_Closure, _Tp>(_Closure (_Array<_Tp>(_M_data), __s)); + } + + template + inline slice_array<_Tp> + valarray<_Tp>::operator[](slice __s) + { return slice_array<_Tp>(_Array<_Tp>(_M_data), __s); } + + template + inline _Expr<_GClos<_ValArray,_Tp>, _Tp> + valarray<_Tp>::operator[](const gslice& __gs) const + { + typedef _GClos<_ValArray,_Tp> _Closure; + return _Expr<_Closure, _Tp> + (_Closure(_Array<_Tp>(_M_data), __gs._M_index->_M_index)); + } + + template + inline gslice_array<_Tp> + valarray<_Tp>::operator[](const gslice& __gs) + { + return gslice_array<_Tp> + (_Array<_Tp>(_M_data), __gs._M_index->_M_index); + } + + template + inline valarray<_Tp> + valarray<_Tp>::operator[](const valarray& __m) const + { + size_t __s = 0; + size_t __e = __m.size(); + for (size_t __i=0; __i<__e; ++__i) + if (__m[__i]) ++__s; + return valarray<_Tp>(mask_array<_Tp>(_Array<_Tp>(_M_data), __s, + _Array (__m))); + } + + template + inline mask_array<_Tp> + valarray<_Tp>::operator[](const valarray& __m) + { + size_t __s = 0; + size_t __e = __m.size(); + for (size_t __i=0; __i<__e; ++__i) + if (__m[__i]) ++__s; + return mask_array<_Tp>(_Array<_Tp>(_M_data), __s, _Array(__m)); + } + + template + inline _Expr<_IClos<_ValArray,_Tp>, _Tp> + valarray<_Tp>::operator[](const valarray& __i) const + { + typedef _IClos<_ValArray,_Tp> _Closure; + return _Expr<_Closure, _Tp>(_Closure(*this, __i)); + } + + template + inline indirect_array<_Tp> + valarray<_Tp>::operator[](const valarray& __i) + { + return indirect_array<_Tp>(_Array<_Tp>(_M_data), __i.size(), + _Array(__i)); + } + + template + inline size_t + valarray<_Tp>::size() const + { return _M_size; } + + template + inline _Tp + valarray<_Tp>::sum() const + { + _GLIBCXX_DEBUG_ASSERT(_M_size > 0); + return std::__valarray_sum(_M_data, _M_data + _M_size); + } + + template + inline valarray<_Tp> + valarray<_Tp>::shift(int __n) const + { + valarray<_Tp> __ret; + _Tp* __restrict__ __tmp_M_data = + std::__valarray_get_storage<_Tp>(_M_size); + + if (__n == 0) // no shift + std::__valarray_copy_construct(_M_data, _M_data + _M_size, + __tmp_M_data); + else if (__n > 0) // __n > 0: shift left + { + if (size_t(__n) > _M_size) + std::__valarray_default_construct(__tmp_M_data, + __tmp_M_data + __n); + else + { + std::__valarray_copy_construct(_M_data + __n, + _M_data + _M_size, + __tmp_M_data); + std::__valarray_default_construct(__tmp_M_data + _M_size - __n, + __tmp_M_data + _M_size); + } + } + else // __n < 0: shift right + { + std::__valarray_copy_construct(_M_data, _M_data + _M_size + __n, + __tmp_M_data - __n); + std::__valarray_default_construct(__tmp_M_data, + __tmp_M_data - __n); + } + + __ret._M_size = _M_size; + __ret._M_data = __tmp_M_data; + return __ret; + } + + template + inline valarray<_Tp> + valarray<_Tp>::cshift(int __n) const + { + valarray<_Tp> __ret; + _Tp* __restrict__ __tmp_M_data = + std::__valarray_get_storage<_Tp>(_M_size); + + if (__n == 0) // no cshift + std::__valarray_copy_construct(_M_data, _M_data + _M_size, + __tmp_M_data); + else if (__n > 0) // cshift left + { + std::__valarray_copy_construct(_M_data, _M_data + __n, + __tmp_M_data + _M_size - __n); + std::__valarray_copy_construct(_M_data + __n, _M_data + _M_size, + __tmp_M_data); + } + else // cshift right + { + std::__valarray_copy_construct + (_M_data + _M_size + __n, _M_data + _M_size, __tmp_M_data); + std::__valarray_copy_construct + (_M_data, _M_data + _M_size + __n, __tmp_M_data - __n); + } + + __ret._M_size = _M_size; + __ret._M_data = __tmp_M_data; + return __ret; + } + + template + inline void + valarray<_Tp>::resize(size_t __n, _Tp __c) + { + // This complication is so to make valarray > work + // even though it is not required by the standard. Nobody should + // be saying valarray > anyway. See the specs. + std::__valarray_destroy_elements(_M_data, _M_data + _M_size); + if (_M_size != __n) + { + std::__valarray_release_memory(_M_data); + _M_size = __n; + _M_data = __valarray_get_storage<_Tp>(__n); + } + std::__valarray_fill_construct(_M_data, _M_data + __n, __c); + } + + template + inline _Tp + valarray<_Tp>::min() const + { + _GLIBCXX_DEBUG_ASSERT(_M_size > 0); + return *std::min_element(_M_data, _M_data+_M_size); + } + + template + inline _Tp + valarray<_Tp>::max() const + { + _GLIBCXX_DEBUG_ASSERT(_M_size > 0); + return *std::max_element(_M_data, _M_data+_M_size); + } + + template + inline _Expr<_ValFunClos<_ValArray, _Tp>, _Tp> + valarray<_Tp>::apply(_Tp func(_Tp)) const + { + typedef _ValFunClos<_ValArray, _Tp> _Closure; + return _Expr<_Closure, _Tp>(_Closure(*this, func)); + } + + template + inline _Expr<_RefFunClos<_ValArray, _Tp>, _Tp> + valarray<_Tp>::apply(_Tp func(const _Tp &)) const + { + typedef _RefFunClos<_ValArray, _Tp> _Closure; + return _Expr<_Closure, _Tp>(_Closure(*this, func)); + } + +#define _DEFINE_VALARRAY_UNARY_OPERATOR(_Op, _Name) \ + template \ + inline typename valarray<_Tp>::template _UnaryOp<_Name>::_Rt \ + valarray<_Tp>::operator _Op() const \ + { \ + typedef _UnClos<_Name, _ValArray, _Tp> _Closure; \ + typedef typename __fun<_Name, _Tp>::result_type _Rt; \ + return _Expr<_Closure, _Rt>(_Closure(*this)); \ + } + + _DEFINE_VALARRAY_UNARY_OPERATOR(+, __unary_plus) + _DEFINE_VALARRAY_UNARY_OPERATOR(-, __negate) + _DEFINE_VALARRAY_UNARY_OPERATOR(~, __bitwise_not) + _DEFINE_VALARRAY_UNARY_OPERATOR (!, __logical_not) + +#undef _DEFINE_VALARRAY_UNARY_OPERATOR + +#define _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(_Op, _Name) \ + template \ + inline valarray<_Tp>& \ + valarray<_Tp>::operator _Op##=(const _Tp &__t) \ + { \ + _Array_augmented_##_Name(_Array<_Tp>(_M_data), _M_size, __t); \ + return *this; \ + } \ + \ + template \ + inline valarray<_Tp>& \ + valarray<_Tp>::operator _Op##=(const valarray<_Tp> &__v) \ + { \ + _GLIBCXX_DEBUG_ASSERT(_M_size == __v._M_size); \ + _Array_augmented_##_Name(_Array<_Tp>(_M_data), _M_size, \ + _Array<_Tp>(__v._M_data)); \ + return *this; \ + } + +_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(+, __plus) +_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(-, __minus) +_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(*, __multiplies) +_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(/, __divides) +_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(%, __modulus) +_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(^, __bitwise_xor) +_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(&, __bitwise_and) +_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(|, __bitwise_or) +_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(<<, __shift_left) +_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(>>, __shift_right) + +#undef _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT + +#define _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(_Op, _Name) \ + template template \ + inline valarray<_Tp>& \ + valarray<_Tp>::operator _Op##=(const _Expr<_Dom, _Tp>& __e) \ + { \ + _Array_augmented_##_Name(_Array<_Tp>(_M_data), __e, _M_size); \ + return *this; \ + } + +_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(+, __plus) +_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(-, __minus) +_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(*, __multiplies) +_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(/, __divides) +_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(%, __modulus) +_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(^, __bitwise_xor) +_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(&, __bitwise_and) +_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(|, __bitwise_or) +_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(<<, __shift_left) +_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(>>, __shift_right) + +#undef _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT + + +#define _DEFINE_BINARY_OPERATOR(_Op, _Name) \ + template \ + inline _Expr<_BinClos<_Name, _ValArray, _ValArray, _Tp, _Tp>, \ + typename __fun<_Name, _Tp>::result_type> \ + operator _Op(const valarray<_Tp>& __v, const valarray<_Tp>& __w) \ + { \ + _GLIBCXX_DEBUG_ASSERT(__v.size() == __w.size()); \ + typedef _BinClos<_Name, _ValArray, _ValArray, _Tp, _Tp> _Closure; \ + typedef typename __fun<_Name, _Tp>::result_type _Rt; \ + return _Expr<_Closure, _Rt>(_Closure(__v, __w)); \ + } \ + \ + template \ + inline _Expr<_BinClos<_Name, _ValArray,_Constant, _Tp, _Tp>, \ + typename __fun<_Name, _Tp>::result_type> \ + operator _Op(const valarray<_Tp>& __v, const _Tp& __t) \ + { \ + typedef _BinClos<_Name, _ValArray, _Constant, _Tp, _Tp> _Closure; \ + typedef typename __fun<_Name, _Tp>::result_type _Rt; \ + return _Expr<_Closure, _Rt>(_Closure(__v, __t)); \ + } \ + \ + template \ + inline _Expr<_BinClos<_Name, _Constant, _ValArray, _Tp, _Tp>, \ + typename __fun<_Name, _Tp>::result_type> \ + operator _Op(const _Tp& __t, const valarray<_Tp>& __v) \ + { \ + typedef _BinClos<_Name, _Constant, _ValArray, _Tp, _Tp> _Closure; \ + typedef typename __fun<_Name, _Tp>::result_type _Rt; \ + return _Expr<_Closure, _Tp>(_Closure(__t, __v)); \ + } + +_DEFINE_BINARY_OPERATOR(+, __plus) +_DEFINE_BINARY_OPERATOR(-, __minus) +_DEFINE_BINARY_OPERATOR(*, __multiplies) +_DEFINE_BINARY_OPERATOR(/, __divides) +_DEFINE_BINARY_OPERATOR(%, __modulus) +_DEFINE_BINARY_OPERATOR(^, __bitwise_xor) +_DEFINE_BINARY_OPERATOR(&, __bitwise_and) +_DEFINE_BINARY_OPERATOR(|, __bitwise_or) +_DEFINE_BINARY_OPERATOR(<<, __shift_left) +_DEFINE_BINARY_OPERATOR(>>, __shift_right) +_DEFINE_BINARY_OPERATOR(&&, __logical_and) +_DEFINE_BINARY_OPERATOR(||, __logical_or) +_DEFINE_BINARY_OPERATOR(==, __equal_to) +_DEFINE_BINARY_OPERATOR(!=, __not_equal_to) +_DEFINE_BINARY_OPERATOR(<, __less) +_DEFINE_BINARY_OPERATOR(>, __greater) +_DEFINE_BINARY_OPERATOR(<=, __less_equal) +_DEFINE_BINARY_OPERATOR(>=, __greater_equal) + +#undef _DEFINE_BINARY_OPERATOR + +_GLIBCXX_END_NAMESPACE + +#endif /* _GLIBCXX_VALARRAY */ diff --git a/libstdc++-v3/include/std/vector b/libstdc++-v3/include/std/vector new file mode 100644 index 00000000000..a4a527eea03 --- /dev/null +++ b/libstdc++-v3/include/std/vector @@ -0,0 +1,82 @@ +// -*- C++ -*- + +// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file include/vector + * This is a Standard C++ Library header. + */ + +#ifndef _GLIBCXX_VECTOR +#define _GLIBCXX_VECTOR 1 + +#pragma GCC system_header + +#include +#include +#include +#include +#include +#include +#include + +#ifndef _GLIBCXX_EXPORT_TEMPLATE +# include +#endif + +#ifdef _GLIBCXX_DEBUG +# include +#endif + +#endif /* _GLIBCXX_VECTOR */ + -- cgit v1.2.1