diff options
Diffstat (limited to 'contrib/libstdc++/std')
-rw-r--r-- | contrib/libstdc++/std/bastring.cc | 524 | ||||
-rw-r--r-- | contrib/libstdc++/std/bastring.h | 654 | ||||
-rw-r--r-- | contrib/libstdc++/std/complext.h | 400 | ||||
-rw-r--r-- | contrib/libstdc++/std/dcomplex.h | 91 | ||||
-rw-r--r-- | contrib/libstdc++/std/fcomplex.h | 87 | ||||
-rw-r--r-- | contrib/libstdc++/std/gslice.h | 111 | ||||
-rw-r--r-- | contrib/libstdc++/std/gslice_array.h | 170 | ||||
-rw-r--r-- | contrib/libstdc++/std/indirect_array.h | 157 | ||||
-rw-r--r-- | contrib/libstdc++/std/ldcomplex.h | 95 | ||||
-rw-r--r-- | contrib/libstdc++/std/mask_array.h | 154 | ||||
-rw-r--r-- | contrib/libstdc++/std/slice.h | 76 | ||||
-rw-r--r-- | contrib/libstdc++/std/slice_array.h | 156 | ||||
-rw-r--r-- | contrib/libstdc++/std/std_valarray.h | 728 | ||||
-rw-r--r-- | contrib/libstdc++/std/straits.h | 161 | ||||
-rw-r--r-- | contrib/libstdc++/std/valarray_array.tcc | 130 |
15 files changed, 0 insertions, 3694 deletions
diff --git a/contrib/libstdc++/std/bastring.cc b/contrib/libstdc++/std/bastring.cc deleted file mode 100644 index f86f6d30157c..000000000000 --- a/contrib/libstdc++/std/bastring.cc +++ /dev/null @@ -1,524 +0,0 @@ -// Member templates for the -*- C++ -*- string classes. -// Copyright (C) 1994, 1999 Free Software Foundation - -// This file is part of the GNU ANSI 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -// As a special exception, if you link this library with files -// compiled with a GNU compiler to produce an executable, this does not 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. - -// Written by Jason Merrill based upon the specification by Takanori Adachi -// in ANSI X3J16/94-0013R2. - -extern "C++" { -template <class charT, class traits, class Allocator> -inline void * basic_string <charT, traits, Allocator>::Rep:: -operator new (size_t s, size_t extra) -{ - return Allocator::allocate(s + extra * sizeof (charT)); -} - -template <class charT, class traits, class Allocator> -inline void basic_string <charT, traits, Allocator>::Rep:: -operator delete (void * ptr) -{ - Allocator::deallocate(ptr, sizeof(Rep) + - reinterpret_cast<Rep *>(ptr)->res * - sizeof (charT)); -} - -template <class charT, class traits, class Allocator> -inline size_t basic_string <charT, traits, Allocator>::Rep:: -frob_size (size_t s) -{ - size_t i = 16; - while (i < s) i *= 2; - return i; -} - -template <class charT, class traits, class Allocator> -inline basic_string <charT, traits, Allocator>::Rep * -basic_string <charT, traits, Allocator>::Rep:: -create (size_t extra) -{ - extra = frob_size (extra + 1); - Rep *p = new (extra) Rep; - p->res = extra; - p->ref = 1; - p->selfish = false; - return p; -} - -template <class charT, class traits, class Allocator> -charT * basic_string <charT, traits, Allocator>::Rep:: -clone () -{ - Rep *p = Rep::create (len); - p->copy (0, data (), len); - p->len = len; - return p->data (); -} - -template <class charT, class traits, class Allocator> -inline bool basic_string <charT, traits, Allocator>::Rep:: -excess_slop (size_t s, size_t r) -{ - return 2 * (s <= 16 ? 16 : s) < r; -} - -template <class charT, class traits, class Allocator> -inline bool basic_string <charT, traits, Allocator>:: -check_realloc (basic_string::size_type s) const -{ - s += sizeof (charT); - rep ()->selfish = false; - return (rep ()->ref > 1 - || s > capacity () - || Rep::excess_slop (s, capacity ())); -} - -template <class charT, class traits, class Allocator> -void basic_string <charT, traits, Allocator>:: -alloc (basic_string::size_type __size, bool __save) -{ - if (! check_realloc (__size)) - return; - - Rep *p = Rep::create (__size); - - if (__save) - { - p->copy (0, data (), length ()); - p->len = length (); - } - else - p->len = 0; - - repup (p); -} - -template <class charT, class traits, class Allocator> -basic_string <charT, traits, Allocator>& -basic_string <charT, traits, Allocator>:: -replace (size_type pos1, size_type n1, - const basic_string& str, size_type pos2, size_type n2) -{ - const size_t len2 = str.length (); - - if (pos1 == 0 && n1 >= length () && pos2 == 0 && n2 >= len2) - return operator= (str); - - OUTOFRANGE (pos2 > len2); - - if (n2 > len2 - pos2) - n2 = len2 - pos2; - - return replace (pos1, n1, str.data () + pos2, n2); -} - -template <class charT, class traits, class Allocator> -inline void basic_string <charT, traits, Allocator>::Rep:: -copy (size_t pos, const charT *s, size_t n) -{ - if (n) - traits::copy (data () + pos, s, n); -} - -template <class charT, class traits, class Allocator> -inline void basic_string <charT, traits, Allocator>::Rep:: -move (size_t pos, const charT *s, size_t n) -{ - if (n) - traits::move (data () + pos, s, n); -} - -template <class charT, class traits, class Allocator> -basic_string <charT, traits, Allocator>& -basic_string <charT, traits, Allocator>:: -replace (size_type pos, size_type n1, const charT* s, size_type n2) -{ - const size_type len = length (); - OUTOFRANGE (pos > len); - if (n1 > len - pos) - n1 = len - pos; - LENGTHERROR (len - n1 > max_size () - n2); - size_t newlen = len - n1 + n2; - - if (check_realloc (newlen)) - { - Rep *p = Rep::create (newlen); - p->copy (0, data (), pos); - p->copy (pos + n2, data () + pos + n1, len - (pos + n1)); - p->copy (pos, s, n2); - repup (p); - } - else - { - rep ()->move (pos + n2, data () + pos + n1, len - (pos + n1)); - rep ()->copy (pos, s, n2); - } - rep ()->len = newlen; - - return *this; -} - -template <class charT, class traits, class Allocator> -inline void basic_string <charT, traits, Allocator>::Rep:: -set (size_t pos, const charT c, size_t n) -{ - traits::set (data () + pos, c, n); -} - -template <class charT, class traits, class Allocator> -basic_string <charT, traits, Allocator>& basic_string <charT, traits, Allocator>:: -replace (size_type pos, size_type n1, size_type n2, charT c) -{ - const size_t len = length (); - OUTOFRANGE (pos > len); - if (n1 > len - pos) - n1 = len - pos; - LENGTHERROR (len - n1 > max_size () - n2); - size_t newlen = len - n1 + n2; - - if (check_realloc (newlen)) - { - Rep *p = Rep::create (newlen); - p->copy (0, data (), pos); - p->copy (pos + n2, data () + pos + n1, len - (pos + n1)); - p->set (pos, c, n2); - repup (p); - } - else - { - rep ()->move (pos + n2, data () + pos + n1, len - (pos + n1)); - rep ()->set (pos, c, n2); - } - rep ()->len = newlen; - - return *this; -} - -template <class charT, class traits, class Allocator> -void basic_string <charT, traits, Allocator>:: -resize (size_type n, charT c) -{ - LENGTHERROR (n > max_size ()); - - if (n > length ()) - append (n - length (), c); - else - erase (n); -} - -template <class charT, class traits, class Allocator> -basic_string <charT, traits, Allocator>::size_type -basic_string <charT, traits, Allocator>:: -copy (charT* s, size_type n, size_type pos) const -{ - OUTOFRANGE (pos > length ()); - - if (n > length () - pos) - n = length () - pos; - - traits::copy (s, data () + pos, n); - return n; -} - -template <class charT, class traits, class Allocator> -basic_string <charT, traits, Allocator>::size_type -basic_string <charT, traits, Allocator>:: -find (const charT* s, size_type pos, size_type n) const -{ - size_t xpos = pos; - for (; xpos + n <= length (); ++xpos) - if (traits::eq (data () [xpos], *s) - && traits::compare (data () + xpos, s, n) == 0) - return xpos; - return npos; -} - -template <class charT, class traits, class Allocator> -inline basic_string <charT, traits, Allocator>::size_type -basic_string <charT, traits, Allocator>:: -_find (const charT* ptr, charT c, size_type xpos, size_type len) -{ - for (; xpos < len; ++xpos) - if (traits::eq (ptr [xpos], c)) - return xpos; - return npos; -} - -template <class charT, class traits, class Allocator> -basic_string <charT, traits, Allocator>::size_type -basic_string <charT, traits, Allocator>:: -find (charT c, size_type pos) const -{ - return _find (data (), c, pos, length ()); -} - -template <class charT, class traits, class Allocator> -basic_string <charT, traits, Allocator>::size_type -basic_string <charT, traits, Allocator>:: -rfind (const charT* s, size_type pos, size_type n) const -{ - if (n > length ()) - return npos; - - size_t xpos = length () - n; - if (xpos > pos) - xpos = pos; - - for (++xpos; xpos-- > 0; ) - if (traits::eq (data () [xpos], *s) - && traits::compare (data () + xpos, s, n) == 0) - return xpos; - return npos; -} - -template <class charT, class traits, class Allocator> -basic_string <charT, traits, Allocator>::size_type -basic_string <charT, traits, Allocator>:: -rfind (charT c, size_type pos) const -{ - if (1 > length ()) - return npos; - - size_t xpos = length () - 1; - if (xpos > pos) - xpos = pos; - - for (++xpos; xpos-- > 0; ) - if (traits::eq (data () [xpos], c)) - return xpos; - return npos; -} - -template <class charT, class traits, class Allocator> -basic_string <charT, traits, Allocator>::size_type -basic_string <charT, traits, Allocator>:: -find_first_of (const charT* s, size_type pos, size_type n) const -{ - size_t xpos = pos; - for (; xpos < length (); ++xpos) - if (_find (s, data () [xpos], 0, n) != npos) - return xpos; - return npos; -} - -template <class charT, class traits, class Allocator> -basic_string <charT, traits, Allocator>::size_type -basic_string <charT, traits, Allocator>:: -find_last_of (const charT* s, size_type pos, size_type n) const -{ - if (length() == 0) - return npos; - size_t xpos = length () - 1; - if (xpos > pos) - xpos = pos; - for (++xpos; xpos-- > 0;) - if (_find (s, data () [xpos], 0, n) != npos) - return xpos; - return npos; -} - -template <class charT, class traits, class Allocator> -basic_string <charT, traits, Allocator>::size_type -basic_string <charT, traits, Allocator>:: -find_first_not_of (const charT* s, size_type pos, size_type n) const -{ - size_t xpos = pos; - for (; xpos < length (); ++xpos) - if (_find (s, data () [xpos], 0, n) == npos) - return xpos; - return npos; -} - -template <class charT, class traits, class Allocator> -basic_string <charT, traits, Allocator>::size_type -basic_string <charT, traits, Allocator>:: -find_first_not_of (charT c, size_type pos) const -{ - size_t xpos = pos; - for (; xpos < length (); ++xpos) - if (traits::ne (data () [xpos], c)) - return xpos; - return npos; -} - -template <class charT, class traits, class Allocator> -basic_string <charT, traits, Allocator>::size_type -basic_string <charT, traits, Allocator>:: -find_last_not_of (const charT* s, size_type pos, size_type n) const -{ - if (length() == 0) - return npos; - size_t xpos = length () - 1; - if (xpos > pos) - xpos = pos; - for (++xpos; xpos-- > 0;) - if (_find (s, data () [xpos], 0, n) == npos) - return xpos; - return npos; -} - -template <class charT, class traits, class Allocator> -basic_string <charT, traits, Allocator>::size_type -basic_string <charT, traits, Allocator>:: -find_last_not_of (charT c, size_type pos) const -{ - if (length() == 0) - return npos; - size_t xpos = length () - 1; - if (xpos > pos) - xpos = pos; - for (++xpos; xpos-- > 0;) - if (traits::ne (data () [xpos], c)) - return xpos; - return npos; -} - -template <class charT, class traits, class Allocator> -int basic_string <charT, traits, Allocator>:: -compare (const basic_string& str, size_type pos, size_type n) const -{ - OUTOFRANGE (pos > length ()); - - size_t rlen = length () - pos; - if (rlen > n) - rlen = n; - if (rlen > str.length ()) - rlen = str.length (); - int r = traits::compare (data () + pos, str.data (), rlen); - if (r != 0) - return r; - if (rlen == n) - return 0; - return (length () - pos) - str.length (); -} - -template <class charT, class traits, class Allocator> -int basic_string <charT, traits, Allocator>:: -compare (const charT* s, size_type pos, size_type n) const -{ - OUTOFRANGE (pos > length ()); - - size_t rlen = length () - pos; - if (rlen > n) - rlen = n; - int r = traits::compare (data () + pos, s, rlen); - if (r != 0) - return r; - return (length () - pos) - n; -} - -#include <iostream.h> - -template <class charT, class traits, class Allocator> -istream & -operator>> (istream &is, basic_string <charT, traits, Allocator> &s) -{ - int w = is.width (0); - if (is.ipfx0 ()) - { - register streambuf *sb = is.rdbuf (); - s.resize (0); - while (1) - { - int ch = sb->sbumpc (); - if (ch == EOF) - { - is.setstate (ios::eofbit); - break; - } - else if (traits::is_del (ch)) - { - sb->sungetc (); - break; - } - s += static_cast<charT> (ch); - if (--w == 1) - break; - } - } - - is.isfx (); - if (s.length () == 0) - is.setstate (ios::failbit); - - return is; -} - -template <class charT, class traits, class Allocator> -ostream & -operator<< (ostream &o, const basic_string <charT, traits, Allocator>& s) -{ - return o.write (s.data (), s.length ()); -} - -template <class charT, class traits, class Allocator> -istream& -getline (istream &is, basic_string <charT, traits, Allocator>& s, charT delim) -{ - if (is.ipfx1 ()) - { - _IO_size_t count = 0; - streambuf *sb = is.rdbuf (); - s.resize (0); - - while (1) - { - int ch = sb->sbumpc (); - if (ch == EOF) - { - is.setstate (count == 0 - ? (ios::failbit|ios::eofbit) - : ios::eofbit); - break; - } - - ++count; - - if (ch == delim) - break; - - s += static_cast<charT> (ch); - - if (s.length () == s.npos - 1) - { - is.setstate (ios::failbit); - break; - } - } - } - - // We need to be friends with istream to do this. - // is._gcount = count; - is.isfx (); - - return is; -} - -template <class charT, class traits, class Allocator> -basic_string <charT, traits, Allocator>::Rep -basic_string<charT, traits, Allocator>::nilRep = { 0, 0, 1, false }; - -template <class charT, class traits, class Allocator> -const basic_string <charT, traits, Allocator>::size_type -basic_string <charT, traits, Allocator>::npos; - -} // extern "C++" diff --git a/contrib/libstdc++/std/bastring.h b/contrib/libstdc++/std/bastring.h deleted file mode 100644 index cd3793fffc04..000000000000 --- a/contrib/libstdc++/std/bastring.h +++ /dev/null @@ -1,654 +0,0 @@ -// Main templates for the -*- C++ -*- string classes. -// Copyright (C) 1994, 1995, 1999 Free Software Foundation - -// This file is part of the GNU ANSI 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -// As a special exception, if you link this library with files -// compiled with a GNU compiler to produce an executable, this does not 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. - -// Written by Jason Merrill based upon the specification by Takanori Adachi -// in ANSI X3J16/94-0013R2. - -#ifndef __BASTRING__ -#define __BASTRING__ - -#ifdef __GNUG__ -#pragma interface -#endif - -#include <cstddef> -#include <std/straits.h> - -// NOTE : This does NOT conform to the draft standard and is likely to change -#include <alloc.h> - -extern "C++" { -class istream; class ostream; - -#include <iterator> - -#ifdef __STL_USE_EXCEPTIONS - -extern void __out_of_range (const char *); -extern void __length_error (const char *); - -#define OUTOFRANGE(cond) \ - do { if (cond) __out_of_range (#cond); } while (0) -#define LENGTHERROR(cond) \ - do { if (cond) __length_error (#cond); } while (0) - -#else - -#include <cassert> -#define OUTOFRANGE(cond) assert (!(cond)) -#define LENGTHERROR(cond) assert (!(cond)) - -#endif - -template <class charT, class traits = string_char_traits<charT>, - class Allocator = alloc > -class basic_string -{ -private: - struct Rep { - size_t len, res, ref; - bool selfish; - - charT* data () { return reinterpret_cast<charT *>(this + 1); } - charT& operator[] (size_t s) { return data () [s]; } - charT* grab () { if (selfish) return clone (); ++ref; return data (); } -#if defined __i486__ || defined __i586__ || defined __i686__ - void release () - { - size_t __val; - // This opcode exists as a .byte instead of as a mnemonic for the - // benefit of SCO OpenServer 5. The system assembler (which is - // essentially required on this target) can't assemble xaddl in - //COFF mode. - asm (".byte 0xf0, 0x0f, 0xc1, 0x02" // lock; xaddl %eax, (%edx) - : "=a" (__val) - : "0" (-1), "m" (ref), "d" (&ref) - : "memory"); - - if (__val == 1) - delete this; - } -#elif defined __sparcv9__ - void release () - { - size_t __newval, __oldval = ref; - do - { - __newval = __oldval - 1; - __asm__ ("cas [%4], %2, %0" - : "=r" (__oldval), "=m" (ref) - : "r" (__oldval), "m" (ref), "r"(&(ref)), "0" (__newval)); - } - while (__newval != __oldval); - - if (__oldval == 0) - delete this; - } -#else - void release () { if (--ref == 0) delete this; } -#endif - - inline static void * operator new (size_t, size_t); - inline static void operator delete (void *); - inline static Rep* create (size_t); - charT* clone (); - - inline void copy (size_t, const charT *, size_t); - inline void move (size_t, const charT *, size_t); - inline void set (size_t, const charT, size_t); - - inline static bool excess_slop (size_t, size_t); - inline static size_t frob_size (size_t); - - private: - Rep &operator= (const Rep &); - }; - -public: -// types: - typedef traits traits_type; - typedef typename traits::char_type value_type; - typedef Allocator allocator_type; - - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef charT& reference; - typedef const charT& const_reference; - typedef charT* pointer; - typedef const charT* const_pointer; - typedef pointer iterator; - typedef const_pointer const_iterator; - typedef ::reverse_iterator<iterator> reverse_iterator; - typedef ::reverse_iterator<const_iterator> const_reverse_iterator; - static const size_type npos = static_cast<size_type>(-1); - -private: - Rep *rep () const { return reinterpret_cast<Rep *>(dat) - 1; } - void repup (Rep *p) { rep ()->release (); dat = p->data (); } - -public: - const charT* data () const - { return rep ()->data(); } - size_type length () const - { return rep ()->len; } - size_type size () const - { return rep ()->len; } - size_type capacity () const - { return rep ()->res; } - size_type max_size () const - { return (npos - 1)/sizeof (charT); } // XXX - bool empty () const - { return size () == 0; } - -// _lib.string.cons_ construct/copy/destroy: - basic_string& operator= (const basic_string& str) - { - if (&str != this) { rep ()->release (); dat = str.rep ()->grab (); } - return *this; - } - - explicit basic_string (): dat (nilRep.grab ()) { } - basic_string (const basic_string& str): dat (str.rep ()->grab ()) { } - basic_string (const basic_string& str, size_type pos, size_type n = npos) - : dat (nilRep.grab ()) { assign (str, pos, n); } - basic_string (const charT* s, size_type n) - : dat (nilRep.grab ()) { assign (s, n); } - basic_string (const charT* s) - : dat (nilRep.grab ()) { assign (s); } - basic_string (size_type n, charT c) - : dat (nilRep.grab ()) { assign (n, c); } -#ifdef __STL_MEMBER_TEMPLATES - template<class InputIterator> - basic_string(InputIterator __begin, InputIterator __end) -#else - basic_string(const_iterator __begin, const_iterator __end) -#endif - : dat (nilRep.grab ()) { assign (__begin, __end); } - - ~basic_string () - { rep ()->release (); } - - void swap (basic_string &s) { charT *d = dat; dat = s.dat; s.dat = d; } - - basic_string& append (const basic_string& str, size_type pos = 0, - size_type n = npos) - { return replace (length (), 0, str, pos, n); } - basic_string& append (const charT* s, size_type n) - { return replace (length (), 0, s, n); } - basic_string& append (const charT* s) - { return append (s, traits::length (s)); } - basic_string& append (size_type n, charT c) - { return replace (length (), 0, n, c); } -#ifdef __STL_MEMBER_TEMPLATES - template<class InputIterator> - basic_string& append(InputIterator first, InputIterator last) -#else - basic_string& append(const_iterator first, const_iterator last) -#endif - { return replace (iend (), iend (), first, last); } - - basic_string& assign (const basic_string& str, size_type pos = 0, - size_type n = npos) - { return replace (0, npos, str, pos, n); } - basic_string& assign (const charT* s, size_type n) - { return replace (0, npos, s, n); } - basic_string& assign (const charT* s) - { return assign (s, traits::length (s)); } - basic_string& assign (size_type n, charT c) - { return replace (0, npos, n, c); } -#ifdef __STL_MEMBER_TEMPLATES - template<class InputIterator> - basic_string& assign(InputIterator first, InputIterator last) -#else - basic_string& assign(const_iterator first, const_iterator last) -#endif - { return replace (ibegin (), iend (), first, last); } - - basic_string& operator= (const charT* s) - { return assign (s); } - basic_string& operator= (charT c) - { return assign (1, c); } - - basic_string& operator+= (const basic_string& rhs) - { return append (rhs); } - basic_string& operator+= (const charT* s) - { return append (s); } - basic_string& operator+= (charT c) - { return append (1, c); } - - basic_string& insert (size_type pos1, const basic_string& str, - size_type pos2 = 0, size_type n = npos) - { return replace (pos1, 0, str, pos2, n); } - basic_string& insert (size_type pos, const charT* s, size_type n) - { return replace (pos, 0, s, n); } - basic_string& insert (size_type pos, const charT* s) - { return insert (pos, s, traits::length (s)); } - basic_string& insert (size_type pos, size_type n, charT c) - { return replace (pos, 0, n, c); } - iterator insert(iterator p, charT c) - { size_type __o = p - ibegin (); - insert (p - ibegin (), 1, c); selfish (); - return ibegin () + __o; } - iterator insert(iterator p, size_type n, charT c) - { size_type __o = p - ibegin (); - insert (p - ibegin (), n, c); selfish (); - return ibegin () + __o; } -#ifdef __STL_MEMBER_TEMPLATES - template<class InputIterator> - void insert(iterator p, InputIterator first, InputIterator last) -#else - void insert(iterator p, const_iterator first, const_iterator last) -#endif - { replace (p, p, first, last); } - - basic_string& erase (size_type pos = 0, size_type n = npos) - { return replace (pos, n, (size_type)0, (charT)0); } - iterator erase(iterator p) - { size_type __o = p - begin(); - replace (__o, 1, (size_type)0, (charT)0); selfish (); - return ibegin() + __o; } - iterator erase(iterator f, iterator l) - { size_type __o = f - ibegin(); - replace (__o, l-f, (size_type)0, (charT)0);selfish (); - return ibegin() + __o; } - - basic_string& replace (size_type pos1, size_type n1, const basic_string& str, - size_type pos2 = 0, size_type n2 = npos); - basic_string& replace (size_type pos, size_type n1, const charT* s, - size_type n2); - basic_string& replace (size_type pos, size_type n1, const charT* s) - { return replace (pos, n1, s, traits::length (s)); } - basic_string& replace (size_type pos, size_type n1, size_type n2, charT c); - basic_string& replace (size_type pos, size_type n, charT c) - { return replace (pos, n, 1, c); } - basic_string& replace (iterator i1, iterator i2, const basic_string& str) - { return replace (i1 - ibegin (), i2 - i1, str); } - basic_string& replace (iterator i1, iterator i2, const charT* s, size_type n) - { return replace (i1 - ibegin (), i2 - i1, s, n); } - basic_string& replace (iterator i1, iterator i2, const charT* s) - { return replace (i1 - ibegin (), i2 - i1, s); } - basic_string& replace (iterator i1, iterator i2, size_type n, charT c) - { return replace (i1 - ibegin (), i2 - i1, n, c); } -#ifdef __STL_MEMBER_TEMPLATES - template<class InputIterator> - basic_string& replace(iterator i1, iterator i2, - InputIterator j1, InputIterator j2); -#else - basic_string& replace(iterator i1, iterator i2, - const_iterator j1, const_iterator j2); -#endif - -private: - static charT eos () { return traits::eos (); } - void unique () { if (rep ()->ref > 1) alloc (length (), true); } - void selfish () { unique (); rep ()->selfish = true; } - -public: - charT operator[] (size_type pos) const - { - if (pos == length ()) - return eos (); - return data ()[pos]; - } - - reference operator[] (size_type pos) - { selfish (); return (*rep ())[pos]; } - - reference at (size_type pos) - { - OUTOFRANGE (pos >= length ()); - return (*this)[pos]; - } - const_reference at (size_type pos) const - { - OUTOFRANGE (pos >= length ()); - return data ()[pos]; - } - -private: - void terminate () const - { traits::assign ((*rep ())[length ()], eos ()); } - -public: - const charT* c_str () const - { if (length () == 0) return ""; terminate (); return data (); } - void resize (size_type n, charT c); - void resize (size_type n) - { resize (n, eos ()); } - void reserve (size_type) { } - - size_type copy (charT* s, size_type n, size_type pos = 0) const; - - size_type find (const basic_string& str, size_type pos = 0) const - { return find (str.data(), pos, str.length()); } - size_type find (const charT* s, size_type pos, size_type n) const; - size_type find (const charT* s, size_type pos = 0) const - { return find (s, pos, traits::length (s)); } - size_type find (charT c, size_type pos = 0) const; - - size_type rfind (const basic_string& str, size_type pos = npos) const - { return rfind (str.data(), pos, str.length()); } - size_type rfind (const charT* s, size_type pos, size_type n) const; - size_type rfind (const charT* s, size_type pos = npos) const - { return rfind (s, pos, traits::length (s)); } - size_type rfind (charT c, size_type pos = npos) const; - - size_type find_first_of (const basic_string& str, size_type pos = 0) const - { return find_first_of (str.data(), pos, str.length()); } - size_type find_first_of (const charT* s, size_type pos, size_type n) const; - size_type find_first_of (const charT* s, size_type pos = 0) const - { return find_first_of (s, pos, traits::length (s)); } - size_type find_first_of (charT c, size_type pos = 0) const - { return find (c, pos); } - - size_type find_last_of (const basic_string& str, size_type pos = npos) const - { return find_last_of (str.data(), pos, str.length()); } - size_type find_last_of (const charT* s, size_type pos, size_type n) const; - size_type find_last_of (const charT* s, size_type pos = npos) const - { return find_last_of (s, pos, traits::length (s)); } - size_type find_last_of (charT c, size_type pos = npos) const - { return rfind (c, pos); } - - size_type find_first_not_of (const basic_string& str, size_type pos = 0) const - { return find_first_not_of (str.data(), pos, str.length()); } - size_type find_first_not_of (const charT* s, size_type pos, size_type n) const; - size_type find_first_not_of (const charT* s, size_type pos = 0) const - { return find_first_not_of (s, pos, traits::length (s)); } - size_type find_first_not_of (charT c, size_type pos = 0) const; - - size_type find_last_not_of (const basic_string& str, size_type pos = npos) const - { return find_last_not_of (str.data(), pos, str.length()); } - size_type find_last_not_of (const charT* s, size_type pos, size_type n) const; - size_type find_last_not_of (const charT* s, size_type pos = npos) const - { return find_last_not_of (s, pos, traits::length (s)); } - size_type find_last_not_of (charT c, size_type pos = npos) const; - - basic_string substr (size_type pos = 0, size_type n = npos) const - { return basic_string (*this, pos, n); } - - int compare (const basic_string& str, size_type pos = 0, size_type n = npos) const; - // There is no 'strncmp' equivalent for charT pointers. - int compare (const charT* s, size_type pos, size_type n) const; - int compare (const charT* s, size_type pos = 0) const - { return compare (s, pos, traits::length (s)); } - - iterator begin () { selfish (); return &(*this)[0]; } - iterator end () { selfish (); return &(*this)[length ()]; } - -private: - iterator ibegin () const { return &(*rep ())[0]; } - iterator iend () const { return &(*rep ())[length ()]; } - -public: - const_iterator begin () const { return ibegin (); } - const_iterator end () const { return iend (); } - - reverse_iterator rbegin() { return reverse_iterator (end ()); } - const_reverse_iterator rbegin() const - { return const_reverse_iterator (end ()); } - reverse_iterator rend() { return reverse_iterator (begin ()); } - const_reverse_iterator rend() const - { return const_reverse_iterator (begin ()); } - -private: - void alloc (size_type size, bool save); - static size_type _find (const charT* ptr, charT c, size_type xpos, size_type len); - inline bool check_realloc (size_type s) const; - - static Rep nilRep; - charT *dat; -}; - -#ifdef __STL_MEMBER_TEMPLATES -template <class charT, class traits, class Allocator> template <class InputIterator> -basic_string <charT, traits, Allocator>& basic_string <charT, traits, Allocator>:: -replace (iterator i1, iterator i2, InputIterator j1, InputIterator j2) -#else -template <class charT, class traits, class Allocator> -basic_string <charT, traits, Allocator>& basic_string <charT, traits, Allocator>:: -replace (iterator i1, iterator i2, const_iterator j1, const_iterator j2) -#endif -{ - const size_type len = length (); - size_type pos = i1 - ibegin (); - size_type n1 = i2 - i1; - size_type n2 = j2 - j1; - - OUTOFRANGE (pos > len); - if (n1 > len - pos) - n1 = len - pos; - LENGTHERROR (len - n1 > max_size () - n2); - size_t newlen = len - n1 + n2; - - if (check_realloc (newlen)) - { - Rep *p = Rep::create (newlen); - p->copy (0, data (), pos); - p->copy (pos + n2, data () + pos + n1, len - (pos + n1)); - for (; j1 != j2; ++j1, ++pos) - traits::assign ((*p)[pos], *j1); - repup (p); - } - else - { - rep ()->move (pos + n2, data () + pos + n1, len - (pos + n1)); - for (; j1 != j2; ++j1, ++pos) - traits::assign ((*rep ())[pos], *j1); - } - rep ()->len = newlen; - - return *this; -} - -template <class charT, class traits, class Allocator> -inline basic_string <charT, traits, Allocator> -operator+ (const basic_string <charT, traits, Allocator>& lhs, - const basic_string <charT, traits, Allocator>& rhs) -{ - basic_string <charT, traits, Allocator> str (lhs); - str.append (rhs); - return str; -} - -template <class charT, class traits, class Allocator> -inline basic_string <charT, traits, Allocator> -operator+ (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs) -{ - basic_string <charT, traits, Allocator> str (lhs); - str.append (rhs); - return str; -} - -template <class charT, class traits, class Allocator> -inline basic_string <charT, traits, Allocator> -operator+ (charT lhs, const basic_string <charT, traits, Allocator>& rhs) -{ - basic_string <charT, traits, Allocator> str (1, lhs); - str.append (rhs); - return str; -} - -template <class charT, class traits, class Allocator> -inline basic_string <charT, traits, Allocator> -operator+ (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs) -{ - basic_string <charT, traits, Allocator> str (lhs); - str.append (rhs); - return str; -} - -template <class charT, class traits, class Allocator> -inline basic_string <charT, traits, Allocator> -operator+ (const basic_string <charT, traits, Allocator>& lhs, charT rhs) -{ - basic_string <charT, traits, Allocator> str (lhs); - str.append (1, rhs); - return str; -} - -template <class charT, class traits, class Allocator> -inline bool -operator== (const basic_string <charT, traits, Allocator>& lhs, - const basic_string <charT, traits, Allocator>& rhs) -{ - return (lhs.compare (rhs) == 0); -} - -template <class charT, class traits, class Allocator> -inline bool -operator== (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs) -{ - return (rhs.compare (lhs) == 0); -} - -template <class charT, class traits, class Allocator> -inline bool -operator== (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs) -{ - return (lhs.compare (rhs) == 0); -} - -template <class charT, class traits, class Allocator> -inline bool -operator!= (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs) -{ - return (rhs.compare (lhs) != 0); -} - -template <class charT, class traits, class Allocator> -inline bool -operator!= (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs) -{ - return (lhs.compare (rhs) != 0); -} - -template <class charT, class traits, class Allocator> -inline bool -operator< (const basic_string <charT, traits, Allocator>& lhs, - const basic_string <charT, traits, Allocator>& rhs) -{ - return (lhs.compare (rhs) < 0); -} - -template <class charT, class traits, class Allocator> -inline bool -operator< (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs) -{ - return (rhs.compare (lhs) > 0); -} - -template <class charT, class traits, class Allocator> -inline bool -operator< (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs) -{ - return (lhs.compare (rhs) < 0); -} - -template <class charT, class traits, class Allocator> -inline bool -operator> (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs) -{ - return (rhs.compare (lhs) < 0); -} - -template <class charT, class traits, class Allocator> -inline bool -operator> (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs) -{ - return (lhs.compare (rhs) > 0); -} - -template <class charT, class traits, class Allocator> -inline bool -operator<= (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs) -{ - return (rhs.compare (lhs) >= 0); -} - -template <class charT, class traits, class Allocator> -inline bool -operator<= (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs) -{ - return (lhs.compare (rhs) <= 0); -} - -template <class charT, class traits, class Allocator> -inline bool -operator>= (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs) -{ - return (rhs.compare (lhs) <= 0); -} - -template <class charT, class traits, class Allocator> -inline bool -operator>= (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs) -{ - return (lhs.compare (rhs) >= 0); -} - -template <class charT, class traits, class Allocator> -inline bool -operator!= (const basic_string <charT, traits, Allocator>& lhs, - const basic_string <charT, traits, Allocator>& rhs) -{ - return (lhs.compare (rhs) != 0); -} - -template <class charT, class traits, class Allocator> -inline bool -operator> (const basic_string <charT, traits, Allocator>& lhs, - const basic_string <charT, traits, Allocator>& rhs) -{ - return (lhs.compare (rhs) > 0); -} - -template <class charT, class traits, class Allocator> -inline bool -operator<= (const basic_string <charT, traits, Allocator>& lhs, - const basic_string <charT, traits, Allocator>& rhs) -{ - return (lhs.compare (rhs) <= 0); -} - -template <class charT, class traits, class Allocator> -inline bool -operator>= (const basic_string <charT, traits, Allocator>& lhs, - const basic_string <charT, traits, Allocator>& rhs) -{ - return (lhs.compare (rhs) >= 0); -} - -class istream; class ostream; -template <class charT, class traits, class Allocator> istream& -operator>> (istream&, basic_string <charT, traits, Allocator>&); -template <class charT, class traits, class Allocator> ostream& -operator<< (ostream&, const basic_string <charT, traits, Allocator>&); -template <class charT, class traits, class Allocator> istream& -getline (istream&, basic_string <charT, traits, Allocator>&, charT delim = '\n'); - -} // extern "C++" - -#include <std/bastring.cc> - -#endif diff --git a/contrib/libstdc++/std/complext.h b/contrib/libstdc++/std/complext.h deleted file mode 100644 index 6c55037bf94b..000000000000 --- a/contrib/libstdc++/std/complext.h +++ /dev/null @@ -1,400 +0,0 @@ -// The template and inlines for the -*- C++ -*- complex number classes. -// Copyright (C) 1994 Free Software Foundation - -// This file is part of the GNU ANSI 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -// As a special exception, if you link this library with files compiled -// with a GNU compiler to produce an executable, this does not 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. - -// Written by Jason Merrill based upon the specification in the 27 May 1994 -// C++ working paper, ANSI document X3J16/94-0098. - -#ifndef __COMPLEXT__ -#define __COMPLEXT__ - -#ifdef __GNUG__ -#pragma interface -#endif - -#include <cmath> - -#if ! defined (__GNUG__) && ! defined (__attribute__) -#define __attribute__(foo) /* Ignore. */ -#endif - -class istream; -class ostream; - -extern "C++" { -template <class _FLT> class complex; -template <class _FLT> complex<_FLT>& - __doapl (complex<_FLT>* ths, const complex<_FLT>& r); -template <class _FLT> complex<_FLT>& - __doami (complex<_FLT>* ths, const complex<_FLT>& r); -template <class _FLT> complex<_FLT>& - __doaml (complex<_FLT>* ths, const complex<_FLT>& r); -template <class _FLT> complex<_FLT>& - __doadv (complex<_FLT>* ths, const complex<_FLT>& r); - -template <class _FLT> -class complex -{ -public: - complex (_FLT r = 0, _FLT i = 0): re (r), im (i) { } - complex& operator += (const complex&); - complex& operator -= (const complex&); - complex& operator *= (const complex&); - complex& operator /= (const complex&); - _FLT real () const { return re; } - _FLT imag () const { return im; } -private: - _FLT re, im; - - friend complex& __doapl<> (complex *, const complex&); - friend complex& __doami<> (complex *, const complex&); - friend complex& __doaml<> (complex *, const complex&); - friend complex& __doadv<> (complex *, const complex&); -}; - -// Declare specializations. -class complex<float>; -class complex<double>; -class complex<long double>; - -template <class _FLT> -inline complex<_FLT>& -__doapl (complex<_FLT>* ths, const complex<_FLT>& r) -{ - ths->re += r.re; - ths->im += r.im; - return *ths; -} -template <class _FLT> -inline complex<_FLT>& -complex<_FLT>::operator += (const complex<_FLT>& r) -{ - return __doapl (this, r); -} - -template <class _FLT> -inline complex<_FLT>& -__doami (complex<_FLT>* ths, const complex<_FLT>& r) -{ - ths->re -= r.re; - ths->im -= r.im; - return *ths; -} -template <class _FLT> -inline complex<_FLT>& -complex<_FLT>::operator -= (const complex<_FLT>& r) -{ - return __doami (this, r); -} - -template <class _FLT> -inline complex<_FLT>& -__doaml (complex<_FLT>* ths, const complex<_FLT>& r) -{ - _FLT f = ths->re * r.re - ths->im * r.im; - ths->im = ths->re * r.im + ths->im * r.re; - ths->re = f; - return *ths; -} -template <class _FLT> -inline complex<_FLT>& -complex<_FLT>::operator *= (const complex<_FLT>& r) -{ - return __doaml (this, r); -} - -template <class _FLT> -inline complex<_FLT>& -complex<_FLT>::operator /= (const complex<_FLT>& r) -{ - return __doadv (this, r); -} - -template <class _FLT> inline _FLT -imag (const complex<_FLT>& x) __attribute__ ((const)); - -template <class _FLT> inline _FLT -imag (const complex<_FLT>& x) -{ - return x.imag (); -} - -template <class _FLT> inline _FLT -real (const complex<_FLT>& x) __attribute__ ((const)); - -template <class _FLT> inline _FLT -real (const complex<_FLT>& x) -{ - return x.real (); -} - -template <class _FLT> inline complex<_FLT> -operator + (const complex<_FLT>& x, const complex<_FLT>& y) __attribute__ ((const)); - -template <class _FLT> inline complex<_FLT> -operator + (const complex<_FLT>& x, const complex<_FLT>& y) -{ - return complex<_FLT> (real (x) + real (y), imag (x) + imag (y)); -} - -template <class _FLT> inline complex<_FLT> -operator + (const complex<_FLT>& x, _FLT y) __attribute__ ((const)); - -template <class _FLT> inline complex<_FLT> -operator + (const complex<_FLT>& x, _FLT y) -{ - return complex<_FLT> (real (x) + y, imag (x)); -} - -template <class _FLT> inline complex<_FLT> -operator + (_FLT x, const complex<_FLT>& y) __attribute__ ((const)); - -template <class _FLT> inline complex<_FLT> -operator + (_FLT x, const complex<_FLT>& y) -{ - return complex<_FLT> (x + real (y), imag (y)); -} - -template <class _FLT> inline complex<_FLT> -operator - (const complex<_FLT>& x, const complex<_FLT>& y) __attribute__ ((const)); - -template <class _FLT> inline complex<_FLT> -operator - (const complex<_FLT>& x, const complex<_FLT>& y) -{ - return complex<_FLT> (real (x) - real (y), imag (x) - imag (y)); -} - -template <class _FLT> inline complex<_FLT> -operator - (const complex<_FLT>& x, _FLT y) __attribute__ ((const)); - -template <class _FLT> inline complex<_FLT> -operator - (const complex<_FLT>& x, _FLT y) -{ - return complex<_FLT> (real (x) - y, imag (x)); -} - -template <class _FLT> inline complex<_FLT> -operator - (_FLT x, const complex<_FLT>& y) __attribute__ ((const)); - -template <class _FLT> inline complex<_FLT> -operator - (_FLT x, const complex<_FLT>& y) -{ - return complex<_FLT> (x - real (y), - imag (y)); -} - -template <class _FLT> inline complex<_FLT> -operator * (const complex<_FLT>& x, const complex<_FLT>& y) __attribute__ ((const)); - -template <class _FLT> inline complex<_FLT> -operator * (const complex<_FLT>& x, const complex<_FLT>& y) -{ - return complex<_FLT> (real (x) * real (y) - imag (x) * imag (y), - real (x) * imag (y) + imag (x) * real (y)); -} - -template <class _FLT> inline complex<_FLT> -operator * (const complex<_FLT>& x, _FLT y) __attribute__ ((const)); - -template <class _FLT> inline complex<_FLT> -operator * (const complex<_FLT>& x, _FLT y) -{ - return complex<_FLT> (real (x) * y, imag (x) * y); -} - -template <class _FLT> inline complex<_FLT> -operator * (_FLT x, const complex<_FLT>& y) __attribute__ ((const)); - -template <class _FLT> inline complex<_FLT> -operator * (_FLT x, const complex<_FLT>& y) -{ - return complex<_FLT> (x * real (y), x * imag (y)); -} - -template <class _FLT> complex<_FLT> -operator / (const complex<_FLT>& x, _FLT y) __attribute__ ((const)); - -template <class _FLT> complex<_FLT> -operator / (const complex<_FLT>& x, _FLT y) -{ - return complex<_FLT> (real (x) / y, imag (x) / y); -} - -template <class _FLT> inline complex<_FLT> -operator + (const complex<_FLT>& x) __attribute__ ((const)); - -template <class _FLT> inline complex<_FLT> -operator + (const complex<_FLT>& x) -{ - return x; -} - -template <class _FLT> inline complex<_FLT> -operator - (const complex<_FLT>& x) __attribute__ ((const)); - -template <class _FLT> inline complex<_FLT> -operator - (const complex<_FLT>& x) -{ - return complex<_FLT> (-real (x), -imag (x)); -} - -template <class _FLT> inline bool -operator == (const complex<_FLT>& x, const complex<_FLT>& y) __attribute__ ((const)); - -template <class _FLT> inline bool -operator == (const complex<_FLT>& x, const complex<_FLT>& y) -{ - return real (x) == real (y) && imag (x) == imag (y); -} - -template <class _FLT> inline bool -operator == (const complex<_FLT>& x, _FLT y) __attribute__ ((const)); - -template <class _FLT> inline bool -operator == (const complex<_FLT>& x, _FLT y) -{ - return real (x) == y && imag (x) == 0; -} - -template <class _FLT> inline bool -operator == (_FLT x, const complex<_FLT>& y) __attribute__ ((const)); - -template <class _FLT> inline bool -operator == (_FLT x, const complex<_FLT>& y) -{ - return x == real (y) && imag (y) == 0; -} - -template <class _FLT> inline bool -operator != (const complex<_FLT>& x, const complex<_FLT>& y) __attribute__ ((const)); - -template <class _FLT> inline bool -operator != (const complex<_FLT>& x, const complex<_FLT>& y) -{ - return real (x) != real (y) || imag (x) != imag (y); -} - -template <class _FLT> inline bool -operator != (const complex<_FLT>& x, _FLT y) __attribute__ ((const)); - -template <class _FLT> inline bool -operator != (const complex<_FLT>& x, _FLT y) -{ - return real (x) != y || imag (x) != 0; -} - -template <class _FLT> inline bool -operator != (_FLT x, const complex<_FLT>& y) __attribute__ ((const)); - -template <class _FLT> inline bool -operator != (_FLT x, const complex<_FLT>& y) -{ - return x != real (y) || imag (y) != 0; -} - -// Some targets don't provide a prototype for hypot when -ansi. -extern "C" double hypot (double, double) __attribute__ ((const)); - -template <class _FLT> inline _FLT -abs (const complex<_FLT>& x) __attribute__ ((const)); - -template <class _FLT> inline _FLT -abs (const complex<_FLT>& x) -{ - return hypot (real (x), imag (x)); -} - -template <class _FLT> inline _FLT -arg (const complex<_FLT>& x) __attribute__ ((const)); - -template <class _FLT> inline _FLT -arg (const complex<_FLT>& x) -{ - return atan2 (imag (x), real (x)); -} - -template <class _FLT> inline complex<_FLT> -polar (_FLT r, _FLT t) __attribute__ ((const)); - -template <class _FLT> inline complex<_FLT> -polar (_FLT r, _FLT t) -{ - return complex<_FLT> (r * cos (t), r * sin (t)); -} - -template <class _FLT> inline complex<_FLT> -conj (const complex<_FLT>& x) __attribute__ ((const)); - -template <class _FLT> inline complex<_FLT> -conj (const complex<_FLT>& x) -{ - return complex<_FLT> (real (x), -imag (x)); -} - -template <class _FLT> inline _FLT -norm (const complex<_FLT>& x) __attribute__ ((const)); - -template <class _FLT> inline _FLT -norm (const complex<_FLT>& x) -{ - return real (x) * real (x) + imag (x) * imag (x); -} - -// Declarations of templates in complext.ccI - -template <class _FLT> complex<_FLT> - operator / (const complex<_FLT>&, const complex<_FLT>&) __attribute__ ((const)); -template <class _FLT> complex<_FLT> - operator / (_FLT, const complex<_FLT>&) __attribute__ ((const)); -template <class _FLT> complex<_FLT> - cos (const complex<_FLT>&) __attribute__ ((const)); -template <class _FLT> complex<_FLT> - cosh (const complex<_FLT>&) __attribute__ ((const)); -template <class _FLT> complex<_FLT> - exp (const complex<_FLT>&) __attribute__ ((const)); -template <class _FLT> complex<_FLT> - log (const complex<_FLT>&) __attribute__ ((const)); -template <class _FLT> complex<_FLT> - pow (const complex<_FLT>&, const complex<_FLT>&) __attribute__ ((const)); -template <class _FLT> complex<_FLT> - pow (const complex<_FLT>&, _FLT) __attribute__ ((const)); -template <class _FLT> complex<_FLT> - pow (const complex<_FLT>&, int) __attribute__ ((const)); -template <class _FLT> complex<_FLT> - pow (_FLT, const complex<_FLT>&) __attribute__ ((const)); -template <class _FLT> complex<_FLT> - sin (const complex<_FLT>&) __attribute__ ((const)); -template <class _FLT> complex<_FLT> - sinh (const complex<_FLT>&) __attribute__ ((const)); -template <class _FLT> complex<_FLT> - sqrt (const complex<_FLT>&) __attribute__ ((const)); - -template <class _FLT> istream& operator >> (istream&, complex<_FLT>&); -template <class _FLT> ostream& operator << (ostream&, const complex<_FLT>&); -} // extern "C++" - -// Specializations and such - -#include <std/fcomplex.h> -#include <std/dcomplex.h> -#include <std/ldcomplex.h> - -#endif diff --git a/contrib/libstdc++/std/dcomplex.h b/contrib/libstdc++/std/dcomplex.h deleted file mode 100644 index 5812d9fa7dfd..000000000000 --- a/contrib/libstdc++/std/dcomplex.h +++ /dev/null @@ -1,91 +0,0 @@ -// The -*- C++ -*- double_complex class. -// Copyright (C) 1994 Free Software Foundation - -// This file is part of the GNU ANSI 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -// As a special exception, if you link this library with files -// compiled with a GNU compiler to produce an executable, this does not 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. - -// Written by Jason Merrill based upon the specification in the 27 May 1994 -// C++ working paper, ANSI document X3J16/94-0098. - -#ifndef __DCOMPLEX__ -#define __DCOMPLEX__ - -#ifdef __GNUG__ -#pragma interface "dcomplex" -#endif - -extern "C++" { -class complex<double> -{ -public: - complex (double r = 0, double i = 0): re (r), im (i) { } - complex (const complex<float>& r): re (r.real ()), im (r.imag ()) { } - explicit complex (const complex<long double>& r); - - complex& operator+= (const complex& r) { return __doapl (this, r); } - complex& operator-= (const complex& r) { return __doami (this, r); } - complex& operator*= (const complex& r) { return __doaml (this, r); } - complex& operator/= (const complex& r) { return __doadv (this, r); } - - double real () const { return re; } - double imag () const { return im; } -private: - double re, im; - - friend complex& __doapl<> (complex *, const complex&); - friend complex& __doami<> (complex *, const complex&); - friend complex& __doaml<> (complex *, const complex&); - friend complex& __doadv<> (complex *, const complex&); - -#ifndef __STRICT_ANSI__ - friend inline complex operator + (const complex& x, double y) - { return operator+<> (x, y); } - friend inline complex operator + (double x, const complex& y) - { return operator+<> (x, y); } - friend inline complex operator - (const complex& x, double y) - { return operator-<> (x, y); } - friend inline complex operator - (double x, const complex& y) - { return operator-<> (x, y); } - friend inline complex operator * (const complex& x, double y) - { return operator*<> (x, y); } - friend inline complex operator * (double x, const complex& y) - { return operator*<> (x, y); } - friend inline complex operator / (const complex& x, double y) - { return operator/<> (x, y); } - friend inline complex operator / (double x, const complex& y) - { return operator/<> (x, y); } - friend inline bool operator == (const complex& x, double y) - { return operator==<> (x, y); } - friend inline bool operator == (double x, const complex& y) - { return operator==<> (x, y); } - friend inline bool operator != (const complex& x, double y) - { return operator!=<> (x, y); } - friend inline bool operator != (double x, const complex& y) - { return operator!=<> (x, y); } -#endif /* __STRICT_ANSI__ */ -}; - -inline complex<float>::complex (const complex<double>& r) -: re (r.real ()), im (r.imag ()) -{ } -} // extern "C++" - -#endif diff --git a/contrib/libstdc++/std/fcomplex.h b/contrib/libstdc++/std/fcomplex.h deleted file mode 100644 index cd9af1a2e0ce..000000000000 --- a/contrib/libstdc++/std/fcomplex.h +++ /dev/null @@ -1,87 +0,0 @@ -// The -*- C++ -*- float_complex class. -// Copyright (C) 1994 Free Software Foundation - -// This file is part of the GNU ANSI 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -// As a special exception, if you link this library with files -// compiled with a GNU compiler to produce an executable, this does not 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. - -// Written by Jason Merrill based upon the specification in the 27 May 1994 -// C++ working paper, ANSI document X3J16/94-0098. - -#ifndef __FCOMPLEX__ -#define __FCOMPLEX__ - -#ifdef __GNUG__ -#pragma interface "fcomplex" -#endif - -extern "C++" { -class complex<float> -{ -public: - complex (float r = 0, float i = 0): re (r), im (i) { } - explicit complex (const complex<double>& r); - explicit complex (const complex<long double>& r); - - complex& operator+= (const complex& r) { return __doapl (this, r); } - complex& operator-= (const complex& r) { return __doami (this, r); } - complex& operator*= (const complex& r) { return __doaml (this, r); } - complex& operator/= (const complex& r) { return __doadv (this, r); } - - float real () const { return re; } - float imag () const { return im; } -private: - float re, im; - - friend complex& __doapl<> (complex *, const complex&); - friend complex& __doami<> (complex *, const complex&); - friend complex& __doaml<> (complex *, const complex&); - friend complex& __doadv<> (complex *, const complex&); - -#ifndef __STRICT_ANSI__ - friend inline complex operator + (const complex& x, float y) - { return operator+<> (x, y); } - friend inline complex operator + (float x, const complex& y) - { return operator+<> (x, y); } - friend inline complex operator - (const complex& x, float y) - { return operator-<> (x, y); } - friend inline complex operator - (float x, const complex& y) - { return operator-<> (x, y); } - friend inline complex operator * (const complex& x, float y) - { return operator*<> (x, y); } - friend inline complex operator * (float x, const complex& y) - { return operator*<> (x, y); } - friend inline complex operator / (const complex& x, float y) - { return operator/<> (x, y); } - friend inline complex operator / (float x, const complex& y) - { return operator/<> (x, y); } - friend inline bool operator == (const complex& x, float y) - { return operator==<> (x, y); } - friend inline bool operator == (float x, const complex& y) - { return operator==<> (x, y); } - friend inline bool operator != (const complex& x, float y) - { return operator!=<> (x, y); } - friend inline bool operator != (float x, const complex& y) - { return operator!=<> (x, y); } -#endif /* __STRICT_ANSI__ */ -}; -} // extern "C++" - -#endif diff --git a/contrib/libstdc++/std/gslice.h b/contrib/libstdc++/std/gslice.h deleted file mode 100644 index 4f6e854a14c0..000000000000 --- a/contrib/libstdc++/std/gslice.h +++ /dev/null @@ -1,111 +0,0 @@ -// The template and inlines for the -*- C++ -*- gslice class. - -// Copyright (C) 1997-1999 Cygnus Solutions -// -// 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -// 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. - -// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr> - -#ifndef __GSLICE__ -#define __GSLICE__ - -extern "C++" { - -struct _Indexer { - size_t _M_count; - size_t _M_start; - valarray<size_t> _M_size; - valarray<size_t> _M_stride; - valarray<size_t> _M_index; - _Indexer(size_t, const valarray<size_t>&, const valarray<size_t>&); - void _M_increment_use() { ++_M_count; } - size_t _M_decrement_use() { return --_M_count; } -}; - - -class gslice -{ -public: - gslice (); - gslice (size_t, const valarray<size_t>&, const valarray<size_t>&); - gslice(const gslice&); - ~gslice(); - - gslice& operator= (const gslice&); - size_t start () const; - valarray<size_t> size () const; - valarray<size_t> stride () const; - -private: - _Indexer* _M_index; - - template<typename _Tp> friend class valarray; -}; - -inline size_t -gslice::start () const -{ return _M_index ? _M_index->_M_start : 0; } - -inline valarray<size_t> -gslice::size () const -{ return _M_index ? _M_index->_M_size : valarray<size_t>(); } - -inline valarray<size_t> -gslice::stride () const -{ return _M_index ? _M_index->_M_stride : valarray<size_t>(); } - -inline gslice::gslice () : _M_index(0) {} - -inline -gslice::gslice(size_t __o, const valarray<size_t>& __l, - const valarray<size_t>& __s) - : _M_index(new _Indexer(__o, __l, __s)) {} - -inline -gslice::gslice(const gslice& __g) : _M_index(__g._M_index) -{ if (_M_index) _M_index->_M_increment_use(); } - -inline -gslice::~gslice() -{ if (_M_index && _M_index->_M_decrement_use() == 0) delete _M_index; } - -inline gslice& -gslice::operator= (const gslice& __g) -{ - if (__g._M_index) __g._M_index->_M_increment_use(); - if (_M_index && _M_index->_M_decrement_use() == 0) delete _M_index; - _M_index = __g._M_index; - return *this; -} - - -} // extern "C++" - -#endif // __GSLICE__ - -// Local Variables: -// mode:c++ -// End: diff --git a/contrib/libstdc++/std/gslice_array.h b/contrib/libstdc++/std/gslice_array.h deleted file mode 100644 index 8a67cac90502..000000000000 --- a/contrib/libstdc++/std/gslice_array.h +++ /dev/null @@ -1,170 +0,0 @@ -// The template and inlines for the -*- C++ -*- gslice_array class. - -// Copyright (C) 1997-1999 Cygnus Solutions -// -// 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -// 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. - -// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr> - -#ifndef __GSLICE_ARRAY__ -#define __GSLICE_ARRAY__ - -extern "C++" { - -template<typename _Tp> class gslice_array -{ -public: - typedef _Tp value_type; - - void operator= (const valarray<_Tp>&) const; - void operator*= (const valarray<_Tp>&) const; - void operator/= (const valarray<_Tp>&) const; - void operator%= (const valarray<_Tp>&) const; - void operator+= (const valarray<_Tp>&) const; - void operator-= (const valarray<_Tp>&) const; - void operator^= (const valarray<_Tp>&) const; - void operator&= (const valarray<_Tp>&) const; - void operator|= (const valarray<_Tp>&) const; - void operator<<=(const valarray<_Tp>&) const; - void operator>>=(const valarray<_Tp>&) const; - void operator=(const _Tp&); - - template<class _Dom> - void operator= (const _Expr<_Dom,_Tp>&) const; - template<class _Dom> - void operator*= (const _Expr<_Dom,_Tp>&) const; - template<class _Dom> - void operator/= (const _Expr<_Dom,_Tp>&) const; - template<class _Dom> - void operator%= (const _Expr<_Dom,_Tp>&) const; - template<class _Dom> - void operator+= (const _Expr<_Dom,_Tp>&) const; - template<class _Dom> - void operator-= (const _Expr<_Dom,_Tp>&) const; - template<class _Dom> - void operator^= (const _Expr<_Dom,_Tp>&) const; - template<class _Dom> - void operator&= (const _Expr<_Dom,_Tp>&) const; - template<class _Dom> - void operator|= (const _Expr<_Dom,_Tp>&) const; - template<class _Dom> - void operator<<= (const _Expr<_Dom,_Tp>&) const; - template<class _Dom> - void operator>>= (const _Expr<_Dom,_Tp>&) const; - -private: - _Array<_Tp> _M_array; - const valarray<size_t>& _M_index; - - friend class valarray<_Tp>; - - gslice_array (_Array<_Tp>, const valarray<size_t>&); - - // this constructor needs to be implemented. - gslice_array (const gslice_array&); - - // not implemented - gslice_array(); - gslice_array& operator= (const gslice_array&); -}; - -template<typename _Tp> -inline -gslice_array<_Tp>::gslice_array (_Array<_Tp> __a, - const valarray<size_t>& __i) - : _M_array (__a), _M_index (__i) {} - - -template<typename _Tp> -inline -gslice_array<_Tp>::gslice_array (const gslice_array<_Tp>& __a) - : _M_array (__a._M_array), _M_index (__a._M_index) {} - - -template<typename _Tp> -inline void -gslice_array<_Tp>::operator= (const _Tp& __t) -{ - __valarray_fill (_M_array, _Array<size_t>(_M_index), - _M_index.size(), __t); -} - -template<typename _Tp> -inline void -gslice_array<_Tp>::operator= (const valarray<_Tp>& __v) const -{ - __valarray_copy (_Array<_Tp> (__v), __v.size (), - _M_array, _Array<size_t>(_M_index)); -} - -template<typename _Tp> -template<class E> -inline void -gslice_array<_Tp>::operator= (const _Expr<E, _Tp>& __e) const -{ - __valarray_copy (__e, _M_index.size(), _M_array, - _Array<size_t>(_M_index)); -} - -#undef _DEFINE_VALARRAY_OPERATOR -#define _DEFINE_VALARRAY_OPERATOR(op, name) \ -template<typename _Tp> \ -inline void \ -gslice_array<_Tp>::operator##op##= (const valarray<_Tp>& __v) const \ -{ \ - _Array_augmented_##name (_M_array, _Array<size_t>(_M_index), \ - _Array<_Tp> (__v), __v.size ()); \ -} \ - \ -template<typename _Tp> template<class E> \ -inline void \ -gslice_array<_Tp>::operator##op##= (const _Expr<E, _Tp>& __e) const \ -{ \ - _Array_augmented_##name (_M_array, _Array<size_t>(_M_index), __e, \ - _M_index.size()); \ -} - -_DEFINE_VALARRAY_OPERATOR(*, multiplies) -_DEFINE_VALARRAY_OPERATOR(/, divides) -_DEFINE_VALARRAY_OPERATOR(%, modulus) -_DEFINE_VALARRAY_OPERATOR(+, plus) -_DEFINE_VALARRAY_OPERATOR(-, minus) -_DEFINE_VALARRAY_OPERATOR(^, xor) -_DEFINE_VALARRAY_OPERATOR(&, and) -_DEFINE_VALARRAY_OPERATOR(|, or) -_DEFINE_VALARRAY_OPERATOR(<<, shift_left) -_DEFINE_VALARRAY_OPERATOR(>>, shift_right) - -#undef _DEFINE_VALARRAY_OPERATOR - -} // extern "C++" - - -#endif // __GSLICE_ARRAY__ - -// Local Variables: -// mode:c++ -// End: diff --git a/contrib/libstdc++/std/indirect_array.h b/contrib/libstdc++/std/indirect_array.h deleted file mode 100644 index bb5b79fb834d..000000000000 --- a/contrib/libstdc++/std/indirect_array.h +++ /dev/null @@ -1,157 +0,0 @@ -// The template and inlines for the -*- C++ -*- indirect_array class. - -// Copyright (C) 1997-1999 Cygnus Solutions -// -// 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -// 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. - -// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr> - -#ifndef __INDIRECT_ARRAY__ -#define __INDIRECT_ARRAY__ - -extern "C++" { - -template <class _Tp> class indirect_array -{ -public: - typedef _Tp value_type; - - void operator= (const valarray<_Tp>&) const; - void operator*= (const valarray<_Tp>&) const; - void operator/= (const valarray<_Tp>&) const; - void operator%= (const valarray<_Tp>&) const; - void operator+= (const valarray<_Tp>&) const; - void operator-= (const valarray<_Tp>&) const; - void operator^= (const valarray<_Tp>&) const; - void operator&= (const valarray<_Tp>&) const; - void operator|= (const valarray<_Tp>&) const; - void operator<<= (const valarray<_Tp>&) const; - void operator>>= (const valarray<_Tp>&) const; - void operator= (const _Tp&); - - template<class _Dom> - void operator= (const _Expr<_Dom, _Tp>&) const; - template<class _Dom> - void operator*= (const _Expr<_Dom, _Tp>&) const; - template<class _Dom> - void operator/= (const _Expr<_Dom, _Tp>&) const; - template<class _Dom> - void operator%= (const _Expr<_Dom, _Tp>&) const; - template<class _Dom> - void operator+= (const _Expr<_Dom, _Tp>&) const; - template<class _Dom> - void operator-= (const _Expr<_Dom, _Tp>&) const; - template<class _Dom> - void operator^= (const _Expr<_Dom, _Tp>&) const; - template<class _Dom> - void operator&= (const _Expr<_Dom, _Tp>&) const; - template<class _Dom> - void operator|= (const _Expr<_Dom, _Tp>&) const; - template<class _Dom> - void operator<<= (const _Expr<_Dom, _Tp>&) const; - template<class _Dom> - void operator>>= (const _Expr<_Dom, _Tp>&) const; - -private: - indirect_array (const indirect_array&); - indirect_array (_Array<_Tp>, size_t, _Array<size_t>); - - friend class valarray<_Tp>; - friend class gslice_array<_Tp>; - - const size_t _M_sz; - const _Array<size_t> _M_index; - const _Array<_Tp> _M_array; - - // not implemented - indirect_array (); - indirect_array& operator= (const indirect_array&); -}; - -template<typename _Tp> -inline indirect_array<_Tp>::indirect_array(const indirect_array<_Tp>& __a) - : _M_sz (__a._M_sz), _M_index (__a._M_index), - _M_array (__a._M_array) {} - -template<typename _Tp> -inline -indirect_array<_Tp>::indirect_array (_Array<_Tp> __a, size_t __s, - _Array<size_t> __i) - : _M_sz (__s), _M_index (__i), _M_array (__a) {} - - -template<typename _Tp> -inline void -indirect_array<_Tp>::operator= (const _Tp& __t) -{ __valarray_fill(_M_array, _M_index, _M_sz, __t); } - -template<typename _Tp> -inline void -indirect_array<_Tp>::operator= (const valarray<_Tp>& __v) const -{ __valarray_copy (_Array<_Tp> (__v), _M_sz, _M_array, _M_index); } - -template<typename _Tp> -template<class _Dom> -inline void -indirect_array<_Tp>::operator= (const _Expr<_Dom,_Tp>& __e) const -{ __valarray_copy (__e, _M_sz, _M_array, _M_index); } - -#undef _DEFINE_VALARRAY_OPERATOR -#define _DEFINE_VALARRAY_OPERATOR(op, name) \ -template<typename _Tp> \ -inline void \ -indirect_array<_Tp>::operator##op##= (const valarray<_Tp>& __v) const \ -{ \ - _Array_augmented_##name (_M_array, _M_index, _Array<_Tp> (__v), _M_sz); \ -} \ - \ -template<typename _Tp> template<class _Dom> \ -inline void \ -indirect_array<_Tp>::operator##op##= (const _Expr<_Dom,_Tp>& __e) const \ -{ \ - _Array_augmented_##name (_M_array, _M_index, __e, _M_sz); \ -} - -_DEFINE_VALARRAY_OPERATOR(*, multiplies) -_DEFINE_VALARRAY_OPERATOR(/, divides) -_DEFINE_VALARRAY_OPERATOR(%, modulus) -_DEFINE_VALARRAY_OPERATOR(+, plus) -_DEFINE_VALARRAY_OPERATOR(-, minus) -_DEFINE_VALARRAY_OPERATOR(^, xor) -_DEFINE_VALARRAY_OPERATOR(&, and) -_DEFINE_VALARRAY_OPERATOR(|, or) -_DEFINE_VALARRAY_OPERATOR(<<, shift_left) -_DEFINE_VALARRAY_OPERATOR(>>, shift_right) - -#undef _DEFINE_VALARRAY_OPERATOR - -} // extern "C++" - -#endif // __INDIRECT_ARRAY__ - -// Local Variables: -// mode:c++ -// End: diff --git a/contrib/libstdc++/std/ldcomplex.h b/contrib/libstdc++/std/ldcomplex.h deleted file mode 100644 index bc91fa422bf7..000000000000 --- a/contrib/libstdc++/std/ldcomplex.h +++ /dev/null @@ -1,95 +0,0 @@ -// The -*- C++ -*- long_double_complex class. -// Copyright (C) 1994 Free Software Foundation - -// This file is part of the GNU ANSI 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -// As a special exception, if you link this library with files -// compiled with a GNU compiler to produce an executable, this does not 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. - -// Written by Jason Merrill based upon the specification in the 27 May 1994 -// C++ working paper, ANSI document X3J16/94-0098. - -#ifndef __LDCOMPLEX__ -#define __LDCOMPLEX__ - -#ifdef __GNUG__ -#pragma interface "ldcomplex" -#endif - -extern "C++" { -class complex<long double> -{ -public: - complex (long double r = 0, long double i = 0): re (r), im (i) { } - complex (const complex<float>& r): re (r.real ()), im (r.imag ()) { } - complex (const complex<double>& r): re (r.real ()), im (r.imag ()) { } - - complex& operator+= (const complex& r) { return __doapl (this, r); } - complex& operator-= (const complex& r) { return __doami (this, r); } - complex& operator*= (const complex& r) { return __doaml (this, r); } - complex& operator/= (const complex& r) { return __doadv (this, r); } - - long double real () const { return re; } - long double imag () const { return im; } -private: - long double re, im; - - friend complex& __doapl<> (complex *, const complex&); - friend complex& __doami<> (complex *, const complex&); - friend complex& __doaml<> (complex *, const complex&); - friend complex& __doadv<> (complex *, const complex&); - -#ifndef __STRICT_ANSI__ - friend inline complex operator + (const complex& x, long double y) - { return operator+<> (x, y); } - friend inline complex operator + (long double x, const complex& y) - { return operator+<> (x, y); } - friend inline complex operator - (const complex& x, long double y) - { return operator-<> (x, y); } - friend inline complex operator - (long double x, const complex& y) - { return operator-<> (x, y); } - friend inline complex operator * (const complex& x, long double y) - { return operator*<> (x, y); } - friend inline complex operator * (long double x, const complex& y) - { return operator*<> (x, y); } - friend inline complex operator / (const complex& x, long double y) - { return operator/<> (x, y); } - friend inline complex operator / (long double x, const complex& y) - { return operator/<> (x, y); } - friend inline bool operator == (const complex& x, long double y) - { return operator==<> (x, y); } - friend inline bool operator == (long double x, const complex& y) - { return operator==<> (x, y); } - friend inline bool operator != (const complex& x, long double y) - { return operator!=<> (x, y); } - friend inline bool operator != (long double x, const complex& y) - { return operator!=<> (x, y); } -#endif /* __STRICT_ANSI__ */ -}; - -inline complex<float>::complex (const complex<long double>& r) -: re (r.real ()), im (r.imag ()) -{ } - -inline complex<double>::complex (const complex<long double>& r) -: re (r.real ()), im (r.imag ()) -{ } -} // extern "C++" - -#endif diff --git a/contrib/libstdc++/std/mask_array.h b/contrib/libstdc++/std/mask_array.h deleted file mode 100644 index d431be4e97fd..000000000000 --- a/contrib/libstdc++/std/mask_array.h +++ /dev/null @@ -1,154 +0,0 @@ -// The template and inlines for the -*- C++ -*- mask_array class. - -// Copyright (C) 1997-1999 Cygnus Solutions -// -// 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -// 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. - -// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr> - -#ifndef __MASK_ARRAY__ -#define __MASK_ARRAY__ - -extern "C++" { - -template <class _T> class mask_array -{ -public: - typedef _T value_type; - - void operator= (const valarray<_T>&) const; - void operator*= (const valarray<_T>&) const; - void operator/= (const valarray<_T>&) const; - void operator%= (const valarray<_T>&) const; - void operator+= (const valarray<_T>&) const; - void operator-= (const valarray<_T>&) const; - void operator^= (const valarray<_T>&) const; - void operator&= (const valarray<_T>&) const; - void operator|= (const valarray<_T>&) const; - void operator<<=(const valarray<_T>&) const; - void operator>>=(const valarray<_T>&) const; - void operator= (const _T&); - - template<class _Dom> - void operator= (const _Expr<_Dom,_T>&) const; - template<class _Dom> - void operator*= (const _Expr<_Dom,_T>&) const; - template<class _Dom> - void operator/= (const _Expr<_Dom,_T>&) const; - template<class _Dom> - void operator%= (const _Expr<_Dom,_T>&) const; - template<class _Dom> - void operator+= (const _Expr<_Dom,_T>&) const; - template<class _Dom> - void operator-= (const _Expr<_Dom,_T>&) const; - template<class _Dom> - void operator^= (const _Expr<_Dom,_T>&) const; - template<class _Dom> - void operator&= (const _Expr<_Dom,_T>&) const; - template<class _Dom> - void operator|= (const _Expr<_Dom,_T>&) const; - template<class _Dom> - void operator<<=(const _Expr<_Dom,_T>&) const; - template<class _Dom> - void operator>>=(const _Expr<_Dom,_T>&) const; - -private: - mask_array (_Array<_T>, size_t, _Array<bool>); - friend class valarray<_T>; - - const size_t _M_sz; - const _Array<bool> _M_mask; - const _Array<_T> _M_array; - - mask_array (const mask_array&); - - // not implemented - mask_array (); - mask_array& operator= (const mask_array&); -}; - -template<typename _Tp> -inline mask_array<_Tp>::mask_array (const mask_array<_Tp>& a) - : _M_sz (a._M_sz), _M_mask (a._M_mask), _M_array (a._M_array) {} - -template<typename _T> -inline -mask_array<_T>::mask_array (_Array<_T> __a, size_t __s, _Array<bool> __m) - : _M_sz (__s), _M_mask (__m), _M_array (__a) {} - -template<typename _T> -inline void -mask_array<_T>::operator= (const _T& __t) -{ __valarray_fill (_M_array, _M_sz, _M_mask, __t); } - -template<typename _T> -inline void -mask_array<_T>::operator= (const valarray<_T>& __v) const -{ __valarray_copy (_Array<_T> (__v), __v.size (), _M_array, _M_mask); } - -template<typename _T> -template<class E> -inline void -mask_array<_T>::operator= (const _Expr<E, _T>& __e) const -{ __valarray_copy (__e, __e.size (), _M_array, _M_mask); } - -#undef _DEFINE_VALARRAY_OPERATOR -#define _DEFINE_VALARRAY_OPERATOR(op, name) \ -template<typename _T> \ -inline void \ -mask_array<_T>::operator##op##= (const valarray<_T>& __v) const \ -{ \ - _Array_augmented_##name (_M_array, _M_mask, \ - _Array<_T> (__v), __v.size ()); \ -} \ - \ -template<typename _T> template<class E> \ -inline void \ -mask_array<_T>::operator##op##= (const _Expr<E, _T>& __e) const \ -{ \ - _Array_augmented_##name (_M_array, _M_mask, __e, __e.size ()); \ -} - -_DEFINE_VALARRAY_OPERATOR(*, multiplies) -_DEFINE_VALARRAY_OPERATOR(/, divides) -_DEFINE_VALARRAY_OPERATOR(%, modulus) -_DEFINE_VALARRAY_OPERATOR(+, plus) -_DEFINE_VALARRAY_OPERATOR(-, minus) -_DEFINE_VALARRAY_OPERATOR(^, xor) -_DEFINE_VALARRAY_OPERATOR(&, and) -_DEFINE_VALARRAY_OPERATOR(|, or) -_DEFINE_VALARRAY_OPERATOR(<<, shift_left) -_DEFINE_VALARRAY_OPERATOR(>>, shift_right) - -#undef _DEFINE_VALARRAY_OPERATOR - -} // extern "C++" - -#endif // __MASK_ARRAY__ - -// Local Variables: -// mode:c++ -// End: diff --git a/contrib/libstdc++/std/slice.h b/contrib/libstdc++/std/slice.h deleted file mode 100644 index cf2fb283de95..000000000000 --- a/contrib/libstdc++/std/slice.h +++ /dev/null @@ -1,76 +0,0 @@ -// The template and inlines for the -*- C++ -*- slice class. - -// Copyright (C) 1997-1999 Cygnus Solutions -// -// 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -// 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. - -// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr> - -#ifndef __SLICE__ -#define __SLICE__ - -extern "C++" { - -class slice -{ -public: - slice (); - slice (size_t, size_t, size_t); - - size_t start () const; - size_t size () const; - size_t stride () const; - -private: - size_t _M_off; // offset - size_t _M_sz; // size - size_t _M_st; // stride unit -}; - -inline slice::slice () {} - -inline slice::slice (size_t __o, size_t __d, size_t __s) - : _M_off (__o), _M_sz (__d), _M_st (__s) {} - -inline size_t -slice::start () const - { return _M_off; } - -inline size_t -slice::size () const - { return _M_sz; } - -inline size_t -slice::stride () const - { return _M_st; } - -} // extern "C++" - -#endif // __SLICE__ - -// Local Variables: -// mode:c++ -// End: diff --git a/contrib/libstdc++/std/slice_array.h b/contrib/libstdc++/std/slice_array.h deleted file mode 100644 index dc1aa34d3556..000000000000 --- a/contrib/libstdc++/std/slice_array.h +++ /dev/null @@ -1,156 +0,0 @@ -// The template and inlines for the -*- C++ -*- slice_array class. - -// Copyright (C) 1997-1999 Cygnus Solutions -// -// 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -// 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. - -// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr> - -#ifndef __SLICE_ARRAY__ -#define __SLICE_ARRAY__ - -extern "C++" { - -template<typename _T> -class slice_array -{ -public: - typedef _T value_type; - - void operator= (const valarray<_T>&) const; - void operator*= (const valarray<_T>&) const; - void operator/= (const valarray<_T>&) const; - void operator%= (const valarray<_T>&) const; - void operator+= (const valarray<_T>&) const; - void operator-= (const valarray<_T>&) const; - void operator^= (const valarray<_T>&) const; - void operator&= (const valarray<_T>&) const; - void operator|= (const valarray<_T>&) const; - void operator<<= (const valarray<_T>&) const; - void operator>>= (const valarray<_T>&) const; - void operator= (const _T &); - - template<class _Dom> - void operator= (const _Expr<_Dom,_T>&) const; - template<class _Dom> - void operator*= (const _Expr<_Dom,_T>&) const; - template<class _Dom> - void operator/= (const _Expr<_Dom,_T>&) const; - template<class _Dom> - void operator%= (const _Expr<_Dom,_T>&) const; - template<class _Dom> - void operator+= (const _Expr<_Dom,_T>&) const; - template<class _Dom> - void operator-= (const _Expr<_Dom,_T>&) const; - template<class _Dom> - void operator^= (const _Expr<_Dom,_T>&) const; - template<class _Dom> - void operator&= (const _Expr<_Dom,_T>&) const; - template<class _Dom> - void operator|= (const _Expr<_Dom,_T>&) const; - template<class _Dom> - void operator<<= (const _Expr<_Dom,_T>&) const; - template<class _Dom> - void operator>>= (const _Expr<_Dom,_T>&) const; - -private: - friend class valarray<_T>; - slice_array(_Array<_T>, const slice&); - - const size_t _M_sz; - const size_t _M_stride; - const _Array<_T> _M_array; - - // this constructor is implemented since we need to return a value. - slice_array (const slice_array&); - - // not implemented - slice_array (); - slice_array& operator= (const slice_array&); -}; - -template<typename _T> -inline slice_array<_T>::slice_array (_Array<_T> __a, const slice& __s) - : _M_sz (__s.size ()), _M_stride (__s.stride ()), - _M_array (__a.begin () + __s.start ()) {} - -template<typename _Tp> -inline slice_array<_Tp>::slice_array(const slice_array<_Tp>& a) - : _M_sz(a._M_sz), _M_stride(a._M_stride), _M_array(a._M_array) {} - -template<typename _T> -inline void -slice_array<_T>::operator= (const _T& __t) -{ __valarray_fill (_M_array, _M_sz, _M_stride, __t); } - -template<typename _T> -inline void -slice_array<_T>::operator= (const valarray<_T>& __v) const -{ __valarray_copy (_Array<_T> (__v), _M_array, _M_sz, _M_stride); } - -template<typename _T> -template<class _Dom> -inline void -slice_array<_T>::operator= (const _Expr<_Dom,_T>& __e) const -{ __valarray_copy (__e, _M_sz, _M_array, _M_stride); } - -#undef _DEFINE_VALARRAY_OPERATOR -#define _DEFINE_VALARRAY_OPERATOR(op, name) \ -template<typename _T> \ -inline void \ -slice_array<_T>::operator##op##= (const valarray<_T>& __v) const \ -{ \ - _Array_augmented_##name (_M_array, _M_sz, _M_stride, _Array<_T> (__v));\ -} \ - \ -template<typename _T> template<class _Dom> \ -inline void \ -slice_array<_T>::operator##op##= (const _Expr<_Dom,_T>& __e) const \ -{ \ - _Array_augmented_##name (_M_array, _M_stride, __e, _M_sz); \ -} - - -_DEFINE_VALARRAY_OPERATOR(*, multiplies) -_DEFINE_VALARRAY_OPERATOR(/, divides) -_DEFINE_VALARRAY_OPERATOR(%, modulus) -_DEFINE_VALARRAY_OPERATOR(+, plus) -_DEFINE_VALARRAY_OPERATOR(-, minus) -_DEFINE_VALARRAY_OPERATOR(^, xor) -_DEFINE_VALARRAY_OPERATOR(&, and) -_DEFINE_VALARRAY_OPERATOR(|, or) -_DEFINE_VALARRAY_OPERATOR(<<, shift_left) -_DEFINE_VALARRAY_OPERATOR(>>, shift_right) - -#undef _DEFINE_VALARRAY_OPERATOR - -} // extern "C++" - -#endif // __SLICE_ARRAY__ - -// Local Variables: -// mode:c++ -// End: diff --git a/contrib/libstdc++/std/std_valarray.h b/contrib/libstdc++/std/std_valarray.h deleted file mode 100644 index b3006555547d..000000000000 --- a/contrib/libstdc++/std/std_valarray.h +++ /dev/null @@ -1,728 +0,0 @@ -// The template and inlines for the -*- C++ -*- valarray class. - -// Copyright (C) 1997-1999 Cygnus Solutions -// -// 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -// 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. - -// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr> - -#ifndef __STD_VALARRAY__ -#define __STD_VALARRAY__ -#define _G_NO_VALARRAY_TEMPLATE_EXPORT 1 - -#include <cstddef> -#include <cmath> -#include <cstdlib> -#include <numeric> -#include <functional> -#include <algorithm> - -#ifndef alloca -#ifdef __GNUC__ -#define alloca __builtin_alloca -#else /* not GNU C. */ -#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) -#include <alloca.h> -#else /* not sparc */ -#if defined (MSDOS) && !defined (__TURBOC__) -#include <malloc.h> -#else /* not MSDOS, or __TURBOC__ */ -#if defined(_AIX) -#include <malloc.h> - #pragma alloca -#else /* not MSDOS, __TURBOC__, or _AIX */ -#ifdef __hpux -#endif /* __hpux */ -#endif /* not _AIX */ -#endif /* not MSDOS, or __TURBOC__ */ -#endif /* not sparc. */ -#endif /* not GNU C. */ -#endif /* alloca not defined. */ - -extern "C" { - void* alloca(size_t); -} - - -extern "C++" { - -template<class _Clos, typename _Tp> class _Expr; - -template<typename _Tp1, typename _Tp2> class _ValArray; - -template<template<class> class _Oper, - template<class, class> class _Meta, class _Dom> struct _UnClos; - -template<template<class> class _Oper, - template<class, class> class _Meta1, - template<class, class> class _Meta2, - class _Dom1, class _Dom2> class _BinClos; - -template<template<class, class> class _Meta, class _Dom> class _SClos; - -template<template<class, class> class _Meta, class _Dom> class _GClos; - -template<template<class, class> class _Meta, class _Dom> class _IClos; - -template<template<class, class> class _Meta, class _Dom> class _ValFunClos; - -template<template<class, class> class _Meta, class _Dom> class _RefFunClos; - -template<class _Tp> struct _Unary_plus; -template<class _Tp> struct _Bitwise_and; -template<class _Tp> struct _Bitwise_or; -template<class _Tp> struct _Bitwise_xor; -template<class _Tp> struct _Bitwise_not; -template<class _Tp> struct _Shift_left; -template<class _Tp> struct _Shift_right; - -template<class _Tp> class valarray; // An array of type _Tp -class slice; // BLAS-like slice out of an array -template<class _Tp> class slice_array; -class gslice; // generalized slice out of an array -template<class _Tp> class gslice_array; -template<class _Tp> class mask_array; // masked array -template<class _Tp> class indirect_array; // indirected array - -} // extern "C++" - -#include <std/valarray_array.h> -#include <std/valarray_meta.h> - -extern "C++" { - -template<class _Tp> class valarray -{ -public: - typedef _Tp value_type; - - // _lib.valarray.cons_ construct/destroy: - valarray(); - explicit valarray(size_t); - valarray(const _Tp&, size_t); - valarray(const _Tp* __restrict__, size_t); - valarray(const valarray&); - valarray(const slice_array<_Tp>&); - valarray(const gslice_array<_Tp>&); - valarray(const mask_array<_Tp>&); - valarray(const indirect_array<_Tp>&); - template<class _Dom> - valarray(const _Expr<_Dom,_Tp>& __e); - ~valarray(); - - // _lib.valarray.assign_ assignment: - valarray<_Tp>& operator=(const valarray<_Tp>&); - valarray<_Tp>& operator=(const _Tp&); - valarray<_Tp>& operator=(const slice_array<_Tp>&); - valarray<_Tp>& operator=(const gslice_array<_Tp>&); - valarray<_Tp>& operator=(const mask_array<_Tp>&); - valarray<_Tp>& operator=(const indirect_array<_Tp>&); - - template<class _Dom> valarray<_Tp>& - operator= (const _Expr<_Dom,_Tp>&); - - // _lib.valarray.access_ element access: - _Tp operator[](size_t) const; - _Tp& operator[](size_t); - // _lib.valarray.sub_ subset operations: - _Expr<_SClos<_ValArray,_Tp>, _Tp> operator[](slice) const; - slice_array<_Tp> operator[](slice); - _Expr<_GClos<_ValArray,_Tp>, _Tp> operator[](const gslice&) const; - gslice_array<_Tp> operator[](const gslice&); - valarray<_Tp> operator[](const valarray<bool>&) const; - mask_array<_Tp> operator[](const valarray<bool>&); - _Expr<_IClos<_ValArray, _Tp>, _Tp> - operator[](const valarray<size_t>&) const; - indirect_array<_Tp> operator[](const valarray<size_t>&); - - // _lib.valarray.unary_ unary operators: - _Expr<_UnClos<_Unary_plus,_ValArray,_Tp>,_Tp> operator+ () const; - _Expr<_UnClos<negate,_ValArray,_Tp>,_Tp> operator- () const; - _Expr<_UnClos<_Bitwise_not,_ValArray,_Tp>,_Tp> operator~ () const; - _Expr<_UnClos<logical_not,_ValArray,_Tp>,bool> operator! () const; - - // _lib.valarray.cassign_ computed assignment: - valarray<_Tp>& operator*= (const _Tp&); - valarray<_Tp>& operator/= (const _Tp&); - valarray<_Tp>& operator%= (const _Tp&); - valarray<_Tp>& operator+= (const _Tp&); - valarray<_Tp>& operator-= (const _Tp&); - valarray<_Tp>& operator^= (const _Tp&); - valarray<_Tp>& operator&= (const _Tp&); - valarray<_Tp>& operator|= (const _Tp&); - valarray<_Tp>& operator<<=(const _Tp&); - valarray<_Tp>& operator>>=(const _Tp&); - valarray<_Tp>& operator*= (const valarray<_Tp>&); - valarray<_Tp>& operator/= (const valarray<_Tp>&); - valarray<_Tp>& operator%= (const valarray<_Tp>&); - valarray<_Tp>& operator+= (const valarray<_Tp>&); - valarray<_Tp>& operator-= (const valarray<_Tp>&); - valarray<_Tp>& operator^= (const valarray<_Tp>&); - valarray<_Tp>& operator|= (const valarray<_Tp>&); - valarray<_Tp>& operator&= (const valarray<_Tp>&); - valarray<_Tp>& operator<<=(const valarray<_Tp>&); - valarray<_Tp>& operator>>=(const valarray<_Tp>&); - - template<class _Dom> - valarray<_Tp>& operator*= (const _Expr<_Dom,_Tp>&); - template<class _Dom> - valarray<_Tp>& operator/= (const _Expr<_Dom,_Tp>&); - template<class _Dom> - valarray<_Tp>& operator%= (const _Expr<_Dom,_Tp>&); - template<class _Dom> - valarray<_Tp>& operator+= (const _Expr<_Dom,_Tp>&); - template<class _Dom> - valarray<_Tp>& operator-= (const _Expr<_Dom,_Tp>&); - template<class _Dom> - valarray<_Tp>& operator^= (const _Expr<_Dom,_Tp>&); - template<class _Dom> - valarray<_Tp>& operator|= (const _Expr<_Dom,_Tp>&); - template<class _Dom> - valarray<_Tp>& operator&= (const _Expr<_Dom,_Tp>&); - template<class _Dom> - valarray<_Tp>& operator<<=(const _Expr<_Dom,_Tp>&); - template<class _Dom> - valarray<_Tp>& operator>>=(const _Expr<_Dom,_Tp>&); - - - // _lib.valarray.members_ member functions: - size_t size() const; - _Tp sum() const; - _Tp min() const; - _Tp max() const; - - // FIXME: Extension - _Tp product () const; - - valarray<_Tp> shift (int) const; - valarray<_Tp> cshift(int) const; - _Expr<_ValFunClos<_ValArray,_Tp>,_Tp> apply(_Tp func(_Tp)) const; - _Expr<_RefFunClos<_ValArray,_Tp>,_Tp> apply(_Tp func(const _Tp&)) const; - void resize(size_t __size, _Tp __c = _Tp()); - -private: - size_t _M_size; - _Tp* __restrict__ _M_data; - - friend class _Array<_Tp>; -}; - - -template<typename _Tp> struct _Unary_plus : unary_function<_Tp,_Tp> { - _Tp operator() (const _Tp& __t) const { return __t; } -}; - -template<typename _Tp> struct _Bitwise_and : binary_function<_Tp,_Tp,_Tp> { - _Tp operator() (_Tp __x, _Tp __y) const { return __x & __y; } -}; - -template<typename _Tp> struct _Bitwise_or : binary_function<_Tp,_Tp,_Tp> { - _Tp operator() (_Tp __x, _Tp __y) const { return __x | __y; } -}; - -template<typename _Tp> struct _Bitwise_xor : binary_function<_Tp,_Tp,_Tp> { - _Tp operator() (_Tp __x, _Tp __y) const { return __x ^ __y; } -}; - -template<typename _Tp> struct _Bitwise_not : unary_function<_Tp,_Tp> { - _Tp operator() (_Tp __t) const { return ~__t; } -}; - -template<typename _Tp> struct _Shift_left : unary_function<_Tp,_Tp> { - _Tp operator() (_Tp __x, _Tp __y) const { return __x << __y; } -}; - -template<typename _Tp> struct _Shift_right : unary_function<_Tp,_Tp> { - _Tp operator() (_Tp __x, _Tp __y) const { return __x >> __y; } -}; - - -template<typename _Tp> -inline _Tp -valarray<_Tp>::operator[] (size_t __i) const -{ return _M_data[__i]; } - -template<typename _Tp> -inline _Tp& -valarray<_Tp>::operator[] (size_t __i) -{ return _M_data[__i]; } - -} // extern "C++" - -#include <std/slice.h> -#include <std/slice_array.h> -#include <std/gslice.h> -#include <std/gslice_array.h> -#include <std/mask_array.h> -#include <std/indirect_array.h> - -extern "C++" { - -template<typename _Tp> -inline valarray<_Tp>::valarray () : _M_size (0), _M_data (0) {} - -template<typename _Tp> -inline valarray<_Tp>::valarray (size_t __n) - : _M_size (__n), _M_data (new _Tp[__n]) {} - -template<typename _Tp> -inline valarray<_Tp>::valarray (const _Tp& __t, size_t __n) - : _M_size (__n), _M_data (new _Tp[__n]) -{ __valarray_fill (_M_data, _M_size, __t); } - -template<typename _Tp> -inline valarray<_Tp>::valarray (const _Tp* __restrict__ __pT, size_t __n) - : _M_size (__n), _M_data (new _Tp[__n]) -{ __valarray_copy (__pT, __n, _M_data); } - -template<typename _Tp> -inline valarray<_Tp>::valarray (const valarray<_Tp>& __v) - : _M_size (__v._M_size), _M_data (new _Tp[__v._M_size]) -{ __valarray_copy (__v._M_data, _M_size, _M_data); } - -template<typename _Tp> -inline valarray<_Tp>::valarray (const slice_array<_Tp>& __sa) - : _M_size (__sa._M_sz), _M_data (new _Tp[__sa._M_sz]) -{ __valarray_copy (__sa._M_array, __sa._M_sz, __sa._M_stride, - _Array<_Tp>(_M_data)); } - -template<typename _Tp> -inline valarray<_Tp>::valarray (const gslice_array<_Tp>& __ga) - : _M_size (__ga._M_index.size()), _M_data (new _Tp[_M_size]) -{ __valarray_copy (__ga._M_array, _Array<size_t>(__ga._M_index), - _Array<_Tp>(_M_data), _M_size); } - -template<typename _Tp> -inline valarray<_Tp>::valarray (const mask_array<_Tp>& __ma) - : _M_size (__ma._M_sz), _M_data (new _Tp[__ma._M_sz]) -{ __valarray_copy (__ma._M_array, __ma._M_mask, - _Array<_Tp>(_M_data), _M_size); } - -template<typename _Tp> -inline valarray<_Tp>::valarray (const indirect_array<_Tp>& __ia) - : _M_size (__ia._M_sz), _M_data (new _Tp[__ia._M_sz]) -{ __valarray_copy (__ia._M_array, __ia._M_index, - _Array<_Tp>(_M_data), _M_size); } - -template<typename _Tp> template<class _Dom> -inline valarray<_Tp>::valarray (const _Expr<_Dom, _Tp>& __e) - : _M_size (__e.size ()), _M_data (new _Tp[_M_size]) -{ __valarray_copy (__e, _M_size, _Array<_Tp>(_M_data)); } - -template<typename _Tp> -inline valarray<_Tp>::~valarray () { delete[] _M_data; } - -template<typename _Tp> -inline valarray<_Tp>& -valarray<_Tp>::operator= (const valarray<_Tp>& __v) -{ - __valarray_copy(__v._M_data, _M_size, _M_data); - return *this; -} - -template<typename _Tp> -inline valarray<_Tp>& -valarray<_Tp>::operator= (const _Tp& __t) -{ - __valarray_fill (_M_data, _M_size, __t); - return *this; -} - -template<typename _Tp> -inline valarray<_Tp>& -valarray<_Tp>::operator= (const slice_array<_Tp>& __sa) -{ - __valarray_copy (__sa._M_array, __sa._M_sz, - __sa._M_stride, _Array<_Tp>(_M_data)); - return *this; -} - -template<typename _Tp> -inline valarray<_Tp>& -valarray<_Tp>::operator= (const gslice_array<_Tp>& __ga) -{ - __valarray_copy (__ga._M_array, _Array<size_t>(__ga._M_index), - _Array<_Tp>(_M_data), _M_size); - return *this; -} - -template<typename _Tp> -inline valarray<_Tp>& -valarray<_Tp>::operator= (const mask_array<_Tp>& __ma) -{ - __valarray_copy (__ma._M_array, __ma._M_mask, - _Array<_Tp>(_M_data), _M_size); - return *this; -} - -template<typename _Tp> -inline valarray<_Tp>& -valarray<_Tp>::operator= (const indirect_array<_Tp>& __ia) -{ - __valarray_copy (__ia._M_array, __ia._M_index, - _Array<_Tp>(_M_data), _M_size); - return *this; -} - -template<typename _Tp> template<class _Dom> -inline valarray<_Tp>& -valarray<_Tp>::operator= (const _Expr<_Dom, _Tp>& __e) -{ - __valarray_copy (__e, _M_size, _Array<_Tp>(_M_data)); - return *this; -} - -template<typename _Tp> -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<typename _Tp> -inline slice_array<_Tp> -valarray<_Tp>::operator[] (slice __s) -{ - return slice_array<_Tp> (_Array<_Tp>(_M_data), __s); -} - -template<typename _Tp> -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<typename _Tp> -inline gslice_array<_Tp> -valarray<_Tp>::operator[] (const gslice& __gs) -{ - return gslice_array<_Tp> - (_Array<_Tp>(_M_data), __gs._M_index->_M_index); -} - -template<typename _Tp> -inline valarray<_Tp> -valarray<_Tp>::operator[] (const valarray<bool>& __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<bool> (__m))); -} - -template<typename _Tp> -inline mask_array<_Tp> -valarray<_Tp>::operator[] (const valarray<bool>& __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<bool> (__m)); -} - -template<typename _Tp> -inline _Expr<_IClos<_ValArray,_Tp>, _Tp> -valarray<_Tp>::operator[] (const valarray<size_t>& __i) const -{ - typedef _IClos<_ValArray,_Tp> _Closure; - return _Expr<_Closure, _Tp> (_Closure (*this, __i)); -} - -template<typename _Tp> -inline indirect_array<_Tp> -valarray<_Tp>::operator[] (const valarray<size_t>& __i) -{ - return indirect_array<_Tp> (_Array<_Tp>(_M_data), __i.size(), - _Array<size_t> (__i)); -} - -template<class _Tp> -inline size_t valarray<_Tp>::size () const { return _M_size; } - -template<class _Tp> -inline _Tp -valarray<_Tp>::sum () const -{ - return accumulate (_M_data, _M_data + _M_size, _Tp ()); -} - -template<typename _Tp> -inline _Tp -valarray<_Tp>::product () const -{ - return accumulate (_M_data, _M_data+_M_size, _Tp(1), multiplies<_Tp> ()); -} - -template <class _Tp> -inline valarray<_Tp> -valarray<_Tp>::shift (int __n) const -{ - _Tp* const __a = static_cast<_Tp*> (alloca (sizeof(_Tp) * _M_size)); - if (! __n) // __n == 0: no shift - __valarray_copy (_M_data, _M_size, __a); - else if (__n > 0) { // __n > 0: shift left - if (__n > _M_size) - __valarray_fill(__a, __n, _Tp()); - else { - __valarray_copy (_M_data+__n, _M_size-__n, __a); - __valarray_fill (__a+_M_size-__n, __n, _Tp()); - } - } - else { // __n < 0: shift right - __valarray_copy (_M_data, _M_size+__n, __a-__n); - __valarray_fill(__a, -__n, _Tp()); - } - return valarray<_Tp> (__a, _M_size); -} - -template <class _Tp> -inline valarray<_Tp> -valarray<_Tp>::cshift (int __n) const -{ - _Tp* const __a = static_cast<_Tp*> (alloca (sizeof(_Tp) * _M_size)); - if (! __n) // __n == 0: no cshift - __valarray_copy(_M_data, _M_size, __a); - else if (__n > 0) { // __n > 0: cshift left - __valarray_copy (_M_data, __n, __a + _M_size-__n); - __valarray_copy (_M_data + __n, _M_size-__n, __a); - } - else { // __n < 0: cshift right - __valarray_copy (_M_data + _M_size + __n, -__n, __a); - __valarray_copy (_M_data, _M_size + __n, __a - __n); - } - return valarray<_Tp> (__a, _M_size); -} - -template <class _Tp> -inline void -valarray<_Tp>::resize (size_t __n, _Tp __c) -{ - if (_M_size != __n) { - delete[] _M_data; - _M_size = __n; - _M_data = new _Tp[_M_size]; - } - __valarray_fill (_M_data, _M_size, __c); -} - -template<typename _Tp> -inline _Tp -valarray<_Tp>::min() const -{ - return *min_element (_M_data, _M_data+_M_size); -} - -template<typename _Tp> -inline _Tp -valarray<_Tp>::max() const -{ - return *max_element (_M_data, _M_data+_M_size); -} - -template<class _Tp> -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<class _Tp> -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<typename _Tp> \ - inline _Expr<_UnClos<_Name,_ValArray,_Tp>, _Tp> \ - valarray<_Tp>::operator##_Op() const \ - { \ - typedef _UnClos<_Name,_ValArray,_Tp> _Closure; \ - return _Expr<_Closure, _Tp> (_Closure (*this)); \ - } - - _DEFINE_VALARRAY_UNARY_OPERATOR(+, _Unary_plus) - _DEFINE_VALARRAY_UNARY_OPERATOR(-, negate) - _DEFINE_VALARRAY_UNARY_OPERATOR(~, _Bitwise_not) - -#undef _DEFINE_VALARRAY_UNARY_OPERATOR - - template<typename _Tp> - inline _Expr<_UnClos<logical_not,_ValArray,_Tp>, bool> - valarray<_Tp>::operator!() const - { - typedef _UnClos<logical_not,_ValArray,_Tp> _Closure; - return _Expr<_Closure, bool> (_Closure (*this)); - } - -#define _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(_Op, _Name) \ - template<class _Tp> \ - inline valarray<_Tp> & \ - valarray<_Tp>::operator##_Op##= (const _Tp &__t) \ - { \ - _Array_augmented_##_Name (_Array<_Tp>(_M_data), _M_size, __t); \ - return *this; \ - } \ - \ - template<class _Tp> \ - inline valarray<_Tp> & \ - valarray<_Tp>::operator##_Op##= (const valarray<_Tp> &__v) \ - { \ - _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(^, xor) -_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(&, and) -_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(|, 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<class _Tp> template<class _Dom> \ - 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(^, xor) -_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(&, and) -_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(|, 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<typename _Tp> \ - inline _Expr<_BinClos<_Name,_ValArray,_ValArray,_Tp,_Tp>, _Tp> \ - operator##_Op (const valarray<_Tp> &__v, const valarray<_Tp> &__w) \ - { \ - typedef _BinClos<_Name,_ValArray,_ValArray,_Tp,_Tp> _Closure; \ - return _Expr<_Closure, _Tp> (_Closure (__v, __w)); \ - } \ - \ - template<typename _Tp> \ - inline _Expr<_BinClos<_Name,_ValArray,_Constant,_Tp,_Tp>,_Tp> \ - operator##_Op (const valarray<_Tp> &__v, const _Tp &__t) \ - { \ - typedef _BinClos<_Name,_ValArray,_Constant,_Tp,_Tp> _Closure; \ - return _Expr<_Closure, _Tp> (_Closure (__v, __t)); \ - } \ - \ - template<typename _Tp> \ - inline _Expr<_BinClos<_Name,_Constant,_ValArray,_Tp,_Tp>,_Tp> \ - operator##_Op (const _Tp &__t, const valarray<_Tp> &__v) \ - { \ - typedef _BinClos<_Name,_Constant,_ValArray,_Tp,_Tp> _Closure; \ - 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) - -#undef _DEFINE_BINARY_OPERATOR - -#define _DEFINE_LOGICAL_OPERATOR(_Op, _Name) \ - template<typename _Tp> \ - inline _Expr<_BinClos<_Name,_ValArray,_ValArray,_Tp,_Tp>,bool> \ - operator##_Op (const valarray<_Tp> &__v, const valarray<_Tp> &__w) \ - { \ - typedef _BinClos<_Name,_ValArray,_ValArray,_Tp,_Tp> _Closure; \ - return _Expr<_Closure, bool> (_Closure (__v, __w)); \ - } \ - \ - template<class _Tp> \ - inline _Expr<_BinClos<_Name,_ValArray,_Constant,_Tp,_Tp>,bool> \ - operator##_Op (const valarray<_Tp> &__v, const _Tp &__t) \ - { \ - typedef _BinClos<_Name,_ValArray,_Constant,_Tp,_Tp> _Closure; \ - return _Expr<_Closure, bool> (_Closure (__v, __t)); \ - } \ - \ - template<class _Tp> \ - inline _Expr<_BinClos<_Name,_Constant,_ValArray,_Tp,_Tp>,bool> \ - operator##_Op (const _Tp &__t, const valarray<_Tp> &__v) \ - { \ - typedef _BinClos<_Name,_Constant,_ValArray,_Tp,_Tp> _Closure; \ - return _Expr<_Closure, bool> (_Closure (__t, __v)); \ - } - -_DEFINE_LOGICAL_OPERATOR(&&, logical_and) -_DEFINE_LOGICAL_OPERATOR(||, logical_or) -_DEFINE_LOGICAL_OPERATOR(==, equal_to) -_DEFINE_LOGICAL_OPERATOR(!=, not_equal_to) -_DEFINE_LOGICAL_OPERATOR(<, less) -_DEFINE_LOGICAL_OPERATOR(>, greater) -_DEFINE_LOGICAL_OPERATOR(<=, less_equal) -_DEFINE_LOGICAL_OPERATOR(>=, greater_equal) - -#undef _DEFINE_VALARRAY_OPERATOR - -#undef _G_NO_VALARRAY_TEMPLATE_EXPORT - -} // extern "C++" - -#endif // __STD_VALARRAY__ - -// Local Variables: -// mode:c++ -// End: diff --git a/contrib/libstdc++/std/straits.h b/contrib/libstdc++/std/straits.h deleted file mode 100644 index c80e7ab7a681..000000000000 --- a/contrib/libstdc++/std/straits.h +++ /dev/null @@ -1,161 +0,0 @@ -// Character traits template for the -*- C++ -*- string classes. -// Copyright (C) 1994 Free Software Foundation - -// This file is part of the GNU ANSI 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -// As a special exception, if you link this library with files -// compiled with a GNU compiler to produce an executable, this does not 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. - -// Written by Jason Merrill based upon the specification by Takanori Adachi -// in ANSI X3J16/94-0013R2. - -#ifndef __STRING_CHAR_TRAITS__ -#define __STRING_CHAR_TRAITS__ - -#ifdef __GNUG__ -// For string_char_traits <char> -#pragma interface "std/straits.h" -#endif - -#include <cstddef> - -extern "C++" { -template <class charT> -struct string_char_traits { - typedef charT char_type; // for users to acquire the basic character type - - // constraints - - static void assign (char_type& c1, const char_type& c2) - { c1 = c2; } - static bool eq (const char_type& c1, const char_type& c2) - { return (c1 == c2); } - static bool ne (const char_type& c1, const char_type& c2) - { return !(c1 == c2); } - static bool lt (const char_type& c1, const char_type& c2) - { return (c1 < c2); } - static char_type eos () { return char_type(); } // the null character - static bool is_del(char_type a) { return 0; } - // characteristic function for delimiters of charT - - // speed-up functions - - static int compare (const char_type* s1, const char_type* s2, size_t n) - { - size_t i; - for (i = 0; i < n; ++i) - if (ne (s1[i], s2[i])) - return lt (s1[i], s2[i]) ? -1 : 1; - - return 0; - } - - static size_t length (const char_type* s) - { - size_t l = 0; - while (ne (*s++, eos ())) - ++l; - return l; - } - - static char_type* copy (char_type* s1, const char_type* s2, size_t n) - { - for (; n--; ) - assign (s1[n], s2[n]); - return s1; - } - - static char_type* move (char_type* s1, const char_type* s2, size_t n) - { - char_type a[n]; - size_t i; - for (i = 0; i < n; ++i) - assign (a[i], s2[i]); - for (i = 0; i < n; ++i) - assign (s1[i], a[i]); - return s1; - } - - static char_type* set (char_type* s1, const char_type& c, size_t n) - { - for (; n--; ) - assign (s1[n], c); - return s1; - } -}; - -class istream; -class ostream; -#include <cctype> -#include <cstring> - -struct string_char_traits <char> { - typedef char char_type; - - static void assign (char_type& c1, const char_type& c2) - { c1 = c2; } - static bool eq (const char_type & c1, const char_type& c2) - { return (c1 == c2); } - static bool ne (const char_type& c1, const char_type& c2) - { return (c1 != c2); } - static bool lt (const char_type& c1, const char_type& c2) - { return (c1 < c2); } - static char_type eos () { return 0; } - static bool is_del(char_type a) { return isspace(a); } - - static int compare (const char_type* s1, const char_type* s2, size_t n) - { return memcmp (s1, s2, n); } - static size_t length (const char_type* s) - { return strlen (s); } - static char_type* copy (char_type* s1, const char_type* s2, size_t n) - { return (char_type*) memcpy (s1, s2, n); } - static char_type* move (char_type* s1, const char_type* s2, size_t n) - { return (char_type*) memmove (s1, s2, n); } - static char_type* set (char_type* s1, const char_type& c, size_t n) - { return (char_type*) memset (s1, c, n); } -}; - -#if 0 -#include <cwctype> -struct string_char_traits <wchar_t> { - typedef wchar_t char_type; - - static void assign (char_type& c1, const char_type& c2) - { c1 = c2; } - static bool eq (const char_type & c1, const char_type& c2) - { return (c1 == c2); } - static bool ne (const char_type& c1, const char_type& c2) - { return (c1 != c2); } - static bool lt (const char_type& c1, const char_type& c2) - { return (c1 < c2); } - static char_type eos () { return 0; } - static bool is_del(char_type a) { return iswspace(a); } - - static int compare (const char_type* s1, const char_type* s2, size_t n) - { return wmemcmp (s1, s2, n); } - static size_t length (const char_type* s) - { return wcslen (s); } - static char_type* copy (char_type* s1, const char_type* s2, size_t n) - { return wmemcpy (s1, s2, n); } - static char_type* set (char_type* s1, const char_type& c, size_t n) - { return wmemset (s1, c, n); } -}; -#endif -} // extern "C++" -#endif diff --git a/contrib/libstdc++/std/valarray_array.tcc b/contrib/libstdc++/std/valarray_array.tcc deleted file mode 100644 index bd6692571fdd..000000000000 --- a/contrib/libstdc++/std/valarray_array.tcc +++ /dev/null @@ -1,130 +0,0 @@ -// The template and inlines for the -*- C++ -*- internal _Array helper class. - -// Copyright (C) 1997-1999 Cygnus Solutions -// -// 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -// 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. - -// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr> - -#ifndef __VALARRAY_ARRAY_TCC__ -#define __VALARRAY_ARRAY_TCC__ - -extern "C++" { - -export template<typename _Tp> -void -__valarray_fill (_Array<_Tp> __a, size_t __n, _Array<bool> __m, const _Tp& __t) -{ - _Tp* __p = __a._M_data; - bool* __ok (__m._M_data); - for (size_t __i=0; __i<__n; ++__i, ++__ok, ++__p) { - while (! *__ok) { - ++__ok; - ++__p; - } - *__p = __t; - } -} - -export template<typename _Tp> -void -__valarray_copy (_Array<_Tp> __a, _Array<bool> __m, _Array<_Tp> __b, size_t __n) -{ - _Tp* __p (__a._M_data); - bool* __ok (__m._M_data); - for (_Tp* __q=__b._M_data; __q<__b._M_data+__n; ++__q, ++__ok, ++__p) { - while (! *__ok) { - ++__ok; - ++__p; - } - *__q = *__p; - } -} - -export template<typename _Tp> -void -__valarray_copy (_Array<_Tp> __a, size_t __n, _Array<_Tp> __b, _Array<bool> __m) -{ - _Tp* __q (__b._M_data); - bool* __ok (__m._M_data); - for (_Tp* __p=__a._M_data; __p<__a._M_data+__n; ++__p, ++__ok, ++__q) { - while (! *__ok) { - ++__ok; - ++__q; - } - *__q = *__p; - } -} - -export template<typename _Tp, class _Dom> -void -__valarray_copy (const _Expr<_Dom, _Tp>& __e, size_t __n, _Array<_Tp> __a) -{ - _Tp* __p (__a._M_data); - for (size_t __i=0; __i<__n; ++__i, ++__p) *__p = __e[__i]; -} - -export template<typename _Tp, class _Dom> -void -__valarray_copy (const _Expr<_Dom, _Tp>& __e, size_t __n, - _Array<_Tp> __a, size_t __s) -{ - _Tp* __p (__a._M_data); - for (size_t __i=0; __i<__n; ++__i, __p+=__s) *__p = __e[__i]; -} - -export template<typename _Tp, class _Dom> -void -__valarray_copy (const _Expr<_Dom, _Tp>& __e, size_t __n, - _Array<_Tp> __a, _Array<size_t> __i) -{ - size_t* __j (__i._M_data); - for (size_t __k=0; __k<__n; ++__k, ++__j) __a._M_data[*__j] = __e[__k]; -} - -export template<typename _Tp, class _Dom> -void -__valarray_copy (const _Expr<_Dom, _Tp>& __e, size_t __n, - _Array<_Tp> __a, _Array<bool> __m) -{ - bool* __ok (__m._M_data); - _Tp* __p (__a._M_data); - for (size_t __i=0; __i<__n; ++__i, ++__ok, ++__p) { - while (! *__ok) { - ++__ok; - ++__p; - } - *__p = __e[__i]; - } -} - -} // extern "C++" - -#endif // __VALARRAY_ARRAY_TCC__ - -// Local Variables: -// mode:c++ -// End: |