williamr@4
|
1 |
/*
|
williamr@4
|
2 |
* © Portions copyright (c) 2006-2007 Nokia Corporation. All rights reserved.
|
williamr@4
|
3 |
*
|
williamr@4
|
4 |
* Copyright (c) 1996,1997
|
williamr@4
|
5 |
* Silicon Graphics Computer Systems, Inc.
|
williamr@4
|
6 |
*
|
williamr@4
|
7 |
* Copyright (c) 1999
|
williamr@4
|
8 |
* Boris Fomitchev
|
williamr@4
|
9 |
*
|
williamr@4
|
10 |
* This material is provided "as is", with absolutely no warranty expressed
|
williamr@4
|
11 |
* or implied. Any use is at your own risk.
|
williamr@4
|
12 |
*
|
williamr@4
|
13 |
* Permission to use or copy this software for any purpose is hereby granted
|
williamr@4
|
14 |
* without fee, provided the above notices are retained on all copies.
|
williamr@4
|
15 |
* Permission to modify the code and to distribute modified code is granted,
|
williamr@4
|
16 |
* provided the above notices are retained, and a notice that the code was
|
williamr@4
|
17 |
* modified is included with the above copyright notice.
|
williamr@4
|
18 |
*
|
williamr@4
|
19 |
*/
|
williamr@4
|
20 |
|
williamr@4
|
21 |
// This header exists solely for portability. Normally it just includes
|
williamr@4
|
22 |
// the native header <exception>.
|
williamr@4
|
23 |
|
williamr@4
|
24 |
// The header <exception> contains low-level functions that interact
|
williamr@4
|
25 |
// with a compiler's exception-handling mechanism. It is assumed to
|
williamr@4
|
26 |
// be supplied with the compiler, rather than with the library, because
|
williamr@4
|
27 |
// it is inherently tied very closely to the compiler itself.
|
williamr@4
|
28 |
|
williamr@4
|
29 |
// On platforms where <exception> does not exist, this header defines
|
williamr@4
|
30 |
// an exception base class. This is *not* a substitute for everything
|
williamr@4
|
31 |
// in <exception>, but it suffices to support a bare minimum of STL
|
williamr@4
|
32 |
// functionality.
|
williamr@4
|
33 |
|
williamr@4
|
34 |
|
williamr@4
|
35 |
# if !defined (_STLP_OUTERMOST_HEADER_ID)
|
williamr@4
|
36 |
# define _STLP_OUTERMOST_HEADER_ID 0x423
|
williamr@4
|
37 |
# include <stl/_prolog.h>
|
williamr@4
|
38 |
# elif (_STLP_OUTERMOST_HEADER_ID == 0x423) && ! defined (_STLP_DONT_POP_0x423)
|
williamr@4
|
39 |
# define _STLP_DONT_POP_0x423
|
williamr@4
|
40 |
# endif
|
williamr@4
|
41 |
|
williamr@4
|
42 |
#ifndef _STLP_EXCEPTION
|
williamr@4
|
43 |
#define _STLP_EXCEPTION
|
williamr@4
|
44 |
|
williamr@4
|
45 |
# if ! defined (_STLP_NO_EXCEPTION_HEADER)
|
williamr@4
|
46 |
|
williamr@4
|
47 |
# if defined ( _UNCAUGHT_EXCEPTION )
|
williamr@4
|
48 |
# undef _STLP_INCOMPLETE_EXCEPTION_HEADER
|
williamr@4
|
49 |
# endif
|
williamr@4
|
50 |
|
williamr@4
|
51 |
# if defined(_STLP_BROKEN_EXCEPTION_CLASS)
|
williamr@4
|
52 |
# define exception _STLP_NULLIFIED_BROKEN_EXCEPTION_CLASS
|
williamr@4
|
53 |
# define bad_exception _STLP_NULLIFIED_BROKEN_BAD_EXCEPTION_CLASS
|
williamr@4
|
54 |
# if defined (_STLP_NO_NEW_NEW_HEADER)
|
williamr@4
|
55 |
# include _STLP_NATIVE_CPP_RUNTIME_HEADER(Exception.h)
|
williamr@4
|
56 |
# else
|
williamr@4
|
57 |
# include _STLP_NATIVE_CPP_RUNTIME_HEADER(Exception)
|
williamr@4
|
58 |
# endif
|
williamr@4
|
59 |
# undef exception
|
williamr@4
|
60 |
# undef bad_exception
|
williamr@4
|
61 |
# else
|
williamr@4
|
62 |
|
williamr@4
|
63 |
#ifndef _STLP_NO_NEW_NEW_HEADER
|
williamr@4
|
64 |
#define _STLP_NO_NEW_NEW_HEADER
|
williamr@4
|
65 |
#endif
|
williamr@4
|
66 |
|
williamr@4
|
67 |
# if defined (_STLP_NO_NEW_NEW_HEADER)
|
williamr@4
|
68 |
# include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception.h)
|
williamr@4
|
69 |
# else
|
williamr@4
|
70 |
# include _STLP_NATIVE_CPP_RUNTIME_HEADER(exception)
|
williamr@4
|
71 |
# endif
|
williamr@4
|
72 |
|
williamr@4
|
73 |
# endif
|
williamr@4
|
74 |
|
williamr@4
|
75 |
# if defined (_STLP_MSVC) || defined (__ICL)
|
williamr@4
|
76 |
// dwa 02/04/00 - here I'm assuming that __ICL uses the same library headers as vc6.
|
williamr@4
|
77 |
// the header <yvals.h> which ships with vc6 and is included by its native <exception>
|
williamr@4
|
78 |
// actually turns on warnings, so we have to turn them back off.
|
williamr@4
|
79 |
# include <config/_msvc_warnings_off.h>
|
williamr@4
|
80 |
# endif
|
williamr@4
|
81 |
|
williamr@4
|
82 |
|
williamr@4
|
83 |
# ifdef _STLP_USE_OWN_NAMESPACE
|
williamr@4
|
84 |
|
williamr@4
|
85 |
_STLP_BEGIN_NAMESPACE
|
williamr@4
|
86 |
|
williamr@4
|
87 |
#if !defined(_STLP_BROKEN_EXCEPTION_CLASS)
|
williamr@4
|
88 |
using _STLP_VENDOR_EXCEPT_STD::exception;
|
williamr@4
|
89 |
using _STLP_VENDOR_EXCEPT_STD::bad_exception;
|
williamr@4
|
90 |
#endif
|
williamr@4
|
91 |
|
williamr@4
|
92 |
# if ! defined (_STLP_NO_USING_FOR_GLOBAL_FUNCTIONS)
|
williamr@4
|
93 |
|
williamr@4
|
94 |
// fbp : many platforms present strange mix of
|
williamr@4
|
95 |
// those in various namespaces
|
williamr@4
|
96 |
# if !defined(_STLP_VENDOR_UNEXPECTED_STD)
|
williamr@4
|
97 |
# define _STLP_VENDOR_UNEXPECTED_STD _STLP_VENDOR_EXCEPT_STD
|
williamr@4
|
98 |
# endif
|
williamr@4
|
99 |
|
williamr@4
|
100 |
// weird errors
|
williamr@4
|
101 |
# if (! defined (__BORLANDC__)) || (defined (__STD_EXCEPTION) && defined (__RWSTD_EXCEPTION_SEEN) && defined ( _STLP_DONT_POP_0x423))
|
williamr@4
|
102 |
using _STLP_VENDOR_UNEXPECTED_STD::unexpected;
|
williamr@4
|
103 |
using _STLP_VENDOR_UNEXPECTED_STD::unexpected_handler;
|
williamr@4
|
104 |
using _STLP_VENDOR_UNEXPECTED_STD::set_unexpected;
|
williamr@4
|
105 |
using _STLP_VENDOR_UNEXPECTED_STD::terminate;
|
williamr@4
|
106 |
using _STLP_VENDOR_UNEXPECTED_STD::terminate_handler;
|
williamr@4
|
107 |
using _STLP_VENDOR_UNEXPECTED_STD::set_terminate;
|
williamr@4
|
108 |
# endif
|
williamr@4
|
109 |
|
williamr@4
|
110 |
# if !defined (_STLP_INCOMPLETE_EXCEPTION_HEADER)
|
williamr@4
|
111 |
using _STLP_VENDOR_UNEXPECTED_STD::uncaught_exception;
|
williamr@4
|
112 |
# endif
|
williamr@4
|
113 |
|
williamr@4
|
114 |
# endif
|
williamr@4
|
115 |
|
williamr@4
|
116 |
_STLP_END_NAMESPACE
|
williamr@4
|
117 |
|
williamr@4
|
118 |
# endif /* _STLP_OWN_NAMESPACE */
|
williamr@4
|
119 |
|
williamr@4
|
120 |
#else /* _STLP_NO_EXCEPTION_HEADER */
|
williamr@4
|
121 |
|
williamr@4
|
122 |
// fbp : absence of <exception> usually means that those
|
williamr@4
|
123 |
// functions are not going to be called by compiler.
|
williamr@4
|
124 |
// Still, define them for the user.
|
williamr@4
|
125 |
#ifdef __SYMBIAN32__
|
williamr@4
|
126 |
_STLP_BEGIN_NAMESPACE
|
williamr@4
|
127 |
#endif //__SYMBIAN32__
|
williamr@4
|
128 |
typedef void (*unexpected_handler)();
|
williamr@4
|
129 |
unexpected_handler set_unexpected(unexpected_handler f) _STLP_NOTHROW_INHERENTLY;
|
williamr@4
|
130 |
void unexpected();
|
williamr@4
|
131 |
|
williamr@4
|
132 |
typedef void (*terminate_handler)();
|
williamr@4
|
133 |
terminate_handler set_terminate(terminate_handler f) _STLP_NOTHROW_INHERENTLY;
|
williamr@4
|
134 |
void terminate();
|
williamr@4
|
135 |
|
williamr@4
|
136 |
bool uncaught_exception(); // not implemented under mpw as of Jan/1999
|
williamr@4
|
137 |
|
williamr@4
|
138 |
#ifdef __SYMBIAN32__
|
williamr@4
|
139 |
_STLP_END_NAMESPACE
|
williamr@4
|
140 |
#endif //__SYMBIAN32__
|
williamr@4
|
141 |
|
williamr@4
|
142 |
#endif /* _STLP_NO_EXCEPTION_HEADER */
|
williamr@4
|
143 |
|
williamr@4
|
144 |
# if defined (_STLP_NO_EXCEPTION_HEADER) || defined(_STLP_BROKEN_EXCEPTION_CLASS)
|
williamr@4
|
145 |
# ifndef _STLP_EXCEPTION_H
|
williamr@4
|
146 |
# define _STLP_EXCEPTION_H
|
williamr@4
|
147 |
|
williamr@4
|
148 |
_STLP_BEGIN_NAMESPACE
|
williamr@4
|
149 |
|
williamr@4
|
150 |
// section 18.6.1
|
williamr@4
|
151 |
#ifdef __SYMBIAN32__
|
williamr@4
|
152 |
class exception
|
williamr@4
|
153 |
#else
|
williamr@4
|
154 |
class _STLP_CLASS_DECLSPEC exception
|
williamr@4
|
155 |
#endif
|
williamr@4
|
156 |
{
|
williamr@4
|
157 |
public:
|
williamr@4
|
158 |
# ifdef _STLP_OWN_IOSTREAMS
|
williamr@4
|
159 |
IMPORT_C exception() _STLP_NOTHROW;
|
williamr@4
|
160 |
IMPORT_C virtual ~exception() _STLP_NOTHROW;
|
williamr@4
|
161 |
IMPORT_C virtual const char* what() const _STLP_NOTHROW;
|
williamr@4
|
162 |
# else
|
williamr@4
|
163 |
exception() _STLP_NOTHROW {}
|
williamr@4
|
164 |
virtual ~exception() _STLP_NOTHROW {}
|
williamr@4
|
165 |
virtual const char* what() const _STLP_NOTHROW {return "class exception";}
|
williamr@4
|
166 |
# endif
|
williamr@4
|
167 |
};
|
williamr@4
|
168 |
|
williamr@4
|
169 |
|
williamr@4
|
170 |
|
williamr@4
|
171 |
// section 18.6.2.1
|
williamr@4
|
172 |
#ifdef __SYMBIAN32__
|
williamr@4
|
173 |
class bad_exception : public exception
|
williamr@4
|
174 |
#else
|
williamr@4
|
175 |
class _STLP_CLASS_DECLSPEC bad_exception : public exception
|
williamr@4
|
176 |
#endif
|
williamr@4
|
177 |
{
|
williamr@4
|
178 |
public:
|
williamr@4
|
179 |
# ifdef _STLP_OWN_IOSTREAMS
|
williamr@4
|
180 |
_STLP_DECLSPEC bad_exception() _STLP_NOTHROW;
|
williamr@4
|
181 |
_STLP_DECLSPEC ~bad_exception() _STLP_NOTHROW;
|
williamr@4
|
182 |
_STLP_DECLSPEC const char* what() const _STLP_NOTHROW;
|
williamr@4
|
183 |
# else
|
williamr@4
|
184 |
bad_exception() _STLP_NOTHROW {}
|
williamr@4
|
185 |
~bad_exception() _STLP_NOTHROW {}
|
williamr@4
|
186 |
const char* what() const _STLP_NOTHROW {return "class bad_exception";}
|
williamr@4
|
187 |
# endif
|
williamr@4
|
188 |
};
|
williamr@4
|
189 |
|
williamr@4
|
190 |
#ifdef __SYMBIAN32__
|
williamr@4
|
191 |
// Give forward declaration, this should be supported by the stdard libraries from platform vendor.
|
williamr@4
|
192 |
typedef void (*unexpected_handler)();
|
williamr@4
|
193 |
_STLP_DECLSPEC unexpected_handler set_unexpected(unexpected_handler f) _STLP_NOTHROW_INHERENTLY;
|
williamr@4
|
194 |
_STLP_DECLSPEC void unexpected();
|
williamr@4
|
195 |
|
williamr@4
|
196 |
typedef void (*terminate_handler)();
|
williamr@4
|
197 |
_STLP_DECLSPEC terminate_handler set_terminate(terminate_handler f) _STLP_NOTHROW_INHERENTLY;
|
williamr@4
|
198 |
_STLP_DECLSPEC void terminate();
|
williamr@4
|
199 |
|
williamr@4
|
200 |
_STLP_DECLSPEC bool uncaught_exception(); // not implemented under mpw as of Jan/1999
|
williamr@4
|
201 |
|
williamr@4
|
202 |
#endif
|
williamr@4
|
203 |
_STLP_END_NAMESPACE
|
williamr@4
|
204 |
|
williamr@4
|
205 |
#endif /* _STLP_NO_EXCEPTION_HEADER */
|
williamr@4
|
206 |
|
williamr@4
|
207 |
_STLP_BEGIN_NAMESPACE
|
williamr@4
|
208 |
// forward declaration
|
williamr@4
|
209 |
class __Named_exception;
|
williamr@4
|
210 |
_STLP_END_NAMESPACE
|
williamr@4
|
211 |
#endif /* _STLP_EXCEPTION_H */
|
williamr@4
|
212 |
|
williamr@4
|
213 |
#endif //_STLP_EXCEPTION
|
williamr@4
|
214 |
|
williamr@4
|
215 |
# if (_STLP_OUTERMOST_HEADER_ID == 0x423)
|
williamr@4
|
216 |
# if ! defined (_STLP_DONT_POP_0x423)
|
williamr@4
|
217 |
# include <stl/_epilog.h>
|
williamr@4
|
218 |
# undef _STLP_OUTERMOST_HEADER_ID
|
williamr@4
|
219 |
# endif
|
williamr@4
|
220 |
# undef _STLP_DONT_POP_0x423
|
williamr@4
|
221 |
# endif
|
williamr@4
|
222 |
|
williamr@4
|
223 |
|
williamr@4
|
224 |
// Local Variables:
|
williamr@4
|
225 |
// mode:C++
|
williamr@4
|
226 |
// End:
|
williamr@4
|
227 |
|
williamr@4
|
228 |
|
williamr@4
|
229 |
|