///////////////////////////////////////////////////////////////////////////
// FILE: exception.h/exception (Basic exception classes)
//
// =========================================================================
//
//                          Open Watcom Project
//
//    Copyright (c) 2002-2010 Open Watcom Contributors. All Rights Reserved.
//    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. It
//              defines the base class of the exception classes as
//              well as a number of helper functions related to
//              exception handling.
///////////////////////////////////////////////////////////////////////////
#ifndef _EXCEPTION_INCLUDED
#define _EXCEPTION_INCLUDED

#ifndef _ENABLE_AUTODEPEND
 #pragma read_only_file;
#endif

#ifndef __cplusplus
 #error This header file requires C++
#endif

#ifndef _COMDEF_H_INCLUDED
 #include <_comdef.h>
#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
#ifdef __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

#ifndef _WATCOM_EXCEPTION_DEFINED
#define _WATCOM_EXCEPTION_DEFINED
 #define _WATCOM_EXCEPTION_DEFINED_
 struct __WATCOM_exception {
  #if defined(__AXP__) || defined(__PPC__)
     void *__filler;
  #endif
 };
#endif

#ifndef _WC_EXCEPTION_MACROS_
#define _WC_EXCEPTION_MACROS_
 #ifdef _CPPUNWIND
  #define _WCTHROWS( __t )  throw( __t ) // Use for exception specifications.
  #define _WCTHROW( __t )   throw( __t ) // Use for throw statements.
  #define _WCTRY            try
  #define _WCHANDLERS       1
 #else
  #define _WCTHROWS( __t )
  #define _WCTHROW( __t )
  #define _WCTRY
 #endif
#endif

namespace std {

  class _WPRTLINK exception {
    const char *_what_val;
  public:
    exception( ) _WCTHROWS() { }

    exception( const exception &src ) _WCTHROWS()
        : _what_val( src._what_val ) { }

    exception( const char *what_val ) _WCTHROWS()
        : _what_val( what_val ) { }

    exception& operator=( const exception &src ) _WCTHROWS()
        { _what_val = src._what_val; return *this; }

    virtual ~exception( ) _WCTHROWS() { }

    virtual const char *what( ) const _WCTHROWS()
        { return _what_val; }
  };


  class _WPRTLINK bad_exception : public exception {
  public:
    bad_exception( ) _WCTHROWS()
        : exception( "exception missing from exception specification" ) { }

    bad_exception( const bad_exception & ) _WCTHROWS() { }

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

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


  typedef void (*unexpected_handler)( );
  typedef void (*terminate_handler)( );

  _WPRTLINK extern void terminate( );
  _WPRTLINK extern terminate_handler set_terminate( terminate_handler );
  _WPRTLINK extern void unexpected( );
  _WPRTLINK extern unexpected_handler set_unexpected( unexpected_handler );

} // namespace std

#endif
