[STLPORT]

Copy stlport headers from cmake branch

svn path=/trunk/; revision=51782
This commit is contained in:
Timo Kreuzer 2011-05-16 13:00:45 +00:00
parent e89305e733
commit 5d006f3cbf
340 changed files with 74550 additions and 0 deletions

View file

@ -0,0 +1,10 @@
// C++ forwarding C errno header.
#pragma once
#include <errno.h>
// Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998
#ifndef errno
#define errno errno
#endif

View file

@ -0,0 +1,9 @@
// C++ forwarding C float header.
//
// ISO C++ 14882: 18.2.2 Implementation properties: C library
//
#pragma once
#include <float.h>

View file

@ -0,0 +1,17 @@
// C limitations
#pragma once
#include <limits.h>
#ifndef LLONG_MIN
#define LLONG_MIN (-__LONG_LONG_MAX__ - 1)
#endif
#ifndef LLONG_MAX
#define LLONG_MAX __LONG_LONG_MAX__
#endif
#ifndef ULLONG_MAX
#define ULLONG_MAX (__LONG_LONG_MAX__ * 2ULL + 1)
#endif

View file

@ -0,0 +1,16 @@
// C++ forwarding C locale header.
#pragma once
#include <locale.h>
// Get rid of those macros defined in <locale.h> in lieu of real functions.
#undef setlocale
#undef localeconv
namespace std
{
using ::lconv;
using ::setlocale;
using ::localeconv;
}

292
reactos/include/c++/cmath Normal file
View file

@ -0,0 +1,292 @@
//Standard C++ math declarations
#pragma once
#include <math.h>
// Get rid of those macros defined in <math.h> in lieu of real functions.
#undef abs
#undef div
#undef acos
#undef asin
#undef atan
#undef atan2
#undef ceil
#undef cos
#undef cosh
#undef exp
#undef fabs
#undef floor
#undef fmod
#undef frexp
#undef ldexp
#undef log
#undef log10
#undef modf
#undef pow
#undef sin
#undef sinh
#undef sqrt
#undef tan
#undef tanh
namespace std
{
// Forward declaration of a helper function. This really should be
// an `exported' forward declaration.
template<typename _Tp>
_Tp __cmath_power(_Tp, unsigned int);
template<typename _Tp>
inline _Tp
__pow_helper(_Tp __x, int __n)
{
return __n < 0
? _Tp(1)/__cmath_power(__x, -__n)
: __cmath_power(__x, __n);
}
inline double
abs(double __x)
{ return fabs(__x); }
inline float
abs(float __x)
{ return fabsf(__x); }
inline long double
abs(long double __x)
{ return fabsl(__x); }
using ::acos;
inline float
acos(float __x)
{ return acosf(__x); }
inline long double
acos(long double __x)
{ return acosl(__x); }
using ::asin;
inline float
asin(float __x)
{ return asinf(__x); }
inline long double
asin(long double __x)
{ return asinl(__x); }
using ::atan;
inline float
atan(float __x)
{ return atanf(__x); }
inline long double
atan(long double __x)
{ return atanl(__x); }
using ::atan2;
inline float
atan2(float __y, float __x)
{ return atan2f(__y, __x); }
inline long double
atan2(long double __y, long double __x)
{ return atan2l(__y, __x); }
using ::ceil;
inline float
ceil(float __x)
{ return ceilf(__x); }
inline long double
ceil(long double __x)
{ return ceill(__x); }
using ::cos;
inline float
cos(float __x)
{ return cosf(__x); }
inline long double
cos(long double __x)
{ return cosl(__x); }
using ::cosh;
inline float
cosh(float __x)
{ return coshf(__x); }
inline long double
cosh(long double __x)
{ return coshl(__x); }
using ::exp;
inline float
exp(float __x)
{ return expf(__x); }
inline long double
exp(long double __x)
{ return expl(__x); }
using ::fabs;
inline float
fabs(float __x)
{ return fabsf(__x); }
inline long double
fabs(long double __x)
{ return fabsl(__x); }
using ::floor;
inline float
floor(float __x)
{ return floorf(__x); }
inline long double
floor(long double __x)
{ return floorl(__x); }
using ::fmod;
inline float
fmod(float __x, float __y)
{ return fmodf(__x, __y); }
inline long double
fmod(long double __x, long double __y)
{ return fmodl(__x, __y); }
using ::frexp;
inline float
frexp(float __x, int* __exp)
{ return frexpf(__x, __exp); }
inline long double
frexp(long double __x, int* __exp)
{ return frexpl(__x, __exp); }
using ::ldexp;
inline float
ldexp(float __x, int __exp)
{ return ldexpf(__x, __exp); }
inline long double
ldexp(long double __x, int __exp)
{ return ldexpl(__x, __exp); }
using ::log;
inline float
log(float __x)
{ return logf(__x); }
inline long double
log(long double __x)
{ return logl(__x); }
using ::log10;
inline float
log10(float __x)
{ return log10f(__x); }
inline long double
log10(long double __x)
{ return log10l(__x); }
using ::modf;
inline float
modf(float __x, float* __iptr)
{ return modff(__x, __iptr); }
inline long double
modf(long double __x, long double* __iptr)
{ return modfl(__x, __iptr); }
using ::pow;
inline float
pow(float __x, float __y)
{ return powf(__x, __y); }
inline long double
pow(long double __x, long double __y)
{ return powl(__x, __y); }
inline double
pow(double __x, int __i)
{ return pow(__x, static_cast<double>(__i)); }
inline float
pow(float __x, int __n)
{ return powf(__x, static_cast<float>(__n)); }
inline long double
pow(long double __x, int __n)
{ return powl(__x, static_cast<long double>(__n)); }
using ::sin;
inline float
sin(float __x)
{ return sinf(__x); }
inline long double
sin(long double __x)
{ return sinl(__x); }
using ::sinh;
inline float
sinh(float __x)
{ return sinhf(__x); }
inline long double
sinh(long double __x)
{ return sinhl(__x); }
using ::sqrt;
inline float
sqrt(float __x)
{ return sqrtf(__x); }
inline long double
sqrt(long double __x)
{ return sqrtl(__x); }
using ::tan;
inline float
tan(float __x)
{ return tanf(__x); }
inline long double
tan(long double __x)
{ return tanl(__x); }
using ::tanh;
inline float
tanh(float __x)
{ return tanhf(__x); }
inline long double
tanh(long double __x)
{ return tanhl(__x); }
}

View file

@ -0,0 +1,11 @@
// ISO C++ standards definitions
#include <stddef.h>
#pragma once
namespace std
{
using ::ptrdiff_t;
using ::size_t;
}

View file

@ -0,0 +1,98 @@
// C++ forwarding C stdio header.
#pragma once
#include <cstddef>
#include <stdio.h>
// Get rid of those macros defined in <stdio.h> in lieu of real functions.
#undef clearerr
#undef fclose
#undef feof
#undef ferror
#undef fflush
#undef fgetc
#undef fgetpos
#undef fgets
#undef fopen
#undef fprintf
#undef fputc
#undef fputs
#undef fread
#undef freopen
#undef fscanf
#undef fseek
#undef fsetpos
#undef ftell
#undef fwrite
#undef getc
#undef getchar
#undef gets
#undef perror
#undef printf
#undef putc
#undef putchar
#undef puts
#undef remove
#undef rename
#undef rewind
#undef scanf
#undef setbuf
#undef setvbuf
#undef sprintf
#undef sscanf
#undef tmpfile
#undef tmpnam
#undef ungetc
#undef vfprintf
#undef vprintf
#undef vsprintf
namespace std
{
using ::FILE;
using ::fpos_t;
using ::clearerr;
using ::fclose;
using ::feof;
using ::ferror;
using ::fflush;
using ::fgetc;
using ::fgetpos;
using ::fgets;
using ::fopen;
using ::fprintf;
using ::fputc;
using ::fputs;
using ::fread;
using ::freopen;
using ::fscanf;
using ::fseek;
using ::fsetpos;
using ::ftell;
using ::fwrite;
using ::getc;
using ::getchar;
using ::gets;
using ::perror;
using ::printf;
using ::putc;
using ::putchar;
using ::puts;
using ::remove;
using ::rename;
using ::rewind;
using ::scanf;
using ::setbuf;
using ::setvbuf;
using ::sprintf;
using ::sscanf;
using ::tmpfile;
using ::tmpnam;
using ::ungetc;
using ::vfprintf;
using ::vprintf;
using ::vsprintf;
using ::vsnprintf;
}

View file

@ -0,0 +1,77 @@
// Standard C library declarations
#pragma once
#include <cstddef>
#include <stdlib.h>
// Get rid of those macros defined in <stdlib.h> in lieu of real functions.
#undef abort
#undef abs
#undef atexit
#undef atof
#undef atoi
#undef atol
#undef bsearch
#undef calloc
#undef div
#undef exit
#undef free
#undef getenv
#undef labs
#undef ldiv
#undef malloc
#undef mblen
#undef mbstowcs
#undef mbtowc
#undef qsort
#undef rand
#undef realloc
#undef srand
#undef strtod
#undef strtol
#undef strtoul
#undef system
#undef wcstombs
#undef wctomb
namespace std
{
using ::div_t;
using ::ldiv_t;
using ::abort;
using ::abs;
using ::atexit;
using ::atof;
using ::atoi;
using ::atol;
using ::bsearch;
using ::calloc;
using ::div;
using ::exit;
using ::free;
using ::getenv;
using ::labs;
using ::ldiv;
using ::malloc;
using ::mblen;
using ::mbstowcs;
using ::mbtowc;
using ::qsort;
using ::rand;
using ::realloc;
using ::srand;
using ::strtod;
using ::strtol;
using ::strtoul;
using ::system;
using ::wcstombs;
using ::wctomb;
inline long
abs(long __i) { return labs(__i); }
inline ldiv_t
div(long __i, long __j) { return ldiv(__i, __j); }
}

View file

@ -0,0 +1,60 @@
// Standard C string declarations for C++
//
// ISO C++ 14882: 20.4.6 C library
//
#pragma once
#include <cstddef>
#include <string.h>
// Get rid of those macros defined in <string.h> in lieu of real functions.
#undef memchr
#undef memcmp
#undef memcpy
#undef memmove
#undef memset
#undef strcat
#undef strchr
#undef strcmp
#undef strcoll
#undef strcpy
#undef strcspn
#undef strerror
#undef strlen
#undef strncat
#undef strncmp
#undef strncpy
#undef strpbrk
#undef strrchr
#undef strspn
#undef strstr
#undef strtok
#undef strxfrm
namespace std
{
using ::memchr;
using ::memcmp;
using ::memcpy;
using ::memmove;
using ::memset;
using ::strcat;
using ::strcmp;
using ::strcoll;
using ::strcpy;
using ::strcspn;
using ::strerror;
using ::strlen;
using ::strncat;
using ::strncmp;
using ::strncpy;
using ::strspn;
using ::strtok;
using ::strxfrm;
using ::strchr;
using ::strpbrk;
using ::strrchr;
using ::strstr;
}

34
reactos/include/c++/ctime Normal file
View file

@ -0,0 +1,34 @@
// ISO C++ date and time declarations
#include <cstddef>
#include <time.h>
#pragma once
// Get rid of those macros defined in <time.h> in lieu of real functions.
#undef clock
#undef difftime
#undef mktime
#undef time
#undef asctime
#undef ctime
#undef gmtime
#undef localtime
#undef strftime
namespace std
{
using ::clock_t;
using ::time_t;
using ::tm;
using ::clock;
using ::difftime;
using ::mktime;
using ::time;
using ::asctime;
using ::ctime;
using ::gmtime;
using ::localtime;
using ::strftime;
}

152
reactos/include/c++/cwchar Normal file
View file

@ -0,0 +1,152 @@
// C++ wchar forwarding header
#pragma once
#include <cstddef>
#include <wchar.h>
namespace std
{
using ::mbstate_t;
}
// Get rid of those macros defined in <wchar.h> in lieu of real functions.
#undef btowc
#undef fgetwc
#undef fgetws
#undef fputwc
#undef fputws
#undef fwide
#undef fwprintf
#undef fwscanf
#undef getwc
#undef getwchar
#undef mbrlen
#undef mbrtowc
#undef mbsinit
#undef mbsrtowcs
#undef putwc
#undef putwchar
#undef swprintf
#undef swscanf
#undef ungetwc
#undef vfwprintf
#undef vfwscanf
#undef vswprintf
#undef vswscanf
#undef vwprintf
#undef vwscanf
#undef wcrtomb
#undef wcscat
#undef wcschr
#undef wcscmp
#undef wcscoll
#undef wcscpy
#undef wcscspn
#undef wcsftime
#undef wcslen
#undef wcsncat
#undef wcsncmp
#undef wcsncpy
#undef wcspbrk
#undef wcsrchr
#undef wcsrtombs
#undef wcsspn
#undef wcsstr
#undef wcstod
#undef wcstof
#undef wcstok
#undef wcstol
#undef wcstoul
#undef wcsxfrm
#undef wctob
#undef wmemchr
#undef wmemcmp
#undef wmemcpy
#undef wmemmove
#undef wmemset
#undef wprintf
#undef wscanf
namespace std
{
using ::wint_t;
using ::btowc;
using ::fgetwc;
using ::fgetws;
using ::fputwc;
using ::fputws;
using ::fwide;
using ::fwprintf;
using ::fwscanf;
using ::getwc;
using ::getwchar;
using ::mbrlen;
using ::mbrtowc;
using ::mbsinit;
using ::mbsrtowcs;
using ::putwc;
using ::putwchar;
using ::swprintf;
using ::swscanf;
using ::ungetwc;
using ::vfwprintf;
using ::vfwscanf;
using ::vswprintf;
using ::vswscanf;
using ::vwprintf;
using ::vwscanf;
using ::wcrtomb;
using ::wcscat;
using ::wcscmp;
using ::wcscoll;
using ::wcscpy;
using ::wcscspn;
using ::wcsftime;
using ::wcslen;
using ::wcsncat;
using ::wcsncmp;
using ::wcsncpy;
using ::wcsrtombs;
using ::wcsspn;
using ::wcstod;
using ::wcstof;
using ::wcstok;
using ::wcstol;
using ::wcstoul;
using ::wcsxfrm;
using ::wctob;
using ::wmemcmp;
using ::wmemcpy;
using ::wmemmove;
using ::wmemset;
using ::wprintf;
using ::wscanf;
using ::wcschr;
using ::wcspbrk;
using ::wcsrchr;
using ::wcsstr;
using ::wmemchr;
inline wchar_t*
wcschr(wchar_t* __p, wchar_t __c)
{ return wcschr(const_cast<const wchar_t*>(__p), __c); }
inline wchar_t*
wcspbrk(wchar_t* __s1, const wchar_t* __s2)
{ return wcspbrk(const_cast<const wchar_t*>(__s1), __s2); }
inline wchar_t*
wcsrchr(wchar_t* __p, wchar_t __c)
{ return wcsrchr(const_cast<const wchar_t*>(__p), __c); }
inline wchar_t*
wcsstr(wchar_t* __s1, const wchar_t* __s2)
{ return wcsstr(const_cast<const wchar_t*>(__s1), __s2); }
inline wchar_t*
wmemchr(wchar_t* __p, wchar_t __c, size_t __n)
{ return wmemchr(const_cast<const wchar_t*>(__p), __c, __n); }
}

View file

@ -0,0 +1,66 @@
// Exception Handling support header for -*- C++ -*-
#ifndef __EXCEPTION__
#define __EXCEPTION__
extern "C++" {
namespace std
{
/**
* @defgroup exceptions Exceptions
* @ingroup diagnostics
*
* Classes and functions for reporting errors via exception classes.
* @{
*/
/**
* @brief Base class for all library exceptions.
*
* This is the base class for all exceptions thrown by the standard
* library, and by certain language expressions. You are free to derive
* your own %exception classes, or use a different hierarchy, or to
* throw non-class data (e.g., fundamental types).
*/
class exception
{
public:
exception() throw() { }
virtual ~exception() throw();
/** Returns a C-style character string describing the general cause
* of the current error. */
virtual const char* what() const throw();
};
/** If an %exception is thrown which is not listed in a function's
* %exception specification, one of these may be thrown. */
class bad_exception : public exception
{
public:
bad_exception() throw() { }
virtual ~bad_exception() throw();
virtual const char* what() const throw();
};
typedef void (*unexpected_handler) ();
unexpected_handler set_unexpected(unexpected_handler) throw();
DECLSPEC_NORETURN void unexpected();
bool uncaught_exception() throw();
// @} group exceptions
} // namespace std
typedef void (*terminate_handler) ();
terminate_handler set_terminate(terminate_handler) throw();
DECLSPEC_NORETURN void terminate() throw();
} // extern "C++"
#endif

49
reactos/include/c++/new Normal file
View file

@ -0,0 +1,49 @@
// Standard C++ dynamic memory management header
#ifndef _NEW
#define _NEW
#include <cstddef>
#include <exception>
extern "C++" {
namespace std
{
class bad_alloc : public exception
{
public:
bad_alloc() throw() { }
// This declaration is not useless:
// http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
virtual ~bad_alloc() throw();
// See comment in eh_exception.cc.
virtual const char* what() const throw();
};
struct nothrow_t { };
extern const nothrow_t nothrow;
} // namespace std
typedef void (*new_handler)();
new_handler set_new_handler(new_handler) throw();
void* operator new (std::size_t size, const std::nothrow_t& nothrow_constant) throw();
inline void* operator new (std::size_t size, void* ptr) throw() { return ptr; }
void* operator new[] (std::size_t size, const std::nothrow_t& nothrow_constant) throw();
inline void* operator new[] (std::size_t size, void* ptr) throw() { return ptr; }
void operator delete (void* ptr) throw ();
void operator delete (void* ptr, const std::nothrow_t& nothrow_constant) throw();
inline void operator delete (void* ptr, void* voidptr2) throw() { }
void operator delete[] (void* ptr) throw ();
void operator delete[] (void* ptr, const std::nothrow_t& nothrow_constant) throw();
inline void operator delete[] (void* ptr, void* voidptr2) throw() { }
//@}
} // extern "C++"
#endif

View file

@ -0,0 +1,62 @@
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1997
* Moscow Center for SPARC Technology
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_ALGORITHM
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x1
# include <stl/_prolog.h>
# define _STLP_ALGORITHM
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x1)
# ifndef _STLP_INTERNAL_CSTDIO
// remove() conflicts, <cstdio> should always go first
# include <stl/_cstdio.h>
# endif
# ifndef _STLP_INTERNAL_ALGO_H
# include <stl/_algo.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x1) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <algorithm>
# else
# include _STLP_NATIVE_HEADER(algorithm)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x1 )
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_ALGORITHM */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,50 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#if !defined (_STLP_OUTERMOST_HEADER_ID)
# define _STLP_OUTERMOST_HEADER_ID 0x202
# include <stl/_cprolog.h>
#elif (_STLP_OUTERMOST_HEADER_ID == 0x202) && ! defined (_STLP_DONT_POP_HEADER_ID)
# define _STLP_DONT_POP_HEADER_ID
#endif
/* evc3 doesn't have assert.h; macro assert() is defined in stl_evc.h */
#ifndef _STLP_WCE_EVC3
# if !defined (assert)
# define _STLP_NATIVE_ASSERT_H_INCLUDED
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <assert.h>
# else
# include _STLP_NATIVE_C_HEADER(assert.h)
# endif
# endif
# if !defined (_STLP_NATIVE_ASSERT_H_INCLUDED)
/* See errno.h for additional information about this #error */
# error assert has been defined before inclusion of assert.h header.
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x202)
# if ! defined (_STLP_DONT_POP_HEADER_ID)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# endif
# undef _STLP_DONT_POP_HEADER_ID
#endif
/* Local Variables:
* mode:C++
* End:
*/

View file

@ -0,0 +1,70 @@
/*
* Copyright (c) 1998
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_BITSET
// This implementation of bitset<> has a second template parameter,
// _WordT, which defaults to unsigned long. *YOU SHOULD NOT USE
// THIS FEATURE*. It is experimental, and it may be removed in
// future releases.
// A bitset of size N, using words of type _WordT, will have
// N % (sizeof(_WordT) * CHAR_BIT) unused bits. (They are the high-
// order bits in the highest word.) It is a class invariant
// of class bitset<> that those unused bits are always zero.
// Most of the actual code isn't contained in bitset<> itself, but in the
// base class _Base_bitset. The base class works with whole words, not with
// individual bits. This allows us to specialize _Base_bitset for the
// important special case where the bitset is only a single word.
// The C++ standard does not define the precise semantics of operator[].
// In this implementation the const version of operator[] is equivalent
// to test(), except that it does no range checking. The non-const version
// returns a reference to a bit, again without doing any range checking.
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x2
# include <stl/_prolog.h>
# define _STLP_BITSET
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x2)
# ifndef _STLP_INTERNAL_BITSET
# include <stl/_bitset.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x2) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <bitset>
# else
# include _STLP_NATIVE_HEADER(bitset)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x2 )
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_BITSET */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,46 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x103
# include <stl/_prolog.h>
#elif (_STLP_OUTERMOST_HEADER_ID == 0x103) && ! defined (_STLP_DONT_POP_HEADER_ID)
# define _STLP_DONT_POP_HEADER_ID
#endif
#if !defined (_STLP_WCE_EVC3)
# if defined (_STLP_USE_NEW_C_HEADERS)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <cassert>
# else
# include _STLP_NATIVE_CPP_C_HEADER(cassert)
# endif
# else
# include <assert.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x103 )
# if !defined (_STLP_DONT_POP_HEADER_ID)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# else
# undef _STLP_DONT_POP_HEADER_ID
# endif
#endif
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,47 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_CCTYPE
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x104
# define _STLP_CCTYPE
# include <stl/_prolog.h>
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x104 )
# ifndef _STLP_INTERNAL_CCTYPE
# include <stl/_cctype.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x104) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <cctype>
# else
# include _STLP_NATIVE_CPP_C_HEADER(cctype)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x104 )
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_CCTYPE */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,55 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_CERRNO
#define _STLP_CERRNO
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x105
# include <stl/_prolog.h>
#endif
#ifndef _STLP_WCE
# if defined (_STLP_USE_NEW_C_HEADERS)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <cerrno>
# else
# include _STLP_NATIVE_CPP_C_HEADER(cerrno)
# endif
# else
# include <errno.h>
# endif
#endif
#ifndef errno /* errno is not a macro */
# if defined (_STLP_IMPORT_VENDOR_CSTD)
# if !defined (__IBMCPP__) && !defined (__hpux) && !defined (__MWERKS__) && !defined (_STLP_WCE)
_STLP_BEGIN_NAMESPACE
using _STLP_VENDOR_CSTD::errno;
_STLP_END_NAMESPACE
# endif
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x105 )
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_CERRNO */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,45 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_CFLOAT
#define _STLP_CFLOAT
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x106
# include <stl/_prolog.h>
#endif
// Borland defines some implementation constants in std:: namespace,
// we do not want to import them.
#if defined (_STLP_USE_NEW_C_HEADERS) && !defined (__BORLANDC__)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <cfloat>
# else
# include _STLP_NATIVE_CPP_C_HEADER(cfloat)
# endif
#else
# include <float.h>
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x106 )
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_CFLOAT */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,45 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_CISO646
#define _STLP_CISO646
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x107
# include <stl/_prolog.h>
#endif
#if !defined(_STLP_WCE_EVC3) && !defined (__BORLANDC__)
# if defined (_STLP_USE_NEW_C_HEADERS)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <ciso646>
# else
# include _STLP_NATIVE_CPP_C_HEADER(ciso646)
# endif
# else
# include <iso646.h>
# endif /* _STLP_USE_NEW_C_HEADERS */
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x107 )
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_CISO646 */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,53 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_CLIMITS
# define _STLP_CLIMITS
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x108
# include <stl/_prolog.h>
#endif
#if defined (__SUNPRO_CC) && ((__SUNPRO_CC == 0x500) && (__SUNPRO_CC_COMPAT > 4))
# include </usr/include/limits.h>
#elif defined (_STLP_USE_NEW_C_HEADERS)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <climits>
# else
# include _STLP_NATIVE_CPP_C_HEADER(climits)
# endif
#else
# if defined (__BORLANDC__)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <limits.h>
# else
# include _STLP_NATIVE_C_HEADER(limits.h)
# endif
# else
# include <limits.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x108 )
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_CLIMITS */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,47 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_CLOCALE
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x109
# define _STLP_CLOCALE
# include <stl/_prolog.h>
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x109)
# ifndef _STLP_INTERNAL_CLOCALE
# include <stl/_clocale.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x109) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <clocale>
# else
# include _STLP_NATIVE_CPP_C_HEADER(clocale)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x109)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_CLOCALE */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,53 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_CMATH
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x110
# include <stl/_prolog.h>
#elif (_STLP_OUTERMOST_HEADER_ID == 0x110) && !defined (_STLP_DONT_POP_HEADER_ID)
# define _STLP_DONT_POP_HEADER_ID
# define _STLP_CMATH
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x110) && !defined (_STLP_DONT_POP_HEADER_ID)
# ifndef _STLP_INTERNAL_CMATH
# include <stl/_cmath.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x110) || defined (_STLP_DONT_POP_HEADER_ID) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <cmath>
# else
# include _STLP_NATIVE_CPP_C_HEADER(cmath)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x110)
# if !defined (_STLP_DONT_POP_HEADER_ID)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# else
# undef _STLP_DONT_POP_HEADER_ID
# endif
#endif
#endif /* _STLP_CMATH */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,57 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_COMPLEX
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x10
# define _STLP_COMPLEX
# include <stl/_prolog.h>
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x10)
// This header declares the template class complex, as described in
// in the C++ Standard. Single-precision complex numbers
// are complex<float>, double-precision are complex<double>, and
// quad precision are complex<long double>.
// Note that the template class complex is declared within namespace
// std, as called for by the draft C++ standard
# ifndef _STLP_INTERNAL_COMPLEX
# include <stl/_complex.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x10) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <complex>
# else
# include _STLP_NATIVE_HEADER(complex)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x10 )
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_COMPLEX */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,47 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_CSETJMP
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x111
# define _STLP_CSETJMP
# include <stl/_prolog.h>
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x111)
# ifndef _STLP_INTERNAL_CSETJMP
# include <stl/_csetjmp.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x111) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <csetjmp>
# else
# include _STLP_NATIVE_CPP_C_HEADER(csetjmp)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x111 )
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_CSETJMP */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,47 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_CSIGNAL
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x112
# define _STLP_CSIGNAL
# include <stl/_prolog.h>
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x112)
# ifndef _STLP_INTERNAL_CSIGNAL
# include <stl/_csignal.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x112) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <csignal>
# else
# include _STLP_NATIVE_CPP_C_HEADER(csignal)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x112 )
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_CSIGNAL */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,47 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_CSTDARG
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x113
# define _STLP_CSTDARG
# include <stl/_prolog.h>
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x113)
# ifndef _STLP_INTERNAL_CSTDARG
# include <stl/_cstdarg.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x113) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <cstdarg>
# else
# include _STLP_NATIVE_CPP_C_HEADER(cstdarg)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x113 )
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_CSTDARG */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,47 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_CSTDDEF
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x114
# define _STLP_CSTDDEF
# include <stl/_prolog.h>
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x114)
# ifndef _STLP_INTERNAL_CSTDDEF
# include <stl/_cstddef.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x114) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <cstddef>
# else
# include _STLP_NATIVE_CPP_C_HEADER(cstddef)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x114 )
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_CSTDDEF */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,53 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_CSTDIO
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x15
# include <stl/_prolog.h>
#elif (_STLP_OUTERMOST_HEADER_ID == 0x15) && !defined (_STLP_DONT_POP_HEADER_ID)
# define _STLP_DONT_POP_HEADER_ID
# define _STLP_CSTDIO
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x15) && !defined (_STLP_DONT_POP_HEADER_ID)
# ifndef _STLP_INTERNAL_CSTDIO
# include <stl/_cstdio.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x15) || defined (_STLP_DONT_POP_HEADER_ID) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <cstdio>
# else
# include _STLP_NATIVE_CPP_C_HEADER(cstdio)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x15)
# if !defined (_STLP_DONT_POP_HEADER_ID)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# else
# undef _STLP_DONT_POP_HEADER_ID
# endif
#endif
#endif
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,54 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_CSTDLIB
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x116
# define _STLP_CSTDLIB
# include <stl/_prolog.h>
#endif
# if defined (__GNUC__) && defined (__MINGW32__)
/* Native cstdlib includes stdlib.h using an include_next so STLport stdlib.h
* is not used and the workaround in this file must be duplicated here
* (see stdlib.h). */
# include "errno.h"
# endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x116)
# ifndef _STLP_INTERNAL_CSTDLIB
# include <stl/_cstdlib.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x116) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <cstdlib>
# else
# include _STLP_NATIVE_CPP_C_HEADER(cstdlib)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x116)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_CSTDLIB */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,47 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_CSTRING
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x117
# define _STLP_CSTRING
# include <stl/_prolog.h>
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x117)
# ifndef _STLP_INTERNAL_CSTRING
# include <stl/_cstring.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x117) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <cstring>
# else
# include _STLP_NATIVE_CPP_C_HEADER(cstring)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x117)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_CSTRING */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,53 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_CTIME
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x118
# include <stl/_prolog.h>
#elif (_STLP_OUTERMOST_HEADER_ID == 0x118) && ! defined (_STLP_DONT_POP_HEADER_ID)
# define _STLP_DONT_POP_HEADER_ID
# define _STLP_CTIME
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x118) && !defined (_STLP_DONT_POP_HEADER_ID)
# ifndef _STLP_INTERNAL_CTIME
# include <stl/_ctime.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x118) || defined (_STLP_DONT_POP_HEADER_ID) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <ctime>
# else
# include _STLP_NATIVE_CPP_C_HEADER(ctime)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x118)
# if !defined (_STLP_DONT_POP_HEADER_ID)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# else
# undef _STLP_DONT_POP_HEADER_ID
# endif
#endif
#endif /* _STLP_CTIME */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,114 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_CTYPE_H
/* Workaround for a "misbehaviour" when compiling resource scripts using
* eMbedded Visual C++. The standard .rc file includes windows header files,
* which in turn include ctype.h, which results in warnings and errors
*/
#if !defined(RC_INVOKED)
# if !defined (_STLP_OUTERMOST_HEADER_ID)
# define _STLP_OUTERMOST_HEADER_ID 0x219
# include <stl/_prolog.h>
# elif (_STLP_OUTERMOST_HEADER_ID == 0x219)
# define _STLP_DONT_POP_HEADER_ID
# define _STLP_CTYPE_H
# endif
# if defined(_STLP_WCE_EVC3)
struct _exception;
# endif
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <ctype.h>
# else
# include _STLP_NATIVE_C_HEADER(ctype.h)
# endif
/* on evc4 including ctype.h also defines setjmp macro */
# if defined (_STLP_WCE)
# define _STLP_NATIVE_SETJMP_H_INCLUDED
# endif
# ifndef _STLP_CTYPE_H_SEEN
# define _STLP_CTYPE_H_SEEN
/* Undef convenience interfaces */
# undef isspace
# undef isprint
# undef iscntrl
# undef isupper
# undef islower
# undef isalpha
# undef isdigit
# undef ispunct
# undef isxdigit
# undef isalnum
# undef isgraph
# undef toupper
# undef tolower
# if defined (UNDER_CE)
# if (_WIN32_WCE < 300) /* Only wide chars for older versions */
# define _isctype iswctype
# endif
__inline int (isalpha)(int c) { return _isctype(c, _ALPHA); }
__inline int (isupper)(int c) { return _isctype(c, _UPPER); }
__inline int (islower)(int c) { return _isctype(c, _LOWER); }
__inline int (isdigit)(int c) { return _isctype(c, _DIGIT); }
__inline int (isxdigit)(int c) { return _isctype(c, _HEX); }
__inline int (isspace)(int c) { return _isctype(c, _SPACE); }
__inline int (ispunct)(int c) { return _isctype(c, _PUNCT); }
__inline int (isalnum)(int c) { return _isctype(c, _ALPHA|_DIGIT); }
__inline int (isprint)(int c) { return _isctype(c, _BLANK|_PUNCT|_ALPHA|_DIGIT); }
__inline int (isgraph)(int c) { return _isctype(c, _PUNCT|_ALPHA|_DIGIT); }
__inline int (iscntrl)(int c) { return _isctype(c, _CONTROL); }
__inline int (isascii)(int c) { return ((unsigned)(c) < 0x80); }
# undef _isctype
__inline int (iswalpha)(int c) { return iswctype((unsigned short)(c), _ALPHA); }
__inline int (iswupper)(int c) { return iswctype((unsigned short)(c), _UPPER); }
__inline int (iswlower)(int c) { return iswctype((unsigned short)(c), _LOWER); }
__inline int (iswdigit)(int c) { return iswctype((unsigned short)(c), _DIGIT); }
__inline int (iswxdigit)(int c) { return iswctype((unsigned short)(c), _HEX); }
__inline int (iswspace)(int c) { return iswctype((unsigned short)(c), _SPACE); }
__inline int (iswpunct)(int c) { return iswctype((unsigned short)(c), _PUNCT); }
__inline int (iswalnum)(int c) { return iswctype((unsigned short)(c), _ALPHA|_DIGIT); }
__inline int (iswprint)(int c) { return iswctype((unsigned short)(c), _BLANK|_PUNCT|_ALPHA|_DIGIT); }
__inline int (iswgraph)(int c) { return iswctype((unsigned short)(c), _PUNCT|_ALPHA|_DIGIT); }
__inline int (iswcntrl)(int c) { return iswctype((unsigned short)(c), _CONTROL); }
__inline int (iswascii)(int c) { return ((unsigned)(c) < 0x80); }
# endif /* UNDER_CE */
# endif /* _STLP_CTYPE_H_SEEN */
# if (_STLP_OUTERMOST_HEADER_ID == 0x219)
# if ! defined (_STLP_DONT_POP_HEADER_ID)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# else
# undef _STLP_DONT_POP_HEADER_ID
# endif
# endif
#endif /* RC_INVOKED */
#endif /* _STLP_CTYPE_H */

