///////////////////////////////////////////////////////////////////////////
// FILE: new/new.h (Dynamic memory support)
//
//                          Open Watcom Project
//
//    Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
//
//    This file is automatically generated. Do not edit directly.
//
// =========================================================================
//
// Description: This header is part of the C++ standard library.
///////////////////////////////////////////////////////////////////////////
#ifndef _NEW_INCLUDED
#define _NEW_INCLUDED

#if !defined(_ENABLE_AUTODEPEND)
  #pragma read_only_file;
#endif


#ifndef __cplusplus
#error The header new requires C++
#endif

#ifndef _COMDEF_H_INCLUDED
  #include <_comdef.h>
#endif

#ifndef _STDDEF_H_INCLUDED
  #include <stddef.h>
#endif

#ifndef _EXCEPTION_INCLUDED
  #include <exception>
#endif

#ifndef _PFV_DEFINED
#define _PFV_DEFINED
#define _PFV_DEFINED_
typedef void (*PFV)( void );
#endif
#ifndef _PFU_DEFINED
#define _PFU_DEFINED
#define _PFU_DEFINED_
typedef int (*PFU)( unsigned );
#endif
#ifndef _PNH_DEFINED
#define _PNH_DEFINED
#define _PNH_DEFINED_
typedef int (*_PNH)( unsigned );
#endif
#if defined(__SW_BR)
  #ifndef _PPV_DEFINED
  #define _PPV_DEFINED
  #define _PPV_DEFINED_
  typedef void (*_PVV)( void *);
  #endif
  #ifndef _PUP_DEFINED
  #define _PUP_DEFINED
  #define _PUP_DEFINED_
  typedef void* (*_PUP)( unsigned );
  #endif
#endif

extern void *operator new( size_t );
extern void *operator new( size_t, void * );
extern void *operator new []( size_t );
extern void *operator new []( size_t, void * );
extern void operator delete( void * );
extern void operator delete []( void * );
_WPRTLINK extern PFV set_new_handler( PFV );
_WPRTLINK extern PFU _set_new_handler( PFU );
#if defined(__SW_BR)
  _WPRTLINK extern _PUP _set_op_new( _PUP );
  _WPRTLINK extern _PUP _set_op_new_array( _PUP );
  _WPRTLINK extern _PVV _set_op_delete( _PVV );
  _WPRTLINK extern _PVV _set_op_delete_array( _PVV );
#endif

// NOTE: Open Watcom currently does not throw std::bad_alloc on
// allocation failures. This class is defined here to so that programs
// that reference it will at least compile. Consider this a first step
// in building an exception throwing implementation of operator new.

namespace std {
  class bad_alloc : public exception {
  public:
    bad_alloc( ) _WCTHROWS() :
      exception( "unable to allocate memory" ) { }

    bad_alloc( const bad_alloc & ) _WCTHROWS() { }

    bad_alloc & operator=( bad_alloc & ) _WCTHROWS()
        { return *this; }

    virtual ~bad_alloc( ) _WCTHROWS() { }
  };
}

#endif
