From 63e749a813fed4a7aff6ff5aa6811855deb2bc2c Mon Sep 17 00:00:00 2001 From: Benjamin Kosnik Date: Tue, 21 Nov 2000 23:44:50 +0000 Subject: [PATCH] strstream.h: Replace with... 2000-11-21 Benjamin Kosnik * include/backward/strstream.h: Replace with... * include/bits/std_strstream.h: ...this. Move. * include/backward/complex.h: Remove SGIisms. * include/backward/streambuf.h: Same. * include/backward/stream.h: Same. * include/backward/ostream.h: Same. * include/backward/istream.h: Same. * include/backward/iostream.h: Same. * include/backward/iomanip.h: Same. * include/backward/fstream.h: Same. * libsupc++/new.h: Add using declarations for bad_alloc, nothrow_t, and nothrow, move to ... * include/backward/new.h: ...here. From-SVN: r37631 --- libstdc++-v3/ChangeLog | 20 ++- libstdc++-v3/include/backward/complex.h | 15 +- libstdc++-v3/include/backward/fstream.h | 17 +- libstdc++-v3/include/backward/iomanip.h | 17 +- libstdc++-v3/include/backward/iostream.h | 35 ++--- libstdc++-v3/include/backward/istream.h | 7 +- libstdc++-v3/include/backward/new.h | 49 +++--- libstdc++-v3/include/backward/ostream.h | 2 +- libstdc++-v3/include/backward/stream.h | 2 +- libstdc++-v3/include/backward/streambuf.h | 7 +- libstdc++-v3/include/backward/strstream.h | 183 ++++++++++++++++++---- libstdc++-v3/include/bits/std_strstream.h | 159 ------------------- libstdc++-v3/libsupc++/new.h | 38 ----- 13 files changed, 233 insertions(+), 318 deletions(-) delete mode 100644 libstdc++-v3/include/bits/std_strstream.h delete mode 100644 libstdc++-v3/libsupc++/new.h diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index bc93dd86ea2..853e3603a8a 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,19 @@ +2000-11-21 Benjamin Kosnik + + * include/backward/strstream.h: Replace with... + * include/bits/std_strstream.h: ...this. Move. + * include/backward/complex.h: Remove SGIisms. + * include/backward/streambuf.h: Same. + * include/backward/stream.h: Same. + * include/backward/ostream.h: Same. + * include/backward/istream.h: Same. + * include/backward/iostream.h: Same. + * include/backward/iomanip.h: Same. + * include/backward/fstream.h: Same. + * libsupc++/new.h: Add using declarations for bad_alloc, + nothrow_t, and nothrow, move to ... + * include/backward/new.h: ...here. + 2000-11-21 Mark Mitchell * porting.texi: New file. @@ -12,10 +28,6 @@ 2000-11-21 Benjamin Kosnik - * libsupc++/new.h: Add using declarations for bad_alloc, - nothrow_t, and nothrow. - * include/backward/new.h: Remove duplicate file, as libsupc++ has it. - * acinclude.m4 (AC_LC_MESSAGES): Check for locale.h. * aclocal.m4: Regenerate. * configure: Renerate. diff --git a/libstdc++-v3/include/backward/complex.h b/libstdc++-v3/include/backward/complex.h index 97e0852068b..055eef9af11 100644 --- a/libstdc++-v3/include/backward/complex.h +++ b/libstdc++-v3/include/backward/complex.h @@ -1,4 +1,3 @@ - // Copyright (C) 2000 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -29,18 +28,14 @@ #ifndef _CPP_BACKWARD_COMPLEX_H #define _CPP_BACKWARD_COMPLEX_H 1 -#include #include -#ifdef __STL_USE_NAMESPACES -using __STD::complex; -#endif /* __STL_USE_NAMESPACES */ +using std::complex; +typedef complex float_complex; +typedef complex double_complex; +typedef complex long_double_complex; -typedef complex float_complex; -typedef complex double_complex; -typedef complex long_double_complex; - -#endif /* _CPP_BACKWARD_COMPLEX_H */ +#endif // Local Variables: // mode:C++ diff --git a/libstdc++-v3/include/backward/fstream.h b/libstdc++-v3/include/backward/fstream.h index a346faf994c..b98ee3c4c40 100644 --- a/libstdc++-v3/include/backward/fstream.h +++ b/libstdc++-v3/include/backward/fstream.h @@ -30,20 +30,17 @@ #include -#ifdef __STL_USE_NAMESPACES -using __STD::ifstream; -using __STD::ofstream; -using __STD::fstream; +using std::ifstream; +using std::ofstream; +using std::fstream; #ifdef _GLIBCPP_USE_WCHAR_T -using __STD::wifstream; -using __STD::wofstream; -using __STD::wfstream; +using std::wifstream; +using std::wofstream; +using std::wfstream; #endif -#endif /* __STL_USE_NAMESPACES */ - -#endif /* _CPP_BACKWARD_FSTREAM_H */ +#endif // Local Variables: // mode:C++ diff --git a/libstdc++-v3/include/backward/iomanip.h b/libstdc++-v3/include/backward/iomanip.h index 206a3880b66..76b209c1fd9 100644 --- a/libstdc++-v3/include/backward/iomanip.h +++ b/libstdc++-v3/include/backward/iomanip.h @@ -1,4 +1,3 @@ - // Copyright (C) 2000 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -32,16 +31,14 @@ #include #include -#ifdef __STL_USE_NAMESPACES -using __STD::resetiosflags; -using __STD::setiosflags; -using __STD::setbase; -using __STD::setfill; -using __STD::setprecision; -using __STD::setw; -#endif /* __STL_USE_NAMESPACES */ +using std::resetiosflags; +using std::setiosflags; +using std::setbase; +using std::setfill; +using std::setprecision; +using std::setw; -#endif /* _CPP_BACKWARD_IOMANIP_H */ +#endif // Local Variables: // mode:C++ diff --git a/libstdc++-v3/include/backward/iostream.h b/libstdc++-v3/include/backward/iostream.h index 2caee39adc4..7656bce6638 100644 --- a/libstdc++-v3/include/backward/iostream.h +++ b/libstdc++-v3/include/backward/iostream.h @@ -1,4 +1,3 @@ - // Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -31,29 +30,27 @@ #include -#ifdef __STL_USE_NAMESPACES -using __STD::iostream; -using __STD::ostream; -using __STD::istream; -using __STD::ios; -using __STD::streambuf; +using std::iostream; +using std::ostream; +using std::istream; +using std::ios; +using std::streambuf; -using __STD::cout; -using __STD::cin; -using __STD::cerr; -using __STD::clog; +using std::cout; +using std::cin; +using std::cerr; +using std::clog; #ifdef _GLIBCPP_USE_WCHAR_T -using __STD::wcout; -using __STD::wcin; -using __STD::wcerr; -using __STD::wclog; +using std::wcout; +using std::wcin; +using std::wcerr; +using std::wclog; #endif -using __STD::endl; -using __STD::ends; -#endif /* __STL_USE_NAMESPACES */ +using std::endl; +using std::ends; -#endif /* _CPP_BACKWARD_IOSTREAM_H */ +#endif // Local Variables: // mode:C++ diff --git a/libstdc++-v3/include/backward/istream.h b/libstdc++-v3/include/backward/istream.h index f45709267eb..c80c474565f 100644 --- a/libstdc++-v3/include/backward/istream.h +++ b/libstdc++-v3/include/backward/istream.h @@ -30,8 +30,13 @@ #include -#endif /* _CPP_BACKWARD_ISTREAM_H */ +#endif // Local Variables: // mode:C++ // End: + + + + + diff --git a/libstdc++-v3/include/backward/new.h b/libstdc++-v3/include/backward/new.h index 20e57dee8de..f04e3585a22 100644 --- a/libstdc++-v3/include/backward/new.h +++ b/libstdc++-v3/include/backward/new.h @@ -1,21 +1,22 @@ +// -*- C++ -*- forwarding header. +// Copyright (C) 2000 Free Software Foundation -// Copyright (C) 1997-1999 Free Software Foundation, Inc. +// This file is part of GNU CC. // -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) +// GNU CC 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, +// +// GNU CC 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. +// +// You should have received a copy of the GNU General Public License +// along with GNU CC; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate @@ -26,21 +27,15 @@ // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. -#ifndef _CPP_BACKWARD_NEW_H -#define _CPP_BACKWARD_NEW_H 1 +#ifndef __NEW_H__ +#define __NEW_H__ -#include +#include -#ifdef __STL_USE_NAMESPACES -using __STD::bad_alloc; -using __STD::nothrow_t; -using __STD::nothrow; -using __STD::new_handler; -using __STD::set_new_handler; -#endif /* __STL_USE_NAMESPACES */ +using std::bad_alloc; +using std::nothrow_t; +using std::nothrow; +using std::new_handler; +using std::set_new_handler; -#endif /* _CPP_BACKWARD_NEW_H */ - -// Local Variables: -// mode:C++ -// End: +#endif // __NEW_H__ diff --git a/libstdc++-v3/include/backward/ostream.h b/libstdc++-v3/include/backward/ostream.h index 740588a277b..aa129b571e7 100644 --- a/libstdc++-v3/include/backward/ostream.h +++ b/libstdc++-v3/include/backward/ostream.h @@ -30,7 +30,7 @@ #include -#endif /* _CPP_BACKWARD_OSTREAM_H */ +#endif // Local Variables: // mode:C++ diff --git a/libstdc++-v3/include/backward/stream.h b/libstdc++-v3/include/backward/stream.h index f829b0dd577..0207f693787 100644 --- a/libstdc++-v3/include/backward/stream.h +++ b/libstdc++-v3/include/backward/stream.h @@ -30,7 +30,7 @@ #include -#endif /* _CPP_BACKWARD_STREAM_H */ +#endif // Local Variables: // mode:C++ diff --git a/libstdc++-v3/include/backward/streambuf.h b/libstdc++-v3/include/backward/streambuf.h index 9bb7646ef04..a0df9f6440d 100644 --- a/libstdc++-v3/include/backward/streambuf.h +++ b/libstdc++-v3/include/backward/streambuf.h @@ -1,4 +1,3 @@ - // Copyright (C) 2000 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -31,11 +30,9 @@ #include -#ifdef __STL_USE_NAMESPACES -using __STD::streambuf; -#endif /* __STL_USE_NAMESPACES */ +using std::streambuf; -#endif /* _CPP_BACKWARD_STREAMBUF_H */ +#endif // Local Variables: // mode:C++ diff --git a/libstdc++-v3/include/backward/strstream.h b/libstdc++-v3/include/backward/strstream.h index f693fcd54de..0a6a129f4ef 100644 --- a/libstdc++-v3/include/backward/strstream.h +++ b/libstdc++-v3/include/backward/strstream.h @@ -1,44 +1,161 @@ -// Copyright (C) 2000 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. +/* + * Copyright (c) 1998 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ -// 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. +// WARNING: The classes defined in this header are DEPRECATED. This +// header is defined in section D.7.1 of the C++ standard, and it +// MAY BE REMOVED in a future standard revision. You should use the +// header instead. -// 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. +#ifndef __SGI_STL_STRSTREAM +#define __SGI_STL_STRSTREAM -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. +#if defined(__sgi) && !defined(__GNUC__) && !defined(_STANDARD_C_PLUS_PLUS) +#error This header file requires the -LANG:std option +#endif -#ifndef _CPP_BACKWARD_STRSTREAM_H -#define _CPP_BACKWARD_STRSTREAM_H 1 +#include +#include +#include +#include +#include -#include +__STL_BEGIN_NAMESPACE -#ifdef __STL_USE_NAMESPACES -using __STD::strstreambuf; -using __STD::istrstream; -using __STD::ostrstream; -using __STD::strstream; -#endif /* __STL_USE_NAMESPACES */ +//---------------------------------------------------------------------- +// Class strstreambuf, a streambuf class that manages an array of char. +// Note that this class is not a template. -#endif /* _CPP_BACKWARD_STRSTREAM_H */ +class strstreambuf : public basic_streambuf > +{ +public: // Types. + typedef char_traits _Traits; + typedef basic_streambuf _Base; + +public: // Constructor, destructor + explicit strstreambuf(streamsize __initial_capacity = 0); + strstreambuf(void* (*__alloc)(size_t), void (*__free)(void*)); + + strstreambuf(char* __get, streamsize __n, char* __put = 0); + strstreambuf(signed char* __get, streamsize __n, signed char* __put = 0); + strstreambuf(unsigned char* __get, streamsize __n, unsigned char* __put=0); + + strstreambuf(const char* __get, streamsize __n); + strstreambuf(const signed char* __get, streamsize __n); + strstreambuf(const unsigned char* __get, streamsize __n); + + virtual ~strstreambuf(); + +public: // strstreambuf operations. + void freeze(bool = true); + char* str(); + int pcount() const; + +protected: // Overridden virtual member functions. + virtual int_type overflow(int_type __c = _Traits::eof()); + virtual int_type pbackfail(int_type __c = _Traits::eof()); + virtual int_type underflow(); + virtual _Base* setbuf(char* __buf, streamsize __n); + virtual pos_type seekoff(off_type __off, ios_base::seekdir __dir, + ios_base::openmode __mode + = ios_base::in | ios_base::out); + virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode + = ios_base::in | ios_base::out); + +private: // Helper functions. + // Dynamic allocation, possibly using _M_alloc_fun and _M_free_fun. + char* _M_alloc(size_t); + void _M_free(char*); + + // Helper function used in constructors. + void _M_setup(char* __get, char* __put, streamsize __n); + +private: // Data members. + void* (*_M_alloc_fun)(size_t); + void (*_M_free_fun)(void*); + + bool _M_dynamic : 1; + bool _M_frozen : 1; + bool _M_constant : 1; +}; + +//---------------------------------------------------------------------- +// Class istrstream, an istream that manages a strstreambuf. + +class istrstream : public basic_istream +{ +public: + explicit istrstream(char*); + explicit istrstream(const char*); + istrstream(char* , streamsize); + istrstream(const char*, streamsize); + virtual ~istrstream(); + + strstreambuf* rdbuf() const; + char* str(); + +private: + strstreambuf _M_buf; +}; + +//---------------------------------------------------------------------- +// Class ostrstream + +class ostrstream : public basic_ostream +{ +public: + ostrstream(); + ostrstream(char*, int, ios_base::openmode = ios_base::out); + virtual ~ostrstream(); + + strstreambuf* rdbuf() const; + void freeze(bool = true); + char* str(); + int pcount() const; + +private: + strstreambuf _M_buf; +}; + +//---------------------------------------------------------------------- +// Class strstream + +class strstream : public basic_iostream +{ +public: + typedef char char_type; + typedef char_traits::int_type int_type; + typedef char_traits::pos_type pos_type; + typedef char_traits::off_type off_type; + + strstream(); + strstream(char*, int, ios_base::openmode = ios_base::in | ios_base::out); + virtual ~strstream(); + + strstreambuf* rdbuf() const; + void freeze(bool = true); + int pcount() const; + char* str(); + +private: + strstreambuf _M_buf; +}; + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_STRSTREAM */ // Local Variables: // mode:C++ // End: + + diff --git a/libstdc++-v3/include/bits/std_strstream.h b/libstdc++-v3/include/bits/std_strstream.h deleted file mode 100644 index 2f784b36fce..00000000000 --- a/libstdc++-v3/include/bits/std_strstream.h +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright (c) 1998 - * Silicon Graphics Computer Systems, Inc. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -// WARNING: The classes defined in this header are DEPRECATED. This -// header is defined in section D.7.1 of the C++ standard, and it -// MAY BE REMOVED in a future standard revision. You should use the -// header instead. - -#ifndef __SGI_STL_STRSTREAM -#define __SGI_STL_STRSTREAM - -#if defined(__sgi) && !defined(__GNUC__) && !defined(_STANDARD_C_PLUS_PLUS) -#error This header file requires the -LANG:std option -#endif - -#include -#include -#include -#include -#include - -__STL_BEGIN_NAMESPACE - -//---------------------------------------------------------------------- -// Class strstreambuf, a streambuf class that manages an array of char. -// Note that this class is not a template. - -class strstreambuf : public basic_streambuf > -{ -public: // Types. - typedef char_traits _Traits; - typedef basic_streambuf _Base; - -public: // Constructor, destructor - explicit strstreambuf(streamsize __initial_capacity = 0); - strstreambuf(void* (*__alloc)(size_t), void (*__free)(void*)); - - strstreambuf(char* __get, streamsize __n, char* __put = 0); - strstreambuf(signed char* __get, streamsize __n, signed char* __put = 0); - strstreambuf(unsigned char* __get, streamsize __n, unsigned char* __put=0); - - strstreambuf(const char* __get, streamsize __n); - strstreambuf(const signed char* __get, streamsize __n); - strstreambuf(const unsigned char* __get, streamsize __n); - - virtual ~strstreambuf(); - -public: // strstreambuf operations. - void freeze(bool = true); - char* str(); - int pcount() const; - -protected: // Overridden virtual member functions. - virtual int_type overflow(int_type __c = _Traits::eof()); - virtual int_type pbackfail(int_type __c = _Traits::eof()); - virtual int_type underflow(); - virtual _Base* setbuf(char* __buf, streamsize __n); - virtual pos_type seekoff(off_type __off, ios_base::seekdir __dir, - ios_base::openmode __mode - = ios_base::in | ios_base::out); - virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode - = ios_base::in | ios_base::out); - -private: // Helper functions. - // Dynamic allocation, possibly using _M_alloc_fun and _M_free_fun. - char* _M_alloc(size_t); - void _M_free(char*); - - // Helper function used in constructors. - void _M_setup(char* __get, char* __put, streamsize __n); - -private: // Data members. - void* (*_M_alloc_fun)(size_t); - void (*_M_free_fun)(void*); - - bool _M_dynamic : 1; - bool _M_frozen : 1; - bool _M_constant : 1; -}; - -//---------------------------------------------------------------------- -// Class istrstream, an istream that manages a strstreambuf. - -class istrstream : public basic_istream -{ -public: - explicit istrstream(char*); - explicit istrstream(const char*); - istrstream(char* , streamsize); - istrstream(const char*, streamsize); - virtual ~istrstream(); - - strstreambuf* rdbuf() const; - char* str(); - -private: - strstreambuf _M_buf; -}; - -//---------------------------------------------------------------------- -// Class ostrstream - -class ostrstream : public basic_ostream -{ -public: - ostrstream(); - ostrstream(char*, int, ios_base::openmode = ios_base::out); - virtual ~ostrstream(); - - strstreambuf* rdbuf() const; - void freeze(bool = true); - char* str(); - int pcount() const; - -private: - strstreambuf _M_buf; -}; - -//---------------------------------------------------------------------- -// Class strstream - -class strstream : public basic_iostream -{ -public: - typedef char char_type; - typedef char_traits::int_type int_type; - typedef char_traits::pos_type pos_type; - typedef char_traits::off_type off_type; - - strstream(); - strstream(char*, int, ios_base::openmode = ios_base::in | ios_base::out); - virtual ~strstream(); - - strstreambuf* rdbuf() const; - void freeze(bool = true); - int pcount() const; - char* str(); - -private: - strstreambuf _M_buf; -}; - -__STL_END_NAMESPACE - -#endif /* __SGI_STL_STRSTREAM */ - -// Local Variables: -// mode:C++ -// End: diff --git a/libstdc++-v3/libsupc++/new.h b/libstdc++-v3/libsupc++/new.h deleted file mode 100644 index cb1fa4cb5ca..00000000000 --- a/libstdc++-v3/libsupc++/new.h +++ /dev/null @@ -1,38 +0,0 @@ -// -*- C++ -*- forwarding header. -// Copyright (C) 2000 Free Software Foundation - -// This file is part of GNU CC. -// -// GNU CC 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. -// -// GNU CC 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 GNU CC; see the file COPYING. If not, write to -// the Free Software Foundation, 59 Temple Place - Suite 330, -// Boston, MA 02111-1307, USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -#ifndef __NEW_H__ -#define __NEW_H__ - -#include - -using std::new_handler; -using std::set_new_handler; - -#endif // __NEW_H__