Add windows libs

This commit is contained in:
2024-09-18 01:56:35 +08:00
parent 306053ad2f
commit 33f393e123
486 changed files with 256040 additions and 0 deletions

View File

@@ -0,0 +1,135 @@
/***
*_vcclrit.h
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file defines the functions and variables used by user
* to initialize CRT and the dll in IJW scenario.
*
****/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
extern IMAGE_DOS_HEADER __ImageBase;
BOOL WINAPI _DllMainCRTStartup(
HANDLE hDllHandle,
DWORD dwReason,
LPVOID lpreserved
);
#ifdef __cplusplus
}
#endif
#ifdef _cplusplus
#define __USE_GLOBAL_NAMESPACE ::
#else
#define __USE_GLOBAL_NAMESPACE
#endif
// Used to lock
__declspec( selectany ) LONG volatile __lock_handle = 0;
// Init called
__declspec(selectany) BOOL volatile __initialized = FALSE;
// Term called
__declspec( selectany ) BOOL volatile __terminated = FALSE;
__inline BOOL WINAPI __crt_dll_initialize()
{
// Try to make the variable names unique, so that the variables don't even clash with macros.
static BOOL volatile (__retval) = FALSE;
static DWORD volatile (__lockThreadId) = 0xffffffff;
DWORD volatile (__currentThreadId) = __USE_GLOBAL_NAMESPACE(GetCurrentThreadId)();
int (__int_var)=0;
// Take Lock, This is needed for multithreaded scenario. Moreover the threads
// need to wait here to make sure that the dll is initialized when they get
// past this function.
while ( __USE_GLOBAL_NAMESPACE(InterlockedExchange)( &(__lock_handle), 1) == 1 )
{
++(__int_var);
if ((__lockThreadId) == (__currentThreadId))
{
return TRUE;
}
__USE_GLOBAL_NAMESPACE(Sleep)( (__int_var)>1000?100:0 );
// If you hang in this loop, this implies that your dllMainCRTStartup is hung on another
// thread. The most likely cause of this is a hang in one of your static constructors or
// destructors.
}
// Note that we don't really need any interlocked stuff here as the writes are always
// in the lock. Only reads are outside the lock.
(__lockThreadId) = (__currentThreadId);
__try {
if ( (__terminated) == TRUE )
{
(__retval) = FALSE;
}
else if ( (__initialized) == FALSE )
{
(__retval) = (_DllMainCRTStartup)( ( HINSTANCE )( &__ImageBase ), DLL_PROCESS_ATTACH, 0 );
(__initialized) = TRUE;
}
} __finally {
// revert the __lockThreadId
(__lockThreadId) = 0xffffffff;
// Release Lock
__USE_GLOBAL_NAMESPACE(InterlockedExchange)( &(__lock_handle), 0 );
}
return (__retval);
}
__inline BOOL WINAPI __crt_dll_terminate()
{
static BOOL volatile (__retval) = TRUE;
static DWORD volatile (__lockThreadId) = 0xffffffff;
DWORD volatile (__currentThreadId) = __USE_GLOBAL_NAMESPACE(GetCurrentThreadId)();
int (__int_var)=0;
// Take Lock, this lock is needed to keep Terminate in sync with Initialize.
while ( __USE_GLOBAL_NAMESPACE(InterlockedExchange)( &(__lock_handle), 1) == 1 )
{
++(__int_var);
if ((__lockThreadId) == (__currentThreadId))
{
return TRUE;
}
__USE_GLOBAL_NAMESPACE(Sleep)( (__int_var)>1000?100:0 );
// If you hang in this loop, this implies that your dllMainCRTStartup is hung on another
// thread. The most likely cause of this is a hang in one of your static constructors or
// destructors.
}
// Note that we don't really need any interlocked stuff here as the writes are always
// in the lock. Only reads are outside the lock.
(__lockThreadId) = (__currentThreadId);
__try {
if ( (__initialized) == FALSE )
{
(__retval) = FALSE;
}
else if ( (__terminated) == FALSE )
{
(__retval) = _DllMainCRTStartup( ( HINSTANCE )( &(__ImageBase) ), DLL_PROCESS_DETACH, 0 );
(__terminated) = TRUE;
}
} __finally {
// revert the __lockThreadId
(__lockThreadId) = 0xffffffff;
// Release Lock
__USE_GLOBAL_NAMESPACE(InterlockedExchange)( &(__lock_handle), 0 );
}
return (__retval);
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,58 @@
/***
*assert.h - define the assert macro
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* Defines the assert(exp) macro.
* [ANSI/System V]
*
* [Public]
*
****/
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
/* Define _CRTIMP */
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* ndef _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* _CRTIMP */
/* Define __cdecl for non-Microsoft compilers */
#if ( !defined(_MSC_VER) && !defined(__cdecl) )
#define __cdecl
#endif
#undef assert
#ifdef NDEBUG
#define assert(exp) ((void)0)
#else
#ifdef __cplusplus
extern "C" {
#endif
_CRTIMP void __cdecl _assert(const char *, const char *, unsigned);
#ifdef __cplusplus
}
#endif
#define assert(exp) (void)( (exp) || (_assert(#exp, __FILE__, __LINE__), 0) )
#endif /* NDEBUG */

View File

@@ -0,0 +1,481 @@
// bitset standard header
#pragma once
#ifndef _BITSET_
#define _BITSET_
#include <string>
#pragma pack(push,8)
#pragma warning(push,3)
#pragma warning(disable: 4127)
_STD_BEGIN
// TEMPLATE CLASS bitset
template<size_t _Bits>
class bitset
{ // store fixed-length sequence of Boolean elements
typedef unsigned long _Ty; // base type for a storage word
public:
typedef bool element_type; // retained
// CLASS reference
class reference
{ // proxy for an element
friend class bitset<_Bits>;
public:
reference& operator=(bool _Val)
{ // assign Boolean to element
_Pbitset->set(_Mypos, _Val);
return (*this);
}
reference& operator=(const reference& _Bitref)
{ // assign reference to element
_Pbitset->set(_Mypos, bool(_Bitref));
return (*this);
}
reference& flip()
{ // complement stored element
_Pbitset->flip(_Mypos);
return (*this);
}
bool operator~() const
{ // return complemented element
return (!_Pbitset->test(_Mypos));
}
operator bool() const
{ // return element
return (_Pbitset->test(_Mypos));
}
private:
reference(bitset<_Bits>& _Bitset, size_t _Pos)
: _Pbitset(&_Bitset), _Mypos(_Pos)
{ // construct from bitset reference and position
}
bitset<_Bits> *_Pbitset; // pointer to the bitset
size_t _Mypos; // position of element in bitset
};
bool at(size_t _Pos) const // retained
{ // subscript nonmutable sequence with checking
if (_Bits <= _Pos)
_Xran();
return (test(_Pos));
}
reference at(size_t _Pos) // retained
{ // subscript mutable sequence with checking
if (_Bits <= _Pos)
_Xran();
return (reference(*this, _Pos));
}
bool operator[](size_t _Pos) const
{ // subscript nonmutable sequence
return (test(_Pos));
}
reference operator[](size_t _Pos)
{ // subscript mutable sequence
return (reference(*this, _Pos));
}
bitset()
{ // construct with all false values
_Tidy();
}
bitset(unsigned long _Val)
{ // construct from bits in unsigned long
_Tidy();
for (size_t _Pos = 0; _Val != 0 && _Pos < _Bits; _Val >>= 1, ++_Pos)
if (_Val & 1)
set(_Pos);
}
#define _BITSET_SIZE_TYPE \
typename basic_string<_Elem, _Tr, _Alloc>::size_type
template<class _Elem,
class _Tr,
class _Alloc>
explicit bitset(const basic_string<_Elem, _Tr, _Alloc>& _Str,
_BITSET_SIZE_TYPE _Pos = 0)
{ // construct from [_Pos, ...) elements in string
_Construct(_Str, _Pos, basic_string<_Elem, _Tr, _Alloc>::npos);
}
template<class _Elem,
class _Tr,
class _Alloc>
explicit bitset(const basic_string<_Elem, _Tr, _Alloc>& _Str,
_BITSET_SIZE_TYPE _Pos,
_BITSET_SIZE_TYPE _Count)
{ // construct from [_Pos, _Pos + _Count) elements in string
_Construct(_Str, _Pos, _Count);
}
template<class _Elem,
class _Tr,
class _Alloc>
void _Construct(
const basic_string<_Elem, _Tr, _Alloc>& _Str,
_BITSET_SIZE_TYPE _Pos,
_BITSET_SIZE_TYPE _Count)
{ // initialize from [_Pos, _Pos + _Count) elements in string
typename basic_string<_Elem, _Tr, _Alloc>::size_type _Num;
if (_Str.size() < _Pos)
_Xran(); // _Pos off end
if (_Str.size() - _Pos < _Count)
_Count = _Str.size() - _Pos; // trim _Count to size
if (_Bits < _Count)
_Count = _Bits; // trim _Count to length of bitset
_Tidy();
for (_Pos += _Count, _Num = 0; _Num < _Count; ++_Num)
if (_Str[--_Pos] == '1')
set(_Num);
else if (_Str[_Pos] != '0')
_Xinv();
}
bitset<_Bits>& operator&=(const bitset<_Bits>& _Right)
{ // AND in _Right
for (int _Wpos = _Words; 0 <= _Wpos; --_Wpos)
_Array[_Wpos] &= _Right._Getword(_Wpos);
return (*this);
}
bitset<_Bits>& operator|=(const bitset<_Bits>& _Right)
{ // OR in _Right
for (int _Wpos = _Words; 0 <= _Wpos; --_Wpos)
_Array[_Wpos] |= _Right._Getword(_Wpos);
return (*this);
}
bitset<_Bits>& operator^=(const bitset<_Bits>& _Right)
{ // XOR in _Right
for (int _Wpos = _Words; 0 <= _Wpos; --_Wpos)
_Array[_Wpos] ^= _Right._Getword(_Wpos);
return (*this);
}
bitset<_Bits>& operator<<=(size_t _Pos)
{ // shift left by _Pos
const int _Wordshift = _Pos / _Bitsperword;
if (_Wordshift != 0)
for (int _Wpos = _Words; 0 <= _Wpos; --_Wpos) // shift by words
_Array[_Wpos] = _Wordshift <= _Wpos
? _Array[_Wpos - _Wordshift] : (_Ty)0;
if ((_Pos %= _Bitsperword) != 0)
{ // 0 < _Pos < _Bitsperword, shift by bits
for (int _Wpos = _Words; 0 < _Wpos; --_Wpos)
_Array[_Wpos] = (_Ty)((_Array[_Wpos] << _Pos)
| (_Array[_Wpos - 1] >> (_Bitsperword - _Pos)));
_Array[0] <<= _Pos;
_Trim();
}
return (*this);
}
bitset<_Bits>& operator>>=(size_t _Pos)
{ // shift right by _Pos
const int _Wordshift = _Pos / _Bitsperword;
if (_Wordshift != 0)
for (int _Wpos = 0; _Wpos <= _Words; ++_Wpos) // shift by words
_Array[_Wpos] = _Wordshift <= _Words - _Wpos
? _Array[_Wpos + _Wordshift] : (_Ty)0;
if ((_Pos %= _Bitsperword) != 0)
{ // 0 < _Pos < _Bitsperword, shift by bits
for (int _Wpos = 0; _Wpos < _Words; ++_Wpos)
_Array[_Wpos] = (_Ty)((_Array[_Wpos] >> _Pos)
| (_Array[_Wpos + 1] << (_Bitsperword - _Pos)));
_Array[_Words] >>= _Pos;
}
return (*this);
}
bitset<_Bits>& set()
{ // set all bits true
_Tidy((_Ty)~0);
return (*this);
}
bitset<_Bits>& set(size_t _Pos,
bool _Val = true)
{ // set bit at _Pos to _Val
if (_Bits <= _Pos)
_Xran(); // _Pos off end
if (_Val)
_Array[_Pos / _Bitsperword] |= (_Ty)1 << _Pos % _Bitsperword;
else
_Array[_Pos / _Bitsperword] &= ~((_Ty)1 << _Pos % _Bitsperword);
return (*this);
}
bitset<_Bits>& reset()
{ // set all bits false
_Tidy();
return (*this);
}
bitset<_Bits>& reset(size_t _Pos)
{ // set bit at _Pos to false
return (set(_Pos, false));
}
bitset<_Bits> operator~() const
{ // flip all bits
return (bitset<_Bits>(*this).flip());
}
bitset<_Bits>& flip()
{ // flip all bits
for (int _Wpos = _Words; 0 <= _Wpos; --_Wpos)
_Array[_Wpos] = (_Ty)~_Array[_Wpos];
_Trim();
return (*this);
}
bitset<_Bits>& flip(size_t _Pos)
{ // flip bit at _Pos
if (_Bits <= _Pos)
_Xran(); // _Pos off end
_Array[_Pos / _Bitsperword] ^= (_Ty)1 << _Pos % _Bitsperword;
return (*this);
}
unsigned long to_ulong() const
{ // convert bitset to unsigned long
enum
{ // cause zero divide if unsigned long not multiple of _Ty
_Assertion = 1
/ (int)(sizeof (unsigned long) % sizeof (_Ty) == 0)};
int _Wpos = _Words;
for (; sizeof (unsigned long) / sizeof (_Ty) <= _Wpos; --_Wpos)
if (_Array[_Wpos] != 0)
_Xoflo(); // fail if any high-order words are nonzero
unsigned long _Val = _Array[_Wpos];
for (; 0 <= --_Wpos; )
_Val = _Val << _Bitsperword | _Array[_Wpos];
return (_Val);
}
template<class _Elem,
class _Tr,
class _Alloc>
basic_string<_Elem, _Tr, _Alloc> to_string() const
{ // convert bitset to string
basic_string<_Elem, _Tr, _Alloc> _Str;
typename basic_string<_Elem, _Tr, _Alloc>::size_type _Pos;
_Str.reserve(_Bits);
for (_Pos = _Bits; 0 < _Pos; )
_Str += (char)('0' + (int)test(--_Pos));
return (_Str);
}
size_t count() const
{ // count number of set bits
static char _Bitsperhex[] = "\0\1\1\2\1\2\2\3\1\2\2\3\2\3\3\4";
size_t _Val = 0;
for (int _Wpos = _Words; 0 <= _Wpos; --_Wpos)
for (_Ty _Wordval = _Array[_Wpos]; _Wordval != 0; _Wordval >>= 4)
_Val += _Bitsperhex[_Wordval & 0xF];
return (_Val);
}
size_t size() const
{ // return size of bitset
return (_Bits);
}
bool operator==(const bitset<_Bits>& _Right) const
{ // test for bitset equality
for (int _Wpos = _Words; 0 <= _Wpos; --_Wpos)
if (_Array[_Wpos] != _Right._Getword(_Wpos))
return (false);
return (true);
}
bool operator!=(const bitset<_Bits>& _Right) const
{ // test for bitset inequality
return (!(*this == _Right));
}
bool test(size_t _Pos) const
{ // test if bit at _Pos is set
if (_Bits <= _Pos)
_Xran(); // _Pos off end
return ((_Array[_Pos / _Bitsperword]
& ((_Ty)1 << _Pos % _Bitsperword)) != 0);
}
bool any() const
{ // test if any bits are set
for (int _Wpos = _Words; 0 <= _Wpos; --_Wpos)
if (_Array[_Wpos] != 0)
return (true);
return (false);
}
bool none() const
{ // test if no bits are set
return (!any());
}
bitset<_Bits> operator<<(size_t _Pos) const
{ // return bitset shifted left by _Pos
return (bitset<_Bits>(*this) <<= _Pos);
}
bitset<_Bits> operator>>(size_t _Pos) const
{ // return bitset shifted right by _Pos
return (bitset<_Bits>(*this) >>= _Pos);
}
bitset<_Bits> operator&(const bitset<_Bits>& _Right) const
{ // return bitset AND _Right
return (bitset<_Bits>(*this) &= _Right);
}
bitset<_Bits> operator|(const bitset<_Bits>& _Right) const
{ // return bitset OR _Right
return (bitset<_Bits>(*this) |= _Right);
}
bitset<_Bits> operator^(const bitset<_Bits>& _Right) const
{ // return bitset XOR _Right
return (bitset<_Bits>(*this) ^= _Right);
}
_Ty _Getword(size_t _Wpos) const
{ // get word at _Wpos
return (_Array[_Wpos]);
}
private:
enum
{ // parameters for packing bits into words
_Bitsperword = CHAR_BIT * sizeof (_Ty), // bits in each word
_Words = _Bits == 0
? 0 : (_Bits - 1) / _Bitsperword}; // NB: number of words - 1
void _Tidy(_Ty _Wordval = 0)
{ // set all words to _Wordval
for (int _Wpos = _Words; 0 <= _Wpos; --_Wpos)
_Array[_Wpos] = _Wordval;
if (_Wordval != 0)
_Trim();
}
void _Trim()
{ // clear any trailing bits in last word
if (_Bits % _Bitsperword != 0)
_Array[_Words] &= ((_Ty)1 << _Bits % _Bitsperword) - 1;
}
void _Xinv() const
{ // report invalid string element in bitset conversion
_THROW(invalid_argument, "invalid bitset<N> char");
}
void _Xoflo() const
{ // report converted value too big to represent
_THROW(overflow_error, "bitset<N> overflow");
}
void _Xran() const
{ // report bit index out of range
_THROW(out_of_range, "invalid bitset<N> position");
}
_Ty _Array[_Words + 1]; // the set of bits
};
// TEMPLATE operator<<
template<class _Elem,
class _Tr,
size_t _Bits> inline
basic_ostream<_Elem, _Tr>& operator<<(
basic_ostream<_Elem, _Tr>& _Ostr, const bitset<_Bits>& _Right)
{ // insert bitset as a string
return (_Ostr
<< _Right.template to_string<_Elem, _Tr, allocator<_Elem> >());
}
// TEMPLATE operator>>
template<class _Elem,
class _Tr,
size_t _Bits> inline
basic_istream<_Elem, _Tr>& operator>>(
basic_istream<_Elem, _Tr>& _Istr, bitset<_Bits>& _Right)
{ // extract bitset as a string
const ctype<_Elem>& _Ctype_fac = _USE(_Istr.getloc(), ctype<_Elem>);
const _Elem _E0 = _Ctype_fac.widen('0');
ios_base::iostate _State = ios_base::goodbit;
bool _Changed = false;
string _Str;
const typename basic_istream<_Elem, _Tr>::sentry _Ok(_Istr);
if (_Ok)
{ // valid stream, extract elements
_TRY_IO_BEGIN
typename _Tr::int_type _Meta = _Istr.rdbuf()->sgetc();
for (size_t _Count = _Right.size(); 0 < _Count;
_Meta = _Istr.rdbuf()->snextc(), --_Count)
{ // test _Meta
_Elem _Char;
if (_Tr::eq_int_type(_Tr::eof(), _Meta))
{ // end of file, quit
_State |= ios_base::eofbit;
break;
}
else if ((_Char = _Tr::to_char_type(_Meta))
!= _E0 && _Char != _E0 + 1)
break; // invalid element
else if (_Str.max_size() <= _Str.size())
{ // no room in string, give up (unlikely)
_State |= ios_base::failbit;
break;
}
else
_Str.append(1, (_Char - _E0) + '0'), _Changed = true;
}
_CATCH_IO_(_Istr)
}
if (!_Changed)
_State |= ios_base::failbit;
_Istr.setstate(_State);
_Right = bitset<_Bits>(_Str); // convert string and store
return (_Istr);
}
_STD_END
#pragma warning(default: 4127)
#pragma warning(pop)
#pragma pack(pop)
#endif /* _BITSET */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

View File

@@ -0,0 +1,8 @@
// cassert standard header
#include <yvals.h>
#include <assert.h>
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

View File

@@ -0,0 +1,31 @@
// cctype standard header
#pragma once
#ifndef _CCTYPE_
#define _CCTYPE_
#include <yvals.h>
#ifdef _STD_USING
#undef _STD_USING
#include <ctype.h>
#define _STD_USING
#else /* _STD_USING */
#include <ctype.h>
#if _GLOBAL_USING
_STD_BEGIN
using ::isalnum; using ::isalpha; using ::iscntrl;
using ::isdigit; using ::isgraph; using ::islower;
using ::isprint; using ::ispunct; using ::isspace;
using ::isupper; using ::isxdigit; using ::tolower;
using ::toupper;
_STD_END
#endif /* _GLOBAL_USING */
#endif /* _STD_USING */
#endif /* _CCTYPE_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

View File

@@ -0,0 +1,30 @@
// cerrno standard header
#pragma once
#ifndef _CERRNO_
#define _CERRNO_
#include <yvals.h>
#ifdef _STD_USING
#undef _STD_USING
#include <errno.h>
#define _STD_USING
#else /* _STD_USING */
#include <errno.h>
#if _GLOBAL_USING
_STD_BEGIN
#ifndef errno
using ::errno;
#endif /* errno */
_STD_END
#endif /* _GLOBAL_USING */
#endif /* _CERRNO_ */
#endif /* _STD_USING */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

View File

@@ -0,0 +1,13 @@
// cfloat standard header
#pragma once
#ifndef _CFLOAT_
#define _CFLOAT_
#include <yvals.h>
#include <float.h>
#endif /* _CFLOAT_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

View File

@@ -0,0 +1,13 @@
// ciso646 standard header
#pragma once
#ifndef _CISO646_
#define _CISO646_
#include <yvals.h>
#include <iso646.h>
#endif /* _CISO646_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

View File

@@ -0,0 +1,15 @@
// climits standard header
#pragma once
#ifndef _CLIMITS_
#define _CLIMITS_
#include <yvals.h>
#pragma warning(disable: 4514)
#include <limits.h>
#endif /* _CLIMITS_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

View File

@@ -0,0 +1,27 @@
// clocale standard header
#pragma once
#ifndef _CLOCALE_
#define _CLOCALE_
#include <yvals.h>
#ifdef _STD_USING
#undef _STD_USING
#include <locale.h>
#define _STD_USING
#else /* _STD_USING */
#include <locale.h>
#if _GLOBAL_USING
_STD_BEGIN
using ::lconv; using ::localeconv; using ::setlocale;
_STD_END
#endif /* _GLOBAL_USING */
#endif /* _STD_USING */
#endif /* _CLOCALE_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

View File

@@ -0,0 +1,52 @@
// cmath standard header
#pragma once
#ifndef _CMATH_
#define _CMATH_
#include <yvals.h>
#ifdef _STD_USING
#undef _STD_USING
#include <math.h>
#define _STD_USING
#else /* _STD_USING */
#include <math.h>
#if _GLOBAL_USING
_STD_BEGIN
using ::abs; using ::acos; using ::asin;
using ::atan; using ::atan2; using ::ceil;
using ::cos; using ::cosh; using ::exp;
using ::fabs; using ::floor; using ::fmod;
using ::frexp; using ::ldexp; using ::log;
using ::log10; using ::modf; using ::pow;
using ::sin; using ::sinh; using ::sqrt;
using ::tan; using ::tanh;
using ::acosf; using ::asinf;
using ::atanf; using ::atan2f; using ::ceilf;
using ::cosf; using ::coshf; using ::expf;
using ::fabsf; using ::floorf; using ::fmodf;
using ::frexpf; using ::ldexpf; using ::logf;
using ::log10f; using ::modff; using ::powf;
using ::sinf; using ::sinhf; using ::sqrtf;
using ::tanf; using ::tanhf;
using ::acosl; using ::asinl;
using ::atanl; using ::atan2l; using ::ceill;
using ::cosl; using ::coshl; using ::expl;
using ::fabsl; using ::floorl; using ::fmodl;
using ::frexpl; using ::ldexpl; using ::logl;
using ::log10l; using ::modfl; using ::powl;
using ::sinl; using ::sinhl; using ::sqrtl;
using ::tanl; using ::tanhl;
_STD_END
#endif /* _GLOBAL_USING */
#endif /* _STD_USING */
#endif /* _CMATH_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,131 @@
/***
*conio.h - console and port I/O declarations
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* This include file contains the function declarations for
* the MS C V2.03 compatible console I/O routines.
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_CONIO
#define _INC_CONIO
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* Define _CRTIMP */
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* ndef _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* _CRTIMP */
#ifndef _WCHAR_T_DEFINED
typedef unsigned short wchar_t;
#define _WCHAR_T_DEFINED
#endif
#ifndef _WCTYPE_T_DEFINED
typedef unsigned short wint_t;
typedef unsigned short wctype_t;
#define _WCTYPE_T_DEFINED
#endif
/* Define __cdecl for non-Microsoft compilers */
#if ( !defined(_MSC_VER) && !defined(__cdecl) )
#define __cdecl
#endif
/* Function prototypes */
_CRTIMP char * __cdecl _cgets(char *);
_CRTIMP int __cdecl _cprintf(const char *, ...);
_CRTIMP int __cdecl _cputs(const char *);
_CRTIMP int __cdecl _cscanf(const char *, ...);
_CRTIMP int __cdecl _getch(void);
_CRTIMP int __cdecl _getche(void);
#ifdef _M_IX86
int __cdecl _inp(unsigned short);
unsigned short __cdecl _inpw(unsigned short);
unsigned long __cdecl _inpd(unsigned short);
#endif /* _M_IX86 */
_CRTIMP int __cdecl _kbhit(void);
#ifdef _M_IX86
int __cdecl _outp(unsigned short, int);
unsigned short __cdecl _outpw(unsigned short, unsigned short);
unsigned long __cdecl _outpd(unsigned short, unsigned long);
#endif /* _M_IX86 */
_CRTIMP int __cdecl _putch(int);
_CRTIMP int __cdecl _ungetch(int);
#ifndef _WCONIO_DEFINED
/* wide function prototypes, also declared in wchar.h */
#ifndef WEOF
#define WEOF (wint_t)(0xFFFF)
#endif
_CRTIMP wchar_t * __cdecl _cgetws(wchar_t *);
_CRTIMP wint_t __cdecl _getwch(void);
_CRTIMP wint_t __cdecl _getwche(void);
_CRTIMP wint_t __cdecl _putwch(wchar_t);
_CRTIMP wint_t __cdecl _ungetwch(wint_t);
_CRTIMP int __cdecl _cputws(const wchar_t *);
_CRTIMP int __cdecl _cwprintf(const wchar_t *, ...);
_CRTIMP int __cdecl _cwscanf(const wchar_t *, ...);
#define _WCONIO_DEFINED
#endif /* _WCONIO_DEFINED */
#if !__STDC__
/* Non-ANSI names for compatibility */
_CRTIMP char * __cdecl cgets(char *);
_CRTIMP int __cdecl cprintf(const char *, ...);
_CRTIMP int __cdecl cputs(const char *);
_CRTIMP int __cdecl cscanf(const char *, ...);
#ifdef _M_IX86
int __cdecl inp(unsigned short);
unsigned short __cdecl inpw(unsigned short);
#endif /* _M_IX86 */
_CRTIMP int __cdecl getch(void);
_CRTIMP int __cdecl getche(void);
_CRTIMP int __cdecl kbhit(void);
#ifdef _M_IX86
int __cdecl outp(unsigned short, int);
unsigned short __cdecl outpw(unsigned short, unsigned short);
#endif /* _M_IX86 */
_CRTIMP int __cdecl putch(int);
_CRTIMP int __cdecl ungetch(int);
#endif /* __STDC__ */
#ifdef __cplusplus
}
#endif
#endif /* _INC_CONIO */

View File

@@ -0,0 +1,704 @@
/***
*crtdbg.h - Supports debugging features of the C runtime library.
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* Support CRT debugging features.
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_CRTDBG
#define _INC_CRTDBG
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/****************************************************************************
*
* Constants and types
*
***************************************************************************/
#if !defined(_W64)
#if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
#define _W64 __w64
#else
#define _W64
#endif
#endif
#ifndef _SIZE_T_DEFINED
#ifdef _WIN64
typedef unsigned __int64 size_t;
#else
typedef _W64 unsigned int size_t;
#endif
#define _SIZE_T_DEFINED
#endif
/* Define NULL pointer value */
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
/****************************************************************************
*
* Debug Reporting
*
***************************************************************************/
typedef void *_HFILE; /* file handle pointer */
#define _CRT_WARN 0
#define _CRT_ERROR 1
#define _CRT_ASSERT 2
#define _CRT_ERRCNT 3
#define _CRTDBG_MODE_FILE 0x1
#define _CRTDBG_MODE_DEBUG 0x2
#define _CRTDBG_MODE_WNDW 0x4
#define _CRTDBG_REPORT_MODE -1
#define _CRTDBG_INVALID_HFILE ((_HFILE)-1)
#define _CRTDBG_HFILE_ERROR ((_HFILE)-2)
#define _CRTDBG_FILE_STDOUT ((_HFILE)-4)
#define _CRTDBG_FILE_STDERR ((_HFILE)-5)
#define _CRTDBG_REPORT_FILE ((_HFILE)-6)
typedef int (__cdecl * _CRT_REPORT_HOOK)(int, char *, int *);
#define _CRT_RPTHOOK_INSTALL 0
#define _CRT_RPTHOOK_REMOVE 1
/****************************************************************************
*
* Heap
*
***************************************************************************/
/****************************************************************************
*
* Client-defined allocation hook
*
***************************************************************************/
#define _HOOK_ALLOC 1
#define _HOOK_REALLOC 2
#define _HOOK_FREE 3
typedef int (__cdecl * _CRT_ALLOC_HOOK)(int, void *, size_t, int, long, const unsigned char *, int);
/****************************************************************************
*
* Memory management
*
***************************************************************************/
/*
* Bit values for _crtDbgFlag flag:
*
* These bitflags control debug heap behavior.
*/
#define _CRTDBG_ALLOC_MEM_DF 0x01 /* Turn on debug allocation */
#define _CRTDBG_DELAY_FREE_MEM_DF 0x02 /* Don't actually free memory */
#define _CRTDBG_CHECK_ALWAYS_DF 0x04 /* Check heap every alloc/dealloc */
#define _CRTDBG_RESERVED_DF 0x08 /* Reserved - do not use */
#define _CRTDBG_CHECK_CRT_DF 0x10 /* Leak check/diff CRT blocks */
#define _CRTDBG_LEAK_CHECK_DF 0x20 /* Leak check at program exit */
/*
* Some bit values for _crtDbgFlag which correspond to frequencies for checking
* the the heap.
*/
#define _CRTDBG_CHECK_EVERY_16_DF 0x00100000 /* check heap every 16 heap ops */
#define _CRTDBG_CHECK_EVERY_128_DF 0x00800000 /* check heap every 128 heap ops */
#define _CRTDBG_CHECK_EVERY_1024_DF 0x04000000 /* check heap every 1024 heap ops */
/*
We do not check the heap by default at this point because the cost was too high
for some applications. You can still turn this feature on manually.
*/
#define _CRTDBG_CHECK_DEFAULT_DF 0
#define _CRTDBG_REPORT_FLAG -1 /* Query bitflag status */
#define _BLOCK_TYPE(block) (block & 0xFFFF)
#define _BLOCK_SUBTYPE(block) (block >> 16 & 0xFFFF)
/****************************************************************************
*
* Memory state
*
***************************************************************************/
/* Memory block identification */
#define _FREE_BLOCK 0
#define _NORMAL_BLOCK 1
#define _CRT_BLOCK 2
#define _IGNORE_BLOCK 3
#define _CLIENT_BLOCK 4
#define _MAX_BLOCKS 5
typedef void (__cdecl * _CRT_DUMP_CLIENT)(void *, size_t);
struct _CrtMemBlockHeader;
typedef struct _CrtMemState
{
struct _CrtMemBlockHeader * pBlockHeader;
size_t lCounts[_MAX_BLOCKS];
size_t lSizes[_MAX_BLOCKS];
size_t lHighWaterCount;
size_t lTotalCount;
} _CrtMemState;
/****************************************************************************
*
* Declarations, prototype and function-like macros
*
***************************************************************************/
#ifndef _DEBUG
/****************************************************************************
*
* Debug OFF
* Debug OFF
* Debug OFF
*
***************************************************************************/
/* We allow our basic _ASSERT macros to be overridden by pre-existing definitions.
This is not the ideal mechanism, but is helpful in some scenarios and helps avoid
multiple definition problems */
#ifndef _ASSERT
#define _ASSERT(expr) ((void)0)
#endif
#ifndef _ASSERTE
#define _ASSERTE(expr) ((void)0)
#endif
#define _RPT0(rptno, msg)
#define _RPT1(rptno, msg, arg1)
#define _RPT2(rptno, msg, arg1, arg2)
#define _RPT3(rptno, msg, arg1, arg2, arg3)
#define _RPT4(rptno, msg, arg1, arg2, arg3, arg4)
#define _RPTF0(rptno, msg)
#define _RPTF1(rptno, msg, arg1)
#define _RPTF2(rptno, msg, arg1, arg2)
#define _RPTF3(rptno, msg, arg1, arg2, arg3)
#define _RPTF4(rptno, msg, arg1, arg2, arg3, arg4)
#define _malloc_dbg(s, t, f, l) malloc(s)
#define _calloc_dbg(c, s, t, f, l) calloc(c, s)
#define _realloc_dbg(p, s, t, f, l) realloc(p, s)
#define _expand_dbg(p, s, t, f, l) _expand(p, s)
#define _free_dbg(p, t) free(p)
#define _msize_dbg(p, t) _msize(p)
#define _aligned_malloc_dbg(s, a, f, l) _aligned_malloc(s, a)
#define _aligned_realloc_dbg(p, s, a, f, l) _aligned_realloc(p, s, a)
#define _aligned_free_dbg(p) _aligned_free(p)
#define _aligned_offset_malloc_dbg(s, a, o, f, l) _aligned_offset_malloc(s, a, o)
#define _aligned_offset_realloc_dbg(p, s, a, o, f, l) _aligned_offset_realloc(p, s, a, o)
#define _CrtSetReportHook(f) ((_CRT_REPORT_HOOK)0)
#define _CrtSetReportHook2(t, f) ((int)0)
#define _CrtSetReportMode(t, f) ((int)0)
#define _CrtSetReportFile(t, f) ((_HFILE)0)
#define _CrtDbgBreak() ((void)0)
#define _CrtSetBreakAlloc(a) ((long)0)
#define _CrtSetAllocHook(f) ((_CRT_ALLOC_HOOK)0)
#define _CrtCheckMemory() ((int)1)
#define _CrtSetDbgFlag(f) ((int)0)
#define _CrtDoForAllClientObjects(f, c) ((void)0)
#define _CrtIsValidPointer(p, n, r) ((int)1)
#define _CrtIsValidHeapPointer(p) ((int)1)
#define _CrtIsMemoryBlock(p, t, r, f, l) ((int)1)
#define _CrtReportBlockType(p) ((int)-1)
#define _CrtSetDumpClient(f) ((_CRT_DUMP_CLIENT)0)
#define _CrtMemCheckpoint(s) ((void)0)
#define _CrtMemDifference(s1, s2, s3) ((int)0)
#define _CrtMemDumpAllObjectsSince(s) ((void)0)
#define _CrtMemDumpStatistics(s) ((void)0)
#define _CrtDumpMemoryLeaks() ((int)0)
#else /* _DEBUG */
/****************************************************************************
*
* Debug ON
* Debug ON
* Debug ON
*
***************************************************************************/
/* Define _CRTIMP */
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* ndef _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* _CRTIMP */
/****************************************************************************
*
* Debug Reporting
*
***************************************************************************/
_CRTIMP extern long _crtAssertBusy;
_CRTIMP _CRT_REPORT_HOOK __cdecl _CrtSetReportHook(
_CRT_REPORT_HOOK
);
_CRTIMP int __cdecl _CrtSetReportHook2(
int,
_CRT_REPORT_HOOK
);
_CRTIMP int __cdecl _CrtSetReportMode(
int,
int
);
_CRTIMP _HFILE __cdecl _CrtSetReportFile(
int,
_HFILE
);
_CRTIMP int __cdecl _CrtDbgReport(
int,
const char *,
int,
const char *,
const char *,
...);
/* Asserts */
#if _MSC_VER >= 1300 || !defined(_M_IX86) || defined(_CRT_PORTABLE)
#define _ASSERT_BASE(expr, msg) \
(void) ((expr) || \
(1 != _CrtDbgReport(_CRT_ASSERT, __FILE__, __LINE__, NULL, msg)) || \
(_CrtDbgBreak(), 0))
#else
#define _ASSERT_BASE(expr, msg) \
do { if (!(expr) && \
(1 == _CrtDbgReport(_CRT_ASSERT, __FILE__, __LINE__, NULL, msg))) \
_CrtDbgBreak(); } while (0)
#endif
#ifndef _ASSERT
#define _ASSERT(expr) _ASSERT_BASE((expr), NULL)
#endif
#ifndef _ASSERTE
#define _ASSERTE(expr) _ASSERT_BASE((expr), #expr)
#endif
/* Reports with no file/line info */
#if _MSC_VER >= 1300 || !defined(_M_IX86) || defined(_CRT_PORTABLE)
#define _RPT_BASE(args) \
(void) ((1 != _CrtDbgReport args) || \
(_CrtDbgBreak(), 0))
#else
#define _RPT_BASE(args) \
do { if ((1 == _CrtDbgReport args)) \
_CrtDbgBreak(); } while (0)
#endif
#define _RPT0(rptno, msg) \
_RPT_BASE((rptno, NULL, 0, NULL, "%s", msg))
#define _RPT1(rptno, msg, arg1) \
_RPT_BASE((rptno, NULL, 0, NULL, msg, arg1))
#define _RPT2(rptno, msg, arg1, arg2) \
_RPT_BASE((rptno, NULL, 0, NULL, msg, arg1, arg2))
#define _RPT3(rptno, msg, arg1, arg2, arg3) \
_RPT_BASE((rptno, NULL, 0, NULL, msg, arg1, arg2, arg3))
#define _RPT4(rptno, msg, arg1, arg2, arg3, arg4) \
_RPT_BASE((rptno, NULL, 0, NULL, msg, arg1, arg2, arg3, arg4))
/* Reports with file/line info */
#define _RPTF0(rptno, msg) \
_RPT_BASE((rptno, __FILE__, __LINE__, NULL, "%s", msg))
#define _RPTF1(rptno, msg, arg1) \
_RPT_BASE((rptno, __FILE__, __LINE__, NULL, msg, arg1))
#define _RPTF2(rptno, msg, arg1, arg2) \
_RPT_BASE((rptno, __FILE__, __LINE__, NULL, msg, arg1, arg2))
#define _RPTF3(rptno, msg, arg1, arg2, arg3) \
_RPT_BASE((rptno, __FILE__, __LINE__, NULL, msg, arg1, arg2, arg3))
#define _RPTF4(rptno, msg, arg1, arg2, arg3, arg4) \
_RPT_BASE((rptno, __FILE__, __LINE__, NULL, msg, arg1, arg2, arg3, arg4))
#if _MSC_VER >= 1300 && !defined(_CRT_PORTABLE)
#define _CrtDbgBreak() __debugbreak()
#elif defined(_M_IX86) && !defined(_CRT_PORTABLE)
#define _CrtDbgBreak() __asm { int 3 }
#elif defined(_M_ALPHA) && !defined(_CRT_PORTABLE)
void _BPT();
#pragma intrinsic(_BPT)
#define _CrtDbgBreak() _BPT()
#elif defined(_M_IA64) && !defined(_CRT_PORTABLE)
void __break(int);
#pragma intrinsic (__break)
#define _CrtDbgBreak() __break(0x80016)
#else
_CRTIMP void __cdecl _CrtDbgBreak(
void
);
#endif
/****************************************************************************
*
* Heap routines
*
***************************************************************************/
#ifdef _CRTDBG_MAP_ALLOC
#define malloc(s) _malloc_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__)
#define calloc(c, s) _calloc_dbg(c, s, _NORMAL_BLOCK, __FILE__, __LINE__)
#define realloc(p, s) _realloc_dbg(p, s, _NORMAL_BLOCK, __FILE__, __LINE__)
#define _expand(p, s) _expand_dbg(p, s, _NORMAL_BLOCK, __FILE__, __LINE__)
#define free(p) _free_dbg(p, _NORMAL_BLOCK)
#define _msize(p) _msize_dbg(p, _NORMAL_BLOCK)
#define _aligned_malloc(s, a) _aligned_malloc_dbg(s, a, __FILE__, __LINE__)
#define _aligned_realloc(p, s, a) _aligned_realloc_dbg(p, s, a, __FILE__, __LINE__)
#define _aligned_offset_malloc(s, a, o) _aligned_offset_malloc_dbg(s, a, o, __FILE__, __LINE__)
#define _aligned_offset_realloc(p, s, a, o) _aligned_offset_realloc_dbg(p, s, a, o, __FILE__, __LINE__)
#define _aligned_free(p) _aligned_free_dbg(p)
#endif /* _CRTDBG_MAP_ALLOC */
_CRTIMP extern long _crtBreakAlloc; /* Break on this allocation */
_CRTIMP long __cdecl _CrtSetBreakAlloc(
long
);
/*
* Prototypes for malloc, free, realloc, etc are in malloc.h
*/
_CRTIMP void * __cdecl _malloc_dbg(
size_t,
int,
const char *,
int
);
_CRTIMP void * __cdecl _calloc_dbg(
size_t,
size_t,
int,
const char *,
int
);
_CRTIMP void * __cdecl _realloc_dbg(
void *,
size_t,
int,
const char *,
int
);
_CRTIMP void * __cdecl _expand_dbg(
void *,
size_t,
int,
const char *,
int
);
_CRTIMP void __cdecl _free_dbg(
void *,
int
);
_CRTIMP size_t __cdecl _msize_dbg (
void *,
int
);
_CRTIMP void * __cdecl _aligned_malloc_dbg(
size_t,
size_t,
const char *,
int
);
_CRTIMP void * __cdecl _aligned_realloc_dbg(
void *,
size_t,
size_t,
const char *,
int
);
_CRTIMP void * __cdecl _aligned_offset_malloc_dbg(
size_t,
size_t,
size_t,
const char *,
int
);
_CRTIMP void * __cdecl _aligned_offset_realloc_dbg(
void *,
size_t,
size_t,
size_t,
const char *,
int
);
_CRTIMP void __cdecl _aligned_free_dbg(
void *
);
/****************************************************************************
*
* Client-defined allocation hook
*
***************************************************************************/
_CRTIMP _CRT_ALLOC_HOOK __cdecl _CrtSetAllocHook(
_CRT_ALLOC_HOOK
);
/****************************************************************************
*
* Memory management
*
***************************************************************************/
/*
* Bitfield flag that controls CRT heap behavior
* Default setting is _CRTDBG_ALLOC_MEM_DF
*/
_CRTIMP extern int _crtDbgFlag;
_CRTIMP int __cdecl _CrtCheckMemory(
void
);
_CRTIMP int __cdecl _CrtSetDbgFlag(
int
);
_CRTIMP void __cdecl _CrtDoForAllClientObjects(
void (*pfn)(void *, void *),
void *
);
_CRTIMP int __cdecl _CrtIsValidPointer(
const void *,
unsigned int,
int
);
_CRTIMP int __cdecl _CrtIsValidHeapPointer(
const void *
);
_CRTIMP int __cdecl _CrtIsMemoryBlock(
const void *,
unsigned int,
long *,
char **,
int *
);
_CRTIMP int __cdecl _CrtReportBlockType(
const void *
);
/****************************************************************************
*
* Memory state
*
***************************************************************************/
_CRTIMP _CRT_DUMP_CLIENT __cdecl _CrtSetDumpClient(
_CRT_DUMP_CLIENT
);
_CRTIMP void __cdecl _CrtMemCheckpoint(
_CrtMemState *
);
_CRTIMP int __cdecl _CrtMemDifference(
_CrtMemState *,
const _CrtMemState *,
const _CrtMemState *
);
_CRTIMP void __cdecl _CrtMemDumpAllObjectsSince(
const _CrtMemState *
);
_CRTIMP void __cdecl _CrtMemDumpStatistics(
const _CrtMemState *
);
_CRTIMP int __cdecl _CrtDumpMemoryLeaks(
void
);
#endif /* _DEBUG */
#ifdef __cplusplus
}
#ifndef _MFC_OVERRIDES_NEW
extern "C++" {
#pragma warning(disable: 4507) /* Ignore faulty warning */
#ifndef _DEBUG
/****************************************************************************
*
* Debug OFF
* Debug OFF
* Debug OFF
*
***************************************************************************/
void * __cdecl operator new[](size_t);
inline void * __cdecl operator new(size_t s, int, const char *, int)
{ return ::operator new(s); }
inline void* __cdecl operator new[](size_t s, int, const char *, int)
{ return ::operator new[](s); }
#if _MSC_VER >= 1200
void __cdecl operator delete[](void *);
inline void __cdecl operator delete(void * _P, int, const char *, int)
{ ::operator delete(_P); }
inline void __cdecl operator delete[](void * _P, int, const char *, int)
{ ::operator delete[](_P); }
#endif
#else /* _DEBUG */
/****************************************************************************
*
* Debug ON
* Debug ON
* Debug ON
*
***************************************************************************/
void * __cdecl operator new[](size_t);
void * __cdecl operator new(
size_t,
int,
const char *,
int
);
void * __cdecl operator new[](
size_t,
int,
const char *,
int
);
#if _MSC_VER >= 1200
void __cdecl operator delete[](void *);
inline void __cdecl operator delete(void * _P, int, const char *, int)
{ ::operator delete(_P); }
inline void __cdecl operator delete[](void * _P, int, const char *, int)
{ ::operator delete[](_P); }
#endif
#ifdef _CRTDBG_MAP_ALLOC
inline void * __cdecl operator new(size_t s)
{ return ::operator new(s, _NORMAL_BLOCK, __FILE__, __LINE__); }
inline void* __cdecl operator new[](size_t s)
{ return ::operator new[](s, _NORMAL_BLOCK, __FILE__, __LINE__); }
#endif /* _CRTDBG_MAP_ALLOC */
#endif /* _DEBUG */
}
#endif /* _MFC_OVERRIDES_NEW */
#endif /* __cplusplus */
#endif /* _INC_CRTDBG */

View File

@@ -0,0 +1,31 @@
// csetjmp standard header
#pragma once
#ifndef _CSETJMP_
#define _CSETJMP_
#include <yvals.h>
#ifdef _STD_USING
#undef _STD_USING
#include <setjmp.h>
#define _STD_USING
#else /* _STD_USING */
#include <setjmp.h>
#if _GLOBAL_USING
_STD_BEGIN
using ::jmp_buf; using ::longjmp;
#ifndef setjmp
using ::setjmp;
#endif /* setjmp */
_STD_END
#endif /* _GLOBAL_USING */
#endif /* _STD_USING */
#endif /* _CSETJMP_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

View File

@@ -0,0 +1,27 @@
// csignal standard header
#pragma once
#ifndef _CSIGNAL_
#define _CSIGNAL_
#include <yvals.h>
#ifdef _STD_USING
#undef _STD_USING
#include <signal.h>
#define _STD_USING
#else /* _STD_USING */
#include <signal.h>
#if _GLOBAL_USING
_STD_BEGIN
using ::sig_atomic_t; using ::raise; using ::signal;
_STD_END
#endif /* _GLOBAL_USING */
#endif /* _STD_USING */
#endif /* _CSIGNAL_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

View File

@@ -0,0 +1,27 @@
// cstdarg standard header
#pragma once
#ifndef _CSTDARG_
#define _CSTDARG_
#include <yvals.h>
#ifdef _STD_USING
#undef _STD_USING
#include <stdarg.h>
#define _STD_USING
#else /* _STD_USING */
#include <stdarg.h>
#if _GLOBAL_USING
_STD_BEGIN
using ::va_list;
_STD_END
#endif /* _GLOBAL_USING */
#endif /* _STD_USING */
#endif /* _CSTDARG_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

View File

@@ -0,0 +1,27 @@
// cstddef standard header
#pragma once
#ifndef _CSTDDEF_
#define _CSTDDEF_
#include <yvals.h>
#ifdef _STD_USING
#undef _STD_USING
#include <stddef.h>
#define _STD_USING
#else /* _STD_USING */
#include <stddef.h>
#if _GLOBAL_USING
_STD_BEGIN
using ::ptrdiff_t; using ::size_t;
_STD_END
#endif /* _GLOBAL_USING */
#endif /* _STD_USING */
#endif /* _CSTDDEF_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

View File

@@ -0,0 +1,42 @@
// cstdio standard header
#pragma once
#ifndef _CSTDIO_
#define _CSTDIO_
#include <yvals.h>
#ifdef _STD_USING
#undef _STD_USING
#include <stdio.h>
#define _STD_USING
#else /* _STD_USING */
#include <stdio.h>
#if _GLOBAL_USING
_STD_BEGIN
using ::size_t; using ::fpos_t; using ::FILE;
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 ::putc; using ::putchar;
using ::printf; 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;
_STD_END
#endif /* _GLOBAL_USING */
#endif /* _STD_USING */
#endif /* _CSTDIO_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

View File

@@ -0,0 +1,38 @@
// cstdlib standard header
#pragma once
#ifndef _CSTDLIB_
#define _CSTDLIB_
#include <yvals.h>
#ifdef _STD_USING
#undef _STD_USING
#include <stdlib.h>
#define _STD_USING
#else /* _STD_USING */
#include <stdlib.h>
#if _GLOBAL_USING
_STD_BEGIN
using ::size_t; 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;
_STD_END
#endif /* _GLOBAL_USING */
#endif /* _STD_USING */
#endif /* _CSTDLIB_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

View File

@@ -0,0 +1,34 @@
// cstring standard header
#pragma once
#ifndef _CSTRING_
#define _CSTRING_
#include <yvals.h>
#ifdef _STD_USING
#undef _STD_USING
#include <string.h>
#define _STD_USING
#else /* _STD_USING */
#include <string.h>
#if _GLOBAL_USING
_STD_BEGIN
using ::size_t; using ::memchr; using ::memcmp;
using ::memcpy; using ::memmove; using ::memset;
using ::strcat; using ::strchr; using ::strcmp;
using ::strcoll; using ::strcpy; using ::strcspn;
using ::strerror; using ::strlen; using ::strncat;
using ::strncmp; using ::strncpy; using ::strpbrk;
using ::strrchr; using ::strspn; using ::strstr;
using ::strtok; using ::strxfrm;
_STD_END
#endif /* _GLOBAL_USING */
#endif /* _STD_USING */
#endif /* _CSTRING_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

View File

@@ -0,0 +1,31 @@
// ctime standard header
#pragma once
#ifndef _CTIME_
#define _CTIME_
#include <yvals.h>
#ifdef _STD_USING
#undef _STD_USING
#include <time.h>
#define _STD_USING
#else /* _STD_USING */
#include <time.h>
#if _GLOBAL_USING
_STD_BEGIN
using ::clock_t; using ::size_t;
using ::time_t; using ::tm;
using ::asctime; using ::clock; using ::ctime;
using ::difftime; using ::gmtime; using ::localtime;
using ::mktime; using ::strftime; using ::time;
_STD_END
#endif /* _GLOBAL_USING */
#endif /* _STD_USING */
#endif /* _CTIME_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

View File

@@ -0,0 +1,295 @@
/***
*ctype.h - character conversion macros and ctype macros
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* Defines macros for character classification/conversion.
* [ANSI/System V]
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_CTYPE
#define _INC_CTYPE
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* Define _CRTIMP */
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* ndef _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* _CRTIMP */
/* Define __cdecl for non-Microsoft compilers */
#if ( !defined(_MSC_VER) && !defined(__cdecl) )
#define __cdecl
#endif
#ifndef _WCHAR_T_DEFINED
typedef unsigned short wchar_t;
#define _WCHAR_T_DEFINED
#endif
#ifndef _WCTYPE_T_DEFINED
typedef unsigned short wint_t;
typedef unsigned short wctype_t;
#define _WCTYPE_T_DEFINED
#endif
#ifndef WEOF
#define WEOF (wint_t)(0xFFFF)
#endif
#ifndef _CTYPE_DISABLE_MACROS
_CRTIMP extern const unsigned short _wctype[];
_CRTIMP extern const unsigned short *_pctype;
_CRTIMP extern const wctype_t *_pwctype;
#endif /* _CTYPE_DISABLE_MACROS */
/* set bit masks for the possible character types */
#define _UPPER 0x1 /* upper case letter */
#define _LOWER 0x2 /* lower case letter */
#define _DIGIT 0x4 /* digit[0-9] */
#define _SPACE 0x8 /* tab, carriage return, newline, */
/* vertical tab or form feed */
#define _PUNCT 0x10 /* punctuation character */
#define _CONTROL 0x20 /* control character */
#define _BLANK 0x40 /* space char */
#define _HEX 0x80 /* hexadecimal digit */
#define _LEADBYTE 0x8000 /* multibyte leadbyte */
#define _ALPHA (0x0100|_UPPER|_LOWER) /* alphabetic character */
/* character classification function prototypes */
#ifndef _CTYPE_DEFINED
_CRTIMP int __cdecl _isctype(int, int);
_CRTIMP int __cdecl isalpha(int);
_CRTIMP int __cdecl isupper(int);
_CRTIMP int __cdecl islower(int);
_CRTIMP int __cdecl isdigit(int);
_CRTIMP int __cdecl isxdigit(int);
_CRTIMP int __cdecl isspace(int);
_CRTIMP int __cdecl ispunct(int);
_CRTIMP int __cdecl isalnum(int);
_CRTIMP int __cdecl isprint(int);
_CRTIMP int __cdecl isgraph(int);
_CRTIMP int __cdecl iscntrl(int);
_CRTIMP int __cdecl toupper(int);
_CRTIMP int __cdecl tolower(int);
_CRTIMP int __cdecl _tolower(int);
_CRTIMP int __cdecl _toupper(int);
_CRTIMP int __cdecl __isascii(int);
_CRTIMP int __cdecl __toascii(int);
_CRTIMP int __cdecl __iscsymf(int);
_CRTIMP int __cdecl __iscsym(int);
#define _CTYPE_DEFINED
#endif
#ifndef _WCTYPE_DEFINED
/* wide function prototypes, also declared in wchar.h */
/* character classification function prototypes */
_CRTIMP int __cdecl iswalpha(wint_t);
_CRTIMP int __cdecl iswupper(wint_t);
_CRTIMP int __cdecl iswlower(wint_t);
_CRTIMP int __cdecl iswdigit(wint_t);
_CRTIMP int __cdecl iswxdigit(wint_t);
_CRTIMP int __cdecl iswspace(wint_t);
_CRTIMP int __cdecl iswpunct(wint_t);
_CRTIMP int __cdecl iswalnum(wint_t);
_CRTIMP int __cdecl iswprint(wint_t);
_CRTIMP int __cdecl iswgraph(wint_t);
_CRTIMP int __cdecl iswcntrl(wint_t);
_CRTIMP int __cdecl iswascii(wint_t);
_CRTIMP int __cdecl isleadbyte(int);
_CRTIMP wchar_t __cdecl towupper(wchar_t);
_CRTIMP wchar_t __cdecl towlower(wchar_t);
_CRTIMP int __cdecl iswctype(wint_t, wctype_t);
/* --------- The following functions are OBSOLETE --------- */
_CRTIMP int __cdecl is_wctype(wint_t, wctype_t);
/* --------- The preceding functions are OBSOLETE --------- */
#define _WCTYPE_DEFINED
#endif
/* the character classification macro definitions */
#ifndef _CTYPE_DISABLE_MACROS
/*
* Maximum number of bytes in multi-byte character in the current locale
* (also defined in stdlib.h).
*/
#ifndef MB_CUR_MAX
#define MB_CUR_MAX __mb_cur_max
_CRTIMP extern int __mb_cur_max;
/* These functions are for enabling STATIC_CPPLIB functionality */
_CRTIMP int __cdecl ___mb_cur_max_func(void);
#endif /* MB_CUR_MAX */
/* Introduced to detect error when character testing functions are called
* with illegal input of integer.
*/
#ifdef _DEBUG
_CRTIMP int __cdecl _chvalidator(int, int);
#define __chvalidchk(a,b) _chvalidator(a,b)
#else
#define __chvalidchk(a,b) (_pctype[a] & (b))
#endif
#ifndef _MT
#ifndef __cplusplus
#define isalpha(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_ALPHA) : __chvalidchk(_c, _ALPHA))
#define isupper(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_UPPER) : __chvalidchk(_c, _UPPER))
#define islower(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_LOWER) : __chvalidchk(_c, _LOWER))
#define isdigit(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_DIGIT) : __chvalidchk(_c, _DIGIT))
#define isxdigit(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_HEX) : __chvalidchk(_c, _HEX))
#define isspace(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_SPACE) : __chvalidchk(_c, _SPACE))
#define ispunct(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_PUNCT) : __chvalidchk(_c, _PUNCT))
#define isalnum(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_ALPHA|_DIGIT) : __chvalidchk(_c, (_ALPHA|_DIGIT)))
#define isprint(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT) : __chvalidchk(_c, (_BLANK|_PUNCT|_ALPHA|_DIGIT)))
#define isgraph(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_PUNCT|_ALPHA|_DIGIT) : __chvalidchk(_c, (_PUNCT|_ALPHA|_DIGIT)))
#define iscntrl(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_CONTROL) : __chvalidchk(_c, _CONTROL))
#elif 0 /* Pending ANSI C++ integration */
inline int isalpha(int _C)
{return (MB_CUR_MAX > 1 ? _isctype(_C,_ALPHA) : __chvalidchk(_C, _ALPHA)); }
inline int isupper(int _C)
{return (MB_CUR_MAX > 1 ? _isctype(_C,_UPPER) : __chvalidchk(_C, _UPPER)); }
inline int islower(int _C)
{return (MB_CUR_MAX > 1 ? _isctype(_C,_LOWER) : __chvalidchk(_C, _LOWER)); }
inline int isdigit(int _C)
{return (MB_CUR_MAX > 1 ? _isctype(_C,_DIGIT) : __chvalidchk(_C, _DIGIT)); }
inline int isxdigit(int _C)
{return (MB_CUR_MAX > 1 ? _isctype(_C,_HEX) : __chvalidchk(_C, _HEX)); }
inline int isspace(int _C)
{return (MB_CUR_MAX > 1 ? _isctype(_C,_SPACE) : __chvalidchk(_C, _SPACE)); }
inline int ispunct(int _C)
{return (MB_CUR_MAX > 1 ? _isctype(_C,_PUNCT) : __chvalidchk(_C, _PUNCT)); }
inline int isalnum(int _C)
{return (MB_CUR_MAX > 1 ? _isctype(_C,_ALPHA|_DIGIT)
: __chvalidchk(_C) , (_ALPHA|_DIGIT)); }
inline int isprint(int _C)
{return (MB_CUR_MAX > 1 ? _isctype(_C,_BLANK|_PUNCT|_ALPHA|_DIGIT)
: __chvalidchk(_C , (_BLANK|_PUNCT|_ALPHA|_DIGIT))); }
inline int isgraph(int _C)
{return (MB_CUR_MAX > 1 ? _isctype(_C,_PUNCT|_ALPHA|_DIGIT)
: __chvalidchk(_C , (_PUNCT|_ALPHA|_DIGIT))); }
inline int iscntrl(int _C)
{return (MB_CUR_MAX > 1 ? _isctype(_C,_CONTROL)
: __chvalidchk(_C , _CONTROL)); }
#endif /* __cplusplus */
#endif /* _MT */
#define _tolower(_c) ( (_c)-'A'+'a' )
#define _toupper(_c) ( (_c)-'a'+'A' )
#define __isascii(_c) ( (unsigned)(_c) < 0x80 )
#define __toascii(_c) ( (_c) & 0x7f )
#ifndef _WCTYPE_INLINE_DEFINED
#ifndef __cplusplus
#define iswalpha(_c) ( iswctype(_c,_ALPHA) )
#define iswupper(_c) ( iswctype(_c,_UPPER) )
#define iswlower(_c) ( iswctype(_c,_LOWER) )
#define iswdigit(_c) ( iswctype(_c,_DIGIT) )
#define iswxdigit(_c) ( iswctype(_c,_HEX) )
#define iswspace(_c) ( iswctype(_c,_SPACE) )
#define iswpunct(_c) ( iswctype(_c,_PUNCT) )
#define iswalnum(_c) ( iswctype(_c,_ALPHA|_DIGIT) )
#define iswprint(_c) ( iswctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT) )
#define iswgraph(_c) ( iswctype(_c,_PUNCT|_ALPHA|_DIGIT) )
#define iswcntrl(_c) ( iswctype(_c,_CONTROL) )
#define iswascii(_c) ( (unsigned)(_c) < 0x80 )
#define isleadbyte(_c) ( _pctype[(unsigned char)(_c)] & _LEADBYTE)
#elif 0 /* __cplusplus */
inline int iswalpha(wint_t _C) {return (iswctype(_C,_ALPHA)); }
inline int iswupper(wint_t _C) {return (iswctype(_C,_UPPER)); }
inline int iswlower(wint_t _C) {return (iswctype(_C,_LOWER)); }
inline int iswdigit(wint_t _C) {return (iswctype(_C,_DIGIT)); }
inline int iswxdigit(wint_t _C) {return (iswctype(_C,_HEX)); }
inline int iswspace(wint_t _C) {return (iswctype(_C,_SPACE)); }
inline int iswpunct(wint_t _C) {return (iswctype(_C,_PUNCT)); }
inline int iswalnum(wint_t _C) {return (iswctype(_C,_ALPHA|_DIGIT)); }
inline int iswprint(wint_t _C)
{return (iswctype(_C,_BLANK|_PUNCT|_ALPHA|_DIGIT)); }
inline int iswgraph(wint_t _C)
{return (iswctype(_C,_PUNCT|_ALPHA|_DIGIT)); }
inline int iswcntrl(wint_t _C) {return (iswctype(_C,_CONTROL)); }
inline int iswascii(wint_t _C) {return ((unsigned)(_C) < 0x80); }
inline int isleadbyte(int _C)
{return (_pctype[(unsigned char)(_C)] & _LEADBYTE); }
#endif /* __cplusplus */
#define _WCTYPE_INLINE_DEFINED
#endif /* _WCTYPE_INLINE_DEFINED */
/* MS C version 2.0 extended ctype macros */
#define __iscsymf(_c) (isalpha(_c) || ((_c) == '_'))
#define __iscsym(_c) (isalnum(_c) || ((_c) == '_'))
#endif /* _CTYPE_DISABLE_MACROS */
#if !__STDC__
/* Non-ANSI names for compatibility */
#ifndef _CTYPE_DEFINED
_CRTIMP int __cdecl isascii(int);
_CRTIMP int __cdecl toascii(int);
_CRTIMP int __cdecl iscsymf(int);
_CRTIMP int __cdecl iscsym(int);
#else
#define isascii __isascii
#define toascii __toascii
#define iscsymf __iscsymf
#define iscsym __iscsym
#endif
#endif /* __STDC__ */
#ifdef __cplusplus
}
#endif
#endif /* _INC_CTYPE */

View File

@@ -0,0 +1,45 @@
// cwchar standard header
#pragma once
#ifndef _CWCHAR_
#define _CWCHAR_
#include <yvals.h>
#ifdef _STD_USING
#undef _STD_USING
#include <wchar.h>
#define _STD_USING
#else /* _STD_USING */
#include <wchar.h>
#if _GLOBAL_USING
_STD_BEGIN
using ::mbstate_t; using ::size_t; using ::tm; 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 ::mbsrtowcs;
using ::mbsinit; using ::putwc; using ::putwchar;
using ::swprintf; using ::swscanf; using ::ungetwc;
using ::vfwprintf; using ::vswprintf; using ::vwprintf;
using ::wcrtomb; using ::wprintf; using ::wscanf;
using ::wcsrtombs; using ::wcstol; using ::wcscat;
using ::wcschr; using ::wcscmp; using ::wcscoll;
using ::wcscpy; using ::wcscspn; using ::wcslen;
using ::wcsncat; using ::wcsncmp; using ::wcsncpy;
using ::wcspbrk; using ::wcsrchr; using ::wcsspn;
using ::wcstod; using ::wcstoul; using ::wcsstr;
using ::wcstok; using ::wcsxfrm; using ::wctob;
using ::wmemchr; using ::wmemcmp; using ::wmemcpy;
using ::wmemmove; using ::wmemset; using ::wcsftime;
_STD_END
#endif /* _GLOBAL_USING */
#endif /* _STD_USING */
#endif /* _CWCHAR_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

View File

@@ -0,0 +1,34 @@
// cwctype standard header
#pragma once
#ifndef _CWCTYPE_
#define _CWCTYPE_
#include <yvals.h>
#ifdef _STD_USING
#undef _STD_USING
#include <wctype.h>
#define _STD_USING
#else /* _STD_USING */
#include <wctype.h>
#if _GLOBAL_USING
_STD_BEGIN
using ::wint_t; using ::wctrans_t; using ::wctype_t;
using ::iswalnum; using ::iswalpha; using ::iswcntrl;
using ::iswctype; using ::iswdigit; using ::iswgraph;
using ::iswlower; using ::iswprint; using ::iswpunct;
using ::iswspace; using ::iswupper; using ::iswxdigit;
using ::towctrans; using ::towlower; using ::towupper;
using ::wctrans; using ::wctype;
_STD_END
#endif /* _GLOBAL_USING */
#endif /* _STD_USING */
#endif /* _CWCTYPE_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,139 @@
/***
*direct.h - function declarations for directory handling/creation
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* This include file contains the function declarations for the library
* functions related to directory handling and creation.
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_DIRECT
#define _INC_DIRECT
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
#ifdef _MSC_VER
/*
* Currently, all MS C compilers for Win32 platforms default to 8 byte
* alignment.
*/
#pragma pack(push,8)
#endif /* _MSC_VER */
#ifdef __cplusplus
extern "C" {
#endif
#if !defined(_W64)
#if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
#define _W64 __w64
#else
#define _W64
#endif
#endif
/* Define _CRTIMP */
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* ndef _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* _CRTIMP */
/* Define __cdecl for non-Microsoft compilers */
#if ( !defined(_MSC_VER) && !defined(__cdecl) )
#define __cdecl
#endif
#ifndef _WCHAR_T_DEFINED
typedef unsigned short wchar_t;
#define _WCHAR_T_DEFINED
#endif
#ifndef _SIZE_T_DEFINED
#ifdef _WIN64
typedef unsigned __int64 size_t;
#else
typedef _W64 unsigned int size_t;
#endif
#define _SIZE_T_DEFINED
#endif
/* _getdiskfree structure for _getdiskfree() */
#ifndef _DISKFREE_T_DEFINED
struct _diskfree_t {
unsigned total_clusters;
unsigned avail_clusters;
unsigned sectors_per_cluster;
unsigned bytes_per_sector;
};
#define _DISKFREE_T_DEFINED
#endif
/* function prototypes */
_CRTIMP int __cdecl _chdir(const char *);
_CRTIMP char * __cdecl _getcwd(char *, int);
_CRTIMP int __cdecl _mkdir(const char *);
_CRTIMP int __cdecl _rmdir(const char *);
_CRTIMP int __cdecl _chdrive(int);
_CRTIMP char * __cdecl _getdcwd(int, char *, int);
_CRTIMP int __cdecl _getdrive(void);
_CRTIMP unsigned long __cdecl _getdrives(void);
_CRTIMP unsigned __cdecl _getdiskfree(unsigned, struct _diskfree_t *);
#ifndef _WDIRECT_DEFINED
/* wide function prototypes, also declared in wchar.h */
_CRTIMP int __cdecl _wchdir(const wchar_t *);
_CRTIMP wchar_t * __cdecl _wgetcwd(wchar_t *, int);
_CRTIMP wchar_t * __cdecl _wgetdcwd(int, wchar_t *, int);
_CRTIMP int __cdecl _wmkdir(const wchar_t *);
_CRTIMP int __cdecl _wrmdir(const wchar_t *);
#define _WDIRECT_DEFINED
#endif
#if !__STDC__
/* Non-ANSI names for compatibility */
_CRTIMP int __cdecl chdir(const char *);
_CRTIMP char * __cdecl getcwd(char *, int);
_CRTIMP int __cdecl mkdir(const char *);
_CRTIMP int __cdecl rmdir(const char *);
#define diskfree_t _diskfree_t
#endif /* __STDC__ */
#ifdef __cplusplus
}
#endif
#ifdef _MSC_VER
#pragma pack(pop)
#endif /* _MSC_VER */
#endif /* _INC_DIRECT */

View File

@@ -0,0 +1,106 @@
/***
*dos.h - definitions for MS-DOS interface routines
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* Defines the structs and unions used for the direct DOS interface
* routines; includes macros to access the segment and offset
* values of far pointers, so that they may be used by the routines; and
* provides function prototypes for direct DOS interface functions.
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_DOS
#define _INC_DOS
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
#ifdef _MSC_VER
/*
* Currently, all MS C compilers for Win32 platforms default to 8 byte
* alignment.
*/
#pragma pack(push,8)
#endif /* _MSC_VER */
#ifdef __cplusplus
extern "C" {
#endif
/* Define _CRTIMP */
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* ndef _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* _CRTIMP */
/* Define __cdecl for non-Microsoft compilers */
#if ( !defined(_MSC_VER) && !defined(__cdecl) )
#define __cdecl
#endif
#ifndef _WCHAR_T_DEFINED
typedef unsigned short wchar_t;
#define _WCHAR_T_DEFINED
#endif
#ifndef _DISKFREE_T_DEFINED
/* _getdiskfree structure (duplicated in DIRECT.H) */
struct _diskfree_t {
unsigned total_clusters;
unsigned avail_clusters;
unsigned sectors_per_cluster;
unsigned bytes_per_sector;
};
#define _DISKFREE_T_DEFINED
#endif
/* File attribute constants */
#define _A_NORMAL 0x00 /* Normal file - No read/write restrictions */
#define _A_RDONLY 0x01 /* Read only file */
#define _A_HIDDEN 0x02 /* Hidden file */
#define _A_SYSTEM 0x04 /* System file */
#define _A_SUBDIR 0x10 /* Subdirectory */
#define _A_ARCH 0x20 /* Archive file */
/* Function prototypes */
_CRTIMP unsigned __cdecl _getdiskfree(unsigned, struct _diskfree_t *);
#ifdef _M_IX86
void __cdecl _disable(void);
void __cdecl _enable(void);
#endif /* _M_IX86 */
#if !__STDC__
/* Non-ANSI name for compatibility */
#define diskfree_t _diskfree_t
#endif /* __STDC__ */
#ifdef __cplusplus
}
#endif
#ifdef _MSC_VER
#pragma pack(pop)
#endif /* _MSC_VER */
#endif /* _INC_DOS */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,70 @@
/***
*eh.h - User include file for exception handling.
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* User include file for exception handling.
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_EH
#define _INC_EH
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
#ifdef _MSC_VER
// Currently, all MS C compilers for Win32 platforms default to 8 byte
// alignment.
#pragma pack(push,8)
#endif // _MSC_VER
#ifndef __cplusplus
#error "eh.h is only for C++!"
#endif
/* Define _CRTIMP */
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* ndef _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* _CRTIMP */
typedef void (__cdecl *terminate_function)();
typedef void (__cdecl *unexpected_function)();
typedef void (__cdecl *terminate_handler)();
typedef void (__cdecl *unexpected_handler)();
struct _EXCEPTION_POINTERS;
typedef void (__cdecl *_se_translator_function)(unsigned int, struct _EXCEPTION_POINTERS*);
#if _MSC_VER >= 1200
_CRTIMP __declspec(noreturn) void __cdecl terminate(void);
_CRTIMP __declspec(noreturn) void __cdecl unexpected(void);
#else
_CRTIMP void __cdecl terminate(void);
_CRTIMP void __cdecl unexpected(void);
#endif
_CRTIMP terminate_function __cdecl set_terminate(terminate_function);
_CRTIMP unexpected_function __cdecl set_unexpected(unexpected_function);
_CRTIMP _se_translator_function __cdecl _set_se_translator(_se_translator_function);
_CRTIMP bool __cdecl __uncaught_exception();
#ifdef _MSC_VER
#pragma pack(pop)
#endif // _MSC_VER
#endif // _INC_EH

View File

@@ -0,0 +1,382 @@
/**
*** Copyright (C) 1985-1999 Intel Corporation. All rights reserved.
***
*** The information and source code contained herein is the exclusive
*** property of Intel Corporation and may not be disclosed, examined
*** or reproduced in whole or in part without explicit written authorization
*** from the company.
***
**/
/*
* emmintrin.h
*
* Principal header file for Willamette New Instruction intrinsics
*
* The intrinsics package can be used in 2 ways, based whether or not
* _EMM_FUNCTIONALITY is defined; if it is, the C implementation
* will be used (the "functional intrinsics").
*/
#ifndef _INCLUDED_EMM
#define _INCLUDED_EMM
/*
* the __m128 & __m64 types are required for the intrinsics
*/
#include <xmmintrin.h>
#ifdef __ICL
#ifdef _EMM_FUNCTIONALITY
#include "emm_func.h"
#else
typedef long long __m128d;
typedef long long __m128i;
#endif
#elif _MSC_VER >= 1300
typedef union __declspec(intrin_type) __declspec(align(16)) __m128i {
__int8 m128i_i8[16];
__int16 m128i_i16[8];
__int32 m128i_i32[4];
__int64 m128i_i64[2];
unsigned __int8 m128i_u8[16];
unsigned __int16 m128i_u16[8];
unsigned __int32 m128i_u32[4];
unsigned __int64 m128i_u64[2];
} __m128i;
typedef struct __declspec(intrin_type) __declspec(align(16)) __m128d {
double m128d_f64[2];
} __m128d;
#endif
/*
* Macro function for shuffle
*/
#define _MM_SHUFFLE2(x,y) (((x)<<1) | (y))
/*****************************************************/
/* INTRINSICS FUNCTION PROTOTYPES START HERE */
/*****************************************************/
#if defined __cplusplus
extern "C" { /* Begin "C" */
/* Intrinsics use C name-mangling. */
#endif /* __cplusplus */
/*
* DP, arithmetic
*/
extern __m128d _mm_add_sd(__m128d a, __m128d b);
extern __m128d _mm_add_pd(__m128d a, __m128d b);
extern __m128d _mm_sub_sd(__m128d a, __m128d b);
extern __m128d _mm_sub_pd(__m128d a, __m128d b);
extern __m128d _mm_mul_sd(__m128d a, __m128d b);
extern __m128d _mm_mul_pd(__m128d a, __m128d b);
extern __m128d _mm_sqrt_sd(__m128d a, __m128d b);
extern __m128d _mm_sqrt_pd(__m128d a);
extern __m128d _mm_div_sd(__m128d a, __m128d b);
extern __m128d _mm_div_pd(__m128d a, __m128d b);
extern __m128d _mm_min_sd(__m128d a, __m128d b);
extern __m128d _mm_min_pd(__m128d a, __m128d b);
extern __m128d _mm_max_sd(__m128d a, __m128d b);
extern __m128d _mm_max_pd(__m128d a, __m128d b);
/*
* DP, logicals
*/
extern __m128d _mm_and_pd(__m128d a, __m128d b);
extern __m128d _mm_andnot_pd(__m128d a, __m128d b);
extern __m128d _mm_or_pd(__m128d a, __m128d b);
extern __m128d _mm_xor_pd(__m128d a, __m128d b);
/*
* DP, comparisons
*/
extern __m128d _mm_cmpeq_sd(__m128d a, __m128d b);
extern __m128d _mm_cmpeq_pd(__m128d a, __m128d b);
extern __m128d _mm_cmplt_sd(__m128d a, __m128d b);
extern __m128d _mm_cmplt_pd(__m128d a, __m128d b);
extern __m128d _mm_cmple_sd(__m128d a, __m128d b);
extern __m128d _mm_cmple_pd(__m128d a, __m128d b);
extern __m128d _mm_cmpgt_sd(__m128d a, __m128d b);
extern __m128d _mm_cmpgt_pd(__m128d a, __m128d b);
extern __m128d _mm_cmpge_sd(__m128d a, __m128d b);
extern __m128d _mm_cmpge_pd(__m128d a, __m128d b);
extern __m128d _mm_cmpneq_sd(__m128d a, __m128d b);
extern __m128d _mm_cmpneq_pd(__m128d a, __m128d b);
extern __m128d _mm_cmpnlt_sd(__m128d a, __m128d b);
extern __m128d _mm_cmpnlt_pd(__m128d a, __m128d b);
extern __m128d _mm_cmpnle_sd(__m128d a, __m128d b);
extern __m128d _mm_cmpnle_pd(__m128d a, __m128d b);
extern __m128d _mm_cmpngt_sd(__m128d a, __m128d b);
extern __m128d _mm_cmpngt_pd(__m128d a, __m128d b);
extern __m128d _mm_cmpnge_sd(__m128d a, __m128d b);
extern __m128d _mm_cmpnge_pd(__m128d a, __m128d b);
extern __m128d _mm_cmpord_pd(__m128d a, __m128d b);
extern __m128d _mm_cmpord_sd(__m128d a, __m128d b);
extern __m128d _mm_cmpunord_pd(__m128d a, __m128d b);
extern __m128d _mm_cmpunord_sd(__m128d a, __m128d b);
extern int _mm_comieq_sd(__m128d a, __m128d b);
extern int _mm_comilt_sd(__m128d a, __m128d b);
extern int _mm_comile_sd(__m128d a, __m128d b);
extern int _mm_comigt_sd(__m128d a, __m128d b);
extern int _mm_comige_sd(__m128d a, __m128d b);
extern int _mm_comineq_sd(__m128d a, __m128d b);
extern int _mm_ucomieq_sd(__m128d a, __m128d b);
extern int _mm_ucomilt_sd(__m128d a, __m128d b);
extern int _mm_ucomile_sd(__m128d a, __m128d b);
extern int _mm_ucomigt_sd(__m128d a, __m128d b);
extern int _mm_ucomige_sd(__m128d a, __m128d b);
extern int _mm_ucomineq_sd(__m128d a, __m128d b);
/*
* DP, converts
*/
extern __m128d _mm_cvtepi32_pd(__m128i a);
extern __m128i _mm_cvtpd_epi32(__m128d a);
extern __m128i _mm_cvttpd_epi32(__m128d a);
extern __m128 _mm_cvtepi32_ps(__m128i a);
extern __m128i _mm_cvtps_epi32(__m128 a);
extern __m128i _mm_cvttps_epi32(__m128 a);
extern __m128 _mm_cvtpd_ps(__m128d a);
extern __m128d _mm_cvtps_pd(__m128 a);
extern __m128 _mm_cvtsd_ss(__m128 a, __m128d b);
extern __m128d _mm_cvtss_sd(__m128d a, __m128 b);
extern int _mm_cvtsd_si32(__m128d a);
extern int _mm_cvttsd_si32(__m128d a);
extern __m128d _mm_cvtsi32_sd(__m128d a, int b);
extern __m64 _mm_cvtpd_pi32(__m128d a);
extern __m64 _mm_cvttpd_pi32(__m128d a);
extern __m128d _mm_cvtpi32_pd(__m64 a);
/*
* DP, misc
*/
extern __m128d _mm_unpackhi_pd(__m128d a, __m128d b);
extern __m128d _mm_unpacklo_pd(__m128d a, __m128d b);
extern int _mm_movemask_pd(__m128d a);
extern __m128d _mm_shuffle_pd(__m128d a, __m128d b, int i);
/*
* DP, loads
*/
extern __m128d _mm_load_pd(double const*dp);
extern __m128d _mm_load1_pd(double const*dp);
extern __m128d _mm_loadr_pd(double const*dp);
extern __m128d _mm_loadu_pd(double const*dp);
extern __m128d _mm_load_sd(double const*dp);
extern __m128d _mm_loadh_pd(__m128d a, double const*dp);
extern __m128d _mm_loadl_pd(__m128d a, double const*dp);
/*
* DP, sets
*/
extern __m128d _mm_set_sd(double w);
extern __m128d _mm_set1_pd(double a);
extern __m128d _mm_set_pd(double z, double y);
extern __m128d _mm_setr_pd(double y, double z);
extern __m128d _mm_setzero_pd(void);
extern __m128d _mm_move_sd(__m128d a, __m128d b);
/*
* DP, stores
*/
extern void _mm_store_sd(double *dp, __m128d a);
extern void _mm_store1_pd(double *dp, __m128d a);
extern void _mm_store_pd(double *dp, __m128d a);
extern void _mm_storeu_pd(double *dp, __m128d a);
extern void _mm_storer_pd(double *dp, __m128d a);
extern void _mm_storeh_pd(double *dp, __m128d a);
extern void _mm_storel_pd(double *dp, __m128d a);
/*
* Integer, arithmetic
*/
extern __m128i _mm_add_epi8(__m128i a, __m128i b);
extern __m128i _mm_add_epi16(__m128i a, __m128i b);
extern __m128i _mm_add_epi32(__m128i a, __m128i b);
extern __m64 _mm_add_si64(__m64 a, __m64 b);
extern __m128i _mm_add_epi64(__m128i a, __m128i b);
extern __m128i _mm_adds_epi8(__m128i a, __m128i b);
extern __m128i _mm_adds_epi16(__m128i a, __m128i b);
extern __m128i _mm_adds_epu8(__m128i a, __m128i b);
extern __m128i _mm_adds_epu16(__m128i a, __m128i b);
extern __m128i _mm_avg_epu8(__m128i a, __m128i b);
extern __m128i _mm_avg_epu16(__m128i a, __m128i b);
extern __m128i _mm_madd_epi16(__m128i a, __m128i b);
extern __m128i _mm_max_epi16(__m128i a, __m128i b);
extern __m128i _mm_max_epu8(__m128i a, __m128i b);
extern __m128i _mm_min_epi16(__m128i a, __m128i b);
extern __m128i _mm_min_epu8(__m128i a, __m128i b);
extern __m128i _mm_mulhi_epi16(__m128i a, __m128i b);
extern __m128i _mm_mulhi_epu16(__m128i a, __m128i b);
extern __m128i _mm_mullo_epi16(__m128i a, __m128i b);
extern __m64 _mm_mul_su32(__m64 a, __m64 b);
extern __m128i _mm_mul_epu32(__m128i a, __m128i b);
extern __m128i _mm_sad_epu8(__m128i a, __m128i b);
extern __m128i _mm_sub_epi8(__m128i a, __m128i b);
extern __m128i _mm_sub_epi16(__m128i a, __m128i b);
extern __m128i _mm_sub_epi32(__m128i a, __m128i b);
extern __m64 _mm_sub_si64(__m64 a, __m64 b);
extern __m128i _mm_sub_epi64(__m128i a, __m128i b);
extern __m128i _mm_subs_epi8(__m128i a, __m128i b);
extern __m128i _mm_subs_epi16(__m128i a, __m128i b);
extern __m128i _mm_subs_epu8(__m128i a, __m128i b);
extern __m128i _mm_subs_epu16(__m128i a, __m128i b);
/*
* Integer, logicals
*/
extern __m128i _mm_and_si128(__m128i a, __m128i b);
extern __m128i _mm_andnot_si128(__m128i a, __m128i b);
extern __m128i _mm_or_si128(__m128i a, __m128i b);
extern __m128i _mm_xor_si128(__m128i a, __m128i b);
/*
* Integer, shifts
*/
extern __m128i _mm_slli_si128(__m128i a, int imm);
extern __m128i _mm_slli_epi16(__m128i a, int count);
extern __m128i _mm_sll_epi16(__m128i a, __m128i count);
extern __m128i _mm_slli_epi32(__m128i a, int count);
extern __m128i _mm_sll_epi32(__m128i a, __m128i count);
extern __m128i _mm_slli_epi64(__m128i a, int count);
extern __m128i _mm_sll_epi64(__m128i a, __m128i count);
extern __m128i _mm_srai_epi16(__m128i a, int count);
extern __m128i _mm_sra_epi16(__m128i a, __m128i count);
extern __m128i _mm_srai_epi32(__m128i a, int count);
extern __m128i _mm_sra_epi32(__m128i a, __m128i count);
extern __m128i _mm_srli_si128(__m128i a, int imm);
extern __m128i _mm_srli_epi16(__m128i a, int count);
extern __m128i _mm_srl_epi16(__m128i a, __m128i count);
extern __m128i _mm_srli_epi32(__m128i a, int count);
extern __m128i _mm_srl_epi32(__m128i a, __m128i count);
extern __m128i _mm_srli_epi64(__m128i a, int count);
extern __m128i _mm_srl_epi64(__m128i a, __m128i count);
/*
* Integer, comparisons
*/
extern __m128i _mm_cmpeq_epi8(__m128i a, __m128i b);
extern __m128i _mm_cmpeq_epi16(__m128i a, __m128i b);
extern __m128i _mm_cmpeq_epi32(__m128i a, __m128i b);
extern __m128i _mm_cmpgt_epi8(__m128i a, __m128i b);
extern __m128i _mm_cmpgt_epi16(__m128i a, __m128i b);
extern __m128i _mm_cmpgt_epi32(__m128i a, __m128i b);
extern __m128i _mm_cmplt_epi8(__m128i a, __m128i b);
extern __m128i _mm_cmplt_epi16(__m128i a, __m128i b);
extern __m128i _mm_cmplt_epi32(__m128i a, __m128i b);
/*
* Integer, converts
*/
extern __m128i _mm_cvtsi32_si128(int a);
extern int _mm_cvtsi128_si32(__m128i a);
/*
* Integer, misc
*/
extern __m128i _mm_packs_epi16(__m128i a, __m128i b);
extern __m128i _mm_packs_epi32(__m128i a, __m128i b);
extern __m128i _mm_packus_epi16(__m128i a, __m128i b);
extern int _mm_extract_epi16(__m128i a, int imm);
extern __m128i _mm_insert_epi16(__m128i a, int b, int imm);
extern int _mm_movemask_epi8(__m128i a);
extern __m128i _mm_shuffle_epi32(__m128i a, int imm);
extern __m128i _mm_shufflehi_epi16(__m128i a, int imm);
extern __m128i _mm_shufflelo_epi16(__m128i a, int imm);
extern __m128i _mm_unpackhi_epi8(__m128i a, __m128i b);
extern __m128i _mm_unpackhi_epi16(__m128i a, __m128i b);
extern __m128i _mm_unpackhi_epi32(__m128i a, __m128i b);
extern __m128i _mm_unpackhi_epi64(__m128i a, __m128i b);
extern __m128i _mm_unpacklo_epi8(__m128i a, __m128i b);
extern __m128i _mm_unpacklo_epi16(__m128i a, __m128i b);
extern __m128i _mm_unpacklo_epi32(__m128i a, __m128i b);
extern __m128i _mm_unpacklo_epi64(__m128i a, __m128i b);
/*
* Integer, loads
*/
extern __m128i _mm_load_si128(__m128i const*p);
extern __m128i _mm_loadu_si128(__m128i const*p);
extern __m128i _mm_loadl_epi64(__m128i const*p);
/*
* Integer, sets
*/
extern __m128i _mm_set_epi64(__m64 q1, __m64 q0);
extern __m128i _mm_set_epi32(int i3, int i2, int i1, int i0);
extern __m128i _mm_set_epi16(short w7, short w6, short w5, short w4,
short w3, short w2, short w1, short w0);
extern __m128i _mm_set_epi8(char b15, char b14, char b13, char b12,
char b11, char b10, char b9, char b8,
char b7, char b6, char b5, char b4,
char b3, char b2, char b1, char b0);
extern __m128i _mm_set1_epi64(__m64 q);
extern __m128i _mm_set1_epi32(int i);
extern __m128i _mm_set1_epi16(short w);
extern __m128i _mm_set1_epi8(char b);
extern __m128i _mm_setl_epi64(__m128i q);
extern __m128i _mm_setr_epi64(__m64 q0, __m64 q1);
extern __m128i _mm_setr_epi32(int i0, int i1, int i2, int i3);
extern __m128i _mm_setr_epi16(short w0, short w1, short w2, short w3,
short w4, short w5, short w6, short w7);
extern __m128i _mm_setr_epi8(char b15, char b14, char b13, char b12,
char b11, char b10, char b9, char b8,
char b7, char b6, char b5, char b4,
char b3, char b2, char b1, char b0);
extern __m128i _mm_setzero_si128();
/*
* Integer, stores
*/
extern void _mm_store_si128(__m128i *p, __m128i b);
extern void _mm_storeu_si128(__m128i *p, __m128i b);
extern void _mm_storel_epi64(__m128i *p, __m128i q);
extern void _mm_maskmoveu_si128(__m128i d, __m128i n, char *p);
/*
* Integer, moves
*/
extern __m128i _mm_move_epi64(__m128i q);
extern __m128i _mm_movpi64_epi64(__m64 q);
extern __m64 _mm_movepi64_pi64(__m128i q);
/*
* Cacheability support
*/
extern void _mm_stream_pd(double *dp, __m128d a);
extern void _mm_stream_si128(__m128i *p, __m128i a);
extern void _mm_clflush(void const*p);
extern void _mm_lfence(void);
extern void _mm_mfence(void);
extern void _mm_stream_si32(int *p, int i);
extern void _mm_pause(void);
#if defined __cplusplus
}; /* End "C" */
#endif /* __cplusplus */
#endif /* _INCLUDED_EMM */

View File

@@ -0,0 +1,110 @@
/***
*errno.h - system wide error numbers (set by system calls)
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file defines the system-wide error numbers (set by
* system calls). Conforms to the XENIX standard. Extended
* for compatibility with Uniforum standard.
* [System V]
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_ERRNO
#define _INC_ERRNO
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* Define _CRTIMP */
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* ndef _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* _CRTIMP */
/* Define __cdecl for non-Microsoft compilers */
#if ( !defined(_MSC_VER) && !defined(__cdecl) )
#define __cdecl
#endif
/* declare reference to errno */
#if defined(_MT) || defined(_DLL)
_CRTIMP extern int * __cdecl _errno(void);
#define errno (*_errno())
#else /* ndef _MT && ndef _DLL */
_CRTIMP extern int errno;
#endif /* _MT || _DLL */
/* Error Codes */
#define EPERM 1
#define ENOENT 2
#define ESRCH 3
#define EINTR 4
#define EIO 5
#define ENXIO 6
#define E2BIG 7
#define ENOEXEC 8
#define EBADF 9
#define ECHILD 10
#define EAGAIN 11
#define ENOMEM 12
#define EACCES 13
#define EFAULT 14
#define EBUSY 16
#define EEXIST 17
#define EXDEV 18
#define ENODEV 19
#define ENOTDIR 20
#define EISDIR 21
#define EINVAL 22
#define ENFILE 23
#define EMFILE 24
#define ENOTTY 25
#define EFBIG 27
#define ENOSPC 28
#define ESPIPE 29
#define EROFS 30
#define EMLINK 31
#define EPIPE 32
#define EDOM 33
#define ERANGE 34
#define EDEADLK 36
#define ENAMETOOLONG 38
#define ENOLCK 39
#define ENOSYS 40
#define ENOTEMPTY 41
#define EILSEQ 42
/*
* Support EDEADLOCK for compatibiity with older MS-C versions.
*/
#define EDEADLOCK EDEADLK
#ifdef __cplusplus
}
#endif
#endif /* _INC_ERRNO */

View File

@@ -0,0 +1,183 @@
// exception standard header for Microsoft
#pragma once
#ifndef _EXCEPTION_
#define _EXCEPTION_
#include <xstddef>
#pragma pack(push,8)
#pragma warning(push,3)
_STD_BEGIN
#define _USE_EX using ::exception; \
using ::set_terminate; using ::terminate_handler; using ::terminate; \
using ::set_unexpected; using ::unexpected_handler; using ::unexpected;
#if _HAS_EXCEPTIONS
_STD_END
#include <eh.h>
#if !defined(_WIN32)
#error ERROR: Only Win32 targets supported!
#endif /* !defined(_WIN32) */
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* ndef _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* _CRTIMP */
typedef const char *__exString;
class _CRTIMP exception
{ // base of all library exceptions
public:
exception();
exception(const char *const&);
exception(const exception&);
exception& operator=(const exception&);
virtual ~exception();
virtual const char *what() const;
private:
const char *_m_what;
int _m_doFree;
};
_STD_BEGIN
_USE_EX
typedef void (*_Prhand)(const exception&);
extern _CRTIMP2 _Prhand _Raise_handler;
_CRTIMP2 bool __cdecl uncaught_exception();
#else /* _HAS_EXCEPTIONS */
// CLASS exception
class exception;
typedef void (*_Prhand)(const exception&);
extern _CRTIMP2 _Prhand _Raise_handler; // pointer to raise handler
_CRTIMP2 void __cdecl _Throw(const exception&); // throw the exception
class _CRTIMP2 exception
{ // base of all library exceptions
public:
static _Prhand _Set_raise_handler(_Prhand _Pnew)
{ // register a handler for _Raise calls
const _Prhand _Pold = _Raise_handler;
_Raise_handler = _Pnew;
return (_Pold);
}
explicit exception(const char *_Message = _MESG("unknown"))
_THROW0()
: _Ptr(_Message)
{ // construct from message string
}
exception(const exception& _Right) _THROW0()
: _Ptr(_Right._Ptr)
{ // construct by copying _Right
}
exception& operator=(const exception& _Right) _THROW0()
{ // assign _Right
_Ptr = _Right._Ptr;
return (*this);
}
virtual ~exception()
{ // destroy the object
}
virtual const char *what() const _THROW0()
{ // return pointer to message string
return (_Ptr);
}
void _Raise() const
{ // raise the exception
if (_Raise_handler != 0)
(*_Raise_handler)(*this); // call raise handler if present
_Doraise(); // call the protected virtual
_RAISE(*this); // raise this exception
}
protected:
virtual void _Doraise() const
{ // perform class-specific exception handling
}
protected:
const char *_Ptr; // the message pointer
};
// TYPES
typedef void (__cdecl *terminate_handler)();
typedef void (__cdecl *unexpected_handler)();
// DUMMY FUNCTION DECLARATIONS
inline terminate_handler __cdecl set_terminate(terminate_handler)
_THROW0()
{ // register a terminate handler
return 0;
}
inline unexpected_handler __cdecl set_unexpected(unexpected_handler)
_THROW0()
{ // register an unexpected handler
return 0;
}
inline void __cdecl terminate()
{ // handle exception termination
}
inline void __cdecl unexpected()
{ // handle unexpected exception
}
_CRTIMP2 bool __cdecl uncaught_exception(); // handle uncaught exception
#endif /* _HAS_EXCEPTIONS */
// CLASS bad_exception
class bad_exception : public exception
{ // base of all bad exceptions
public:
bad_exception(const char *_Message = _MESG("bad exception"))
_THROW0()
: exception(_Message)
{ // construct from message string
}
virtual ~bad_exception() _THROW0()
{ // destroy the object
}
#if !_HAS_EXCEPTIONS
protected:
virtual void _Doraise() const
{ // raise this exception
_RAISE(*this);
}
#endif /* _HAS_EXCEPTIONS */
};
_STD_END
#pragma warning(pop)
#pragma pack(pop)
#endif /* _EXCEPTION_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

View File

@@ -0,0 +1,159 @@
/***
*excpt.h - defines exception values, types and routines
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file contains the definitions and prototypes for the compiler-
* dependent intrinsics, support functions and keywords which implement
* the structured exception handling extensions.
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_EXCPT
#define _INC_EXCPT
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
#ifdef _MSC_VER
/*
* Currently, all MS C compilers for Win32 platforms default to 8 byte
* alignment.
*/
#pragma pack(push,8)
#endif /* _MSC_VER */
#ifdef __cplusplus
extern "C" {
#endif
/* Define _CRTIMP */
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* ndef _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* _CRTIMP */
/* Define __cdecl for non-Microsoft compilers */
#if ( !defined(_MSC_VER) && !defined(__cdecl) )
#define __cdecl
#endif
/*
* Exception disposition return values.
*/
typedef enum _EXCEPTION_DISPOSITION {
ExceptionContinueExecution,
ExceptionContinueSearch,
ExceptionNestedException,
ExceptionCollidedUnwind
} EXCEPTION_DISPOSITION;
/*
* Prototype for SEH support function.
*/
#ifdef _M_IX86
/*
* Declarations to keep MS C 8 (386/486) compiler happy
*/
struct _EXCEPTION_RECORD;
struct _CONTEXT;
EXCEPTION_DISPOSITION __cdecl _except_handler (
struct _EXCEPTION_RECORD *ExceptionRecord,
void * EstablisherFrame,
struct _CONTEXT *ContextRecord,
void * DispatcherContext
);
#elif defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) || defined(_M_IA64)
/*
* Declarations to keep MIPS, ALPHA, and PPC compiler happy
*/
typedef struct _EXCEPTION_POINTERS *Exception_info_ptr;
struct _EXCEPTION_RECORD;
struct _CONTEXT;
struct _DISPATCHER_CONTEXT;
#if defined(_M_IA64)
_CRTIMP EXCEPTION_DISPOSITION __C_specific_handler (
struct _EXCEPTION_RECORD *ExceptionRecord,
unsigned __int64 MemoryStackFp,
unsigned __int64 BackingStoreFp,
struct _CONTEXT *ContextRecord,
struct _DISPATCHER_CONTEXT *DispatcherContext,
unsigned __int64 GlobalPointer
);
#else
_CRTIMP EXCEPTION_DISPOSITION __C_specific_handler (
struct _EXCEPTION_RECORD *ExceptionRecord,
void *EstablisherFrame,
struct _CONTEXT *ContextRecord,
struct _DISPATCHER_CONTEXT *DispatcherContext
);
#endif /* defined(_M_IA64) */
#endif
/*
* Keywords and intrinsics for SEH
*/
#ifdef _MSC_VER
#define GetExceptionCode _exception_code
#define exception_code _exception_code
#define GetExceptionInformation (struct _EXCEPTION_POINTERS *)_exception_info
#define exception_info (struct _EXCEPTION_POINTERS *)_exception_info
#define AbnormalTermination _abnormal_termination
#define abnormal_termination _abnormal_termination
unsigned long __cdecl _exception_code(void);
void * __cdecl _exception_info(void);
int __cdecl _abnormal_termination(void);
#endif
/*
* Legal values for expression in except().
*/
#define EXCEPTION_EXECUTE_HANDLER 1
#define EXCEPTION_CONTINUE_SEARCH 0
#define EXCEPTION_CONTINUE_EXECUTION -1
#ifdef __cplusplus
}
#endif
#ifdef _MSC_VER
#pragma pack(pop)
#endif /* _MSC_VER */
#endif /* _INC_EXCPT */

View File

@@ -0,0 +1,82 @@
/***
*fcntl.h - file control options used by open()
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file defines constants for the file control options used
* by the _open() function.
* [System V]
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_FCNTL
#define _INC_FCNTL
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
#define _O_RDONLY 0x0000 /* open for reading only */
#define _O_WRONLY 0x0001 /* open for writing only */
#define _O_RDWR 0x0002 /* open for reading and writing */
#define _O_APPEND 0x0008 /* writes done at eof */
#define _O_CREAT 0x0100 /* create and open file */
#define _O_TRUNC 0x0200 /* open and truncate */
#define _O_EXCL 0x0400 /* open only if file doesn't already exist */
/* O_TEXT files have <cr><lf> sequences translated to <lf> on read()'s,
** and <lf> sequences translated to <cr><lf> on write()'s
*/
#define _O_TEXT 0x4000 /* file mode is text (translated) */
#define _O_BINARY 0x8000 /* file mode is binary (untranslated) */
/* macro to translate the C 2.0 name used to force binary mode for files */
#define _O_RAW _O_BINARY
/* Open handle inherit bit */
#define _O_NOINHERIT 0x0080 /* child process doesn't inherit file */
/* Temporary file bit - file is deleted when last handle is closed */
#define _O_TEMPORARY 0x0040 /* temporary file bit */
/* temporary access hint */
#define _O_SHORT_LIVED 0x1000 /* temporary storage file, try not to flush */
/* sequential/random access hints */
#define _O_SEQUENTIAL 0x0020 /* file access is primarily sequential */
#define _O_RANDOM 0x0010 /* file access is primarily random */
#if !__STDC__ || defined(_POSIX_)
/* Non-ANSI names for compatibility */
#define O_RDONLY _O_RDONLY
#define O_WRONLY _O_WRONLY
#define O_RDWR _O_RDWR
#define O_APPEND _O_APPEND
#define O_CREAT _O_CREAT
#define O_TRUNC _O_TRUNC
#define O_EXCL _O_EXCL
#define O_TEXT _O_TEXT
#define O_BINARY _O_BINARY
#define O_RAW _O_BINARY
#define O_TEMPORARY _O_TEMPORARY
#define O_NOINHERIT _O_NOINHERIT
#define O_SEQUENTIAL _O_SEQUENTIAL
#define O_RANDOM _O_RANDOM
#endif /* __STDC__ */
#endif /* _INC_FCNTL */

View File

@@ -0,0 +1,302 @@
/***
*float.h - constants for floating point values
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file contains defines for a number of implementation dependent
* values which are commonly used by sophisticated numerical (floating
* point) programs.
* [ANSI]
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_FLOAT
#define _INC_FLOAT
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* Define _CRTIMP */
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* ndef _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* _CRTIMP */
/* Define __cdecl for non-Microsoft compilers */
#if ( !defined(_MSC_VER) && !defined(__cdecl) )
#define __cdecl
#endif
#define DBL_DIG 15 /* # of decimal digits of precision */
#define DBL_EPSILON 2.2204460492503131e-016 /* smallest such that 1.0+DBL_EPSILON != 1.0 */
#define DBL_MANT_DIG 53 /* # of bits in mantissa */
#define DBL_MAX 1.7976931348623158e+308 /* max value */
#define DBL_MAX_10_EXP 308 /* max decimal exponent */
#define DBL_MAX_EXP 1024 /* max binary exponent */
#define DBL_MIN 2.2250738585072014e-308 /* min positive value */
#define DBL_MIN_10_EXP (-307) /* min decimal exponent */
#define DBL_MIN_EXP (-1021) /* min binary exponent */
#define _DBL_RADIX 2 /* exponent radix */
#define _DBL_ROUNDS 1 /* addition rounding: near */
#define FLT_DIG 6 /* # of decimal digits of precision */
#define FLT_EPSILON 1.192092896e-07F /* smallest such that 1.0+FLT_EPSILON != 1.0 */
#define FLT_GUARD 0
#define FLT_MANT_DIG 24 /* # of bits in mantissa */
#define FLT_MAX 3.402823466e+38F /* max value */
#define FLT_MAX_10_EXP 38 /* max decimal exponent */
#define FLT_MAX_EXP 128 /* max binary exponent */
#define FLT_MIN 1.175494351e-38F /* min positive value */
#define FLT_MIN_10_EXP (-37) /* min decimal exponent */
#define FLT_MIN_EXP (-125) /* min binary exponent */
#define FLT_NORMALIZE 0
#define FLT_RADIX 2 /* exponent radix */
#define FLT_ROUNDS 1 /* addition rounding: near */
#define LDBL_DIG DBL_DIG /* # of decimal digits of precision */
#define LDBL_EPSILON DBL_EPSILON /* smallest such that 1.0+LDBL_EPSILON != 1.0 */
#define LDBL_MANT_DIG DBL_MANT_DIG /* # of bits in mantissa */
#define LDBL_MAX DBL_MAX /* max value */
#define LDBL_MAX_10_EXP DBL_MAX_10_EXP /* max decimal exponent */
#define LDBL_MAX_EXP DBL_MAX_EXP /* max binary exponent */
#define LDBL_MIN DBL_MIN /* min positive value */
#define LDBL_MIN_10_EXP DBL_MIN_10_EXP /* min decimal exponent */
#define LDBL_MIN_EXP DBL_MIN_EXP /* min binary exponent */
#define _LDBL_RADIX DBL_RADIX /* exponent radix */
#define _LDBL_ROUNDS DBL_ROUNDS /* addition rounding: near */
/* Function prototypes */
_CRTIMP unsigned int __cdecl _clearfp(void);
_CRTIMP unsigned int __cdecl _controlfp(unsigned int,unsigned int);
_CRTIMP unsigned int __cdecl _statusfp(void);
_CRTIMP void __cdecl _fpreset(void);
#define _clear87 _clearfp
#define _status87 _statusfp
/*
* Abstract User Control Word Mask and bit definitions
*/
#define _MCW_EM 0x0008001f /* interrupt Exception Masks */
#define _EM_INEXACT 0x00000001 /* inexact (precision) */
#define _EM_UNDERFLOW 0x00000002 /* underflow */
#define _EM_OVERFLOW 0x00000004 /* overflow */
#define _EM_ZERODIVIDE 0x00000008 /* zero divide */
#define _EM_INVALID 0x00000010 /* invalid */
#define _MCW_RC 0x00000300 /* Rounding Control */
#define _RC_NEAR 0x00000000 /* near */
#define _RC_DOWN 0x00000100 /* down */
#define _RC_UP 0x00000200 /* up */
#define _RC_CHOP 0x00000300 /* chop */
/*
* Abstract User Status Word bit definitions
*/
#define _SW_INEXACT 0x00000001 /* inexact (precision) */
#define _SW_UNDERFLOW 0x00000002 /* underflow */
#define _SW_OVERFLOW 0x00000004 /* overflow */
#define _SW_ZERODIVIDE 0x00000008 /* zero divide */
#define _SW_INVALID 0x00000010 /* invalid */
/*
* i386 specific definitions
*/
#define _MCW_PC 0x00030000 /* Precision Control */
#define _PC_64 0x00000000 /* 64 bits */
#define _PC_53 0x00010000 /* 53 bits */
#define _PC_24 0x00020000 /* 24 bits */
#define _MCW_IC 0x00040000 /* Infinity Control */
#define _IC_AFFINE 0x00040000 /* affine */
#define _IC_PROJECTIVE 0x00000000 /* projective */
#define _EM_DENORMAL 0x00080000 /* denormal exception mask (_control87 only) */
#define _SW_DENORMAL 0x00080000 /* denormal status bit */
_CRTIMP unsigned int __cdecl _control87(unsigned int,unsigned int);
/*
* RISC specific definitions
*/
#define _MCW_DN 0x03000000 /* Denormal Control */
#define _DN_SAVE 0x00000000 /* save denormal results and operands */
#define _DN_FLUSH 0x01000000 /* flush denormal results and operands to zero */
#define _DN_FLUSH_OPERANDS_SAVE_RESULTS 0x02000000 /* flush operands to zero and save results */
#define _DN_SAVE_OPERANDS_FLUSH_RESULTS 0x03000000 /* save operands and flush results to zero */
/* initial Control Word value */
#if defined(_M_IX86)
#define _CW_DEFAULT ( _RC_NEAR + _PC_53 + _EM_INVALID + _EM_ZERODIVIDE + _EM_OVERFLOW + _EM_UNDERFLOW + _EM_INEXACT + _EM_DENORMAL)
#elif defined(_M_IA64)
#define _CW_DEFAULT ( _RC_NEAR + _PC_64 + _EM_INVALID + _EM_ZERODIVIDE + _EM_OVERFLOW + _EM_UNDERFLOW + _EM_INEXACT + _EM_DENORMAL)
#elif defined(_M_MRX000) || defined (_M_ALPHA) || defined(_M_PPC)
#define _CW_DEFAULT ( _RC_NEAR + _DN_FLUSH + _EM_INVALID + _EM_ZERODIVIDE + _EM_OVERFLOW + _EM_UNDERFLOW + _EM_INEXACT )
#endif
/* Global variable holding floating point error code */
#if defined(_MT) || defined(_DLL)
_CRTIMP extern int * __cdecl __fpecode(void);
#define _fpecode (*__fpecode())
#else /* ndef _MT && ndef _DLL */
extern int _fpecode;
#endif /* _MT || _DLL */
/* invalid subconditions (_SW_INVALID also set) */
#define _SW_UNEMULATED 0x0040 /* unemulated instruction */
#define _SW_SQRTNEG 0x0080 /* square root of a neg number */
#define _SW_STACKOVERFLOW 0x0200 /* FP stack overflow */
#define _SW_STACKUNDERFLOW 0x0400 /* FP stack underflow */
/* Floating point error signals and return codes */
#define _FPE_INVALID 0x81
#define _FPE_DENORMAL 0x82
#define _FPE_ZERODIVIDE 0x83
#define _FPE_OVERFLOW 0x84
#define _FPE_UNDERFLOW 0x85
#define _FPE_INEXACT 0x86
#define _FPE_UNEMULATED 0x87
#define _FPE_SQRTNEG 0x88
#define _FPE_STACKOVERFLOW 0x8a
#define _FPE_STACKUNDERFLOW 0x8b
#define _FPE_EXPLICITGEN 0x8c /* raise( SIGFPE ); */
/* IEEE recommended functions */
_CRTIMP double __cdecl _copysign (double, double);
_CRTIMP double __cdecl _chgsign (double);
_CRTIMP double __cdecl _scalb(double, long);
_CRTIMP double __cdecl _logb(double);
_CRTIMP double __cdecl _nextafter(double, double);
_CRTIMP int __cdecl _finite(double);
_CRTIMP int __cdecl _isnan(double);
_CRTIMP int __cdecl _fpclass(double);
#define _FPCLASS_SNAN 0x0001 /* signaling NaN */
#define _FPCLASS_QNAN 0x0002 /* quiet NaN */
#define _FPCLASS_NINF 0x0004 /* negative infinity */
#define _FPCLASS_NN 0x0008 /* negative normal */
#define _FPCLASS_ND 0x0010 /* negative denormal */
#define _FPCLASS_NZ 0x0020 /* -0 */
#define _FPCLASS_PZ 0x0040 /* +0 */
#define _FPCLASS_PD 0x0080 /* positive denormal */
#define _FPCLASS_PN 0x0100 /* positive normal */
#define _FPCLASS_PINF 0x0200 /* positive infinity */
#if !__STDC__
/* Non-ANSI names for compatibility */
#define clear87 _clear87
#define status87 _status87
#define control87 _control87
_CRTIMP void __cdecl fpreset(void);
#define DBL_RADIX _DBL_RADIX
#define DBL_ROUNDS _DBL_ROUNDS
#define LDBL_RADIX _LDBL_RADIX
#define LDBL_ROUNDS _LDBL_ROUNDS
#define MCW_EM _MCW_EM
#define EM_INVALID _EM_INVALID
#define EM_DENORMAL _EM_DENORMAL
#define EM_ZERODIVIDE _EM_ZERODIVIDE
#define EM_OVERFLOW _EM_OVERFLOW
#define EM_UNDERFLOW _EM_UNDERFLOW
#define EM_INEXACT _EM_INEXACT
#define MCW_IC _MCW_IC
#define IC_AFFINE _IC_AFFINE
#define IC_PROJECTIVE _IC_PROJECTIVE
#define MCW_RC _MCW_RC
#define RC_CHOP _RC_CHOP
#define RC_UP _RC_UP
#define RC_DOWN _RC_DOWN
#define RC_NEAR _RC_NEAR
#define MCW_PC _MCW_PC
#define PC_24 _PC_24
#define PC_53 _PC_53
#define PC_64 _PC_64
#define CW_DEFAULT _CW_DEFAULT
#define SW_INVALID _SW_INVALID
#define SW_DENORMAL _SW_DENORMAL
#define SW_ZERODIVIDE _SW_ZERODIVIDE
#define SW_OVERFLOW _SW_OVERFLOW
#define SW_UNDERFLOW _SW_UNDERFLOW
#define SW_INEXACT _SW_INEXACT
#define SW_UNEMULATED _SW_UNEMULATED
#define SW_SQRTNEG _SW_SQRTNEG
#define SW_STACKOVERFLOW _SW_STACKOVERFLOW
#define SW_STACKUNDERFLOW _SW_STACKUNDERFLOW
#define FPE_INVALID _FPE_INVALID
#define FPE_DENORMAL _FPE_DENORMAL
#define FPE_ZERODIVIDE _FPE_ZERODIVIDE
#define FPE_OVERFLOW _FPE_OVERFLOW
#define FPE_UNDERFLOW _FPE_UNDERFLOW
#define FPE_INEXACT _FPE_INEXACT
#define FPE_UNEMULATED _FPE_UNEMULATED
#define FPE_SQRTNEG _FPE_SQRTNEG
#define FPE_STACKOVERFLOW _FPE_STACKOVERFLOW
#define FPE_STACKUNDERFLOW _FPE_STACKUNDERFLOW
#define FPE_EXPLICITGEN _FPE_EXPLICITGEN
#endif /* __STDC__ */
#ifdef __cplusplus
}
#endif
#endif /* _INC_FLOAT */

View File

@@ -0,0 +1,362 @@
/***
*fpieee.h - Definitions for floating point IEEE exception handling
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file contains constant and type definitions for handling
* floating point exceptions [ANSI/IEEE std. 754]
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_FPIEEE
#define _INC_FPIEEE
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
#ifndef __assembler /* MIPS ONLY: Protect from assembler */
#ifdef _MSC_VER
/*
* Currently, all MS C compilers for Win32 platforms default to 8 byte
* alignment.
*/
#pragma pack(push,8)
/* Disable C4324: structure was padded due to __declspec(align()) */
#pragma warning(push)
#pragma warning(disable: 4324)
#endif /* _MSC_VER */
#ifdef __cplusplus
extern "C" {
#endif
/* Define _CRTIMP */
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* ndef _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* _CRTIMP */
/* Define __cdecl for non-Microsoft compilers */
#if ( !defined(_MSC_VER) && !defined(__cdecl) )
#define __cdecl
#endif
/*
* Define floating point IEEE compare result values.
*/
typedef enum {
_FpCompareEqual,
_FpCompareGreater,
_FpCompareLess,
_FpCompareUnordered
} _FPIEEE_COMPARE_RESULT;
/*
* Define floating point format and result precision values.
*/
typedef enum {
_FpFormatFp32,
_FpFormatFp64,
_FpFormatFp80,
_FpFormatFp128,
_FpFormatI16,
_FpFormatI32,
_FpFormatI64,
_FpFormatU16,
_FpFormatU32,
_FpFormatU64,
_FpFormatBcd80,
_FpFormatCompare,
_FpFormatString,
#if defined(_M_IA64)
_FpFormatFp82
#endif
} _FPIEEE_FORMAT;
/*
* Define operation code values.
*/
typedef enum {
_FpCodeUnspecified,
_FpCodeAdd,
_FpCodeSubtract,
_FpCodeMultiply,
_FpCodeDivide,
_FpCodeSquareRoot,
_FpCodeRemainder,
_FpCodeCompare,
_FpCodeConvert,
_FpCodeRound,
_FpCodeTruncate,
_FpCodeFloor,
_FpCodeCeil,
_FpCodeAcos,
_FpCodeAsin,
_FpCodeAtan,
_FpCodeAtan2,
_FpCodeCabs,
_FpCodeCos,
_FpCodeCosh,
_FpCodeExp,
_FpCodeFabs,
_FpCodeFmod,
_FpCodeFrexp,
_FpCodeHypot,
_FpCodeLdexp,
_FpCodeLog,
_FpCodeLog10,
_FpCodeModf,
_FpCodePow,
_FpCodeSin,
_FpCodeSinh,
_FpCodeTan,
_FpCodeTanh,
_FpCodeY0,
_FpCodeY1,
_FpCodeYn,
_FpCodeLogb,
_FpCodeNextafter,
_FpCodeNegate,
_FpCodeFmin, /* XMMI */
_FpCodeFmax, /* XMMI */
_FpCodeConvertTrunc, /* XMMI */
_XMMIAddps, /* XMMI */
_XMMIAddss,
_XMMISubps,
_XMMISubss,
_XMMIMulps,
_XMMIMulss,
_XMMIDivps,
_XMMIDivss,
_XMMISqrtps,
_XMMISqrtss,
_XMMIMaxps,
_XMMIMaxss,
_XMMIMinps,
_XMMIMinss,
_XMMICmpps,
_XMMICmpss,
_XMMIComiss,
_XMMIUComiss,
_XMMICvtpi2ps,
_XMMICvtsi2ss,
_XMMICvtps2pi,
_XMMICvtss2si,
_XMMICvttps2pi,
_XMMICvttss2si,
_XMMI2Addpd, /* XMMI2 */
_XMMI2Addsd,
_XMMI2Subpd,
_XMMI2Subsd,
_XMMI2Mulpd,
_XMMI2Mulsd,
_XMMI2Divpd,
_XMMI2Divsd,
_XMMI2Sqrtpd,
_XMMI2Sqrtsd,
_XMMI2Maxpd,
_XMMI2Maxsd,
_XMMI2Minpd,
_XMMI2Minsd,
_XMMI2Cmppd,
_XMMI2Cmpsd,
_XMMI2Comisd,
_XMMI2UComisd,
_XMMI2Cvtpd2pi, /* 66 2D */
_XMMI2Cvtsd2si, /* F2 */
_XMMI2Cvttpd2pi, /* 66 2C */
_XMMI2Cvttsd2si, /* F2 */
_XMMI2Cvtps2pd, /* 0F 5A */
_XMMI2Cvtss2sd, /* F3 */
_XMMI2Cvtpd2ps, /* 66 */
_XMMI2Cvtsd2ss, /* F2 */
_XMMI2Cvtdq2ps, /* 0F 5B */
_XMMI2Cvttps2dq, /* F3 */
_XMMI2Cvtps2dq, /* 66 */
_XMMI2Cvttpd2dq, /* 66 0F E6 */
_XMMI2Cvtpd2dq, /* F2 */
#if defined(_M_IA64)
_FpCodeFma,
_FpCodeFmaSingle,
_FpCodeFmaDouble,
_FpCodeFms,
_FpCodeFmsSingle,
_FpCodeFmsDouble,
_FpCodeFnma,
_FpCodeFnmaSingle,
_FpCodeFnmaDouble,
_FpCodeFamin,
_FpCodeFamax
#endif
} _FP_OPERATION_CODE;
#endif /* #ifndef __assembler */
/*
* Define rounding modes.
*/
#ifndef __assembler /* MIPS ONLY: Protect from assembler */
typedef enum {
_FpRoundNearest,
_FpRoundMinusInfinity,
_FpRoundPlusInfinity,
_FpRoundChopped
} _FPIEEE_ROUNDING_MODE;
typedef enum {
_FpPrecisionFull,
_FpPrecision53,
_FpPrecision24,
#if defined(_M_IA64)
_FpPrecision64,
_FpPrecision113
#endif
} _FPIEEE_PRECISION;
/*
* Define floating point context record
*/
typedef float _FP32;
typedef double _FP64;
typedef short _I16;
typedef int _I32;
typedef unsigned short _U16;
typedef unsigned int _U32;
typedef __int64 _Q64;
typedef struct
#if defined(_M_IA64)
__declspec(align(16))
#endif
{
unsigned short W[5];
} _FP80;
typedef struct __declspec(align(16))
{
unsigned long W[4];
} _FP128;
typedef struct __declspec(align(8))
{
unsigned long W[2];
} _I64;
typedef struct __declspec(align(8))
{
unsigned long W[2];
} _U64;
typedef struct
#if defined(_M_IA64)
__declspec(align(16))
#endif
{
unsigned short W[5];
} _BCD80;
typedef struct __declspec(align(16))
{
_Q64 W[2];
} _FPQ64;
typedef struct {
union {
_FP32 Fp32Value;
_FP64 Fp64Value;
_FP80 Fp80Value;
_FP128 Fp128Value;
_I16 I16Value;
_I32 I32Value;
_I64 I64Value;
_U16 U16Value;
_U32 U32Value;
_U64 U64Value;
_BCD80 Bcd80Value;
char *StringValue;
int CompareValue;
_Q64 Q64Value;
_FPQ64 Fpq64Value;
} Value;
unsigned int OperandValid : 1;
unsigned int Format : 4;
} _FPIEEE_VALUE;
typedef struct {
unsigned int Inexact : 1;
unsigned int Underflow : 1;
unsigned int Overflow : 1;
unsigned int ZeroDivide : 1;
unsigned int InvalidOperation : 1;
} _FPIEEE_EXCEPTION_FLAGS;
typedef struct {
unsigned int RoundingMode : 2;
unsigned int Precision : 3;
unsigned int Operation :12;
_FPIEEE_EXCEPTION_FLAGS Cause;
_FPIEEE_EXCEPTION_FLAGS Enable;
_FPIEEE_EXCEPTION_FLAGS Status;
_FPIEEE_VALUE Operand1;
_FPIEEE_VALUE Operand2;
_FPIEEE_VALUE Result;
#if defined(_M_IA64)
_FPIEEE_VALUE Operand3;
#endif
} _FPIEEE_RECORD, *_PFPIEEE_RECORD;
struct _EXCEPTION_POINTERS;
/*
* Floating point IEEE exception filter routine
*/
_CRTIMP int __cdecl _fpieee_flt(
unsigned long,
struct _EXCEPTION_POINTERS *,
int (__cdecl *)(_FPIEEE_RECORD *)
);
#ifdef __cplusplus
}
#endif
#ifdef _MSC_VER
#pragma warning(pop)
#pragma pack(pop)
#endif /* _MSC_VER */
#endif /* #ifndef __assembler */
#endif /* _INC_FPIEEE */

View File

@@ -0,0 +1,743 @@
// fstream standard header
#pragma once
#ifndef _FSTREAM_
#define _FSTREAM_
#include <istream>
#pragma pack(push,8)
#pragma warning(push,3)
#pragma warning(disable: 4127)
_STD_BEGIN
extern _CRTIMP2 _Filet *__cdecl _Fiopen(const char *, ios_base::openmode, int);
// TEMPLATE FUNCTION _Fgetc
template<class _Elem> inline
bool _Fgetc(_Elem& _Ch, _Filet *_File)
{ // get an element from a C stream
return (fread(&_Ch, sizeof (_Elem), 1, _File) == 1);
}
template<> inline bool _Fgetc(char& _Byte, _Filet *_File)
{ // get a char element from a C stream
int _Meta;
if ((_Meta = fgetc(_File)) == EOF)
return (false);
else
{ // got one, convert to char
_Byte = (char)_Meta;
return (true);
}
}
template<> inline bool _Fgetc(wchar_t& _Wchar, _Filet *_File)
{ // get a wchar_t element from a C stream
wint_t _Meta;
if ((_Meta = fgetwc(_File)) == WEOF)
return (false);
else
{ // got one, convert to wchar_t
_Wchar = (wchar_t)_Meta;
return (true);
}
}
// TEMPLATE FUNCTION _Fputc
template<class _Elem> inline
bool _Fputc(_Elem _Ch, _Filet *_File)
{ // put an element to a C stream
return (fwrite(&_Ch, sizeof (_Elem), 1, _File) == 1);
}
template<> inline bool _Fputc(char _Byte, _Filet *_File)
{ // put a char element to a C stream
return (fputc(_Byte, _File) != EOF);
}
template<> inline bool _Fputc(wchar_t _Wchar, _Filet *_File)
{ // put a wchar_t element to a C stream
return (fputwc(_Wchar, _File) != WEOF);
}
// TEMPLATE FUNCTION _Ungetc
template<class _Elem> inline
bool _Ungetc(const _Elem& _Ch, _Filet *_File)
{ // put back an arbitrary element to a C stream (always fail)
return (false);
}
template<> inline bool _Ungetc(const char& _Byte, _Filet *_File)
{ // put back a char element to a C stream
return (ungetc((unsigned char)_Byte, _File) != EOF);
}
template<> inline bool _Ungetc(const signed char& _Byte, _Filet *_File)
{ // put back a signed char element to a C stream
return (ungetc((unsigned char)_Byte, _File) != EOF);
}
template<> inline bool _Ungetc(const unsigned char& _Byte, _Filet *_File)
{ // put back an unsigned char element to a C stream
return (ungetc(_Byte, _File) != EOF);
}
template<> inline bool _Ungetc(const wchar_t& _Wchar, _Filet *_File)
{ // put back a wchar_t element to a C stream
return (ungetwc(_Wchar, _File) != WEOF);
}
// TEMPLATE CLASS basic_filebuf
template<class _Elem,
class _Traits>
class basic_filebuf
: public basic_streambuf<_Elem, _Traits>
{ // stream buffer associated with a C stream
public:
typedef basic_filebuf<_Elem, _Traits> _Myt;
typedef basic_streambuf<_Elem, _Traits> _Mysb;
typedef codecvt<_Elem, char, typename _Traits::state_type> _Cvt;
virtual ~basic_filebuf()
{ // destroy the object
if (_Closef)
close();
_DELETE_CRT(_Mystr);
}
basic_filebuf(_Filet *_File = 0)
: _Mysb(), _Mystr(0)
{ // construct from pointer to C stream
_Init(_File, _Newfl);
}
typedef _Elem char_type;
typedef _Traits traits_type;
typedef typename _Traits::int_type int_type;
typedef typename _Traits::pos_type pos_type;
typedef typename _Traits::off_type off_type;
basic_filebuf(_Uninitialized)
: _Mysb(_Noinit)
{ // construct uninitialized
}
enum _Initfl
{ // reasons for a call to _Init
_Newfl, _Openfl, _Closefl};
bool is_open() const
{ // test if C stream has been opened
return (_Myfile != 0);
}
_Myt *open(const char *_Filename,
ios_base::openmode _Mode,
int _Prot = (int)ios_base::_Openprot)
{ // open a C stream with specified mode
_Filet *_File;
if (_Myfile != 0 || (_File = _Fiopen(_Filename, _Mode, _Prot)) == 0)
return (0); // open failed
_Init(_File, _Openfl);
_Initcvt((_Cvt *)&_USE(_Mysb::getloc(), _Cvt));
return (this); // open succeeded
}
_Myt *open(const char *_Filename, ios_base::open_mode _Mode)
{ // open a C stream with specified mode (old style)
return (open(_Filename, (ios_base::openmode)_Mode));
}
_Myt *close()
{ // close the C stream
if (_Myfile != 0 && _Endwrite() && fclose(_Myfile) == 0)
{ // close succeeded, tidy up
_Init(0, _Closefl);
return (this);
}
else
return (0);
}
protected:
virtual int_type overflow(int_type _Meta = _Traits::eof())
{ // put an element to stream
if (_Traits::eq_int_type(_Traits::eof(), _Meta))
return (_Traits::not_eof(_Meta)); // EOF, return success code
else if (_Mysb::pptr() != 0
&& _Mysb::pptr() < _Mysb::epptr())
{ // room in buffer, store it
*_Mysb::_Pninc() = _Traits::to_char_type(_Meta);
return (_Meta);
}
else if (_Myfile == 0)
return (_Traits::eof()); // no open C stream, fail
else if (_Pcvt == 0)
return (_Fputc(_Traits::to_char_type(_Meta), _Myfile)
? _Meta : _Traits::eof()); // no codecvt facet, put as is
else
{ // put using codecvt facet
const int _STRING_INC = 8;
const _Elem _Ch = _Traits::to_char_type(_Meta);
const _Elem *_Source;
char *_Dest;
_Mystr->erase();
string _Str(_STRING_INC, '\0');
for (; ; )
switch (_Pcvt->out(_State,
&_Ch, &_Ch + 1, _Source,
&*_Str.begin(), &*_Str.begin() + _Str.size(), _Dest))
{ // test result of converting one element
case codecvt_base::partial:
case codecvt_base::ok:
{ // converted something, try to put it out
size_t _Count = _Dest - &*_Str.begin();
if (0 < _Count && _Count !=
fwrite(&*_Str.begin(), 1, _Count, _Myfile))
return (_Traits::eof()); // write failed
_Wrotesome = true; // write succeeded
if (_Source != &_Ch)
return (_Meta); // converted whole element
if (_Count == 0)
_Str.append(_STRING_INC, '\0'); // try with more space
break;
}
case codecvt_base::noconv:
return (_Fputc(_Ch, _Myfile) ? _Meta
: _Traits::eof()); // no conversion, put as is
default:
return (_Traits::eof()); // conversion failed
}
}
}
virtual int_type pbackfail(int_type _Meta = _Traits::eof())
{ // put an element back to stream
if (_Mysb::gptr() != 0
&& _Mysb::eback() < _Mysb::gptr()
&& (_Traits::eq_int_type(_Traits::eof(), _Meta)
|| _Traits::eq_int_type(_Traits::to_int_type(_Mysb::gptr()[-1]),
_Meta)))
{ // just back up position
_Mysb::_Gndec();
return (_Traits::not_eof(_Meta));
}
else if (_Myfile == 0 || _Traits::eq_int_type(_Traits::eof(), _Meta))
return (_Traits::eof()); // no open C stream or EOF, fail
else if (_Pcvt == 0 && _Ungetc(_Traits::to_char_type(_Meta), _Myfile))
return (_Meta); // no facet and unget succeeded, return
else if (_Mysb::gptr() != &_Mychar)
{ // putback to _Mychar
_Mychar = _Traits::to_char_type(_Meta);
_Mysb::setg(&_Mychar, &_Mychar, &_Mychar + 1);
return (_Meta);
}
else
return (_Traits::eof()); // nowhere to put back
}
virtual int_type underflow()
{ // get an element from stream, but don't point past it
int_type _Meta;
if (_Mysb::gptr() != 0
&& _Mysb::gptr() < _Mysb::egptr())
return (_Traits::to_int_type(*_Mysb::gptr())); // return buffered
else if (_Traits::eq_int_type(_Traits::eof(), _Meta = uflow()))
return (_Meta); // uflow failed, return EOF
else
{ // get a char, don't point past it
pbackfail(_Meta);
return (_Meta);
}
}
virtual int_type uflow()
{ // get an element from stream, point past it
if (_Mysb::gptr() != 0
&& _Mysb::gptr() < _Mysb::egptr())
return (_Traits::to_int_type(
*_Mysb::_Gninc())); // return buffered
else if (_Myfile == 0)
return (_Traits::eof()); // no open C stream, fail
else if (_Pcvt == 0)
{ // no codecvt facet, just get it
_Elem _Ch = 0;
return (_Fgetc(_Ch, _Myfile) ? _Traits::to_int_type(_Ch)
: _Traits::eof());
}
else
for (_State0 = _State, _Mystr->erase(); ; )
{ // get using codecvt facet
_Elem _Ch, *_Dest;
const char *_Source;
ptrdiff_t _Nleft;
int _Meta = fgetc(_Myfile);
if (_Meta == EOF)
return (_Traits::eof()); // partial char?
_Mystr->append(1, (char)_Meta); // append byte and convert
switch (_Pcvt->in(_State,
&*_Mystr->begin(), &*_Mystr->begin() + _Mystr->size(),
_Source, &_Ch, &_Ch + 1, _Dest))
{ // test result of converting one element
case codecvt_base::partial:
_Mystr->erase((size_t)0, // partial, not done yet
(size_t)(_Source - &*_Mystr->begin()));
break;
case codecvt_base::noconv:
if (_Mystr->size() < sizeof (_Elem))
break; // no conversion, but need more chars
memcpy(&_Ch, &*_Mystr->begin(),
sizeof (_Elem)); // copy raw bytes to element
return (_Traits::to_int_type(_Ch)); // return result
case codecvt_base::ok:
for (_Nleft = &*_Mystr->begin() + _Mystr->size() - _Source;
0 < _Nleft; )
ungetc(_Source[--_Nleft], _Myfile);
return (_Traits::to_int_type(_Ch)); // return result
default:
return (_Traits::eof()); // conversion failed
}
}
}
virtual pos_type seekoff(off_type _Off,
ios_base::seekdir _Way,
ios_base::openmode =
(ios_base::openmode)(ios_base::in | ios_base::out))
{ // change position by _Off
fpos_t _Fileposition;
if (_Mysb::egptr() <= _Mysb::gptr() // nothing buffered
|| _Mysb::gptr() != &_Mychar // nothing putback
|| _Way != ios_base::cur) // not a relative seek
; // don't have to worry about putback character
else if (_Pcvt == 0)
_Off -= (off_type)sizeof (_Elem); // back up over _Elem bytes
else
{ // back up over converted bytes
for (ptrdiff_t _Nleft = _Mystr->size(); 0 < _Nleft; )
ungetc(_Mystr->operator[](--_Nleft), _Myfile);
_Mystr->erase();
_State = _State0;
}
if (_Myfile == 0 || !_Endwrite()
|| (_Off != 0 || _Way != ios_base::cur)
&& fseek(_Myfile, (long)_Off, _Way) != 0
|| fgetpos(_Myfile, &_Fileposition) != 0)
return (pos_type(_BADOFF)); // report failure
if (_Mysb::gptr() == &_Mychar)
_Mysb::setg(&_Mychar, &_Mychar, &_Mychar); // discard any putback
return (_POS_TYPE_FROM_STATE(pos_type, _State,
_Fileposition)); // return new position
}
virtual pos_type seekpos(pos_type _Pos,
ios_base::openmode =
(ios_base::openmode)(ios_base::in | ios_base::out))
{ // change position to _Pos
fpos_t _Fileposition = _POS_TYPE_TO_FPOS_T(_Pos);
off_type _Off = (off_type)_Pos - _FPOSOFF(_Fileposition);
if (_Myfile == 0 || !_Endwrite()
|| fsetpos(_Myfile, &_Fileposition) != 0
|| _Off != 0 && fseek(_Myfile, (long)_Off, SEEK_CUR) != 0
|| fgetpos(_Myfile, &_Fileposition) != 0)
return (pos_type(_BADOFF)); // report failure
if (_Mystr != 0)
{ // restore state
_State = _POS_TYPE_TO_STATE(_Pos);
_Mystr->erase();
}
if (_Mysb::gptr() == &_Mychar)
_Mysb::setg(&_Mychar, &_Mychar, &_Mychar); // discard any putback
return (_POS_TYPE_FROM_STATE(pos_type, _State,
_Fileposition)); // return new position
}
virtual _Mysb *setbuf(_Elem *_Buffer, streamsize _Count)
{ // offer _Buffer to C stream
return (_Myfile == 0 || setvbuf(_Myfile, (char *)_Buffer,
_Buffer == 0 && _Count == 0 ? _IONBF : _IOFBF,
_Count * sizeof (_Elem)) != 0 ? 0 : this);
}
virtual int sync()
{ // synchronize C stream with external file
return (_Myfile == 0
|| _Traits::eq_int_type(_Traits::eof(), overflow())
|| 0 <= fflush(_Myfile) ? 0 : -1);
}
virtual void imbue(const locale& _Loc)
{ // set locale to argument (capture nontrivial codecvt facet)
_Initcvt((_Cvt *)&_USE(_Loc, _Cvt));
}
void _Init(_Filet *_File, _Initfl _Which)
{ // initialize to C stream _File after {new, open, close}
static typename _Traits::state_type _Stinit; // initial state
_Closef = _Which == _Openfl;
_Wrotesome = false;
_Mysb::_Init(); // initialize stream buffer base object
#ifndef _IORCNT
#define _IORCNT _IOCNT /* read and write counts are the same */
#define _IOWCNT _IOCNT
#endif /* _IORCNT */
if (_File != 0 && sizeof (_Elem) == 1)
{ // point inside C stream with [first, first + count) buffer
_Elem **_Pb = (_Elem **)&_File->_IOBASE;
_Elem **_Pn = (_Elem **)&_File->_IOPTR;
int *_Nr = (int *)&_File->_IORCNT;
int *_Nw = (int *)&_File->_IOWCNT;
_Mysb::_Init(_Pb, _Pn, _Nr, _Pb, _Pn, _Nw);
}
_Myfile = _File;
_State = _Stinit;
_State0 = _Stinit;
_Pcvt = 0; // pointer to codecvt facet
}
bool _Endwrite()
{ // put shift to initial conversion state, as needed
if (_Pcvt == 0 || !_Wrotesome)
return (true);
else
{ // may have to put
const int _STRING_INC = 8;
char *_Dest;
overflow();
string _Str(_STRING_INC, '\0');
for (; ; )
switch (_Pcvt->unshift(_State,
&*_Str.begin(), &*_Str.begin() + _Str.size(), _Dest))
{ // test result of homing conversion
case codecvt_base::ok:
_Wrotesome = false; // homed successfully
case codecvt_base::partial: // can fall through
{ // put any generated bytes
size_t _Count = _Dest - &*_Str.begin();
if (0 < _Count && _Count !=
fwrite(&*_Str.begin(), _Count, 1, _Myfile))
return (false); // write failed
if (!_Wrotesome)
return (true);
_Str.append(_STRING_INC, '\0'); // try some more
break;
}
case codecvt_base::noconv:
return (true); // nothing to do
default:
return (false); // conversion failed
}
}
}
void _Initcvt(_Cvt *_Newpcvt)
{ // initialize codecvt pointer
if (_Newpcvt->always_noconv())
_Pcvt = 0; // nothing to do
else
{ // set up for nontrivial codecvt facet
_Pcvt = _Newpcvt;
_Mysb::_Init(); // reset any buffering
if (_Mystr == 0)
_Mystr = _NEW_CRT _STRING_CRT; // buy conversion buffer
}
}
private:
_Cvt *_Pcvt; // pointer to codecvt facet (may be null)
typename _Traits::state_type _State0; // rollback for bad conversion
_Elem _Mychar; // putback character, when _Ungetc fails
_STRING_CRT *_Mystr; // string to hold partial conversion sequences
bool _Wrotesome; // true if homing sequence may be needed
typename _Traits::state_type _State; // current conversion state
bool _Closef; // true if C stream must be closed
_Filet *_Myfile; // pointer to C stream
};
#ifdef _DLL_CPPLIB
template class _CRTIMP2 basic_filebuf<char,
char_traits<char> >;
template class _CRTIMP2 basic_filebuf<wchar_t,
char_traits<wchar_t> >;
#endif /* _DLL_CPPLIB */
// TEMPLATE CLASS basic_ifstream
template<class _Elem,
class _Traits>
class basic_ifstream
: public basic_istream<_Elem, _Traits>
{ // input stream associated with a C stream
public:
typedef basic_ifstream<_Elem, _Traits> _Myt;
typedef basic_filebuf<_Elem, _Traits> _Myfb;
typedef basic_ios<_Elem, _Traits> _Myios;
basic_ifstream()
: basic_istream<_Elem, _Traits>(&_Filebuffer)
{ // construct unopened
}
explicit basic_ifstream(const char *_Filename,
ios_base::openmode _Mode = ios_base::in,
int _Prot = (int)ios_base::_Openprot)
: basic_istream<_Elem, _Traits>(&_Filebuffer)
{ // construct with named file and specified mode
if (_Filebuffer.open(_Filename, _Mode | ios_base::in, _Prot) == 0)
_Myios::setstate(ios_base::failbit);
}
explicit basic_ifstream(_Filet *_File)
: basic_istream<_Elem, _Traits>(&_Filebuffer),
_Filebuffer(_File)
{ // construct with specified C stream
}
virtual ~basic_ifstream()
{ // destroy the object
}
_Myfb *rdbuf() const
{ // return pointer to file buffer
return ((_Myfb *)&_Filebuffer);
}
bool is_open() const
{ // test if C stream has been opened
return (_Filebuffer.is_open());
}
void open(const char *_Filename,
ios_base::openmode _Mode = ios_base::in,
int _Prot = (int)ios_base::_Openprot)
{ // open a C stream with specified mode
if (_Filebuffer.open(_Filename, _Mode | ios_base::in, _Prot) == 0)
_Myios::setstate(ios_base::failbit);
}
void open(const char *_Filename, ios_base::open_mode _Mode)
{ // open named file with specified mode (old style)
open(_Filename, (ios_base::openmode)_Mode);
}
void close()
{ // close the C stream
if (_Filebuffer.close() == 0)
_Myios::setstate(ios_base::failbit);
}
private:
_Myfb _Filebuffer; // the file buffer
};
#ifdef _DLL_CPPLIB
template class _CRTIMP2 basic_ifstream<char,
char_traits<char> >;
template class _CRTIMP2 basic_ifstream<wchar_t,
char_traits<wchar_t> >;
#endif /* _DLL_CPPLIB */
// TEMPLATE CLASS basic_ofstream
template<class _Elem,
class _Traits>
class basic_ofstream
: public basic_ostream<_Elem, _Traits>
{ // output stream associated with a C stream
public:
typedef basic_ofstream<_Elem, _Traits> _Myt;
typedef basic_filebuf<_Elem, _Traits> _Myfb;
typedef basic_ios<_Elem, _Traits> _Myios;
basic_ofstream()
: basic_ostream<_Elem, _Traits>(&_Filebuffer)
{ // construct unopened
}
explicit basic_ofstream(const char *_Filename,
ios_base::openmode _Mode = ios_base::out,
int _Prot = (int)ios_base::_Openprot)
: basic_ostream<_Elem, _Traits>(&_Filebuffer)
{ // construct with named file and specified mode
if (_Filebuffer.open(_Filename, _Mode | ios_base::out, _Prot) == 0)
_Myios::setstate(ios_base::failbit);
}
explicit basic_ofstream(_Filet *_File)
: basic_ostream<_Elem, _Traits>(&_Filebuffer),
_Filebuffer(_File)
{ // construct with specified C stream
}
virtual ~basic_ofstream()
{ // destroy the object
}
_Myfb *rdbuf() const
{ // return pointer to file buffer
return ((_Myfb *)&_Filebuffer);
}
bool is_open() const
{ // test if C stream has been opened
return (_Filebuffer.is_open());
}
void open(const char *_Filename,
ios_base::openmode _Mode = ios_base::out,
int _Prot = (int)ios_base::_Openprot)
{ // open a C stream with specified mode
if (_Filebuffer.open(_Filename, _Mode | ios_base::out, _Prot) == 0)
_Myios::setstate(ios_base::failbit);
}
void open(const char *_Filename, ios_base::open_mode _Mode)
{ // open a C stream with specified mode (old style)
open(_Filename, (ios_base::openmode)_Mode);
}
void close()
{ // close the C stream
if (_Filebuffer.close() == 0)
_Myios::setstate(ios_base::failbit);
}
private:
_Myfb _Filebuffer; // the file buffer
};
#ifdef _DLL_CPPLIB
template class _CRTIMP2 basic_ofstream<char,
char_traits<char> >;
template class _CRTIMP2 basic_ofstream<wchar_t,
char_traits<wchar_t> >;
#endif /* _DLL_CPPLIB */
// TEMPLATE CLASS basic_fstream
template<class _Elem,
class _Traits>
class basic_fstream
: public basic_iostream<_Elem, _Traits>
{ // input/output stream associated with a C stream
public:
typedef basic_fstream<_Elem, _Traits> _Myt;
typedef basic_ios<_Elem, _Traits> _Myios;
typedef _Elem char_type;
typedef _Traits traits_type;
typedef typename _Traits::int_type int_type;
typedef typename _Traits::pos_type pos_type;
typedef typename _Traits::off_type off_type;
basic_fstream()
: basic_iostream<_Elem, _Traits>(&_Filebuffer)
{ // construct unopened
}
explicit basic_fstream(const char *_Filename,
ios_base::openmode _Mode = ios_base::in | ios_base::out,
int _Prot = (int)ios_base::_Openprot)
: basic_iostream<_Elem, _Traits>(&_Filebuffer)
{ // construct with named file and specified mode
if (_Filebuffer.open(_Filename, _Mode, _Prot) == 0)
_Myios::setstate(ios_base::failbit);
}
explicit basic_fstream(_Filet *_File)
: basic_iostream<_Elem, _Traits>(&_Filebuffer),
_Filebuffer(_File)
{ // construct with specified C stream
}
virtual ~basic_fstream()
{ // destroy the object
}
basic_filebuf<_Elem, _Traits> *rdbuf() const
{ // return pointer to file buffer
return ((basic_filebuf<_Elem, _Traits> *)&_Filebuffer);
}
bool is_open() const
{ // test if C stream has been opened
return (_Filebuffer.is_open());
}
void open(const char *_Filename,
ios_base::openmode _Mode = ios_base::in | ios_base::out,
int _Prot = (int)ios_base::_Openprot)
{ // open a C stream with specified mode
if (_Filebuffer.open(_Filename, _Mode, _Prot) == 0)
_Myios::setstate(ios_base::failbit);
}
void open(const char *_Filename, ios_base::open_mode _Mode)
{ // open a C stream with specified mode (old style)
open(_Filename, (ios_base::openmode)_Mode);
}
void close()
{ // close the C stream
if (_Filebuffer.close() == 0)
_Myios::setstate(ios_base::failbit);
}
private:
basic_filebuf<_Elem, _Traits> _Filebuffer; // the file buffer
};
#ifdef _DLL_CPPLIB
template class _CRTIMP2 basic_fstream<char,
char_traits<char> >;
template class _CRTIMP2 basic_fstream<wchar_t,
char_traits<wchar_t> >;
#endif /* _DLL_CPPLIB */
_STD_END
#pragma warning(default: 4127)
#pragma warning(pop)
#pragma pack(pop)
#endif /* _FSTREAM_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

View File

@@ -0,0 +1,685 @@
// functional standard header
#pragma once
#ifndef _FUNCTIONAL_
#define _FUNCTIONAL_
#include <xstddef>
#pragma pack(push,8)
#pragma warning(push,3)
#pragma warning(disable: 4244)
_STD_BEGIN
// TEMPLATE STRUCT unary_function
template<class _Arg,
class _Result>
struct unary_function
{ // base class for unary functions
typedef _Arg argument_type;
typedef _Result result_type;
};
// TEMPLATE STRUCT binary_function
template<class _Arg1,
class _Arg2,
class _Result>
struct binary_function
{ // base class for binary functions
typedef _Arg1 first_argument_type;
typedef _Arg2 second_argument_type;
typedef _Result result_type;
};
// TEMPLATE STRUCT plus
template<class _Ty>
struct plus
: public binary_function<_Ty, _Ty, _Ty>
{ // functor for operator+
_Ty operator()(const _Ty& _Left, const _Ty& _Right) const
{ // apply operator+ to operands
return (_Left + _Right);
}
};
// TEMPLATE STRUCT minus
template<class _Ty>
struct minus
: public binary_function<_Ty, _Ty, _Ty>
{ // functor for operator-
_Ty operator()(const _Ty& _Left, const _Ty& _Right) const
{ // apply operator- to operands
return (_Left - _Right);
}
};
// TEMPLATE STRUCT multiplies
template<class _Ty>
struct multiplies
: public binary_function<_Ty, _Ty, _Ty>
{ // functor for operator*
_Ty operator()(const _Ty& _Left, const _Ty& _Right) const
{ // apply operator* to operands
return (_Left * _Right);
}
};
// TEMPLATE STRUCT divides
template<class _Ty>
struct divides
: public binary_function<_Ty, _Ty, _Ty>
{ // functor for operator/
_Ty operator()(const _Ty& _Left, const _Ty& _Right) const
{ // apply operator/ to operands
return (_Left / _Right);
}
};
// TEMPLATE STRUCT modulus
template<class _Ty>
struct modulus
: public binary_function<_Ty, _Ty, _Ty>
{ // functor for operator%
_Ty operator()(const _Ty& _Left, const _Ty& _Right) const
{ // apply operator% to operands
return (_Left % _Right);
}
};
// TEMPLATE STRUCT negate
template<class _Ty>
struct negate
: public unary_function<_Ty, _Ty>
{ // functor for unary operator-
_Ty operator()(const _Ty& _Left) const
{ // apply operator- to operand
return (-_Left);
}
};
// TEMPLATE STRUCT equal_to
template<class _Ty>
struct equal_to
: public binary_function<_Ty, _Ty, bool>
{ // functor for operator==
bool operator()(const _Ty& _Left, const _Ty& _Right) const
{ // apply operator== to operands
return (_Left == _Right);
}
};
// TEMPLATE STRUCT not_equal_to
template<class _Ty>
struct not_equal_to
: public binary_function<_Ty, _Ty, bool>
{ // functor for operator!=
bool operator()(const _Ty& _Left, const _Ty& _Right) const
{ // apply operator= to operands
return (_Left != _Right);
}
};
// TEMPLATE STRUCT greater
template<class _Ty>
struct greater
: public binary_function<_Ty, _Ty, bool>
{ // functor for operator>
bool operator()(const _Ty& _Left, const _Ty& _Right) const
{ // apply operator> to operands
return (_Left > _Right);
}
};
// TEMPLATE STRUCT less
template<class _Ty>
struct less
: public binary_function<_Ty, _Ty, bool>
{ // functor for operator<
bool operator()(const _Ty& _Left, const _Ty& _Right) const
{ // apply operator< to operands
return (_Left < _Right);
}
};
// TEMPLATE STRUCT greater_equal
template<class _Ty>
struct greater_equal
: public binary_function<_Ty, _Ty, bool>
{ // functor for operator>=
bool operator()(const _Ty& _Left, const _Ty& _Right) const
{ // apply operator>= to operands
return (_Left >= _Right);
}
};
// TEMPLATE STRUCT less_equal
template<class _Ty>
struct less_equal
: public binary_function<_Ty, _Ty, bool>
{ // functor for operator<=
bool operator()(const _Ty& _Left, const _Ty& _Right) const
{ // apply operator<= to operands
return (_Left <= _Right);
}
};
// TEMPLATE STRUCT logical_and
template<class _Ty>
struct logical_and
: public binary_function<_Ty, _Ty, bool>
{ // functor for operator&&
bool operator()(const _Ty& _Left, const _Ty& _Right) const
{ // apply operator&& to operands
return (_Left && _Right);
}
};
// TEMPLATE STRUCT logical_or
template<class _Ty>
struct logical_or
: public binary_function<_Ty, _Ty, bool>
{ // functor for operator||
bool operator()(const _Ty& _Left, const _Ty& _Right) const
{ // apply operator|| to operands
return (_Left || _Right);
}
};
// TEMPLATE STRUCT logical_not
template<class _Ty>
struct logical_not
: public unary_function<_Ty, bool>
{ // functor for unary operator!
bool operator()(const _Ty& _Left) const
{ // apply operator! to operand
return (!_Left);
}
};
// TEMPLATE CLASS unary_negate
template<class _Fn1>
class unary_negate
: public unary_function<typename _Fn1::argument_type, bool>
{ // functor adapter !_Func(left)
public:
explicit unary_negate(const _Fn1& _Func)
: _Functor(_Func)
{ // construct from functor
}
bool operator()(const typename _Fn1::argument_type& _Left) const
{ // apply functor to operand
return (!_Functor(_Left));
}
protected:
_Fn1 _Functor; // the functor to apply
};
// TEMPLATE FUNCTION not1
template<class _Fn1> inline
unary_negate<_Fn1> not1(const _Fn1& _Func)
{ // return a unary_negate functor adapter
return (std::unary_negate<_Fn1>(_Func));
}
// TEMPLATE CLASS binary_negate
template<class _Fn2>
class binary_negate
: public binary_function<typename _Fn2::first_argument_type,
typename _Fn2::second_argument_type, bool>
{ // functor adapter !_Func(left, right)
public:
explicit binary_negate(const _Fn2& _Func)
: _Functor(_Func)
{ // construct from functor
}
bool operator()(const typename _Fn2::first_argument_type& _Left,
const typename _Fn2::second_argument_type& _Right) const
{ // apply functor to operands
return (!_Functor(_Left, _Right));
}
protected:
_Fn2 _Functor; // the functor to apply
};
// TEMPLATE FUNCTION not2
template<class _Fn2> inline
binary_negate<_Fn2> not2(const _Fn2& _Func)
{ // return a binary_negate functor adapter
return (std::binary_negate<_Fn2>(_Func));
}
// TEMPLATE CLASS binder1st
template<class _Fn2>
class binder1st
: public unary_function<typename _Fn2::second_argument_type,
typename _Fn2::result_type>
{ // functor adapter _Func(stored, right)
public:
typedef unary_function<typename _Fn2::second_argument_type,
typename _Fn2::result_type> _Base;
typedef typename _Base::argument_type argument_type;
typedef typename _Base::result_type result_type;
binder1st(const _Fn2& _Func,
const typename _Fn2::first_argument_type& _Left)
: op(_Func), value(_Left)
{ // construct from functor and left operand
}
result_type operator()(const argument_type& _Right) const
{ // apply functor to operands
return (op(value, _Right));
}
result_type operator()(argument_type& _Right) const
{ // apply functor to operands
return (op(value, _Right));
}
protected:
_Fn2 op; // the functor to apply
typename _Fn2::first_argument_type value; // the left operand
};
// TEMPLATE FUNCTION bind1st
template<class _Fn2,
class _Ty> inline
binder1st<_Fn2> bind1st(const _Fn2& _Func, const _Ty& _Left)
{ // return a binder1st functor adapter
typename _Fn2::first_argument_type _Val(_Left);
return (std::binder1st<_Fn2>(_Func, _Val));
}
// TEMPLATE CLASS binder2nd
template<class _Fn2>
class binder2nd
: public unary_function<typename _Fn2::first_argument_type,
typename _Fn2::result_type>
{ // functor adapter _Func(left, stored)
public:
typedef unary_function<typename _Fn2::first_argument_type,
typename _Fn2::result_type> _Base;
typedef typename _Base::argument_type argument_type;
typedef typename _Base::result_type result_type;
binder2nd(const _Fn2& _Func,
const typename _Fn2::second_argument_type& _Right)
: op(_Func), value(_Right)
{ // construct from functor and right operand
}
result_type operator()(const argument_type& _Left) const
{ // apply functor to operands
return (op(_Left, value));
}
result_type operator()(argument_type& _Left) const
{ // apply functor to operands
return (op(_Left, value));
}
protected:
_Fn2 op; // the functor to apply
typename _Fn2::second_argument_type value; // the right operand
};
// TEMPLATE FUNCTION bind2nd
template<class _Fn2,
class _Ty> inline
binder2nd<_Fn2> bind2nd(const _Fn2& _Func, const _Ty& _Right)
{ // return a binder2nd functor adapter
typename _Fn2::second_argument_type _Val(_Right);
return (std::binder2nd<_Fn2>(_Func, _Val));
}
// TEMPLATE CLASS pointer_to_unary_function
template<class _Arg,
class _Result>
class pointer_to_unary_function
: public unary_function<_Arg, _Result>
{ // functor adapter (*pfunc)(left)
public:
explicit pointer_to_unary_function(_Result (__cdecl *_Left)(_Arg))
: _Pfun(_Left)
{ // construct from pointer
}
_Result operator()(_Arg _Left) const
{ // call function with operand
return (_Pfun(_Left));
}
protected:
_Result (__cdecl *_Pfun)(_Arg); // the function pointer
};
// TEMPLATE CLASS pointer_to_binary_function
template<class _Arg1,
class _Arg2,
class _Result>
class pointer_to_binary_function
: public binary_function<_Arg1, _Arg2, _Result>
{ // functor adapter (*pfunc)(left, right)
public:
explicit pointer_to_binary_function(
_Result (__cdecl *_Left)(_Arg1, _Arg2))
: _Pfun(_Left)
{ // construct from pointer
}
_Result operator()(_Arg1 _Left, _Arg2 _Right) const
{ // call function with operands
return (_Pfun(_Left, _Right));
}
protected:
_Result (__cdecl *_Pfun)(_Arg1, _Arg2); // the function pointer
};
// TEMPLATE FUNCTION ptr_fun
template<class _Arg,
class _Result> inline
pointer_to_unary_function<_Arg, _Result>
ptr_fun(_Result (__cdecl *_Left)(_Arg))
{ // return pointer_to_unary_function functor adapter
return (std::pointer_to_unary_function<_Arg, _Result>(_Left));
}
template<class _Arg1,
class _Arg2,
class _Result> inline
pointer_to_binary_function<_Arg1, _Arg2, _Result>
ptr_fun(_Result (__cdecl *_Left)(_Arg1, _Arg2))
{ // return pointer_to_binary_function functor adapter
return (std::pointer_to_binary_function<_Arg1, _Arg2, _Result>(_Left));
}
// TEMPLATE CLASS mem_fun_t
template<class _Result,
class _Ty>
class mem_fun_t
: public unary_function<_Ty *, _Result>
{ // functor adapter (*p->*pfunc)(), non-const *pfunc
public:
explicit mem_fun_t(_Result (_Ty::*_Pm)())
: _Pmemfun(_Pm)
{ // construct from pointer
}
_Result operator()(_Ty *_Pleft) const
{ // call function
return ((_Pleft->*_Pmemfun)());
}
private:
_Result (_Ty::*_Pmemfun)(); // the member function pointer
};
// TEMPLATE CLASS mem_fun1_t
template<class _Result,
class _Ty,
class _Arg>
class mem_fun1_t
: public binary_function<_Ty *, _Arg, _Result>
{ // functor adapter (*p->*pfunc)(val), non-const *pfunc
public:
explicit mem_fun1_t(_Result (_Ty::*_Pm)(_Arg))
: _Pmemfun(_Pm)
{ // construct from pointer
}
_Result operator()(_Ty *_Pleft, _Arg _Right) const
{ // call function with operand
return ((_Pleft->*_Pmemfun)(_Right));
}
private:
_Result (_Ty::*_Pmemfun)(_Arg); // the member function pointer
};
// TEMPLATE CLASS const_mem_fun_t
template<class _Result,
class _Ty>
class const_mem_fun_t
: public unary_function<const _Ty *, _Result>
{ // functor adapter (*p->*pfunc)(), const *pfunc
public:
explicit const_mem_fun_t(_Result (_Ty::*_Pm)() const)
: _Pmemfun(_Pm)
{ // construct from pointer
}
_Result operator()(const _Ty *_Pleft) const
{ // call function
return ((_Pleft->*_Pmemfun)());
}
private:
_Result (_Ty::*_Pmemfun)() const; // the member function pointer
};
// TEMPLATE CLASS const_mem_fun1_t
template<class _Result,
class _Ty,
class _Arg>
class const_mem_fun1_t
: public binary_function<const _Ty *, _Arg, _Result>
{ // functor adapter (*p->*pfunc)(val), const *pfunc
public:
explicit const_mem_fun1_t(_Result (_Ty::*_Pm)(_Arg) const)
: _Pmemfun(_Pm)
{ // construct from pointer
}
_Result operator()(const _Ty *_Pleft, _Arg _Right) const
{ // call function with operand
return ((_Pleft->*_Pmemfun)(_Right));
}
private:
_Result (_Ty::*_Pmemfun)(_Arg) const; // the member function pointer
};
// TEMPLATE FUNCTION mem_fun
template<class _Result,
class _Ty> inline
mem_fun_t<_Result, _Ty> mem_fun(_Result (_Ty::*_Pm)())
{ // return a mem_fun_t functor adapter
return (std::mem_fun_t<_Result, _Ty>(_Pm));
}
template<class _Result,
class _Ty,
class _Arg> inline
mem_fun1_t<_Result, _Ty, _Arg> mem_fun(_Result (_Ty::*_Pm)(_Arg))
{ // return a mem_fun1_t functor adapter
return (std::mem_fun1_t<_Result, _Ty, _Arg>(_Pm));
}
template<class _Result,
class _Ty> inline
const_mem_fun_t<_Result, _Ty>
mem_fun(_Result (_Ty::*_Pm)() const)
{ // return a const_mem_fun_t functor adapter
return (std::const_mem_fun_t<_Result, _Ty>(_Pm));
}
template<class _Result,
class _Ty,
class _Arg> inline
const_mem_fun1_t<_Result, _Ty, _Arg>
mem_fun(_Result (_Ty::*_Pm)(_Arg) const)
{ // return a const_mem_fun1_t functor adapter
return (std::const_mem_fun1_t<_Result, _Ty, _Arg>(_Pm));
}
// TEMPLATE FUNCTION mem_fun1 (retained)
template<class _Result,
class _Ty,
class _Arg> inline
mem_fun1_t<_Result, _Ty, _Arg> mem_fun1(_Result (_Ty::*_Pm)(_Arg))
{ // return a mem_fun1_t functor adapter
return (std::mem_fun1_t<_Result, _Ty, _Arg>(_Pm));
}
// TEMPLATE CLASS mem_fun_ref_t
template<class _Result,
class _Ty>
class mem_fun_ref_t
: public unary_function<_Ty, _Result>
{ // functor adapter (*left.*pfunc)(), non-const *pfunc
public:
explicit mem_fun_ref_t(_Result (_Ty::*_Pm)())
: _Pmemfun(_Pm)
{ // construct from pointer
}
_Result operator()(_Ty& _Left) const
{ // call function
return ((_Left.*_Pmemfun)());
}
private:
_Result (_Ty::*_Pmemfun)(); // the member function pointer
};
// TEMPLATE CLASS mem_fun1_ref_t
template<class _Result,
class _Ty,
class _Arg>
class mem_fun1_ref_t
: public binary_function<_Ty, _Arg, _Result>
{ // functor adapter (*left.*pfunc)(val), non-const *pfunc
public:
explicit mem_fun1_ref_t(_Result (_Ty::*_Pm)(_Arg))
: _Pmemfun(_Pm)
{ // construct from pointer
}
_Result operator()(_Ty& _Left, _Arg _Right) const
{ // call function with operand
return ((_Left.*_Pmemfun)(_Right));
}
private:
_Result (_Ty::*_Pmemfun)(_Arg); // the member function pointer
};
// TEMPLATE CLASS const_mem_fun_ref_t
template<class _Result,
class _Ty>
class const_mem_fun_ref_t
: public unary_function<_Ty, _Result>
{ // functor adapter (*left.*pfunc)(), const *pfunc
public:
explicit const_mem_fun_ref_t(_Result (_Ty::*_Pm)() const)
: _Pmemfun(_Pm)
{ // construct from pointer
}
_Result operator()(const _Ty& _Left) const
{ // call function
return ((_Left.*_Pmemfun)());
}
private:
_Result (_Ty::*_Pmemfun)() const; // the member function pointer
};
// TEMPLATE CLASS const_mem_fun1_ref_t
template<class _Result,
class _Ty,
class _Arg>
class const_mem_fun1_ref_t
: public binary_function<_Ty, _Arg, _Result>
{ // functor adapter (*left.*pfunc)(val), const *pfunc
public:
explicit const_mem_fun1_ref_t(_Result (_Ty::*_Pm)(_Arg) const)
: _Pmemfun(_Pm)
{ // construct from pointer
}
_Result operator()(const _Ty& _Left, _Arg _Right) const
{ // call function with operand
return ((_Left.*_Pmemfun)(_Right));
}
private:
_Result (_Ty::*_Pmemfun)(_Arg) const; // the member function pointer
};
// TEMPLATE FUNCTION mem_fun_ref
template<class _Result,
class _Ty> inline
mem_fun_ref_t<_Result, _Ty> mem_fun_ref(_Result (_Ty::*_Pm)())
{ // return a mem_fun_ref_t functor adapter
return (std::mem_fun_ref_t<_Result, _Ty>(_Pm));
}
template<class _Result,
class _Ty,
class _Arg> inline
mem_fun1_ref_t<_Result, _Ty, _Arg>
mem_fun_ref(_Result (_Ty::*_Pm)(_Arg))
{ // return a mem_fun1_ref_t functor adapter
return (std::mem_fun1_ref_t<_Result, _Ty, _Arg>(_Pm));
}
template<class _Result,
class _Ty> inline
const_mem_fun_ref_t<_Result, _Ty>
mem_fun_ref(_Result (_Ty::*_Pm)() const)
{ // return a const_mem_fun_ref_t functor adapter
return (std::const_mem_fun_ref_t<_Result, _Ty>(_Pm));
}
template<class _Result,
class _Ty,
class _Arg> inline
const_mem_fun1_ref_t<_Result, _Ty, _Arg>
mem_fun_ref(_Result (_Ty::*_Pm)(_Arg) const)
{ // return a const_mem_fun1_ref_t functor adapter
return (std::const_mem_fun1_ref_t<_Result, _Ty, _Arg>(_Pm));
}
// TEMPLATE FUNCTION mem_fun1_ref (retained)
template<class _Result,
class _Ty,
class _Arg> inline
mem_fun1_ref_t<_Result, _Ty, _Arg> mem_fun1_ref(_Result (_Ty::*_Pm)(_Arg))
{ // return a mem_fun1_ref_t functor adapter
return (std::mem_fun1_ref_t<_Result, _Ty, _Arg>(_Pm));
}
_STD_END
#pragma warning(default: 4244)
#pragma warning(pop)
#pragma pack(pop)
#endif /* _FUNCTIONAL_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
*/
/*
* This file is derived from software bearing the following
* restrictions:
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Permission to use, copy, modify, distribute and sell this
* software and its documentation for any purpose is hereby
* granted without fee, provided that the above copyright notice
* appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation.
* Hewlett-Packard Company makes no representations about the
* suitability of this software for any purpose. It is provided
* "as is" without express or implied warranty.
V3.13:0009 */

View File

@@ -0,0 +1,467 @@
/**
*** Copyright (C) 1985-1999 Intel Corporation. All rights reserved.
***
*** The information and source code contained herein is the exclusive
*** property of Intel Corporation and may not be disclosed, examined
*** or reproduced in whole or in part without explicit written authorization
*** from the company.
***
**/
/*
* Definition of a C++ class interface to Streaming SIMD Extension intrinsics.
*
*
* File name : fvec.h Fvec class definitions
*
* Concept: A C++ abstraction of Streaming SIMD Extensions designed to improve
*
* programmer productivity. Speed and accuracy are sacrificed for utility.
*
* Facilitates an easy transition to compiler intrinsics
*
* or assembly language.
*
* F32vec4: 4 packed single precision
* 32-bit floating point numbers
*/
#ifndef FVEC_H_INCLUDED
#define FVEC_H_INCLUDED
#if !defined __cplusplus
#error ERROR: This file is only supported in C++ compilations!
#endif /* !__cplusplus */
#include <xmmintrin.h> /* Streaming SIMD Extensions Intrinsics include file */
#include <assert.h>
#include <ivec.h>
/* Define _ENABLE_VEC_DEBUG to enable std::ostream inserters for debug output */
#if defined(_ENABLE_VEC_DEBUG)
#include <iostream>
#endif
#pragma pack(push,16) /* Must ensure class & union 16-B aligned */
/* If using MSVC5.0, explicit keyword should be used */
#if (_MSC_VER >= 1100)
#define EXPLICIT explicit
#else
#if (__ICL)
#define EXPLICIT __explicit /* If MSVC4.x & ICL, use __explicit */
#else
#define EXPLICIT /* nothing */
#pragma message( "explicit keyword not recognized")
#endif
#endif
class F32vec4
{
protected:
__m128 vec;
public:
/* Constructors: __m128, 4 floats, 1 float */
F32vec4() {}
/* initialize 4 SP FP with __m128 data type */
F32vec4(__m128 m) { vec = m;}
/* initialize 4 SP FPs with 4 floats */
F32vec4(float f3, float f2, float f1, float f0) { vec= _mm_set_ps(f3,f2,f1,f0); }
/* Explicitly initialize each of 4 SP FPs with same float */
EXPLICIT F32vec4(float f) { vec = _mm_set_ps1(f); }
/* Explicitly initialize each of 4 SP FPs with same double */
EXPLICIT F32vec4(double d) { vec = _mm_set_ps1((float) d); }
/* Assignment operations */
F32vec4& operator =(float f) { vec = _mm_set_ps1(f); return *this; }
F32vec4& operator =(double d) { vec = _mm_set_ps1((float) d); return *this; }
/* Conversion functions */
operator __m128() const { return vec; } /* Convert to __m128 */
/* Logical Operators */
friend F32vec4 operator &(const F32vec4 &a, const F32vec4 &b) { return _mm_and_ps(a,b); }
friend F32vec4 operator |(const F32vec4 &a, const F32vec4 &b) { return _mm_or_ps(a,b); }
friend F32vec4 operator ^(const F32vec4 &a, const F32vec4 &b) { return _mm_xor_ps(a,b); }
/* Arithmetic Operators */
friend F32vec4 operator +(const F32vec4 &a, const F32vec4 &b) { return _mm_add_ps(a,b); }
friend F32vec4 operator -(const F32vec4 &a, const F32vec4 &b) { return _mm_sub_ps(a,b); }
friend F32vec4 operator *(const F32vec4 &a, const F32vec4 &b) { return _mm_mul_ps(a,b); }
friend F32vec4 operator /(const F32vec4 &a, const F32vec4 &b) { return _mm_div_ps(a,b); }
F32vec4& operator =(const F32vec4 &a) { vec = a.vec; return *this; }
F32vec4& operator =(const __m128 &avec) { vec = avec; return *this; }
F32vec4& operator +=(F32vec4 &a) { return *this = _mm_add_ps(vec,a); }
F32vec4& operator -=(F32vec4 &a) { return *this = _mm_sub_ps(vec,a); }
F32vec4& operator *=(F32vec4 &a) { return *this = _mm_mul_ps(vec,a); }
F32vec4& operator /=(F32vec4 &a) { return *this = _mm_div_ps(vec,a); }
F32vec4& operator &=(F32vec4 &a) { return *this = _mm_and_ps(vec,a); }
F32vec4& operator |=(F32vec4 &a) { return *this = _mm_or_ps(vec,a); }
F32vec4& operator ^=(F32vec4 &a) { return *this = _mm_xor_ps(vec,a); }
/* Horizontal Add */
friend float add_horizontal(F32vec4 &a)
{
F32vec4 ftemp = _mm_add_ss(a,_mm_add_ss(_mm_shuffle_ps(a, a, 1),_mm_add_ss(_mm_shuffle_ps(a, a, 2),_mm_shuffle_ps(a, a, 3))));
return ftemp[0];
}
/* Square Root */
friend F32vec4 sqrt(const F32vec4 &a) { return _mm_sqrt_ps(a); }
/* Reciprocal */
friend F32vec4 rcp(const F32vec4 &a) { return _mm_rcp_ps(a); }
/* Reciprocal Square Root */
friend F32vec4 rsqrt(const F32vec4 &a) { return _mm_rsqrt_ps(a); }
/* NewtonRaphson Reciprocal
[2 * rcpps(x) - (x * rcpps(x) * rcpps(x))] */
friend F32vec4 rcp_nr(const F32vec4 &a)
{
F32vec4 Ra0 = _mm_rcp_ps(a);
return _mm_sub_ps(_mm_add_ps(Ra0, Ra0), _mm_mul_ps(_mm_mul_ps(Ra0, a), Ra0));
}
/* NewtonRaphson Reciprocal Square Root
0.5 * rsqrtps * (3 - x * rsqrtps(x) * rsqrtps(x)) */
friend F32vec4 rsqrt_nr(const F32vec4 &a)
{
static const F32vec4 fvecf0pt5(0.5f);
static const F32vec4 fvecf3pt0(3.0f);
F32vec4 Ra0 = _mm_rsqrt_ps(a);
return (fvecf0pt5 * Ra0) * (fvecf3pt0 - (a * Ra0) * Ra0);
}
/* Compares: Mask is returned */
/* Macros expand to all compare intrinsics. Example:
friend F32vec4 cmpeq(const F32vec4 &a, const F32vec4 &b)
{ return _mm_cmpeq_ps(a,b);} */
#define Fvec32s4_COMP(op) \
friend F32vec4 cmp##op (const F32vec4 &a, const F32vec4 &b) { return _mm_cmp##op##_ps(a,b); }
Fvec32s4_COMP(eq) // expanded to cmpeq(a,b)
Fvec32s4_COMP(lt) // expanded to cmplt(a,b)
Fvec32s4_COMP(le) // expanded to cmple(a,b)
Fvec32s4_COMP(gt) // expanded to cmpgt(a,b)
Fvec32s4_COMP(ge) // expanded to cmpge(a,b)
Fvec32s4_COMP(neq) // expanded to cmpneq(a,b)
Fvec32s4_COMP(nlt) // expanded to cmpnlt(a,b)
Fvec32s4_COMP(nle) // expanded to cmpnle(a,b)
Fvec32s4_COMP(ngt) // expanded to cmpngt(a,b)
Fvec32s4_COMP(nge) // expanded to cmpnge(a,b)
#undef Fvec32s4_COMP
/* Min and Max */
friend F32vec4 simd_min(const F32vec4 &a, const F32vec4 &b) { return _mm_min_ps(a,b); }
friend F32vec4 simd_max(const F32vec4 &a, const F32vec4 &b) { return _mm_max_ps(a,b); }
/* Debug Features */
#if defined(_ENABLE_VEC_DEBUG)
/* Output */
friend std::ostream & operator<<(std::ostream & os, const F32vec4 &a)
{
/* To use: cout << "Elements of F32vec4 fvec are: " << fvec; */
float *fp = (float*)&a;
os << "[3]:" << *(fp+3)
<< " [2]:" << *(fp+2)
<< " [1]:" << *(fp+1)
<< " [0]:" << *fp;
return os;
}
#endif
/* Element Access Only, no modifications to elements*/
const float& operator[](int i) const
{
/* Assert enabled only during debug /DDEBUG */
assert((0 <= i) && (i <= 3)); /* User should only access elements 0-3 */
float *fp = (float*)&vec;
return *(fp+i);
}
/* Element Access and Modification*/
float& operator[](int i)
{
/* Assert enabled only during debug /DDEBUG */
assert((0 <= i) && (i <= 3)); /* User should only access elements 0-3 */
float *fp = (float*)&vec;
return *(fp+i);
}
};
/* Miscellaneous */
/* Interleave low order data elements of a and b into destination */
inline F32vec4 unpack_low(const F32vec4 &a, const F32vec4 &b)
{ return _mm_unpacklo_ps(a, b); }
/* Interleave high order data elements of a and b into target */
inline F32vec4 unpack_high(const F32vec4 &a, const F32vec4 &b)
{ return _mm_unpackhi_ps(a, b); }
/* Move Mask to Integer returns 4 bit mask formed of most significant bits of a */
inline int move_mask(const F32vec4 &a)
{ return _mm_movemask_ps(a);}
/* Data Motion Functions */
/* Load Unaligned loadu_ps: Unaligned */
inline void loadu(F32vec4 &a, float *p)
{ a = _mm_loadu_ps(p); }
/* Store Temporal storeu_ps: Unaligned */
inline void storeu(float *p, const F32vec4 &a)
{ _mm_storeu_ps(p, a); }
/* Cacheability Support */
/* Non-Temporal Store */
inline void store_nta(float *p, F32vec4 &a)
{ _mm_stream_ps(p,a);}
/* Conditional Selects:*/
/*(a OP b)? c : d; where OP is any compare operator
Macros expand to conditional selects which use all compare intrinsics.
Example:
friend F32vec4 select_eq(const F32vec4 &a, const F32vec4 &b, const F32vec4 &c, const F32vec4 &d)
{
F32vec4 mask = _mm_cmpeq_ps(a,b);
return( (mask & c) | F32vec4((_mm_andnot_ps(mask,d))));
}
*/
#define Fvec32s4_SELECT(op) \
inline F32vec4 select_##op (const F32vec4 &a, const F32vec4 &b, const F32vec4 &c, const F32vec4 &d) \
{ \
F32vec4 mask = _mm_cmp##op##_ps(a,b); \
return( (mask & c) | F32vec4((_mm_andnot_ps(mask,d)))); \
}
Fvec32s4_SELECT(eq) // generates select_eq(a,b)
Fvec32s4_SELECT(lt) // generates select_lt(a,b)
Fvec32s4_SELECT(le) // generates select_le(a,b)
Fvec32s4_SELECT(gt) // generates select_gt(a,b)
Fvec32s4_SELECT(ge) // generates select_ge(a,b)
Fvec32s4_SELECT(neq) // generates select_neq(a,b)
Fvec32s4_SELECT(nlt) // generates select_nlt(a,b)
Fvec32s4_SELECT(nle) // generates select_nle(a,b)
Fvec32s4_SELECT(ngt) // generates select_ngt(a,b)
Fvec32s4_SELECT(nge) // generates select_nge(a,b)
#undef Fvec32s4_SELECT
/* Streaming SIMD Extensions Integer Intrinsics */
/* Max and Min */
inline Is16vec4 simd_max(const Is16vec4 &a, const Is16vec4 &b) { return _m_pmaxsw(a,b);}
inline Is16vec4 simd_min(const Is16vec4 &a, const Is16vec4 &b) { return _m_pminsw(a,b);}
inline Iu8vec8 simd_max(const Iu8vec8 &a, const Iu8vec8 &b) { return _m_pmaxub(a,b);}
inline Iu8vec8 simd_min(const Iu8vec8 &a, const Iu8vec8 &b) { return _m_pminub(a,b);}
/* Average */
inline Iu16vec4 simd_avg(const Iu16vec4 &a, const Iu16vec4 &b) { return _m_pavgw(a,b); }
inline Iu8vec8 simd_avg(const Iu8vec8 &a, const Iu8vec8 &b) { return _m_pavgb(a,b); }
/* Move ByteMask To Int: returns mask formed from most sig bits of each vec of a */
inline int move_mask(const I8vec8 &a) { return _m_pmovmskb(a);}
/* Packed Multiply High Unsigned */
inline Iu16vec4 mul_high(const Iu16vec4 &a, const Iu16vec4 &b) { return _m_pmulhuw(a,b); }
/* Byte Mask Write: Write bytes if most significant bit in each corresponding byte is set */
inline void mask_move(const I8vec8 &a, const I8vec8 &b, char *addr) { _m_maskmovq(a, b, addr); }
/* Data Motion: Store Non Temporal */
inline void store_nta(__m64 *p, M64 &a) { _mm_stream_pi(p,a); }
/* Conversions between ivec <-> fvec */
/* Convert first element of F32vec4 to int with truncation */
inline int F32vec4ToInt(const F32vec4 &a)
{
return _mm_cvtt_ss2si(a);
}
/* Convert two lower SP FP values of a to Is32vec2 with truncation */
inline Is32vec2 F32vec4ToIs32vec2 (const F32vec4 &a)
{
__m64 result;
result = _mm_cvtt_ps2pi(a);
return Is32vec2(result);
}
/* Convert the 32-bit int i to an SP FP value; the upper three SP FP values are passed through from a. */
inline F32vec4 IntToF32vec4(const F32vec4 &a, int i)
{
__m128 result;
result = _mm_cvt_si2ss(a,i);
return F32vec4(result);
}
/* Convert the two 32-bit integer values in b to two SP FP values; the upper two SP FP values are passed from a. */
inline F32vec4 Is32vec2ToF32vec4(const F32vec4 &a, const Is32vec2 &b)
{
__m128 result;
result = _mm_cvt_pi2ps(a,b);
return F32vec4(result);
}
class F32vec1
{
protected:
__m128 vec;
public:
/* Constructors: 1 float */
F32vec1() {}
F32vec1(int i) { vec = _mm_cvt_si2ss(vec,i);};
/* Initialize each of 4 SP FPs with same float */
EXPLICIT F32vec1(float f) { vec = _mm_set_ss(f); }
/* Initialize each of 4 SP FPs with same float */
EXPLICIT F32vec1(double d) { vec = _mm_set_ss((float) d); }
/* initialize with __m128 data type */
F32vec1(__m128 m) { vec = m; }
/* Conversion functions */
operator __m128() const { return vec; } /* Convert to float */
/* Logical Operators */
friend F32vec1 operator &(const F32vec1 &a, const F32vec1 &b) { return _mm_and_ps(a,b); }
friend F32vec1 operator |(const F32vec1 &a, const F32vec1 &b) { return _mm_or_ps(a,b); }
friend F32vec1 operator ^(const F32vec1 &a, const F32vec1 &b) { return _mm_xor_ps(a,b); }
/* Arithmetic Operators */
friend F32vec1 operator +(const F32vec1 &a, const F32vec1 &b) { return _mm_add_ss(a,b); }
friend F32vec1 operator -(const F32vec1 &a, const F32vec1 &b) { return _mm_sub_ss(a,b); }
friend F32vec1 operator *(const F32vec1 &a, const F32vec1 &b) { return _mm_mul_ss(a,b); }
friend F32vec1 operator /(const F32vec1 &a, const F32vec1 &b) { return _mm_div_ss(a,b); }
F32vec1& operator +=(F32vec1 &a) { return *this = _mm_add_ss(vec,a); }
F32vec1& operator -=(F32vec1 &a) { return *this = _mm_sub_ss(vec,a); }
F32vec1& operator *=(F32vec1 &a) { return *this = _mm_mul_ss(vec,a); }
F32vec1& operator /=(F32vec1 &a) { return *this = _mm_div_ss(vec,a); }
F32vec1& operator &=(F32vec1 &a) { return *this = _mm_and_ps(vec,a); }
F32vec1& operator |=(F32vec1 &a) { return *this = _mm_or_ps(vec,a); }
F32vec1& operator ^=(F32vec1 &a) { return *this = _mm_xor_ps(vec,a); }
/* Square Root */
friend F32vec1 sqrt(const F32vec1 &a) { return _mm_sqrt_ss(a); }
/* Reciprocal */
friend F32vec1 rcp(const F32vec1 &a) { return _mm_rcp_ss(a); }
/* Reciprocal Square Root */
friend F32vec1 rsqrt(const F32vec1 &a) { return _mm_rsqrt_ss(a); }
/* NewtonRaphson Reciprocal
[2 * rcpss(x) - (x * rcpss(x) * rcpss(x))] */
friend F32vec1 rcp_nr(const F32vec1 &a)
{
F32vec1 Ra0 = _mm_rcp_ss(a);
return _mm_sub_ss(_mm_add_ss(Ra0, Ra0), _mm_mul_ss(_mm_mul_ss(Ra0, a), Ra0));
}
/* NewtonRaphson Reciprocal Square Root
0.5 * rsqrtss * (3 - x * rsqrtss(x) * rsqrtss(x)) */
friend F32vec1 rsqrt_nr(const F32vec1 &a)
{
static const F32vec1 fvecf0pt5(0.5f);
static const F32vec1 fvecf3pt0(3.0f);
F32vec1 Ra0 = _mm_rsqrt_ss(a);
return (fvecf0pt5 * Ra0) * (fvecf3pt0 - (a * Ra0) * Ra0);
}
/* Compares: Mask is returned */
/* Macros expand to all compare intrinsics. Example:
friend F32vec1 cmpeq(const F32vec1 &a, const F32vec1 &b)
{ return _mm_cmpeq_ss(a,b);} */
#define Fvec32s1_COMP(op) \
friend F32vec1 cmp##op (const F32vec1 &a, const F32vec1 &b) { return _mm_cmp##op##_ss(a,b); }
Fvec32s1_COMP(eq) // expanded to cmpeq(a,b)
Fvec32s1_COMP(lt) // expanded to cmplt(a,b)
Fvec32s1_COMP(le) // expanded to cmple(a,b)
Fvec32s1_COMP(gt) // expanded to cmpgt(a,b)
Fvec32s1_COMP(ge) // expanded to cmpge(a,b)
Fvec32s1_COMP(neq) // expanded to cmpneq(a,b)
Fvec32s1_COMP(nlt) // expanded to cmpnlt(a,b)
Fvec32s1_COMP(nle) // expanded to cmpnle(a,b)
Fvec32s1_COMP(ngt) // expanded to cmpngt(a,b)
Fvec32s1_COMP(nge) // expanded to cmpnge(a,b)
#undef Fvec32s1_COMP
/* Min and Max */
friend F32vec1 simd_min(const F32vec1 &a, const F32vec1 &b) { return _mm_min_ss(a,b); }
friend F32vec1 simd_max(const F32vec1 &a, const F32vec1 &b) { return _mm_max_ss(a,b); }
/* Debug Features */
#if defined(_ENABLE_VEC_DEBUG)
/* Output */
friend std::ostream & operator<<(std::ostream & os, const F32vec1 &a)
{
/* To use: cout << "Elements of F32vec1 fvec are: " << fvec; */
float *fp = (float*)&a;
os << "float:" << *fp;
return os;
}
#endif
};
/* Conditional Selects:*/
/*(a OP b)? c : d; where OP is any compare operator
Macros expand to conditional selects which use all compare intrinsics.
Example:
friend F32vec1 select_eq(const F32vec1 &a, const F32vec1 &b, const F32vec1 &c, const F32vec1 &d)
{
F32vec1 mask = _mm_cmpeq_ss(a,b);
return( (mask & c) | F32vec1((_mm_andnot_ps(mask,d))));
}
*/
#define Fvec32s1_SELECT(op) \
inline F32vec1 select_##op (const F32vec1 &a, const F32vec1 &b, const F32vec1 &c, const F32vec1 &d) \
{ \
F32vec1 mask = _mm_cmp##op##_ss(a,b); \
return( (mask & c) | F32vec1((_mm_andnot_ps(mask,d)))); \
}
Fvec32s1_SELECT(eq) // generates select_eq(a,b)
Fvec32s1_SELECT(lt) // generates select_lt(a,b)
Fvec32s1_SELECT(le) // generates select_le(a,b)
Fvec32s1_SELECT(gt) // generates select_gt(a,b)
Fvec32s1_SELECT(ge) // generates select_ge(a,b)
Fvec32s1_SELECT(neq) // generates select_neq(a,b)
Fvec32s1_SELECT(nlt) // generates select_nlt(a,b)
Fvec32s1_SELECT(nle) // generates select_nle(a,b)
Fvec32s1_SELECT(ngt) // generates select_ngt(a,b)
Fvec32s1_SELECT(nge) // generates select_nge(a,b)
#undef Fvec32s1_SELECT
/* Conversions between ivec <-> fvec */
/* Convert F32vec1 to int */
inline int F32vec1ToInt(const F32vec1 &a)
{
return _mm_cvtt_ss2si(a);
}
#pragma pack(pop) /* 16-B aligned */
#endif /* FVEC_H_INCLUDED */

View File

@@ -0,0 +1,132 @@
//
// gcroot.h - Template class that wraps GCHandle from mscorlib.dll.
// Copyright (C) 2000-2001 Microsoft Corporation
// All rights reserved.
//
// Use this class to declare gc "pointers" that live in the C++ heap.
//
// Example:
// struct StringList {
// gcroot<String*> str;
// StringList *next;
// StringList(); // should have ctors and dtors
// ~StringList();
// };
//
// By convention, we maintain a 1-to-1 relationship between C++ objects
// and the handle slots they "point" to. Thus, two distinct C++ objects
// always refer to two distinct handles, even if they "point" to the same
// object. Therefore, when the C++ object is destroyed, its handle can
// be freed without error.
//
// Note that we cannot currently embed a GCHandle directly in an unmanaged C++
// class. We therefore store an integer (intptr_t), and use the conversion methods of
// GCHandle to reconstitute a GCHandle from the integer on demand.
//
#if _MSC_VER > 1000
#pragma once
#endif
#if !defined(_INC_GCROOT)
#define _INC_GCROOT
#using <mscorlib.dll>
#include <stddef.h>
template <class T> struct gcroot {
typedef System::Runtime::InteropServices::GCHandle GCHandle;
// always allocate a new handle during construction (see above)
//
gcroot() {
_handle = GCHandle::op_Explicit(GCHandle::Alloc(0))
#ifdef _WIN32
.ToInt32()
#elif defined(_WIN64)
.ToInt64()
#else
#error ERROR: either _WIN64 or _WIN32 must be defined
#endif
;
}
// this can't be T& here because & does not yet work on managed types
// (T should be a pointer anyway).
//
gcroot(T t) {
_handle = GCHandle::op_Explicit(GCHandle::Alloc(t))
#ifdef _WIN32
.ToInt32()
#elif defined(_WIN64)
.ToInt64()
#else
#error ERROR: either _WIN64 or _WIN32 must be defined
#endif
;
}
gcroot(const gcroot& r) {
// don't copy a handle, copy what it points to (see above)
_handle = GCHandle::op_Explicit(
GCHandle::Alloc(
GCHandle::op_Explicit(r._handle).Target ))
#ifdef _WIN32
.ToInt32()
#elif defined(_WIN64)
.ToInt64()
#else
#error ERROR: either _WIN64 or _WIN32 must be defined
#endif
;
}
// Since C++ objects and handles are allocated 1-to-1, we can
// free the handle when the object is destroyed
//
~gcroot() {
GCHandle g = GCHandle::op_Explicit(_handle);
g.Free();
_handle = 0; // should fail if reconstituted
}
gcroot& operator=(T t) {
// no need to check for valid handle; was allocated in ctor
GCHandle::op_Explicit(_handle).Target = t;
return *this;
}
gcroot& operator=(const gcroot &r) {
// no need to check for valid handle; was allocated in ctor
T t = (T)r;
GCHandle::op_Explicit(_handle).Target = t;
return *this;
}
operator T () const {
// gcroot is typesafe, so use static_cast
return static_cast<T>( GCHandle::op_Explicit(_handle).Target );
}
// don't return T& here because & to gc pointer not yet implemented
// (T should be a pointer anyway).
T operator->() const {
// gcroot is typesafe, so use static_cast
return static_cast<T>(GCHandle::op_Explicit(_handle).Target);
}
private:
// Don't let anyone copy the handle value directly, or make a copy
// by taking the address of this object and pointing to it from
// somewhere else. The root will be freed when the dtor of this
// object gets called, and anyone pointing to it still will
// cause serious harm to the Garbage Collector.
//
intptr_t _handle;
T* operator& ();
};
#endif // _INC_GCROOT

View File

@@ -0,0 +1,475 @@
// hash_map standard header
#pragma once
#ifndef _HASH_MAP_
#define _HASH_MAP_
#include <xhash>
#pragma pack(push,8)
#pragma warning(push,3)
_STDEXT_BEGIN
// TEMPLATE CLASS _Hmap_traits
template<class _Kty, // key type
class _Ty, // mapped type
class _Tr, // comparator predicate type
class _Alloc, // actual allocator type (should be value allocator)
bool _Mfl> // true if multiple equivalent keys are permitted
class _Hmap_traits
{ // traits required to make _Hash behave like a map
public:
typedef _Kty key_type;
typedef _STD pair<const _Kty, _Ty> value_type;
typedef _Tr key_compare;
typedef typename _Alloc::template rebind<value_type>::other
allocator_type;
enum
{ // make multi parameter visible as an enum constant
_Multi = _Mfl};
_Hmap_traits()
: comp()
{ // construct with default comparator
}
_Hmap_traits(const _Tr& _Traits)
: comp(_Traits)
{ // construct with specified comparator
}
class value_compare
: public _STD binary_function<value_type, value_type, bool>
{ // functor for comparing two element values
friend class _Hmap_traits<_Kty, _Ty, _Tr, _Alloc, _Mfl>;
public:
bool operator()(const value_type& _Left,
const value_type& _Right) const
{ // test if _Left precedes _Right by comparing just keys
return (comp(_Left.first, _Right.first));
}
value_compare(const key_compare& _Traits)
: comp(_Traits)
{ // construct with specified predicate
}
protected:
key_compare comp; // the comparator predicate for keys
};
static const _Kty& _Kfn(const value_type& _Val)
{ // extract key from element value
return (_Val.first);
}
_Tr comp; // the comparator predicate for keys
};
// TEMPLATE CLASS hash_map
template<class _Kty,
class _Ty,
class _Tr = hash_compare<_Kty, _STD less<_Kty> >,
class _Alloc = _STD allocator< _STD pair<const _Kty, _Ty> > >
class hash_map
: public _Hash<_Hmap_traits<_Kty, _Ty, _Tr, _Alloc, false> >
{ // hash table of {key, mapped} values, unique keys
public:
typedef hash_map<_Kty, _Ty, _Tr, _Alloc> _Myt;
typedef _Hash<_Hmap_traits<_Kty, _Ty, _Tr, _Alloc, false> > _Mybase;
typedef _Kty key_type;
typedef _Ty mapped_type;
typedef _Ty referent_type;
typedef _Tr key_compare;
typedef typename _Mybase::value_compare value_compare;
typedef typename _Mybase::allocator_type allocator_type;
typedef typename _Mybase::size_type size_type;
typedef typename _Mybase::difference_type difference_type;
typedef typename _Mybase::pointer pointer;
typedef typename _Mybase::const_pointer const_pointer;
typedef typename _Mybase::reference reference;
typedef typename _Mybase::const_reference const_reference;
typedef typename _Mybase::iterator iterator;
typedef typename _Mybase::const_iterator const_iterator;
typedef typename _Mybase::reverse_iterator reverse_iterator;
typedef typename _Mybase::const_reverse_iterator
const_reverse_iterator;
typedef typename _Mybase::value_type value_type;
hash_map()
: _Mybase(key_compare(), allocator_type())
{ // construct empty map from defaults
}
explicit hash_map(const key_compare& _Traits)
: _Mybase(_Traits, allocator_type())
{ // construct empty map from comparator
}
hash_map(const key_compare& _Traits, const allocator_type& _Al)
: _Mybase(_Traits, _Al)
{ // construct empty map from comparator and allocator
}
template<class _Iter>
hash_map(_Iter _First, _Iter _Last)
: _Mybase(key_compare(), allocator_type())
{ // construct map from sequence, defaults
for (; _First != _Last; ++_First)
this->insert(*_First);
}
template<class _Iter>
hash_map(_Iter _First, _Iter _Last,
const key_compare& _Traits)
: _Mybase(_Traits, allocator_type())
{ // construct map from sequence, comparator
for (; _First != _Last; ++_First)
this->insert(*_First);
}
template<class _Iter>
hash_map(_Iter _First, _Iter _Last,
const key_compare& _Traits,
const allocator_type& _Al)
: _Mybase(_Traits, _Al)
{ // construct map from sequence, comparator, and allocator
for (; _First != _Last; ++_First)
this->insert(*_First);
}
mapped_type& operator[](const key_type& _Keyval)
{ // find element matching _Keyval or insert with default mapped
iterator _Where = this->lower_bound(_Keyval);
if (_Where == this->end())
_Where = this->insert(value_type(_Keyval, mapped_type())).first;
return ((*_Where).second);
}
};
template<class _Kty,
class _Ty,
class _Tr,
class _Alloc> inline
void swap( _STDEXT hash_map<_Kty, _Ty, _Tr, _Alloc>& _Left,
_STDEXT hash_map<_Kty, _Ty, _Tr, _Alloc>& _Right)
{ // swap _Left and _Right hash_maps
_Left.swap(_Right);
}
// TEMPLATE CLASS hash_multimap
template<class _Kty,
class _Ty,
class _Tr = hash_compare<_Kty, _STD less<_Kty> >,
class _Alloc = _STD allocator< _STD pair<const _Kty, _Ty> > >
class hash_multimap
: public _Hash<_Hmap_traits<_Kty, _Ty, _Tr, _Alloc, true> >
{ // hash table of {key, mapped} values, non-unique keys
public:
typedef hash_multimap<_Kty, _Ty, _Tr, _Alloc> _Myt;
typedef _Hash<_Hmap_traits<_Kty, _Ty, _Tr, _Alloc, true> > _Mybase;
typedef _Kty key_type;
typedef _Ty mapped_type;
typedef _Ty referent_type; // old name, magically gone
typedef _Tr key_compare;
typedef typename _Mybase::value_compare value_compare;
typedef typename _Mybase::allocator_type allocator_type;
typedef typename _Mybase::size_type size_type;
typedef typename _Mybase::difference_type difference_type;
typedef typename _Mybase::pointer pointer;
typedef typename _Mybase::const_pointer const_pointer;
typedef typename _Mybase::reference reference;
typedef typename _Mybase::const_reference const_reference;
typedef typename _Mybase::iterator iterator;
typedef typename _Mybase::const_iterator const_iterator;
typedef typename _Mybase::reverse_iterator reverse_iterator;
typedef typename _Mybase::const_reverse_iterator
const_reverse_iterator;
typedef typename _Mybase::value_type value_type;
hash_multimap()
: _Mybase(key_compare(), allocator_type())
{ // construct empty map from defaults
}
explicit hash_multimap(const key_compare& _Traits)
: _Mybase(_Traits, allocator_type())
{ // construct empty map from comparator
}
hash_multimap(const key_compare& _Traits,
const allocator_type& _Al)
: _Mybase(_Traits, _Al)
{ // construct empty map from comparator and allocator
}
template<class _Iter>
hash_multimap(_Iter _First, _Iter _Last)
: _Mybase(key_compare(), allocator_type())
{ // construct map from sequence, defaults
for (; _First != _Last; ++_First)
this->insert(*_First);
}
template<class _Iter>
hash_multimap(_Iter _First, _Iter _Last,
const key_compare& _Traits)
: _Mybase(_Traits, allocator_type())
{ // construct map from sequence, comparator
for (; _First != _Last; ++_First)
this->insert(*_First);
}
template<class _Iter>
hash_multimap(_Iter _First, _Iter _Last,
const key_compare& _Traits,
const allocator_type& _Al)
: _Mybase(_Traits, _Al)
{ // construct map from sequence, comparator, and allocator
for (; _First != _Last; ++_First)
this->insert(*_First);
}
iterator insert(const value_type& _Val)
{ // insert a {key, mapped} value
return (_Mybase::insert(_Val).first);
}
iterator insert(iterator _Where, const value_type& _Val)
{ // insert a {key, mapped} value, with hint
return (_Mybase::insert(_Where, _Val));
}
template<class _Iter>
void insert(_Iter _First, _Iter _Last)
{ // insert [_First, _Last), arbitrary iterators
for (; _First != _Last; ++_First)
insert(*_First);
}
};
template<class _Kty,
class _Ty,
class _Tr,
class _Alloc> inline
void swap( _STDEXT hash_multimap<_Kty, _Ty, _Tr, _Alloc>& _Left,
_STDEXT hash_multimap<_Kty, _Ty, _Tr, _Alloc>& _Right)
{ // swap _Left and _Right hash_multimaps
_Left.swap(_Right);
}
_STDEXT_END
#ifdef _MSC_EXTENSIONS
#if _DEFINE_DEPRECATED_HASH_CLASSES
#pragma warning(push)
#pragma warning(disable: 4996)
_STD_BEGIN
// TEMPLATE CLASS hash_map
template<class _Kty,
class _Ty,
class _Tr = _STDEXT hash_compare<_Kty, less<_Kty> >,
class _Alloc = allocator< pair<const _Kty, _Ty> > >
class _DEPRECATED hash_map
: public _STDEXT _Hash< _STDEXT _Hmap_traits<_Kty, _Ty, _Tr, _Alloc, false> >
{ // hash table of {key, mapped} values, unique keys
public:
typedef hash_map<_Kty, _Ty, _Tr, _Alloc> _Myt;
typedef _STDEXT _Hash< _STDEXT _Hmap_traits<_Kty, _Ty, _Tr, _Alloc, false> > _Mybase;
typedef _Kty key_type;
typedef _Ty mapped_type;
typedef _Ty referent_type;
typedef _Tr key_compare;
typedef typename _Mybase::value_compare value_compare;
typedef typename _Mybase::allocator_type allocator_type;
typedef typename _Mybase::size_type size_type;
typedef typename _Mybase::difference_type difference_type;
typedef typename _Mybase::pointer pointer;
typedef typename _Mybase::const_pointer const_pointer;
typedef typename _Mybase::reference reference;
typedef typename _Mybase::const_reference const_reference;
typedef typename _Mybase::iterator iterator;
typedef typename _Mybase::const_iterator const_iterator;
typedef typename _Mybase::reverse_iterator reverse_iterator;
typedef typename _Mybase::const_reverse_iterator
const_reverse_iterator;
typedef typename _Mybase::value_type value_type;
hash_map()
: _Mybase(key_compare(), allocator_type())
{ // construct empty map from defaults
}
explicit hash_map(const key_compare& _Traits)
: _Mybase(_Traits, allocator_type())
{ // construct empty map from comparator
}
hash_map(const key_compare& _Traits, const allocator_type& _Al)
: _Mybase(_Traits, _Al)
{ // construct empty map from comparator and allocator
}
template<class _Iter>
hash_map(_Iter _First, _Iter _Last)
: _Mybase(key_compare(), allocator_type())
{ // construct map from sequence, defaults
for (; _First != _Last; ++_First)
this->insert(*_First);
}
template<class _Iter>
hash_map(_Iter _First, _Iter _Last,
const key_compare& _Traits)
: _Mybase(_Traits, allocator_type())
{ // construct map from sequence, comparator
for (; _First != _Last; ++_First)
this->insert(*_First);
}
template<class _Iter>
hash_map(_Iter _First, _Iter _Last,
const key_compare& _Traits,
const allocator_type& _Al)
: _Mybase(_Traits, _Al)
{ // construct map from sequence, comparator, and allocator
for (; _First != _Last; ++_First)
this->insert(*_First);
}
mapped_type& operator[](const key_type& _Keyval)
{ // find element matching _Keyval or insert with default mapped
iterator _Where = this->lower_bound(_Keyval);
if (_Where == this->end())
_Where = this->insert(value_type(_Keyval, mapped_type())).first;
return ((*_Where).second);
}
};
template<class _Kty,
class _Ty,
class _Tr,
class _Alloc> inline
void swap(hash_map<_Kty, _Ty, _Tr, _Alloc>& _Left,
hash_map<_Kty, _Ty, _Tr, _Alloc>& _Right)
{ // swap _Left and _Right hash_maps
_Left.swap(_Right);
}
// TEMPLATE CLASS hash_multimap
template<class _Kty,
class _Ty,
class _Tr = _STDEXT hash_compare<_Kty, less<_Kty> >,
class _Alloc = allocator< pair<const _Kty, _Ty> > >
class _DEPRECATED hash_multimap
: public _STDEXT _Hash< _STDEXT _Hmap_traits<_Kty, _Ty, _Tr, _Alloc, true> >
{ // hash table of {key, mapped} values, non-unique keys
public:
typedef hash_multimap<_Kty, _Ty, _Tr, _Alloc> _Myt;
typedef _STDEXT _Hash< _STDEXT _Hmap_traits<_Kty, _Ty, _Tr, _Alloc, true> > _Mybase;
typedef _Kty key_type;
typedef _Ty mapped_type;
typedef _Ty referent_type; // old name, magically gone
typedef _Tr key_compare;
typedef typename _Mybase::value_compare value_compare;
typedef typename _Mybase::allocator_type allocator_type;
typedef typename _Mybase::size_type size_type;
typedef typename _Mybase::difference_type difference_type;
typedef typename _Mybase::pointer pointer;
typedef typename _Mybase::const_pointer const_pointer;
typedef typename _Mybase::reference reference;
typedef typename _Mybase::const_reference const_reference;
typedef typename _Mybase::iterator iterator;
typedef typename _Mybase::const_iterator const_iterator;
typedef typename _Mybase::reverse_iterator reverse_iterator;
typedef typename _Mybase::const_reverse_iterator
const_reverse_iterator;
typedef typename _Mybase::value_type value_type;
hash_multimap()
: _Mybase(key_compare(), allocator_type())
{ // construct empty map from defaults
}
explicit hash_multimap(const key_compare& _Traits)
: _Mybase(_Traits, allocator_type())
{ // construct empty map from comparator
}
hash_multimap(const key_compare& _Traits,
const allocator_type& _Al)
: _Mybase(_Traits, _Al)
{ // construct empty map from comparator and allocator
}
template<class _Iter>
hash_multimap(_Iter _First, _Iter _Last)
: _Mybase(key_compare(), allocator_type())
{ // construct map from sequence, defaults
for (; _First != _Last; ++_First)
this->insert(*_First);
}
template<class _Iter>
hash_multimap(_Iter _First, _Iter _Last,
const key_compare& _Traits)
: _Mybase(_Traits, allocator_type())
{ // construct map from sequence, comparator
for (; _First != _Last; ++_First)
this->insert(*_First);
}
template<class _Iter>
hash_multimap(_Iter _First, _Iter _Last,
const key_compare& _Traits,
const allocator_type& _Al)
: _Mybase(_Traits, _Al)
{ // construct map from sequence, comparator, and allocator
for (; _First != _Last; ++_First)
this->insert(*_First);
}
iterator insert(const value_type& _Val)
{ // insert a {key, mapped} value
return (_Mybase::insert(_Val).first);
}
iterator insert(iterator _Where, const value_type& _Val)
{ // insert a {key, mapped} value, with hint
return (_Mybase::insert(_Where, _Val));
}
template<class _Iter>
void insert(_Iter _First, _Iter _Last)
{ // insert [_First, _Last), arbitrary iterators
for (; _First != _Last; ++_First)
insert(*_First);
}
};
template<class _Kty,
class _Ty,
class _Tr,
class _Alloc> inline
void swap(hash_multimap<_Kty, _Ty, _Tr, _Alloc>& _Left,
hash_multimap<_Kty, _Ty, _Tr, _Alloc>& _Right)
{ // swap _Left and _Right hash_multimaps
_Left.swap(_Right);
}
_STD_END
#pragma warning(pop)
#endif /* _DEFINE_DEPRECATED_HASH_CLASSES */
#endif /* MSC_EXTENSIONS */
#pragma warning(pop)
#pragma pack(pop)
#endif /* _HASH_MAP_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

View File

@@ -0,0 +1,419 @@
// hash_set standard header
#pragma once
#ifndef _HASH_SET_
#define _HASH_SET_
#include <xhash>
#pragma pack(push,8)
#pragma warning(push,3)
_STDEXT_BEGIN
// TEMPLATE CLASS _Hset_traits
template<class _Kty, // key type (same as value type)
class _Tr, // comparator predicate type
class _Alloc, // actual allocator type (should be value allocator)
bool _Mfl> // true if multiple equivalent keys are permitted
class _Hset_traits
{ // traits required to make _Hash behave like a set
public:
typedef _Kty key_type;
typedef _Kty value_type;
typedef _Tr key_compare;
typedef typename _Alloc::template rebind<value_type>::other
allocator_type;
enum
{ // make multi parameter visible as an enum constant
_Multi = _Mfl};
_Hset_traits()
: comp()
{ // construct with default comparator
}
_Hset_traits(const _Tr& _Traits)
: comp(_Traits)
{ // construct with specified comparator
}
typedef key_compare value_compare;
static const _Kty& _Kfn(const value_type& _Val)
{ // return entire value as key
return (_Val);
}
_Tr comp; // the comparator predicate for keys
};
// TEMPLATE CLASS hash_set
template<class _Kty,
class _Tr = hash_compare<_Kty, _STD less<_Kty> >,
class _Alloc = _STD allocator<_Kty> >
class hash_set
: public _Hash<_Hset_traits<_Kty, _Tr, _Alloc, false> >
{ // hash table of key values, unique keys
public:
typedef hash_set<_Kty, _Tr, _Alloc> _Myt;
typedef _Hash<_Hset_traits<_Kty, _Tr, _Alloc, false> > _Mybase;
typedef _Kty key_type;
typedef _Tr key_compare;
typedef typename _Mybase::value_compare value_compare;
typedef typename _Mybase::allocator_type allocator_type;
typedef typename _Mybase::size_type size_type;
typedef typename _Mybase::difference_type difference_type;
typedef typename _Mybase::pointer pointer;
typedef typename _Mybase::const_pointer const_pointer;
typedef typename _Mybase::reference reference;
typedef typename _Mybase::const_reference const_reference;
typedef typename _Mybase::iterator iterator;
typedef typename _Mybase::const_iterator const_iterator;
typedef typename _Mybase::reverse_iterator reverse_iterator;
typedef typename _Mybase::const_reverse_iterator
const_reverse_iterator;
typedef typename _Mybase::value_type value_type;
hash_set()
: _Mybase(key_compare(), allocator_type())
{ // construct empty set from defaults
}
explicit hash_set(const key_compare& _Traits)
: _Mybase(_Traits, allocator_type())
{ // construct empty set from comparator
}
hash_set(const key_compare& _Traits, const allocator_type& _Al)
: _Mybase(_Traits, _Al)
{ // construct empty set from comparator and allocator
}
template<class _Iter>
hash_set(_Iter _First, _Iter _Last)
: _Mybase(key_compare(), allocator_type())
{ // construct set from sequence, defaults
for (; _First != _Last; ++_First)
this->insert(*_First);
}
template<class _Iter>
hash_set(_Iter _First, _Iter _Last,
const key_compare& _Traits)
: _Mybase(_Traits, allocator_type())
{ // construct set from sequence, comparator
for (; _First != _Last; ++_First)
this->insert(*_First);
}
template<class _Iter>
hash_set(_Iter _First, _Iter _Last,
const key_compare& _Traits, const allocator_type& _Al)
: _Mybase(_Traits, _Al)
{ // construct set from sequence, comparator, and allocator
for (; _First != _Last; ++_First)
this->insert(*_First);
}
};
template<class _Kty,
class _Tr,
class _Alloc> inline
void swap(_STDEXT hash_set<_Kty, _Tr, _Alloc>& _Left,
_STDEXT hash_set<_Kty, _Tr, _Alloc>& _Right)
{ // swap _Left and _Right hash_sets
_Left.swap(_Right);
}
// TEMPLATE CLASS hash_multiset
template<class _Kty,
class _Tr = hash_compare<_Kty, _STD less<_Kty> >,
class _Alloc = _STD allocator<_Kty> >
class hash_multiset
: public _Hash<_Hset_traits<_Kty, _Tr, _Alloc, true> >
{ // hash table of key values, non-unique keys
public:
typedef hash_multiset<_Kty, _Tr, _Alloc> _Myt;
typedef _Hash<_Hset_traits<_Kty, _Tr, _Alloc, true> > _Mybase;
typedef _Kty key_type;
typedef _Tr key_compare;
typedef typename _Mybase::value_compare value_compare;
typedef typename _Mybase::allocator_type allocator_type;
typedef typename _Mybase::size_type size_type;
typedef typename _Mybase::difference_type difference_type;
typedef typename _Mybase::pointer pointer;
typedef typename _Mybase::const_pointer const_pointer;
typedef typename _Mybase::reference reference;
typedef typename _Mybase::const_reference const_reference;
typedef typename _Mybase::iterator iterator;
typedef typename _Mybase::const_iterator const_iterator;
typedef typename _Mybase::reverse_iterator reverse_iterator;
typedef typename _Mybase::const_reverse_iterator
const_reverse_iterator;
typedef typename _Mybase::value_type value_type;
hash_multiset()
: _Mybase(key_compare(), allocator_type())
{ // construct empty set from defaults
}
explicit hash_multiset(const key_compare& _Traits)
: _Mybase(_Traits, allocator_type())
{ // construct empty set from comparator
}
hash_multiset(const key_compare& _Traits,
const allocator_type& _Al)
: _Mybase(_Traits, _Al)
{ // construct empty set from comparator and allocator
}
template<class _Iter>
hash_multiset(_Iter _First, _Iter _Last)
: _Mybase(key_compare(), allocator_type())
{ // construct from sequence, defaults
for (; _First != _Last; ++_First)
this->insert(*_First);
}
template<class _Iter>
hash_multiset(_Iter _First, _Iter _Last,
const key_compare& _Traits)
: _Mybase(_Traits, allocator_type())
{ // construct from sequence, comparator
for (; _First != _Last; ++_First)
this->insert(*_First);
}
template<class _Iter>
hash_multiset(_Iter _First, _Iter _Last,
const key_compare& _Traits, const allocator_type& _Al)
: _Mybase(_Traits, _Al)
{ // construct from sequence, comparator, and allocator
for (; _First != _Last; ++_First)
this->insert(*_First);
}
iterator insert(const value_type& _Val)
{ // insert a key value
return (_Mybase::insert(_Val).first);
}
iterator insert(iterator _Where, const value_type& _Val)
{ // insert a key value, with hint
return (_Mybase::insert(_Where, _Val));
}
template<class _Iter>
void insert(_Iter _First, _Iter _Last)
{ // insert [_First, _Last), arbitrary iterators
for (; _First != _Last; ++_First)
insert(*_First);
}
};
template<class _Kty,
class _Tr,
class _Alloc> inline
void swap(_STDEXT hash_multiset<_Kty, _Tr, _Alloc>& _Left,
_STDEXT hash_multiset<_Kty, _Tr, _Alloc>& _Right)
{ // swap _Left and _Right hash_multisets
_Left.swap(_Right);
}
_STDEXT_END
#ifdef _MSC_EXTENSIONS
#if _DEFINE_DEPRECATED_HASH_CLASSES
#pragma warning(push)
#pragma warning(disable: 4996)
_STD_BEGIN
// TEMPLATE CLASS hash_set
template<class _Kty,
class _Tr = _STDEXT hash_compare<_Kty, less<_Kty> >,
class _Alloc = allocator<_Kty> >
class _DEPRECATED hash_set
: public _STDEXT _Hash< _STDEXT _Hset_traits<_Kty, _Tr, _Alloc, false> >
{ // hash table of key values, unique keys
public:
typedef hash_set<_Kty, _Tr, _Alloc> _Myt;
typedef _STDEXT _Hash< _STDEXT _Hset_traits<_Kty, _Tr, _Alloc, false> > _Mybase;
typedef _Kty key_type;
typedef _Tr key_compare;
typedef typename _Mybase::value_compare value_compare;
typedef typename _Mybase::allocator_type allocator_type;
typedef typename _Mybase::size_type size_type;
typedef typename _Mybase::difference_type difference_type;
typedef typename _Mybase::pointer pointer;
typedef typename _Mybase::const_pointer const_pointer;
typedef typename _Mybase::reference reference;
typedef typename _Mybase::const_reference const_reference;
typedef typename _Mybase::iterator iterator;
typedef typename _Mybase::const_iterator const_iterator;
typedef typename _Mybase::reverse_iterator reverse_iterator;
typedef typename _Mybase::const_reverse_iterator
const_reverse_iterator;
typedef typename _Mybase::value_type value_type;
hash_set()
: _Mybase(key_compare(), allocator_type())
{ // construct empty set from defaults
}
explicit hash_set(const key_compare& _Traits)
: _Mybase(_Traits, allocator_type())
{ // construct empty set from comparator
}
hash_set(const key_compare& _Traits, const allocator_type& _Al)
: _Mybase(_Traits, _Al)
{ // construct empty set from comparator and allocator
}
template<class _Iter>
hash_set(_Iter _First, _Iter _Last)
: _Mybase(key_compare(), allocator_type())
{ // construct set from sequence, defaults
for (; _First != _Last; ++_First)
this->insert(*_First);
}
template<class _Iter>
hash_set(_Iter _First, _Iter _Last,
const key_compare& _Traits)
: _Mybase(_Traits, allocator_type())
{ // construct set from sequence, comparator
for (; _First != _Last; ++_First)
this->insert(*_First);
}
template<class _Iter>
hash_set(_Iter _First, _Iter _Last,
const key_compare& _Traits, const allocator_type& _Al)
: _Mybase(_Traits, _Al)
{ // construct set from sequence, comparator, and allocator
for (; _First != _Last; ++_First)
this->insert(*_First);
}
};
template<class _Kty,
class _Tr,
class _Alloc> inline
void swap(hash_set<_Kty, _Tr, _Alloc>& _Left,
hash_set<_Kty, _Tr, _Alloc>& _Right)
{ // swap _Left and _Right hash_sets
_Left.swap(_Right);
}
// TEMPLATE CLASS hash_multiset
template<class _Kty,
class _Tr = _STDEXT hash_compare<_Kty, less<_Kty> >,
class _Alloc = allocator<_Kty> >
class _DEPRECATED hash_multiset
: public _STDEXT _Hash< _STDEXT _Hset_traits<_Kty, _Tr, _Alloc, true> >
{ // hash table of key values, non-unique keys
public:
typedef hash_multiset<_Kty, _Tr, _Alloc> _Myt;
typedef _STDEXT _Hash< _STDEXT _Hset_traits<_Kty, _Tr, _Alloc, true> > _Mybase;
typedef _Kty key_type;
typedef _Tr key_compare;
typedef typename _Mybase::value_compare value_compare;
typedef typename _Mybase::allocator_type allocator_type;
typedef typename _Mybase::size_type size_type;
typedef typename _Mybase::difference_type difference_type;
typedef typename _Mybase::pointer pointer;
typedef typename _Mybase::const_pointer const_pointer;
typedef typename _Mybase::reference reference;
typedef typename _Mybase::const_reference const_reference;
typedef typename _Mybase::iterator iterator;
typedef typename _Mybase::const_iterator const_iterator;
typedef typename _Mybase::reverse_iterator reverse_iterator;
typedef typename _Mybase::const_reverse_iterator
const_reverse_iterator;
typedef typename _Mybase::value_type value_type;
hash_multiset()
: _Mybase(key_compare(), allocator_type())
{ // construct empty set from defaults
}
explicit hash_multiset(const key_compare& _Traits)
: _Mybase(_Traits, allocator_type())
{ // construct empty set from comparator
}
hash_multiset(const key_compare& _Traits,
const allocator_type& _Al)
: _Mybase(_Traits, _Al)
{ // construct empty set from comparator and allocator
}
template<class _Iter>
hash_multiset(_Iter _First, _Iter _Last)
: _Mybase(key_compare(), allocator_type())
{ // construct from sequence, defaults
for (; _First != _Last; ++_First)
this->insert(*_First);
}
template<class _Iter>
hash_multiset(_Iter _First, _Iter _Last,
const key_compare& _Traits)
: _Mybase(_Traits, allocator_type())
{ // construct from sequence, comparator
for (; _First != _Last; ++_First)
this->insert(*_First);
}
template<class _Iter>
hash_multiset(_Iter _First, _Iter _Last,
const key_compare& _Traits, const allocator_type& _Al)
: _Mybase(_Traits, _Al)
{ // construct from sequence, comparator, and allocator
for (; _First != _Last; ++_First)
this->insert(*_First);
}
iterator insert(const value_type& _Val)
{ // insert a key value
return (_Mybase::insert(_Val).first);
}
iterator insert(iterator _Where, const value_type& _Val)
{ // insert a key value, with hint
return (_Mybase::insert(_Where, _Val));
}
template<class _Iter>
void insert(_Iter _First, _Iter _Last)
{ // insert [_First, _Last), arbitrary iterators
for (; _First != _Last; ++_First)
insert(*_First);
}
};
template<class _Kty,
class _Tr,
class _Alloc> inline
void swap(hash_multiset<_Kty, _Tr, _Alloc>& _Left,
hash_multiset<_Kty, _Tr, _Alloc>& _Right)
{ // swap _Left and _Right hash_multisets
_Left.swap(_Right);
}
_STD_END
#pragma warning(pop)
#endif /* _DEFINE_DEPRECATED_HASH_CLASSES */
#endif /* _MSC_EXTENSIONS */
#pragma warning(pop)
#pragma pack(pop)
#endif /* _HASH_SET_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

View File

@@ -0,0 +1,290 @@
/***
*io.h - declarations for low-level file handling and I/O functions
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file contains the function declarations for the low-level
* file handling and I/O functions.
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_IO
#define _INC_IO
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
#ifdef _MSC_VER
/*
* Currently, all MS C compilers for Win32 platforms default to 8 byte
* alignment.
*/
#pragma pack(push,8)
#endif /* _MSC_VER */
#ifndef _POSIX_
#ifdef __cplusplus
extern "C" {
#endif
#if !defined(_W64)
#if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
#define _W64 __w64
#else
#define _W64
#endif
#endif
/* Define _CRTIMP */
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* ndef _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* _CRTIMP */
/* Define __cdecl for non-Microsoft compilers */
#if ( !defined(_MSC_VER) && !defined(__cdecl) )
#define __cdecl
#endif
#ifndef _INTPTR_T_DEFINED
#ifdef _WIN64
typedef __int64 intptr_t;
#else
typedef _W64 int intptr_t;
#endif
#define _INTPTR_T_DEFINED
#endif
#ifndef _WCHAR_T_DEFINED
typedef unsigned short wchar_t;
#define _WCHAR_T_DEFINED
#endif
#ifndef _TIME_T_DEFINED
#ifdef _WIN64
typedef __int64 time_t; /* time value */
#else
typedef _W64 long time_t; /* time value */
#endif
#define _TIME_T_DEFINED /* avoid multiple def's of time_t */
#endif
#ifndef _TIME64_T_DEFINED
#if _INTEGRAL_MAX_BITS >= 64
typedef __int64 __time64_t; /* 64-bit time value */
#endif
#define _TIME64_T_DEFINED
#endif
#ifndef _FSIZE_T_DEFINED
typedef unsigned long _fsize_t; /* Could be 64 bits for Win32 */
#define _FSIZE_T_DEFINED
#endif
#ifndef _FINDDATA_T_DEFINED
struct _finddata_t {
unsigned attrib;
time_t time_create; /* -1 for FAT file systems */
time_t time_access; /* -1 for FAT file systems */
time_t time_write;
_fsize_t size;
char name[260];
};
#if _INTEGRAL_MAX_BITS >= 64
struct _finddatai64_t {
unsigned attrib;
time_t time_create; /* -1 for FAT file systems */
time_t time_access; /* -1 for FAT file systems */
time_t time_write;
__int64 size;
char name[260];
};
struct __finddata64_t {
unsigned attrib;
__time64_t time_create; /* -1 for FAT file systems */
__time64_t time_access; /* -1 for FAT file systems */
__time64_t time_write;
__int64 size;
char name[260];
};
#endif
#define _FINDDATA_T_DEFINED
#endif
#ifndef _WFINDDATA_T_DEFINED
struct _wfinddata_t {
unsigned attrib;
time_t time_create; /* -1 for FAT file systems */
time_t time_access; /* -1 for FAT file systems */
time_t time_write;
_fsize_t size;
wchar_t name[260];
};
#if _INTEGRAL_MAX_BITS >= 64
struct _wfinddatai64_t {
unsigned attrib;
time_t time_create; /* -1 for FAT file systems */
time_t time_access; /* -1 for FAT file systems */
time_t time_write;
__int64 size;
wchar_t name[260];
};
struct __wfinddata64_t {
unsigned attrib;
__time64_t time_create; /* -1 for FAT file systems */
__time64_t time_access; /* -1 for FAT file systems */
__time64_t time_write;
__int64 size;
wchar_t name[260];
};
#endif
#define _WFINDDATA_T_DEFINED
#endif
/* File attribute constants for _findfirst() */
#define _A_NORMAL 0x00 /* Normal file - No read/write restrictions */
#define _A_RDONLY 0x01 /* Read only file */
#define _A_HIDDEN 0x02 /* Hidden file */
#define _A_SYSTEM 0x04 /* System file */
#define _A_SUBDIR 0x10 /* Subdirectory */
#define _A_ARCH 0x20 /* Archive file */
/* function prototypes */
_CRTIMP int __cdecl _access(const char *, int);
_CRTIMP int __cdecl _chmod(const char *, int);
_CRTIMP int __cdecl _chsize(int, long);
_CRTIMP int __cdecl _close(int);
_CRTIMP int __cdecl _commit(int);
_CRTIMP int __cdecl _creat(const char *, int);
_CRTIMP int __cdecl _dup(int);
_CRTIMP int __cdecl _dup2(int, int);
_CRTIMP int __cdecl _eof(int);
_CRTIMP long __cdecl _filelength(int);
_CRTIMP intptr_t __cdecl _findfirst(const char *, struct _finddata_t *);
_CRTIMP int __cdecl _findnext(intptr_t, struct _finddata_t *);
_CRTIMP int __cdecl _findclose(intptr_t);
_CRTIMP int __cdecl _isatty(int);
_CRTIMP int __cdecl _locking(int, int, long);
_CRTIMP long __cdecl _lseek(int, long, int);
_CRTIMP char * __cdecl _mktemp(char *);
_CRTIMP int __cdecl _open(const char *, int, ...);
_CRTIMP int __cdecl _pipe(int *, unsigned int, int);
_CRTIMP int __cdecl _read(int, void *, unsigned int);
_CRTIMP int __cdecl remove(const char *);
_CRTIMP int __cdecl rename(const char *, const char *);
_CRTIMP int __cdecl _setmode(int, int);
_CRTIMP int __cdecl _sopen(const char *, int, int, ...);
_CRTIMP long __cdecl _tell(int);
_CRTIMP int __cdecl _umask(int);
_CRTIMP int __cdecl _unlink(const char *);
_CRTIMP int __cdecl _write(int, const void *, unsigned int);
#if _INTEGRAL_MAX_BITS >= 64
_CRTIMP __int64 __cdecl _filelengthi64(int);
_CRTIMP intptr_t __cdecl _findfirsti64(const char *, struct _finddatai64_t *);
_CRTIMP intptr_t __cdecl _findfirst64(const char *, struct __finddata64_t *);
_CRTIMP int __cdecl _findnexti64(intptr_t, struct _finddatai64_t *);
_CRTIMP int __cdecl _findnext64(intptr_t, struct __finddata64_t *);
_CRTIMP __int64 __cdecl _lseeki64(int, __int64, int);
_CRTIMP __int64 __cdecl _telli64(int);
#endif
#ifndef _WIO_DEFINED
/* wide function prototypes, also declared in wchar.h */
_CRTIMP int __cdecl _waccess(const wchar_t *, int);
_CRTIMP int __cdecl _wchmod(const wchar_t *, int);
_CRTIMP int __cdecl _wcreat(const wchar_t *, int);
_CRTIMP intptr_t __cdecl _wfindfirst(const wchar_t *, struct _wfinddata_t *);
_CRTIMP int __cdecl _wfindnext(intptr_t, struct _wfinddata_t *);
_CRTIMP int __cdecl _wunlink(const wchar_t *);
_CRTIMP int __cdecl _wrename(const wchar_t *, const wchar_t *);
_CRTIMP int __cdecl _wopen(const wchar_t *, int, ...);
_CRTIMP int __cdecl _wsopen(const wchar_t *, int, int, ...);
_CRTIMP wchar_t * __cdecl _wmktemp(wchar_t *);
#if _INTEGRAL_MAX_BITS >= 64
_CRTIMP intptr_t __cdecl _wfindfirsti64(const wchar_t *, struct _wfinddatai64_t *);
_CRTIMP int __cdecl _wfindnexti64(intptr_t, struct _wfinddatai64_t *);
_CRTIMP intptr_t __cdecl _wfindfirst64(const wchar_t *, struct __wfinddata64_t *);
_CRTIMP int __cdecl _wfindnext64(intptr_t, struct __wfinddata64_t *);
#endif
#define _WIO_DEFINED
#endif
_CRTIMP intptr_t __cdecl _get_osfhandle(int);
_CRTIMP int __cdecl _open_osfhandle(intptr_t, int);
#if !__STDC__
/* Non-ANSI names for compatibility */
_CRTIMP int __cdecl access(const char *, int);
_CRTIMP int __cdecl chmod(const char *, int);
_CRTIMP int __cdecl chsize(int, long);
_CRTIMP int __cdecl close(int);
_CRTIMP int __cdecl creat(const char *, int);
_CRTIMP int __cdecl dup(int);
_CRTIMP int __cdecl dup2(int, int);
_CRTIMP int __cdecl eof(int);
_CRTIMP long __cdecl filelength(int);
_CRTIMP int __cdecl isatty(int);
_CRTIMP int __cdecl locking(int, int, long);
_CRTIMP long __cdecl lseek(int, long, int);
_CRTIMP char * __cdecl mktemp(char *);
_CRTIMP int __cdecl open(const char *, int, ...);
_CRTIMP int __cdecl read(int, void *, unsigned int);
_CRTIMP int __cdecl setmode(int, int);
_CRTIMP int __cdecl sopen(const char *, int, int, ...);
_CRTIMP long __cdecl tell(int);
_CRTIMP int __cdecl umask(int);
_CRTIMP int __cdecl unlink(const char *);
_CRTIMP int __cdecl write(int, const void *, unsigned int);
#endif /* __STDC__ */
#ifdef __cplusplus
}
#endif
#endif /* _POSIX_ */
#ifdef _MSC_VER
#pragma pack(pop)
#endif /* _MSC_VER */
#endif /* _INC_IO */

View File

@@ -0,0 +1,92 @@
// iomanip standard header
#pragma once
#ifndef _IOMANIP_
#define _IOMANIP_
#include <istream>
#pragma pack(push,8)
#pragma warning(push,3)
_STD_BEGIN
// TEMPLATE STRUCT _Fillobj
template<class _Elem>
struct _Fillobj
{ // store fill character
_Fillobj(_Elem _Ch)
: _Fill(_Ch)
{ // construct from fill character
}
_Elem _Fill; // the fill character
};
// TEMPLATE FUNCTION setfill
template<class _Elem> inline
_Fillobj<_Elem> __cdecl setfill(_Elem _Ch)
{ // return a _Fillobj manipulator
return (_Fillobj<_Elem>(_Ch));
}
template<class _Elem, class _Traits> inline
basic_istream<_Elem, _Traits>&
__cdecl operator>>(basic_istream<_Elem, _Traits>& _Istr,
const _Fillobj<_Elem>& _Manip)
{ // set fill character in input stream
_Istr.fill(_Manip._Fill);
return (_Istr);
}
template<class _Elem, class _Traits> inline
basic_ostream<_Elem, _Traits>&
__cdecl operator<<(basic_ostream<_Elem, _Traits>& _Ostr,
const _Fillobj<_Elem>& _Manip)
{ // set fill character in output stream
_Ostr.fill(_Manip._Fill);
return (_Ostr);
}
// TEMPLATE STRUCT _Smanip
template<class _Arg>
struct _Smanip
{ // store function pointer and argument value
_Smanip(void (__cdecl *_Left)(ios_base&, _Arg), _Arg _Val)
: _Pfun(_Left), _Manarg(_Val)
{ // construct from function pointer and argument value
}
void (__cdecl *_Pfun)(ios_base&, _Arg); // the function pointer
_Arg _Manarg; // the argument value
};
template<class _Elem, class _Traits, class _Arg> inline
basic_istream<_Elem, _Traits>& __cdecl operator>>(
basic_istream<_Elem, _Traits>& _Istr, const _Smanip<_Arg>& _Manip)
{ // extract by calling function with input stream and argument
(*_Manip._Pfun)(_Istr, _Manip._Manarg);
return (_Istr);
}
template<class _Elem, class _Traits, class _Arg> inline
basic_ostream<_Elem, _Traits>& __cdecl operator<<(
basic_ostream<_Elem, _Traits>& _Ostr, const _Smanip<_Arg>& _Manip)
{ // insert by calling function with output stream and argument
(*_Manip._Pfun)(_Ostr, _Manip._Manarg);
return (_Ostr);
}
// INSTANTIATIONS
_CRTIMP2 _Smanip<ios_base::fmtflags> __cdecl resetiosflags(ios_base::fmtflags);
_CRTIMP2 _Smanip<ios_base::fmtflags> __cdecl setiosflags(ios_base::fmtflags);
_CRTIMP2 _Smanip<int> __cdecl setbase(int);
_CRTIMP2 _Smanip<streamsize> __cdecl setprecision(streamsize);
_CRTIMP2 _Smanip<streamsize> __cdecl setw(streamsize);
_STD_END
#pragma warning(pop)
#pragma pack(pop)
#endif /* _IOMANIP_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

View File

@@ -0,0 +1,307 @@
// ios standard header
#pragma once
#ifndef _IOS_
#define _IOS_
#include <xlocnum>
#pragma pack(push,8)
#pragma warning(push,3)
_STD_BEGIN
// TEMPLATE CLASS basic_ios
template<class _Elem,
class _Traits>
class basic_ios
: public ios_base
{ // base class for basic_istream/basic_ostream
public:
typedef basic_ios<_Elem, _Traits> _Myt;
typedef basic_ostream<_Elem, _Traits> _Myos;
typedef basic_streambuf<_Elem, _Traits> _Mysb;
typedef ctype<_Elem> _Ctype;
typedef _Elem char_type;
typedef _Traits traits_type;
typedef typename _Traits::int_type int_type;
typedef typename _Traits::pos_type pos_type;
typedef typename _Traits::off_type off_type;
explicit basic_ios(_Mysb *_Strbuf)
{ // construct from stream buffer pointer
init(_Strbuf);
}
virtual ~basic_ios()
{ // destroy the object
}
void clear(iostate _State = goodbit, bool _Except = false)
{ // set state, possibly reraise exception
ios_base::clear((iostate)(_Mystrbuf == 0
? (int)_State | (int)badbit : (int)_State), _Except);
}
void clear(io_state _State)
{ // set state to _State
clear((iostate)_State);
}
void setstate(iostate _State, bool _Except = false)
{ // merge _State into state, possible reraise exception
if (_State != goodbit)
clear((iostate)((int)rdstate() | (int)_State), _Except);
}
void setstate(io_state _State)
{ // merge _State into state
setstate((iostate)_State);
}
_Myt& copyfmt(const _Myt& _Right)
{ // copy format parameters
_Tiestr = _Right.tie();
_Fillch = _Right.fill();
ios_base::copyfmt(_Right);
return (*this);
}
_Myos *tie() const
{ // return tie pointer
return (_Tiestr);
}
_Myos *tie(_Myos *_Newtie)
{ // set tie pointer
_Myos *_Oldtie = _Tiestr;
_Tiestr = _Newtie;
return (_Oldtie);
}
_Mysb *rdbuf() const
{ // return stream buffer pointer
return (_Mystrbuf);
}
_Mysb *rdbuf(_Mysb *_Strbuf)
{ // set stream buffer pointer
_Mysb *_Oldstrbuf = _Mystrbuf;
_Mystrbuf = _Strbuf;
clear();
return (_Oldstrbuf);
}
locale imbue(const locale& _Loc)
{ // set locale to argument
locale _Oldlocale = ios_base::imbue(_Loc);
if (rdbuf() != 0)
rdbuf()->pubimbue(_Loc);
return (_Oldlocale);
}
_Elem fill() const
{ // return fill character
return (_Fillch);
}
_Elem fill(_Elem _Newfill)
{ // set fill character
_Elem _Oldfill = _Fillch;
_Fillch = _Newfill;
return (_Oldfill);
}
char narrow(_Elem _Ch, char _Dflt = '\0') const
{ // convert _Ch to byte using imbued locale
const _Ctype& _Ctype_fac = _USE(getloc(), _Ctype);
return (_Ctype_fac.narrow(_Ch, _Dflt));
}
_Elem widen(char _Byte) const
{ // convert _Byte to character using imbued locale
const _Ctype& _Ctype_fac = _USE(getloc(), _Ctype);
return (_Ctype_fac.widen(_Byte));
}
protected:
void init(_Mysb *_Strbuf = 0,
bool _Isstd = false)
{ // initialize with stream buffer pointer
_Init(); // initialize ios_base
_Mystrbuf = _Strbuf;
_Tiestr = 0;
_Fillch = widen(' ');
if (_Mystrbuf == 0)
setstate(badbit);
if (_Isstd)
_Addstd(); // special handling for standard streams
else
_Stdstr = 0;
}
basic_ios()
{ // default constructor, do nothing
}
private:
basic_ios(const _Myt&); // not defined
_Myt& operator=(const _Myt&); // not defined
_Mysb *_Mystrbuf; // pointer to stream buffer
_Myos *_Tiestr; // pointer to tied output stream
_Elem _Fillch; // the fill character
};
#ifdef _DLL_CPPLIB
template class _CRTIMP2 basic_ios<char,
char_traits<char> >;
template class _CRTIMP2 basic_ios<wchar_t,
char_traits<wchar_t> >;
#endif /* _DLL_CPPLIB */
// MANIPULATORS
inline ios_base& __cdecl boolalpha(ios_base& _Iosbase)
{ // set boolalpha
_Iosbase.setf(ios_base::boolalpha);
return (_Iosbase);
}
inline ios_base& __cdecl dec(ios_base& _Iosbase)
{ // set basefield to dec
_Iosbase.setf(ios_base::dec, ios_base::basefield);
return (_Iosbase);
}
inline ios_base& __cdecl fixed(ios_base& _Iosbase)
{ // set floatfield to fixed
_Iosbase.setf(ios_base::fixed, ios_base::floatfield);
return (_Iosbase);
}
inline ios_base& __cdecl hex(ios_base& _Iosbase)
{ // set basefield to hex
_Iosbase.setf(ios_base::hex, ios_base::basefield);
return (_Iosbase);
}
inline ios_base& __cdecl internal(ios_base& _Iosbase)
{ // set adjustfield to internal
_Iosbase.setf(ios_base::internal, ios_base::adjustfield);
return (_Iosbase);
}
inline ios_base& __cdecl left(ios_base& _Iosbase)
{ // set adjustfield to left
_Iosbase.setf(ios_base::left, ios_base::adjustfield);
return (_Iosbase);
}
inline ios_base& __cdecl noboolalpha(ios_base& _Iosbase)
{ // clear boolalpha
_Iosbase.unsetf(ios_base::boolalpha);
return (_Iosbase);
}
inline ios_base& __cdecl noshowbase(ios_base& _Iosbase)
{ // clear showbase
_Iosbase.unsetf(ios_base::showbase);
return (_Iosbase);
}
inline ios_base& __cdecl noshowpoint(ios_base& _Iosbase)
{ // clear showpoint
_Iosbase.unsetf(ios_base::showpoint);
return (_Iosbase);
}
inline ios_base& __cdecl noshowpos(ios_base& _Iosbase)
{ // clear showpos
_Iosbase.unsetf(ios_base::showpos);
return (_Iosbase);
}
inline ios_base& __cdecl noskipws(ios_base& _Iosbase)
{ // clear skipws
_Iosbase.unsetf(ios_base::skipws);
return (_Iosbase);
}
inline ios_base& __cdecl nounitbuf(ios_base& _Iosbase)
{ // clear unitbuf
_Iosbase.unsetf(ios_base::unitbuf);
return (_Iosbase);
}
inline ios_base& __cdecl nouppercase(ios_base& _Iosbase)
{ // clear uppercase
_Iosbase.unsetf(ios_base::uppercase);
return (_Iosbase);
}
inline ios_base& __cdecl oct(ios_base& _Iosbase)
{ // set oct in basefield
_Iosbase.setf(ios_base::oct, ios_base::basefield);
return (_Iosbase);
}
inline ios_base& __cdecl right(ios_base& _Iosbase)
{ // set right in adjustfield
_Iosbase.setf(ios_base::right, ios_base::adjustfield);
return (_Iosbase);
}
inline ios_base& __cdecl scientific(ios_base& _Iosbase)
{ // set scientific in floatfield
_Iosbase.setf(ios_base::scientific, ios_base::floatfield);
return (_Iosbase);
}
inline ios_base& __cdecl showbase(ios_base& _Iosbase)
{ // set showbase
_Iosbase.setf(ios_base::showbase);
return (_Iosbase);
}
inline ios_base& __cdecl showpoint(ios_base& _Iosbase)
{ // set showpoint
_Iosbase.setf(ios_base::showpoint);
return (_Iosbase);
}
inline ios_base& __cdecl showpos(ios_base& _Iosbase)
{ // set showpos
_Iosbase.setf(ios_base::showpos);
return (_Iosbase);
}
inline ios_base& __cdecl skipws(ios_base& _Iosbase)
{ // set skipws
_Iosbase.setf(ios_base::skipws);
return (_Iosbase);
}
inline ios_base& __cdecl unitbuf(ios_base& _Iosbase)
{ // set unitbuf
_Iosbase.setf(ios_base::unitbuf);
return (_Iosbase);
}
inline ios_base& __cdecl uppercase(ios_base& _Iosbase)
{ // set uppercase
_Iosbase.setf(ios_base::uppercase);
return (_Iosbase);
}
_STD_END
#pragma warning(pop)
#pragma pack(pop)
#endif /* _IOS_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

View File

@@ -0,0 +1,533 @@
// iosfwd standard header
#pragma once
#ifndef _IOSFWD_
#define _IOSFWD_
#include <cstdio>
#include <cstring>
#include <cwchar>
#include <xstddef>
#pragma pack(push,8)
#pragma warning(push,3)
_STD_BEGIN
// STREAM POSITIONING TYPES (from <streambuf>)
#ifdef _WIN64
typedef __int64 streamoff;
typedef __int64 streamsize;
#else /* _WIN64 */
typedef long streamoff;
typedef int streamsize;
#endif /* _WIN64 */
extern _CRTIMP2 fpos_t _Fpz;
extern _CRTIMP2 const streamoff _BADOFF;
// TEMPLATE CLASS fpos (from <streambuf>)
template<class _Statetype>
class fpos
{ // store arbitrary file position
typedef fpos<_Statetype> _Myt;
public:
fpos(streamoff _Off = 0)
: _Myoff(_Off), _Fpos(_Fpz), _Mystate(_Stz)
{ // construct with stream offset
}
fpos(_Statetype _State, fpos_t _Fileposition)
: _Myoff(0), _Fpos(_Fileposition), _Mystate(_State)
{ // construct with conversion state and C file position
}
_Statetype state() const
{ // return conversion state
return (_Mystate);
}
void state(_Statetype _State)
{ // set conversion state
_Mystate = _State;
}
fpos_t seekpos() const
{ // return C file position
return (_Fpos);
}
operator streamoff() const
{ // return offset
return (_Myoff + _FPOSOFF(_Fpos));
}
streamoff operator-(const _Myt& _Right) const
{ // return difference of file positions as an offset
return ((streamoff)*this - (streamoff)_Right);
}
_Myt& operator+=(streamoff _Off)
{ // add offset
_Myoff += _Off;
return (*this);
}
_Myt& operator-=(streamoff _Off)
{ // subtract offset
_Myoff -= _Off;
return (*this);
}
_Myt operator+(streamoff _Off) const
{ // return this + offset
_Myt _Tmp = *this;
return (_Tmp += _Off);
}
_Myt operator-(streamoff _Off) const
{ // return this - offset
_Myt _Tmp = *this;
return (_Tmp -= _Off);
}
bool operator==(const _Myt& _Right) const
{ // test for file position equality
return ((streamoff)*this == (streamoff)_Right);
}
bool operator!=(const _Myt& _Right) const
{ // test for file position inequality
return (!(*this == _Right));
}
private:
static _Statetype _Stz; // initial conversion state
streamoff _Myoff; // stream offset
fpos_t _Fpos; // C file position
_Statetype _Mystate; // current conversion state
};
// STATIC fpos::_Stz OBJECT
template<class _Statetype>
_Statetype fpos<_Statetype>::_Stz;
#define _POS_TYPE_FROM_STATE(postype, state, position) \
postype(state, position)
#define _POS_TYPE_TO_FPOS_T(pos) pos.seekpos()
#define _POS_TYPE_TO_STATE(pos) pos.state()
typedef fpos<mbstate_t> streampos;
typedef streampos wstreampos;
// TEMPLATE STRUCT char_traits (FROM <string>)
template<class _Elem>
struct char_traits
{ // properties of a string or stream element
typedef _Elem char_type;
typedef _Elem int_type;
typedef streampos pos_type;
typedef streamoff off_type;
typedef mbstate_t state_type;
static void __cdecl assign(_Elem& _Left, const _Elem& _Right)
{ // assign an element
_Left = _Right;
}
static bool __cdecl eq(const _Elem& _Left, const _Elem& _Right)
{ // test for element equality
return (_Left == _Right);
}
static bool __cdecl lt(const _Elem& _Left, const _Elem& _Right)
{ // test if _Left precedes _Right
return (_Left < _Right);
}
static int __cdecl compare(const _Elem *_First1,
const _Elem *_First2, size_t _Count)
{ // compare [_First1, _First1 + _Count) with [_First2, ...)
for (; 0 < _Count; --_Count, ++_First1, ++_First2)
if (!eq(*_First1, *_First2))
return (lt(*_First1, *_First2) ? -1 : +1);
return (0);
}
static size_t __cdecl length(const _Elem *_First)
{ // find length of null-terminated sequence
size_t _Count;
for (_Count = 0; !eq(*_First, _Elem()); ++_First)
++_Count;
return (_Count);
}
static _Elem *__cdecl copy(_Elem *_First1,
const _Elem *_First2, size_t _Count)
{ // copy [_First1, _First1 + _Count) to [_First2, ...)
_Elem *_Next = _First1;
for (; 0 < _Count; --_Count, ++_Next, ++_First2)
assign(*_Next, *_First2);
return (_First1);
}
static const _Elem *__cdecl find(const _Elem *_First,
size_t _Count, const _Elem& _Ch)
{ // look for _Ch in [_First, _First + _Count)
for (; 0 < _Count; --_Count, ++_First)
if (eq(*_First, _Ch))
return (_First);
return (0);
}
static _Elem *__cdecl move(_Elem *_First1,
const _Elem *_First2, size_t _Count)
{ // copy [_First1, _First1 + _Count) to [_First2, ...)
_Elem *_Next = _First1;
if (_First2 < _Next && _Next < _First2 + _Count)
for (_Next += _Count, _First2 += _Count; 0 < _Count; --_Count)
assign(*--_Next, *--_First2);
else
for (; 0 < _Count; --_Count, ++_Next, ++_First2)
assign(*_Next, *_First2);
return (_First1);
}
static _Elem *__cdecl assign(_Elem *_First,
size_t _Count, _Elem _Ch)
{ // assign _Count * _Ch to [_First, ...)
_Elem *_Next = _First;
for (; 0 < _Count; --_Count, ++_Next)
assign(*_Next, _Ch);
return (_First);
}
static _Elem __cdecl to_char_type(const int_type& _Meta)
{ // convert metacharacter to character
return (_Meta);
}
static int_type __cdecl to_int_type(const _Elem& _Ch)
{ // convert character to metacharacter
return (_Ch);
}
static bool __cdecl eq_int_type(const int_type& _Left,
const int_type& _Right)
{ // test for metacharacter equality
return (_Left == _Right);
}
static int_type __cdecl eof()
{ // return end-of-file metacharacter
return ((int_type)EOF);
}
static int_type __cdecl not_eof(const int_type& _Meta)
{ // return anything but EOF
return (_Meta != eof() ? _Meta : !eof());
}
};
// STRUCT char_traits<wchar_t>
template<> struct _CRTIMP2 char_traits<wchar_t>
{ // properties of a string or stream wchar_t element
typedef wchar_t _Elem;
typedef _Elem char_type; // for overloads
typedef wint_t int_type;
typedef streampos pos_type;
typedef streamoff off_type;
typedef mbstate_t state_type;
static void __cdecl assign(_Elem& _Left, const _Elem& _Right)
{ // assign an element
_Left = _Right;
}
static bool __cdecl eq(const _Elem& _Left, const _Elem& _Right)
{ // test for element equality
return (_Left == _Right);
}
static bool __cdecl lt(const _Elem& _Left, const _Elem& _Right)
{ // test if _Left precedes _Right
return (_Left < _Right);
}
static int __cdecl compare(const _Elem *_First1, const _Elem *_First2,
size_t _Count)
{ // compare [_First1, _First1 + _Count) with [_First2, ...)
return (::wmemcmp(_First1, _First2, _Count));
}
static size_t __cdecl length(const _Elem *_First)
{ // find length of null-terminated sequence
return (::wcslen(_First));
}
static _Elem *__cdecl copy(_Elem *_First1, const _Elem *_First2,
size_t _Count)
{ // copy [_First1, _First1 + _Count) to [_First2, ...)
return (::wmemcpy(_First1, _First2, _Count));
}
static const _Elem *__cdecl find(const _Elem *_First, size_t _Count,
const _Elem& _Ch)
{ // look for _Ch in [_First, _First + _Count)
return ((const _Elem *)::wmemchr(_First, _Ch, _Count));
}
static _Elem *__cdecl move(_Elem *_First1, const _Elem *_First2,
size_t _Count)
{ // copy [_First1, _First1 + _Count) to [_First2, ...)
return (::wmemmove(_First1, _First2, _Count));
}
static _Elem *__cdecl assign(_Elem *_First, size_t _Count, _Elem _Ch)
{ // assign _Count * _Ch to [_First, ...)
return (::wmemset(_First, _Ch, _Count));
}
static _Elem __cdecl to_char_type(const int_type& _Meta)
{ // convert metacharacter to character
return (_Meta);
}
static int_type __cdecl to_int_type(const _Elem& _Ch)
{ // convert character to metacharacter
return (_Ch);
}
static bool __cdecl eq_int_type(const int_type& _Left,
const int_type& _Right)
{ // test for metacharacter equality
return (_Left == _Right);
}
static int_type __cdecl eof()
{ // return end-of-file metacharacter
return (WEOF);
}
static int_type __cdecl not_eof(const int_type& _Meta)
{ // return anything but EOF
return (_Meta != eof() ? _Meta : !eof());
}
};
// STRUCT char_traits<char> (FROM <string>)
template<> struct _CRTIMP2 char_traits<char>
{ // properties of a string or stream char element
typedef char _Elem;
typedef _Elem char_type;
typedef int int_type;
typedef streampos pos_type;
typedef streamoff off_type;
typedef mbstate_t state_type;
static void __cdecl assign(_Elem& _Left, const _Elem& _Right)
{ // assign an element
_Left = _Right;
}
static bool __cdecl eq(const _Elem& _Left, const _Elem& _Right)
{ // test for element equality
return (_Left == _Right);
}
static bool __cdecl lt(const _Elem& _Left, const _Elem& _Right)
{ // test if _Left precedes _Right
return (_Left < _Right);
}
static int __cdecl compare(const _Elem *_First1, const _Elem *_First2,
size_t _Count)
{ // compare [_First1, _First1 + _Count) with [_First2, ...)
return (::memcmp(_First1, _First2, _Count));
}
static size_t __cdecl length(const _Elem *_First)
{ // find length of null-terminated string
return (::strlen(_First));
}
static _Elem *__cdecl copy(_Elem *_First1, const _Elem *_First2,
size_t _Count)
{ // copy [_First1, _First1 + _Count) to [_First2, ...)
return ((_Elem *)::memcpy(_First1, _First2, _Count));
}
static const _Elem *__cdecl find(const _Elem *_First, size_t _Count,
const _Elem& _Ch)
{ // look for _Ch in [_First, _First + _Count)
return ((const _Elem *)::memchr(_First, _Ch, _Count));
}
static _Elem *__cdecl move(_Elem *_First1, const _Elem *_First2,
size_t _Count)
{ // copy [_First1, _First1 + _Count) to [_First2, ...)
return ((_Elem *)::memmove(_First1, _First2, _Count));
}
static _Elem *__cdecl assign(_Elem *_First, size_t _Count, _Elem _Ch)
{ // assign _Count * _Ch to [_First, ...)
return ((_Elem *)::memset(_First, _Ch, _Count));
}
static _Elem __cdecl to_char_type(const int_type& _Meta)
{ // convert metacharacter to character
return ((_Elem)_Meta);
}
static int_type __cdecl to_int_type(const _Elem& _Ch)
{ // convert character to metacharacter
return ((unsigned char)_Ch);
}
static bool __cdecl eq_int_type(const int_type& _Left,
const int_type& _Right)
{ // test for metacharacter equality
return (_Left == _Right);
}
static int_type __cdecl eof()
{ // return end-of-file metacharacter
return (EOF);
}
static int_type __cdecl not_eof(const int_type& _Meta)
{ // return anything but EOF
return (_Meta != eof() ? _Meta : !eof());
}
};
// FORWARD REFERENCES
template<class _Ty>
class allocator;
class ios_base;
template<class _Elem,
class _Traits = char_traits<_Elem> >
class basic_ios;
template<class _Elem,
class _Traits = char_traits<_Elem> >
class istreambuf_iterator;
template<class _Elem,
class _Traits = char_traits<_Elem> >
class ostreambuf_iterator;
template<class _Elem,
class _Traits = char_traits<_Elem> >
class basic_streambuf;
template<class _Elem,
class _Traits = char_traits<_Elem> >
class basic_istream;
template<class _Elem,
class _Traits = char_traits<_Elem> >
class basic_ostream;
template<class _Elem,
class _Traits = char_traits<_Elem> >
class basic_iostream;
template<class _Elem,
class _Traits = char_traits<_Elem>,
class _Alloc = allocator<_Elem> >
class basic_stringbuf;
template<class _Elem,
class _Traits = char_traits<_Elem>,
class _Alloc = allocator<_Elem> >
class basic_istringstream;
template<class _Elem,
class _Traits = char_traits<_Elem>,
class _Alloc = allocator<_Elem> >
class basic_ostringstream;
template<class _Elem,
class _Traits = char_traits<_Elem>,
class _Alloc = allocator<_Elem> >
class basic_stringstream;
template<class _Elem,
class _Traits = char_traits<_Elem> >
class basic_filebuf;
template<class _Elem,
class _Traits = char_traits<_Elem> >
class basic_ifstream;
template<class _Elem,
class _Traits = char_traits<_Elem> >
class basic_ofstream;
template<class _Elem,
class _Traits = char_traits<_Elem> >
class basic_fstream;
#ifdef _DLL_CPPLIB
template<class _Elem,
class _InIt >
class num_get;
template<class _Elem,
class _OutIt >
class num_put;
template<class _Elem>
class collate;
#endif /* _DLL_CPPLIB */
// char TYPEDEFS
typedef basic_ios<char, char_traits<char> > ios;
typedef basic_streambuf<char, char_traits<char> > streambuf;
typedef basic_istream<char, char_traits<char> > istream;
typedef basic_ostream<char, char_traits<char> > ostream;
typedef basic_iostream<char, char_traits<char> > iostream;
typedef basic_stringbuf<char, char_traits<char>,
allocator<char> > stringbuf;
typedef basic_istringstream<char, char_traits<char>,
allocator<char> > istringstream;
typedef basic_ostringstream<char, char_traits<char>,
allocator<char> > ostringstream;
typedef basic_stringstream<char, char_traits<char>,
allocator<char> > stringstream;
typedef basic_filebuf<char, char_traits<char> > filebuf;
typedef basic_ifstream<char, char_traits<char> > ifstream;
typedef basic_ofstream<char, char_traits<char> > ofstream;
typedef basic_fstream<char, char_traits<char> > fstream;
// wchat_t TYPEDEFS
typedef basic_ios<wchar_t, char_traits<wchar_t> > wios;
typedef basic_streambuf<wchar_t, char_traits<wchar_t> >
wstreambuf;
typedef basic_istream<wchar_t, char_traits<wchar_t> > wistream;
typedef basic_ostream<wchar_t, char_traits<wchar_t> > wostream;
typedef basic_iostream<wchar_t, char_traits<wchar_t> > wiostream;
typedef basic_stringbuf<wchar_t, char_traits<wchar_t>,
allocator<wchar_t> > wstringbuf;
typedef basic_istringstream<wchar_t, char_traits<wchar_t>,
allocator<wchar_t> > wistringstream;
typedef basic_ostringstream<wchar_t, char_traits<wchar_t>,
allocator<wchar_t> > wostringstream;
typedef basic_stringstream<wchar_t, char_traits<wchar_t>,
allocator<wchar_t> > wstringstream;
typedef basic_filebuf<wchar_t, char_traits<wchar_t> > wfilebuf;
typedef basic_ifstream<wchar_t, char_traits<wchar_t> > wifstream;
typedef basic_ofstream<wchar_t, char_traits<wchar_t> > wofstream;
typedef basic_fstream<wchar_t, char_traits<wchar_t> > wfstream;
#ifdef _DLL_CPPLIB
typedef num_get<char, istreambuf_iterator<char, char_traits<char> > >
numget;
typedef num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >
wnumget;
typedef num_put<char, ostreambuf_iterator<char, char_traits<char> > >
numput;
typedef num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >
wnumput;
typedef collate<char> ncollate;
typedef collate<wchar_t> wcollate;
#endif /* _DLL_CPPLIB */
_STD_END
#pragma warning(pop)
#pragma pack(pop)
#endif /* _IOSFWD_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

View File

@@ -0,0 +1,40 @@
// iostream standard header for Microsoft
#pragma once
#ifndef _IOSTREAM_
#define _IOSTREAM_
#include <istream>
#pragma pack(push,8)
#pragma warning(push,3)
_STD_BEGIN
// OBJECTS
extern _CRTIMP2 istream cin, *_Ptr_cin;
extern _CRTIMP2 ostream cout, *_Ptr_cout;
extern _CRTIMP2 ostream cerr, *_Ptr_cerr;
extern _CRTIMP2 ostream clog, *_Ptr_clog;
// CLASS _Winit
class _CRTIMP2 _Winit {
public:
_Winit();
~_Winit();
private:
static int _Init_cnt;
};
// WIDE OBJECTS
extern _CRTIMP2 wistream wcin, *_Ptr_wcin;
extern _CRTIMP2 wostream wcout, *_Ptr_wcout;
extern _CRTIMP2 wostream wcerr, *_Ptr_wcerr;
extern _CRTIMP2 wostream wclog, *_Ptr_wclog;
_STD_END
#pragma warning(pop)
#pragma pack(pop)
#endif /* _IOSTREAM_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

View File

@@ -0,0 +1,25 @@
/* iso646.h standard header */
#pragma once
#ifndef _ISO646
#define _ISO646
#if !defined(__cplusplus) || defined(_MSC_EXTENSIONS)
#define and &&
#define and_eq &=
#define bitand &
#define bitor |
#define compl ~
#define not !
#define not_eq !=
#define or ||
#define or_eq |=
#define xor ^
#define xor_eq ^=
#endif /* !__cplusplus || _MSC_EXTENSIONS */
#endif /* _ISO646 */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,362 @@
// iterator standard header
#pragma once
#ifndef _ITERATOR_
#define _ITERATOR_
#include <xutility>
#pragma pack(push,8)
#pragma warning(push,3)
_STD_BEGIN
// TEMPLATE CLASS back_insert_iterator
template<class _Container>
class back_insert_iterator
: public _Outit
{ // wrap pushes to back of container as output iterator
public:
typedef _Container container_type;
typedef typename _Container::reference reference;
explicit back_insert_iterator(_Container& _Cont)
: container(&_Cont)
{ // construct with container
}
back_insert_iterator<_Container>& operator=(
typename _Container::const_reference _Val)
{ // push value into container
container->push_back(_Val);
return (*this);
}
back_insert_iterator<_Container>& operator*()
{ // pretend to return designated value
return (*this);
}
back_insert_iterator<_Container>& operator++()
{ // pretend to preincrement
return (*this);
}
back_insert_iterator<_Container> operator++(int)
{ // pretend to postincrement
return (*this);
}
protected:
_Container *container; // pointer to container
};
// TEMPLATE FUNCTION back_inserter
template<class _Container> inline
back_insert_iterator<_Container> back_inserter(_Container& _Cont)
{ // return a back_insert_iterator
return (std::back_insert_iterator<_Container>(_Cont));
}
// TEMPLATE CLASS front_insert_iterator
template<class _Container>
class front_insert_iterator
: public _Outit
{ // wrap pushes to front of container as output iterator
public:
typedef _Container container_type;
typedef typename _Container::reference reference;
explicit front_insert_iterator(_Container& _Cont)
: container(&_Cont)
{ // construct with container
}
front_insert_iterator<_Container>& operator=(
typename _Container::const_reference _Val)
{ // push value into container
container->push_front(_Val);
return (*this);
}
front_insert_iterator<_Container>& operator*()
{ // pretend to return designated value
return (*this);
}
front_insert_iterator<_Container>& operator++()
{ // pretend to preincrement
return (*this);
}
front_insert_iterator<_Container> operator++(int)
{ // pretend to postincrement
return (*this);
}
protected:
_Container *container; // pointer to container
};
// TEMPLATE FUNCTION front_inserter
template<class _Container> inline
front_insert_iterator<_Container> front_inserter(_Container& _Cont)
{ // return front_insert_iterator
return (std::front_insert_iterator<_Container>(_Cont));
}
// TEMPLATE CLASS insert_iterator
template<class _Container>
class insert_iterator
: public _Outit
{ // wrap inserts into container as output iterator
public:
typedef _Container container_type;
typedef typename _Container::reference reference;
insert_iterator(_Container& _Cont, typename _Container::iterator _Where)
: container(&_Cont), iter(_Where)
{ // construct with container and iterator
}
insert_iterator<_Container>& operator=(
typename _Container::const_reference _Val)
{ // insert into container and increment stored iterator
iter = container->insert(iter, _Val);
++iter;
return (*this);
}
insert_iterator<_Container>& operator*()
{ // pretend to return designated value
return (*this);
}
insert_iterator<_Container>& operator++()
{ // pretend to preincrement
return (*this);
}
insert_iterator<_Container>& operator++(int)
{ // pretend to postincrement
return (*this);
}
protected:
_Container *container; // pointer to container
typename _Container::iterator iter; // iterator into container
};
// TEMPLATE FUNCTION inserter
template<class _Container,
class _Iter> inline
insert_iterator<_Container> inserter(_Container& _Cont, _Iter _Where)
{ // return insert_iterator
return (std::insert_iterator<_Container>(_Cont, _Where));
}
// TEMPLATE CLASS istream_iterator
template<class _Ty,
class _Elem = char,
class _Traits = char_traits<_Elem>,
class _Diff = ptrdiff_t>
class istream_iterator
: public iterator<input_iterator_tag, _Ty, _Diff,
const _Ty *, const _Ty&>
{ // wrap _Ty extracts from input stream as input iterator
public:
typedef istream_iterator<_Ty, _Elem, _Traits, _Diff> _Myt;
typedef _Elem char_type;
typedef _Traits traits_type;
typedef basic_istream<_Elem, _Traits> istream_type;
istream_iterator()
: _Myistr(0)
{ // construct singular iterator
}
istream_iterator(istream_type& _Istr)
: _Myistr(&_Istr)
{ // construct with input stream
_Getval();
}
const _Ty& operator*() const
{ // return designated value
return (_Myval);
}
const _Ty *operator->() const
{ // return pointer to class object
return (&**this);
}
_Myt& operator++()
{ // preincrement
_Getval();
return (*this);
}
_Myt operator++(int)
{ // postincrement
_Myt _Tmp = *this;
++*this;
return (_Tmp);
}
bool _Equal(const _Myt& _Right) const
{ // test for iterator equality
return (_Myistr == _Right._Myistr);
}
protected:
void _Getval()
{ // get a _Ty value if possible
if (_Myistr != 0 && !(*_Myistr >> _Myval))
_Myistr = 0;
}
istream_type *_Myistr; // pointer to input stream
_Ty _Myval; // lookahead value (valid if _Myistr is not null)
};
// istream_iterator TEMPLATE OPERATORS
template<class _Ty, class _Elem, class _Traits, class _Diff> inline
bool operator==(
const istream_iterator<_Ty, _Elem, _Traits, _Diff>& _Left,
const istream_iterator<_Ty, _Elem, _Traits, _Diff>& _Right)
{ // test for istream_iterator equality
return (_Left._Equal(_Right));
}
template<class _Ty, class _Elem, class _Traits, class _Diff> inline
bool operator!=(
const istream_iterator<_Ty, _Elem, _Traits, _Diff>& _Left,
const istream_iterator<_Ty, _Elem, _Traits, _Diff>& _Right)
{ // test for istream_iterator inequality
return (!(_Left == _Right));
}
// TEMPLATE CLASS ostream_iterator
template<class _Ty, class _Elem = char,
class _Traits = char_traits<_Elem> >
class ostream_iterator
: public _Outit
{ // wrap _Ty inserts to output stream as output iterator
public:
typedef _Elem char_type;
typedef _Traits traits_type;
typedef basic_ostream<_Elem, _Traits> ostream_type;
ostream_iterator(ostream_type& _Ostr,
const _Elem *_Delim = 0)
: _Myostr(&_Ostr), _Mydelim(_Delim)
{ // construct from output stream and delimiter
}
ostream_iterator<_Ty, _Elem, _Traits>& operator=(const _Ty& _Val)
{ // insert value into output stream, followed by delimiter
*_Myostr << _Val;
if (_Mydelim != 0)
*_Myostr << _Mydelim;
return (*this);
}
ostream_iterator<_Ty, _Elem, _Traits>& operator*()
{ // pretend to return designated value
return (*this);
}
ostream_iterator<_Ty, _Elem, _Traits>& operator++()
{ // pretend to preincrement
return (*this);
}
ostream_iterator<_Ty, _Elem, _Traits> operator++(int)
{ // pretend to postincrement
return (*this);
}
protected:
const _Elem *_Mydelim; // pointer to delimiter string (NB: not freed)
ostream_type *_Myostr; // pointer to output stream
};
// TEMPLATE FUNCTION _Val_type
template<class _Iter> inline
typename iterator_traits<_Iter>::value_type *_Val_type(_Iter)
{ // return value type from arbitrary argument
return (0);
}
// TEMPLATE FUNCTION advance
template<class _InIt, class _Diff> inline
void advance(_InIt& _Where, _Diff _Off)
{ // increment iterator by offset, arbitrary iterators
_Advance(_Where, _Off, _Iter_cat(_Where));
}
template<class _InIt, class _Diff> inline
void _Advance(_InIt& _Where, _Diff _Off, input_iterator_tag)
{ // increment iterator by offset, input iterators
for (; 0 < _Off; --_Off)
++_Where;
}
template<class _FI, class _Diff> inline
void _Advance(_FI& _Where, _Diff _Off, forward_iterator_tag)
{ // increment iterator by offset, forward iterators
for (; 0 < _Off; --_Off)
++_Where;
}
template<class _BI, class _Diff> inline
void _Advance(_BI& _Where, _Diff _Off, bidirectional_iterator_tag)
{ // increment iterator by offset, bidirectional iterators
for (; 0 < _Off; --_Off)
++_Where;
for (; _Off < 0; ++_Off)
--_Where;
}
template<class _RI, class _Diff> inline
void _Advance(_RI& _Where, _Diff _Off, random_access_iterator_tag)
{ // increment iterator by offset, random-access iterators
_Where += _Off;
}
// TEMPLATE FUNCTION _Dist_type
template<class _Iter> inline
typename iterator_traits<_Iter>::difference_type
*_Dist_type(_Iter)
{ // return distance type from arbitrary argument
return (0);
}
_STD_END
#pragma warning(pop)
#pragma pack(pop)
#endif /* _ITERATOR_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
*/
/*
* This file is derived from software bearing the following
* restrictions:
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Permission to use, copy, modify, distribute and sell this
* software and its documentation for any purpose is hereby
* granted without fee, provided that the above copyright notice
* appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation.
* Hewlett-Packard Company makes no representations about the
* suitability of this software for any purpose. It is provided
* "as is" without express or implied warranty.
V3.13:0009 */

View File

@@ -0,0 +1,837 @@
/**
*** Copyright (C) 1985-1999 Intel Corporation. All rights reserved.
***
*** The information and source code contained herein is the exclusive
*** property of Intel Corporation and may not be disclosed, examined
*** or reproduced in whole or in part without explicit written authorization
*** from the company.
***
**/
/*
* Definition of a C++ class interface to MMX(TM) instruction intrinsics.
*
*/
#ifndef IVEC_H_INCLUDED
#define IVEC_H_INCLUDED
#if !defined __cplusplus
#error ERROR: This file is only supported in C++ compilations!
#endif /* !__cplusplus */
#include <mmintrin.h>
#include <assert.h>
/*
* Define _SILENCE_IVEC_C4799 to disable warning C4799 inside this header.
* Be careful that any code that uses these functions properly executes EMMS
* or _m_empty() after using any MMX instruction and before using the x87 NDP.
*/
#if defined(_SILENCE_IVEC_C4799)
#pragma warning(push)
#pragma warning(disable: 4799)
#endif
/*
* Define _ENABLE_VEC_DEBUG to enable std::ostream inserters for debug output
*/
#if defined(_ENABLE_VEC_DEBUG)
#include <iostream>
#endif
/* If using MSVC5.0, explicit keyword should be used */
#if (_MSC_VER >= 1100)
#define EXPLICIT explicit
#else
#if (__ICL)
#define EXPLICIT __explicit /* If MSVC4.x & ICL, use __explicit */
#else
#define EXPLICIT /* nothing */
#pragma message( "explicit keyword not recognized")
#endif
#endif
class I8vec8; /* 8 elements, each element a signed or unsigned char data type */
class Is8vec8; /* 8 elements, each element a signed char data type */
class Iu8vec8; /* 8 elements, each element an unsigned char data type */
class I16vec4; /* 4 elements, each element a signed or unsigned short */
class Is16vec4; /* 4 elements, each element a signed short */
class Iu16vec4; /* 4 elements, each element an unsigned short */
class I32vec2; /* 2 elements, each element a signed or unsigned long */
class Is32vec2; /* 2 elements, each element a signed long */
class Iu32vec2; /* 2 elements, each element a unsigned long */
class I64vec1; /* 1 element, a __m64 data type - Base I64vec1 class */
#define _MM_8UB(element,vector) (*((unsigned char*)&##vector + ##element))
#define _MM_8B(element,vector) (*((signed char*)&##vector + ##element))
#define _MM_4UW(element,vector) (*((unsigned short*)&##vector + ##element))
#define _MM_4W(element,vector) (*((short*)&##vector + ##element))
#define _MM_2UDW(element,vector) (*((unsigned int*)&##vector + ##element))
#define _MM_2DW(element,vector) (*((int*)&##vector + ##element))
#define _MM_QW (*((__int64*)&vec))
/* M64 Class:
* 1 element, a __m64 data type
* Contructors & Logical Operations
*/
class M64
{
protected:
__m64 vec;
public:
M64() { }
M64(__m64 mm) { vec = mm; }
M64(__int64 mm) { _MM_QW = mm; }
M64(int i) { vec = _m_from_int(i); }
operator __m64() const { return vec; }
/* Logical Operations */
M64& operator&=(const M64 &a) { return *this = (M64) _m_pand(vec,a); }
M64& operator|=(const M64 &a) { return *this = (M64) _m_por(vec,a); }
M64& operator^=(const M64 &a) { return *this = (M64) _m_pxor(vec,a); }
};
inline M64 operator&(const M64 &a, const M64 &b) { return _m_pand( a,b); }
inline M64 operator|(const M64 &a, const M64 &b) { return _m_por(a,b); }
inline M64 operator^(const M64 &a, const M64 &b) { return _m_pxor(a,b); }
inline M64 andnot(const M64 &a, const M64 &b) { return _m_pandn(a,b); }
/* I64vec1 Class:
* 1 element, a __m64 data type
* Contains Operations which can operate on any __m64 data type
*/
class I64vec1 : public M64
{
public:
I64vec1() { }
I64vec1(__m64 mm) : M64(mm) { }
EXPLICIT I64vec1(int i) : M64(i) { }
EXPLICIT I64vec1(__int64 mm) : M64(mm) { }
I64vec1& operator= (const M64 &a) { return *this = (I64vec1) a; }
I64vec1& operator&=(const M64 &a) { return *this = (I64vec1) _m_pand(vec,a); }
I64vec1& operator|=(const M64 &a) { return *this = (I64vec1) _m_por(vec,a); }
I64vec1& operator^=(const M64 &a) { return *this = (I64vec1) _m_pxor(vec,a); }
/* Shift Logical Operations */
I64vec1 operator<<(const M64 &a) { return _m_psllq(vec, a); }
I64vec1 operator<<(int count) { return _m_psllqi(vec, count); }
I64vec1& operator<<=(const M64 &a) { return *this = (I64vec1) _m_psllq(vec, a); }
I64vec1& operator<<=(int count) { return *this = (I64vec1) _m_psllqi(vec, count); }
I64vec1 operator>>(const M64 &a) { return _m_psrlq(vec, a); }
I64vec1 operator>>(int count) { return _m_psrlqi(vec, count); }
I64vec1& operator>>=(const M64 &a) { return *this = (I64vec1) _m_psrlq(vec, a); }
I64vec1& operator>>=(int count) { return *this = (I64vec1) _m_psrlqi(vec, count); }
};
/* I32vec2 Class:
* 2 elements, each element either a signed or unsigned int
*/
class I32vec2 : public M64
{
public:
I32vec2() { }
I32vec2(__m64 mm) : M64(mm) { }
EXPLICIT I32vec2(int i) : M64 (i) { }
EXPLICIT I32vec2(__int64 i): M64(i) {}
/* Assignment Operator */
I32vec2& operator= (const M64 &a) { return *this = (I32vec2) a; }
/* Logical Assignment Operators */
I32vec2& operator&=(const M64 &a) { return *this = (I32vec2) _m_pand(vec,a); }
I32vec2& operator|=(const M64 &a) { return *this = (I32vec2) _m_por(vec,a); }
I32vec2& operator^=(const M64 &a) { return *this = (I32vec2) _m_pxor(vec,a); }
/* Addition & Subtraction Assignment Operators */
I32vec2& operator +=(const I32vec2 &a) { return *this = (I32vec2) _m_paddd(vec,a); }
I32vec2& operator -=(const I32vec2 &a) { return *this = (I32vec2) _m_psubd(vec,a); }
/* Shift Logical Operators */
I32vec2 operator<<(const I32vec2 &a) { return _m_pslld(vec,a); }
I32vec2 operator<<(int count) { return _m_pslldi(vec,count); }
I32vec2& operator<<=(const I32vec2 &a) { return *this = (I32vec2) _m_pslld(vec,a); }
I32vec2& operator<<=(int count) { return *this = (I32vec2) _m_pslldi(vec,count); }
};
/* Compare For Equality */
inline I32vec2 cmpeq(const I32vec2 &a, const I32vec2 &b) { return _m_pcmpeqd(a,b); }
inline I32vec2 cmpneq(const I32vec2 &a, const I32vec2 &b) { return _m_pandn(_m_pcmpeqd(a,b), M64(0xffffffffffffffffi64)); }
/* Unpacks */
inline I32vec2 unpack_low(const I32vec2 &a, const I32vec2 &b) {return _m_punpckldq(a,b); }
inline I32vec2 unpack_high(const I32vec2 &a, const I32vec2 &b) {return _m_punpckhdq(a,b); }
/* Is32vec2 Class:
* 2 elements, each element a signed int
*/
class Is32vec2 : public I32vec2
{
public:
Is32vec2() { }
Is32vec2(__m64 mm) : I32vec2(mm) { }
Is32vec2(signed int i0, signed int i1)
{
_MM_2DW(0,vec) = i1;
_MM_2DW(1,vec) = i0;
}
EXPLICIT Is32vec2(int i) : I32vec2 (i) {}
EXPLICIT Is32vec2(__int64 i): I32vec2(i) {}
/* Assignment Operator */
Is32vec2& operator= (const M64 &a) { return *this = (Is32vec2) a; }
/* Logical Assignment Operators */
Is32vec2& operator&=(const M64 &a) { return *this = (Is32vec2) _m_pand(vec,a); }
Is32vec2& operator|=(const M64 &a) { return *this = (Is32vec2) _m_por(vec,a); }
Is32vec2& operator^=(const M64 &a) { return *this = (Is32vec2) _m_pxor(vec,a); }
/* Addition & Subtraction Assignment Operators */
Is32vec2& operator +=(const I32vec2 &a) { return *this = (Is32vec2) _m_paddd(vec,a); }
Is32vec2& operator -=(const I32vec2 &a) { return *this = (Is32vec2) _m_psubd(vec,a); }
/* Shift Logical Operators */
Is32vec2 operator<<(const M64 &a) { return _m_pslld(vec,a); }
Is32vec2 operator<<(int count) { return _m_pslldi(vec,count); }
Is32vec2& operator<<=(const M64 &a) { return *this = (Is32vec2) _m_pslld(vec,a); }
Is32vec2& operator<<=(int count) { return *this = (Is32vec2) _m_pslldi(vec,count); }
/* Shift Arithmetic Operations */
Is32vec2 operator>>(const M64 &a) { return _m_psrad(vec, a); }
Is32vec2 operator>>(int count) { return _m_psradi(vec, count); }
Is32vec2& operator>>=(const M64 &a) { return *this = (Is32vec2) _m_psrad(vec, a); }
Is32vec2& operator>>=(int count) { return *this = (Is32vec2) _m_psradi(vec, count); }
#if defined(_ENABLE_VEC_DEBUG)
/* Output for Debug */
friend std::ostream& operator<< (std::ostream &os, const Is32vec2 &a)
{
os << " [1]:" << _MM_2DW(1,a)
<< " [0]:" << _MM_2DW(0,a);
return os;
}
#endif
/* Element Access for Debug, No data modified */
const int& operator[](int i)const
{
assert(static_cast<unsigned int>(i) < 2); /* Only 2 elements to access */
return _MM_2DW(i,vec);
}
/* Element Access and Assignment for Debug */
int& operator[](int i)
{
assert(static_cast<unsigned int>(i) < 2); /* Only 2 elements to access */
return _MM_2DW(i,vec);
}
};
/* Compares */
inline Is32vec2 cmpeq(const Is32vec2 &a, const Is32vec2 &b) { return _m_pcmpeqd(a,b); }
inline Is32vec2 cmpneq(const Is32vec2 &a, const Is32vec2 &b) { return _m_pandn(_m_pcmpeqd(a,b), M64(0xffffffffffffffffi64)); }
inline Is32vec2 cmpgt(const Is32vec2 &a, const Is32vec2 &b) { return _m_pcmpgtd(a,b); }
inline Is32vec2 cmplt(const Is32vec2 &a, const Is32vec2 &b) { return _m_pcmpgtd(b,a); }
inline Is32vec2 cmple(const Is32vec2 &a, const Is32vec2 &b) { return _m_pandn(_m_pcmpgtd(a,b), M64(0xffffffffffffffffi64)); }
inline Is32vec2 cmpge(const Is32vec2 &a, const Is32vec2 &b) { return _m_pandn(_m_pcmpgtd(b,a), M64(0xffffffffffffffffi64)); }
/* Unpacks & Pack */
inline Is32vec2 unpack_low(const Is32vec2 &a, const Is32vec2 &b) { return _m_punpckldq(a,b); }
inline Is32vec2 unpack_high(const Is32vec2 &a, const Is32vec2 &b) { return _m_punpckhdq(a,b); }
/* Iu32vec2 Class:
* 2 elements, each element unsigned int
*/
class Iu32vec2 : public I32vec2
{
public:
Iu32vec2() { }
Iu32vec2(__m64 mm) : I32vec2(mm) { }
Iu32vec2(unsigned int ui0, unsigned int ui1)
{
_MM_2UDW(0,vec) = ui1;
_MM_2UDW(1,vec) = ui0;
}
EXPLICIT Iu32vec2(int i) : I32vec2 (i) { }
EXPLICIT Iu32vec2(__int64 i) : I32vec2 (i) { }
/* Assignment Operator */
Iu32vec2& operator= (const M64 &a) { return *this = (Iu32vec2) a; }
/* Logical Assignment Operators */
Iu32vec2& operator&=(const M64 &a) { return *this = (Iu32vec2) _m_pand(vec,a); }
Iu32vec2& operator|=(const M64 &a) { return *this = (Iu32vec2) _m_por(vec,a); }
Iu32vec2& operator^=(const M64 &a) { return *this = (Iu32vec2) _m_pxor(vec,a); }
/* Addition & Subtraction Assignment Operators */
Iu32vec2& operator +=(const I32vec2 &a) { return *this = (Iu32vec2) _m_paddd(vec,a); }
Iu32vec2& operator -=(const I32vec2 &a) { return *this = (Iu32vec2) _m_psubd(vec,a); }
/* Shift Logical Operators */
Iu32vec2 operator<<(const M64 &a) { return _m_pslld(vec,a); }
Iu32vec2 operator<<(int count) { return _m_pslldi(vec,count); }
Iu32vec2& operator<<=(const M64 &a) { return *this = (Iu32vec2) _m_pslld(vec,a); }
Iu32vec2& operator<<=(int count) { return *this = (Iu32vec2) _m_pslldi(vec,count); }
Iu32vec2 operator>>(const M64 &a) { return _m_psrld(vec,a); }
Iu32vec2 operator>>(int count) { return _m_psrldi(vec,count); }
Iu32vec2& operator>>=(const M64 &a) { return *this = (Iu32vec2) _m_psrld(vec,a); }
Iu32vec2& operator>>=(int count) { return *this = (Iu32vec2) _m_psrldi(vec,count); }
#if defined(_ENABLE_VEC_DEBUG)
/* Output for Debug */
friend std::ostream& operator<< (std::ostream &os, const Iu32vec2 &a)
{
os << " [1]:" << _MM_2UDW(1,a)
<< " [0]:" << _MM_2UDW(0,a);
return os;
}
#endif
/* Element Access for Debug, No data modified */
const unsigned int& operator[](int i)const
{
assert(static_cast<unsigned int>(i) < 2); /* Only 2 elements to access */
return _MM_2UDW(i,vec);
}
/* Element Access and Assignment for Debug */
unsigned int& operator[](int i)
{
assert(static_cast<unsigned int>(i) < 2); /* Only 2 elements to access */
return _MM_2UDW(i,vec);
}
};
/* Compares For Equality / Inequality */
inline Iu32vec2 cmpeq(const Iu32vec2 &a, const Iu32vec2 &b) { return _m_pcmpeqd(a,b); }
inline Iu32vec2 cmpneq(const Iu32vec2 &a, const Iu32vec2 &b) { return _m_pandn(_m_pcmpeqd(a,b), M64(0xffffffffffffffffi64)); }
/* Unpacks */
inline Iu32vec2 unpack_low(const Iu32vec2 &a, const Iu32vec2 &b) {return _m_punpckldq(a,b); }
inline Iu32vec2 unpack_high(const Iu32vec2 &a, const Iu32vec2 &b) {return _m_punpckhdq(a,b); }
/* I16vec4 Class:
* 4 elements, each element either a signed or unsigned short
*/
class I16vec4 : public M64
{
public:
I16vec4() { }
I16vec4(__m64 mm) : M64(mm) { }
EXPLICIT I16vec4(__int64 i) : M64 (i) { }
EXPLICIT I16vec4(int i) : M64 (i) { }
/* Assignment Operator */
I16vec4& operator= (const M64 &a) { return *this = (I16vec4) a; }
/* Addition & Subtraction Assignment Operators */
I16vec4& operator&=(const M64 &a) { return *this = (I16vec4) _m_pand(vec,a); }
I16vec4& operator|=(const M64 &a) { return *this = (I16vec4) _m_por(vec,a); }
I16vec4& operator^=(const M64 &a) { return *this = (I16vec4) _m_pxor(vec,a); }
/* Addition & Subtraction Assignment Operators */
I16vec4& operator +=(const I16vec4 &a) { return *this = (I16vec4)_m_paddw(vec,a); }
I16vec4& operator -=(const I16vec4 &a) { return *this = (I16vec4)_m_psubw(vec,a); }
I16vec4& operator *=(const I16vec4 &a) { return *this = (I16vec4)_m_pmullw(vec,a); }
/* Shift Logical Operators */
I16vec4 operator<<(const I16vec4 &a) { return _m_psllw(vec,a); }
I16vec4 operator<<(int count) { return _m_psllwi(vec,count); }
I16vec4& operator<<=(const I16vec4 &a) { return *this = (I16vec4)_m_psllw(vec,a); }
I16vec4& operator<<=(int count) { return *this = (I16vec4)_m_psllwi(vec,count); }
};
inline I16vec4 operator*(const I16vec4 &a, const I16vec4 &b) { return _m_pmullw(a,b); }
inline I16vec4 cmpeq(const I16vec4 &a, const I16vec4 &b) { return _m_pcmpeqw(a,b); }
inline I16vec4 cmpneq(const I16vec4 &a, const I16vec4 &b) { return _m_pandn(_m_pcmpeqw(a,b), M64(0xffffffffffffffffi64)); }
inline I16vec4 unpack_low(const I16vec4 &a, const I16vec4 &b) { return _m_punpcklwd(a,b); }
inline I16vec4 unpack_high(const I16vec4 &a, const I16vec4 &b) { return _m_punpckhwd(a,b); }
/* Is16vec4 Class:
* 4 elements, each element signed short
*/
class Is16vec4 : public I16vec4
{
public:
Is16vec4() { }
Is16vec4(__m64 mm) : I16vec4(mm) { }
Is16vec4(short i0, short i1, short i2, short i3)
{
_MM_4W(0,vec) = i3;
_MM_4W(1,vec) = i2;
_MM_4W(2,vec) = i1;
_MM_4W(3,vec) = i0;
}
EXPLICIT Is16vec4(__int64 i) : I16vec4 (i) { }
EXPLICIT Is16vec4(int i) : I16vec4 (i) { }
/* Assignment Operator */
Is16vec4& operator= (const M64 &a) { return *this = (Is16vec4) a; }
/* Addition & Subtraction Assignment Operators */
Is16vec4& operator&=(const M64 &a) { return *this = (Is16vec4) _m_pand(vec,a); }
Is16vec4& operator|=(const M64 &a) { return *this = (Is16vec4) _m_por(vec,a); }
Is16vec4& operator^=(const M64 &a) { return *this = (Is16vec4) _m_pxor(vec,a); }
/* Addition & Subtraction Assignment Operators */
Is16vec4& operator +=(const I16vec4 &a) { return *this = (Is16vec4)_m_paddw(vec,a); }
Is16vec4& operator -=(const I16vec4 &a) { return *this = (Is16vec4)_m_psubw(vec,a); }
Is16vec4& operator *=(const I16vec4 &a) { return *this = (Is16vec4)_m_pmullw(vec,a); }
/* Shift Logical Operators */
Is16vec4 operator<<(const M64 &a) { return _m_psllw(vec,a); }
Is16vec4 operator<<(int count) { return _m_psllwi(vec,count); }
Is16vec4& operator<<=(const M64 &a) { return *this = (Is16vec4)_m_psllw(vec,a); }
Is16vec4& operator<<=(int count) { return *this = (Is16vec4)_m_psllwi(vec,count); }
/* Shift Arithmetic Operations */
Is16vec4 operator>>(const M64 &a) { return _m_psraw(vec,a); }
Is16vec4 operator>>(int count) { return _m_psrawi(vec,count); }
Is16vec4& operator>>=(const M64 &a) { return *this = (Is16vec4) _m_psraw(vec,a); }
Is16vec4& operator>>=(int count) { return *this = (Is16vec4) _m_psrawi(vec,count); }
#if defined(_ENABLE_VEC_DEBUG)
/* Output for Debug */
friend std::ostream& operator<< (std::ostream &os, const Is16vec4 &a)
{
os << "[3]:" << _MM_4W(3,a)
<< " [2]:" << _MM_4W(2,a)
<< " [1]:" << _MM_4W(1,a)
<< " [0]:" << _MM_4W(0,a);
return os;
}
#endif
/* Element Access for Debug, No data modified */
const short& operator[](int i)const
{
assert(static_cast<unsigned int>(i) < 4); /* Only 4 elements to access */
return _MM_4W(i,vec);
}
/* Element Access for Debug */
short& operator[](int i)
{
assert(static_cast<unsigned int>(i) < 4); /* Only 4 elements to access */
return _MM_4W(i,vec);
}
};
inline Is16vec4 operator*(const Is16vec4 &a, const Is16vec4 &b) { return _m_pmullw(a,b); }
/* Compares */
inline Is16vec4 cmpeq(const Is16vec4 &a, const Is16vec4 &b) { return _m_pcmpeqw(a,b); }
inline Is16vec4 cmpneq(const Is16vec4 &a, const Is16vec4 &b) { return _m_pandn(_m_pcmpeqw(a,b), M64(0xffffffffffffffffi64)); }
inline Is16vec4 cmpgt(const Is16vec4 &a, const Is16vec4 &b) { return _m_pcmpgtw(a,b); }
inline Is16vec4 cmplt(const Is16vec4 &a, const Is16vec4 &b) { return _m_pcmpgtw(b,a); }
inline Is16vec4 cmple(const Is16vec4 &a, const Is16vec4 &b) { return _m_pandn(_m_pcmpgtw(a,b), M64(0xffffffffffffffffi64)); }
inline Is16vec4 cmpge(const Is16vec4 &a, const Is16vec4 &b) { return _m_pandn(_m_pcmpgtw(b,a), M64(0xffffffffffffffffi64)); }
/* Unpacks */
inline Is16vec4 unpack_low(const Is16vec4 &a, const Is16vec4 &b) { return _m_punpcklwd(a,b); }
inline Is16vec4 unpack_high(const Is16vec4 &a, const Is16vec4 &b) { return _m_punpckhwd(a,b); }
inline Is16vec4 sat_add(const Is16vec4 &a, const Is16vec4 &b) { return _m_paddsw(a,b); }
inline Is16vec4 sat_sub(const Is16vec4 &a, const Is16vec4 &b) { return _m_psubsw(a,b); }
inline Is16vec4 mul_high(const Is16vec4 &a, const Is16vec4 &b) { return _m_pmulhw(a,b); }
inline Is32vec2 mul_add(const Is16vec4 &a, const Is16vec4 &b) { return _m_pmaddwd(a,b);}
/* Iu16vec4 Class:
* 4 elements, each element unsigned short
*/
class Iu16vec4 : public I16vec4
{
public:
Iu16vec4() { }
Iu16vec4(__m64 mm) : I16vec4(mm) { }
Iu16vec4(unsigned short ui0, unsigned short ui1, unsigned short ui2, unsigned short ui3)
{
_MM_4UW(0,vec) = ui3;
_MM_4UW(1,vec) = ui2;
_MM_4UW(2,vec) = ui1;
_MM_4UW(3,vec) = ui0;
}
EXPLICIT Iu16vec4(__int64 i) : I16vec4 (i) { }
EXPLICIT Iu16vec4(int i) : I16vec4 (i) { }
/* Assignment Operator */
Iu16vec4& operator= (const M64 &a) { return *this = (Iu16vec4) a; }
/* Logical Assignment Operators */
Iu16vec4& operator&=(const M64 &a) { return *this = (Iu16vec4) _m_pand(vec,a); }
Iu16vec4& operator|=(const M64 &a) { return *this = (Iu16vec4) _m_por(vec,a); }
Iu16vec4& operator^=(const M64 &a) { return *this = (Iu16vec4) _m_pxor(vec,a); }
/* Addition & Subtraction Assignment Operators */
Iu16vec4& operator +=(const I16vec4 &a) { return *this = (Iu16vec4)_m_paddw(vec,a); }
Iu16vec4& operator -=(const I16vec4 &a) { return *this = (Iu16vec4)_m_psubw(vec,a); }
Iu16vec4& operator *=(const I16vec4 &a) { return *this = (Iu16vec4)_m_pmullw(vec,a); }
/* Shift Logical Operators */
Iu16vec4 operator<<(const M64 &a) { return _m_psllw(vec,a); }
Iu16vec4 operator<<(int count) { return _m_psllwi(vec,count); }
Iu16vec4& operator<<=(const M64 &a) { return *this = (Iu16vec4)_m_psllw(vec,a); }
Iu16vec4& operator<<=(int count) { return *this = (Iu16vec4)_m_psllwi(vec,count); }
Iu16vec4 operator>>(const M64 &a) { return _m_psrlw(vec,a); }
Iu16vec4 operator>>(int count) { return _m_psrlwi(vec,count); }
Iu16vec4& operator>>=(const M64 &a) { return *this = (Iu16vec4) _m_psrlw(vec,a); }
Iu16vec4& operator>>=(int count) { return *this = (Iu16vec4) _m_psrlwi(vec,count); }
#if defined(_ENABLE_VEC_DEBUG)
/* Output for Debug */
friend std::ostream& operator<< (std::ostream &os, const Iu16vec4 &a)
{
os << "[3]:" << _MM_4UW(3,a)
<< " [2]:" << _MM_4UW(2,a)
<< " [1]:" << _MM_4UW(1,a)
<< " [0]:" << _MM_4UW(0,a);
return os;
}
#endif
/* Element Access for Debug, No data modified */
const unsigned short& operator[](int i)const
{
assert(static_cast<unsigned int>(i) < 4); /* Only 4 elements to access */
return _MM_4UW(i,vec);
}
/* Element Access and Assignment for Debug */
unsigned short& operator[](int i)
{
assert(static_cast<unsigned int>(i) < 4); /* Only 4 elements to access */
return _MM_4UW(i,vec);
}
};
inline Iu16vec4 operator*(const Iu16vec4 &a, const Iu16vec4 &b) { return _m_pmullw(a,b); }
inline Iu16vec4 cmpeq(const Iu16vec4 &a, const Iu16vec4 &b) { return _m_pcmpeqw(a,b); }
inline Iu16vec4 cmpneq(const Iu16vec4 &a, const Iu16vec4 &b) { return _m_pandn(_m_pcmpeqw(a,b), M64(0xffffffffffffffffi64)); }
inline Iu16vec4 sat_add(const Iu16vec4 &a, const Iu16vec4 &b) { return _m_paddusw(a,b); }
inline Iu16vec4 sat_sub(const Iu16vec4 &a, const Iu16vec4 &b) { return _m_psubusw(a,b); }
inline Iu16vec4 unpack_low(const Iu16vec4 &a, const Iu16vec4 &b) { return _m_punpcklwd(a,b); }
inline Iu16vec4 unpack_high(const Iu16vec4 &a, const Iu16vec4 &b) { return _m_punpckhwd(a,b); }
/* I8vec8 Class:
* 8 elements, each element either unsigned or signed char
*/
class I8vec8 : public M64
{
public:
I8vec8() { }
I8vec8(__m64 mm) : M64(mm) { }
EXPLICIT I8vec8(__int64 i) : M64 (i) { }
EXPLICIT I8vec8(int i) : M64 (i) { }
/* Assignment Operator */
I8vec8& operator= (const M64 &a) { return *this = (I8vec8) a; }
/* Logical Assignment Operators */
I8vec8& operator&=(const M64 &a) { return *this = (I8vec8) _m_pand(vec,a); }
I8vec8& operator|=(const M64 &a) { return *this = (I8vec8) _m_por(vec,a); }
I8vec8& operator^=(const M64 &a) { return *this = (I8vec8) _m_pxor(vec,a); }
/* Addition & Subtraction Assignment Operators */
I8vec8& operator +=(const I8vec8 &a) { return *this = (I8vec8) _m_paddb(vec,a); }
I8vec8& operator -=(const I8vec8 &a) { return *this = (I8vec8) _m_psubb(vec,a); }
};
inline I8vec8 cmpeq(const I8vec8 &a, const I8vec8 &b) { return _m_pcmpeqb(a,b); }
inline I8vec8 cmpneq(const I8vec8 &a, const I8vec8 &b) { return _m_pandn(_m_pcmpeqb(a,b), M64(0xffffffffffffffffi64)); }
inline I8vec8 unpack_low(const I8vec8 &a, const I8vec8 &b) { return _m_punpcklbw(a,b); }
inline I8vec8 unpack_high(const I8vec8 &a, const I8vec8 &b) { return _m_punpckhbw(a,b); }
/* Is8vec8 Class:
* 8 elements, each element signed char
*/
class Is8vec8 : public I8vec8
{
public:
Is8vec8() { }
Is8vec8(__m64 mm) : I8vec8(mm) { }
Is8vec8(signed char s0,signed char s1,signed char s2,signed char s3,signed char s4,signed char s5,signed char s6,signed char s7)
{
_MM_8B(0,vec) = s7;
_MM_8B(1,vec) = s6;
_MM_8B(2,vec) = s5;
_MM_8B(3,vec) = s4;
_MM_8B(4,vec) = s3;
_MM_8B(5,vec) = s2;
_MM_8B(6,vec) = s1;
_MM_8B(7,vec) = s0;
}
EXPLICIT Is8vec8(__int64 i) : I8vec8 (i) { }
EXPLICIT Is8vec8(int i) : I8vec8 (i) { }
/* Assignment Operator */
Is8vec8& operator= (const M64 &a) { return *this = (Is8vec8) a; }
/* Logical Assignment Operators */
Is8vec8& operator&=(const M64 &a) { return *this = (Is8vec8) _m_pand(vec,a); }
Is8vec8& operator|=(const M64 &a) { return *this = (Is8vec8) _m_por(vec,a); }
Is8vec8& operator^=(const M64 &a) { return *this = (Is8vec8) _m_pxor(vec,a); }
/* Addition & Subtraction Assignment Operators */
Is8vec8& operator +=(const I8vec8 &a) { return *this = (Is8vec8) _m_paddb(vec,a); }
Is8vec8& operator -=(const I8vec8 &a) { return *this = (Is8vec8) _m_psubb(vec,a); }
#if defined(_ENABLE_VEC_DEBUG)
/* Output for Debug */
friend std::ostream& operator<< (std::ostream &os, const Is8vec8 &a)
{
os << "[7]:" << short(_MM_8B(7,a))
<< " [6]:" << short(_MM_8B(6,a))
<< " [5]:" << short(_MM_8B(5,a))
<< " [4]:" << short(_MM_8B(4,a))
<< " [3]:" << short(_MM_8B(3,a))
<< " [2]:" << short(_MM_8B(2,a))
<< " [1]:" << short(_MM_8B(1,a))
<< " [0]:" << short(_MM_8B(0,a));
return os;
}
#endif
/* Element Access for Debug, No data modified */
const signed char& operator[](int i)const
{
assert(static_cast<unsigned int>(i) < 8); /* Only 8 elements to access */
return _MM_8B(i,vec);
}
/* Element Access and Assignment for Debug */
signed char& operator[](int i)
{
assert(static_cast<unsigned int>(i) < 8); /* Only 8 elements to access */
return _MM_8B(i,vec);
}
};
/* Additional Is8vec8 functions: compares, unpacks, sat add/sub */
inline Is8vec8 cmpeq(const Is8vec8 &a, const Is8vec8 &b) { return _m_pcmpeqb(a,b); }
inline Is8vec8 cmpneq(const Is8vec8 &a, const Is8vec8 &b) { return _m_pandn(_m_pcmpeqb(a,b), M64(0xffffffffffffffffi64)); }
inline Is8vec8 cmpgt(const Is8vec8 &a, const Is8vec8 &b) { return _m_pcmpgtb(a,b); }
inline Is8vec8 cmplt(const Is8vec8 &a, const Is8vec8 &b) { return _m_pcmpgtb(b,a); }
inline Is8vec8 cmple(const Is8vec8 &a, const Is8vec8 &b) { return _m_pandn(_m_pcmpgtb(a,b), M64(0xffffffffffffffffi64)); }
inline Is8vec8 cmpge(const Is8vec8 &a, const Is8vec8 &b) { return _m_pandn(_m_pcmpgtb(b,a), M64(0xffffffffffffffffi64)); }
inline Is8vec8 unpack_low(const Is8vec8 &a, const Is8vec8 &b) { return _m_punpcklbw(a,b); }
inline Is8vec8 unpack_high(const Is8vec8 &a, const Is8vec8 &b) { return _m_punpckhbw(a,b); }
inline Is8vec8 sat_add(const Is8vec8 &a, const Is8vec8 &b) { return _m_paddsb(a,b); }
inline Is8vec8 sat_sub(const Is8vec8 &a, const Is8vec8 &b) { return _m_psubsb(a,b); }
/* Iu8vec8 Class:
* 8 elements, each element unsigned char
*/
class Iu8vec8 : public I8vec8
{
public:
Iu8vec8() { }
Iu8vec8(__m64 mm) : I8vec8(mm) { }
Iu8vec8(unsigned char s0,unsigned char s1,unsigned char s2,unsigned char s3,unsigned char s4,unsigned char s5,unsigned char s6,unsigned char s7)
{
_MM_8UB(0,vec) = s7;
_MM_8UB(1,vec) = s6;
_MM_8UB(2,vec) = s5;
_MM_8UB(3,vec) = s4;
_MM_8UB(4,vec) = s3;
_MM_8UB(5,vec) = s2;
_MM_8UB(6,vec) = s1;
_MM_8UB(7,vec) = s0;
}
EXPLICIT Iu8vec8(__int64 i) : I8vec8 (i) { }
EXPLICIT Iu8vec8(int i) : I8vec8 (i) { }
/* Assignment Operator */
Iu8vec8& operator= (const M64 &a) { return *this = (Iu8vec8) a; }
/* Logical Assignment Operators */
Iu8vec8& operator&=(const M64 &a) { return *this = (Iu8vec8) _m_pand(vec,a); }
Iu8vec8& operator|=(const M64 &a) { return *this = (Iu8vec8) _m_por(vec,a); }
Iu8vec8& operator^=(const M64 &a) { return *this = (Iu8vec8) _m_pxor(vec,a); }
/* Addition & Subtraction Assignment Operators */
Iu8vec8& operator +=(const I8vec8 &a) { return *this = (Iu8vec8) _m_paddb(vec,a); }
Iu8vec8& operator -=(const I8vec8 &a) { return *this = (Iu8vec8) _m_psubb(vec,a); }
#if defined(_ENABLE_VEC_DEBUG)
/* Output for Debug */
friend std::ostream& operator << (std::ostream &os, const Iu8vec8 &a)
{
os << "[7]:" << unsigned short(_MM_8UB(7,a))
<< " [6]:" << unsigned short(_MM_8UB(6,a))
<< " [5]:" << unsigned short(_MM_8UB(5,a))
<< " [4]:" << unsigned short(_MM_8UB(4,a))
<< " [3]:" << unsigned short(_MM_8UB(3,a))
<< " [2]:" << unsigned short(_MM_8UB(2,a))
<< " [1]:" << unsigned short(_MM_8UB(1,a))
<< " [0]:" << unsigned short(_MM_8UB(0,a));
return os;
}
#endif
/* Element Access for Debug, No data modified */
const unsigned char& operator[](int i)const
{
assert(static_cast<unsigned int>(i) < 8); /* Only 8 elements to access */
return _MM_8UB(i,vec);
}
/* Element Access for Debug */
unsigned char& operator[](int i)
{
assert(static_cast<unsigned int>(i) < 8); /* Only 8 elements to access */
return _MM_8UB(i,vec);
}
};
/* Additional Iu8vec8 functions: cmpeq,cmpneq, unpacks, sat add/sub */
inline Iu8vec8 cmpeq(const Iu8vec8 &a, const Iu8vec8 &b) { return _m_pcmpeqb(a,b); }
inline Iu8vec8 cmpneq(const Iu8vec8 &a, const Iu8vec8 &b) { return _m_pandn(_m_pcmpeqb(a,b), M64(0xffffffffffffffffi64)); }
inline Iu8vec8 unpack_low(const Iu8vec8 &a, const Iu8vec8 &b) { return _m_punpcklbw(a,b); }
inline Iu8vec8 unpack_high(const Iu8vec8 &a, const Iu8vec8 &b) { return _m_punpckhbw(a,b); }
inline Iu8vec8 sat_add(const Iu8vec8 &a, const Iu8vec8 &b) { return _m_paddusb(a,b); }
inline Iu8vec8 sat_sub(const Iu8vec8 &a, const Iu8vec8 &b) { return _m_psubusb(a,b); }
inline Is16vec4 pack_sat(const Is32vec2 &a, const Is32vec2 &b) { return _m_packssdw(a,b); }
inline Is8vec8 pack_sat(const Is16vec4 &a, const Is16vec4 &b) { return _m_packsswb(a,b); }
inline Iu8vec8 packu_sat(const Is16vec4 &a, const Is16vec4 &b) { return _m_packuswb(a,b); }
/********************************* Logicals ****************************************/
#define IVEC_LOGICALS(vect,element) \
inline I##vect##vec##element operator& (const I##vect##vec##element &a, const I##vect##vec##element &b) \
{ return _m_pand( a,b); } \
inline I##vect##vec##element operator| (const I##vect##vec##element &a, const I##vect##vec##element &b) \
{ return _m_por( a,b); } \
inline I##vect##vec##element operator^ (const I##vect##vec##element &a, const I##vect##vec##element &b) \
{ return _m_pxor( a,b); } \
inline I##vect##vec##element andnot (const I##vect##vec##element &a, const I##vect##vec##element &b) \
{ return _m_pandn( a,b); }
IVEC_LOGICALS(8,8)
IVEC_LOGICALS(u8,8)
IVEC_LOGICALS(s8,8)
IVEC_LOGICALS(16,4)
IVEC_LOGICALS(u16,4)
IVEC_LOGICALS(s16,4)
IVEC_LOGICALS(32,2)
IVEC_LOGICALS(u32,2)
IVEC_LOGICALS(s32,2)
IVEC_LOGICALS(64,1)
#undef IVEC_LOGICALS
/********************************* Add & Sub ****************************************/
#define IVEC_ADD_SUB(vect,element,opsize) \
inline I##vect##vec##element operator+ (const I##vect##vec##element &a, const I##vect##vec##element &b) \
{ return _m_padd##opsize( a,b); } \
inline I##vect##vec##element operator- (const I##vect##vec##element &a, const I##vect##vec##element &b) \
{ return _m_psub##opsize( a,b); }
IVEC_ADD_SUB(8,8, b)
IVEC_ADD_SUB(u8,8, b)
IVEC_ADD_SUB(s8,8, b)
IVEC_ADD_SUB(16,4, w)
IVEC_ADD_SUB(u16,4, w)
IVEC_ADD_SUB(s16,4, w)
IVEC_ADD_SUB(32,2, d)
IVEC_ADD_SUB(u32,2, d)
IVEC_ADD_SUB(s32,2, d)
#undef IVEC_ADD_SUB
/********************************* Conditional Select ****************************************/
/* version of: retval = (a OP b)? c : d; *
* Where OP is one of the possible comparision operators. *
* Example: r = select_eq(a,b,c,d); *
* if "member at position x of the vector a" == "member at position x of vector b" *
* assign the corresponding member in r from c, else assign from d. *
********************************* Conditional Select ****************************************/
#define IVEC_SELECT(vect12,vect34,element,selop,arg1,arg2) \
inline I##vect34##vec##element select_##selop (const I##vect12##vec##element &a, const I##vect12##vec##element &b, const I##vect34##vec##element &c, const I##vect34##vec##element &d) \
{ \
I##vect12##vec##element mask = cmp##selop(a,b); \
return( I##vect34##vec##element ((mask & arg1 ) | I##vect12##vec##element ((_m_pandn(mask, arg2 ))))); \
}
IVEC_SELECT(8,s8,8,eq,c,d)
IVEC_SELECT(8,u8,8,eq,c,d)
IVEC_SELECT(8,8,8,eq,c,d)
IVEC_SELECT(8,s8,8,neq,c,d)
IVEC_SELECT(8,u8,8,neq,c,d)
IVEC_SELECT(8,8,8,neq,c,d)
IVEC_SELECT(16,s16,4,eq,c,d)
IVEC_SELECT(16,u16,4,eq,c,d)
IVEC_SELECT(16,16,4,eq,c,d)
IVEC_SELECT(16,s16,4,neq,c,d)
IVEC_SELECT(16,u16,4,neq,c,d)
IVEC_SELECT(16,16,4,neq,c,d)
IVEC_SELECT(32,s32,2,eq,c,d)
IVEC_SELECT(32,u32,2,eq,c,d)
IVEC_SELECT(32,32,2,eq,c,d)
IVEC_SELECT(32,s32,2,neq,c,d)
IVEC_SELECT(32,u32,2,neq,c,d)
IVEC_SELECT(32,32,2,neq,c,d)
IVEC_SELECT(s8,s8,8,gt,c,d)
IVEC_SELECT(s8,u8,8,gt,c,d)
IVEC_SELECT(s8,8,8,gt,c,d)
IVEC_SELECT(s8,s8,8,lt,c,d)
IVEC_SELECT(s8,u8,8,lt,c,d)
IVEC_SELECT(s8,8,8,lt,c,d)
IVEC_SELECT(s8,s8,8,le,c,d)
IVEC_SELECT(s8,u8,8,le,c,d)
IVEC_SELECT(s8,8,8,le,c,d)
IVEC_SELECT(s8,s8,8,ge,c,d)
IVEC_SELECT(s8,u8,8,ge,c,d)
IVEC_SELECT(s8,8,8,ge,c,d)
IVEC_SELECT(s16,s16,4,gt,c,d)
IVEC_SELECT(s16,u16,4,gt,c,d)
IVEC_SELECT(s16,16,4,gt,c,d)
IVEC_SELECT(s16,s16,4,lt,c,d)
IVEC_SELECT(s16,u16,4,lt,c,d)
IVEC_SELECT(s16,16,4,lt,c,d)
IVEC_SELECT(s16,s16,4,le,c,d)
IVEC_SELECT(s16,u16,4,le,c,d)
IVEC_SELECT(s16,16,4,le,c,d)
IVEC_SELECT(s16,s16,4,ge,c,d)
IVEC_SELECT(s16,u16,4,ge,c,d)
IVEC_SELECT(s16,16,4,ge,c,d)
IVEC_SELECT(s32,s32,2,gt,c,d)
IVEC_SELECT(s32,u32,2,gt,c,d)
IVEC_SELECT(s32,32,2,gt,c,d)
IVEC_SELECT(s32,s32,2,lt,c,d)
IVEC_SELECT(s32,u32,2,lt,c,d)
IVEC_SELECT(s32,32,2,lt,c,d)
IVEC_SELECT(s32,s32,2,le,c,d)
IVEC_SELECT(s32,u32,2,le,c,d)
IVEC_SELECT(s32,32,2,le,c,d)
IVEC_SELECT(s32,s32,2,ge,c,d)
IVEC_SELECT(s32,u32,2,ge,c,d)
IVEC_SELECT(s32,32,2,ge,c,d)
#undef IVEC_SELECT
inline static void empty(void) { _m_empty(); }
#if defined(_SILENCE_IVEC_C4799)
#pragma warning(pop)
#endif
#endif // IVEC_H_INCLUDED

View File

@@ -0,0 +1,257 @@
/*--
Module Name:
largeint.h
Abstract:
Include file for sample Large Integer Arithmetic routines.
This file includes all of the prototypes for the routines found in
largeint.lib. For complete descriptions of these functions, see the
largeint.s source file for MIPS, or the divlarge.c and largeint.asm
source files for x86.
Revision History:
--*/
#ifdef __cplusplus
extern "C" {
#endif
//
//Large integer arithmetic routines.
//
//
// Large integer add - 64-bits + 64-bits -> 64-bits
//
LARGE_INTEGER
WINAPI
LargeIntegerAdd (
LARGE_INTEGER Addend1,
LARGE_INTEGER Addend2
);
//
// Enlarged integer multiply - 32-bits * 32-bits -> 64-bits
//
LARGE_INTEGER
WINAPI
EnlargedIntegerMultiply (
LONG Multiplicand,
LONG Multiplier
);
//
// Unsigned enlarged integer multiply - 32-bits * 32-bits -> 64-bits
//
LARGE_INTEGER
WINAPI
EnlargedUnsignedMultiply (
ULONG Multiplicand,
ULONG Multiplier
);
//
// Enlarged integer divide - 64-bits / 32-bits > 32-bits
//
ULONG
WINAPI
EnlargedUnsignedDivide (
IN ULARGE_INTEGER Dividend,
IN ULONG Divisor,
IN PULONG Remainder
);
//
// Extended large integer magic divide - 64-bits / 32-bits -> 64-bits
//
LARGE_INTEGER
WINAPI
ExtendedMagicDivide (
LARGE_INTEGER Dividend,
LARGE_INTEGER MagicDivisor,
CCHAR ShiftCount
);
//
// Large Integer divide - 64-bits / 32-bits -> 64-bits
//
LARGE_INTEGER
WINAPI
ExtendedLargeIntegerDivide (
LARGE_INTEGER Dividend,
ULONG Divisor,
PULONG Remainder
);
//
// Large Integer divide - 64-bits / 32-bits -> 64-bits
//
LARGE_INTEGER
WINAPI
LargeIntegerDivide (
LARGE_INTEGER Dividend,
LARGE_INTEGER Divisor,
PLARGE_INTEGER Remainder
);
//
// Extended integer multiply - 32-bits * 64-bits -> 64-bits
//
LARGE_INTEGER
WINAPI
ExtendedIntegerMultiply (
LARGE_INTEGER Multiplicand,
LONG Multiplier
);
//
// Large integer negation - -(64-bits)
//
LARGE_INTEGER
WINAPI
LargeIntegerNegate (
LARGE_INTEGER Subtrahend
);
//
// Large integer subtract - 64-bits - 64-bits -> 64-bits.
//
LARGE_INTEGER
WINAPI
LargeIntegerSubtract (
LARGE_INTEGER Minuend,
LARGE_INTEGER Subtrahend
);
//
// Large integer and - 64-bite & 64-bits -> 64-bits.
//
#define LargeIntegerAnd(Result, Source, Mask) \
{ \
Result.HighPart = Source.HighPart & Mask.HighPart; \
Result.LowPart = Source.LowPart & Mask.LowPart; \
}
//
// Large integer conversion routines.
//
//
// Convert signed integer to large integer.
//
LARGE_INTEGER
WINAPI
ConvertLongToLargeInteger (
LONG SignedInteger
);
//
// Convert unsigned integer to large integer.
//
LARGE_INTEGER
WINAPI
ConvertUlongToLargeInteger (
ULONG UnsignedInteger
);
//
// Large integer shift routines.
//
LARGE_INTEGER
WINAPI
LargeIntegerShiftLeft (
LARGE_INTEGER LargeInteger,
CCHAR ShiftCount
);
LARGE_INTEGER
WINAPI
LargeIntegerShiftRight (
LARGE_INTEGER LargeInteger,
CCHAR ShiftCount
);
LARGE_INTEGER
WINAPI
LargeIntegerArithmeticShift (
LARGE_INTEGER LargeInteger,
CCHAR ShiftCount
);
#define LargeIntegerGreaterThan(X,Y) ( \
(((X).HighPart == (Y).HighPart) && ((X).LowPart > (Y).LowPart)) || \
((X).HighPart > (Y).HighPart) \
)
#define LargeIntegerGreaterThanOrEqualTo(X,Y) ( \
(((X).HighPart == (Y).HighPart) && ((X).LowPart >= (Y).LowPart)) || \
((X).HighPart > (Y).HighPart) \
)
#define LargeIntegerEqualTo(X,Y) ( \
!(((X).LowPart ^ (Y).LowPart) | ((X).HighPart ^ (Y).HighPart)) \
)
#define LargeIntegerNotEqualTo(X,Y) ( \
(((X).LowPart ^ (Y).LowPart) | ((X).HighPart ^ (Y).HighPart)) \
)
#define LargeIntegerLessThan(X,Y) ( \
(((X).HighPart == (Y).HighPart) && ((X).LowPart < (Y).LowPart)) || \
((X).HighPart < (Y).HighPart) \
)
#define LargeIntegerLessThanOrEqualTo(X,Y) ( \
(((X).HighPart == (Y).HighPart) && ((X).LowPart <= (Y).LowPart)) || \
((X).HighPart < (Y).HighPart) \
)
#define LargeIntegerGreaterThanZero(X) ( \
(((X).HighPart == 0) && ((X).LowPart > 0)) || \
((X).HighPart > 0 ) \
)
#define LargeIntegerGreaterOrEqualToZero(X) ( \
(X).HighPart >= 0 \
)
#define LargeIntegerEqualToZero(X) ( \
!((X).LowPart | (X).HighPart) \
)
#define LargeIntegerNotEqualToZero(X) ( \
((X).LowPart | (X).HighPart) \
)
#define LargeIntegerLessThanZero(X) ( \
((X).HighPart < 0) \
)
#define LargeIntegerLessOrEqualToZero(X) ( \
((X).HighPart < 0) || !((X).LowPart | (X).HighPart) \
)
#ifdef __cplusplus
}
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,125 @@
/***
*limits.h - implementation dependent values
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* Contains defines for a number of implementation dependent values
* which are commonly used in C programs.
* [ANSI]
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_LIMITS
#define _INC_LIMITS
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
#define CHAR_BIT 8 /* number of bits in a char */
#define SCHAR_MIN (-128) /* minimum signed char value */
#define SCHAR_MAX 127 /* maximum signed char value */
#define UCHAR_MAX 0xff /* maximum unsigned char value */
#ifndef _CHAR_UNSIGNED
#define CHAR_MIN SCHAR_MIN /* mimimum char value */
#define CHAR_MAX SCHAR_MAX /* maximum char value */
#else
#define CHAR_MIN 0
#define CHAR_MAX UCHAR_MAX
#endif /* _CHAR_UNSIGNED */
#define MB_LEN_MAX 5 /* max. # bytes in multibyte char */
#define SHRT_MIN (-32768) /* minimum (signed) short value */
#define SHRT_MAX 32767 /* maximum (signed) short value */
#define USHRT_MAX 0xffff /* maximum unsigned short value */
#define INT_MIN (-2147483647 - 1) /* minimum (signed) int value */
#define INT_MAX 2147483647 /* maximum (signed) int value */
#define UINT_MAX 0xffffffff /* maximum unsigned int value */
#define LONG_MIN (-2147483647L - 1) /* minimum (signed) long value */
#define LONG_MAX 2147483647L /* maximum (signed) long value */
#define ULONG_MAX 0xffffffffUL /* maximum unsigned long value */
/* Make sure these macros don't show up in ANSI C++ code */
#if !defined(__cplusplus) || defined(_MSC_EXTENSIONS)
#define LLONG_MAX 0x7fffffffffffffff /*maximum signed __int64 value */
#define LLONG_MIN 0x8000000000000000 /*minimum signed __int64 value */
#define ULLONG_MAX 0xffffffffffffffff /*maximum unsigned __int64 value */
#endif
#if _INTEGRAL_MAX_BITS >= 8
#define _I8_MIN (-127i8 - 1) /* minimum signed 8 bit value */
#define _I8_MAX 127i8 /* maximum signed 8 bit value */
#define _UI8_MAX 0xffui8 /* maximum unsigned 8 bit value */
#endif
#if _INTEGRAL_MAX_BITS >= 16
#define _I16_MIN (-32767i16 - 1) /* minimum signed 16 bit value */
#define _I16_MAX 32767i16 /* maximum signed 16 bit value */
#define _UI16_MAX 0xffffui16 /* maximum unsigned 16 bit value */
#endif
#if _INTEGRAL_MAX_BITS >= 32
#define _I32_MIN (-2147483647i32 - 1) /* minimum signed 32 bit value */
#define _I32_MAX 2147483647i32 /* maximum signed 32 bit value */
#define _UI32_MAX 0xffffffffui32 /* maximum unsigned 32 bit value */
#endif
#if _INTEGRAL_MAX_BITS >= 64
/* minimum signed 64 bit value */
#define _I64_MIN (-9223372036854775807i64 - 1)
/* maximum signed 64 bit value */
#define _I64_MAX 9223372036854775807i64
/* maximum unsigned 64 bit value */
#define _UI64_MAX 0xffffffffffffffffui64
#endif
#if _INTEGRAL_MAX_BITS >= 128
/* minimum signed 128 bit value */
#define _I128_MIN (-170141183460469231731687303715884105727i128 - 1)
/* maximum signed 128 bit value */
#define _I128_MAX 170141183460469231731687303715884105727i128
/* maximum unsigned 128 bit value */
#define _UI128_MAX 0xffffffffffffffffffffffffffffffffui128
#endif
#ifdef _POSIX_
#define _POSIX_ARG_MAX 4096
#define _POSIX_CHILD_MAX 6
#define _POSIX_LINK_MAX 8
#define _POSIX_MAX_CANON 255
#define _POSIX_MAX_INPUT 255
#define _POSIX_NAME_MAX 14
#define _POSIX_NGROUPS_MAX 0
#define _POSIX_OPEN_MAX 16
#define _POSIX_PATH_MAX 255
#define _POSIX_PIPE_BUF 512
#define _POSIX_SSIZE_MAX 32767
#define _POSIX_STREAM_MAX 8
#define _POSIX_TZNAME_MAX 3
#define ARG_MAX 14500 /* 16k heap, minus overhead */
#define LINK_MAX 1024
#define MAX_CANON _POSIX_MAX_CANON
#define MAX_INPUT _POSIX_MAX_INPUT
#define NAME_MAX 255
#define NGROUPS_MAX 16
#define OPEN_MAX 32
#define PATH_MAX 512
#define PIPE_BUF _POSIX_PIPE_BUF
#define SSIZE_MAX _POSIX_SSIZE_MAX
#define STREAM_MAX 20
#define TZNAME_MAX 10
#endif /* POSIX */
#endif /* _INC_LIMITS */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,244 @@
// locale standard header
#pragma once
#ifndef _LOCALE_
#define _LOCALE_
#include <string>
#include <xlocmes>
#include <xlocmon>
#include <xlocnum>
#include <xloctime>
#pragma pack(push,8)
#pragma warning(push,3)
_STD_BEGIN
// TEMPLATE CLASS collate
template<class _Elem>
class collate
: public locale::facet
{ // facet for ordering sequences of elements
public:
typedef _Elem char_type;
typedef basic_string<_Elem, char_traits<_Elem>,
allocator<_Elem> > string_type;
int compare(const _Elem *_First1, const _Elem *_Last1,
const _Elem *_First2, const _Elem *_Last2) const
{ // compare [_First1, _Last1) to [_First2, _Last2)
return (do_compare(_First1, _Last1, _First2, _Last2));
}
string_type transform(const _Elem *_First, const _Elem *_Last) const
{ // transform [_First, _Last) to key string
return (do_transform(_First, _Last));
}
long hash(const _Elem *_First, const _Elem *_Last) const
{ // compute hash code for [_First, _Last)
return (do_hash(_First, _Last));
}
static locale::id id; // unique facet id
explicit collate(size_t _Refs = 0)
: locale::facet(_Refs)
{ // construct from current locale
_Init(_Locinfo());
}
collate(const _Locinfo& _Lobj, size_t _Refs = 0)
: locale::facet(_Refs)
{ // construct from specified locale
_Init(_Lobj);
}
static size_t __cdecl _Getcat(const locale::facet **_Ppf = 0)
{ // return locale category mask and construct standard facet
if (_Ppf != 0 && *_Ppf == 0)
*_Ppf = _NEW_CRT collate<_Elem>;
return (_X_COLLATE);
}
_PROTECTED:
~collate()
{ // destroy the object
}
protected:
void _Init(const _Locinfo& _Lobj)
{ // initialize from _Lobj
_Coll = _Lobj._Getcoll();
}
virtual int do_compare(const _Elem *_First1, const _Elem *_Last1,
const _Elem *_First2, const _Elem *_Last2) const
{ // compare [_First1, _Last1) to [_First2, _Last2)
return (_LStrcoll(_First1, _Last1, _First2, _Last2, &_Coll));
}
virtual string_type do_transform(const _Elem *_First,
const _Elem *_Last) const
{ // transform [_First, _Last) to key string
size_t _Count;
string_type _Str;
for (_Count = _Last - _First; 0 < _Count; )
{ // grow string if locale-specific strxfrm fails
_Str.resize(_Count);
if ((_Count = _LStrxfrm(&*_Str.begin(),
&*_Str.begin() + _Str.size(),
_First, _Last, &_Coll)) <= _Str.size())
break;
}
_Str.resize(_Count);
return (_Str);
}
virtual long do_hash(const _Elem *_First,
const _Elem *_Last) const
{ // compute hash code for [_First, _Last)
unsigned long _Val = 0;
for (; _First != _Last; ++_First)
_Val = (_Val << 8 | _Val >> 24) + *_First;
return ((long)_Val);
}
private:
_Locinfo::_Collvec _Coll; // used by _LStrcoll and _XStrxfrm
};
// STATIC collate::id OBJECT
template<class _Elem>
locale::id collate<_Elem>::id;
#ifdef _DLL_CPPLIB
template class _CRTIMP2 collate<char>;
template class _CRTIMP2 collate<wchar_t>;
#endif /* _DLL_CPPLIB */
// TEMPLATE CLASS collate_byname
template<class _Elem>
class collate_byname
: public collate<_Elem>
{ // collate for named locale
public:
explicit collate_byname(const char *_Locname, size_t _Refs = 0)
: collate<_Elem>(_Locinfo(_Locname), _Refs)
{ // construct for named locale
}
_PROTECTED:
virtual ~collate_byname()
{ // destroy the object
}
};
// locale SUPPORT TEMPLATES
#define _HAS(loc, fac) has_facet<fac>(loc)
template<class _Facet> inline
bool has_facet(const locale& _Loc) _THROW0()
{ // test if facet is in locale
_Lockit _Lock(_LOCK_LOCALE); // the thread lock, make get atomic
size_t _Id = _Facet::id;
return (_Loc._Getfacet(_Id) != 0 || _Facet::_Getcat() != (size_t)(-1));
}
template<class _Facet> inline _DEPRECATED
bool has_facet(const locale& _Loc, const _Facet *) _THROW0()
{ // test if facet is in locale -- retained, two arg version
return (has_facet<_Facet>(_Loc));
}
// ctype TEMPLATE FUNCTIONS
template<class _Elem> inline
bool (isalnum)(_Elem _Ch, const locale& _Loc)
{ // test if character is alphanumeric, locale specific
return (_USE(_Loc, ctype<_Elem>).is(ctype_base::alnum, _Ch));
}
template<class _Elem> inline
bool (isalpha)(_Elem _Ch, const locale& _Loc)
{ // test if character is alphabetic, locale specific
return (_USE(_Loc, ctype<_Elem>).is(ctype_base::alpha, _Ch));
}
template<class _Elem> inline
bool (iscntrl)(_Elem _Ch, const locale& _Loc)
{ // test if character is control, locale specific
return (_USE(_Loc, ctype<_Elem>).is(ctype_base::cntrl, _Ch));
}
template<class _Elem> inline
bool (isdigit)(_Elem _Ch, const locale& _Loc)
{ // test if character is digit, locale specific
return (_USE(_Loc, ctype<_Elem>).is(ctype_base::digit, _Ch));
}
template<class _Elem> inline
bool (isgraph)(_Elem _Ch, const locale& _Loc)
{ // test if character is graphic, locale specific
return (_USE(_Loc, ctype<_Elem>).is(ctype_base::graph, _Ch));
}
template<class _Elem> inline
bool (islower)(_Elem _Ch, const locale& _Loc)
{ // test if character is lower case, locale specific
return (_USE(_Loc, ctype<_Elem>).is(ctype_base::lower, _Ch));
}
template<class _Elem> inline
bool (isprint)(_Elem _Ch, const locale& _Loc)
{ // test if character is printing, locale specific
return (_USE(_Loc, ctype<_Elem>).is(ctype_base::print, _Ch));
}
template<class _Elem> inline
bool (ispunct)(_Elem _Ch, const locale& _Loc)
{ // test if character is punctuation, locale specific
return (_USE(_Loc, ctype<_Elem>).is(ctype_base::punct, _Ch));
}
template<class _Elem> inline
bool (isspace)(_Elem _Ch, const locale& _Loc)
{ // test if character is whitespace, locale specific
return (_USE(_Loc, ctype<_Elem>).is(ctype_base::space, _Ch));
}
template<class _Elem> inline
bool (isupper)(_Elem _Ch, const locale& _Loc)
{ // test if character is upper case, locale specific
return (_USE(_Loc, ctype<_Elem>).is(ctype_base::upper, _Ch));
}
template<class _Elem> inline
bool (isxdigit)(_Elem _Ch, const locale& _Loc)
{ // test if character is hexadecimal digit, locale specific
return (_USE(_Loc, ctype<_Elem>).is(ctype_base::xdigit, _Ch));
}
template<class _Elem> inline
_Elem (tolower)(_Elem _Ch, const locale& _Loc)
{ // convert character to lower case, locale specific
return (_USE(_Loc, ctype<_Elem>).tolower(_Ch));
}
template<class _Elem> inline
_Elem (toupper)(_Elem _Ch, const locale& _Loc)
{ // convert character to upper case, locale specific
return (_USE(_Loc, ctype<_Elem>).toupper(_Ch));
}
_STD_END
#pragma warning(pop)
#pragma pack(pop)
#endif /* _LOCALE_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

View File

@@ -0,0 +1,141 @@
/***
*locale.h - definitions/declarations for localization routines
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file defines the structures, values, macros, and functions
* used by the localization routines.
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_LOCALE
#define _INC_LOCALE
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
#ifdef _MSC_VER
/*
* Currently, all MS C compilers for Win32 platforms default to 8 byte
* alignment.
*/
#pragma pack(push,8)
#endif /* _MSC_VER */
#ifdef __cplusplus
extern "C" {
#endif
/* Define _CRTIMP */
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* ndef _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* _CRTIMP */
/* Define __cdecl for non-Microsoft compilers */
#if ( !defined(_MSC_VER) && !defined(__cdecl) )
#define __cdecl
#endif
#ifndef _WCHAR_T_DEFINED
typedef unsigned short wchar_t;
#define _WCHAR_T_DEFINED
#endif
/* define NULL pointer value */
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
/* Locale categories */
#define LC_ALL 0
#define LC_COLLATE 1
#define LC_CTYPE 2
#define LC_MONETARY 3
#define LC_NUMERIC 4
#define LC_TIME 5
#define LC_MIN LC_ALL
#define LC_MAX LC_TIME
/* Locale convention structure */
#ifndef _LCONV_DEFINED
struct lconv {
char *decimal_point;
char *thousands_sep;
char *grouping;
char *int_curr_symbol;
char *currency_symbol;
char *mon_decimal_point;
char *mon_thousands_sep;
char *mon_grouping;
char *positive_sign;
char *negative_sign;
char int_frac_digits;
char frac_digits;
char p_cs_precedes;
char p_sep_by_space;
char n_cs_precedes;
char n_sep_by_space;
char p_sign_posn;
char n_sign_posn;
};
#define _LCONV_DEFINED
#endif
/* ANSI: char lconv members default is CHAR_MAX which is compile time
dependent. Defining and using _charmax here causes CRT startup code
to initialize lconv members properly */
#ifdef _CHAR_UNSIGNED
extern int _charmax;
extern __inline int __dummy() { return _charmax; }
#endif
/* function prototypes */
_CRTIMP char * __cdecl setlocale(int, const char *);
_CRTIMP struct lconv * __cdecl localeconv(void);
#ifndef _WLOCALE_DEFINED
/* wide function prototypes, also declared in wchar.h */
_CRTIMP wchar_t * __cdecl _wsetlocale(int, const wchar_t *);
#define _WLOCALE_DEFINED
#endif
#ifdef __cplusplus
}
#endif
#ifdef _MSC_VER
#pragma pack(pop)
#endif /* _MSC_VER */
#endif /* _INC_LOCALE */

View File

@@ -0,0 +1,188 @@
/***
*malloc.h - declarations and definitions for memory allocation functions
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* Contains the function declarations for memory allocation functions;
* also defines manifest constants and types used by the heap routines.
* [System V]
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_MALLOC
#define _INC_MALLOC
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
#ifdef _MSC_VER
/*
* Currently, all MS C compilers for Win32 platforms default to 8 byte
* alignment.
*/
#pragma pack(push,8)
#endif /* _MSC_VER */
#ifdef __cplusplus
extern "C" {
#endif
#if !defined(_W64)
#if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
#define _W64 __w64
#else
#define _W64
#endif
#endif
/* Define _CRTIMP */
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* ndef _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* _CRTIMP */
/* Define __cdecl for non-Microsoft compilers */
#if ( !defined(_MSC_VER) && !defined(__cdecl) )
#define __cdecl
#endif
#ifndef _SIZE_T_DEFINED
#ifdef _WIN64
typedef unsigned __int64 size_t;
#else
typedef _W64 unsigned int size_t;
#endif
#define _SIZE_T_DEFINED
#endif
#ifndef _INTPTR_T_DEFINED
#ifdef _WIN64
typedef __int64 intptr_t;
#else
typedef _W64 int intptr_t;
#endif
#define _INTPTR_T_DEFINED
#endif
/* Maximum heap request the heap manager will attempt */
#ifdef _WIN64
#define _HEAP_MAXREQ 0xFFFFFFFFFFFFFFE0
#else
#define _HEAP_MAXREQ 0xFFFFFFE0
#endif
/* Constants for _heapchk/_heapset/_heapwalk routines */
#define _HEAPEMPTY (-1)
#define _HEAPOK (-2)
#define _HEAPBADBEGIN (-3)
#define _HEAPBADNODE (-4)
#define _HEAPEND (-5)
#define _HEAPBADPTR (-6)
#define _FREEENTRY 0
#define _USEDENTRY 1
#ifndef _HEAPINFO_DEFINED
typedef struct _heapinfo {
int * _pentry;
size_t _size;
int _useflag;
} _HEAPINFO;
#define _HEAPINFO_DEFINED
#endif
/* External variable declarations */
extern unsigned int _amblksiz;
#define _mm_free(a) _aligned_free(a)
#define _mm_malloc(a, b) _aligned_malloc(a, b)
/* Function prototypes */
_CRTIMP void * __cdecl calloc(size_t, size_t);
_CRTIMP void __cdecl free(void *);
_CRTIMP void * __cdecl malloc(size_t);
_CRTIMP void * __cdecl realloc(void *, size_t);
_CRTIMP void __cdecl _aligned_free(void *);
_CRTIMP void * __cdecl _aligned_malloc(size_t, size_t);
_CRTIMP void * __cdecl _aligned_offset_malloc(size_t, size_t, size_t);
_CRTIMP void * __cdecl _aligned_realloc(void *, size_t, size_t);
_CRTIMP void * __cdecl _aligned_offset_realloc(void *, size_t, size_t, size_t);
_CRTIMP int __cdecl _resetstkoflw (void);
#ifndef _POSIX_
void * __cdecl _alloca(size_t);
_CRTIMP void * __cdecl _expand(void *, size_t);
_CRTIMP size_t __cdecl _get_sbh_threshold(void);
_CRTIMP int __cdecl _set_sbh_threshold(size_t);
_CRTIMP int __cdecl _heapadd(void *, size_t);
_CRTIMP int __cdecl _heapchk(void);
_CRTIMP int __cdecl _heapmin(void);
_CRTIMP int __cdecl _heapset(unsigned int);
_CRTIMP int __cdecl _heapwalk(_HEAPINFO *);
_CRTIMP size_t __cdecl _heapused(size_t *, size_t *);
_CRTIMP size_t __cdecl _msize(void *);
_CRTIMP intptr_t __cdecl _get_heap_handle(void);
#if !__STDC__
/* Non-ANSI names for compatibility */
#define alloca _alloca
#endif /* __STDC__*/
#if defined(_M_MRX000) || defined(_M_PPC) || defined(_M_ALPHA)
#pragma intrinsic(_alloca)
#endif
#endif /* _POSIX_ */
#ifdef HEAPHOOK
#ifndef _HEAPHOOK_DEFINED
/* hook function type */
typedef int (__cdecl * _HEAPHOOK)(int, size_t, void *, void **);
#define _HEAPHOOK_DEFINED
#endif /* _HEAPHOOK_DEFINED */
/* set hook function */
_CRTIMP _HEAPHOOK __cdecl _setheaphook(_HEAPHOOK);
/* hook function must handle these types */
#define _HEAP_MALLOC 1
#define _HEAP_CALLOC 2
#define _HEAP_FREE 3
#define _HEAP_REALLOC 4
#define _HEAP_MSIZE 5
#define _HEAP_EXPAND 6
#endif /* HEAPHOOK */
#ifdef __cplusplus
}
#endif
#ifdef _MSC_VER
#pragma pack(pop)
#endif /* _MSC_VER */
#endif /* _INC_MALLOC */

View File

@@ -0,0 +1,268 @@
// map standard header
#pragma once
#ifndef _MAP_
#define _MAP_
#include <xtree>
#pragma pack(push,8)
#pragma warning(push,3)
_STD_BEGIN
// TEMPLATE CLASS _Tmap_traits
template<class _Kty, // key type
class _Ty, // mapped type
class _Pr, // comparator predicate type
class _Alloc, // actual allocator type (should be value allocator)
bool _Mfl> // true if multiple equivalent keys are permitted
class _Tmap_traits
{ // traits required to make _Tree behave like a map
public:
typedef _Kty key_type;
typedef pair<const _Kty, _Ty> value_type;
typedef _Pr key_compare;
typedef typename _Alloc::template rebind<value_type>::other
allocator_type;
typedef _POINTER_X(value_type, allocator_type) _ITptr;
typedef _REFERENCE_X(value_type, allocator_type) _IReft;
enum
{ // make multi parameter visible as an enum constant
_Multi = _Mfl};
_Tmap_traits()
: comp()
{ // construct with default comparator
}
_Tmap_traits(_Pr _Parg)
: comp(_Parg)
{ // construct with specified comparator
}
class value_compare
: public binary_function<value_type, value_type, bool>
{ // functor for comparing two element values
friend class _Tmap_traits<_Kty, _Ty, _Pr, _Alloc, _Mfl>;
public:
bool operator()(const value_type& _Left,
const value_type& _Right) const
{ // test if _Left precedes _Right by comparing just keys
return (comp(_Left.first, _Right.first));
}
value_compare(key_compare _Pred)
: comp(_Pred)
{ // construct with specified predicate
}
protected:
key_compare comp; // the comparator predicate for keys
};
static const _Kty& _Kfn(const value_type& _Val)
{ // extract key from element value
return (_Val.first);
}
_Pr comp; // the comparator predicate for keys
};
// TEMPLATE CLASS map
template<class _Kty,
class _Ty,
class _Pr = less<_Kty>,
class _Alloc = allocator<pair<const _Kty, _Ty> > >
class map
: public _Tree<_Tmap_traits<_Kty, _Ty, _Pr, _Alloc, false> >
{ // ordered red-black tree of {key, mapped} values, unique keys
public:
typedef map<_Kty, _Ty, _Pr, _Alloc> _Myt;
typedef _Tree<_Tmap_traits<_Kty, _Ty, _Pr, _Alloc, false> > _Mybase;
typedef _Kty key_type;
typedef _Ty mapped_type;
typedef _Ty referent_type; // retained
typedef _Pr key_compare;
typedef typename _Mybase::value_compare value_compare;
typedef typename _Mybase::allocator_type allocator_type;
typedef typename _Mybase::size_type size_type;
typedef typename _Mybase::difference_type difference_type;
typedef typename _Mybase::pointer pointer;
typedef typename _Mybase::const_pointer const_pointer;
typedef typename _Mybase::reference reference;
typedef typename _Mybase::const_reference const_reference;
typedef typename _Mybase::iterator iterator;
typedef typename _Mybase::const_iterator const_iterator;
typedef typename _Mybase::reverse_iterator reverse_iterator;
typedef typename _Mybase::const_reverse_iterator
const_reverse_iterator;
typedef typename _Mybase::value_type value_type;
map()
: _Mybase(key_compare(), allocator_type())
{ // construct empty map from defaults
}
explicit map(const key_compare& _Pred)
: _Mybase(_Pred, allocator_type())
{ // construct empty map from comparator
}
map(const key_compare& _Pred, const allocator_type& _Al)
: _Mybase(_Pred, _Al)
{ // construct empty map from comparator and allocator
}
template<class _Iter>
map(_Iter _First, _Iter _Last)
: _Mybase(key_compare(), allocator_type())
{ // construct map from [_First, _Last), defaults
for (; _First != _Last; ++_First)
this->insert(*_First);
}
template<class _Iter>
map(_Iter _First, _Iter _Last,
const key_compare& _Pred)
: _Mybase(_Pred, allocator_type())
{ // construct map from [_First, _Last), comparator
for (; _First != _Last; ++_First)
this->insert(*_First);
}
template<class _Iter>
map(_Iter _First, _Iter _Last,
const key_compare& _Pred, const allocator_type& _Al)
: _Mybase(_Pred, _Al)
{ // construct map from [_First, _Last), comparator, and allocator
for (; _First != _Last; ++_First)
this->insert(*_First);
}
mapped_type& operator[](const key_type& _Keyval)
{ // find element matching _Keyval or insert with default mapped
iterator _Where = this->lower_bound(_Keyval);
if (_Where == this->end() || this->comp(_Keyval, this->_Key(_Where._Mynode())))
_Where = this->insert(_Where,
value_type(_Keyval, mapped_type()));
return ((*_Where).second);
}
};
template<class _Kty,
class _Ty,
class _Pr,
class _Alloc> inline
void swap(map<_Kty, _Ty, _Pr, _Alloc>& _Left,
map<_Kty, _Ty, _Pr, _Alloc>& _Right)
{ // swap _Left and _Right maps
_Left.swap(_Right);
}
// TEMPLATE CLASS multimap
template<class _Kty,
class _Ty,
class _Pr = less<_Kty>,
class _Alloc = allocator<pair<const _Kty, _Ty> > >
class multimap
: public _Tree<_Tmap_traits<_Kty, _Ty, _Pr, _Alloc, true> >
{ // ordered red-black tree of {key, mapped} values, non-unique keys
public:
typedef multimap<_Kty, _Ty, _Pr, _Alloc> _Myt;
typedef _Tree<_Tmap_traits<_Kty, _Ty, _Pr, _Alloc, true> > _Mybase;
typedef _Kty key_type;
typedef _Ty mapped_type;
typedef _Ty referent_type; // retained
typedef _Pr key_compare;
typedef typename _Mybase::value_compare value_compare;
typedef typename _Mybase::allocator_type allocator_type;
typedef typename _Mybase::size_type size_type;
typedef typename _Mybase::difference_type difference_type;
typedef typename _Mybase::pointer pointer;
typedef typename _Mybase::const_pointer const_pointer;
typedef typename _Mybase::reference reference;
typedef typename _Mybase::const_reference const_reference;
typedef typename _Mybase::iterator iterator;
typedef typename _Mybase::const_iterator const_iterator;
typedef typename _Mybase::reverse_iterator reverse_iterator;
typedef typename _Mybase::const_reverse_iterator
const_reverse_iterator;
typedef typename _Mybase::value_type value_type;
multimap()
: _Mybase(key_compare(), allocator_type())
{ // construct empty map from defaults
}
explicit multimap(const key_compare& _Pred)
: _Mybase(_Pred, allocator_type())
{ // construct empty map from comparator
}
multimap(const key_compare& _Pred, const allocator_type& _Al)
: _Mybase(_Pred, _Al)
{ // construct empty map from comparator and allocator
}
template<class _Iter>
multimap(_Iter _First, _Iter _Last)
: _Mybase(key_compare(), allocator_type())
{ // construct map from [_First, _Last), defaults
for (; _First != _Last; ++_First)
insert(*_First);
}
template<class _Iter>
multimap(_Iter _First, _Iter _Last,
const key_compare& _Pred)
: _Mybase(_Pred, allocator_type())
{ // construct map from [_First, _Last), comparator
for (; _First != _Last; ++_First)
insert(*_First);
}
template<class _Iter>
multimap(_Iter _First, _Iter _Last,
const key_compare& _Pred, const allocator_type& _Al)
: _Mybase(_Pred, _Al)
{ // construct map from [_First, _Last), comparator, and allocator
for (; _First != _Last; ++_First)
insert(*_First);
}
iterator insert(const value_type& _Val)
{ // insert a {key, mapped} value
return (_Mybase::insert(_Val).first);
}
iterator insert(iterator _Where, const value_type& _Val)
{ // insert a {key, mapped} value, with hint
return (_Mybase::insert(_Where, _Val));
}
template<class _Iter>
void insert(_Iter _First, _Iter _Last)
{ // insert [_First, _Last), arbitrary iterators
for (; _First != _Last; ++_First)
insert(*_First);
}
};
template<class _Kty,
class _Ty,
class _Pr,
class _Alloc> inline
void swap(multimap<_Kty, _Ty, _Pr, _Alloc>& _Left,
multimap<_Kty, _Ty, _Pr, _Alloc>& _Right)
{ // swap _Left and _Right multimaps
_Left.swap(_Right);
}
_STD_END
#pragma warning(pop)
#pragma pack(pop)
#endif /* _MAP_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

View File

@@ -0,0 +1,640 @@
/***
*math.h - definitions and declarations for math library
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file contains constant definitions and external subroutine
* declarations for the math subroutine library.
* [ANSI/System V]
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_MATH
#define _INC_MATH
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
#ifdef _MSC_VER
/*
* Currently, all MS C compilers for Win32 platforms default to 8 byte
* alignment.
*/
#pragma pack(push,8)
#endif /* _MSC_VER */
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __assembler /* Protect from assembler */
/* Define _CRTIMP */
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* ndef _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* _CRTIMP */
/* Define __cdecl for non-Microsoft compilers */
#if ( !defined(_MSC_VER) && !defined(__cdecl) )
#define __cdecl
#endif
/* Definition of _exception struct - this struct is passed to the matherr
* routine when a floating point exception is detected
*/
#ifndef _EXCEPTION_DEFINED
struct _exception {
int type; /* exception type - see below */
char *name; /* name of function where error occured */
double arg1; /* first argument to function */
double arg2; /* second argument (if any) to function */
double retval; /* value to be returned by function */
} ;
#define _EXCEPTION_DEFINED
#endif
/* Definition of a _complex struct to be used by those who use cabs and
* want type checking on their argument
*/
#ifndef _COMPLEX_DEFINED
struct _complex {
double x,y; /* real and imaginary parts */
} ;
#if !__STDC__ && !defined (__cplusplus)
/* Non-ANSI name for compatibility */
#define complex _complex
#endif
#define _COMPLEX_DEFINED
#endif
#endif /* __assembler */
/* Constant definitions for the exception type passed in the _exception struct
*/
#define _DOMAIN 1 /* argument domain error */
#define _SING 2 /* argument singularity */
#define _OVERFLOW 3 /* overflow range error */
#define _UNDERFLOW 4 /* underflow range error */
#define _TLOSS 5 /* total loss of precision */
#define _PLOSS 6 /* partial loss of precision */
#define EDOM 33
#define ERANGE 34
/* Definitions of _HUGE and HUGE_VAL - respectively the XENIX and ANSI names
* for a value returned in case of error by a number of the floating point
* math routines
*/
#ifndef __assembler /* Protect from assembler */
_CRTIMP extern double _HUGE;
#endif /* __assembler */
#define HUGE_VAL _HUGE
#ifdef _USE_MATH_DEFINES
/* Define _USE_MATH_DEFINES before including math.h to expose these macro
* definitions for common math constants. These are placed under an #ifdef
* since these commonly-defined names are not part of the C/C++ standards.
*/
/* Definitions of useful mathematical constants
* M_E - e
* M_LOG2E - log2(e)
* M_LOG10E - log10(e)
* M_LN2 - ln(2)
* M_LN10 - ln(10)
* M_PI - pi
* M_PI_2 - pi/2
* M_PI_4 - pi/4
* M_1_PI - 1/pi
* M_2_PI - 2/pi
* M_2_SQRTPI - 2/sqrt(pi)
* M_SQRT2 - sqrt(2)
* M_SQRT1_2 - 1/sqrt(2)
*/
#define M_E 2.71828182845904523536
#define M_LOG2E 1.44269504088896340736
#define M_LOG10E 0.434294481903251827651
#define M_LN2 0.693147180559945309417
#define M_LN10 2.30258509299404568402
#define M_PI 3.14159265358979323846
#define M_PI_2 1.57079632679489661923
#define M_PI_4 0.785398163397448309616
#define M_1_PI 0.318309886183790671538
#define M_2_PI 0.636619772367581343076
#define M_2_SQRTPI 1.12837916709551257390
#define M_SQRT2 1.41421356237309504880
#define M_SQRT1_2 0.707106781186547524401
#endif /* _USE_MATH_DEFINES */
/* Function prototypes */
#if !defined(__assembler) /* Protect from assembler */
#if defined(_M_MRX000)
_CRTIMP int __cdecl abs(int);
_CRTIMP double __cdecl acos(double);
_CRTIMP double __cdecl asin(double);
_CRTIMP double __cdecl atan(double);
_CRTIMP double __cdecl atan2(double, double);
_CRTIMP double __cdecl cos(double);
_CRTIMP double __cdecl cosh(double);
_CRTIMP double __cdecl exp(double);
_CRTIMP double __cdecl fabs(double);
_CRTIMP double __cdecl fmod(double, double);
_CRTIMP long __cdecl labs(long);
_CRTIMP double __cdecl log(double);
_CRTIMP double __cdecl log10(double);
_CRTIMP double __cdecl pow(double, double);
_CRTIMP double __cdecl sin(double);
_CRTIMP double __cdecl sinh(double);
_CRTIMP double __cdecl tan(double);
_CRTIMP double __cdecl tanh(double);
_CRTIMP double __cdecl sqrt(double);
#else
int __cdecl abs(int);
double __cdecl acos(double);
double __cdecl asin(double);
double __cdecl atan(double);
double __cdecl atan2(double, double);
double __cdecl cos(double);
double __cdecl cosh(double);
double __cdecl exp(double);
double __cdecl fabs(double);
double __cdecl fmod(double, double);
long __cdecl labs(long);
double __cdecl log(double);
double __cdecl log10(double);
double __cdecl pow(double, double);
double __cdecl sin(double);
double __cdecl sinh(double);
double __cdecl tan(double);
double __cdecl tanh(double);
double __cdecl sqrt(double);
#endif
_CRTIMP double __cdecl atof(const char *);
_CRTIMP double __cdecl _cabs(struct _complex);
#if defined(_M_ALPHA)
double __cdecl ceil(double);
double __cdecl floor(double);
#else
_CRTIMP double __cdecl ceil(double);
_CRTIMP double __cdecl floor(double);
#endif
_CRTIMP double __cdecl frexp(double, int *);
_CRTIMP double __cdecl _hypot(double, double);
_CRTIMP double __cdecl _j0(double);
_CRTIMP double __cdecl _j1(double);
_CRTIMP double __cdecl _jn(int, double);
_CRTIMP double __cdecl ldexp(double, int);
int __cdecl _matherr(struct _exception *);
_CRTIMP double __cdecl modf(double, double *);
_CRTIMP double __cdecl _y0(double);
_CRTIMP double __cdecl _y1(double);
_CRTIMP double __cdecl _yn(int, double);
#if defined(_M_IX86)
_CRTIMP int __cdecl _set_SSE2_enable(int);
#endif
#if defined(_M_MRX000)
/* MIPS fast prototypes for float */
/* ANSI C, 4.5 Mathematics */
/* 4.5.2 Trigonometric functions */
_CRTIMP float __cdecl acosf( float );
_CRTIMP float __cdecl asinf( float );
_CRTIMP float __cdecl atanf( float );
_CRTIMP float __cdecl atan2f( float , float );
_CRTIMP float __cdecl cosf( float );
_CRTIMP float __cdecl sinf( float );
_CRTIMP float __cdecl tanf( float );
/* 4.5.3 Hyperbolic functions */
_CRTIMP float __cdecl coshf( float );
_CRTIMP float __cdecl sinhf( float );
_CRTIMP float __cdecl tanhf( float );
/* 4.5.4 Exponential and logarithmic functions */
_CRTIMP float __cdecl expf( float );
_CRTIMP float __cdecl logf( float );
_CRTIMP float __cdecl log10f( float );
_CRTIMP float __cdecl modff( float , float* );
/* 4.5.5 Power functions */
_CRTIMP float __cdecl powf( float , float );
float __cdecl sqrtf( float );
/* 4.5.6 Nearest integer, absolute value, and remainder functions */
float __cdecl ceilf( float );
float __cdecl fabsf( float );
float __cdecl floorf( float );
_CRTIMP float __cdecl fmodf( float , float );
_CRTIMP float __cdecl hypotf(float, float);
#endif /* _M_MRX000 */
#if defined(_M_ALPHA)
/* ALPHA fast prototypes for float */
/* ANSI C, 4.5 Mathematics */
/* 4.5.2 Trigonometric functions */
float __cdecl acosf( float );
float __cdecl asinf( float );
float __cdecl atanf( float );
float __cdecl atan2f( float , float );
float __cdecl cosf( float );
float __cdecl sinf( float );
float __cdecl tanf( float );
/* 4.5.3 Hyperbolic functions */
float __cdecl coshf( float );
float __cdecl sinhf( float );
float __cdecl tanhf( float );
/* 4.5.4 Exponential and logarithmic functions */
float __cdecl expf( float );
float __cdecl logf( float );
float __cdecl log10f( float );
_CRTIMP float __cdecl modff( float , float* );
/* 4.5.5 Power functions */
float __cdecl powf( float , float );
float __cdecl sqrtf( float );
/* 4.5.6 Nearest integer, absolute value, and remainder functions */
float __cdecl ceilf( float );
float __cdecl fabsf( float );
float __cdecl floorf( float );
float __cdecl fmodf( float , float );
_CRTIMP float __cdecl _hypotf(float, float);
#endif /* _M_ALPHA */
#if defined(_M_IA64)
/* ANSI C, 4.5 Mathematics */
/* 4.5.2 Trigonometric functions */
float __cdecl acosf( float );
float __cdecl asinf( float );
float __cdecl atanf( float );
float __cdecl atan2f( float , float );
float __cdecl cosf( float );
float __cdecl sinf( float );
float __cdecl tanf( float );
/* 4.5.3 Hyperbolic functions */
float __cdecl coshf( float );
float __cdecl sinhf( float );
float __cdecl tanhf( float );
/* 4.5.4 Exponential and logarithmic functions */
float __cdecl expf( float );
float __cdecl logf( float );
float __cdecl log10f( float );
float __cdecl modff( float , float* );
/* 4.5.5 Power functions */
float __cdecl powf( float , float );
float __cdecl sqrtf( float );
/* 4.5.6 Nearest integer, absolute value, and remainder functions */
float __cdecl ceilf( float );
float __cdecl fabsf( float );
float __cdecl floorf( float );
float __cdecl fmodf( float , float );
float __cdecl hypotf(float, float);
#endif /* _M_IA64 */
/* Macros defining long double functions to be their double counterparts
* (long double is synonymous with double in this implementation).
*/
#ifndef __cplusplus
#define acosl(x) ((long double)acos((double)(x)))
#define asinl(x) ((long double)asin((double)(x)))
#define atanl(x) ((long double)atan((double)(x)))
#define atan2l(x,y) ((long double)atan2((double)(x), (double)(y)))
#define _cabsl _cabs
#define ceill(x) ((long double)ceil((double)(x)))
#define cosl(x) ((long double)cos((double)(x)))
#define coshl(x) ((long double)cosh((double)(x)))
#define expl(x) ((long double)exp((double)(x)))
#define fabsl(x) ((long double)fabs((double)(x)))
#define floorl(x) ((long double)floor((double)(x)))
#define fmodl(x,y) ((long double)fmod((double)(x), (double)(y)))
#define frexpl(x,y) ((long double)frexp((double)(x), (y)))
#define _hypotl(x,y) ((long double)_hypot((double)(x), (double)(y)))
#define ldexpl(x,y) ((long double)ldexp((double)(x), (y)))
#define logl(x) ((long double)log((double)(x)))
#define log10l(x) ((long double)log10((double)(x)))
#define _matherrl _matherr
#define modfl(x,y) ((long double)modf((double)(x), (double *)(y)))
#define powl(x,y) ((long double)pow((double)(x), (double)(y)))
#define sinl(x) ((long double)sin((double)(x)))
#define sinhl(x) ((long double)sinh((double)(x)))
#define sqrtl(x) ((long double)sqrt((double)(x)))
#define tanl(x) ((long double)tan((double)(x)))
#define tanhl(x) ((long double)tanh((double)(x)))
#else /* __cplusplus */
inline long double acosl(long double _X)
{return (acos((double)_X)); }
inline long double asinl(long double _X)
{return (asin((double)_X)); }
inline long double atanl(long double _X)
{return (atan((double)_X)); }
inline long double atan2l(long double _X, long double _Y)
{return (atan2((double)_X, (double)_Y)); }
inline long double ceill(long double _X)
{return (ceil((double)_X)); }
inline long double cosl(long double _X)
{return (cos((double)_X)); }
inline long double coshl(long double _X)
{return (cosh((double)_X)); }
inline long double expl(long double _X)
{return (exp((double)_X)); }
inline long double fabsl(long double _X)
{return (fabs((double)_X)); }
inline long double floorl(long double _X)
{return (floor((double)_X)); }
inline long double fmodl(long double _X, long double _Y)
{return (fmod((double)_X, (double)_Y)); }
inline long double frexpl(long double _X, int *_Y)
{return (frexp((double)_X, _Y)); }
inline long double ldexpl(long double _X, int _Y)
{return (ldexp((double)_X, _Y)); }
inline long double logl(long double _X)
{return (log((double)_X)); }
inline long double log10l(long double _X)
{return (log10((double)_X)); }
inline long double modfl(long double _X, long double *_Y)
{double _Di, _Df = modf((double)_X, &_Di);
*_Y = (long double)_Di;
return (_Df); }
inline long double powl(long double _X, long double _Y)
{return (pow((double)_X, (double)_Y)); }
inline long double sinl(long double _X)
{return (sin((double)_X)); }
inline long double sinhl(long double _X)
{return (sinh((double)_X)); }
inline long double sqrtl(long double _X)
{return (sqrt((double)_X)); }
inline long double tanl(long double _X)
{return (tan((double)_X)); }
inline long double tanhl(long double _X)
{return (tanh((double)_X)); }
inline float frexpf(float _X, int *_Y)
{return ((float)frexp((double)_X, _Y)); }
inline float ldexpf(float _X, int _Y)
{return ((float)ldexp((double)_X, _Y)); }
#if !defined(_M_MRX000) && !defined(_M_ALPHA) && !defined(_M_IA64)
inline float acosf(float _X)
{return ((float)acos((double)_X)); }
inline float asinf(float _X)
{return ((float)asin((double)_X)); }
inline float atanf(float _X)
{return ((float)atan((double)_X)); }
inline float atan2f(float _X, float _Y)
{return ((float)atan2((double)_X, (double)_Y)); }
inline float ceilf(float _X)
{return ((float)ceil((double)_X)); }
inline float cosf(float _X)
{return ((float)cos((double)_X)); }
inline float coshf(float _X)
{return ((float)cosh((double)_X)); }
inline float expf(float _X)
{return ((float)exp((double)_X)); }
inline float fabsf(float _X)
{return ((float)fabs((double)_X)); }
inline float floorf(float _X)
{return ((float)floor((double)_X)); }
inline float fmodf(float _X, float _Y)
{return ((float)fmod((double)_X, (double)_Y)); }
inline float logf(float _X)
{return ((float)log((double)_X)); }
inline float log10f(float _X)
{return ((float)log10((double)_X)); }
inline float modff(float _X, float *_Y)
{ double _Di, _Df = modf((double)_X, &_Di);
*_Y = (float)_Di;
return ((float)_Df); }
inline float powf(float _X, float _Y)
{return ((float)pow((double)_X, (double)_Y)); }
inline float sinf(float _X)
{return ((float)sin((double)_X)); }
inline float sinhf(float _X)
{return ((float)sinh((double)_X)); }
inline float sqrtf(float _X)
{return ((float)sqrt((double)_X)); }
inline float tanf(float _X)
{return ((float)tan((double)_X)); }
inline float tanhf(float _X)
{return ((float)tanh((double)_X)); }
#endif /* !defined(_M_MRX000) && !defined(_M_ALPHA) && !defined(_M_IA64) */
#endif /* __cplusplus */
#endif /* __assembler */
#if !__STDC__
/* Non-ANSI names for compatibility */
#define DOMAIN _DOMAIN
#define SING _SING
#define OVERFLOW _OVERFLOW
#define UNDERFLOW _UNDERFLOW
#define TLOSS _TLOSS
#define PLOSS _PLOSS
#define matherr _matherr
#ifndef __assembler /* Protect from assembler */
_CRTIMP extern double HUGE;
_CRTIMP double __cdecl cabs(struct _complex);
_CRTIMP double __cdecl hypot(double, double);
_CRTIMP double __cdecl j0(double);
_CRTIMP double __cdecl j1(double);
_CRTIMP double __cdecl jn(int, double);
int __cdecl matherr(struct _exception *);
_CRTIMP double __cdecl y0(double);
_CRTIMP double __cdecl y1(double);
_CRTIMP double __cdecl yn(int, double);
#endif /* __assembler */
#endif /* __STDC__ */
#ifdef __cplusplus
}
extern "C++" {
template<class _Ty> inline
_Ty _Pow_int(_Ty _X, int _Y)
{unsigned int _N;
if (_Y >= 0)
_N = _Y;
else
_N = -_Y;
for (_Ty _Z = _Ty(1); ; _X *= _X)
{if ((_N & 1) != 0)
_Z *= _X;
if ((_N >>= 1) == 0)
return (_Y < 0 ? _Ty(1) / _Z : _Z); }}
inline long __cdecl abs(long _X)
{return (labs(_X)); }
inline double __cdecl abs(double _X)
{return (fabs(_X)); }
inline double __cdecl pow(double _X, int _Y)
{return (_Pow_int(_X, _Y)); }
inline double __cdecl pow(int _X, int _Y)
{return (_Pow_int(_X, _Y)); }
inline float __cdecl abs(float _X)
{return (fabsf(_X)); }
inline float __cdecl acos(float _X)
{return (acosf(_X)); }
inline float __cdecl asin(float _X)
{return (asinf(_X)); }
inline float __cdecl atan(float _X)
{return (atanf(_X)); }
inline float __cdecl atan2(float _Y, float _X)
{return (atan2f(_Y, _X)); }
inline float __cdecl ceil(float _X)
{return (ceilf(_X)); }
inline float __cdecl cos(float _X)
{return (cosf(_X)); }
inline float __cdecl cosh(float _X)
{return (coshf(_X)); }
inline float __cdecl exp(float _X)
{return (expf(_X)); }
inline float __cdecl fabs(float _X)
{return (fabsf(_X)); }
inline float __cdecl floor(float _X)
{return (floorf(_X)); }
inline float __cdecl fmod(float _X, float _Y)
{return (fmodf(_X, _Y)); }
inline float __cdecl frexp(float _X, int * _Y)
{return (frexpf(_X, _Y)); }
inline float __cdecl ldexp(float _X, int _Y)
{return (ldexpf(_X, _Y)); }
inline float __cdecl log(float _X)
{return (logf(_X)); }
inline float __cdecl log10(float _X)
{return (log10f(_X)); }
inline float __cdecl modf(float _X, float * _Y)
{return (modff(_X, _Y)); }
inline float __cdecl pow(float _X, float _Y)
{return (powf(_X, _Y)); }
inline float __cdecl pow(float _X, int _Y)
{return (_Pow_int(_X, _Y)); }
inline float __cdecl sin(float _X)
{return (sinf(_X)); }
inline float __cdecl sinh(float _X)
{return (sinhf(_X)); }
inline float __cdecl sqrt(float _X)
{return (sqrtf(_X)); }
inline float __cdecl tan(float _X)
{return (tanf(_X)); }
inline float __cdecl tanh(float _X)
{return (tanhf(_X)); }
inline long double __cdecl abs(long double _X)
{return (fabsl(_X)); }
inline long double __cdecl acos(long double _X)
{return (acosl(_X)); }
inline long double __cdecl asin(long double _X)
{return (asinl(_X)); }
inline long double __cdecl atan(long double _X)
{return (atanl(_X)); }
inline long double __cdecl atan2(long double _Y, long double _X)
{return (atan2l(_Y, _X)); }
inline long double __cdecl ceil(long double _X)
{return (ceill(_X)); }
inline long double __cdecl cos(long double _X)
{return (cosl(_X)); }
inline long double __cdecl cosh(long double _X)
{return (coshl(_X)); }
inline long double __cdecl exp(long double _X)
{return (expl(_X)); }
inline long double __cdecl fabs(long double _X)
{return (fabsl(_X)); }
inline long double __cdecl floor(long double _X)
{return (floorl(_X)); }
inline long double __cdecl fmod(long double _X, long double _Y)
{return (fmodl(_X, _Y)); }
inline long double __cdecl frexp(long double _X, int * _Y)
{return (frexpl(_X, _Y)); }
inline long double __cdecl ldexp(long double _X, int _Y)
{return (ldexpl(_X, _Y)); }
inline long double __cdecl log(long double _X)
{return (logl(_X)); }
inline long double __cdecl log10(long double _X)
{return (log10l(_X)); }
inline long double __cdecl modf(long double _X, long double * _Y)
{return (modfl(_X, _Y)); }
inline long double __cdecl pow(long double _X, long double _Y)
{return (powl(_X, _Y)); }
inline long double __cdecl pow(long double _X, int _Y)
{return (_Pow_int(_X, _Y)); }
inline long double __cdecl sin(long double _X)
{return (sinl(_X)); }
inline long double __cdecl sinh(long double _X)
{return (sinhl(_X)); }
inline long double __cdecl sqrt(long double _X)
{return (sqrtl(_X)); }
inline long double __cdecl tan(long double _X)
{return (tanl(_X)); }
inline long double __cdecl tanh(long double _X)
{return (tanhl(_X)); }
}
#endif /* __cplusplus */
#ifdef _MSC_VER
#pragma pack(pop)
#endif /* _MSC_VER */
#endif /* _INC_MATH */

View File

@@ -0,0 +1,146 @@
/***
*mbctype.h - MBCS character conversion macros
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* Defines macros for MBCS character classification/conversion.
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_MBCTYPE
#define _INC_MBCTYPE
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
/* include the standard ctype.h header file */
#include <ctype.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Define _CRTIMP */
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* ndef _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* _CRTIMP */
/* Define __cdecl for non-Microsoft compilers */
#if (!defined(_MSC_VER) && !defined(__cdecl))
#define __cdecl
#endif
/*
* MBCS - Multi-Byte Character Set
*/
/*
* This declaration allows the user access the _mbctype[] look-up array.
*/
_CRTIMP extern unsigned char _mbctype[];
_CRTIMP extern unsigned char _mbcasemap[];
/* bit masks for MBCS character types */
#define _MS 0x01 /* MBCS single-byte symbol */
#define _MP 0x02 /* MBCS punct */
#define _M1 0x04 /* MBCS 1st (lead) byte */
#define _M2 0x08 /* MBCS 2nd byte*/
#define _SBUP 0x10 /* SBCS upper char */
#define _SBLOW 0x20 /* SBCS lower char */
/* byte types */
#define _MBC_SINGLE 0 /* valid single byte char */
#define _MBC_LEAD 1 /* lead byte */
#define _MBC_TRAIL 2 /* trailing byte */
#define _MBC_ILLEGAL (-1) /* illegal byte */
#define _KANJI_CP 932
/* _setmbcp parameter defines */
#define _MB_CP_SBCS 0
#define _MB_CP_OEM -2
#define _MB_CP_ANSI -3
#define _MB_CP_LOCALE -4
#ifndef _MBCTYPE_DEFINED
/* MB control routines */
_CRTIMP int __cdecl _setmbcp(int);
_CRTIMP int __cdecl _getmbcp(void);
/* MBCS character classification function prototypes */
/* byte routines */
_CRTIMP int __cdecl _ismbbkalnum( unsigned int );
_CRTIMP int __cdecl _ismbbkana( unsigned int );
_CRTIMP int __cdecl _ismbbkpunct( unsigned int );
_CRTIMP int __cdecl _ismbbkprint( unsigned int );
_CRTIMP int __cdecl _ismbbalpha( unsigned int );
_CRTIMP int __cdecl _ismbbpunct( unsigned int );
_CRTIMP int __cdecl _ismbbalnum( unsigned int );
_CRTIMP int __cdecl _ismbbprint( unsigned int );
_CRTIMP int __cdecl _ismbbgraph( unsigned int );
#ifndef _MBLEADTRAIL_DEFINED
_CRTIMP int __cdecl _ismbblead( unsigned int );
_CRTIMP int __cdecl _ismbbtrail( unsigned int );
_CRTIMP int __cdecl _ismbslead( const unsigned char *, const unsigned char *);
_CRTIMP int __cdecl _ismbstrail( const unsigned char *, const unsigned char *);
#define _MBLEADTRAIL_DEFINED
#endif
#define _MBCTYPE_DEFINED
#endif
/*
* char byte classification macros
*/
#define _ismbbkalnum(_c) ((_mbctype+1)[(unsigned char)(_c)] & _MS)
#define _ismbbkprint(_c) ((_mbctype+1)[(unsigned char)(_c)] & (_MS|_MP))
#define _ismbbkpunct(_c) ((_mbctype+1)[(unsigned char)(_c)] & _MP)
#define _ismbbalnum(_c) (((_pctype)[(unsigned char)(_c)] & (_ALPHA|_DIGIT))||_ismbbkalnum(_c))
#define _ismbbalpha(_c) (((_pctype)[(unsigned char)(_c)] & (_ALPHA))||_ismbbkalnum(_c))
#define _ismbbgraph(_c) (((_pctype)[(unsigned char)(_c)] & (_PUNCT|_ALPHA|_DIGIT))||_ismbbkprint(_c))
#define _ismbbprint(_c) (((_pctype)[(unsigned char)(_c)] & (_BLANK|_PUNCT|_ALPHA|_DIGIT))||_ismbbkprint(_c))
#define _ismbbpunct(_c) (((_pctype)[(unsigned char)(_c)] & _PUNCT)||_ismbbkpunct(_c))
#define _ismbblead(_c) ((_mbctype+1)[(unsigned char)(_c)] & _M1)
#define _ismbbtrail(_c) ((_mbctype+1)[(unsigned char)(_c)] & _M2)
#define _ismbbkana(_c) ((_mbctype+1)[(unsigned char)(_c)] & (_MS|_MP))
#ifdef __cplusplus
}
#endif
#endif /* _INC_MBCTYPE */

View File

@@ -0,0 +1,213 @@
/***
* mbstring.h - MBCS string manipulation macros and functions
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file contains macros and function declarations for the MBCS
* string manipulation functions.
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_MBSTRING
#define _INC_MBSTRING
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
#ifdef _MSC_VER
/*
* Currently, all MS C compilers for Win32 platforms default to 8 byte
* alignment.
*/
#pragma pack(push,8)
#endif /* _MSC_VER */
#ifdef __cplusplus
extern "C" {
#endif
#if !defined(_W64)
#if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
#define _W64 __w64
#else
#define _W64
#endif
#endif
/* Define _CRTIMP */
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* ndef _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* _CRTIMP */
/* Define __cdecl for non-Microsoft compilers */
#if ( !defined(_MSC_VER) && !defined(__cdecl) )
#define __cdecl
#endif
#ifndef _SIZE_T_DEFINED
#ifdef _WIN64
typedef unsigned __int64 size_t;
#else
typedef _W64 unsigned int size_t;
#endif
#define _SIZE_T_DEFINED
#endif
#ifndef _NLSCMP_DEFINED
#define _NLSCMPERROR 2147483647 /* currently == INT_MAX */
#define _NLSCMP_DEFINED
#endif
#ifndef _VA_LIST_DEFINED
#ifdef _M_ALPHA
typedef struct {
char *a0; /* pointer to first homed integer argument */
int offset; /* byte offset of next parameter */
} va_list;
#else
typedef char * va_list;
#endif
#define _VA_LIST_DEFINED
#endif
#ifndef _FILE_DEFINED
struct _iobuf {
char *_ptr;
int _cnt;
char *_base;
int _flag;
int _file;
int _charbuf;
int _bufsiz;
char *_tmpfname;
};
typedef struct _iobuf FILE;
#define _FILE_DEFINED
#endif
/*
* MBCS - Multi-Byte Character Set
*/
#ifndef _MBSTRING_DEFINED
/* function prototypes */
_CRTIMP unsigned int __cdecl _mbbtombc(unsigned int);
_CRTIMP int __cdecl _mbbtype(unsigned char, int);
_CRTIMP unsigned int __cdecl _mbctombb(unsigned int);
_CRTIMP int __cdecl _mbsbtype(const unsigned char *, size_t);
_CRTIMP unsigned char * __cdecl _mbscat(unsigned char *, const unsigned char *);
_CRTIMP unsigned char * __cdecl _mbschr(const unsigned char *, unsigned int);
_CRTIMP int __cdecl _mbscmp(const unsigned char *, const unsigned char *);
_CRTIMP int __cdecl _mbscoll(const unsigned char *, const unsigned char *);
_CRTIMP unsigned char * __cdecl _mbscpy(unsigned char *, const unsigned char *);
_CRTIMP size_t __cdecl _mbscspn(const unsigned char *, const unsigned char *);
_CRTIMP unsigned char * __cdecl _mbsdec(const unsigned char *, const unsigned char *);
_CRTIMP unsigned char * __cdecl _mbsdup(const unsigned char *);
_CRTIMP int __cdecl _mbsicmp(const unsigned char *, const unsigned char *);
_CRTIMP int __cdecl _mbsicoll(const unsigned char *, const unsigned char *);
_CRTIMP unsigned char * __cdecl _mbsinc(const unsigned char *);
_CRTIMP size_t __cdecl _mbslen(const unsigned char *);
_CRTIMP unsigned char * __cdecl _mbslwr(unsigned char *);
_CRTIMP unsigned char * __cdecl _mbsnbcat(unsigned char *, const unsigned char *, size_t);
_CRTIMP int __cdecl _mbsnbcmp(const unsigned char *, const unsigned char *, size_t);
_CRTIMP int __cdecl _mbsnbcoll(const unsigned char *, const unsigned char *, size_t);
_CRTIMP size_t __cdecl _mbsnbcnt(const unsigned char *, size_t);
_CRTIMP unsigned char * __cdecl _mbsnbcpy(unsigned char *, const unsigned char *, size_t);
_CRTIMP int __cdecl _mbsnbicmp(const unsigned char *, const unsigned char *, size_t);
_CRTIMP int __cdecl _mbsnbicoll(const unsigned char *, const unsigned char *, size_t);
_CRTIMP unsigned char * __cdecl _mbsnbset(unsigned char *, unsigned int, size_t);
_CRTIMP unsigned char * __cdecl _mbsncat(unsigned char *, const unsigned char *, size_t);
_CRTIMP size_t __cdecl _mbsnccnt(const unsigned char *, size_t);
_CRTIMP int __cdecl _mbsncmp(const unsigned char *, const unsigned char *, size_t);
_CRTIMP int __cdecl _mbsncoll(const unsigned char *, const unsigned char *, size_t);
_CRTIMP unsigned char * __cdecl _mbsncpy(unsigned char *, const unsigned char *, size_t);
_CRTIMP unsigned int __cdecl _mbsnextc (const unsigned char *);
_CRTIMP int __cdecl _mbsnicmp(const unsigned char *, const unsigned char *, size_t);
_CRTIMP int __cdecl _mbsnicoll(const unsigned char *, const unsigned char *, size_t);
_CRTIMP unsigned char * __cdecl _mbsninc(const unsigned char *, size_t);
_CRTIMP unsigned char * __cdecl _mbsnset(unsigned char *, unsigned int, size_t);
_CRTIMP unsigned char * __cdecl _mbspbrk(const unsigned char *, const unsigned char *);
_CRTIMP unsigned char * __cdecl _mbsrchr(const unsigned char *, unsigned int);
_CRTIMP unsigned char * __cdecl _mbsrev(unsigned char *);
_CRTIMP unsigned char * __cdecl _mbsset(unsigned char *, unsigned int);
_CRTIMP size_t __cdecl _mbsspn(const unsigned char *, const unsigned char *);
_CRTIMP unsigned char * __cdecl _mbsspnp(const unsigned char *, const unsigned char *);
_CRTIMP unsigned char * __cdecl _mbsstr(const unsigned char *, const unsigned char *);
_CRTIMP unsigned char * __cdecl _mbstok(unsigned char *, const unsigned char *);
_CRTIMP unsigned char * __cdecl _mbsupr(unsigned char *);
_CRTIMP size_t __cdecl _mbclen(const unsigned char *);
_CRTIMP void __cdecl _mbccpy(unsigned char *, const unsigned char *);
#define _mbccmp(_cpc1, _cpc2) _mbsncmp((_cpc1),(_cpc2),1)
/* character routines */
_CRTIMP int __cdecl _ismbcalnum(unsigned int);
_CRTIMP int __cdecl _ismbcalpha(unsigned int);
_CRTIMP int __cdecl _ismbcdigit(unsigned int);
_CRTIMP int __cdecl _ismbcgraph(unsigned int);
_CRTIMP int __cdecl _ismbclegal(unsigned int);
_CRTIMP int __cdecl _ismbclower(unsigned int);
_CRTIMP int __cdecl _ismbcprint(unsigned int);
_CRTIMP int __cdecl _ismbcpunct(unsigned int);
_CRTIMP int __cdecl _ismbcspace(unsigned int);
_CRTIMP int __cdecl _ismbcupper(unsigned int);
_CRTIMP unsigned int __cdecl _mbctolower(unsigned int);
_CRTIMP unsigned int __cdecl _mbctoupper(unsigned int);
#define _MBSTRING_DEFINED
#endif
#ifndef _MBLEADTRAIL_DEFINED
_CRTIMP int __cdecl _ismbblead(unsigned int);
_CRTIMP int __cdecl _ismbbtrail(unsigned int);
_CRTIMP int __cdecl _ismbslead(const unsigned char *, const unsigned char *);
_CRTIMP int __cdecl _ismbstrail(const unsigned char *, const unsigned char *);
#define _MBLEADTRAIL_DEFINED
#endif
/* Kanji specific prototypes. */
_CRTIMP int __cdecl _ismbchira(unsigned int);
_CRTIMP int __cdecl _ismbckata(unsigned int);
_CRTIMP int __cdecl _ismbcsymbol(unsigned int);
_CRTIMP int __cdecl _ismbcl0(unsigned int);
_CRTIMP int __cdecl _ismbcl1(unsigned int);
_CRTIMP int __cdecl _ismbcl2(unsigned int);
_CRTIMP unsigned int __cdecl _mbcjistojms(unsigned int);
_CRTIMP unsigned int __cdecl _mbcjmstojis(unsigned int);
_CRTIMP unsigned int __cdecl _mbctohira(unsigned int);
_CRTIMP unsigned int __cdecl _mbctokata(unsigned int);
#ifdef __cplusplus
}
#endif
#ifdef _MSC_VER
#pragma pack(pop)
#endif /* _MSC_VER */
#endif /* _INC_MBSTRING */

View File

@@ -0,0 +1,545 @@
// memory standard header
#pragma once
#ifndef _MEMORY_
#define _MEMORY_
#include <iterator>
#include <xmemory>
#pragma pack(push,8)
#pragma warning(push,3)
_STD_BEGIN
// TEMPLATE FUNCTION get_temporary_buffer
template<class _Ty> inline
pair<_Ty _FARQ *, _PDFT>
get_temporary_buffer(_PDFT _Count)
{ // get raw temporary buffer of up to _Count elements
_Ty _FARQ *_Pbuf;
for (_Pbuf = 0; 0 < _Count; _Count /= 2)
if ((_Pbuf = (_Ty _FARQ *)operator new(
(_SIZT)_Count * sizeof (_Ty), nothrow)) != 0)
break;
return (pair<_Ty _FARQ *, _PDFT>(_Pbuf, _Count));
}
// TEMPLATE FUNCTION return_temporary_buffer
template<class _Ty> inline
void return_temporary_buffer(_Ty *_Pbuf)
{ // delete raw temporary buffer
operator delete(_Pbuf);
}
// TEMPLATE FUNCTION uninitialized_copy
template<class _InIt,
class _FwdIt> inline
_FwdIt _Uninit_copy(_InIt _First, _InIt _Last, _FwdIt _Dest,
_Nonscalar_ptr_iterator_tag)
{ // copy [_First, _Last) to raw _Dest, arbitrary type
_FwdIt _Next = _Dest;
_TRY_BEGIN
for (; _First != _Last; ++_Dest, ++_First)
_Construct(&*_Dest, *_First);
_CATCH_ALL
for (; _Next != _Dest; ++_Next)
_Destroy(&*_Next);
_RERAISE;
_CATCH_END
return (_Dest);
}
template<class _Ty1,
class _Ty2> inline
_Ty2 *_Uninit_copy(_Ty1 *_First, _Ty1 *_Last, _Ty2 *_Dest,
_Scalar_ptr_iterator_tag)
{ // copy [_First, _Last) to raw _Dest, scalar type
size_t _Count = (size_t)(_Last - _First);
return ((_Ty2 *)memmove(&*_Dest, &*_First,
_Count * sizeof (*_First)) + _Count); // NB: non-overlapping move
}
template<class _InIt,
class _FwdIt> inline
_FwdIt uninitialized_copy(_InIt _First, _InIt _Last, _FwdIt _Dest)
{ // copy [_First, _Last) to raw _Dest
return (_Uninit_copy(_First, _Last, _Dest,
_Ptr_cat(_First, _Dest)));
}
// TEMPLATE FUNCTION _Uninitialized_copy WITH ALLOCATOR
template<class _InIt,
class _FwdIt,
class _Alloc> inline
_FwdIt _Uninit_copy(_InIt _First, _InIt _Last, _FwdIt _Dest,
_Alloc& _Al, _Nonscalar_ptr_iterator_tag)
{ // copy [_First, _Last) to raw _Dest, using _Al, arbitrary type
_FwdIt _Next = _Dest;
_TRY_BEGIN
for (; _First != _Last; ++_Dest, ++_First)
_Al.construct(_Dest, *_First);
_CATCH_ALL
for (; _Next != _Dest; ++_Next)
_Al.destroy(_Next);
_RERAISE;
_CATCH_END
return (_Dest);
}
template<class _InIt,
class _FwdIt,
class _Alloc> inline
_FwdIt _Uninit_copy(_InIt _First, _InIt _Last, _FwdIt _Dest,
_Alloc& _Al, _Scalar_ptr_iterator_tag)
{ // copy [_First, _Last) to raw _Dest, using _Al, scalar type
return (_Uninit_copy(_First, _Last, _Dest,
_Al, _Nonscalar_ptr_iterator_tag()));
}
template<class _Ty1,
class _Ty2> inline
_Ty2 *_Uninit_copy(_Ty1 *_First, _Ty1 *_Last, _Ty2 *_Dest,
allocator<_Ty2>&, _Scalar_ptr_iterator_tag)
{ // copy [_First, _Last) to raw _Dest, (const) scalar type
size_t _Count = (size_t)(_Last - _First);
return ((_Ty2 *)memmove(&*_Dest, &*_First,
_Count * sizeof (*_First)) + _Count); // NB: non-overlapping move
}
template<class _Ty1,
class _Ty2> inline
_Ty2 *_Uninit_copy(_Ty1 *_First, _Ty1 *_Last, _Ty2 *_Dest,
allocator<const _Ty2>&, _Scalar_ptr_iterator_tag)
{ // copy [_First, _Last) to raw _Dest, (const) scalar type
size_t _Count = (size_t)(_Last - _First);
return ((_Ty2 *)memmove(&*_Dest, &*_First,
_Count * sizeof (*_First)) + _Count); // NB: non-overlapping move
}
template<class _InIt,
class _FwdIt,
class _Alloc> inline
_FwdIt _Uninitialized_copy(_InIt _First, _InIt _Last, _FwdIt _Dest,
_Alloc& _Al)
{ // copy [_First, _Last) to raw _Dest, using _Al
return (_Uninit_copy(_First, _Last, _Dest, _Al,
_Ptr_cat(_First, _Dest)));
}
// TEMPLATE FUNCTION uninitialized_fill
template<class _FwdIt,
class _Tval> inline
void _Uninit_fill(_FwdIt _First, _FwdIt _Last, const _Tval& _Val,
_Nonscalar_ptr_iterator_tag)
{ // copy _Val throughout raw [_First, _Last), arbitrary type
_FwdIt _Next = _First;
_TRY_BEGIN
for (; _First != _Last; ++_First)
_Construct(&*_First, _Val);
_CATCH_ALL
for (; _Next != _First; ++_Next)
_Destroy(&*_Next);
_RERAISE;
_CATCH_END
}
template<class _Ty,
class _Tval> inline
void _Uninit_fill(_Ty *_First, _Ty *_Last, const _Tval& _Val,
_Scalar_ptr_iterator_tag)
{ // copy _Val throughout raw [_First, _Last), scalar type
std::fill(_First, _Last, _Val);
}
template<class _FwdIt,
class _Tval> inline
void uninitialized_fill(_FwdIt _First, _FwdIt _Last, const _Tval& _Val)
{ // copy _Val throughout raw [_First, _Last)
_Uninit_fill(_First, _Last, _Val, _Ptr_cat(_First, _First));
}
// TEMPLATE FUNCTION uninitialized_fill_n
template<class _FwdIt,
class _Diff,
class _Tval> inline
void _Uninit_fill_n(_FwdIt _First, _Diff _Count, const _Tval& _Val,
_Nonscalar_ptr_iterator_tag)
{ // copy _Count *_Val to raw _First, arbitrary type
_FwdIt _Next = _First;
_TRY_BEGIN
for (; 0 < _Count; --_Count, ++_First)
_Construct(&*_First, _Val);
_CATCH_ALL
for (; _Next != _First; ++_Next)
_Destroy(&*_Next);
_RERAISE;
_CATCH_END
}
template<class _Ty,
class _Diff,
class _Tval> inline
void _Uninit_fill_n(_Ty *_First, _Diff _Count, const _Tval& _Val,
_Scalar_ptr_iterator_tag)
{ // copy _Count *_Val to raw _First, scalar type
std::fill_n(_First, _Count, _Val);
}
template<class _FwdIt,
class _Diff,
class _Tval> inline
void uninitialized_fill_n(_FwdIt _First, _Diff _Count, const _Tval& _Val)
{ // copy _Count *_Val to raw _First
_Uninit_fill_n(_First, _Count, _Val, _Ptr_cat(_First, _First));
}
// TEMPLATE FUNCTION _Uninitialized_fill_n WITH ALLOCATOR
template<class _FwdIt,
class _Diff,
class _Tval,
class _Alloc> inline
void _Uninit_fill_n(_FwdIt _First, _Diff _Count,
const _Tval& _Val, _Alloc& _Al, _Nonscalar_ptr_iterator_tag)
{ // copy _Count *_Val to raw _First, using _Al, arbitrary type
_FwdIt _Next = _First;
_TRY_BEGIN
for (; 0 < _Count; --_Count, ++_First)
_Al.construct(_First, _Val);
_CATCH_ALL
for (; _Next != _First; ++_Next)
_Al.destroy(_Next);
_RERAISE;
_CATCH_END
}
template<class _FwdIt,
class _Diff,
class _Tval,
class _Alloc> inline
void _Uninit_fill_n(_FwdIt _First, _Diff _Count,
const _Tval& _Val, _Alloc& _Al, _Scalar_ptr_iterator_tag)
{ // copy _Count *_Val to raw _First, using _Al, arbitrary type
_Uninit_fill_n(_First, _Count,
_Val, _Al, _Nonscalar_ptr_iterator_tag());
}
template<class _Ty,
class _Diff,
class _Tval> inline
void _Uninit_fill_n(_Ty *_First, _Diff _Count,
const _Tval& _Val, allocator<_Ty>&, _Scalar_ptr_iterator_tag)
{ // copy _Count *_Val to raw _First, using _Al, scalar type
fill_n(_First, _Count, _Val);
}
template<class _Ty,
class _Diff,
class _Tval> inline
void _Uninit_fill_n(_Ty *_First, _Diff _Count,
const _Tval& _Val, allocator<const _Ty>&, _Scalar_ptr_iterator_tag)
{ // copy _Count *_Val to raw _First, using _Al, scalar type
fill_n(_First, _Count, _Val);
}
template<class _FwdIt,
class _Diff,
class _Tval,
class _Alloc> inline
void _Uninitialized_fill_n(_FwdIt _First, _Diff _Count,
const _Tval& _Val, _Alloc& _Al)
{ // copy _Count *_Val to raw _First, using _Al
_Uninit_fill_n(_First, _Count, _Val, _Al,
_Ptr_cat(_First, _First));
}
// TEMPLATE CLASS raw_storage_iterator
template<class _FwdIt,
class _Ty>
class raw_storage_iterator
: public _Outit
{ // wrap stores to raw buffer as output iterator
public:
typedef _FwdIt iterator_type; // retained
typedef _FwdIt iter_type; // retained
typedef _Ty element_type; // retained
explicit raw_storage_iterator(_FwdIt _First)
: _Next(_First)
{ // construct with iterator
}
raw_storage_iterator<_FwdIt, _Ty>& operator*()
{ // pretend to return designated value
return (*this);
}
raw_storage_iterator<_FwdIt, _Ty>& operator=(const _Ty& _Val)
{ // construct value designated by stored iterator
_Construct(&*_Next, _Val);
return (*this);
}
raw_storage_iterator<_FwdIt, _Ty>& operator++()
{ // preincrement
++_Next;
return (*this);
}
raw_storage_iterator<_FwdIt, _Ty> operator++(int)
{ // postincrement
raw_storage_iterator<_FwdIt, _Ty> _Ans = *this;
++_Next;
return (_Ans);
}
private:
_FwdIt _Next; // the stored iterator
};
// TEMPLATE CLASS _Temp_iterator
template<class _Ty>
class _Temp_iterator
: public _Outit
{ // wrap stores to temporary buffer as output iterator
public:
typedef _Ty _FARQ *_Pty;
_Temp_iterator(_PDFT _Count = 0)
{ // construct from desired temporary buffer size
pair<_Pty, _PDFT> _Pair =
std::get_temporary_buffer<_Ty>(_Count);
_Buf._Begin = _Pair.first;
_Buf._Current = _Pair.first;
_Buf._Hiwater = _Pair.first;
_Buf._Size = _Pair.second;
_Pbuf = &_Buf;
}
_Temp_iterator(const _Temp_iterator<_Ty>& _Right)
{ // construct from _Right (share active buffer)
_Buf._Begin = 0; // clear stored buffer, to be tidy
_Buf._Current = 0;
_Buf._Hiwater = 0;
_Buf._Size = 0;
*this = _Right;
}
~_Temp_iterator()
{ // destroy the object
if (_Buf._Begin != 0)
{ // destroy any constructed elements in buffer
for (_Pty _Next = _Buf._Begin;
_Next != _Buf._Hiwater; ++_Next)
_Destroy(&*_Next);
std::return_temporary_buffer(_Buf._Begin);
}
}
_Temp_iterator<_Ty>& operator=(const _Temp_iterator<_Ty>& _Right)
{ // assign _Right (share active buffer)
_Pbuf = _Right._Pbuf;
return (*this);
}
_Temp_iterator<_Ty>& operator=(const _Ty& _Val)
{ // assign or construct value into active buffer, and increment
if (_Pbuf->_Current < _Pbuf->_Hiwater)
*_Pbuf->_Current++ = _Val; // below high water mark, assign
else
{ // above high water mark, construct
_Construct(&*_Pbuf->_Current, _Val);
_Pbuf->_Hiwater = ++_Pbuf->_Current;
}
return (*this);
}
_Temp_iterator<_Ty>& operator*()
{ // pretend to return designated value
return (*this);
}
_Temp_iterator<_Ty>& operator++()
{ // pretend to preincrement
return (*this);
}
_Temp_iterator<_Ty>& operator++(int)
{ // pretend to postincrement
return (*this);
}
_Temp_iterator<_Ty>& _Init()
{ // set pointer at beginning of buffer
_Pbuf->_Current = _Pbuf->_Begin;
return (*this);
}
_Pty _First() const
{ // return pointer to beginning of buffer
return (_Pbuf->_Begin);
}
_Pty _Last() const
{ // return pointer past end of buffer contents
return (_Pbuf->_Current);
}
_PDFT _Maxlen() const
{ // return size of buffer
return (_Pbuf->_Size);
}
private:
struct _Bufpar
{ // control information for a temporary buffer
_Pty _Begin; // pointer to beginning of buffer
_Pty _Current; // pointer to next available element
_Pty _Hiwater; // pointer to first unconstructed element
_PDFT _Size; // length of buffer
};
_Bufpar _Buf; // buffer control stored in iterator
_Bufpar *_Pbuf; // pointer to active buffer control
};
// TEMPLATE CLASS auto_ptr
template<class _Ty>
class auto_ptr;
template<class _Ty>
struct auto_ptr_ref
{ // proxy reference for auto_ptr copying
auto_ptr_ref(auto_ptr<_Ty>& _Right)
: _Ref(_Right)
{ // construct from compatible auto_ptr
}
auto_ptr<_Ty>& _Ref; // reference to constructor argument
};
template<class _Ty>
class auto_ptr
{ // wrap an object pointer to ensure destruction
public:
typedef _Ty element_type;
explicit auto_ptr(_Ty *_Ptr = 0) _THROW0()
: _Myptr(_Ptr)
{ // construct from object pointer
}
auto_ptr(auto_ptr<_Ty>& _Right) _THROW0()
: _Myptr(_Right.release())
{ // construct by assuming pointer from _Right auto_ptr
}
auto_ptr(auto_ptr_ref<_Ty> _Right) _THROW0()
: _Myptr(_Right._Ref.release())
{ // construct by assuming pointer from _Right auto_ptr_ref
}
template<class _Other>
operator auto_ptr<_Other>() _THROW0()
{ // convert to compatible auto_ptr
return (auto_ptr<_Other>(*this));
}
template<class _Other>
operator auto_ptr_ref<_Other>() _THROW0()
{ // convert to compatible auto_ptr_ref
return (auto_ptr_ref<_Other>(*this));
}
template<class _Other>
auto_ptr<_Ty>& operator=(auto_ptr<_Other>& _Right) _THROW0()
{ // assign compatible _Right (assume pointer)
reset(_Right.release());
return (*this);
}
template<class _Other>
auto_ptr(auto_ptr<_Other>& _Right) _THROW0()
: _Myptr(_Right.release())
{ // construct by assuming pointer from _Right
}
auto_ptr<_Ty>& operator=(auto_ptr<_Ty>& _Right) _THROW0()
{ // assign compatible _Right (assume pointer)
reset(_Right.release());
return (*this);
}
auto_ptr<_Ty>& operator=(auto_ptr_ref<_Ty>& _Right) _THROW0()
{ // assign compatible _Right._Ref (assume pointer)
reset(_Right._Ref.release());
return (*this);
}
~auto_ptr()
{ // destroy the object
delete _Myptr;
}
_Ty& operator*() const _THROW0()
{ // return designated value
return (*_Myptr);
}
_Ty *operator->() const _THROW0()
{ // return pointer to class object
return (&**this);
}
_Ty *get() const _THROW0()
{ // return wrapped pointer
return (_Myptr);
}
_Ty *release() _THROW0()
{ // return wrapped pointer and give up ownership
_Ty *_Tmp = _Myptr;
_Myptr = 0;
return (_Tmp);
}
void reset(_Ty* _Ptr = 0)
{ // destroy designated object and store new pointer
if (_Ptr != _Myptr)
delete _Myptr;
_Myptr = _Ptr;
}
private:
_Ty *_Myptr; // the wrapped object pointer
};
_STD_END
#pragma warning(pop)
#pragma pack(pop)
#endif /* _MEMORY_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
*/
/*
* This file is derived from software bearing the following
* restrictions:
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Permission to use, copy, modify, distribute and sell this
* software and its documentation for any purpose is hereby
* granted without fee, provided that the above copyright notice
* appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation.
* Hewlett-Packard Company makes no representations about the
* suitability of this software for any purpose. It is provided
* "as is" without express or implied warranty.
V3.13:0009 */

View File

@@ -0,0 +1,95 @@
/***
*memory.h - declarations for buffer (memory) manipulation routines
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* This include file contains the function declarations for the
* buffer (memory) manipulation routines.
* [System V]
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_MEMORY
#define _INC_MEMORY
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if !defined(_W64)
#if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
#define _W64 __w64
#else
#define _W64
#endif
#endif
/* Define _CRTIMP */
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* ndef _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* _CRTIMP */
/* Define __cdecl for non-Microsoft compilers */
#if ( !defined(_MSC_VER) && !defined(__cdecl) )
#define __cdecl
#endif
#ifndef _SIZE_T_DEFINED
#ifdef _WIN64
typedef unsigned __int64 size_t;
#else
typedef _W64 unsigned int size_t;
#endif
#define _SIZE_T_DEFINED
#endif
/* Function prototypes */
_CRTIMP void * __cdecl _memccpy(void *, const void *, int, size_t);
_CRTIMP void * __cdecl memchr(const void *, int, size_t);
_CRTIMP int __cdecl _memicmp(const void *, const void *, size_t);
#ifdef _M_MRX000
_CRTIMP int __cdecl memcmp(const void *, const void *, size_t);
_CRTIMP void * __cdecl memcpy(void *, const void *, size_t);
_CRTIMP void * __cdecl memset(void *, int, size_t);
#else
int __cdecl memcmp(const void *, const void *, size_t);
void * __cdecl memcpy(void *, const void *, size_t);
void * __cdecl memset(void *, int, size_t);
#endif
#if !__STDC__
/* Non-ANSI names for compatibility */
_CRTIMP void * __cdecl memccpy(void *, const void *, int, size_t);
_CRTIMP int __cdecl memicmp(const void *, const void *, size_t);
#endif /* __STDC__ */
#ifdef __cplusplus
}
#endif
#endif /* _INC_MEMORY */

View File

@@ -0,0 +1,28 @@
/***
*minmax.h - familiar min & max macros
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* Defines min and max macros.
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_MINMAX
#define _INC_MINMAX
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
#endif

View File

@@ -0,0 +1,66 @@
/**
*** Copyright (C) 1999 Advanced Micro Devices Inc. All rights reserved.
***
*** The information and source code contained herein is the exclusive
*** property of Advanced Micro Devices and may not be disclosed, examined
*** or reproduced in whole or in part without explicit written authorization
*** from the company.
***
**/
/*
* mm3dnow.h
*
*/
#ifndef _MM3DNOW_H_INCLUDED
#define _MM3DNOW_H_INCLUDED
#include <mmintrin.h>
#include <xmmintrin.h>
#if defined __cplusplus
extern "C" { /* Intrinsics use C name-mangling. */
#endif /* __cplusplus */
/* 3DNOW intrinsics */
void _m_femms(void);
__m64 _m_pavgusb(__m64, __m64);
__m64 _m_pf2id(__m64);
__m64 _m_pfacc(__m64, __m64);
__m64 _m_pfadd(__m64, __m64);
__m64 _m_pfcmpeq(__m64, __m64);
__m64 _m_pfcmpge(__m64, __m64);
__m64 _m_pfcmpgt(__m64, __m64);
__m64 _m_pfmax(__m64, __m64);
__m64 _m_pfmin(__m64, __m64);
__m64 _m_pfmul(__m64, __m64);
__m64 _m_pfrcp(__m64);
__m64 _m_pfrcpit1(__m64, __m64);
__m64 _m_pfrcpit2(__m64, __m64);
__m64 _m_pfrsqrt(__m64);
__m64 _m_pfrsqit1(__m64, __m64);
__m64 _m_pfsub(__m64, __m64);
__m64 _m_pfsubr(__m64, __m64);
__m64 _m_pi2fd(__m64);
__m64 _m_pmulhrw(__m64, __m64);
void _m_prefetch(void*);
void _m_prefetchw(void*);
__m64 _m_from_float(float);
float _m_to_float(__m64);
/* Athlon DSP intrinsics */
__m64 _m_pf2iw(__m64);
__m64 _m_pfnacc(__m64, __m64);
__m64 _m_pfpnacc(__m64, __m64);
__m64 _m_pi2fw(__m64);
__m64 _m_pswapd(__m64);
#if defined __cplusplus
}; /* End "C" */
#endif /* __cplusplus */
#endif /* _MM3DNOW_H_INCLUDED */

View File

@@ -0,0 +1,183 @@
/**
*** Copyright (C) 1985-1999 Intel Corporation. All rights reserved.
***
*** The information and source code contained herein is the exclusive
*** property of Intel Corporation and may not be disclosed, examined
*** or reproduced in whole or in part without explicit written authorization
*** from the company.
***
**/
/*
* Definitions and declarations for use with compiler intrinsics.
*/
#ifndef _MMINTRIN_H_INCLUDED
#define _MMINTRIN_H_INCLUDED
#if defined __cplusplus
extern "C" { /* Begin "C" */
/* Intrinsics use C name-mangling.
*/
#endif /* __cplusplus */
#ifdef __ICL
typedef unsigned long long __m64;
#elif _MSC_VER >= 1300
typedef union __declspec(intrin_type) __declspec(align(8)) __m64
{
unsigned __int64 m64_u64;
float m64_f32[2];
__int8 m64_i8[8];
__int16 m64_i16[4];
__int32 m64_i32[2];
__int64 m64_i64;
unsigned __int8 m64_u8[8];
unsigned __int16 m64_u16[4];
unsigned __int32 m64_u32[2];
} __m64;
#endif
/* General support intrinsics */
void _m_empty(void);
__m64 _m_from_int(int i);
int _m_to_int(__m64 m);
__m64 _m_packsswb(__m64 m1, __m64 m2);
__m64 _m_packssdw(__m64 m1, __m64 m2);
__m64 _m_packuswb(__m64 m1, __m64 m2);
__m64 _m_punpckhbw(__m64 m1, __m64 m2);
__m64 _m_punpckhwd(__m64 m1, __m64 m2);
__m64 _m_punpckhdq(__m64 m1, __m64 m2);
__m64 _m_punpcklbw(__m64 m1, __m64 m2);
__m64 _m_punpcklwd(__m64 m1, __m64 m2);
__m64 _m_punpckldq(__m64 m1, __m64 m2);
/* Packed arithmetic intrinsics */
__m64 _m_paddb(__m64 m1, __m64 m2);
__m64 _m_paddw(__m64 m1, __m64 m2);
__m64 _m_paddd(__m64 m1, __m64 m2);
__m64 _m_paddsb(__m64 m1, __m64 m2);
__m64 _m_paddsw(__m64 m1, __m64 m2);
__m64 _m_paddusb(__m64 m1, __m64 m2);
__m64 _m_paddusw(__m64 m1, __m64 m2);
__m64 _m_psubb(__m64 m1, __m64 m2);
__m64 _m_psubw(__m64 m1, __m64 m2);
__m64 _m_psubd(__m64 m1, __m64 m2);
__m64 _m_psubsb(__m64 m1, __m64 m2);
__m64 _m_psubsw(__m64 m1, __m64 m2);
__m64 _m_psubusb(__m64 m1, __m64 m2);
__m64 _m_psubusw(__m64 m1, __m64 m2);
__m64 _m_pmaddwd(__m64 m1, __m64 m2);
__m64 _m_pmulhw(__m64 m1, __m64 m2);
__m64 _m_pmullw(__m64 m1, __m64 m2);
/* Shift intrinsics */
__m64 _m_psllw(__m64 m, __m64 count);
__m64 _m_psllwi(__m64 m, int count);
__m64 _m_pslld(__m64 m, __m64 count);
__m64 _m_pslldi(__m64 m, int count);
__m64 _m_psllq(__m64 m, __m64 count);
__m64 _m_psllqi(__m64 m, int count);
__m64 _m_psraw(__m64 m, __m64 count);
__m64 _m_psrawi(__m64 m, int count);
__m64 _m_psrad(__m64 m, __m64 count);
__m64 _m_psradi(__m64 m, int count);
__m64 _m_psrlw(__m64 m, __m64 count);
__m64 _m_psrlwi(__m64 m, int count);
__m64 _m_psrld(__m64 m, __m64 count);
__m64 _m_psrldi(__m64 m, int count);
__m64 _m_psrlq(__m64 m, __m64 count);
__m64 _m_psrlqi(__m64 m, int count);
/* Logical intrinsics */
__m64 _m_pand(__m64 m1, __m64 m2);
__m64 _m_pandn(__m64 m1, __m64 m2);
__m64 _m_por(__m64 m1, __m64 m2);
__m64 _m_pxor(__m64 m1, __m64 m2);
/* Comparison intrinsics */
__m64 _m_pcmpeqb(__m64 m1, __m64 m2);
__m64 _m_pcmpeqw(__m64 m1, __m64 m2);
__m64 _m_pcmpeqd(__m64 m1, __m64 m2);
__m64 _m_pcmpgtb(__m64 m1, __m64 m2);
__m64 _m_pcmpgtw(__m64 m1, __m64 m2);
__m64 _m_pcmpgtd(__m64 m1, __m64 m2);
/* Utility intrinsics */
__m64 _mm_setzero_si64();
__m64 _mm_set_pi32(int i1, int i0);
__m64 _mm_set_pi16(short s3, short s2, short s1, short s0);
__m64 _mm_set_pi8(char b7, char b6, char b5, char b4,
char b3, char b2, char b1, char b0);
__m64 _mm_set1_pi32(int i);
__m64 _mm_set1_pi16(short s);
__m64 _mm_set1_pi8(char b);
__m64 _mm_setr_pi32(int i1, int i0);
__m64 _mm_setr_pi16(short s3, short s2, short s1, short s0);
__m64 _mm_setr_pi8(char b7, char b6, char b5, char b4,
char b3, char b2, char b1, char b0);
/* Alternate intrinsic name definitions */
#define _mm_empty _m_empty
#define _mm_cvtsi32_si64 _m_from_int
#define _mm_cvtsi64_si32 _m_to_int
#define _mm_packs_pi16 _m_packsswb
#define _mm_packs_pi32 _m_packssdw
#define _mm_packs_pu16 _m_packuswb
#define _mm_unpackhi_pi8 _m_punpckhbw
#define _mm_unpackhi_pi16 _m_punpckhwd
#define _mm_unpackhi_pi32 _m_punpckhdq
#define _mm_unpacklo_pi8 _m_punpcklbw
#define _mm_unpacklo_pi16 _m_punpcklwd
#define _mm_unpacklo_pi32 _m_punpckldq
#define _mm_add_pi8 _m_paddb
#define _mm_add_pi16 _m_paddw
#define _mm_add_pi32 _m_paddd
#define _mm_adds_pi8 _m_paddsb
#define _mm_adds_pi16 _m_paddsw
#define _mm_adds_pu8 _m_paddusb
#define _mm_adds_pu16 _m_paddusw
#define _mm_sub_pi8 _m_psubb
#define _mm_sub_pi16 _m_psubw
#define _mm_sub_pi32 _m_psubd
#define _mm_subs_pi8 _m_psubsb
#define _mm_subs_pi16 _m_psubsw
#define _mm_subs_pu8 _m_psubusb
#define _mm_subs_pu16 _m_psubusw
#define _mm_madd_pi16 _m_pmaddwd
#define _mm_mulhi_pi16 _m_pmulhw
#define _mm_mullo_pi16 _m_pmullw
#define _mm_sll_pi16 _m_psllw
#define _mm_slli_pi16 _m_psllwi
#define _mm_sll_pi32 _m_pslld
#define _mm_slli_pi32 _m_pslldi
#define _mm_sll_si64 _m_psllq
#define _mm_slli_si64 _m_psllqi
#define _mm_sra_pi16 _m_psraw
#define _mm_srai_pi16 _m_psrawi
#define _mm_sra_pi32 _m_psrad
#define _mm_srai_pi32 _m_psradi
#define _mm_srl_pi16 _m_psrlw
#define _mm_srli_pi16 _m_psrlwi
#define _mm_srl_pi32 _m_psrld
#define _mm_srli_pi32 _m_psrldi
#define _mm_srl_si64 _m_psrlq
#define _mm_srli_si64 _m_psrlqi
#define _mm_and_si64 _m_pand
#define _mm_andnot_si64 _m_pandn
#define _mm_or_si64 _m_por
#define _mm_xor_si64 _m_pxor
#define _mm_cmpeq_pi8 _m_pcmpeqb
#define _mm_cmpeq_pi16 _m_pcmpeqw
#define _mm_cmpeq_pi32 _m_pcmpeqd
#define _mm_cmpgt_pi8 _m_pcmpgtb
#define _mm_cmpgt_pi16 _m_pcmpgtw
#define _mm_cmpgt_pi32 _m_pcmpgtd
#if defined __cplusplus
}; /* End "C" */
#endif /* __cplusplus */
#endif /* _MMINTRIN_H_INCLUDED */

View File

@@ -0,0 +1,120 @@
// new standard header for Microsoft
#pragma once
#ifndef _NEW_
#define _NEW_
#include <exception>
#pragma pack(push,8)
#pragma warning(push,3)
#pragma push_macro("new")
#undef new
_STD_BEGIN
// CLASS bad_alloc
class bad_alloc
: public exception
{ // base of all bad allocation exceptions
public:
bad_alloc(const char *_Message = _MESG("bad allocation")) _THROW0()
: exception(_Message)
{ // construct from message string
}
virtual ~bad_alloc() _THROW0()
{ // destroy the object
}
#if !_HAS_EXCEPTIONS
protected:
virtual void _Doraise() const
{ // perform class-specific exception handling
_RAISE(*this);
}
#endif /* _HAS_EXCEPTIONS */
};
// SUPPORT TYPES
#if !defined(_INC_NEW) || !defined(_MSC_EXTENSIONS)
typedef void (__cdecl *new_handler)(); // handler for operator new failures
#endif /* !defined(_INC_NEW) || !defined(_MSC_EXTENSIONS) */
#ifndef __NOTHROW_T_DEFINED
struct nothrow_t
{ // placement new tag type to suppress exceptions
};
extern const nothrow_t nothrow; // constant for placement new tag
#endif /* __NOTHROW_T_DEFINED */
// FUNCTION AND OBJECT DECLARATIONS
_CRTIMP2 new_handler __cdecl set_new_handler(new_handler)
_THROW0(); // establish alternate new handler
_STD_END
// new AND delete DECLARATIONS (NB: NOT IN std)
void __cdecl operator delete(void *) _THROW0();
void *__cdecl operator new(size_t) _THROW1(std::bad_alloc);
#ifndef __PLACEMENT_NEW_INLINE
#define __PLACEMENT_NEW_INLINE
inline void *__cdecl operator new(size_t, void *_Where) _THROW0()
{ // construct array with placement at _Where
return (_Where);
}
inline void __cdecl operator delete(void *, void *) _THROW0()
{ // delete if placement new fails
}
#endif /* __PLACEMENT_NEW_INLINE */
#ifndef __PLACEMENT_VEC_NEW_INLINE
#define __PLACEMENT_VEC_NEW_INLINE
inline void *__cdecl operator new[](size_t, void *_Where) _THROW0()
{ // construct array with placement at _Where
return (_Where);
}
inline void __cdecl operator delete[](void *, void *) _THROW0()
{ // delete if placement array new fails
}
#endif /* __PLACEMENT_VEC_NEW_INLINE */
void __cdecl operator delete[](void *) _THROW0(); // delete allocated array
void *__cdecl operator new[](size_t)
_THROW1(std::bad_alloc); // allocate array or throw exception
#ifndef __NOTHROW_T_DEFINED
#define __NOTHROW_T_DEFINED
void *__cdecl operator new(size_t, const std::nothrow_t&)
_THROW0();
void *__cdecl operator new[](size_t, const std::nothrow_t&)
_THROW0(); // allocate array or return null pointer
void __cdecl operator delete(void *, const std::nothrow_t&)
_THROW0(); // delete if nothrow new fails -- REPLACEABLE
void __cdecl operator delete[](void *, const std::nothrow_t&)
_THROW0(); // delete if nothrow array new fails -- REPLACEABLE
#endif /* __NOTHROW_T_DEFINED */
#if !defined(_INC_NEW) || !defined(_MSC_EXTENSIONS)
using std::new_handler;
#endif /* !defined(_INC_NEW) || !defined(_MSC_EXTENSIONS) */
#pragma pop_macro("new")
#pragma warning(pop)
#pragma pack(pop)
#endif /* _NEW_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

View File

@@ -0,0 +1,148 @@
/***
*new.h - declarations and definitions for C++ memory allocation functions
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* Contains the declarations for C++ memory allocation functions.
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_NEW
#define _INC_NEW
#ifdef __cplusplus
#ifndef _MSC_EXTENSIONS
#include <new>
#endif
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
/* Protect against #define of new */
#pragma push_macro("new")
#undef new
#if !defined(_W64)
#if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
#define _W64 __w64
#else
#define _W64
#endif
#endif
/* Define _CRTIMP */
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* ndef _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* _CRTIMP */
/* Define _CRTIMP2 */
#ifndef _CRTIMP2
#if defined(_DLL) && !defined(_STATIC_CPPLIB)
#define _CRTIMP2 __declspec(dllimport)
#else /* ndef _DLL && !STATIC_CPPLIB */
#define _CRTIMP2
#endif /* _DLL && !STATIC_CPPLIB */
#endif /* _CRTIMP2 */
/* Define __cdecl for non-Microsoft compilers */
#if ( !defined(_MSC_VER) && !defined(__cdecl) )
#define __cdecl
#endif
/* types and structures */
#ifndef _SIZE_T_DEFINED
#ifdef _WIN64
typedef unsigned __int64 size_t;
#else
typedef _W64 unsigned int size_t;
#endif
#define _SIZE_T_DEFINED
#endif
#ifdef _MSC_EXTENSIONS
namespace std {
typedef void (__cdecl * new_handler) ();
_CRTIMP2 new_handler __cdecl set_new_handler(new_handler) throw();
};
using std::new_handler;
using std::set_new_handler;
#endif
#ifndef __NOTHROW_T_DEFINED
#define __NOTHROW_T_DEFINED
namespace std {
/* placement new tag type to suppress exceptions */
struct nothrow_t {};
/* constant for placement new tag */
extern const nothrow_t nothrow;
};
void *__cdecl operator new(size_t, const std::nothrow_t&) throw();
void *__cdecl operator new[](size_t, const std::nothrow_t&) throw();
void __cdecl operator delete(void *, const std::nothrow_t&) throw();
void __cdecl operator delete[](void *, const std::nothrow_t&) throw();
#endif
#ifndef __PLACEMENT_NEW_INLINE
#define __PLACEMENT_NEW_INLINE
inline void *__cdecl operator new(size_t, void *_P)
{return (_P); }
#if _MSC_VER >= 1200
inline void __cdecl operator delete(void *, void *)
{return; }
#endif
#endif
/*
* new mode flag -- when set, makes malloc() behave like new()
*/
_CRTIMP int __cdecl _query_new_mode( void );
_CRTIMP int __cdecl _set_new_mode( int );
#ifndef _PNH_DEFINED
typedef int (__cdecl * _PNH)( size_t );
#define _PNH_DEFINED
#endif
_CRTIMP _PNH __cdecl _query_new_handler( void );
_CRTIMP _PNH __cdecl _set_new_handler( _PNH );
/*
* Microsoft extension:
*
* _NO_ANSI_NEW_HANDLER de-activates the ANSI new_handler. Use this special value
* to support old style (_set_new_handler) behavior.
*/
#ifndef _NO_ANSI_NH_DEFINED
#define _NO_ANSI_NEW_HANDLER ((new_handler)-1)
#define _NO_ANSI_NH_DEFINED
#endif
#pragma pop_macro("new")
#endif /* __cplusplus */
#endif /* _INC_NEW */

View File

@@ -0,0 +1,179 @@
// numeric standard header
#pragma once
#ifndef _NUMERIC_
#define _NUMERIC_
#include <iterator>
#pragma pack(push,8)
#pragma warning(push,3)
_STD_BEGIN
// TEMPLATE FUNCTION accumulate
template<class _InIt,
class _Ty> inline
_Ty accumulate(_InIt _First, _InIt _Last, _Ty _Val)
{ // return sum of _Val and all in [_First, _Last)
for (; _First != _Last; ++_First)
_Val = _Val + *_First;
return (_Val);
}
// TEMPLATE FUNCTION accumulate WITH BINOP
template<class _InIt,
class _Ty,
class _Fn2> inline
_Ty accumulate(_InIt _First, _InIt _Last, _Ty _Val, _Fn2 _Func)
{ // return sum of _Val and all in [_First, _Last), using _Func
for (; _First != _Last; ++_First)
_Val = _Func(_Val, *_First);
return (_Val);
}
// TEMPLATE FUNCTION inner_product
template<class _InIt1,
class _InIt2,
class _Ty> inline
_Ty inner_product(_InIt1 _First1, _InIt1 _Last1, _InIt2 _First2, _Ty _Val)
{ // return inner product of sequences
for (; _First1 != _Last1; ++_First1, ++_First2)
_Val = _Val + *_First1 * *_First2;
return (_Val);
}
// TEMPLATE FUNCTION inner_product WITH BINOPS
template<class _InIt1,
class _InIt2,
class _Ty,
class _Fn21,
class _Fn22> inline
_Ty inner_product(_InIt1 _First1, _InIt1 _Last1, _InIt2 _First2, _Ty _Val,
_Fn21 _Func1, _Fn22 _Func2)
{ // return inner product of sequences, using _Func1 and _Func2
for (; _First1 != _Last1; ++_First1, ++_First2)
_Val = _Func1(_Val, _Func2(*_First1, *_First2));
return (_Val);
}
// TEMPLATE FUNCTION partial_sum
template<class _InIt,
class _OutIt,
class _Ty> inline
_OutIt _Partial_sum(_InIt _First, _InIt _Last, _OutIt _Dest, _Ty *)
{ // compute partial sums into _Dest
_Ty _Val = *_First;
for (*_Dest = _Val; ++_First != _Last; *++_Dest = _Val)
_Val = _Val + *_First;
return (++_Dest);
}
template<class _InIt,
class _OutIt> inline
_OutIt partial_sum(_InIt _First, _InIt _Last, _OutIt _Dest)
{ // compute partial sums into _Dest
return (_First == _Last ? _Dest
: _Partial_sum(_First, _Last, _Dest, _Val_type(_First)));
}
// TEMPLATE FUNCTION partial_sum WITH BINOP
template<class _InIt,
class _OutIt,
class _Fn2,
class _Ty> inline
_OutIt _Partial_sum(_InIt _First, _InIt _Last,
_OutIt _Dest, _Fn2 _Func, _Ty *)
{ // compute partial sums into _Dest, using _Func
_Ty _Val = *_First;
for (*_Dest = _Val; ++_First != _Last; *++_Dest = _Val)
_Val = _Func(_Val, *_First);
return (++_Dest);
}
template<class _InIt,
class _OutIt,
class _Fn2> inline
_OutIt partial_sum(_InIt _First, _InIt _Last,
_OutIt _Dest, _Fn2 _Func)
{ // compute partial sums into _Dest, using _Func
return (_First == _Last ? _Dest
: _Partial_sum(_First, _Last, _Dest, _Func, _Val_type(_First)));
}
// TEMPLATE FUNCTION adjacent_difference
template<class _InIt,
class _OutIt,
class _Ty> inline
_OutIt _Adjacent_difference(_InIt _First, _InIt _Last,
_OutIt _Dest, _Ty *)
{ // compute adjacent differences into _Dest
_Ty _Val = *_First;
for (*_Dest = _Val; ++_First != _Last; )
{ // compute another difference
_Ty _Tmp = *_First;
*++_Dest = _Tmp - _Val;
_Val = _Tmp;
}
return (++_Dest);
}
template<class _InIt,
class _OutIt> inline
_OutIt adjacent_difference(_InIt _First, _InIt _Last, _OutIt _Dest)
{ // compute adjacent differences into _Dest
return (_First == _Last ? _Dest
: _Adjacent_difference(_First, _Last, _Dest, _Val_type(_First)));
}
// TEMPLATE FUNCTION adjacent_difference WITH BINOP
template<class _InIt,
class _OutIt,
class _Fn2,
class _Ty> inline
_OutIt _Adjacent_difference(_InIt _First, _InIt _Last,
_OutIt _Dest, _Fn2 _Func, _Ty *)
{ // compute adjacent differences into _Dest, using _Func
_Ty _Val = *_First;
for (*_Dest = _Val; ++_First != _Last; )
{ // compute another difference
_Ty _Tmp = *_First;
*++_Dest = _Func(_Tmp, _Val);
_Val = _Tmp;
}
return (++_Dest);
}
template<class _InIt,
class _OutIt,
class _Fn2> inline
_OutIt adjacent_difference(_InIt _First, _InIt _Last,
_OutIt _Dest, _Fn2 _Func)
{ // compute adjacent differences into _Dest, using _Func
return (_First == _Last ? _Dest : _Adjacent_difference(_First, _Last,
_Dest, _Func, _Val_type(_First)));
}
_STD_END
#pragma warning(pop)
#pragma pack(pop)
#endif /* _NUMERIC_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
*/
/*
* This file is derived from software bearing the following
* restrictions:
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Permission to use, copy, modify, distribute and sell this
* software and its documentation for any purpose is hereby
* granted without fee, provided that the above copyright notice
* appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation.
* Hewlett-Packard Company makes no representations about the
* suitability of this software for any purpose. It is provided
* "as is" without express or implied warranty.
V3.13:0009 */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,251 @@
/***
*process.h - definition and declarations for process control functions
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file defines the modeflag values for spawnxx calls.
* Also contains the function argument declarations for all
* process control related routines.
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_PROCESS
#define _INC_PROCESS
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
#ifndef _POSIX_
#ifdef __cplusplus
extern "C" {
#endif
#if !defined(_W64)
#if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
#define _W64 __w64
#else
#define _W64
#endif
#endif
/* Define _CRTIMP */
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* ndef _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* _CRTIMP */
/* Define __cdecl for non-Microsoft compilers */
#if ( !defined(_MSC_VER) && !defined(__cdecl) )
#define __cdecl
#endif
#ifndef _INTPTR_T_DEFINED
#ifdef _WIN64
typedef __int64 intptr_t;
#else
typedef _W64 int intptr_t;
#endif
#define _INTPTR_T_DEFINED
#endif
#ifndef _UINTPTR_T_DEFINED
#ifdef _WIN64
typedef unsigned __int64 uintptr_t;
#else
typedef _W64 unsigned int uintptr_t;
#endif
#define _UINTPTR_T_DEFINED
#endif
#ifndef _WCHAR_T_DEFINED
typedef unsigned short wchar_t;
#define _WCHAR_T_DEFINED
#endif
/* modeflag values for _spawnxx routines */
#define _P_WAIT 0
#define _P_NOWAIT 1
#define _OLD_P_OVERLAY 2
#define _P_NOWAITO 3
#define _P_DETACH 4
#ifdef _MT
#define _P_OVERLAY 2
#else
extern int _p_overlay;
#define _P_OVERLAY _p_overlay
#endif /* _MT */
/* Action codes for _cwait(). The action code argument to _cwait is ignored
on Win32 though it is accepted for compatibilty with old MS CRT libs */
#define _WAIT_CHILD 0
#define _WAIT_GRANDCHILD 1
/* function prototypes */
#ifdef _MT
_CRTIMP uintptr_t __cdecl _beginthread (void (__cdecl *) (void *),
unsigned, void *);
_CRTIMP void __cdecl _endthread(void);
_CRTIMP uintptr_t __cdecl _beginthreadex(void *, unsigned,
unsigned (__stdcall *) (void *), void *, unsigned, unsigned *);
_CRTIMP void __cdecl _endthreadex(unsigned);
#endif
#if _MSC_VER >= 1200
_CRTIMP __declspec(noreturn) void __cdecl abort(void);
_CRTIMP __declspec(noreturn) void __cdecl exit(int);
_CRTIMP __declspec(noreturn) void __cdecl _exit(int);
#else
_CRTIMP void __cdecl abort(void);
_CRTIMP void __cdecl exit(int);
_CRTIMP void __cdecl _exit(int);
#endif
_CRTIMP void __cdecl _cexit(void);
_CRTIMP void __cdecl _c_exit(void);
_CRTIMP int __cdecl _getpid(void);
_CRTIMP intptr_t __cdecl _cwait(int *, intptr_t, int);
_CRTIMP intptr_t __cdecl _execl(const char *, const char *, ...);
_CRTIMP intptr_t __cdecl _execle(const char *, const char *, ...);
_CRTIMP intptr_t __cdecl _execlp(const char *, const char *, ...);
_CRTIMP intptr_t __cdecl _execlpe(const char *, const char *, ...);
_CRTIMP intptr_t __cdecl _execv(const char *, const char * const *);
_CRTIMP intptr_t __cdecl _execve(const char *, const char * const *, const char * const *);
_CRTIMP intptr_t __cdecl _execvp(const char *, const char * const *);
_CRTIMP intptr_t __cdecl _execvpe(const char *, const char * const *, const char * const *);
_CRTIMP intptr_t __cdecl _spawnl(int, const char *, const char *, ...);
_CRTIMP intptr_t __cdecl _spawnle(int, const char *, const char *, ...);
_CRTIMP intptr_t __cdecl _spawnlp(int, const char *, const char *, ...);
_CRTIMP intptr_t __cdecl _spawnlpe(int, const char *, const char *, ...);
_CRTIMP intptr_t __cdecl _spawnv(int, const char *, const char * const *);
_CRTIMP intptr_t __cdecl _spawnve(int, const char *, const char * const *,
const char * const *);
_CRTIMP intptr_t __cdecl _spawnvp(int, const char *, const char * const *);
_CRTIMP intptr_t __cdecl _spawnvpe(int, const char *, const char * const *,
const char * const *);
_CRTIMP int __cdecl system(const char *);
#ifndef _WPROCESS_DEFINED
/* wide function prototypes, also declared in wchar.h */
_CRTIMP intptr_t __cdecl _wexecl(const wchar_t *, const wchar_t *, ...);
_CRTIMP intptr_t __cdecl _wexecle(const wchar_t *, const wchar_t *, ...);
_CRTIMP intptr_t __cdecl _wexeclp(const wchar_t *, const wchar_t *, ...);
_CRTIMP intptr_t __cdecl _wexeclpe(const wchar_t *, const wchar_t *, ...);
_CRTIMP intptr_t __cdecl _wexecv(const wchar_t *, const wchar_t * const *);
_CRTIMP intptr_t __cdecl _wexecve(const wchar_t *, const wchar_t * const *, const wchar_t * const *);
_CRTIMP intptr_t __cdecl _wexecvp(const wchar_t *, const wchar_t * const *);
_CRTIMP intptr_t __cdecl _wexecvpe(const wchar_t *, const wchar_t * const *, const wchar_t * const *);
_CRTIMP intptr_t __cdecl _wspawnl(int, const wchar_t *, const wchar_t *, ...);
_CRTIMP intptr_t __cdecl _wspawnle(int, const wchar_t *, const wchar_t *, ...);
_CRTIMP intptr_t __cdecl _wspawnlp(int, const wchar_t *, const wchar_t *, ...);
_CRTIMP intptr_t __cdecl _wspawnlpe(int, const wchar_t *, const wchar_t *, ...);
_CRTIMP intptr_t __cdecl _wspawnv(int, const wchar_t *, const wchar_t * const *);
_CRTIMP intptr_t __cdecl _wspawnve(int, const wchar_t *, const wchar_t * const *,
const wchar_t * const *);
_CRTIMP intptr_t __cdecl _wspawnvp(int, const wchar_t *, const wchar_t * const *);
_CRTIMP intptr_t __cdecl _wspawnvpe(int, const wchar_t *, const wchar_t * const *,
const wchar_t * const *);
_CRTIMP int __cdecl _wsystem(const wchar_t *);
#define _WPROCESS_DEFINED
#endif
/* --------- The following functions are OBSOLETE --------- */
/*
* The Win32 API LoadLibrary, FreeLibrary and GetProcAddress should be used
* instead.
*/
intptr_t __cdecl _loaddll(char *);
int __cdecl _unloaddll(intptr_t);
int (__cdecl * __cdecl _getdllprocaddr(intptr_t, char *, intptr_t))();
/* --------- The preceding functions are OBSOLETE --------- */
#ifdef _DECL_DLLMAIN
/*
* Declare DLL notification (initialization/termination) routines
* The preferred method is for the user to provide DllMain() which will
* be called automatically by the DLL entry point defined by the C run-
* time library code. If the user wants to define the DLL entry point
* routine, the user's entry point must call _CRT_INIT on all types of
* notifications, as the very first thing on attach notifications and
* as the very last thing on detach notifications.
*/
#ifdef _WINDOWS_ /* Use types from WINDOWS.H */
BOOL WINAPI DllMain(HANDLE, DWORD, LPVOID);
BOOL WINAPI _CRT_INIT(HANDLE, DWORD, LPVOID);
BOOL WINAPI _wCRT_INIT(HANDLE, DWORD, LPVOID);
extern BOOL (WINAPI *_pRawDllMain)(HANDLE, DWORD, LPVOID);
#else
int __stdcall DllMain(void *, unsigned, void *);
int __stdcall _CRT_INIT(void *, unsigned, void *);
int __stdcall _wCRT_INIT(void *, unsigned, void *);
extern int (__stdcall *_pRawDllMain)(void *, unsigned, void *);
#endif /* _WINDOWS_ */
#endif
#if !__STDC__
/* Non-ANSI names for compatibility */
#define P_WAIT _P_WAIT
#define P_NOWAIT _P_NOWAIT
#define P_OVERLAY _P_OVERLAY
#define OLD_P_OVERLAY _OLD_P_OVERLAY
#define P_NOWAITO _P_NOWAITO
#define P_DETACH _P_DETACH
#define WAIT_CHILD _WAIT_CHILD
#define WAIT_GRANDCHILD _WAIT_GRANDCHILD
/* current declarations */
_CRTIMP intptr_t __cdecl cwait(int *, intptr_t, int);
_CRTIMP intptr_t __cdecl execl(const char *, const char *, ...);
_CRTIMP intptr_t __cdecl execle(const char *, const char *, ...);
_CRTIMP intptr_t __cdecl execlp(const char *, const char *, ...);
_CRTIMP intptr_t __cdecl execlpe(const char *, const char *, ...);
_CRTIMP intptr_t __cdecl execv(const char *, const char * const *);
_CRTIMP intptr_t __cdecl execve(const char *, const char * const *, const char * const *);
_CRTIMP intptr_t __cdecl execvp(const char *, const char * const *);
_CRTIMP intptr_t __cdecl execvpe(const char *, const char * const *, const char * const *);
_CRTIMP intptr_t __cdecl spawnl(int, const char *, const char *, ...);
_CRTIMP intptr_t __cdecl spawnle(int, const char *, const char *, ...);
_CRTIMP intptr_t __cdecl spawnlp(int, const char *, const char *, ...);
_CRTIMP intptr_t __cdecl spawnlpe(int, const char *, const char *, ...);
_CRTIMP intptr_t __cdecl spawnv(int, const char *, const char * const *);
_CRTIMP intptr_t __cdecl spawnve(int, const char *, const char * const *,
const char * const *);
_CRTIMP intptr_t __cdecl spawnvp(int, const char *, const char * const *);
_CRTIMP intptr_t __cdecl spawnvpe(int, const char *, const char * const *,
const char * const *);
_CRTIMP int __cdecl getpid(void);
#endif /* __STDC__ */
#ifdef __cplusplus
}
#endif
#endif /* _POSIX_ */
#endif /* _INC_PROCESS */

View File

@@ -0,0 +1,239 @@
// queue standard header
#pragma once
#ifndef _QUEUE_
#define _QUEUE_
#include <algorithm>
#include <deque>
#include <functional>
#include <vector>
#pragma pack(push,8)
#pragma warning(push,3)
_STD_BEGIN
// TEMPLATE CLASS queue
template<class _Ty,
class _Container = deque<_Ty> >
class queue
{ // FIFO queue implemented with a container
public:
typedef _Container container_type;
typedef typename _Container::value_type value_type;
typedef typename _Container::size_type size_type;
queue()
: c()
{ // construct with empty container
}
explicit queue(const _Container& _Cont)
: c(_Cont)
{ // construct by copying specified container
}
bool empty() const
{ // test if queue is empty
return (c.empty());
}
size_type size() const
{ // return length of queue
return (c.size());
}
value_type& front()
{ // return first element of mutable queue
return (c.front());
}
const value_type& front() const
{ // return first element of nonmutable queue
return (c.front());
}
value_type& back()
{ // return last element of mutable queue
return (c.back());
}
const value_type& back() const
{ // return last element of nonmutable queue
return (c.back());
}
void push(const value_type& _Val)
{ // insert element at beginning
c.push_back(_Val);
}
void pop()
{ // erase element at end
c.pop_front();
}
//protected:
_Container c; // the underlying container
};
// queue TEMPLATE FUNCTIONS
template<class _Ty,
class _Container> inline
bool operator==(const queue<_Ty, _Container>& _Left,
const queue<_Ty, _Container>& _Right)
{ // test for queue equality
return (_Left.c == _Right.c);
}
template<class _Ty,
class _Container> inline
bool operator!=(const queue<_Ty, _Container>& _Left,
const queue<_Ty, _Container>& _Right)
{ // test for queue inequality
return (!(_Left == _Right));
}
template<class _Ty,
class _Container> inline
bool operator<(const queue<_Ty, _Container>& _Left,
const queue<_Ty, _Container>& _Right)
{ // test if _Left < _Right for queues
return (_Left.c < _Right.c);
}
template<class _Ty,
class _Container> inline
bool operator>(const queue<_Ty, _Container>& _Left,
const queue<_Ty, _Container>& _Right)
{ // test if _Left > _Right for queues
return (_Right < _Left);
}
template<class _Ty,
class _Container> inline
bool operator<=(const queue<_Ty, _Container>& _Left,
const queue<_Ty, _Container>& _Right)
{ // test if _Left <= _Right for queues
return (!(_Right < _Left));
}
template<class _Ty,
class _Container> inline
bool operator>=(const queue<_Ty, _Container>& _Left,
const queue<_Ty, _Container>& _Right)
{ // test if _Left >= _Right for queues
return (!(_Left < _Right));
}
// TEMPLATE CLASS priority_queue
template<class _Ty,
class _Container = vector<_Ty>,
class _Pr = less<typename _Container::value_type> >
class priority_queue
{ // priority queue implemented with a _Container
public:
typedef _Container container_type;
typedef typename _Container::value_type value_type;
typedef typename _Container::size_type size_type;
priority_queue()
: c(), comp()
{ // construct with empty container, default comparator
}
explicit priority_queue(const _Pr& _Pred)
: c(), comp(_Pred)
{ // construct with empty container, specified comparator
}
priority_queue(const _Pr& _Pred, const _Container& _Cont)
: c(_Cont), comp(_Pred)
{ // construct by copying specified container, comparator
make_heap(c.begin(), c.end(), comp);
}
template<class _Iter>
priority_queue(_Iter _First, _Iter _Last)
: c(_First, _Last), comp()
{ // construct by copying [_First, _Last), default comparator
make_heap(c.begin(), c.end(), comp);
}
template<class _Iter>
priority_queue(_Iter _First, _Iter _Last, const _Pr& _Pred)
: c(_First, _Last), comp(_Pred)
{ // construct by copying [_First, _Last), specified comparator
make_heap(c.begin(), c.end(), comp);
}
template<class _Iter>
priority_queue(_Iter _First, _Iter _Last, const _Pr& _Pred,
const _Container& _Cont)
: c(_Cont), comp(_Pred)
{ // construct by copying [_First, _Last), container, and comparator
c.insert(c.end(), _First, _Last);
make_heap(c.begin(), c.end(), comp);
}
bool empty() const
{ // test if queue is empty
return (c.empty());
}
size_type size() const
{ // return length of queue
return (c.size());
}
const value_type& top() const
{ // return highest-priority element
return (c.front());
}
value_type& top()
{ // return mutable highest-priority element (retained)
return (c.front());
}
void push(const value_type& _Pred)
{ // insert value in priority order
c.push_back(_Pred);
push_heap(c.begin(), c.end(), comp);
}
void pop()
{ // erase highest-priority element
pop_heap(c.begin(), c.end(), comp);
c.pop_back();
}
protected:
_Container c; // the underlying container
_Pr comp; // the comparator functor
};
_STD_END
#pragma warning(pop)
#pragma pack(pop)
#endif /* _QUEUE_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
*/
/*
* This file is derived from software bearing the following
* restrictions:
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Permission to use, copy, modify, distribute and sell this
* software and its documentation for any purpose is hereby
* granted without fee, provided that the above copyright notice
* appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation.
* Hewlett-Packard Company makes no representations about the
* suitability of this software for any purpose. It is provided
* "as is" without express or implied warranty.
V3.13:0009 */

View File

@@ -0,0 +1,103 @@
/***
*rtcapi.h - declarations and definitions for RTC use
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* Contains the declarations and definitions for all RunTime Check
* support.
*
****/
#ifndef _INC_RTCAPI
#define _INC_RTCAPI
#ifdef __cplusplus
extern "C" {
#endif
/* General User API */
typedef enum _RTC_ErrorNumber {
_RTC_CHKSTK = 0,
_RTC_CVRT_LOSS_INFO,
_RTC_CORRUPT_STACK,
_RTC_UNINIT_LOCAL_USE,
_RTC_ILLEGAL
} _RTC_ErrorNumber;
# define _RTC_ERRTYPE_IGNORE -1
# define _RTC_ERRTYPE_ASK -2
typedef int (__cdecl *_RTC_error_fn)(int, const char *, int, const char *, const char *, ...);
/* User API */
int __cdecl _RTC_NumErrors(void);
const char * __cdecl _RTC_GetErrDesc(_RTC_ErrorNumber errnum);
int __cdecl _RTC_SetErrorType(_RTC_ErrorNumber errnum, int ErrType);
_RTC_error_fn __cdecl _RTC_SetErrorFunc(_RTC_error_fn);
/* Power User/library API */
/* Init functions */
/* These functions all call _CRT_RTC_INIT */
void __cdecl _RTC_Initialize(void);
void __cdecl _RTC_Terminate(void);
/*
* If you're not using the CRT, you have to implement _CRT_RTC_INIT
* Just return either null, or your error reporting function
* *** Don't mess with res0/res1/res2/res3/res4 - YOU'VE BEEN WARNED! ***
*/
_RTC_error_fn _CRT_RTC_INIT(void *res0, void **res1, int res2, int res3, int res4);
/* Compiler generated calls (unlikely to be used, even by power users) */
/* Types */
typedef struct _RTC_vardesc {
int addr;
int size;
char *name;
} _RTC_vardesc;
typedef struct _RTC_framedesc {
int varCount;
_RTC_vardesc *variables;
} _RTC_framedesc;
/* Shortening convert checks - name indicates src bytes to target bytes */
/* Signedness is NOT checked */
char __fastcall _RTC_Check_2_to_1(short src);
char __fastcall _RTC_Check_4_to_1(int src);
char __fastcall _RTC_Check_8_to_1(__int64 src);
short __fastcall _RTC_Check_4_to_2(int src);
short __fastcall _RTC_Check_8_to_2(__int64 src);
int __fastcall _RTC_Check_8_to_4(__int64 src);
/* Stack Checking Calls */
void __cdecl _RTC_CheckEsp();
void __fastcall _RTC_CheckStackVars(void *esp, _RTC_framedesc *fd);
/* Unintialized Local call */
void __cdecl _RTC_UninitUse(const char *varname);
/* Subsystem initialization stuff */
void __cdecl _RTC_Shutdown(void);
void __cdecl _RTC_InitBase(void);
#ifdef __cplusplus
void* _ReturnAddress();
}
#endif
#endif /* _INC_RTCAPI */

View File

@@ -0,0 +1,92 @@
/***
*search.h - declarations for searcing/sorting routines
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file contains the declarations for the sorting and
* searching routines.
* [System V]
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_SEARCH
#define _INC_SEARCH
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if !defined(_W64)
#if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
#define _W64 __w64
#else
#define _W64
#endif
#endif
/* Define _CRTIMP */
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* ndef _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* _CRTIMP */
/* Define __cdecl for non-Microsoft compilers */
#if ( !defined(_MSC_VER) && !defined(__cdecl) )
#define __cdecl
#endif
#ifndef _SIZE_T_DEFINED
#ifdef _WIN64
typedef unsigned __int64 size_t;
#else
typedef _W64 unsigned int size_t;
#endif
#define _SIZE_T_DEFINED
#endif
/* Function prototypes */
_CRTIMP void * __cdecl bsearch(const void *, const void *, size_t, size_t,
int (__cdecl *)(const void *, const void *));
_CRTIMP void * __cdecl _lfind(const void *, const void *, unsigned int *, unsigned int,
int (__cdecl *)(const void *, const void *));
_CRTIMP void * __cdecl _lsearch(const void *, void *, unsigned int *, unsigned int,
int (__cdecl *)(const void *, const void *));
_CRTIMP void __cdecl qsort(void *, size_t, size_t, int (__cdecl *)(const void *,
const void *));
#if !__STDC__
/* Non-ANSI names for compatibility */
_CRTIMP void * __cdecl lfind(const void *, const void *, unsigned int *, unsigned int,
int (__cdecl *)(const void *, const void *));
_CRTIMP void * __cdecl lsearch(const void *, void *, unsigned int *, unsigned int,
int (__cdecl *)(const void *, const void *));
#endif /* __STDC__ */
#ifdef __cplusplus
}
#endif
#endif /* _INC_SEARCH */

View File

@@ -0,0 +1,233 @@
// set standard header
#pragma once
#ifndef _SET_
#define _SET_
#include <xtree>
#pragma pack(push,8)
#pragma warning(push,3)
_STD_BEGIN
// TEMPLATE CLASS _Tset_traits
template<class _Kty, // key/value type
class _Pr, // comparator predicate type
class _Alloc, // actual allocator type (should be value allocator)
bool _Mfl> // true if multiple equivalent keys are permitted
class _Tset_traits
{ // traits required to make _Tree behave like a set
public:
typedef _Kty key_type;
typedef _Kty value_type;
typedef _Pr key_compare;
typedef typename _Alloc::template rebind<value_type>::other
allocator_type;
typedef _POINTER_X(value_type, allocator_type) _ITptr;
typedef _REFERENCE_X(value_type, allocator_type) _IReft;
enum
{ // make multi parameter visible as an enumeration constant
_Multi = _Mfl};
_Tset_traits()
: comp()
{ // construct with default comparator
}
_Tset_traits(_Pr _Parg)
: comp(_Parg)
{ // construct with specified comparator
}
typedef key_compare value_compare;
static const _Kty& _Kfn(const value_type& _Val)
{ // extract key from element value
return (_Val);
}
_Pr comp; // the comparator predicate for keys
};
// TEMPLATE CLASS set
template<class _Kty,
class _Pr = less<_Kty>,
class _Alloc = allocator<_Kty> >
class set
: public _Tree<_Tset_traits<_Kty, _Pr, _Alloc, false> >
{ // ordered red-black tree of key values, unique keys
public:
typedef set<_Kty, _Pr, _Alloc> _Myt;
typedef _Tree<_Tset_traits<_Kty, _Pr, _Alloc, false> > _Mybase;
typedef _Kty key_type;
typedef _Pr key_compare;
typedef typename _Mybase::value_compare value_compare;
typedef typename _Mybase::allocator_type allocator_type;
typedef typename _Mybase::size_type size_type;
typedef typename _Mybase::difference_type difference_type;
typedef typename _Mybase::pointer pointer;
typedef typename _Mybase::const_pointer const_pointer;
typedef typename _Mybase::reference reference;
typedef typename _Mybase::const_reference const_reference;
typedef typename _Mybase::iterator iterator;
typedef typename _Mybase::const_iterator const_iterator;
typedef typename _Mybase::reverse_iterator reverse_iterator;
typedef typename _Mybase::const_reverse_iterator
const_reverse_iterator;
typedef typename _Mybase::value_type value_type;
set()
: _Mybase(key_compare(), allocator_type())
{ // construct empty set from defaults
}
explicit set(const key_compare& _Pred)
: _Mybase(_Pred, allocator_type())
{ // construct empty set from comparator
}
set(const key_compare& _Pred, const allocator_type& _Al)
: _Mybase(_Pred, _Al)
{ // construct empty set from comparator and allocator
}
template<class _Iter>
set(_Iter _First, _Iter _Last)
: _Mybase(key_compare(), allocator_type())
{ // construct set from [_First, _Last), defaults
for (; _First != _Last; ++_First)
this->insert(*_First);
}
template<class _Iter>
set(_Iter _First, _Iter _Last,
const key_compare& _Pred)
: _Mybase(_Pred, allocator_type())
{ // construct set from [_First, _Last), comparator
for (; _First != _Last; ++_First)
this->insert(*_First);
}
template<class _Iter>
set(_Iter _First, _Iter _Last,
const key_compare& _Pred, const allocator_type& _Al)
: _Mybase(_Pred, _Al)
{ // construct set from [_First, _Last), defaults, and allocator
for (; _First != _Last; ++_First)
this->insert(*_First);
}
};
template<class _Kty,
class _Pr,
class _Alloc> inline
void swap(set<_Kty, _Pr, _Alloc>& _Left,
set<_Kty, _Pr, _Alloc>& _Right)
{ // swap _Left and _Right sets
_Left.swap(_Right);
}
// TEMPLATE CLASS multiset
template<class _Kty,
class _Pr = less<_Kty>,
class _Alloc = allocator<_Kty> >
class multiset
: public _Tree<_Tset_traits<_Kty, _Pr, _Alloc, true> >
{ // ordered red-black tree of key values, non-unique keys
public:
typedef multiset<_Kty, _Pr, _Alloc> _Myt;
typedef _Tree<_Tset_traits<_Kty, _Pr, _Alloc, true> > _Mybase;
typedef _Kty key_type;
typedef _Pr key_compare;
typedef typename _Mybase::value_compare value_compare;
typedef typename _Mybase::allocator_type allocator_type;
typedef typename _Mybase::size_type size_type;
typedef typename _Mybase::difference_type difference_type;
typedef typename _Mybase::pointer pointer;
typedef typename _Mybase::const_pointer const_pointer;
typedef typename _Mybase::reference reference;
typedef typename _Mybase::const_reference const_reference;
typedef typename _Mybase::iterator iterator;
typedef typename _Mybase::const_iterator const_iterator;
typedef typename _Mybase::reverse_iterator reverse_iterator;
typedef typename _Mybase::const_reverse_iterator
const_reverse_iterator;
typedef typename _Mybase::value_type value_type;
multiset()
: _Mybase(key_compare(), allocator_type())
{ // construct empty set from defaults
}
explicit multiset(const key_compare& _Pred)
: _Mybase(_Pred, allocator_type())
{ // construct empty set from comparator
}
multiset(const key_compare& _Pred, const allocator_type& _Al)
: _Mybase(_Pred, _Al)
{ // construct empty set from comparator and allocator
}
template<class _Iter>
multiset(_Iter _First, _Iter _Last)
: _Mybase(key_compare(), allocator_type())
{ // construct set from [_First, _Last)
for (; _First != _Last; ++_First)
this->insert(*_First);
}
template<class _Iter>
multiset(_Iter _First, _Iter _Last,
const key_compare& _Pred)
: _Mybase(_Pred, allocator_type())
{ // construct set from [_First, _Last), comparator
for (; _First != _Last; ++_First)
this->insert(*_First);
}
template<class _Iter>
multiset(_Iter _First, _Iter _Last,
const key_compare& _Pred, const allocator_type& _Al)
: _Mybase(_Pred, _Al)
{ // construct set from [_First, _Last), comparator, and allocator
for (; _First != _Last; ++_First)
this->insert(*_First);
}
iterator insert(const value_type& _Val)
{ // insert a key value
return (_Mybase::insert(_Val).first);
}
iterator insert(iterator _Where, const value_type& _Val)
{ // insert a key value, with hint
return (_Mybase::insert(_Where, _Val));
}
template<class _Iter>
void insert(_Iter _First, _Iter _Last)
{ // insert [_First, _Last)
for (; _First != _Last; ++_First)
this->insert(*_First);
}
};
template<class _Kty,
class _Pr,
class _Alloc> inline
void swap(multiset<_Kty, _Pr, _Alloc>& _Left,
multiset<_Kty, _Pr, _Alloc>& _Right)
{ // swap _Left and _Right multisets
_Left.swap(_Right);
}
_STD_END
#pragma warning(pop)
#pragma pack(pop)
#endif /* _SET_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

View File

@@ -0,0 +1,413 @@
/***
*setjmp.h - definitions/declarations for setjmp/longjmp routines
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file defines the machine-dependent buffer used by
* setjmp/longjmp to save and restore the program state, and
* declarations for those routines.
* [ANSI/System V]
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_SETJMP
#define _INC_SETJMP
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
#ifdef _MSC_VER
/*
* Currently, all MS C compilers for Win32 platforms default to 8 byte
* alignment.
*/
#pragma pack(push,8)
#endif /* _MSC_VER */
#ifdef __cplusplus
extern "C" {
#endif
/* Define _CRTIMP */
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* ndef _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* _CRTIMP */
/* Define __cdecl for non-Microsoft compilers */
#if ( !defined(_MSC_VER) && !defined(__cdecl) )
#define __cdecl
#endif
/*
* Definitions specific to particular setjmp implementations.
*/
#if defined(_M_IX86)
/*
* MS compiler for x86
*/
#ifndef _INC_SETJMPEX
#define setjmp _setjmp
#endif
#define _JBLEN 16
#define _JBTYPE int
/*
* Define jump buffer layout for x86 setjmp/longjmp.
*/
typedef struct __JUMP_BUFFER {
unsigned long Ebp;
unsigned long Ebx;
unsigned long Edi;
unsigned long Esi;
unsigned long Esp;
unsigned long Eip;
unsigned long Registration;
unsigned long TryLevel;
unsigned long Cookie;
unsigned long UnwindFunc;
unsigned long UnwindData[6];
} _JUMP_BUFFER;
#elif defined(_M_MRX000)
#ifndef _INC_SETJMPEX
#if _MSC_VER >= 1100
#define _setjmp _setjmpVfp
#endif
#define setjmp _setjmp
#endif
/*
* All MIPS implementations need _JBLEN of 16
*/
#define _JBLEN 16
#define _JBTYPE double
/*
* Define jump buffer layout for MIPS setjmp/longjmp.
*/
typedef struct __JUMP_BUFFER {
unsigned long FltF20;
unsigned long FltF21;
unsigned long FltF22;
unsigned long FltF23;
unsigned long FltF24;
unsigned long FltF25;
unsigned long FltF26;
unsigned long FltF27;
unsigned long FltF28;
unsigned long FltF29;
unsigned long FltF30;
unsigned long FltF31;
unsigned long IntS0;
unsigned long IntS1;
unsigned long IntS2;
unsigned long IntS3;
unsigned long IntS4;
unsigned long IntS5;
unsigned long IntS6;
unsigned long IntS7;
unsigned long IntS8;
unsigned long IntSp;
unsigned long Type;
unsigned long Fir;
} _JUMP_BUFFER;
#elif defined(_M_ALPHA)
/*
* The Alpha C8/GEM C compiler uses an intrinsic _setjmp.
* The Alpha acc compiler implements setjmp as a function.
*/
#ifdef _MSC_VER
#ifndef _INC_SETJMPEX
#define setjmp _setjmpex /* Alpha should always use setjmp as _setjmpex */
#endif
#endif
/*
* Alpha implementations use a _JBLEN of 24 quadwords.
* A double is used only to obtain quadword size and alignment.
*/
#define _JBLEN 24
#define _JBTYPE double
/*
* Define jump buffer layout for Alpha setjmp/longjmp.
* A double is used only to obtain quadword size and alignment.
*/
typedef struct __JUMP_BUFFER {
#ifdef _M_ALPHA64
#define _JBFILL 3
unsigned __int64 Fp;
unsigned __int64 Pc;
unsigned __int64 Seb;
unsigned long Type;
unsigned long Type_Fill;
#else
#define _JBFILL 5
unsigned long Fp;
unsigned long Pc;
unsigned long Seb;
unsigned long Type;
#endif
double FltF2;
double FltF3;
double FltF4;
double FltF5;
double FltF6;
double FltF7;
double FltF8;
double FltF9;
double IntS0;
double IntS1;
double IntS2;
double IntS3;
double IntS4;
double IntS5;
double IntS6;
double IntSp;
double Fir;
double Fill[_JBFILL];
} _JUMP_BUFFER;
#undef _JBFILL
#elif defined(_M_PPC)
/*
* The Microsoft VC++ V4.0 compiler uses an intrinsic _setjmp.
* The Motorola C8.5 compiler implements setjmp as a function.
*/
#if _MSC_VER > 850
#ifndef _INC_SETJMPEX
#undef _setjmp
#define setjmp _setjmp
#endif
#endif
/*
* Min length is 240 bytes; round to 256 bytes.
* Since this is allocated as an array of "double", the
* number of entries required is 32.
*
* All PPC implementations need _JBLEN of 32
*/
#define _JBLEN 32
#define _JBTYPE double
/*
* Define jump buffer layout for PowerPC setjmp/longjmp.
*/
typedef struct __JUMP_BUFFER {
double Fpr14;
double Fpr15;
double Fpr16;
double Fpr17;
double Fpr18;
double Fpr19;
double Fpr20;
double Fpr21;
double Fpr22;
double Fpr23;
double Fpr24;
double Fpr25;
double Fpr26;
double Fpr27;
double Fpr28;
double Fpr29;
double Fpr30;
double Fpr31;
unsigned long Gpr1;
unsigned long Gpr2;
unsigned long Gpr13;
unsigned long Gpr14;
unsigned long Gpr15;
unsigned long Gpr16;
unsigned long Gpr17;
unsigned long Gpr18;
unsigned long Gpr19;
unsigned long Gpr20;
unsigned long Gpr21;
unsigned long Gpr22;
unsigned long Gpr23;
unsigned long Gpr24;
unsigned long Gpr25;
unsigned long Gpr26;
unsigned long Gpr27;
unsigned long Gpr28;
unsigned long Gpr29;
unsigned long Gpr30;
unsigned long Gpr31;
unsigned long Cr;
unsigned long Iar;
unsigned long Type;
} _JUMP_BUFFER;
#elif defined(_M_IA64)
/*
* Minimum length is 528 bytes
* Since this is allocated as an array of "SETJMP_FLOAT128", the
* number of entries required is 33 (16-byte aligned).
*/
/* Avoid conflicts with winnt.h FLOAT128 by giving the typedef another name. */
typedef __declspec(align(16)) struct _SETJMP_FLOAT128 {
__int64 LowPart;
__int64 HighPart;
} SETJMP_FLOAT128;
#define _JBLEN 33
typedef SETJMP_FLOAT128 _JBTYPE;
#ifndef _INC_SETJMPEX
#define setjmp _setjmp
#endif
/*
* Define jump buffer layout for IA64 setjmp/longjmp.
*/
typedef struct __JUMP_BUFFER {
unsigned long iAReserved[6];
/*
* x86 C9.0 compatibility
*/
unsigned long Registration; /* point to the UnwindData field. */
unsigned long TryLevel; /* ignored by setjmp */
unsigned long Cookie; /* set to "VC20" by setjmp */
unsigned long UnwindFunc; /* set to EM longjmp() by setjmp */
/*
* First dword is zero to indicate it's an exception registration
* record prepared by EM setjmp function.
* Second dword is set to 0 for unsafe EM setjmp, and 1 for safe
* EM setjmp.
* Third dword is set to the setjmp site memory stack frame pointer.
* Fourth dword is set to the setjmp site backing store frame pointer.
*/
unsigned long UnwindData[6];
/*
* floating point status register,
* and preserved floating point registers fs0 - fs19
*/
SETJMP_FLOAT128 FltS0;
SETJMP_FLOAT128 FltS1;
SETJMP_FLOAT128 FltS2;
SETJMP_FLOAT128 FltS3;
SETJMP_FLOAT128 FltS4;
SETJMP_FLOAT128 FltS5;
SETJMP_FLOAT128 FltS6;
SETJMP_FLOAT128 FltS7;
SETJMP_FLOAT128 FltS8;
SETJMP_FLOAT128 FltS9;
SETJMP_FLOAT128 FltS10;
SETJMP_FLOAT128 FltS11;
SETJMP_FLOAT128 FltS12;
SETJMP_FLOAT128 FltS13;
SETJMP_FLOAT128 FltS14;
SETJMP_FLOAT128 FltS15;
SETJMP_FLOAT128 FltS16;
SETJMP_FLOAT128 FltS17;
SETJMP_FLOAT128 FltS18;
SETJMP_FLOAT128 FltS19;
__int64 FPSR;
/*
* return link and preserved branch registers bs0 - bs4
*/
__int64 StIIP; /* continuation address */
__int64 BrS0;
__int64 BrS1;
__int64 BrS2;
__int64 BrS3;
__int64 BrS4;
/*
* preserved general registers s0 - s3, sp, nats
*/
__int64 IntS0;
__int64 IntS1;
__int64 IntS2;
__int64 IntS3;
/*
* bsp, pfs, unat, lc
*/
__int64 RsBSP;
__int64 RsPFS; /* previous frame marker (cfm of setjmp's caller) */
__int64 ApUNAT; /* User Nat collection register (preserved) */
__int64 ApLC; /* loop counter */
__int64 IntSp; /* memory stack pointer */
__int64 IntNats; /* Nat bits of preserved integer regs s0 - s3 */
__int64 Preds; /* predicates */
} _JUMP_BUFFER;
#endif
/* Define the buffer type for holding the state information */
#ifndef _JMP_BUF_DEFINED
typedef _JBTYPE jmp_buf[_JBLEN];
#define _JMP_BUF_DEFINED
#endif
/* Function prototypes */
int __cdecl setjmp(jmp_buf);
#if _MSC_VER >= 1200
_CRTIMP __declspec(noreturn) void __cdecl longjmp(jmp_buf, int);
#else
_CRTIMP void __cdecl longjmp(jmp_buf, int);
#endif
#ifdef __cplusplus
}
#endif
#ifdef _MSC_VER
#pragma pack(pop)
#endif /* _MSC_VER */
#endif /* _INC_SETJMP */

View File

@@ -0,0 +1,58 @@
/***
*setjmpex.h - definitions/declarations for extended setjmp/longjmp routines
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file causes _setjmpex to be called which will enable safe
* setjmp/longjmp that work correctly with try/except/finally.
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_SETJMPEX
#define _INC_SETJMPEX
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
/*
* Definitions specific to particular setjmp implementations.
*/
#if defined(_M_IX86)
/*
* MS compiler for x86
*/
#define setjmp _setjmp
#define longjmp _longjmpex
#elif defined(_M_MRX000)
#if _MSC_VER >= 1100
#define _setjmpex _setjmpexVfp
#endif
#define setjmp _setjmpex
#else
#ifdef setjmp
#undef setjmp
#endif
#define setjmp _setjmpex
#endif
#include <setjmp.h>
#endif /* _INC_SETJMPEX */

View File

@@ -0,0 +1,38 @@
/***
*share.h - defines file sharing modes for sopen
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file defines the file sharing modes for sopen().
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_SHARE
#define _INC_SHARE
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
#define _SH_DENYRW 0x10 /* deny read/write mode */
#define _SH_DENYWR 0x20 /* deny write mode */
#define _SH_DENYRD 0x30 /* deny read mode */
#define _SH_DENYNO 0x40 /* deny none mode */
#if !__STDC__
/* Non-ANSI names for compatibility */
#define SH_DENYRW _SH_DENYRW
#define SH_DENYWR _SH_DENYWR
#define SH_DENYRD _SH_DENYRD
#define SH_DENYNO _SH_DENYNO
#endif
#endif /* _INC_SHARE */

View File

@@ -0,0 +1,100 @@
/***
*signal.h - defines signal values and routines
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file defines the signal values and declares the signal functions.
* [ANSI/System V]
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_SIGNAL
#define _INC_SIGNAL
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* Define _CRTIMP */
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* ndef _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* _CRTIMP */
/* Define __cdecl for non-Microsoft compilers */
#if ( !defined(_MSC_VER) && !defined(__cdecl) )
#define __cdecl
#endif
#ifndef _SIG_ATOMIC_T_DEFINED
typedef int sig_atomic_t;
#define _SIG_ATOMIC_T_DEFINED
#endif
#define NSIG 23 /* maximum signal number + 1 */
/* Signal types */
#define SIGINT 2 /* interrupt */
#define SIGILL 4 /* illegal instruction - invalid function image */
#define SIGFPE 8 /* floating point exception */
#define SIGSEGV 11 /* segment violation */
#define SIGTERM 15 /* Software termination signal from kill */
#define SIGBREAK 21 /* Ctrl-Break sequence */
#define SIGABRT 22 /* abnormal termination triggered by abort call */
/* signal action codes */
#define SIG_DFL (void (__cdecl *)(int))0 /* default signal action */
#define SIG_IGN (void (__cdecl *)(int))1 /* ignore signal */
#define SIG_SGE (void (__cdecl *)(int))3 /* signal gets error */
#define SIG_ACK (void (__cdecl *)(int))4 /* acknowledge */
/* signal error value (returned by signal call on error) */
#define SIG_ERR (void (__cdecl *)(int))-1 /* signal error value */
/* pointer to exception information pointers structure */
#if defined(_MT) || defined(_DLL)
extern void * * __cdecl __pxcptinfoptrs(void);
#define _pxcptinfoptrs (*__pxcptinfoptrs())
#else /* ndef _MT && ndef _DLL */
extern void * _pxcptinfoptrs;
#endif /* _MT || _DLL */
/* Function prototypes */
_CRTIMP void (__cdecl * __cdecl signal(int, void (__cdecl *)(int)))(int);
_CRTIMP int __cdecl raise(int);
#ifdef __cplusplus
}
#endif
#endif /* _INC_SIGNAL */

View File

@@ -0,0 +1,525 @@
// sstream standard header
#pragma once
#ifndef _SSTREAM_
#define _SSTREAM_
#include <string>
#pragma pack(push,8)
#pragma warning(push,3)
_STD_BEGIN
#pragma warning(disable:4251)
// TEMPLATE CLASS basic_stringbuf
template<class _Elem,
class _Traits,
class _Alloc>
class basic_stringbuf
: public basic_streambuf<_Elem, _Traits>
{ // stream buffer maintaining an allocated character array
public:
typedef _Alloc allocator_type;
typedef basic_streambuf<_Elem, _Traits> _Mysb;
typedef basic_string<_Elem, _Traits, _Alloc> _Mystr;
explicit basic_stringbuf(ios_base::openmode _Mode =
ios_base::in | ios_base::out)
{ // construct empty character buffer from mode
_Init(0, 0, _Getstate(_Mode));
}
explicit basic_stringbuf(const _Mystr& _Str,
ios_base::openmode _Mode = ios_base::in | ios_base::out)
{ // construct character buffer from string, mode
_Init(_Str.c_str(), _Str.size(), _Getstate(_Mode));
}
virtual ~basic_stringbuf()
{ // destroy the object
_Tidy();
}
enum
{ // constants for bits in stream state
_Allocated = 1, // set if character array storage has been allocated
_Constant = 2, // set if character array nonmutable
_Noread = 4, // set if character array cannot be read
_Append = 8}; // set if all writes are appends
typedef int _Strstate;
typedef typename _Traits::int_type int_type;
typedef typename _Traits::pos_type pos_type;
typedef typename _Traits::off_type off_type;
_Mystr str() const
{ // return string copy of character array
if (!(_Mystate & _Constant) && _Mysb::pptr() != 0)
{ // writable, make string from write buffer
_Mystr _Str(_Mysb::pbase(), (_Seekhigh < _Mysb::pptr()
? _Mysb::pptr() : _Seekhigh) - _Mysb::pbase());
return (_Str);
}
else if (!(_Mystate & _Noread) && _Mysb::gptr() != 0)
{ // readable, make string from read buffer
_Mystr _Str(_Mysb::eback(), _Mysb::egptr() - _Mysb::eback());
return (_Str);
}
else
{ // inaccessible, return empty string
_Mystr _Nul;
return (_Nul);
}
}
void str(const _Mystr& _Newstr)
{ // replace character array from string
_Tidy();
_Init(_Newstr.c_str(), _Newstr.size(), _Mystate);
}
protected:
virtual int_type overflow(int_type _Meta = _Traits::eof())
{ // put an element to stream
if (_Mystate & _Append
&& _Mysb::pptr() != 0 && _Mysb::pptr() < _Seekhigh)
_Mysb::setp(_Mysb::pbase(), _Seekhigh, _Mysb::epptr());
if (_Traits::eq_int_type(_Traits::eof(), _Meta))
return (_Traits::not_eof(_Meta)); // EOF, return success code
else if (_Mysb::pptr() != 0
&& _Mysb::pptr() < _Mysb::epptr())
{ // room in buffer, store it
*_Mysb::_Pninc() = _Traits::to_char_type(_Meta);
return (_Meta);
}
else if (_Mystate & _Constant)
return (_Traits::eof()); // array nonmutable, fail
else
{ // grow buffer and store element
size_t _Oldsize = _Mysb::pptr() == 0
? 0 : _Mysb::epptr() - _Mysb::eback();
size_t _Newsize = _Oldsize;
size_t _Inc = _Newsize / 2 < _MINSIZE
? _MINSIZE : _Newsize / 2; // grow by 50 per cent
_Elem *_Ptr = 0;
while (0 < _Inc && INT_MAX - _Inc < _Newsize)
_Inc /= 2; // increment causes overflow, halve it
if (0 < _Inc)
{ // finite increment, allocate new character array
_Newsize += _Inc;
_Ptr = _Al.allocate(_Newsize);
}
if (0 < _Oldsize)
_Traits::copy(_Ptr, _Mysb::eback(), _Oldsize);
if (_Mystate & _Allocated)
_Al.deallocate(_Mysb::eback(), _Oldsize);
_Mystate |= _Allocated;
if (_Oldsize == 0)
{ // first growth, set up pointers
_Seekhigh = _Ptr;
_Mysb::setp(_Ptr, _Ptr + _Newsize);
if (_Mystate & _Noread)
_Mysb::setg(_Ptr, 0, _Ptr);
else
_Mysb::setg(_Ptr, _Ptr, _Ptr + 1);
}
else
{ // not first growth, adjust pointers
_Seekhigh = _Seekhigh - _Mysb::eback() + _Ptr;
_Mysb::setp(_Mysb::pbase() - _Mysb::eback() + _Ptr,
_Mysb::pptr() - _Mysb::eback() + _Ptr, _Ptr + _Newsize);
if (_Mystate & _Noread)
_Mysb::setg(_Ptr, 0, _Ptr);
else
_Mysb::setg(_Ptr,
_Mysb::gptr() - _Mysb::eback() + _Ptr,
_Mysb::pptr() + 1);
}
*_Mysb::_Pninc() = _Traits::to_char_type(_Meta);
return (_Meta);
}
}
virtual int_type pbackfail(int_type _Meta = _Traits::eof())
{ // put an element back to stream
if (_Mysb::gptr() == 0
|| _Mysb::gptr() <= _Mysb::eback()
|| !_Traits::eq_int_type(_Traits::eof(), _Meta)
&& !_Traits::eq(_Traits::to_char_type(_Meta), _Mysb::gptr()[-1])
&& _Mystate & _Constant)
return (_Traits::eof()); // can't put back, fail
else
{ // back up one position and store put-back character
_Mysb::gbump(-1);
if (!_Traits::eq_int_type(_Traits::eof(), _Meta))
*_Mysb::gptr() = _Traits::to_char_type(_Meta);
return (_Traits::not_eof(_Meta));
}
}
virtual int_type underflow()
{ // get an element from stream, but don't point past it
if (_Mysb::gptr() == 0)
return (_Traits::eof()); // no character buffer, fail
else if (_Mysb::gptr() < _Mysb::egptr())
return (_Traits::to_int_type(*_Mysb::gptr())); // return buffered
else if (_Mystate & _Noread || _Mysb::pptr() == 0
|| _Mysb::pptr() <= _Mysb::gptr() && _Seekhigh <= _Mysb::gptr())
return (_Traits::eof()); // can't read, fail
else
{ // extend read buffer into written area, then return buffered
if (_Seekhigh < _Mysb::pptr())
_Seekhigh = _Mysb::pptr();
_Mysb::setg(_Mysb::eback(), _Mysb::gptr(), _Seekhigh);
return (_Traits::to_int_type(*_Mysb::gptr()));
}
}
virtual pos_type seekoff(off_type _Off,
ios_base::seekdir _Way,
ios_base::openmode _Which = ios_base::in | ios_base::out)
{ // change position by _Off, according to _Way, _Mode
if (_Mysb::pptr() != 0 && _Seekhigh < _Mysb::pptr())
_Seekhigh = _Mysb::pptr(); // update high-water pointer
if (_Which & ios_base::in && _Mysb::gptr() != 0)
{ // position within read buffer
if (_Way == ios_base::end)
_Off += (off_type)(_Seekhigh - _Mysb::eback());
else if (_Way == ios_base::cur
&& (_Which & ios_base::out) == 0)
_Off += (off_type)(_Mysb::gptr() - _Mysb::eback());
else if (_Way != ios_base::beg)
_Off = _BADOFF;
if (0 <= _Off && _Off <= _Seekhigh - _Mysb::eback())
{ // change read position
_Mysb::gbump((int)(_Mysb::eback() - _Mysb::gptr() + _Off));
if (_Which & ios_base::out && _Mysb::pptr() != 0)
_Mysb::setp(_Mysb::pbase(), _Mysb::gptr(),
_Mysb::epptr()); // change write position to match
}
else
_Off = _BADOFF;
}
else if (_Which & ios_base::out && _Mysb::pptr() != 0)
{ // position within write buffer
if (_Way == ios_base::end)
_Off += (off_type)(_Seekhigh - _Mysb::eback());
else if (_Way == ios_base::cur)
_Off += (off_type)(_Mysb::pptr() - _Mysb::eback());
else if (_Way != ios_base::beg)
_Off = _BADOFF;
if (0 <= _Off && _Off <= _Seekhigh - _Mysb::eback())
_Mysb::pbump((int)(_Mysb::eback()
- _Mysb::pptr() + _Off)); // change write position
else
_Off = _BADOFF;
}
else
_Off = _BADOFF; // neither read nor write buffer selected, fail
return (pos_type(_Off));
}
virtual pos_type seekpos(pos_type _Ptr,
ios_base::openmode _Mode = ios_base::in | ios_base::out)
{ // change position to _Pos, according to _Mode
streamoff _Off = (streamoff)_Ptr;
if (_Mysb::pptr() != 0 && _Seekhigh < _Mysb::pptr())
_Seekhigh = _Mysb::pptr(); // update high-water pointer
if (_Off == _BADOFF)
;
else if (_Mode & ios_base::in && _Mysb::gptr() != 0)
{ // position within read buffer
if (0 <= _Off && _Off <= _Seekhigh - _Mysb::eback())
{ // change read position
_Mysb::gbump((int)(_Mysb::eback() - _Mysb::gptr() + _Off));
if (_Mode & ios_base::out && _Mysb::pptr() != 0)
_Mysb::setp(_Mysb::pbase(), _Mysb::gptr(),
_Mysb::epptr()); // change write position to match
}
else
_Off = _BADOFF;
}
else if (_Mode & ios_base::out && _Mysb::pptr() != 0)
{ // position within write buffer
if (0 <= _Off && _Off <= _Seekhigh - _Mysb::eback())
_Mysb::pbump((int)(_Mysb::eback()
- _Mysb::pptr() + _Off)); // change write position
else
_Off = _BADOFF;
}
else
_Off = _BADOFF;
return (streampos(_Off));
}
void _Init(const _Elem *_Ptr,
size_t _Count, _Strstate _State)
{ // initialize buffer to [_Ptr, _Ptr + _Count), set state
_Seekhigh = 0;
_Mystate = _State;
if (_Count != 0
&& (_Mystate & (_Noread | _Constant)) != (_Noread | _Constant))
{ // finite buffer that can be read or written, set it up
_Elem *_Pnew = _Al.allocate(_Count);
_Traits::copy(_Pnew, _Ptr, _Count);
_Seekhigh = _Pnew + _Count;
if (!(_Mystate & _Noread))
_Mysb::setg(_Pnew, _Pnew,
_Pnew + _Count); // setup read buffer
if (!(_Mystate & _Constant))
{ // setup write buffer, and maybe read buffer
_Mysb::setp(_Pnew, _Pnew + _Count);
if (_Mysb::gptr() == 0)
_Mysb::setg(_Pnew, 0, _Pnew);
}
_Mystate |= _Allocated;
}
}
void _Tidy()
{ // discard any allocated buffer and clear pointers
if (_Mystate & _Allocated)
_Al.deallocate(_Mysb::eback(),
(_Mysb::pptr() != 0 ? _Mysb::epptr()
: _Mysb::egptr()) - _Mysb::eback());
_Mysb::setg(0, 0, 0);
_Mysb::setp(0, 0);
_Seekhigh = 0;
_Mystate &= ~_Allocated;
}
private:
enum
{ // constant for minimum buffer size
_MINSIZE = 32};
_Strstate _Getstate(ios_base::openmode _Mode)
{ // convert open mode to stream state bits
_Strstate _State = (_Strstate)0;
if (!(_Mode & ios_base::in))
_State |= _Noread;
if (!(_Mode & ios_base::out))
_State |= _Constant;
if (_Mode & ios_base::app)
_State |= _Append;
return (_State);
}
_Elem *_Seekhigh; // the high-water pointer in character array
_Strstate _Mystate; // the stream state
allocator_type _Al; // the allocator object
};
#ifdef _DLL_CPPLIB
template class _CRTIMP2 basic_stringbuf<char,
char_traits<char>, allocator<char> >;
template class _CRTIMP2 basic_stringbuf<wchar_t,
char_traits<wchar_t>, allocator<wchar_t> >;
#endif /* _DLL_CPPLIB */
// TEMPLATE CLASS basic_istringstream
template<class _Elem,
class _Traits,
class _Alloc>
class basic_istringstream
: public basic_istream<_Elem, _Traits>
{ // input stream associated with a character array
public:
typedef _Alloc allocator_type;
typedef basic_stringbuf<_Elem, _Traits, _Alloc> _Mysb;
typedef basic_string<_Elem, _Traits, _Alloc> _Mystr;
explicit basic_istringstream(ios_base::openmode _Mode = ios_base::in)
: basic_istream<_Elem, _Traits>(&_Stringbuffer),
_Stringbuffer(_Mode | ios_base::in)
{ // construct empty readable character buffer
}
explicit basic_istringstream(const _Mystr& _Str,
ios_base::openmode _Mode = ios_base::in)
: basic_istream<_Elem, _Traits>(&_Stringbuffer),
_Stringbuffer(_Str, _Mode | ios_base::in)
{ // construct readable character buffer from NTCS
}
virtual ~basic_istringstream()
{ // destroy the object
}
_Mysb *rdbuf() const
{ // return pointer to file buffer
return ((_Mysb *)&_Stringbuffer);
}
_Mystr str() const
{ // return string copy of character array
return (_Stringbuffer.str());
}
void str(const _Mystr& _Newstr)
{ // replace character array from string
_Stringbuffer.str(_Newstr);
}
private:
_Mysb _Stringbuffer; // the string buffer
};
#ifdef _DLL_CPPLIB
template class _CRTIMP2 basic_istringstream<char,
char_traits<char>, allocator<char> >;
template class _CRTIMP2 basic_istringstream<wchar_t,
char_traits<wchar_t>, allocator<wchar_t> >;
#endif /* _DLL_CPPLIB */
// TEMPLATE CLASS basic_ostringstream
template<class _Elem,
class _Traits,
class _Alloc>
class basic_ostringstream
: public basic_ostream<_Elem, _Traits>
{ // output stream associated with a character array
public:
typedef _Alloc allocator_type;
typedef basic_stringbuf<_Elem, _Traits, _Alloc> _Mysb;
typedef basic_string<_Elem, _Traits, _Alloc> _Mystr;
explicit basic_ostringstream(ios_base::openmode _Mode = ios_base::out)
: basic_ostream<_Elem, _Traits>(&_Stringbuffer),
_Stringbuffer(_Mode | ios_base::out)
{ // construct empty writable character buffer
}
explicit basic_ostringstream(const _Mystr& _Str,
ios_base::openmode _Mode = ios_base::out)
: basic_ostream<_Elem, _Traits>(&_Stringbuffer),
_Stringbuffer(_Str, _Mode | ios_base::out)
{ // construct writable character buffer from NTCS
}
virtual ~basic_ostringstream()
{ // destroy the object
}
_Mysb *rdbuf() const
{ // return pointer to buffer
return ((_Mysb *)&_Stringbuffer);
}
_Mystr str() const
{ // return string copy of character array
return (_Stringbuffer.str());
}
void str(const _Mystr& _Newstr)
{ // replace character array from string
_Stringbuffer.str(_Newstr);
}
private:
_Mysb _Stringbuffer; // the string buffer
};
#ifdef _DLL_CPPLIB
template class _CRTIMP2 basic_ostringstream<char,
char_traits<char>, allocator<char> >;
template class _CRTIMP2 basic_ostringstream<wchar_t,
char_traits<wchar_t>, allocator<wchar_t> >;
#endif /* _DLL_CPPLIB */
// TEMPLATE CLASS basic_stringstream
template<class _Elem,
class _Traits,
class _Alloc>
class basic_stringstream
: public basic_iostream<_Elem, _Traits>
{ // input/output stream associated with a character array
public:
typedef _Elem char_type;
typedef _Traits traits_type;
typedef _Alloc allocator_type;
typedef typename _Traits::int_type int_type;
typedef typename _Traits::pos_type pos_type;
typedef typename _Traits::off_type off_type;
typedef basic_string<_Elem, _Traits, _Alloc> _Mystr;
explicit basic_stringstream(ios_base::openmode _Mode =
ios_base::in | ios_base::out)
: basic_iostream<_Elem, _Traits>(&_Stringbuffer),
_Stringbuffer(_Mode)
{ // construct empty character buffer
}
explicit basic_stringstream(const _Mystr& _Str,
ios_base::openmode _Mode = ios_base::in | ios_base::out)
: basic_iostream<_Elem, _Traits>(&_Stringbuffer),
_Stringbuffer(_Str, _Mode)
{ // construct character buffer from NTCS
}
virtual ~basic_stringstream()
{ // destroy the object
}
basic_stringbuf<_Elem, _Traits, _Alloc> *rdbuf() const
{ // return pointer to buffer
return ((basic_stringbuf<_Elem, _Traits, _Alloc> *)&_Stringbuffer);
}
_Mystr str() const
{ // return string copy of character array
return (_Stringbuffer.str());
}
void str(const _Mystr& _Newstr)
{ // replace character array from string
_Stringbuffer.str(_Newstr);
}
private:
basic_stringbuf<_Elem, _Traits, _Alloc>
_Stringbuffer; // the string buffer
};
#ifdef _DLL_CPPLIB
template class _CRTIMP2 basic_stringstream<char,
char_traits<char>, allocator<char> >;
template class _CRTIMP2 basic_stringstream<wchar_t,
char_traits<wchar_t>, allocator<wchar_t> >;
#endif /* _DLL_CPPLIB */
_STD_END
#pragma warning(pop)
#pragma pack(pop)
#endif /* _SSTREAM_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

View File

@@ -0,0 +1,139 @@
// stack standard header
#pragma once
#ifndef _STACK_
#define _STACK_
#include <deque>
#pragma pack(push,8)
#pragma warning(push,3)
_STD_BEGIN
// TEMPLATE CLASS stack
template<class _Ty,
class _Container = deque<_Ty> >
class stack
{ // LIFO queue implemented with a container
public:
typedef _Container container_type;
typedef typename _Container::value_type value_type;
typedef typename _Container::size_type size_type;
stack()
: c()
{ // construct with empty container
}
explicit stack(const _Container& _Cont)
: c(_Cont)
{ // construct by copying specified container
}
bool empty() const
{ // test if stack is empty
return (c.empty());
}
size_type size() const
{ // test length of stack
return (c.size());
}
value_type& top()
{ // return last element of mutable stack
return (c.back());
}
const value_type& top() const
{ // return last element of nonmutable stack
return (c.back());
}
void push(const value_type& _Val)
{ // insert element at end
c.push_back(_Val);
}
void pop()
{ // erase last element
c.pop_back();
}
//protected:
_Container c; // the underlying container
};
// stack TEMPLATE FUNCTIONS
template<class _Ty,
class _Container> inline
bool operator==(const stack<_Ty, _Container>& _Left,
const stack<_Ty, _Container>& _Right)
{ // test for stack equality
return (_Left.c == _Right.c);
}
template<class _Ty,
class _Container> inline
bool operator!=(const stack<_Ty, _Container>& _Left,
const stack<_Ty, _Container>& _Right)
{ // test for stack inequality
return (!(_Left == _Right));
}
template<class _Ty,
class _Container> inline
bool operator<(const stack<_Ty, _Container>& _Left,
const stack<_Ty, _Container>& _Right)
{ // test if _Left < _Right for stacks
return (_Left.c < _Right.c);
}
template<class _Ty,
class _Container> inline
bool operator>(const stack<_Ty, _Container>& _Left,
const stack<_Ty, _Container>& _Right)
{ // test if _Left > _Right for stacks
return (_Right < _Left);
}
template<class _Ty,
class _Container> inline
bool operator<=(const stack<_Ty, _Container>& _Left,
const stack<_Ty, _Container>& _Right)
{ // test if _Left <= _Right for stacks
return (!(_Right < _Left));
}
template<class _Ty,
class _Container> inline
bool operator>=(const stack<_Ty, _Container>& _Left,
const stack<_Ty, _Container>& _Right)
{ // test if _Left >= _Right for stacks
return (!(_Left < _Right));
}
_STD_END
#pragma warning(pop)
#pragma pack(pop)
#endif /* _STACK_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
*/
/*
* This file is derived from software bearing the following
* restrictions:
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Permission to use, copy, modify, distribute and sell this
* software and its documentation for any purpose is hereby
* granted without fee, provided that the above copyright notice
* appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation.
* Hewlett-Packard Company makes no representations about the
* suitability of this software for any purpose. It is provided
* "as is" without express or implied warranty.
V3.13:0009 */

View File

@@ -0,0 +1,210 @@
/***
*stdarg.h - defines ANSI-style macros for variable argument functions
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file defines ANSI-style macros for accessing arguments
* of functions which take a variable number of arguments.
* [ANSI]
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_STDARG
#define _INC_STDARG
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
#ifdef _MSC_VER
/*
* Currently, all MS C compilers for Win32 platforms default to 8 byte
* alignment.
*/
#pragma pack(push,8)
#endif /* _MSC_VER */
#ifdef __cplusplus
extern "C" {
#endif
#if !defined(_W64)
#if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
#define _W64 __w64
#else
#define _W64
#endif
#endif
#ifndef _UINTPTR_T_DEFINED
#ifdef _WIN64
typedef unsigned __int64 uintptr_t;
#else
typedef _W64 unsigned int uintptr_t;
#endif
#define _UINTPTR_T_DEFINED
#endif
#ifndef _VA_LIST_DEFINED
#ifdef _M_ALPHA
typedef struct {
char *a0; /* pointer to first homed integer argument */
int offset; /* byte offset of next parameter */
} va_list;
#else
typedef char * va_list;
#endif
#define _VA_LIST_DEFINED
#endif
#ifdef __cplusplus
#define _ADDRESSOF(v) ( &reinterpret_cast<const char &>(v) )
#else
#define _ADDRESSOF(v) ( &(v) )
#endif
#if defined(_M_IA64)
#define _VA_ALIGN 8
#define _SLOTSIZEOF(t) ( (sizeof(t) + _VA_ALIGN - 1) & ~(_VA_ALIGN - 1) )
#define _VA_STRUCT_ALIGN 16
#define _ALIGNOF(ap) ((((ap)+_VA_STRUCT_ALIGN - 1) & ~(_VA_STRUCT_ALIGN -1)) \
- (ap))
#define _APALIGN(t,ap) (__alignof(t) > 8 ? _ALIGNOF((uintptr_t) ap) : 0)
#else
#define _SLOTSIZEOF(t) (sizeof(t))
#define _APALIGN(t,ap) (__builtin_alignof(t))
#endif
#if defined(_M_CEE)
extern void __cdecl __va_start(va_list*, ...);
extern void * __cdecl __va_arg(va_list*, ...);
extern void __cdecl __va_end(va_list*);
#define va_start(ap,v) ( __va_start(&ap, _ADDRESSOF(v), _SLOTSIZEOF(v), \
__builtin_alignof(v), _ADDRESSOF(v)) )
#define va_arg(ap,t) ( *(t *)__va_arg(&ap, _SLOTSIZEOF(t), \
_APALIGN(t,ap), (t *)0) )
#define va_end(ap) ( __va_end(&ap) )
#elif defined(_M_IX86)
#define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) )
#define va_start(ap,v) ( ap = (va_list)_ADDRESSOF(v) + _INTSIZEOF(v) )
#define va_arg(ap,t) ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) )
#define va_end(ap) ( ap = (va_list)0 )
#elif defined(_M_MRX000)
/* Use these types and definitions if generating code for MIPS */
#define va_start(ap,v) ap = (va_list)_ADDRESSOF(v) + sizeof(v)
#define va_end(list)
#define va_arg(list, mode) ((mode *)(list =\
(char *) ((((int)list + (__builtin_alignof(mode)<=4?3:7)) &\
(__builtin_alignof(mode)<=4?-4:-8))+sizeof(mode))))[-1]
/* +++++++++++++++++++++++++++++++++++++++++++
Because of parameter passing conventions in C:
use mode=int for char, and short types
use mode=double for float types
use a pointer for array types
+++++++++++++++++++++++++++++++++++++++++++ */
#elif defined(_M_ALPHA)
/* Use these types and definitions if generating code for ALPHA */
/*
* The Alpha compiler supports two builtin functions that are used to
* implement stdarg/varargs. The __builtin_va_start function is used
* by va_start to initialize the data structure that locates the next
* argument. The __builtin_isfloat function is used by va_arg to pick
* which part of the home area a given register argument is stored in.
* The home area is where up to six integer and/or six floating point
* register arguments are stored down (so they can also be referenced
* by a pointer like any arguments passed on the stack).
*/
extern void * __builtin_va_start(va_list, ...);
#ifdef _CFRONT
#define __builtin_isfloat(a) __builtin_alignof(a)
#endif
#define va_start(list, v) __builtin_va_start(list, v, 1)
#define va_end(list)
#define va_arg(list, mode) \
( *( ((list).offset += ((int)sizeof(mode) + 7) & -8) , \
(mode *)((list).a0 + (list).offset - \
((__builtin_isfloat(mode) && (list).offset <= (6 * 8)) ? \
(6 * 8) + 8 : ((int)sizeof(mode) + 7) & -8) \
) \
) \
)
#elif defined(_M_PPC)
/* Microsoft C8 front end (used in Motorola Merged compiler) */
/* bytes that a type occupies in the argument list */
#define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) )
/* return 'ap' adjusted for type 't' in arglist */
#define _ALIGNIT(ap,t) \
((((int)(ap))+(sizeof(t)<8?3:7)) & (sizeof(t)<8?~3:~7))
#define va_start(ap,v) ( ap = (va_list)_ADDRESSOF(v) + _INTSIZEOF(v) )
#define va_arg(ap,t) ( *(t *)((ap = (char *) (_ALIGNIT(ap, t) + _INTSIZEOF(t))) - _INTSIZEOF(t)) )
#define va_end(ap) ( ap = (va_list)0 )
#elif defined(_M_IA64)
#ifdef __cplusplus
extern void __cdecl __va_start(va_list*, ...);
#define va_start(ap,v) ( __va_start(&ap, _ADDRESSOF(v), _SLOTSIZEOF(v), \
_ADDRESSOF(v)) )
#else
#define va_start(ap,v) ( ap = (va_list)_ADDRESSOF(v) + _SLOTSIZEOF(v) )
#endif
#define va_arg(ap,t) (*(t *)((ap += _SLOTSIZEOF(t)+ _APALIGN(t,ap)) \
-_SLOTSIZEOF(t)))
#define va_end(ap) ( ap = (va_list)0 )
#else
/* A guess at the proper definitions for other platforms */
#define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) )
#define va_start(ap,v) ( ap = (va_list)_ADDRESSOF(v) + _INTSIZEOF(v) )
#define va_arg(ap,t) ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) )
#define va_end(ap) ( ap = (va_list)0 )
#endif
#ifdef __cplusplus
}
#endif
#ifdef _MSC_VER
#pragma pack(pop)
#endif /* _MSC_VER */
#endif /* _INC_STDARG */

View File

@@ -0,0 +1,143 @@
/***
*stddef.h - definitions/declarations for common constants, types, variables
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file contains definitions and declarations for some commonly
* used constants, types, and variables.
* [ANSI]
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_STDDEF
#define _INC_STDDEF
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if !defined(_W64)
#if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
#define _W64 __w64
#else
#define _W64
#endif
#endif
/* Define _CRTIMP */
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* ndef _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* _CRTIMP */
/* Define __cdecl for non-Microsoft compilers */
#if ( !defined(_MSC_VER) && !defined(__cdecl) )
#define __cdecl
#endif
/* Define NULL pointer value */
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
/* Declare reference to errno */
#if defined(_MT) || defined(_DLL)
_CRTIMP extern int * __cdecl _errno(void);
#define errno (*_errno())
#else /* ndef _MT && ndef _DLL */
_CRTIMP extern int errno;
#endif /* _MT || _DLL */
/* Define the implementation dependent size types */
#ifndef _INTPTR_T_DEFINED
#ifdef _WIN64
typedef __int64 intptr_t;
#else
typedef _W64 int intptr_t;
#endif
#define _INTPTR_T_DEFINED
#endif
#ifndef _UINTPTR_T_DEFINED
#ifdef _WIN64
typedef unsigned __int64 uintptr_t;
#else
typedef _W64 unsigned int uintptr_t;
#endif
#define _UINTPTR_T_DEFINED
#endif
#ifndef _PTRDIFF_T_DEFINED
#ifdef _WIN64
typedef __int64 ptrdiff_t;
#else
typedef _W64 int ptrdiff_t;
#endif
#define _PTRDIFF_T_DEFINED
#endif
#ifndef _SIZE_T_DEFINED
#ifdef _WIN64
typedef unsigned __int64 size_t;
#else
typedef _W64 unsigned int size_t;
#endif
#define _SIZE_T_DEFINED
#endif
#ifndef _WCHAR_T_DEFINED
typedef unsigned short wchar_t;
#define _WCHAR_T_DEFINED
#endif
/* Define offsetof macro */
#ifdef _WIN64
#define offsetof(s,m) (size_t)( (ptrdiff_t)&(((s *)0)->m) )
#else
#define offsetof(s,m) (size_t)&(((s *)0)->m)
#endif
#ifdef _MT
_CRTIMP extern unsigned long __cdecl __threadid(void);
#define _threadid (__threadid())
_CRTIMP extern uintptr_t __cdecl __threadhandle(void);
#endif
#ifdef __cplusplus
}
#endif
#endif /* _INC_STDDEF */

View File

@@ -0,0 +1,241 @@
// stdexcept standard header
#pragma once
#ifndef _STDEXCEPT_
#define _STDEXCEPT_
#include <exception>
#include <xstring>
#pragma pack(push,8)
#pragma warning(push,3)
_STD_BEGIN
// CLASS logic_error
class logic_error
: public _XSTD exception
{ // base of all logic-error exceptions
public:
explicit logic_error(const string& _Message)
: _Str(_Message)
{ // construct from message string
}
virtual ~logic_error()
{} // destroy the object
virtual const char *what() const _THROW0()
{ // return pointer to message string
return (_Str.c_str());
}
#if !_HAS_EXCEPTIONS
protected:
virtual void _Doraise() const
{ // perform class-specific exception handling
_RAISE(*this);
}
#endif /* _HAS_EXCEPTIONS */
private:
string _Str; // the stored message string
};
// CLASS domain_error
class domain_error
: public logic_error
{ // base of all domain-error exceptions
public:
explicit domain_error(const string& _Message)
: logic_error(_Message)
{ // construct from message string
}
virtual ~domain_error()
{} // destroy the object
#if !_HAS_EXCEPTIONS
protected:
virtual void _Doraise() const
{ // perform class-specific exception handling
_RAISE(*this);
}
#endif /* _HAS_EXCEPTIONS */
};
// CLASS invalid_argument
class invalid_argument
: public logic_error
{ // base of all invalid-argument exceptions
public:
explicit invalid_argument(const string& _Message)
: logic_error(_Message)
{ // construct from message string
}
virtual ~invalid_argument()
{} // destroy the object
#if !_HAS_EXCEPTIONS
protected:
virtual void _Doraise() const
{ // perform class-specific exception handling
_RAISE(*this);
}
#endif /* _HAS_EXCEPTIONS */
};
// CLASS length_error
class length_error
: public logic_error
{ // base of all length-error exceptions
public:
explicit length_error(const string& _Message)
: logic_error(_Message)
{ // construct from message string
}
virtual ~length_error()
{} // destroy the object
#if !_HAS_EXCEPTIONS
protected:
virtual void _Doraise() const
{ // perform class-specific exception handling
_RAISE(*this);
}
#endif /* _HAS_EXCEPTIONS */
};
// CLASS out_of_range
class out_of_range
: public logic_error
{ // base of all out-of-range exceptions
public:
explicit out_of_range(const string& _Message)
: logic_error(_Message)
{ // construct from message string
}
virtual ~out_of_range()
{} // destroy the object
#if !_HAS_EXCEPTIONS
protected:
virtual void _Doraise() const
{ // perform class-specific exception handling
_RAISE(*this);
}
#endif /* _HAS_EXCEPTIONS */
};
// CLASS runtime_error
class runtime_error
: public _XSTD exception
{ // base of all runtime-error exceptions
public:
explicit runtime_error(const string& _Message)
: _Str(_Message)
{ // construct from message string
}
virtual ~runtime_error()
{} // destroy the object
virtual const char *what() const _THROW0()
{ // return pointer to message string
return (_Str.c_str());
}
#if !_HAS_EXCEPTIONS
protected:
virtual void _Doraise() const
{ // perform class-specific exception handling
_RAISE(*this);
}
#endif /* _HAS_EXCEPTIONS */
private:
string _Str; // the stored message string
};
// CLASS overflow_error
class overflow_error
: public runtime_error
{ // base of all overflow-error exceptions
public:
explicit overflow_error(const string& _Message)
: runtime_error(_Message)
{ // construct from message string
}
virtual ~overflow_error()
{} // destroy the object
#if !_HAS_EXCEPTIONS
protected:
virtual void _Doraise() const
{ // perform class-specific exception handling
_RAISE(*this);
}
#endif /* _HAS_EXCEPTIONS */
};
// CLASS underflow_error
class underflow_error
: public runtime_error
{ // base of all underflow-error exceptions
public:
explicit underflow_error(const string& _Message)
: runtime_error(_Message)
{ // construct from message string
}
virtual ~underflow_error()
{} // destroy the object
#if !_HAS_EXCEPTIONS
protected:
virtual void _Doraise() const
{ // perform class-specific exception handling
_RAISE(*this);
}
#endif /* _HAS_EXCEPTIONS */
};
// CLASS range_error
class range_error
: public runtime_error
{ // base of all range-error exceptions
public:
explicit range_error(const string& _Message)
: runtime_error(_Message)
{ // construct from message string
}
virtual ~range_error()
{} // destroy the object
#if !_HAS_EXCEPTIONS
protected:
virtual void _Doraise() const
{ // perform class-specific exception handling
_RAISE(*this);
}
#endif /* _HAS_EXCEPTIONS */
};
_STD_END
#pragma warning(pop)
#pragma pack(pop)
#endif /* _STDEXCEPT_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

View File

@@ -0,0 +1,31 @@
/***
*stdexcpt.h - User include file for standard exception classes
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file is the previous location of the standard exception class
* definitions, now found in the standard header <exception>.
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_STDEXCPT
#define _INC_STDEXCPT
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
#ifdef __cplusplus
#include <exception>
#endif /* __cplusplus */
#endif /* _INC_STDEXCPT */

View File

@@ -0,0 +1,458 @@
/***
*stdio.h - definitions/declarations for standard I/O routines
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file defines the structures, values, macros, and functions
* used by the level 2 I/O ("standard I/O") routines.
* [ANSI/System V]
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_STDIO
#define _INC_STDIO
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
#ifdef _MSC_VER
/*
* Currently, all MS C compilers for Win32 platforms default to 8 byte
* alignment.
*/
#pragma pack(push,8)
#endif /* _MSC_VER */
#ifdef __cplusplus
extern "C" {
#endif
#if !defined(_W64)
#if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
#define _W64 __w64
#else
#define _W64
#endif
#endif
/* Define _CRTIMP */
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* ndef _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* _CRTIMP */
/* Define __cdecl for non-Microsoft compilers */
#if ( !defined(_MSC_VER) && !defined(__cdecl) )
#define __cdecl
#endif
#ifndef _SIZE_T_DEFINED
#ifdef _WIN64
typedef unsigned __int64 size_t;
#else
typedef _W64 unsigned int size_t;
#endif
#define _SIZE_T_DEFINED
#endif
#ifndef _WCHAR_T_DEFINED
typedef unsigned short wchar_t;
#define _WCHAR_T_DEFINED
#endif
#ifndef _WCTYPE_T_DEFINED
typedef unsigned short wint_t;
typedef unsigned short wctype_t;
#define _WCTYPE_T_DEFINED
#endif
#ifndef _VA_LIST_DEFINED
#ifdef _M_ALPHA
typedef struct {
char *a0; /* pointer to first homed integer argument */
int offset; /* byte offset of next parameter */
} va_list;
#else
typedef char * va_list;
#endif
#define _VA_LIST_DEFINED
#endif
/* Buffered I/O macros */
#define BUFSIZ 512
/*
* Default number of supported streams. _NFILE is confusing and obsolete, but
* supported anyway for backwards compatibility.
*/
#define _NFILE _NSTREAM_
#define _NSTREAM_ 512
/*
* Number of entries in _iob[] (declared below). Note that _NSTREAM_ must be
* greater than or equal to _IOB_ENTRIES.
*/
#define _IOB_ENTRIES 20
#define EOF (-1)
#ifndef _FILE_DEFINED
struct _iobuf {
char *_ptr;
int _cnt;
char *_base;
int _flag;
int _file;
int _charbuf;
int _bufsiz;
char *_tmpfname;
};
typedef struct _iobuf FILE;
#define _FILE_DEFINED
#endif
/* Directory where temporary files may be created. */
#ifdef _POSIX_
#define _P_tmpdir "/"
#define _wP_tmpdir L"/"
#else
#define _P_tmpdir "\\"
#define _wP_tmpdir L"\\"
#endif
/* L_tmpnam = length of string _P_tmpdir
* + 1 if _P_tmpdir does not end in "/" or "\", else 0
* + 12 (for the filename string)
* + 1 (for the null terminator)
*/
#define L_tmpnam sizeof(_P_tmpdir)+12
#ifdef _POSIX_
#define L_ctermid 9
#define L_cuserid 32
#endif
/* Seek method constants */
#define SEEK_CUR 1
#define SEEK_END 2
#define SEEK_SET 0
#define FILENAME_MAX 260
#define FOPEN_MAX 20
#define _SYS_OPEN 20
#define TMP_MAX 32767
/* Define NULL pointer value */
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
/* Declare _iob[] array */
#ifndef _STDIO_DEFINED
_CRTIMP extern FILE _iob[];
#endif /* _STDIO_DEFINED */
/* Define file position type */
#ifndef _FPOS_T_DEFINED
#undef _FPOSOFF
#if defined (_POSIX_)
typedef long fpos_t;
#define _FPOSOFF(fp) ((long)(fp))
#else /* _POSIX_ */
#if !__STDC__ && _INTEGRAL_MAX_BITS >= 64
typedef __int64 fpos_t;
#define _FPOSOFF(fp) ((long)(fp))
#else
typedef struct fpos_t {
unsigned int lopart;
int hipart;
} fpos_t;
#define _FPOSOFF(fp) ((long)(fp).lopart)
#endif
#endif /* _POSIX_ */
#define _FPOS_T_DEFINED
#endif
#define stdin (&_iob[0])
#define stdout (&_iob[1])
#define stderr (&_iob[2])
#define _IOREAD 0x0001
#define _IOWRT 0x0002
#define _IOFBF 0x0000
#define _IOLBF 0x0040
#define _IONBF 0x0004
#define _IOMYBUF 0x0008
#define _IOEOF 0x0010
#define _IOERR 0x0020
#define _IOSTRG 0x0040
#define _IORW 0x0080
#ifdef _POSIX_
#define _IOAPPEND 0x0200
#endif
/* Function prototypes */
#ifndef _STDIO_DEFINED
_CRTIMP int __cdecl _filbuf(FILE *);
_CRTIMP int __cdecl _flsbuf(int, FILE *);
#ifdef _POSIX_
_CRTIMP FILE * __cdecl _fsopen(const char *, const char *);
#else
_CRTIMP FILE * __cdecl _fsopen(const char *, const char *, int);
#endif
_CRTIMP void __cdecl clearerr(FILE *);
_CRTIMP int __cdecl fclose(FILE *);
_CRTIMP int __cdecl _fcloseall(void);
#ifdef _POSIX_
_CRTIMP FILE * __cdecl fdopen(int, const char *);
#else
_CRTIMP FILE * __cdecl _fdopen(int, const char *);
#endif
_CRTIMP int __cdecl feof(FILE *);
_CRTIMP int __cdecl ferror(FILE *);
_CRTIMP int __cdecl fflush(FILE *);
_CRTIMP int __cdecl fgetc(FILE *);
_CRTIMP int __cdecl _fgetchar(void);
_CRTIMP int __cdecl fgetpos(FILE *, fpos_t *);
_CRTIMP char * __cdecl fgets(char *, int, FILE *);
#ifdef _POSIX_
_CRTIMP int __cdecl fileno(FILE *);
#else
_CRTIMP int __cdecl _fileno(FILE *);
#endif
_CRTIMP int __cdecl _flushall(void);
_CRTIMP FILE * __cdecl fopen(const char *, const char *);
_CRTIMP int __cdecl fprintf(FILE *, const char *, ...);
_CRTIMP int __cdecl fputc(int, FILE *);
_CRTIMP int __cdecl _fputchar(int);
_CRTIMP int __cdecl fputs(const char *, FILE *);
_CRTIMP size_t __cdecl fread(void *, size_t, size_t, FILE *);
_CRTIMP FILE * __cdecl freopen(const char *, const char *, FILE *);
_CRTIMP int __cdecl fscanf(FILE *, const char *, ...);
_CRTIMP int __cdecl fsetpos(FILE *, const fpos_t *);
_CRTIMP int __cdecl fseek(FILE *, long, int);
_CRTIMP long __cdecl ftell(FILE *);
_CRTIMP size_t __cdecl fwrite(const void *, size_t, size_t, FILE *);
_CRTIMP int __cdecl getc(FILE *);
_CRTIMP int __cdecl getchar(void);
_CRTIMP int __cdecl _getmaxstdio(void);
_CRTIMP char * __cdecl gets(char *);
_CRTIMP int __cdecl _getw(FILE *);
_CRTIMP void __cdecl perror(const char *);
_CRTIMP int __cdecl _pclose(FILE *);
_CRTIMP FILE * __cdecl _popen(const char *, const char *);
_CRTIMP int __cdecl printf(const char *, ...);
_CRTIMP int __cdecl putc(int, FILE *);
_CRTIMP int __cdecl putchar(int);
_CRTIMP int __cdecl puts(const char *);
_CRTIMP int __cdecl _putw(int, FILE *);
_CRTIMP int __cdecl remove(const char *);
_CRTIMP int __cdecl rename(const char *, const char *);
_CRTIMP void __cdecl rewind(FILE *);
_CRTIMP int __cdecl _rmtmp(void);
_CRTIMP int __cdecl scanf(const char *, ...);
_CRTIMP void __cdecl setbuf(FILE *, char *);
_CRTIMP int __cdecl _setmaxstdio(int);
_CRTIMP int __cdecl setvbuf(FILE *, char *, int, size_t);
_CRTIMP int __cdecl _snprintf(char *, size_t, const char *, ...);
_CRTIMP int __cdecl sprintf(char *, const char *, ...);
_CRTIMP int __cdecl _scprintf(const char *, ...);
_CRTIMP int __cdecl sscanf(const char *, const char *, ...);
_CRTIMP int __cdecl _snscanf(const char *, size_t, const char *, ...);
_CRTIMP char * __cdecl _tempnam(const char *, const char *);
_CRTIMP FILE * __cdecl tmpfile(void);
_CRTIMP char * __cdecl tmpnam(char *);
_CRTIMP int __cdecl ungetc(int, FILE *);
_CRTIMP int __cdecl _unlink(const char *);
_CRTIMP int __cdecl vfprintf(FILE *, const char *, va_list);
_CRTIMP int __cdecl vprintf(const char *, va_list);
_CRTIMP int __cdecl _vsnprintf(char *, size_t, const char *, va_list);
_CRTIMP int __cdecl vsprintf(char *, const char *, va_list);
_CRTIMP int __cdecl _vscprintf(const char *, va_list);
#ifndef _WSTDIO_DEFINED
/* wide function prototypes, also declared in wchar.h */
#ifndef WEOF
#define WEOF (wint_t)(0xFFFF)
#endif
#ifdef _POSIX_
_CRTIMP FILE * __cdecl _wfsopen(const wchar_t *, const wchar_t *);
#else
_CRTIMP FILE * __cdecl _wfsopen(const wchar_t *, const wchar_t *, int);
#endif
_CRTIMP wint_t __cdecl fgetwc(FILE *);
_CRTIMP wint_t __cdecl _fgetwchar(void);
_CRTIMP wint_t __cdecl fputwc(wchar_t, FILE *);
_CRTIMP wint_t __cdecl _fputwchar(wchar_t);
_CRTIMP wint_t __cdecl getwc(FILE *);
_CRTIMP wint_t __cdecl getwchar(void);
_CRTIMP wint_t __cdecl putwc(wchar_t, FILE *);
_CRTIMP wint_t __cdecl putwchar(wchar_t);
_CRTIMP wint_t __cdecl ungetwc(wint_t, FILE *);
_CRTIMP wchar_t * __cdecl fgetws(wchar_t *, int, FILE *);
_CRTIMP int __cdecl fputws(const wchar_t *, FILE *);
_CRTIMP wchar_t * __cdecl _getws(wchar_t *);
_CRTIMP int __cdecl _putws(const wchar_t *);
_CRTIMP int __cdecl fwprintf(FILE *, const wchar_t *, ...);
_CRTIMP int __cdecl wprintf(const wchar_t *, ...);
_CRTIMP int __cdecl _snwprintf(wchar_t *, size_t, const wchar_t *, ...);
/* This non-standard definition exists for historical reasons to avoid breaking old code */
_CRTIMP int __cdecl swprintf(wchar_t *, const wchar_t *, ...);
#ifdef __cplusplus
/* For C++ we have an overloaded version with the standard definition */
extern "C++" _CRTIMP int __cdecl swprintf(wchar_t *, size_t, const wchar_t *, ...);
#endif
_CRTIMP int __cdecl _scwprintf(const wchar_t *, ...);
_CRTIMP int __cdecl vfwprintf(FILE *, const wchar_t *, va_list);
_CRTIMP int __cdecl vwprintf(const wchar_t *, va_list);
_CRTIMP int __cdecl _vsnwprintf(wchar_t *, size_t, const wchar_t *, va_list);
/* This non-standard definition exists for historical reasons to avoid breaking old code */
_CRTIMP int __cdecl vswprintf(wchar_t *, const wchar_t *, va_list);
#ifdef __cplusplus
/* For C++ we have an overloaded version with the standard definition */
extern "C++" _CRTIMP int __cdecl vswprintf(wchar_t *, size_t, const wchar_t *, va_list);
#endif
_CRTIMP int __cdecl _vscwprintf(const wchar_t *, va_list);
_CRTIMP int __cdecl fwscanf(FILE *, const wchar_t *, ...);
_CRTIMP int __cdecl swscanf(const wchar_t *, const wchar_t *, ...);
_CRTIMP int __cdecl _snwscanf(const wchar_t *, size_t, const wchar_t *, ...);
_CRTIMP int __cdecl wscanf(const wchar_t *, ...);
#define getwchar() fgetwc(stdin)
#define putwchar(_c) fputwc((_c),stdout)
#define getwc(_stm) fgetwc(_stm)
#define putwc(_c,_stm) fputwc(_c,_stm)
_CRTIMP FILE * __cdecl _wfdopen(int, const wchar_t *);
_CRTIMP FILE * __cdecl _wfopen(const wchar_t *, const wchar_t *);
_CRTIMP FILE * __cdecl _wfreopen(const wchar_t *, const wchar_t *, FILE *);
_CRTIMP void __cdecl _wperror(const wchar_t *);
_CRTIMP FILE * __cdecl _wpopen(const wchar_t *, const wchar_t *);
_CRTIMP int __cdecl _wremove(const wchar_t *);
_CRTIMP wchar_t * __cdecl _wtempnam(const wchar_t *, const wchar_t *);
_CRTIMP wchar_t * __cdecl _wtmpnam(wchar_t *);
#define _WSTDIO_DEFINED
#endif /* _WSTDIO_DEFINED */
#define _STDIO_DEFINED
#endif /* _STDIO_DEFINED */
/* Macro definitions */
#define feof(_stream) ((_stream)->_flag & _IOEOF)
#define ferror(_stream) ((_stream)->_flag & _IOERR)
#define _fileno(_stream) ((_stream)->_file)
#define getc(_stream) (--(_stream)->_cnt >= 0 \
? 0xff & *(_stream)->_ptr++ : _filbuf(_stream))
#define putc(_c,_stream) (--(_stream)->_cnt >= 0 \
? 0xff & (*(_stream)->_ptr++ = (char)(_c)) : _flsbuf((_c),(_stream)))
#define getchar() getc(stdin)
#define putchar(_c) putc((_c),stdout)
#ifdef _MT
#undef getc
#undef putc
#undef getchar
#undef putchar
#endif
#if !__STDC__ && !defined(_POSIX_)
/* Non-ANSI names for compatibility */
#define P_tmpdir _P_tmpdir
#define SYS_OPEN _SYS_OPEN
_CRTIMP int __cdecl fcloseall(void);
_CRTIMP FILE * __cdecl fdopen(int, const char *);
_CRTIMP int __cdecl fgetchar(void);
_CRTIMP int __cdecl fileno(FILE *);
_CRTIMP int __cdecl flushall(void);
_CRTIMP int __cdecl fputchar(int);
_CRTIMP int __cdecl getw(FILE *);
_CRTIMP int __cdecl putw(int, FILE *);
_CRTIMP int __cdecl rmtmp(void);
_CRTIMP char * __cdecl tempnam(const char *, const char *);
_CRTIMP int __cdecl unlink(const char *);
#endif /* __STDC__ */
#ifdef __cplusplus
}
#endif
#ifdef _MSC_VER
#pragma pack(pop)
#endif /* _MSC_VER */
#endif /* _INC_STDIO */

View File

@@ -0,0 +1,455 @@
/***
*stdlib.h - declarations/definitions for commonly used library functions
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* This include file contains the function declarations for commonly
* used library functions which either don't fit somewhere else, or,
* cannot be declared in the normal place for other reasons.
* [ANSI]
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_STDLIB
#define _INC_STDLIB
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
#ifdef _MSC_VER
/*
* Currently, all MS C compilers for Win32 platforms default to 8 byte
* alignment.
*/
#pragma pack(push,8)
#endif /* _MSC_VER */
#ifdef __cplusplus
extern "C" {
#endif
#if !defined(_W64)
#if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
#define _W64 __w64
#else
#define _W64
#endif
#endif
/* Define _CRTIMP */
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* ndef _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* _CRTIMP */
/* Define __cdecl for non-Microsoft compilers */
#if ( !defined(_MSC_VER) && !defined(__cdecl) )
#define __cdecl
#endif
#ifndef _SIZE_T_DEFINED
#ifdef _WIN64
typedef unsigned __int64 size_t;
#else
typedef _W64 unsigned int size_t;
#endif
#define _SIZE_T_DEFINED
#endif
#ifndef _WCHAR_T_DEFINED
typedef unsigned short wchar_t;
#define _WCHAR_T_DEFINED
#endif
/* Define NULL pointer value */
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
/* Definition of the argument values for the exit() function */
#define EXIT_SUCCESS 0
#define EXIT_FAILURE 1
#ifndef _ONEXIT_T_DEFINED
typedef int (__cdecl * _onexit_t)(void);
#if !__STDC__
/* Non-ANSI name for compatibility */
#define onexit_t _onexit_t
#endif
#define _ONEXIT_T_DEFINED
#endif
/* Data structure definitions for div and ldiv runtimes. */
#ifndef _DIV_T_DEFINED
typedef struct _div_t {
int quot;
int rem;
} div_t;
typedef struct _ldiv_t {
long quot;
long rem;
} ldiv_t;
#define _DIV_T_DEFINED
#endif
/* Maximum value that can be returned by the rand function. */
#define RAND_MAX 0x7fff
/*
* Maximum number of bytes in multi-byte character in the current locale
* (also defined in ctype.h).
*/
#ifndef MB_CUR_MAX
#define MB_CUR_MAX __mb_cur_max
_CRTIMP extern int __mb_cur_max;
/* These functions are for enabling STATIC_CPPLIB functionality */
_CRTIMP int __cdecl ___mb_cur_max_func(void);
#endif /* MB_CUR_MAX */
/* Minimum and maximum macros */
#define __max(a,b) (((a) > (b)) ? (a) : (b))
#define __min(a,b) (((a) < (b)) ? (a) : (b))
/*
* Sizes for buffers used by the _makepath() and _splitpath() functions.
* note that the sizes include space for 0-terminator
*/
#define _MAX_PATH 260 /* max. length of full pathname */
#define _MAX_DRIVE 3 /* max. length of drive component */
#define _MAX_DIR 256 /* max. length of path component */
#define _MAX_FNAME 256 /* max. length of file name component */
#define _MAX_EXT 256 /* max. length of extension component */
/*
* Argument values for _set_error_mode().
*/
#define _OUT_TO_DEFAULT 0
#define _OUT_TO_STDERR 1
#define _OUT_TO_MSGBOX 2
#define _REPORT_ERRMODE 3
#if defined(_M_IX86)
/*
* Typedefs and argument values for _set_security_error_handler()
*/
#define _SECERR_BUFFER_OVERRUN 1 /* void* arg ignored */
typedef void (__cdecl * _secerr_handler_func)(int, void *);
#endif
/* a purecall handler procedure. Never returns normally */
typedef void (__cdecl *_purecall_handler)();
/* establishes a purecall handler for the process */
_CRTIMP _purecall_handler __cdecl _set_purecall_handler(_purecall_handler);
/* External variable declarations */
#if defined(_MT) || defined(_DLL)
_CRTIMP int * __cdecl _errno(void);
_CRTIMP unsigned long * __cdecl __doserrno(void);
#define errno (*_errno())
#define _doserrno (*__doserrno())
#else /* ndef _MT && ndef _DLL */
_CRTIMP extern int errno; /* XENIX style error number */
_CRTIMP extern unsigned long _doserrno; /* OS system error value */
#endif /* _MT || _DLL */
_CRTIMP extern char * _sys_errlist[]; /* perror error message table */
_CRTIMP extern int _sys_nerr; /* # of entries in sys_errlist table */
#if defined(_DLL) && defined(_M_IX86)
#define __argc (*__p___argc()) /* count of cmd line args */
#define __argv (*__p___argv()) /* pointer to table of cmd line args */
#define __wargv (*__p___wargv()) /* pointer to table of wide cmd line args */
#define _environ (*__p__environ()) /* pointer to environment table */
#ifdef _POSIX_
extern char ** environ; /* pointer to environment table */
#else
#define _wenviron (*__p__wenviron()) /* pointer to wide environment table */
#endif /* _POSIX_ */
#define _pgmptr (*__p__pgmptr()) /* points to the module (EXE) name */
#define _wpgmptr (*__p__wpgmptr()) /* points to the module (EXE) wide name */
_CRTIMP int * __cdecl __p___argc(void);
_CRTIMP char *** __cdecl __p___argv(void);
_CRTIMP wchar_t *** __cdecl __p___wargv(void);
_CRTIMP char *** __cdecl __p__environ(void);
_CRTIMP wchar_t *** __cdecl __p__wenviron(void);
_CRTIMP char ** __cdecl __p__pgmptr(void);
_CRTIMP wchar_t ** __cdecl __p__wpgmptr(void);
#else
_CRTIMP extern int __argc; /* count of cmd line args */
_CRTIMP extern char ** __argv; /* pointer to table of cmd line args */
_CRTIMP extern wchar_t ** __wargv; /* pointer to table of wide cmd line args */
#ifdef _POSIX_
extern char ** environ; /* pointer to environment table */
#else
_CRTIMP extern char ** _environ; /* pointer to environment table */
_CRTIMP extern wchar_t ** _wenviron; /* pointer to wide environment table */
#endif /* _POSIX_ */
_CRTIMP extern char * _pgmptr; /* points to the module (EXE) name */
_CRTIMP extern wchar_t * _wpgmptr; /* points to the module (EXE) wide name */
#endif
_CRTIMP extern int _fmode; /* default file translation mode */
_CRTIMP extern int _fileinfo; /* open file info mode (for spawn) */
/* Windows major/minor and O.S. version numbers */
_CRTIMP extern unsigned int _osplatform;
_CRTIMP extern unsigned int _osver;
_CRTIMP extern unsigned int _winver;
_CRTIMP extern unsigned int _winmajor;
_CRTIMP extern unsigned int _winminor;
/* function prototypes */
#if _MSC_VER >= 1200
_CRTIMP __declspec(noreturn) void __cdecl abort(void);
_CRTIMP __declspec(noreturn) void __cdecl exit(int);
#else
_CRTIMP void __cdecl abort(void);
_CRTIMP void __cdecl exit(int);
#endif
#if defined(_M_MRX000)
_CRTIMP int __cdecl abs(int);
#else
int __cdecl abs(int);
#endif
__int64 __cdecl _abs64(__int64);
int __cdecl atexit(void (__cdecl *)(void));
_CRTIMP double __cdecl atof(const char *);
_CRTIMP int __cdecl atoi(const char *);
_CRTIMP long __cdecl atol(const char *);
_CRTIMP void * __cdecl bsearch(const void *, const void *, size_t, size_t,
int (__cdecl *)(const void *, const void *));
unsigned short __cdecl _byteswap_ushort(unsigned short);
unsigned long __cdecl _byteswap_ulong (unsigned long);
unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64);
_CRTIMP void * __cdecl calloc(size_t, size_t);
_CRTIMP div_t __cdecl div(int, int);
_CRTIMP void __cdecl free(void *);
_CRTIMP char * __cdecl getenv(const char *);
_CRTIMP char * __cdecl _itoa(int, char *, int);
#if _INTEGRAL_MAX_BITS >= 64
_CRTIMP char * __cdecl _i64toa(__int64, char *, int);
_CRTIMP char * __cdecl _ui64toa(unsigned __int64, char *, int);
_CRTIMP __int64 __cdecl _atoi64(const char *);
_CRTIMP __int64 __cdecl _strtoi64(const char *, char **, int);
_CRTIMP unsigned __int64 __cdecl _strtoui64(const char *, char **, int);
#endif
#if defined(_M_MRX000)
_CRTIMP long __cdecl labs(long);
#else
long __cdecl labs(long);
#endif
_CRTIMP ldiv_t __cdecl ldiv(long, long);
_CRTIMP char * __cdecl _ltoa(long, char *, int);
_CRTIMP void * __cdecl malloc(size_t);
_CRTIMP int __cdecl mblen(const char *, size_t);
_CRTIMP size_t __cdecl _mbstrlen(const char *s);
_CRTIMP int __cdecl mbtowc(wchar_t *, const char *, size_t);
_CRTIMP size_t __cdecl mbstowcs(wchar_t *, const char *, size_t);
_CRTIMP void __cdecl qsort(void *, size_t, size_t, int (__cdecl *)
(const void *, const void *));
_CRTIMP int __cdecl rand(void);
_CRTIMP void * __cdecl realloc(void *, size_t);
_CRTIMP int __cdecl _set_error_mode(int);
#if defined(_M_IX86)
_CRTIMP _secerr_handler_func
__cdecl _set_security_error_handler(_secerr_handler_func);
#endif
_CRTIMP void __cdecl srand(unsigned int);
_CRTIMP double __cdecl strtod(const char *, char **);
_CRTIMP long __cdecl strtol(const char *, char **, int);
_CRTIMP unsigned long __cdecl strtoul(const char *, char **, int);
_CRTIMP int __cdecl system(const char *);
_CRTIMP char * __cdecl _ultoa(unsigned long, char *, int);
_CRTIMP int __cdecl wctomb(char *, wchar_t);
_CRTIMP size_t __cdecl wcstombs(char *, const wchar_t *, size_t);
#ifndef _WSTDLIB_DEFINED
/* wide function prototypes, also declared in wchar.h */
_CRTIMP wchar_t * __cdecl _itow (int, wchar_t *, int);
_CRTIMP wchar_t * __cdecl _ltow (long, wchar_t *, int);
_CRTIMP wchar_t * __cdecl _ultow (unsigned long, wchar_t *, int);
_CRTIMP double __cdecl wcstod(const wchar_t *, wchar_t **);
_CRTIMP long __cdecl wcstol(const wchar_t *, wchar_t **, int);
_CRTIMP unsigned long __cdecl wcstoul(const wchar_t *, wchar_t **, int);
_CRTIMP wchar_t * __cdecl _wgetenv(const wchar_t *);
_CRTIMP int __cdecl _wsystem(const wchar_t *);
_CRTIMP double __cdecl _wtof(const wchar_t *);
_CRTIMP int __cdecl _wtoi(const wchar_t *);
_CRTIMP long __cdecl _wtol(const wchar_t *);
#if _INTEGRAL_MAX_BITS >= 64
_CRTIMP wchar_t * __cdecl _i64tow(__int64, wchar_t *, int);
_CRTIMP wchar_t * __cdecl _ui64tow(unsigned __int64, wchar_t *, int);
_CRTIMP __int64 __cdecl _wtoi64(const wchar_t *);
_CRTIMP __int64 __cdecl _wcstoi64(const wchar_t *, wchar_t **, int);
_CRTIMP unsigned __int64 __cdecl _wcstoui64(const wchar_t *, wchar_t **, int);
#endif
#define _WSTDLIB_DEFINED
#endif
#ifndef _POSIX_
/*
Buffer size required to be passed to _gcvt, fcvt and other fp conversion routines
*/
#define _CVTBUFSIZE (309+40) /* # of digits in max. dp value + slop */
_CRTIMP char * __cdecl _ecvt(double, int, int *, int *);
#if _MSC_VER >= 1200
_CRTIMP __declspec(noreturn) void __cdecl _exit(int);
#else
_CRTIMP void __cdecl _exit(int);
#endif
_CRTIMP char * __cdecl _fcvt(double, int, int *, int *);
_CRTIMP char * __cdecl _fullpath(char *, const char *, size_t);
_CRTIMP char * __cdecl _gcvt(double, int, char *);
unsigned long __cdecl _lrotl(unsigned long, int);
unsigned long __cdecl _lrotr(unsigned long, int);
_CRTIMP void __cdecl _makepath(char *, const char *, const char *, const char *,
const char *);
_onexit_t __cdecl _onexit(_onexit_t);
_CRTIMP void __cdecl perror(const char *);
_CRTIMP int __cdecl _putenv(const char *);
unsigned int __cdecl _rotl(unsigned int, int);
unsigned __int64 __cdecl _rotl64(unsigned __int64, int);
unsigned int __cdecl _rotr(unsigned int, int);
unsigned __int64 __cdecl _rotr64(unsigned __int64, int);
_CRTIMP void __cdecl _searchenv(const char *, const char *, char *);
_CRTIMP void __cdecl _splitpath(const char *, char *, char *, char *, char *);
_CRTIMP void __cdecl _swab(char *, char *, int);
#ifndef _WSTDLIBP_DEFINED
/* wide function prototypes, also declared in wchar.h */
_CRTIMP wchar_t * __cdecl _wfullpath(wchar_t *, const wchar_t *, size_t);
_CRTIMP void __cdecl _wmakepath(wchar_t *, const wchar_t *, const wchar_t *, const wchar_t *,
const wchar_t *);
_CRTIMP void __cdecl _wperror(const wchar_t *);
_CRTIMP int __cdecl _wputenv(const wchar_t *);
_CRTIMP void __cdecl _wsearchenv(const wchar_t *, const wchar_t *, wchar_t *);
_CRTIMP void __cdecl _wsplitpath(const wchar_t *, wchar_t *, wchar_t *, wchar_t *, wchar_t *);
#define _WSTDLIBP_DEFINED
#endif
/* --------- The following functions are OBSOLETE --------- */
/* The Win32 API SetErrorMode, Beep and Sleep should be used instead. */
_CRTIMP void __cdecl _seterrormode(int);
_CRTIMP void __cdecl _beep(unsigned, unsigned);
_CRTIMP void __cdecl _sleep(unsigned long);
/* --------- The preceding functions are OBSOLETE --------- */
#endif /* _POSIX_ */
#if !__STDC__
/* --------- The declarations below should not be in stdlib.h --------- */
/* --------- and will be removed in a future release. Include --------- */
/* --------- ctype.h to obtain these declarations. --------- */
#ifndef tolower /* tolower has been undefined - use function */
_CRTIMP int __cdecl tolower(int);
#endif /* tolower */
#ifndef toupper /* toupper has been undefined - use function */
_CRTIMP int __cdecl toupper(int);
#endif /* toupper */
/* --------- The declarations above will be removed. --------- */
#endif
#if !__STDC__
#ifndef _POSIX_
/* Non-ANSI names for compatibility */
#ifndef __cplusplus
#define max(a,b) (((a) > (b)) ? (a) : (b))
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
#define sys_errlist _sys_errlist
#define sys_nerr _sys_nerr
#define environ _environ
_CRTIMP char * __cdecl ecvt(double, int, int *, int *);
_CRTIMP char * __cdecl fcvt(double, int, int *, int *);
_CRTIMP char * __cdecl gcvt(double, int, char *);
_CRTIMP char * __cdecl itoa(int, char *, int);
_CRTIMP char * __cdecl ltoa(long, char *, int);
onexit_t __cdecl onexit(onexit_t);
_CRTIMP int __cdecl putenv(const char *);
_CRTIMP void __cdecl swab(char *, char *, int);
_CRTIMP char * __cdecl ultoa(unsigned long, char *, int);
#endif /* _POSIX_ */
#endif /* __STDC__ */
#ifdef __cplusplus
}
#endif
#ifdef _MSC_VER
#pragma pack(pop)
#endif /* _MSC_VER */
#endif /* _INC_STDLIB */

View File

@@ -0,0 +1,409 @@
// streambuf standard header
#pragma once
#ifndef _STREAMBUF_
#define _STREAMBUF_
#include <xiosbase>
#pragma pack(push,8)
#pragma warning(push,3)
_STD_BEGIN
// TEMPLATE CLASS basic_streambuf
template<class _Elem, class _Traits>
class basic_streambuf
{ // control read/write buffers
basic_streambuf(const basic_streambuf<_Elem, _Traits>&); // not defined
basic_streambuf<_Elem, _Traits>&
operator=(const basic_streambuf<_Elem, _Traits>&); // not defined
protected:
basic_streambuf()
: _Plocale(_NEW_CRT locale)
{ // construct with no buffers
_Init();
}
basic_streambuf(_Uninitialized)
{ // construct uninitialized
}
public:
typedef basic_streambuf<_Elem, _Traits> _Myt;
typedef _Elem char_type;
typedef _Traits traits_type;
virtual ~basic_streambuf()
{ // destroy the object
_DELETE_CRT(_Plocale);
}
typedef typename _Traits::int_type int_type;
typedef typename _Traits::pos_type pos_type;
typedef typename _Traits::off_type off_type;
pos_type pubseekoff(off_type _Off, ios_base::seekdir _Way,
ios_base::openmode _Mode = ios_base::in | ios_base::out)
{ // change position by _Off, according to _Way, _Mode
return (seekoff(_Off, _Way, _Mode));
}
pos_type pubseekoff(off_type _Off, ios_base::seek_dir _Way,
ios_base::open_mode _Mode)
{ // change position by _Off, according to _Way, _Mode (old style)
return (pubseekoff(_Off, (ios_base::seekdir)_Way,
(ios_base::openmode)_Mode));
}
pos_type pubseekpos(pos_type _Pos,
ios_base::openmode _Mode = ios_base::in | ios_base::out)
{ // change position to _Pos, according to _Mode
return (seekpos(_Pos, _Mode));
}
pos_type pubseekpos(pos_type _Pos, ios_base::open_mode _Mode)
{ // change position to _Pos, according to _Mode (old style)
return (seekpos(_Pos, (ios_base::openmode)_Mode));
}
_Myt *pubsetbuf(_Elem *_Buffer, streamsize _Count)
{ // offer _Buffer to external agent
return (setbuf(_Buffer, _Count));
}
locale pubimbue(const locale &_Newlocale)
{ // set locale to argument
locale _Oldlocale = *_Plocale;
imbue(_Newlocale);
*_Plocale = _Newlocale;
return (_Oldlocale);
}
locale getloc() const
{ // get locale
return (*_Plocale);
}
streamsize in_avail()
{ // return count of buffered input characters
return (gptr() != 0 && gptr() < egptr()
? (streamsize)(egptr() - gptr()) : showmanyc());
}
int pubsync()
{ // synchronize with external agent
return (sync());
}
int_type sbumpc()
{ // get a character and point past it
return (gptr() != 0 && gptr() < egptr()
? _Traits::to_int_type(*_Gninc()) : uflow());
}
int_type sgetc()
{ // get a character and don't point past it
return (gptr() != 0 && gptr() < egptr()
? _Traits::to_int_type(*gptr()) : underflow());
}
streamsize sgetn(_Elem *_Ptr, streamsize _Count)
{ // get up to _Count characters into array beginning at _Ptr
return (xsgetn(_Ptr, _Count));
}
int_type snextc()
{ // point to next character and return it
return (_Traits::eq_int_type(_Traits::eof(), sbumpc())
? _Traits::eof() : sgetc());
}
int_type sputbackc(_Elem _Ch)
{ // put back _Ch
return (gptr() != 0 && eback() < gptr()
&& _Traits::eq(_Ch, gptr()[-1])
? _Traits::to_int_type(*_Gndec())
: pbackfail(_Traits::to_int_type(_Ch)));
}
void stossc()
{ // point past a character
if (gptr() != 0 && gptr() < egptr())
_Gninc();
else
uflow();
}
int_type sungetc()
{ // back up one position
return (gptr() != 0 && eback() < gptr()
? _Traits::to_int_type(*_Gndec()) : pbackfail());
}
int_type sputc(_Elem _Ch)
{ // put a character
return (pptr() != 0 && pptr() < epptr()
? _Traits::to_int_type(*_Pninc() = _Ch)
: overflow(_Traits::to_int_type(_Ch)));
}
streamsize sputn(const _Elem *_Ptr, streamsize _Count)
{ // put _Count characters from array beginning at _Ptr
return (xsputn(_Ptr, _Count));
}
void _Lock()
{ // set the thread lock
_Mylock._Lock();
}
void _Unlock()
{ // clear the thread lock
_Mylock._Unlock();
}
protected:
_Elem *eback() const
{ // return beginning of read buffer
return (*_IGfirst);
}
_Elem *gptr() const
{ // return current position in read buffer
return (*_IGnext);
}
_Elem *pbase() const
{ // return beginning of write buffer
return (*_IPfirst);
}
_Elem *pptr() const
{ // return current position in write buffer
return (*_IPnext);
}
_Elem *egptr() const
{ // return end of read buffer
return (*_IGnext + *_IGcount);
}
void gbump(int _Off)
{ // alter current position in read buffer by _Off
*_IGcount -= _Off;
*_IGnext += _Off;
}
void setg(_Elem *_First, _Elem *_Next, _Elem *_Last)
{ // set pointers for read buffer
*_IGfirst = _First;
*_IGnext = _Next;
*_IGcount = (int)(_Last - _Next);
}
_Elem *epptr() const
{ // return end of write buffer
return (*_IPnext + *_IPcount);
}
_Elem *_Gndec()
{ // decrement current position in read buffer
++*_IGcount;
return (--*_IGnext);
}
_Elem *_Gninc()
{ // increment current position in read buffer
--*_IGcount;
return ((*_IGnext)++);
}
void pbump(int _Off)
{ // alter current position in write buffer by _Off
*_IPcount -= _Off;
*_IPnext += _Off;
}
void setp(_Elem *_First, _Elem *_Last)
{ // set pointers for write buffer
*_IPfirst = _First;
*_IPnext = _First;
*_IPcount = (int)(_Last - _First);
}
void setp(_Elem *_First, _Elem *_Next, _Elem *_Last)
{ // set pointers for write buffer, extended version
*_IPfirst = _First;
*_IPnext = _Next;
*_IPcount = (int)(_Last - _Next);
}
_Elem *_Pninc()
{ // decrement current position in write buffer
--*_IPcount;
return ((*_IPnext)++);
}
void _Init()
{ // initialize buffer parameters for no buffers
_IGfirst = &_Gfirst, _IPfirst = &_Pfirst;
_IGnext = &_Gnext, _IPnext = &_Pnext;
_IGcount = &_Gcount, _IPcount = &_Pcount;
setp(0, 0), setg(0, 0, 0);
}
void _Init(_Elem **_Gf, _Elem **_Gn, int *_Gc,
_Elem **_Pf, _Elem **_Pn, int *_Pc)
{ // initialize buffer parameters as specified
_IGfirst = _Gf, _IPfirst = _Pf;
_IGnext = _Gn, _IPnext = _Pn;
_IGcount = _Gc, _IPcount = _Pc;
}
virtual int_type overflow(int_type = _Traits::eof())
{ // put a character to stream (always fail)
return (_Traits::eof());
}
virtual int_type pbackfail(int_type = _Traits::eof())
{ // put a character back to stream (always fail)
return (_Traits::eof());
}
virtual streamsize showmanyc()
{ // return count of input characters
return (0);
}
virtual int_type underflow()
{ // get a character from stream, but don't point past it
return (_Traits::eof());
}
virtual int_type uflow()
{ // get a character from stream, point past it
return (_Traits::eq_int_type(_Traits::eof(), underflow())
? _Traits::eof() : _Traits::to_int_type(*_Gninc()));
}
virtual streamsize xsgetn(_Elem * _Ptr,
streamsize _Count)
{ // get _Count characters from stream
int_type _Meta;
streamsize _Size, _Copied;
for (_Copied = 0; 0 < _Count; )
if (gptr() != 0 && 0 < (_Size = (streamsize)(egptr() - gptr())))
{ // copy from read buffer
if (_Count < _Size)
_Size = _Count;
_Traits::copy(_Ptr, gptr(), _Size);
_Ptr += _Size;
_Copied += _Size;
_Count -= _Size;
gbump((int)_Size);
}
else if (_Traits::eq_int_type(_Traits::eof(), _Meta = uflow()))
break; // end of file, quit
else
{ // get a single character
*_Ptr++ = _Traits::to_char_type(_Meta);
++_Copied;
--_Count;
}
return (_Copied);
}
virtual streamsize xsputn(const _Elem *_Ptr,
streamsize _Count)
{ // put _Count characters to stream
streamsize _Size, _Copied;
for (_Copied = 0; 0 < _Count; )
if (pptr() != 0 && 0 < (_Size = (streamsize)(epptr() - pptr())))
{ // copy to write buffer
if (_Count < _Size)
_Size = _Count;
_Traits::copy(pptr(), _Ptr, _Size);
_Ptr += _Size;
_Copied += _Size;
_Count -= _Size;
pbump((int)_Size);
}
else if (_Traits::eq_int_type(_Traits::eof(),
overflow(_Traits::to_int_type(*_Ptr))))
break; // single character put failed, quit
else
{ // count character successfully put
++_Ptr;
++_Copied;
--_Count;
}
return (_Copied);
}
virtual pos_type seekoff(off_type, ios_base::seekdir,
ios_base::openmode = ios_base::in | ios_base::out)
{ // change position by offset, according to way and mode
return (streampos(_BADOFF));
}
virtual pos_type seekpos(pos_type,
ios_base::openmode = ios_base::in | ios_base::out)
{ // change to specified position, according to mode
return (streampos(_BADOFF));
}
virtual _Myt *setbuf(_Elem *, streamsize)
{ // offer buffer to external agent (do nothing)
return (this);
}
virtual int sync()
{ // synchronize with external agent (do nothing)
return (0);
}
virtual void imbue(const locale&)
{ // set locale to argument (do nothing)
}
private:
_Mutex _Mylock; // thread lock
_Elem *_Gfirst; // beginning of read buffer
_Elem *_Pfirst; // beginning of write buffer
_Elem **_IGfirst; // pointer to beginning of read buffer
_Elem **_IPfirst; // pointer to beginning of write buffer
_Elem *_Gnext; // current position in read buffer
_Elem *_Pnext; // current position in write buffer
_Elem **_IGnext; // pointer to current position in read buffer
_Elem **_IPnext; // pointer to current position in write buffer
int _Gcount; // length of read buffer
int _Pcount; // length of write buffer
int *_IGcount; // pointer to length of read buffer
int *_IPcount; // pointer to length of write buffer
locale *_Plocale; // pointer to imbued locale object
};
#ifdef _DLL_CPPLIB
template class _CRTIMP2 basic_streambuf<char, char_traits<char> >;
template class _CRTIMP2 basic_streambuf<wchar_t, char_traits<wchar_t> >;
#endif /* _DLL_CPPLIB */
_STD_END
#pragma warning(pop)
#pragma pack(pop)
#endif /* _STREAMBUF_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

View File

@@ -0,0 +1,639 @@
// string standard header
#pragma once
#ifndef _STRING_
#define _STRING_
#include <istream>
#pragma pack(push,8)
#pragma warning(push,3)
#pragma warning(disable: 4189)
_STD_BEGIN
// basic_string TEMPLATE OPERATORS
template<class _Elem,
class _Traits,
class _Alloc> inline
basic_string<_Elem, _Traits, _Alloc> __cdecl operator+(
const basic_string<_Elem, _Traits, _Alloc>& _Left,
const basic_string<_Elem, _Traits, _Alloc>& _Right)
{ // return string + string
return (basic_string<_Elem, _Traits, _Alloc>(_Left) += _Right);
}
template<class _Elem,
class _Traits,
class _Alloc> inline
basic_string<_Elem, _Traits, _Alloc> __cdecl operator+(
const _Elem *_Left,
const basic_string<_Elem, _Traits, _Alloc>& _Right)
{ // return NTCS + string
return (basic_string<_Elem, _Traits, _Alloc>(_Left) += _Right);
}
template<class _Elem,
class _Traits,
class _Alloc> inline
basic_string<_Elem, _Traits, _Alloc> __cdecl operator+(
const _Elem _Left,
const basic_string<_Elem, _Traits, _Alloc>& _Right)
{ // return character + string
return (basic_string<_Elem, _Traits, _Alloc>(1, _Left) += _Right);
}
template<class _Elem,
class _Traits,
class _Alloc> inline
basic_string<_Elem, _Traits, _Alloc> __cdecl operator+(
const basic_string<_Elem, _Traits, _Alloc>& _Left,
const _Elem *_Right)
{ // return string + NTCS
return (basic_string<_Elem, _Traits, _Alloc>(_Left) += _Right);
}
template<class _Elem,
class _Traits,
class _Alloc> inline
basic_string<_Elem, _Traits, _Alloc> __cdecl operator+(
const basic_string<_Elem, _Traits, _Alloc>& _Left,
const _Elem _Right)
{ // return string + character
return (basic_string<_Elem, _Traits, _Alloc>(_Left) += _Right);
}
template<class _Elem,
class _Traits,
class _Alloc> inline
bool __cdecl operator==(
const basic_string<_Elem, _Traits, _Alloc>& _Left,
const basic_string<_Elem, _Traits, _Alloc>& _Right)
{ // test for string equality
return (_Left.compare(_Right) == 0);
}
template<class _Elem,
class _Traits,
class _Alloc> inline
bool __cdecl operator==(
const _Elem * _Left,
const basic_string<_Elem, _Traits, _Alloc>& _Right)
{ // test for NTCS vs. string equality
return (_Right.compare(_Left) == 0);
}
template<class _Elem,
class _Traits,
class _Alloc> inline
bool __cdecl operator==(
const basic_string<_Elem, _Traits, _Alloc>& _Left,
const _Elem *_Right)
{ // test for string vs. NTCS equality
return (_Left.compare(_Right) == 0);
}
template<class _Elem,
class _Traits,
class _Alloc> inline
bool __cdecl operator!=(
const basic_string<_Elem, _Traits, _Alloc>& _Left,
const basic_string<_Elem, _Traits, _Alloc>& _Right)
{ // test for string inequality
return (!(_Left == _Right));
}
template<class _Elem,
class _Traits,
class _Alloc> inline
bool __cdecl operator!=(
const _Elem *_Left,
const basic_string<_Elem, _Traits, _Alloc>& _Right)
{ // test for NTCS vs. string inequality
return (!(_Left == _Right));
}
template<class _Elem,
class _Traits,
class _Alloc> inline
bool __cdecl operator!=(
const basic_string<_Elem, _Traits, _Alloc>& _Left,
const _Elem *_Right)
{ // test for string vs. NTCS inequality
return (!(_Left == _Right));
}
template<class _Elem,
class _Traits,
class _Alloc> inline
bool __cdecl operator<(
const basic_string<_Elem, _Traits, _Alloc>& _Left,
const basic_string<_Elem, _Traits, _Alloc>& _Right)
{ // test if string < string
return (_Left.compare(_Right) < 0);
}
template<class _Elem,
class _Traits,
class _Alloc> inline
bool __cdecl operator<(
const _Elem * _Left,
const basic_string<_Elem, _Traits, _Alloc>& _Right)
{ // test if NTCS < string
return (_Right.compare(_Left) > 0);
}
template<class _Elem,
class _Traits,
class _Alloc> inline
bool __cdecl operator<(
const basic_string<_Elem, _Traits, _Alloc>& _Left,
const _Elem *_Right)
{ // test if string < NTCS
return (_Left.compare(_Right) < 0);
}
template<class _Elem,
class _Traits,
class _Alloc> inline
bool __cdecl operator>(
const basic_string<_Elem, _Traits, _Alloc>& _Left,
const basic_string<_Elem, _Traits, _Alloc>& _Right)
{ // test if string > string
return (_Right < _Left);
}
template<class _Elem,
class _Traits,
class _Alloc> inline
bool __cdecl operator>(
const _Elem * _Left,
const basic_string<_Elem, _Traits, _Alloc>& _Right)
{ // test if NTCS > string
return (_Right < _Left);
}
template<class _Elem,
class _Traits,
class _Alloc> inline
bool __cdecl operator>(
const basic_string<_Elem, _Traits, _Alloc>& _Left,
const _Elem *_Right)
{ // test if string > NTCS
return (_Right < _Left);
}
template<class _Elem,
class _Traits,
class _Alloc> inline
bool __cdecl operator<=(
const basic_string<_Elem, _Traits, _Alloc>& _Left,
const basic_string<_Elem, _Traits, _Alloc>& _Right)
{ // test if string <= string
return (!(_Right < _Left));
}
template<class _Elem,
class _Traits,
class _Alloc> inline
bool __cdecl operator<=(
const _Elem * _Left,
const basic_string<_Elem, _Traits, _Alloc>& _Right)
{ // test if NTCS <= string
return (!(_Right < _Left));
}
template<class _Elem,
class _Traits,
class _Alloc> inline
bool __cdecl operator<=(
const basic_string<_Elem, _Traits, _Alloc>& _Left,
const _Elem *_Right)
{ // test if string <= NTCS
return (!(_Right < _Left));
}
template<class _Elem,
class _Traits,
class _Alloc> inline
bool __cdecl operator>=(
const basic_string<_Elem, _Traits, _Alloc>& _Left,
const basic_string<_Elem, _Traits, _Alloc>& _Right)
{ // test if string >= string
return (!(_Left < _Right));
}
template<class _Elem,
class _Traits,
class _Alloc> inline
bool __cdecl operator>=(
const _Elem * _Left,
const basic_string<_Elem, _Traits, _Alloc>& _Right)
{ // test if NTCS >= string
return (!(_Left < _Right));
}
template<class _Elem,
class _Traits,
class _Alloc> inline
bool __cdecl operator>=(
const basic_string<_Elem, _Traits, _Alloc>& _Left,
const _Elem *_Right)
{ // test if string >= NTCS
return (!(_Left < _Right));
}
#ifdef _DLL_CPPLIB
template class _CRTIMP2 basic_string<char,
char_traits<char>, allocator<char> > __cdecl operator+(
const basic_string<char, char_traits<char>, allocator<char> >&,
const basic_string<char, char_traits<char>, allocator<char> >&);
template class _CRTIMP2 basic_string<char,
char_traits<char>, allocator<char> > __cdecl operator+(
const char *,
const basic_string<char, char_traits<char>, allocator<char> >&);
template class _CRTIMP2 basic_string<char,
char_traits<char>, allocator<char> > __cdecl operator+(
const char,
const basic_string<char, char_traits<char>, allocator<char> >&);
template class _CRTIMP2 basic_string<char,
char_traits<char>, allocator<char> > __cdecl operator+(
const basic_string<char, char_traits<char>, allocator<char> >&,
const char *);
template class _CRTIMP2 basic_string<char,
char_traits<char>, allocator<char> > __cdecl operator+(
const basic_string<char, char_traits<char>, allocator<char> >&,
const char);
template _CRTIMP2 bool __cdecl operator==(
const basic_string<char, char_traits<char>, allocator<char> >&,
const basic_string<char, char_traits<char>, allocator<char> >&);
template _CRTIMP2 bool __cdecl operator==(
const char *,
const basic_string<char, char_traits<char>, allocator<char> >&);
template _CRTIMP2 bool __cdecl operator==(
const basic_string<char, char_traits<char>, allocator<char> >&,
const char *);
template _CRTIMP2 bool __cdecl operator!=(
const basic_string<char, char_traits<char>, allocator<char> >&,
const basic_string<char, char_traits<char>, allocator<char> >&);
template _CRTIMP2 bool __cdecl operator!=(
const char *,
const basic_string<char, char_traits<char>, allocator<char> >&);
template _CRTIMP2 bool __cdecl operator!=(
const basic_string<char, char_traits<char>, allocator<char> >&,
const char *);
template _CRTIMP2 bool __cdecl operator<(
const basic_string<char, char_traits<char>, allocator<char> >&,
const basic_string<char, char_traits<char>, allocator<char> >&);
template _CRTIMP2 bool __cdecl operator<(
const char *,
const basic_string<char, char_traits<char>, allocator<char> >&);
template _CRTIMP2 bool __cdecl operator<(
const basic_string<char, char_traits<char>, allocator<char> >&,
const char *);
template _CRTIMP2 bool __cdecl operator>(
const basic_string<char, char_traits<char>, allocator<char> >&,
const basic_string<char, char_traits<char>, allocator<char> >&);
template _CRTIMP2 bool __cdecl operator>(
const char *,
const basic_string<char, char_traits<char>, allocator<char> >&);
template _CRTIMP2 bool __cdecl operator>(
const basic_string<char, char_traits<char>, allocator<char> >&,
const char *);
template _CRTIMP2 bool __cdecl operator<=(
const basic_string<char, char_traits<char>, allocator<char> >&,
const basic_string<char, char_traits<char>, allocator<char> >&);
template _CRTIMP2 bool __cdecl operator<=(
const char *,
const basic_string<char, char_traits<char>, allocator<char> >&);
template _CRTIMP2 bool __cdecl operator<=(
const basic_string<char, char_traits<char>, allocator<char> >&,
const char *);
template _CRTIMP2 bool __cdecl operator>=(
const basic_string<char, char_traits<char>, allocator<char> >&,
const basic_string<char, char_traits<char>, allocator<char> >&);
template _CRTIMP2 bool __cdecl operator>=(
const char *,
const basic_string<char, char_traits<char>, allocator<char> >&);
template _CRTIMP2 bool __cdecl operator>=(
const basic_string<char, char_traits<char>, allocator<char> >&,
const char *);
template class _CRTIMP2 basic_string<wchar_t,
char_traits<wchar_t>, allocator<wchar_t> > __cdecl operator+(
const basic_string<wchar_t, char_traits<wchar_t>,
allocator<wchar_t> >&,
const basic_string<wchar_t, char_traits<wchar_t>,
allocator<wchar_t> >&);
template class _CRTIMP2 basic_string<wchar_t,
char_traits<wchar_t>, allocator<wchar_t> > __cdecl operator+(
const wchar_t *,
const basic_string<wchar_t, char_traits<wchar_t>,
allocator<wchar_t> >&);
template class _CRTIMP2 basic_string<wchar_t,
char_traits<wchar_t>, allocator<wchar_t> > __cdecl operator+(
const wchar_t,
const basic_string<wchar_t, char_traits<wchar_t>,
allocator<wchar_t> >&);
template class _CRTIMP2 basic_string<wchar_t,
char_traits<wchar_t>, allocator<wchar_t> > __cdecl operator+(
const basic_string<wchar_t, char_traits<wchar_t>,
allocator<wchar_t> >&,
const wchar_t *);
template class _CRTIMP2 basic_string<wchar_t,
char_traits<wchar_t>, allocator<wchar_t> > __cdecl operator+(
const basic_string<wchar_t, char_traits<wchar_t>,
allocator<wchar_t> >&,
const wchar_t);
template _CRTIMP2 bool __cdecl operator==(
const basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >&,
const basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >&);
template _CRTIMP2 bool __cdecl operator==(
const wchar_t *,
const basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >&);
template _CRTIMP2 bool __cdecl operator==(
const basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >&,
const wchar_t *);
template _CRTIMP2 bool __cdecl operator!=(
const basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >&,
const basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >&);
template _CRTIMP2 bool __cdecl operator!=(
const wchar_t *,
const basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >&);
template _CRTIMP2 bool __cdecl operator!=(
const basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >&,
const wchar_t *);
template _CRTIMP2 bool __cdecl operator<(
const basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >&,
const basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >&);
template _CRTIMP2 bool __cdecl operator<(
const wchar_t *,
const basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >&);
template _CRTIMP2 bool __cdecl operator<(
const basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >&,
const wchar_t *);
template _CRTIMP2 bool __cdecl operator>(
const basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >&,
const basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >&);
template _CRTIMP2 bool __cdecl operator>(
const wchar_t *,
const basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >&);
template _CRTIMP2 bool __cdecl operator>(
const basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >&,
const wchar_t *);
template _CRTIMP2 bool __cdecl operator<=(
const basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >&,
const basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >&);
template _CRTIMP2 bool __cdecl operator<=(
const wchar_t *,
const basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >&);
template _CRTIMP2 bool __cdecl operator<=(
const basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >&,
const wchar_t *);
template _CRTIMP2 bool __cdecl operator>=(
const basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >&,
const basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >&);
template _CRTIMP2 bool __cdecl operator>=(
const wchar_t *,
const basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >&);
template _CRTIMP2 bool __cdecl operator>=(
const basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >&,
const wchar_t *);
#endif /* _DLL_CPPLIB */
// basic_string INSERTERS AND EXTRACTORS
template<class _Elem,
class _Traits,
class _Alloc> inline
basic_istream<_Elem, _Traits>& __cdecl operator>>(
basic_istream<_Elem, _Traits>& _Istr,
basic_string<_Elem, _Traits, _Alloc>& _Str)
{ // extract a string
typedef ctype<_Elem> _Ctype;
typedef basic_istream<_Elem, _Traits> _Myis;
typedef basic_string<_Elem, _Traits, _Alloc> _Mystr;
typedef typename _Mystr::size_type _Mysizt;
ios_base::iostate _State = ios_base::goodbit;
bool _Changed = false;
const typename _Myis::sentry _Ok(_Istr);
if (_Ok)
{ // state okay, extract characters
const _Ctype& _Ctype_fac = _USE(_Istr.getloc(), _Ctype);
_Str.erase();
_TRY_IO_BEGIN
_Mysizt _Size = 0 < _Istr.width()
&& (_Mysizt)_Istr.width() < _Str.max_size()
? (_Mysizt)_Istr.width() : _Str.max_size();
typename _Traits::int_type _Meta = _Istr.rdbuf()->sgetc();
for (; 0 < _Size; --_Size, _Meta = _Istr.rdbuf()->snextc())
if(_Traits::eq_int_type(_Traits::eof(), _Meta))
{ // end of file, quit
_State |= ios_base::eofbit;
break;
}
else if (_Ctype_fac.is(_Ctype::space,
_Traits::to_char_type(_Meta)))
break; // whitespace, quit
else
{ // add character to string
_Str.append(1, _Traits::to_char_type(_Meta));
_Changed = true;
}
_CATCH_IO_(_Istr)
}
_Istr.width(0);
if (!_Changed)
_State |= ios_base::failbit;
_Istr.setstate(_State);
return (_Istr);
}
template<class _Elem,
class _Traits,
class _Alloc> inline
basic_istream<_Elem, _Traits>& __cdecl getline(
basic_istream<_Elem, _Traits>& _Istr,
basic_string<_Elem, _Traits, _Alloc>& _Str,
const _Elem _Delim)
{ // get characters into string, discard delimiter
typedef basic_istream<_Elem, _Traits> _Myis;
ios_base::iostate _State = ios_base::goodbit;
bool _Changed = false;
const typename _Myis::sentry _Ok(_Istr, true);
if (_Ok)
{ // state okay, extract characters
_TRY_IO_BEGIN
_Str.erase();
const typename _Traits::int_type _Metadelim =
_Traits::to_int_type(_Delim);
typename _Traits::int_type _Meta = _Istr.rdbuf()->sgetc();
for (; ; _Meta = _Istr.rdbuf()->snextc())
if (_Traits::eq_int_type(_Traits::eof(), _Meta))
{ // end of file, quit
_State |= ios_base::eofbit;
break;
}
else if (_Traits::eq_int_type(_Meta, _Metadelim))
{ // got a delimiter, discard it and quit
_Changed = true;
_Istr.rdbuf()->sbumpc();
break;
}
else if (_Str.max_size() <= _Str.size())
{ // string too large, quit
_State |= ios_base::failbit;
break;
}
else
{ // got a character, add it to string
_Str += _Traits::to_char_type(_Meta);
_Changed = true;
}
_CATCH_IO_(_Istr)
}
if (!_Changed)
_State |= ios_base::failbit;
_Istr.setstate(_State);
return (_Istr);
}
template<class _Elem,
class _Traits,
class _Alloc> inline
basic_istream<_Elem, _Traits>& __cdecl getline(
basic_istream<_Elem, _Traits>& _Istr,
basic_string<_Elem, _Traits, _Alloc>& _Str)
{ // get characters into string, discard newline
return (getline(_Istr, _Str, _Istr.widen('\n')));
}
template<class _Elem,
class _Traits,
class _Alloc> inline
basic_ostream<_Elem, _Traits>& __cdecl operator<<(
basic_ostream<_Elem, _Traits>& _Ostr,
const basic_string<_Elem, _Traits, _Alloc>& _Str)
{ // insert a string
typedef basic_ostream<_Elem, _Traits> _Myos;
typedef basic_string<_Elem, _Traits, _Alloc> _Mystr;
typedef typename _Mystr::size_type _Mysizt;
ios_base::iostate _State = ios_base::goodbit;
_Mysizt _Size = _Str.size();
_Mysizt _Pad = _Ostr.width() <= 0 || (_Mysizt)_Ostr.width() <= _Size
? 0 : (_Mysizt)_Ostr.width() - _Size;
const typename _Myos::sentry _Ok(_Ostr);
if (!_Ok)
_State |= ios_base::badbit;
else
{ // state okay, insert characters
_TRY_IO_BEGIN
if ((_Ostr.flags() & ios_base::adjustfield) != ios_base::left)
for (; 0 < _Pad; --_Pad) // pad on left
if (_Traits::eq_int_type(_Traits::eof(),
_Ostr.rdbuf()->sputc(_Ostr.fill())))
{ // insertion failed, quit
_State |= ios_base::badbit;
break;
}
if (_State == ios_base::goodbit)
for (_Mysizt _Count = 0; _Count < _Size; ++_Count)
if (_Traits::eq_int_type(_Traits::eof(),
_Ostr.rdbuf()->sputc(_Str[_Count])))
{ // insertion failed, quit
_State |= ios_base::badbit;
break;
}
if (_State == ios_base::goodbit)
for (; 0 < _Pad; --_Pad) // pad on right
if (_Traits::eq_int_type(_Traits::eof(),
_Ostr.rdbuf()->sputc(_Ostr.fill())))
{ // insertion failed, quit
_State |= ios_base::badbit;
break;
}
_Ostr.width(0);
_CATCH_IO_(_Ostr)
}
_Ostr.setstate(_State);
return (_Ostr);
}
#ifdef _DLL_CPPLIB
template class _CRTIMP2 basic_istream<char,
char_traits<char> >& __cdecl operator>>(
basic_istream<char, char_traits<char> >&,
basic_string<char, char_traits<char>, allocator<char> >&);
template class _CRTIMP2 basic_istream<char,
char_traits<char> >& __cdecl getline(
basic_istream<char, char_traits<char> >&,
basic_string<char, char_traits<char>, allocator<char> >&);
template class _CRTIMP2 basic_istream<char,
char_traits<char> >& __cdecl getline(
basic_istream<char, char_traits<char> >&,
basic_string<char, char_traits<char>, allocator<char> >&,
const char);
template class _CRTIMP2 basic_ostream<char,
char_traits<char> >& __cdecl operator<<(
basic_ostream<char, char_traits<char> >&,
const basic_string<char, char_traits<char>, allocator<char> >&);
template class _CRTIMP2 basic_istream<wchar_t,
char_traits<wchar_t> >& __cdecl operator>>(
basic_istream<wchar_t, char_traits<wchar_t> >&,
basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >&);
template class _CRTIMP2 basic_istream<wchar_t,
char_traits<wchar_t> >& __cdecl getline(
basic_istream<wchar_t, char_traits<wchar_t> >&,
basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >&);
template class _CRTIMP2 basic_istream<wchar_t,
char_traits<wchar_t> >& __cdecl getline(
basic_istream<wchar_t, char_traits<wchar_t> >&,
basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> >&,
const wchar_t);
template class _CRTIMP2 basic_ostream<wchar_t,
char_traits<wchar_t> >& __cdecl operator<<(
basic_ostream<wchar_t, char_traits<wchar_t> >&,
const basic_string<wchar_t, char_traits<wchar_t>,
allocator<wchar_t> >&);
#endif /* _DLL_CPPLIB */
_STD_END
#pragma warning(default: 4189)
#pragma warning(pop)
#pragma pack(pop)
#endif /* _STRING */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

View File

@@ -0,0 +1,227 @@
/***
*string.h - declarations for string manipulation functions
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file contains the function declarations for the string
* manipulation functions.
* [ANSI/System V]
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_STRING
#define _INC_STRING
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if !defined(_W64)
#if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
#define _W64 __w64
#else
#define _W64
#endif
#endif
/* Define _CRTIMP */
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* ndef _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* _CRTIMP */
/* Define __cdecl for non-Microsoft compilers */
#if ( !defined(_MSC_VER) && !defined(__cdecl) )
#define __cdecl
#endif
#ifndef _SIZE_T_DEFINED
#ifdef _WIN64
typedef unsigned __int64 size_t;
#else
typedef _W64 unsigned int size_t;
#endif
#define _SIZE_T_DEFINED
#endif
#ifndef _WCHAR_T_DEFINED
typedef unsigned short wchar_t;
#define _WCHAR_T_DEFINED
#endif
#ifndef _NLSCMP_DEFINED
#define _NLSCMPERROR 2147483647 /* currently == INT_MAX */
#define _NLSCMP_DEFINED
#endif
/* Define NULL pointer value */
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
/* Function prototypes */
#ifdef _M_MRX000
_CRTIMP void * __cdecl memcpy(void *, const void *, size_t);
_CRTIMP int __cdecl memcmp(const void *, const void *, size_t);
_CRTIMP void * __cdecl memset(void *, int, size_t);
_CRTIMP char * __cdecl _strset(char *, int);
_CRTIMP char * __cdecl strcpy(char *, const char *);
_CRTIMP char * __cdecl strcat(char *, const char *);
_CRTIMP int __cdecl strcmp(const char *, const char *);
_CRTIMP size_t __cdecl strlen(const char *);
#else
void * __cdecl memcpy(void *, const void *, size_t);
int __cdecl memcmp(const void *, const void *, size_t);
void * __cdecl memset(void *, int, size_t);
char * __cdecl _strset(char *, int);
char * __cdecl strcpy(char *, const char *);
char * __cdecl strcat(char *, const char *);
int __cdecl strcmp(const char *, const char *);
size_t __cdecl strlen(const char *);
#endif
_CRTIMP void * __cdecl _memccpy(void *, const void *, int, size_t);
_CRTIMP void * __cdecl memchr(const void *, int, size_t);
_CRTIMP int __cdecl _memicmp(const void *, const void *, size_t);
#if defined(_M_IA64) || defined(_M_ALPHA)
void * __cdecl memmove(void *, const void *, size_t);
#else
_CRTIMP void * __cdecl memmove(void *, const void *, size_t);
#endif
_CRTIMP char * __cdecl strchr(const char *, int);
_CRTIMP int __cdecl _strcmpi(const char *, const char *);
_CRTIMP int __cdecl _stricmp(const char *, const char *);
_CRTIMP int __cdecl strcoll(const char *, const char *);
_CRTIMP int __cdecl _stricoll(const char *, const char *);
_CRTIMP int __cdecl _strncoll(const char *, const char *, size_t);
_CRTIMP int __cdecl _strnicoll(const char *, const char *, size_t);
_CRTIMP size_t __cdecl strcspn(const char *, const char *);
_CRTIMP char * __cdecl _strdup(const char *);
_CRTIMP char * __cdecl _strerror(const char *);
_CRTIMP char * __cdecl strerror(int);
_CRTIMP char * __cdecl _strlwr(char *);
_CRTIMP char * __cdecl strncat(char *, const char *, size_t);
_CRTIMP int __cdecl strncmp(const char *, const char *, size_t);
_CRTIMP int __cdecl _strnicmp(const char *, const char *, size_t);
_CRTIMP char * __cdecl strncpy(char *, const char *, size_t);
_CRTIMP char * __cdecl _strnset(char *, int, size_t);
_CRTIMP char * __cdecl strpbrk(const char *, const char *);
_CRTIMP char * __cdecl strrchr(const char *, int);
_CRTIMP char * __cdecl _strrev(char *);
_CRTIMP size_t __cdecl strspn(const char *, const char *);
_CRTIMP char * __cdecl strstr(const char *, const char *);
_CRTIMP char * __cdecl strtok(char *, const char *);
_CRTIMP char * __cdecl _strupr(char *);
_CRTIMP size_t __cdecl strxfrm (char *, const char *, size_t);
#if !__STDC__
/* prototypes for oldnames.lib functions */
_CRTIMP void * __cdecl memccpy(void *, const void *, int, size_t);
_CRTIMP int __cdecl memicmp(const void *, const void *, size_t);
_CRTIMP int __cdecl strcmpi(const char *, const char *);
_CRTIMP int __cdecl stricmp(const char *, const char *);
_CRTIMP char * __cdecl strdup(const char *);
_CRTIMP char * __cdecl strlwr(char *);
_CRTIMP int __cdecl strnicmp(const char *, const char *, size_t);
_CRTIMP char * __cdecl strnset(char *, int, size_t);
_CRTIMP char * __cdecl strrev(char *);
char * __cdecl strset(char *, int);
_CRTIMP char * __cdecl strupr(char *);
#endif /* !__STDC__ */
#ifndef _WSTRING_DEFINED
/* wide function prototypes, also declared in wchar.h */
_CRTIMP wchar_t * __cdecl wcscat(wchar_t *, const wchar_t *);
_CRTIMP wchar_t * __cdecl wcschr(const wchar_t *, wchar_t);
_CRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *);
_CRTIMP wchar_t * __cdecl wcscpy(wchar_t *, const wchar_t *);
_CRTIMP size_t __cdecl wcscspn(const wchar_t *, const wchar_t *);
_CRTIMP size_t __cdecl wcslen(const wchar_t *);
_CRTIMP wchar_t * __cdecl wcsncat(wchar_t *, const wchar_t *, size_t);
_CRTIMP int __cdecl wcsncmp(const wchar_t *, const wchar_t *, size_t);
_CRTIMP wchar_t * __cdecl wcsncpy(wchar_t *, const wchar_t *, size_t);
_CRTIMP wchar_t * __cdecl wcspbrk(const wchar_t *, const wchar_t *);
_CRTIMP wchar_t * __cdecl wcsrchr(const wchar_t *, wchar_t);
_CRTIMP size_t __cdecl wcsspn(const wchar_t *, const wchar_t *);
_CRTIMP wchar_t * __cdecl wcsstr(const wchar_t *, const wchar_t *);
_CRTIMP wchar_t * __cdecl wcstok(wchar_t *, const wchar_t *);
_CRTIMP wchar_t * __cdecl _wcserror(int);
_CRTIMP wchar_t * __cdecl __wcserror(const wchar_t *);
_CRTIMP wchar_t * __cdecl _wcsdup(const wchar_t *);
_CRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *);
_CRTIMP int __cdecl _wcsnicmp(const wchar_t *, const wchar_t *, size_t);
_CRTIMP wchar_t * __cdecl _wcsnset(wchar_t *, wchar_t, size_t);
_CRTIMP wchar_t * __cdecl _wcsrev(wchar_t *);
_CRTIMP wchar_t * __cdecl _wcsset(wchar_t *, wchar_t);
_CRTIMP wchar_t * __cdecl _wcslwr(wchar_t *);
_CRTIMP wchar_t * __cdecl _wcsupr(wchar_t *);
_CRTIMP size_t __cdecl wcsxfrm(wchar_t *, const wchar_t *, size_t);
_CRTIMP int __cdecl wcscoll(const wchar_t *, const wchar_t *);
_CRTIMP int __cdecl _wcsicoll(const wchar_t *, const wchar_t *);
_CRTIMP int __cdecl _wcsncoll(const wchar_t *, const wchar_t *, size_t);
_CRTIMP int __cdecl _wcsnicoll(const wchar_t *, const wchar_t *, size_t);
#if !__STDC__
/* old names */
#define wcswcs wcsstr
/* prototypes for oldnames.lib functions */
_CRTIMP wchar_t * __cdecl wcsdup(const wchar_t *);
_CRTIMP int __cdecl wcsicmp(const wchar_t *, const wchar_t *);
_CRTIMP int __cdecl wcsnicmp(const wchar_t *, const wchar_t *, size_t);
_CRTIMP wchar_t * __cdecl wcsnset(wchar_t *, wchar_t, size_t);
_CRTIMP wchar_t * __cdecl wcsrev(wchar_t *);
_CRTIMP wchar_t * __cdecl wcsset(wchar_t *, wchar_t);
_CRTIMP wchar_t * __cdecl wcslwr(wchar_t *);
_CRTIMP wchar_t * __cdecl wcsupr(wchar_t *);
_CRTIMP int __cdecl wcsicoll(const wchar_t *, const wchar_t *);
#endif /* !__STDC__ */
#define _WSTRING_DEFINED
#endif
#ifdef __cplusplus
}
#endif
#endif /* _INC_STRING */

View File

@@ -0,0 +1,253 @@
// strstream standard header
#pragma once
#ifndef _STRSTREAM_
#define _STRSTREAM_
#include <istream>
#pragma pack(push,8)
#pragma warning(push,3)
_STD_BEGIN
// CLASS strstreambuf
class strstreambuf
: public streambuf
{ // stream buffer associated with static or allocated character array
public:
enum
{ // constants for bits in stream state
_Allocated = 1, // set if character array storage has been allocated
_Constant = 2, // set if character array nonmutable
_Dynamic = 4, // set if character array length grows on demand
_Frozen = 8}; // set if character array ownership given away
typedef int _Strstate;
explicit strstreambuf(streamsize _Count = 0)
{ // construct with empty character array, suggested initial size
_Init(_Count);
}
strstreambuf(void *(__cdecl *_Allocfunc)(size_t),
void (__cdecl *_Freefunc)(void *))
{ // construct with empty character array, allocation functions
_Init();
_Palloc = _Allocfunc;
_Pfree = _Freefunc;
}
strstreambuf(char *_Getptr, streamsize _Count, char *_Putptr = 0)
{ // construct with [_Getptr, _Getptr + _Count), possibly mutable
_Init(_Count, _Getptr, _Putptr);
}
strstreambuf(unsigned char *_Getptr, streamsize _Count,
unsigned char *_Putptr = 0)
{ // construct with [_Getptr, _Getptr + _Count), possibly mutable
_Init(_Count, (char *)_Getptr, (char *)_Putptr);
}
strstreambuf(const char *_Getptr, streamsize _Count)
{ // construct with [_Getptr, _Getptr + _Count), nonmutable
_Init(_Count, (char *)_Getptr, 0, _Constant);
}
strstreambuf(const unsigned char *_Getptr, streamsize _Count)
{ // construct with [_Getptr, _Getptr + _Count), nonmutable
_Init(_Count, (char *)_Getptr, 0, _Constant);
}
_CRTIMP2 virtual ~strstreambuf(); // destroy the object
_CRTIMP2 void freeze(bool = true); // freeze or unfreeze writing
char *str()
{ // freeze and return pointer to character array
freeze();
return (gptr());
}
streamsize pcount() const
{ // return size of writable character array
return (pptr() == 0 ? 0 : (streamsize)(pptr() - pbase()));
}
strstreambuf(signed char *_Getptr, streamsize _Count,
signed char *_Putptr = 0)
{ // construct with [_Getptr, _Getptr + _Count), possibly mutable
_Init(_Count, (char *)_Getptr, (char *)_Putptr);
}
strstreambuf(const signed char *_Getptr, streamsize _Count)
{ // construct with [_Getptr, _Getptr + _Count), nonmutable
_Init(_Count, (char *)_Getptr, 0, _Constant);
}
protected:
_CRTIMP2 virtual int overflow(int = EOF); // try to extend write area
_CRTIMP2 virtual int pbackfail(int = EOF); // try to putback a character
_CRTIMP2 virtual int underflow(); // read if read position available
_CRTIMP2 virtual streampos seekoff(streamoff,
ios_base::seekdir,
ios_base::openmode =
ios_base::in | ios_base::out); // seek by specified offset
_CRTIMP2 virtual streampos seekpos(streampos,
ios_base::openmode =
ios_base::in | ios_base::out); // seek to memorized position
_CRTIMP2 void _Init(streamsize = 0, char * = 0, char * = 0,
_Strstate = (_Strstate)0); // initialize with possibly static buffer
_CRTIMP2 void _Tidy(); // free any allocated storage
private:
enum
{ // constant for default minimum buffer size
_MINSIZE = 32};
streamsize _Minsize; // the minimum buffer size
char *_Pendsave; // the saved end pointer during freeze
char *_Seekhigh; // the high-water pointer in character array
_Strstate _Strmode; // the stream state
void *(__cdecl *_Palloc)(size_t); // the pointer to allocator function
void (__cdecl *_Pfree)(void *); // the pointer to free function
};
// CLASS istrstream
class istrstream
: public istream
{ // input stream associated with a character array
public:
explicit istrstream(const char *_Ptr)
: istream(&_Mysb), _Mysb(_Ptr, 0)
{ // construct with NTBS
}
istrstream(const char *_Ptr, streamsize _Count)
: istream(&_Mysb), _Mysb(_Ptr, _Count)
{ // construct with [_Ptr, _Ptr + _Count)
}
explicit istrstream(char *_Ptr)
: istream(&_Mysb), _Mysb((const char *)_Ptr, 0)
{ // construct with NTBS
}
istrstream(char *_Ptr, int _Count)
: istream(&_Mysb), _Mysb((const char *)_Ptr, _Count)
{ // construct with [_Ptr, _Ptr + _Count)
}
_CRTIMP2 virtual ~istrstream(); // destroy the object
strstreambuf *rdbuf() const
{ // return pointer to character array buffer
return ((strstreambuf *)&_Mysb);
}
char *str()
{ // freeze and return pointer to character array
return (_Mysb.str());
}
private:
strstreambuf _Mysb; // the string buffer
};
// CLASS ostrstream
class ostrstream
: public ostream
{ // output stream associated with a character array
public:
ostrstream()
: ostream(&_Mysb), _Mysb()
{ // construct with empty character array
}
_CRTIMP2 ostrstream(char *, streamsize,
ios_base::openmode =
ios_base::out); // construct with static array
_CRTIMP2 virtual ~ostrstream(); // destroy the object
strstreambuf *rdbuf() const
{ // return pointer to character array buffer
return ((strstreambuf *)&_Mysb);
}
void freeze(bool _Freezeit = true)
{ // freeze or unfreeze writing
_Mysb.freeze(_Freezeit);
}
char *str()
{ // freeze and return pointer to character array
return (_Mysb.str());
}
streamsize pcount() const
{ // return size of writable character array
return (_Mysb.pcount());
}
private:
strstreambuf _Mysb; // the character array buffer
};
// CLASS strstream
class strstream
: public iostream
{ // input/output stream associated with character array buffer
public:
typedef char char_type;
typedef int int_type;
typedef streampos pos_type;
typedef streamoff off_type;
strstream()
: iostream(&_Mysb), _Mysb()
{ // construct with empty character array
}
_CRTIMP2 strstream(char *, streamsize,
ios_base::openmode =
ios_base::in | ios_base::out); // construct with static array
_CRTIMP2 virtual ~strstream(); // destroy the object
strstreambuf *rdbuf() const
{ // return pointer to character array buffer
return ((strstreambuf *)&_Mysb);
}
void freeze(bool _Freezeit = true)
{ // freeze or unfreeze writing
_Mysb.freeze(_Freezeit);
}
char *str()
{ // freeze and return pointer to character array
return (_Mysb.str());
}
streamsize pcount() const
{ // return size of writable character array
return (_Mysb.pcount());
}
private:
strstreambuf _Mysb; // the character array buffer
};
_STD_END
#pragma warning(pop)
#pragma pack(pop)
#endif /* _STRSTREAM_ */
/*
* Copyright (c) 1992-2002 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
V3.13:0009 */

View File

@@ -0,0 +1,41 @@
/***
*sys/locking.h - flags for locking() function
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file defines the flags for the locking() function.
* [System V]
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_LOCKING
#define _INC_LOCKING
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
#define _LK_UNLCK 0 /* unlock the file region */
#define _LK_LOCK 1 /* lock the file region */
#define _LK_NBLCK 2 /* non-blocking lock */
#define _LK_RLCK 3 /* lock for writing */
#define _LK_NBRLCK 4 /* non-blocking lock for writing */
#if !__STDC__
/* Non-ANSI names for compatibility */
#define LK_UNLCK _LK_UNLCK
#define LK_LOCK _LK_LOCK
#define LK_NBLCK _LK_NBLCK
#define LK_RLCK _LK_RLCK
#define LK_NBRLCK _LK_NBRLCK
#endif
#endif /* _INC_LOCKING */

View File

@@ -0,0 +1,214 @@
/***
*sys/stat.h - defines structure used by stat() and fstat()
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file defines the structure used by the _stat() and _fstat()
* routines.
* [System V]
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_STAT
#define _INC_STAT
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
#ifdef _MSC_VER
#pragma pack(push,8)
#endif /* _MSC_VER */
#ifdef __cplusplus
extern "C" {
#endif
/* Define _CRTIMP */
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* ndef _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* _CRTIMP */
/* Define __cdecl for non-Microsoft compilers */
#if ( !defined(_MSC_VER) && !defined(__cdecl) )
#define __cdecl
#endif
#include <sys/types.h>
#ifndef _TIME_T_DEFINED
#ifdef _WIN64
typedef __int64 time_t; /* time value */
#else
typedef long time_t; /* time value */
#endif
#if _INTEGRAL_MAX_BITS >= 64
typedef __int64 __time64_t; /* 64-bit time value */
#endif
#define _TIME_T_DEFINED /* avoid multiple def's of time_t */
#endif
#ifndef _WCHAR_T_DEFINED
typedef unsigned short wchar_t;
#define _WCHAR_T_DEFINED
#endif
/* define structure for returning status information */
#ifndef _STAT_DEFINED
struct _stat {
_dev_t st_dev;
_ino_t st_ino;
unsigned short st_mode;
short st_nlink;
short st_uid;
short st_gid;
_dev_t st_rdev;
_off_t st_size;
time_t st_atime;
time_t st_mtime;
time_t st_ctime;
};
#if !__STDC__
/* Non-ANSI names for compatibility */
struct stat {
_dev_t st_dev;
_ino_t st_ino;
unsigned short st_mode;
short st_nlink;
short st_uid;
short st_gid;
_dev_t st_rdev;
_off_t st_size;
time_t st_atime;
time_t st_mtime;
time_t st_ctime;
};
#endif /* __STDC__ */
#if _INTEGRAL_MAX_BITS >= 64
struct _stati64 {
_dev_t st_dev;
_ino_t st_ino;
unsigned short st_mode;
short st_nlink;
short st_uid;
short st_gid;
_dev_t st_rdev;
__int64 st_size;
time_t st_atime;
time_t st_mtime;
time_t st_ctime;
};
struct __stat64 {
_dev_t st_dev;
_ino_t st_ino;
unsigned short st_mode;
short st_nlink;
short st_uid;
short st_gid;
_dev_t st_rdev;
__int64 st_size;
__time64_t st_atime;
__time64_t st_mtime;
__time64_t st_ctime;
};
#endif
#define _STAT_DEFINED
#endif
#define _S_IFMT 0170000 /* file type mask */
#define _S_IFDIR 0040000 /* directory */
#define _S_IFCHR 0020000 /* character special */
#define _S_IFIFO 0010000 /* pipe */
#define _S_IFREG 0100000 /* regular */
#define _S_IREAD 0000400 /* read permission, owner */
#define _S_IWRITE 0000200 /* write permission, owner */
#define _S_IEXEC 0000100 /* execute/search permission, owner */
/* Function prototypes */
_CRTIMP int __cdecl _fstat(int, struct _stat *);
_CRTIMP int __cdecl _stat(const char *, struct _stat *);
#if _INTEGRAL_MAX_BITS >= 64
_CRTIMP int __cdecl _fstati64(int, struct _stati64 *);
_CRTIMP int __cdecl _fstat64(int, struct __stat64 *);
_CRTIMP int __cdecl _stati64(const char *, struct _stati64 *);
_CRTIMP int __cdecl _stat64(const char *, struct __stat64 *);
#endif
#ifndef _WSTAT_DEFINED
/* wide function prototypes, also declared in wchar.h */
_CRTIMP int __cdecl _wstat(const wchar_t *, struct _stat *);
#if _INTEGRAL_MAX_BITS >= 64
_CRTIMP int __cdecl _wstati64(const wchar_t *, struct _stati64 *);
_CRTIMP int __cdecl _wstat64(const wchar_t *, struct __stat64 *);
#endif
#define _WSTAT_DEFINED
#endif
#if !__STDC__
/* Non-ANSI names for compatibility */
#define S_IFMT _S_IFMT
#define S_IFDIR _S_IFDIR
#define S_IFCHR _S_IFCHR
#define S_IFREG _S_IFREG
#define S_IREAD _S_IREAD
#define S_IWRITE _S_IWRITE
#define S_IEXEC _S_IEXEC
_CRTIMP int __cdecl fstat(int, struct stat *);
_CRTIMP int __cdecl stat(const char *, struct stat *);
#endif /* __STDC__ */
#ifdef __cplusplus
}
#endif
#ifdef _MSC_VER
#pragma pack(pop)
#endif /* _MSC_VER */
#endif /* _INC_STAT */

View File

@@ -0,0 +1,127 @@
/***
*sys/timeb.h - definition/declarations for _ftime()
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file define the _ftime() function and the types it uses.
* [System V]
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_TIMEB
#define _INC_TIMEB
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
#ifdef _MSC_VER
#pragma pack(push,8)
#endif /* _MSC_VER */
#ifdef __cplusplus
extern "C" {
#endif
/* Define _CRTIMP */
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* ndef _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* _CRTIMP */
/* Define __cdecl for non-Microsoft compilers */
#if ( !defined(_MSC_VER) && !defined(__cdecl) )
#define __cdecl
#endif
#ifndef _TIME_T_DEFINED
#ifdef _WIN64
typedef __int64 time_t; /* time value */
#else
typedef long time_t; /* time value */
#endif
#if _INTEGRAL_MAX_BITS >= 64
typedef __int64 __time64_t;
#endif
#define _TIME_T_DEFINED /* avoid multiple def's of time_t */
#endif
/* Structure returned by _ftime system call */
#ifndef _TIMEB_DEFINED
struct _timeb {
time_t time;
unsigned short millitm;
short timezone;
short dstflag;
};
#if !__STDC__
/* Non-ANSI name for compatibility */
struct timeb {
time_t time;
unsigned short millitm;
short timezone;
short dstflag;
};
#endif
#if _INTEGRAL_MAX_BITS >= 64
struct __timeb64 {
__time64_t time;
unsigned short millitm;
short timezone;
short dstflag;
};
#endif
#define _TIMEB_DEFINED
#endif
/* Function prototypes */
_CRTIMP void __cdecl _ftime(struct _timeb *);
#if !__STDC__
/* Non-ANSI name for compatibility */
_CRTIMP void __cdecl ftime(struct timeb *);
#endif
#if _INTEGRAL_MAX_BITS >= 64
_CRTIMP void __cdecl _ftime64(struct __timeb64 *);
#endif
#ifdef __cplusplus
}
#endif
#ifdef _MSC_VER
#pragma pack(pop)
#endif /* _MSC_VER */
#endif /* _INC_TIMEB */

View File

@@ -0,0 +1,78 @@
/***
*sys/types.h - types returned by system level calls for file and time info
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file defines types used in defining values returned by system
* level calls for file status and time information.
* [System V]
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_TYPES
#define _INC_TYPES
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
#ifndef _TIME_T_DEFINED
#ifdef _WIN64
typedef __int64 time_t; /* time value */
#else
typedef long time_t; /* time value */
#endif
#if _INTEGRAL_MAX_BITS >= 64
typedef __int64 __time64_t;
#endif
#define _TIME_T_DEFINED /* avoid multiple def's of time_t */
#endif
#ifndef _INO_T_DEFINED
typedef unsigned short _ino_t; /* i-node number (not used on DOS) */
#if !__STDC__
/* Non-ANSI name for compatibility */
typedef unsigned short ino_t;
#endif
#define _INO_T_DEFINED
#endif
#ifndef _DEV_T_DEFINED
typedef unsigned int _dev_t; /* device code */
#if !__STDC__
/* Non-ANSI name for compatibility */
typedef unsigned int dev_t;
#endif
#define _DEV_T_DEFINED
#endif
#ifndef _OFF_T_DEFINED
typedef long _off_t; /* file offset value */
#if !__STDC__
/* Non-ANSI name for compatibility */
typedef long off_t;
#endif
#define _OFF_T_DEFINED
#endif
#endif /* _INC_TYPES */

View File

@@ -0,0 +1,129 @@
/***
*sys/utime.h - definitions/declarations for utime()
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
*Purpose:
* This file defines the structure used by the utime routine to set
* new file access and modification times. NOTE - MS-DOS
* does not recognize access time, so this field will
* always be ignored and the modification time field will be
* used to set the new time.
*
* [Public]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _INC_UTIME
#define _INC_UTIME
#if !defined(_WIN32)
#error ERROR: Only Win32 target supported!
#endif
#ifdef _MSC_VER
#pragma pack(push,8)
#endif /* _MSC_VER */
#ifdef __cplusplus
extern "C" {
#endif
/* Define _CRTIMP */
#ifndef _CRTIMP
#ifdef _DLL
#define _CRTIMP __declspec(dllimport)
#else /* ndef _DLL */
#define _CRTIMP
#endif /* _DLL */
#endif /* _CRTIMP */
/* Define __cdecl for non-Microsoft compilers */
#if ( !defined(_MSC_VER) && !defined(__cdecl) )
#define __cdecl
#endif
#ifndef _WCHAR_T_DEFINED
typedef unsigned short wchar_t;
#define _WCHAR_T_DEFINED
#endif
#ifndef _TIME_T_DEFINED
#ifdef _WIN64
typedef __int64 time_t; /* time value */
#else
typedef long time_t; /* time value */
#endif
#if _INTEGRAL_MAX_BITS >= 64
typedef __int64 __time64_t;
#endif
#define _TIME_T_DEFINED /* avoid multiple def's of time_t */
#endif
/* define struct used by _utime() function */
#ifndef _UTIMBUF_DEFINED
struct _utimbuf {
time_t actime; /* access time */
time_t modtime; /* modification time */
};
#if !__STDC__
/* Non-ANSI name for compatibility */
struct utimbuf {
time_t actime; /* access time */
time_t modtime; /* modification time */
};
#endif
#if _INTEGRAL_MAX_BITS >= 64
struct __utimbuf64 {
__time64_t actime; /* access time */
__time64_t modtime; /* modification time */
};
#endif
#define _UTIMBUF_DEFINED
#endif
/* Function Prototypes */
_CRTIMP int __cdecl _utime(const char *, struct _utimbuf *);
_CRTIMP int __cdecl _futime(int, struct _utimbuf *);
/* Wide Function Prototypes */
_CRTIMP int __cdecl _wutime(const wchar_t *, struct _utimbuf *);
#if _INTEGRAL_MAX_BITS >= 64
_CRTIMP int __cdecl _utime64(const char *, struct __utimbuf64 *);
_CRTIMP int __cdecl _futime64(int, struct __utimbuf64 *);
_CRTIMP int __cdecl _wutime64(const wchar_t *, struct __utimbuf64 *);
#endif
#if !__STDC__
/* Non-ANSI name for compatibility */
_CRTIMP int __cdecl utime(const char *, struct utimbuf *);
#endif
#ifdef __cplusplus
}
#endif
#ifdef _MSC_VER
#pragma pack(pop)
#endif /* _MSC_VER */
#endif /* _INC_UTIME */

File diff suppressed because it is too large Load Diff

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