View file

@ -0,0 +1,48 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_CWCHAR
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x120
# define _STLP_CWCHAR
# include <stl/_prolog.h>
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x120)
# ifndef _STLP_INTERNAL_CWCHAR
# include <stl/_cwchar.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x120) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <cwchar>
# else
# include _STLP_NATIVE_CPP_C_HEADER(cwchar)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x120)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_CWCHAR */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,47 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_CWCTYPE
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x121
# define _STLP_CWCTYPE
# include <stl/_prolog.h>
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x121)
# ifndef _STLP_INTERNAL_CWCTYPE
# include <stl/_cwctype.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x121) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <cwctype>
# else
# include _STLP_NATIVE_CPP_C_HEADER(cwctype)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x121)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_CWCTYPE */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,57 @@
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1997
* Moscow Center for SPARC Technology
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_DEQUE
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x22
# include <stl/_prolog.h>
# define _STLP_DEQUE
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x22)
# ifndef _STLP_INTERNAL_DEQUE_H
# include <stl/_deque.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x22) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <deque>
# else
# include _STLP_NATIVE_HEADER(deque)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x22)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_DEQUE */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,71 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#if !defined (_STLP_OUTERMOST_HEADER_ID)
# define _STLP_OUTERMOST_HEADER_ID 0x205
# include <stl/_cprolog.h>
#elif (_STLP_OUTERMOST_HEADER_ID == 0x205) && !defined (_STLP_DONT_POP_HEADER_ID)
# define _STLP_DONT_POP_HEADER_ID
#endif
#ifdef _STLP_WCE
/* only show message when directly including this file in a non-library build */
# if !defined(__BUILDING_STLPORT) && (_STLP_OUTERMOST_HEADER_ID == 0x205)
# pragma message("eMbedded Visual C++ 3 and .NET don't have a errno.h header; STLport won't include native errno.h here")
# endif
#else
# ifndef errno
/* We define the following macro first to guaranty the header reentrancy: */
# define _STLP_NATIVE_ERRNO_H_INCLUDED
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <errno.h>
# else
# include _STLP_NATIVE_C_HEADER(errno.h)
# endif
# if defined (__BORLANDC__) && (__BORLANDC__ >= 0x590) && defined (__cplusplus)
_STLP_BEGIN_NAMESPACE
using _STLP_VENDOR_CSTD::__errno;
_STLP_END_NAMESPACE
# endif
# endif /* errno */
# if !defined (_STLP_NATIVE_ERRNO_H_INCLUDED)
/* If errno has been defined before inclusion of native errno.h including it from STLport errno.h
* becomes impossible because if:
* #define errno foo
* then
* #include _STLP_NATIVE_C_HEADER(errno.h)
* becomes:
* #include _STLP_NATIVE_C_HEADER(foo.h)
*
* To fix this problem you have to find where this definition comes from and include errno.h before it.
*/
# define errno foo
# error errno has been defined before inclusion of errno.h header.
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x205)
# if ! defined (_STLP_DONT_POP_HEADER_ID)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# endif
# undef _STLP_DONT_POP_HEADER_ID
#endif
/* Local Variables:
* mode: C
* End:
*/

View file

@ -0,0 +1,68 @@
/*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
// This header exists solely for portability. Normally it just includes
// the native header <exception>.
#ifndef _STLP_EXCEPTION
#if !defined (_STLP_OUTERMOST_HEADER_ID)
# define _STLP_OUTERMOST_HEADER_ID 0x423
# include <stl/_prolog.h>
#elif (_STLP_OUTERMOST_HEADER_ID == 0x423)
# define _STLP_DONT_POP_HEADER_ID
# define _STLP_EXCEPTION
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x423) && !defined (_STLP_DONT_POP_HEADER_ID)
# ifndef _STLP_INTERNAL_EXCEPTION
# include <stl/_exception.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x423) || defined (_STLP_DONT_POP_HEADER_ID) || defined (_STLP_IMPORT_VENDOR_STD)
/* If we are here it means that we are in an include called
* from the native lib which means that we can simply forward this
* call to the native exception header:
*/
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <exception>
# else
# if defined (__DMC__) && (_STLP_OUTERMOST_HEADER_ID == 0x874)
// Workaround to DMC harcoded typeinfo.h inclusion.
# include <../include/exception>
# else
# include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception)
# endif
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x423)
# if !defined(_STLP_DONT_POP_HEADER_ID)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# else
# undef _STLP_DONT_POP_HEADER_ID
# endif
#endif
#endif /* _STLP_EXCEPTION */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,43 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_OLDSTD_exception
#define _STLP_OLDSTD_exception
#if !defined (_STLP_OUTERMOST_HEADER_ID)
# define _STLP_OUTERMOST_HEADER_ID 0x824
# include <stl/_prolog.h>
#endif
#if defined (__BORLANDC__) || defined (_MSC_VER)
# include <exception>
#else
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <exception.h>
# else
# include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception.h)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x824)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_OLDSTD_exception */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,52 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#if !defined (_STLP_OUTERMOST_HEADER_ID)
# define _STLP_OUTERMOST_HEADER_ID 0x203
# include <stl/_cprolog.h>
#elif (_STLP_OUTERMOST_HEADER_ID == 0x203) && !defined (_STLP_DONT_POP_HEADER_ID)
# define _STLP_DONT_POP_HEADER_ID
#elif (_STLP_OUTERMOST_HEADER_ID == 0x203)
# error This header is only reentrant once, it should be modified if it has to be included more.
#endif
#if defined (_STLP_WCE_EVC3)
struct _exception;
#endif
#if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <float.h>
#else
# include _STLP_NATIVE_C_HEADER(float.h)
#endif
#if !defined (__linux__)
# if defined(__BORLANDC__) && defined (__cplusplus) && (__BORLANDC__ >= 0x560)
_STLP_BEGIN_NAMESPACE
using ::_max_dble;
using ::_max_flt;
using ::_max_ldble;
using ::_tiny_ldble;
_STLP_END_NAMESPACE
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x203)
# if ! defined (_STLP_DONT_POP_HEADER_ID)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# endif
# undef _STLP_DONT_POP_HEADER_ID
#endif

View file

@ -0,0 +1,66 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
// This header defines classes basic_filebuf, basic_ifstream,
// basic_ofstream, and basic_fstream. These classes represent
// streambufs and streams whose sources or destinations are files.
#ifndef _STLP_FSTREAM
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x1025
# include <stl/_prolog.h>
# define _STLP_FSTREAM
# if defined (__DMC__) && defined (_DLL)
# define _STLP_CLASS_IMPORT_DECLSPEC __declspec(dllimport)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x1025) && \
!(defined (_STLP_NO_IOSTREAMS) && defined (_STLP_IMPORT_VENDOR_STD))
# include <stl/_ioserr.h>
# ifndef _STLP_INTERNAL_FSTREAM_H
# include <stl/_fstream.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x1025) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <fstream>
# else
# include _STLP_NATIVE_HEADER(fstream)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x1025)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# if defined (__DMC__) && defined (_DLL)
# undef _STLP_CLASS_IMPORT_DECLSPEC
# define _STLP_CLASS_IMPORT_DECLSPEC
# endif
#endif
#endif /* _STLP_FSTREAM */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,42 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_FSTREAM_H
#define _STLP_FSTREAM_H
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x2026
# include <stl/_prolog.h>
#endif
#include <fstream>
// get desired pollution
#include <iostream.h>
#ifndef _STLP_HAS_NO_NAMESPACES
# include <using/fstream>
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x2026)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_FSTREAM_H */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,148 @@
/*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_FUNCTIONAL
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x27
# include <stl/_prolog.h>
# define _STLP_FUNCTIONAL
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x27)
# ifndef _STLP_INTERNAL_FUNCTION_H
# include <stl/_function.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x27) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <functional>
# else
# include _STLP_NATIVE_HEADER(functional)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x27)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#if !defined(_STLP_NO_EXTENSIONS) && defined(_STLP_USE_BOOST_SUPPORT)
#include <boost/ref.hpp>
#include <boost/utility/result_of.hpp>
#include <boost/bind/placeholders.hpp>
#include <boost/mem_fn.hpp>
#include <boost/bind.hpp>
namespace boost {
template<class T> class reference_wrapper;
template<class T> reference_wrapper<T> const ref(T &);
template<class T> inline reference_wrapper<T const> const cref(T const &);
template<typename F> struct result_of;
namespace _mfi {
template<class R, class T> class dm;
}
template<class R, class T> _mfi::dm<R, T> mem_fn(R T::*f);
} // namespace boost
_STLP_BEGIN_NAMESPACE
namespace tr1 {
using ::boost::reference_wrapper;
using ::boost::ref;
using ::boost::cref;
using ::boost::result_of;
using ::boost::mem_fn;
using ::boost::bind;
namespace placeholders {
using ::_1;
using ::_2;
using ::_3;
using ::_4;
using ::_5;
using ::_6;
using ::_7;
using ::_8;
using ::_9;
} // placeholders
} // namespace tr1
_STLP_END_NAMESPACE
#endif // !_STLP_NO_EXTENSIONS && _STLP_USE_BOOST_SUPPORT
#endif /* _STLP_FUNCTIONAL */
#if !defined(_STLP_FUNCTIONAL_FUN) && !defined(_STLP_NO_EXTENSIONS) && defined(_STLP_USE_BOOST_SUPPORT)
#ifndef BOOST_FUNCTION_NUM_ARGS // avoid recursive includes
// #ifdef BOOST_FUNCTION_BASE_HEADER
// #undef BOOST_FUNCTION_BASE_HEADER
// #endif
// #ifdef BOOST_FUNCTION_PROLOGUE_HPP
// #undef BOOST_FUNCTION_PROLOGUE_HPP
// #endif
#define _STLP_FUNCTIONAL_FUN
#ifndef BOOST_FUNCTION_BASE_HEADER // avoid recursive includes
# include <boost/function.hpp>
#else
namespace boost {
class bad_function_call;
template<typename Signature, typename Allocator >
class function;
template<typename Signature, typename Allocator>
void swap(function<Signature, Allocator>& f1, function<Signature, Allocator>& f2);
}
#endif
_STLP_BEGIN_NAMESPACE
namespace tr1 {
using ::boost::bad_function_call;
using ::boost::function;
using ::boost::swap;
} // namespace tr1
_STLP_END_NAMESPACE
#endif // !BOOST_FUNCTION_NUM_ARGS
#endif // !_STLP_FUNCTIONAL_REF && !_STLP_NO_EXTENSIONS && _STLP_USE_BOOST_SUPPORT
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,49 @@
/*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_HASH_MAP
#define _STLP_HASH_MAP
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x4028
# include <stl/_prolog.h>
#endif
#ifdef _STLP_PRAGMA_ONCE
# pragma once
#endif
#if defined (_STLP_NO_EXTENSIONS)
/* Comment following if you want to use hash constainers even if you ask for
* no extension.
*/
# error The hash_map and hash_multimap class are STLport extensions.
#endif
#include <stl/_hash_map.h>
#if (_STLP_OUTERMOST_HEADER_ID == 0x4028)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_HASH_MAP */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,49 @@
/*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_HASH_SET
#define _STLP_HASH_SET
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x4029
# include <stl/_prolog.h>
#endif
#ifdef _STLP_PRAGMA_ONCE
# pragma once
#endif
#if defined (_STLP_NO_EXTENSIONS)
/* Comment following if you want to use hash constainers even if you ask for
* no extension.
*/
# error The hash_set and hash_multiset class are STLport extensions.
#endif
#include <stl/_hash_set.h>
#if (_STLP_OUTERMOST_HEADER_ID == 0x4029)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_HASH_SET */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,53 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_IOMANIP
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x1030
# include <stl/_prolog.h>
# define _STLP_IOMANIP
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x1030) && \
!(defined (_STLP_NO_IOSTREAMS) && defined (_STLP_IMPORT_VENDOR_STD))
# include <stl/_ioserr.h>
# ifndef _STLP_INTERNAL_IOMANIP
# include <stl/_iomanip.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x1030) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <iomanip>
# else
# include _STLP_NATIVE_HEADER(iomanip)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x1030)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_IOMANIP */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,53 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_IOMANIP_H
#define _STLP_IOMANIP_H
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x2031
# include <stl/_prolog.h>
#endif
#include <stl/_ioserr.h>
#include <iomanip>
#ifndef _STLP_HAS_NO_NAMESPACES
# ifdef _STLP_BROKEN_USING_DIRECTIVE
_STLP_USING_NAMESPACE(stlport)
# else
using _STLP_STD::setiosflags;
using _STLP_STD::resetiosflags;
using _STLP_STD::setbase;
using _STLP_STD::setfill;
using _STLP_STD::setprecision;
using _STLP_STD::setw;
# endif
#endif /* _STLP_HAS_NO_NAMESPACES */
// get all the pollution we want
#include <iostream.h>
#if (_STLP_OUTERMOST_HEADER_ID == 0x2031)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_IOMANIP_H */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,53 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_IOS
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x1032
# include <stl/_prolog.h>
# define _STLP_IOS
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x1032) && \
!(defined (_STLP_NO_IOSTREAMS) && defined (_STLP_IMPORT_VENDOR_STD))
# include <stl/_ioserr.h>
# ifndef _STLP_INTERNAL_IOS_H
# include <stl/_ios.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x1032) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <ios>
# else
# include _STLP_NATIVE_HEADER(ios)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x1032)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_IOS */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,39 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_IOS_H
#define _STLP_IOS_H
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x1033
# include <stl/_prolog.h>
#endif
#include <ios>
#if defined (_STLP_USE_NAMESPACES)
# include <using/ios>
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x1033)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_IOS_H */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,53 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_IOSFWD
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x1034
# include <stl/_prolog.h>
# define _STLP_IOSFWD
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x1034) && \
!(defined (_STLP_NO_IOSTREAMS) && defined (_STLP_IMPORT_VENDOR_STD))
# include <stl/_ioserr.h>
# ifndef _STLP_INTERNAL_IOSFWD
# include <stl/_iosfwd.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x1034) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <iosfwd>
# else
# include _STLP_NATIVE_HEADER(iosfwd)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x1034)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_IOSFWD */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,104 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_IOSTREAM
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x1037
# include <stl/_prolog.h>
# define _STLP_IOSTREAM
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x1037) && \
!(defined (_STLP_NO_IOSTREAMS) && defined (_STLP_IMPORT_VENDOR_STD))
# include <stl/_ioserr.h>
# ifdef _STLP_REDIRECT_STDSTREAMS
// for ofstream redirection
# ifndef _STLP_INTERNAL_FSTREAM_H
# include <stl/_fstream.h>
# endif
# endif
# ifndef _STLP_INTERNAL_IOSFWD
# include <stl/_iosfwd.h>
# endif
# ifndef _STLP_INTERNAL_ISTREAM
# include <stl/_istream.h>
# endif
_STLP_BEGIN_NAMESPACE
# ifndef _STLP_USE_NAMESPACES
// in case of SGI iostreams, we have to rename our streams not to clash with those
// provided in native lib
# define cin _STLP_cin
# define cout _STLP_cout
# define cerr _STLP_cerr
# define clog _STLP_clog
# endif
// Note: cin and wcin are both associated with stdio. The C standard
// (Amendment 1, section 4.6.2.1) says that it is an error to mix
// wide- and narrow-oriented I/O on the same stream. This implies
// that it is an error to use both cin and wcin in the same C++
// program; the same applies to cout and wcout, and cerr/clog and
// wcerr/wclog.
extern _STLP_DECLSPEC istream cin;
# ifdef _STLP_REDIRECT_STDSTREAMS
extern _STLP_DECLSPEC ofstream cout;
extern _STLP_DECLSPEC ofstream cerr;
extern _STLP_DECLSPEC ofstream clog;
# else
extern _STLP_DECLSPEC ostream cout;
extern _STLP_DECLSPEC ostream cerr;
extern _STLP_DECLSPEC ostream clog;
# endif
# ifndef _STLP_NO_WCHAR_T
extern _STLP_DECLSPEC wistream wcin;
extern _STLP_DECLSPEC wostream wcout;
extern _STLP_DECLSPEC wostream wcerr;
extern _STLP_DECLSPEC wostream wclog;
# endif
_STLP_END_NAMESPACE
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x1037) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <iostream>
# else
# include _STLP_NATIVE_HEADER(iostream)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x1037)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_IOSTREAM */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,106 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_IOSTREAM_H
#define _STLP_IOSTREAM_H
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x2035
# include <stl/_prolog.h>
#endif
#include <iostream>
// Those should be included all separately, as they do contain using declarations
#include <streambuf.h>
#include <ostream.h>
#include <istream.h>
#ifndef _STLP_HAS_NO_NAMESPACES
# ifdef _STLP_BROKEN_USING_DIRECTIVE
_STLP_USING_NAMESPACE(stlport)
# else
using _STLP_STD::cin;
using _STLP_STD::cout;
using _STLP_STD::clog;
using _STLP_STD::cerr;
using _STLP_STD::iostream;
# ifndef _STLP_NO_WCHAR_T
using _STLP_STD::wcin;
using _STLP_STD::wcout;
using _STLP_STD::wclog;
using _STLP_STD::wcerr;
# endif
# endif
#endif /* _STLP_HAS_NO_NAMESPACES */
// Obsolete classes for old-style backwards compatibility
class istream_withassign : public istream {
public:
istream_withassign() : istream((streambuf*)0) {}
~istream_withassign() {}
istream_withassign& operator=(istream& __s) {
ios::init(__s.rdbuf());
return *this;
}
istream_withassign& operator=(streambuf* __s) {
ios::init(__s);
return *this;
}
};
class ostream_withassign : public ostream {
public:
ostream_withassign() : ostream((streambuf*)0) {}
~ostream_withassign() {}
ostream_withassign& operator=(ostream& __s) {
ios::init(__s.rdbuf());
return *this;
}
ostream_withassign& operator=(streambuf* __s) {
ios::init(__s);
return *this;
}
};
class iostream_withassign : public iostream {
public:
iostream_withassign() : iostream((streambuf*)0) {}
~iostream_withassign() {}
iostream_withassign & operator=(ios& __i) {
ios::init(__i.rdbuf());
return *this;
}
iostream_withassign & operator=(streambuf* __s) {
ios::init(__s);
return *this;
}
} ;
#if (_STLP_OUTERMOST_HEADER_ID == 0x2035)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_IOSTREAM_H */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,39 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#if !defined (_STLP_OUTERMOST_HEADER_ID)
# define _STLP_OUTERMOST_HEADER_ID 0x204
# include <stl/_cprolog.h>
#elif (_STLP_OUTERMOST_HEADER_ID == 0x204) && !defined (_STLP_DONT_POP_HEADER_ID)
# define _STLP_DONT_POP_HEADER_ID
#endif
/* evc3 doesn't have iso646.h */
#if !defined (_STLP_WCE_EVC3) && !defined (__BORLANDC__)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <iso646.h>
# else
# include _STLP_NATIVE_C_HEADER(iso646.h)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x204)
# if ! defined (_STLP_DONT_POP_HEADER_ID)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# endif
# undef _STLP_DONT_POP_HEADER_ID
#endif

View file

@ -0,0 +1,53 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_ISTREAM
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x1036
# include <stl/_prolog.h>
# define _STLP_ISTREAM
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x1036) && \
!(defined (_STLP_NO_IOSTREAMS) && defined (_STLP_IMPORT_VENDOR_STD))
# include <stl/_ioserr.h>
# ifndef _STLP_INTERNAL_ISTREAM
# include <stl/_istream.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x1036) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <istream>
# else
# include _STLP_NATIVE_HEADER(istream)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x1036)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_ISTREAM */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,50 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_ISTREAM_H
#define _STLP_ISTREAM_H
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x2037
# include <stl/_prolog.h>
#endif
#include <stl/_ioserr.h>
#include <istream>
#ifndef _STLP_HAS_NO_NAMESPACES
# ifdef _STLP_BROKEN_USING_DIRECTIVE
_STLP_USING_NAMESPACE(stlport)
# else
using _STLP_STD::basic_istream;
using _STLP_STD::basic_iostream;
using _STLP_STD::istream;
using _STLP_STD::iostream;
using _STLP_STD::ios;
# ifndef _STLP_NO_WCHAR_T
using _STLP_STD::wistream;
using _STLP_STD::wiostream;
# endif
using _STLP_STD::ws;
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x2037)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_ISTREAM_H */

View file

@ -0,0 +1,61 @@
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1997
* Moscow Center for SPARC Technology
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_ITERATOR
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x38
# include <stl/_prolog.h>
# define _STLP_ITERATOR
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x38)
# ifndef _STLP_INTERNAL_ITERATOR_H
# include <stl/_iterator.h>
# endif
# ifndef _STLP_INTERNAL_STREAM_ITERATOR_H
# include <stl/_stream_iterator.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x38) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <iterator>
# else
# include _STLP_NATIVE_HEADER(iterator)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x38)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_ITERATOR */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,50 @@
/*
* Copyright (c) 1997
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_LIMITS
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x39
# include <stl/_prolog.h>
# define _STLP_LIMITS
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x39)
# ifndef _STLP_INTERNAL_LIMITS
# include <stl/_limits.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x39) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <limits>
# else
# include _STLP_NATIVE_HEADER(limits)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x39)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_LIMITS */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,39 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#if !defined (_STLP_OUTERMOST_HEADER_ID)
# define _STLP_OUTERMOST_HEADER_ID 0x201
# include <stl/_cprolog.h>
#elif (_STLP_OUTERMOST_HEADER_ID == 0x201) && ! defined (_STLP_DONT_POP_HEADER_ID)
# define _STLP_DONT_POP_HEADER_ID
#endif
#if defined(_STLP_WCE_EVC3)
struct _exception;
#endif
#if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <limits.h>
#else
# include _STLP_NATIVE_C_HEADER(limits.h)
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x201)
# if ! defined (_STLP_DONT_POP_HEADER_ID)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# endif
# undef _STLP_DONT_POP_HEADER_ID
#endif

View file

@ -0,0 +1,57 @@
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1997
* Moscow Center for SPARC Technology
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_LIST
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x40
# include <stl/_prolog.h>
# define _STLP_LIST
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x40)
# ifndef _STLP_INTERNAL_LIST_H
# include <stl/_list.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x40) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <list>
# else
# include _STLP_NATIVE_HEADER(list)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x40)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_LIST */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,156 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_LOCALE
// Basic framework: class locale and class locale::facet
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x1041
# include <stl/_prolog.h>
# define _STLP_LOCALE
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x1041) && \
!(defined (_STLP_NO_IOSTREAMS) && defined (_STLP_IMPORT_VENDOR_STD))
# include <stl/_ioserr.h>
// Individual facets
# ifndef _STLP_INTERNAL_CTYPE_H
# include <stl/_ctype.h>
# endif
# ifndef _STLP_INTERNAL_CODECVT_H
# include <stl/_codecvt.h>
# endif
# ifndef _STLP_INTERNAL_COLLATE_H
# include <stl/_collate.h>
# endif
# ifndef _STLP_INTERNAL_NUM_PUT_H
# include <stl/_num_put.h>
# endif
# ifndef _STLP_INTERNAL_NUM_GET_H
# include <stl/_num_get.h>
# endif
// those never included separately anyway
# include <stl/_monetary.h>
# include <stl/_time_facets.h>
# include <stl/_messages_facets.h>
// some stuff for streambuf iterators ended up defined there
// Strictly speaking, _istream.h portion is only required for <iterator>, but it may break too many
// programs if we omit it
# ifndef _STLP_ISTREAM_H
# include <stl/_istream.h>
# endif
// Convenience interfaces
#undef isspace
#undef isprint
#undef iscntrl
#undef isupper
#undef islower
#undef isalpha
#undef isdigit
#undef ispunct
#undef isxdigit
#undef isalnum
#undef isgraph
#undef toupper
#undef tolower
_STLP_BEGIN_NAMESPACE
template <class _CharT>
inline bool isspace (_CharT c, const locale& loc)
{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::space, c); }
template <class _CharT>
inline bool isprint (_CharT c, const locale& loc)
{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::print, c); }
template <class _CharT>
inline bool iscntrl (_CharT c, const locale& loc)
{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::cntrl, c); }
template <class _CharT>
inline bool isupper (_CharT c, const locale& loc)
{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::upper, c); }
template <class _CharT>
inline bool islower (_CharT c, const locale& loc)
{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::lower, c); }
template <class _CharT>
inline bool isalpha (_CharT c, const locale& loc)
{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::alpha, c); }
template <class _CharT>
inline bool isdigit (_CharT c, const locale& loc)
{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::digit, c); }
template <class _CharT>
inline bool ispunct (_CharT c, const locale& loc)
{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::punct, c); }
template <class _CharT>
inline bool isxdigit (_CharT c, const locale& loc)
{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::xdigit, c); }
template <class _CharT>
inline bool isalnum (_CharT c, const locale& loc)
{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::alnum, c); }
template <class _CharT>
inline bool isgraph (_CharT c, const locale& loc)
{ return (use_facet<ctype<_CharT> >(loc)).is(ctype_base::graph, c); }
template <class _CharT>
inline _CharT toupper(_CharT c, const locale& loc)
{ return (use_facet<ctype<_CharT> >(loc)).toupper(c); }
template <class _CharT>
inline _CharT tolower(_CharT c, const locale& loc)
{ return (use_facet<ctype<_CharT> >(loc)).tolower(c); }
_STLP_END_NAMESPACE
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x1041) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <locale>
# else
# include _STLP_NATIVE_HEADER(locale)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x1041)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_LOCALE */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,43 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#if !defined (_STLP_OUTERMOST_HEADER_ID)
# define _STLP_OUTERMOST_HEADER_ID 0x242
# include <stl/_cprolog.h>
#elif (_STLP_OUTERMOST_HEADER_ID == 0x242)
# if !defined (_STLP_DONT_POP_HEADER_ID)
# define _STLP_DONT_POP_HEADER_ID
# else
# error STLport include schema violation
# endif
#endif
/* evc3 doesn't have locale.h */
#ifndef _STLP_WCE_EVC3
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <locale.h>
# else
# include _STLP_NATIVE_C_HEADER(locale.h)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x242)
# if !defined (_STLP_DONT_POP_HEADER_ID)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# else
# undef _STLP_DONT_POP_HEADER_ID
# endif
#endif

View file

