This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
ios_base patch (make some functions protected)
- To: Benjamin Kosnik <bkoz@cygnus.com>
- Subject: ios_base patch (make some functions protected)
- From: Ryszard Kabatek <rysio@rumcajs.chemie.uni-halle.de>
- Date: Mon, 01 Feb 1999 12:14:18 +0100
- CC: libstdc++-v3@cygnus.com
- Organization: Martin-Luther-Universitaet Halle-Wittenberg
- Reply-To: kabatek@Chemie.UNI-Halle.DE
1999-02-01 Ryszard Kabatek <kabatek@chemie.uni-halle.de>
* bits/ios_base.h: Changes in the class ios_base:
Rename _M_exceptions member to _M_exceptions_data.
Make the member functions rdstate(), clear(), exceptions()
and exceptions(iostate) protected and add the "_M_" prefix.
* src/ios.cc: Ditto.
* bits/basic_ios.h: Adapt the changes from ios_base.
diff -c3p -r ../lib3-cvs/libstdc++/bits/basic_ios.h
libstdc++/bits/basic_ios.h
*** ../lib3-cvs/libstdc++/bits/basic_ios.h Tue Jan 26 10:07:18 1999
--- libstdc++/bits/basic_ios.h Mon Feb 1 12:33:45 1999
*************** namespace std {
*** 55,61 ****
operator void* () const
{ return fail() ? 0 : const_cast<basic_ios*>(this); }
bool operator! () const { return fail (); }
! iostate rdstate () const { return ios_base::rdstate (); }
void clear (iostate __state = goodbit);
void setstate (iostate __state);
bool good () const { return rdstate () == 0; }
--- 55,61 ----
operator void* () const
{ return fail() ? 0 : const_cast<basic_ios*>(this); }
bool operator! () const { return fail (); }
! iostate rdstate () const { return ios_base::_M_rdstate (); }
void clear (iostate __state = goodbit);
void setstate (iostate __state);
bool good () const { return rdstate () == 0; }
*************** namespace std {
*** 63,70 ****
bool fail () const { return (rdstate () & (badbit | failbit)) !=
0; }
bool bad () const { return (rdstate () & badbit) != 0; }
! iostate exceptions () const { return ios_base::exceptions(); }
! void exceptions (iostate __except) {
ios_base::exceptions(__except); }
// Constructor/destructor:
explicit basic_ios (basic_streambuf<_CharT,_Traits>* __sb);
--- 63,70 ----
bool fail () const { return (rdstate () & (badbit | failbit)) !=
0; }
bool bad () const { return (rdstate () & badbit) != 0; }
! iostate exceptions () const { return ios_base::_M_exceptions(); }
! void exceptions (iostate __except) {
ios_base::_M_exceptions(__except); }
// Constructor/destructor:
explicit basic_ios (basic_streambuf<_CharT,_Traits>* __sb);
*************** namespace std {
*** 112,118 ****
template <class _CharT, class _Traits>
void
basic_ios<_CharT,_Traits>::clear (iostate __state)
! { ios_base::clear ((rdbuf () == 0 ? __state|badbit : __state));
}
template <class _CharT, class _Traits>
void
--- 112,118 ----
template <class _CharT, class _Traits>
void
basic_ios<_CharT,_Traits>::clear (iostate __state)
! { ios_base::_M_clear ((rdbuf () == 0 ? __state|badbit :
__state)); }
template <class _CharT, class _Traits>
void
diff -c3p -r ../lib3-cvs/libstdc++/bits/ios_base.h
libstdc++/bits/ios_base.h
*** ../lib3-cvs/libstdc++/bits/ios_base.h Tue Jan 26 10:07:19 1999
--- libstdc++/bits/ios_base.h Mon Feb 1 12:32:10 1999
*************** namespace std {
*** 156,162 ****
private:
// Data members.
iostate _M_state;
! iostate _M_exceptions;
fmtflags _M_flags;
streamsize _M_precision;
streamsize _M_width;
--- 156,162 ----
private:
// Data members.
iostate _M_state;
! iostate _M_exceptions_data;
fmtflags _M_flags;
streamsize _M_precision;
streamsize _M_width;
*************** namespace std {
*** 179,197 ****
void _M_dispose_callbacks();
void _M_init();
void _M_copy_base(ios_base& __rhs);
!
! public:
! iostate rdstate() const { return _M_state; }
! void clear(iostate __state = goodbit);
! iostate exceptions () const
! { return _M_exceptions; }
! void exceptions(iostate __except)
{
! _M_exceptions = __except;
! this->clear(rdstate());
}
!
// 27.4.2.1.6 Class ios_base::Init
// Used to initialize standard streams. Not needed in this
implementation.
struct Init { Init() { } };
--- 179,195 ----
void _M_dispose_callbacks();
void _M_init();
void _M_copy_base(ios_base& __rhs);
! iostate _M_rdstate() const { return _M_state; }
! void _M_clear(iostate __state = goodbit);
! iostate _M_exceptions () const
! { return _M_exceptions_data; }
! void _M_exceptions(iostate __except)
{
! _M_exceptions_data = __except;
! this->_M_clear(_M_rdstate());
}
! public:
// 27.4.2.1.6 Class ios_base::Init
// Used to initialize standard streams. Not needed in this
implementation.
struct Init { Init() { } };
diff -c3p -r ../lib3-cvs/libstdc++/src/ios.cc libstdc++/src/ios.cc
*** ../lib3-cvs/libstdc++/src/ios.cc Tue Jan 26 10:07:21 1999
--- libstdc++/src/ios.cc Mon Feb 1 12:34:29 1999
*************** template class basic_ios<char>;
*** 46,55 ****
template class basic_ios<wchar_t>;
void
! ios_base::clear(iostate __state)
{
#if 0
! if ( ((_M_state = __state) & this->exceptions()) == 0)
{
#ifdef _G_USE_EXCEPTIONS
throw failure ("unmasked state event in basic_ios object");
--- 46,55 ----
template class basic_ios<wchar_t>;
void
! ios_base::_M_clear(iostate __state)
{
#if 0
! if ( ((_M_state = __state) & this->_M_exceptions()) == 0)
{
#ifdef _G_USE_EXCEPTIONS
throw failure ("unmasked state event in basic_ios object");
*************** ios_base::_M_grow_words(int ix)
*** 87,93 ****
catch (...)
{
_M_dummy = zero; // XXX MT? Not on "normal" machines.
! clear(rdstate () | badbit); // may throw
return _M_dummy;
}
do { words[i] = _M_words[i]; } while (++i < _M_word_limit);
--- 87,93 ----
catch (...)
{
_M_dummy = zero; // XXX MT? Not on "normal" machines.
! _M_clear(_M_rdstate () | badbit); // may throw
return _M_dummy;
}
do { words[i] = _M_words[i]; } while (++i < _M_word_limit);
*************** ios_base::_M_init() // called only by
*** 154,160 ****
_M_words = 0;
_M_word_limit = 0;
_M_state = goodbit;
! _M_exceptions = goodbit;
_M_locale = locale ();
// no init needed for _M_word_array or _M_dummy.
}
--- 154,160 ----
_M_words = 0;
_M_word_limit = 0;
_M_state = goodbit;
! _M_exceptions_data = goodbit;
_M_locale = locale ();
// no init needed for _M_word_array or _M_dummy.
}