/*
 * 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.
 *
 */

#ifndef __SGI_STL_EXCEPTION_H

# ifndef __BORLANDC__
# define __SGI_STL_EXCEPTION_H
# endif

// 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.

#ifndef __STL_CONFIG_H
#include <stl_config.h>
#endif

#ifndef __STL_NO_EXCEPTION_HEADER

#  if defined ( __STL_REDEFINE_STD ) && defined (std) 
#    undef std
#    define __STL_RESUME_STD_FOR_EXCEPTION
#    define __STLPORT_NATIVE_PASS
#  endif

#  if defined (__GNUC__) && (__GNUC_MINOR__ >= 8 )
#    include <../include/exception>
#  else
#    include __STL_NATIVE_HEADER(exception)
#  endif

# ifdef __BORLANDC__
// define guard after inclusion only, as recursive inclusion
// is possible.
# define __SGI_STL_EXCEPTION_H
# endif

# if defined ( __STL_RESUME_STD_FOR_EXCEPTION )
#    undef __STL_RESUME_STD_FOR_EXCEPTION
#    define std __STLPORT_NAMESPACE
#    undef __STLPORT_NATIVE_PASS
# 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;
__STL_END_NAMESPACE
#  endif /* __STL_OWN_NAMESPACE */

#else /* __STL_NO_EXCEPTION_HEADER */

// define it right away
# define __SGI_STL_EXCEPTION_H

__STL_BEGIN_NAMESPACE

// this has to be a class, to avoid portability problems
// with derived classes

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

# define __STL_EXCEPTION_BASE exception

// fbp : absence of <exception> usually means that those
// functions are not going to be called by compiler.
// Still, define them for the user.
 
void unexpected();
typedef void (*unexpected_handler)();
unexpected_handler set_unexpected (unexpected_handler) __STL_NOTHROW;

void terminate();
typedef void (*terminate_handler)();
terminate_handler set_terminate(terminate_handler) __STL_NOTHROW;

bool uncaught_exception() __STL_NOTHROW;

__STL_END_NAMESPACE

#endif /* __STL_NO_EXCEPTION_HEADER */

#endif /* __SGI_STL_EXCEPTION_H */

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