/*
 * Copyright (c) 1996,1997
 * Silicon Graphics Computer Systems, Inc.
 *
 * Copyright (c) 1999 
 * Boris Fomitchev
 *
 * This material is provided "as is", with absolutely no warranty expressed
 * or implied. Any use is at your own risk.
 *
 * Permission to use or copy this software for any purpose is hereby granted 
 * without fee, provided the above notices are retained on all copies.
 * Permission to modify the code and to distribute modified code is granted,
 * provided the above notices are retained, and a notice that the code was
 * modified is included with the above copyright notice.
 *
 */

// This header exists solely for portability.  Normally it just includes
// the native header <exception>.

// The header <exception> contains low-level functions that interact
// with a compiler's exception-handling mechanism.  It is assumed to
// be supplied with the compiler, rather than with the library, because
// it is inherently tied very closely to the compiler itself.

// On platforms where <exception> does not exist, this header defines
// an exception base class.  This is *not* a substitute for everything
// in <exception>, but it suffices to support a bare minimum of STL
// functionality.

# if !defined (__STL_OUTERMOST_HEADER_ID)
#  define __STL_OUTERMOST_HEADER_ID 0x423
#  include <stl/_prolog.h>
# elif (__STL_OUTERMOST_HEADER_ID == 0x423) && ! defined (__STL_DONT_POP_0x423)
#  define __STL_DONT_POP_0x423
# endif

# if   ! defined (__STL_NO_EXCEPTION_HEADER)

# if defined ( _UNCAUGHT_EXCEPTION )
#  undef __STL_INCOMPLETE_EXCEPTION_HEADER
# endif

#  if defined (__GNUC__) && (__GNUC_MINOR__ >= 8 )
#    include <../include/exception>
#  else
#    include __STL_NATIVE_HEADER(exception)
#  endif
// dwa 02/04/00 - here I'm assuming that __ICL uses the same library headers as vc6.
// the header <yvals.h> which ships with vc6 and is included by its native <exception>
// actually turns on warnings, so we have to turn them back off.
#    if defined (__STL_MSVC) || defined (__ICL)
#      include <config/_msvc_warnings_off.h>
#    endif

# ifndef __STL_EXCEPTION_BASE
#  define __STL_EXCEPTION_BASE __STL_VENDOR_EXCEPT_STD::exception
# endif

#  ifdef __STL_USE_OWN_NAMESPACE

__STL_BEGIN_NAMESPACE

using __STL_VENDOR_EXCEPT_STD::exception;
using __STL_VENDOR_EXCEPT_STD::bad_exception;

# if ! defined (__STL_NO_USING_FOR_GLOBAL_FUNCTIONS)

// fbp : many platforms present strange mix of
// those in various namespaces
#  if !defined(__STL_VENDOR_UNEXPECTED_STD)
#   define __STL_VENDOR_UNEXPECTED_STD __STL_VENDOR_EXCEPT_STD
#  endif

// weird errors
# ifndef __BORLANDC__
using __STL_VENDOR_UNEXPECTED_STD ::unexpected;
using __STL_VENDOR_UNEXPECTED_STD ::unexpected_handler;
using __STL_VENDOR_UNEXPECTED_STD ::set_unexpected;
using __STL_VENDOR_UNEXPECTED_STD ::terminate;
using __STL_VENDOR_UNEXPECTED_STD ::terminate_handler;
using __STL_VENDOR_UNEXPECTED_STD ::set_terminate;
# endif

# if !defined (__STL_INCOMPLETE_EXCEPTION_HEADER) 
using __STL_VENDOR_UNEXPECTED_STD::uncaught_exception;
# endif

#  endif

__STL_END_NAMESPACE

#  endif /* __STL_OWN_NAMESPACE */

#else /* __STL_NO_EXCEPTION_HEADER */

# ifndef __SGI_STL_EXCEPTION_H
#  define __SGI_STL_EXCEPTION_H

__STL_BEGIN_NAMESPACE

// section 18.6
	class exception;
	class bad_exception;
	
// fbp : absence of <exception> usually means that those
// functions are not going to be called by compiler.
// Still, define them for the user.
	typedef void (*unexpected_handler)();
	unexpected_handler set_unexpected(unexpected_handler f) __STL_NOTHROW;
	void unexpected();
	
	typedef void (*terminate_handler)();
	terminate_handler set_terminate(terminate_handler f) __STL_NOTHROW;
	void terminate();
	
	bool uncaught_exception(); // not implemented under mpw as of Jan/1999

// section 18.6.1
	class exception 
	{
	public:
		exception()__STL_NOTHROW {}
		virtual ~exception() __STL_NOTHROW {}
		virtual const char* what() const __STL_NOTHROW {return "class exception";}
	};
	
	

// section 18.6.2.1
	class bad_exception : public exception 
	{
	public:
		bad_exception() __STL_NOTHROW {}
		virtual ~bad_exception() __STL_NOTHROW {}
		virtual const char* what() const __STL_NOTHROW {return "class bad_exception";}
	};

# define __STL_EXCEPTION_BASE exception

__STL_END_NAMESPACE

#endif /* __STL_NO_EXCEPTION_HEADER */

__STL_BEGIN_NAMESPACE
// forward declaration
class __Named_exception;
__STL_END_NAMESPACE
#endif /* __SGI_STL_EXCEPTION_H */

# if (__STL_OUTERMOST_HEADER_ID == 0x423)
#  if ! defined (__STL_DONT_POP_0x423)
#   include <stl/_epilog.h>
#   undef  __STL_OUTERMOST_HEADER_ID
#   endif
#   undef  __STL_DONT_POP_0x423
# endif

// Local Variables:
// mode:C++
// End:
