williamr@4: /* williamr@4: * Copyright (c) 1996,1997 williamr@4: * Silicon Graphics Computer Systems, Inc. williamr@4: * williamr@4: * Copyright (c) 1999 williamr@4: * Boris Fomitchev williamr@4: * williamr@4: * This material is provided "as is", with absolutely no warranty expressed williamr@4: * or implied. Any use is at your own risk. williamr@4: * williamr@4: * Permission to use or copy this software for any purpose is hereby granted williamr@4: * without fee, provided the above notices are retained on all copies. williamr@4: * Permission to modify the code and to distribute modified code is granted, williamr@4: * provided the above notices are retained, and a notice that the code was williamr@4: * modified is included with the above copyright notice. williamr@4: */ williamr@4: williamr@4: // The header contains low-level functions that interact williamr@4: // with a compiler's exception-handling mechanism. It is assumed to williamr@4: // be supplied with the compiler, rather than with the library, because williamr@4: // it is inherently tied very closely to the compiler itself. williamr@4: williamr@4: // On platforms where does not exist, this header defines williamr@4: // an exception base class. This is *not* a substitute for everything williamr@4: // in , but it suffices to support a bare minimum of STL williamr@4: // functionality. williamr@4: williamr@4: #ifndef _STLP_INTERNAL_EXCEPTION williamr@4: #define _STLP_INTERNAL_EXCEPTION williamr@4: williamr@4: #if !defined (_STLP_NO_EXCEPTION_HEADER) williamr@4: williamr@4: # if defined ( _UNCAUGHT_EXCEPTION ) williamr@4: # undef _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT williamr@4: # endif williamr@4: williamr@4: # if defined (_STLP_BROKEN_EXCEPTION_CLASS) williamr@4: # define exception _STLP_NULLIFIED_BROKEN_EXCEPTION_CLASS williamr@4: # define bad_exception _STLP_NULLIFIED_BROKEN_BAD_EXCEPTION_CLASS williamr@4: # if defined (_STLP_NO_NEW_NEW_HEADER) williamr@4: # include _STLP_NATIVE_CPP_RUNTIME_HEADER(Exception.h) williamr@4: # else williamr@4: # include _STLP_NATIVE_CPP_RUNTIME_HEADER(Exception) williamr@4: # endif williamr@4: # undef exception williamr@4: # undef bad_exception williamr@4: # else williamr@4: # if defined (_STLP_NO_NEW_NEW_HEADER) williamr@4: # include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception.h) williamr@4: # else williamr@4: # include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception) williamr@4: # endif williamr@4: # endif williamr@4: williamr@4: # if defined (_STLP_HAS_SPECIFIC_PROLOG_EPILOG) && (defined (_STLP_MSVC) || defined (__ICL)) williamr@4: // dwa 02/04/00 - here I'm assuming that __ICL uses the same library headers as vc6. williamr@4: // the header which ships with vc6 and is included by its native williamr@4: // actually turns on warnings, so we have to turn them back off. williamr@4: # include williamr@4: # endif williamr@4: williamr@4: # if defined (_STLP_USE_OWN_NAMESPACE) williamr@4: williamr@4: _STLP_BEGIN_NAMESPACE williamr@4: # if !defined (_STLP_BROKEN_EXCEPTION_CLASS) williamr@4: # if !defined (_STLP_USING_PLATFORM_SDK_COMPILER) || !defined (_WIN64) williamr@4: using _STLP_VENDOR_EXCEPT_STD::exception; williamr@4: # else williamr@4: using ::exception; williamr@4: # endif williamr@4: using _STLP_VENDOR_EXCEPT_STD::bad_exception; williamr@4: # endif williamr@4: williamr@4: # if !defined (_STLP_NO_USING_FOR_GLOBAL_FUNCTIONS) williamr@4: // fbp : many platforms present strange mix of williamr@4: // those in various namespaces williamr@4: # if !defined (_STLP_VENDOR_UNEXPECTED_STD) williamr@4: # define _STLP_VENDOR_UNEXPECTED_STD _STLP_VENDOR_EXCEPT_STD williamr@4: # else williamr@4: /* The following definitions are for backward compatibility as _STLP_VENDOR_TERMINATE_STD williamr@4: * and _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD has been introduce after _STLP_VENDOR_UNEXPECTED_STD williamr@4: * and _STLP_VENDOR_UNEXPECTED_STD was the macro used in their place before that introduction. williamr@4: */ williamr@4: # if !defined (_STLP_VENDOR_TERMINATE_STD) williamr@4: # define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_UNEXPECTED_STD williamr@4: # endif williamr@4: # if !defined (_STLP_VENDOR_UNCAUGHT_EXCEPTION_STD) williamr@4: # define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_UNEXPECTED_STD williamr@4: # endif williamr@4: # endif williamr@4: # if !defined (_STLP_VENDOR_TERMINATE_STD) williamr@4: # define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_EXCEPT_STD williamr@4: # endif williamr@4: # if !defined (_STLP_VENDOR_UNCAUGHT_EXCEPTION_STD) williamr@4: # define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_EXCEPT_STD williamr@4: # endif williamr@4: # if !defined (_STLP_VENDOR_TERMINATE_STD) williamr@4: # define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_EXCEPT_STD williamr@4: # endif williamr@4: # if !defined (_STLP_VENDOR_UNCAUGHT_EXCEPTION_STD) williamr@4: # define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_EXCEPT_STD williamr@4: # endif williamr@4: // weird errors williamr@4: # if !defined (_STLP_NO_UNEXPECTED_EXCEPT_SUPPORT) williamr@4: # if defined (__ICL) && (__ICL >= 900) && (_STLP_MSVC_LIB < 1300) williamr@4: //See config/_intel.h for reason about this workaround williamr@4: using std::unexpected; williamr@4: # else williamr@4: using _STLP_VENDOR_UNEXPECTED_STD::unexpected; williamr@4: # endif williamr@4: using _STLP_VENDOR_UNEXPECTED_STD::unexpected_handler; williamr@4: using _STLP_VENDOR_UNEXPECTED_STD::set_unexpected; williamr@4: # endif williamr@4: using _STLP_VENDOR_TERMINATE_STD::terminate; williamr@4: using _STLP_VENDOR_TERMINATE_STD::terminate_handler; williamr@4: using _STLP_VENDOR_TERMINATE_STD::set_terminate; williamr@4: williamr@4: # if !defined (_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT) williamr@4: using _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD::uncaught_exception; williamr@4: # endif williamr@4: # endif /* !_STLP_NO_USING_FOR_GLOBAL_FUNCTIONS */ williamr@4: _STLP_END_NAMESPACE williamr@4: # endif /* _STLP_OWN_NAMESPACE */ williamr@4: #else /* _STLP_NO_EXCEPTION_HEADER */ williamr@4: williamr@4: /* fbp : absence of usually means that those williamr@4: * functions are not going to be called by compiler. williamr@4: * Still, define them for the user. williamr@4: * dums: Policy modification, if the function do not behave like the Standard williamr@4: * defined it we do not grant it in the STLport namespace. We will have williamr@4: * compile time error rather than runtime error. williamr@4: */ williamr@4: #if 0 williamr@4: /* williamr@4: typedef void (*unexpected_handler)(); williamr@4: unexpected_handler set_unexpected(unexpected_handler f) _STLP_NOTHROW_INHERENTLY; williamr@4: void unexpected(); williamr@4: williamr@4: typedef void (*terminate_handler)(); williamr@4: terminate_handler set_terminate(terminate_handler f) _STLP_NOTHROW_INHERENTLY; williamr@4: void terminate(); williamr@4: williamr@4: bool uncaught_exception(); // not implemented under mpw as of Jan/1999 williamr@4: */ williamr@4: #endif williamr@4: williamr@4: #endif /* _STLP_NO_EXCEPTION_HEADER */ williamr@4: williamr@4: #if defined (_STLP_NO_EXCEPTION_HEADER) || defined (_STLP_BROKEN_EXCEPTION_CLASS) williamr@4: _STLP_BEGIN_NAMESPACE williamr@4: williamr@4: // section 18.6.1 williamr@4: class _STLP_CLASS_DECLSPEC exception { williamr@4: public: williamr@4: # ifndef _STLP_USE_NO_IOSTREAMS williamr@4: exception() _STLP_NOTHROW; williamr@4: virtual ~exception() _STLP_NOTHROW; williamr@4: virtual const char* what() const _STLP_NOTHROW; williamr@4: # else williamr@4: exception() _STLP_NOTHROW {} williamr@4: virtual ~exception() _STLP_NOTHROW {} williamr@4: virtual const char* what() const _STLP_NOTHROW {return "class exception";} williamr@4: # endif williamr@4: }; williamr@4: williamr@4: // section 18.6.2.1 williamr@4: class _STLP_CLASS_DECLSPEC bad_exception : public exception { williamr@4: public: williamr@4: # ifndef _STLP_USE_NO_IOSTREAMS williamr@4: bad_exception() _STLP_NOTHROW; williamr@4: ~bad_exception() _STLP_NOTHROW; williamr@4: const char* what() const _STLP_NOTHROW; williamr@4: # else williamr@4: bad_exception() _STLP_NOTHROW {} williamr@4: ~bad_exception() _STLP_NOTHROW {} williamr@4: const char* what() const _STLP_NOTHROW {return "class bad_exception";} williamr@4: # endif williamr@4: }; williamr@4: williamr@4: // forward declaration williamr@4: class __Named_exception; williamr@4: _STLP_END_NAMESPACE williamr@4: #endif williamr@4: williamr@4: #endif /* _STLP_INTERNAL_EXCEPTION */