diff options
author | obrien <obrien@FreeBSD.org> | 1999-04-05 05:37:27 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 1999-04-05 05:37:27 +0000 |
commit | c33391678f3d59265daeef12c989f1f25917e8bb (patch) | |
tree | 919fd166b18ac0f3b22be6fa155a6704bf9d014f /contrib/libg++/libstdc++/std | |
parent | 26216b12ae7556753bddb773035dcf9ba5722aed (diff) | |
download | FreeBSD-src-c33391678f3d59265daeef12c989f1f25917e8bb.zip FreeBSD-src-c33391678f3d59265daeef12c989f1f25917e8bb.tar.gz |
libg++ is OBE.
Diffstat (limited to 'contrib/libg++/libstdc++/std')
35 files changed, 0 insertions, 3042 deletions
diff --git a/contrib/libg++/libstdc++/std/bastring.cc b/contrib/libg++/libstdc++/std/bastring.cc deleted file mode 100644 index 92c69d8..0000000 --- a/contrib/libg++/libstdc++/std/bastring.cc +++ /dev/null @@ -1,489 +0,0 @@ -// Member templates 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. - -#include <std/stddef.h> -#include <std/bastring.h> - -extern "C++" { -template <class charT, class traits> -inline void * __bsrep <charT, traits>:: -operator new (size_t s, size_t extra) -{ - return ::operator new (s + extra * sizeof (charT)); -} - -template <class charT, class traits> -inline size_t __bsrep <charT, traits>:: -#if _G_ALLOC_CONTROL -default_frob (size_t s) -#else -frob_size (size_t s) -#endif -{ - size_t i = 16; - while (i < s) i *= 2; - return i; -} - -template <class charT, class traits> -inline __bsrep <charT, traits> * __bsrep <charT, traits>:: -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> -charT * __bsrep <charT, traits>:: -clone () -{ - Rep *p = Rep::create (len); - p->copy (0, data (), len); - p->len = len; - return p->data (); -} - -template <class charT, class traits> -inline bool __bsrep <charT, traits>:: -#ifdef _G_ALLOC_CONTROL -default_excess (size_t s, size_t r) -#else -excess_slop (size_t s, size_t r) -#endif -{ - return 2 * (s <= 16 ? 16 : s) < r; -} - -template <class charT, class traits> -inline bool basic_string <charT, traits>:: -check_realloc (size_t s) const -{ - s += sizeof (charT); - return (rep ()->ref > 1 - || s > capacity () - || Rep::excess_slop (s, capacity ())); -} - -template <class charT, class traits> -void basic_string <charT, traits>:: -alloc (size_t 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> -basic_string <charT, traits>& basic_string <charT, traits>:: -replace (size_t pos1, size_t n1, - const basic_string& str, size_t pos2, size_t 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> -inline void __bsrep <charT, traits>:: -copy (size_t pos, const charT *s, size_t n) -{ - if (n) - traits::copy (data () + pos, s, n); -} - -template <class charT, class traits> -inline void __bsrep <charT, traits>:: -move (size_t pos, const charT *s, size_t n) -{ - if (n) - traits::move (data () + pos, s, n); -} - -template <class charT, class traits> -basic_string <charT, traits>& basic_string <charT, traits>:: -replace (size_t pos, size_t n1, const charT* s, size_t n2) -{ - 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->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> -inline void __bsrep <charT, traits>:: -set (size_t pos, const charT c, size_t n) -{ - traits::set (data () + pos, c, n); -} - -template <class charT, class traits> -basic_string <charT, traits>& basic_string <charT, traits>:: -replace (size_t pos, size_t n1, size_t 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> -void basic_string <charT, traits>:: -resize (size_t n, charT c) -{ - LENGTHERROR (n > max_size ()); - - if (n > length ()) - append (n - length (), c); - else - remove (n); -} - -template <class charT, class traits> -size_t basic_string <charT, traits>:: -copy (charT* s, size_t n, size_t pos) -{ - OUTOFRANGE (pos > length ()); - - if (n > length () - pos) - n = length () - pos; - - traits::copy (s, data () + pos, n); - return n; -} - -template <class charT, class traits> -size_t basic_string <charT, traits>:: -find (const charT* s, size_t pos, size_t 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> -inline size_t basic_string <charT, traits>:: -_find (const charT* ptr, charT c, size_t xpos, size_t len) -{ - for (; xpos < len; ++xpos) - if (traits::eq (ptr [xpos], c)) - return xpos; - return npos; -} - -template <class charT, class traits> -size_t basic_string <charT, traits>:: -find (charT c, size_t pos) const -{ - return _find (data (), c, pos, length ()); -} - -template <class charT, class traits> -size_t basic_string <charT, traits>:: -rfind (const charT* s, size_t pos, size_t 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> -size_t basic_string <charT, traits>:: -rfind (charT c, size_t 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> -size_t basic_string <charT, traits>:: -find_first_of (const charT* s, size_t pos, size_t 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> -size_t basic_string <charT, traits>:: -find_last_of (const charT* s, size_t pos, size_t n) const -{ - size_t xpos = length (); - for (; xpos-- > pos; ) - if (_find (s, data () [xpos], 0, n) != npos) - return xpos; - return npos; -} - -template <class charT, class traits> -size_t basic_string <charT, traits>:: -find_first_not_of (const charT* s, size_t pos, size_t 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> -size_t basic_string <charT, traits>:: -find_first_not_of (charT c, size_t 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> -size_t basic_string <charT, traits>:: -find_last_not_of (const charT* s, size_t pos, size_t n) const -{ - size_t xpos = length (); - for (; xpos-- > pos; ) - if (_find (s, data () [xpos], 0, n) == npos) - return xpos; - return npos; -} - -template <class charT, class traits> -size_t basic_string <charT, traits>:: -find_last_not_of (charT c, size_t pos) const -{ - size_t xpos = length (); - for (; xpos-- > pos; ) - if (traits::ne (data () [xpos], c)) - return xpos; - return npos; -} - -template <class charT, class traits> -int basic_string <charT, traits>:: -compare (const basic_string& str, size_t pos, size_t 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> -int basic_string <charT, traits>:: -compare (const charT* s, size_t pos, size_t 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> -istream & -operator>> (istream &is, basic_string <charT, traits> &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 += ch; - if (--w == 1) - break; - } - } - - is.isfx (); - if (s.length () == 0) - is.setstate (ios::failbit); - - return is; -} - -template <class charT, class traits> -ostream & -operator<< (ostream &o, const basic_string <charT, traits>& s) -{ - return o.write (s.data (), s.length ()); -} - -template <class charT, class traits> -istream& -getline (istream &is, basic_string <charT, traits>& 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 += 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; -} -} // extern "C++" diff --git a/contrib/libg++/libstdc++/std/bastring.h b/contrib/libg++/libstdc++/std/bastring.h deleted file mode 100644 index d6174a2..0000000 --- a/contrib/libg++/libstdc++/std/bastring.h +++ /dev/null @@ -1,574 +0,0 @@ -// Main templates for the -*- C++ -*- string classes. -// Copyright (C) 1994, 1995 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 <std/stddef.h> -#include <std/straits.h> - -#if _G_USE_EXCEPTIONS - -#include <stdexcept> -#define OUTOFRANGE(cond) \ - do { if (!(cond)) throw out_of_range (#cond); } while (0) -#define LENGTHERROR(cond) \ - do { if (!(cond)) throw length_error (#cond); } while (0) - -#else - -#include <cassert> -#define OUTOFRANGE(cond) assert (!(cond)) -#define LENGTHERROR(cond) assert (!(cond)) - -#endif - -extern "C++" { -class istream; class ostream; - -// Should be a nested class basic_string<charT, traits>::Rep, but nested -// classes don't work well with templates in g++. -template <class charT, class traits = string_char_traits<charT> > -struct __bsrep { - typedef __bsrep 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 (); } - void release () { if (--ref == 0) delete this; } - - inline static void * operator new (size_t, size_t); - 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); - -#if _G_ALLOC_CONTROL - // These function pointers allow you to modify the allocation policy used - // by the string classes. By default they expand by powers of two, but - // this may be excessive for space-critical applications. - - // Returns true if ALLOCATED is too much larger than LENGTH - static bool (*excess_slop) (size_t length, size_t allocated); - inline static bool default_excess (size_t, size_t); - - // Returns a good amount of space to allocate for a string of length LENGTH - static size_t (*frob_size) (size_t length); - inline static size_t default_frob (size_t); -#else - inline static bool excess_slop (size_t, size_t); - inline static size_t frob_size (size_t); -#endif - -private: - Rep &operator= (const Rep &); -}; - -// #include <iterator.h> - -template <class charT, class traits = string_char_traits<charT> > -class basic_string -{ -private: - typedef __bsrep<charT, traits> Rep; - -public: -// types: - typedef traits traits_type; - typedef charT value_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; -#if 0 - typedef reverse_iterator<iterator, value_type, - reference, difference_type> reverse_iterator; - typedef reverse_iterator<const_iterator, value_type, const_reference, - difference_type> const_reverse_iterator; -#endif - 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); } -#if 0 - template<class InputIterator> - basic_string(InputIterator begin, InputIterator end, - Allocator& = Allocator()); -#endif - - ~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); } -#if 0 - template<class InputIterator> - basic_string& append(InputIterator first, InputIterator last); -#endif - - 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); } -#if 0 - template<class InputIterator> - basic_string& assign(InputIterator first, InputIterator last); -#endif - - 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 pos = p - begin (); insert (pos, 1, c); return pos +begin (); } - iterator insert(iterator p, size_type n, charT c) - { size_type pos = p - begin (); insert (pos, n, c); return pos +begin (); } -#if 0 - template<class InputIterator> - void insert(iterator p, InputIterator first, InputIterator last); -#endif - - basic_string& remove (size_type pos = 0, size_type n = npos) - { return replace (pos, n, (size_type)0, (charT)0); } - basic_string& remove (iterator pos) - { return replace (pos - begin (), 1, (size_type)0, (charT)0); } - basic_string& remove (iterator first, iterator last) - { return replace (first - begin (), last - first, (size_type)0, (charT)0);} - - 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 - begin (), i2 - i1, str); } - basic_string& replace (iterator i1, iterator i2, const charT* s, size_type n) - { return replace (i1 - begin (), i2 - i1, s, n); } - basic_string& replace (iterator i1, iterator i2, const charT* s) - { return replace (i1 - begin (), i2 - i1, s); } - basic_string& replace (iterator i1, iterator i2, size_type n, charT c) - { return replace (i1 - begin (), i2 - i1, n, c); } -#if 0 - template<class InputIterator> - basic_string& replace(iterator i1, iterator i2, - InputIterator j1, InputIterator j2); -#endif - -private: - static charT eos () { return traits::eos (); } - void unique () { if (rep ()->ref > 1) alloc (capacity (), 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) - { unique (); 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 - { 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); - - 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 ()]; } - const_iterator begin () const { return &(*rep ())[0]; } - const_iterator end () const { return &(*rep ())[length ()]; } - -#if 0 - 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 ()); } -#endif - -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; -}; - -template <class charT, class traits> -inline basic_string <charT, traits> -operator+ (const basic_string <charT, traits>& lhs, - const basic_string <charT, traits>& rhs) -{ - basic_string <charT, traits> str (lhs); - str.append (rhs); - return str; -} - -template <class charT, class traits> -inline basic_string <charT, traits> -operator+ (const charT* lhs, const basic_string <charT, traits>& rhs) -{ - basic_string <charT, traits> str (lhs); - str.append (rhs); - return str; -} - -template <class charT, class traits> -inline basic_string <charT, traits> -operator+ (charT lhs, const basic_string <charT, traits>& rhs) -{ - basic_string <charT, traits> str (1, lhs); - str.append (rhs); - return str; -} - -template <class charT, class traits> -inline basic_string <charT, traits> -operator+ (const basic_string <charT, traits>& lhs, const charT* rhs) -{ - basic_string <charT, traits> str (lhs); - str.append (rhs); - return str; -} - -template <class charT, class traits> -inline basic_string <charT, traits> -operator+ (const basic_string <charT, traits>& lhs, charT rhs) -{ - basic_string <charT, traits> str (lhs); - str.append (1, rhs); - return str; -} - -template <class charT, class traits> -inline bool -operator== (const basic_string <charT, traits>& lhs, - const basic_string <charT, traits>& rhs) -{ - return (lhs.compare (rhs) == 0); -} - -template <class charT, class traits> -inline bool -operator== (const charT* lhs, const basic_string <charT, traits>& rhs) -{ - return (rhs.compare (lhs) == 0); -} - -template <class charT, class traits> -inline bool -operator== (const basic_string <charT, traits>& lhs, const charT* rhs) -{ - return (lhs.compare (rhs) == 0); -} - -template <class charT, class traits> -inline bool -operator!= (const charT* lhs, const basic_string <charT, traits>& rhs) -{ - return (rhs.compare (lhs) != 0); -} - -template <class charT, class traits> -inline bool -operator!= (const basic_string <charT, traits>& lhs, const charT* rhs) -{ - return (lhs.compare (rhs) != 0); -} - -template <class charT, class traits> -inline bool -operator< (const basic_string <charT, traits>& lhs, - const basic_string <charT, traits>& rhs) -{ - return (lhs.compare (rhs) < 0); -} - -template <class charT, class traits> -inline bool -operator< (const charT* lhs, const basic_string <charT, traits>& rhs) -{ - return (rhs.compare (lhs) > 0); -} - -template <class charT, class traits> -inline bool -operator< (const basic_string <charT, traits>& lhs, const charT* rhs) -{ - return (lhs.compare (rhs) < 0); -} - -template <class charT, class traits> -inline bool -operator> (const charT* lhs, const basic_string <charT, traits>& rhs) -{ - return (rhs.compare (lhs) < 0); -} - -template <class charT, class traits> -inline bool -operator> (const basic_string <charT, traits>& lhs, const charT* rhs) -{ - return (lhs.compare (rhs) > 0); -} - -template <class charT, class traits> -inline bool -operator<= (const charT* lhs, const basic_string <charT, traits>& rhs) -{ - return (rhs.compare (lhs) >= 0); -} - -template <class charT, class traits> -inline bool -operator<= (const basic_string <charT, traits>& lhs, const charT* rhs) -{ - return (lhs.compare (rhs) <= 0); -} - -template <class charT, class traits> -inline bool -operator>= (const charT* lhs, const basic_string <charT, traits>& rhs) -{ - return (rhs.compare (lhs) <= 0); -} - -template <class charT, class traits> -inline bool -operator>= (const basic_string <charT, traits>& lhs, const charT* rhs) -{ - return (lhs.compare (rhs) >= 0); -} - -// Kludge this until g++ supports the new template overloading semantics. -#if !defined(FUNCTION_H) -template <class charT, class traits> -inline bool -operator!= (const basic_string <charT, traits>& lhs, - const basic_string <charT, traits>& rhs) -{ - return (lhs.compare (rhs) != 0); -} - -template <class charT, class traits> -inline bool -operator> (const basic_string <charT, traits>& lhs, - const basic_string <charT, traits>& rhs) -{ - return (lhs.compare (rhs) > 0); -} - -template <class charT, class traits> -inline bool -operator<= (const basic_string <charT, traits>& lhs, - const basic_string <charT, traits>& rhs) -{ - return (lhs.compare (rhs) <= 0); -} - -template <class charT, class traits> -inline bool -operator>= (const basic_string <charT, traits>& lhs, - const basic_string <charT, traits>& rhs) -{ - return (lhs.compare (rhs) >= 0); -} -#endif - -class istream; class ostream; -template <class charT, class traits> istream& -operator>> (istream&, basic_string <charT, traits>&); -template <class charT, class traits> ostream& -operator<< (ostream&, const basic_string <charT, traits>&); -template <class charT, class traits> istream& -getline (istream&, basic_string <charT, traits>&, charT delim = '\n'); - -} // extern "C++" - -#if !defined (_G_NO_EXTERN_TEMPLATES) -#include <std/sinst.h> -#endif - -#endif diff --git a/contrib/libg++/libstdc++/std/cassert.h b/contrib/libg++/libstdc++/std/cassert.h deleted file mode 100644 index 83f9f40..0000000 --- a/contrib/libg++/libstdc++/std/cassert.h +++ /dev/null @@ -1,7 +0,0 @@ -// The -*- C++ -*- assertions header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __ASSERT__ -#define __ASSERT__ -#include <assert.h> -#endif diff --git a/contrib/libg++/libstdc++/std/cctype.h b/contrib/libg++/libstdc++/std/cctype.h deleted file mode 100644 index e2765ae..0000000 --- a/contrib/libg++/libstdc++/std/cctype.h +++ /dev/null @@ -1,7 +0,0 @@ -// The -*- C++ -*- character type header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CCTYPE__ -#define __CCTYPE__ -#include <ctype.h> -#endif diff --git a/contrib/libg++/libstdc++/std/cerrno.h b/contrib/libg++/libstdc++/std/cerrno.h deleted file mode 100644 index ce49346..0000000 --- a/contrib/libg++/libstdc++/std/cerrno.h +++ /dev/null @@ -1,7 +0,0 @@ -// The -*- C++ -*- error number header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CERRNO__ -#define __CERRNO__ -#include <errno.h> -#endif diff --git a/contrib/libg++/libstdc++/std/cfloat.h b/contrib/libg++/libstdc++/std/cfloat.h deleted file mode 100644 index 05a6338..0000000 --- a/contrib/libg++/libstdc++/std/cfloat.h +++ /dev/null @@ -1,7 +0,0 @@ -// The -*- C++ -*- floating point header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CFLOAT__ -#define __CFLOAT__ -#include <float.h> -#endif diff --git a/contrib/libg++/libstdc++/std/cinst.h b/contrib/libg++/libstdc++/std/cinst.h deleted file mode 100644 index e41a2ba..0000000 --- a/contrib/libg++/libstdc++/std/cinst.h +++ /dev/null @@ -1,112 +0,0 @@ -// Forward declarations of -*- C++ -*- complex number instantiations. -// 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 __CINST__ -#define __CINST__ - -#ifndef _G_NO_EXTERN_TEMPLATES -extern "C++" { -extern template class complex<float>; -extern template class complex<double>; -extern template class complex<long double>; - -#define __B(type) bool -#define __C(type) complex<type> -#define __F(type) type -#define __I(type) int -#define __IS(type) istream& -#define __OS(type) ostream& -#define __CR(type) complex<type>& -#define __CCR(type) const complex<type>& - -#define __D2(name,type,ret,arg1,arg2) ret(type) name (arg1(type), arg2(type)); - -#define __S1(name,type,ret,arg1) \ - extern template ret(type) name (arg1(type)); -#define __S2(name,type,ret,arg1,arg2) \ - extern template __D2 (name,type,ret,arg1,arg2) - -#define __DO1(name,ret,arg1) \ - __S1(name,float,ret,arg1) \ - __S1(name,double,ret,arg1) \ - __S1(name,long double,ret,arg1) -#define __DO2(name,ret,arg1,arg2) \ - __S2(name,float,ret,arg1,arg2) \ - __S2(name,double,ret,arg1,arg2) \ - __S2(name,long double,ret,arg1,arg2) - -#define __DOCCC(name) __DO2(name,__C,__CCR,__CCR) -#define __DOCCF(name) __DO2(name,__C,__CCR,__F) -#define __DOCFC(name) __DO2(name,__C,__F,__CCR) -#define __DOCFF(name) __DO2(name,__C,__F,__F) -#define __DOBCC(name) __DO2(name,__B,__CCR,__CCR) -#define __DOBCF(name) __DO2(name,__B,__CCR,__F) -#define __DOBFC(name) __DO2(name,__B,__F,__CCR) -#define __DOFC(name) __DO1(name,__F,__CCR) -#define __DOCC(name) __DO1(name,__C,__CCR) - -__DO2(operator+,__C,__CCR,__CCR) -__DO2(operator+,__C,__CCR,__F) -__DO2(operator+,__C,__F,__CCR) -__DO2(operator-,__C,__CCR,__CCR) -__DO2(operator-,__C,__CCR,__F) -__DO2(operator-,__C,__F,__CCR) -__DO2(operator*,__C,__CCR,__CCR) -__DO2(operator*,__C,__CCR,__F) -__DO2(operator*,__C,__F,__CCR) -__DO2(operator/,__C,__CCR,__F) -__DO1(operator+,__C,__CCR) -__DO1(operator-,__C,__CCR) -__DO2(operator==,__B,__CCR,__CCR) -__DO2(operator==,__B,__CCR,__F) -__DO2(operator==,__B,__F,__CCR) -__DO2(operator!=,__B,__CCR,__CCR) -__DO2(operator!=,__B,__CCR,__F) -__DO2(operator!=,__B,__F,__CCR) -__DO1(abs,__F,__CCR) -__DO1(arg,__F,__CCR) -__DO2(polar,__C,__F,__F) -__DO1(conj,__C,__CCR) -__DO1(norm,__F,__CCR) - -#undef __DO1 -#undef __DO2 -#undef __S1 -#undef __S2 -#undef __D2 -#undef __B -#undef __C -#undef __F -#undef __I -#undef __IS -#undef __OS -#undef __CR -#undef __CCR -} // extern "C++" -#endif - -#endif diff --git a/contrib/libg++/libstdc++/std/ciso646.h b/contrib/libg++/libstdc++/std/ciso646.h deleted file mode 100644 index 974d15b..0000000 --- a/contrib/libg++/libstdc++/std/ciso646.h +++ /dev/null @@ -1,7 +0,0 @@ -// The -*- C++ -*- ISO 646 header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CISO646__ -#define __CISO646__ -#include <iso646.h> -#endif diff --git a/contrib/libg++/libstdc++/std/climits.h b/contrib/libg++/libstdc++/std/climits.h deleted file mode 100644 index 45e3d62..0000000 --- a/contrib/libg++/libstdc++/std/climits.h +++ /dev/null @@ -1,7 +0,0 @@ -// The -*- C++ -*- integral type limits header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CLIMITS__ -#define __CLIMITS__ -#include <limits.h> -#endif diff --git a/contrib/libg++/libstdc++/std/clocale.h b/contrib/libg++/libstdc++/std/clocale.h deleted file mode 100644 index b67cf31..0000000 --- a/contrib/libg++/libstdc++/std/clocale.h +++ /dev/null @@ -1,7 +0,0 @@ -// The -*- C++ -*- locale support header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CLOCALE__ -#define __CLOCALE__ -#include <locale.h> -#endif diff --git a/contrib/libg++/libstdc++/std/cmath.h b/contrib/libg++/libstdc++/std/cmath.h deleted file mode 100644 index 8c6628e..0000000 --- a/contrib/libg++/libstdc++/std/cmath.h +++ /dev/null @@ -1,76 +0,0 @@ -// The -*- C++ -*- math functions header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CMATH__ -#define __CMATH__ -#include <_G_config.h> -#include <math.h> - -#ifdef __GNUG__ -#pragma interface "std/cmath.h" -#endif - -extern "C++" { -#if 0 -float acos (float); -float asin (float); -float atan (float); -float atan2(float, float); -float ceil (float); -float cos (float); -float cosh (float); -float exp (float); -float fabs (float); -float floor(float); -float fmod (float, float); -float frexp(float, int*); -float modf (float, float*); -float ldexp(float, int); -float log (float); -float log10(float); -float pow (float, float); -float pow (float, int); -float sin (float); -float sinh (float); -float sqrt (float); -float tan (float); -float tanh (float); -#endif - -inline float abs (float x) { return fabs (x); } -#if ! _G_MATH_H_INLINES /* hpux and SCO define this in math.h */ -inline double abs (double x) { return fabs (x); } -#endif - -#if 0 -double pow(double, int); - -long double acos (long double); -long double asin (long double); -long double atan (long double); -long double atan2(long double, long double); -long double ceil (long double); -long double cos (long double); -long double cosh (long double); -long double exp (long double); -long double fabs (long double); -long double floor(long double); -long double frexp(long double, int*); -long double fmod (long double, long double); -long double frexp(long double, int*); -long double log (long double); -long double log10(long double); -long double modf (long double, long double*); -long double pow (long double, long double); -long double pow (long double, int); -long double sin (long double); -long double sinh (long double); -long double sqrt (long double); -long double tan (long double); -long double tanh (long double); -#endif -inline long double abs (long double x) { return fabs (x); } - -} // extern "C++" - -#endif diff --git a/contrib/libg++/libstdc++/std/complex.h b/contrib/libg++/libstdc++/std/complex.h deleted file mode 100644 index bfdd352..0000000 --- a/contrib/libg++/libstdc++/std/complex.h +++ /dev/null @@ -1,18 +0,0 @@ -// Main header for the -*- C++ -*- complex number classes. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __COMPLEX__ -#define __COMPLEX__ - -#include <std/complext.h> - -extern "C++" { -#define __STD_COMPLEX - -// ANSI complex types -typedef complex<float> float_complex; -typedef complex<double> double_complex; -typedef complex<long double> long_double_complex; -} - -#endif diff --git a/contrib/libg++/libstdc++/std/complext.cc b/contrib/libg++/libstdc++/std/complext.cc deleted file mode 100644 index 0b63125..0000000 --- a/contrib/libg++/libstdc++/std/complext.cc +++ /dev/null @@ -1,273 +0,0 @@ -// Member templates 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. - -#include <std/complex.h> - -extern "C++" { -template <class FLOAT> complex<FLOAT> -cos (const complex<FLOAT>& x) -{ - return complex<FLOAT> (cos (real (x)) * cosh (imag (x)), - - sin (real (x)) * sinh (imag (x))); -} - -template <class FLOAT> complex<FLOAT> -cosh (const complex<FLOAT>& x) -{ - return complex<FLOAT> (cosh (real (x)) * cos (imag (x)), - sinh (real (x)) * sin (imag (x))); -} - -template <class FLOAT> complex<FLOAT> -exp (const complex<FLOAT>& x) -{ - return polar (FLOAT (exp (real (x))), imag (x)); -} - -template <class FLOAT> complex<FLOAT> -log (const complex<FLOAT>& x) -{ - return complex<FLOAT> (log (abs (x)), arg (x)); -} - -template <class FLOAT> complex<FLOAT> -pow (const complex<FLOAT>& x, const complex<FLOAT>& y) -{ - FLOAT logr = log (abs (x)); - FLOAT t = arg (x); - - return polar (FLOAT (exp (logr * real (y) - imag (y) * t)), - FLOAT (imag (y) * logr + real (y) * t)); -} - -template <class FLOAT> complex<FLOAT> -pow (const complex<FLOAT>& x, FLOAT y) -{ - return exp (FLOAT (y) * log (x)); -} - -template <class FLOAT> complex<FLOAT> -pow (FLOAT x, const complex<FLOAT>& y) -{ - return exp (y * FLOAT (log (x))); -} - -template <class FLOAT> complex<FLOAT> -sin (const complex<FLOAT>& x) -{ - return complex<FLOAT> (sin (real (x)) * cosh (imag (x)), - cos (real (x)) * sinh (imag (x))); -} - -template <class FLOAT> complex<FLOAT> -sinh (const complex<FLOAT>& x) -{ - return complex<FLOAT> (sinh (real (x)) * cos (imag (x)), - cosh (real (x)) * sin (imag (x))); -} - -#include <iostream.h> - -template <class FLOAT> istream& -operator >> (istream& is, complex<FLOAT>& x) -{ - FLOAT re, im = 0; - char ch = 0; - - if (is.ipfx0 ()) - { - if (is.peek () == '(') - is >> ch; - is >> re; - if (ch == '(') - { - is >> ch; - if (ch == ',') - is >> im >> ch; - } - } - is.isfx (); - - if (ch != 0 && ch != ')') - is.setstate (ios::failbit); - else if (is.good ()) - x = complex<FLOAT> (re, im); - - return is; -} - -template <class FLOAT> ostream& -operator << (ostream& os, const complex<FLOAT>& x) -{ - return os << '(' << real (x) << ',' << imag (x) << ')'; -} - -// The code below is adapted from f2c's libF77, and is subject to this -// copyright: - -/**************************************************************** -Copyright 1990, 1991, 1992, 1993 by AT&T Bell Laboratories and Bellcore. - -Permission to use, copy, modify, and distribute this software -and its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that the copyright notice and this -permission notice and warranty disclaimer appear in supporting -documentation, and that the names of AT&T Bell Laboratories or -Bellcore or any of their entities not be used in advertising or -publicity pertaining to distribution of the software without -specific, written prior permission. - -AT&T and Bellcore disclaim all warranties with regard to this -software, including all implied warranties of merchantability -and fitness. In no event shall AT&T or Bellcore be liable for -any special, indirect or consequential damages or any damages -whatsoever resulting from loss of use, data or profits, whether -in an action of contract, negligence or other tortious action, -arising out of or in connection with the use or performance of -this software. -****************************************************************/ - -template <class FLOAT> complex<FLOAT>& complex<FLOAT>:: -operator /= (const complex& y) -{ - FLOAT ar = abs (y.re); - FLOAT ai = abs (y.im); - FLOAT nr, ni; - FLOAT t, d; - if (ar <= ai) - { - t = y.re / y.im; - d = y.im * (1 + t*t); - nr = (re * t + im) / d; - ni = (im * t - re) / d; - } - else - { - t = y.im / y.re; - d = y.re * (1 + t*t); - nr = (re + im * t) / d; - ni = (im - re * t) / d; - } - re = nr; - im = ni; - return *this; -} - -template <class FLOAT> complex<FLOAT> -operator / (const complex<FLOAT>& x, const complex<FLOAT>& y) -{ - FLOAT ar = abs (real (y)); - FLOAT ai = abs (imag (y)); - FLOAT nr, ni; - FLOAT t, d; - if (ar <= ai) - { - t = real (y) / imag (y); - d = imag (y) * (1 + t*t); - nr = (real (x) * t + imag (x)) / d; - ni = (imag (x) * t - real (x)) / d; - } - else - { - t = imag (y) / real (y); - d = real (y) * (1 + t*t); - nr = (real (x) + imag (x) * t) / d; - ni = (imag (x) - real (x) * t) / d; - } - return complex<FLOAT> (nr, ni); -} - -template <class FLOAT> complex<FLOAT> -operator / (FLOAT x, const complex<FLOAT>& y) -{ - FLOAT ar = abs (real (y)); - FLOAT ai = abs (imag (y)); - FLOAT nr, ni; - FLOAT t, d; - if (ar <= ai) - { - t = real (y) / imag (y); - d = imag (y) * (1 + t*t); - nr = x * t / d; - ni = -x / d; - } - else - { - t = imag (y) / real (y); - d = real (y) * (1 + t*t); - nr = x / d; - ni = -x * t / d; - } - return complex<FLOAT> (nr, ni); -} - -template <class FLOAT> complex<FLOAT> -pow (const complex<FLOAT>& xin, int y) -{ - if (y == 0) - return complex<FLOAT> (1.0); - complex<FLOAT> r (1.0); - complex<FLOAT> x (xin); - if (y < 0) - { - y = -y; - x = 1/x; - } - for (;;) - { - if (y & 1) - r *= x; - if (y >>= 1) - x *= x; - else - return r; - } -} - -template <class FLOAT> complex<FLOAT> -sqrt (const complex<FLOAT>& x) -{ - FLOAT r = abs (x); - FLOAT nr, ni; - if (r == 0.0) - nr = ni = r; - else if (real (x) > 0) - { - nr = sqrt (0.5 * (r + real (x))); - ni = imag (x) / nr / 2; - } - else - { - ni = sqrt (0.5 * (r - real (x))); - if (imag (x) < 0) - ni = - ni; - nr = imag (x) / ni / 2; - } - return complex<FLOAT> (nr, ni); -} -} // extern "C++" diff --git a/contrib/libg++/libstdc++/std/complext.h b/contrib/libg++/libstdc++/std/complext.h deleted file mode 100644 index db87dd0..0000000 --- a/contrib/libg++/libstdc++/std/complext.h +++ /dev/null @@ -1,317 +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 <std/cmath.h> - -#if ! defined (__GNUG__) && ! defined (__attribute__) -#define __attribute__ (foo) /* Ignore. */ -#endif - -extern "C++" { -template <class FLOAT> -class complex -{ -public: - complex (FLOAT r = 0, FLOAT i = 0): re (r), im (i) { } - complex& operator += (const complex&); - complex& operator -= (const complex&); - complex& operator *= (const complex&); - complex& operator /= (const complex&); - FLOAT real () const { return re; } - FLOAT imag () const { return im; } -private: - FLOAT re, im; - - // These functions are specified as friends for purposes of name injection; - // they do not actually reference private members. - friend FLOAT real (const complex&) __attribute__ ((const)); - friend FLOAT imag (const complex&) __attribute__ ((const)); - friend complex operator + (const complex&, const complex&) __attribute__ ((const)); - friend complex operator + (const complex&, FLOAT) __attribute__ ((const)); - friend complex operator + (FLOAT, const complex&) __attribute__ ((const)); - friend complex operator - (const complex&, const complex&) __attribute__ ((const)); - friend complex operator - (const complex&, FLOAT) __attribute__ ((const)); - friend complex operator - (FLOAT, const complex&) __attribute__ ((const)); - friend complex operator * (const complex&, const complex&) __attribute__ ((const)); - friend complex operator * (const complex&, FLOAT) __attribute__ ((const)); - friend complex operator * (FLOAT, const complex&) __attribute__ ((const)); - friend complex operator / (const complex&, const complex&) __attribute__ ((const)); - friend complex operator / (const complex&, FLOAT) __attribute__ ((const)); - friend complex operator / (FLOAT, const complex&) __attribute__ ((const)); - friend bool operator == (const complex&, const complex&) __attribute__ ((const)); - friend bool operator == (const complex&, FLOAT) __attribute__ ((const)); - friend bool operator == (FLOAT, const complex&) __attribute__ ((const)); - friend bool operator != (const complex&, const complex&) __attribute__ ((const)); - friend bool operator != (const complex&, FLOAT) __attribute__ ((const)); - friend bool operator != (FLOAT, const complex&) __attribute__ ((const)); - friend complex polar (FLOAT, FLOAT) __attribute__ ((const)); - friend complex pow (const complex&, const complex&) __attribute__ ((const)); - friend complex pow (const complex&, FLOAT) __attribute__ ((const)); - friend complex pow (const complex&, int) __attribute__ ((const)); - friend complex pow (FLOAT, const complex&) __attribute__ ((const)); - friend istream& operator>> (istream&, complex&); - friend ostream& operator<< (ostream&, const complex&); -}; - -// Declare specializations. -class complex<float>; -class complex<double>; -class complex<long double>; - -template <class FLOAT> -inline complex<FLOAT>& -complex<FLOAT>::operator += (const complex<FLOAT>& r) -{ - re += r.re; - im += r.im; - return *this; -} - -template <class FLOAT> -inline complex<FLOAT>& -complex<FLOAT>::operator -= (const complex<FLOAT>& r) -{ - re -= r.re; - im -= r.im; - return *this; -} - -template <class FLOAT> -inline complex<FLOAT>& -complex<FLOAT>::operator *= (const complex<FLOAT>& r) -{ - FLOAT f = re * r.re - im * r.im; - im = re * r.im + im * r.re; - re = f; - return *this; -} - -template <class FLOAT> inline FLOAT -imag (const complex<FLOAT>& x) __attribute__ ((const)) -{ - return x.imag (); -} - -template <class FLOAT> inline FLOAT -real (const complex<FLOAT>& x) __attribute__ ((const)) -{ - return x.real (); -} - -template <class FLOAT> inline complex<FLOAT> -operator + (const complex<FLOAT>& x, const complex<FLOAT>& y) __attribute__ ((const)) -{ - return complex<FLOAT> (real (x) + real (y), imag (x) + imag (y)); -} - -template <class FLOAT> inline complex<FLOAT> -operator + (const complex<FLOAT>& x, FLOAT y) __attribute__ ((const)) -{ - return complex<FLOAT> (real (x) + y, imag (x)); -} - -template <class FLOAT> inline complex<FLOAT> -operator + (FLOAT x, const complex<FLOAT>& y) __attribute__ ((const)) -{ - return complex<FLOAT> (x + real (y), imag (y)); -} - -template <class FLOAT> inline complex<FLOAT> -operator - (const complex<FLOAT>& x, const complex<FLOAT>& y) __attribute__ ((const)) -{ - return complex<FLOAT> (real (x) - real (y), imag (x) - imag (y)); -} - -template <class FLOAT> inline complex<FLOAT> -operator - (const complex<FLOAT>& x, FLOAT y) __attribute__ ((const)) -{ - return complex<FLOAT> (real (x) - y, imag (x)); -} - -template <class FLOAT> inline complex<FLOAT> -operator - (FLOAT x, const complex<FLOAT>& y) __attribute__ ((const)) -{ - return complex<FLOAT> (x - real (y), - imag (y)); -} - -template <class FLOAT> inline complex<FLOAT> -operator * (const complex<FLOAT>& x, const complex<FLOAT>& y) __attribute__ ((const)) -{ - return complex<FLOAT> (real (x) * real (y) - imag (x) * imag (y), - real (x) * imag (y) + imag (x) * real (y)); -} - -template <class FLOAT> inline complex<FLOAT> -operator * (const complex<FLOAT>& x, FLOAT y) __attribute__ ((const)) -{ - return complex<FLOAT> (real (x) * y, imag (x) * y); -} - -template <class FLOAT> inline complex<FLOAT> -operator * (FLOAT x, const complex<FLOAT>& y) __attribute__ ((const)) -{ - return complex<FLOAT> (x * real (y), x * imag (y)); -} - -template <class FLOAT> complex<FLOAT> -operator / (const complex<FLOAT>& x, FLOAT y) __attribute__ ((const)) -{ - return complex<FLOAT> (real (x) / y, imag (x) / y); -} - -template <class FLOAT> inline complex<FLOAT> -operator + (const complex<FLOAT>& x) __attribute__ ((const)) -{ - return x; -} - -template <class FLOAT> inline complex<FLOAT> -operator - (const complex<FLOAT>& x) __attribute__ ((const)) -{ - return complex<FLOAT> (-real (x), -imag (x)); -} - -template <class FLOAT> inline bool -operator == (const complex<FLOAT>& x, const complex<FLOAT>& y) __attribute__ ((const)) -{ - return real (x) == real (y) && imag (x) == imag (y); -} - -template <class FLOAT> inline bool -operator == (const complex<FLOAT>& x, FLOAT y) __attribute__ ((const)) -{ - return real (x) == y && imag (x) == 0; -} - -template <class FLOAT> inline bool -operator == (FLOAT x, const complex<FLOAT>& y) __attribute__ ((const)) -{ - return x == real (y) && imag (y) == 0; -} - -template <class FLOAT> inline bool -operator != (const complex<FLOAT>& x, const complex<FLOAT>& y) __attribute__ ((const)) -{ - return real (x) != real (y) || imag (x) != imag (y); -} - -template <class FLOAT> inline bool -operator != (const complex<FLOAT>& x, FLOAT y) __attribute__ ((const)) -{ - return real (x) != y || imag (x) != 0; -} - -template <class FLOAT> inline bool -operator != (FLOAT x, const complex<FLOAT>& y) __attribute__ ((const)) -{ - 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 FLOAT> inline FLOAT -abs (const complex<FLOAT>& x) __attribute__ ((const)) -{ - return hypot (real (x), imag (x)); -} - -template <class FLOAT> inline FLOAT -arg (const complex<FLOAT>& x) __attribute__ ((const)) -{ - return atan2 (imag (x), real (x)); -} - -template <class FLOAT> inline complex<FLOAT> -polar (FLOAT r, FLOAT t) __attribute__ ((const)) -{ - return complex<FLOAT> (r * cos (t), r * sin (t)); -} - -template <class FLOAT> inline complex<FLOAT> -conj (const complex<FLOAT>& x) __attribute__ ((const)) -{ - return complex<FLOAT> (real (x), -imag (x)); -} - -template <class FLOAT> inline FLOAT -norm (const complex<FLOAT>& x) __attribute__ ((const)) -{ - return real (x) * real (x) + imag (x) * imag (x); -} - -// Declarations of templates in complext.ccI - -template <class FLOAT> complex<FLOAT> - operator / (const complex<FLOAT>&, const complex<FLOAT>&) __attribute__ ((const)); -template <class FLOAT> complex<FLOAT> - operator / (FLOAT, const complex<FLOAT>&) __attribute__ ((const)); -template <class FLOAT> complex<FLOAT> - cos (const complex<FLOAT>&) __attribute__ ((const)); -template <class FLOAT> complex<FLOAT> - cosh (const complex<FLOAT>&) __attribute__ ((const)); -template <class FLOAT> complex<FLOAT> - exp (const complex<FLOAT>&) __attribute__ ((const)); -template <class FLOAT> complex<FLOAT> - log (const complex<FLOAT>&) __attribute__ ((const)); -template <class FLOAT> complex<FLOAT> - pow (const complex<FLOAT>&, const complex<FLOAT>&) __attribute__ ((const)); -template <class FLOAT> complex<FLOAT> - pow (const complex<FLOAT>&, FLOAT) __attribute__ ((const)); -template <class FLOAT> complex<FLOAT> - pow (const complex<FLOAT>&, int) __attribute__ ((const)); -template <class FLOAT> complex<FLOAT> - pow (FLOAT, const complex<FLOAT>&) __attribute__ ((const)); -template <class FLOAT> complex<FLOAT> - sin (const complex<FLOAT>&) __attribute__ ((const)); -template <class FLOAT> complex<FLOAT> - sinh (const complex<FLOAT>&) __attribute__ ((const)); -template <class FLOAT> complex<FLOAT> - sqrt (const complex<FLOAT>&) __attribute__ ((const)); - -class istream; -class ostream; -template <class FLOAT> istream& operator >> (istream&, complex<FLOAT>&); -template <class FLOAT> ostream& operator << (ostream&, const complex<FLOAT>&); -} // extern "C++" - -// Specializations and such - -#include <std/fcomplex.h> -#include <std/dcomplex.h> -#include <std/ldcomplex.h> - -// Declare the instantiations. -#include <std/cinst.h> - -#endif diff --git a/contrib/libg++/libstdc++/std/csetjmp.h b/contrib/libg++/libstdc++/std/csetjmp.h deleted file mode 100644 index 4bba048..0000000 --- a/contrib/libg++/libstdc++/std/csetjmp.h +++ /dev/null @@ -1,8 +0,0 @@ -// The -*- C++ -*- setjmp/longjmp header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CSETJMP__ -#define __CSETJMP__ -#include <setjmp.h> -#endif - diff --git a/contrib/libg++/libstdc++/std/csignal.h b/contrib/libg++/libstdc++/std/csignal.h deleted file mode 100644 index 6febfb7..0000000 --- a/contrib/libg++/libstdc++/std/csignal.h +++ /dev/null @@ -1,7 +0,0 @@ -// The -*- C++ -*- signal handling header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CSIGNAL__ -#define __CSIGNAL__ -#include <signal.h> -#endif diff --git a/contrib/libg++/libstdc++/std/cstdarg.h b/contrib/libg++/libstdc++/std/cstdarg.h deleted file mode 100644 index 24c57f0..0000000 --- a/contrib/libg++/libstdc++/std/cstdarg.h +++ /dev/null @@ -1,7 +0,0 @@ -// The -*- C++ -*- variable argument handling header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CSTDARG__ -#define __CSTDARG__ -#include <stdarg.h> -#endif diff --git a/contrib/libg++/libstdc++/std/cstddef.h b/contrib/libg++/libstdc++/std/cstddef.h deleted file mode 100644 index 0e025e3..0000000 --- a/contrib/libg++/libstdc++/std/cstddef.h +++ /dev/null @@ -1,7 +0,0 @@ -// The -*- C++ -*- wrapper for the C standard definitions header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CSTDDEF__ -#define __CSTDDEF__ -#include <stddef.h> -#endif diff --git a/contrib/libg++/libstdc++/std/cstdio.h b/contrib/libg++/libstdc++/std/cstdio.h deleted file mode 100644 index 1fe1456..0000000 --- a/contrib/libg++/libstdc++/std/cstdio.h +++ /dev/null @@ -1,7 +0,0 @@ -// The -*- C++ -*- standard I/O header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CSTDIO__ -#define __CSTDIO__ -#include <stdio.h> -#endif diff --git a/contrib/libg++/libstdc++/std/cstdlib.h b/contrib/libg++/libstdc++/std/cstdlib.h deleted file mode 100644 index 51dc00a..0000000 --- a/contrib/libg++/libstdc++/std/cstdlib.h +++ /dev/null @@ -1,23 +0,0 @@ -// The -*- C++ -*- standard library header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CSTDLIB__ -#define __CSTDLIB__ -#include <stdlib.h> - -#ifdef __GNUG__ -#pragma interface "std/cstdlib.h" -#endif - -extern "C++" { - -#if _G_HAS_LABS -inline long abs(long x) { return labs (x); } -#else -inline long abs(long x) { return x >= 0 ? x : -x; } -#endif -//inline ldiv_t div(long x, long y) { return ldiv (x, y); } - -} // extern "C++" - -#endif diff --git a/contrib/libg++/libstdc++/std/cstring.h b/contrib/libg++/libstdc++/std/cstring.h deleted file mode 100644 index f0e914b..0000000 --- a/contrib/libg++/libstdc++/std/cstring.h +++ /dev/null @@ -1,71 +0,0 @@ -// The -*- C++ -*- null-terminated string header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CSTRING__ -#define __CSTRING__ - -#if 0 // Let's not bother with this just yet. -// The ANSI C prototypes for these functions have a const argument type and -// non-const return type, so we can't use them. - -#define strchr __hide_strchr -#define strpbrk __hide_strpbrk -#define strrchr __hide_strrchr -#define strstr __hide_strstr -#define memchr __hide_memchr -#endif // 0 - -#include <string.h> - -#if 0 // Let's not bother with this just yet. -#undef strchr -#undef strpbrk -#undef strrchr -#undef strstr -#undef memchr - -#include <std/cstddef.h> - -#ifdef __GNUG__ -#pragma interface "std/cstring.h" -#endif - -extern "C++" { -extern "C" const char *strchr (const char *, int); -inline char * -strchr (char *s, int c) -{ - return const_cast<char *> (strchr (static_cast<const char *> (s), c)); -} - -extern "C" const char *strpbrk (const char *, const char *); -inline char * -strpbrk (char *s1, const char *s2) -{ - return const_cast<char *> (strpbrk (static_cast<const char *> (s1), s2)); -} - -extern "C" const char *strrchr (const char *, int); -inline char * -strrchr (char *s, int c) -{ - return const_cast<char *> (strrchr (static_cast<const char *> (s), c)); -} - -extern "C" const char *strstr (const char *, const char *); -inline char * -strstr (char *s1, const char *s2) -{ - return const_cast<char *> (strstr (static_cast<const char *> (s1), s2)); -} - -extern "C" const void *memchr (const void *, int, size_t); -inline void * -memchr (void *s, int c, size_t n) -{ - return const_cast<void *> (memchr (static_cast<const void *> (s), c, n)); -} -} // extern "C++" - -#endif // 0 -#endif // !defined (__CSTRING__) diff --git a/contrib/libg++/libstdc++/std/ctime.h b/contrib/libg++/libstdc++/std/ctime.h deleted file mode 100644 index 0184da5..0000000 --- a/contrib/libg++/libstdc++/std/ctime.h +++ /dev/null @@ -1,7 +0,0 @@ -// The -*- C++ -*- time header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CTIME__ -#define __CTIME__ -#include <time.h> -#endif diff --git a/contrib/libg++/libstdc++/std/cwchar.h b/contrib/libg++/libstdc++/std/cwchar.h deleted file mode 100644 index 1674c12..0000000 --- a/contrib/libg++/libstdc++/std/cwchar.h +++ /dev/null @@ -1,7 +0,0 @@ -// The -*- C++ -*- wide character header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CWCHAR__ -#define __CWCHAR__ -#include <wchar.h> -#endif diff --git a/contrib/libg++/libstdc++/std/cwctype.h b/contrib/libg++/libstdc++/std/cwctype.h deleted file mode 100644 index 8112201..0000000 --- a/contrib/libg++/libstdc++/std/cwctype.h +++ /dev/null @@ -1,7 +0,0 @@ -// The -*- C++ -*- wide character type header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __CWCTYPE__ -#define __CWCTYPE__ -#include <wctype.h> -#endif diff --git a/contrib/libg++/libstdc++/std/dcomplex.h b/contrib/libg++/libstdc++/std/dcomplex.h deleted file mode 100644 index d3e5d31..0000000 --- a/contrib/libg++/libstdc++/std/dcomplex.h +++ /dev/null @@ -1,89 +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&); - complex& operator-= (const complex&); - complex& operator*= (const complex&); - complex& operator/= (const complex&); - - double real () const { return re; } - double imag () const { return im; } -private: - double re, im; - - // These functions are specified as friends for purposes of name injection; - // they do not actually reference private members. - friend double real (const complex& x) { return x.real (); } - friend double imag (const complex& x) { return x.imag (); } - friend complex operator + (const complex&, const complex&) __attribute__ ((const)); - friend complex operator + (const complex&, double) __attribute__ ((const)); - friend complex operator + (double, const complex&) __attribute__ ((const)); - friend complex operator - (const complex&, const complex&) __attribute__ ((const)); - friend complex operator - (const complex&, double) __attribute__ ((const)); - friend complex operator - (double, const complex&) __attribute__ ((const)); - friend complex operator * (const complex&, const complex&) __attribute__ ((const)); - friend complex operator * (const complex&, double) __attribute__ ((const)); - friend complex operator * (double, const complex&) __attribute__ ((const)); - friend complex operator / (const complex&, const complex&) __attribute__ ((const)); - friend complex operator / (const complex&, double) __attribute__ ((const)); - friend complex operator / (double, const complex&) __attribute__ ((const)); - friend bool operator == (const complex&, const complex&) __attribute__ ((const)); - friend bool operator == (const complex&, double) __attribute__ ((const)); - friend bool operator == (double, const complex&) __attribute__ ((const)); - friend bool operator != (const complex&, const complex&) __attribute__ ((const)); - friend bool operator != (const complex&, double) __attribute__ ((const)); - friend bool operator != (double, const complex&) __attribute__ ((const)); - friend complex polar (double, double) __attribute__ ((const)); - friend complex pow (const complex&, const complex&) __attribute__ ((const)); - friend complex pow (const complex&, double) __attribute__ ((const)); - friend complex pow (const complex&, int) __attribute__ ((const)); - friend complex pow (double, const complex&) __attribute__ ((const)); - friend istream& operator>> (istream&, complex&); - friend ostream& operator<< (ostream&, const complex&); -}; - -inline complex<float>::complex (const complex<double>& r) -: re (r.real ()), im (r.imag ()) -{ } -} // extern "C++" - -#endif diff --git a/contrib/libg++/libstdc++/std/exception.h b/contrib/libg++/libstdc++/std/exception.h deleted file mode 100644 index 6de65d8..0000000 --- a/contrib/libg++/libstdc++/std/exception.h +++ /dev/null @@ -1,39 +0,0 @@ -// Exception Handling header for -*- C++ -*- -// Copyright (C) 1995 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. - -#ifndef __EXCEPTION__ -#define __EXCEPTION__ - -extern "C++" { -// class XUNEXPECTED { to be specified }; -typedef void (*terminate_handler) (); -typedef void (*unexpected_handler) (); - -terminate_handler set_terminate (terminate_handler); -void terminate (void); -unexpected_handler set_unexpected (unexpected_handler); -void unexpected (void); -} // extern "C++" - -#endif diff --git a/contrib/libg++/libstdc++/std/fcomplex.h b/contrib/libg++/libstdc++/std/fcomplex.h deleted file mode 100644 index 27f3be7..0000000 --- a/contrib/libg++/libstdc++/std/fcomplex.h +++ /dev/null @@ -1,85 +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&); - complex& operator-= (const complex&); - complex& operator*= (const complex&); - complex& operator/= (const complex&); - - float real () const { return re; } - float imag () const { return im; } -private: - float re, im; - - // These functions are specified as friends for purposes of name injection; - // they do not actually reference private members. - friend float real (const complex& x) { return x.real (); } - friend float imag (const complex& x) { return x.imag (); } - friend complex operator + (const complex&, const complex&) __attribute__ ((const)); - friend complex operator + (const complex&, float) __attribute__ ((const)); - friend complex operator + (float, const complex&) __attribute__ ((const)); - friend complex operator - (const complex&, const complex&) __attribute__ ((const)); - friend complex operator - (const complex&, float) __attribute__ ((const)); - friend complex operator - (float, const complex&) __attribute__ ((const)); - friend complex operator * (const complex&, const complex&) __attribute__ ((const)); - friend complex operator * (const complex&, float) __attribute__ ((const)); - friend complex operator * (float, const complex&) __attribute__ ((const)); - friend complex operator / (const complex&, const complex&) __attribute__ ((const)); - friend complex operator / (const complex&, float) __attribute__ ((const)); - friend complex operator / (float, const complex&) __attribute__ ((const)); - friend bool operator == (const complex&, const complex&) __attribute__ ((const)); - friend bool operator == (const complex&, float) __attribute__ ((const)); - friend bool operator == (float, const complex&) __attribute__ ((const)); - friend bool operator != (const complex&, const complex&) __attribute__ ((const)); - friend bool operator != (const complex&, float) __attribute__ ((const)); - friend bool operator != (float, const complex&) __attribute__ ((const)); - friend complex polar (float, float) __attribute__ ((const)); - friend complex pow (const complex&, const complex&) __attribute__ ((const)); - friend complex pow (const complex&, float) __attribute__ ((const)); - friend complex pow (const complex&, int) __attribute__ ((const)); - friend complex pow (float, const complex&) __attribute__ ((const)); - friend istream& operator>> (istream&, complex&); - friend ostream& operator<< (ostream&, const complex&); -}; -} // extern "C++" - -#endif diff --git a/contrib/libg++/libstdc++/std/ldcomplex.h b/contrib/libg++/libstdc++/std/ldcomplex.h deleted file mode 100644 index 95f90ae..0000000 --- a/contrib/libg++/libstdc++/std/ldcomplex.h +++ /dev/null @@ -1,93 +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&); - complex& operator-= (const complex&); - complex& operator*= (const complex&); - complex& operator/= (const complex&); - - long double real () const { return re; } - long double imag () const { return im; } -private: - long double re, im; - - // These functions are specified as friends for purposes of name injection; - // they do not actually reference private members. - friend long double real (const complex& x) { return x.real (); } - friend long double imag (const complex& x) { return x.imag (); } - friend complex operator + (const complex&, const complex&) __attribute__ ((const)); - friend complex operator + (const complex&, long double) __attribute__ ((const)); - friend complex operator + (long double, const complex&) __attribute__ ((const)); - friend complex operator - (const complex&, const complex&) __attribute__ ((const)); - friend complex operator - (const complex&, long double) __attribute__ ((const)); - friend complex operator - (long double, const complex&) __attribute__ ((const)); - friend complex operator * (const complex&, const complex&) __attribute__ ((const)); - friend complex operator * (const complex&, long double) __attribute__ ((const)); - friend complex operator * (long double, const complex&) __attribute__ ((const)); - friend complex operator / (const complex&, const complex&) __attribute__ ((const)); - friend complex operator / (const complex&, long double) __attribute__ ((const)); - friend complex operator / (long double, const complex&) __attribute__ ((const)); - friend bool operator == (const complex&, const complex&) __attribute__ ((const)); - friend bool operator == (const complex&, long double) __attribute__ ((const)); - friend bool operator == (long double, const complex&) __attribute__ ((const)); - friend bool operator != (const complex&, const complex&) __attribute__ ((const)); - friend bool operator != (const complex&, long double) __attribute__ ((const)); - friend bool operator != (long double, const complex&) __attribute__ ((const)); - friend complex polar (long double, long double) __attribute__ ((const)); - friend complex pow (const complex&, const complex&) __attribute__ ((const)); - friend complex pow (const complex&, long double) __attribute__ ((const)); - friend complex pow (const complex&, int) __attribute__ ((const)); - friend complex pow (long double, const complex&) __attribute__ ((const)); - friend istream& operator>> (istream&, complex&); - friend ostream& operator<< (ostream&, const complex&); -}; - -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/libg++/libstdc++/std/new.h b/contrib/libg++/libstdc++/std/new.h deleted file mode 100644 index cfdfbeb..0000000 --- a/contrib/libg++/libstdc++/std/new.h +++ /dev/null @@ -1,34 +0,0 @@ -// The -*- C++ -*- dynamic memory management header. -// Copyright (C) 1994 Free Software Foundation - -#ifndef __NEW__ -#define __NEW__ - -#ifdef __GNUG__ -#pragma interface "std/new.h" -#endif - -#include <std/cstddef.h> - -extern "C++" { -typedef void (*new_handler)(); -extern "C" new_handler set_new_handler (new_handler); - -#if defined(__GNUG__) && !defined (__STRICT_ANSI__) -// G++ implementation internals -extern new_handler __new_handler; -extern "C" void __default_new_handler (void); -#endif - -// replaceable signatures -void *operator new (size_t); -void *operator new[] (size_t); -void operator delete (void *); -void operator delete[] (void *); - -// default placement versions of operator new -inline void *operator new(size_t, void *place) { return place; } -inline void *operator new[](size_t, void *place) { return place; } -} // extern "C++" - -#endif diff --git a/contrib/libg++/libstdc++/std/sinst.h b/contrib/libg++/libstdc++/std/sinst.h deleted file mode 100644 index 6bd9bfc..0000000 --- a/contrib/libg++/libstdc++/std/sinst.h +++ /dev/null @@ -1,73 +0,0 @@ -// Forward declarations of -*- C++ -*- string instantiations. -// 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 __SINST__ -#define __SINST__ - -extern "C++" { -#define __S basic_string<char,string_char_traits<char> > -//#define __W basic_string<wchar_t,string_char_traits<wchar_t> > - -extern template class __bsrep<char, string_char_traits<char> >; -extern template class __S; -// extern template class __W; -// extern template class __bsrep<wchar_t, string_char_traits<wchar_t> >; - -#define __DOPR(op, ret, c, s) \ - extern template ret operator op (const s&, const s&); \ - extern template ret operator op (const c*, const s&); \ - extern template ret operator op (const s&, const c*); \ - -#define __DO(op, ret, c, s) \ - extern template ret operator op (const s&, const s&); \ - extern template ret operator op (const c*, const s&); \ - extern template ret operator op (const s&, const c*); \ - extern template ret operator op (c, const s&); \ - extern template ret operator op (const s&, c); - -__DO (+, __S, char, __S) -// __DO (+, __W, wchar_t, __W) */ - -#define __DOB(op) \ - __DOPR (op, bool, char, __S) -// __DOPR (op, bool, wchar_t, __W) - -__DOB (==) -__DOB (!=) -__DOB (<) -__DOB (>) -__DOB (<=) -__DOB (>=) - -#undef __S -//#undef __W -#undef __DO -#undef __DOB -#undef __DOPR -} // extern "C++" - -#endif diff --git a/contrib/libg++/libstdc++/std/stddef.h b/contrib/libg++/libstdc++/std/stddef.h deleted file mode 100644 index 00cf47e..0000000 --- a/contrib/libg++/libstdc++/std/stddef.h +++ /dev/null @@ -1,25 +0,0 @@ -// The -*- C++ -*- standard definitions header. -// This file is part of the GNU ANSI C++ Library. - -#ifndef __STDDEF__ -#define __STDDEF__ - -#ifdef __GNUG__ -#pragma interface "std/stddef.h" -#endif - -#include <_G_config.h> -#include <std/cstddef.h> - -extern "C++" { -const size_t NPOS = (size_t)(-1); -typedef void fvoid_t(); - -#ifndef _WINT_T -#define _WINT_T -typedef _G_wint_t wint_t; -#endif - -} // extern "C++" - -#endif diff --git a/contrib/libg++/libstdc++/std/stdexcept.h b/contrib/libg++/libstdc++/std/stdexcept.h deleted file mode 100644 index 785bb6a..0000000 --- a/contrib/libg++/libstdc++/std/stdexcept.h +++ /dev/null @@ -1,126 +0,0 @@ -// Methods for Exception Support for -*- C++ -*- -// Copyright (C) 1994, 1995 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 Mike Stump based upon the specification in the 20 September 1994 -// C++ working paper, ANSI document X3J16/94-0158. - -#ifndef __STDEXCEPT__ -#define __STDEXCEPT__ - -#ifdef __GNUG__ -#pragma interface "std/stdexcept.h" -#endif - -#include <typeinfo> - -extern "C++" { -#if 0 -#include <string> -typedef string __string; -#else -typedef const char * __string; -#endif - -class exception { -public: - typedef void (*raise_handler)(exception&); - static raise_handler set_raise_handler(raise_handler handler_arg); - exception (const __string& what_arg): desc (what_arg) { } - virtual ~exception() { } - void raise(); - virtual __string what() const { return desc; } -protected: - exception() { } - virtual void do_raise() { } -private: - __string desc; -}; - -class logic_error : public exception { -public: - logic_error(const __string& what_arg): exception (what_arg) { } - virtual ~logic_error() { } -}; - -class domain_error : public logic_error { -public: - domain_error (const __string& what_arg): logic_error (what_arg) { } - virtual ~domain_error () { } -}; - -class invalid_argument : public logic_error { -public: - invalid_argument (const __string& what_arg): logic_error (what_arg) { } - virtual ~invalid_argument () { } -}; - -class length_error : public logic_error { -public: - length_error (const __string& what_arg): logic_error (what_arg) { } - virtual ~length_error () { } -}; - -class out_of_range : public logic_error { -public: - out_of_range (const __string& what_arg): logic_error (what_arg) { } - virtual ~out_of_range () { } -}; - -class runtime_error : public exception { -public: - runtime_error(const __string& what_arg): exception (what_arg) { } - virtual ~runtime_error() { } -protected: - runtime_error(): exception () { } -}; - -class range_error : public runtime_error { -public: - range_error (const __string& what_arg): runtime_error (what_arg) { } - virtual ~range_error () { } -}; - -class overflow_error : public runtime_error { -public: - overflow_error (const __string& what_arg): runtime_error (what_arg) { } - virtual ~overflow_error () { } -}; - -// These are moved here from typeinfo so that we can compile with -frtti -class bad_cast : public logic_error { -public: - bad_cast(const __string& what_arg): logic_error (what_arg) { } - virtual ~bad_cast() { } -}; - -extern bad_cast __bad_cast_object; - -class bad_typeid : public logic_error { - public: - bad_typeid (): logic_error ("bad_typeid") { } - virtual ~bad_typeid () { } -}; -} // extern "C++" - -#endif diff --git a/contrib/libg++/libstdc++/std/straits.h b/contrib/libg++/libstdc++/std/straits.h deleted file mode 100644 index 42fbad37..0000000 --- a/contrib/libg++/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 <std/stddef.h> - -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 <std/cctype.h> -#include <std/cstring.h> - -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 <std/cwctype.h> -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/libg++/libstdc++/std/string.h b/contrib/libg++/libstdc++/std/string.h deleted file mode 100644 index 77cc801..0000000 --- a/contrib/libg++/libstdc++/std/string.h +++ /dev/null @@ -1,13 +0,0 @@ -// Main header for the -*- C++ -*- string classes. - -#ifndef __STRING__ -#define __STRING__ - -#include <std/bastring.h> - -extern "C++" { -typedef basic_string <char, string_char_traits <char> > string; -// typedef basic_string <wchar_t, string_char_traits <wchar_t> > wstring; -} // extern "C++" - -#endif diff --git a/contrib/libg++/libstdc++/std/typeinfo.h b/contrib/libg++/libstdc++/std/typeinfo.h deleted file mode 100644 index 44f833c..0000000 --- a/contrib/libg++/libstdc++/std/typeinfo.h +++ /dev/null @@ -1,245 +0,0 @@ -// RTTI support for -*- C++ -*- -// Copyright (C) 1994, 1995 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 Kung Hsu based upon the specification in the 20 September 1994 -// C++ working paper, ANSI document X3J16/94-0158. - -#ifndef __TYPEINFO__ -#define __TYPEINFO__ - -#ifdef __GNUG__ -#pragma interface "std/typeinfo.h" -#endif - -extern "C" void* __throw_type_match_rtti (void *, void *, void *); - -extern "C++" { -class type_info { -private: - // assigning type_info is not supported. made private. - type_info& operator=(const type_info&); - type_info(const type_info&); - -public: - enum node_type { - _RTTI_BUILTIN_TYPE, // builtin type - _RTTI_USER_TYPE, // user defined type - _RTTI_CLASS_TYPE, // class type - _RTTI_POINTER_TYPE, // pointer type - _RTTI_ATTR_TYPE, // attribute type for const and volatile - _RTTI_FUNC_TYPE, // function type - _RTTI_PTMF_TYPE, // pointer to member function type - _RTTI_PTMD_TYPE // pointer to member data type - }; - - // return node type of the object - virtual node_type __rtti_get_node_type() const { return _RTTI_BUILTIN_TYPE; } - - // get_name will return the name of the type, NULL if no name (like builtin) - virtual const char * __rtti_get_name() const { return 0; } - - // compare if type represented by the type_info are the same type - virtual int __rtti_compare(const type_info&) const { return 0; } - - // argument passed is the desired type, - // for class type, if the type can be converted to the desired type, - // it will be, and returned, else 0 is returned. If the match - // succeeds, the return value will be adjusted to point to the sub-object. - virtual void* __rtti_match(const type_info&, int, void *) const { - // This should never be called. - return 0; - }; - - // destructor - virtual ~type_info() {} - type_info() {} - - bool before(const type_info& arg); - const char* name() const - { return __rtti_get_name(); } - bool operator==(const type_info& arg) const - { return __rtti_compare(arg) == 0; } - bool operator!=(const type_info& arg) const - { return __rtti_compare(arg) != 0; } -}; - -// type_info for builtin type - -class __builtin_type_info : public type_info { -public: - enum builtin_type_val { - _RTTI_BI_BOOL = 1, _RTTI_BI_CHAR, _RTTI_BI_SHORT, _RTTI_BI_INT, - _RTTI_BI_LONG, _RTTI_BI_LONGLONG, _RTTI_BI_FLOAT, - _RTTI_BI_DOUBLE, _RTTI_BI_LDOUBLE, _RTTI_BI_UCHAR, - _RTTI_BI_USHORT, _RTTI_BI_UINT, _RTTI_BI_ULONG, - _RTTI_BI_ULONGLONG, _RTTI_BI_SCHAR, _RTTI_BI_WCHAR, _RTTI_BI_VOID - }; - - builtin_type_val b_type; - - __builtin_type_info (builtin_type_val bt) : b_type (bt) {} - node_type __rtti_get_node_type () const - { return _RTTI_BUILTIN_TYPE; } - const char *__rtti_get_name () const - { return (const char *)0; } - int __rtti_compare (const type_info& arg) const - { return (arg.__rtti_get_node_type () == _RTTI_BUILTIN_TYPE && - ((__builtin_type_info&)arg).b_type == b_type) ? 0 : -1; } -}; - -// serice function for comparing types by name. - -inline int __fast_compare (const char *n1, const char *n2) { - int c; - if (n1 == n2) return 0; - if (n1 == 0) return *n2; - else if (n2 == 0) return *n1; - - c = (int)*n1++ - (int)*n2++; - return c == 0 ? strcmp (n1, n2) : c; -}; - -// type_info for user type. - -class __user_type_info : public type_info { - private: - const char *_name; - -public: - __user_type_info (const char *nm) : _name (nm) {} - node_type __rtti_get_node_type () const - { return _RTTI_USER_TYPE; } - const char *__rtti_get_name () const - { return _name; } - int __rtti_compare (const type_info& arg) const - { return (arg.__rtti_get_node_type () == __rtti_get_node_type() && - __fast_compare (_name, arg.__rtti_get_name ()) == 0) ? 0 : -1; } -}; - -// type_info for a class. - -class __class_type_info : public __user_type_info { -private: - enum access_mode { - _RTTI_ACCESS_PUBLIC, _RTTI_ACCESS_PROTECTED, _RTTI_ACCESS_PRIVATE - }; - type_info **base_list; - int *offset_list; - int *is_virtual_list; - access_mode *access_list; - int n_bases; - -public: - __class_type_info (const char *name, type_info **bl, int *off, - int *is_vir, access_mode *acc, int bn) - : __user_type_info (name), base_list (bl), offset_list(off), - is_virtual_list(is_vir), access_list(acc), n_bases (bn) {} - node_type __rtti_get_node_type () const - { return _RTTI_CLASS_TYPE; } - - // inherit __rtti_compare from __user_type_info - - // This is a little complex defined in typeinfo.cc - void* __rtti_match(const type_info&, int, void *) const; -}; - -// type info for pointer type. - -class __pointer_type_info : public type_info { -private: - type_info& type; - -public: - __pointer_type_info (type_info& ti) : type (ti) {} - node_type __rtti_get_node_type () const - { return _RTTI_POINTER_TYPE; } - const char *__rtti_get_name () const - { return (const char *)0; } - int __rtti_compare (const type_info& arg) const - { return (arg.__rtti_get_node_type () == __rtti_get_node_type() && - type.__rtti_compare ( ((__pointer_type_info&)arg).type) == 0) ? 0 : -1; } - void* __rtti_match(const type_info& catch_type, int, void *objptr) const; -}; - -// type info for attributes - -class __attr_type_info : public type_info { -public: - enum attr_val { - _RTTI_ATTR_CONST = 1, _RTTI_ATTR_VOLATILE, _RTTI_ATTR_CONSTVOL - }; - - attr_val attr; - type_info& type; - - __attr_type_info (attr_val a, type_info& t) : attr (a), type(t) {} - node_type __rtti_get_node_type () const - { return _RTTI_ATTR_TYPE; } - const char *__rtti_get_name () const - { return (const char *)0; } - int __rtti_compare (const type_info& arg) const - { return (arg.__rtti_get_node_type () == _RTTI_ATTR_TYPE && - attr == ((__attr_type_info&)arg).attr && - type.__rtti_compare ( ((__attr_type_info&)arg).type ) == 0) - ? 0 : -1; } -}; - -// type info for function. - -class __func_type_info : public __user_type_info { -public: - __func_type_info (const char *name) : __user_type_info (name) {} - node_type __rtti_get_node_type () const - { return _RTTI_FUNC_TYPE; } -}; - -// type info for pointer to member function. - -class __ptmf_type_info : public __user_type_info { -public: - __ptmf_type_info (const char *name) : __user_type_info (name) {} - node_type __rtti_get_node_type () const - { return _RTTI_PTMF_TYPE; } -}; - -// type info for pointer to data member. - -class __ptmd_type_info : public type_info { - type_info& classtype; - type_info& type; -public: - __ptmd_type_info (type_info& tc, type_info& t) : classtype (tc), type (t) {} - node_type __rtti_get_node_type () const - { return _RTTI_PTMD_TYPE; } - int __rtti_compare (const type_info& arg) const - { return (arg.__rtti_get_node_type () == _RTTI_PTMD_TYPE && - classtype.__rtti_compare ( ((__ptmd_type_info&)arg).classtype ) == 0 && - type.__rtti_compare ( ((__ptmd_type_info&)arg).type ) == 0) - ? 0 : -1; } -}; -} // extern "C++" - -#include <stdexcept> - -#endif |