@ -0,0 +1,57 @@
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1997
* Moscow Center for SPARC Technology
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_MAP
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x43
# include <stl/_prolog.h>
# define _STLP_MAP
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x43)
# ifndef _STLP_INTERNAL_MAP_H
# include <stl/_map.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x43) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <map>
# else
# include _STLP_NATIVE_HEADER(map)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x43)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_MAP */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,53 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#if !defined (_STLP_OUTERMOST_HEADER_ID)
# define _STLP_OUTERMOST_HEADER_ID 0x244
# include <stl/_cprolog.h>
#elif (_STLP_OUTERMOST_HEADER_ID == 0x244) && !defined (_STLP_DONT_POP_HEADER_ID)
# define _STLP_DONT_POP_HEADER_ID
#endif
#if !defined (exception) && (!defined (__KCC) || (__KCC_VERSION < 4000)) && \
!(defined(__IBMCPP__) && (500 <= __IBMCPP__)) && !defined(_STLP_WCE_EVC3)
# define _STLP_EXCEPTION_WAS_REDEFINED 1
# define exception __math_exception
#endif
#if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <math.h>
#else
# include _STLP_NATIVE_C_HEADER(math.h)
#endif
#if defined (_STLP_EXCEPTION_WAS_REDEFINED)
# undef exception
# undef _STLP_EXCEPTION_WAS_REDEFINED
#endif
#ifdef _STLP_WCE_EVC3
# undef _exception
# define _exception exception
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x244)
# if ! defined (_STLP_DONT_POP_HEADER_ID)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# else
# undef _STLP_DONT_POP_HEADER_ID
# endif
#endif

View file

@ -0,0 +1,58 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_mem_h
#if !defined (_STLP_OUTERMOST_HEADER_ID)
# define _STLP_OUTERMOST_HEADER_ID 0x245
# include <stl/_cprolog.h>
#elif (_STLP_OUTERMOST_HEADER_ID == 0x245) && !defined (_STLP_DONT_POP_HEADER_ID)
# define _STLP_DONT_POP_HEADER_ID
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x245) || defined (_STLP_DONT_POP_HEADER_ID)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <mem.h>
# else
# include _STLP_NATIVE_C_HEADER(mem.h)
# endif
#else
# if defined (__BORLANDC__) && defined (__USING_CNAME__)
# define _USING_CNAME_WAS_UNDEFINED
# undef __USING_CNAME__
# endif
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <mem.h>
# else
# include _STLP_NATIVE_C_HEADER(mem.h)
# endif
# if defined (__BORLANDC__) && defined (_USING_CNAME_WAS_UNDEFINED)
# define __USING_CNAME__
# define _STLP_mem_h 1
# undef _USING_CNAME_WAS_UNDEFINED
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x245)
# if !defined (_STLP_DONT_POP_HEADER_ID)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# endif
# undef _STLP_DONT_POP_HEADER_ID
#endif
#endif /* _STLP_mem_h */

View file

@ -0,0 +1,130 @@
/*
* Copyright (c) 1997-1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_MEMORY
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x46
# include <stl/_prolog.h>
# define _STLP_MEMORY
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x46)
# ifndef _STLP_INTERNAL_ALLOC_H
# include <stl/_alloc.h>
# endif
# ifndef _STLP_INTERNAL_TEMPBUF_H
# include <stl/_tempbuf.h>
# endif
# ifndef _STLP_INTERNAL_RAW_STORAGE_ITER_H
# include <stl/_raw_storage_iter.h>
# endif
# include <stl/_auto_ptr.h>
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x46) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (__MSL__)
# include _STLP_NATIVE_HEADER(limits)
# endif
# if !defined(_STLP_NO_EXTENSIONS) && defined(_STLP_USE_BOOST_SUPPORT)
# define BOOST_TR1_MEMORY_INCLUDED
# define BOOST_TR1_FULL_MEMORY_INCLUDED
# endif
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <memory>
# else
# include _STLP_NATIVE_HEADER(memory)
# endif
# if defined (__MSL__) && (__MSL__ >= 0x2405 && __MSL__ < 0x5201)
/* 980401 vss MSL 2.4 Pro 3 Release */
# include <new_mem.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x46)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#if !defined(_STLP_NO_EXTENSIONS) && defined(_STLP_USE_BOOST_SUPPORT)
namespace boost {
class bad_weak_ptr;
template<class T> class shared_ptr;
template<class T> class weak_ptr;
template<class T> class enable_shared_from_this;
template<class D, class T> D * get_deleter(shared_ptr<T> const & p);
template<class T, class U> shared_ptr<T> static_pointer_cast(shared_ptr<U> const & r);
template<class T, class U> shared_ptr<T> const_pointer_cast(shared_ptr<U> const & r);
template<class T, class U> shared_ptr<T> dynamic_pointer_cast(shared_ptr<U> const & r);
template<class T> void swap(weak_ptr<T> & a, weak_ptr<T> & b);
template<class T> void swap(shared_ptr<T> & a, shared_ptr<T> & b);
namespace detail{
class shared_count;
class weak_count;
}
} // namespace boost
# ifndef BOOST_SHARED_PTR_HPP_INCLUDED
# include <boost/shared_ptr.hpp>
# endif
# ifndef BOOST_WEAK_PTR_HPP_INCLUDED
# include <boost/weak_ptr.hpp>
# endif
# ifndef BOOST_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED
# include <boost/enable_shared_from_this.hpp>
# endif
_STLP_BEGIN_NAMESPACE
namespace tr1 {
using ::boost::bad_weak_ptr;
using ::boost::shared_ptr;
using ::boost::swap;
using ::boost::static_pointer_cast;
using ::boost::dynamic_pointer_cast;
using ::boost::const_pointer_cast;
using ::boost::get_deleter;
using ::boost::weak_ptr;
using ::boost::enable_shared_from_this;
// shared_ptr IO
// weak_ptr IO
} // namespace tr1
_STLP_END_NAMESPACE
#endif /* !_STLP_NO_EXTENSIONS && _STLP_USE_BOOST_SUPPORT */
#endif /* _STLP_MEMORY */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,47 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_NEW_HEADER
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x447
# define _STLP_NEW_HEADER
# include <stl/_prolog.h>
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x447)
# ifndef _STLP_NEW_H_HEADER
# include <stl/_new.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x447) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <new>
# else
# include _STLP_NATIVE_CPP_RUNTIME_HEADER(new)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x447)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_NEW */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,50 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#if !defined (_STLP_OUTERMOST_HEADER_ID)
# define _STLP_OUTERMOST_HEADER_ID 0x848
# include <stl/_prolog.h>
#elif (_STLP_OUTERMOST_HEADER_ID == 0x848) && ! defined (_STLP_DONT_POP_HEADER_ID)
# define _STLP_DONT_POP_HEADER_ID
#endif
#if !defined(_STLP_NO_NEW_HEADER)
# if defined (__BORLANDC__)
# include <new>
# elif defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <new.h>
# elif defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800 && !defined(_MSC_VER))
# include _STLP_NATIVE_OLD_STREAMS_HEADER(new.h)
# else
# if defined (__GNUC__) && (__GNUC__ >= 3)
# include _STLP_NATIVE_OLD_STREAMS_HEADER(new.h)
# else
# include _STLP_NATIVE_CPP_RUNTIME_HEADER(new.h)
# endif
# endif
#endif /* !defined(_STLP_NO_NEW_HEADER) */
#if (_STLP_OUTERMOST_HEADER_ID == 0x848)
# if ! defined (_STLP_DONT_POP_HEADER_ID)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# else
# undef _STLP_DONT_POP_HEADER_ID
# endif
#endif
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,54 @@
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_NUMERIC
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x49
# include <stl/_prolog.h>
# define _STLP_NUMERIC
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x49)
# ifndef _STLP_INTERNAL_NUMERIC_H
# include <stl/_numeric.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x49) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <numeric>
# else
# include _STLP_NATIVE_HEADER(numeric)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x49)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_NUMERIC */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,52 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_OSTREAM
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x1050
# include <stl/_prolog.h>
# define _STLP_OSTREAM
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x1050) && \
!(defined (_STLP_NO_IOSTREAMS) && defined (_STLP_IMPORT_VENDOR_STD))
# include <stl/_ioserr.h>
# ifndef _STLP_INTERNAL_OSTREAM
# include <stl/_ostream.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x1050) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <ostream>
# else
# include _STLP_NATIVE_HEADER(ostream)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x1050)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_OSTREAM */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,37 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_OSTREAM_H
#define _STLP_OSTREAM_H
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x2051
# include <stl/_prolog.h>
#endif
#include <stl/_ioserr.h>
#include <ostream>
#ifdef _STLP_USE_NAMESPACES
# include <using/ostream>
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x2051)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_OSTREAM_H */

View file

@ -0,0 +1,46 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#if !defined (_STLP_OUTERMOST_HEADER_ID)
# define _STLP_OUTERMOST_HEADER_ID 0x280
# include <stl/_prolog.h>
#elif (_STLP_OUTERMOST_HEADER_ID == 0x280) && ! defined (_STLP_DONT_POP_HEADER_ID)
# define _STLP_DONT_POP_HEADER_ID
#endif
#if defined (__SUNPRO_CC) || defined (__HP_aCC)
# include "/usr/include/pthread.h"
#else
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <pthread.h>
# else
# include _STLP_NATIVE_C_HEADER(pthread.h)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x280)
# if !defined (_STLP_DONT_POP_HEADER_ID)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# else
# undef _STLP_DONT_POP_HEADER_ID
# endif
#endif
/*
Local Variables:
mode:C++
End:
*/

View file

@ -0,0 +1,49 @@
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1997
* Moscow Center for SPARC Technology
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_PTHREAD_ALLOC
#define _STLP_PTHREAD_ALLOC
# ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x52
# include <stl/_prolog.h>
# endif
# ifdef _STLP_PRAGMA_ONCE
# pragma once
# endif
# include <stl/_pthread_alloc.h>
# if (_STLP_OUTERMOST_HEADER_ID == 0x52)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# endif
#endif /* _STLP_PTHREAD_ALLOC */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,57 @@
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1997
* Moscow Center for SPARC Technology
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_QUEUE
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x53
# include <stl/_prolog.h>
# define _STLP_QUEUE
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x53)
# ifndef _STLP_INTERNAL_QUEUE_H
# include <stl/_queue.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x53) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <queue>
# else
# include _STLP_NATIVE_HEADER(queue)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x53)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_QUEUE */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,11 @@
#ifndef _STLP_misc_rlocks_h
# define _STLP_misc_rlocks_h
# if (__SUNPRO_CC >= 0x500 )
# include <../CCios/rlocks.h>
# elif defined (__SUNPRO_CC)
# include <../CC/rlocks.h>
# else
# error "This file is for SUN CC only. Please remove it if it causes any harm for other compilers."
# endif
#endif

View file

@ -0,0 +1,44 @@
/*
* 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 _STLP_ROPE
#define _STLP_ROPE
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x54
# include <stl/_prolog.h>
#endif
#ifdef _STLP_PRAGMA_ONCE
# pragma once
#endif
#if defined (_STLP_NO_EXTENSIONS)
/* Comment following if you want to use rope class even if you ask for
* no extension.
*/
# error The rope class is a STLport extension.
#endif
#include <stl/_rope.h>
#if (_STLP_OUTERMOST_HEADER_ID == 0x54)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_ROPE */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,57 @@
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1997
* Moscow Center for SPARC Technology
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_SET
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x55
# include <stl/_prolog.h>
# define _STLP_SET
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x55)
# ifndef _STLP_INTERNAL_SET_H
# include <stl/_set.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x55) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <set>
# else
# include _STLP_NATIVE_HEADER(set)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x55)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_SET */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,52 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_SETJMP_H
#if !defined (_STLP_OUTERMOST_HEADER_ID)
# define _STLP_OUTERMOST_HEADER_ID 0x256
# include <stl/_cprolog.h>
#elif (_STLP_OUTERMOST_HEADER_ID == 0x256) && !defined (_STLP_DONT_POP_HEADER_ID)
# define _STLP_DONT_POP_HEADER_ID
# define _STLP_SETJMP_H
#endif
#if defined(_STLP_WCE_EVC3)
struct _exception;
#endif
#if !defined (setjmp)
# define _STLP_NATIVE_SETJMP_H_INCLUDED
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <setjmp.h>
# else
# include _STLP_NATIVE_C_HEADER(setjmp.h)
# endif
#endif
#if !defined (_STLP_NATIVE_SETJMP_H_INCLUDED)
/* See errno.h file for a description of this problem. */
# error setjmp has been defined before inclusion of setjmp.h header.
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x256)
# if ! defined (_STLP_DONT_POP_HEADER_ID)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# else
# undef _STLP_DONT_POP_HEADER_ID
# endif
#endif
#endif /* _STLP_SETJMP_H */

View file

@ -0,0 +1,39 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#if !defined (_STLP_OUTERMOST_HEADER_ID)
# define _STLP_OUTERMOST_HEADER_ID 0x257
# include <stl/_cprolog.h>
#elif (_STLP_OUTERMOST_HEADER_ID == 0x257) && ! defined (_STLP_DONT_POP_HEADER_ID)
# define _STLP_DONT_POP_HEADER_ID
#endif
/* evc3 and evc4 don't have signal.h */
#ifndef _STLP_WCE
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <signal.h>
# else
# include _STLP_NATIVE_C_HEADER(signal.h)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x257)
# if ! defined (_STLP_DONT_POP_HEADER_ID)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# endif
# undef _STLP_DONT_POP_HEADER_ID
#endif

View file

@ -0,0 +1,54 @@
/*
* 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 _STLP_SLIST
#define _STLP_SLIST
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x58
# include <stl/_prolog.h>
#endif
#ifdef _STLP_PRAGMA_ONCE
# pragma once
#endif
#if defined (_STLP_NO_EXTENSIONS)
/* Comment following if you want to use the slist constainer even if you ask for
* no extension.
*/
# error The slist class is an STLport extension.
#endif
#ifndef _STLP_INTERNAL_SLIST_H
# include <stl/_slist.h>
#endif
#if defined (_STLP_IMPORT_VENDOR_STD)
//This is not a Standard header, it might failed for most of
//the compilers so we comment it for the moment. Should be uncommented
//on a compiler basis.
//# include _STLP_NATIVE_HEADER(slist)
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x58)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_SLIST */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,57 @@
/*
* Copyright (c) 1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
// This header defines classes basic_stringbuf, basic_istringstream,
// basic_ostringstream, and basic_stringstream. These classes
// represent streamsbufs and streams whose sources or destinations are
// C++ strings.
#ifndef _STLP_SSTREAM
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x1059
# include <stl/_prolog.h>
# define _STLP_SSTREAM
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x1059) && \
!(defined (_STLP_NO_IOSTREAMS) && defined (_STLP_IMPORT_VENDOR_STD))
# include <stl/_ioserr.h>
# ifndef _STLP_INTERNAL_SSTREAM
# include <stl/_sstream.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x1059) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <sstream>
# else
# include _STLP_NATIVE_HEADER(sstream)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x1059)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_SSTREAM */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,57 @@
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1997
* Moscow Center for SPARC Technology
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_STACK
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x60
# include <stl/_prolog.h>
# define _STLP_STACK
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x60)
# ifndef _STLP_INTERNAL_STACK_H
# include <stl/_stack.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x60) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <stack>
# else
# include _STLP_NATIVE_HEADER(stack)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x60)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
#endif
#endif /* _STLP_STACK */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,47 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
/* Workaround for a "misbehaviour" when compiling resource scripts using
* eMbedded Visual C++. The standard .rc file includes windows header files,
* which in turn include stdarg.h, which results in warnings and errors
*/
#if !defined (RC_INVOKED)
# if !defined (_STLP_OUTERMOST_HEADER_ID)
# define _STLP_OUTERMOST_HEADER_ID 0x261
# include <stl/_cprolog.h>
# elif (_STLP_OUTERMOST_HEADER_ID == 0x261) && !defined (_STLP_DONT_POP_HEADER_ID)
# define _STLP_DONT_POP_HEADER_ID
# endif
# if defined(_STLP_WCE_EVC3)
struct _exception;
# endif
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <stdarg.h>
# else
# include _STLP_NATIVE_C_HEADER(stdarg.h)
# endif
# if (_STLP_OUTERMOST_HEADER_ID == 0x261)
# if !defined (_STLP_DONT_POP_HEADER_ID)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# else
# undef _STLP_DONT_POP_HEADER_ID
# endif
# endif
#endif /* RC_INVOKED */

View file

@ -0,0 +1,44 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x262
# include <stl/_cprolog.h>
#elif (_STLP_OUTERMOST_HEADER_ID == 0x262) && ! defined (_STLP_DONT_POP_HEADER_ID)
# define _STLP_DONT_POP_HEADER_ID
#endif
#if defined (_MSC_VER) || defined (__DMC__)
/* Native stddef.h contains errno macro definition making inclusion of native
* errno.h in STLport errno.h impossible. We are then forced to include errno.h
* first.
*/
# include "errno.h"
#endif
#if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <stddef.h>
#else
# include _STLP_NATIVE_C_HEADER(stddef.h)
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x262)
# if ! defined (_STLP_DONT_POP_HEADER_ID)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# else
# undef _STLP_DONT_POP_HEADER_ID
# endif
#endif

View file

@ -0,0 +1,56 @@
/*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_STDEXCEPT
#if !defined (_STLP_OUTERMOST_HEADER_ID)
# define _STLP_OUTERMOST_HEADER_ID 0x63
# include <stl/_prolog.h>
#elif (_STLP_OUTERMOST_HEADER_ID == 0x63) && !defined (_STLP_DONT_POP_HEADER_ID)
# define _STLP_DONT_POP_HEADER_ID
# define _STLP_STDEXCEPT
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x63)
# ifndef _STLP_INTERNAL_STDEXCEPT
# include <stl/_stdexcept.h>
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID != 0x63) || defined (_STLP_IMPORT_VENDOR_STD)
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <stdexcept>
# else
# include _STLP_NATIVE_HEADER(stdexcept)
# endif
#endif
#if (_STLP_OUTERMOST_HEADER_ID == 0x63)
# if !defined (_STLP_DONT_POP_HEADER_ID)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# else
# undef _STLP_DONT_POP_HEADER_ID
# endif
#endif
#endif /* _STLP_STDEXCEPT */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,57 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
/* Workaround for a "misbehaviour" when compiling resource scripts using
* eMbedded Visual C++. The standard .rc file includes windows header files,
* which in turn include stdarg.h, which results in warnings and errors
*/
#if !defined(RC_INVOKED)
# ifndef _STLP_OUTERMOST_HEADER_ID
# define _STLP_OUTERMOST_HEADER_ID 0x264
# include <stl/_cprolog.h>
# elif (_STLP_OUTERMOST_HEADER_ID == 0x264) && !defined (_STLP_DONT_POP_HEADER_ID)
# define _STLP_DONT_POP_HEADER_ID
# endif
# if defined(_STLP_WCE_EVC3)
struct _exception;
# endif
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <stdio.h>
# else
# include _STLP_NATIVE_C_HEADER(stdio.h)
# endif
# if defined (__SUNPRO_CC) && !defined (_STRUCT_FILE)
# define _STRUCT_FILE
# endif
# if defined (__BORLANDC__) && defined (__cplusplus) && !defined (__linux__)
_STLP_BEGIN_NAMESPACE
using __std_alias::_streams;
_STLP_END_NAMESPACE
# endif
# if (_STLP_OUTERMOST_HEADER_ID == 0x264)
# if !defined (_STLP_DONT_POP_HEADER_ID)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# else
# undef _STLP_DONT_POP_HEADER_ID
# endif
# endif
#endif /* RC_INVOKED */

View file

@ -0,0 +1,10 @@
#ifndef _STLP_misc_stdiostream_h
# define _STLP_misc_stdiostream_h
# if (__SUNPRO_CC >= 0x500 )
# include <../CCios/stdiostream.h>
# else if defined (__SUNPRO_CC)
# include <../CC/stdiostream.h>
# else
# error "This file is for SUN CC only. Please remove it if it causes any harm for other compilers."
# endif
#endif

View file

@ -0,0 +1,67 @@
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
/* Workaround for a "misbehaviour" when compiling resource scripts using
* eMbedded Visual C++. The standard .rc file includes windows header files,
* which in turn include stdlib.h, which results in warnings and errors
*/
#if !defined (RC_INVOKED)
# if !defined (_STLP_OUTERMOST_HEADER_ID)
# define _STLP_OUTERMOST_HEADER_ID 0x265
# include <stl/_cprolog.h>
# elif (_STLP_OUTERMOST_HEADER_ID == 0x265) && !defined (_STLP_DONT_POP_HEADER_ID)
# define _STLP_DONT_POP_HEADER_ID
# endif
# if defined (_STLP_MSVC_LIB) || (defined (__GNUC__) && defined (__MINGW32__)) || \
defined (__BORLANDC__) || defined (__DMC__) || \
(defined (__HP_aCC) && defined (_REENTRANT))
/* Native stdlib.h contains errno macro definition making inclusion of native
* errno.h in STLport errno.h impossible. We are then forced to include errno.h
* first.
*/
# include "errno.h"
# endif
/*
forward-declaration for _exception struct; prevents warning message
../include/stdlib.h(817) : warning C4115: '_exception' : named type definition in parentheses
*/
# if defined(_STLP_WCE_EVC3)
struct _exception;
# endif
# if defined (_STLP_HAS_INCLUDE_NEXT)
# include_next <stdlib.h>
# else
# include _STLP_NATIVE_C_HEADER(stdlib.h)
# endif
/* on evc3/evc4 including stdlib.h also defines setjmp macro */
# if defined (_STLP_WCE)
# define _STLP_NATIVE_SETJMP_H_INCLUDED
# endif
# if (_STLP_OUTERMOST_HEADER_ID == 0x265)
# if ! defined (_STLP_DONT_POP_HEADER_ID)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# else
# undef _STLP_DONT_POP_HEADER_ID
# endif
# endif
#endif /* RC_INVOKED */

View file

