/*  Metrowerks Standard Library  Version 4.0  1998 August 10  */

/*  $Date: 1998/12/04 23:58:21 $ 
 *  $Revision: 1.2 $ 
 *  $NoKeywords: $ 
 *
 *		Copyright  1995-1998 Metrowerks, Inc.
 *		All rights reserved.
 */

/************************************************************************/
/*	Project...:	Standard C++ Library									*/
/*	Name......:	exception												*/
/*	Purpose...:	exception handling										*/
/************************************************************************/

#ifndef _EXCEPTION
#define _EXCEPTION

#include <mcompile.h>

#ifndef RC_INVOKED // hh 971230

#pragma options align=native
#if defined(__CFM68K__) && !defined(__USING_STATIC_LIBS__)
	#pragma import on
#endif

#ifdef MSIPL_USING_NAMESPACE           // hh 971206 moved this up in the file
	namespace std {
#endif

	// hh 971226
	// Removed string and bool from this class.  This data is moved into
	// derived classes if and when needed.
	class exception {       // hh 971226 moved from mexcept.h
	public :
	    exception () MSIPL_THROW {}
	    exception (const exception&) MSIPL_THROW {}
	    exception& operator= (const exception&) MSIPL_THROW {return *this;}
	    virtual ~exception () MSIPL_THROW {}
	    virtual const char* what () const MSIPL_THROW {return "exception";}
	};

	class bad_exception : public exception {
	public:
		bad_exception() MSIPL_THROW {}
		bad_exception(const bad_exception&) MSIPL_THROW {}
		bad_exception& operator=(const bad_exception&) MSIPL_THROW { return *this; }
		virtual ~bad_exception() MSIPL_THROW {};
		virtual const char* what() const MSIPL_THROW { return "bad_exception"; };
	};

	typedef void (*unexpected_handler)();
	unexpected_handler set_unexpected(unexpected_handler f) MSIPL_THROW;
	void unexpected();
	typedef void (*terminate_handler)();
	terminate_handler set_terminate(terminate_handler f) MSIPL_THROW;
	void terminate();
//	bool uncaught_exception();    // hh 971226 not implemented yet.

//	extern void __priv_throwbadcast(void);   // hh 970102 no longer needed

#ifdef MSIPL_USING_NAMESPACE
	}
#endif

#if defined(__CFM68K__) && !defined(__USING_STATIC_LIBS__)
	#pragma import reset
#endif
#pragma options align=reset

#endif // RC_INVOKED

#endif
/*     Change record
960828 bkoz try a forward declaration to cut the exception->string dependencies
960828 bkoz add exception::exception(const char*) ctor for string literals
961210 bkoz added wrapper for alignment
961217 KO	Changed char_traits from a struct to a class. Needed for the new x86
			compiler.
970211 bkoz	line 73 added bad_exception::what from stdexcept.cp
970408 bkoz	line 22, include bstring, inlined exception class
hh 971206   Moved #ifdef MSIPL_USING_NAMESPACE around
// hh 971226 moved exception from mexcept.h
// hh 971226 cleaned up & checked against standard
// hh 971226 Removed string and bool from this class.  This data is moved into
//           derived classes if and when needed.
// hh 971230 added RC_INVOKED wrapper
// hh 970102 __priv_throwbadcast no longer needed
*/
