first commit

This commit is contained in:
Jose Caban
2025-06-07 11:34:38 -04:00
commit 0eb2d7c07d
4708 changed files with 1500614 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
/***************************************************************************
*
* rw/_algobase.c
*
* $Id: _algobase.c 580483 2007-09-28 20:55:52Z sebor $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
**************************************************************************/
#include <rw/_algobase.cc>

View File

@@ -0,0 +1,94 @@
/***************************************************************************
*
* _algobase.cc - Definitions of out-of-line C++ Standard Library algorithms
*
* $Id: _algobase.cc 550991 2007-06-26 23:58:07Z sebor $
*
***************************************************************************
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* 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. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
**************************************************************************/
_RWSTD_NAMESPACE (std) {
_EXPORT
template <class _InputIter1, class _InputIter2>
bool lexicographical_compare (_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _InputIter2 __last2)
{
_RWSTD_ASSERT_RANGE (__first1, __last1);
_RWSTD_ASSERT_RANGE (__first2, __last2);
for ( ; ; ++__first2, ++__first1) {
if (__first1 == __last1)
return !(__first2 == __last2);
if (__first2 == __last2 || *__first2 < *__first1)
break;
if (*__first1 < *__first2)
return true;
}
return false;
}
_EXPORT
template <class _InputIter1, class _InputIter2, class _Compare>
bool lexicographical_compare (_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _InputIter2 __last2,
_Compare __comp)
{
_RWSTD_ASSERT_RANGE (__first1, __last1);
_RWSTD_ASSERT_RANGE (__first2, __last2);
for ( ; ; ++__first2, ++__first1) {
if (__first1 == __last1)
return !(__first2 == __last2);
if (__first2 == __last2 || !(__comp (*__first2, *__first1) == false))
break;
if (!(__comp (*__first1, *__first2) == false))
return true;
}
return false;
}
} // namespace std

View File

@@ -0,0 +1,281 @@
/***************************************************************************
*
* _algobase.h - Declarations and inline definitions of frequently used
* C++ Standard Library algorithms
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _algobase.h 550991 2007-06-26 23:58:07Z sebor $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2005 Rogue Wave Software.
*
***************************************************************************
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* 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. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
**************************************************************************/
#ifndef _RWSTD_RW_ALGOBASE_H_INCLUDED
#define _RWSTD_RW_ALGOBASE_H_INCLUDED
#include <rw/_pair.h> // for pair
#include <rw/_iterbase.h> // for iterator_traits, __rw_debug_iter
_RWSTD_NAMESPACE (std) {
// 25.3.7, p1
template <class _TypeT>
inline const _TypeT& (min)(const _TypeT& __a, const _TypeT& __b)
{
return __b < __a ? __b : __a;
}
template <class _TypeT, class _Compare>
inline const _TypeT& (min)(const _TypeT& __a, const _TypeT& __b, _Compare __cmp)
{
return __cmp (__b, __a) ? __b : __a;
}
// 25.3.7, p3
template <class _TypeT>
inline const _TypeT& (max)(const _TypeT& __a, const _TypeT& __b)
{
return __a < __b ? __b : __a;
}
template <class _TypeT, class _Compare>
inline const _TypeT&
(max)(const _TypeT& __a, const _TypeT& __b, _Compare __cmp)
{
return !(__cmp (__a, __b) == false) ? __b : __a;
}
// 25.2.1, p1
template <class _InputIter, class _OutputIter>
inline _OutputIter
copy (_InputIter __first, _InputIter __last, _OutputIter __res)
{
_RWSTD_ASSERT_RANGE (__first, __last);
for (; !(__first == __last); ++__first,++__res)
*__res = *__first;
return __res;
}
// 25.2.1, p5
template <class _BidirIter1, class _BidirIter2>
inline _BidirIter2
copy_backward (_BidirIter1 __first, _BidirIter1 __last, _BidirIter2 __res)
{
_RWSTD_ASSERT_RANGE (__first, __last);
while (!(__first == __last))
*--__res = *--__last;
return __res;
}
// 25.2.5
template <class _FwdIter, class _TypeT>
inline void fill (_FwdIter __first, _FwdIter __last, const _TypeT &__val)
{
_RWSTD_ASSERT_RANGE (__first, __last);
for ( ; !(__first == __last); ++__first)
*__first = __val;
}
template <class _OutputIter, class _Size, class _TypeT>
inline void fill_n (_OutputIter __first, _Size __n, const _TypeT &__val)
{
// Size must be convertible to integral type but need not itself be one
// Complexity:
// Exactly n if n is positive, or 0 otherwise, assignments.
// (see lwg issue 426 for the complexity when n is not positive)
for (_RWSTD_PTRDIFF_T __inx = __n; 0 < __inx; --__inx, ++__first)
*__first = __val;
}
} // namespace std
_RWSTD_NAMESPACE (__rw) {
// `less than' function object - used by non-predicate forms
// of algorithms to invoke the predicate forms for code reuse
struct __rw_lt
{
template <class _TypeT, class _TypeU>
bool operator() (const _TypeT &__lhs, const _TypeU &__rhs) const {
// cast away constness in case operator<
// takes a non-const argument
return _RWSTD_CONST_CAST (_TypeT&, __lhs)
< _RWSTD_CONST_CAST (_TypeU&, __rhs);
}
};
# define _RWSTD_LESS(ignore) _RW::__rw_lt ()
// swaps values of 2 (possibly distinct) types
template <class _TypeT, class _TypeU>
inline void __rw_swap (_TypeT& __a, _TypeU& __b)
{
// _TypeT must satisfy Assignable and CopyConstructible
_TypeT __tmp = __a;
__a = __b;
__b = __tmp;
}
} // namespace __rw
_RWSTD_NAMESPACE (std) {
// 25.2.2, p1
template <class _TypeT>
inline void swap (_TypeT& __a, _TypeT& __b)
{
// lwg issue 227 - _TypeT must satisfy Assignable and CopyConstructible
_TypeT __tmp = __a;
__a = __b;
__b = __tmp;
}
// 25.2.2, p7
template <class _FwdIter1, class _FwdIter2>
inline void iter_swap (_FwdIter1 __a, _FwdIter2 __b)
{
// std::iterator_traits<_FwdIter[12]>::value_type must satisfy
// both Assignable and CopyConstructible
#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
// accommodate _FwdIter::operator*() that returns an rvalue that
// doesn't bind to a non-const reference e.g., vector<bool>::reference
_TYPENAME iterator_traits<_FwdIter1>::reference __ref1 (*__a);
_TYPENAME iterator_traits<_FwdIter2>::reference __ref2 (*__b);
_RW::__rw_swap (__ref1, __ref2);
#else // if defined (_RWSTD_NO_CLASS_PARTIAL_SPEC)
// the return type of std::iterator_traits<_FwdIter>::operator*()
// must be (convertible to) a true reference (i.e., value_type&)
_RW::__rw_swap (*__a, *__b);
#endif // _RWSTD_NO_CLASS_PARTIAL_SPEC
}
// 25.1.7 - Mismatch
template <class _InputIter1, class _InputIter2>
inline pair<_InputIter1, _InputIter2>
mismatch (_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2)
{
_RWSTD_ASSERT_RANGE (__first1, __last1);
while (!(__first1 == __last1) && *__first1 == *__first2) {
++__first1;
++__first2;
}
return pair<_InputIter1, _InputIter2> (__first1, __first2);
}
template <class _InputIter1, class _InputIter2, class _BinaryPredicate>
inline pair<_InputIter1, _InputIter2>
mismatch (_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _BinaryPredicate __pred)
{
_RWSTD_ASSERT_RANGE (__first1, __last1);
while ( !(__first1 == __last1)
&& !(__pred (*__first1, *__first2) == false)) {
++__first1;
++__first2;
}
return pair<_InputIter1, _InputIter2> (__first1, __first2);
}
// 25.1.8 - Equal
template <class _InputIter1, class _InputIter2>
inline bool
equal (_InputIter1 __first1, _InputIter1 __last1, _InputIter2 __first2)
{
return __last1 == _STD::mismatch (__first1, __last1, __first2).first;
}
template <class _InputIter1, class _InputIter2, class _BinaryPredicate>
inline bool equal (_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _BinaryPredicate __pred)
{
return __last1 == _STD::mismatch (__first1, __last1,
__first2, __pred).first;
}
// 25.3.8 - Lexicographical Comparison
_EXPORT
template <class _InputIter1, class _InputIter2>
bool lexicographical_compare (_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _InputIter2 __last2);
_EXPORT
template <class _InputIter1, class _InputIter2, class _Compare>
bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _InputIter2 __last2,
_Compare __comp);
} // namespace std
#ifdef _RWSTD_NO_IMPLICIT_INCLUSION
# include <rw/_algobase.cc>
#endif // _RWSTD_NO_IMPLICIT_INCLUSION
#endif // _RWSTD_RW_ALGOBASE_H_INCLUDED

View File

@@ -0,0 +1,402 @@
// -*- C++ -*-
/***************************************************************************
*
* _allocator.h - definition of the class template allocator
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _allocator.h 614913 2008-01-24 16:22:31Z faridz $
*
***************************************************************************
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* 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. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
**************************************************************************/
#ifndef _RWSTD_RW_ALLOCATOR_H_INCLUDED
#define _RWSTD_RW_ALLOCATOR_H_INCLUDED
#ifndef _RWSTD_SPECIALIZED_H_INCLUDED
# include <rw/_specialized.h>
#endif // _RWSTD_SPECIALIZED_H_INCLUDED
_RWSTD_NAMESPACE (__rw) {
// [de]allocate storage (in bytes)
_RWSTD_EXPORT void* __rw_allocate (_RWSTD_SIZE_T, int = 0);
_RWSTD_EXPORT void __rw_deallocate (void*, _RWSTD_SIZE_T, int = 0);
} // namespace __rw
_RWSTD_NAMESPACE (std) {
template <class _TypeT> class
allocator;
_RWSTD_SPECIALIZED_CLASS
class allocator<void>
{
public:
typedef void value_type;
typedef value_type* pointer;
typedef const value_type* const_pointer;
#ifdef _RWSTD_ALLOCATOR
template <class _TypeU>
struct rebind {
typedef allocator<_TypeU> other;
};
#endif // _RWSTD_ALLOCATOR
};
template <class _TypeT>
class allocator
{
public:
typedef _RWSTD_SIZE_T size_type;
typedef _RWSTD_PTRDIFF_T difference_type;
typedef _TypeT value_type;
typedef value_type* pointer;
typedef const value_type* const_pointer;
typedef value_type& reference;
typedef const value_type& const_reference;
allocator () _THROWS (()) { }
allocator (const allocator &__rhs) _THROWS (()) {
// working around an HP aCC warning 431
_RWSTD_UNUSED (__rhs);
}
#ifdef _RWSTD_ALLOCATOR
template <class _TypeU>
struct rebind {
typedef allocator<_TypeU> other;
};
template <class _TypeU>
allocator (const allocator<_TypeU>&) _THROWS (()) { }
template <class _TypeU>
allocator&
operator= (const allocator<_TypeU>&) _THROWS (()) {
return *this;
}
#endif // _RWSTD_ALLOCATOR
pointer address (reference __x) const {
// lwg issue 350
return _RWSTD_REINTERPRET_CAST (pointer,
&_RWSTD_REINTERPRET_CAST (char&, __x));
}
const_pointer address (const_reference __x) const {
// lwg issue 350
return _RWSTD_REINTERPRET_CAST (const_pointer,
&_RWSTD_REINTERPRET_CAST (const char&, __x));
}
pointer allocate (size_type __n, allocator<void>::const_pointer = 0) {
#ifdef _RWSTD_ALLOCATOR
return _RWSTD_STATIC_CAST (pointer,
_RW::__rw_allocate (__n * sizeof (value_type)));
#else
return _RWSTD_STATIC_CAST (pointer, _RW::__rw_allocate (__n));
#endif // _RWSTD_ALLOCATOR
}
#ifdef _RWSTD_ALLOCATOR
void deallocate (pointer __p, size_type __n)
#else
void deallocate (void* __p, size_type __n)
#endif // _RWSTD_ALLOCATOR
{
_RW::__rw_deallocate (__p, __n);
}
// 20.4.1.1, p11 - the largest N for which allocate (N) might succeed
size_type max_size () const _THROWS (()) {
return size_type (_RWSTD_SIZE_MAX) / sizeof (value_type)
? size_type (size_type (_RWSTD_SIZE_MAX) / sizeof (value_type))
: size_type (1);
}
void construct (pointer __p, const_reference __val) {
_RW::__rw_construct (__p, __val);
}
void destroy (pointer __p) {
_RWSTD_ASSERT (0 != __p);
__p->~_TypeT ();
}
};
#if !defined (_RWSTD_NO_CLASS_PARTIAL_SPEC) \
&& !defined (_RWSTD_NO_EXT_CONST_ALLOCATOR)
// extension: allocates/constructs/destroys const elements
template <class _TypeT>
class allocator<const _TypeT>
{
public:
typedef _RWSTD_SIZE_T size_type;
typedef _RWSTD_PTRDIFF_T difference_type;
typedef const _TypeT value_type;
typedef const value_type* pointer;
typedef const value_type* const_pointer;
typedef const value_type& reference;
typedef const value_type& const_reference;
allocator () _THROWS (()) { }
allocator (const allocator &__rhs) _THROWS (()) {
// working around an HP aCC warning 431
_RWSTD_UNUSED (__rhs);
}
#ifdef _RWSTD_ALLOCATOR
template <class _TypeU>
struct rebind {
typedef allocator<_TypeU> other;
};
template <class _TypeU>
allocator (const allocator<_TypeU>&) _THROWS (()) { }
template <class _TypeU>
allocator& operator= (const allocator<_TypeU>&) _THROWS (()) {
return *this;
}
#endif // _RWSTD_ALLOCATOR
const_pointer address (const_reference __x) const {
// lwg issue 350
return _RWSTD_REINTERPRET_CAST (const_pointer,
&_RWSTD_REINTERPRET_CAST (const char&, __x));
}
// avoid the use of allocator<void>::const_pointer below
// to work around a SunPro 5.3 (and prior) bug
const_pointer allocate (size_type __n, const void* = 0) {
#ifdef _RWSTD_ALLOCATOR
return _RWSTD_STATIC_CAST (const_pointer,
_RWSTD_CONST_CAST (const void*,
_RW::__rw_allocate (__n * sizeof (value_type))));
#else
return _RWSTD_STATIC_CAST (const_pointer,
_RWSTD_CONST_CAST (const void*,
_RW::__rw_allocate (__n)));
#endif // _RWSTD_ALLOCATOR
}
#ifdef _RWSTD_ALLOCATOR
void deallocate (const_pointer __p, size_type __nelems) {
_RW::__rw_deallocate (_RWSTD_CONST_CAST (_TypeT*, __p), __nelems);
}
#else
void deallocate (const void* __p, size_type __nbytes) {
_RW::__rw_deallocate (_RWSTD_CONST_CAST (void*, __p), __nbytes);
}
#endif // _RWSTD_ALLOCATOR
// 20.4.1.1, p11 - the largest N for which allocate (N) might succeed
size_type max_size () const _THROWS (()) {
return size_type (_RWSTD_SIZE_MAX) / sizeof (value_type)
? size_type (size_type (_RWSTD_SIZE_MAX) / sizeof (value_type))
: size_type (1);
}
void construct (const_pointer __p, const_reference __val) {
_RW::__rw_construct (_RWSTD_CONST_CAST (_TypeT*, __p), __val);
}
void destroy (const_pointer __p) {
_RWSTD_ASSERT (0 != __p);
__p->~_TypeT ();
}
};
#endif // !_RWSTD_NO_CLASS_PARTIAL_SPEC && !_RWSTD_NO_EXT_CONST_ALLOCATOR)
// allocator_interface provides all types and typed functions. Memory
// allocated as raw bytes using the class provided by the Allocator
// template parameter. allocator_interface casts appropriately.
//
// Multiple allocator_interface objects can attach to a single
// allocator, thus allowing one allocator to allocate all storage
// for a container, regardless of how many types are involved.
//
// The only real restriction is that pointer and reference are
// hard coded as _TypeT* and _TypeT&. Partial specialization would
// get around this.
//
#ifndef _RWSTD_ALLOCATOR
template <class _Allocator, class _TypeT>
class allocator_interface
{
public:
typedef _Allocator allocator_type;
typedef _TypeT value_type;
typedef value_type* pointer;
typedef const value_type* const_pointer;
typedef value_type& reference;
typedef const value_type& const_reference;
typedef _TYPENAME allocator_type::size_type size_type;
typedef _TYPENAME allocator_type::difference_type difference_type;
protected:
allocator_type _C_alloc;
public:
allocator_interface() _THROWS (()) { }
allocator_interface (const allocator_type &__alloc) _THROWS (())
: _C_alloc (__alloc) { }
operator allocator_type& () {
return _C_alloc;
}
pointer address (reference __x) const {
// lwg issue 350
return _RWSTD_REINTERPRET_CAST (pointer,
&_RWSTD_REINTERPRET_CAST (char&, __x));
}
const_pointer address (const_reference __x) const {
// lwg issue 350
return _RWSTD_REINTERPRET_CAST (const_pointer,
&_RWSTD_REINTERPRET_CAST (const char&, __x));
}
size_type max_size () const {
return _C_alloc.max_size () / sizeof (value_type);
}
pointer allocate (size_type __n, const void* __p = 0) {
return (pointer)_C_alloc.allocate (__n * sizeof (value_type), __p);
}
void deallocate (pointer __p, size_type __n) {
_C_alloc.deallocate (__p, __n);
}
void construct (pointer __p, const_reference __val) {
_RW::__rw_construct(__p, __val);
}
void destroy (pointer __p) const {
_RWSTD_ASSERT (0 != __p);
__p->~_TypeT ();
}
};
_RWSTD_SPECIALIZED_CLASS
class allocator_interface<allocator<void>, void>
{
public:
typedef allocator<void> allocator_type;
typedef void* pointer;
typedef const void* const_pointer;
typedef void value_type;
protected:
allocator_type _C_alloc;
public:
allocator_interface () _THROWS (()) { }
allocator_interface (const allocator<void>& __rhs) _THROWS (())
: _C_alloc (__rhs) { }
};
template <class _TypeT, class _TypeU, class _TypeV, class _TypeW>
inline bool
operator== (const allocator_interface<_TypeT, _TypeU>&,
const allocator_interface<_TypeV, _TypeW>&) _THROWS (())
{
return true;
}
#endif // _RWSTD_ALLOCATOR
template <class _TypeT, class _TypeU>
inline bool
operator== (const allocator<_TypeT>&, const allocator<_TypeU>&) _THROWS (())
{
return true;
}
#ifndef _RWSTD_NO_NAMESPACE
template <class _TypeT, class _TypeU>
inline bool
operator!= (const allocator<_TypeT>& __x,
const allocator<_TypeU>& __y) _THROWS (())
{
return !(__x == __y);
}
#endif // _RWSTD_NO_NAMESPACE
} // namespace std
#endif // _RWSTD_RW_ALLOCATOR_H_INCLUDED

230
extern/stdcxx/4.2.1/include/rw/_array.h vendored Normal file
View File

@@ -0,0 +1,230 @@
/***************************************************************************
*
* _array.h - Declarations for the Standard Library __rw_array
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _array.h 648752 2008-04-16 17:01:56Z faridz $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 2000-2006 Rogue Wave Software.
*
**************************************************************************/
#ifndef _RWSTD_RW_ARRAY_H_INCLUDED
#define _RWSTD_RW_ARRAY_H_INCLUDED
#ifndef _RWSTD_RW_SPECIALIZED_H_INCLUDED
# include <rw/_specialized.h>
#endif // _RWSTD_RW_SPECIALIZED_H_INCLUDED
_RWSTD_NAMESPACE (__rw) {
template <class _TypeT>
class __rw_array
{
public:
typedef _RWSTD_SIZE_T size_type;
typedef _TypeT value_type;
typedef value_type* pointer;
typedef value_type& reference;
typedef const value_type* const_pointer;
typedef const value_type& const_reference;
__rw_array ()
: _C_size (0),
_C_data (0) { }
// allocate but do not initialize
__rw_array (size_type);
// allocate and initialize from value
__rw_array (const_reference, size_type);
// allocate and initialize from an array
__rw_array (const_pointer, size_type);
__rw_array (const __rw_array&);
~__rw_array ();
__rw_array& operator= (const __rw_array&);
size_type size () const {
return _C_size;
}
const_reference operator[] (size_type __inx) const {
_RWSTD_ASSERT (__inx < size ());
return _C_data [__inx];
}
reference operator[] (size_type __inx) {
_RWSTD_ASSERT (__inx < size ());
return _C_data [__inx];
}
void swap (__rw_array&);
pointer begin () {
return _C_data;
}
const_pointer begin () const {
return _C_data;
}
pointer end () {
return _C_data + _C_size;
}
const_pointer end () const {
return _C_data + _C_size;
}
void resize (size_type, const_reference = value_type ());
private:
size_type _C_size; // number of elements
pointer _C_data; // array of elements
};
template <class _TypeT>
inline __rw_array<_TypeT>::__rw_array (size_type __n)
{
if (__n)
_C_data = _RWSTD_STATIC_CAST (pointer,
::operator new (__n * sizeof *_C_data));
else
_C_data = 0;
_C_size = __n;
}
template <class _TypeT>
inline __rw_array<_TypeT>::__rw_array (const_reference __val, size_type __n)
{
if (__n) {
_C_data = _RWSTD_STATIC_CAST (pointer,
::operator new (__n * sizeof *_C_data));
_STD::uninitialized_fill_n (_C_data, __n, __val);
}
else
_C_data = 0;
_C_size = __n;
}
template <class _TypeT>
inline __rw_array<_TypeT>::__rw_array (const_pointer __data, size_type __n)
{
if (__n) {
_C_data = _RWSTD_STATIC_CAST (pointer,
::operator new (__n * sizeof *_C_data));
_STD::uninitialized_copy (__data, __data + __n, _C_data);
}
else
_C_data = 0;
_C_size = __n;
}
template <class _TypeT>
inline __rw_array<_TypeT>::__rw_array (const __rw_array<_TypeT> &__rhs)
: _C_size (__rhs.size ())
{
if (__rhs.size ()) {
_C_data = _RWSTD_STATIC_CAST (pointer,
::operator new (_C_size * sizeof *_C_data));
_STD::uninitialized_copy (__rhs.begin (), __rhs.end (), begin ());
}
else
_C_data = 0;
}
template <class _TypeT>
inline __rw_array<_TypeT>&
__rw_array<_TypeT>::operator= (const __rw_array<_TypeT> &__rhs)
{
if (__rhs.size () == size ())
// do not allocate, just copy for efficiency
_STD::copy (__rhs.begin (), __rhs.end (), begin ());
else
// allocate and copy into a temporary, then swap
__rw_array <_TypeT> (__rhs).swap (*this);
return *this;
}
template <class _TypeT>
inline
__rw_array<_TypeT>::
~__rw_array ()
{
__rw_destroy (_C_data, _C_data + _C_size);
::operator delete (_C_data);
}
template <class _TypeT>
inline void __rw_array<_TypeT>::swap (__rw_array<_TypeT> &__rhs)
{
pointer __tmp_data = begin ();
size_type __tmp_size = size ();
_C_data = __rhs.begin ();
_C_size = __rhs.size ();
__rhs._C_data = __tmp_data;
__rhs._C_size = __tmp_size;
}
template <class _TypeT>
inline void __rw_array<_TypeT>::
resize (size_type __size, const_reference __val /* = value_type () */)
{
if (_C_data) {
__rw_destroy (_C_data, _C_data + _C_size);
::operator delete (_C_data);
_C_data = 0;
}
if ((_C_size = __size)) {
_C_data = _RWSTD_STATIC_CAST (pointer,
::operator new (_C_size * sizeof *_C_data));
_STD::uninitialized_fill_n (_C_data, _C_size, __val);
}
}
} // namespace __rw
#endif // _RWSTD_RW_ARRAY_H_INCLUDED

View File

@@ -0,0 +1,243 @@
// -*- C++ -*-
/***************************************************************************
*
* _autoptr.h - definition of the class template auto_ptr
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _autoptr.h 448928 2006-09-22 13:43:18Z faridz $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
**************************************************************************/
#ifndef _RWSTD_RW_AUTOPTR_H_INCLUDED
#define _RWSTD_RW_AUTOPTR_H_INCLUDED
#ifndef _RWSTD_RW_DEFS_H_INCLUDED
# include <rw/_defs.h>
#endif // _RWSTD_RW_DEFS_H_INCLUDED
_RWSTD_NAMESPACE (__rw) {
template <class _TypeT>
struct __rw_nonvoid_ref
{
typedef _TypeT& _C_ref;
};
_RWSTD_SPECIALIZED_CLASS
struct __rw_nonvoid_ref<void>
{
// makes the declaration of auto_ptr<void>::operator*() well-formed
// (the function definition itself may still be ill-formed and must
// not be instantiated)
typedef void _C_ref;
};
#ifndef _RWSTD_NO_CV_VOID_SPECIALIZATIONS
_RWSTD_SPECIALIZED_CLASS
struct __rw_nonvoid_ref<const void>
{
typedef void _C_ref;
};
_RWSTD_SPECIALIZED_CLASS
struct __rw_nonvoid_ref<volatile void>
{
typedef void _C_ref;
};
_RWSTD_SPECIALIZED_CLASS
struct __rw_nonvoid_ref<const volatile void>
{
typedef void _C_ref;
};
#endif // _RWSTD_NO_CV_VOID_SPECIALIZATIONS
} // namespace __rw
_RWSTD_NAMESPACE (std) {
// 20.4.5 - Template class auto_ptr
template <class _TypeT>
class auto_ptr;
// 20.4.5, p2 (defined outside of auto_ptr<> according to the proposed
// resolution of lwg issue 127)
template <class _TypeT>
class auto_ptr_ref
{
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
template <class _TypeU>
friend class auto_ptr;
// implicit conversion from auto_ptr<U> available only
// if U* is implicitly convertible to T* (via inheritance)
template <class _TypeU>
auto_ptr_ref (auto_ptr<_TypeU>& __rhs, const _TypeU* = 0) _THROWS (())
: _C_ptr (_RWSTD_REINTERPRET_CAST (auto_ptr<_TypeT>&, __rhs)) { }
#else // if defined (_RWSTD_NO_MEMBER_TEMPLATES)
public:
// useless, auto_ptr_ref necessary only for auto_ptr conversions
auto_ptr_ref (auto_ptr<_TypeT>& __rhs, const _TypeT* = 0) _THROWS (())
: _C_ptr (__rhs) { }
#endif // _RWSTD_NO_MEMBER_TEMPLATES
// reference to the owning auto_ptr object
auto_ptr<_TypeT>& _C_ptr;
};
template<class _TypeT>
class auto_ptr
{
public:
typedef _TypeT element_type;
// 20.4.5.1, p1
_EXPLICIT auto_ptr (element_type* __p = 0) _THROWS (())
: _C_ptr (__p) { }
// 20.4.5.1, p2
auto_ptr (auto_ptr& __rhs) _THROWS (())
: _C_ptr (__rhs.release ()) { }
// 20.4.5.1, p7
auto_ptr& operator= (auto_ptr& __rhs) _THROWS (()) {
reset (__rhs.release ());
return *this;
}
// 20.4.5.1, p13
~auto_ptr () _THROWS (()) {
delete _C_ptr;
}
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
// 20.4.5.1, p4
template <class _TypeU>
auto_ptr (auto_ptr<_TypeU>& __rhs) _THROWS (())
: _C_ptr (__rhs.release ()) { }
// 20.4.5.1, p10
template <class _TypeU>
auto_ptr& operator= (auto_ptr<_TypeU>& __rhs) _THROWS (()) {
reset (__rhs.release ());
return *this;
}
// 20.4.5.3, p3
template <class _TypeU>
operator auto_ptr_ref<_TypeU>() _THROWS (()) {
// convertible only if T* is implicitly convertible to U*
return auto_ptr_ref<_TypeU>(*this, _C_ptr);
}
// 20.4.5.3, p4
template <class _TypeU>
operator auto_ptr<_TypeU>() _THROWS (()) {
return auto_ptr<_TypeU>(release ());
}
#else // if defined (_RWSTD_NO_MEMBER_TEMPLATES)
// 20.4.5.3, p3 (limited to T == U)
operator auto_ptr_ref<_TypeT>() _THROWS (()) {
return auto_ptr_ref<_TypeT>(*this, _C_ptr);
}
#endif // _RWSTD_NO_MEMBER_TEMPLATES
// 20.4.5.2, p1
_TYPENAME _RW::__rw_nonvoid_ref<element_type>::_C_ref
operator* () const _THROWS (()) {
_RWSTD_ASSERT (0 != get ());
return *get ();
}
#ifndef _RWSTD_NO_NONCLASS_ARROW_RETURN
// 20.4.5.2, p3
element_type* operator->() const _THROWS (()) {
// avoid using the _RWSTD_OPERATOR_ARROW() helper macro
// (defined in terms of operator*()) in order to permit
// auto_ptr<void>::operator->() to be instantiated
return _C_ptr;
}
#endif // _RWSTD_NO_NONCLASS_ARROW_RETURN
// 20.4.5.2, p4
element_type* get () const _THROWS (()) {
return _C_ptr;
}
// 20.4.5.2, p5
element_type* release () _THROWS (()) {
element_type* __tmp = _C_ptr;
_C_ptr = 0;
return __tmp;
}
// 20.4.5.2, p7
void reset (element_type* __p = 0) _THROWS (()) {
if (_C_ptr != __p) {
delete _C_ptr;
_C_ptr = __p;
}
}
// 20.4.5.3, p1
auto_ptr (auto_ptr_ref<element_type> __r) _THROWS (())
: _C_ptr (__r._C_ptr.release ()) { }
// 20.4.5.3, p? - follows lwg issue 127
auto_ptr& operator= (auto_ptr_ref<element_type> __rhs) _THROWS (()) {
reset (__rhs._C_ptr.release ());
return *this;
}
private:
element_type* _C_ptr;
};
} // namespace std
#endif // _RWSTD_RW_AUTOPTR_H_INCLUDED

View File

@@ -0,0 +1,29 @@
/***************************************************************************
*
* rw/_basic_ios.c
*
* $Id: _basic_ios.c 580483 2007-09-28 20:55:52Z sebor $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
**************************************************************************/
#include <rw/_basic_ios.cc>

View File

@@ -0,0 +1,56 @@
/***************************************************************************
*
* _basic_ios.cc - definitions of basic_ios members
*
* $Id: _basic_ios.cc 550991 2007-06-26 23:58:07Z sebor $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
**************************************************************************/
_RWSTD_NAMESPACE (std) {
#ifdef _RWSTD_NO_UNDEFINED_TEMPLATES
template <class _CharT, class _Traits>
basic_ios<_CharT, _Traits>::
basic_ios (const basic_ios<_CharT, _Traits>&)
{
_RWSTD_ASSERT (!"not callable");
}
template <class _CharT, class _Traits>
basic_ios<_CharT, _Traits>&
basic_ios<_CharT, _Traits>::
operator= (const basic_ios<_CharT, _Traits>&)
{
_RWSTD_ASSERT (!"not callable");
return *this;
}
#endif // _RWSTD_NO_UNDEFINED_TEMPLATES
} // namespace std

View File

@@ -0,0 +1,367 @@
// -*- C++ -*-
/***************************************************************************
*
* _basic_ios.h - definition of the class template basic_ios
*
* $Id: _basic_ios.h 637130 2008-03-14 15:16:33Z faridz $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
**************************************************************************/
#ifndef _RWSTD_RW_BASIC_IOS_H_INCLUDED
#define _RWSTD_RW_BASIC_IOS_H_INCLUDED
#if __GNUG__ >= 3
# pragma GCC system_header
#endif // gcc >= 3
#ifndef _RWSTD_NO_REDUNDANT_DEFINITIONS
# include <streambuf>
#endif // _RWSTD_NO_REDUNDANT_DEFINITIONS
#include <loc/_ctype.h> // for ctype
#ifndef _RWSTD_RW_IOSBASE_H_INCLUDED
# include <rw/_iosbase.h> // for ios_base
#endif // _RWSTD_RW_IOSBASE_H_INCLUDED
#ifndef _RWSTD_RW_IOSFWD_H_INCLUDED
# include <rw/_iosfwd.h>
#endif // _RWSTD_RW_IOSFWD_H_INCLUDED
_RWSTD_NAMESPACE (std) {
#ifndef _RWSTD_IOSFWD_INCLUDED
_EXPORT
template <class _CharT, class _Traits = char_traits<_CharT> >
class basic_ios;
typedef basic_ios<char> ios;
# ifndef _RWSTD_NO_WCHAR_T
typedef basic_ios<wchar_t> wios;
# endif // _RWSTD_NO_WCHAR_T
#endif // _RWSTD_IOSFWD_INCLUDED
_EXPORT
template <class _CharT, class _Traits>
class basic_ios: public ios_base
{
public:
typedef _CharT char_type;
typedef _Traits traits_type;
typedef _TYPENAME traits_type::int_type int_type;
typedef _TYPENAME traits_type::pos_type pos_type;
typedef _TYPENAME traits_type::int_type off_type;
protected:
typedef basic_streambuf<char_type, traits_type> streambuf_type;
typedef basic_ostream<char_type, traits_type> ostream_type;
public:
// 27.4.4.1, p1 - NOTE: `sb' may point to a yet uninitialized
// object; it is unsafe to reference any of its members
_EXPLICIT basic_ios (streambuf_type *__sb) {
init (__sb);
}
// 27.4.4.3, p1
#ifndef _RWSTD_NO_EXT_IOS_SAFE_CONVERSION
private:
# if !defined (__INTEL_COMPILER) || !defined (_WIN32)
// SunPro 5.7 needs a data pointer and misoptimizes the conversion
// operator when this is a pointer to a member function (bug #446)
struct _C_uniq_type { int _C_foo; /* never used */ };
typedef int _C_uniq_type::*_C_uniq_ptr;
# else // if __INTEL_COMPILER && _WIN32
// working around Intel C++ 8.1 -Zi bug #570 on Win32
struct _C_uniq_type { void _C_foo () { }; /* never used */ };
typedef void (_C_uniq_type::*_C_uniq_ptr)();
# endif // __INTEL_COMPILER/_WIN32
public:
operator _C_uniq_ptr () const {
return fail () ? _C_uniq_ptr (0) : &_C_uniq_type::_C_foo;
}
#else // if defined (_RWSTD_NO_EXT_IOS_SAFE_CONVERSION)
operator void*() const {
return fail () ? (void*)0 : (void*)1;
}
#endif // _RWSTD_NO_EXT_IOS_SAFE_CONVERSION
// 27.4.4.3, p2
bool operator! () const {
return fail ();
}
// 27.4.4.3, p3
iostate rdstate () const {
return iostate (_C_state);
}
// 27.4.4.3, p4
void clear (iostate __state = goodbit) {
_C_set (__state, _C_except, rdbuf ());
}
// 27.4.4.3, p6
void setstate (iostate __st) {
clear (rdstate () | __st);
}
// 27.4.4.3, p7
bool good () const {
return goodbit == rdstate ();
}
// 27.4.4.3, p8
bool eof () const {
return 0 != (rdstate () & eofbit);
}
// 27.4.4.3, p9
bool fail () const {
return 0 != (rdstate () & (failbit | badbit));
}
// 27.4.4.3, p10
bool bad () const {
return 0 != (rdstate () & badbit);
}
// 27.4.4.3, p11
iostate exceptions () const {
return iostate (_C_except);
}
// 27.4.4.3, p12
void exceptions (iostate __state) {
_C_set (rdstate (), __state, rdbuf ());
}
// 27.4.4.2, p1
ostream_type* tie () const {
return _C_usr ? _RWSTD_STATIC_CAST (ostream_type*, _C_tie ()) : 0;
}
// 27.4.4.2, p2
ostream_type* tie (ostream_type *__strm) {
return _RWSTD_STATIC_CAST (ostream_type*, _C_tie (__strm));
}
// 27.4.4.2, p4 - NOTE: the pointer returned from rdbuf() in derived
// classes may be different from the one passed to rdbuf (streambuf_type*)
streambuf_type* rdbuf () const {
return _RWSTD_STATIC_CAST (streambuf_type*, _C_rdbuf);
}
// 27.4.4.2, p5
streambuf_type* rdbuf (streambuf_type *__rdbuf) {
return _RWSTD_STATIC_CAST (streambuf_type*,
_C_set (goodbit, _C_except, __rdbuf));
}
// 27.4.4.2, p15
basic_ios& copyfmt (const basic_ios &__x) {
return _C_copyfmt (__x, &_C_fill, &__x._C_fill, sizeof _C_fill), *this;
}
// 27.4.4.2, p12
char_type fill () const;
// 27.4.4.2, p13
char_type fill (char_type);
// 27.4.4.2, p8
locale imbue (const locale&);
// 27.4.4.2, p10
char narrow (char_type __c, char __dflt) const {
return _USE_FACET (ctype<char_type>, getloc ()).narrow (__c, __dflt);
}
// 27.4.4.2, p11
char_type widen (char __c) const {
return _USE_FACET (ctype<char_type>, getloc ()).widen (__c);
}
protected:
// initialization of standard iostream objects may depend on
// the default ctor not to re-initialize the object
basic_ios () { /* no-op as per 27.4.4.1, p2 */ }
// 27.4.4.1, p3
void init (streambuf_type*);
// (conditionally) returns a pointer to a mutex in the associated
// basic_streambuf object
_RW::__rw_mutex* _C_bufmutex () const;
private:
basic_ios (const basic_ios&); // not defined
basic_ios& operator= (const basic_ios&); // not defined
int_type _C_fill; // fill character (space by default)
};
template<class _CharT, class _Traits>
inline _TYPENAME basic_ios<_CharT, _Traits>::char_type
basic_ios<_CharT, _Traits>::fill () const
{
// delayed initialization used to allow objects of stream types other
// than those whose char_type is char or wchar_t to be successfully
// constructed even if the global locale doesn't contain a ctype facet
// specialized on the stream type's char_type
if (traits_type::eq_int_type (traits_type::eof (), _C_fill))
_RWSTD_CONST_CAST (basic_ios*, this)->fill (widen (' '));
return traits_type::to_char_type (_C_fill);
}
template<class _CharT, class _Traits>
inline _TYPENAME basic_ios<_CharT, _Traits>::char_type
basic_ios<_CharT, _Traits>::fill (char_type __ch)
{
// convert to int type before swapping
const int_type __c = traits_type::to_int_type (__ch);
_RWSTD_MT_GUARD (flags () & _RWSTD_IOS_NOLOCK ? 0 : &_C_mutex);
// save the previous value of the fill character
traits_type::assign (__ch, traits_type::to_char_type (_C_fill));
_C_fill = __c;
return __ch;
}
template<class _CharT, class _Traits>
inline locale
basic_ios<_CharT, _Traits>::imbue (const locale& __loc)
{
_RWSTD_MT_GUARD (flags () & _RWSTD_IOS_NOLOCK ? 0 : &_C_mutex);
const locale __tmp = _C_unsafe_imbue (__loc);
if (rdbuf ())
rdbuf ()->pubimbue (__loc);
return __tmp;
}
template<class _CharT, class _Traits>
inline void
basic_ios<_CharT, _Traits>::init (streambuf_type *__sb)
{
// invalidate the fill character
// the character will be initialized the first time fill() is called
// so that objects of stream types other than those specialized on char
// and wchar_t can be successfully constructed even if the global locale
// doesn't contain a ctype facet specialized on the stream type's
// char_type
_C_fill = traits_type::eof ();
_C_init (__sb);
}
template<class _CharT, class _Traits>
inline _RW::__rw_mutex*
basic_ios<_CharT, _Traits>::_C_bufmutex () const
{
#if !defined (_RWSTD_REENTRANT) || defined (_RWSTD_NO_EXT_REENTRANT_IO)
// unconditionally return pointer to buffer's mutex
// (real or fake if not in an MT environment)
return rdbuf () ? &rdbuf ()->_C_mutex : 0;
#else
// return pointer to buffer's mutex unless the object is in
// a state where buffer locking is disabled)
return flags () & _RWSTD_IOS_NOLOCKBUF || !rdbuf ()
? 0 : &rdbuf ()->_C_mutex;
#endif // !_RWSTD_REENTRANT || !_RWSTD_NO_EXT_REENTRANT_IO
}
} // namespace std
#if _RWSTD_DEFINE_TEMPLATE_FIRST (_BASIC_IOS)
# include <rw/_basic_ios.cc>
#endif // _RWSTD_DEFINE_TEMPLATE_FIRST (_BASIC_IOS)
_RWSTD_NAMESPACE (std) {
#if _RWSTD_INSTANTIATE (_BASIC_IOS, _CHAR)
_RWSTD_INSTANTIATE_2 (class _RWSTD_TI_EXPORT
basic_ios<char, char_traits<char> >);
#endif // _RWSTD_INSTANTIATE (_BASIC_IOS, _CHAR)
#if _RWSTD_INSTANTIATE (_BASIC_IOS, _WCHAR_T)
_RWSTD_INSTANTIATE_2 (class _RWSTD_TI_EXPORT
basic_ios<wchar_t, char_traits<wchar_t> >);
#endif // _RWSTD_INSTANTIATE (_BASIC_IOS, _WCHAR_T)
} // namespace std
#if _RWSTD_DEFINE_TEMPLATE_LAST (_BASIC_IOS)
# include <rw/_basic_ios.cc>
#endif // _RWSTD_DEFINE_TEMPLATE_LAST (_BASIC_IOS)
#endif // _RWSTD_RW_BASIC_IOS_H_INCLUDED

View File

@@ -0,0 +1,83 @@
/***************************************************************************
*
* _bitmask.h - helper definitions for bitmask types
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _bitmask.h 550991 2007-06-26 23:58:07Z sebor $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
**************************************************************************/
#ifndef _RWSTD_RW_BITMASK_H_INCLUDED
#define _RWSTD_RW_BITMASK_H_INCLUDED
#ifndef _RWSTD_RW_DEFS_H_INCLUDED
# include <rw/_defs.h>
#endif // _RWSTD_RW_DEFS_H_INCLUDED
#ifndef _RWSTD_NO_STATIC_CONST_MEMBER_INIT
# define _RWSTD_BITMASK_ENUM(Bitmask) Bitmask
# define _RWSTD_DEFINE_BITMASK_OPERATORS(Bitmask) \
\
inline Bitmask& operator&= (Bitmask &__lhs, Bitmask __rhs) { \
return __lhs = Bitmask (long (__lhs) & __rhs); \
} \
\
inline Bitmask& operator|= (Bitmask &__lhs, Bitmask __rhs) { \
return __lhs = Bitmask (long (__lhs) | __rhs); \
} \
\
inline Bitmask& operator^= (Bitmask &__lhs, Bitmask __rhs) { \
return __lhs = Bitmask (long (__lhs) ^ __rhs); \
} \
\
inline Bitmask operator& (Bitmask __lhs, Bitmask __rhs) { \
return __lhs &= __rhs; \
} \
\
inline Bitmask operator| (Bitmask __lhs, Bitmask __rhs) { \
return __lhs |= __rhs; \
} \
\
inline Bitmask operator^ (Bitmask __lhs, Bitmask __rhs) { \
return __lhs ^= __rhs; \
} \
\
inline Bitmask operator~ (Bitmask __rhs) { \
return Bitmask (~long (__rhs)); \
} \
typedef void __rw_unused_typedef
#else // if defined (_RWSTD_NO_STATIC_CONST_MEMBER_INIT)
# define _RWSTD_BITMASK_ENUM(ignore) int
# define _RWSTD_DEFINE_BITMASK_OPERATORS(ignore) \
typedef void __rw_unused_typedef
#endif // _RWSTD_NO_STATIC_CONST_MEMBER_INIT
#endif // _RWSTD_RW_BITMASK_H_INCLUDED

View File

@@ -0,0 +1,106 @@
/***************************************************************************
*
* _config-acc.h - HP aC++ configuration definitions
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _config-acc.h 650742 2008-04-23 04:55:38Z sebor $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2008 Rogue Wave Software, Inc.
*
**************************************************************************/
// _REENTRANT is defined by the -mt compiler option
// accommodate aCC 1.xx (HP-UX 10.xx), aCC 3.xx (HP-UX 11/PA-RISC)
// and aCC 5.xx (HP-UX 11/IA64)
#define _RWSTD_HP_aCC_MAJOR (__HP_aCC / 10000)
#define _RWSTD_HP_aCC_MINOR (__HP_aCC % 10000)
// new C++ libc headers supported
#undef _RWSTD_NO_NEW_HEADER
#ifndef _RWSTD_NO_PURE_C_HEADERS
// disable for now
# define _RWSTD_NO_PURE_C_HEADERS
#endif // _RWSTD_NO_PURE_C_HEADERS
// deprecated C++ libc headers don't introduce names into namespace std
#ifndef _RWSTD_NO_DEPRECATED_LIBC_IN_STD
# define _RWSTD_NO_DEPRECATED_LIBC_IN_STD
#endif
// deprecated C++ libc headers aren't used
#define _RWSTD_NO_DEPRECATED_C_HEADERS
// prevents Error (future) 553: Expected type arguments to follow
// class template name.
#define _RWSTD_REDUNDANT_TMPL_PARAMS
#if (_RWSTD_HP_aCC_MINOR < 3300) && !defined (_RWSTD_NO_MBSTATE_T)
// mbstate_t definition is guarded in _mbstate_t.h and is available
// only if _INCLUDE__STDC_A1_SOURCE is defined (i.e., with -AA)
# define _RWSTD_NO_MBSTATE_T
#endif
#if defined (_HP_NAMESPACE_STD) || defined (_NAMESPACE_STD)
# undef _RWSTD_NO_RUNTIME_IN_STD
# undef _RWSTD_NO_STD_BAD_TYPEID
# undef _RWSTD_NO_STD_TYPE_INFO
#endif
#ifndef _RWSTD_NO_BAD_ALLOC_WHAT
// avoid the following ld errors:
// Unsatisfied symbol "Class tables [Vtable] dependent on
// key function: "bad_alloc::what() const"" in file [*.o]
// Unsatisfied symbol "typeid<bad_alloc>" in file [*.o]
# define _RWSTD_NO_BAD_ALLOC_WHAT
#endif // _RWSTD_NO_BAD_ALLOC_WHAT
#if __HP_aCC < 60000
# ifndef _RWSTD_NO_EXTERN_TEMPLATE
# ifndef _RWSTD_NO_STRING_NPOS_TYPE
// define the type of basic_string::npos to be size_t
// instead of basic_string::size_type to work around
// an HP aCC extern template bug #333 (only the HP
// front end has this bug; HP aCC 6.0 which uses the
// EDG front end works fine
# define _RWSTD_NO_STRING_NPOS_TYPE
# endif // _RWSTD_NO_STRING_NPOS_TYPE
# endif // _RWSTD_NO_EXTERN_TEMPLATE
#endif // aCC < 6.0
#ifdef __HPACC_NOEH
// disable exceptions when the macro __HPACC_NOEH
// is #defined by the compiler, e.g., when the
// +noeh option is used
# ifndef _RWSTD_NO_EXCEPTIONS
# define _RWSTD_NO_EXCEPTIONS
# endif // _RWSTD_NO_EXCEPTIONS
#endif // __HPACC_NOEH
#if 6 <= _RWSTD_HP_aCC_MAJOR
// aCC 6 attribute((noreturn)) to indicate that a function
// doesn't return (it may exit by throwing an exception)
# define _RWSTD_ATTRIBUTE_NORETURN __attribute__ ((noreturn))
#endif // aCC >= 6

View File

@@ -0,0 +1,57 @@
/***************************************************************************
*
* _config-deccxx.h - DEC/Compaq/HP C++ configuration definitions
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _config-deccxx.h 605369 2007-12-19 00:12:47Z sebor $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
**************************************************************************/
// _REENTRANT is defined by -pthread option
#if defined (_RWSTD_REENTRANT)
# if defined (_PTHREAD_USE_D4) && !defined (_RWSTD_DCE_THREADS)
# define _RWSTD_DCE_THREADS
# endif // _PTHREAD_USE_D4 && !_RWSTD_DCE_THREADS
# if !defined (_RWSTD_DCE_THREADS) && !defined (_RWSTD_POSIX_THREADS)
# define _RWSTD_POSIX_THREADS
# endif // !(_RWSTD_DCE_THREADS) && !(_RWSTD_POSIX_THREADS)
#endif // (_RWSTD_REENTRANT)
#if __DECCXX_VER < 60390008
// version of Compaq C++ prior to C++ do not implement
// C++ C library headers (the <cxxx> kind)
# define _RWSTD_NO_NEW_HEADER
#endif // __DECCXX_VER < 60390008
#ifndef __EXCEPTIONS
// disable exceptions when the macro __EXCEPTIONS
// is not #defined by the compiler, e.g., when
// the -LANG:exceptions=OFF option is used
# ifndef _RWSTD_NO_EXCEPTIONS
# define _RWSTD_NO_EXCEPTIONS
# endif // _RWSTD_NO_EXCEPTIONS
#endif // __EXCEPTIONS

View File

@@ -0,0 +1,72 @@
/***************************************************************************
*
* _config-eccp.h - EDG eccp configuration definitions
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _config-eccp.h 605369 2007-12-19 00:12:47Z sebor $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 2001-2007 Rogue Wave Software, Inc.
*
**************************************************************************/
// identify the EDG eccp standalone front-end in order to help avoid
// confusing it with compilers such as Compaq C++, Intel C++, or SGI
// MIPSpro, that use the front-end and (sometimes) #define __EDG__
#define _RWSTD_EDG_ECCP
#if defined (_RWSTD_REENTRANT) && !defined (_RWSTD_POSIX_THREADS)
# define _RWSTD_POSIX_THREADS
#endif // (_RWSTD_REENTRANT) && !(_RWSTD_POSIX_THREADS)
#undef _RWSTD_NO_NEW_HEADER
#undef _RWSTD_NO_LIBC_IN_STD
#ifndef _RWSTD_NO_EXPORT
# undef _RWSTD_NO_IMPLICIT_INCLUSION
#endif
// the vanilla front-end doesn't actually #include the header,
// but it treats it specially instead, which throws off the test
#undef _RWSTD_ANSI_C_STDARG_H
#define _RWSTD_ANSI_C_STDARG_H <stdarg.h>
#ifdef _RWSTD_REENTRANT
// std::uncaught_exception() not thread-safe in the front-end demo
# define _RWSTD_NO_UNCAUGHT_EXCEPTION
#endif // _RWSTD_REENTRANT
#ifndef _RWSTD_NO_MBSTATE_T
# define _RWSTD_NO_MBSTATE_T
#endif // _RWSTD_NO_MBSTATE_T
#undef _RWSTD_NO_DEPRECATED_C_HEADERS
#undef _RWSTD_NO_PURE_C_HEADERS
#ifndef __EXCEPTIONS
// disable exceptions when the macro __EXCEPTIONS
// is not #defined by the compiler, e.g., when
// the -no_exceptions option is used
# ifndef _RWSTD_NO_EXCEPTIONS
# define _RWSTD_NO_EXCEPTIONS
# endif // _RWSTD_NO_EXCEPTIONS
#endif // __EXCEPTIONS

View File

@@ -0,0 +1,176 @@
/***************************************************************************
*
* _config-gcc.h - GCC configuration definitions
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _config-gcc.h 650742 2008-04-23 04:55:38Z sebor $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2008 Rogue Wave Software, Inc.
*
**************************************************************************/
// _REENTRANT is defined by the -pthread compiler option
#ifndef _RWSTD_NO_IMPLICIT_INCLUSION
# define _RWSTD_NO_IMPLICIT_INCLUSION
#endif
#ifndef _RWSTD_NO_EXPORT
// not implemented
# define _RWSTD_NO_EXPORT
#endif
#ifndef __EXCEPTIONS
// disable exceptions when the macro __EXCEPTIONS
// is not #defined by the compiler, e.g., when
// the -fno-exceptions option is used
# ifndef _RWSTD_NO_EXCEPTIONS
# define _RWSTD_NO_EXCEPTIONS
# endif // _RWSTD_NO_EXCEPTIONS
#endif // __EXCEPTIONS
#if !defined (_RWSTD_USE_PURE_C_HEADERS)
// disabled except when requested
# define _RWSTD_NO_PURE_C_HEADERS
#endif // !_RWSTD_USE_PURE_C_HEADERS
#ifdef _RWSTD_NO_PURE_C_HEADERS
// deprecated C headers (the <xxx.h> kind) are fully implemented
// in terms of the pure C++ C library headers (the <cxxx> kind)
# define _RWSTD_NO_DEPRECATED_C_HEADERS
#endif // _RWSTD_NO_PURE_C_HEADERS
#if !defined (_RWSTD_STRICT_ANSI) && __GNUG__ <= 2 && __GNUC_MINOR__ < 97
// prevent gcc 2.9x ICE
# define _RWSTD_NO_PLACEMENT_DELETE
#endif // !_RWSTD_STRICT_ANSI
#if __GNUG__ < 3
// gcc 2.x doesn't understand the extern template syntax
// but only issues a warning: ANSI C++ forbids the use
// of `extern' on explicit instantiations
# ifndef _RWSTD_NO_EXTERN_TEMPLATE
# define _RWSTD_NO_EXTERN_TEMPLATE
# endif // _RWSTD_NO_EXTERN_TEMPLATE
#endif // gcc 2.x
#if __GNUG__ <= 2 && __GNUC_MINOR__ < 97 && defined (_RWSTD_NO_HONOR_STD)
// standard iostream objects are declared as objects of their respective
// types by defined as POD's to prevent their destruction during program
// lifetime (done to work around a g++ 2.95.2 bug that prevents g++
// from deducing the type of references to the objects in template code)
# define _RWSTD_NO_IOSTREAM_OBJECT_REFS
#endif //__GNUG__ <= 2 && __GNUC_MINOR__ < 97 && _RWSTD_NO_HONOR_STD
#define _RWSTD_GNUC_ATTRIBUTE(attr) __attribute__ (attr)
// gcc attribute((noreturn)) to indicate that a function doesn't return
// (it may still exit by throwing an exception or by calling longjmp)
#define _RWSTD_ATTRIBUTE_NORETURN _RWSTD_GNUC_ATTRIBUTE ((noreturn))
#ifdef _RWSTD_OS_LINUX
# ifdef _RWSTD_NO_NEW_HEADER
# undef _RWSTD_NO_NEW_HEADER
# endif // _RWSTD_NO_NEW_HEADER
// our <cxxx> libc headers put the libc functions in namespace std
# ifdef _RWSTD_NO_LIBC_IN_STD
# undef _RWSTD_NO_LIBC_IN_STD
# endif // _RWSTD_NO_LIBC_IN_STD
# ifdef _RWSTD_ANSI_C_LIMITS_H
// prevent system header warnings
# undef _RWSTD_ANSI_C_LIMITS_H
# define _RWSTD_ANSI_C_LIMITS_H <../include/limits.h>
# endif // _RWSTD_ANSI_C_LIMITS_H
#endif // _RWSTD_OS_LINUX
#ifdef _RWSTD_OS_AIX
// functions called from member functions of explicitly instantiated
// class templates aren't "implicitly" instantiated (compiler bug)
# define _RWSTD_NO_IMPLICIT_INSTANTIATION
#endif
// force using /usr/include/math.h
// prevent recursion caused by pulling in gcc's own "fixed" header
#undef _RWSTD_ANSI_C_MATH_H
// use new C++ libc headers
#undef _RWSTD_NO_NEW_HEADER
#undef _RWSTD_NO_LIBC_IN_STD
#undef _RWSTD_NO_DEPRECATED_LIBC_IN_STD
#ifdef __CYGWIN__
// use our own C++ libc headers
# undef _RWSTD_NO_NEW_HEADER
// libc is wrapped in namespaces std
# undef _RWSTD_NO_LIBC_IN_STD
// deprecated C++ libc headers don't introduce names into namespace std
# ifndef _RWSTD_NO_DEPRECATED_LIBC_IN_STD
# define _RWSTD_NO_DEPRECATED_LIBC_IN_STD
# endif
# ifdef _RWSHARED
// disabe exporting timeplate instantations in shared builds
// see STDCXX-507
# define _RWSTD_NO_EXTERN_TEMPLATE
// operator new and delete is not reliably replaceable across
// shared library boundaries, which includes the shared library
// version of the language support library
# define _RWSTD_NO_REPLACEABLE_NEW_DELETE
# endif
#endif // __CYGWIN__
#ifdef _RWSTD_OS_OSF1
// sizeof (long double) == sizeof (double), 'L' causes SIGSEGV
# define _RWSTD_LDBL_PRINTF_PREFIX ""
# define _RWSTD_LDBL_SCANF_PREFIX "l"
#endif // _RWSTD_OS_OSF1
#ifdef _RWSTD_OS_SUNOS
// _SOLARIS_THREADS #defined when the -threads option is used on SunOS
# if defined (_SOLARIS_THREADS) && !defined (_RWSTD_SOLARIS_THREADS)
# define _RWSTD_SOLARIS_THREADS
# endif // _SOLARIS_THREADS && !_RWSTD_SOLARIS_THREADS
// _PTHREADS #defined when the -pthreads option is used on SunOS
# if defined (_PTHREADS) && !defined (_RWSTD_POSIX_THREADS)
# define _RWSTD_POSIX_THREADS
# endif // _PTHREADS && !_RWSTD_POSIX_THREADS
# if __GNUG__ == 3 && __GNUC_MINOR__ < 1
// Avoid gcc 3.0.1 header configuration confusion with wchar
# ifndef _RWSTD_NO_NEW_HEADER
# define _RWSTD_NO_NEW_HEADER
# endif
# ifndef _RWSTD_NO_LIBC_IN_STD
# define _RWSTD_NO_LIBC_IN_STD
# endif
# endif // __GNUG__ == 3 && __GNUC_MINOR__ < 1
#endif // _RWSTD_OS_SUNOS

View File

@@ -0,0 +1,72 @@
/***************************************************************************
*
* _config-icc.h - Intel C++ configuration definitions
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _config-icc.h 605369 2007-12-19 00:12:47Z sebor $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
**************************************************************************/
#if !defined (_WIN32) && !defined (_WIN64)
// enable the <cxxx> form of libc headers
// we can only use the rw version in include/ansi
# ifndef _RWSTD_NO_PURE_C_HEADERS
# define _RWSTD_NO_PURE_C_HEADERS
# endif // _RWSTD_NO_PURE_C_HEADERS
# ifndef _RWSTD_NO_DEPRECATED_C_HEADERS
# define _RWSTD_NO_DEPRECATED_C_HEADERS
# endif // _RWSTD_NO_DEPRECATED_C_HEADERS
# undef _RWSTD_NO_NEW_HEADER
# undef _RWSTD_NO_LIBC_IN_STD
# ifndef __EXCEPTIONS
// disable exceptions when the macro __EXCEPTIONS
// is not #deined by the compiler, e.g., when
// the -fno-exceptions option is used
# ifndef _RWSTD_NO_EXCEPTIONS
# define _RWSTD_NO_EXCEPTIONS
# endif // _RWSTD_NO_EXCEPTIONS
# endif
#else // if defined (_WIN{32,64})
# include "_config-msvcrt.h"
# if defined (_RWSHARED)
// only when using shared libstd and Intel C++/MSVC
// working around an Intel C++ 7.1 bug (PR #29178)
# define _RWSTD_NO_OUTLINED_USE_FACET_SPECIALIZATIONS
# endif // _RWSHARED
// disable "function was declared "deprecated"
# pragma warning (disable: 1786)
// disable "dllexport/dllimport conflict with ... ; dllexport assumed"
# pragma warning (disable: 1740)
#endif // (_WIN{32,64})

View File

@@ -0,0 +1,66 @@
/***************************************************************************
*
* _config-mipspro.h - SGI MIPSpro configuration definitions
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _config-mipspro.h 605369 2007-12-19 00:12:47Z sebor $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
**************************************************************************/
#define _RWSTD_SGI_MIPSPRO
#ifndef _RWSTD_NO_PURE_C_HEADERS
# define _RWSTD_NO_PURE_C_HEADERS
#endif // _RWSTD_NO_PURE_C_HEADERS
#if defined _RWSTD_NO_NEW_HEADER
# undef _RWSTD_NO_NEW_HEADER
#endif // _RWSTD_NO_NEW_HEADER
// our <cxxx> libc headers put the libc functions in namespace std
#ifdef _RWSTD_NO_LIBC_IN_STD
# undef _RWSTD_NO_LIBC_IN_STD
#endif // _RWSTD_NO_LIBC_IN_STD
#ifndef _RWSTD_NO_DEPRECATED_C_HEADERS
# define _RWSTD_NO_DEPRECATED_C_HEADERS
#endif
#define _RWSTD_NO_PLACEMENT_DELETE
// The comptest sets compile instantiate when it shouldn't.
// override it here.
#if defined (_RWSTD_NO_IMPLICIT_INCLUSION)
# undef _RWSTD_NO_IMPLICIT_INCLUSION
#endif
#ifndef __EXCEPTIONS
// disable exceptions when the macro __EXCEPTIONS
// is not #defined by the compiler, e.g., when
// the -noexceptions option is used
# ifndef _RWSTD_NO_EXCEPTIONS
# define _RWSTD_NO_EXCEPTIONS
# endif // _RWSTD_NO_EXCEPTIONS
#endif // __EXCEPTIONS

View File

@@ -0,0 +1,84 @@
/***************************************************************************
*
* _config-msvc.h - Microsoft Visual C++ configuration definitions
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _config-msvc.h 637130 2008-03-14 15:16:33Z faridz $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
**************************************************************************/
#include "_config-msvcrt.h"
#if _MSC_VER <= 1300 // MSVC <= 7.0
# define _RWSTD_NO_PTR_VALUE_TEMPLATE_OVERLOAD
# define _RWSTD_NO_PRAGMA_INSTANTIATE
// disable explicit instantiation extensions if building
// optimized client code (all templates still explicitly
// instantiated in the library);
// *** Not currently done for MSVC 7, since an implicit
// instantiation bug causes multiply defined symbols
// in downstream libraries
# ifndef _RWSTD_NO_STRING_NPOS_TYPE
// define basic_string::npos to be of type size_t
// instead of basic_string::size_type to work around
// an MSVC 7.0 bug (PR #26549)
# define _RWSTD_NO_STRING_NPOS_TYPE
# endif // _RWSTD_NO_STRING_NPOS_TYPE
#endif // MSVC <= 7.0
// disable "Same type qualifier used more than once"
#pragma warning (disable: 4114)
// disable "return type for operator->' is not a UDT"
#pragma warning (disable: 4284)
// disable "nonstandard extension used :"
// "'extern' before template explicit instantiation"
#pragma warning (disable: 4231)
// RWDLL - defined for all Rogue Wave(R) products built as shared libs
// _RWSHARED - defined for libstd built/used as a shared lib
#if defined (RWDLL) || defined (_RWSHARED)
// disable "class needs to have dll-interface to be used by cliens"
# pragma warning (disable: 4251)
// disable "non dll-interface class used as base for dll-interface class"
# pragma warning (disable: 4275)
#endif // RWDLL || _RWSHARED
// disable "decorated name length exceeded"
#pragma warning (disable: 4503)
// disable "'identifier' : no suitable definition"
// "provided for explicit template instantiation request"
#pragma warning (disable: 4661)
// disable "identifier was truncated to 255 characters"
#pragma warning (disable: 4786)
// disable "'function': was declared deprecated"
#pragma warning (disable: 4996)

View File

@@ -0,0 +1,157 @@
/***************************************************************************
*
* _config-msvcrt.h - Microsoft Visual C++ run-time library
* configuration definitions
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _config-msvcrt.h 614864 2008-01-24 12:52:22Z faridz $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2007 Rogue Wave Software, Inc.
*
**************************************************************************/
#if _MSC_VER <= 1300 // MSVC <= 7.0
# define _RWSTD_EXCEPTION_HANDLER_IN_STD
# define _RWSTD_NO_STATIC_DEF3
#endif // MSVC <= 7.0
// enable the <cxxx> form of libc headers
// we can only use the rw version in include/ansi
#ifndef _RWSTD_NO_PURE_C_HEADERS
# define _RWSTD_NO_PURE_C_HEADERS
#endif // _RWSTD_NO_PURE_C_HEADERS
#if defined _RWSTD_NO_NEW_HEADER
# undef _RWSTD_NO_NEW_HEADER
#endif // _RWSTD_NO_NEW_HEADER
// our <cxxx> libc headers put the libc functions in namespace std
#ifdef _RWSTD_NO_LIBC_IN_STD
# undef _RWSTD_NO_LIBC_IN_STD
#endif // _RWSTD_NO_LIBC_IN_STD
#ifndef _RWSTD_NO_DEPRECATED_C_HEADERS
# define _RWSTD_NO_DEPRECATED_C_HEADERS
#endif // _RWSTD_NO_DEPRECATED_C_HEADERS
#ifndef _RWSTD_NO_WCSTOK
// MSVC CRT has incorrect prototype of the wcstok()
# define _RWSTD_NO_WCSTOK
#endif // _RWSTD_NO_WCSTOK
#ifndef _RWSTD_NO_WCSTOK_IN_LIBC
# define _RWSTD_NO_WCSTOK_IN_LIBC
#endif // _RWSTD_NO_WCSTOK_IN_LIBC
// operator new and delete is not reliably replaceable across
// shared library boundaries, which includes the shared library
// version of the language support library
#define _RWSTD_NO_REPLACEABLE_NEW_DELETE
// names of (most) extern "C" libc symbols begin with an underscore
#define _RWSTD_LIBC_SYM(name) _ ## name
#ifdef _DLL
// the _DLL macro is defined by the compiler when building a shared
// library, i.e., in response to either of the /MD and /MDd options
// _RWSTD_DLLIMPORT is used when declaring libc functions that need
// to be "imported" into the shared library
# define _RWSTD_DLLIMPORT __declspec (dllimport)
#endif // _DLL
#ifndef _RWSTD_NO_STATIC_CONST_MEMBER_DEFINITION
// both MSVC 7.x and Intel C++/Windows allow "inline" initializers
// for static const integral data members but out-of-line definitions
// cause multiply defined symbol errors (see PR #26562 and #30260)
// disable their definitions in source files (the members are still
// declared)
# define _RWSTD_NO_STATIC_CONST_MEMBER_DEFINITION
#endif // _RWSTD_NO_STATIC_CONST_MEMBER_DEFINITION
// enable iostream and locale support for long long integers
#if _MSC_VER <= 1300 || defined (_RWSTD_NO_LONG_LONG)
# define _RWSTD_LONG_LONG __int64
#endif // _MSC_VER <= 1300 || _RWSTD_NO_LONG_LONG
#if defined (_WIN64)
// FIXME: handle by forward declaring fuctions in <rw/_mutex.h>
# define _RWSTD_NO_FWD_DECLARATIONS
#endif // _WIN64
#if defined (WIN32) && !defined(_WIN32)
# define _WIN32
#endif
#if defined (_MT) && !defined (_RWSTD_NO_REENTRANT)
# ifndef _RWSTD_REENTRANT
# define _RWSTD_REENTRANT 1
# endif // _RWSTD_REENTRANT
# ifndef _RWSTD_NO_TLS
// thread-local stoprage declaration specifier
# ifndef _RWSTD_THREAD
# define _RWSTD_THREAD __declspec (thread)
# endif // _RWSTD_THREAD
# endif // _RWSTD_NO_TLS
#else // if !defined (_MT) || defined (_RWSTD_NO_REENTRANT)
# ifdef _RWSTD_REENTRANT
# undef _RWSTD_REENTRANT
# endif // _RWSTD_REENTRANT
# ifndef _RWSTD_THREAD
# define _RWSTD_THREAD /* empty */
# endif // _RWSTD_THREAD
#endif // _MT && !_RWSTD_NO_REENTRANT
#if defined (_CPPRTTI)
// override in case library was configured with -GR-
// (i.e., with RTTI disabled)
# undef _RWSTD_NO_DYNAMIC_CAST
#elif !defined (_RWSTD_NO_DYNAMIC_CAST)
// override in case library was configured with -GR
// (i.e., with RTTI enabled)
# define _RWSTD_NO_DYNAMIC_CAST
#endif // _CPPRTTI
#pragma warning (error: 4541)
#ifndef _NATIVE_WCHAR_T_DEFINED
// define wchar_t if it is not a keyword recognized by the compiler
// (use the /Zc:wchar_t compiler option to enable wchar_t as a keyword)
typedef unsigned short wchar_t;
#endif // _NATIVE_WCHAR_T_DEFINED
#if _RWSTD_VER_MAJOR < 5 && defined (_DLL)
// defined for binary compatibility with stdcxx 4.1.x
// (for all versions of MSVC and Intel C++)
# define _RWSTD_NO_BAD_CAST_ASSIGNMENT
# define _RWSTD_NO_BAD_CAST_COPY_CTOR
# define _RWSTD_NO_BAD_CAST_DTOR
# define _RWSTD_NO_BAD_TYPEID_ASSIGNMENT
# define _RWSTD_NO_BAD_TYPEID_COPY_CTOR
# define _RWSTD_NO_BAD_TYPEID_DTOR
# define _RWSTD_NO_EXCEPTION_ASSIGNMENT
# define _RWSTD_NO_EXCEPTION_COPY_CTOR
# define _RWSTD_NO_EXCEPTION_DEFAULT_CTOR
# define _RWSTD_NO_EXCEPTION_DTOR
# define _RWSTD_NO_EXCEPTION_WHAT
#endif // _RWSTD_VER_MAJOR < 5 && _DLL

View File

@@ -0,0 +1,53 @@
/***************************************************************************
*
* _config-xlc.h - IBM VisualAge/XLC++ configuration definitions
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _config-sunpro.h 590052 2007-10-30 12:44:14Z faridz $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
**************************************************************************/
// _REENTRANT defined by the -mt compiler option
#if __SUNPRO_CC >= 0x530 && __SUNPRO_CC <= 0x540
// test fails due to a SunPro 5.3 bug (PR RW #26641/Sun #4526136)
# undef _RWSTD_NO_MEMBER_TEMPLATES
#endif // SunPro 5.3, 5.4
#if __SUNPRO_CC <= 0x540
// works around a partial specialization bug (PR #28119)
# ifndef _RWSTD_NO_EXT_CONST_ALLOCATOR
# define _RWSTD_NO_EXT_CONST_ALLOCATOR
# endif
#endif // SunPro < 5.4
#ifndef _RWSTD_NO_EXPORT
# define _RWSTD_NO_EXPORT
#endif // _RWSTD_NO_EXPORT
// prevent warnings about SunPro being unable to find
// source for (intentionally undefined) member functions
// of class templates
#define _RWSTD_NO_UNDEFINED_TEMPLATES

View File

@@ -0,0 +1,169 @@
/***************************************************************************
*
* _config-xlc.h - IBM VisualAge/XLC++ configuration definitions
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _config-xlc.h 605745 2007-12-19 23:52:20Z sebor $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
**************************************************************************/
// _THREAD_SAFE defined by the xlC_r compiler driver
#ifndef _RWSTD_NO_PURE_C_HEADERS
# define _RWSTD_NO_PURE_C_HEADERS
#endif // _RWSTD_NO_PURE_C_HEADERS
#if defined _RWSTD_NO_NEW_HEADER
# undef _RWSTD_NO_NEW_HEADER
#endif // _RWSTD_NO_NEW_HEADER
// our <cxxx> libc headers put the libc functions in namespace std
#ifdef _RWSTD_NO_LIBC_IN_STD
# undef _RWSTD_NO_LIBC_IN_STD
#endif // _RWSTD_NO_LIBC_IN_STD
#ifndef _RWSTD_NO_DEPRECATED_C_HEADERS
# define _RWSTD_NO_DEPRECATED_C_HEADERS
#endif
// static data members of cass templates aren't properly collapsed
// (compiler emits one copy per each translation unit that contains
// the definition of the template member)
#define _RWSTD_NO_COLLAPSE_TEMPLATE_STATICS
// the above prevents correct static mutex initialization
// (but the alternative approach is also unreliable)
#define _RWSTD_NO_STATIC_MUTEX_INIT
// VisualAge for C++ version >= 5.0.2.0, when the tempinc model
// (which makes use of implicit inclusion) is in effect (i.e.,
// when neither of -qtemplateregistry or -qnotempinc is specified
// on the command line) the compiler defines the macro __TEMPINC__
#if __IBMCPP__ < 502 || !defined (__TEMPINC__)
// override the autodetected setting of the macro
# undef _RWSTD_NO_IMPLICIT_INCLUSION
# define _RWSTD_NO_IMPLICIT_INCLUSION
#endif
#if __IBMCPP__ >= 502 && defined (__TEMPINC__)
// override the autodetected setting of the macro
# undef _RWSTD_NO_IMPLICIT_INCLUSION
#endif // VAC++ >= 5.0.2 && __TEMPINC__
#if !defined (_RWSTD_WCTRANS_T)
# undef _RWSTD_NO_WCTRANS_T
# define _RWSTD_WCTRANS_T win_t(*wctrans_t)(wint_t)
#endif // _RWSTD_WCTRANS_T
#ifdef _RWSTD_OS_AIX
// operator new and delete is not reliably replaceable across
// shared library boundaries, which includes the shared library
// version of the language support library
# define _RWSTD_NO_REPLACEABLE_NEW_DELETE
# if (8 == _RWSTD_LONG_SIZE)
// avoid using strtof() in LP64 due to bug #379 (PMR 02164)
# ifndef _RWSTD_NO_STRTOF
# define _RWSTD_NO_STRTOF
# endif // _RWSTD_NO_STRTOF
# ifndef _RWSTD_NO_STRTOF_IN_LIBC
# define _RWSTD_NO_STRTOF_IN_LIBC
# endif // _RWSTD_NO_STRTOF_IN_LIBC
# endif // REENTRANT && LP64
#endif // AIX
#if __IBMCPP__ <= 800
# ifndef _RWSTD_NO_EXTERN_TEMPLATE
// disable extern template to work around an XLC++ 8.0 bug
// (see STDCXX-379)
# define _RWSTD_NO_EXTERN_TEMPLATE
# endif // _RWSTD_NO_EXTERN_TEMPLATE
#endif // XLC++ 8.0 or prior
#if __IBMCPP__ == 800
# if !defined (__TEMPINC__) && defined (_RWSTD_NO_INSTANTIATE_DEFAULT_ARGS)
// disable explicit instantiation directives occuring prior
// the definition of out-of-line member functions of class
// templates in .cc files (i.e., prior their explicit
// #inclusion at the bottom of each header)
# ifndef _RWSTD_NO_EXPLICIT_INSTANTIATION_BEFORE_DEFINITION
# define _RWSTD_NO_EXPLICIT_INSTANTIATION_BEFORE_DEFINITION
# endif
# ifndef _RWSTD_NO_EXTERN_TEMPLATE_BEFORE_DEFINITION
# define _RWSTD_NO_EXTERN_TEMPLATE_BEFORE_DEFINITION
# endif
# endif // !__TEMPINC__ && _RWSTD_NO_INSTANTIATE_DEFAULT_ARGS
# ifndef _RWSTDDEBUG
// work around an XLC++ 8.0 ICE (STDCXX-159)
# if defined (_RWSTD_NO_EXTERN_TEMPLATE)
# define _RWSTD_NO_EXPLICIT_INSTANTIATION
# endif // _RWSTD_NO_EXTERN_TEMPLATE
# endif // without debugging
#endif // XLC++ 8.0
#ifndef __TEMPINC__
// avoid VAC++ 7.0 diagnostic 1540-2910 (I) The template uses
// a file organization for tempinc, but tempinc is not being
// used. See bug #450
// prevent warnings about VAC++ being unable to find
// source for (intentionally undefined) member functions
// of class templates
# define _RWSTD_NO_UNDEFINED_TEMPLATES
#endif // __TEMPINC__
#if (__IBMCPP__ >= 700) && !defined(__EXCEPTIONS)
// disable exceptions when the macro __EXCEPTIONS
// is not #defined by the compiler, e.g., when
// the -qnoeh option is used
# ifndef _RWSTD_NO_EXCEPTIONS
# define _RWSTD_NO_EXCEPTIONS
# endif // _RWSTD_NO_EXCEPTIONS
#endif // __EXCEPTIONS
// avoid using autodetected libc headers
#undef _RWSTD_ANSI_C_ASSERT_H
#undef _RWSTD_ANSI_C_CTYPE_H
#undef _RWSTD_ANSI_C_ERRNO_H
#undef _RWSTD_ANSI_C_FLOAT_H
#undef _RWSTD_ANSI_C_ISO646_H
#undef _RWSTD_ANSI_C_LIMITS_H
#undef _RWSTD_ANSI_C_LOCALE_H
#undef _RWSTD_ANSI_C_MATH_H
#undef _RWSTD_ANSI_C_SETJMP_H
#undef _RWSTD_ANSI_C_SIGNAL_H
#undef _RWSTD_ANSI_C_STDARG_H
#undef _RWSTD_ANSI_C_STDDEF_H
#undef _RWSTD_ANSI_C_STDIO_H
#undef _RWSTD_ANSI_C_STDLIB_H
#undef _RWSTD_ANSI_C_STRING_H
#undef _RWSTD_ANSI_C_TIME_H
#undef _RWSTD_ANSI_C_WCHAR_H
#undef _RWSTD_ANSI_C_WCTYPE_H

498
extern/stdcxx/4.2.1/include/rw/_config.h vendored Normal file
View File

@@ -0,0 +1,498 @@
/***************************************************************************
*
* _config.h - Compiler and C library configuration definitions
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _config.h 649727 2008-04-19 00:10:23Z vitek $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2007 Rogue Wave Software, Inc.
*
**************************************************************************/
#ifndef _RWSTD_RW_CONFIG_H_INCLUDED
#define _RWSTD_RW_CONFIG_H_INCLUDED
// include generated configuration header
#include <config.h>
/*** library version numbers and ids **************************************/
#define _RWSTD_VER 0x04020100
// | | | |
// MMmmuupp
// | | | |
// | | | +--- pp = patch version number
// | | +----- uu = micro version number
// | +------- mm = minor version number
// +--------- MM = major version number
// library version string (patch number included only if non-zero)
#define _RWSTD_VER_STR "4.2.1"
// library version numbers
#define _RWSTD_VER_MAJOR ((_RWSTD_VER >> 24) & 0xff)
#define _RWSTD_VER_MINOR ((_RWSTD_VER >> 16) & 0xff)
#define _RWSTD_VER_MICRO ((_RWSTD_VER >> 8) & 0xff)
#define _RWSTD_VER_PATCH (_RWSTD_VER & 0xff)
// a newer release of stdcxx is backward source and binary compatible
// with an older release if both releases share the same major version
// number; stdcxx releases whose major version numbers differ may or
// may not be source or binary compatible
// two releases of stdcxx are forward (as well as backward) source and
// binary compatible if both releases share the same major and minor
// version numbers
// backward compatibility means that a program linked with an older
// release of a library will not be adversely affected by upgrading
// to a more recent release of the same library
// forward compatibility means that a program linked with a newer
// release of a library will not be adversely affected by downgrading
// to an older release of the same library
/**************************************************************************
* OVERRIDES FOR CONFIGURATION MACROS *
**************************************************************************/
#if defined (_RWSTD_NO_EXTENSIONS) && !defined (_RWSTD_STRICT_ANSI)
# define _RWSTD_STRICT_ANSI
#endif // _RWSTD_NO_EXTENSIONS && !_RWSTD_STRICT_ANSI
// -D _REENTRANT or any one of the other thread safety macros
// used in the conditional below turns on thread safety features
#if defined (_REENTRANT) \
|| defined (_THREAD_SAFE) \
|| defined (_RWSTD_MULTI_THREAD) \
|| defined (_RWSTD_DCE_THREADS) \
|| defined (_RWSTD_SOLARIS_THREADS) \
|| defined (_RWSTD_POSIX_THREADS)
# ifndef _RWSTD_REENTRANT
# define _RWSTD_REENTRANT
# endif // _RWSTD_REENTRANT
#endif
/**************************************************************************
* ARCHITECTURE-SPECIFIC OVERRIDES *
**************************************************************************/
/*** Alpha ****************************************************************/
#if defined (__alpha__) || defined (__alpha)
// this applies to both Tru64 UNIX and Linux on Alpha
# undef _RWSTD_IS_IEC559
# ifdef _IEEE_FP
// IEEE 754/IEC 559 conforming environment enabled
// using the Compaq C++ -ieee compiler command line
// option or with gcc -mieee
# define _RWSTD_IS_IEC559 true
# else
// OSF1 (Tru64 UNIX) Compaq C++ without -ieee
# define _RWSTD_IS_IEC559 false
# endif
#endif // Alpha
/*** Itanium (IA64) *******************************************************/
#if defined (__ia64__) || defined (__ia64)
#endif // IA64
/*** MIPS *****************************************************************/
#if defined (__mips__) || defined (__mips)
#endif // MIPS
/*** PA-RISC **************************************************************/
#if defined (__parisc__) || defined (__parsisc)
#endif // PA RISC
/*** PowerPC **************************************************************/
#if defined (__powerpc__) || defined (__powerpc)
#endif // PowerPC
/*** SPARC ****************************************************************/
#if defined (__sparc__) || defined (__sparc)
#endif // SPARC
/*** AMD64/Intel EM64T ****************************************************/
#if defined (__amd64__) || defined (__amd64) \
|| defined (__x86_64__) || defined (__x86_64)
# if _RWSTD_VER_MAJOR < 5
# ifdef _RWSTD_OS_LINUX
// on Linux/AMD64, unless explicitly requested, disable the use
// of atomic operations in string for binary compatibility with
// stdcxx 4.1.x
# ifndef _RWSTD_USE_STRING_ATOMIC_OPS
# define _RWSTD_NO_STRING_ATOMIC_OPS
# endif // _RWSTD_USE_STRING_ATOMIC_OPS
# endif // _WIN32
# endif // stdcxx < 5.0
#endif // AMD64/EM64T
/**************************************************************************
* COMPILER-SPECIFIC OVERRIDES *
**************************************************************************/
/*** Apogee C++ ***********************************************************/
// Apogee C++ uses an EDG front end but doesn't define __EDG__
#ifdef __APOGEE__
#endif // __APOGEE__
/*** IBM VAC++ ************************************************************/
#if defined (__IBMCPP__)
# include "_config-xlc.h"
#endif // __IBMCPP___
/*** Compaq C++ ***********************************************************/
// Compaq C++ uses an EDG front end and #defines __EDG__
#ifdef __DECCXX
# include "_config-deccxx.h"
#endif // __DECCXX
/*** EDG eccp (this is the vanilla EDG front end) *************************/
// NOTE: the __EDG__ macro is #defined by most EDG-based compilers
#if defined (__EDG__) \
&& !defined (__DECCXX) \
&& !defined (__HP_aCC) \
&& !defined (__INTEL_COMPILER) \
&& !defined (_SGI_COMPILER_VERSION)
// FIXME: make this more robust by detecting the EDG eccp demo
// during library configuration (and avoid relying on compiler
// specific macros)
# include "_config-eccp.h"
#endif // __EDG__
/*** GCC ******************************************************************/
#ifdef __GNUG__
# include "_config-gcc.h"
#else // if !defined (__GNUG__)
# define _RWSTD_GNUC_ATTRIBUTE(ignore)
#endif // __GNUG__
/*** HP aCC ***************************************************************/
#ifdef __HP_aCC
# include "_config-acc.h"
#endif // __HP_aCC
/*** Intel C++ ************************************************************/
#if defined (__INTEL_COMPILER)
# include "_config-icc.h"
#endif // __INTEL_COMPILER
/*** SGI MIPSpro **********************************************************/
// SGI MIPSpro uses an EDG front end; it may or may not #define __EDG__
// (starting with MIPSpro 7.4 the preprocessor does #define the macro
// along with _SGI_COMPILER_VERSION)
#ifdef _RWSTD_OS_IRIX64
// if _SGI_COMPILER_VERSION is not #defined, assume MIPSpro
// unless __GNUG__ is #defined
# if defined (_SGI_COMPILER_VERSION) || !defined (__GNUG__)
# include "_config-mipspro.h"
# endif // _SGI_COMPILER_VERSION || !__GNUG__
#endif // _RWSTD_OS_IRIX64
/*** MSVC *****************************************************************/
#if defined (_MSC_VER) && !defined (__INTEL_COMPILER)
# include "_config-msvc.h"
#endif // _MSC_VER && !__INTEL_COMPILER
/*** Siemens CDS++ ********************************************************/
#ifdef SNI
# define _RWSTD_NO_PTR_VALUE_TEMPLATE_OVERLOAD
# if __STDC__ == 1
# ifndef _RWSTD_STRICT_ANSI
# define _RWSTD_STRICT_ANSI
# endif
# endif
# if defined __SNI_THREAD_SUPPORT
# define _RWSTD_NO_MBRTOWC
# define _RWSTD_NO_WCRTOMB
# endif
#endif // SNI
/*** SunPro aka Sun C++ ***************************************************/
#ifdef __SUNPRO_CC
# include "_config-sunpro.h"
#endif // __SUNPRO_CC
/**************************************************************************
* OPERATING SYSTEM-SPECIFIC OVERRIDES *
**************************************************************************/
/*** OS2 ******************************************************************/
#ifdef __OS2__
# define _RWSTD_NO_STATIC_MUTEX_INIT
#endif // __OS2__
/*** Win{32,64} ***********************************************************/
#if defined (_WIN32) || defined (_WIN64)
# define _RWSTD_NO_STATIC_MUTEX_INIT
# define _RWSTD_PATH_SEP '\\'
#endif // _WIN32
#ifndef _RWSTD_PATH_SEP
# define _RWSTD_PATH_SEP '/'
#endif // _RWSTD_PATH_SEP
/*** Non-10646 platforms **************************************************/
#if !defined (_RWSTD_OS_LINUX) && !defined (_WIN32)
// Linux glibc and Windows use ISO 10646 (Unicode)
// as the internal wchar_t encoding in all locales
# ifndef _RWSTD_NO_ISO_10646_WCHAR_T
# define _RWSTD_NO_ISO_10646_WCHAR_T
# endif // _RWSTD_NO_ISO_10646_WCHAR_T
#endif // !Linux && !Windoze
/********************** Threads *******************************************/
#ifdef _RWSTD_REENTRANT
# if !defined (_RWSTD_DCE_THREADS) \
&& !defined (_RWSTD_DEC_THREADS) \
&& !defined (_RWSTD_POSIX_THREADS) \
&& !defined (_RWSTD_SOLARIS_THREADS)
// default to POSIX threads except on Win32 or Win64
# if !defined (_WIN32) && !defined (_WIN64)
# define _RWSTD_POSIX_THREADS
# endif // _WIN{32,64}
# endif // _RWSTD_*_THREADS
#endif // _RWSTD_REENTRANT
#ifdef _RWSTD_DCE_THREADS
# define _RWSTD_NO_STATIC_MUTEX_INIT
#endif // _RWSTD_DCE_THREADS
/********************** Miscellaneous *************************************/
// g++ cannot inline functions that take a variable number of arguments
// or functions that contain static (local) variables
#if !defined (__GNUG__) || __GNUG__ > 2 || __GNUG_MINOR__ > 96
# define _INLINE_VARARGS inline
# if !defined (__HP_aCC) || __HP_aCC > 012100
// working around a known aCC 1.21 bug
# define _INLINE_WITH_STATICS inline
# endif // !__HP_aCC || __HP_aCC > 012100
#endif // !__GNUG__ || __GNUG__ > 2 || __GNUG_MINOR__ > 96
#if defined (_RWSTD_NO_COLLAPSE_TEMPLATE_STATICS) \
|| defined (_RWSTD_NO_STATIC_TEMPLATE_MEMBER_INIT)
// static mutex initialization depends on the compiler's (and the
// linker's in gcc's case) ability to correctly handle explicitly
// initialized static members of class templates
# ifndef _RWSTD_NO_STATIC_MUTEX_INIT
# define _RWSTD_NO_STATIC_MUTEX_INIT
# endif
#endif // NO_COLLAPSE_TEMPLATE_STATICS || NO_STATIC_TEMPLATE_MEMBER_INIT
/********************** Environment ***************************************/
// pa-risc2 atomic ops related
#if defined(_PA_RISC2_0) && defined(__HP_aCC)
# define _RWSTD_STRING_REF_OFFSET _RWSTD_INT_MAX
#endif
#if defined (_RWSTD_NO_WCHAR_T) && !defined (_RWSTD_NO_NATIVE_WCHAR_T)
# define _RWSTD_NO_NATIVE_WCHAR_T
#endif
#ifndef _RWSTD_NO_STL_SPECIALIZATION
// #ifdef _RWSTD_NO_CLASS_PARTIAL_SPEC
// disable partial specialization for void* of STL sequences
# define _RWSTD_NO_STL_SPECIALIZATION
// #endif // _RWSTD_NO_CLASS_PARTIAL_SPEC
#endif // _RWSTD_NO_STL_SPECIALIZATION
//
// Macro for path to the ANSI 'C' headers
// Must be set specifically for each platform when the
// C++ wrappers for 'C' headers are used.
//
#define _RWSTD_ANSIC(x) </usr/include/x>
// the default long double printf format prefix is "L" (unless #defined above)
#ifndef _RWSTD_LDBL_PRINTF_PREFIX
# define _RWSTD_LDBL_PRINTF_PREFIX "L"
#endif // _RWSTD_LDBL_PRINTF_PREFIX
// the default long double scanf format prefix is "L" (unless #defined above)
#ifndef _RWSTD_LDBL_SCANF_PREFIX
# define _RWSTD_LDBL_SCANF_PREFIX "L"
#endif // _RWSTD_LDBL_SCANF_PREFIX
// the default expansion of dllimport is empty (unless #defined above)
#ifndef _RWSTD_DLLIMPORT
# define _RWSTD_DLLIMPORT /* empty */
#endif // _RWSTD_DLLIMPORT
// the default name of a libc symbol is itself (unless #defined above)
#ifndef _RWSTD_LIBC_SYM
# define _RWSTD_LIBC_SYM(name) name
#endif // _RWSTD_LIBC_SYM
/********************** Library Option Dependencies ***********************/
/*
* The following macro sets the default size of file stream internal buffers
*/
#ifndef _RWSTD_DEFAULT_BUFSIZE // specified on command line?
# define _RWSTD_DEFAULT_BUFSIZE 512
#endif
#ifndef _RWSTD_NO_LONG_LONG
// Win32/64 #defines _RWSTD_LONG_LONG to __int64
# ifndef _RWSTD_LONG_LONG
# define _RWSTD_LONG_LONG long long
# endif // _RWSTD_LONG_LONG
#endif // _RWSTD_NO_LONG_LONG
// disable all extensions in strict ANSI mode
#ifdef _RWSTD_STRICT_ANSI
// long long is not in ANSI C++ yet (although it is in ANSI C99)
# undef _RWSTD_LONG_LONG
# define _RWSTD_NO_EXT_FILEBUF
# define _RWSTD_NO_EXT_VECTOR_BOOL_REF_OPS
# define _RWSTD_NO_EXT_LOCALE
# define _RWSTD_NO_EXT_DEEP_STRING_COPY
// no support for exceptions derived from ios_base::failure
# define _RWSTD_NO_EXT_FAILURE
// no support for writing out integral values in base 2
# define _RWSTD_NO_EXT_BIN_IO
// disable safe conversion of iostream objects only to bool
// (and enable conversion to void*)
# define _RWSTD_NO_EXT_IOS_SAFE_CONVERSION
// std::setbase manipulator accepts only required bases (i.e.,
// 0, 8, 10, 16, and 2 unless _RWSTD_NO_EXT_BIN_IO is also #defined)
# define _RWSTD_NO_EXT_SETBASE
// disable the str(const char*) overload in stringbuf and stringstreams
# define _RWSTD_NO_EXT_STRINGBUF_STR
// no support for member overloads on all fundamental types
# define _RWSTD_NO_EXT_NUM_GET
# define _RWSTD_NO_EXT_NUM_PUT
// no support for extended member overloads
# define _RWSTD_NO_EXT_TIME_GET
// no support for optional mt-locking in iostreams
# define _RWSTD_NO_EXT_REENTRANT_IO
// allocator<const T> not possible
# define _RWSTD_NO_EXT_CONST_ALLOCATOR
// missing operator new or delete not defined
# define _RWSTD_NO_EXT_OPERATOR_NEW
// void std::count<>() not defined (except when necessary)
# define _RWSTD_NO_EXT_VOID_COUNT
// void std::distance() not defined
# define _RWSTD_NO_EXT_VOID_DISTANCE
// calling width(0) only when insertion succeeds
# define _RWSTD_NO_EXT_KEEP_WIDTH_ON_FAILURE
// deque::assign() clears container before assignment
// rather than assigning over existing elements
# define _RWSTD_NO_EXT_DEQUE_ASSIGN_IN_PLACE
// deque::insert() creates a copy of the container
// to insert into and on success swaps the copy
# define _RWSTD_NO_EXT_DEQUE_INSERT_IN_PLACE
// primary templates not defined
# define _RWSTD_NO_EXT_CHAR_TRAITS_PRIMARY
# define _RWSTD_NO_EXT_CODECVT_PRIMARY
# define _RWSTD_NO_EXT_COLLATE_PRIMARY
# define _RWSTD_NO_EXT_CTYPE_PRIMARY
// random number generator used by algorithms such as random_shuffle
// utilizes the entire range of size_t and will not generate the same
// sequence of values between ILP32 and LP64 (or LLP64)
# define _RWSTD_NO_EXT_PORTABLE_RANDOM_SEQUENCE
// disable the implementation of LWG issue 559 (numeric_limits
// limits specialized on cv-qualified scalar types)
# define _RWSTD_NO_EXT_CV_QUALIFIED_LIMITS
// commented out macros not implemented yet
// # define _RWSTD_NO_EXT_MONEYPUNCT_PRIMARY
// # define _RWSTD_NO_EXT_NUMPUNCT_PRIMARY
// # define _RWSTD_NO_EXT_TIME_GET_PRIMARY
// # define _RWSTD_NO_EXT_TIME_PUT_PRIMARY
// # define _RWSTD_NO_EXT_MESSAGES_PRIMARY
#endif // _RWSTD_STRICT_ANSI
// macros that are enabled in library source files
#ifdef _RWSTD_LIB_SRC
// don't instantiate templates in library source code
// (but see _RWSTD_INSTANTIATE_TEMPLATES macro below)
# define _RWSTD_NO_TEMPLATE_DEFINITIONS
// don't provide definitions of operator new in library
# define _RWSTD_NO_EXT_OPERATOR_NEW
#endif // _RWSTD_LIB_SRC
#if _MSC_VER <= 1300
// msvc60 expects a definition to be provided for all variants
// of operator new/delete that are declared. This means that either
// the operators must be defined - preventing redefinition in user code -
// or that they must be undeclared - preventing them from being called
// directly in user code. We have chosen the former option.
# undef _RWSTD_NO_EXT_OPERATOR_NEW
#endif // _MSC_VER
#ifdef _RWSTD_INSTANTIATE_TEMPLATES
// instantiate templates (this macro is defined at the top of each
// library source file (.cpp file) that explicitly instantiates class
// or function templates using the _RWSTD_INSTANTIATE_N() macros
# undef _RWSTD_NO_TEMPLATE_DEFINITIONS
#endif
#endif // _RWSTD_RW_CONFIG_H_INCLUDED

1618
extern/stdcxx/4.2.1/include/rw/_defs.h vendored Normal file

File diff suppressed because it is too large Load Diff

147
extern/stdcxx/4.2.1/include/rw/_error.h vendored Normal file
View File

@@ -0,0 +1,147 @@
/**************************************************************************
*
* _error.h - Definitions for error messages
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _error.h 550991 2007-06-26 23:58:07Z sebor $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
**************************************************************************/
#ifndef _RWSTD_RW_ERROR_H_INCLUDED
#define _RWSTD_RW_ERROR_H_INCLUDED
#ifndef _RWSTD_NO_INCLUDES
// prevent inclusion if compiling a .rc file with MSVC
# ifndef _RWSTD_RW_DEFS_H_INCLUDED
# include <rw/_defs.h>
# endif // _RWSTD_RW_DEFS_H_INCLUDED
_RWSTD_NAMESPACE (__rw) {
// throws an exception identified by first argument, optional arguments
// (if any) used to format the exception object's what() string
_RWSTD_EXPORT void __rw_throw (int, ...);
// frees memory buffer used for what() message
_RWSTD_EXPORT void __rw_free_what_buf (char*);
// throws an exception identified by first argument with the second
// argument containing the exception object's what() string, which
// if non-0, is must be freed using __rw_free_what_buf()
// may be assigned to a user-defined handler (e.g., to prevent
// the library from throwing exceptions or to implement logging)
_RWSTD_EXPORT extern void (*__rw_throw_proc)(int, char*);
} // namespace __rw
#endif
#ifndef _RWSTD_ERROR_CATALOG
// name of catalog optionally followed by a colon and a set number
// catalog looked up according to rules of catopen(3)
// may be customized at lib build time (pathname okay)
# define _RWSTD_ERROR_CATALOG "rwstderr:1"
#endif // _RWSTD_ERROR_CATALOG
#ifndef _RWSTD_ERROR_ENVVAR
// environment variable name - overrides _RWSTD_ERROR_CATALOG
// may be customized at lib build time
# define _RWSTD_ERROR_ENVVAR "RWSTDERR"
#endif // _RWSTD_ERROR_ENVVAR
#ifndef _RWSTD_ERROR_FIRST
// id of first message - 1, may be customized at lib build time
# define _RWSTD_ERROR_FIRST 0
#endif // _RWSTD_ERROR_FIRST
// these must be macros to accomodate MSVC's resource compiler, with values
// expected to be consecutive starting with _RWSTD_ERROR_FIRST + 1
// # define _RWSTD_ERROR_EXCEPTION (_RWSTD_ERROR_FIRST + 1)
// # define _RWSTD_ERROR_BAD_EXCEPTION (_RWSTD_ERROR_FIRST + 2)
// # define _RWSTD_ERROR_BAD_ALLOC (_RWSTD_ERROR_FIRST + 3)
# define _RWSTD_ERROR_BAD_CAST (_RWSTD_ERROR_FIRST + 4)
# define _RWSTD_ERROR_LOGIC_ERROR (_RWSTD_ERROR_FIRST + 5)
# define _RWSTD_ERROR_DOMAIN_ERROR (_RWSTD_ERROR_FIRST + 6)
# define _RWSTD_ERROR_INVALID_ARGUMENT (_RWSTD_ERROR_FIRST + 7)
# define _RWSTD_ERROR_LENGTH_ERROR (_RWSTD_ERROR_FIRST + 8)
# define _RWSTD_ERROR_OUT_OF_RANGE (_RWSTD_ERROR_FIRST + 9)
# define _RWSTD_ERROR_RUNTIME_ERROR (_RWSTD_ERROR_FIRST + 10)
# define _RWSTD_ERROR_RANGE_ERROR (_RWSTD_ERROR_FIRST + 11)
# define _RWSTD_ERROR_OVERFLOW_ERROR (_RWSTD_ERROR_FIRST + 12)
# define _RWSTD_ERROR_UNDERFLOW_ERROR (_RWSTD_ERROR_FIRST + 13)
# define _RWSTD_ERROR_FAILBIT_SET (_RWSTD_ERROR_FIRST + 14)
# define _RWSTD_ERROR_BADBIT_SET (_RWSTD_ERROR_FIRST + 15)
# define _RWSTD_ERROR_EOFBIT_SET (_RWSTD_ERROR_FIRST + 16)
# define _RWSTD_ERROR_IOSTATE_BIT_SET (_RWSTD_ERROR_FIRST + 17)
# define _RWSTD_ERROR_FACET_NOT_FOUND (_RWSTD_ERROR_FIRST + 18)
# define _RWSTD_ERROR_LOCALE_BAD_NAME (_RWSTD_ERROR_FIRST + 19)
# define _RWSTD_ERROR_LOCALE_ERROR_NAME (_RWSTD_ERROR_FIRST + 20)
# define _RWSTD_ERROR_CODECVT (_RWSTD_ERROR_FIRST + 21)
# define _RWSTD_ERROR_BAD_POINTER (_RWSTD_ERROR_FIRST + 22)
# define _RWSTD_ERROR_TRANSFORM (_RWSTD_ERROR_FIRST + 23)
# define _RWSTD_ERROR_LOCALE_BAD_CAT (_RWSTD_ERROR_FIRST + 24)
# define _RWSTD_ERROR_STRINGS \
"%s: %s: unspecified error", \
"%s: %s: exception", \
"%s: %s: unexpected exception", \
"%s: %s: bad_alloc: out of memory", \
"%s: %s: bad cast", \
"%s: %s: logic error", \
"%s: %s: domain error", \
"%s: %s: invalid argument", \
"%s: %s: length error: size %u out of range [0, %u)", \
"%s: %s: argument value %u out of range [0, %u)", \
"%s: %s: runtime error", \
"%s: %s: range error: invalid range [%d, %d)", \
"%s: %s: overflow error", \
"%s: %s: underflow error", \
/* the following take a single arg because */ \
/* they are generated in a .cpp file */ \
"%s: stream object has set ios::failbit", \
"%s: stream object has set ios::badbit", \
"%s: stream object has set ios::eofbit", \
"%s: stream object has set %s", \
"%s: %s: facet %u not found in locale (\"%s\")", \
"%s: %s: bad locale name: \"%s\"", \
"%s: %s: failed to construct locale name", \
"%s: %s: conversion failed", \
"%s: %s: invalid pointer %p", \
"%s: %s: transformation failed", \
"%s: %s: bad category value: %#x"
#define _RWSTD_ERROR_EXCEPTION "exception"
#define _RWSTD_ERROR_BAD_EXCEPTION "unexpected exception"
#define _RWSTD_ERROR_BAD_ALLOC "bad_alloc: out of memory"
#endif // _RWSTD_RW_ERROR_H_INCLUDED

View File

@@ -0,0 +1,96 @@
/***************************************************************************
*
* _exception.h - Declarations for the Standard Library exception class
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _exception.h 648752 2008-04-16 17:01:56Z faridz $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
**************************************************************************/
#ifndef _RWSTD_RW_EXCEPTION_H_INCLUDED
#define _RWSTD_RW_EXCEPTION_H_INCLUDED
#include <exception>
#ifndef _RWSTD_RW_DEFS_H_INCLUDED
# include <rw/_defs.h>
#endif // _RWSTD_RW_DEFS_H_INCLUDED
_RWSTD_NAMESPACE (std) {
// forward declarations avoid circular dependencies
template <class _CharT, class _Traits, class _Allocator>
class basic_string;
template <class _CharT>
struct char_traits;
template <class _TypeT>
class allocator;
typedef basic_string<char, char_traits<char>, allocator<char> > string;
} // namespace std
_RWSTD_NAMESPACE (__rw) {
// base exception class inherited by all other exceptions
class _RWSTD_EXPORT __rw_exception: public _STD::exception
{
public:
__rw_exception () _THROWS (());
__rw_exception (const __rw_exception&);
_EXPLICIT __rw_exception (const _STD::string&);
_EXPLICIT __rw_exception (const char*);
virtual ~__rw_exception () _THROWS (());
// empty exception specification necessary in order to preserve
// the no-exception guarantee provided by std::exception to
// derived classes (e.g., logic_error)
__rw_exception& operator= (const __rw_exception&) _THROWS (());
virtual const char* what () const _THROWS (());
__rw_exception&
_C_assign (const char*, _RWSTD_SIZE_T = _RWSTD_SIZE_MAX);
private:
char *_C_what; // description string
};
} // namespace __rw
#endif // _RWSTD_RW_EXCEPTION_H_INCLUDED

61
extern/stdcxx/4.2.1/include/rw/_file.h vendored Normal file
View File

@@ -0,0 +1,61 @@
/***************************************************************************
*
* _file.h - Wrapper definitions for platform independent file I/O
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _file.h 550991 2007-06-26 23:58:07Z sebor $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
**************************************************************************/
#ifndef _RWSTD_RW_FILE_H_INCLUDED
#define _RWSTD_RW_FILE_H_INCLUDED
#ifndef _RWSTD_RW_DEFS_H_INCLUDED
# include <rw/_defs.h>
#endif // _RWSTD_RW_DEFS_H_INCLUDED
_RWSTD_NAMESPACE (__rw) {
_RWSTD_EXPORT void* __rw_fopen (const char*, int, long);
_RWSTD_EXPORT void* __rw_fdopen (int);
_RWSTD_EXPORT int __rw_fclose (void*, int);
_RWSTD_EXPORT int __rw_fileno (void*, int);
_RWSTD_EXPORT int __rw_fdmode (int);
_RWSTD_EXPORT int __rw_fmode (void*, int);
_RWSTD_EXPORT _RWSTD_SIZE_T
__rw_fread (void*, int, void*, _RWSTD_SIZE_T);
_RWSTD_EXPORT _RWSTD_PTRDIFF_T
__rw_fwrite (void*, int, const void*, _RWSTD_SIZE_T);
_RWSTD_EXPORT long __rw_fseek (void*, int, _RWSTD_PTRDIFF_T, int);
_RWSTD_EXPORT int __rw_fflush (void*, int);
} // namespace __rw
#endif // _RWSTD_RW_FILE_H_INCLUDED

View File

@@ -0,0 +1,102 @@
// -*- C++ -*-
/***************************************************************************
*
* _funcbase.h - definitions of function objects base classes
*
* $Id: _funcbase.h 550991 2007-06-26 23:58:07Z sebor $
*
***************************************************************************
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* 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. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
**************************************************************************/
#ifndef _RWSTD_RW_FUNCBASE_H_INCLUDED
#define _RWSTD_RW_FUNCBASE_H_INCLUDED
#ifndef _RWSTD_RW_DEFS_H_INCLUDED
# include <rw/_defs.h>
#endif // _RWSTD_RW_DEFS_H_INCLUDED
_RWSTD_NAMESPACE (std) {
// 20.3.1 - Base
template <class _Arg, class _Result>
struct unary_function
{
typedef _Arg argument_type;
typedef _Result result_type;
};
#define _RWSTD_UNARY_FUNCTION_TYPES(T, U) \
typedef _TYPENAME _STD::unary_function<T, U>::argument_type argument_type; \
typedef _TYPENAME _STD::unary_function<T, U>::result_type result_type
template <class _Arg1, class _Arg2, class _Result>
struct binary_function
{
typedef _Arg1 first_argument_type;
typedef _Arg2 second_argument_type;
typedef _Result result_type;
};
#define _RWSTD_BINARY_FUNCTION_TYPES(T, U, V) \
typedef _TYPENAME _STD::binary_function<T, U, V>::second_argument_type \
second_argument_type; \
typedef _TYPENAME _STD::binary_function<T, U, V>::first_argument_type \
first_argument_type; \
typedef _TYPENAME _STD::binary_function<T, U, V>::result_type \
result_type
// 20.3.3, p5
template <class _TypeT>
struct less: binary_function<_TypeT, _TypeT, bool>
{
_RWSTD_BINARY_FUNCTION_TYPES (_TypeT, _TypeT, bool);
result_type operator() (const first_argument_type &__x,
const second_argument_type &__y) const {
return __x < __y;
}
};
} // namespace std
#endif // _RWSTD_RW_FUNCBASE_H_INCLUDED

29
extern/stdcxx/4.2.1/include/rw/_heap.c vendored Normal file
View File

@@ -0,0 +1,29 @@
/***************************************************************************
*
* rw/_heap.c
*
* $Id: _heap.c 580483 2007-09-28 20:55:52Z sebor $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
**************************************************************************/
#include <rw/_heap.cc>

107
extern/stdcxx/4.2.1/include/rw/_heap.cc vendored Normal file
View File

@@ -0,0 +1,107 @@
/***************************************************************************
*
* _heap.cc - Non-inline definitions for the C++ Standard Library
* Heap operations
*
* $Id: _heap.cc 550991 2007-06-26 23:58:07Z sebor $
*
***************************************************************************
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* 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. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
**************************************************************************/
_RWSTD_NAMESPACE (std) {
_EXPORT
template <class _RandomAccessIter, class _Dist, class _TypeT, class _Compare>
void __push_heap (_RandomAccessIter __first, _Dist __holeIndex,
_Dist __topIndex, _TypeT __val, _Compare __comp)
{
for (_Dist __parent = (__holeIndex - 1) / 2;
__holeIndex > __topIndex
&& !(__comp (*(__first + __parent), __val) == false);
__parent = ((__holeIndex = __parent) - 1) / 2) {
*(__first + __holeIndex) = *(__first + __parent);
}
*(__first + __holeIndex) = __val;
}
_EXPORT
template <class _RandomAccessIter, class _Dist, class _TypeT, class _Compare>
void __adjust_heap (_RandomAccessIter __first, _Dist __holeIndex,
_Dist __dist, _TypeT __val, _Compare __comp)
{
const _Dist __topIndex = __holeIndex;
_Dist __2ndChild;
while ((__2ndChild = 2 * __holeIndex + 2) < __dist) {
if (__comp (*(__first + __2ndChild), *(__first + (__2ndChild - 1))))
--__2ndChild;
*(__first + __holeIndex) = *(__first + __2ndChild);
__holeIndex = __2ndChild;
}
if (__2ndChild == __dist) {
*(__first + __holeIndex) = *(__first + (__2ndChild - 1));
__holeIndex = __2ndChild - 1;
}
__push_heap (__first, __holeIndex, __topIndex, __val, __comp);
}
_EXPORT
template <class _RandomAccessIter, class _Compare, class _Dist>
void __make_heap (_RandomAccessIter __first, _RandomAccessIter __last,
_Compare __comp, _Dist*)
{
_RWSTD_ASSERT_RANGE (__first, __last);
const _Dist __dist = __last - __first;
for (_Dist __parent = (__dist - 2) / 2; ; --__parent) {
__adjust_heap (__first, __parent, __dist, *(__first + __parent),
__comp);
if (__parent == 0)
return;
}
}
} // namespace std

194
extern/stdcxx/4.2.1/include/rw/_heap.h vendored Normal file
View File

@@ -0,0 +1,194 @@
// -*- C++ -*-
/***************************************************************************
*
* _heap.h - declarations and inline definitions of the C++ Standard
* Library Heap operations
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _heap.h 550991 2007-06-26 23:58:07Z sebor $
*
***************************************************************************
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* 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. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
**************************************************************************/
#ifndef _RWSTD_RW_HEAP_H_INCLUDED
#define _RWSTD_RW_HEAP_H_INCLUDED
#ifndef _RWSTD_RW_ALGOBASE_H_INCLUDED
# include <rw/_algobase.h>
#endif // _RWSTD_RW_ALGOBASE_H_INCLUDED
#ifndef _RWSTD_RW_ITERBASE_H_INCLUDED
# include <rw/_iterbase.h>
#endif // _RWSTD_RW_ITERBASE_H_INCLUDED
_RWSTD_NAMESPACE (std) {
// 25.3.6 - Heap operations
// helper to work around the lack of iterator_traits
_EXPORT
template <class _RandomAccessIter, class _Dist, class _TypeT,
class _Compare>
void __push_heap (_RandomAccessIter, _Dist, _Dist, _TypeT, _Compare);
template <class _RandomAccessIter, class _Dist, class _Compare>
inline void
__push_heap (_RandomAccessIter __first, _RandomAccessIter __last,
_Dist*, _Compare __comp)
{
__push_heap (__first, _Dist (__last - __first), _Dist (), *__last, __comp);
}
// 25.3.6.1
template <class _RandomAccessIter, class _Compare>
inline void push_heap (_RandomAccessIter __first, _RandomAccessIter __last,
_Compare __comp)
{
_RWSTD_ASSERT_RANGE (__first, __last);
if (!(__first == __last))
__push_heap (__first, --__last,
_RWSTD_DIFFERENCE_TYPE (_RandomAccessIter), __comp);
}
// 25.3.6.1
template <class _RandomAccessIter>
inline void push_heap (_RandomAccessIter __first, _RandomAccessIter __last)
{
_STD::push_heap (__first, __last, _RWSTD_LESS (_RandomAccessIter));
}
_EXPORT
template <class _RandomAccessIter, class _Dist, class _TypeT,
class _Compare>
void __adjust_heap (_RandomAccessIter, _Dist, _Dist, _TypeT, _Compare);
// helper to work around the lack of iterator_traits
template <class _RandomAccessIter, class _TypeT, class _Compare, class _Dist>
inline void
__pop_heap (_RandomAccessIter __first, _RandomAccessIter __last,
_RandomAccessIter __res, _TypeT __val, _Compare __cmp, _Dist*)
{
*__res = *__first;
__adjust_heap (__first, _Dist (), _Dist (__last - __first), __val, __cmp);
}
// 25.3.6.2
template <class _RandomAccessIter, class _Compare>
inline void
pop_heap (_RandomAccessIter __first, _RandomAccessIter __last, _Compare __comp)
{
_RWSTD_ASSERT_RANGE (__first, __last);
if (!(__first == __last)) {
--__last;
__pop_heap (__first, __last, __last, *__last, __comp,
_RWSTD_DIFFERENCE_TYPE (_RandomAccessIter));
}
}
// 25.3.6.2
template <class _RandomAccessIter>
inline void pop_heap (_RandomAccessIter __first, _RandomAccessIter __last)
{
_STD::pop_heap (__first, __last, _RWSTD_LESS (_RandomAccessIter));
}
_EXPORT
template <class _RandomAccessIter, class _Compare, class _Dist>
void __make_heap (_RandomAccessIter, _RandomAccessIter, _Compare, _Dist*);
// 25.3.6.3
template <class _RandomAccessIter, class _Compare>
inline void make_heap (_RandomAccessIter __first, _RandomAccessIter __last,
_Compare __comp)
{
_RWSTD_ASSERT_RANGE (__first, __last);
if (!(__last - __first < 2))
__make_heap (__first, __last, __comp,
_RWSTD_DIFFERENCE_TYPE (_RandomAccessIter));
}
// 25.3.6.3
template <class _RandomAccessIter>
inline void make_heap (_RandomAccessIter __first, _RandomAccessIter __last)
{
_STD::make_heap (__first, __last, _RWSTD_LESS (_RandomAccessIter));
}
// 25.3.6.4
template <class _RandomAccessIter, class _Compare>
inline void sort_heap (_RandomAccessIter __first, _RandomAccessIter __last,
_Compare __comp)
{
_RWSTD_ASSERT_RANGE (__first, __last);
for (; __last - __first > 1; --__last)
_STD::pop_heap (__first, __last, __comp);
}
// 25.3.6.4
template <class _RandomAccessIter>
inline void sort_heap (_RandomAccessIter __first, _RandomAccessIter __last)
{
_STD::sort_heap (__first, __last, _RWSTD_LESS (_RandomAccessIter));
}
} // namespace std
#ifdef _RWSTD_NO_IMPLICIT_INCLUSION
# include <rw/_heap.cc>
#endif
#endif // _RWSTD_RW_HEAP_H_INCLUDED

View File

@@ -0,0 +1,29 @@
/***************************************************************************
*
* rw/_ioinsert.c
*
* $Id: _ioinsert.c 580483 2007-09-28 20:55:52Z sebor $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
**************************************************************************/
#include <rw/_ioinsert.cc>

View File

@@ -0,0 +1,195 @@
/***************************************************************************
*
* _ioinsert.cc - definitions for the C++ Standard Library inserter
* helper templates
*
* $Id: _ioinsert.cc 590052 2007-10-30 12:44:14Z faridz $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
**************************************************************************/
#include <rw/_select.h>
_RWSTD_NAMESPACE (__rw) {
_EXPORT
template <class _CharT, class _Traits, class _NativeType>
_STD::basic_ostream<_CharT, _Traits>&
__rw_insert (_STD::basic_ostream<_CharT, _Traits> &__strm,
_NativeType __val)
{
const _TYPENAME _STD::basic_ostream<_CharT, _Traits>::sentry
__opfx (__strm);
_TRY {
typedef _STD::ostreambuf_iterator<_CharT, _Traits> _Iter;
typedef _STD::num_put<_CharT, _Iter> _NumPut;
if (__opfx && _STD_USE_FACET (_NumPut, __strm.getloc ())
.put (_Iter (__strm), __strm, __strm.fill (), __val).failed ()) {
// this may throw but the exception will just be caught
// and rethrown below; this optimizes for the common case
// (i.e., success) but pessimizes the case of failure
__strm.setstate (_STD::ios_base::badbit);
}
}
_CATCH (...) {
__strm.setstate (_STD::ios_base::badbit | _RW::__rw_rethrow);
}
return __strm;
}
// optimized for when stream's char_type is the same
// as the type of the character string being inserted,
// i.e., ostream and char* and wostream and wchar_t*
template <class _CharT, class _Traits>
inline _RWSTD_STREAMSIZE
__rw_sputn (_STD::basic_ostream<_CharT, _Traits> &__strm,
const _CharT *__s, _RWSTD_STREAMSIZE __len, __rw_true_t)
{
_RWSTD_ASSERT (!__len || __len > 0 && 0 != __s);
if (1 == __len) {
typedef _TYPENAME _Traits::int_type _IntT;
const _IntT __ic = __strm.rdbuf ()->sputc (*__s);
return 0 + !_Traits::eq_int_type (_Traits::eof (), __ic);
}
return __strm.rdbuf ()->sputn (__s, __len);
}
// special case for char* insertion into a stream whose
// char_type is not char (e.g., wostream or user-defined)
template <class _CharT, class _Traits>
inline _RWSTD_STREAMSIZE
__rw_sputn (_STD::basic_ostream<_CharT, _Traits> &__strm,
const char *__s, _RWSTD_STREAMSIZE __len, __rw_false_t)
{
_RWSTD_ASSERT (!__len || __len > 0 && 0 != __s);
const _STD::ctype<_CharT>& __ctp =
_STD_USE_FACET (_STD::ctype<_CharT>, __strm.getloc ());
for (_RWSTD_STREAMSIZE __i = 0; __i < __len; ++__i) {
typedef _TYPENAME _Traits::int_type _IntT;
const _IntT __ic = __strm.rdbuf ()->sputc (__ctp.widen (__s [__i]));
if (_Traits::eq_int_type (__ic, _Traits::eof ()))
return __i;
}
return __len;
}
_EXPORT
template<class _CharT, class _Traits, class _StringT>
_STD::basic_ostream<_CharT, _Traits>&
__rw_insert (_STD::basic_ostream<_CharT, _Traits> &__strm,
const _StringT *__s,
_RWSTD_STREAMSIZE __len,
_RWSTD_STREAMSIZE __width)
{
_RWSTD_ASSERT (0 != __strm.rdbuf ());
_RWSTD_ASSERT (0 != __s);
_STD::ios_base::iostate __err = _STD::ios_base::goodbit;
// writes out max(len, width) characters, padding appropriately
// with the fill character if (len < width);
// calls width(0) if and only if the write has been successful
// (i.e., will leave it unchanged if sputn fails or throws an
// exception)
_TRY {
const _TYPENAME _STD::basic_ostream<_CharT, _Traits>::sentry
__opfx (__strm);
if (__opfx) {
// compute the number of fill chars to pad with
// according to the rules described in 22.2.2.2.2, p19
const _RWSTD_STREAMSIZE __pad = __width - __len;
typedef _TYPENAME
__rw_is_same<_CharT, _StringT>::_C_type _Same;
if (__pad > 0) {
const int __padbits =
_STD::ios_base::adjustfield & __strm.flags ();
// output left padding (output is right-aligned by default)
if ( _STD::ios_base::left != __padbits
&& __pad != __strm._C_pad (__pad)
// write out (not necessarily null-terminated) string
|| __len != __rw_sputn (__strm, __s, __len, _Same ())
// output right padding (output is left-aligned)
|| _STD::ios_base::left == __padbits
&& __pad != __strm._C_pad (__pad))
__err = _STD::ios_base::badbit;
#ifndef _RWSTD_NO_EXT_KEEP_WIDTH_ON_FAILURE
else
__strm.width (0); // reset width only on success
#else // if defined (_RWSTD_NO_EXT_KEEP_WIDTH_ON_FAILURE)
__strm.width (0); // reset width unconditionally
#endif // _RWSTD_NO_EXT_KEEP_WIDTH_ON_FAILURE
}
else if (__len == __rw_sputn (__strm, __s, __len, _Same ())) {
__strm.width (0); // reset width only on success
}
else {
__err = _STD::ios_base::badbit;
#ifdef _RWSTD_NO_EXT_KEEP_WIDTH_ON_FAILURE
__strm.width (0);
#endif // _RWSTD_NO_EXT_KEEP_WIDTH_ON_FAILURE
}
}
}
_CATCH (...) {
// set badbit and rethrow the caught exception if badbit
// is also set in exceptions()
__strm.setstate (_STD::ios_base::badbit | _RW::__rw_rethrow);
}
if (__err) {
// set badbit which may throw ios_base::failure
__strm.setstate (__err);
}
return __strm;
}
} // namespace __rw

View File

@@ -0,0 +1,226 @@
// -*- C++ -*-
/***************************************************************************
*
* _ioinsert.h - declarations for the C++ Standard Library inserter
* helper templates
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _ioinsert.h 637130 2008-03-14 15:16:33Z faridz $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 2003-2006 Rogue Wave Software.
*
**************************************************************************/
#ifndef _RWSTD_RW_IOINSERT_H_INCLUDED
#define _RWSTD_RW_IOINSERT_H_INCLUDED
#if __GNUG__ >= 3
# pragma GCC system_header
#endif // gcc >= 3
#ifndef _RWSTD_NO_REDUNDANT_DEFINITIONS
# ifndef _RWSTD_RW_IOITER_H_INCLUDED
# include <rw/_ioiter.h>
# endif // _RWSTD_RW_IOITER_H_INCLUDED
# include <streambuf>
#endif // _RWSTD_NO_REDUNDANT_DEFINITIONS
#include <loc/_num_get.h>
#include <loc/_num_put.h>
#ifndef _RWSTD_RW_BASIC_IOS_H_INCLUDED
# include <rw/_basic_ios.h>
#endif // _RWSTD_RW_BASIC_IOS_H_INCLUDED
_RWSTD_NAMESPACE (std) {
#ifndef _RWSTD_IOSFWD_INCLUDED
_EXPORT
template <class _CharT, class _Traits = char_traits<_CharT> >
class basic_ostream;
typedef basic_ostream<char> ostream;
# ifndef _RWSTD_NO_WCHAR_T
typedef basic_ostream<wchar_t> wostream;
# endif // _RWSTD_NO_WCHAR_T
#endif // _RWSTD_IOSFWD_INCLUDED
}
_RWSTD_NAMESPACE (__rw) {
// helper - implements insertion of arithmetic and pointer types
_EXPORT
template <class _CharT, class _Traits, class _NativeType>
_STD::basic_ostream<_CharT, _Traits>&
__rw_insert (_STD::basic_ostream<_CharT, _Traits>&, _NativeType);
// helper - implements insertion of character strigs
_EXPORT
template<class _CharT, class _Traits, class _StringT>
_STD::basic_ostream<_CharT, _Traits>&
__rw_insert (_STD::basic_ostream<_CharT, _Traits>&, const _StringT*,
_RWSTD_STREAMSIZE, _RWSTD_STREAMSIZE);
} // namespace __rw
#if _RWSTD_DEFINE_TEMPLATE_FIRST (_INSERTER)
# include <rw/_ioinsert.cc>
#endif // _RWSTD_DEFINE_TEMPLATE_FIRST (_INSERTER)
_RWSTD_NAMESPACE (__rw) {
#if _RWSTD_INSTANTIATE (_INSERT_INT, _CHAR)
# ifndef _RWSTD_NO_NATIVE_BOOL
_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::ostream&
__rw_insert (_STD::ostream&, bool));
# endif // _RWSTD_NO_NATIVE_BOOL
_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::ostream&
__rw_insert (_STD::ostream&, long));
_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::ostream&
__rw_insert (_STD::ostream&, unsigned long));
# ifdef _RWSTD_LONG_LONG
_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::ostream&
__rw_insert (_STD::ostream&, _RWSTD_LONG_LONG));
_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::ostream&
__rw_insert (_STD::ostream&,
unsigned _RWSTD_LONG_LONG));
# endif // _RWSTD_LONG_LONG
#endif // _RWSTD_INSTANTIATE (_INSERT_INT, _CHAR)
#if _RWSTD_INSTANTIATE (_INSERT_DBL, _CHAR)
_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::ostream&
__rw_insert (_STD::ostream&, double));
# ifndef _RWSTD_NO_LONG_DOUBLE
_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::ostream&
__rw_insert (_STD::ostream&, long double));
# endif // _RWSTD_NO_LONG_DOUBLE
#endif // _RWSTD_INSTANTIATE (_INSERT_DBL, _CHAR)
#if _RWSTD_INSTANTIATE (_INSERT_PTR, _CHAR)
_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::ostream&
__rw_insert (_STD::ostream&, const void*));
_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::ostream&
__rw_insert (_STD::ostream&, const char*,
_RWSTD_STREAMSIZE, _RWSTD_STREAMSIZE));
#endif // _RWSTD_INSTANTIATE (_INSERT_PTR, _CHAR)
#if _RWSTD_INSTANTIATE (_INSERT_INT, _WCHAR_T)
# ifndef _RWSTD_NO_NATIVE_BOOL
_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_EXPORT _STD::wostream&
__rw_insert (_STD::wostream&, bool));
# endif // _RWSTD_NO_NATIVE_BOOL
_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::wostream&
__rw_insert (_STD::wostream&, long));
_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::wostream&
__rw_insert (_STD::wostream&, unsigned long));
# ifdef _RWSTD_LONG_LONG
_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::wostream&
__rw_insert (_STD::wostream&, _RWSTD_LONG_LONG));
_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::wostream&
__rw_insert (_STD::wostream&,
unsigned _RWSTD_LONG_LONG));
# endif // _RWSTD_LONG_LONG
#endif // _RWSTD_INSTANTIATE (_INSERT_INT, _WCHAR_T)
#if _RWSTD_INSTANTIATE (_INSERT_DBL, _WCHAR_T)
_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::wostream&
__rw_insert (_STD::wostream&, double));
# ifndef _RWSTD_NO_LONG_DOUBLE
_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::wostream&
__rw_insert (_STD::wostream&, long double));
# endif // _RWSTD_NO_LONG_DOUBLE
#endif // _RWSTD_INSTANTIATE (_INSERT_DBL, _WCHAR_T)
#if _RWSTD_INSTANTIATE (_INSERT_PTR, _WCHAR_T)
_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::wostream&
__rw_insert (_STD::wostream&, const void*));
_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::wostream&
__rw_insert (_STD::wostream&, const char*,
_RWSTD_STREAMSIZE, _RWSTD_STREAMSIZE));
_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT _STD::wostream&
__rw_insert (_STD::wostream&, const wchar_t*,
_RWSTD_STREAMSIZE, _RWSTD_STREAMSIZE));
#endif // _RWSTD_INSTANTIATE (_INSERT_PTR, _WCHAR_T)
} // namespace __rw
#if _RWSTD_DEFINE_TEMPLATE_LAST (_INSERTER)
# include <rw/_ioinsert.cc>
#endif // _RWSTD_DEFINE_TEMPLATE_LAST (_INSERTER)
#endif // _RWSTD_RW_IOINSERT_H_INCLUDED

283
extern/stdcxx/4.2.1/include/rw/_ioiter.h vendored Normal file
View File

@@ -0,0 +1,283 @@
/***************************************************************************
*
* _ioiter.h - Definitions of stream iterator templates
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _ioiter.h 590052 2007-10-30 12:44:14Z faridz $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
**************************************************************************/
#ifndef _RWSTD_RW_IOITER_H_INCLUDED
#define _RWSTD_RW_IOITER_H_INCLUDED
#ifndef _RWSTD_RW_IOSFWD_H_INCLUDED
# include <rw/_iosfwd.h>
#endif // _RWSTD_RW_IOSFWD_H_INCLUDED
#ifndef _RWSTD_RW_ITERBASE_H_INCLUDED
# include <rw/_iterbase.h>
#endif // _RWSTD_RW_ITERBASE_H_INCLUDED
_RWSTD_NAMESPACE (std) {
#ifndef _RWSTD_IOSFWD_INCLUDED
template <class _CharT, class _Traits = char_traits<_CharT> >
struct istreambuf_iterator;
template <class _CharT, class _Traits = char_traits<_CharT> >
struct ostreambuf_iterator;
#endif // _RWSTD_IOSFWD_INCLUDED
// 24.5.3
template <class _CharT, class _Traits>
struct istreambuf_iterator
: iterator<input_iterator_tag, _CharT,
_TYPENAME _Traits::off_type, _CharT*, _CharT&>
{
typedef _CharT char_type;
typedef _Traits traits_type;
typedef _TYPENAME traits_type::int_type int_type;
typedef basic_streambuf<char_type, traits_type> streambuf_type;
typedef basic_istream<char_type, traits_type> istream_type;
private:
// 24.5.3.1 (exposition only)
class _C_proxy {
char_type _C_keep;
streambuf_type *_C_sb;
_C_proxy (char_type __c, streambuf_type *__sb)
: _C_keep (__c), _C_sb (__sb) { }
public:
char_type operator* () const {
return _C_keep;
}
friend struct istreambuf_iterator<char_type, traits_type>;
};
public:
#ifndef _RWSTD_STRICT_ANSI
// expose proxy in relaxed mode
typedef _C_proxy proxy;
#endif // _RWSTD_STRICT_ANSI
// 24.5.3.2, p1
istreambuf_iterator (streambuf_type *__sb = 0) _THROWS (())
: _C_sb (__sb) { }
// 24.5.3.2, p2
istreambuf_iterator (istream_type&) _THROWS (());
// 24.5.3.2, p3
istreambuf_iterator (const _C_proxy &__proxy) _THROWS (())
: _C_sb (__proxy._C_sb) { }
// 24.5.3.3, p1
char_type operator*() const;
// 24.5.3.4, p1
istreambuf_iterator& operator++ ();
// 24.5.3.4, p3
_C_proxy operator++ (int);
// 24.5.3.5, p1 - const follows the resolution of lwg issue 110
bool equal (const istreambuf_iterator&) const;
private:
streambuf_type *_C_sb;
};
// defined here as opposed to within the body of the class
// to work around IBM VisualAge C++ bug #396 (PMR 02173)
template <class _CharT, class _Traits>
inline istreambuf_iterator<_CharT, _Traits>::
istreambuf_iterator (istream_type &__strm) _THROWS (())
: _C_sb (__strm.rdbuf ())
{
// no-op
}
template <class _CharT, class _Traits>
inline _TYPENAME istreambuf_iterator<_CharT, _Traits>::char_type
istreambuf_iterator<_CharT, _Traits>::
operator*() const
{
_RWSTD_ASSERT (0 != _C_sb);
_RWSTD_ASSERT (!equal (istreambuf_iterator ()));
return traits_type::to_char_type (_C_sb->sgetc ());
}
template <class _CharT, class _Traits>
inline istreambuf_iterator<_CharT, _Traits>&
istreambuf_iterator<_CharT, _Traits>::
operator++()
{
_RWSTD_ASSERT (0 != _C_sb);
_RWSTD_ASSERT (!equal (istreambuf_iterator ()));
_C_sb->sbumpc ();
return *this;
}
template <class _CharT, class _Traits>
inline _TYPENAME istreambuf_iterator<_CharT, _Traits>::_C_proxy
istreambuf_iterator<_CharT, _Traits>::
operator++(int)
{
_RWSTD_ASSERT (0 != _C_sb);
_RWSTD_ASSERT (!equal (istreambuf_iterator ()));
return _C_proxy (traits_type::to_char_type (_C_sb->sbumpc ()), _C_sb);
}
template <class _CharT, class _Traits>
inline bool
istreambuf_iterator<_CharT, _Traits>::
equal (const istreambuf_iterator &__rhs) const
{
// Returns true if and only if both iterators are at end-of-stream,
// or neither is at end-of-stream, regardless of what streambuf
// object they use.
// See also lwg issue 111.
const int_type __eof = traits_type::eof ();
const bool __eof_lhs =
!_C_sb || traits_type::eq_int_type (_C_sb->sgetc (), __eof);
const bool __eof_rhs =
!__rhs._C_sb || traits_type::eq_int_type (__rhs._C_sb->sgetc(), __eof);
return __eof_lhs && __eof_rhs || !__eof_lhs && !__eof_rhs;
}
// 24.5.3.6
template <class _CharT, class _Traits>
inline bool
operator== (const istreambuf_iterator<_CharT, _Traits>& __x,
const istreambuf_iterator<_CharT, _Traits>& __y)
{
return __x.equal (__y);
}
// 24.5.3.7
template <class _CharT, class _Traits>
inline bool
operator!= (const istreambuf_iterator<_CharT, _Traits>& __x,
const istreambuf_iterator<_CharT, _Traits>& __y)
{
return !__x.equal (__y);
}
// 24.5.4
template <class _CharT, class _Traits>
struct ostreambuf_iterator
: public iterator<output_iterator_tag, void, void, void, void>
{
typedef _CharT char_type;
typedef _Traits traits_type;
typedef basic_streambuf<char_type, traits_type> streambuf_type;
typedef basic_ostream<char_type, traits_type> ostream_type;
// 24.5.4.1, p1
ostreambuf_iterator (ostream_type&) _THROWS (());
// 24.5.4.1, p2
ostreambuf_iterator (streambuf_type *__sb) _THROWS (())
: _C_sb (__sb) {
_RWSTD_ASSERT (__sb != 0);
}
// 24.5.4.2, p3
ostreambuf_iterator& operator* () {
return *this;
}
// 24.5.4.2, p4
ostreambuf_iterator& operator++ () {
return *this;
}
// 24.5.4.2, p4
ostreambuf_iterator& operator++ (int) {
return *this;
}
// 24.5.4.2, p1
ostreambuf_iterator& operator= (char_type __c) {
if (_C_sb && traits_type::eq_int_type (_C_sb->sputc (__c),
traits_type::eof ()))
_C_sb = 0;
return *this;
}
// 24.5.4.2, p5
bool failed () const _THROWS (()) {
return !_C_sb;
}
private:
streambuf_type *_C_sb;
};
// defined here as opposed to within the body of the class
// to work around IBM VisualAge C++ bug #396 (PMR 02173)
template <class _CharT, class _Traits>
inline ostreambuf_iterator<_CharT, _Traits>::
ostreambuf_iterator (ostream_type &__strm) _THROWS (())
: _C_sb (__strm.rdbuf ())
{
_RWSTD_ASSERT (__strm.rdbuf () != 0); // lwg issue 112
}
} // namespace std
#endif // _RWSTD_RW_IOITER_H_INCLUDED

View File

@@ -0,0 +1,393 @@
/***************************************************************************
*
* _iosbase.h - Declarations for the Standard Library basic stream I/O
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _iosbase.h 550991 2007-06-26 23:58:07Z sebor $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
**************************************************************************/
#ifndef _RWSTD_RW_IOSBASE_H_INCLUDED
#define _RWSTD_RW_IOSBASE_H_INCLUDED
#include <loc/_locale.h>
#ifndef _RWSTD_RW_IOSFAILURE_H_INCLUDED
# include <rw/_iosfailure.h>
#endif // _RWSTD_RW_IOSFAILURE_H_INCLUDED
#ifndef _RWSTD_RW_IOSFWD_H_INCLUDED
# include <rw/_iosfwd.h>
#endif // _RWSTD_RW_IOSFWD_H_INCLUDED
#ifndef _RWSTD_RW_TRAITS_H_INCLUDED
# include <rw/_traits.h>
#endif // _RWSTD_RW_TRAITS_H_INCLUDED
_RWSTD_NAMESPACE (std) {
struct _RWSTD_EXPORT ios_base: _RW::__rw_synchronized
{
// 27.4.2.1.1
typedef _RW::__rw_failure failure;
#ifndef _RWSTD_NO_EXT_FAILURE
// extensions
typedef _RW::__rw_badbit_set badbit_set;
typedef _RW::__rw_eofbit_set eofbit_set;
typedef _RW::__rw_failbit_set failbit_set;
#endif // _RWSTD_NO_EXT_FAILURE
// 27.4.2.1.2
typedef _RWSTD_BITMASK_ENUM (_RW::__rw_fmtflags) fmtflags;
// insert and extract bool type in alphabetic format
_RWSTD_STATIC_CONST (fmtflags, boolalpha = _RW::__rw_boolalpha);
// converts integer input or generates integer output in decimal base
_RWSTD_STATIC_CONST (fmtflags, dec = _RW::__rw_dec);
// generate floating-point output in fixed-point notation
_RWSTD_STATIC_CONST (fmtflags, fixed = _RW::__rw_fixed);
// converts integer input or generates integer output in hexadecimal base
_RWSTD_STATIC_CONST (fmtflags, hex = _RW::__rw_hex);
// adds fill characters at a designated internal point in certain generated
// output, or identical to right if no such point is designated
_RWSTD_STATIC_CONST (fmtflags, internal = _RW::__rw_internal);
// adds fill characters on the right of certain generated output
_RWSTD_STATIC_CONST (fmtflags, left = _RW::__rw_left);
// converts integer input or generates integer output in octal base
_RWSTD_STATIC_CONST (fmtflags, oct = _RW::__rw_oct);
// adds fill characters on the left of certain generated output
_RWSTD_STATIC_CONST (fmtflags, right = _RW::__rw_right);
// generates floating-point output in scientific notation
_RWSTD_STATIC_CONST (fmtflags, scientific = _RW::__rw_scientific);
// generates a prefix indicating the numeric base of generated integer
// output (bin - none, oct - "0", dec - none, hex - "0x")
_RWSTD_STATIC_CONST (fmtflags, showbase = _RW::__rw_showbase);
// generates a decimal-point character unconditionally in generated
// floating-point output
_RWSTD_STATIC_CONST (fmtflags, showpoint = _RW::__rw_showpoint);
// generates a + sign in non-negative generated numeric output
_RWSTD_STATIC_CONST (fmtflags, showpos = _RW::__rw_showpos);
// skips leading white space before certain input operations
_RWSTD_STATIC_CONST (fmtflags, skipws = _RW::__rw_skipws);
// flushes output after each output operation
_RWSTD_STATIC_CONST (fmtflags, unitbuf = _RW::__rw_unitbuf);
// replaces certain lowercase letters with their uppercase equivalents
// in generated output
_RWSTD_STATIC_CONST (fmtflags, uppercase = _RW::__rw_uppercase);
#ifndef _RWSTD_NO_EXT_BIN_IO
// extension - converts integer input or generates integer output
// in binary base
_RWSTD_STATIC_CONST (fmtflags, bin = _RW::__rw_bin);
#endif // _RWSTD_NO_EXT_BIN_IO
_RWSTD_STATIC_CONST (fmtflags, basefield = _RW::__rw_basefield);
_RWSTD_STATIC_CONST (fmtflags, adjustfield = _RW::__rw_adjustfield);
_RWSTD_STATIC_CONST (fmtflags, floatfield = _RW::__rw_floatfield);
#ifndef _RWSTD_NO_EXT_REENTRANT_IO
// extension: never locks the object in MT environments
_RWSTD_STATIC_CONST (fmtflags, nolock = _RW::__rw_nolock);
// extension: never locks stream buffer in MT environments
_RWSTD_STATIC_CONST (fmtflags, nolockbuf = _RW::__rw_nolockbuf);
#endif // _RWSTD_NO_EXT_REENTRANT_IO
// 27.4.2.1.3
typedef _RWSTD_BITMASK_ENUM (_RW::__rw_iostate) iostate;
_RWSTD_STATIC_CONST (iostate, goodbit = _RW::__rw_goodbit);
// indicates a loss of integrity in an input or output sequence
// (such as an irrecoverable read error from a file);
_RWSTD_STATIC_CONST (iostate, badbit = _RW::__rw_badbit);
// indicates that an input operation reached the end of an input sequence
_RWSTD_STATIC_CONST (iostate, eofbit = _RW::__rw_eofbit);
// indicates that an input operation failed to read the expected
// characters, or that an output operation failed to generate the
// desired characters
_RWSTD_STATIC_CONST (iostate, failbit = _RW::__rw_failbit);
// 27.4.2.1.4
typedef _RWSTD_BITMASK_ENUM (_RW::__rw_openmode) openmode;
// seek to end before each write
_RWSTD_STATIC_CONST (openmode, app = _RW::__rw_app);
// perform input and output in binary mode (as opposed to text mode)
_RWSTD_STATIC_CONST (openmode, binary = _RW::__rw_binary);
// open for input
_RWSTD_STATIC_CONST (openmode, in = _RW::__rw_in);
// open for output
_RWSTD_STATIC_CONST (openmode, out = _RW::__rw_out);
// truncate an existing stream when opening
_RWSTD_STATIC_CONST (openmode, trunc = _RW::__rw_trunc);
// open and seek to end immediately after opening
_RWSTD_STATIC_CONST (openmode, ate = _RW::__rw_ate);
#ifndef _RWSTD_STRICT_ANSI
// extensions for compatibility with Classic Iostreams
// do not create a file if it doesn't exist
_RWSTD_STATIC_CONST (openmode, nocreate = _RW::__rw_nocreate);
// do not replace an existing file
_RWSTD_STATIC_CONST (openmode, noreplace = _RW::__rw_noreplace);
#endif // _RWSTD_STRICT_ANSI
#ifndef _RWSTD_NO_EXT_STDIO
// use the C stdio library for all file I/O
_RWSTD_STATIC_CONST (openmode, stdio = _RW::__rw_stdio);
// use the native OS calls for all file I/O
_RWSTD_STATIC_CONST (openmode, native = _RW::__rw_native);
#endif // _RWSTD_NO_EXT_STDIO
typedef _RWSTD_BITMASK_ENUM (_RW::__rw_seekdir) seekdir;
// 27.4.2.1.5, p1
_RWSTD_STATIC_CONST (seekdir, beg = _RW::__rw_beg);
_RWSTD_STATIC_CONST (seekdir, cur = _RW::__rw_cur);
_RWSTD_STATIC_CONST (seekdir, end = _RW::__rw_end);
#ifndef _RWSTD_NO_DEPRECATED
// D.6, p1 (must be integer types and not enums)
typedef int seek_dir;
typedef int open_mode;
typedef int io_state;
typedef _RWSTD_STREAMOFF streamoff;
typedef _RWSTD_STREAMOFF streampos;
#endif // _RWSTD_NO_DEPRECATED
// 27.4.2.1.6
struct _RWSTD_EXPORT Init {
Init ();
~Init ();
};
// 27.4.2.2, p1
fmtflags flags () const {
return fmtflags (_C_fmtfl);
}
// 27.4.2.2, p2
fmtflags flags (fmtflags);
// 27.4.2.2, p4
fmtflags setf (fmtflags __f) {
return flags (flags () | __f);
}
// 27.4.2.2, p6
fmtflags setf (fmtflags __f, fmtflags __mask) {
return flags (flags () & ~__mask | __f & __mask);
}
// 27.4.2.2, p8
void unsetf (fmtflags __f) {
flags (flags () & ~__f);
}
// 27.4.2.2, p9
_RWSTD_STREAMSIZE precision () const {
return _C_prec;
}
// 27.4.2.2, p10
_RWSTD_STREAMSIZE precision (_RWSTD_STREAMSIZE);
// 27.4.2.2, p12
_RWSTD_STREAMSIZE width () const {
return _C_wide;
}
// 27.4.2.2, p13
_RWSTD_STREAMSIZE width (_RWSTD_STREAMSIZE);
// 27.4.2.3, p1
locale imbue (const locale&);
// extension: avoids reference counting in MT builds (may result in
// a speedup of up to 50%); this is an alternative to caching a reference
// (pointer) to a facet in each stream and stream buffer object
locale& getloc () {
return _C_loc;
}
// 27.4.2.3, p4
locale getloc () const {
return _C_loc;
}
// 27.4.2.5, p1
static int xalloc ();
// 27.4.2.5, p2
long& iword (int);
// 27.4.2.5, p4
void*& pword (int);
enum event { erase_event, imbue_event, copyfmt_event };
typedef void (*event_callback)(event, ios_base&, int);
// 27.4.2.6, p1
void register_callback (event_callback, int);
// 27.4.2.4, p1
static bool sync_with_stdio (bool = true);
// 27.4.2.7, p2
virtual ~ios_base ();
// returns a numeric base as per 22.2.2.1.2, p4
int _C_base () const {
return _RWSTD_STATIC_CAST (unsigned, flags ()) >> _RWSTD_IOS_BASEOFF;
}
protected:
// 27.4.2.7, p1
ios_base ();
// implements basic_ios<T>::init()
void _C_init (void*);
// will be reentrant only if `reentrant' is true
void _C_fire_event (event, bool __reentrant);
// implements basic_ios<T>::copyfmt()
void _C_copyfmt (const ios_base&, void*, const void*, _RWSTD_SIZE_T);
// sets state, exceptions, and rdbuf to the function arguments
// in that order (except state & ~_RWSTD_IOS_NOTHROW)
// may throw except when _RWSTD_IOS_NOTHROW is set in the first
// argument; returns the previous value of rdbuf
void* _C_set (unsigned, unsigned, void*);
// retrieves and sets the tied stream pointer
void* _C_tie () const;
void* _C_tie (void*);
// called from basic_ios<>::imbue (), not thread safe
locale _C_unsafe_imbue (const locale&);
void *_C_rdbuf; // pointer to the associated stream buffer
_RWSTD_STREAMSIZE _C_prec; // current precision
_RWSTD_STREAMSIZE _C_wide; // current width
unsigned _C_fmtfl; // formatting flags
unsigned char _C_state; // stream state
unsigned char _C_except; // active exceptions
static bool _C_sync_with_stdio;
private:
ios_base (const ios_base&); // not defined
ios_base& operator= (const ios_base&); // not defined
#if __EDG_VERSION__ < 245
// working around an EDG eccp 2.3x bug (also derivatives,
// such as MIPSpro, see PR #28631)
public:
struct _C_usr_data;
#else
protected:
struct _C_usr_data;
#endif // EDG < 2.45
protected:
_C_usr_data *_C_usr; // user data (iword, pword, callbacks)
locale _C_loc; // locale associated with stream
friend struct _RWSTD_EXPORT Init;
// working around an EDG eccp 3.2 and prior bug (see PR #29526)
friend struct _C_usr_data;
};
inline _RWSTD_STREAMSIZE ios_base::
width (_RWSTD_STREAMSIZE __width)
{
_RWSTD_ASSERT (0 != this);
const _RWSTD_STREAMSIZE __tmp = _C_wide;
// not thread-safe for efficiency since width(0) is called
// (directly or through a facet) by each formatted output
// function and the return value is not used
_C_wide = __width;
return __tmp;
}
} // namespace std
#endif // _RWSTD_RW_IOSBASE_H_INCLUDED

View File

@@ -0,0 +1,68 @@
/***************************************************************************
*
* _iosfailure.h - definition of the ios_base::failure class
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _iosfailure.h 550991 2007-06-26 23:58:07Z sebor $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
**************************************************************************/
#ifndef _RWSTD_RW_IOSFAILURE_H_INCLUDED
#define _RWSTD_RW_IOSFAILURE_H_INCLUDED
#ifndef _RWSTD_RW_EXCEPTION_H_INCLUDED
# include <rw/_exception.h>
#endif // _RWSTD_RW_EXCEPTION_H_INCLUDED
#ifndef _RWSTD_RW_IOSFWD_H_INCLUDED
# include <rw/_iosfwd.h>
#endif // _RWSTD_RW_IOSFWD_H_INCLUDED
_RWSTD_NAMESPACE (__rw) {
struct _RWSTD_EXPORT __rw_failure: __rw_exception
{
_EXPLICIT __rw_failure (const _STD::string &__what)
: __rw_exception (__what) { }
// extension
_EXPLICIT __rw_failure (const char *__what = 0)
: __rw_exception (__what) { }
virtual ~__rw_failure () _THROWS (());
};
struct _RWSTD_EXPORT __rw_badbit_set: __rw_failure { };
struct _RWSTD_EXPORT __rw_eofbit_set: __rw_failure { };
struct _RWSTD_EXPORT __rw_failbit_set: __rw_failure { };
} // namespace __rw
#endif // _RWSTD_RW_IOSFAILURE_H_INCLUDED

184
extern/stdcxx/4.2.1/include/rw/_iosfwd.h vendored Normal file
View File

@@ -0,0 +1,184 @@
/***************************************************************************
*
* _bitmask.h - helper definitions for bitmask types
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _iosfwd.h 638379 2008-03-18 14:13:51Z faridz $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
**************************************************************************/
#ifndef _RWSTD_RW_IOSFWD_H_INCLUDED
#define _RWSTD_RW_IOSFWD_H_INCLUDED
#ifndef _RWSTD_RW_BITMASK_H_INCLUDED
# include <rw/_bitmask.h>
#endif // _RWSTD_RW_BITMASK_H_INCLUDED
_RWSTD_NAMESPACE (std) {
template<class _CharT>
struct char_traits;
_RWSTD_SPECIALIZED_CLASS
struct char_traits<char>;
#ifndef _RWSTD_NO_WCHAR_T
_RWSTD_SPECIALIZED_CLASS
struct char_traits<wchar_t>;
#endif // _RWSTD_NO_WCHAR_T
struct _RWSTD_EXPORT ios_base;
_EXPORT
template <class _CharT, class _Traits>
class basic_ios;
_EXPORT
template <class _CharT, class _Traits>
class basic_streambuf;
// 27.2, p4
_EXPORT
template <class _CharT, class _Traits>
class basic_istream;
// 27.2, p5
_EXPORT
template <class _CharT, class _Traits>
class basic_ostream;
// 27.2, p6
_EXPORT
template <class _CharT, class _Traits>
class basic_iostream;
template <class _CharT, class _Traits>
struct ostreambuf_iterator;
template <class _CharT, class _Traits>
struct istreambuf_iterator;
} // namespace std
// used in money_get and num_get facets
#define _RWSTD_IOSTATE _RWSTD_BITMASK_ENUM (_RW::__rw_iostate)
#define _RWSTD_FMTFLAGS _RWSTD_BITMASK_ENUM (_RW::__rw_fmtflags)
_RWSTD_NAMESPACE (__rw) {
// for convenience
typedef _STD::istreambuf_iterator<char, _STD::char_traits<char> >
__rw_istreambuf_iterator;
#ifndef _RWSTD_NO_WCHAR_T
typedef _STD::istreambuf_iterator<wchar_t, _STD::char_traits<wchar_t> >
__rw_wistreambuf_iterator;
#endif // _RWSTD_NO_WCHAR_T
enum __rw_fmtflags {
__rw_boolalpha = _RWSTD_IOS_BOOLALPHA,
__rw_dec = _RWSTD_IOS_DEC,
__rw_fixed = _RWSTD_IOS_FIXED,
__rw_hex = _RWSTD_IOS_HEX,
__rw_internal = _RWSTD_IOS_INTERNAL,
__rw_left = _RWSTD_IOS_LEFT,
__rw_oct = _RWSTD_IOS_OCT,
__rw_right = _RWSTD_IOS_RIGHT,
__rw_scientific = _RWSTD_IOS_SCIENTIFIC,
__rw_showbase = _RWSTD_IOS_SHOWBASE,
__rw_showpoint = _RWSTD_IOS_SHOWPOINT,
__rw_showpos = _RWSTD_IOS_SHOWPOS,
__rw_skipws = _RWSTD_IOS_SKIPWS,
__rw_unitbuf = _RWSTD_IOS_UNITBUF,
__rw_uppercase = _RWSTD_IOS_UPPERCASE,
__rw_bin = _RWSTD_IOS_BIN,
__rw_basefield = _RWSTD_IOS_BASEFIELD,
__rw_adjustfield = _RWSTD_IOS_ADJUSTFIELD,
__rw_floatfield = _RWSTD_IOS_FLOATFIELD,
__rw_nolock = _RWSTD_IOS_NOLOCK,
__rw_nolockbuf = _RWSTD_IOS_NOLOCKBUF,
__rw_sync_stdio = _RWSTD_IOS_SYNC_STDIO
};
_RWSTD_DEFINE_BITMASK_OPERATORS (__rw_fmtflags);
enum __rw_iostate {
__rw_goodbit = _RWSTD_IOS_GOODBIT,
__rw_badbit = _RWSTD_IOS_BADBIT,
__rw_eofbit = _RWSTD_IOS_EOFBIT,
__rw_failbit = _RWSTD_IOS_FAILBIT,
// for debugging
__rw_bad_eof = _RWSTD_IOS_BADBIT | _RWSTD_IOS_EOFBIT,
__rw_bad_fail = _RWSTD_IOS_BADBIT | _RWSTD_IOS_FAILBIT,
__rw_bad_eof_fail = _RWSTD_IOS_BADBIT | _RWSTD_IOS_EOFBIT
| _RWSTD_IOS_FAILBIT,
__rw_eof_fail = _RWSTD_IOS_EOFBIT | _RWSTD_IOS_FAILBIT,
__rw_nothrow = _RWSTD_IOS_NOTHROW,
__rw_rethrow = _RWSTD_IOS_RETHROW
};
_RWSTD_DEFINE_BITMASK_OPERATORS (__rw_iostate);
enum __rw_openmode {
__rw_app = _RWSTD_IOS_APP,
__rw_binary = _RWSTD_IOS_BINARY,
__rw_in = _RWSTD_IOS_IN,
__rw_out = _RWSTD_IOS_OUT,
__rw_in_out = _RWSTD_IOS_IN | _RWSTD_IOS_OUT,
__rw_trunc = _RWSTD_IOS_TRUNC,
__rw_ate = _RWSTD_IOS_ATE,
__rw_nocreate = _RWSTD_IOS_NOCREATE,
__rw_noreplace = _RWSTD_IOS_NOREPLACE,
__rw_stdio = _RWSTD_IOS_STDIO,
__rw_native = _RWSTD_IOS_NATIVE
};
_RWSTD_DEFINE_BITMASK_OPERATORS (__rw_openmode);
enum __rw_seekdir {
__rw_beg = _RWSTD_SEEK_SET,
__rw_cur = _RWSTD_SEEK_CUR,
__rw_end = _RWSTD_SEEK_END
};
} // namespace __rw
#endif // _RWSTD_RW_IOSFWD_H_INCLUDED

View File

@@ -0,0 +1,535 @@
/***************************************************************************
*
* _iterator.h - Iterator declarations for the Standard Library
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _iterator.h 590052 2007-10-30 12:44:14Z faridz $
*
***************************************************************************
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* 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. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
**************************************************************************/
#ifndef _RWSTD_RW_ITERATOR_H_INCLUDED
#define _RWSTD_RW_ITERATOR_H_INCLUDED
#ifndef _RWSTD_RW_ITERBASE_H_INCLUDED
# include <rw/_iterbase.h>
#endif // _RWSTD_RW_ITERBASE_H_INCLUDED
_RWSTD_NAMESPACE (std) {
// Reverse iterator.
//
// Macros for reverse iterators to accomodate non-standard compilers
//
#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
# define _RWSTD_ITER_TEMPLATE template <class _Iterator>
# define _RWSTD_ITER_ID(i) i <_Iterator>
# define _RWSTD_ITER_DIFF_TYPE(i, ignore) \
_TYPENAME iterator_traits<_Iterator>::difference_type
#else
# define _RWSTD_ITER_TEMPLATE \
template <class _Iterator, class _Category, class _TypeT, \
class _Reference, class _Pointer, class _Distance>
# define _RWSTD_ITER_ID(i) \
i <_Iterator, _Category, _TypeT, _Reference, _Pointer, _Distance>
# define _RWSTD_ITER_DIFF_TYPE(ignore, distance) distance
#endif // _RWSTD_NO_CLASS_PARTIAL_SPEC
#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
template <class _Iterator>
class reverse_iterator
: public iterator<_TYPENAME iterator_traits<_Iterator>::iterator_category,
_TYPENAME iterator_traits<_Iterator>::value_type,
_TYPENAME iterator_traits<_Iterator>::difference_type,
_TYPENAME iterator_traits<_Iterator>::pointer,
_TYPENAME iterator_traits<_Iterator>::reference>
{
typedef iterator_traits<_Iterator> traits_type;
public:
typedef _TYPENAME traits_type::difference_type difference_type;
typedef _TYPENAME traits_type::value_type value_type;
typedef _TYPENAME traits_type::pointer pointer;
typedef _TYPENAME traits_type::reference reference;
#else // if defined (_RWSTD_NO_CLASS_PARTIAL_SPEC)
template <class _Iterator, class _Category, class _TypeT,
class _Reference = _TypeT&,
class _Pointer = _TypeT*,
class _Distance = _RWSTD_PTRDIFF_T>
class reverse_iterator
: public iterator<_Category, _TypeT, _Distance, _Pointer, _Reference>
{
public:
typedef _Distance difference_type;
typedef _TypeT value_type;
typedef _Reference reference;
typedef _Pointer pointer;
#endif // _RWSTD_NO_CLASS_PARTIAL_SPEC
typedef _Iterator iterator_type;
reverse_iterator () { }
// 24.4.1.3.1, p1
_EXPLICIT reverse_iterator (iterator_type __rhs) : current (__rhs) { }
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
# ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
// 24.4.1.3.1, p2
template <class _TypeU>
reverse_iterator (const reverse_iterator<_TypeU>& __rhs)
: current (__rhs.base ()) { }
# else // if defined (_RWSTD_NO_CLASS_PARTIAL_SPEC)
// 24.4.1.3.1, p2
template <class _Iterator2, class _Category2, class _TypeU,
class _Reference2, class _Pointer2, class _Distance2>
reverse_iterator (const reverse_iterator<_Iterator2, _Category2, _TypeU,
_Reference2, _Pointer2, _Distance2>& __rhs)
: current (__rhs.base ()) { }
# endif // _RWSTD_NO_CLASS_PARTIAL_SPEC
#endif // _RWSTD_NO_MEMBER_TEMPLATES
// 24.4.1.3.2, p1
iterator_type base () const {
return current;
}
// 24.4.1.3.3, p1
reference operator* () const {
iterator_type __tmp (base ());
return *--__tmp;
}
// 24.4.1.3.4, p1
_RWSTD_OPERATOR_ARROW (pointer operator->() const);
// 24.4.1.3.5, p1
reverse_iterator& operator++ () {
return --current, *this;
}
// 24.4.1.3.5, p3
reverse_iterator operator++ (int) {
reverse_iterator __tmp (*this);
return ++*this, __tmp;
}
// 24.4.1.3.6, p1
reverse_iterator& operator-- () {
return ++current, *this;
}
// 24.4.1.3.6, p3
reverse_iterator operator-- (int) {
reverse_iterator __tmp (*this);
return --*this, __tmp;
}
// 24.4.1.3.8, p1
reverse_iterator& operator+= (difference_type __n) {
return current -= __n, *this;
}
// 24.4.1.3.10, p1
reverse_iterator& operator-= (difference_type __n) {
return *this += -__n;
}
// 24.4.1.3.7, p1
reverse_iterator operator+ (difference_type __n) const {
return reverse_iterator (*this) += __n;
}
// 24.4.1.3.9, p1
reverse_iterator operator- (difference_type __n) const {
return reverse_iterator (*this) -= __n;
}
// 24.4.1.3.11, p1
reference operator[] (difference_type __n) const {
return *(*this + __n);
}
protected:
iterator_type current;
};
// 24.4.1.3.12
_RWSTD_ITER_TEMPLATE
inline bool operator== (const _RWSTD_ITER_ID (reverse_iterator)& __x,
const _RWSTD_ITER_ID (reverse_iterator)& __y)
{
return __x.base () == __y.base ();
}
// 24.4.1.3.13
_RWSTD_ITER_TEMPLATE
inline bool operator< (const _RWSTD_ITER_ID (reverse_iterator)& __x,
const _RWSTD_ITER_ID (reverse_iterator)& __y)
{
return __y.base() < __x.base();
}
// 24.4.1.3.14
_RWSTD_ITER_TEMPLATE
inline bool operator!= (const _RWSTD_ITER_ID (reverse_iterator)& __x,
const _RWSTD_ITER_ID (reverse_iterator)& __y)
{
return !(__x == __y);
}
// 24.4.1.3.15
_RWSTD_ITER_TEMPLATE
inline bool operator> (const _RWSTD_ITER_ID (reverse_iterator)& __x,
const _RWSTD_ITER_ID (reverse_iterator)& __y)
{
return __y < __x;
}
// 24.4.1.3.16
_RWSTD_ITER_TEMPLATE
inline bool operator>= (const _RWSTD_ITER_ID (reverse_iterator)& __x,
const _RWSTD_ITER_ID (reverse_iterator)& __y)
{
return !(__x < __y);
}
// 24.4.1.3.17
_RWSTD_ITER_TEMPLATE
inline bool operator<= (const _RWSTD_ITER_ID (reverse_iterator)& __x,
const _RWSTD_ITER_ID (reverse_iterator)& __y)
{
return !(__y < __x);
}
// 24.4.1.3.18
_RWSTD_ITER_TEMPLATE
inline _RWSTD_ITER_DIFF_TYPE (_Iterator, _Distance)
operator- (const _RWSTD_ITER_ID (reverse_iterator)& __x,
const _RWSTD_ITER_ID (reverse_iterator)& __y)
{
return __y.base () - __x.base ();
}
// 24.4.1.3.19
_RWSTD_ITER_TEMPLATE
inline _RWSTD_ITER_ID (reverse_iterator)
operator+ (_RWSTD_ITER_DIFF_TYPE (_Iterator, _Distance) __n,
const _RWSTD_ITER_ID (reverse_iterator)& __x)
{
return __x + __n;
}
#undef _RWSTD_ITER_DIFF_TYPE
#ifdef _RWSTD_NO_CLASS_PARTIAL_SPEC
} // namespace std
_RWSTD_NAMESPACE (__rw) {
// Reverse bidirectional iterator.
// This is needed to get around non-standard compilers that insist
// on instantiating all members of a class whether they're used
// or not.
template <class _Iterator, class _Category, class _TypeT,
class _Reference = _TypeT&,
class _Pointer = _TypeT*,
class _Distance = _RWSTD_PTRDIFF_T>
class __reverse_bi_iterator
: public _STD::iterator<_Category, _TypeT, _Distance, _Pointer, _Reference>
{
public:
typedef _Distance difference_type;
typedef _TypeT value_type;
typedef _Reference reference;
typedef _Pointer pointer;
typedef _Iterator iterator_type;
__reverse_bi_iterator () { }
_EXPLICIT __reverse_bi_iterator (const iterator_type &__rhs)
: current (__rhs) { }
#ifndef _RWSTD_NO_MEMBER_TEMPLATES
# ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
template <class _TypeU>
__reverse_bi_iterator (const __reverse_bi_iterator<_TypeU>& __rhs)
: current (__rhs.base ()) { }
# else // if defined (_RWSTD_NO_CLASS_PARTIAL_SPEC )
template <class _Iterator2, class _Category2, class _TypeU,
class _Reference2, class _Pointer2, class _Distance2>
__reverse_bi_iterator (const __reverse_bi_iterator<_Iterator2,
_Category2,
_TypeU,
_Reference2,
_Pointer2,
_Distance2>& __rhs)
: current (__rhs.base ()) { }
# endif
#endif // _RWSTD_NO_MEMBER_TEMPLATES
iterator_type base () const {
return current;
}
reference operator* () const {
iterator_type __tmp = base ();
return *--__tmp;
}
_RWSTD_OPERATOR_ARROW (pointer operator->() const);
__reverse_bi_iterator& operator++ () {
return --current, *this;
}
__reverse_bi_iterator operator++ (int) {
__reverse_bi_iterator __tmp (*this);
++*this;
return __tmp;
}
__reverse_bi_iterator& operator-- () {
return ++current, *this;
}
__reverse_bi_iterator operator-- (int) {
__reverse_bi_iterator __tmp (*this);
--*this;
return __tmp;
}
protected:
iterator_type current;
};
_RWSTD_ITER_TEMPLATE
inline bool operator== (const _RWSTD_ITER_ID (__reverse_bi_iterator)& __x,
const _RWSTD_ITER_ID (__reverse_bi_iterator)& __y)
{
return __x.base () == __y.base ();
}
_RWSTD_ITER_TEMPLATE
inline bool operator!= (const _RWSTD_ITER_ID (__reverse_bi_iterator)& __x,
const _RWSTD_ITER_ID (__reverse_bi_iterator)& __y)
{
return !(__x == __y);
}
#undef _RWSTD_ITER_TEMPLATE
#undef _RWSTD_ITER_ID
} // namespace __rw
_RWSTD_NAMESPACE (std) {
#endif // _RWSTD_NO_CLASS_PARTIAL_SPEC
#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
# define _RWSTD_INSERT_ITERATOR_BASE(ignore) \
iterator<output_iterator_tag, void, void, void, void>
#else
// necessary to allow __iterator_category, __value_type, etc. to work
# define _RWSTD_INSERT_ITERATOR_BASE(cont) \
iterator<output_iterator_tag, \
_TYPENAME cont::value_type, \
_TYPENAME cont::difference_type, \
_TYPENAME cont::pointer, \
_TYPENAME cont::reference>
#endif // _RWSTD_NO_CLASS_PARTIAL_SPEC
template <class _Container>
class back_insert_iterator: public _RWSTD_INSERT_ITERATOR_BASE (_Container)
{
public:
typedef _Container container_type;
_EXPLICIT back_insert_iterator (container_type& __rhs)
: container (&__rhs) { }
back_insert_iterator&
operator= (_TYPENAME container_type::const_reference __x) {
return container->push_back (__x), *this;
}
back_insert_iterator& operator* () {
return *this;
}
back_insert_iterator& operator++ () {
return *this;
}
back_insert_iterator operator++ (int) {
return *this;
}
protected:
container_type* container;
};
template <class _Container>
inline back_insert_iterator<_Container> back_inserter (_Container& __x)
{
return back_insert_iterator<_Container>(__x);
}
template <class _Container>
class front_insert_iterator: public _RWSTD_INSERT_ITERATOR_BASE (_Container)
{
public:
typedef _Container container_type;
_EXPLICIT front_insert_iterator (container_type& __rhs)
: container (&__rhs) { }
front_insert_iterator&
operator= (_TYPENAME container_type::const_reference __x) {
return container->push_front (__x), *this;
}
front_insert_iterator& operator* () {
return *this;
}
front_insert_iterator& operator++ () {
return *this;
}
front_insert_iterator operator++ (int) {
return *this;
}
protected:
container_type* container;
};
template <class _Container>
inline front_insert_iterator<_Container> front_inserter (_Container& __x)
{
return front_insert_iterator<_Container>(__x);
}
template <class _Container>
class insert_iterator: public _RWSTD_INSERT_ITERATOR_BASE (_Container)
{
public:
typedef _Container container_type;
insert_iterator (container_type &__x,
_TYPENAME container_type::iterator __it)
: iter (__it), container (&__x) { }
insert_iterator&
operator= (_TYPENAME container_type::const_reference __x) {
iter = container->insert (iter, __x);
return ++iter, *this;
}
insert_iterator& operator* () {
return *this;
}
insert_iterator& operator++ () {
return *this;
}
insert_iterator& operator++ (int) {
return *this;
}
protected:
_TYPENAME container_type::iterator iter;
container_type* container;
};
template <class _Container, class _Iterator>
inline insert_iterator<_Container> inserter (_Container& __x, _Iterator __it)
{
typedef _TYPENAME _Container::iterator _Iter;
return insert_iterator<_Container> (__x, _Iter (__it));
}
} // namespace std
#endif // _RWSTD_RW_ITERATOR_H_INCLUDED

View File

@@ -0,0 +1,752 @@
/***************************************************************************
*
* _iterbase.h - Definitions of iterator primitives
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _iterbase.h 580483 2007-09-28 20:55:52Z sebor $
*
***************************************************************************
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* 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. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2007 Rogue Wave Software, Inc.
*
**************************************************************************/
#ifndef _RWSTD_RW_ITERBASE_H_INCLUDED
#define _RWSTD_RW_ITERBASE_H_INCLUDED
#ifndef _RWSTD_RW_DEFS_H_INCLUDED
# include <rw/_defs.h>
#endif // _RWSTD_RW_DEFS_H_INCLUDED
_RWSTD_NAMESPACE (std) {
// 24.3.1 - Iterator traits
template <class _Iterator>
struct iterator_traits
{
typedef _TYPENAME _Iterator::value_type value_type;
typedef _TYPENAME _Iterator::difference_type difference_type;
typedef _TYPENAME _Iterator::pointer pointer;
typedef _TYPENAME _Iterator::reference reference;
typedef _TYPENAME _Iterator::iterator_category iterator_category;
};
// 24.3.3 - Standard iterator tags
struct input_iterator_tag { };
struct output_iterator_tag { };
struct forward_iterator_tag : public input_iterator_tag { };
struct bidirectional_iterator_tag : public forward_iterator_tag { };
struct random_access_iterator_tag : public bidirectional_iterator_tag { };
#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
template <class _TypeT>
struct iterator_traits<_TypeT*>
{
typedef _TypeT value_type;
typedef _RWSTD_PTRDIFF_T difference_type;
typedef value_type* pointer;
typedef value_type& reference;
typedef random_access_iterator_tag iterator_category;
};
template <class _TypeT>
struct iterator_traits<const _TypeT*>
{
typedef _TypeT value_type;
typedef _RWSTD_PTRDIFF_T difference_type;
typedef const value_type* pointer;
typedef const value_type& reference;
typedef random_access_iterator_tag iterator_category;
};
#endif // _RWSTD_NO_CLASS_PARTIAL_SPEC
// 24.3.2 - Basic iterator
template <class _Category, class _TypeT,
class _Distance = _RWSTD_PTRDIFF_T,
class _Pointer = _TypeT*,
class _Reference = _TypeT&>
struct iterator
{
typedef _TypeT value_type;
typedef _Distance difference_type;
typedef _Pointer pointer;
typedef _Reference reference;
typedef _Category iterator_category;
};
// returns the category of an iterator
template <class _TypeT>
inline random_access_iterator_tag __iterator_category (const _TypeT*)
{
return random_access_iterator_tag ();
}
template <class _Category, class _TypeT, class _Distance,
class _Pointer, class _Reference>
inline _Category
__iterator_category (const iterator<_Category, _TypeT,
_Distance, _Pointer, _Reference>&)
{
typedef _TYPENAME iterator<_Category, _TypeT, _Distance, _TypeT*,
_TypeT&>::iterator_category _IterCategory;
return _IterCategory ();
}
template <class _Tag>
inline bool __is_input_iterator (_Tag)
{
return false;
}
template <class _Tag>
inline bool __is_bidirectional_iterator (_Tag)
{
return false;
}
template <class _Tag>
inline bool __is_random_access_iterator (_Tag)
{
return false;
}
_RWSTD_SPECIALIZED_FUNCTION
inline bool __is_input_iterator (input_iterator_tag)
{
return true;
}
_RWSTD_SPECIALIZED_FUNCTION
inline bool __is_bidirectional_iterator (bidirectional_iterator_tag)
{
return true;
}
_RWSTD_SPECIALIZED_FUNCTION
inline bool __is_bidirectional_iterator (random_access_iterator_tag)
{
return true;
}
_RWSTD_SPECIALIZED_FUNCTION
inline bool __is_random_access_iterator (random_access_iterator_tag)
{
return true;
}
#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
template <class _Iterator>
inline _TYPENAME iterator_traits<_Iterator>::value_type*
__value_type (const _Iterator*)
{
return 0;
}
#else // if defined (_RWSTD_NO_CLASS_PARTIAL_SPEC)
template <class _Category, class _TypeT, class _Distance,
class _Pointer, class _Reference>
inline _TypeT*
__value_type (const iterator<_Category, _TypeT, _Distance,
_Pointer, _Reference>*)
{
return 0;
}
template <class _TypeT>
inline _TypeT* __value_type (const _TypeT* const*)
{
return 0;
}
#endif // _RWSTD_NO_CLASS_PARTIAL_SPEC
#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
template <class _Iterator>
inline _TYPENAME iterator_traits<_Iterator>::difference_type*
__distance_type (_Iterator)
{
return 0;
}
#else // if defined (_RWSTD_NO_CLASS_PARTIAL_SPEC)
template <class _Category, class _TypeT, class _Distance,
class _Pointer, class _Reference>
inline _Distance*
__distance_type (iterator<_Category, _TypeT, _Distance, _Pointer, _Reference>)
{
return 0;
}
template <class _TypeT>
inline _RWSTD_PTRDIFF_T* __distance_type (const _TypeT*)
{
return 0;
}
#endif // _RWSTD_NO_CLASS_PARTIAL_SPEC
// 24.3.4 - Iterator operations
template <class _InputIterator, class _Distance>
inline void __advance (_InputIterator &__it, _Distance __n, input_iterator_tag)
{
_RWSTD_ASSERT (__n == 0 || __n > 0);
while (__n > 0) {
--__n;
++__it;
}
}
template <class _ForwardIterator, class _Distance>
inline void __advance (_ForwardIterator &__it, _Distance __n,
forward_iterator_tag)
{
__advance (__it, __n, input_iterator_tag ());
}
template <class _BidirectionalIterator, class _Distance>
inline void __advance (_BidirectionalIterator &__it, _Distance __n,
bidirectional_iterator_tag)
{
if (__n > 0)
__advance (__it, __n, input_iterator_tag ());
else
while (__n) {
++__n;
--__it;
}
}
template <class _RandomAccessIterator, class _Distance>
inline void __advance (_RandomAccessIterator& __it, _Distance __n,
random_access_iterator_tag)
{
__it += __n;
}
// 24.3.4, p2
template <class _InputIterator, class _Distance>
inline void advance (_InputIterator& __it, _Distance __n)
{
__advance (__it, __n, _RWSTD_ITERATOR_CATEGORY (_InputIterator, __it));
}
template <class _InputIterator, class _Distance>
inline void __distance (const _InputIterator &__first,
const _InputIterator &__last,
_Distance &__n,
input_iterator_tag)
{
for (_InputIterator __it = __first; !(__it == __last); ++__it)
++__n;
}
template <class _ForwardIterator, class _Distance>
inline void __distance (const _ForwardIterator &__first,
const _ForwardIterator &__last,
_Distance &__n,
forward_iterator_tag)
{
__distance (__first, __last, __n, input_iterator_tag ());
}
template <class _BidirectionalIterator, class _Distance>
inline void __distance (const _BidirectionalIterator &__first,
const _BidirectionalIterator &__last,
_Distance &__n,
bidirectional_iterator_tag)
{
__distance (__first, __last, __n, input_iterator_tag ());
}
template <class _RandomAccessIterator, class _Distance>
inline void __distance (const _RandomAccessIterator &__first,
const _RandomAccessIterator &__last,
_Distance &__n,
random_access_iterator_tag)
{
__n = __last - __first;
}
#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
// 24.3.4, p4
template <class _ForwardIterator>
inline _TYPENAME iterator_traits<_ForwardIterator>::difference_type
distance (_ForwardIterator __first, _ForwardIterator __last)
{
_TYPENAME iterator_traits<_ForwardIterator>::difference_type __n = 0;
__distance (__first, __last, __n,
_RWSTD_ITERATOR_CATEGORY (_ForwardIterator, __first));
return __n;
}
#endif // _RWSTD_NO_CLASS_PARTIAL_SPEC
#if !defined (_RWSTD_NO_EXT_VOID_DISTANCE) \
|| defined (_RWSTD_NO_CLASS_PARTIAL_SPEC)
template <class _ForwardIterator, class _Distance>
inline void distance (const _ForwardIterator &__first,
const _ForwardIterator &__last,
_Distance &__n)
{
__distance (__first, __last, __n,
_RWSTD_ITERATOR_CATEGORY (_ForwardIterator, __first));
}
#endif // !_RWSTD_NO_EXT_VOID_DISTANCE || _RWSTD_NO_CLASS_PARTIAL_SPEC
} // namespace std
_RWSTD_NAMESPACE (__rw) {
// __rw_distance: Same purpose as 3-parameter distance function, but
// with return value.
template <class _ForwardIterator, class _Distance>
inline _Distance
__rw_distance (const _ForwardIterator &__first,
const _ForwardIterator &__last,
_Distance __n)
{
_STD::__distance (__first, __last, __n,
_RWSTD_ITERATOR_CATEGORY (_ForwardIterator, __first));
return __n;
}
} // namespace __rw
#ifndef _RWSTD_NO_DEBUG_ITER
_RWSTD_NAMESPACE (__rw) {
// __rw_debug_iter - iterator adapter with debugging support
// _Iterator is either iterator or const_iterator; if the latter,
// _MutableIterator should be iterator to allow for implicit
// conversions from non-const (mutable) to const_iterator objects
template <class _Container, class _Iterator, class _MutableIterator>
class __rw_debug_iter
{
typedef _Container container_type;
typedef _Iterator iterator_type;
typedef _STD::iterator_traits<iterator_type> traits_type;
public:
typedef _TYPENAME traits_type::value_type value_type;
typedef _TYPENAME traits_type::difference_type difference_type;
typedef _TYPENAME traits_type::reference reference;
typedef _TYPENAME traits_type::pointer pointer;
typedef _TYPENAME traits_type::iterator_category iterator_category;
typedef __rw_debug_iter <container_type, _MutableIterator,
_MutableIterator> _C_mutable_iterator;
__rw_debug_iter (): _C_cont (0) { }
__rw_debug_iter (const container_type &__cont, const iterator_type &__it)
: _C_iter (__it), _C_cont (&__cont) { }
// no copy ctor other than the one below is defined
// will use a compiler generated one if _Iterator != _MutableIterator
__rw_debug_iter (const _C_mutable_iterator &__rhs)
: _C_iter (__rhs._C_iter), _C_cont (__rhs._C_cont) { }
__rw_debug_iter& operator= (const __rw_debug_iter &__rhs) {
_C_iter = __rhs._C_iter;
_C_cont = __rhs._C_cont;
return *this;
}
reference operator* () const {
_RWSTD_ASSERT (_C_is_dereferenceable ());
return *_C_iter;
}
reference operator[] (difference_type __n) const {
_RWSTD_ASSERT ((*this + __n)._C_is_dereferenceable ());
return _C_iter [__n];
}
_RWSTD_OPERATOR_ARROW (pointer operator-> () const);
__rw_debug_iter& operator++ () {
_RWSTD_ASSERT (!_C_is_end ());
return ++_C_iter, *this;
}
__rw_debug_iter& operator-- () {
_RWSTD_ASSERT (!_C_is_begin ());
return --_C_iter, *this;
}
__rw_debug_iter operator++ (int) {
__rw_debug_iter __tmp = *this;
return ++*this, __tmp;
}
__rw_debug_iter operator-- (int) {
__rw_debug_iter __tmp = *this;
return --*this, __tmp;
}
__rw_debug_iter& operator+= (difference_type __n) {
_C_iter += __n;
_RWSTD_ASSERT ( !(_C_iter < _C_cont->begin ()._C_iter)
&& !(_C_cont->end ()._C_iter < _C_iter));
return *this;
}
__rw_debug_iter& operator-= (difference_type __n) {
_C_iter -= __n;
_RWSTD_ASSERT ( !(_C_iter < _C_cont->begin ()._C_iter)
&& !(_C_cont->end ()._C_iter < _C_iter));
return *this;
}
__rw_debug_iter operator+ (difference_type __n) const {
return __rw_debug_iter (*this) += __n;
}
__rw_debug_iter operator- (difference_type __n) const {
return __rw_debug_iter (*this) -= __n;
}
bool _C_is_begin () const {
return _C_cont && _C_cont->begin () == *this;
}
bool _C_is_end () const {
return _C_cont && _C_cont->end () == *this;
}
bool _C_is_dereferenceable () const {
return !_C_is_end ();
}
bool _C_valid_range (const __rw_debug_iter &__it) const {
return _C_cont && _C_cont == __it._C_cont;
}
const iterator_type& base () const {
return _C_iter;
}
iterator_type& base () {
return _C_iter;
}
#if !defined (_RWSTD_NO_MEMBER_TEMPLATES) \
&& (!defined (__IBMCPP__) || __IBMCPP__ > 502)
// IBM xlC 5.0 fails to find these member template operators,
// yet it complains about ambiguity if they are defined along
// with the non-members below...
// operators are templatized to assure const/non-const symmetry
template <class _Iter>
difference_type
operator- (const __rw_debug_iter<container_type, _Iter,
_MutableIterator> &__rhs) const {
_RWSTD_ASSERT (_C_cont && _C_cont == __rhs._C_cont);
return _C_iter - __rhs._C_iter;
}
template <class _Iter>
bool
operator== (const __rw_debug_iter<container_type, _Iter,
_MutableIterator> &__rhs) const {
return _C_iter == __rhs._C_iter;
}
template <class _Iter>
bool
operator< (const __rw_debug_iter<container_type, _Iter,
_MutableIterator> &__rhs) const {
return _C_iter < __rhs._C_iter;
}
template <class _Iter>
bool
operator!= (const __rw_debug_iter<container_type, _Iter,
_MutableIterator> &__rhs) const {
return !(_C_iter == __rhs._C_iter);
}
template <class _Iter>
bool
operator<= (const __rw_debug_iter<container_type, _Iter,
_MutableIterator> &__rhs) const {
return !(__rhs._C_iter < _C_iter);
}
template <class _Iter>
bool
operator> (const __rw_debug_iter<container_type, _Iter,
_MutableIterator> &__rhs) const {
return __rhs._C_iter < _C_iter;
}
template <class _Iter>
bool
operator>= (const __rw_debug_iter<container_type, _Iter,
_MutableIterator> &__rhs) const {
return !(_C_iter < __rhs._C_iter);
}
#endif // !_RWSTD_NO_MEMBER_TEMPLATES && __IBMCPP__ > 502
iterator_type _C_iter; // wrapped iterator
const container_type *_C_cont; // associated container
};
} // namespace __rw
_RWSTD_NAMESPACE (std) {
#ifndef _RWSTD_NO_NONDEDUCED_CONTEXT
# define _RWSTD_CONT_DIFF_TYPE _TYPENAME _Cont::difference_type
#else
# define _RWSTD_CONT_DIFF_TYPE _RWSTD_PTRDIFF_T
#endif
template <class _Cont, class _Iter, class _MutIter>
inline _RW::__rw_debug_iter<_Cont, _Iter, _MutIter>
operator+ (_RWSTD_CONT_DIFF_TYPE __n,
const _RW::__rw_debug_iter<_Cont, _Iter, _MutIter> &__x)
{
return __x + __n;
}
#undef _RWSTD_CONT_DIFF_TYPE
#if defined (_RWSTD_NO_MEMBER_TEMPLATES) \
|| defined (__IBMCPP__) && __IBMCPP__ <= 502
// IBM xlC 5.0 fails to find the member template operators
// defined above in the presence of namespaces...
// with no support for member templates namespace-scope (non-member)
// operators must be used - these will cause ambiguities with those
// in std::rel_ops if the latter are found during lookup
// _Iter1 may differ from _Iter2 if the function operands are const
// and non-const iterators, respectively (allows symmetry)
template <class _Cont, class _Iter1, class _Iter2, class _MutIter>
inline _TYPENAME _Cont::difference_type
operator- (const _RW::__rw_debug_iter<_Cont, _Iter1, _MutIter> &__x,
const _RW::__rw_debug_iter<_Cont, _Iter2, _MutIter> &__y)
{
_RWSTD_ASSERT (__x._C_cont && __x._C_cont == __y._C_cont);
return __x._C_iter - __y._C_iter;
}
template <class _Cont, class _Iter1, class _Iter2, class _MutIter>
inline bool
operator== (const _RW::__rw_debug_iter<_Cont, _Iter1, _MutIter> &__x,
const _RW::__rw_debug_iter<_Cont, _Iter2, _MutIter> &__y)
{
return __x._C_iter == __y._C_iter;
}
template <class _Cont, class _Iter1, class _Iter2, class _MutIter>
inline bool
operator< (const _RW::__rw_debug_iter<_Cont, _Iter1, _MutIter> &__x,
const _RW::__rw_debug_iter<_Cont, _Iter2, _MutIter> &__y)
{
_RWSTD_ASSERT (__x._C_cont && __x._C_cont == __y._C_cont);
return __x._C_iter < __y._C_iter;
}
template <class _Cont, class _Iter1, class _Iter2, class _MutIter>
inline bool
operator!= (const _RW::__rw_debug_iter<_Cont, _Iter1, _MutIter> &__x,
const _RW::__rw_debug_iter<_Cont, _Iter2, _MutIter> &__y)
{
return !(__x == __y);
}
template <class _Cont, class _Iter1, class _Iter2, class _MutIter>
inline bool
operator<= (const _RW::__rw_debug_iter<_Cont, _Iter1, _MutIter> &__x,
const _RW::__rw_debug_iter<_Cont, _Iter2, _MutIter> &__y)
{
return !(__y < __x);
}
template <class _Cont, class _Iter1, class _Iter2, class _MutIter>
inline bool
operator>= (const _RW::__rw_debug_iter<_Cont, _Iter1, _MutIter> &__x,
const _RW::__rw_debug_iter<_Cont, _Iter2, _MutIter> &__y)
{
return !(__x < __y);
}
template <class _Cont, class _Iter1, class _Iter2, class _MutIter>
inline bool
operator> (const _RW::__rw_debug_iter<_Cont, _Iter1, _MutIter> &__x,
const _RW::__rw_debug_iter<_Cont, _Iter2, _MutIter> &__y)
{
return __y < __x;
}
#endif // _RWSTD_NO_MEMBER_TEMPLATES && __IBMCPP__ <= 502
} // namespace std
_RWSTD_NAMESPACE (__rw) {
#define _RWSTD_DEBUG_ITER(cont, it, mutit) __rw_debug_iter< cont, it, mutit >
template <class _Cont, class _Iter, class _MutIter>
inline bool
__rw_valid_range (const _RWSTD_DEBUG_ITER(_Cont, _Iter, _MutIter) &__first,
const _RWSTD_DEBUG_ITER(_Cont, _Iter, _MutIter) &__last)
{
return __first._C_cont && __first._C_cont == __last._C_cont;
}
template <class _Iterator>
inline bool
__rw_valid_range (const _Iterator &, const _Iterator &)
{
return true;
}
template <class _Cont, class _Iter, class _MutIter>
inline bool
__rw_in_range (const _RWSTD_DEBUG_ITER(_Cont, _Iter, _MutIter) &__it,
const _RWSTD_DEBUG_ITER(_Cont, _Iter, _MutIter) &__first,
const _RWSTD_DEBUG_ITER(_Cont, _Iter, _MutIter) &__last)
{
return __rw_valid_range (__first, __it)
&& __rw_valid_range (__it, __last);
}
template <class _Iterator>
inline bool
__rw_in_range (const _Iterator&, const _Iterator&, const _Iterator&)
{
return true;
}
template <class _Cont, class _Iter, class _MutIter>
inline bool
__rw_dereferenceable (const _RWSTD_DEBUG_ITER(_Cont, _Iter, _MutIter) &__it)
{
return __it._C_is_dereferenceable ();
}
template <class _Iterator>
inline bool
__rw_dereferenceable (const _Iterator&)
{
return true;
}
template <class _TypeT>
inline bool
__rw_dereferenceable (const _TypeT *__ptr)
{
return 0 != __ptr;
}
} // namespace __rw
#undef _RWSTD_DEBUG_ITER
#endif // _RWSTD_NO_DEBUG_ITER
#endif // _RWSTD_RW_ITERBASE_H_INCLUDED

58
extern/stdcxx/4.2.1/include/rw/_math.h vendored Normal file
View File

@@ -0,0 +1,58 @@
/***************************************************************************
*
* _math.h - Standard Library vs math.h exception conflict hack.
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _math.h 550991 2007-06-26 23:58:07Z sebor $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
**************************************************************************/
#ifndef _RWSTD_RW_MATH_H_INCLUDED
#define _RWSTD_RW_MATH_H_INCLUDED
#ifndef _RWSTD_RW_DEFS_H_INCLUDED
# include <rw/_defs.h>
#endif // _RWSTD_RW_DEFS_H_INCLUDED
// avoid a conflicting exception structure on platforms where
// struct exception is defined unguarded in <math.h>
#ifndef _RWSTD_NO_MATH_EXCEPTION
# undef exception
# define exception math_exception
#endif // _RWSTD_NO_MATH_EXCEPTION
#include _RWSTD_CMATH
#undef exception
// MSVC provides its own complex macro
#ifdef _MSC_VER
# ifdef complex
# undef complex
# endif
#endif
#endif // _RWSTD_RW_MATH_H_INCLUDED

View File

@@ -0,0 +1,273 @@
/***************************************************************************
*
* _mbstate.h - definition of mbstate_t
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _mbstate.h 648752 2008-04-16 17:01:56Z faridz $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 2005-2008 Rogue Wave Software, Inc.
*
**************************************************************************/
#ifndef _RWSTD_RW_MBSTATE_H_INCLUDED
#define _RWSTD_RW_MBSTATE_H_INCLUDED
#ifndef _RWSTD_RW_DEFS_H_INCLUDED
# include <rw/_defs.h>
#endif // _RWSTD_RW_DEFS_H_INCLUDED
#if defined (_RWSTD_OS_AIX)
/*** AIX ******************************************************************/
_RWSTD_NAMESPACE (__rw) {
// introduce typedef to avoid const qualification issues
typedef char* __rw_mbstate_t;
# define _RWSTD_MBSTATE_T _RW::__rw_mbstate_t
} // namespace __rw
#elif defined (_RWSTD_OS_HP_UX)
/*** HP-UX ****************************************************************/
# ifndef _MBSTATE_T
# define _MBSTATE_T
# if !defined (__HP_aCC) && !defined (_RWSTD_NO_LIBC_IN_STD) \
|| defined (__HP_aCC) && defined (_NAMESPACE_STD)
_RWSTD_NAMESPACE (std) {
# endif // HP aCC -AA
extern "C" {
// HP-UX 10.00 or 11.00 do not define mbstate_t
// HP-UX 11.11 (and higher) definition of mbstate_t
typedef struct {
unsigned char __parse_size: 3;
unsigned char __dummy: 4;
unsigned char __shift_state: 1;
char __parse_buf [7];
} mbstate_t;
} // extern "C"
# if !defined (__HP_aCC) && !defined (_RWSTD_NO_LIBC_IN_STD) \
|| defined (__HP_aCC) && defined (_NAMESPACE_STD)
} // namespace std
# undef _RWSTD_NO_STD_MBSTATE_T
# define _RWSTD_MBSTATE_T _STD::mbstate_t
# else // if !(HP aCC -AA)
// let <cwchar> et al know that mbstate_t is not declared
// in namespace std (and should be introduced there via
// a using declaration)
# define _RWSTD_NO_STD_MBSTATE_T
_RWSTD_NAMESPACE (std) {
_USING (::mbstate_t);
} // namespace std
# define _RWSTD_MBSTATE_T mbstate_t
# endif // HP aCC -AA
# else // if defined (_MBSTATE_T)
// /usr/include/sys/_mbstate_t.h #included and mbstate_t defined
# ifndef _NAMESPACE_STD
// let <cwchar> et al know that mbstate_t is not declared
// in namespace std (and should be introduced there via
// a using declaration)
# define _RWSTD_NO_STD_MBSTATE_T
_RWSTD_NAMESPACE (std) {
_USING (::mbstate_t);
} // namespace std
# define _RWSTD_MBSTATE_T mbstate_t
# endif // _NAMESPACE_STD
# endif // _MBSTATE_T
#elif defined (_RWSTD_OS_IRIX64)
/*** IRIX64 ***************************************************************/
# define _RWSTD_MBSTATE_T char
#elif defined (_MSC_VER)
/*** MSVC 6.0 - 8.0 *******************************************************/
# define _RWSTD_MBSTATE_T int
#elif !defined (_RWSTD_NO_MBSTATE_T)
/*** not HP-UX that has a mbstate_t ***************************************/
# if defined (_RWSTD_OS_LINUX)
/*** Linux/glibc **********************************************************/
// define __mbstate_t at file scope (see /usr/include/wchar.h)
# ifndef __mbstate_t_defined
# define __mbstate_t_defined 1
extern "C" {
typedef struct {
int __count;
union {
_RWSTD_WINT_T __wch;
char __wchb [4];
} __value;
} __mbstate_t;
} // extern "C"
# endif // __mbstate_t_defined
# define _RWSTD_MBSTATE_T __mbstate_t
# elif defined (_RWSTD_OS_SUNOS)
/*** Solaris 7 and beyond *************************************************/
# ifndef _MBSTATET_H
# define _MBSTATET_H
extern "C" {
// avoid namespace pollution on Solaris
typedef struct __mbstate_t {
// Sun uses _LP64 in their header but the macro may not
// yetbe #defined at this point, depending on what other
// headers have been #included
# if 8 == _RWSTD_LONG_SIZE // LP64
long __filler [4];
# else
int __filler [6];
# endif // 8 == sizeof(long)
} __mbstate_t;
} // extern "C"
# endif // _MBSTATET_H
# define _RWSTD_MBSTATE_T __mbstate_t
// let <cwchar> et al know that mbstate_t is not declared
// in namespace std (and should be introduced there via
// a using declaration)
# define _RWSTD_NO_STD_MBSTATE_T
# elif defined (_RWSTD_OS_DARWIN)
/*** Apple Darwin/OS X ****************************************************/
// include a system header for __mbstate_t
# include <machine/_types.h>
# define _RWSTD_MBSTATE_T __mbstate_t
# else // if !defined (_RWSTD_OS_SUNOS)
/*** generic OS ***********************************************************/
# include _RWSTD_CWCHAR
# define _RWSTD_MBSTATE_T _RWSTD_C::mbstate_t
# endif // _RWSTD_OS_SUNOS
/*** not HP-UX that does not define mbstate_t *****************************/
#elif !defined (_RWSTD_MBSTATE_T_DEFINED)
# define _RWSTD_MBSTATE_T_DEFINED
/*** SunOS 5.6 and prior **************************************************/
# if defined (_RWSTD_OS_SUNOS)
// Solaris 6 does not define mbstate_t; the definition of
// the struct below is taken from <wchar_impl.h> on Solaris 7
# ifndef _WCHAR_IMPL_H
# define _WCHAR_IMPL_H
# ifndef _MBSTATET_H
# define _MBSTATET_H
extern "C" {
struct __mbstate_t
{
# ifdef _LP64
long _C_data [4];
# else // if !defined (_LP64)
int _C_data [6];
# endif // _LP64
};
} // extern "C"
# endif // _MBSTATET_H
# endif // _WCHAR_IMPL_H
# define _RWSTD_MBSTATE_T __mbstate_t
// let <cwchar> et al know that mbstate_t is not declared
// in namespace std (and should be introduced there via
// a using declaration)
# define _RWSTD_NO_STD_MBSTATE_T
# else // any other OS
# ifndef _RWSTD_NO_USING_LIBC_IN_STD
_RWSTD_NAMESPACE (std) {
# endif // _RWSTD_NO_USING_LIBC_IN_STD
extern "C" {
// generic definition of mbstate_t
struct mbstate_t
{
# ifdef _RWSTD_MBSTATE_T_SIZE
char _C_data [_RWSTD_MBSTATE_T_SIZE];
# else
char _C_data [sizeof (long)];
# endif
};
} // extern "C"
# ifndef _RWSTD_NO_USING_LIBC_IN_STD
} // namespace std
# endif // _RWSTD_NO_USING_LIBC_IN_STD
# define _RWSTD_MBSTATE_T _STD::mbstate_t
# endif // generic OS
#endif // _RWSTD_NO_MBSTATE_T && !_RWSTD_MBSTATE_T_DEFINED
#endif // _RWSTD_RW_MBSTATE_H_INCLUDED

2123
extern/stdcxx/4.2.1/include/rw/_mutex.h vendored Normal file

File diff suppressed because it is too large Load Diff

97
extern/stdcxx/4.2.1/include/rw/_new.h vendored Normal file
View File

@@ -0,0 +1,97 @@
// -*- C++ -*-
/***************************************************************************
*
* _new.h - definitions of placement operator new and delete
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _new.h 550991 2007-06-26 23:58:07Z sebor $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
**************************************************************************/
#ifndef _RWSTD_RW_NEW_H_INCLUDED
#define _RWSTD_RW_NEW_H_INCLUDED
#ifndef _RWSTD_RW_DEFS_H_INCLUDED
# include <rw/_defs.h>
#endif // _RWSTD_RW_DEFS_H_INCLUDED
#if defined (__SUNPRO_CC)
# include <new>
#else // if !defined (__SUNPRO_CC)
void* operator new (_RWSTD_SIZE_T, void*) _NEW_THROWS (());
# ifdef _RWSTD_NO_OPERATOR_NEW_PLACEMENT
# if !defined (_MSC_VER) || !defined (__PLACEMENT_NEW_INLINE)
// remember to disable definitions of placement new and
// placement delete in MSVC's <new.h> later in this file
# define _RWSTD_DEFINE_PLACEMENT_NEW_INLINE
// 18.4.1.3, p2 - not replaceable, no-op
inline void*
operator new (_RWSTD_SIZE_T, void *__ptr) _NEW_THROWS (())
{
return __ptr;
}
# endif // !MSVC || !__PLACEMENT_NEW_INLINE
# endif // _RWSTD_NO_OPERATOR_NEW_PLACEMENT
# ifndef _RWSTD_NO_PLACEMENT_DELETE
# if !defined (_MSC_VER) || !defined (__PLACEMENT_NEW_INLINE)
void operator delete (void*, void*) _NEW_THROWS (());
# ifdef _RWSTD_NO_OPERATOR_DELETE_PLACEMENT
// remember to disable definitions of placement new and
// placement delete in MSVC's <new.h> later in this file
# define _RWSTD_DEFINE_PLACEMENT_NEW_INLINE
// not replaceable, no-op
inline void
operator delete (void*, void*) _NEW_THROWS (())
{
// no-op
}
# endif // _RWSTD_NO_OPERATOR_DELETE_PLACEMENT
# endif // !MSVC || !__PLACEMENT_NEW_INLINE
# endif // _RWSTD_NO_PLACEMENT_DELETE
# ifdef _RWSTD_DEFINE_PLACEMENT_NEW_INLINE
# define __PLACEMENT_NEW_INLINE
# undef _RWSTD_DEFINE_PLACEMENT_NEW_INLINE
# endif // _RWSTD_DEFINE_PLACEMENT_NEW_INLINE
#endif // __SUNPRO_CC
#endif // _RWSTD_RW_NEW_H_INCLUDED

158
extern/stdcxx/4.2.1/include/rw/_pair.h vendored Normal file
View File

@@ -0,0 +1,158 @@
// -*- C++ -*-
/***************************************************************************
*
* _pair.h - definition of std::pair
*
* $Id: _pair.h 550991 2007-06-26 23:58:07Z sebor $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2005 Rogue Wave Software.
*
***************************************************************************
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* 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. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
**************************************************************************/
#ifndef _RWSTD_RW_PAIR_H_INCLUDED
#define _RWSTD_RW_PAIR_H_INCLUDED
#ifndef _RWSTD_RW_FUNCBASE_H_INCLUDED
# include <rw/_funcbase.h> // for less
#endif // _RWSTD_RW_FUNCBASE_H_INCLUDED
_RWSTD_NAMESPACE (std) {
// 20.2.2
template <class _TypeT, class _TypeU>
struct pair
{
typedef _TypeT first_type;
typedef _TypeU second_type;
first_type first;
second_type second;
// 20.2.2, p2
pair ()
#ifndef _RWSTD_NO_EMPTY_MEM_INITIALIZER
: first (/* lwg issue 265 */), second () { }
#else
// assumes types satisfy the CopyConstructible requirements
: first (first_type ()), second (second_type ()) { }
#endif // _RWSTD_NO_EMPTY_MEM_INITIALIZER
// 20.2.2, p3
pair (const first_type &__x, const second_type &__y)
: first (__x), second (__y) { }
// 20.2.2, p4
template <class _TypeX, class _TypeY>
pair (const pair <_TypeX, _TypeY> &__rhs)
: first (__rhs.first), second (__rhs.second) { }
// lwg issue 353
template <class _TypeX, class _TypeY>
pair<_TypeT, _TypeU>& operator= (const pair <_TypeX, _TypeY> &__rhs) {
return first = __rhs.first, second = __rhs.second, *this;
}
};
// 20.2.2, p5
template <class _TypeT, class _TypeU>
inline bool
operator== (const pair<_TypeT, _TypeU>& __x, const pair<_TypeT, _TypeU>& __y)
{
return __x.first == __y.first && __x.second == __y.second;
}
template <class _TypeT, class _TypeU>
inline bool
operator!= (const pair<_TypeT, _TypeU>& __x, const pair<_TypeT, _TypeU>& __y)
{
return !(__x == __y);
}
// 20.2.2, p6
template <class _TypeT, class _TypeU>
inline bool
operator< (const pair<_TypeT, _TypeU>& __x, const pair<_TypeT, _TypeU>& __y)
{
_STD::less<_TypeT> __lessT;
// follows resolution of lwg issue 348
return __lessT (__x.first, __y.first)
|| ( !__lessT (__y.first, __x.first)
&& _STD::less<_TypeU>()(__x.second, __y.second));
}
template <class _TypeT, class _TypeU>
inline bool
operator> (const pair<_TypeT, _TypeU>& __x, const pair<_TypeT, _TypeU>& __y)
{
return __y < __x;
}
template <class _TypeT, class _TypeU>
inline bool
operator>= (const pair<_TypeT, _TypeU>& __x, const pair<_TypeT, _TypeU>& __y)
{
return !(__x < __y);
}
template <class _TypeT, class _TypeU>
inline bool
operator<= (const pair<_TypeT, _TypeU>& __x, const pair<_TypeT, _TypeU>& __y)
{
return !(__y < __x);
}
// 20.2.2, p7, signature follows lwg issue 181
template <class _TypeT, class _TypeU>
inline pair<_TypeT, _TypeU>
make_pair (_TypeT __x, _TypeU __y)
{
return pair<_TypeT, _TypeU>(__x, __y);
}
} // namespace std
#endif // _RWSTD_RW_PAIR_H_INCLUDED

View File

@@ -0,0 +1,194 @@
// -*- C++ -*-
/***************************************************************************
*
* _rawiter - declarations for the C++ Standard Library raw_storage_iterator
*
* $Id: _rawiter.h 586811 2007-10-20 22:02:54Z sebor $
*
***************************************************************************
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* 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. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2007 Rogue Wave Software, Inc.
*
**************************************************************************/
#ifndef _RWSTD_RW_RAWITER_H_INCLUDED
#define _RWSTD_RW_RAWITER_H_INCLUDED
#ifndef _RWSTD_ITERBASE_H_INCLUDED
# include <rw/_iterbase.h>
#endif // _RWSTD_ITERBASE_H_INCLUDED
#ifndef _RWSTD_RW_NEW_H_INCLUDED
# include <rw/_new.h>
#endif // _RWSTD_RW_NEW_H_INCLUDED
#ifndef _RWSTD_RW_PAIR_H_INCLUDED
# include <rw/_pair.h>
#endif // _RWSTD_RW_PAIR_H_INCLUDED
_RWSTD_NAMESPACE (std) {
// 20.4.2
template <class _OutputIterator, class _TypeT>
class raw_storage_iterator
: public iterator<output_iterator_tag, void, void, void, void>
{
_OutputIterator _C_iter;
public:
// for completeness and genericity
typedef _OutputIterator iterator_type;
// 20.4.2, p2
_EXPLICIT raw_storage_iterator (iterator_type __x): _C_iter (__x) { }
// 20.4.2, p3
raw_storage_iterator& operator* () {
return *this;
}
// 20.4.2, p4
raw_storage_iterator& operator= (const _TypeT& __rhs) {
::new (&(*_C_iter)) _TypeT (__rhs);
return *this;
}
// 20.4.2, p6
raw_storage_iterator& operator++ () {
return ++_C_iter, *this;
}
// 20.4.2, p7
raw_storage_iterator operator++ (int) {
const raw_storage_iterator __tmp = *this;
return ++*this, __tmp;
}
};
} // namespace std
_RWSTD_NAMESPACE (__rw) {
extern "C" {
// [de]allocates a previously allocated temporary buffer
// the constant _RWSTD_TMPBUF_SIZE controls the size of a static buffer
// if request for area larger than _RWSTD_TMPBUF_SIZE comes in, space
// is allocated dynamically, otherwise the static buffer is used
// return value meaningful only when allocating
_RWSTD_EXPORT _RWSTD_SIZE_T
__rw_tmpbuf (void**, _RWSTD_PTRDIFF_T, _RWSTD_SIZE_T);
}
} // namespace __rw
_RWSTD_NAMESPACE (std) {
// 20.4.3 only specifies a get_temporary_buffer<>() that takes a ptrdiff_t.
// We overload on all types so that signed integral types other than ptrdiff_t
// can be used. This is important in getting algorithms to compile with
// user-defined iterators (not derived from iterator<...>) whose difference
// type is something other than ptrdiff_t.
// having this overload is important in some cases for compilers that
// do not support partial class specialization (and where as a consequence
// iterator_traits<> isn't available)
template <class _TypeT, class _Distance>
inline pair<_TypeT*, _Distance>
get_temporary_buffer (_Distance __nelems, _TypeT*)
{
pair<_TypeT*, _Distance> __res (0, 0);
#if __GNUG__ >= 4
// tell gcc 4 about type-punning in the cast below
typedef void* __attribute__ ((__may_alias__)) _VoidPtrT;
#else // !gcc || gcc < 4
typedef void* _VoidPtrT;
#endif // gcc
__res.second =
_RW::__rw_tmpbuf (_RWSTD_REINTERPRET_CAST (_VoidPtrT*, &__res.first),
__nelems < 0 ? 0 : __nelems, sizeof (_TypeT));
return __res;
}
#ifndef _RWSTD_NO_TEMPLATE_ON_RETURN_TYPE
// 20.4.3, p1
template <class _TypeT>
inline pair<_TypeT*, _RWSTD_PTRDIFF_T>
get_temporary_buffer (_RWSTD_PTRDIFF_T __n)
{
return get_temporary_buffer (__n, (_TypeT*)0);
}
#endif // _RWSTD_NO_TEMPLATE_ON_RETURN_TYPE
// 20.4.3, p3
template <class _TypeT>
inline void
return_temporary_buffer (_TypeT *__p)
{
#if __GNUG__ >= 4
// tell gcc 4 about type-punning in the cast below
typedef void* __attribute__ ((__may_alias__)) _VoidPtrT;
#else // !gcc || gcc < 4
typedef void* _VoidPtrT;
#endif // gcc
_RW::__rw_tmpbuf (_RWSTD_REINTERPRET_CAST (_VoidPtrT*, &__p),
0, sizeof (_TypeT));
}
} // namespace std
#endif // _RWSTD_RW_RAWITER_H_INCLUDED

View File

@@ -0,0 +1,95 @@
// -*- C++ -*-
/***************************************************************************
*
* _relops.h - definition of the std::rel_ops namespace and members
*
* $Id: _relops.h 550991 2007-06-26 23:58:07Z sebor $
*
***************************************************************************
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* 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. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
**************************************************************************/
#ifndef _RWSTD_RW_RELOPS_H_INCLUDED
#define _RWSTD_RW_RELOPS_H_INCLUDED
#ifndef _RWSTD_RW_DEFS_H_INCLUDED
# include <rw/_defs.h>
#endif // _RWSTD_RW_DEFS_H_INCLUDED
_RWSTD_NAMESPACE (std) {
#ifndef _RWSTD_NO_NAMESPACE
// rel_ops contents not available if namespaces are disabled
// to avoid ambiguities with other overloaded operators
_RWSTD_NAMESPACE (rel_ops) {
template <class _TypeT>
inline bool operator!= (const _TypeT& __x, const _TypeT& __y)
{
return !(__x == __y);
}
template <class _TypeT>
inline bool operator> (const _TypeT& __x, const _TypeT& __y)
{
return __y < __x;
}
template <class _TypeT>
inline bool operator<= (const _TypeT& __x, const _TypeT& __y)
{
return !(__y < __x);
}
template <class _TypeT>
inline bool operator>= (const _TypeT& __x, const _TypeT& __y)
{
return !(__x < __y);
}
} // namespace rel_ops
#endif // _RWSTD_NO_NAMESPACE
} // namespace std
#endif // _RWSTD_RW_RELOPS_H_INCLUDED

161
extern/stdcxx/4.2.1/include/rw/_select.h vendored Normal file
View File

@@ -0,0 +1,161 @@
/***************************************************************************
*
* _select.h - Definitions of helper templates
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _select.h 451936 2006-10-02 09:51:24Z faridz $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2005 Rogue Wave Software.
*
**************************************************************************/
#ifndef _RWSTD_RW_SELECT_H_INCLUDED
#define _RWSTD_RW_SELECT_H_INCLUDED
#ifndef _RWSTD_RW_DEFS_H_INCLUDED
# include <rw/_defs.h>
#endif // _RWSTD_RW_DEFS_H_INCLUDED
_RWSTD_NAMESPACE (__rw) {
struct __rw_false_t { enum { _C_val }; };
struct __rw_true_t { enum { _C_val = 1 }; };
template <class _TypeT>
struct __rw_select_int
{
typedef void* _SelectT;
#if defined (__SUNPRO_CC) && __SUNPRO_CC <= 0x530
void* _C_selector;
#endif // SunPro
};
#define _RWSTD_SPECIALIZE_IS_INT(T) \
_RWSTD_SPECIALIZED_CLASS \
struct __rw_select_int<T> { \
typedef int _SelectT; \
enum { _C_selector = 1 }; \
}
#ifndef _RWSTD_NO_NATIVE_BOOL
_RWSTD_SPECIALIZE_IS_INT (bool);
#endif // _RWSTD_NO_NATIVE_BOOL
_RWSTD_SPECIALIZE_IS_INT (char);
_RWSTD_SPECIALIZE_IS_INT (signed char);
_RWSTD_SPECIALIZE_IS_INT (unsigned char);
_RWSTD_SPECIALIZE_IS_INT (short);
_RWSTD_SPECIALIZE_IS_INT (unsigned short);
_RWSTD_SPECIALIZE_IS_INT (int);
_RWSTD_SPECIALIZE_IS_INT (unsigned int);
_RWSTD_SPECIALIZE_IS_INT (long);
_RWSTD_SPECIALIZE_IS_INT (unsigned long);
#ifdef _RWSTD_LONG_LONG
_RWSTD_SPECIALIZE_IS_INT (_RWSTD_LONG_LONG);
_RWSTD_SPECIALIZE_IS_INT (unsigned _RWSTD_LONG_LONG);
#endif // _RWSTD_LONG_LONG
#ifndef _RWSTD_NO_NATIVE_WCHAR_T
_RWSTD_SPECIALIZE_IS_INT (wchar_t);
#endif // _RWSTD_NO_NATIVE_WCHAR_T
#if !defined (__SUNPRO_CC) || __SUNPRO_CC > 0x530
# define _RWSTD_DISPATCH(iter) \
(_TYPENAME _RW::__rw_select_int< iter >::_SelectT (1))
#else
// working around a SunPro 5.3 a prior bug (PR #28739)
# define _RWSTD_DISPATCH(iter) _RW::__rw_select_int< iter >()._C_selector
#endif
#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
template <class _TypeT, class _TypeU>
struct __rw_is_same
{
typedef __rw_false_t _C_type;
enum { _C_val };
};
template <class _TypeT>
struct __rw_is_same<_TypeT, _TypeT>
{
typedef __rw_true_t _C_type;
enum { _C_val = 1 };
};
#else // if defined (_RWSTD_NO_CLASS_PARTIAL_SPEC)
template <bool flag>
struct __rw_bool_t
{
typedef __rw_false_t _C_type;
};
_RWSTD_SPECIALIZED_CLASS
struct __rw_bool_t<true>
{
typedef __rw_true_t _C_type;
};
template <class _TypeT, class _TypeU>
struct __rw_is_same
{
struct _C_yes {};
struct _C_no { _C_yes no_ [2]; };
template <class _TypeV>
struct _C_Type {};
static _C_yes test (_C_Type<_TypeT>, _C_Type<_TypeT>);
static _C_no test (...);
enum { _C_val = sizeof (test (_C_Type<_TypeT> (),
_C_Type<_TypeU> ())) == sizeof (_C_yes) };
typedef _TYPENAME __rw_bool_t<_C_val>::_C_type _C_type;
};
#endif // _RWSTD_NO_CLASS_PARTIAL_SPEC
} // namespace __rw
# if defined (__IBMCPP__) && __IBMCPP__ <= 500
// working around an xlC 5.0 bug
_USING (__rw::__rw_select_int);
# endif // VisualAge 5.0
#endif // _RWSTD_RW_SELECT_H_INCLUDED

View File

@@ -0,0 +1,324 @@
// -*- C++ -*-
/***************************************************************************
*
* _specialized.h - definitions of specialized algorithms
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _specialized.h 605548 2007-12-19 14:19:33Z faridz $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
***************************************************************************
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* 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. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
**************************************************************************/
#ifndef _RWSTD_RW_SPECIALIZED_H_INCLUDED
#define _RWSTD_RW_SPECIALIZED_H_INCLUDED
#ifndef _RWSTD_RW_NEW_H_INCLUDED
# include <rw/_new.h>
#endif // _RWSTD_RW_NEW_H_INCLUDED
_RWSTD_NAMESPACE (__rw) {
#ifndef _RWSTD_NO_NONDEDUCED_CONTEXT
# define _RWSTD_CONTAINER_SIZE_TYPE _TYPENAME _Container::size_type
#else
# define _RWSTD_CONTAINER_SIZE_TYPE _RWSTD_SIZE_T
#endif // _RWSTD_NO_NONDEDUCED_CONTEXT
// returns a suggested new capacity for a container needing more space
template <class _Container>
inline _RWSTD_CONTAINER_SIZE_TYPE
__rw_new_capacity (_RWSTD_CONTAINER_SIZE_TYPE __size, const _Container*)
{
typedef _RWSTD_CONTAINER_SIZE_TYPE _RWSizeT;
const _RWSizeT __ratio = _RWSizeT ( (_RWSTD_NEW_CAPACITY_RATIO << 10)
/ _RWSTD_RATIO_DIVIDER);
const _RWSizeT __cap = (__size >> 10) * __ratio
+ (((__size & 0x3ff) * __ratio) >> 10);
return (__size += _RWSTD_MINIMUM_NEW_CAPACITY) > __cap ? __size : __cap;
}
#undef _RWSTD_CONTAINER_SIZE_TYPE
#ifndef _RWSTD_NO_PART_SPEC_OVERLOAD
template <class _TypeT, class _TypeU>
inline void
__rw_construct (_TypeT* __p, _TypeU& __val)
{
::new (_RWSTD_STATIC_CAST (void*, __p)) _TypeT (__val);
}
template <class _TypeT, class _TypeU>
inline void
__rw_construct (volatile _TypeT* __p, _TypeU& __val)
{
// remove volatile before invoking operator new
__rw_construct (_RWSTD_CONST_CAST (_TypeT*, __p), __val);
}
#else // #ifdef _RWSTD_NO_PART_SPEC_OVERLOAD
template <class _TypeT, class _TypeU>
inline void
__rw_construct_impl (_TypeT* __p, _TypeU& __val)
{
::new (_RWSTD_STATIC_CAST (void*, __p)) _TypeT (__val);
}
template <class _TypeT, class _TypeU>
inline void
__rw_construct (volatile _TypeT* __p, _TypeU& __val)
{
// remove volatile before invoking operator new
__rw_construct_impl (_RWSTD_CONST_CAST (_TypeT*, __p), __val);
}
#endif // _RWSTD_NO_PART_SPEC_OVERLOAD
template <class _TypeT>
inline void
__rw_destroy (_TypeT &__ref)
{
__ref.~_TypeT ();
}
template <class _ForwardIterator>
inline void
__rw_destroy (_ForwardIterator __first, _ForwardIterator __last)
{
for (; __first != __last; ++__first)
__rw_destroy (*__first);
}
#ifndef _RWSTD_NO_PTR_VALUE_TEMPLATE_OVERLOAD
// for compilers that don't optimize "empty" loops
template <class _TypeT>
inline void __rw_destroy (_TypeT**, _TypeT**)
{ }
#endif // _RWSTD_NO_PTR_VALUE_TEMPLATE_OVERLOAD
} // namespace __rw
_RWSTD_NAMESPACE (std) {
template <class _TypeT>
class allocator;
// 20.4.4.1
template <class _InputIterator, class _ForwardIterator>
inline _ForwardIterator
uninitialized_copy (_InputIterator __first, _InputIterator __last,
_ForwardIterator __res)
{
const _ForwardIterator __start = __res;
_TRY {
for (; __first != __last; ++__first, ++__res)
_RW::__rw_construct (&*__res, *__first);
}
_CATCH (...) {
_RW::__rw_destroy (__start, __res);
_RETHROW;
}
return __res;
}
#ifdef _RWSTD_ALLOCATOR
// extension
template <class _InputIterator, class _ForwardIterator, class _Allocator>
inline _ForwardIterator
uninitialized_copy (_InputIterator __first, _InputIterator __last,
_ForwardIterator __res, _Allocator &__alloc)
{
_ForwardIterator __start = __res;
_TRY {
for (; __first != __last; ++__first, ++__res)
__alloc.construct (__alloc.address (*__res), *__first);
}
_CATCH (...) {
for (; __start != __res; ++__start)
__alloc.destroy (__alloc.address (*__start));
_RETHROW;
}
return __res;
}
#endif // _RWSTD_ALLOCATOR
// 20.4.4.2
template <class _ForwardIterator, class _TypeT>
inline void
uninitialized_fill (_ForwardIterator __first, _ForwardIterator __last,
const _TypeT& __x)
{
const _ForwardIterator __start = __first;
_TRY {
for (; __first != __last; ++__first)
_RW::__rw_construct (&*__first, __x);
}
_CATCH (...) {
_RW::__rw_destroy (__start, __first);
_RETHROW;
}
}
// 20.4.4.3
template <class _ForwardIterator, class _Size, class _TypeT>
inline void
uninitialized_fill_n (_ForwardIterator __first, _Size __n, const _TypeT& __x)
{
const _ForwardIterator __start = __first;
_TRY {
for (; __n; --__n, ++__first)
_RW::__rw_construct (&*__first, __x);
}
_CATCH (...) {
_RW::__rw_destroy (__start, __first);
_RETHROW;
}
}
#ifdef _RWSTD_ALLOCATOR
// extension
template <class _ForwardIter, class _Size, class _TypeT, class _Allocator>
inline void
uninitialized_fill_n (_ForwardIter __first, _Size __n,
const _TypeT& __x, _Allocator& __alloc)
{
_ForwardIter __start = __first;
_TRY {
for (; __n; --__n, ++__first)
__alloc.construct (__alloc.address (*__first), __x);
}
_CATCH (...) {
for (; __start != __first; ++__start)
__alloc.destroy (__alloc.address (*__start));
_RETHROW;
}
}
#else // if !defined (_RWSTD_ALLOCATOR)
template <class _Allocator, class _TypeT>
class allocator_interface;
// Specializations for non-standard allocators. When vector calls
// uninitialized_{copy,fill_n} with non-standard allocator, a temporary
// instance of allocator_interface is passed to these functions. Since
// C++ forbids temporaries to be passed as non-const references, we
// use these specializations to pass a const reference (and we can force
// allocator_interface members construct & destroy to be const).
template <class _InputIterator, class _ForwardIterator,
class _Allocator, class _TypeT>
inline _ForwardIterator
uninitialized_copy (_InputIterator __first,
_InputIterator __last,
_ForwardIterator __res,
allocator_interface<_Allocator, _TypeT> &__alloc)
{
_ForwardIterator __start = __res;
_TRY {
for (; __first != __last; ++__first, ++__res)
__alloc.construct (__alloc.address (*__res), *__first);
}
_CATCH (...) {
for (; __start != __res; ++__start)
__alloc.destroy (__alloc.address (*__start));
_RETHROW;
}
return __res;
}
template <class _ForwardIter, class _Size,
class _TypeT, class _Allocator, class _TypeU>
inline void
uninitialized_fill_n (_ForwardIter __first, _Size __n,
const _TypeT& __x,
allocator_interface<_Allocator, _TypeU> &__alloc)
{
_ForwardIter __start = __first;
_TRY {
for (; __n; --__n, ++__first)
__alloc.construct (__alloc.address (*__first), __x);
}
_CATCH (...) {
for (; __start != __first; ++__start)
__alloc.destroy (__alloc.address (*__start));
_RETHROW;
}
}
#endif // _RWSTD_ALLOCATOR
} // namespace std
#endif // _RWSTD_RW_SPECIALIZED_H_INCLUDED

View File

@@ -0,0 +1,196 @@
/***************************************************************************
*
* _streamiter.h - Definitions of stream iterator templates
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _streamiter.h 648752 2008-04-16 17:01:56Z faridz $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2008 Rogue Wave Software, Inc.
*
**************************************************************************/
#ifndef _RWSTD_RW_STREAMITER_H_INCLUDED
#define _RWSTD_RW_STREAMITER_H_INCLUDED
#ifndef _RWSTD_RW_ITERBASE_H_INCLUDED
# include <rw/_iterbase.h>
#endif // _RWSTD_RW_ITERBASE_H_INCLUDED
#include <iosfwd>
_RWSTD_NAMESPACE (std) {
template <class _TypeT, class _CharT, class _Traits, class _Distance>
class istream_iterator;
template <class _TypeT, class _CharT, class _Traits, class _Distance>
bool operator== (const istream_iterator<_TypeT, _CharT, _Traits, _Distance>&,
const istream_iterator<_TypeT, _CharT, _Traits, _Distance>&);
// 24.5.1
#if !defined (_MSC_VER) || _MSC_VER > 1300
template <class _TypeT, class _CharT = char,
class _Traits = char_traits<_CharT>,
class _Distance = _RWSTD_PTRDIFF_T>
#else
// prevent MSVC 6.0 ICE
template <class _TypeT, class _CharT, class _Traits, class _Distance>
#endif
class istream_iterator
: public iterator<input_iterator_tag, _TypeT, _Distance,
const _TypeT*, const _TypeT&>
{
friend bool _RWSTD_SPECIALIZED_FRIEND (operator==)
(const istream_iterator&, const istream_iterator&);
typedef iterator<input_iterator_tag, _TypeT, _Distance,
const _TypeT*, const _TypeT&> _C_base;
public:
typedef _CharT char_type;
typedef _Traits traits_type;
typedef basic_istream<char_type, traits_type> istream_type;
// for convenience
typedef _TYPENAME _C_base::value_type value_type;
// 24.5.1.1, p1
istream_iterator (): _C_strm (0) { }
// 24.5.1.1, p2
istream_iterator (istream_type& __s)
: _C_strm (&__s) {
++*this;
}
// 24.5.1.2, p1
const value_type& operator* () const {
return _C_val;
}
// 24.5.1.2, p2
_RWSTD_OPERATOR_ARROW (const value_type* operator->() const);
// 24.5.1.2, p3
istream_iterator& operator++ ();
// 24.5.1.2, p5
istream_iterator operator++ (int) {
istream_iterator __tmp = *this;
return ++*this, __tmp;
}
protected:
istream_type *_C_strm; // associated stream
value_type _C_val; // last extracted value
};
template <class _TypeT, class _CharT, class _Traits, class _Distance>
inline istream_iterator<_TypeT, _CharT, _Traits, _Distance>&
istream_iterator<_TypeT, _CharT, _Traits, _Distance>::
operator++ ()
{
// incrementing an end-of-stream iterator has undefined behavior
// see also LWG issue 788
if (_C_strm && (*_C_strm >> _C_val).fail ())
_C_strm = 0;
return *this;
}
// 24.5.1.2, p6
template <class _TypeT, class _CharT, class _Traits, class _Distance>
inline bool
operator== (const istream_iterator<_TypeT, _CharT, _Traits, _Distance>& __x,
const istream_iterator<_TypeT, _CharT, _Traits, _Distance>& __y)
{
return __x._C_strm == __y._C_strm;
}
template <class _TypeT, class _CharT, class _Traits, class _Distance>
inline bool
operator!= (const istream_iterator<_TypeT, _CharT, _Traits, _Distance>& __x,
const istream_iterator<_TypeT, _CharT, _Traits, _Distance>& __y)
{
return !(__x == __y);
}
// 24.5.2
template <class _TypeT, class _CharT = char,
class _Traits = char_traits<_CharT> >
struct ostream_iterator: iterator<output_iterator_tag, void, void, void, void>
{
typedef _CharT char_type;
typedef _Traits traits_type;
typedef basic_ostream<char_type, traits_type> ostream_type;
// 24.5.2.1, p1, p2
ostream_iterator (ostream_type& __strm, const char_type* __s = 0)
: _C_strm (&__strm), _C_str (__s) { }
// 24.5.2.2, p1
ostream_iterator& operator= (const _TypeT &__val) {
*_C_strm << __val;
if (_C_str)
*_C_strm << _C_str;
return *this;
}
// 24.5.2.2, p2
ostream_iterator& operator* () {
return *this;
}
// 24.5.2.2, p3
ostream_iterator& operator++ () {
return *this;
}
ostream_iterator& operator++ (int) {
return *this;
}
private:
ostream_type *_C_strm; // associated stream
const char_type *_C_str; // string to separate values with
};
} // namespace std
#endif // _RWSTD_RW_STREAMITER_H_INCLUDED

View File

@@ -0,0 +1,29 @@
/***************************************************************************
*
* rw/_stringio.c
*
* $Id: _stringio.c 637130 2008-03-14 15:16:33Z faridz $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2008 Rogue Wave Software.
*
**************************************************************************/
#include <rw/_stringio.cc>

View File

@@ -0,0 +1,399 @@
/***************************************************************************
*
* _stringio.cc - definitions of the string extractors
*
* $Id: _stringio.cc 637130 2008-03-14 15:16:33Z faridz $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2008 Rogue Wave Software.
*
**************************************************************************/
_RWSTD_NAMESPACE (std) {
_EXPORT
template<class _CharT, class _Traits, class _Allocator>
basic_istream<_CharT, _Traits>&
operator>> (basic_istream<_CharT, _Traits>& __is,
basic_string<_CharT, _Traits, _Allocator>& __str)
{
_RWSTD_ASSERT (0 != __is.rdbuf ());
const _TYPENAME basic_istream<_CharT, _Traits>::sentry
__ipfx (__is /* , noskipws = false */);
ios_base::iostate __err = ios_base::goodbit;
typedef _RWSTD_SIZE_T _SizeT;
// count of characters read from stream
_SizeT __gcount = 0;
_TRY {
if (__ipfx) {
__str.clear ();
// maximum number of characters we can read
_RWSTD_SIZE_T __n =
__is.width () ? __is.width () : __str.max_size ();
basic_streambuf<_CharT, _Traits>* const __rdbuf = __is.rdbuf ();
const ctype<_CharT> &__ctp =
_USE_FACET (ctype<_CharT>, __is.getloc ());
#ifndef _RWSTD_NO_FRIEND_TEMPLATE
while (__n != 0) {
const _CharT* const __gptr = __rdbuf->gptr ();
const _CharT* const __egptr = __rdbuf->egptr ();
// maximum number of characters would want to extract
_SizeT __navail = __egptr - __gptr;
if (__n < __navail)
__navail = __n;
if (__navail) {
// find the delimeter in the squence if it exists, or
// get pointer to end of sequence
const _CharT* __pdel = __gptr;
for (/**/; __pdel != __egptr; ++__pdel) {
const _TYPENAME _Traits::int_type
__c = _Traits::to_int_type(*__pdel);
if (_Traits::eq_int_type (__c, _Traits::eof ())) {
__err = ios_base::eofbit;
break;
}
if (__ctp.is (__ctp.space, *__pdel))
break;
}
// __pdel is either pointing to a delimiter or one past
// the end of the input stream get area. if it is past
// the end, then set it to null.
if (__pdel == __egptr) {
__pdel = 0;
}
if (__pdel) {
__navail = __pdel - __gptr + 1;
__n -= __navail - 1;
}
else if (__n == __navail)
__n -= --__navail;
else
__n -= __navail;
// store characters excluding the delimiter
__str.append (__gptr, __navail - !!__pdel);
__gcount += __navail;
// advance gptr() by the number of extracted
// characters, including the delimiter
__rdbuf->gbump (__navail);
// we found a delimiter before the end of the get area,
// break out of outer loop
if (__pdel) {
break;
}
if (2 > __n && _SizeT (__egptr - __gptr) != __navail) {
__err = ios_base::failbit;
break;
}
}
else {
// n data in buffer, trigger underflow()
// note that streambuf may be unbuffered
const _TYPENAME _Traits::int_type
__c = __rdbuf->sgetc ();
if (_Traits::eq_int_type (__c, _Traits::eof ())) {
__err = ios_base::eofbit;
break;
}
// convert to char_type so that isspace works correctly
const _TYPENAME _Traits::char_type
__ch = _Traits::to_char_type (__c);
if (__ctp.is (__ctp.space, __ch))
break;
__str.push_back (__ch);
--__n;
__rdbuf->sbumpc ();
// increment gcount only _after_ sbumpc() but _before_
// the subsequent call to sgetc() to correctly reflect
// the number of extracted characters in the presence
// of exceptions thrown from streambuf virtuals
++__gcount;
}
}
#else // if defined (_RWSTD_NO_FRIEND_TEMPLATE)
for ( ; __n != 0; ) {
const _TYPENAME _Traits::int_type
__c (__rdbuf->sgetc ());
if (_Traits::eq_int_type (__c, _Traits::eof ())) {
__err = ios_base::eofbit;
break;
}
// convert to char_type so that isspace works correctly
const _TYPENAME _Traits::char_type
__ch = _Traits::to_char_type (__c);
if (__ctp.is (__ctp.space, __ch))
break;
__str.push_back (__ch);
--__n;
__rdbuf->sbumpc ();
// increment gcount only _after_ sbumpc() but _before_
// the subsequent call to sgetc() to correctly reflect
// the number of extracted characters in the presence
// of exceptions thrown from streambuf virtuals
++__gcount;
}
#endif // if defined (_RWSTD_NO_FRIEND_TEMPLATE)
__is.width (0);
}
}
_CATCH (...) {
__is.setstate (ios_base::badbit | _RW::__rw_rethrow);
}
if (!__gcount)
__err |= ios_base::failbit;
if (__err)
__is.setstate (__err);
return __is;
}
_EXPORT
template<class _CharT, class _Traits, class _Allocator>
basic_istream<_CharT, _Traits>&
getline (basic_istream<_CharT, _Traits>& __is,
basic_string<_CharT, _Traits, _Allocator>& __str,
_CharT __delim)
{
_RWSTD_ASSERT (0 != __is.rdbuf ());
const _TYPENAME basic_istream<_CharT, _Traits>::sentry
__ipfx (__is, true /* noskipws */);
#ifndef _RWSTD_NO_FRIEND_TEMPLATE
ios_base::iostate __err = ios_base::goodbit;
typedef _RWSTD_SIZE_T _SizeT;
_SizeT __gcount = 0;
if (__ipfx) {
__str.clear ();
// carefuly handle arithmetic overflow
_SizeT __n = __str.max_size ();
if (__n + _SizeT (1))
++__n;
basic_streambuf<_CharT, _Traits>* const __rdbuf = __is.rdbuf ();
_TRY {
for ( ; ; ) {
typedef _TYPENAME _Traits::int_type int_type;
const _CharT* const __gptr = __rdbuf->gptr ();
const _CharT* const __egptr = __rdbuf->egptr ();
// compute the lesser of the number of characters in the
// stream buffer and the size of the destination buffer
_SizeT __navail = __egptr - __gptr;
if (__n < __navail)
__navail = __n;
if (__navail) {
// find the delimiter in the sequence if it exists
const _CharT* const __pdel =
_Traits::find (__gptr, __navail, __delim);
if (__pdel) {
__navail = __pdel - __gptr + 1;
__n -= __navail - 1;
}
else if (__n == __navail)
__n -= --__navail;
else
__n -= __navail;
// store characters excluding the delimiter
__str.append (__gptr, __navail - !!__pdel);
__gcount += __navail;
// advance gptr() by the number of extracted
// characters, including the delimiter
__rdbuf->gbump (__navail);
if (__pdel) {
break;
}
if (2 > __n && _SizeT (__egptr - __gptr) != __navail) {
__err = ios_base::failbit;
break;
}
}
else {
// no data in buffer, trigger underflow()
// note that streambuf may be unbuffered
const int_type __c (__rdbuf->sgetc ());
if (_Traits::eq_int_type (__c, _Traits::eof ())) {
__err = ios_base::eofbit;
break;
}
const _CharT __ch = _Traits::to_char_type (__c);
if (_Traits::eq (__ch, __delim)) {
__rdbuf->sbumpc ();
__gcount++;
break;
}
if (2 > __n) {
__err = ios_base::failbit;
break;
}
__str += __ch;
--__n;
__rdbuf->sbumpc ();
// increment gcount only _after_ sbumpc() but _before_
// the subsequent call to sgetc() to correctly reflect
// the number of extracted characters in the presence
// of exceptions thrown from streambuf virtuals
++__gcount;
}
}
}
_CATCH (...) {
__is.setstate (ios_base::badbit | _RW::__rw_rethrow);
}
}
if (!__gcount)
__err |= ios_base::failbit;
#else // if defined (_RWSTD_NO_FRIEND_TEMPLATE)
ios_base::iostate __err = ios_base::failbit;
if (__ipfx) {
_TRY {
__str.clear ();
const _RWSTD_SIZE_T __max_size = __str.max_size ();
// FIXME: code commented out to work around an HP aCC 3.14.10
// bug #JAGac86264
// typedef _TYPENAME
// basic_string<_CharT, _Traits, _Allocator>::size_type
for ( ; ; ) {
const _TYPENAME _Traits::int_type
__c (__is.rdbuf ()->sgetc ());
if (_Traits::eq_int_type (__c, _Traits::eof ())) {
// 21.3.7.9, p7
if (__str.size ())
__err = ios_base::eofbit;
else
__err = ios_base::eofbit | ios_base::failbit;
break;
}
if (_Traits::eq (_Traits::to_char_type (__c), __delim)) {
__is.rdbuf ()->sbumpc ();
__err = ios_base::goodbit;
break;
}
if (__max_size <= __str.size ())
break;
__str.push_back (_Traits::to_char_type (__c));
__is.rdbuf ()->sbumpc ();
}
}
_CATCH (...) {
__is.setstate (ios_base::badbit | _RW::__rw_rethrow);
}
}
#endif // _RWSTD_NO_FRIEND_TEMPLATE
if (__err)
__is.setstate (__err);
return __is;
}
} // namespace std

View File

@@ -0,0 +1,149 @@
// -*- C++ -*-
/***************************************************************************
*
* _stringio.h - declarations of the string extractors
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _stringio.h 637130 2008-03-14 15:16:33Z faridz $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 2003-2006 Rogue Wave Software.
*
**************************************************************************/
#if __GNUG__ >= 3
# pragma GCC system_header
#endif // gcc >= 3
#ifndef _RWSTD_RW_STRINGIO_H_INCLUDED
#define _RWSTD_RW_STRINGIO_H_INCLUDED
_RWSTD_NAMESPACE (std) {
_EXPORT
template<class _CharT, class _Traits, class _Allocator>
basic_istream<_CharT, _Traits>&
operator>> (basic_istream<_CharT, _Traits>&,
basic_string<_CharT, _Traits, _Allocator>&);
_EXPORT
template<class _CharT, class _Traits, class _Allocator>
basic_istream<_CharT, _Traits>&
getline (basic_istream<_CharT, _Traits>&,
basic_string<_CharT, _Traits, _Allocator>&,
_CharT);
template<class _CharT, class _Traits, class _Allocator>
inline basic_istream<_CharT, _Traits>&
getline (basic_istream<_CharT, _Traits>& __is,
basic_string<_CharT, _Traits, _Allocator>& __str);
template<class _CharT, class _Traits, class _Allocator>
inline basic_ostream<_CharT, _Traits>&
operator<< (basic_ostream<_CharT, _Traits>&,
const basic_string<_CharT, _Traits, _Allocator>&);
} // namespace std
#endif // _RWSTD_RW_STRINGIO_H_INCLUDED
#if !defined (_RWSTD_STRING_INSERTER_INCLUDED) \
&& defined (_RWSTD_INCLUDE_STRING_INSERTER)
# define _RWSTD_STRING_INSERTER_INCLUDED
_RWSTD_NAMESPACE (std) {
template<class _CharT, class _Traits, class _Allocator>
inline basic_ostream<_CharT, _Traits>&
operator<< (basic_ostream<_CharT, _Traits>& __os,
const basic_string<_CharT, _Traits, _Allocator>& __str)
{
return _RW::__rw_insert (__os, __str.data (), __str.length (),
__os.width ());
}
} // namespace std
#endif // !_RWSTD_STRING_INSERTER_INCLUDED
#if !defined (_RWSTD_STRING_EXTRACTORS_INCLUDED) \
&& defined (_RWSTD_INCLUDE_STRING_EXTRACTORS)
# define _RWSTD_STRING_EXTRACTORS_INCLUDED
_RWSTD_NAMESPACE (std) {
template<class _CharT, class _Traits, class _Allocator>
inline basic_istream<_CharT, _Traits>&
getline (basic_istream<_CharT, _Traits>& __is,
basic_string<_CharT, _Traits, _Allocator>& __str)
{
return getline (__is, __str, __is.widen ('\n'));
}
} // namespace std
# if _RWSTD_DEFINE_TEMPLATE_FIRST (_BASIC_ISTREAM)
# include <rw/_stringio.cc>
# endif // _RWSTD_DEFINE_TEMPLATE_FIRST (_BASIC_ISTREAM)
_RWSTD_NAMESPACE (std) {
#if _RWSTD_INSTANTIATE (_BASIC_ISTREAM, _CHAR)
_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT istream&
operator>> (istream&, string&));
_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT istream&
getline (istream&, string&, char));
#endif // _RWSTD_INSTANTIATE (_BASIC_ISTREAM, _CHAR)
#if _RWSTD_INSTANTIATE (_BASIC_ISTREAM, _WCHAR_T)
_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT wistream&
operator>> (wistream&, wstring&));
_RWSTD_INSTANTIATE_FUN_1 (_RWSTD_TI_EXPORT wistream&
getline (wistream&, wstring&, wchar_t));
#endif // _RWSTD_INSTANTIATE (_BASIC_ISTREAM, _WCHAR_T)
} // namespace std
# if _RWSTD_DEFINE_TEMPLATE_LAST (_BASIC_ISTREAM)
# include <rw/_stringio.cc>
# endif // _RWSTD_DEFINE_TEMPLATE_LAST (_BASIC_ISTREAM)
#endif // !_RWSTD_STRING_EXTRACTORS_INCLUDED

273
extern/stdcxx/4.2.1/include/rw/_strref.h vendored Normal file
View File

@@ -0,0 +1,273 @@
/***************************************************************************
*
* _strref.h - Declarations for the Standard Library string_ref classes
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _strref.h 585996 2007-10-18 14:59:39Z sebor $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2007 Rogue Wave Software, Inc.
*
**************************************************************************/
#ifndef _RWSTD_RW_STRREF_H_INCLUDED
#define _RWSTD_RW_STRREF_H_INCLUDED
#ifndef _RWSTD_RW_ALLOCATOR_H_INCLUDED
# include <rw/_allocator.h>
#endif // _RWSTD_RW_ALLOCATOR_H_INCLUDED
#ifndef _RWSTD_RW_MUTEX_H_INCLUDED
# include <rw/_mutex.h>
#endif // _RWSTD_RW_MUTEX_H_INCLUDED
#ifndef _RWSTD_RW_SPECIALIZED_H_INCLUDED
# include <rw/_specialized.h>
#endif // _RWSTD_RW_SPECIALIZED_H_INCLUDED
#ifndef _RWSTD_RW_TRAITS_H_INCLUDED
# include <rw/_traits.h>
#endif // _RWSTD_RW_TRAITS_H_INCLUDED
#if !defined(_RWSTD_STRING_REF_OFFSET)
# define _RWSTD_STRING_REF_OFFSET 1
#endif
#if !defined(_RWSTD_STRING_REF_INT)
# define _RWSTD_STRING_REF_INT long
#endif
#if !defined (_RWSTD_NO_ATOMIC_OPS) && !defined (_RWSTD_NO_STRING_ATOMIC_OPS)
// disable string mutex when atomic operations are available
# ifndef _RWSTD_NO_STRING_MUTEX
# define _RWSTD_NO_STRING_MUTEX
# endif // _RWSTD_NO_STRING_MUTEX
#endif // _RWSTD_NO_ATOMIC_OPS && !_RWSTD_NO_STRING_ATOMIC_OPS
_RWSTD_NAMESPACE (std) {
// chooses either a single global mutex or a mutex per string object
// or no mutex at all when atomic test-and-set instruction is available
#if !defined (_RWSTD_REENTRANT) || defined (_RWSTD_NO_STRING_MUTEX)
# define _RWSTD_STRING_MUTEX(ignore) false
#elif defined (_RWSTD_ONE_STRING_MUTEX)
# define _RWSTD_STRING_MUTEX(ignore) __rw_string_mutex
#else
# define _RWSTD_STRING_MUTEX(pstr) pstr->_C_mutex
#endif
template <class _CharT,
class _Traits = char_traits<_CharT>,
class _Allocator = allocator<_CharT> >
class basic_string;
} // namespace std
_RWSTD_NAMESPACE (__rw) {
#if defined (_RWSTD_REENTRANT) \
&& defined (_RWSTD_ONE_STRING_MUTEX) \
&& !defined (_RWSTD_NO_STRING_MUTEX)
extern __rw_mutex _RWSTD_EXPORT __rw_string_mutex;
#endif // _REENTRANT && _ONE_STRING_MUTEX && !NO_STRING_MUTEX
template <class _CharT, class _Traits , class _Allocator>
struct __string_ref
{
typedef _CharT char_type;
typedef _Allocator allocator_type;
typedef _TYPENAME allocator_type::size_type size_type;
typedef _STD::basic_string<_CharT, _Traits, _Allocator> string_type;
#if defined (_RWSTD_REENTRANT) \
&& !defined (_RWSTD_ONE_STRING_MUTEX) \
&& !defined (_RWSTD_NO_STRING_MUTEX) \
&& !defined (_RWSTD_NO_STATIC_MUTEX_INIT)
void _C_init (size_type __cap, size_type __size) {
_C_cap = __cap;
_C_size._C_size = __size;
# ifndef _RWSTD_NO_STRING_REF_COUNT
_C_refs = 1 - _RWSTD_STRING_REF_OFFSET;
if (0 != _RWSTD_MUTEX_INIT (this->_C_mutex._C_mutex))
_RW::__rw_throw (_RWSTD_ERROR_RUNTIME_ERROR,
"synchronization error");
# endif // _RWSTD_NO_STRING_REF_COUNT
}
void _C_destroy () {
# ifndef _RWSTD_NO_STRING_REF_COUNT
_RWSTD_MUTEX_DESTROY (this->_C_mutex._C_mutex);
# endif
}
#else
void _C_init (size_type __cap, size_type __size) {
# ifndef _RWSTD_NO_STRING_REF_COUNT
_C_refs = 1 - _RWSTD_STRING_REF_OFFSET;
# endif // _RWSTD_NO_STRING_REF_COUNT
_C_cap = __cap;
_C_size._C_size = __size;
}
void _C_destroy () { }
#endif // _RWSTD_REENTRANT && !_RWSTD_ONE_STRING_MUTEX &&
// !_RWSTD_NO_STRING_MUTEX && !_RWSTD_NO_STATIC_MUTEX_INIT
int _C_get_ref () const {
# ifndef _RWSTD_NO_STRING_REF_COUNT
return _C_refs + _RWSTD_STRING_REF_OFFSET;
#else // if defined (_RWSTD_NO_STRING_REF_COUNT)
return 0;
#endif // _RWSTD_NO_STRING_REF_COUNT
}
void _C_unref () {
#ifndef _RWSTD_NO_STRING_REF_COUNT
// not thread-safe (see caller)
if (this != string_type::_C_nullref ())
_C_refs = -_RWSTD_STRING_REF_OFFSET;
#endif // _RWSTD_NO_STRING_REF_COUNT
}
int _C_inc_ref () {
#ifndef _RWSTD_NO_STRING_REF_COUNT
return this == string_type::_C_nullref () ? 1 :
_RWSTD_STRING_ATOMIC_PREINCREMENT (_C_refs,
_RWSTD_STRING_MUTEX (this));
#else // if defined (_RWSTD_NO_STRING_REF_COUNT)
return 0 + (this != string_type::_C_nullref ());
#endif // _RWSTD_NO_STRING_REF_COUNT
}
int _C_dec_ref () {
#ifndef _RWSTD_NO_STRING_REF_COUNT
return this == string_type::_C_nullref () ? 1 :
_RWSTD_STRING_REF_OFFSET
+ _RWSTD_STRING_ATOMIC_PREDECREMENT (_C_refs,
_RWSTD_STRING_MUTEX (this));
#else // if defined (_RWSTD_NO_STRING_REF_COUNT)
return 0 + (this == string_type::_C_nullref ());
#endif // _RWSTD_NO_STRING_REF_COUNT
}
size_type size () const {
return _C_size._C_size;
}
size_type capacity () const {
return _C_cap;
}
char_type* data () {
return _RWSTD_REINTERPRET_CAST (char_type*, this + 1);
}
const char_type* data () const {
return _RWSTD_REINTERPRET_CAST (const char_type*, this + 1);
}
#ifndef _RWSTD_NO_STRING_REF_COUNT
# if defined (_RWSTD_REENTRANT) \
&& !defined (_RWSTD_ONE_STRING_MUTEX) \
&& !defined (_RWSTD_NO_STRING_MUTEX)
__rw_mutex_base _C_mutex;
# endif // _REENTRANT && !_ONE_STRING_MUTEX && !_NO_STRING_MUTEX
// reference count:
// 1 less than the number of references to the string body
// _RWSTD_STRING_REF_OFFSET less if _RWSTD_NO_STRING_MUTEX is defined
// -1 if reference counting is disabled
int _C_refs;
#endif // _RWSTD_NO_STRING_REF_COUNT
size_type _C_cap; // Size of allocated memory
union {
size_type _C_size; // Number of actual data values stored
_CharT _C_dummy; // force the alignment of the first char
} _C_size; // named to work around an HP aCC 3.30 bug
};
// representation of the null string; will be a POD wherever possible
// (will not be POD if the reference contains a mutex with a UD-ctor)
template <class _CharT, class _Traits , class _Allocator>
struct __null_ref
: __string_ref<_CharT, _Traits , _Allocator>
{
// string reference immediately followed by a single terminating null
_CharT _C_eos;
};
#ifdef _RWSTD_NO_COLLAPSE_TEMPLATE_STATICS
extern _RWSTD_EXPORT unsigned long __nullref [];
#endif // _RWSTD_NO_COLLAPSE_TEMPLATE_STATICS
} // namespace __rw
#endif // _RWSTD_RW_STRREF_H_INCLUDED

561
extern/stdcxx/4.2.1/include/rw/_traits.h vendored Normal file
View File

@@ -0,0 +1,561 @@
/***************************************************************************
*
* _traits.h - definition of the char_traits class template
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _traits.h 648752 2008-04-16 17:01:56Z faridz $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2008 Rogue Wave Software, Inc.
*
**************************************************************************/
#ifndef _RWSTD_RW_TRAITS_H_INCLUDED
#define _RWSTD_RW_TRAITS_H_INCLUDED
#ifndef _RWSTD_RW_IOSFWD_H_INCLUDED
# include <rw/_iosfwd.h>
#endif // _RWSTD_RW_IOSFWD_H_INCLUDED
#ifndef _RWSTD_RW_MBSTATE_H_INCLUDED
# include <rw/_mbstate.h> // for _RWSTD_MBSTATE_T
#endif // _RWSTD_RW_MBSTATE_H_INCLUDED
#if defined (_RWSTDDEBUG) || defined (_RWSTD_EDG_ECCP)
// avoid including <cstring> and <cwchar> in debug mode or when using
// the vanilla EDG eccp (i.e., in strict conformance mode) to prevent
// namespace pollutiuon
_RWSTD_NAMESPACE (__rw) {
_RWSTD_EXPORT void* __rw_memcpy (void*, const void*, _RWSTD_SIZE_T);
_RWSTD_EXPORT void* __rw_memmove (void*, const void*, _RWSTD_SIZE_T);
_RWSTD_EXPORT const void* __rw_memchr (const void*, int, _RWSTD_SIZE_T);
_RWSTD_EXPORT void* __rw_memset (void*, int, _RWSTD_SIZE_T);
_RWSTD_EXPORT int __rw_memcmp (const void*, const void*, _RWSTD_SIZE_T);
_RWSTD_EXPORT _RWSTD_SIZE_T __rw_strlen (const char*);
# ifndef _RWSTD_NO_WCHAR_T
_RWSTD_EXPORT wchar_t* __rw_wmemcpy (wchar_t*, const wchar_t*, _RWSTD_SIZE_T);
_RWSTD_EXPORT wchar_t* __rw_wmemmove (wchar_t*, const wchar_t*, _RWSTD_SIZE_T);
_RWSTD_EXPORT const wchar_t*
__rw_wmemchr (const wchar_t*, wchar_t, _RWSTD_SIZE_T);
_RWSTD_EXPORT wchar_t* __rw_wmemset (wchar_t*, wchar_t, _RWSTD_SIZE_T);
_RWSTD_EXPORT int __rw_wmemcmp (const wchar_t*, const wchar_t*, _RWSTD_SIZE_T);
_RWSTD_EXPORT _RWSTD_SIZE_T __rw_wcslen (const wchar_t*);
# endif // _RWSTD_NO_WCHAR_T
} // namespace __rw
# define _RWSTD_MEMCPY _RW::__rw_memcpy
# define _RWSTD_MEMCMP _RW::__rw_memcmp
# define _RWSTD_MEMCHR _RW::__rw_memchr
# define _RWSTD_MEMMOVE _RW::__rw_memmove
# define _RWSTD_MEMSET _RW::__rw_memset
# define _RWSTD_STRLEN _RW::__rw_strlen
# define _RWSTD_WMEMCPY _RW::__rw_wmemcpy
# define _RWSTD_WMEMCMP _RW::__rw_wmemcmp
# define _RWSTD_WMEMCHR _RW::__rw_wmemchr
# define _RWSTD_WMEMMOVE _RW::__rw_wmemmove
# define _RWSTD_WMEMSET _RW::__rw_wmemset
# define _RWSTD_WCSLEN _RW::__rw_wcslen
#else // if !defined (_RWSTDDEBUG) && !defined (_RWSTD_EDG_ECCP)
# if 4 <= __GNUG__ && !defined (__INTEL_COMPILER)
// use gcc 4.x intrinsic functions
# define _RWSTD_MEMCPY __builtin_memcpy
# define _RWSTD_MEMCMP __builtin_memcmp
# define _RWSTD_MEMMOVE __builtin_memmove
# define _RWSTD_MEMSET __builtin_memset
# define _RWSTD_STRLEN __builtin_strlen
# if 4 < __GNUG__ || 3 <= __GNUC_MINOR__
// __builtin_memchr() is only available in gcc 4.3 and beyond
# define _RWSTD_MEMCHR __builtin_memchr
# else // gcc < 4.3
# include _RWSTD_CSTRING // for memchr()
# define _RWSTD_MEMCHR _RWSTD_C::memchr
# endif // gcc 4.3
# else // gcc < 4.0
# include _RWSTD_CSTRING // for memcmp(), ...
# define _RWSTD_MEMCPY _RWSTD_C::memcpy
# define _RWSTD_MEMCMP _RWSTD_C::memcmp
# define _RWSTD_MEMMOVE _RWSTD_C::memmove
# define _RWSTD_MEMSET _RWSTD_C::memset
# define _RWSTD_STRLEN _RWSTD_C::strlen
# define _RWSTD_MEMCHR _RWSTD_C::memchr
# endif // gcc 4.0
# include _RWSTD_CWCHAR // wmemcmp(), ...
# ifndef _RWSTD_NO_WMEMCPY
# define _RWSTD_WMEMCPY _RWSTD_C::wmemcpy
# elif !defined (_RWSTD_NO_WCHAR_T)
_RWSTD_NAMESPACE (__rw) {
_RWSTD_EXPORT wchar_t*
__rw_wmemcpy (wchar_t*, const wchar_t*, _RWSTD_SIZE_T);
} // namespace __rw
# define _RWSTD_WMEMCPY _RW::__rw_wmemcpy
# endif // _RWSTD_NO_WMEMCPY
# ifndef _RWSTD_NO_WMEMCMP
# define _RWSTD_WMEMCMP wmemcmp
# elif !defined (_RWSTD_NO_WCHAR_T)
_RWSTD_NAMESPACE (__rw) {
_RWSTD_EXPORT int
__rw_wmemcmp (const wchar_t*, const wchar_t*, _RWSTD_SIZE_T);
} // namespace __rw
# define _RWSTD_WMEMCMP _RW::__rw_wmemcmp
# endif // _RWSTD_NO_WMEMCMP
# ifndef _RWSTD_NO_WMEMMOVE
# define _RWSTD_WMEMMOVE _RWSTD_C::wmemmove
# elif !defined (_RWSTD_NO_WCHAR_T)
_RWSTD_NAMESPACE (__rw) {
_RWSTD_EXPORT wchar_t*
__rw_wmemmove (wchar_t*, const wchar_t*, _RWSTD_SIZE_T);
} // namespace __rw
# define _RWSTD_WMEMMOVE _RW::__rw_wmemmove
# endif // _RWSTD_NO_WMEMMOVE
# ifndef _RWSTD_NO_WMEMSET
# define _RWSTD_WMEMSET _RWSTD_C::wmemset
# elif !defined (_RWSTD_NO_WCHAR_T)
_RWSTD_NAMESPACE (__rw) {
_RWSTD_EXPORT wchar_t*
__rw_wmemset (wchar_t*, wchar_t, _RWSTD_SIZE_T);
} // namespace __rw
# define _RWSTD_WMEMSET _RW::__rw_wmemset
# endif // _RWSTD_NO_WMEMSET
# ifndef _RWSTD_NO_WCSLEN
# define _RWSTD_WCSLEN _RWSTD_C::wcslen
# elif !defined (_RWSTD_NO_WCHAR_T)
_RWSTD_NAMESPACE (__rw) {
_RWSTD_EXPORT _RWSTD_SIZE_T
__rw_wcslen (const wchar_t*);
} // namespace __rw
# define _RWSTD_WCSLEN _RW::__rw_wcslen
# endif // _RWSTD_NO_WCSLEN
# ifndef _RWSTD_NO_WMEMCHR
# define _RWSTD_WMEMCHR _RWSTD_C::wmemchr
# elif !defined (_RWSTD_NO_WCHAR_T)
_RWSTD_NAMESPACE (__rw) {
_RWSTD_EXPORT const wchar_t*
__rw_wmemchr (const wchar_t*, wchar_t, _RWSTD_SIZE_T);
} // namespace __rw
# define _RWSTD_WMEMCHR _RW::__rw_wmemchr
# endif // _RWSTD_NO_WMEMCHR
#endif // !_RWSTDDEBUG && !(vanilla EDG eccp demo)
_RWSTD_NAMESPACE (std) {
// 27.4.1, p2
// the C++ type ptrdiff_t is the same as the POSIX ssize_t suggested
// to be used here in 27.4.2, Footnote 266, except for Win64 where
// the former is 64 bits while the latter is only 32 bits wide
typedef _RWSTD_PTRDIFF_T streamsize;
// 27.4.3
template <class _StateT>
class fpos
{
public:
typedef _StateT state_type;
#ifndef _RWSTD_NO_POD_ZERO_INIT
fpos (_RWSTD_STREAMOFF __off = 0,
const state_type &__state = state_type ())
: _C_pos (__off),
_C_state (__state)
{ }
#else // if defined (_RWSTD_NO_POD_ZERO_INIT)
fpos (_RWSTD_STREAMOFF __off = 0)
: _C_pos (__off) {
_RWSTD_MEMSET (&_C_state, 0, sizeof _C_state);
}
fpos (_RWSTD_STREAMOFF __off, const state_type &__state)
: _C_pos (__off),
_C_state (__state)
{ }
#endif // _RWSTD_NO_POD_ZERO_INIT
operator _RWSTD_STREAMOFF () const {
return _C_pos;
}
// 27.4.3.1, p1
void state (state_type __state) {
_C_state = __state;
}
// 27.4.3.1, p2
state_type state () const {
return _C_state;
}
// 27.4.3.2, p1: Table 88
fpos& operator-= (_RWSTD_STREAMOFF __off) {
return _C_pos -= __off, *this;
}
fpos& operator+= (_RWSTD_STREAMOFF __off) {
return _C_pos += __off, *this;
}
fpos operator- (_RWSTD_STREAMOFF __off) const {
return fpos (*this) -= __off;
}
fpos operator+ (_RWSTD_STREAMOFF __off) const {
return fpos (*this) += __off;
}
// equality and relational operators provided
// via the conversion operator to streamoff
private:
_RWSTD_STREAMOFF _C_pos; // signed displacement
state_type _C_state; // conversion state
};
template <class _CharT>
struct char_traits;
#ifndef _RWSTD_NO_EXT_CHAR_TRAITS_PRIMARY
template <class _CharT>
struct char_traits
{
typedef _CharT char_type;
typedef int int_type;
typedef _RWSTD_STREAMOFF off_type;
typedef _RWSTD_MBSTATE_T state_type;
typedef fpos<state_type> pos_type;
static int_type eof () {
return -1;
}
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 lt (const char_type& __c1, const char_type& __c2) {
return __c1 < __c2;
}
static int
compare (const char_type* __s1, const char_type* __s2, _RWSTD_SIZE_T __n) {
for (_RWSTD_SIZE_T __i = 0; __i != __n; ++__i) {
if (!eq (__s1[__i], __s2[__i])) {
return lt (__s1[__i], __s2[__i]) ? -1 : 1;
}
}
return 0;
}
static _RWSTD_SIZE_T length (const char_type *__s) {
_RWSTD_SIZE_T __len = 0;
while (!eq (*__s++, char_type ()))
++__len;
return __len;
}
static const char_type*
find (const char_type* __s, _RWSTD_SIZE_T __n, const char_type& __c) {
while (__n-- > 0 && !eq (*__s, __c) )
++__s;
return eq (*__s, __c) ? __s : 0;
}
static char_type*
move (char_type* __s1, const char_type* __s2, _RWSTD_SIZE_T __n) {
_RWSTD_MEMMOVE (__s1, __s2, __n * sizeof (char_type));
return __s1;
}
static char_type*
copy (char_type *__dst, const char_type *__src, _RWSTD_SIZE_T __n) {
_RWSTD_MEMCPY (_RWSTD_STATIC_CAST (void*, __dst),
_RWSTD_STATIC_CAST (const void*, __src),
__n * sizeof (char_type));
return __dst;
}
static char_type*
assign (char_type* __s, _RWSTD_SIZE_T __n, char_type __c) {
char_type* __tmp = __s;
while (__n-- > 0)
assign (*__tmp++, __c);
return __s;
}
static bool eq_int_type (const int_type& __c1, const int_type& __c2) {
return __c1 == __c2;
}
static int_type not_eof (const int_type& __c) {
return eq_int_type (eof (), __c) ? 0 : __c;
}
static char_type to_char_type (const int_type& __c) {
// cast to prevent warnings for unusual types
return _RWSTD_STATIC_CAST (char_type, __c);
}
static int_type to_int_type (const char_type& __c) {
// cast to prevent warnings for unusual types
return _RWSTD_STATIC_CAST (int_type, __c);
}
};
#endif // _RWSTD_NO_EXT_CHAR_TRAITS_PRIMARY
// 21.1.3.1
_RWSTD_SPECIALIZED_CLASS
struct char_traits<char>
{
typedef char char_type;
typedef _RWSTD_INT_T int_type;
typedef _RWSTD_STREAMOFF off_type;
typedef _RWSTD_MBSTATE_T state_type;
typedef fpos<state_type> pos_type;
static int_type eof () {
return int_type (_RWSTD_EOF);
}
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 lt (const char_type& __c1, const char_type& __c2) {
// lwg issue 467: cast arguments to unsigned char
// to get the same result as memcmp(&c1, &c2) < 0
return _RWSTD_STATIC_CAST (unsigned char, __c1)
< _RWSTD_STATIC_CAST (unsigned char, __c2);
}
static int
compare (const char_type* __s1, const char_type* __s2, _RWSTD_SIZE_T __n) {
return _RWSTD_MEMCMP (__s1, __s2, __n);
}
static const char_type*
find (const char_type* __s, _RWSTD_SIZE_T __n, const char_type& __c) {
// cast to const void* used to get around a gcc 2.95 bug
// that prevents a static_cast from void* --> const T*
// (only occurs if memchr() isn't overloaded on const)
return _RWSTD_STATIC_CAST (
const char_type*, (const void*)_RWSTD_MEMCHR (
__s, _RWSTD_STATIC_CAST (unsigned char, __c), __n));
}
static _RWSTD_SIZE_T length (const char_type *__s) {
return _RWSTD_STRLEN (__s);
}
static char_type*
move (char_type* __s1, const char_type* __s2, _RWSTD_SIZE_T __n) {
_RWSTD_MEMMOVE (__s1, __s2, __n);
return __s1;
}
static char_type*
copy (char_type *__dst, const char_type *__src, _RWSTD_SIZE_T __n) {
_RWSTD_MEMCPY (__dst, __src, __n);
return __dst;
}
static char_type*
assign (char_type* __s, _RWSTD_SIZE_T __n, char_type __c) {
_RWSTD_MEMSET (__s, __c, __n);
return __s;
}
static bool eq_int_type (const int_type& __c1, const int_type& __c2) {
return __c1 == __c2;
}
static int_type not_eof (const int_type& __c) {
return eq_int_type (eof (), __c) ? 0 : __c;
}
static char_type to_char_type (const int_type& __c) {
return _RWSTD_STATIC_CAST (char_type, __c);
}
static int_type to_int_type (const char_type& __c) {
// make sure (signed char)'\xff' converts to 255 and not -1
return _RWSTD_STATIC_CAST (unsigned char, __c);
}
};
#ifndef _RWSTD_NO_WCHAR_T
// 21.1.3.2
_RWSTD_SPECIALIZED_CLASS
struct char_traits<wchar_t>
{
typedef wchar_t char_type;
typedef _RWSTD_WINT_T int_type;
typedef _RWSTD_STREAMOFF off_type;
typedef _RWSTD_MBSTATE_T state_type;
typedef fpos<state_type> pos_type;
static int_type eof () {
return int_type (_RWSTD_WEOF);
}
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 lt (const char_type& __c1, const char_type& __c2) {
return __c1 < __c2;
}
static int
compare (const char_type* __s1, const char_type* __s2, _RWSTD_SIZE_T __n) {
return _RWSTD_WMEMCMP (__s1, __s2, __n);
}
static _RWSTD_SIZE_T length (const char_type *__s) {
// [harmless] cast necessary on CygWin
return _RWSTD_WCSLEN (_RWSTD_CONST_CAST (char_type*, __s));
}
static const char_type*
find (const char_type* __s, _RWSTD_SIZE_T __n, const char_type& __c) {
// const cast in case of a const-incorrect wmemchr()
return _RWSTD_STATIC_CAST (const char_type*,
_RWSTD_WMEMCHR (_RWSTD_CONST_CAST (char_type*, __s),
__c, __n));
}
static char_type*
copy (char_type *__dst, const char_type *__src, _RWSTD_SIZE_T __n) {
_RWSTD_WMEMCPY (__dst, __src, __n);
return __dst;
}
static char_type*
move (char_type* __s1, const char_type* __s2, _RWSTD_SIZE_T __n) {
_RWSTD_WMEMMOVE (__s1, __s2, __n);
return __s1;
}
static char_type*
assign (char_type* __s, _RWSTD_SIZE_T __n, char_type __c) {
_RWSTD_WMEMSET (__s, __c, __n);
return __s;
}
static bool eq_int_type (const int_type& __c1, const int_type& __c2) {
return __c1 == __c2;
}
static int_type not_eof (const int_type& __c) {
return eq_int_type (eof (), __c) ? 0 : __c;
}
static char_type to_char_type (const int_type& __c) {
return __c;
}
static int_type to_int_type (const char_type& __c) {
return __c;
}
};
#endif // _RWSTD_NO_WCHAR_T
} // namespace std
#endif // _RWSTD_RW_TRAITS_H_INCLUDED

29
extern/stdcxx/4.2.1/include/rw/_tree.c vendored Normal file
View File

@@ -0,0 +1,29 @@
/***************************************************************************
*
* rw/_tree.c
*
* $Id: _tree.c 580483 2007-09-28 20:55:52Z sebor $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
**************************************************************************/
#include <rw/_tree.cc>

989
extern/stdcxx/4.2.1/include/rw/_tree.cc vendored Normal file
View File

@@ -0,0 +1,989 @@
/***************************************************************************
*
* _tree.cc - Non-inline tree definitions for the Standard Library
*
* $Id: _tree.cc 648752 2008-04-16 17:01:56Z faridz $
*
***************************************************************************
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* 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. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
**************************************************************************/
_RWSTD_NAMESPACE (__rw) {
template <class _Key, class _Val, class _KeyOf, class _Comp, class _Alloc>
__rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::
__rb_tree (const key_compare &__cmp /* = key_compare () */,
const allocator_type &__alloc /* = allocator_type () */)
: allocator_type (__alloc),
_C_buf_list (0),
_C_end (0),
_C_size (0),
_C_cmp (__cmp)
{
_C_init ();
}
template <class _Key, class _Val, class _KeyOf, class _Comp, class _Alloc>
__rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>&
__rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::
operator= (const __rb_tree &__x)
{
if (this != &__x) {
erase (begin (), end ());
// set the root of the tree
_C_end->_C_parent = _C_copy (__x._C_end->_C_parent, _C_end);
if (_C_link_t () == _C_end->_C_parent) {
// set the child pointers of an empty tree to point to the header
_C_end->_C_child [0] =
_C_end->_C_child [1] = _C_end;
}
else {
// set the leftmost and the rightmost nodes
_C_end->_C_child [0] = _C_node_t::_C_min (_C_end->_C_parent);
_C_end->_C_child [1] = _C_node_t::_C_max (_C_end->_C_parent);
}
_C_size = __x._C_size;
_C_cmp = __x._C_cmp;
}
return *this;
}
template <class _Key, class _Val, class _KeyOf, class _Comp, class _Alloc>
__rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::
__rb_tree (const __rb_tree &__lnk)
: allocator_type (__lnk.get_allocator ()), _C_buf_list (0), _C_end (0),
_C_size (__lnk._C_size),
_C_cmp (__lnk._C_cmp)
{
_C_free_list = _C_next_avail = _C_last = 0;
_C_end = _C_get_node ();
_C_end->_C_color = _C_node_t::_C_red;
_TRY {
_C_end->_C_parent = _C_copy (__lnk._C_end->_C_parent, _C_end);
}
_CATCH (...) {
_C_deallocate_buffers ();
_RETHROW;
}
if (_C_link_t () == _C_end->_C_parent) {
_C_end->_C_child [0] =
_C_end->_C_child [1] = _C_end;
}
else {
_C_end->_C_child [0] = _C_node_t::_C_min (_C_end->_C_parent);
_C_end->_C_child [1] = _C_node_t::_C_max (_C_end->_C_parent);
}
}
template <class _Key, class _Val, class _KeyOf, class _Comp, class _Alloc>
__rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::
~__rb_tree ()
{
if (_C_link_t () != _C_end) {
erase (begin (), end ());
_C_put_node (_C_end, false);
_C_deallocate_buffers ();
}
}
template <class _Key, class _Val, class _KeyOf, class _Comp, class _Alloc>
void __rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::
_C_add_new_buffer ()
{
const size_type __bufsize =
_C_buf_ptr_t () == _C_buf_list ? 0 : _C_buf_list->size;
size_type __newsize = _RWSTD_NEW_CAPACITY (__rb_tree, this, __bufsize);
if (__newsize <= __bufsize)
__newsize = __bufsize + 1;
_C_buf_ptr_t __buf =
_C_buf_alloc_t (*this).allocate (size_type (1), (void*)_C_buf_list);
_TRY {
__buf->_C_buffer =
_C_node_alloc_t (*this).allocate (__newsize, (void*)_C_last);
}
_CATCH (...) {
_C_buf_alloc_t (*this).deallocate (__buf, 1);
_RETHROW;
}
__buf->_C_next_buffer = _C_buf_list;
__buf->size = __newsize;
_C_buf_list = __buf;
_C_next_avail = _C_buf_list->_C_buffer;
_C_last = _C_next_avail + __newsize;
}
template <class _Key, class _Val, class _KeyOf, class _Comp, class _Alloc>
void __rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::
_C_deallocate_buffers ()
{
while ((void*)_C_buf_list) {
_C_buf_ptr_t __tmp = _C_buf_list;
_C_buf_list = (_C_buf_ptr_t)(_C_buf_list->_C_next_buffer);
_C_node_alloc_t(*this).deallocate(__tmp->_C_buffer,__tmp->size);
_C_buf_alloc_t(*this).deallocate(__tmp,1);
}
}
template <class _Key, class _Val, class _KeyOf, class _Comp, class _Alloc>
_TYPENAME __rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::iterator
__rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::
_C_insert (_C_link_t __x, _C_link_t __y, const value_type &__v)
{
_C_link_t __z = _C_get_node (__v);
++_C_size;
// for notational convenience
const _TYPENAME _C_node_t::_C_color_t _Red = _C_node_t::_C_red;
const _TYPENAME _C_node_t::_C_color_t _Black = _C_node_t::_C_black;
const _C_link_t _Null = _C_link_t ();
if ( __y == _C_end || _Null != __x
|| _C_cmp (_KeyOf()(__v), __y->_C_key ())) {
__y->_C_child [0] = __z;
if (__y == _C_end) {
// set the root node and the rightmost node
_C_end->_C_parent = __z;
_C_end->_C_child [1] = __z;
}
else if (__y == _C_end->_C_child [0]) {
// set the leftmost node
_C_end->_C_child [0] = __z;
}
}
else {
__y->_C_child [1] = __z;
if (__y == _C_end->_C_child [1]) {
// set the rightmost node
_C_end->_C_child [1] = __z;
}
}
__z->_C_parent = __y;
__x = __z; // recolor and rebalance the tree
while ( __x != _C_end->_C_parent
&& __x->_C_parent->_C_color == _Red) {
#ifndef _RWSTD_NO_OPTIMIZE_SPEED
if (__x->_C_parent == __x->_C_parent->_C_parent->_C_child [0]) {
__y = __x->_C_parent->_C_parent->_C_child [1];
if (_Null != __y && __y->_C_color == _Red) {
__x->_C_parent->_C_color = _Black;
__y->_C_color = _Black;
__x->_C_parent->_C_parent->_C_color = _Red;
__x = __x->_C_parent->_C_parent;
}
else {
if (__x == __x->_C_parent->_C_child [1]) {
__x = __x->_C_parent;
_C_rol (__x);
}
__x->_C_parent->_C_color = _Black;
__x->_C_parent->_C_parent->_C_color = _Red;
_C_ror (__x->_C_parent->_C_parent);
}
}
else {
__y = __x->_C_parent->_C_parent->_C_child [0];
if (_Null != __y && __y->_C_color == _Red) {
__x->_C_parent->_C_color = _Black;
__y->_C_color = _Black;
__x->_C_parent->_C_parent->_C_color = _Red;
__x = __x->_C_parent->_C_parent;
}
else {
if (__x == __x->_C_parent->_C_child [0]) {
__x = __x->_C_parent;
_C_ror (__x);
}
__x->_C_parent->_C_color = _Black;
__x->_C_parent->_C_parent->_C_color = _Red;
_C_rol (__x->_C_parent->_C_parent);
}
}
#else // if defined (_RWSTD_NO_OPTIMIZE_SPEED)
const bool __left =
__x->_C_parent == __x->_C_parent->_C_parent->_C_child [0];
const bool __right = !__left;
__y = __x->_C_parent->_C_parent->_C_child [__left];
if (_Null != __y && _Red == __y->_C_color) {
__y->_C_color =
__x->_C_parent->_C_color = _Black;
__x->_C_parent->_C_parent->_C_color = _Red;
__x = __x->_C_parent->_C_parent;
}
else {
if (__x == __x->_C_parent->_C_child [__left]) {
__x = __x->_C_parent;
_C_rotate (__x, __right);
}
__x->_C_parent->_C_color = _Black;
__x->_C_parent->_C_parent->_C_color = _Red;
_C_rotate (__x->_C_parent->_C_parent, __left);
}
#endif // _RWSTD_NO_OPTIMIZE_SPEED
}
// set the color of the root node
_C_end->_C_parent->_C_color = _Black;
return _C_make_iter (__z);
}
template <class _Key, class _Val, class _KeyOf, class _Comp, class _Alloc>
void __rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::
_C_insert (const value_type &__v, _STD::pair<iterator, bool> &__ret,
bool __dup)
{
_C_link_t __y = _C_end; // end
_C_link_t __x = _C_end->_C_parent; // root node
bool __right = true;
while (_C_link_t () != __x) {
__y = __x;
__right = _C_cmp (_KeyOf ()(__v), __x->_C_key ());
__x = __x->_C_child [!__right];
}
typedef _STD::pair<iterator, bool> _IterPair;
if (__dup) {
// allow insertion of duplicate keys
__ret = _IterPair (_C_insert (__x, __y, __v), true);
return;
}
iterator __j = _C_make_iter (__y);
if (__right) {
if (__j == begin ()) {
__ret = _IterPair (_C_insert (__x, __y, __v), true);
return;
}
--__j;
}
if (_C_cmp (_ITER_NODE (__j)->_C_key (), _KeyOf ()(__v)))
__ret = _IterPair (_C_insert (__x, __y, __v), true);
else
__ret = _IterPair (__j, false);
}
template <class _Key, class _Val, class _KeyOf, class _Comp, class _Alloc>
_TYPENAME __rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::iterator
__rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::
insert (iterator __it, const value_type &__v, bool __dup)
{
_RWSTD_ASSERT_RANGE (begin (), __it);
#ifdef _RWSTDDEBUG
{ // verify the consistency of the tree
size_type __two_logN = 0;
for (size_type __i = size () + 1; __i >>= 1; ++__two_logN);
__two_logN *= 2;
const size_type __depth = _C_depth ();
_RWSTD_ASSERT (__depth <= __two_logN);
}
#endif // _RWSTDDEBUG
const _C_link_t __hint = _ITER_NODE (__it);
// if __hint is the right most child, or tree is empty
if (__hint == _C_end->_C_child [1]) {
// if tree is not empty and __key is greater
// then insert on the right
if (_C_size && _C_cmp (__hint->_C_key (), _KeyOf ()(__v)))
return _C_insert (0, __hint, __v);
// otherwise just insert
return insert (__v, __dup).first;
}
// if __hint is past the end and __key is greater,
// then insert on the right
if (__hint == _C_end) {
if (_C_cmp (__hint->_C_child [1]->_C_key(), _KeyOf ()(__v)))
return _C_insert (0, __hint->_C_child [1], __v);
return insert (__v, __dup).first;
}
// if __hint is the left most child and __key is less
// then insert on the left
if (__hint == _C_end->_C_child [0]) {
if (_C_cmp (_KeyOf ()(__v), __hint->_C_key ()))
return _C_insert (__hint, __hint, __v);
return insert (__v, __dup).first;
}
const iterator __prev = __it++;
// if __v falls between __prev and __it, then insert it there
if ( _C_cmp (_ITER_NODE (__prev)->_C_key (), _KeyOf ()(__v))
&& _C_cmp (_KeyOf ()(__v), _ITER_NODE (__it)->_C_key ())) {
// if there is no right child of __prev, then __prev is the
// left child of __it and we insert to right of __prev
if (_C_link_t () == _ITER_NODE (__prev)->_C_child [1])
return _C_insert (0, _ITER_NODE (__prev), __v);
// otherwise we insert on the left of __it
return _C_insert (_ITER_NODE (__it), _ITER_NODE (__it), __v);
}
// otherwise, do a full traversal
return insert (__v, __dup).first;
}
template <class _Key, class _Val, class _KeyOf, class _Comp, class _Alloc>
_TYPENAME __rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::iterator
__rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::erase (iterator __it)
{
_RWSTD_ASSERT_RANGE (begin (), __it);
#ifdef _RWSTDDEBUG
{ // verify the consistency of the tree
size_type __two_logN = 0;
for (size_type __i = size () + 1; __i >>= 1; ++__two_logN);
__two_logN *= 2;
const size_type __depth = _C_depth ();
_RWSTD_ASSERT (__depth <= __two_logN);
}
#endif // _RWSTDDEBUG
if (__it == end ())
return end ();
// for notational convenience
const _TYPENAME _C_node_t::_C_color_t _Red = _C_node_t::_C_red;
const _TYPENAME _C_node_t::_C_color_t _Black = _C_node_t::_C_black;
const _C_link_t _Null = _C_link_t ();
// returned iterator pointing to the element just past `it'
const iterator __next = ++iterator (__it);
_C_link_t __z (_ITER_NODE (__it)); // `it's node
_C_link_t __y (__z); // node to be erased
_C_link_t __x;
_C_link_t __x_parent = 0;
_RWSTD_ASSERT (_Null != __z);
if (_Null == __y->_C_child [0]) {
// __z might have one non-null child. x
// holds that child (might be null though).
__x = __y->_C_child [1];
}
else if (_Null == __y->_C_child [1]) {
// __z HAS one non-null child and __x points to it now.
__x = __y->_C_child [0];
}
else {
// __z has two non-null children; make __y point to its immediate
// predecessor; __x will point to that predecessor's immediate
// predecessor.
__y = _C_node_t::_C_min (__y->_C_child [1]);
__x = __y->_C_child [1];
}
if (__y != __z) {
// __y != __z ( means __y is in __z's left subtree )
// __y REPLACES __z
// relink `y' in place of `z' (at this point __y
// is __z's immediate predecessor)
__z->_C_child [0]->_C_parent = __y;
__y->_C_child [0] = __z->_C_child [0];
if (__y != __z->_C_child [1]) {
// __y is predecessor but is not __z's direct child (right)
// save y's former parent
__x_parent = __y->_C_parent;
if (_Null != __x)
// if __x exists, __x's parent becomes __y's parent
__x->_C_parent = __y->_C_parent;
// __y's former parent becomes __x's parent
__y->_C_parent->_C_child [0] = __x;
// __y's right child gets __z's former right child
__y->_C_child [1] = __z->_C_child [1];
// __z's former right child gets __y as parent
__z->_C_child [1]->_C_parent = __y;
}
else {
// in the case when __y is a direct child of __z,
// save __y value as __x's parent
__x_parent = __y;
}
if (_C_end->_C_parent == __z) {
// when deleted (__z) is root/end, then __y replaces root/end
_C_end->_C_parent = __y;
}
else {
// nice shot;
// when __z is not root/end, then its parent's
// child on __z's side becomes __y
__z->_C_parent->_C_child [__z->_C_parent->_C_child [0] != __z]
= __y;
}
// Finally, y's parent changes to be z's parent;
// y is completely severed from its place
__y->_C_parent = __z->_C_parent;
// swap y and z colors
_STD::swap (__y->_C_color, __z->_C_color);
// __y now points to the deleted node
__y = __z;
}
else {
// (__y == __z) ( __z has had only one child (or maybe none) )
// __x REPLACES __z
// save __y's/__z's parent (will later become x's parent)
__x_parent = __y->_C_parent;
if (_Null != __x) {
// for a non-null __x, set its parent to point to __y's parent
__x->_C_parent = __y->_C_parent;
}
if (_C_end->_C_parent == __z) {
// if __z was root, __x becomes new root...
_C_end->_C_parent = __x;
}
else
// ... otherwise, __x simply replaces __z and as such,
// __z's parent gets __x as right *or* left child
__z->_C_parent->_C_child [__z->_C_parent->_C_child [0] != __z]
= __x;
// ADJUST TREE'S CORNERS
if (_C_end->_C_child [0] == __z) {
// __z is the left corner of the tree (smallest element)
if (_Null == __z->_C_child [1])
// when __z leaves the tree, leftmost will be invalidated;
// adjust left corner to point to __z's parent
_C_end->_C_child [0] = __z->_C_parent;
else {
// finding the successor of __z when __z's right subtree
// is not null; leftmost becomes that minimum/sucessor
_C_end->_C_child [0] = _C_node_t::_C_min (__x);
}
}
if (_C_end->_C_child [1] == __z) {
// __z is in the right corner of the tree
if (_Null == __z->_C_child [0])
// when __z leaves the tree, right corner will be invalidated;
// adjust right corner to point to __z's parent
_C_end->_C_child [1] = __z->_C_parent;
else {
// otherwise, find z's predecessor in z's
// left subtree; that becomes the new rightmost element
_C_end->_C_child [1] = _C_node_t::_C_max (__x);
}
}
}
// COLOR SWAPPING
// (At this point __y has replaced __z and __z has been removed.)
if (__y->_C_color != _Red) {
// __y's color is not red; had it been red, we would have been
// done because it would not have altered the "blackness"
// At the loop's beginning, __x can be one of the two:
// 1. either the strict predecessor of __z's strict predecessor
// and in this case is down the subtree on z's left
// 2. is the node that replaced __z when __z has had only one
// child; that child has replaced __z and its changes
// will be propagated upward
while ( __x != _C_end->_C_parent
&& (_Null == __x || __x->_C_color == _Black)) {
#ifndef _RWSTD_NO_OPTIMIZE_SPEED
if (__x == __x_parent->_C_child [0]) {
// X ON THE LEFT SIDE OF ITS PARENT
// __w is __x's brother/sibling
_C_link_t __w = __x_parent->_C_child [1];
if (_Red == __w->_C_color) {
__w->_C_color = _Black;
__x_parent->_C_color = _Red;
_C_rol (__x_parent);
__w = __x_parent->_C_child [1];
}
if ((_Null == __w->_C_child [0] ||
_Black == __w->_C_child [0]->_C_color) &&
(_Null == __w->_C_child [1] ||
_Black == __w->_C_child [1]->_C_color)) {
// __x's sibling (__w) has black children (or null);
// color __x's sibling as RED and move up in the tree
__w->_C_color = _Red;
__x = __x_parent;
__x_parent = __x_parent->_C_parent;
}
else {
// __w (__x's sibling) has a child which is RED
if (_Null == __w->_C_child [1] ||
_Black == __w->_C_child [1]->_C_color) {
// __w's left is RED
if (_Null != __w->_C_child [0])
// the left RED child becomes BLACK
__w->_C_child [0]->_C_color = _Black;
// __w (x's sibling) becomes RED - color propagates up
__w->_C_color = _Red;
_C_ror (__w);
__w = __x_parent->_C_child [1];
}
__w->_C_color = __x_parent->_C_color;
__x_parent->_C_color = _Black;
if (_Null != __w->_C_child [1])
__w->_C_child [1]->_C_color = _Black;
_C_rol (__x_parent);
break;
}
}
else {
// same as the if clause with "right" and "left" exchanged
_C_link_t __w = __x_parent->_C_child [0];
if (_Red == __w->_C_color) {
__w->_C_color = _Black;
__x_parent->_C_color = _Red;
_C_ror (__x_parent);
__w = __x_parent->_C_child [0];
}
if ((_Null == __w->_C_child [1] ||
_Black == __w->_C_child [1]->_C_color) &&
(_Null == __w->_C_child [0] ||
_Black == __w->_C_child [0]->_C_color)) {
__w->_C_color = _Red;
__x = __x_parent;
__x_parent = __x_parent->_C_parent;
}
else {
if (_Null == __w->_C_child [0] ||
_Black == __w->_C_child [0]->_C_color) {
if (_Null != __w->_C_child [1])
__w->_C_child [1]->_C_color = _Black;
__w->_C_color = _Red;
_C_rol (__w);
__w = __x_parent->_C_child [0];
}
__w->_C_color = __x_parent->_C_color;
__x_parent->_C_color = _Black;
if (_Null != __w->_C_child [0])
__w->_C_child [0]->_C_color = _Black;
_C_ror (__x_parent);
break;
}
}
#else // if defined (_RWSTD_NO_OPTIMIZE_SPEED)
const bool __left = (__x == __x_parent->_C_child [0]);
const bool __right = !__left;
_C_link_t __w = __x_parent->_C_child [__left];
if (_Red == __w->_C_color) {
__w->_C_color = _Black;
__x_parent->_C_color = _Red;
// rotate right if `x' is a right child, otherwise right
_C_rotate (__x_parent, __right);
__w = __x_parent->_C_child [__left];
}
if ((_Null == __w->_C_child [__right] ||
_Black == __w->_C_child [__right]->_C_color) &&
(_Null == __w->_C_child [__left ] ||
_Black == __w->_C_child [__left ]->_C_color)) {
__w->_C_color = _Red;
__x = __x_parent;
__x_parent = __x->_C_parent;
}
else {
if (_Null == __w->_C_child [__left] ||
_Black == __w->_C_child [__left]->_C_color) {
if (_Null != __w->_C_child [__right])
__w->_C_child [__right]->_C_color = _Black;
__w->_C_color = _Red;
_C_rotate (__w, __left);
__w = __x_parent->_C_child [__left];
}
if (_Null != __w) {
__w->_C_color = __x_parent->_C_color;
__x_parent->_C_color = _Black;
if (_Null != __w->_C_child [__left])
__w->_C_child [__left]->_C_color = _Black;
_C_rotate (__x_parent, __right);
}
break;
}
#endif // _RWSTD_NO_OPTIMIZE_SPEED
}
if (_Null != __x)
__x->_C_color = _Black;
}
_C_put_node (__y);
--_C_size;
return __next;
}
template <class _Key, class _Val, class _KeyOf, class _Comp, class _Alloc>
_TYPENAME __rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::size_type
__rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::
erase (const key_type &__x)
{
const _STD::pair<iterator, iterator> __p = equal_range(__x);
const size_type __n = _DISTANCE (__p.first, __p.second, size_type);
erase (__p.first, __p.second);
return __n;
}
template <class _Key, class _Val, class _KeyOf, class _Comp, class _Alloc>
_TYPENAME __rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::_C_link_t
__rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::
_C_copy (_C_link_t __x, _C_link_t __p)
{
// recursive structural copy
_C_link_t __res = __x;
while (_C_link_t () != __x) {
const _C_link_t __y = _C_get_node (__x->_C_value);
if (__res == __x)
__res = __y; // save for return value
__y->_C_color = __x->_C_color;
__y->_C_parent = __p;
__p->_C_child [0] = __y;
__y->_C_child [1] = _C_copy (__x->_C_child [1], __y);
__p = __y;
__x = __x->_C_child [0];
}
__p->_C_child [0] = 0;
return __res;
}
template <class _Key, class _Val, class _KeyOf, class _Comp, class _Alloc>
void __rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::
_C_erase (_C_link_t __x)
{
// recursively erase without rebalancing
while (_C_link_t () != __x) {
_C_erase (__x->_C_child [1]);
_C_link_t __y = __x->_C_child [0];
_C_put_node (__x);
__x = __y;
}
}
template <class _Key, class _Val, class _KeyOf, class _Comp, class _Alloc>
_TYPENAME __rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::iterator
__rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::
erase (iterator __first, iterator __last)
{
_RWSTD_ASSERT_RANGE (begin (), __first);
_RWSTD_ASSERT_RANGE (__first, __last);
iterator __tmp;
if (__first == begin () && __last == end () && _C_size) {
// erase the root node
_C_erase (_C_end->_C_parent);
// set the parent pointer of an empty tree to null
_C_end->_C_parent = 0;
// set the child pointers of an empty tree to end()
_C_end->_C_child [0] =
_C_end->_C_child [1] = _C_end;
// set the size of the tree to 0
_C_size = 0;
// return end()
__tmp = end ();
} else
for (__tmp = end (); !(__first == __last); __tmp = erase (__first++));
return __tmp;
}
template <class _Key, class _Val, class _KeyOf, class _Comp, class _Alloc>
_TYPENAME __rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::iterator
__rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::
find (const key_type &__k)
{
const iterator __j = lower_bound (__k);
return __j == end () || _C_cmp (__k, _ITER_NODE (__j)->_C_key ()) ?
end () : __j;
}
template <class _Key, class _Val, class _KeyOf, class _Comp, class _Alloc>
_TYPENAME __rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::iterator
__rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::
lower_bound (const key_type &__k)
{
_C_link_t __y = _C_end;
for (_C_link_t __x = __y->_C_parent; _C_link_t () != __x; ) {
if (_C_cmp (__x->_C_key (), __k)) {
__x = __x->_C_child [1];
}
else {
__y = __x;
__x = __x->_C_child [0];
}
}
return _C_make_iter (__y);
}
template <class _Key, class _Val, class _KeyOf, class _Comp, class _Alloc>
_TYPENAME __rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::iterator
__rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::
upper_bound (const key_type &__k)
{
_C_link_t __y = _C_end;
for (_C_link_t __x = __y->_C_parent; _C_link_t () != __x; ) {
if (_C_cmp (__k, __x->_C_key ())) {
__y = __x;
__x = __x->_C_child [0];
}
else
__x = __x->_C_child [1];
}
return _C_make_iter (__y);
}
template <class _Key, class _Val, class _KeyOf, class _Comp, class _Alloc>
_TYPENAME __rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::size_type
__rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::
_C_depth (const_iterator __it, size_type *__rank /* = 0 */) const
{
// for notational convenience
const _TYPENAME _C_node_t::_C_color_t _Black = _C_node_t::_C_black;
const _C_link_t _Null = _C_link_t ();
const _C_link_t __node = _ITER_NODE (__it);
if (_Null == __node)
return 0;
#ifdef _RWSTDDEBUG
const _TYPENAME _C_node_t::_C_color_t _Red = _C_node_t::_C_red;
if (_Red == __node->_C_color) {
// both children of every red node must be black
const bool __left_child_black =
_Null == __node->_C_child [0]
|| _Black == __node->_C_child [0]->_C_color;
const bool __right_child_black =
_Null == __node->_C_child [1]
|| _Black == __node->_C_child [1]->_C_color;
_RWSTD_ASSERT (__left_child_black);
_RWSTD_ASSERT (__right_child_black);
}
#endif // _RWDSDEBUG
// every simple path from every node must contain the same number
// of black nodes; that means that every black node must either
// have zero or two children (of either color), or a single red
// child
size_type __ranks [2];
if ( _Null == __node->_C_child [0]
|| _Black == __node->_C_child [0]->_C_color)
__ranks [0] = 1;
else
__ranks [0] = 0;
if ( _Null == __node->_C_child [1]
|| _Black == __node->_C_child [1]->_C_color)
__ranks [1] = 1;
else
__ranks [1] = 0;
const size_type __depth [] = {
_Null == __node->_C_child [0] ?
0 : 1 + _C_depth (_C_make_iter (__node->_C_child [0]), __ranks + 0),
_Null == __node->_C_child [1] ?
0 : 1 + _C_depth (_C_make_iter (__node->_C_child [1]), __ranks + 1)
};
_RWSTD_ASSERT (__ranks [0] == __ranks [1]);
if (__rank)
*__rank += __ranks [0];
return __depth [__depth [0] < __depth [1]];
}
template <class _Key, class _Val, class _KeyOf, class _Comp, class _Alloc>
_TYPENAME __rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::size_type
__rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::
_C_level (const_iterator __it) const
{
if (_ITER_NODE (__it) == _C_end->_C_parent)
return 0;
return 1 + _C_level (_C_make_iter (_ITER_NODE (__it)->_C_parent));
}
} // namespace __rw

854
extern/stdcxx/4.2.1/include/rw/_tree.h vendored Normal file
View File

@@ -0,0 +1,854 @@
/***************************************************************************
*
* _tree.h - Declarations for the Standard Library tree classes
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _tree.h 648752 2008-04-16 17:01:56Z faridz $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
***************************************************************************
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* 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. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
**************************************************************************/
/***************************************************************************
*
* Red-black tree class, designed for use in implementing associative
* containers (set, multiset, map, and multimap). The insertion and
* deletion algorithms are based on those in Cormen, Leiserson, and
* Rivest, Introduction to Algorithms (MIT Press, 1990), except that:
*
* (1) the header cell is maintained with links not only to the root
* but also to the leftmost node of the tree, to enable constant time
* begin(), and to the rightmost node of the tree, to enable linear time
* performance when used with the generic set algorithms (set_union,
* etc.);
*
* (2) when a node being deleted has two children its successor node
* is relinked into its place, rather than copied, so that the only
* iterators invalidated are those referring to the deleted node.
*
**************************************************************************/
#ifndef _RWSTD_RW_TREE_H_INCLUDED
#define _RWSTD_RW_TREE_H_INCLUDED
#ifndef _RWSTD_RW_ALGOBASE_H_INCLUDED
# include <rw/_algobase.h>
#endif // _RWSTD_RW_ALGOBASE_H_INCLUDED
#ifndef _RWSTD_RW_ITERATOR_H_INCLUDED
# include <rw/_iterator.h>
#endif // _RWSTD_RW_ITERATOR_H_INCLUDED
_RWSTD_NAMESPACE (__rw) {
template <class _Alloc, class _Val, class _Key, class _KeyOf>
struct __rw_rb_tree_node
{
enum _C_color_t { _C_red, _C_black };
typedef _Val& reference;
typedef _Alloc allocator_type;
typedef _RWSTD_REBIND (allocator_type, __rw_rb_tree_node) _C_node_alloc_t;
typedef _RWSTD_REBIND (allocator_type, _Key) _C_key_alloc_t;
typedef _TYPENAME _C_node_alloc_t::pointer _C_link_t;
typedef _TYPENAME _C_key_alloc_t::const_reference _C_const_key_ref;
_C_color_t _C_color;
_C_link_t _C_parent;
_C_link_t _C_child [2]; // left (0) and right (1) children
_Val _C_value;
static _C_link_t _C_minmax (_C_link_t __lnk, bool __do_max) {
_RWSTD_ASSERT (_C_link_t () != __lnk);
while (_C_link_t () != __lnk->_C_child [__do_max])
__lnk = __lnk->_C_child [__do_max];
return __lnk;
}
static _C_link_t _C_min (_C_link_t __lnk) {
return _C_minmax (__lnk, false);
}
static _C_link_t _C_max (_C_link_t __lnk) {
return _C_minmax (__lnk, true);
}
_C_const_key_ref _C_key () const {
return _KeyOf ()(_C_value);
}
};
// iterator implements inorder traversal; i.e., nodes are visited
// recursively in this order: left subtree, root, right subtree
template <class _TypeT, class _DiffT,
class _Pointer, class _Reference, class _Node>
class __rw_tree_iter
: public _STD::iterator <_STD::bidirectional_iterator_tag,
_TypeT, _DiffT, _Pointer, _Reference>
{
typedef _STD::iterator <_STD::bidirectional_iterator_tag,
_TypeT, _DiffT, _Pointer, _Reference> _C_iter_base;
public:
typedef _TYPENAME _C_iter_base::value_type value_type;
typedef _TYPENAME _C_iter_base::difference_type difference_type;
typedef _TYPENAME _C_iter_base::pointer pointer;
typedef _TYPENAME _C_iter_base::reference reference;
typedef _TYPENAME _C_iter_base::iterator_category iterator_category;
typedef _Node _C_node_t;
typedef _TYPENAME _C_node_t::allocator_type allocator_type;
typedef _TYPENAME _C_node_t::_C_link_t _C_link_t;
typedef const value_type* const_pointer;
typedef const value_type& const_reference;
typedef __rw_tree_iter<_TypeT, _DiffT, value_type*, value_type&, _C_node_t>
_C_iterator;
_C_link_t _C_node;
__rw_tree_iter () { /* empty */ }
// no copy ctor other than the one below is defined
// will use a compiler generated one if __rw_tree_iter != _C_iterator
__rw_tree_iter (const _C_iterator &__rhs)
: _C_node (__rhs._C_node) { }
template <class _Ptr, class _Ref>
__rw_tree_iter (const __rw_tree_iter<_TypeT, _DiffT, _Ptr, _Ref, _Node>&
__rhs)
: _C_node (__rhs._C_node) { }
__rw_tree_iter (_C_link_t __lnk)
: _C_node (__lnk) {}
#ifdef SNI
difference_type operator- (const __rw_tree_iter&) const {
return 0;
}
#endif
__rw_tree_iter& operator++ () {
if (_C_link_t () != _C_node->_C_child [1]) {
_C_node = _C_node_t::_C_min (_C_node->_C_child [1]);
}
else {
_C_link_t __tmp = _C_node->_C_parent;
while (_C_node == __tmp->_C_child [1]) {
_C_node = __tmp;
__tmp = __tmp->_C_parent;
}
if (_C_node->_C_child [1] != __tmp)
_C_node = __tmp;
}
return *this;
}
__rw_tree_iter& operator-- () {
if ( _C_node->_C_color == _C_node_t::_C_red
&& _C_node->_C_parent->_C_parent == _C_node)
//
// Check for header.
//
_C_node = _C_node->_C_child [1]; // Return rightmost.
else if (_C_link_t () != _C_node->_C_child [0]) {
_C_node = _C_node_t::_C_max (_C_node->_C_child [0]);
}
else {
_C_link_t __tmp = _C_node->_C_parent;
while (_C_node == __tmp->_C_child [0]) {
_C_node = __tmp;
__tmp = __tmp->_C_parent;
}
_C_node = __tmp;
}
return *this;
}
__rw_tree_iter operator++ (int) {
__rw_tree_iter __tmp (*this);
return ++*this, __tmp;
}
__rw_tree_iter operator-- (int) {
__rw_tree_iter __tmp (*this);
return --*this, __tmp;
}
reference operator* () const {
return _C_node->_C_value;
}
_RWSTD_OPERATOR_ARROW (pointer operator-> () const);
};
#define _RWSTD_TREE_ITER(n) \
__rw_tree_iter <_TypeT, _DiffT, _Ptr##n, _Ref##n, _Node>
template <class _TypeT, class _DiffT,
class _Ptr1, class _Ref1, class _Ptr2, class _Ref2, class _Node>
inline bool
operator== (const _RWSTD_TREE_ITER (1) &__lhs,
const _RWSTD_TREE_ITER (2) &__rhs)
{
return __lhs._C_node == __rhs._C_node;
}
template <class _TypeT, class _DiffT,
class _Ptr1, class _Ref1, class _Ptr2, class _Ref2, class _Node>
inline bool
operator!= (const _RWSTD_TREE_ITER (1) &__lhs,
const _RWSTD_TREE_ITER (2) &__rhs)
{
return !(__lhs == __rhs);
}
#undef _RWSTD_TREE_ITER
// for convenience
#undef _ITER_NODE
#define _ITER_NODE(it) (_ITER_BASE (it)._C_node)
_EXPORT
template <class _Key, class _Val, class _KeyOf, class _Comp, class _Alloc>
class __rb_tree : private _Alloc
{
private:
typedef __rw_rb_tree_node<_Alloc,_Val,_Key,_KeyOf> _C_node_t;
typedef _RWSTD_ALLOC_TYPE (_Alloc,_Val) _C_val_alloc_t;
typedef _TYPENAME _C_node_t::_C_key_alloc_t _C_key_alloc_t;
typedef _TYPENAME _C_node_t::_C_node_alloc_t _C_node_alloc_t;
typedef _TYPENAME _C_node_t::_C_link_t _C_link_t;
public:
typedef _Key key_type;
typedef _Val value_type;
typedef _Comp key_compare;
typedef _Alloc allocator_type;
typedef _TYPENAME _C_val_alloc_t::pointer pointer;
typedef _TYPENAME _C_val_alloc_t::const_pointer const_pointer;
typedef _TYPENAME allocator_type::size_type size_type;
typedef _TYPENAME allocator_type::difference_type difference_type;
typedef _TYPENAME _C_val_alloc_t::reference reference;
typedef _TYPENAME _C_val_alloc_t::const_reference const_reference;
private:
typedef __rw_tree_iter<value_type, difference_type, pointer,
reference, _C_node_t> _C_tree_iter;
typedef __rw_tree_iter<value_type, difference_type, const_pointer,
const_reference, _C_node_t> _C_tree_citer;
public:
#ifndef _RWSTD_NO_DEBUG_ITER
typedef __rw_debug_iter <__rb_tree, _C_tree_iter, _C_tree_iter>
iterator;
typedef __rw_debug_iter <__rb_tree, _C_tree_citer, _C_tree_iter>
const_iterator;
iterator _C_make_iter (_C_link_t __node) {
return iterator (*this, _C_tree_iter (__node));
}
const_iterator _C_make_iter (_C_link_t __node) const {
return const_iterator (*this, _C_tree_citer (__node));
}
#else // if defined (_RWSTD_NO_DEBUG_ITER)
typedef _C_tree_iter iterator;
typedef _C_tree_citer const_iterator;
iterator _C_make_iter (_C_link_t __node) {
return iterator (__node);
}
const_iterator _C_make_iter (_C_link_t __node) const {
return const_iterator (__node);
}
#endif // _RWSTD_NO_DEBUG_ITER
private:
#ifdef _RWSTD_NO_NESTED_CLASS_ACCESS
// allow _C_node_buf access to __rb_tree's private type(s)
// if the resolution of cwg issue 45 is not yet implemented
struct _C_node_buf;
friend struct _C_node_buf;
#endif // _RWSTD_NO_NESTED_CLASS_ACCESS
struct _C_node_buf {
typedef _RWSTD_REBIND (allocator_type, _C_node_buf) _C_buf_alloc_t;
typedef _TYPENAME _C_buf_alloc_t::pointer _C_buf_ptr_t;
_C_buf_ptr_t _C_next_buffer;
size_type size;
_C_link_t _C_buffer;
};
typedef _TYPENAME _C_node_buf::_C_buf_alloc_t _C_buf_alloc_t;
typedef _TYPENAME _C_node_buf::_C_buf_ptr_t _C_buf_ptr_t;
_C_buf_ptr_t _C_buf_list;
_C_link_t _C_free_list;
_C_link_t _C_next_avail;
_C_link_t _C_last;
void _C_add_new_buffer ();
void _C_deallocate_buffers ();
//
// Return a node from the free list or new storage
//
_C_link_t _C_get_link () {
_C_link_t __tmp = _C_free_list;
_C_link_t __tmp2 = (void*)_C_free_list ?
(_C_free_list = _RWSTD_STATIC_CAST (_C_link_t,(_C_free_list->_C_child [1])), __tmp)
: (_C_next_avail == _C_last ? (_C_add_new_buffer (), _C_next_avail++)
: _C_next_avail++);
__tmp2->_C_parent = 0;
__tmp2->_C_child [0] = 0;
__tmp2->_C_child [1] = 0;
__tmp2->_C_color = _C_node_t::_C_red;
return __tmp2;
}
//
// Return a node from the free list or new storage with
// the _Val __v constructed on it. Every call to _C_get_node
// must eventually be followed by a call to _C_put_node.
//
_C_link_t _C_get_node (const_reference __v) {
_C_link_t __tmp2 = _C_get_link ();
_TRY {
_RWSTD_VALUE_ALLOC (_C_val_alloc_t, *this,
construct (_RWSTD_VALUE_ALLOC (_C_val_alloc_t, *this,
address (__tmp2->_C_value)),
__v));
}
_CATCH (...) {
_C_put_node (__tmp2, false);
_RETHROW;
}
return __tmp2;
}
_C_link_t _C_get_node () {
return _C_get_link ();
}
//
// Return a node to the free list and destroy the value in it.
//
void _C_put_node (_C_link_t __p, bool __destroy = true) {
__p->_C_child [1] = _C_free_list;
if (__destroy) {
_RWSTD_VALUE_ALLOC (_C_val_alloc_t, *this,
destroy (_RWSTD_VALUE_ALLOC (_C_val_alloc_t, *this,
address (__p->_C_value))));
}
_C_free_list = __p;
}
private:
// _C_end is end()
// tree root is _C_end->_C_parent
// the leftmost node, i.e., begin(), is _C_end->_C_child [0]
// the rightmost node, i.e., end() - 1, is _C_end->_C_child [1]
// all three pointers are null (0) when the tree is empty
// both child pointers of each leaf node are null (0)
// the parent pointer of the root node points to *_C_end
_C_link_t _C_end;
size_type _C_size; // number of nodes
key_compare _C_cmp; // comparison object
public:
#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
typedef _STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef _STD::reverse_iterator<iterator> reverse_iterator;
#else // if defined (_RWSTD_NO_CLASS_PARTIAL_SPEC)
typedef std::reverse_iterator<const_iterator,
_STD::bidirectional_iterator_tag, value_type,
const_reference, const_pointer, difference_type>
const_reverse_iterator;
typedef std::reverse_iterator<iterator,
_STD::bidirectional_iterator_tag, value_type,
reference, pointer, difference_type>
reverse_iterator;
#endif // _RWSTD_NO_CLASS_PARTIAL_SPEC
private:
iterator _C_insert (_C_link_t, _C_link_t, const value_type&);
_C_link_t _C_copy (_C_link_t, _C_link_t);
void _C_erase (_C_link_t);
void _C_erase_leaf (_C_link_t);
void _C_init () {
_C_buf_list = 0;
_C_free_list =
_C_next_avail =
_C_last = 0;
_C_end = _C_get_node ();
_C_end->_C_parent = 0;
_C_end->_C_child [0] =
_C_end->_C_child [1] = _C_end;
}
public:
__rb_tree (const key_compare& = key_compare (),
const allocator_type& = allocator_type ());
template<class _InputIter>
__rb_tree (_InputIter __first, _InputIter __last,
const key_compare &__cmp,
const allocator_type &__alloc, bool __dup)
: allocator_type (__alloc), _C_buf_list (0),
_C_end (0), _C_size (0),
_C_cmp (__cmp) {
_C_init ();
_TRY {
insert (__first, __last, __dup);
}
_CATCH (...) {
_C_deallocate_buffers ();
_RETHROW;
}
}
__rb_tree (const __rb_tree&);
~__rb_tree ();
__rb_tree& operator= (const __rb_tree&);
key_compare key_comp () const {
return _C_cmp;
}
_C_val_alloc_t get_allocator () const {
return _C_val_alloc_t (*this);
}
iterator begin () {
return _C_make_iter (_C_end->_C_child [0]);
}
const_iterator begin () const {
return _C_make_iter (_C_end->_C_child [0]);
}
iterator end () {
return _C_make_iter (_C_end);
}
const_iterator end () const {
return _C_make_iter (_C_end);
}
reverse_iterator rbegin () {
return reverse_iterator (end ());
}
reverse_iterator rend () {
return reverse_iterator (begin ());
}
const_reverse_iterator rbegin () const {
return const_reverse_iterator (end ());
}
const_reverse_iterator rend () const {
return const_reverse_iterator (begin ());
}
bool empty () const {
return 0 == _C_size;
}
size_type size () const {
return _C_size;
}
size_type max_size () const {
return _C_node_alloc_t (*this).max_size ();
}
void swap (__rb_tree &__rhs) {
if (get_allocator () == __rhs.get_allocator ()) {
_STD::swap (_C_buf_list, __rhs._C_buf_list);
_STD::swap (_C_free_list, __rhs._C_free_list);
_STD::swap (_C_next_avail, __rhs._C_next_avail);
_STD::swap (_C_last, __rhs._C_last);
_STD::swap (_C_end, __rhs._C_end);
_STD::swap (_C_size, __rhs._C_size);
_STD::swap (_C_cmp, __rhs._C_cmp);
}
else {
__rb_tree __tmp = *this;
*this = __rhs;
__rhs = __tmp;
}
}
void _C_insert (const value_type&, _STD::pair<iterator, bool>&, bool);
_STD::pair<iterator, bool>
insert (const value_type &__val, bool __dup) {
_STD::pair<iterator, bool> __ret;
return _C_insert (__val, __ret, __dup), __ret;
}
iterator insert (iterator, const value_type&, bool);
template<class _Iterator>
void insert (_Iterator __first, _Iterator __last, bool __dup) {
for (; __first != __last; ++__first)
insert (*__first, __dup);
}
iterator erase (iterator);
size_type erase (const key_type&);
iterator erase (iterator, iterator);
// MSVC 6.0 thinks S<const T*> is the same as S<T*>...
#if !defined (_MSC_VER) || _MSC_VER > 1300
// map and set's iterator may be defined to be tree::const_iterator
iterator insert (const_iterator __it, const value_type &__x, bool __dup) {
return insert (_C_make_iter (_ITER_NODE (__it)), __x, __dup);
}
// map and set's iterator may be defined to be tree::const_iterator
iterator erase (const_iterator __it) {
return erase (_C_make_iter (_ITER_NODE (__it)));
}
// map and set's iterator may be defined to be tree::const_iterator
iterator erase (const_iterator __first, const_iterator __last) {
return erase (_C_make_iter (_ITER_NODE (__first)),
_C_make_iter (_ITER_NODE (__last)));
}
#endif // _MSC_VER <= 1300
void erase (const key_type*, const key_type*);
void clear () {
erase (begin (), end ());
}
iterator find (const key_type&);
const_iterator find (const key_type& __key) const {
return _RWSTD_CONST_CAST (__rb_tree*, this)->find (__key);
}
size_type count (const key_type&) const;
iterator lower_bound (const key_type&);
const_iterator lower_bound (const key_type& __key) const {
return _RWSTD_CONST_CAST (__rb_tree*, this)->lower_bound (__key);
}
iterator upper_bound (const key_type&);
const_iterator upper_bound (const key_type& __key) const {
return _RWSTD_CONST_CAST (__rb_tree*, this)->upper_bound (__key);
}
_STD::pair<iterator, iterator> equal_range (const key_type&);
_STD::pair<const_iterator, const_iterator>
equal_range (const key_type& __key) const {
_STD::pair<iterator, iterator> __tmp =
_RWSTD_CONST_CAST (__rb_tree*, this)->equal_range (__key);
return _STD::pair<const_iterator, const_iterator>
(__tmp.first, __tmp.second);
}
#ifndef _RWSTD_NO_OPTIMIZE_SPEED
void _C_rol (_C_link_t);
void _C_ror (_C_link_t);
#else // if defined (_RWSTD_NO_OPTIMIZE_SPEED)
void _C_rotate (_C_link_t, bool);
#endif // _RWSTD_NO_OPTIMIZE_SPEED
size_type _C_level (const_iterator) const;
// depth guaranteed to be <= 2 * log2(size() + 1)
size_type _C_depth (const_iterator, size_type* = 0) const;
size_type _C_depth () const {
return _C_depth (_C_make_iter (_C_end->_C_parent));
}
};
template <class _Key, class _Val, class _KeyOf, class _Comp, class _Alloc>
inline bool
operator== (const __rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>& __lhs,
const __rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>& __rhs)
{
return __lhs.size () == __rhs.size ()
&& _STD::equal (__lhs.begin (), __lhs.end (), __rhs.begin ());
}
template <class _Key, class _Val, class _KeyOf, class _Comp, class _Alloc>
inline bool
operator< (const __rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>& __lhs,
const __rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>& __rhs)
{
return _STD::lexicographical_compare (__lhs.begin (), __lhs.end (),
__rhs.begin (), __rhs.end ());
}
template <class _Key,class _Val,class _KeyOf,class _Comp,class _Alloc>
inline void
__rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::
_C_erase_leaf (_C_link_t __lnk)
{
// remove a leaf node from the tree
const _C_link_t __parent = __lnk->_C_parent;
if (__parent == _C_end) {
_C_end->_C_parent = 0;
_C_end->_C_child [0] =
_C_end->_C_child [1] = __parent;
}
#ifndef _RWSTD_NO_OPTIMIZE_SPEED
else if (__parent->_C_child [0] == __lnk) {
__parent->_C_child [0] = 0;
if (_C_end->_C_child [0] == __lnk)
_C_end->_C_child [0] = __parent;
}
else {
__parent->_C_child [1] = 0;
if (_C_end->_C_child [1] == __lnk)
_C_end->_C_child [1] = __parent;
}
#else // if !defined (_RWSTD_NO_OPTIMIZE_SPEED)
else {
const bool __right = __parent->_C_child [0] != __lnk;
__parent->_C_child [__right] = 0;
if (_C_end->_C_child [__right] == __lnk)
_C_end->_C_child [__right] = __parent;
}
#endif // _RWSTD_NO_OPTIMIZE_SPEED
}
#ifndef _RWSTD_NO_OPTIMIZE_SPEED
template <class _Key, class _Val, class _KeyOf, class _Comp, class _Alloc>
inline void
__rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::
_C_rol (_C_link_t __lnk)
{
_RWSTD_ASSERT (_C_link_t () != __lnk);
_C_link_t __tmp = __lnk->_C_child [1];
__lnk->_C_child [1] = __tmp->_C_child [0];
if (_C_link_t () != __tmp->_C_child [0])
__tmp->_C_child [0]->_C_parent = __lnk;
__tmp->_C_parent = __lnk->_C_parent;
if (__lnk == _C_end->_C_parent)
_C_end->_C_parent = __tmp;
else if (__lnk == __lnk->_C_parent->_C_child [0])
__lnk->_C_parent->_C_child [0] = __tmp;
else
__lnk->_C_parent->_C_child [1] = __tmp;
__tmp->_C_child [0] = __lnk;
__lnk->_C_parent = __tmp;
}
template <class _Key, class _Val, class _KeyOf, class _Comp, class _Alloc>
inline void
__rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::
_C_ror (_C_link_t __lnk)
{
_RWSTD_ASSERT (_C_link_t () != __lnk);
_C_link_t __tmp = __lnk->_C_child [0];
__lnk->_C_child [0] = __tmp->_C_child [1];
if (_C_link_t () != __tmp->_C_child [1])
__tmp->_C_child [1]->_C_parent = __lnk;
__tmp->_C_parent = __lnk->_C_parent;
if (__lnk == _C_end->_C_parent)
_C_end->_C_parent = __tmp;
else if (__lnk == __lnk->_C_parent->_C_child [1])
__lnk->_C_parent->_C_child [1] = __tmp;
else
__lnk->_C_parent->_C_child [0] = __tmp;
__tmp->_C_child [1] = __lnk;
__lnk->_C_parent = __tmp;
}
#else // if defined (_RWSTD_NO_OPTIMIZE_SPEED)
template <class _Key, class _Val, class _KeyOf, class _Comp, class _Alloc>
inline void
__rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::
_C_rotate (_C_link_t __lnk, bool __right)
{
_RWSTD_ASSERT (_C_link_t () != __lnk);
_C_link_t __tmp = __lnk->_C_child [!__right];
__lnk->_C_child [!__right] = __tmp->_C_child [__right];
if (_C_link_t () != __tmp->_C_child [__right])
__tmp->_C_child [__right]->_C_parent = __lnk;
__tmp->_C_parent = __lnk->_C_parent;
if (__lnk == _C_end->_C_parent)
_C_end->_C_parent = __tmp;
else {
const bool __rt = __lnk == __lnk->_C_parent->_C_child [1];
__lnk->_C_parent->_C_child [__rt] = __tmp;
}
__tmp->_C_child [__right] = __lnk;
__lnk->_C_parent = __tmp;
}
#endif // _RWSTD_NO_OPTIMIZE_SPEED
template <class _Key, class _Val, class _KeyOf, class _Comp, class _Alloc>
inline void __rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::
erase (const _Key* __first, const _Key* __last)
{
for (; __first != __last; ++__first)
erase (*__first);
}
template <class _Key, class _Val, class _KeyOf, class _Comp, class _Alloc>
inline _TYPENAME __rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::size_type
__rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::
count (const _Key& __k) const
{
_STD::pair<const_iterator, const_iterator> __p = equal_range (__k);
size_type __n = _DISTANCE (__p.first, __p.second, size_type);
return __n;
}
#define _RWSTD_RB_TREE_ITER \
_TYPENAME __rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::iterator
template <class _Key, class _Val, class _KeyOf, class _Comp, class _Alloc>
inline _STD::pair<_RWSTD_RB_TREE_ITER , _RWSTD_RB_TREE_ITER >
__rb_tree<_Key, _Val, _KeyOf, _Comp, _Alloc>::
equal_range (const _Key& __k)
{
return _STD::pair<iterator, iterator>(lower_bound (__k), upper_bound(__k));
}
#undef _RWSTD_RB_TREE_ITER
} // namespace __rw
#ifdef _RWSTD_NO_IMPLICIT_INCLUSION
# include <rw/_tree.cc>
#endif
#endif // _RWSTD_RW_TREE_H_INCLUDED

View File

@@ -0,0 +1,297 @@
// -*- C++ -*-
/***************************************************************************
*
* _typetraits.h - definitions of type traits helper templates
*
* This is an internal header file used to implement the C++ Standard
* Library. It should never be #included directly by a program.
*
* $Id: _typetraits.h 550991 2007-06-26 23:58:07Z sebor $
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Copyright 1994-2006 Rogue Wave Software.
*
**************************************************************************/
#ifndef _RWSTD_TYPETRAITS_H_INCLUDED
#define _RWSTD_TYPETRAITS_H_INCLUDED
#include <rw/_defs.h>
_RWSTD_NAMESPACE (__rw) {
template <class _TypeT>
struct __rw_is_const
{
typedef _TypeT _C_type;
enum { _C_val = 0 };
};
template <class _TypeT>
struct __rw_is_const<const _TypeT>
{
typedef _TypeT _C_type;
enum { _C_val = 1 };
};
template <class _TypeT>
struct __rw_is_volatile
{
typedef _TypeT _C_type;
enum { _C_val = 0 };
};
template <class _TypeT>
struct __rw_is_volatile<volatile _TypeT>
{
typedef _TypeT _C_type;
enum { _C_val = 1 };
};
template <class _TypeT>
struct __rw_is_cv_qualified
{
typedef _TypeT _C_type;
enum { _C_val = 0 };
};
template <class _TypeT>
struct __rw_is_cv_qualified<const _TypeT>
{
typedef _TypeT _C_type;
enum { _C_val = 1 };
};
template <class _TypeT>
struct __rw_is_cv_qualified<volatile _TypeT>
{
typedef _TypeT _C_type;
enum { _C_val = 1 };
};
template <class _TypeT>
struct __rw_is_cv_qualified<const volatile _TypeT>
{
typedef _TypeT _C_type;
enum { _C_val = 1 };
};
template <class _TypeT>
struct __rw_is_pointer
{
typedef _TypeT _C_type;
enum { _C_val = 0 };
};
template <class _TypeT>
struct __rw_is_pointer<_TypeT*>
{
typedef _TypeT _C_type;
enum { _C_val = 1 };
};
template <class _TypeT>
struct __rw_is_reference
{
typedef _TypeT _C_type;
enum { _C_val = 0 };
};
template <class _TypeT>
struct __rw_is_reference<_TypeT&>
{
typedef _TypeT _C_type;
enum { _C_val = 1 };
};
template <class _TypeT>
struct __rw_is_fundamental
{
enum { _C_val = __rw_is_pointer<_TypeT>::_C_val };
};
_RWSTD_SPECIALIZED_CLASS
struct __rw_is_fundamental<unsigned char> { enum { _C_val = 1 }; };
_RWSTD_SPECIALIZED_CLASS
struct __rw_is_fundamental<signed char> { enum { _C_val = 1 }; };
_RWSTD_SPECIALIZED_CLASS
struct __rw_is_fundamental<char> { enum { _C_val = 1 }; };
_RWSTD_SPECIALIZED_CLASS
struct __rw_is_fundamental<unsigned short> { enum { _C_val = 1 }; };
_RWSTD_SPECIALIZED_CLASS
struct __rw_is_fundamental<signed short> { enum { _C_val = 1 }; };
_RWSTD_SPECIALIZED_CLASS
struct __rw_is_fundamental<unsigned int> { enum { _C_val = 1 }; };
_RWSTD_SPECIALIZED_CLASS
struct __rw_is_fundamental<signed int> { enum { _C_val = 1 }; };
_RWSTD_SPECIALIZED_CLASS
struct __rw_is_fundamental<unsigned long> { enum { _C_val = 1 }; };
_RWSTD_SPECIALIZED_CLASS
struct __rw_is_fundamental<signed long> { enum { _C_val = 1 }; };
#ifdef _RWSTD_LONG_LONG
_RWSTD_SPECIALIZED_CLASS
struct __rw_is_fundamental<unsigned _RWSTD_LONG_LONG> { enum { _C_val = 1 }; };
_RWSTD_SPECIALIZED_CLASS
struct __rw_is_fundamental<signed _RWSTD_LONG_LONG> { enum { _C_val = 1 }; };
#endif // _RWSTD_LONG_LONG
_RWSTD_SPECIALIZED_CLASS
struct __rw_is_fundamental<float> { enum { _C_val = 1 }; };
_RWSTD_SPECIALIZED_CLASS
struct __rw_is_fundamental<double> { enum { _C_val = 1 }; };
#ifndef _RWSTD_NO_LONG_DOUBLE
_RWSTD_SPECIALIZED_CLASS
struct __rw_is_fundamental<long double> { enum { _C_val = 1 }; };
#endif // _RWSTD_NO_LONG_DOUBLE
#ifndef _RWSTD_NO_BOOL
_RWSTD_SPECIALIZED_CLASS
struct __rw_is_fundamental<bool> { enum { _C_val = 1 }; };
#endif // _RWSTD_NO_BOOL
#ifndef _RWSTD_NO_NATIVE_WCHAR_T
_RWSTD_SPECIALIZED_CLASS
struct __rw_is_fundamental<wchar_t> { enum { _C_val = 1 }; };
#endif // _RWSTD_NO_NATIVE_WCHAR_T
_RWSTD_SPECIALIZED_CLASS
struct __rw_is_fundamental<void> { enum { _C_val = 1 }; };
template <class _TypeT>
struct __rw_is_enum
{
struct _C_no { };
struct _C_yes { int _C_dummy [2]; };
struct _C_indirect {
// prevent classes with user-defined conversions from matching
// use double to prevent float->int gcc conversion warnings
_C_indirect (double);
};
// nested struct gets rid of bogus gcc errors
struct _C_nest {
// supply first argument to prevent HP aCC warnings
static _C_no _C_is (int, ...);
static _C_yes _C_is (int, _C_indirect);
static _TypeT _C_make_T ();
};
#if !defined (__HP_aCC) || __HP_aCC > 33000
enum {
_C_val = sizeof (_C_yes)
== sizeof (_C_nest::_C_is (0, _C_nest::_C_make_T ()))
&& !__rw_is_fundamental<_TypeT>::_C_val
};
#else
// prevent references from causing an error
typedef _TYPENAME __rw_is_reference<_TypeT>::_C_type _C_type;
// working around an HP aCC bug (see PR #25347)
// NOTE: this fails for classes due to another bug (PR #25384)
static const bool
_C_val = sizeof (_C_yes) == sizeof (_C_nest::_C_is (0, _C_type ()))
&& !__rw_is_fundamental<_TypeT>::_C_val;
#endif // __HP_aCC > 33000
};
#if defined (__HP_aCC) && __HP_aCC <= 33000
template <class _TypeT>
const bool __rw_is_enum<_TypeT>::_C_val;
#endif // __HP_aCC <= 33000
_RWSTD_SPECIALIZED_CLASS
struct __rw_is_enum<void>
{
enum { _C_val = 0 };
};
template <class _TypeT>
struct __rw_type_traits
{
typedef _TYPENAME __rw_is_const<_TypeT>::_C_type _C_non_const_type;
typedef _TYPENAME __rw_is_volatile<_TypeT>::_C_type _C_non_volatile_type;
typedef _TYPENAME __rw_is_pointer<_TypeT>::_C_type _C_non_pointer_type;
typedef _TYPENAME __rw_is_reference<_TypeT>::_C_type _C_non_reference_type;
typedef _TYPENAME __rw_is_cv_qualified<_TypeT>::_C_type
_C_non_cv_qualified_type;
enum {
_C_is_const = __rw_is_const<_TypeT>::_C_val,
_C_is_volatile = __rw_is_volatile<_TypeT>::_C_val,
_C_is_cv_qualified = __rw_is_cv_qualified<_TypeT>::_C_val,
_C_is_pointer = __rw_is_pointer<_TypeT>::_C_val,
_C_is_reference = __rw_is_reference<_TypeT>::_C_val,
_C_is_fundamental = __rw_is_fundamental<_TypeT>::_C_val,
_C_is_enum = __rw_is_enum<_TypeT>::_C_val,
_C_is_class = !_C_is_pointer
&& !_C_is_reference
&& !_C_is_fundamental
&& !_C_is_enum
};
};
} // namespace __rw
#endif // _RWSTD_TYPETRAITS_H_INCLUDED