@ -0,0 +1,77 @@
/*
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
/* NOTE: This is an internal header file, included by other STL headers.
* You should not attempt to use it directly.
*/
#ifndef _STLP_INTERNAL_ABBREVS_H
# define _STLP_INTERNAL_ABBREVS_H
// ugliness is intentional - to reduce conflicts
# define input_iterator_tag _In__ItT
# define output_iterator_tag _Ou__ItT
# define bidirectional_iterator_tag _Bd__ItT
# define random_access_iterator_tag _Ra__ItT
# define input_iterator _In__It
# define output_iterator _Ou__It
# define bidirectional_iterator _Bd__It
# define random_access_iterator _Ra__It
# define reverse_bidirectional_iterator _rBd__It
# define reverse_iterator _r__It
# define back_insert_iterator _bI__It
# define front_insert_iterator _fI__It
# define raw_storage_iterator _rS__It
# define _Const_traits _C_Tr
# define _Const_Const_traits _CC_Tr
# define _Nonconst_traits _N_Tr
# define _Nonconst_Const_traits _NC_Tr
// ugliness is intentional - to reduce conflicts probability
# define __malloc_alloc M__A
# define __node_alloc D__A
# define __new_alloc N__A
# define __debug_alloc G__A
# define _STLP_alloc_proxy P__A
# define _Deque_iterator_base _Dq__ItB
# define _Deque_iterator _Dq__It
# define _Select1st _S1st
# define _Select2nd _S2nd
# define __move_source __m_s
# define _Vector_nonconst_traits _V_nct
# define _Ht_iterator _Ht_It
# define _List_node_base _L__NB
# define _List_iterator_base _L__ItB
# define _List_iterator _L__It
# define _Slist_iterator_base _SL__ItB
# define _Slist_iterator _SL__It
# define _Rb_tree_node_base _rbT__NB
# define _Rb_tree_node _rbT__N
# define _Rb_tree_base_iterator _rbT__It
# define _Rb_tree_base _rbT__B
# if defined (__DMC__) && defined (_STLP_DEBUG)
# define _NonDbg_hashtable _Nd_Ht
# define _DBG_iter _d__It
# endif
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,745 @@
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1997
* Moscow Center for SPARC Technology
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
/* NOTE: This is an internal header file, included by other STL headers.
* You should not attempt to use it directly.
*/
#ifndef _STLP_INTERNAL_ALGO_H
#define _STLP_INTERNAL_ALGO_H
#ifndef _STLP_INTERNAL_ALGOBASE_H
# include <stl/_algobase.h>
#endif
#ifndef _STLP_INTERNAL_HEAP_H
# include <stl/_heap.h>
#endif
#ifndef _STLP_INTERNAL_ITERATOR_H
# include <stl/_iterator.h>
#endif
#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
# include <stl/_function_base.h>
#endif
#if defined (__SUNPRO_CC) && !defined (_STLP_INTERNAL_CSTDIO)
// remove() conflict
# include <stl/_cstdio.h>
#endif
_STLP_BEGIN_NAMESPACE
// for_each. Apply a function to every element of a range.
template <class _InputIter, class _Function>
_STLP_INLINE_LOOP _Function
for_each(_InputIter __first, _InputIter __last, _Function __f) {
for ( ; __first != __last; ++__first)
__f(*__first);
return __f;
}
// count_if
template <class _InputIter, class _Predicate>
_STLP_INLINE_LOOP _STLP_DIFFERENCE_TYPE(_InputIter)
count_if(_InputIter __first, _InputIter __last, _Predicate __pred) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
_STLP_DIFFERENCE_TYPE(_InputIter) __n = 0;
for ( ; __first != __last; ++__first) {
if (__pred(*__first))
++__n;
}
return __n;
}
// adjacent_find.
template <class _ForwardIter, class _BinaryPredicate>
_STLP_INLINE_LOOP _ForwardIter
adjacent_find(_ForwardIter __first, _ForwardIter __last,
_BinaryPredicate __binary_pred) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
if (__first == __last)
return __last;
_ForwardIter __next = __first;
while(++__next != __last) {
if (__binary_pred(*__first, *__next))
return __first;
__first = __next;
}
return __last;
}
template <class _ForwardIter>
_STLP_INLINE_LOOP _ForwardIter
adjacent_find(_ForwardIter __first, _ForwardIter __last) {
return adjacent_find(__first, __last,
_STLP_PRIV __equal_to(_STLP_VALUE_TYPE(__first, _ForwardIter)));
}
#if !defined (_STLP_NO_ANACHRONISMS)
template <class _InputIter, class _Tp, class _Size>
_STLP_INLINE_LOOP void
count(_InputIter __first, _InputIter __last, const _Tp& __val, _Size& __n) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
for ( ; __first != __last; ++__first)
if (*__first == __val)
++__n;
}
template <class _InputIter, class _Predicate, class _Size>
_STLP_INLINE_LOOP void
count_if(_InputIter __first, _InputIter __last, _Predicate __pred, _Size& __n) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
for ( ; __first != __last; ++__first)
if (__pred(*__first))
++__n;
}
#endif
template <class _ForwardIter1, class _ForwardIter2>
_ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1,
_ForwardIter2 __first2, _ForwardIter2 __last2);
// search_n. Search for __count consecutive copies of __val.
template <class _ForwardIter, class _Integer, class _Tp>
_ForwardIter search_n(_ForwardIter __first, _ForwardIter __last,
_Integer __count, const _Tp& __val);
template <class _ForwardIter, class _Integer, class _Tp, class _BinaryPred>
_ForwardIter search_n(_ForwardIter __first, _ForwardIter __last,
_Integer __count, const _Tp& __val, _BinaryPred __binary_pred);
template <class _InputIter, class _ForwardIter>
inline _InputIter find_first_of(_InputIter __first1, _InputIter __last1,
_ForwardIter __first2, _ForwardIter __last2) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
return _STLP_PRIV __find_first_of(__first1, __last1, __first2, __last2);
}
template <class _InputIter, class _ForwardIter, class _BinaryPredicate>
inline _InputIter
find_first_of(_InputIter __first1, _InputIter __last1,
_ForwardIter __first2, _ForwardIter __last2, _BinaryPredicate __comp) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
return _STLP_PRIV __find_first_of(__first1, __last1, __first2, __last2, __comp);
}
template <class _ForwardIter1, class _ForwardIter2>
_ForwardIter1
find_end(_ForwardIter1 __first1, _ForwardIter1 __last1,
_ForwardIter2 __first2, _ForwardIter2 __last2);
// swap_ranges
template <class _ForwardIter1, class _ForwardIter2>
_STLP_INLINE_LOOP _ForwardIter2
swap_ranges(_ForwardIter1 __first1, _ForwardIter1 __last1, _ForwardIter2 __first2) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
for ( ; __first1 != __last1; ++__first1, ++__first2)
iter_swap(__first1, __first2);
return __first2;
}
// transform
template <class _InputIter, class _OutputIter, class _UnaryOperation>
_STLP_INLINE_LOOP _OutputIter
transform(_InputIter __first, _InputIter __last, _OutputIter __result, _UnaryOperation __opr) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
for ( ; __first != __last; ++__first, ++__result)
*__result = __opr(*__first);
return __result;
}
template <class _InputIter1, class _InputIter2, class _OutputIter, class _BinaryOperation>
_STLP_INLINE_LOOP _OutputIter
transform(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _OutputIter __result,_BinaryOperation __binary_op) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
for ( ; __first1 != __last1; ++__first1, ++__first2, ++__result)
*__result = __binary_op(*__first1, *__first2);
return __result;
}
// replace_if, replace_copy, replace_copy_if
template <class _ForwardIter, class _Predicate, class _Tp>
_STLP_INLINE_LOOP void
replace_if(_ForwardIter __first, _ForwardIter __last, _Predicate __pred, const _Tp& __new_value) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
for ( ; __first != __last; ++__first)
if (__pred(*__first))
*__first = __new_value;
}
template <class _InputIter, class _OutputIter, class _Tp>
_STLP_INLINE_LOOP _OutputIter
replace_copy(_InputIter __first, _InputIter __last,_OutputIter __result,
const _Tp& __old_value, const _Tp& __new_value) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
for ( ; __first != __last; ++__first, ++__result)
*__result = *__first == __old_value ? __new_value : *__first;
return __result;
}
template <class _Iterator, class _OutputIter, class _Predicate, class _Tp>
_STLP_INLINE_LOOP _OutputIter
replace_copy_if(_Iterator __first, _Iterator __last,
_OutputIter __result,
_Predicate __pred, const _Tp& __new_value) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
for ( ; __first != __last; ++__first, ++__result)
*__result = __pred(*__first) ? __new_value : *__first;
return __result;
}
// generate and generate_n
template <class _ForwardIter, class _Generator>
_STLP_INLINE_LOOP void
generate(_ForwardIter __first, _ForwardIter __last, _Generator __gen) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
for ( ; __first != __last; ++__first)
*__first = __gen();
}
template <class _OutputIter, class _Size, class _Generator>
_STLP_INLINE_LOOP void
generate_n(_OutputIter __first, _Size __n, _Generator __gen) {
for ( ; __n > 0; --__n, ++__first)
*__first = __gen();
}
// remove, remove_if, remove_copy, remove_copy_if
template <class _InputIter, class _OutputIter, class _Tp>
_STLP_INLINE_LOOP _OutputIter
remove_copy(_InputIter __first, _InputIter __last,_OutputIter __result, const _Tp& __val) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
for ( ; __first != __last; ++__first) {
if (!(*__first == __val)) {
*__result = *__first;
++__result;
}
}
return __result;
}
template <class _InputIter, class _OutputIter, class _Predicate>
_STLP_INLINE_LOOP _OutputIter
remove_copy_if(_InputIter __first, _InputIter __last, _OutputIter __result, _Predicate __pred) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
for ( ; __first != __last; ++__first) {
if (!__pred(*__first)) {
*__result = *__first;
++__result;
}
}
return __result;
}
template <class _ForwardIter, class _Tp>
_STLP_INLINE_LOOP _ForwardIter
remove(_ForwardIter __first, _ForwardIter __last, const _Tp& __val) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
__first = find(__first, __last, __val);
if (__first == __last)
return __first;
else {
_ForwardIter __next = __first;
return remove_copy(++__next, __last, __first, __val);
}
}
template <class _ForwardIter, class _Predicate>
_STLP_INLINE_LOOP _ForwardIter
remove_if(_ForwardIter __first, _ForwardIter __last, _Predicate __pred) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
__first = find_if(__first, __last, __pred);
if ( __first == __last )
return __first;
else {
_ForwardIter __next = __first;
return remove_copy_if(++__next, __last, __first, __pred);
}
}
// unique and unique_copy
template <class _InputIter, class _OutputIter>
_OutputIter unique_copy(_InputIter __first, _InputIter __last, _OutputIter __result);
template <class _InputIter, class _OutputIter, class _BinaryPredicate>
_OutputIter unique_copy(_InputIter __first, _InputIter __last,_OutputIter __result,
_BinaryPredicate __binary_pred);
template <class _ForwardIter>
inline _ForwardIter unique(_ForwardIter __first, _ForwardIter __last) {
__first = adjacent_find(__first, __last);
return unique_copy(__first, __last, __first);
}
template <class _ForwardIter, class _BinaryPredicate>
inline _ForwardIter unique(_ForwardIter __first, _ForwardIter __last,
_BinaryPredicate __binary_pred) {
__first = adjacent_find(__first, __last, __binary_pred);
return unique_copy(__first, __last, __first, __binary_pred);
}
// reverse and reverse_copy, and their auxiliary functions
_STLP_MOVE_TO_PRIV_NAMESPACE
template <class _BidirectionalIter>
_STLP_INLINE_LOOP void
__reverse(_BidirectionalIter __first, _BidirectionalIter __last, const bidirectional_iterator_tag &) {
for (; __first != __last && __first != --__last; ++__first)
_STLP_STD::iter_swap(__first,__last);
}
template <class _RandomAccessIter>
_STLP_INLINE_LOOP void
__reverse(_RandomAccessIter __first, _RandomAccessIter __last, const random_access_iterator_tag &) {
for (; __first < __last; ++__first)
_STLP_STD::iter_swap(__first, --__last);
}
_STLP_MOVE_TO_STD_NAMESPACE
template <class _BidirectionalIter>
inline void
reverse(_BidirectionalIter __first, _BidirectionalIter __last) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
_STLP_PRIV __reverse(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _BidirectionalIter));
}
template <class _BidirectionalIter, class _OutputIter>
_STLP_INLINE_LOOP
_OutputIter reverse_copy(_BidirectionalIter __first,
_BidirectionalIter __last,
_OutputIter __result) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
while (__first != __last) {
--__last;
*__result = *__last;
++__result;
}
return __result;
}
template <class _ForwardIter>
void rotate(_ForwardIter __first, _ForwardIter __middle, _ForwardIter __last);
template <class _ForwardIter, class _OutputIter>
inline _OutputIter rotate_copy(_ForwardIter __first, _ForwardIter __middle,
_ForwardIter __last, _OutputIter __result) {
return _STLP_STD::copy(__first, __middle, copy(__middle, __last, __result));
}
// random_shuffle
template <class _RandomAccessIter>
void random_shuffle(_RandomAccessIter __first, _RandomAccessIter __last);
template <class _RandomAccessIter, class _RandomNumberGenerator>
void random_shuffle(_RandomAccessIter __first, _RandomAccessIter __last,
_RandomNumberGenerator& __rand);
#if !defined (_STLP_NO_EXTENSIONS)
// random_sample and random_sample_n (extensions, not part of the standard).
template <class _ForwardIter, class _OutputIter, class _Distance>
_OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last,
_OutputIter __out_ite, const _Distance __n);
template <class _ForwardIter, class _OutputIter, class _Distance,
class _RandomNumberGenerator>
_OutputIter random_sample_n(_ForwardIter __first, _ForwardIter __last,
_OutputIter __out_ite, const _Distance __n,
_RandomNumberGenerator& __rand);
template <class _InputIter, class _RandomAccessIter>
_RandomAccessIter
random_sample(_InputIter __first, _InputIter __last,
_RandomAccessIter __out_first, _RandomAccessIter __out_last);
template <class _InputIter, class _RandomAccessIter,
class _RandomNumberGenerator>
_RandomAccessIter
random_sample(_InputIter __first, _InputIter __last,
_RandomAccessIter __out_first, _RandomAccessIter __out_last,
_RandomNumberGenerator& __rand);
#endif /* _STLP_NO_EXTENSIONS */
// partition, stable_partition, and their auxiliary functions
template <class _ForwardIter, class _Predicate>
_ForwardIter partition(_ForwardIter __first, _ForwardIter __last, _Predicate __pred);
template <class _ForwardIter, class _Predicate>
_ForwardIter
stable_partition(_ForwardIter __first, _ForwardIter __last, _Predicate __pred);
// sort() and its auxiliary functions.
_STLP_MOVE_TO_PRIV_NAMESPACE
template <class _Size>
inline _Size __lg(_Size __n) {
_Size __k;
for (__k = 0; __n != 1; __n >>= 1) ++__k;
return __k;
}
_STLP_MOVE_TO_STD_NAMESPACE
template <class _RandomAccessIter>
void sort(_RandomAccessIter __first, _RandomAccessIter __last);
template <class _RandomAccessIter, class _Compare>
void sort(_RandomAccessIter __first, _RandomAccessIter __last, _Compare __comp);
// stable_sort() and its auxiliary functions.
template <class _RandomAccessIter>
void stable_sort(_RandomAccessIter __first,
_RandomAccessIter __last);
template <class _RandomAccessIter, class _Compare>
void stable_sort(_RandomAccessIter __first,
_RandomAccessIter __last, _Compare __comp);
// partial_sort, partial_sort_copy, and auxiliary functions.
template <class _RandomAccessIter>
void partial_sort(_RandomAccessIter __first, _RandomAccessIter __middle,
_RandomAccessIter __last);
template <class _RandomAccessIter, class _Compare>
void partial_sort(_RandomAccessIter __first,_RandomAccessIter __middle,
_RandomAccessIter __last, _Compare __comp);
template <class _InputIter, class _RandomAccessIter>
_RandomAccessIter
partial_sort_copy(_InputIter __first, _InputIter __last,
_RandomAccessIter __result_first, _RandomAccessIter __result_last);
template <class _InputIter, class _RandomAccessIter, class _Compare>
_RandomAccessIter
partial_sort_copy(_InputIter __first, _InputIter __last,
_RandomAccessIter __result_first,
_RandomAccessIter __result_last, _Compare __comp);
// nth_element() and its auxiliary functions.
template <class _RandomAccessIter>
void nth_element(_RandomAccessIter __first, _RandomAccessIter __nth,
_RandomAccessIter __last);
template <class _RandomAccessIter, class _Compare>
void nth_element(_RandomAccessIter __first, _RandomAccessIter __nth,
_RandomAccessIter __last, _Compare __comp);
// auxiliary class for lower_bound, etc.
_STLP_MOVE_TO_PRIV_NAMESPACE
template <class _T1, class _T2>
struct __less_2 {
bool operator() (const _T1& __x, const _T2& __y) const { return __x < __y ; }
};
template <class _T1, class _T2>
__less_2<_T1,_T2> __less2(_T1*, _T2* ) { return __less_2<_T1, _T2>(); }
#if defined (_STLP_FUNCTION_PARTIAL_ORDER)
template <class _Tp>
less<_Tp> __less2(_Tp*, _Tp* ) { return less<_Tp>(); }
#endif
_STLP_MOVE_TO_STD_NAMESPACE
// Binary search (lower_bound, upper_bound, equal_range, binary_search).
template <class _ForwardIter, class _Tp>
inline _ForwardIter lower_bound(_ForwardIter __first, _ForwardIter __last,
const _Tp& __val) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
return _STLP_PRIV __lower_bound(__first, __last, __val,
_STLP_PRIV __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0),
_STLP_PRIV __less2((_Tp*)0, _STLP_VALUE_TYPE(__first, _ForwardIter)),
_STLP_DISTANCE_TYPE(__first, _ForwardIter));
}
template <class _ForwardIter, class _Tp, class _Compare>
inline _ForwardIter lower_bound(_ForwardIter __first, _ForwardIter __last,
const _Tp& __val, _Compare __comp) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
return _STLP_PRIV __lower_bound(__first, __last, __val, __comp, __comp,
_STLP_DISTANCE_TYPE(__first, _ForwardIter));
}
_STLP_MOVE_TO_PRIV_NAMESPACE
template <class _ForwardIter, class _Tp, class _Compare1, class _Compare2, class _Distance>
_ForwardIter __upper_bound(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
_Compare1 __comp1, _Compare2 __comp2, _Distance*);
_STLP_MOVE_TO_STD_NAMESPACE
template <class _ForwardIter, class _Tp>
inline _ForwardIter upper_bound(_ForwardIter __first, _ForwardIter __last,
const _Tp& __val) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
return _STLP_PRIV __upper_bound(__first, __last, __val,
_STLP_PRIV __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0),
_STLP_PRIV __less2((_Tp*)0, _STLP_VALUE_TYPE(__first, _ForwardIter)),
_STLP_DISTANCE_TYPE(__first, _ForwardIter));
}
template <class _ForwardIter, class _Tp, class _Compare>
inline _ForwardIter upper_bound(_ForwardIter __first, _ForwardIter __last,
const _Tp& __val, _Compare __comp) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
return _STLP_PRIV __upper_bound(__first, __last, __val, __comp, __comp,
_STLP_DISTANCE_TYPE(__first, _ForwardIter));
}
_STLP_MOVE_TO_PRIV_NAMESPACE
template <class _ForwardIter, class _Tp, class _Compare1, class _Compare2, class _Distance>
pair<_ForwardIter, _ForwardIter>
__equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
_Compare1 __comp1, _Compare2 __comp2, _Distance*);
_STLP_MOVE_TO_STD_NAMESPACE
template <class _ForwardIter, class _Tp>
inline pair<_ForwardIter, _ForwardIter>
equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
return _STLP_PRIV __equal_range(__first, __last, __val,
_STLP_PRIV __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0),
_STLP_PRIV __less2((_Tp*)0, _STLP_VALUE_TYPE(__first, _ForwardIter)),
_STLP_DISTANCE_TYPE(__first, _ForwardIter));
}
template <class _ForwardIter, class _Tp, class _Compare>
inline pair<_ForwardIter, _ForwardIter>
equal_range(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
_Compare __comp) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
return _STLP_PRIV __equal_range(__first, __last, __val, __comp, __comp,
_STLP_DISTANCE_TYPE(__first, _ForwardIter));
}
template <class _ForwardIter, class _Tp>
inline bool binary_search(_ForwardIter __first, _ForwardIter __last,
const _Tp& __val) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
_ForwardIter __i = _STLP_PRIV __lower_bound(__first, __last, __val,
_STLP_PRIV __less2(_STLP_VALUE_TYPE(__first, _ForwardIter), (_Tp*)0),
_STLP_PRIV __less2((_Tp*)0, _STLP_VALUE_TYPE(__first, _ForwardIter)),
_STLP_DISTANCE_TYPE(__first, _ForwardIter));
return __i != __last && !(__val < *__i);
}
template <class _ForwardIter, class _Tp, class _Compare>
inline bool binary_search(_ForwardIter __first, _ForwardIter __last,
const _Tp& __val,
_Compare __comp) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
_ForwardIter __i = _STLP_PRIV __lower_bound(__first, __last, __val, __comp, __comp,
_STLP_DISTANCE_TYPE(__first, _ForwardIter));
return __i != __last && !__comp(__val, *__i);
}
// merge, with and without an explicitly supplied comparison function.
template <class _InputIter1, class _InputIter2, class _OutputIter>
_OutputIter merge(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _InputIter2 __last2,
_OutputIter __result);
template <class _InputIter1, class _InputIter2, class _OutputIter,
class _Compare>
_OutputIter merge(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _InputIter2 __last2,
_OutputIter __result, _Compare __comp);
// inplace_merge and its auxiliary functions.
template <class _BidirectionalIter>
void inplace_merge(_BidirectionalIter __first,
_BidirectionalIter __middle,
_BidirectionalIter __last) ;
template <class _BidirectionalIter, class _Compare>
void inplace_merge(_BidirectionalIter __first,
_BidirectionalIter __middle,
_BidirectionalIter __last, _Compare __comp);
// Set algorithms: includes, set_union, set_intersection, set_difference,
// set_symmetric_difference. All of these algorithms have the precondition
// that their input ranges are sorted and the postcondition that their output
// ranges are sorted.
template <class _InputIter1, class _InputIter2>
bool includes(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _InputIter2 __last2);
template <class _InputIter1, class _InputIter2, class _Compare>
bool includes(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _InputIter2 __last2, _Compare __comp);
template <class _InputIter1, class _InputIter2, class _OutputIter>
_OutputIter set_union(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _InputIter2 __last2,
_OutputIter __result);
template <class _InputIter1, class _InputIter2, class _OutputIter,
class _Compare>
_OutputIter set_union(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _InputIter2 __last2,
_OutputIter __result, _Compare __comp);
template <class _InputIter1, class _InputIter2, class _OutputIter>
_OutputIter set_intersection(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _InputIter2 __last2,
_OutputIter __result);
template <class _InputIter1, class _InputIter2, class _OutputIter,
class _Compare>
_OutputIter set_intersection(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _InputIter2 __last2,
_OutputIter __result, _Compare __comp);
template <class _InputIter1, class _InputIter2, class _OutputIter>
_OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _InputIter2 __last2,
_OutputIter __result);
template <class _InputIter1, class _InputIter2, class _OutputIter,
class _Compare>
_OutputIter set_difference(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _InputIter2 __last2,
_OutputIter __result, _Compare __comp);
template <class _InputIter1, class _InputIter2, class _OutputIter>
_OutputIter
set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _InputIter2 __last2,
_OutputIter __result);
template <class _InputIter1, class _InputIter2, class _OutputIter,
class _Compare>
_OutputIter
set_symmetric_difference(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _InputIter2 __last2,
_OutputIter __result,
_Compare __comp);
// min_element and max_element, with and without an explicitly supplied
// comparison function.
template <class _ForwardIter>
_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last);
template <class _ForwardIter, class _Compare>
_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last,
_Compare __comp);
template <class _ForwardIter>
_ForwardIter min_element(_ForwardIter __first, _ForwardIter __last);
template <class _ForwardIter, class _Compare>
_ForwardIter min_element(_ForwardIter __first, _ForwardIter __last,
_Compare __comp);
// next_permutation and prev_permutation, with and without an explicitly
// supplied comparison function.
template <class _BidirectionalIter>
bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last);
template <class _BidirectionalIter, class _Compare>
bool next_permutation(_BidirectionalIter __first, _BidirectionalIter __last,
_Compare __comp);
template <class _BidirectionalIter>
bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last);
template <class _BidirectionalIter, class _Compare>
bool prev_permutation(_BidirectionalIter __first, _BidirectionalIter __last,
_Compare __comp);
#if !defined (_STLP_NO_EXTENSIONS)
// is_heap, a predicate testing whether or not a range is
// a heap. This function is an extension, not part of the C++
// standard.
template <class _RandomAccessIter>
bool is_heap(_RandomAccessIter __first, _RandomAccessIter __last);
template <class _RandomAccessIter, class _StrictWeakOrdering>
bool is_heap(_RandomAccessIter __first, _RandomAccessIter __last,
_StrictWeakOrdering __comp);
// is_sorted, a predicated testing whether a range is sorted in
// nondescending order. This is an extension, not part of the C++
// standard.
_STLP_MOVE_TO_PRIV_NAMESPACE
template <class _ForwardIter, class _StrictWeakOrdering>
bool __is_sorted(_ForwardIter __first, _ForwardIter __last,
_StrictWeakOrdering __comp);
_STLP_MOVE_TO_STD_NAMESPACE
template <class _ForwardIter>
inline bool is_sorted(_ForwardIter __first, _ForwardIter __last) {
return _STLP_PRIV __is_sorted(__first, __last,
_STLP_PRIV __less(_STLP_VALUE_TYPE(__first, _ForwardIter)));
}
template <class _ForwardIter, class _StrictWeakOrdering>
inline bool is_sorted(_ForwardIter __first, _ForwardIter __last,
_StrictWeakOrdering __comp) {
return _STLP_PRIV __is_sorted(__first, __last, __comp);
}
#endif
_STLP_END_NAMESPACE
#if !defined (_STLP_LINK_TIME_INSTANTIATION)
# include <stl/_algo.c>
#endif
#endif /* _STLP_INTERNAL_ALGO_H */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,483 @@
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1997
* Moscow Center for SPARC Technology
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_ALGOBASE_C
#define _STLP_ALGOBASE_C
#ifndef _STLP_INTERNAL_ALGOBASE_H
# include <stl/_algobase.h>
#endif
#ifndef _STLP_INTERNAL_FUNCTION_BASE_H
# include <stl/_function_base.h>
#endif
_STLP_BEGIN_NAMESPACE
template <class _InputIter1, class _InputIter2>
bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _InputIter2 __last2) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
for ( ; __first1 != __last1 && __first2 != __last2
; ++__first1, ++__first2) {
if (*__first1 < *__first2) {
_STLP_VERBOSE_ASSERT(!(*__first2 < *__first1), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
return true;
}
if (*__first2 < *__first1)
return false;
}
return __first1 == __last1 && __first2 != __last2;
}
template <class _InputIter1, class _InputIter2, class _Compare>
bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _InputIter2 __last2,
_Compare __comp) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
for ( ; __first1 != __last1 && __first2 != __last2
; ++__first1, ++__first2) {
if (__comp(*__first1, *__first2)) {
_STLP_VERBOSE_ASSERT(!__comp(*__first2, *__first1),
_StlMsg_INVALID_STRICT_WEAK_PREDICATE)
return true;
}
if (__comp(*__first2, *__first1))
return false;
}
return __first1 == __last1 && __first2 != __last2;
}
#if !defined (_STLP_NO_EXTENSIONS)
_STLP_MOVE_TO_PRIV_NAMESPACE
template <class _InputIter1, class _InputIter2>
int __lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _InputIter2 __last2) {
while (__first1 != __last1 && __first2 != __last2) {
if (*__first1 < *__first2) {
_STLP_VERBOSE_ASSERT(!(*__first2 < *__first1), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
return -1;
}
if (*__first2 < *__first1)
return 1;
++__first1;
++__first2;
}
if (__first2 == __last2) {
return !(__first1 == __last1);
}
else {
return -1;
}
}
_STLP_MOVE_TO_STD_NAMESPACE
template <class _InputIter1, class _InputIter2>
int lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _InputIter2 __last2) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
return _STLP_PRIV __lexicographical_compare_3way(__first1, __last1, __first2, __last2);
}
#endif
_STLP_MOVE_TO_PRIV_NAMESPACE
template <class _RandomAccessIter, class _Tp>
_STLP_INLINE_LOOP _RandomAccessIter __find(_RandomAccessIter __first, _RandomAccessIter __last,
const _Tp& __val,
const random_access_iterator_tag &) {
_STLP_DIFFERENCE_TYPE(_RandomAccessIter) __trip_count = (__last - __first) >> 2;
for ( ; __trip_count > 0 ; --__trip_count) {
if (*__first == __val) return __first;
++__first;
if (*__first == __val) return __first;
++__first;
if (*__first == __val) return __first;
++__first;
if (*__first == __val) return __first;
++__first;
}
switch (__last - __first) {
case 3:
if (*__first == __val) return __first;
++__first;
case 2:
if (*__first == __val) return __first;
++__first;
case 1:
if (*__first == __val) return __first;
//++__first;
case 0:
default:
return __last;
}
}
inline char*
__find(char* __first, char* __last, char __val, const random_access_iterator_tag &) {
void *res = memchr(__first, __val, __last - __first);
return res != 0 ? __STATIC_CAST(char*, res) : __last;
}
inline const char*
__find(const char* __first, const char* __last, char __val, const random_access_iterator_tag &) {
const void *res = memchr(__first, __val, __last - __first);
return res != 0 ? __STATIC_CAST(const char*, res) : __last;
}
template <class _RandomAccessIter, class _Predicate>
_STLP_INLINE_LOOP _RandomAccessIter __find_if(_RandomAccessIter __first, _RandomAccessIter __last,
_Predicate __pred,
const random_access_iterator_tag &) {
_STLP_DIFFERENCE_TYPE(_RandomAccessIter) __trip_count = (__last - __first) >> 2;
for ( ; __trip_count > 0 ; --__trip_count) {
if (__pred(*__first)) return __first;
++__first;
if (__pred(*__first)) return __first;
++__first;
if (__pred(*__first)) return __first;
++__first;
if (__pred(*__first)) return __first;
++__first;
}
switch(__last - __first) {
case 3:
if (__pred(*__first)) return __first;
++__first;
case 2:
if (__pred(*__first)) return __first;
++__first;
case 1:
if (__pred(*__first)) return __first;
//++__first;
case 0:
default:
return __last;
}
}
template <class _InputIter, class _Tp>
_STLP_INLINE_LOOP _InputIter __find(_InputIter __first, _InputIter __last,
const _Tp& __val,
const input_iterator_tag &) {
while (__first != __last && !(*__first == __val)) ++__first;
return __first;
}
template <class _InputIter, class _Predicate>
_STLP_INLINE_LOOP _InputIter __find_if(_InputIter __first, _InputIter __last,
_Predicate __pred,
const input_iterator_tag &) {
while (__first != __last && !__pred(*__first))
++__first;
return __first;
}
_STLP_MOVE_TO_STD_NAMESPACE
template <class _InputIter, class _Predicate>
_InputIter find_if(_InputIter __first, _InputIter __last,
_Predicate __pred) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
return _STLP_PRIV __find_if(__first, __last, __pred, _STLP_ITERATOR_CATEGORY(__first, _InputIter));
}
template <class _InputIter, class _Tp>
_InputIter find(_InputIter __first, _InputIter __last, const _Tp& __val) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
return _STLP_PRIV __find(__first, __last, __val, _STLP_ITERATOR_CATEGORY(__first, _InputIter));
}
template <class _ForwardIter1, class _ForwardIter2, class _BinaryPred>
_ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1,
_ForwardIter2 __first2, _ForwardIter2 __last2,
_BinaryPred __pred) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
// Test for empty ranges
if (__first1 == __last1 || __first2 == __last2)
return __first1;
// Test for a pattern of length 1.
_ForwardIter2 __p1(__first2);
if ( ++__p1 == __last2 ) {
while (__first1 != __last1 && !__pred(*__first1, *__first2)) {
++__first1;
}
return __first1;
}
// General case.
for ( ; ; ) { // __first1 != __last1 will be checked below
while (__first1 != __last1 && !__pred(*__first1, *__first2)) {
++__first1;
}
if (__first1 == __last1) {
return __last1;
}
_ForwardIter2 __p = __p1;
_ForwardIter1 __current = __first1;
if (++__current == __last1) return __last1;
while (__pred(*__current, *__p)) {
if (++__p == __last2)
return __first1;
if (++__current == __last1)
return __last1;
}
++__first1;
}
return __first1;
}
_STLP_MOVE_TO_PRIV_NAMESPACE
template <class _Tp>
struct _IsCharLikeType
{ typedef __false_type _Ret; };
_STLP_TEMPLATE_NULL struct _IsCharLikeType<char>
{ typedef __true_type _Ret; };
_STLP_TEMPLATE_NULL struct _IsCharLikeType<unsigned char>
{ typedef __true_type _Ret; };
# ifndef _STLP_NO_SIGNED_BUILTINS
_STLP_TEMPLATE_NULL struct _IsCharLikeType<signed char>
{ typedef __true_type _Ret; };
# endif
template <class _Tp1, class _Tp2>
inline bool __stlp_eq(_Tp1 __val1, _Tp2 __val2)
{ return __val1 == __val2; }
#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
template <class _Tp>
inline bool __stlp_eq(_Tp, _Tp)
{ return true; }
#endif
template <class _InputIter, class _ForwardIter, class _Tp2, class _Predicate>
inline _InputIter __find_first_of_aux2(_InputIter __first1, _InputIter __last1,
_ForwardIter __first2, _ForwardIter __last2,
_Tp2*, _Predicate __pred,
const __true_type& /* _UseStrcspnLikeAlgo */) {
unsigned char __hints[(UCHAR_MAX + 1) / CHAR_BIT];
memset(__hints, 0, sizeof(__hints) / sizeof(unsigned char));
for (; __first2 != __last2; ++__first2) {
unsigned char __tmp = (unsigned char)*__first2;
__hints[__tmp / CHAR_BIT] |= (1 << (__tmp % CHAR_BIT));
}
for (; __first1 != __last1; ++__first1) {
_Tp2 __tmp = (_Tp2)*__first1;
if (__stlp_eq(*__first1, __tmp) &&
__pred((__hints[(unsigned char)__tmp / CHAR_BIT] & (1 << ((unsigned char)__tmp % CHAR_BIT))) != 0))
break;
}
return __first1;
}
template <class _InputIter, class _ForwardIter, class _Tp2, class _Predicate>
inline _InputIter __find_first_of_aux2(_InputIter __first1, _InputIter __last1,
_ForwardIter __first2, _ForwardIter __last2,
_Tp2* /* __dummy */, _Predicate /* __pred */,
const __false_type& /* _UseStrcspnLikeAlgo */) {
return _STLP_PRIV __find_first_of(__first1, __last1, __first2, __last2,
_STLP_PRIV __equal_to(_STLP_VALUE_TYPE(__first1, _InputIter)));
}
template <class _InputIter, class _ForwardIter, class _Tp1, class _Tp2>
inline _InputIter __find_first_of_aux1(_InputIter __first1, _InputIter __last1,
_ForwardIter __first2, _ForwardIter __last2,
_Tp1* __pt1, _Tp2* __pt2) {
typedef _STLP_TYPENAME _STLP_STD::_IsIntegral<_Tp1>::_Ret _IsIntegral;
typedef _STLP_TYPENAME _STLP_PRIV _IsCharLikeType<_Tp2>::_Ret _IsCharLike;
typedef _STLP_TYPENAME _STLP_STD::_Land2<_IsIntegral, _IsCharLike>::_Ret _UseStrcspnLikeAlgo;
return _STLP_PRIV __find_first_of_aux2(__first1, __last1,
__first2, __last2,
__pt2, _Identity<bool>(), _UseStrcspnLikeAlgo());
}
template <class _InputIter, class _ForwardIter>
inline _InputIter __find_first_of(_InputIter __first1, _InputIter __last1,
_ForwardIter __first2, _ForwardIter __last2) {
return _STLP_PRIV __find_first_of_aux1(__first1, __last1, __first2, __last2,
_STLP_VALUE_TYPE(__first1, _InputIter),
_STLP_VALUE_TYPE(__first2, _ForwardIter));
}
// find_first_of, with and without an explicitly supplied comparison function.
template <class _InputIter, class _ForwardIter, class _BinaryPredicate>
_InputIter __find_first_of(_InputIter __first1, _InputIter __last1,
_ForwardIter __first2, _ForwardIter __last2,
_BinaryPredicate __comp) {
for ( ; __first1 != __last1; ++__first1) {
for (_ForwardIter __iter = __first2; __iter != __last2; ++__iter) {
if (__comp(*__first1, *__iter)) {
return __first1;
}
}
}
return __last1;
}
// find_end, with and without an explicitly supplied comparison function.
// Search [first2, last2) as a subsequence in [first1, last1), and return
// the *last* possible match. Note that find_end for bidirectional iterators
// is much faster than for forward iterators.
// find_end for forward iterators.
template <class _ForwardIter1, class _ForwardIter2,
class _BinaryPredicate>
_ForwardIter1 __find_end(_ForwardIter1 __first1, _ForwardIter1 __last1,
_ForwardIter2 __first2, _ForwardIter2 __last2,
const forward_iterator_tag &, const forward_iterator_tag &,
_BinaryPredicate __comp) {
if (__first2 == __last2)
return __last1;
else {
_ForwardIter1 __result = __last1;
for (;;) {
_ForwardIter1 __new_result = _STLP_STD::search(__first1, __last1, __first2, __last2, __comp);
if (__new_result == __last1)
return __result;
else {
__result = __new_result;
__first1 = __new_result;
++__first1;
}
}
}
}
_STLP_MOVE_TO_STD_NAMESPACE
// find_end for bidirectional iterators. Requires partial specialization.
#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
# ifndef _STLP_INTERNAL_ITERATOR_H
_STLP_END_NAMESPACE
# include <stl/_iterator.h>
_STLP_BEGIN_NAMESPACE
# endif /*_STLP_INTERNAL_ITERATOR_H*/
_STLP_MOVE_TO_PRIV_NAMESPACE
template <class _BidirectionalIter1, class _BidirectionalIter2,
class _BinaryPredicate>
_BidirectionalIter1
__find_end(_BidirectionalIter1 __first1, _BidirectionalIter1 __last1,
_BidirectionalIter2 __first2, _BidirectionalIter2 __last2,
const bidirectional_iterator_tag &, const bidirectional_iterator_tag &,
_BinaryPredicate __comp) {
typedef _STLP_STD::reverse_iterator<_BidirectionalIter1> _RevIter1;
typedef _STLP_STD::reverse_iterator<_BidirectionalIter2> _RevIter2;
_RevIter1 __rlast1(__first1);
_RevIter2 __rlast2(__first2);
_RevIter1 __rresult = _STLP_STD::search(_RevIter1(__last1), __rlast1,
_RevIter2(__last2), __rlast2,
__comp);
if (__rresult == __rlast1)
return __last1;
else {
_BidirectionalIter1 __result = __rresult.base();
_STLP_STD::advance(__result, -_STLP_STD::distance(__first2, __last2));
return __result;
}
}
_STLP_MOVE_TO_STD_NAMESPACE
#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
template <class _ForwardIter1, class _ForwardIter2,
class _BinaryPredicate>
_ForwardIter1
find_end(_ForwardIter1 __first1, _ForwardIter1 __last1,
_ForwardIter2 __first2, _ForwardIter2 __last2,
_BinaryPredicate __comp) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
return _STLP_PRIV __find_end(__first1, __last1, __first2, __last2,
#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
_STLP_ITERATOR_CATEGORY(__first1, _ForwardIter1),
_STLP_ITERATOR_CATEGORY(__first2, _ForwardIter2),
#else
forward_iterator_tag(),
forward_iterator_tag(),
#endif
__comp);
}
_STLP_MOVE_TO_PRIV_NAMESPACE
template <class _ForwardIter, class _Tp, class _Compare1, class _Compare2, class _Distance>
_ForwardIter __lower_bound(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
_Compare1 __comp1, _Compare2 __comp2, _Distance*) {
_Distance __len = _STLP_STD::distance(__first, __last);
_Distance __half;
_ForwardIter __middle;
while (__len > 0) {
__half = __len >> 1;
__middle = __first;
_STLP_STD::advance(__middle, __half);
if (__comp1(*__middle, __val)) {
_STLP_VERBOSE_ASSERT(!__comp2(__val, *__middle), _StlMsg_INVALID_STRICT_WEAK_PREDICATE)
__first = __middle;
++__first;
__len = __len - __half - 1;
}
else
__len = __half;
}
return __first;
}
_STLP_MOVE_TO_STD_NAMESPACE
_STLP_END_NAMESPACE
#endif /* _STLP_ALGOBASE_C */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,728 @@
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1997
* Moscow Center for SPARC Technology
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
/* NOTE: This is an internal header file, included by other STL headers.
* You should not attempt to use it directly.
*/
#ifndef _STLP_INTERNAL_ALGOBASE_H
#define _STLP_INTERNAL_ALGOBASE_H
#ifndef _STLP_INTERNAL_CSTDDEF
# include <stl/_cstddef.h>
#endif
#ifndef _STLP_INTERNAL_CSTRING
# include <stl/_cstring.h>
#endif
#ifndef _STLP_CLIMITS
# include <climits>
#endif
#ifndef _STLP_INTERNAL_CSTDLIB
# include <stl/_cstdlib.h>
#endif
#ifndef _STLP_INTERNAL_PAIR_H
# include <stl/_pair.h>
#endif
#ifndef _STLP_INTERNAL_ITERATOR_BASE_H
# include <stl/_iterator_base.h>
#endif
#ifndef _STLP_TYPE_TRAITS_H
# include <stl/type_traits.h>
#endif
_STLP_BEGIN_NAMESPACE
#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
_STLP_MOVE_TO_PRIV_NAMESPACE
template <class _Tp>
inline void __swap_aux(_Tp& __a, _Tp& __b, const __true_type& /*SwapImplemented*/) {
__a._M_swap_workaround(__b);
}
template <class _Tp>
inline void __swap_aux(_Tp& __a, _Tp& __b, const __false_type& /*SwapImplemented*/) {
_Tp __tmp = __a;
__a = __b;
__b = __tmp;
}
_STLP_MOVE_TO_STD_NAMESPACE
#endif
// swap and iter_swap
template <class _Tp>
inline void swap(_Tp& __a, _Tp& __b) {
#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
# if !defined(__BORLANDC__)
typedef typename _SwapImplemented<_Tp>::_Ret _Implemented;
# else
enum { _Is = _SwapImplemented<_Tp>::_Is };
typedef typename __bool2type<_Is>::_Ret _Implemented;
# endif
_STLP_PRIV __swap_aux(__a, __b, _Implemented());
#else
_Tp __tmp = __a;
__a = __b;
__b = __tmp;
#endif
}
_STLP_MOVE_TO_PRIV_NAMESPACE
template <class _ForwardIter1, class _ForwardIter2, class _Value>
inline void __iter_swap_aux_aux(_ForwardIter1& __i1, _ForwardIter2& __i2, _Value *) {
_Value tmp = *__i1;
*__i1 = *__i2;
*__i2 = tmp;
}
template <class _ForwardIter1, class _ForwardIter2>
inline void __iter_swap_aux(_ForwardIter1& __i1, _ForwardIter2& __i2, const __true_type& /*OKToSwap*/) {
/* namespace specification breaks access to the right swap template overload (at least for gcc) */
/*_STLP_STD::*/ swap(*__i1, *__i2);
}
template <class _ForwardIter1, class _ForwardIter2>
inline void __iter_swap_aux(_ForwardIter1& __i1, _ForwardIter2& __i2, const __false_type& /*OKToSwap*/) {
_STLP_PRIV __iter_swap_aux_aux( __i1, __i2, _STLP_VALUE_TYPE(__i1,_ForwardIter1) );
}
_STLP_MOVE_TO_STD_NAMESPACE
template <class _ForwardIter1, class _ForwardIter2>
inline void iter_swap(_ForwardIter1 __i1, _ForwardIter2 __i2) {
_STLP_PRIV __iter_swap_aux( __i1, __i2, _IsOKToSwap(_STLP_VALUE_TYPE(__i1, _ForwardIter1), _STLP_VALUE_TYPE(__i2, _ForwardIter2),
_STLP_IS_REF_TYPE_REAL_REF(__i1, _ForwardIter1),
_STLP_IS_REF_TYPE_REAL_REF(__i2, _ForwardIter2))._Answer());
}
//--------------------------------------------------
// min and max
#if !defined (__BORLANDC__) || defined (_STLP_USE_OWN_NAMESPACE)
# if (defined (__BORLANDC__) && (__BORLANDC__ < 0x580)) && !defined (__STDC__)
//In not ANSI mode Borland import min/max in global namespace which conflict
//with STLport min/max when user does a 'using namespace std' in its code
//(see test/unit/alg_test.cpp). To avoid this clash we simply import Borland min/max
//in STLport namespace.
using _STLP_VENDOR_STD::min;
using _STLP_VENDOR_STD::max;
# else
template <class _Tp>
inline const _Tp& (min)(const _Tp& __a, const _Tp& __b) { return __b < __a ? __b : __a; }
template <class _Tp>
inline const _Tp& (max)(const _Tp& __a, const _Tp& __b) { return __a < __b ? __b : __a; }
# endif
#endif
# if defined (__BORLANDC__) && defined (_STLP_USE_OWN_NAMESPACE)
inline unsigned long (min) (unsigned long __a, unsigned long __b) { return __b < __a ? __b : __a; }
inline unsigned long (max) (unsigned long __a, unsigned long __b) { return __a < __b ? __b : __a; }
# endif
# if !defined (__BORLANDC__) || (__BORLANDC__ < 0x590)
template <class _Tp, class _Compare>
inline const _Tp& (min)(const _Tp& __a, const _Tp& __b, _Compare __comp) {
return __comp(__b, __a) ? __b : __a;
}
template <class _Tp, class _Compare>
inline const _Tp& (max)(const _Tp& __a, const _Tp& __b, _Compare __comp) {
return __comp(__a, __b) ? __b : __a;
}
# else
template <class _Tp, class _Compare>
inline const _Tp (min)(const _Tp __a, const _Tp __b, _Compare __comp) {
return __comp(__b, __a) ? __b : __a;
}
template <class _Tp, class _Compare>
inline const _Tp (max)(const _Tp __a, const _Tp __b, _Compare __comp) {
return __comp(__a, __b) ? __b : __a;
}
# endif
//--------------------------------------------------
// copy
// All of these auxiliary functions serve two purposes. (1) Replace
// calls to copy with memmove whenever possible. (Memmove, not memcpy,
// because the input and output ranges are permitted to overlap.)
// (2) If we're using random access iterators, then write the loop as
// a for loop with an explicit count.
_STLP_MOVE_TO_PRIV_NAMESPACE
template <class _InputIter, class _OutputIter, class _Distance>
inline _OutputIter __copy(_InputIter __first, _InputIter __last,
_OutputIter __result, const input_iterator_tag &, _Distance*) {
for ( ; __first != __last; ++__result, ++__first)
*__result = *__first;
return __result;
}
#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
template <class _InputIter, class _OutputIter, class _Distance>
inline _OutputIter __copy(_InputIter __first, _InputIter __last,
_OutputIter __result, const forward_iterator_tag &, _Distance* ) {
for ( ; __first != __last; ++__result, ++__first)
*__result = *__first;
return __result;
}
template <class _InputIter, class _OutputIter, class _Distance>
inline _OutputIter __copy(_InputIter __first, _InputIter __last,
_OutputIter __result, const bidirectional_iterator_tag &, _Distance* ) {
for ( ; __first != __last; ++__result, ++__first)
*__result = *__first;
return __result;
}
#endif
template <class _RandomAccessIter, class _OutputIter, class _Distance>
inline _OutputIter
__copy(_RandomAccessIter __first, _RandomAccessIter __last,
_OutputIter __result, const random_access_iterator_tag &, _Distance*) {
for (_Distance __n = __last - __first; __n > 0; --__n) {
*__result = *__first;
++__first;
++__result;
}
return __result;
}
inline void*
__copy_trivial(const void* __first, const void* __last, void* __result) {
size_t __n = (const char*)__last - (const char*)__first;
return __n ? (void *)((char*)memmove(__result, __first, __n) + __n) : __result;
}
//--------------------------------------------------
// copy_backward auxiliary functions
template <class _BidirectionalIter1, class _BidirectionalIter2,
class _Distance>
inline _BidirectionalIter2 __copy_backward(_BidirectionalIter1 __first,
_BidirectionalIter1 __last,
_BidirectionalIter2 __result,
const bidirectional_iterator_tag &,
_Distance*) {
while (__first != __last)
*--__result = *--__last;
return __result;
}
template <class _RandomAccessIter, class _BidirectionalIter, class _Distance>
inline _BidirectionalIter __copy_backward(_RandomAccessIter __first,
_RandomAccessIter __last,
_BidirectionalIter __result,
const random_access_iterator_tag &,
_Distance*) {
for (_Distance __n = __last - __first; __n > 0; --__n)
*--__result = *--__last;
return __result;
}
inline void*
__copy_trivial_backward(const void* __first, const void* __last, void* __result) {
const ptrdiff_t _Num = (const char*)__last - (const char*)__first;
return (_Num > 0) ? memmove((char*)__result - _Num, __first, _Num) : __result ;
}
template <class _InputIter, class _OutputIter>
inline _OutputIter __copy_ptrs(_InputIter __first, _InputIter __last, _OutputIter __result,
const __false_type& /*IsOKToMemCpy*/) {
return _STLP_PRIV __copy(__first, __last, __result, random_access_iterator_tag(), (ptrdiff_t*)0);
}
template <class _InputIter, class _OutputIter>
inline _OutputIter __copy_ptrs(_InputIter __first, _InputIter __last, _OutputIter __result,
const __true_type& /*IsOKToMemCpy*/) {
// we know they all pointers, so this cast is OK
// return (_OutputIter)__copy_trivial(&(*__first), &(*__last), &(*__result));
return (_OutputIter)_STLP_PRIV __copy_trivial(__first, __last, __result);
}
template <class _InputIter, class _OutputIter>
inline _OutputIter __copy_aux(_InputIter __first, _InputIter __last, _OutputIter __result,
const __true_type& /*BothPtrType*/) {
return _STLP_PRIV __copy_ptrs(__first, __last, __result,
_UseTrivialCopy(_STLP_VALUE_TYPE(__first, _InputIter),
_STLP_VALUE_TYPE(__result, _OutputIter))._Answer());
}
template <class _InputIter, class _OutputIter>
inline _OutputIter __copy_aux(_InputIter __first, _InputIter __last, _OutputIter __result,
const __false_type& /*BothPtrType*/) {
return _STLP_PRIV __copy(__first, __last, __result,
_STLP_ITERATOR_CATEGORY(__first, _InputIter),
_STLP_DISTANCE_TYPE(__first, _InputIter));
}
_STLP_MOVE_TO_STD_NAMESPACE
template <class _InputIter, class _OutputIter>
inline _OutputIter copy(_InputIter __first, _InputIter __last, _OutputIter __result) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
return _STLP_PRIV __copy_aux(__first, __last, __result, _BothPtrType< _InputIter, _OutputIter>::_Answer());
}
_STLP_MOVE_TO_PRIV_NAMESPACE
template <class _InputIter, class _OutputIter>
inline _OutputIter __copy_backward_ptrs(_InputIter __first, _InputIter __last,
_OutputIter __result, const __false_type& /*TrivialAssignment*/) {
return _STLP_PRIV __copy_backward(__first, __last, __result,
_STLP_ITERATOR_CATEGORY(__first, _InputIter),
_STLP_DISTANCE_TYPE(__first, _InputIter));
}
template <class _InputIter, class _OutputIter>
inline _OutputIter __copy_backward_ptrs(_InputIter __first, _InputIter __last,
_OutputIter __result, const __true_type& /*TrivialAssignment*/) {
return (_OutputIter)_STLP_PRIV __copy_trivial_backward(__first, __last, __result);
}
template <class _InputIter, class _OutputIter>
inline _OutputIter __copy_backward_aux(_InputIter __first, _InputIter __last, _OutputIter __result, const __false_type&) {
return _STLP_PRIV __copy_backward(__first, __last, __result,
_STLP_ITERATOR_CATEGORY(__first,_InputIter),
_STLP_DISTANCE_TYPE(__first, _InputIter));
}
template <class _InputIter, class _OutputIter>
inline _OutputIter __copy_backward_aux(_InputIter __first, _InputIter __last, _OutputIter __result, const __true_type&) {
return _STLP_PRIV __copy_backward_ptrs(__first, __last, __result,
_UseTrivialCopy(_STLP_VALUE_TYPE(__first, _InputIter),
_STLP_VALUE_TYPE(__result, _OutputIter))._Answer());
}
_STLP_MOVE_TO_STD_NAMESPACE
template <class _InputIter, class _OutputIter>
inline _OutputIter copy_backward(_InputIter __first, _InputIter __last, _OutputIter __result) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
return _STLP_PRIV __copy_backward_aux(__first, __last, __result, _BothPtrType< _InputIter, _OutputIter>::_Answer() );
}
#if !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS)
# define _STLP_DECLARE_COPY_TRIVIAL(_Tp) \
inline _Tp* copy(const _Tp* __first, const _Tp* __last, _Tp* __result) \
{ return (_Tp*)_STLP_PRIV __copy_trivial(__first, __last, __result); } \
inline _Tp* copy_backward(const _Tp* __first, const _Tp* __last, _Tp* __result) \
{ return (_Tp*)_STLP_PRIV __copy_trivial_backward(__first, __last, __result); }
# if !defined (_STLP_NO_BOOL)
_STLP_DECLARE_COPY_TRIVIAL(bool)
# endif
_STLP_DECLARE_COPY_TRIVIAL(char)
# if !defined (_STLP_NO_SIGNED_BUILTINS)
_STLP_DECLARE_COPY_TRIVIAL(signed char)
# endif
_STLP_DECLARE_COPY_TRIVIAL(unsigned char)
_STLP_DECLARE_COPY_TRIVIAL(short)
_STLP_DECLARE_COPY_TRIVIAL(unsigned short)
_STLP_DECLARE_COPY_TRIVIAL(int)
_STLP_DECLARE_COPY_TRIVIAL(unsigned int)
_STLP_DECLARE_COPY_TRIVIAL(long)
_STLP_DECLARE_COPY_TRIVIAL(unsigned long)
# if !defined(_STLP_NO_WCHAR_T) && !defined (_STLP_WCHAR_T_IS_USHORT)
_STLP_DECLARE_COPY_TRIVIAL(wchar_t)
# endif
# if defined (_STLP_LONG_LONG)
_STLP_DECLARE_COPY_TRIVIAL(_STLP_LONG_LONG)
_STLP_DECLARE_COPY_TRIVIAL(unsigned _STLP_LONG_LONG)
# endif
_STLP_DECLARE_COPY_TRIVIAL(float)
_STLP_DECLARE_COPY_TRIVIAL(double)
# if !defined (_STLP_NO_LONG_DOUBLE)
_STLP_DECLARE_COPY_TRIVIAL(long double)
# endif
# undef _STLP_DECLARE_COPY_TRIVIAL
#endif
//--------------------------------------------------
// copy_n (not part of the C++ standard)
#if !defined (_STLP_NO_EXTENSIONS)
_STLP_MOVE_TO_PRIV_NAMESPACE
template <class _InputIter, class _Size, class _OutputIter>
_STLP_INLINE_LOOP _STLP_STD::pair<_InputIter, _OutputIter>
__copy_n(_InputIter __first, _Size __count, _OutputIter __result,
const input_iterator_tag &) {
for ( ; __count > 0; --__count) {
*__result = *__first;
++__first;
++__result;
}
return _STLP_STD::pair<_InputIter, _OutputIter>(__first, __result);
}
template <class _RAIter, class _Size, class _OutputIter>
inline _STLP_STD::pair<_RAIter, _OutputIter>
__copy_n(_RAIter __first, _Size __count, _OutputIter __result,
const random_access_iterator_tag &) {
_RAIter __last = __first + __count;
return _STLP_STD::pair<_RAIter, _OutputIter>(__last, _STLP_STD::copy(__first, __last, __result));
}
_STLP_MOVE_TO_STD_NAMESPACE
template <class _InputIter, class _Size, class _OutputIter>
inline pair<_InputIter, _OutputIter>
copy_n(_InputIter __first, _Size __count, _OutputIter __result) {
_STLP_FIX_LITERAL_BUG(__first)
return _STLP_PRIV __copy_n(__first, __count, __result, _STLP_ITERATOR_CATEGORY(__first, _InputIter));
}
#endif
//--------------------------------------------------
// fill and fill_n
_STLP_MOVE_TO_PRIV_NAMESPACE
template <class _ForwardIter, class _Tp>
_STLP_INLINE_LOOP
void __fill_fwd(_ForwardIter __first, _ForwardIter __last, const _Tp& __val) {
for ( ; __first != __last; ++__first)
*__first = __val;
}
template <class _ForwardIter, class _Tp, class _Distance>
inline void __fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
const input_iterator_tag &, _Distance*) {
_STLP_PRIV __fill_fwd(__first, __last, __val);
}
#if defined (_STLP_NONTEMPL_BASE_MATCH_BUG)
template <class _ForwardIter, class _Tp, class _Distance>
_STLP_INLINE_LOOP
void __fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
const forward_iterator_tag &, _Distance*) {
_STLP_PRIV __fill_fwd(__first, __last, __val);
}
template <class _ForwardIter, class _Tp, class _Distance>
_STLP_INLINE_LOOP
void __fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __val,
const bidirectional_iterator_tag &, _Distance*) {
_STLP_PRIV __fill_fwd(__first, __last, __val);
}
#endif
template <class _RandomAccessIter, class _Tp, class _Distance>
_STLP_INLINE_LOOP
void __fill(_RandomAccessIter __first, _RandomAccessIter __last, const _Tp& __val,
const random_access_iterator_tag &, _Distance*) {
for (_Distance __n = __last - __first ; __n > 0; ++__first, --__n)
*__first = __val;
}
_STLP_MOVE_TO_STD_NAMESPACE
template <class _ForwardIter, class _Tp>
inline void fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __val) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
_STLP_PRIV __fill(__first, __last, __val,
_STLP_ITERATOR_CATEGORY(__first, _ForwardIter),
_STLP_DISTANCE_TYPE(__first, _ForwardIter));
}
// Specialization: for one-byte types we can use memset.
inline void fill(unsigned char* __first, unsigned char* __last,
const unsigned char& __val) {
unsigned char __tmp = __val;
memset(__first, __tmp, __last - __first);
}
#if !defined (_STLP_NO_SIGNED_BUILTINS)
inline void fill(signed char* __first, signed char* __last,
const signed char& __val) {
signed char __tmp = __val;
memset(__first, __STATIC_CAST(unsigned char,__tmp), __last - __first);
}
#endif
inline void fill(char* __first, char* __last, const char& __val) {
char __tmp = __val;
memset(__first, __STATIC_CAST(unsigned char,__tmp), __last - __first);
}
_STLP_MOVE_TO_PRIV_NAMESPACE
template <class _OutputIter, class _Size, class _Tp>
_STLP_INLINE_LOOP
_OutputIter __fill_n(_OutputIter __first, _Size __n, const _Tp& __val) {
_STLP_FIX_LITERAL_BUG(__first)
for ( ; __n > 0; --__n, ++__first)
*__first = __val;
return __first;
}
#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
template <class _Size>
inline unsigned char* __fill_n(unsigned char* __first, _Size __n,
const unsigned char& __val) {
_STLP_STD::fill(__first, __first + __n, __val);
return __first + __n;
}
#if !defined (_STLP_NO_SIGNED_BUILTINS)
template <class _Size>
inline signed char* __fill_n(signed char* __first, _Size __n,
const signed char& __val) {
_STLP_STD::fill(__first, __first + __n, __val);
return __first + __n;
}
#endif
template <class _Size>
inline char* __fill_n(char* __first, _Size __n,
const char& __val) {
_STLP_STD::fill(__first, __first + __n, __val);
return __first + __n;
}
#endif
_STLP_MOVE_TO_STD_NAMESPACE
template <class _OutputIter, class _Size, class _Tp>
inline void fill_n(_OutputIter __first, _Size __n, const _Tp& __val) {
_STLP_FIX_LITERAL_BUG(__first)
_STLP_PRIV __fill_n(__first, __n, __val);
}
//--------------------------------------------------
// equal and mismatch
template <class _InputIter1, class _InputIter2>
_STLP_INLINE_LOOP
_STLP_STD::pair<_InputIter1, _InputIter2> mismatch(_InputIter1 __first1,
_InputIter1 __last1,
_InputIter2 __first2) {
_STLP_FIX_LITERAL_BUG(__first2)
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
while (__first1 != __last1 && *__first1 == *__first2) {
++__first1;
++__first2;
}
return _STLP_STD::pair<_InputIter1, _InputIter2>(__first1, __first2);
}
template <class _InputIter1, class _InputIter2, class _BinaryPredicate>
_STLP_INLINE_LOOP
_STLP_STD::pair<_InputIter1, _InputIter2> mismatch(_InputIter1 __first1,
_InputIter1 __last1,
_InputIter2 __first2,
_BinaryPredicate __binary_pred) {
_STLP_FIX_LITERAL_BUG(__first2)
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
while (__first1 != __last1 && __binary_pred(*__first1, *__first2)) {
++__first1;
++__first2;
}
return _STLP_STD::pair<_InputIter1, _InputIter2>(__first1, __first2);
}
template <class _InputIter1, class _InputIter2>
_STLP_INLINE_LOOP
bool equal(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2) {
_STLP_FIX_LITERAL_BUG(__first1) _STLP_FIX_LITERAL_BUG(__last1) _STLP_FIX_LITERAL_BUG(__first2)
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
for ( ; __first1 != __last1; ++__first1, ++__first2)
if (!(*__first1 == *__first2))
return false;
return true;
}
template <class _InputIter1, class _InputIter2, class _BinaryPredicate>
_STLP_INLINE_LOOP
bool equal(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _BinaryPredicate __binary_pred) {
_STLP_FIX_LITERAL_BUG(__first2)
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
for ( ; __first1 != __last1; ++__first1, ++__first2)
if (!__binary_pred(*__first1, *__first2))
return false;
return true;
}
//--------------------------------------------------
// lexicographical_compare and lexicographical_compare_3way.
// (the latter is not part of the C++ standard.)
template <class _InputIter1, class _InputIter2>
bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _InputIter2 __last2);
template <class _InputIter1, class _InputIter2, class _Compare>
bool lexicographical_compare(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _InputIter2 __last2,
_Compare __comp);
inline bool
lexicographical_compare(const unsigned char* __first1,
const unsigned char* __last1,
const unsigned char* __first2,
const unsigned char* __last2) {
const size_t __len1 = __last1 - __first1;
const size_t __len2 = __last2 - __first2;
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
const int __result = memcmp(__first1, __first2, (min) (__len1, __len2));
return __result != 0 ? (__result < 0) : (__len1 < __len2);
}
#if !(CHAR_MAX == SCHAR_MAX)
inline bool lexicographical_compare(const char* __first1, const char* __last1,
const char* __first2, const char* __last2) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first1, __last1))
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first2, __last2))
return lexicographical_compare((const unsigned char*) __first1,
(const unsigned char*) __last1,
(const unsigned char*) __first2,
(const unsigned char*) __last2);
}
#endif /* CHAR_MAX == SCHAR_MAX */
_STLP_MOVE_TO_PRIV_NAMESPACE
template <class _InputIter1, class _InputIter2>
int __lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _InputIter2 __last2);
inline int
__lexicographical_compare_3way(const unsigned char* __first1,
const unsigned char* __last1,
const unsigned char* __first2,
const unsigned char* __last2) {
const ptrdiff_t __len1 = __last1 - __first1;
const ptrdiff_t __len2 = __last2 - __first2;
const int __result = memcmp(__first1, __first2, (min) (__len1, __len2));
return __result != 0 ? __result
: (__len1 == __len2 ? 0 : (__len1 < __len2 ? -1 : 1));
}
#if !(CHAR_MAX == SCHAR_MAX)
inline int
__lexicographical_compare_3way(const char* __first1, const char* __last1,
const char* __first2, const char* __last2) {
return __lexicographical_compare_3way((const unsigned char*) __first1,
(const unsigned char*) __last1,
(const unsigned char*) __first2,
(const unsigned char*) __last2);
}
#endif
_STLP_MOVE_TO_STD_NAMESPACE
#if !defined (_STLP_NO_EXTENSIONS)
template <class _InputIter1, class _InputIter2>
int lexicographical_compare_3way(_InputIter1 __first1, _InputIter1 __last1,
_InputIter2 __first2, _InputIter2 __last2);
#endif
// count
template <class _InputIter, class _Tp>
_STLP_INLINE_LOOP _STLP_DIFFERENCE_TYPE(_InputIter)
count(_InputIter __first, _InputIter __last, const _Tp& __val) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
_STLP_DIFFERENCE_TYPE(_InputIter) __n = 0;
for ( ; __first != __last; ++__first)
if (*__first == __val)
++__n;
return __n;
}
// find and find_if. Note find may be expressed in terms of find_if if appropriate binder was available.
template <class _InputIter, class _Tp>
_InputIter find(_InputIter __first, _InputIter __last, const _Tp& __val);
template <class _InputIter, class _Predicate>
_InputIter find_if(_InputIter __first, _InputIter __last, _Predicate __pred);
// search.
template <class _ForwardIter1, class _ForwardIter2, class _BinaryPred>
_ForwardIter1 search(_ForwardIter1 __first1, _ForwardIter1 __last1,
_ForwardIter2 __first2, _ForwardIter2 __last2, _BinaryPred __predicate);
_STLP_MOVE_TO_PRIV_NAMESPACE
// find_first_of
template <class _InputIter, class _ForwardIter>
_InputIter __find_first_of(_InputIter __first1, _InputIter __last1,
_ForwardIter __first2, _ForwardIter __last2);
template <class _InputIter, class _ForwardIter, class _BinaryPredicate>
_InputIter __find_first_of(_InputIter __first1, _InputIter __last1,
_ForwardIter __first2, _ForwardIter __last2,
_BinaryPredicate __comp);
_STLP_MOVE_TO_STD_NAMESPACE
template <class _ForwardIter1, class _ForwardIter2,
class _BinaryPredicate>
_ForwardIter1
find_end(_ForwardIter1 __first1, _ForwardIter1 __last1,
_ForwardIter2 __first2, _ForwardIter2 __last2,
_BinaryPredicate __comp);
// replace
template <class _ForwardIter, class _Tp>
_STLP_INLINE_LOOP void
replace(_ForwardIter __first, _ForwardIter __last,
const _Tp& __old_value, const _Tp& __new_value) {
_STLP_DEBUG_CHECK(_STLP_PRIV __check_range(__first, __last))
for ( ; __first != __last; ++__first)
if (*__first == __old_value)
*__first = __new_value;
}
_STLP_MOVE_TO_PRIV_NAMESPACE
template <class _ForwardIter, class _Tp, class _Compare1, class _Compare2, class _Distance>
_ForwardIter __lower_bound(_ForwardIter __first, _ForwardIter __last,
const _Tp& __val, _Compare1 __comp1, _Compare2 __comp2, _Distance*);
_STLP_MOVE_TO_STD_NAMESPACE
_STLP_END_NAMESPACE
#if !defined (_STLP_LINK_TIME_INSTANTIATION)
# include <stl/_algobase.c>
#endif
#endif /* _STLP_INTERNAL_ALGOBASE_H */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,87 @@
/*
*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1997
* Moscow Center for SPARC Technology
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_ALLOC_C
#define _STLP_ALLOC_C
#ifndef _STLP_INTERNAL_ALLOC_H
# include <stl/_alloc.h>
#endif
#if defined (__WATCOMC__)
# pragma warning 13 9
# pragma warning 367 9
# pragma warning 368 9
#endif
_STLP_BEGIN_NAMESPACE
template <class _Alloc>
void * _STLP_CALL __debug_alloc<_Alloc>::allocate(size_t __n) {
size_t __total_extra = __extra_before_chunk() + __extra_after_chunk();
size_t __real_n = __n + __total_extra;
if (__real_n < __n) {
//It means that we rolled on size_t, __n must be very large:
_STLP_THROW_BAD_ALLOC;
}
__alloc_header *__result = (__alloc_header *)__allocator_type::allocate(__real_n);
memset((char*)__result, __shred_byte, __real_n * sizeof(value_type));
__result->__magic = __magic;
__result->__type_size = sizeof(value_type);
__result->_M_size = (_STLP_UINT32_T)__n;
return ((char*)__result) + (long)__extra_before;
}
template <class _Alloc>
void _STLP_CALL
__debug_alloc<_Alloc>::deallocate(void *__p, size_t __n) {
__alloc_header * __real_p = (__alloc_header*)((char *)__p -(long)__extra_before);
// check integrity
_STLP_VERBOSE_ASSERT(__real_p->__magic != __deleted_magic, _StlMsg_DBA_DELETED_TWICE)
_STLP_VERBOSE_ASSERT(__real_p->__magic == __magic, _StlMsg_DBA_NEVER_ALLOCATED)
_STLP_VERBOSE_ASSERT(__real_p->__type_size == 1,_StlMsg_DBA_TYPE_MISMATCH)
_STLP_VERBOSE_ASSERT(__real_p->_M_size == __n, _StlMsg_DBA_SIZE_MISMATCH)
// check pads on both sides
unsigned char* __tmp;
for (__tmp = (unsigned char*)(__real_p + 1); __tmp < (unsigned char*)__p; ++__tmp) {
_STLP_VERBOSE_ASSERT(*__tmp == __shred_byte, _StlMsg_DBA_UNDERRUN)
}
size_t __real_n = __n + __extra_before_chunk() + __extra_after_chunk();
for (__tmp= ((unsigned char*)__p) + __n * sizeof(value_type);
__tmp < ((unsigned char*)__real_p) + __real_n ; ++__tmp) {
_STLP_VERBOSE_ASSERT(*__tmp == __shred_byte, _StlMsg_DBA_OVERRUN)
}
// that may be unfortunate, just in case
__real_p->__magic = __deleted_magic;
memset((char*)__p, __shred_byte, __n * sizeof(value_type));
__allocator_type::deallocate(__real_p, __real_n);
}
_STLP_END_NAMESPACE
#endif /* _STLP_ALLOC_C */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,580 @@
/*
*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1997
* Moscow Center for SPARC Technology
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
/* NOTE: This is an internal header file, included by other STL headers.
* You should not attempt to use it directly.
*/
#ifndef _STLP_INTERNAL_ALLOC_H
#define _STLP_INTERNAL_ALLOC_H
#ifndef _STLP_INTERNAL_CSTDDEF
# include <stl/_cstddef.h>
#endif
#ifndef _STLP_INTERNAL_CSTDLIB
# include <stl/_cstdlib.h>
#endif
#ifndef _STLP_INTERNAL_CSTRING
# include <stl/_cstring.h>
#endif
#ifndef _STLP_INTERNAL_ALGOBASE_H
# include <stl/_algobase.h>
#endif
#ifndef _STLP_INTERNAL_NEW_HEADER
# include <stl/_new.h>
#endif
#ifndef _STLP_INTERNAL_CONSTRUCT_H
# include <stl/_construct.h>
#endif
_STLP_BEGIN_NAMESPACE
// Malloc-based allocator. Typically slower than default alloc below.
// Typically thread-safe and more storage efficient.
#if !defined (_STLP_USE_NO_IOSTREAMS)
typedef void (* __oom_handler_type)();
#endif
class _STLP_CLASS_DECLSPEC __malloc_alloc {
public:
// this one is needed for proper simple_alloc wrapping
typedef char value_type;
static void* _STLP_CALL allocate(size_t __n)
#if !defined (_STLP_USE_NO_IOSTREAMS)
;
#else
{
void *__result = malloc(__n);
if (__result == 0) {
_STLP_THROW_BAD_ALLOC;
}
return __result;
}
#endif
static void _STLP_CALL deallocate(void* __p, size_t /* __n */) { free((char*)__p); }
#if !defined (_STLP_USE_NO_IOSTREAMS)
static __oom_handler_type _STLP_CALL set_malloc_handler(__oom_handler_type __f);
#endif
};
// New-based allocator. Typically slower than default alloc below.
// Typically thread-safe and more storage efficient.
class _STLP_CLASS_DECLSPEC __new_alloc {
public:
// this one is needed for proper simple_alloc wrapping
typedef char value_type;
static void* _STLP_CALL allocate(size_t __n) { return __stl_new(__n); }
static void _STLP_CALL deallocate(void* __p, size_t) { __stl_delete(__p); }
};
// Allocator adaptor to check size arguments for debugging.
// Reports errors using assert. Checking can be disabled with
// NDEBUG, but it's far better to just use the underlying allocator
// instead when no checking is desired.
// There is some evidence that this can confuse Purify.
// This adaptor can only be applied to raw allocators
template <class _Alloc>
class __debug_alloc : public _Alloc {
public:
typedef _Alloc __allocator_type;
typedef typename _Alloc::value_type value_type;
private:
struct __alloc_header {
size_t __magic: 16;
size_t __type_size:16;
_STLP_UINT32_T _M_size;
}; // that is 8 bytes for sure
// Sunpro CC has bug on enums, so extra_before/after set explicitly
enum { __pad = 8, __magic = 0xdeba, __deleted_magic = 0xdebd,
__shred_byte = _STLP_SHRED_BYTE };
enum { __extra_before = 16, __extra_after = 8 };
// Size of space used to store size. Note
// that this must be large enough to preserve
// alignment.
static size_t _STLP_CALL __extra_before_chunk() {
return (long)__extra_before / sizeof(value_type) +
(size_t)((long)__extra_before % sizeof(value_type) > 0);
}
static size_t _STLP_CALL __extra_after_chunk() {
return (long)__extra_after / sizeof(value_type) +
(size_t)((long)__extra_after % sizeof(value_type) > 0);
}
public:
__debug_alloc() {}
~__debug_alloc() {}
static void* _STLP_CALL allocate(size_t);
static void _STLP_CALL deallocate(void *, size_t);
};
# if defined (__OS400__)
// dums 02/05/2007: is it really necessary ?
enum { _MAX_BYTES = 256 };
# else
enum { _MAX_BYTES = 32 * sizeof(void*) };
# endif
#if !defined (_STLP_USE_NO_IOSTREAMS)
// Default node allocator.
// With a reasonable compiler, this should be roughly as fast as the
// original STL class-specific allocators, but with less fragmentation.
class _STLP_CLASS_DECLSPEC __node_alloc {
static void * _STLP_CALL _M_allocate(size_t& __n);
/* __p may not be 0 */
static void _STLP_CALL _M_deallocate(void *__p, size_t __n);
public:
// this one is needed for proper simple_alloc wrapping
typedef char value_type;
/* __n must be > 0 */
static void* _STLP_CALL allocate(size_t& __n)
{ return (__n > (size_t)_MAX_BYTES) ? __stl_new(__n) : _M_allocate(__n); }
/* __p may not be 0 */
static void _STLP_CALL deallocate(void *__p, size_t __n)
{ if (__n > (size_t)_MAX_BYTES) __stl_delete(__p); else _M_deallocate(__p, __n); }
};
# if defined (_STLP_USE_TEMPLATE_EXPORT)
_STLP_EXPORT_TEMPLATE_CLASS __debug_alloc<__node_alloc>;
# endif
#endif
#if defined (_STLP_USE_TEMPLATE_EXPORT)
_STLP_EXPORT_TEMPLATE_CLASS __debug_alloc<__new_alloc>;
_STLP_EXPORT_TEMPLATE_CLASS __debug_alloc<__malloc_alloc>;
#endif
/* macro to convert the allocator for initialization
* not using MEMBER_TEMPLATE_CLASSES as it should work given template constructor */
#if defined (_STLP_MEMBER_TEMPLATES) || ! defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
/* if _STLP_NO_TEMPLATE_CONVERSIONS is set, the member template constructor is
* not used implicitly to convert allocator parameter, so let us do it explicitly */
# if defined (_STLP_MEMBER_TEMPLATE_CLASSES) && defined (_STLP_NO_TEMPLATE_CONVERSIONS)
# define _STLP_CONVERT_ALLOCATOR(__a, _Tp) __stl_alloc_create(__a,(_Tp*)0)
# else
# define _STLP_CONVERT_ALLOCATOR(__a, _Tp) __a
# endif
/* else convert, but only if partial specialization works, since else
* Container::allocator_type won't be different */
#else
# define _STLP_CONVERT_ALLOCATOR(__a, _Tp) __stl_alloc_create(__a,(_Tp*)0)
#endif
// Another allocator adaptor: _Alloc_traits. This serves two
// purposes. First, make it possible to write containers that can use
// either SGI-style allocators or standard-conforming allocator.
// The fully general version.
template <class _Tp, class _Allocator>
struct _Alloc_traits {
typedef _Allocator _Orig;
#if !defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE)
typedef typename _Allocator::_STLP_TEMPLATE rebind<_Tp> _Rebind_type;
typedef typename _Rebind_type::other allocator_type;
static allocator_type create_allocator(const _Orig& __a)
{ return allocator_type(_STLP_CONVERT_ALLOCATOR(__a, _Tp)); }
#else
// this is not actually true, used only to pass this type through
// to dynamic overload selection in _STLP_alloc_proxy methods
typedef _Allocator allocator_type;
#endif
};
#if defined (_STLP_USE_PERTHREAD_ALLOC)
_STLP_END_NAMESPACE
// include additional header here
# include <stl/_pthread_alloc.h>
_STLP_BEGIN_NAMESPACE
typedef __pthread_alloc __alloc_type;
#elif defined (_STLP_USE_NEWALLOC)
typedef __new_alloc __alloc_type;
#elif defined (_STLP_USE_MALLOC)
typedef __malloc_alloc __alloc_type;
#else
typedef __node_alloc __alloc_type;
#endif
#if defined (_STLP_DEBUG_ALLOC)
typedef __debug_alloc<__alloc_type> __sgi_alloc;
#else
typedef __alloc_type __sgi_alloc;
#endif
#if !defined (_STLP_NO_ANACHRONISMS)
typedef __sgi_alloc __single_client_alloc;
typedef __sgi_alloc __multithreaded_alloc;
#endif
// This implements allocators as specified in the C++ standard.
//
// Note that standard-conforming allocators use many language features
// that are not yet widely implemented. In particular, they rely on
// member templates, partial specialization, partial ordering of function
// templates, the typename keyword, and the use of the template keyword
// to refer to a template member of a dependent type.
/*
template <class _Tp>
struct _AllocatorAux {
typedef _Tp* pointer;
typedef const _Tp* const_pointer;
typedef _Tp& reference;
typedef const _Tp& const_reference;
pointer address(reference __x) const {return &__x;}
const_pointer address(const_reference __x) const { return &__x; }
};
template <class _Tp>
struct _AllocatorAux<const _Tp> {
typedef _Tp* pointer;
typedef const _Tp* const_pointer;
typedef _Tp& reference;
typedef const _Tp& const_reference;
const_pointer address(const_reference __x) const { return &__x; }
};
*/
template <class _Tp>
class allocator //: public _AllocatorAux<_Tp>
/* A small helper struct to recognize STLport allocator implementation
* from any user specialization one.
*/
: public __stlport_class<allocator<_Tp> >
{
public:
typedef _Tp value_type;
typedef _Tp* pointer;
typedef const _Tp* const_pointer;
typedef _Tp& reference;
typedef const _Tp& const_reference;
typedef size_t size_type;
typedef ptrdiff_t difference_type;
#if defined (_STLP_MEMBER_TEMPLATE_CLASSES)
template <class _Tp1> struct rebind {
typedef allocator<_Tp1> other;
};
#endif
allocator() _STLP_NOTHROW {}
#if defined (_STLP_MEMBER_TEMPLATES)
template <class _Tp1> allocator(const allocator<_Tp1>&) _STLP_NOTHROW {}
#endif
allocator(const allocator<_Tp>&) _STLP_NOTHROW {}
#if !defined (_STLP_NO_MOVE_SEMANTIC)
allocator(__move_source<allocator<_Tp> > src) _STLP_NOTHROW {}
#endif
~allocator() _STLP_NOTHROW {}
pointer address(reference __x) const {return &__x;}
const_pointer address(const_reference __x) const { return &__x; }
// __n is permitted to be 0. The C++ standard says nothing about what the return value is when __n == 0.
_Tp* allocate(size_type __n, const void* = 0) {
if (__n > max_size()) {
_STLP_THROW_BAD_ALLOC;
}
if (__n != 0) {
size_type __buf_size = __n * sizeof(value_type);
_Tp* __ret = __REINTERPRET_CAST(_Tp*, __sgi_alloc::allocate(__buf_size));
#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size);
#endif
return __ret;
}
return 0;
}
// __p is permitted to be a null pointer, only if n==0.
void deallocate(pointer __p, size_type __n) {
_STLP_ASSERT( (__p == 0) == (__n == 0) )
if (__p != 0) {
#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
memset((char*)__p, _STLP_SHRED_BYTE, __n * sizeof(value_type));
#endif
__sgi_alloc::deallocate((void*)__p, __n * sizeof(value_type));
}
}
#if !defined (_STLP_NO_ANACHRONISMS)
// backwards compatibility
void deallocate(pointer __p) const { if (__p != 0) __sgi_alloc::deallocate((void*)__p, sizeof(value_type)); }
#endif
size_type max_size() const _STLP_NOTHROW { return size_t(-1) / sizeof(value_type); }
void construct(pointer __p, const_reference __val) { _STLP_STD::_Copy_Construct(__p, __val); }
void destroy(pointer __p) { _STLP_STD::_Destroy(__p); }
#if defined (_STLP_NO_EXTENSIONS)
/* STLport extension giving rounded size of an allocated memory buffer
* This method do not have to be part of a user defined allocator implementation
* and won't even be called if such a function was granted.
*/
protected:
#endif
_Tp* _M_allocate(size_type __n, size_type& __allocated_n) {
if (__n > max_size()) {
_STLP_THROW_BAD_ALLOC;
}
if (__n != 0) {
size_type __buf_size = __n * sizeof(value_type);
_Tp* __ret = __REINTERPRET_CAST(_Tp*, __sgi_alloc::allocate(__buf_size));
#if defined (_STLP_DEBUG_UNINITIALIZED) && !defined (_STLP_DEBUG_ALLOC)
memset((char*)__ret, _STLP_SHRED_BYTE, __buf_size);
#endif
__allocated_n = __buf_size / sizeof(value_type);
return __ret;
}
return 0;
}
#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
void _M_swap_workaround(allocator<_Tp>& __other) {}
#endif
};
_STLP_TEMPLATE_NULL
class _STLP_CLASS_DECLSPEC allocator<void> {
public:
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef void* pointer;
typedef const void* const_pointer;
#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
typedef void value_type;
#endif
#if defined (_STLP_MEMBER_TEMPLATE_CLASSES)
template <class _Tp1> struct rebind {
typedef allocator<_Tp1> other;
};
#endif
};
template <class _T1, class _T2>
inline bool _STLP_CALL operator==(const allocator<_T1>&, const allocator<_T2>&) _STLP_NOTHROW
{ return true; }
template <class _T1, class _T2>
inline bool _STLP_CALL operator!=(const allocator<_T1>&, const allocator<_T2>&) _STLP_NOTHROW
{ return false; }
#if defined (_STLP_USE_TEMPLATE_EXPORT)
_STLP_EXPORT_TEMPLATE_CLASS allocator<char>;
# if defined (_STLP_HAS_WCHAR_T)
_STLP_EXPORT_TEMPLATE_CLASS allocator<wchar_t>;
# endif
# if defined (_STLP_USE_PTR_SPECIALIZATIONS)
_STLP_EXPORT_TEMPLATE_CLASS allocator<void*>;
# endif
#endif
_STLP_MOVE_TO_PRIV_NAMESPACE
template <class _Tp>
struct __alloc_type_traits {
#if !defined (__BORLANDC__)
typedef typename _IsSTLportClass<allocator<_Tp> >::_Ret _STLportAlloc;
#else
enum { _Is = _IsSTLportClass<allocator<_Tp> >::_Is };
typedef typename __bool2type<_Is>::_Ret _STLportAlloc;
#endif
//The default allocator implementation which is recognize thanks to the
//__stlport_class inheritance is a stateless object so:
typedef _STLportAlloc has_trivial_default_constructor;
typedef _STLportAlloc has_trivial_copy_constructor;
typedef _STLportAlloc has_trivial_assignment_operator;
typedef _STLportAlloc has_trivial_destructor;
typedef _STLportAlloc is_POD_type;
};
_STLP_MOVE_TO_STD_NAMESPACE
#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
template <class _Tp>
struct __type_traits<allocator<_Tp> > : _STLP_PRIV __alloc_type_traits<_Tp> {};
#else
_STLP_TEMPLATE_NULL
struct __type_traits<allocator<char> > : _STLP_PRIV __alloc_type_traits<char> {};
# if defined (_STLP_HAS_WCHAR_T)
_STLP_TEMPLATE_NULL
struct __type_traits<allocator<wchar_t> > : _STLP_PRIV __alloc_type_traits<wchar_t> {};
# endif
# if defined (_STLP_USE_PTR_SPECIALIZATIONS)
_STLP_TEMPLATE_NULL
struct __type_traits<allocator<void*> > : _STLP_PRIV __alloc_type_traits<void*> {};
# endif
#endif
#if !defined (_STLP_FORCE_ALLOCATORS)
# define _STLP_FORCE_ALLOCATORS(a,y)
#endif
#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_MEMBER_TEMPLATE_CLASSES)
// The version for the default allocator, for rare occasion when we have partial spec w/o member template classes
template <class _Tp, class _Tp1>
struct _Alloc_traits<_Tp, allocator<_Tp1> > {
typedef allocator<_Tp1> _Orig;
typedef allocator<_Tp> allocator_type;
static allocator_type create_allocator(const allocator<_Tp1 >& __a)
{ return allocator_type(_STLP_CONVERT_ALLOCATOR(__a, _Tp)); }
};
#endif
#if !defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE) && defined (_STLP_MEMBER_TEMPLATES)
template <class _Tp, class _Alloc>
inline _STLP_TYPENAME_ON_RETURN_TYPE _Alloc_traits<_Tp, _Alloc>::allocator_type _STLP_CALL
__stl_alloc_create(const _Alloc& __a, const _Tp*) {
typedef typename _Alloc::_STLP_TEMPLATE rebind<_Tp>::other _Rebound_type;
return _Rebound_type(__a);
}
#else
// If custom allocators are being used without member template classes support :
// user (on purpose) is forced to define rebind/get operations !!!
template <class _Tp1, class _Tp2>
inline allocator<_Tp2>& _STLP_CALL
__stl_alloc_rebind(allocator<_Tp1>& __a, const _Tp2*) { return (allocator<_Tp2>&)(__a); }
template <class _Tp1, class _Tp2>
inline allocator<_Tp2> _STLP_CALL
__stl_alloc_create(const allocator<_Tp1>&, const _Tp2*) { return allocator<_Tp2>(); }
#endif
_STLP_MOVE_TO_PRIV_NAMESPACE
// inheritance is being used for EBO optimization
template <class _Value, class _Tp, class _MaybeReboundAlloc>
class _STLP_alloc_proxy : public _MaybeReboundAlloc {
private:
typedef _MaybeReboundAlloc _Base;
typedef typename _Base::size_type size_type;
typedef _STLP_alloc_proxy<_Value, _Tp, _MaybeReboundAlloc> _Self;
public:
_Value _M_data;
_STLP_alloc_proxy (const _MaybeReboundAlloc& __a, _Value __p) :
_MaybeReboundAlloc(__a), _M_data(__p) {}
#if !defined (_STLP_NO_MOVE_SEMANTIC)
_STLP_alloc_proxy (__move_source<_Self> src) :
_Base(_STLP_PRIV _AsMoveSource(src.get()._M_base())),
_M_data(_STLP_PRIV _AsMoveSource(src.get()._M_data)) {}
_Base& _M_base()
{ return *this; }
#endif
private:
/* Following are helper methods to detect stateless allocators and avoid
* swap in this case. For some compilers (VC6) it is a workaround for a
* compiler bug in the Empty Base class Optimization feature, for others
* it is a small optimization or nothing if no EBO. */
void _M_swap_alloc(_Self&, const __true_type& /*_IsStateless*/)
{}
void _M_swap_alloc(_Self& __x, const __false_type& /*_IsStateless*/) {
_MaybeReboundAlloc &__base_this = *this;
_MaybeReboundAlloc &__base_x = __x;
_STLP_STD::swap(__base_this, __base_x);
}
public:
void _M_swap_alloc(_Self& __x) {
#if !defined (__BORLANDC__)
typedef typename _IsStateless<_MaybeReboundAlloc>::_Ret _StatelessAlloc;
#else
typedef typename __bool2type<_IsStateless<_MaybeReboundAlloc>::_Is>::_Ret _StatelessAlloc;
#endif
_M_swap_alloc(__x, _StatelessAlloc());
}
/* We need to define the following swap implementation for allocator with state
* as those allocators might have implement a special swap function to correctly
* move datas from an instance to the oher, _STLP_alloc_proxy should not break
* this mecanism. */
void swap(_Self& __x) {
_M_swap_alloc(__x);
_STLP_STD::swap(_M_data, __x._M_data);
}
_Tp* allocate(size_type __n, size_type& __allocated_n) {
#if !defined (__BORLANDC__)
typedef typename _IsSTLportClass<_MaybeReboundAlloc>::_Ret _STLportAlloc;
#else
typedef typename __bool2type<_IsSTLportClass<_MaybeReboundAlloc>::_Is>::_Ret _STLportAlloc;
#endif
return allocate(__n, __allocated_n, _STLportAlloc());
}
// Unified interface to perform allocate()/deallocate() with limited
// language support
#if defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE)
// else it is rebound already, and allocate() member is accessible
_Tp* allocate(size_type __n)
{ return __stl_alloc_rebind(__STATIC_CAST(_Base&, *this), __STATIC_CAST(_Tp*, 0)).allocate(__n, 0); }
void deallocate(_Tp* __p, size_type __n)
{ __stl_alloc_rebind(__STATIC_CAST(_Base&, *this), __STATIC_CAST(_Tp*, 0)).deallocate(__p, __n); }
private:
_Tp* allocate(size_type __n, size_type& __allocated_n, const __true_type& /*STLport allocator*/)
{ return __stl_alloc_rebind(__STATIC_CAST(_Base&, *this), __STATIC_CAST(_Tp*, 0))._M_allocate(__n, __allocated_n); }
#else
//Expose Standard allocate overload (using expression do not work for some compilers (Borland))
_Tp* allocate(size_type __n)
{ return _Base::allocate(__n); }
private:
_Tp* allocate(size_type __n, size_type& __allocated_n, const __true_type& /*STLport allocator*/)
{ return _Base::_M_allocate(__n, __allocated_n); }
#endif
_Tp* allocate(size_type __n, size_type& __allocated_n, const __false_type& /*STLport allocator*/)
{ __allocated_n = __n; return allocate(__n); }
};
#if defined (_STLP_USE_TEMPLATE_EXPORT)
_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<char*, char, allocator<char> >;
# if defined (_STLP_HAS_WCHAR_T)
_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<wchar_t*, wchar_t, allocator<wchar_t> >;
# endif
# if defined (_STLP_USE_PTR_SPECIALIZATIONS)
_STLP_EXPORT_TEMPLATE_CLASS _STLP_alloc_proxy<void**, void*, allocator<void*> >;
# endif
#endif
_STLP_MOVE_TO_STD_NAMESPACE
_STLP_END_NAMESPACE
#if defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
# include <stl/_alloc.c>
#endif
#endif /* _STLP_INTERNAL_ALLOC_H */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,133 @@
/*
* Copyright (c) 1997-1999
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_AUTO_PTR_H
#define _STLP_AUTO_PTR_H
_STLP_BEGIN_NAMESPACE
// implementation primitive
class __ptr_base {
public:
void* _M_p;
void __set(const volatile void* p) { _M_p = __CONST_CAST(void*,p); }
void __set(void* p) { _M_p = p; }
};
template <class _Tp>
class auto_ptr_ref {
public:
__ptr_base& _M_r;
_Tp* const _M_p;
auto_ptr_ref(__ptr_base& __r, _Tp* __p) : _M_r(__r), _M_p(__p) { }
_Tp* release() const { _M_r.__set(__STATIC_CAST(void*, 0)); return _M_p; }
private:
//explicitely defined as private to avoid warnings:
typedef auto_ptr_ref<_Tp> _Self;
_Self& operator = (_Self const&);
};
template<class _Tp>
class auto_ptr : public __ptr_base {
public:
typedef _Tp element_type;
typedef auto_ptr<_Tp> _Self;
_Tp* release() _STLP_NOTHROW {
_Tp* __px = this->get();
this->_M_p = 0;
return __px;
}
void reset(_Tp* __px = 0) _STLP_NOTHROW {
_Tp* __pt = this->get();
if (__px != __pt)
delete __pt;
this->__set(__px);
}
_Tp* get() const _STLP_NOTHROW
#if !defined (__GNUC__) || (__GNUC__ > 2)
{ return __STATIC_CAST(_Tp*, _M_p); }
#else
{ return __REINTERPRET_CAST(_Tp*, _M_p); }
#endif
#if !defined (_STLP_NO_ARROW_OPERATOR)
_Tp* operator->() const _STLP_NOTHROW {
_STLP_VERBOSE_ASSERT(get() != 0, _StlMsg_AUTO_PTR_NULL)
return get();
}
#endif
_Tp& operator*() const _STLP_NOTHROW {
_STLP_VERBOSE_ASSERT(get() != 0, _StlMsg_AUTO_PTR_NULL)
return *get();
}
explicit auto_ptr(_Tp* __px = 0) _STLP_NOTHROW { this->__set(__px); }
#if defined (_STLP_MEMBER_TEMPLATES)
# if !defined (_STLP_NO_TEMPLATE_CONVERSIONS)
template<class _Tp1> auto_ptr(auto_ptr<_Tp1>& __r) _STLP_NOTHROW {
_Tp* __conversionCheck = __r.release();
this->__set(__conversionCheck);
}
# endif
template<class _Tp1> auto_ptr<_Tp>& operator=(auto_ptr<_Tp1>& __r) _STLP_NOTHROW {
_Tp* __conversionCheck = __r.release();
reset(__conversionCheck);
return *this;
}
#endif
auto_ptr(_Self& __r) _STLP_NOTHROW { this->__set(__r.release()); }
_Self& operator=(_Self& __r) _STLP_NOTHROW {
reset(__r.release());
return *this;
}
~auto_ptr() _STLP_NOTHROW { /* boris : reset(0) might be better */ delete this->get(); }
auto_ptr(auto_ptr_ref<_Tp> __r) _STLP_NOTHROW
{ this->__set(__r.release()); }
_Self& operator=(auto_ptr_ref<_Tp> __r) _STLP_NOTHROW {
reset(__r.release());
return *this;
}
#if defined(_STLP_MEMBER_TEMPLATES) && !defined(_STLP_NO_TEMPLATE_CONVERSIONS)
template<class _Tp1> operator auto_ptr_ref<_Tp1>() _STLP_NOTHROW
{ return auto_ptr_ref<_Tp1>(*this, this->get()); }
template<class _Tp1> operator auto_ptr<_Tp1>() _STLP_NOTHROW
{ return auto_ptr<_Tp1>(release()); }
#else
operator auto_ptr_ref<_Tp>() _STLP_NOTHROW
{ return auto_ptr_ref<_Tp>(*this, this->get()); }
#endif
};
_STLP_END_NAMESPACE
#endif /* _STLP_AUTO_PTR_H */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,235 @@
/*
* Copyright (c) 1998
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_BITSET_C
#define _STLP_BITSET_C
#ifndef _STLP_BITSET_H
# include <stl/_bitset.h>
#endif
#define __BITS_PER_WORD (CHAR_BIT * sizeof(unsigned long))
_STLP_BEGIN_NAMESPACE
_STLP_MOVE_TO_PRIV_NAMESPACE
//
// Definitions of non-inline functions from _Base_bitset.
//
template<size_t _Nw>
void _Base_bitset<_Nw>::_M_do_left_shift(size_t __shift) {
if (__shift != 0) {
const size_t __wshift = __shift / __BITS_PER_WORD;
const size_t __offset = __shift % __BITS_PER_WORD;
if (__offset == 0)
for (size_t __n = _Nw - 1; __n >= __wshift; --__n)
_M_w[__n] = _M_w[__n - __wshift];
else {
const size_t __sub_offset = __BITS_PER_WORD - __offset;
for (size_t __n = _Nw - 1; __n > __wshift; --__n)
_M_w[__n] = (_M_w[__n - __wshift] << __offset) |
(_M_w[__n - __wshift - 1] >> __sub_offset);
_M_w[__wshift] = _M_w[0] << __offset;
}
fill(_M_w + 0, _M_w + __wshift, __STATIC_CAST(_WordT,0));
}
}
template<size_t _Nw>
void _Base_bitset<_Nw>::_M_do_right_shift(size_t __shift) {
if (__shift != 0) {
const size_t __wshift = __shift / __BITS_PER_WORD;
const size_t __offset = __shift % __BITS_PER_WORD;
const size_t __limit = _Nw - __wshift - 1;
if (__offset == 0)
for (size_t __n = 0; __n <= __limit; ++__n)
_M_w[__n] = _M_w[__n + __wshift];
else {
const size_t __sub_offset = __BITS_PER_WORD - __offset;
for (size_t __n = 0; __n < __limit; ++__n)
_M_w[__n] = (_M_w[__n + __wshift] >> __offset) |
(_M_w[__n + __wshift + 1] << __sub_offset);
_M_w[__limit] = _M_w[_Nw-1] >> __offset;
}
fill(_M_w + __limit + 1, _M_w + _Nw, __STATIC_CAST(_WordT,0));
}
}
template<size_t _Nw>
unsigned long _Base_bitset<_Nw>::_M_do_to_ulong() const {
for (size_t __i = 1; __i < _Nw; ++__i)
if (_M_w[__i])
__stl_throw_overflow_error("bitset");
return _M_w[0];
} // End _M_do_to_ulong
template<size_t _Nw>
size_t _Base_bitset<_Nw>::_M_do_find_first(size_t __not_found) const {
for ( size_t __i = 0; __i < _Nw; __i++ ) {
_WordT __thisword = _M_w[__i];
if ( __thisword != __STATIC_CAST(_WordT,0) ) {
// find byte within word
for ( size_t __j = 0; __j < sizeof(_WordT); __j++ ) {
unsigned char __this_byte
= __STATIC_CAST(unsigned char,(__thisword & (~(unsigned char)0)));
if ( __this_byte )
return __i*__BITS_PER_WORD + __j*CHAR_BIT +
_Bs_G::_S_first_one(__this_byte);
__thisword >>= CHAR_BIT;
}
}
}
// not found, so return an indication of failure.
return __not_found;
}
template<size_t _Nw>
size_t
_Base_bitset<_Nw>::_M_do_find_next(size_t __prev,
size_t __not_found) const {
// make bound inclusive
++__prev;
// check out of bounds
if ( __prev >= _Nw * __BITS_PER_WORD )
return __not_found;
// search first word
size_t __i = _S_whichword(__prev);
_WordT __thisword = _M_w[__i];
// mask off bits below bound
__thisword &= (~__STATIC_CAST(_WordT,0)) << _S_whichbit(__prev);
if ( __thisword != __STATIC_CAST(_WordT,0) ) {
// find byte within word
// get first byte into place
__thisword >>= _S_whichbyte(__prev) * CHAR_BIT;
for ( size_t __j = _S_whichbyte(__prev); __j < sizeof(_WordT); ++__j ) {
unsigned char __this_byte
= __STATIC_CAST(unsigned char,(__thisword & (~(unsigned char)0)));
if ( __this_byte )
return __i*__BITS_PER_WORD + __j*CHAR_BIT +
_Bs_G::_S_first_one(__this_byte);
__thisword >>= CHAR_BIT;
}
}
// check subsequent words
++__i;
for ( ; __i < _Nw; ++__i ) {
/* _WordT */ __thisword = _M_w[__i];
if ( __thisword != __STATIC_CAST(_WordT,0) ) {
// find byte within word
for ( size_t __j = 0; __j < sizeof(_WordT); ++__j ) {
unsigned char __this_byte
= __STATIC_CAST(unsigned char,(__thisword & (~(unsigned char)0)));
if ( __this_byte )
return __i*__BITS_PER_WORD + __j*CHAR_BIT +
_Bs_G::_S_first_one(__this_byte);
__thisword >>= CHAR_BIT;
}
}
}
// not found, so return an indication of failure.
return __not_found;
} // end _M_do_find_next
_STLP_MOVE_TO_STD_NAMESPACE
#if !defined (_STLP_NON_TYPE_TMPL_PARAM_BUG)
# if !defined (_STLP_USE_NO_IOSTREAMS)
_STLP_END_NAMESPACE
#ifndef _STLP_STRING_IO_H
# include <stl/_string_io.h> //includes _istream.h and _ostream.h
#endif
_STLP_BEGIN_NAMESPACE
template <class _CharT, class _Traits, size_t _Nb>
basic_istream<_CharT, _Traits>& _STLP_CALL
operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x) {
basic_string<_CharT, _Traits> __tmp;
__tmp.reserve(_Nb);
// Skip whitespace
typename basic_istream<_CharT, _Traits>::sentry __sentry(__is);
if (__sentry) {
basic_streambuf<_CharT, _Traits>* __buf = __is.rdbuf();
for (size_t __i = 0; __i < _Nb; ++__i) {
static typename _Traits::int_type __eof = _Traits::eof();
typename _Traits::int_type __c1 = __buf->sbumpc();
if (_Traits::eq_int_type(__c1, __eof)) {
__is.setstate(ios_base::eofbit);
break;
}
else {
typename _Traits::char_type __c2 = _Traits::to_char_type(__c1);
char __c = __is.narrow(__c2, '*');
if (__c == '0' || __c == '1')
__tmp.push_back(__c);
else if (_Traits::eq_int_type(__buf->sputbackc(__c2), __eof)) {
__is.setstate(ios_base::failbit);
break;
}
}
}
if (__tmp.empty())
__is.setstate(ios_base::failbit);
else
__x._M_copy_from_string(__tmp, __STATIC_CAST(size_t,0), _Nb);
}
return __is;
}
template <class _CharT, class _Traits, size_t _Nb>
basic_ostream<_CharT, _Traits>& _STLP_CALL
operator<<(basic_ostream<_CharT, _Traits>& __os,
const bitset<_Nb>& __x) {
basic_string<_CharT, _Traits> __tmp;
__x._M_copy_to_string(__tmp);
return __os << __tmp;
}
# endif /* !_STLP_USE_NO_IOSTREAMS */
#endif /* _STLP_NON_TYPE_TMPL_PARAM_BUG */
_STLP_END_NAMESPACE
#undef __BITS_PER_WORD
#undef bitset
#endif /* _STLP_BITSET_C */

