/* SCE CONFIDENTIAL
PLAYSTATION(R)3 Programmer Tool Runtime Library 084.006
* Copyright (C) 2004 Sony Computer Entertainment Inc. 
* All Rights Reserved.
*/
// new standard header
#ifndef _NEW_
#define _NEW_
#include <exception>

 #if __GNUC__ < 3
_X_STD_BEGIN

 #else /* __GNUC__ < 3 */
namespace std {
 #endif /* __GNUC__ < 3 */

		// CLASS bad_alloc
class bad_alloc
	: public _XSTD exception
	{	// base of all bad allocation exceptions
public:

 #if __EDG__ || defined(__SUNPRO_CC)
	bad_alloc(const char *_Message = _MESG("bad allocation")) _THROW0()
		: exception(_Message)
		{	// construct from message string
		}

 #else /* __EDG__ etc. */
	bad_alloc() _THROW0()
		{	// construct with no message string
		}

	virtual const char *what() const _THROW0()
		{	// report a bad allocation
		return ("bad allocation");
		}
 #endif /* __EDG__ etc. */

//	virtual ~bad_alloc() _THROW0()
//		{}	// destroy the object

 #if _HAS_EXCEPTIONS

 #else /* _HAS_EXCEPTIONS */

protected:
	virtual void _Doraise() const
		{	// perform class-specific exception handling
		_RAISE(*this);
		}
 #endif /* _HAS_EXCEPTIONS */

	};

 #if __GNUC__ < 3
_X_STD_END

 #else /* __GNUC__ < 3 */
} /* namespace std */

 #if _HAS_NAMESPACE

 #else /* _HAS_NAMESPACE */
using std::bad_alloc;
 #endif /* _HAS_NAMESPACE */

 #endif /* __GNUC__ < 3 */

_STD_BEGIN
		// SUPPORT TYPES
typedef void (*new_handler)();	// handler for operator new failures

struct nothrow_t
	{	// placement new tag type to suppress exceptions
	};

extern const nothrow_t nothrow;	// constant for placement new tag

		// FUNCTION AND OBJECT DECLARATIONS
new_handler set_new_handler(new_handler)
	_THROW0();	// establish alternate new handler

extern new_handler _New_hand;	// pointer to current new handler
_STD_END

		// new AND delete DECLARATIONS (NB: NOT IN std)


void *operator new(_CSTD size_t)
	_THROW1(_XSTD bad_alloc);	// allocate or throw exception

void *operator new(_CSTD size_t, const _STD nothrow_t&)
	_THROW0();	// allocate or return null pointer

inline void *operator new(_CSTD size_t, void *_Where) _THROW0()
	{	// construct with placement at _Where
	return (_Where);
	}


void *operator new[](_CSTD size_t)
	_THROW1(_XSTD bad_alloc);	// allocate array or throw exception

void *operator new[](_CSTD size_t, const _STD nothrow_t&)
	_THROW0();	// allocate array or return null pointer

inline void *operator new[](_CSTD size_t, void *_Where) _THROW0()
	{	// construct array with placement at _Where
	return (_Where);
	}



void operator delete  (void *) _THROW0();	// delete allocated storage
void operator delete[](void *) _THROW0();	// delete allocated array

// The rest of these deletes will be called if the correspond call to
// new throws an exception.
void operator delete  (void *, const _STD nothrow_t&) _THROW0();	// delete if nothrow new fails -- REPLACEABLE
void operator delete[](void *, const _STD nothrow_t&) _THROW0();	// delete if nothrow array new fails -- REPLACEABLE
void operator delete  (void *, void *) _THROW0();	// delete if placement new fails
void operator delete[](void *, void *) _THROW0();	// delete if placement array new fails

#ifdef __STRICT_ALIGNED
// with alignment argument
void *operator new(_CSTD size_t, _CSTD size_t)
	_THROW1(_XSTD bad_alloc);	// allocate or throw exception

void *operator new(_CSTD size_t, _CSTD size_t, const _STD nothrow_t&)
	_THROW0();	// allocate or return null pointer

inline void *operator new(_CSTD size_t, _CSTD size_t, void *_Where) _THROW0()
	{	// construct with placement at _Where
	return (_Where);
	}


void *operator new[](_CSTD size_t, _CSTD size_t)
	_THROW1(_XSTD bad_alloc);	// allocate array or throw exception

void *operator new[](_CSTD size_t, _CSTD size_t, const _STD nothrow_t&)
	_THROW0();	// allocate array or return null pointer

inline void *operator new[](_CSTD size_t, _CSTD size_t, void *_Where) _THROW0()
	{	// construct array with placement at _Where
	return (_Where);
	}

void operator delete  (void *, _CSTD size_t) _THROW0();	// delete allocated storage
void operator delete[](void *, _CSTD size_t) _THROW0();	// delete allocated array
void operator delete  (void *, _CSTD size_t, const _STD nothrow_t&) _THROW0();
void operator delete[](void *, _CSTD size_t, const _STD nothrow_t&) _THROW0();	
void operator delete  (void *, _CSTD size_t, void *) _THROW0();
void operator delete[](void *, _CSTD size_t, void *) _THROW0();
#endif


#endif /* _NEW_ */

/*
 * Copyright (c) 1992-2003 by P.J. Plauger.  ALL RIGHTS RESERVED.
 * Consult your license regarding permissions and restrictions.
V4.02:0216 */
