aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/ext/ropeimpl.h
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/include/ext/ropeimpl.h')
-rw-r--r--libstdc++-v3/include/ext/ropeimpl.h141
1 files changed, 46 insertions, 95 deletions
diff --git a/libstdc++-v3/include/ext/ropeimpl.h b/libstdc++-v3/include/ext/ropeimpl.h
index cc4d7bc679e..8373538a539 100644
--- a/libstdc++-v3/include/ext/ropeimpl.h
+++ b/libstdc++-v3/include/ext/ropeimpl.h
@@ -1,3 +1,32 @@
+// SGI's rope class implementation -*- C++ -*-
+
+// Copyright (C) 2001 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 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.
+
/*
* Copyright (c) 1997
* Silicon Graphics Computer Systems, Inc.
@@ -15,23 +44,15 @@
* You should not attempt to use it directly.
*/
-# include <bits/std_cstdio.h>
-
-#ifdef __STL_USE_NEW_IOSTREAMS
-# include <iostream>
-#else /* __STL_USE_NEW_IOSTREAMS */
-# include <bits/std_iostream.h>
-#endif /* __STL_USE_NEW_IOSTREAMS */
+#include <bits/std_cstdio.h>
+#include <bits/std_iostream.h>
#ifdef __STL_USE_EXCEPTIONS
# include <bits/std_stdexcept.h>
#endif
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1174
-#endif
+namespace std
+{
// Set buf_start, buf_end, and buf_ptr appropriately, filling tmp_buf
// if necessary. Assumes _M_path_end[leaf_index] and leaf_pos are correct.
@@ -303,26 +324,16 @@ inline void _Rope_RopeRep<_CharT,_Alloc>::_M_free_c_string()
template <class _CharT, class _Alloc>
-#ifdef __STL_USE_STD_ALLOCATORS
inline void _Rope_RopeRep<_CharT,_Alloc>::_S_free_string(_CharT* __s,
size_t __n,
allocator_type __a)
-#else
- inline void _Rope_RopeRep<_CharT,_Alloc>::_S_free_string(_CharT* __s,
- size_t __n)
-#endif
{
if (!_S_is_basic_char_type((_CharT*)0)) {
destroy(__s, __s + __n);
}
// This has to be a static member, so this gets a bit messy
-# ifdef __STL_USE_STD_ALLOCATORS
__a.deallocate(
__s, _Rope_RopeLeaf<_CharT,_Alloc>::_S_rounded_up_size(__n));
-# else
- _Data_deallocate(
- __s, _Rope_RopeLeaf<_CharT,_Alloc>::_S_rounded_up_size(__n));
-# endif
}
@@ -375,13 +386,8 @@ void _Rope_RopeRep<_CharT,_Alloc>::_M_free_tree()
#else
template <class _CharT, class _Alloc>
-#ifdef __STL_USE_STD_ALLOCATORS
inline void _Rope_RopeRep<_CharT,_Alloc>::_S_free_string
(const _CharT*, size_t, allocator_type)
-#else
- inline void _Rope_RopeRep<_CharT,_Alloc>::_S_free_string
- (const _CharT*, size_t)
-#endif
{}
#endif
@@ -456,9 +462,7 @@ rope<_CharT,_Alloc>::_S_tree_concat (_RopeRep* __left, _RopeRep* __right)
_S_new_RopeConcatenation(__left, __right, __left->get_allocator());
size_t __depth = __result->_M_depth;
-# ifdef __STL_USE_STD_ALLOCATORS
__stl_assert(__left->get_allocator() == __right->get_allocator());
-# endif
if (__depth > 20 && (__result->_M_size < 1000 ||
__depth > _RopeRep::_S_max_rope_depth)) {
_RopeRep* __balanced;
@@ -791,22 +795,11 @@ class _Rope_find_char_char_consumer : public _Rope_char_consumer<_CharT> {
}
};
-#ifdef __STL_USE_NEW_IOSTREAMS
template<class _CharT, class _Traits>
// Here _CharT is both the stream and rope character type.
-#else
- template<class _CharT>
- // Here _CharT is the rope character type. Unlike in the
- // above case, we somewhat handle the case in which it doesn't
- // match the stream character type, i.e. char.
-#endif
class _Rope_insert_char_consumer : public _Rope_char_consumer<_CharT> {
private:
-# ifdef __STL_USE_NEW_IOSTREAMS
typedef basic_ostream<_CharT,_Traits> _Insert_ostream;
-# else
- typedef ostream _Insert_ostream;
-# endif
_Insert_ostream& _M_o;
public:
_Rope_insert_char_consumer(_Insert_ostream& __writer)
@@ -817,38 +810,15 @@ class _Rope_insert_char_consumer : public _Rope_char_consumer<_CharT> {
// Returns true to continue traversal.
};
-#ifdef __STL_USE_NEW_IOSTREAMS
- template<class _CharT, class _Traits>
- bool _Rope_insert_char_consumer<_CharT, _Traits>::operator()
- (const _CharT* __leaf, size_t __n)
- {
- size_t __i;
- // We assume that formatting is set up correctly for each element.
- for (__i = 0; __i < __n; __i++) _M_o.put(__leaf[__i]);
- return true;
- }
-
-#else
- template<class _CharT>
- bool _Rope_insert_char_consumer<_CharT>::operator()
- (const _CharT* __leaf, size_t __n)
- {
- size_t __i;
- // We assume that formatting is set up correctly for each element.
- for (__i = 0; __i < __n; __i++) _M_o << __leaf[__i];
- return true;
- }
-
-
- __STL_TEMPLATE_NULL
- inline bool _Rope_insert_char_consumer<char>::operator()
- (const char* __leaf, size_t __n)
- {
- size_t __i;
- for (__i = 0; __i < __n; __i++) _M_o.put(__leaf[__i]);
- return true;
- }
-#endif
+template<class _CharT, class _Traits>
+bool _Rope_insert_char_consumer<_CharT, _Traits>::operator()
+ (const _CharT* __leaf, size_t __n)
+{
+ size_t __i;
+ // We assume that formatting is set up correctly for each element.
+ for (__i = 0; __i < __n; __i++) _M_o.put(__leaf[__i]);
+ return true;
+}
template <class _CharT, class _Alloc>
bool rope<_CharT, _Alloc>::_S_apply_to_pieces(
@@ -908,12 +878,8 @@ bool rope<_CharT, _Alloc>::_S_apply_to_pieces(
}
}
-#ifdef __STL_USE_NEW_IOSTREAMS
template<class _CharT, class _Traits>
inline void _Rope_fill(basic_ostream<_CharT, _Traits>& __o, size_t __n)
-#else
- inline void _Rope_fill(ostream& __o, size_t __n)
-#endif
{
char __f = __o.fill();
size_t __i;
@@ -926,25 +892,15 @@ template <class _CharT> inline bool _Rope_is_simple(_CharT*) { return false; }
inline bool _Rope_is_simple(char*) { return true; }
inline bool _Rope_is_simple(wchar_t*) { return true; }
-#ifdef __STL_USE_NEW_IOSTREAMS
- template<class _CharT, class _Traits, class _Alloc>
- basic_ostream<_CharT, _Traits>& operator<<
- (basic_ostream<_CharT, _Traits>& __o,
- const rope<_CharT, _Alloc>& __r)
-#else
- template<class _CharT, class _Alloc>
- ostream& operator<< (ostream& __o, const rope<_CharT, _Alloc>& __r)
-#endif
+template<class _CharT, class _Traits, class _Alloc>
+basic_ostream<_CharT, _Traits>& operator<< (basic_ostream<_CharT, _Traits>& __o,
+ const rope<_CharT, _Alloc>& __r)
{
size_t __w = __o.width();
bool __left = bool(__o.flags() & ios::left);
size_t __pad_len;
size_t __rope_len = __r.size();
-# ifdef __STL_USE_NEW_IOSTREAMS
_Rope_insert_char_consumer<_CharT, _Traits> __c(__o);
-# else
- _Rope_insert_char_consumer<_CharT> __c(__o);
-# endif
bool __is_simple = _Rope_is_simple((_CharT*)0);
if (__rope_len < __w) {
@@ -1575,12 +1531,7 @@ inline void rotate(
}
# endif
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1174
-#endif
-
-__STL_END_NAMESPACE
+} // namespace std
// Local Variables:
// mode:C++