View file

@ -0,0 +1,880 @@
/*
* Copyright (c) 1998
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
#ifndef _STLP_BITSET_H
#define _STLP_BITSET_H
// A bitset of size N has N % (sizeof(unsigned long) * CHAR_BIT) unused
// bits. (They are the high- order bits in the highest word.) It is
// a class invariant of class bitset<> that those unused bits are
// always zero.
// Most of the actual code isn't contained in bitset<> itself, but in the
// base class _Base_bitset. The base class works with whole words, not with
// individual bits. This allows us to specialize _Base_bitset for the
// important special case where the bitset is only a single word.
// The C++ standard does not define the precise semantics of operator[].
// In this implementation the const version of operator[] is equivalent
// to test(), except that it does no range checking. The non-const version
// returns a reference to a bit, again without doing any range checking.
#ifndef _STLP_INTERNAL_ALGOBASE_H
# include <stl/_algobase.h>
#endif
#ifndef _STLP_INTERNAL_ALLOC_H
# include <stl/_alloc.h>
#endif
#ifndef _STLP_INTERNAL_ITERATOR_H
# include <stl/_iterator.h>
#endif
#ifndef _STLP_INTERNAL_UNINITIALIZED_H
# include <stl/_uninitialized.h>
#endif
#ifndef _STLP_RANGE_ERRORS_H
# include <stl/_range_errors.h>
#endif
#ifndef _STLP_INTERNAL_STRING_H
# include <stl/_string.h>
#endif
#define __BITS_PER_WORD (CHAR_BIT*sizeof(unsigned long))
#define __BITSET_WORDS(__n) ((__n + __BITS_PER_WORD - 1)/__BITS_PER_WORD)
_STLP_BEGIN_NAMESPACE
_STLP_MOVE_TO_PRIV_NAMESPACE
// structure to aid in counting bits
class _STLP_CLASS_DECLSPEC _Bs_G
{
public:
//returns the number of bit set within the buffer between __beg and __end.
static size_t _S_count(const unsigned char *__beg, const unsigned char *__end)
#if defined (_STLP_USE_NO_IOSTREAMS)
{
size_t __result = 0;
for (; __beg != __end; ++__beg) {
for (size_t i = 0; i < (sizeof(unsigned char) * 8); ++i) {
if ((*__beg & (1 << i)) != 0) { ++__result; }
}
}
return __result;
}
#else
;
#endif
// Mapping from 8 bit unsigned integers to the index of the first one bit set:
static unsigned char _S_first_one(unsigned char __x)
#if defined (_STLP_USE_NO_IOSTREAMS)
{
for (unsigned char i = 0; i < (sizeof(unsigned char) * 8); ++i) {
if ((__x & (1 << i)) != 0) { return i; }
}
return 0;
}
#else
;
#endif
};
//
// Base class: general case.
//
template<size_t _Nw>
struct _Base_bitset {
typedef unsigned long _WordT;
_WordT _M_w[_Nw]; // 0 is the least significant word.
_Base_bitset() { _M_do_reset(); }
_Base_bitset(unsigned long __val) {
_M_do_reset();
_M_w[0] = __val;
}
static size_t _STLP_CALL _S_whichword( size_t __pos ) {
return __pos / __BITS_PER_WORD;
}
static size_t _STLP_CALL _S_whichbyte( size_t __pos ) {
return (__pos % __BITS_PER_WORD) / CHAR_BIT;
}
static size_t _STLP_CALL _S_whichbit( size_t __pos ) {
return __pos % __BITS_PER_WORD;
}
static _WordT _STLP_CALL _S_maskbit( size_t __pos ) {
return __STATIC_CAST(_WordT,1) << _S_whichbit(__pos);
}
_WordT& _M_getword(size_t __pos) { return _M_w[_S_whichword(__pos)]; }
_WordT _M_getword(size_t __pos) const { return _M_w[_S_whichword(__pos)]; }
_WordT& _M_hiword() { return _M_w[_Nw - 1]; }
_WordT _M_hiword() const { return _M_w[_Nw - 1]; }
void _M_do_and(const _Base_bitset<_Nw>& __x) {
for ( size_t __i = 0; __i < _Nw; __i++ ) {
_M_w[__i] &= __x._M_w[__i];
}
}
void _M_do_or(const _Base_bitset<_Nw>& __x) {
for ( size_t __i = 0; __i < _Nw; __i++ ) {
_M_w[__i] |= __x._M_w[__i];
}
}
void _M_do_xor(const _Base_bitset<_Nw>& __x) {
for ( size_t __i = 0; __i < _Nw; __i++ ) {
_M_w[__i] ^= __x._M_w[__i];
}
}
void _M_do_left_shift(size_t __shift);
void _M_do_right_shift(size_t __shift);
void _M_do_flip() {
for ( size_t __i = 0; __i < _Nw; __i++ ) {
_M_w[__i] = ~_M_w[__i];
}
}
void _M_do_set() {
for ( size_t __i = 0; __i < _Nw; __i++ ) {
_M_w[__i] = ~__STATIC_CAST(_WordT,0);
}
}
void _M_do_reset() { memset(_M_w, 0, _Nw * sizeof(_WordT)); }
bool _M_is_equal(const _Base_bitset<_Nw>& __x) const {
for (size_t __i = 0; __i < _Nw; ++__i) {
if (_M_w[__i] != __x._M_w[__i])
return false;
}
return true;
}
bool _M_is_any() const {
for ( size_t __i = 0; __i < _Nw ; __i++ ) {
if ( _M_w[__i] != __STATIC_CAST(_WordT,0) )
return true;
}
return false;
}
size_t _M_do_count() const {
const unsigned char* __byte_ptr = (const unsigned char*)_M_w;
const unsigned char* __end_ptr = (const unsigned char*)(_M_w+_Nw);
return _Bs_G::_S_count(__byte_ptr, __end_ptr);
}
unsigned long _M_do_to_ulong() const;
// find first "on" bit
size_t _M_do_find_first(size_t __not_found) const;
// find the next "on" bit that follows "prev"
size_t _M_do_find_next(size_t __prev, size_t __not_found) const;
};
//
// Base class: specialization for a single word.
//
_STLP_TEMPLATE_NULL
struct _Base_bitset<1UL> {
typedef unsigned long _WordT;
typedef _Base_bitset<1UL> _Self;
_WordT _M_w;
_Base_bitset( void ) : _M_w(0) {}
_Base_bitset(unsigned long __val) : _M_w(__val) {}
static size_t _STLP_CALL _S_whichword( size_t __pos ) {
return __pos / __BITS_PER_WORD ;
}
static size_t _STLP_CALL _S_whichbyte( size_t __pos ) {
return (__pos % __BITS_PER_WORD) / CHAR_BIT;
}
static size_t _STLP_CALL _S_whichbit( size_t __pos ) {
return __pos % __BITS_PER_WORD;
}
static _WordT _STLP_CALL _S_maskbit( size_t __pos ) {
return (__STATIC_CAST(_WordT,1)) << _S_whichbit(__pos);
}
_WordT& _M_getword(size_t) { return _M_w; }
_WordT _M_getword(size_t) const { return _M_w; }
_WordT& _M_hiword() { return _M_w; }
_WordT _M_hiword() const { return _M_w; }
void _M_do_and(const _Self& __x) { _M_w &= __x._M_w; }
void _M_do_or(const _Self& __x) { _M_w |= __x._M_w; }
void _M_do_xor(const _Self& __x) { _M_w ^= __x._M_w; }
void _M_do_left_shift(size_t __shift) { _M_w <<= __shift; }
void _M_do_right_shift(size_t __shift) { _M_w >>= __shift; }
void _M_do_flip() { _M_w = ~_M_w; }
void _M_do_set() { _M_w = ~__STATIC_CAST(_WordT,0); }
void _M_do_reset() { _M_w = 0; }
bool _M_is_equal(const _Self& __x) const {
return _M_w == __x._M_w;
}
bool _M_is_any() const {
return _M_w != 0;
}
size_t _M_do_count() const {
const unsigned char* __byte_ptr = (const unsigned char*)&_M_w;
const unsigned char* __end_ptr = ((const unsigned char*)&_M_w)+sizeof(_M_w);
return _Bs_G::_S_count(__byte_ptr, __end_ptr);
}
unsigned long _M_do_to_ulong() const { return _M_w; }
inline size_t _M_do_find_first(size_t __not_found) const;
// find the next "on" bit that follows "prev"
inline size_t _M_do_find_next(size_t __prev, size_t __not_found) const;
};
// ------------------------------------------------------------
//
// Definitions of should-be-non-inline functions from the single-word version of
// _Base_bitset.
//
inline size_t
_Base_bitset<1UL>::_M_do_find_first(size_t __not_found) const {
// typedef unsigned long _WordT;
_WordT __thisword = _M_w;
if ( __thisword != __STATIC_CAST(_WordT,0) ) {
// find byte within word
for ( size_t __j = 0; __j < sizeof(_WordT); __j++ ) {
unsigned char __this_byte
= __STATIC_CAST(unsigned char,(__thisword & (~(unsigned char)0)));
if ( __this_byte )
return __j*CHAR_BIT + _Bs_G::_S_first_one(__this_byte);
__thisword >>= CHAR_BIT;
}
}
// not found, so return a value that indicates failure.
return __not_found;
}
inline size_t
_Base_bitset<1UL>::_M_do_find_next(size_t __prev,
size_t __not_found ) const {
// make bound inclusive
++__prev;
// check out of bounds
if ( __prev >= __BITS_PER_WORD )
return __not_found;
// search first (and only) word
_WordT __thisword = _M_w;
// mask off bits below bound
__thisword &= (~__STATIC_CAST(_WordT,0)) << _S_whichbit(__prev);
if ( __thisword != __STATIC_CAST(_WordT,0) ) {
// find byte within word
// get first byte into place
__thisword >>= _S_whichbyte(__prev) * CHAR_BIT;
for ( size_t __j = _S_whichbyte(__prev); __j < sizeof(_WordT); __j++ ) {
unsigned char __this_byte
= __STATIC_CAST(unsigned char,(__thisword & (~(unsigned char)0)));
if ( __this_byte )
return __j*CHAR_BIT + _Bs_G::_S_first_one(__this_byte);
__thisword >>= CHAR_BIT;
}
}
// not found, so return a value that indicates failure.
return __not_found;
} // end _M_do_find_next
// ------------------------------------------------------------
// Helper class to zero out the unused high-order bits in the highest word.
template <size_t _Extrabits> struct _Sanitize {
static void _STLP_CALL _M_do_sanitize(unsigned long& __val)
{ __val &= ~((~__STATIC_CAST(unsigned long,0)) << _Extrabits); }
};
_STLP_TEMPLATE_NULL struct _Sanitize<0UL> {
static void _STLP_CALL _M_do_sanitize(unsigned long) {}
};
_STLP_MOVE_TO_STD_NAMESPACE
// ------------------------------------------------------------
// Class bitset.
// _Nb may be any nonzero number of type size_t.
template<size_t _Nb>
class bitset : public _STLP_PRIV _Base_bitset<__BITSET_WORDS(_Nb) > {
public:
enum { _Words = __BITSET_WORDS(_Nb) } ;
private:
typedef _STLP_PRIV _Base_bitset< _Words > _Base;
void _M_do_sanitize() {
_STLP_PRIV _Sanitize<_Nb%__BITS_PER_WORD >::_M_do_sanitize(this->_M_hiword());
}
public:
typedef unsigned long _WordT;
struct reference;
friend struct reference;
// bit reference:
struct reference {
typedef _STLP_PRIV _Base_bitset<_Words > _Bitset_base;
typedef bitset<_Nb> _Bitset;
// friend _Bitset;
_WordT *_M_wp;
size_t _M_bpos;
// should be left undefined
reference() {}
reference( _Bitset& __b, size_t __pos ) {
_M_wp = &__b._M_getword(__pos);
_M_bpos = _Bitset_base::_S_whichbit(__pos);
}
public:
~reference() {}
// for b[i] = __x;
reference& operator=(bool __x) {
if ( __x )
*_M_wp |= _Bitset_base::_S_maskbit(_M_bpos);
else
*_M_wp &= ~_Bitset_base::_S_maskbit(_M_bpos);
return *this;
}
// for b[i] = b[__j];
reference& operator=(const reference& __j) {
if ( (*(__j._M_wp) & _Bitset_base::_S_maskbit(__j._M_bpos)) )
*_M_wp |= _Bitset_base::_S_maskbit(_M_bpos);
else
*_M_wp &= ~_Bitset_base::_S_maskbit(_M_bpos);
return *this;
}
// flips the bit
bool operator~() const { return (*(_M_wp) & _Bitset_base::_S_maskbit(_M_bpos)) == 0; }
// for __x = b[i];
operator bool() const { return (*(_M_wp) & _Bitset_base::_S_maskbit(_M_bpos)) != 0; }
// for b[i].flip();
reference& flip() {
*_M_wp ^= _Bitset_base::_S_maskbit(_M_bpos);
return *this;
}
};
// 23.3.5.1 constructors:
bitset() {}
bitset(unsigned long __val) : _STLP_PRIV _Base_bitset<_Words>(__val) { _M_do_sanitize(); }
#if defined (_STLP_MEMBER_TEMPLATES)
template<class _CharT, class _Traits, class _Alloc>
explicit bitset(const basic_string<_CharT,_Traits,_Alloc>& __s,
size_t __pos = 0)
: _STLP_PRIV _Base_bitset<_Words >() {
if (__pos > __s.size())
__stl_throw_out_of_range("bitset");
_M_copy_from_string(__s, __pos,
basic_string<_CharT, _Traits, _Alloc>::npos);
}
template<class _CharT, class _Traits, class _Alloc>
bitset(const basic_string<_CharT, _Traits, _Alloc>& __s,
size_t __pos,
size_t __n)
: _STLP_PRIV _Base_bitset<_Words >() {
if (__pos > __s.size())
__stl_throw_out_of_range("bitset");
_M_copy_from_string(__s, __pos, __n);
}
#else /* _STLP_MEMBER_TEMPLATES */
explicit bitset(const string& __s,
size_t __pos = 0,
size_t __n = (size_t)-1)
: _STLP_PRIV _Base_bitset<_Words >() {
if (__pos > __s.size())
__stl_throw_out_of_range("bitset");
_M_copy_from_string(__s, __pos, __n);
}
#endif /* _STLP_MEMBER_TEMPLATES */
// 23.3.5.2 bitset operations:
bitset<_Nb>& operator&=(const bitset<_Nb>& __rhs) {
this->_M_do_and(__rhs);
return *this;
}
bitset<_Nb>& operator|=(const bitset<_Nb>& __rhs) {
this->_M_do_or(__rhs);
return *this;
}
bitset<_Nb>& operator^=(const bitset<_Nb>& __rhs) {
this->_M_do_xor(__rhs);
return *this;
}
bitset<_Nb>& operator<<=(size_t __pos) {
this->_M_do_left_shift(__pos);
this->_M_do_sanitize();
return *this;
}
bitset<_Nb>& operator>>=(size_t __pos) {
this->_M_do_right_shift(__pos);
this->_M_do_sanitize();
return *this;
}
//
// Extension:
// Versions of single-bit set, reset, flip, test with no range checking.
//
bitset<_Nb>& _Unchecked_set(size_t __pos) {
this->_M_getword(__pos) |= _STLP_PRIV _Base_bitset<_Words > ::_S_maskbit(__pos);
return *this;
}
bitset<_Nb>& _Unchecked_set(size_t __pos, int __val) {
if (__val)
this->_M_getword(__pos) |= this->_S_maskbit(__pos);
else
this->_M_getword(__pos) &= ~ this->_S_maskbit(__pos);
return *this;
}
bitset<_Nb>& _Unchecked_reset(size_t __pos) {
this->_M_getword(__pos) &= ~ this->_S_maskbit(__pos);
return *this;
}
bitset<_Nb>& _Unchecked_flip(size_t __pos) {
this->_M_getword(__pos) ^= this->_S_maskbit(__pos);
return *this;
}
bool _Unchecked_test(size_t __pos) const {
return (this->_M_getword(__pos) & this->_S_maskbit(__pos)) != __STATIC_CAST(_WordT,0);
}
// Set, reset, and flip.
bitset<_Nb>& set() {
this->_M_do_set();
this->_M_do_sanitize();
return *this;
}
bitset<_Nb>& set(size_t __pos) {
if (__pos >= _Nb)
__stl_throw_out_of_range("bitset");
return _Unchecked_set(__pos);
}
bitset<_Nb>& set(size_t __pos, int __val) {
if (__pos >= _Nb)
__stl_throw_out_of_range("bitset");
return _Unchecked_set(__pos, __val);
}
bitset<_Nb>& reset() {
this->_M_do_reset();
return *this;
}
bitset<_Nb>& reset(size_t __pos) {
if (__pos >= _Nb)
__stl_throw_out_of_range("bitset");
return _Unchecked_reset(__pos);
}
bitset<_Nb>& flip() {
this->_M_do_flip();
this->_M_do_sanitize();
return *this;
}
bitset<_Nb>& flip(size_t __pos) {
if (__pos >= _Nb)
__stl_throw_out_of_range("bitset");
return _Unchecked_flip(__pos);
}
bitset<_Nb> operator~() const {
return bitset<_Nb>(*this).flip();
}
// element access:
//for b[i];
reference operator[](size_t __pos) { return reference(*this,__pos); }
bool operator[](size_t __pos) const { return _Unchecked_test(__pos); }
unsigned long to_ulong() const { return this->_M_do_to_ulong(); }
#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS)
template <class _CharT, class _Traits, class _Alloc>
basic_string<_CharT, _Traits, _Alloc> to_string() const {
basic_string<_CharT, _Traits, _Alloc> __result;
_M_copy_to_string(__result);
return __result;
}
#else
string to_string() const {
string __result;
_M_copy_to_string(__result);
return __result;
}
#endif /* _STLP_EXPLICIT_FUNCTION_TMPL_ARGS */
size_t count() const { return this->_M_do_count(); }
size_t size() const { return _Nb; }
bool operator==(const bitset<_Nb>& __rhs) const {
return this->_M_is_equal(__rhs);
}
bool operator!=(const bitset<_Nb>& __rhs) const {
return !this->_M_is_equal(__rhs);
}
bool test(size_t __pos) const {
if (__pos >= _Nb)
__stl_throw_out_of_range("bitset");
return _Unchecked_test(__pos);
}
bool any() const { return this->_M_is_any(); }
bool none() const { return !this->_M_is_any(); }
bitset<_Nb> operator<<(size_t __pos) const {
bitset<_Nb> __result(*this);
__result <<= __pos ; return __result;
}
bitset<_Nb> operator>>(size_t __pos) const {
bitset<_Nb> __result(*this);
__result >>= __pos ; return __result;
}
#if !defined (_STLP_NO_EXTENSIONS)
//
// EXTENSIONS: bit-find operations. These operations are
// experimental, and are subject to change or removal in future
// versions.
//
// find the index of the first "on" bit
size_t _Find_first() const
{ return this->_M_do_find_first(_Nb); }
// find the index of the next "on" bit after prev
size_t _Find_next( size_t __prev ) const
{ return this->_M_do_find_next(__prev, _Nb); }
#endif
//
// Definitions of should-be non-inline member functions.
//
#if defined (_STLP_MEMBER_TEMPLATES)
template<class _CharT, class _Traits, class _Alloc>
void _M_copy_from_string(const basic_string<_CharT,_Traits,_Alloc>& __s,
size_t __pos, size_t __n) {
#else
void _M_copy_from_string(const string& __s,
size_t __pos, size_t __n) {
typedef typename string::traits_type _Traits;
#endif
reset();
size_t __tmp = _Nb;
const size_t __Nbits = (min) (__tmp, (min) (__n, __s.size() - __pos));
for ( size_t __i= 0; __i < __Nbits; ++__i) {
typename _Traits::int_type __k = _Traits::to_int_type(__s[__pos + __Nbits - __i - 1]);
// boris : widen() ?
if (__k == '1')
set(__i);
else if (__k != '0')
__stl_throw_invalid_argument("bitset");
}
}
#if defined (_STLP_MEMBER_TEMPLATES)
template <class _CharT, class _Traits, class _Alloc>
void _M_copy_to_string(basic_string<_CharT, _Traits, _Alloc>& __s) const
#else
void _M_copy_to_string(string& __s) const
#endif
{
__s.assign(_Nb, '0');
for (size_t __i = 0; __i < _Nb; ++__i) {
if (_Unchecked_test(__i))
__s[_Nb - 1 - __i] = '1';
}
}
#if !defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_NO_WCHAR_T)
void _M_copy_to_string(wstring& __s) const {
__s.assign(_Nb, '0');
for (size_t __i = 0; __i < _Nb; ++__i) {
if (_Unchecked_test(__i))
__s[_Nb - 1 - __i] = '1';
}
}
#endif
#if defined (_STLP_NON_TYPE_TMPL_PARAM_BUG)
bitset<_Nb> operator&(const bitset<_Nb>& __y) const {
bitset<_Nb> __result(*this);
__result &= __y;
return __result;
}
bitset<_Nb> operator|(const bitset<_Nb>& __y) const {
bitset<_Nb> __result(*this);
__result |= __y;
return __result;
}
bitset<_Nb> operator^(const bitset<_Nb>& __y) const {
bitset<_Nb> __result(*this);
__result ^= __y;
return __result;
}
#endif
};
// ------------------------------------------------------------
//
// 23.3.5.3 bitset operations:
//
#if ! defined (_STLP_NON_TYPE_TMPL_PARAM_BUG)
template <size_t _Nb>
inline bitset<_Nb> _STLP_CALL
operator&(const bitset<_Nb>& __x,
const bitset<_Nb>& __y) {
bitset<_Nb> __result(__x);
__result &= __y;
return __result;
}
template <size_t _Nb>
inline bitset<_Nb> _STLP_CALL
operator|(const bitset<_Nb>& __x,
const bitset<_Nb>& __y) {
bitset<_Nb> __result(__x);
__result |= __y;
return __result;
}
template <size_t _Nb>
inline bitset<_Nb> _STLP_CALL
operator^(const bitset<_Nb>& __x,
const bitset<_Nb>& __y) {
bitset<_Nb> __result(__x);
__result ^= __y;
return __result;
}
#if !defined (_STLP_USE_NO_IOSTREAMS)
_STLP_END_NAMESPACE
# if !(defined (_STLP_MSVC) && (_STLP_MSVC < 1300)) && \
!(defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x500))
#ifndef _STLP_INTERNAL_IOSFWD
# include <stl/_iosfwd.h>
#endif
_STLP_BEGIN_NAMESPACE
template <class _CharT, class _Traits, size_t _Nb>
basic_istream<_CharT, _Traits>& _STLP_CALL
operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x);
template <class _CharT, class _Traits, size_t _Nb>
basic_ostream<_CharT, _Traits>& _STLP_CALL
operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Nb>& __x);
# else
#ifndef _STLP_STRING_IO_H
# include <stl/_string_io.h> //includes _istream.h and _ostream.h
#endif
_STLP_BEGIN_NAMESPACE
template <size_t _Nb>
istream& _STLP_CALL
operator>>(istream& __is, bitset<_Nb>& __x) {
typedef typename string::traits_type _Traits;
string __tmp;
__tmp.reserve(_Nb);
// Skip whitespace
typename istream::sentry __sentry(__is);
if (__sentry) {
streambuf* __buf = __is.rdbuf();
for (size_t __i = 0; __i < _Nb; ++__i) {
static typename _Traits::int_type __eof = _Traits::eof();
typename _Traits::int_type __c1 = __buf->sbumpc();
if (_Traits::eq_int_type(__c1, __eof)) {
__is.setstate(ios_base::eofbit);
break;
}
else {
typename _Traits::char_type __c2 = _Traits::to_char_type(__c1);
char __c = __is.narrow(__c2, '*');
if (__c == '0' || __c == '1')
__tmp.push_back(__c);
else if (_Traits::eq_int_type(__buf->sputbackc(__c2), __eof)) {
__is.setstate(ios_base::failbit);
break;
}
}
}
if (__tmp.empty())
__is.setstate(ios_base::failbit);
else
__x._M_copy_from_string(__tmp, __STATIC_CAST(size_t,0), _Nb);
}
return __is;
}
template <size_t _Nb>
ostream& _STLP_CALL
operator<<(ostream& __os, const bitset<_Nb>& __x) {
string __tmp;
__x._M_copy_to_string(__tmp);
return __os << __tmp;
}
# if !defined (_STLP_NO_WCHAR_T)
template <size_t _Nb>
wistream& _STLP_CALL
operator>>(wistream& __is, bitset<_Nb>& __x) {
typedef typename wstring::traits_type _Traits;
wstring __tmp;
__tmp.reserve(_Nb);
// Skip whitespace
typename wistream::sentry __sentry(__is);
if (__sentry) {
wstreambuf* __buf = __is.rdbuf();
for (size_t __i = 0; __i < _Nb; ++__i) {
static typename _Traits::int_type __eof = _Traits::eof();
typename _Traits::int_type __c1 = __buf->sbumpc();
if (_Traits::eq_int_type(__c1, __eof)) {
__is.setstate(ios_base::eofbit);
break;
}
else {
typename _Traits::char_type __c2 = _Traits::to_char_type(__c1);
char __c = __is.narrow(__c2, '*');
if (__c == '0' || __c == '1')
__tmp.push_back(__c);
else if (_Traits::eq_int_type(__buf->sputbackc(__c2), __eof)) {
__is.setstate(ios_base::failbit);
break;
}
}
}
if (__tmp.empty())
__is.setstate(ios_base::failbit);
else
__x._M_copy_from_string(__tmp, __STATIC_CAST(size_t,0), _Nb);
}
return __is;
}
template <size_t _Nb>
wostream& _STLP_CALL
operator<<(wostream& __os, const bitset<_Nb>& __x) {
wstring __tmp;
__x._M_copy_to_string(__tmp);
return __os << __tmp;
}
# endif /* _STLP_NO_WCHAR_T */
# endif
#endif
#endif /* _STLP_NON_TYPE_TMPL_PARAM_BUG */
#undef bitset
_STLP_END_NAMESPACE
#undef __BITS_PER_WORD
#undef __BITSET_WORDS
#if !defined (_STLP_LINK_TIME_INSTANTIATION)
# include <stl/_bitset.c>
#endif
#endif /* _STLP_BITSET_H */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,841 @@
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Copyright (c) 1996,1997
* Silicon Graphics Computer Systems, Inc.
*
* Copyright (c) 1997
* Moscow Center for SPARC Technology
*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
/* NOTE: This is an internal header file, included by other STL headers.
* You should not attempt to use it directly.
*/
#ifndef _STLP_INTERNAL_BVECTOR_H
#define _STLP_INTERNAL_BVECTOR_H
#ifndef _STLP_INTERNAL_VECTOR_H
# include <stl/_vector.h>
#endif
#define _STLP_WORD_BIT (int(CHAR_BIT * sizeof(unsigned int)))
_STLP_BEGIN_NAMESPACE
_STLP_MOVE_TO_PRIV_NAMESPACE
struct _Bit_reference {
unsigned int* _M_p;
unsigned int _M_mask;
_Bit_reference(unsigned int* __x, unsigned int __y)
: _M_p(__x), _M_mask(__y) {}
public:
_Bit_reference() : _M_p(0), _M_mask(0) {}
operator bool() const {
return !(!(*_M_p & _M_mask));
}
_Bit_reference& operator = (bool __x) {
if (__x) *_M_p |= _M_mask;
else *_M_p &= ~_M_mask;
return *this;
}
_Bit_reference& operator = (const _Bit_reference& __x) {
return *this = bool(__x);
}
bool operator == (const _Bit_reference& __x) const {
return bool(*this) == bool(__x);
}
bool operator < (const _Bit_reference& __x) const {
return !bool(*this) && bool(__x);
}
_Bit_reference& operator |= (bool __x) {
if (__x)
*_M_p |= _M_mask;
return *this;
}
_Bit_reference& operator &= (bool __x) {
if (!__x)
*_M_p &= ~_M_mask;
return *this;
}
void flip() { *_M_p ^= _M_mask; }
};
_STLP_MOVE_TO_STD_NAMESPACE
inline void swap(_STLP_PRIV _Bit_reference& __x, _STLP_PRIV _Bit_reference& __y) {
bool __tmp = (bool)__x;
__x = __y;
__y = __tmp;
}
// Might not be very useful but costs nothing!
_STLP_TEMPLATE_NULL
struct __type_traits<_STLP_PRIV _Bit_reference> {
typedef __false_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __false_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor;
typedef __false_type is_POD_type;
};
_STLP_MOVE_TO_PRIV_NAMESPACE
struct _Bit_iterator_base {
typedef ptrdiff_t difference_type;
unsigned int* _M_p;
unsigned int _M_offset;
void _M_bump_up() {
if (_M_offset++ == _STLP_WORD_BIT - 1) {
_M_offset = 0;
++_M_p;
}
}
void _M_bump_down() {
if (_M_offset-- == 0) {
_M_offset = _STLP_WORD_BIT - 1;
--_M_p;
}
}
_Bit_iterator_base() : _M_p(0), _M_offset(0) {}
_Bit_iterator_base(unsigned int* __x, unsigned int __y) : _M_p(__x), _M_offset(__y) {}
// see comment in doc/README.evc4 and doc/README.evc8
#if defined(_MSC_VER) && _MSC_VER<=1401 && defined(MIPS) && defined(NDEBUG)
_Bit_iterator_base( const _Bit_iterator_base& __x) : _M_p(__x._M_p), _M_offset(__x._M_offset) {}
#endif
// _Bit_iterator_base& operator = ( const _Bit_iterator_base& __x) { _M_p = __x._M_p ; _M_offset = __x._M_offset ; return *this; }
void _M_advance (difference_type __i) {
difference_type __n = __i + _M_offset;
_M_p += __n / _STLP_WORD_BIT;
__n = __n % _STLP_WORD_BIT;
if (__n < 0) {
_M_offset = (unsigned int) __n + _STLP_WORD_BIT;
--_M_p;
} else
_M_offset = (unsigned int) __n;
}
difference_type _M_subtract(const _Bit_iterator_base& __x) const {
return _STLP_WORD_BIT * (_M_p - __x._M_p) + _M_offset - __x._M_offset;
}
};
inline bool _STLP_CALL operator==(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
return __y._M_p == __x._M_p && __y._M_offset == __x._M_offset;
}
inline bool _STLP_CALL operator!=(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
return __y._M_p != __x._M_p || __y._M_offset != __x._M_offset;
}
inline bool _STLP_CALL operator<(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
return __x._M_p < __y._M_p || (__x._M_p == __y._M_p && __x._M_offset < __y._M_offset);
}
inline bool _STLP_CALL operator>(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
return operator <(__y , __x);
}
inline bool _STLP_CALL operator<=(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
return !(__y < __x);
}
inline bool _STLP_CALL operator>=(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) {
return !(__x < __y);
}
template <class _Ref, class _Ptr>
struct _Bit_iter : public _Bit_iterator_base {
typedef _Ref reference;
typedef _Ptr pointer;
typedef _Bit_iter<_Ref, _Ptr> _Self;
typedef random_access_iterator_tag iterator_category;
typedef bool value_type;
typedef ptrdiff_t difference_type;
typedef size_t size_type;
_Bit_iter(unsigned int* __x, unsigned int __y) : _Bit_iterator_base(__x, __y) {}
_Bit_iter() {}
_Bit_iter(const _Bit_iter<_Bit_reference, _Bit_reference*>& __x):
_Bit_iterator_base((const _Bit_iterator_base&)__x) {}
// _Self& operator = (const _Bit_iter<_Bit_reference, _Bit_reference*>& __x)
// { (_Bit_iterator_base&)*this = (const _Bit_iterator_base&)__x; return *this; }
reference operator*() const {
return _Bit_reference(_M_p, 1UL << _M_offset);
}
_Self& operator++() {
_M_bump_up();
return *this;
}
_Self operator++(int) {
_Self __tmp = *this;
_M_bump_up();
return __tmp;
}
_Self& operator--() {
_M_bump_down();
return *this;
}
_Self operator--(int) {
_Self __tmp = *this;
_M_bump_down();
return __tmp;
}
_Self& operator+=(difference_type __i) {
_M_advance(__i);
return *this;
}
_Self& operator-=(difference_type __i) {
*this += -__i;
return *this;
}
_Self operator+(difference_type __i) const {
_Self __tmp = *this;
return __tmp += __i;
}
_Self operator-(difference_type __i) const {
_Self __tmp = *this;
return __tmp -= __i;
}
difference_type operator-(const _Self& __x) const {
return _M_subtract(__x);
}
reference operator[](difference_type __i) { return *(*this + __i); }
};
template <class _Ref, class _Ptr>
inline _Bit_iter<_Ref,_Ptr> _STLP_CALL
operator+(ptrdiff_t __n, const _Bit_iter<_Ref, _Ptr>& __x) {
return __x + __n;
}
_STLP_MOVE_TO_STD_NAMESPACE
#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
template <class _Ref, class _Ptr>
struct __type_traits< _STLP_PRIV _Bit_iter<_Ref, _Ptr> > {
typedef __false_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor;
typedef __false_type is_POD_type;
};
#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
#if defined (_STLP_USE_OLD_HP_ITERATOR_QUERIES)
inline random_access_iterator_tag iterator_category(const _STLP_PRIV _Bit_iterator_base&)
{ return random_access_iterator_tag(); }
inline ptrdiff_t* distance_type(const _STLP_PRIV _Bit_iterator_base&)
{ return (ptrdiff_t*)0; }
inline bool* value_type(const _STLP_PRIV _Bit_iter<_STLP_PRIV _Bit_reference, _STLP_PRIV _Bit_reference*>&)
{ return (bool*)0; }
inline bool* value_type(const _STLP_PRIV _Bit_iter<bool, const bool*>&)
{ return (bool*)0; }
#endif
_STLP_MOVE_TO_PRIV_NAMESPACE
typedef _Bit_iter<bool, const bool*> _Bit_const_iterator;
typedef _Bit_iter<_Bit_reference, _Bit_reference*> _Bit_iterator;
// Bit-vector base class, which encapsulates the difference between
// old SGI-style allocators and standard-conforming allocators.
template <class _Alloc>
class _Bvector_base {
typedef _Bvector_base<_Alloc> _Self;
public:
_STLP_FORCE_ALLOCATORS(bool, _Alloc)
typedef _Alloc allocator_type;
typedef unsigned int __chunk_type;
typedef typename _Alloc_traits<__chunk_type, _Alloc>::allocator_type __chunk_allocator_type;
allocator_type get_allocator() const
{ return _STLP_CONVERT_ALLOCATOR(__STATIC_CAST(const __chunk_allocator_type&, _M_end_of_storage), bool); }
_Bvector_base(const allocator_type& __a)
: _M_start(), _M_finish(), _M_end_of_storage(_STLP_CONVERT_ALLOCATOR(__a, __chunk_type),
(__chunk_type*)0)
{}
#if !defined (_STLP_NO_MOVE_SEMANTIC)
_Bvector_base(__move_source<_Self> src)
: _M_start(src.get()._M_start), _M_finish(src.get()._M_finish),
_M_end_of_storage(src.get()._M_end_of_storage) {
//Make the source destroyable
src.get()._M_start._M_p = 0;
}
#endif
~_Bvector_base() {
_M_deallocate();
}
protected:
static size_t _M_bits_to_chunks(size_t __n_bits)
{ return (__n_bits + _STLP_WORD_BIT - 1) / _STLP_WORD_BIT; }
__chunk_type* _M_bit_alloc(size_t __n)
{ return _M_end_of_storage.allocate(_M_bits_to_chunks(__n)); }
void _M_deallocate() {
if (_M_start._M_p)
_M_end_of_storage.deallocate(_M_start._M_p,
_M_end_of_storage._M_data - _M_start._M_p);
}
_Bit_iterator _M_start;
_Bit_iterator _M_finish;
_STLP_alloc_proxy<__chunk_type*, __chunk_type, __chunk_allocator_type> _M_end_of_storage;
};
// The next few lines are confusing. What we're doing is declaring a
// partial specialization of vector<T, Alloc> if we have the necessary
// compiler support. Otherwise, we define a class bit_vector which uses
// the default allocator.
#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_BOOL) && !defined (__SUNPRO_CC)
# define _STLP_VECBOOL_TEMPLATE
# define __BVEC_TMPL_HEADER template <class _Alloc>
#else
# undef _STLP_VECBOOL_TEMPLATE
# ifdef _STLP_NO_BOOL
# define __BVEC_TMPL_HEADER
# else
# define __BVEC_TMPL_HEADER _STLP_TEMPLATE_NULL
# endif
# define _Alloc allocator<bool>
#endif
#if defined (_STLP_DEBUG)
# define vector _STLP_NON_DBG_NAME(vector)
#endif
#ifdef _STLP_NO_BOOL
# define __BVECTOR_QUALIFIED bit_vector
# define __BVECTOR bit_vector
#else
# ifdef _STLP_VECBOOL_TEMPLATE
# define __BVECTOR_QUALIFIED vector<bool, _Alloc>
# else
# define __BVECTOR_QUALIFIED vector<bool, allocator<bool> >
# endif
# if defined (_STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS)
# define __BVECTOR __BVECTOR_QUALIFIED
# else
# define __BVECTOR vector
# endif
#endif
#if !defined (_STLP_DEBUG) || defined (_STLP_NO_BOOL)
_STLP_MOVE_TO_STD_NAMESPACE
#endif
__BVEC_TMPL_HEADER
class __BVECTOR_QUALIFIED : public _STLP_PRIV _Bvector_base<_Alloc >
#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_DEBUG)
, public __stlport_class< __BVECTOR_QUALIFIED >
#endif
{
typedef _STLP_PRIV _Bvector_base<_Alloc > _Base;
typedef __BVECTOR_QUALIFIED _Self;
public:
typedef bool value_type;
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef _STLP_PRIV _Bit_reference reference;
typedef bool const_reference;
typedef _STLP_PRIV _Bit_reference* pointer;
typedef const bool* const_pointer;
typedef random_access_iterator_tag _Iterator_category;
typedef _STLP_PRIV _Bit_iterator iterator;
typedef _STLP_PRIV _Bit_const_iterator const_iterator;
_STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS;
#ifdef _STLP_VECBOOL_TEMPLATE
typedef _STLP_TYPENAME _STLP_PRIV _Bvector_base<_Alloc >::allocator_type allocator_type;
typedef _STLP_TYPENAME _STLP_PRIV _Bvector_base<_Alloc >::__chunk_type __chunk_type;
#else
typedef _STLP_PRIV _Bvector_base<_Alloc >::allocator_type allocator_type;
typedef _STLP_PRIV _Bvector_base<_Alloc >::__chunk_type __chunk_type;
#endif
protected:
void _M_initialize(size_type __n) {
__chunk_type* __q = this->_M_bit_alloc(__n);
this->_M_end_of_storage._M_data = __q + _Base::_M_bits_to_chunks(__n);
this->_M_start = iterator(__q, 0);
this->_M_finish = this->_M_start + difference_type(__n);
}
void _M_insert_aux(iterator __position, bool __x) {
if (this->_M_finish._M_p != this->_M_end_of_storage._M_data) {
_STLP_PRIV __copy_backward(__position, this->_M_finish, this->_M_finish + 1,
random_access_iterator_tag(), (difference_type*)0 );
*__position = __x;
++this->_M_finish;
}
else {
size_type __len = size() ? 2 * size() : _STLP_WORD_BIT;
__chunk_type* __q = this->_M_bit_alloc(__len);
iterator __i = _STLP_STD::copy(begin(), __position, iterator(__q, 0));
*__i++ = __x;
this->_M_finish = _STLP_STD::copy(__position, end(), __i);
this->_M_deallocate();
this->_M_end_of_storage._M_data = __q + _Base::_M_bits_to_chunks(__len);
this->_M_start = iterator(__q, 0);
}
}
#if defined (_STLP_MEMBER_TEMPLATES)
template <class _InputIterator>
void _M_initialize_range(_InputIterator __first, _InputIterator __last,
const input_iterator_tag &) {
this->_M_start = iterator();
this->_M_finish = iterator();
this->_M_end_of_storage._M_data = 0;
for ( ; __first != __last; ++__first)
push_back(*__first);
}
template <class _ForwardIterator>
void _M_initialize_range(_ForwardIterator __first, _ForwardIterator __last,
const forward_iterator_tag &) {
size_type __n = _STLP_STD::distance(__first, __last);
_M_initialize(__n);
_STLP_STD::copy(__first, __last, this->_M_start);
}
template <class _InputIterator>
void _M_insert_range(iterator __pos,
_InputIterator __first, _InputIterator __last,
const input_iterator_tag &) {
for ( ; __first != __last; ++__first) {
__pos = insert(__pos, *__first);
++__pos;
}
}
template <class _ForwardIterator>
void _M_insert_range(iterator __position,
_ForwardIterator __first, _ForwardIterator __last,
const forward_iterator_tag &) {
if (__first != __last) {
size_type __n = _STLP_STD::distance(__first, __last);
if (capacity() - size() >= __n) {
_STLP_PRIV __copy_backward(__position, end(), this->_M_finish + difference_type(__n),
random_access_iterator_tag(), (difference_type*)0 );
_STLP_STD::copy(__first, __last, __position);
this->_M_finish += difference_type(__n);
}
else {
size_type __len = size() + (max)(size(), __n);
__chunk_type* __q = this->_M_bit_alloc(__len);
iterator __i = _STLP_STD::copy(begin(), __position, iterator(__q, 0));
__i = _STLP_STD::copy(__first, __last, __i);
this->_M_finish = _STLP_STD::copy(__position, end(), __i);
this->_M_deallocate();
this->_M_end_of_storage._M_data = __q + _Base::_M_bits_to_chunks(__len);
this->_M_start = iterator(__q, 0);
}
}
}
#endif /* _STLP_MEMBER_TEMPLATES */
public:
iterator begin() { return this->_M_start; }
const_iterator begin() const { return this->_M_start; }
iterator end() { return this->_M_finish; }
const_iterator end() const { return this->_M_finish; }
reverse_iterator rbegin() { return reverse_iterator(end()); }
const_reverse_iterator rbegin() const {
return const_reverse_iterator(end());
}
reverse_iterator rend() { return reverse_iterator(begin()); }
const_reverse_iterator rend() const {
return const_reverse_iterator(begin());
}
size_type size() const { return size_type(end() - begin()); }
size_type max_size() const { return size_type(-1); }
size_type capacity() const {
return size_type(const_iterator(this->_M_end_of_storage._M_data, 0) - begin());
}
bool empty() const { return begin() == end(); }
reference operator[](size_type __n)
{ return *(begin() + difference_type(__n)); }
const_reference operator[](size_type __n) const
{ return *(begin() + difference_type(__n)); }
void _M_range_check(size_type __n) const {
if (__n >= this->size())
__stl_throw_range_error("vector<bool>");
}
reference at(size_type __n)
{ _M_range_check(__n); return (*this)[__n]; }
const_reference at(size_type __n) const
{ _M_range_check(__n); return (*this)[__n]; }
explicit __BVECTOR(const allocator_type& __a = allocator_type())
: _STLP_PRIV _Bvector_base<_Alloc >(__a) {}
__BVECTOR(size_type __n, bool __val,
const allocator_type& __a = allocator_type())
: _STLP_PRIV _Bvector_base<_Alloc >(__a) {
_M_initialize(__n);
fill(this->_M_start._M_p, (__chunk_type*)(this->_M_end_of_storage._M_data), __val ? ~0 : 0);
}
explicit __BVECTOR(size_type __n)
: _STLP_PRIV _Bvector_base<_Alloc >(allocator_type()) {
_M_initialize(__n);
fill(this->_M_start._M_p, (__chunk_type*)(this->_M_end_of_storage._M_data), 0);
}
__BVECTOR(const _Self& __x)
: _STLP_PRIV _Bvector_base<_Alloc >(__x.get_allocator()) {
_M_initialize(__x.size());
_STLP_STD::copy(__x.begin(), __x.end(), this->_M_start);
}
#if defined (_STLP_MEMBER_TEMPLATES)
template <class _Integer>
void _M_initialize_dispatch(_Integer __n, _Integer __x, const __true_type&) {
_M_initialize(__n);
fill(this->_M_start._M_p, this->_M_end_of_storage._M_data, __x ? ~0 : 0);
}
template <class _InputIterator>
void _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
const __false_type&) {
_M_initialize_range(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator));
}
# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS)
// Check whether it's an integral type. If so, it's not an iterator.
template <class _InputIterator>
__BVECTOR(_InputIterator __first, _InputIterator __last)
: _STLP_PRIV _Bvector_base<_Alloc >(allocator_type()) {
typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
_M_initialize_dispatch(__first, __last, _Integral());
}
# endif
template <class _InputIterator>
__BVECTOR(_InputIterator __first, _InputIterator __last,
const allocator_type& __a _STLP_ALLOCATOR_TYPE_DFL)
: _STLP_PRIV _Bvector_base<_Alloc >(__a) {
typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
_M_initialize_dispatch(__first, __last, _Integral());
}
#else /* _STLP_MEMBER_TEMPLATES */
__BVECTOR(const_iterator __first, const_iterator __last,
const allocator_type& __a = allocator_type())
: _STLP_PRIV _Bvector_base<_Alloc >(__a) {
size_type __n = _STLP_STD::distance(__first, __last);
_M_initialize(__n);
_STLP_STD::copy(__first, __last, this->_M_start);
}
__BVECTOR(const bool* __first, const bool* __last,
const allocator_type& __a = allocator_type())
: _STLP_PRIV _Bvector_base<_Alloc >(__a) {
size_type __n = _STLP_STD::distance(__first, __last);
_M_initialize(__n);
_STLP_STD::copy(__first, __last, this->_M_start);
}
#endif /* _STLP_MEMBER_TEMPLATES */
#if !defined (_STLP_NO_MOVE_SEMANTIC)
__BVECTOR(__move_source<_Self> src)
: _STLP_PRIV _Bvector_base<_Alloc >(__move_source<_Base>(src.get())) {}
#endif
~__BVECTOR() {}
__BVECTOR_QUALIFIED& operator=(const __BVECTOR_QUALIFIED& __x) {
if (&__x == this) return *this;
if (__x.size() > capacity()) {
this->_M_deallocate();
_M_initialize(__x.size());
}
_STLP_STD::copy(__x.begin(), __x.end(), begin());
this->_M_finish = begin() + difference_type(__x.size());
return *this;
}
// assign(), a generalized assignment member function. Two
// versions: one that takes a count, and one that takes a range.
// The range version is a member template, so we dispatch on whether
// or not the type is an integer.
void _M_fill_assign(size_t __n, bool __x) {
if (__n > size()) {
fill(this->_M_start._M_p, (__chunk_type*)(this->_M_end_of_storage._M_data), __x ? ~0 : 0);
insert(end(), __n - size(), __x);
}
else {
erase(begin() + __n, end());
fill(this->_M_start._M_p, (__chunk_type*)(this->_M_end_of_storage._M_data), __x ? ~0 : 0);
}
}
void assign(size_t __n, bool __x) { _M_fill_assign(__n, __x); }
#if defined (_STLP_MEMBER_TEMPLATES)
template <class _InputIterator>
void assign(_InputIterator __first, _InputIterator __last) {
typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
_M_assign_dispatch(__first, __last, _Integral());
}
template <class _Integer>
void _M_assign_dispatch(_Integer __n, _Integer __val, const __true_type&)
{ _M_fill_assign((size_t) __n, (bool) __val); }
template <class _InputIter>
void _M_assign_dispatch(_InputIter __first, _InputIter __last, const __false_type&)
{ _M_assign_aux(__first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIter)); }
template <class _InputIterator>
void _M_assign_aux(_InputIterator __first, _InputIterator __last,
const input_iterator_tag &) {
iterator __cur = begin();
for ( ; __first != __last && __cur != end(); ++__cur, ++__first)
*__cur = *__first;
if (__first == __last)
erase(__cur, end());
else
insert(end(), __first, __last);
}
template <class _ForwardIterator>
void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
const forward_iterator_tag &) {
size_type __len = _STLP_STD::distance(__first, __last);
if (__len < size())
erase(_STLP_STD::copy(__first, __last, begin()), end());
else {
_ForwardIterator __mid = __first;
_STLP_STD::advance(__mid, size());
_STLP_STD::copy(__first, __mid, begin());
insert(end(), __mid, __last);
}
}
#endif /* _STLP_MEMBER_TEMPLATES */
void reserve(size_type __n) {
if (capacity() < __n) {
if (max_size() < __n)
__stl_throw_length_error("vector<bool>");
__chunk_type* __q = this->_M_bit_alloc(__n);
_STLP_PRIV _Bit_iterator __z(__q, 0);
this->_M_finish = _STLP_STD::copy(begin(), end(), __z);
this->_M_deallocate();
this->_M_start = iterator(__q, 0);
this->_M_end_of_storage._M_data = __q + _Base::_M_bits_to_chunks(__n);
}
}
reference front() { return *begin(); }
const_reference front() const { return *begin(); }
reference back() { return *(end() - 1); }
const_reference back() const { return *(end() - 1); }
void push_back(bool __x) {
if (this->_M_finish._M_p != this->_M_end_of_storage._M_data) {
*(this->_M_finish) = __x;
++this->_M_finish;
}
else
_M_insert_aux(end(), __x);
}
void swap(__BVECTOR_QUALIFIED& __x) {
_STLP_STD::swap(this->_M_start, __x._M_start);
_STLP_STD::swap(this->_M_finish, __x._M_finish);
this->_M_end_of_storage.swap(__x._M_end_of_storage);
}
#if defined (_STLP_USE_PARTIAL_SPEC_WORKAROUND) && !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER)
void _M_swap_workaround(__BVECTOR_QUALIFIED& __x) { swap(__x); }
#endif
iterator insert(iterator __position, bool __x = bool()) {
difference_type __n = __position - begin();
if (this->_M_finish._M_p != this->_M_end_of_storage._M_data && __position == end()) {
*(this->_M_finish) = __x;
++this->_M_finish;
}
else
_M_insert_aux(__position, __x);
return begin() + __n;
}
#if defined (_STLP_MEMBER_TEMPLATES)
template <class _Integer>
void _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
const __true_type&) {
_M_fill_insert(__pos, (size_type) __n, (bool) __x);
}
template <class _InputIterator>
void _M_insert_dispatch(iterator __pos,
_InputIterator __first, _InputIterator __last,
const __false_type&) {
_M_insert_range(__pos, __first, __last, _STLP_ITERATOR_CATEGORY(__first, _InputIterator));
}
// Check whether it's an integral type. If so, it's not an iterator.
template <class _InputIterator>
void insert(iterator __position,
_InputIterator __first, _InputIterator __last) {
typedef typename _IsIntegral<_InputIterator>::_Ret _Integral;
_M_insert_dispatch(__position, __first, __last, _Integral());
}
#else /* _STLP_MEMBER_TEMPLATES */
void insert(iterator __position,
const_iterator __first, const_iterator __last) {
if (__first == __last) return;
size_type __n = _STLP_STD::distance(__first, __last);
if (capacity() - size() >= __n) {
_STLP_PRIV __copy_backward(__position, end(), this->_M_finish + __n,
random_access_iterator_tag(), (difference_type*)0 );
_STLP_STD::copy(__first, __last, __position);
this->_M_finish += __n;
}
else {
size_type __len = size() + (max)(size(), __n);
__chunk_type* __q = this->_M_bit_alloc(__len);
iterator __i = _STLP_STD::copy(begin(), __position, iterator(__q, 0));
__i = _STLP_STD::copy(__first, __last, __i);
this->_M_finish = _STLP_STD::copy(__position, end(), __i);
this->_M_deallocate();
this->_M_end_of_storage._M_data = __q + _Base::_M_bits_to_chunks(__len);
this->_M_start = iterator(__q, 0);
}
}
void insert(iterator __position, const bool* __first, const bool* __last) {
if (__first == __last) return;
size_type __n = _STLP_STD::distance(__first, __last);
if (capacity() - size() >= __n) {
_STLP_PRIV __copy_backward(__position, end(), this->_M_finish + __n,
random_access_iterator_tag(), (difference_type*)0 );
_STLP_STD::copy(__first, __last, __position);
this->_M_finish += __n;
}
else {
size_type __len = size() + (max)(size(), __n);
__chunk_type* __q = this->_M_bit_alloc(__len);
iterator __i = _STLP_STD::copy(begin(), __position, iterator(__q, 0));
__i = _STLP_STD::copy(__first, __last, __i);
this->_M_finish = _STLP_STD::copy(__position, end(), __i);
this->_M_deallocate();
this->_M_end_of_storage._M_data = __q + _Base::_M_bits_to_chunks(__len);
this->_M_start = iterator(__q, 0);
}
}
#endif /* _STLP_MEMBER_TEMPLATES */
void _M_fill_insert(iterator __position, size_type __n, bool __x) {
if (__n == 0) return;
if (capacity() - size() >= __n) {
_STLP_PRIV __copy_backward(__position, end(), this->_M_finish + difference_type(__n),
random_access_iterator_tag(), (difference_type*)0 );
fill(__position, __position + difference_type(__n), __x);
this->_M_finish += difference_type(__n);
}
else {
size_type __len = size() + (max)(size(), __n);
__chunk_type* __q = this->_M_bit_alloc(__len);
iterator __i = _STLP_STD::copy(begin(), __position, iterator(__q, 0));
fill_n(__i, __n, __x);
this->_M_finish = _STLP_STD::copy(__position, end(), __i + difference_type(__n));
this->_M_deallocate();
this->_M_end_of_storage._M_data = __q + _Base::_M_bits_to_chunks(__len);
this->_M_start = iterator(__q, 0);
}
}
void insert(iterator __position, size_type __n, bool __x) {
_M_fill_insert(__position, __n, __x);
}
void pop_back() {
--this->_M_finish;
}
iterator erase(iterator __position) {
if (__position + 1 != end())
_STLP_STD::copy(__position + 1, end(), __position);
--this->_M_finish;
return __position;
}
iterator erase(iterator __first, iterator __last) {
this->_M_finish = _STLP_STD::copy(__last, end(), __first);
return __first;
}
void resize(size_type __new_size, bool __x = bool()) {
if (__new_size < size())
erase(begin() + difference_type(__new_size), end());
else
insert(end(), __new_size - size(), __x);
}
void flip() {
for (__chunk_type* __p = this->_M_start._M_p; __p != this->_M_end_of_storage._M_data; ++__p)
*__p = ~*__p;
}
void clear() { erase(begin(), end()); }
};
#if defined (_STLP_NO_BOOL) || defined (__HP_aCC) // fixed soon (03/17/2000)
# define _STLP_TEMPLATE_HEADER __BVEC_TMPL_HEADER
# define _STLP_TEMPLATE_CONTAINER __BVECTOR_QUALIFIED
# include <stl/_relops_cont.h>
# undef _STLP_TEMPLATE_CONTAINER
# undef _STLP_TEMPLATE_HEADER
#endif /* NO_BOOL */
#if defined (_STLP_DEBUG) && !defined (_STLP_NO_BOOL)
_STLP_MOVE_TO_STD_NAMESPACE
#endif
_STLP_END_NAMESPACE
#undef vector
#undef _Alloc
#undef _STLP_VECBOOL_TEMPLATE
#undef __BVECTOR
#undef __BVECTOR_QUALIFIED
#undef __BVEC_TMPL_HEADER
#undef _STLP_WORD_BIT
#endif /* _STLP_INTERNAL_BVECTOR_H */
// Local Variables:
// mode:C++
// End:

View file

@ -0,0 +1,61 @@
/*
* Copyright (c) 2005
* Francois Dumont
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
/* NOTE: This is an internal header file, included by other STL headers.
* You should not attempt to use it directly.
*/
#ifndef _STLP_CARRAY_H
#define _STLP_CARRAY_H
/* Purpose: Mimic a pur C array with the additionnal feature of
* being able to be used with type not default constructible.
*/
#ifndef _STLP_INTERNAL_CONSTRUCT_H
# include <stl/_construct.h>
#endif
_STLP_BEGIN_NAMESPACE
_STLP_MOVE_TO_PRIV_NAMESPACE
template <class _Tp, size_t _Nb>
struct _CArray {
_CArray (const _Tp& __val) {
for (size_t __i = 0; __i < _Nb; ++__i) {
_Copy_Construct(__REINTERPRET_CAST(_Tp*, _M_data + __i * sizeof(_Tp)), __val);
}
}
~_CArray() {
_Destroy_Range(__REINTERPRET_CAST(_Tp*, _M_data + 0),
__REINTERPRET_CAST(_Tp*, _M_data + _Nb * sizeof(_Tp)));
}
_Tp& operator [] (size_t __i) {
_STLP_ASSERT(__i < _Nb)
return *__REINTERPRET_CAST(_Tp*, _M_data + __i * sizeof(_Tp));
}
private:
char _M_data[sizeof(_Tp) * _Nb];
};
_STLP_MOVE_TO_STD_NAMESPACE
_STLP_END_NAMESPACE
#endif //_STLP_CARRAY_H

Some files were not shown because too many files have changed in this diff Show more