we dont use these bits of SGI STL

From-SVN: r22184
This commit is contained in:
Jason Merrill 1998-09-02 08:33:40 -04:00
parent ff51efd52d
commit ec9c42c9c3
7 changed files with 4 additions and 2708 deletions

View File

@ -1,135 +0,0 @@
/*
* Copyright (c) 1997
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*/
#ifndef __SGI_STL_CHAR_TRAITS_H
#define __SGI_STL_CHAR_TRAITS_H
#include <string.h>
#include <wchar.h>
__STL_BEGIN_NAMESPACE
// Class __char_traits_base.
template <class _CharT, class _IntT> struct __char_traits_base {
typedef _CharT char_type;
typedef _IntT int_type;
// typedef streamoff off_type;
// typedef streampos pos_type;
// typedef mbstate_t state_type;
static void assign(char_type& __c1, const char_type& __c2) { __c1 = __c2; }
static bool eq(const _CharT& __c1, const _CharT& __c2)
{ return __c1 == __c2; }
static bool lt(const _CharT& __c1, const _CharT& __c2)
{ return __c1 < __c2; }
static int compare(const _CharT* __s1, const _CharT* __s2, size_t __n) {
for (size_t __i = 0; __i < __n; ++__i)
if (!eq(__s1[__i], __s2[__i]))
return __s1[__i] < __s2[__i] ? -1 : 1;
return 0;
}
static size_t length(const _CharT* __s) {
const _CharT __null = _CharT();
size_t __i;
for (__i = 0; !eq(__s[__i], __null); ++__i)
{}
return __i;
}
static const _CharT* find(const _CharT* __s, size_t __n, const _CharT& __c)
{
for ( ; __n > 0 ; ++__s, --__n)
if (eq(*__s, __c))
return __s;
return 0;
}
static _CharT* move(_CharT* __s1, const _CharT* __s2, size_t __n) {
memmove(__s1, __s2, __n * sizeof(_CharT));
return __s1;
}
static _CharT* copy(_CharT* __s1, const _CharT* __s2, size_t __n) {
memcpy(__s1, __s2, __n * sizeof(_CharT));
return __s1;
}
static _CharT* assign(_CharT* __s, size_t __n, _CharT __c) {
for (size_t __i = 0; __i < __n; ++__i)
__s[__i] = __c;
return __s;
}
static int_type not_eof(const int_type& __c) {
return !eq(__c, eof()) ? __c : 0;
}
static char_type to_char_type(const int_type& __c) {
return static_cast<char_type>(__c);
}
static int_type to_int_type(const char_type& __c) {
return static_cast<int_type>(__c);
}
static bool eq_int_type(const int_type& __c1, const int_type& __c2) {
return __c1 == __c2;
}
static int_type eof() {
return static_cast<int_type>(-1);
}
};
// Generic char_traits class. Note that this class is provided only
// as a base for explicit specialization; it is unlikely to be useful
// as is for any particular user-defined type. In particular, it
// *will not work* for a non-POD type.
template <class _CharT> struct char_traits
: public __char_traits_base<_CharT, _CharT>
{};
// Specialization for char.
template<> struct char_traits<char>
: public __char_traits_base<char, int>
{
static int compare(const char* __s1, const char* __s2, size_t __n)
{ return memcmp(__s1, __s2, __n); }
static size_t length(const char* __s) { return strlen(__s); }
static void assign(char& __c1, const char& __c2) { __c1 = __c2; }
static char* assign(char* __s, size_t __n, char __c)
{ memset(__s, __c, __n); return __s; }
};
// Specialization for wchar_t.
template<> struct char_traits<wchar_t>
: public __char_traits_base<wchar_t, wint_t>
{};
__STL_END_NAMESPACE
#endif /* __SGI_STL_CHAR_TRAITS_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,413 +0,0 @@
/*
* Copyright (c) 1997
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*/
/* NOTE: This is not portable code. Parts of numeric_limits<> are
* inherently machine-dependent, and this file is written for the MIPS
* architecture and the SGI MIPSpro C++ compiler. Parts of it (in
* particular, some of the characteristics of floating-point types)
* are almost certainly incorrect for any other platform.
*/
#ifndef __SGI_CPP_LIMITS
#define __SGI_CPP_LIMITS
#include <limits.h>
#include <float.h>
#include <stl_config.h>
__STL_BEGIN_NAMESPACE
enum float_round_style {
round_indeterminate = -1,
round_toward_zero = 0,
round_to_nearest = 1,
round_toward_infinity = 2,
round_toward_neg_infinity = 3
};
enum float_denorm_style {
denorm_indeterminate = -1,
denorm_absent = 0,
denorm_present = 1
};
// Base class for all specializations of numeric_limits.
template <class __number>
class _Numeric_limits_base {
public:
static const bool is_specialized = false;
static __number min() __STL_NOTHROW { return __number(); }
static __number max() __STL_NOTHROW { return __number(); }
static const int digits = 0;
static const int digits10 = 0;
static const bool is_signed = false;
static const bool is_integer = false;
static const bool is_exact = false;
static const int radix = 0;
static __number epsilon() __STL_NOTHROW { return __number(); }
static __number round_error() __STL_NOTHROW { return __number(); }
static const int min_exponent = 0;
static const int min_exponent10 = 0;
static const int max_exponent = 0;
static const int max_exponent10 = 0;
static const bool has_infinity = false;
static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
static __number infinity() __STL_NOTHROW { return __number(); }
static __number quiet_NaN() __STL_NOTHROW { return __number(); }
static __number signaling_NaN() __STL_NOTHROW { return __number(); }
static __number denorm_min() __STL_NOTHROW { return __number(); }
static const bool is_iec559 = false;
static const bool is_bounded = false;
static const bool is_modulo = false;
static const bool traps = false;
static const bool tinyness_before = false;
static const float_round_style round_style = round_toward_zero;
};
#define __declare_numeric_base_member(__type, __mem) \
template <class __number> \
const __type _Numeric_limits_base<__number>:: __mem
__declare_numeric_base_member(bool, is_specialized);
__declare_numeric_base_member(int, digits);
__declare_numeric_base_member(int, digits10);
__declare_numeric_base_member(bool, is_signed);
__declare_numeric_base_member(bool, is_integer);
__declare_numeric_base_member(bool, is_exact);
__declare_numeric_base_member(int, radix);
__declare_numeric_base_member(int, min_exponent);
__declare_numeric_base_member(int, max_exponent);
__declare_numeric_base_member(int, min_exponent10);
__declare_numeric_base_member(int, max_exponent10);
__declare_numeric_base_member(bool, has_infinity);
__declare_numeric_base_member(bool, has_quiet_NaN);
__declare_numeric_base_member(bool, has_signaling_NaN);
__declare_numeric_base_member(float_denorm_style, has_denorm);
__declare_numeric_base_member(bool, has_denorm_loss);
__declare_numeric_base_member(bool, is_iec559);
__declare_numeric_base_member(bool, is_bounded);
__declare_numeric_base_member(bool, is_modulo);
__declare_numeric_base_member(bool, traps);
__declare_numeric_base_member(bool, tinyness_before);
__declare_numeric_base_member(float_round_style, round_style);
#undef __declare_numeric_base_member
// Base class for integers.
template <class _Int,
_Int __imin,
_Int __imax,
int __idigits = -1>
class _Integer_limits : public _Numeric_limits_base<_Int>
{
public:
static const bool is_specialized = true;
static _Int min() __STL_NOTHROW { return __imin; }
static _Int max() __STL_NOTHROW { return __imax; }
static const int digits =
(__idigits < 0) ? sizeof(_Int) * CHAR_BIT - (__imin == 0 ? 0 : 1)
: __idigits;
static const int digits10 = (digits * 301) / 1000;
// log 2 = 0.301029995664...
static const bool is_signed = __imin != 0;
static const bool is_integer = true;
static const bool is_exact = true;
static const int radix = 2;
static const bool is_bounded = true;
static const bool is_modulo = true;
};
#define __declare_integer_limits_member(__type, __mem) \
template <class _Int, _Int __imin, _Int __imax, int __idigits> \
const __type _Integer_limits<_Int, __imin, __imax, __idigits>:: __mem
__declare_integer_limits_member(bool, is_specialized);
__declare_integer_limits_member(int, digits);
__declare_integer_limits_member(int, digits10);
__declare_integer_limits_member(bool, is_signed);
__declare_integer_limits_member(bool, is_integer);
__declare_integer_limits_member(bool, is_exact);
__declare_integer_limits_member(int, radix);
__declare_integer_limits_member(bool, is_bounded);
__declare_integer_limits_member(bool, is_modulo);
#undef __declare_integer_limits_member
// Base class for floating-point numbers.
template <class __number,
int __Digits, int __Digits10,
int __MinExp, int __MaxExp,
int __MinExp10, int __MaxExp10,
unsigned int __InfinityWord,
unsigned int __QNaNWord, unsigned int __SNaNWord,
bool __IsIEC559,
float_round_style __RoundStyle>
class _Floating_limits : public _Numeric_limits_base<__number>
{
public:
static const bool is_specialized = true;
static const int digits = __Digits;
static const int digits10 = __Digits10;
static const bool is_signed = true;
static const int radix = 2;
static const int min_exponent = __MinExp;
static const int max_exponent = __MaxExp;
static const int min_exponent10 = __MinExp10;
static const int max_exponent10 = __MaxExp10;
static const bool has_infinity = true;
static const bool has_quiet_NaN = true;
static const bool has_signaling_NaN = true;
static const float_denorm_style has_denorm = denorm_indeterminate;
static const bool has_denorm_loss = false;
static __number infinity() __STL_NOTHROW {
static unsigned int _S_inf[sizeof(__number) / sizeof(int)] =
{ __InfinityWord };
return *reinterpret_cast<__number*>(&_S_inf);
}
static __number quiet_NaN() __STL_NOTHROW {
static unsigned int _S_nan[sizeof(__number) / sizeof(int)] =
{ __QNaNWord };
return *reinterpret_cast<__number*>(&_S_nan);
}
static __number signaling_NaN() __STL_NOTHROW {
static unsigned int _S_nan[sizeof(__number) / sizeof(int)] =
{ __SNaNWord };
return *reinterpret_cast<__number*>(&_S_nan);
}
static const bool is_iec559 = __IsIEC559;
static const bool is_bounded = true;
static const bool traps = true;
static const bool tinyness_before = false;
static const float_round_style round_style = __RoundStyle;
};
#define __declare_float_limits_member(__type, __mem) \
template <class __Num, int __Dig, int __Dig10, \
int __MnX, int __MxX, int __MnX10, int __MxX10, \
unsigned int __Inf, unsigned int __QNaN, unsigned int __SNaN, \
bool __IsIEEE, float_round_style __Sty> \
const __type _Floating_limits<__Num, __Dig, __Dig10, \
__MnX, __MxX, __MnX10, __MxX10, \
__Inf, __QNaN, __SNaN,__IsIEEE, __Sty>:: __mem
__declare_float_limits_member(bool, is_specialized);
__declare_float_limits_member(int, digits);
__declare_float_limits_member(int, digits10);
__declare_float_limits_member(bool, is_signed);
__declare_float_limits_member(int, radix);
__declare_float_limits_member(int, min_exponent);
__declare_float_limits_member(int, max_exponent);
__declare_float_limits_member(int, min_exponent10);
__declare_float_limits_member(int, max_exponent10);
__declare_float_limits_member(bool, has_infinity);
__declare_float_limits_member(bool, has_quiet_NaN);
__declare_float_limits_member(bool, has_signaling_NaN);
__declare_float_limits_member(float_denorm_style, has_denorm);
__declare_float_limits_member(bool, has_denorm_loss);
__declare_float_limits_member(bool, is_iec559);
__declare_float_limits_member(bool, is_bounded);
__declare_float_limits_member(bool, traps);
__declare_float_limits_member(bool, tinyness_before);
__declare_float_limits_member(float_round_style, round_style);
#undef __declare_float_limits_member
// Class numeric_limits
// The unspecialized class.
template<class T>
class numeric_limits : public _Numeric_limits_base<T> {};
// Specializations for all built-in integral types.
#ifndef __STL_NO_BOOL
template<>
class numeric_limits<bool>
: public _Integer_limits<bool, false, true, 0>
{};
#endif /* __STL_NO_BOOL */
template<>
class numeric_limits<char>
: public _Integer_limits<char, CHAR_MIN, CHAR_MAX>
{};
template<>
class numeric_limits<signed char>
: public _Integer_limits<signed char, SCHAR_MIN, SCHAR_MAX>
{};
template<>
class numeric_limits<unsigned char>
: public _Integer_limits<unsigned char, 0, UCHAR_MAX>
{};
#ifdef __STL_HAS_WCHAR_T
template<>
class numeric_limits<wchar_t>
: public _Integer_limits<wchar_t, INT_MIN, INT_MAX>
{};
#endif
template<>
class numeric_limits<short>
: public _Integer_limits<short, SHRT_MIN, SHRT_MAX>
{};
template<>
class numeric_limits<unsigned short>
: public _Integer_limits<unsigned short, 0, USHRT_MAX>
{};
template<>
class numeric_limits<int>
: public _Integer_limits<int, INT_MIN, INT_MAX>
{};
template<>
class numeric_limits<unsigned int>
: public _Integer_limits<unsigned int, 0, UINT_MAX>
{};
template<>
class numeric_limits<long>
: public _Integer_limits<long, LONG_MIN, LONG_MAX>
{};
template<>
class numeric_limits<unsigned long>
: public _Integer_limits<unsigned long, 0, ULONG_MAX>
{};
#ifdef __STL_LONG_LONG
template<>
class numeric_limits<long long>
: public _Integer_limits<long long, LONGLONG_MIN, LONGLONG_MAX>
{};
template<>
class numeric_limits<unsigned long long>
: public _Integer_limits<unsigned long long, 0, ULONGLONG_MAX>
{};
#endif /* __STL_LONG_LONG */
// Specializations for all built-in floating-point type.
template<> class numeric_limits<float>
: public _Floating_limits<float,
FLT_MANT_DIG, // Binary digits of precision
FLT_DIG, // Decimal digits of precision
FLT_MIN_EXP, // Minimum exponent
FLT_MAX_EXP, // Maximum exponent
FLT_MIN_10_EXP, // Minimum base 10 exponent
FLT_MAX_10_EXP, // Maximum base 10 exponent
0x7f800000u, // First word of +infinity
0x7f810000u, // First word of quiet NaN
0x7fc10000u, // First word of signaling NaN
true, // conforms to iec559
round_to_nearest>
{
public:
static float min() __STL_NOTHROW { return FLT_MIN; }
static float denorm_min() __STL_NOTHROW { return FLT_MIN; }
static float max() __STL_NOTHROW { return FLT_MAX; }
static float epsilon() __STL_NOTHROW { return FLT_EPSILON; }
static float round_error() __STL_NOTHROW { return 0.5f; } // Units: ulps.
};
template<> class numeric_limits<double>
: public _Floating_limits<double,
DBL_MANT_DIG, // Binary digits of precision
DBL_DIG, // Decimal digits of precision
DBL_MIN_EXP, // Minimum exponent
DBL_MAX_EXP, // Maximum exponent
DBL_MIN_10_EXP, // Minimum base 10 exponent
DBL_MAX_10_EXP, // Maximum base 10 exponent
0x7ff00000u, // First word of +infinity
0x7ff10000u, // First word of quiet NaN
0x7ff90000u, // First word of signaling NaN
true, // conforms to iec559
round_to_nearest>
{
public:
static double min() __STL_NOTHROW { return DBL_MIN; }
static double denorm_min() __STL_NOTHROW { return DBL_MIN; }
static double max() __STL_NOTHROW { return DBL_MAX; }
static double epsilon() __STL_NOTHROW { return DBL_EPSILON; }
static double round_error() __STL_NOTHROW { return 0.5; } // Units: ulps.
};
template<> class numeric_limits<long double>
: public _Floating_limits<long double,
LDBL_MANT_DIG, // Binary digits of precision
LDBL_DIG, // Decimal digits of precision
LDBL_MIN_EXP, // Minimum exponent
LDBL_MAX_EXP, // Maximum exponent
LDBL_MIN_10_EXP,// Minimum base 10 exponent
LDBL_MAX_10_EXP,// Maximum base 10 exponent
0x7ff00000u, // First word of +infinity
0x7ff10000u, // First word of quiet NaN
0x7ff90000u, // First word of signaling NaN
false, // Doesn't conform to iec559
round_to_nearest>
{
public:
static long double min() __STL_NOTHROW { return LDBL_MIN; }
static long double denorm_min() __STL_NOTHROW { return LDBL_MIN; }
static long double max() __STL_NOTHROW { return LDBL_MAX; }
static long double epsilon() __STL_NOTHROW { return LDBL_EPSILON; }
static long double round_error() __STL_NOTHROW { return 4; } // Units: ulps.
};
__STL_END_NAMESPACE
#endif /* __SGI_CPP_LIMITS */
// Local Variables:
// mode:C++
// End:

View File

@ -1,92 +0,0 @@
/*
* Copyright (c) 1997
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*/
#ifndef __SGI_STDEXCEPT
#define __SGI_STDEXCEPT
#include <stl_exception.h>
#if !(defined(_MIPS_SIM) && defined(_ABIO32) && _MIPS_SIM == _ABIO32)
#include <stl_string_fwd.h>
__STL_BEGIN_NAMESPACE
class logic_error : public __STL_EXCEPTION_BASE {
public:
logic_error(const string& __s)
{ _S_string_copy(__s, _M_name, _S_bufsize); }
virtual const char* what() const __STL_NOTHROW { return _M_name; }
private:
enum { _S_bufsize = 256 };
char _M_name[_S_bufsize];
};
class runtime_error : public __STL_EXCEPTION_BASE {
public:
runtime_error(const string& __s)
{ _S_string_copy(__s, _M_name, _S_bufsize); }
virtual const char* what() const __STL_NOTHROW { return _M_name; }
private:
enum { _S_bufsize = 256 };
char _M_name[_S_bufsize];
};
class domain_error : public logic_error {
public:
domain_error(const string& __arg) : logic_error(__arg) {}
};
class invalid_argument : public logic_error {
public:
invalid_argument(const string& __arg) : logic_error(__arg) {}
};
class length_error : public logic_error {
public:
length_error(const string& __arg) : logic_error(__arg) {}
};
class out_of_range : public logic_error {
public:
out_of_range(const string& __arg) : logic_error(__arg) {}
};
class range_error : public runtime_error {
public:
range_error(const string& __arg) : runtime_error(__arg) {}
};
class overflow_error : public runtime_error {
public:
overflow_error(const string& __arg) : runtime_error(__arg) {}
};
class underflow_error : public runtime_error {
public:
underflow_error(const string& __arg) : runtime_error(__arg) {}
};
__STL_END_NAMESPACE
#ifndef __SGI_STL_STRING
#include <string>
#endif
#endif /* Not o32 */
#endif /* __SGI_STDEXCEPT */
// Local Variables:
// mode:C++
// End:

View File

@ -118,6 +118,10 @@
It should be upgraded to glibc 2.0 or later. */
# if !defined(_NOTHREADS) && __GLIBC__ >= 2 && defined(_G_USING_THUNKS)
# define __STL_PTHREADS
# ifdef __STRICT_ANSI__
/* Work around a bug in the glibc 2.0.x pthread.h. */
# define sigset_t __sigset_t
# endif
# endif
# ifdef __EXCEPTIONS
# define __STL_USE_EXCEPTIONS

View File

@ -1,57 +0,0 @@
/*
* Copyright (c) 1998
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*/
#ifndef __SGI_STL_EXCEPTION_H
#define __SGI_STL_EXCEPTION_H
// This header exists solely for portability. Normally it just includes
// the header <exception>.
// The header <exception> contains low-level functions that interact
// with a compiler's exception-handling mechanism. It is assumed to
// be supplied with the compiler, rather than with the library, because
// it is inherently tied very closely to the compiler itself.
// On platforms where <exception> does not exist, this header defines
// an exception base class. This is *not* a substitute for everything
// in <exception>, but it suffices to support a bare minimum of STL
// functionality.
#include <stl_config.h>
#ifndef __STL_NO_EXCEPTION_HEADER
#include <exception>
#define __STL_EXCEPTION_BASE exception
#else /* __STL_NO_EXCEPTION_HEADER */
__STL_BEGIN_NAMESPACE
class _Exception {
public:
virtual ~_Exception() __STL_NOTHROW {}
virtual const char* what() const __STL_NOTHROW { return ""; }
};
#define __STL_EXCEPTION_BASE _Exception
__STL_END_NAMESPACE
#endif /* __STL_NO_EXCEPTION_HEADER */
#endif /* __SGI_STL_EXCEPTION_H */
// Local Variables:
// mode:C++
// End:

View File

@ -1,51 +0,0 @@
/*
* Copyright (c) 1997
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*/
#ifndef __SGI_STL_STRING_FWD_H
#define __SGI_STL_STRING_FWD_H
#include <stddef.h>
__STL_BEGIN_NAMESPACE
#ifdef __STL_USE_STD_ALLOCATORS
template <class _Tp> class allocator;
#else /* __STL_USE_STD_ALLOCATORS */
template <bool __threads, int __inst> class _Default_alloc_template;
typedef _Default_alloc_template<true, 0> _Alloc;
#endif /* __STL_USE_STD_ALLOCATORS */
template <class _CharT> struct char_traits;
template <class _CharT,
class _Traits = char_traits<_CharT>,
class _Alloc = __STL_DEFAULT_ALLOCATOR(_CharT) >
class basic_string;
typedef basic_string<char> string;
typedef basic_string<wchar_t> wstring;
template <class _CharT, class _Traits, class _Alloc>
void _S_string_copy(const basic_string<_CharT,_Traits,_Alloc>&, _CharT*,
size_t);
__STL_END_NAMESPACE
#endif /* __SGI_STL_STRING_FWD_H */
// Local Variables:
// mode:C++
// End:

File diff suppressed because it is too large Load Diff