/home/ntakagi/work/STLport-5.1.5/stlport/stl/_exception.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1996,1997
00003  * Silicon Graphics Computer Systems, Inc.
00004  *
00005  * Copyright (c) 1999
00006  * Boris Fomitchev
00007  *
00008  * This material is provided "as is", with absolutely no warranty expressed
00009  * or implied. Any use is at your own risk.
00010  *
00011  * Permission to use or copy this software for any purpose is hereby granted
00012  * without fee, provided the above notices are retained on all copies.
00013  * Permission to modify the code and to distribute modified code is granted,
00014  * provided the above notices are retained, and a notice that the code was
00015  * modified is included with the above copyright notice.
00016  */
00017 
00018 // The header <exception> contains low-level functions that interact
00019 // with a compiler's exception-handling mechanism.  It is assumed to
00020 // be supplied with the compiler, rather than with the library, because
00021 // it is inherently tied very closely to the compiler itself.
00022 
00023 // On platforms where <exception> does not exist, this header defines
00024 // an exception base class.  This is *not* a substitute for everything
00025 // in <exception>, but it suffices to support a bare minimum of STL
00026 // functionality.
00027 
00028 #ifndef _STLP_INTERNAL_EXCEPTION
00029 #define _STLP_INTERNAL_EXCEPTION
00030 
00031 #if !defined (_STLP_NO_EXCEPTION_HEADER)
00032 
00033 #  if defined ( _UNCAUGHT_EXCEPTION )
00034 #    undef _STLP_NO_UNCAUGHT_EXCEPT_SUPPORT
00035 #  endif
00036 
00037 #  if defined (_STLP_BROKEN_EXCEPTION_CLASS)
00038 #    define exception     _STLP_NULLIFIED_BROKEN_EXCEPTION_CLASS
00039 #    define bad_exception _STLP_NULLIFIED_BROKEN_BAD_EXCEPTION_CLASS
00040 #    if defined (_STLP_NO_NEW_NEW_HEADER)
00041 #      include _STLP_NATIVE_CPP_RUNTIME_HEADER(Exception.h)
00042 #    else
00043 #      include _STLP_NATIVE_CPP_RUNTIME_HEADER(Exception)
00044 #    endif
00045 #    undef exception
00046 #    undef bad_exception
00047 #  else
00048 #    if defined (_STLP_NO_NEW_NEW_HEADER)
00049 #      include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception.h)
00050 #    else
00051 #      include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception)
00052 #    endif
00053 #  endif
00054 
00055 #  if defined (_STLP_HAS_SPECIFIC_PROLOG_EPILOG) && (defined (_STLP_MSVC) || defined (__ICL))
00056 // dwa 02/04/00 - here I'm assuming that __ICL uses the same library headers as vc6.
00057 // the header <yvals.h> which ships with vc6 and is included by its native <exception>
00058 // actually turns on warnings, so we have to turn them back off.
00059 #    include <stl/config/_warnings_off.h>
00060 #  endif
00061 
00062 #  if defined (_STLP_USE_OWN_NAMESPACE)
00063 
00064 _STLP_BEGIN_NAMESPACE
00065 #    if !defined (_STLP_BROKEN_EXCEPTION_CLASS)
00066 #      if !defined (_STLP_USING_PLATFORM_SDK_COMPILER) || !defined (_WIN64)
00067 using _STLP_VENDOR_EXCEPT_STD::exception;
00068 #      else
00069 using ::exception;
00070 #      endif
00071 using _STLP_VENDOR_EXCEPT_STD::bad_exception;
00072 #    endif
00073 
00074 #    if !defined (_STLP_NO_USING_FOR_GLOBAL_FUNCTIONS)
00075 // fbp : many platforms present strange mix of
00076 // those in various namespaces
00077 #      if !defined (_STLP_VENDOR_UNEXPECTED_STD)
00078 #        define _STLP_VENDOR_UNEXPECTED_STD _STLP_VENDOR_EXCEPT_STD
00079 #      else
00080 /* The following definitions are for backward compatibility as _STLP_VENDOR_TERMINATE_STD
00081  * and _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD has been introduce after _STLP_VENDOR_UNEXPECTED_STD
00082  * and _STLP_VENDOR_UNEXPECTED_STD was the macro used in their place before that introduction.
00083  */
00084 #        if !defined (_STLP_VENDOR_TERMINATE_STD)
00085 #          define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_UNEXPECTED_STD
00086 #        endif
00087 #        if !defined (_STLP_VENDOR_UNCAUGHT_EXCEPTION_STD)
00088 #          define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_UNEXPECTED_STD
00089 #        endif
00090 #      endif
00091 #      if !defined (_STLP_VENDOR_TERMINATE_STD)
00092 #        define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_EXCEPT_STD
00093 #      endif
00094 #      if !defined (_STLP_VENDOR_UNCAUGHT_EXCEPTION_STD)
00095 #        define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_EXCEPT_STD
00096 #      endif
00097 #      if !defined (_STLP_VENDOR_TERMINATE_STD)
00098 #        define _STLP_VENDOR_TERMINATE_STD _STLP_VENDOR_EXCEPT_STD
00099 #      endif
00100 #      if !defined (_STLP_VENDOR_UNCAUGHT_EXCEPTION_STD)
00101 #        define _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD _STLP_VENDOR_EXCEPT_STD
00102 #      endif
00103 // weird errors
00104 #        if !defined (_STLP_NO_UNEXPECTED_EXCEPT_SUPPORT)
00105 #          if defined (__ICL) && (__ICL >= 900) && (_STLP_MSVC_LIB < 1300)
00106 //See config/_intel.h for reason about this workaround
00107 using std::unexpected;
00108 #          else
00109 using _STLP_VENDOR_UNEXPECTED_STD::unexpected;
00110 #          endif
00111 using _STLP_VENDOR_UNEXPECTED_STD::unexpected_handler;
00112 using _STLP_VENDOR_UNEXPECTED_STD::set_unexpected;
00113 #        endif
00114 using _STLP_VENDOR_TERMINATE_STD::terminate;
00115 using _STLP_VENDOR_TERMINATE_STD::terminate_handler;
00116 using _STLP_VENDOR_TERMINATE_STD::set_terminate;
00117 
00118 #      if !defined (_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT)
00119 using _STLP_VENDOR_UNCAUGHT_EXCEPTION_STD::uncaught_exception;
00120 #      endif
00121 #    endif /* !_STLP_NO_USING_FOR_GLOBAL_FUNCTIONS */
00122 _STLP_END_NAMESPACE
00123 #  endif /* _STLP_OWN_NAMESPACE */
00124 #else /* _STLP_NO_EXCEPTION_HEADER */
00125 
00126 /* fbp : absence of <exception> usually means that those
00127  * functions are not going to be called by compiler.
00128  * Still, define them for the user.
00129  * dums: Policy modification, if the function do not behave like the Standard
00130  *       defined it we do not grant it in the STLport namespace. We will have
00131  *       compile time error rather than runtime error.
00132  */
00133 #if 0
00134 /*
00135 typedef void (*unexpected_handler)();
00136 unexpected_handler set_unexpected(unexpected_handler f) _STLP_NOTHROW_INHERENTLY;
00137 void unexpected();
00138 
00139 typedef void (*terminate_handler)();
00140 terminate_handler set_terminate(terminate_handler f) _STLP_NOTHROW_INHERENTLY;
00141 void terminate();
00142 
00143 bool uncaught_exception(); // not implemented under mpw as of Jan/1999
00144 */
00145 #endif
00146 
00147 #endif /* _STLP_NO_EXCEPTION_HEADER */
00148 
00149 #if defined (_STLP_NO_EXCEPTION_HEADER) || defined (_STLP_BROKEN_EXCEPTION_CLASS)
00150 _STLP_BEGIN_NAMESPACE
00151 
00152 // section 18.6.1
00153 class _STLP_CLASS_DECLSPEC exception {
00154 public:
00155 #  ifndef _STLP_USE_NO_IOSTREAMS
00156   exception() _STLP_NOTHROW;
00157   virtual ~exception() _STLP_NOTHROW;
00158   virtual const char* what() const _STLP_NOTHROW;
00159 #  else
00160   exception() _STLP_NOTHROW {}
00161   virtual ~exception() _STLP_NOTHROW {}
00162   virtual const char* what() const _STLP_NOTHROW {return "class exception";}
00163 #  endif
00164 };
00165 
00166 // section 18.6.2.1
00167 class _STLP_CLASS_DECLSPEC bad_exception : public exception {
00168 public:
00169 #  ifndef _STLP_USE_NO_IOSTREAMS
00170   bad_exception() _STLP_NOTHROW;
00171   ~bad_exception() _STLP_NOTHROW;
00172   const char* what() const _STLP_NOTHROW;
00173 #  else
00174   bad_exception() _STLP_NOTHROW {}
00175   ~bad_exception() _STLP_NOTHROW {}
00176   const char* what() const _STLP_NOTHROW {return "class bad_exception";}
00177 #  endif
00178 };
00179 
00180 // forward declaration
00181 class __Named_exception;
00182 _STLP_END_NAMESPACE
00183 #endif
00184 
00185 #endif /* _STLP_INTERNAL_EXCEPTION */



Generated on Mon Mar 10 15:32:21 2008 by  doxygen 1.5.1