/[eiffelstudio]/FreeELKS/trunk/library/kernel/exceptions.e
ViewVC logotype

Contents of /FreeELKS/trunk/library/kernel/exceptions.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 91424 - (show annotations)
Tue Oct 26 18:39:32 2004 UTC (15 years, 3 months ago) by manus_eiffel
File size: 6247 byte(s)
Initial revision

1 indexing
2
3 description: "[
4 Facilities for adapting the exception handling mechanism.
5 This class may be used as ancestor by classes needing its facilities.
6 ]"
7
8 status: "See notice at end of class"
9 date: "$Date$"
10 revision: "$Revision$"
11
12 class EXCEPTIONS
13
14 inherit
15
16 EXCEP_CONST
17
18 feature -- Status report
19
20 meaning (except: INTEGER): STRING is
21 -- A message in English describing what `except' is
22 external
23 "C use %"eif_except.h%""
24 alias
25 "eename"
26 end
27
28 assertion_violation: BOOLEAN is
29 -- Is last exception originally due to a violated
30 -- assertion or non-decreasing variant?
31 do
32 Result :=
33 (original_exception = Check_instruction) or else
34 (original_exception = Class_invariant) or else
35 (original_exception = Loop_invariant) or else
36 (original_exception = Loop_variant) or else
37 (original_exception = Postcondition) or else
38 (original_exception = Precondition)
39 end
40
41 is_developer_exception: BOOLEAN is
42 -- Is the last exception originally due to
43 -- a developer exception?
44 do
45 Result := (original_exception = Developer_exception)
46 end
47
48 is_developer_exception_of_name (name: STRING): BOOLEAN is
49 -- Is the last exception originally due to a developer
50 -- exception of name `name'?
51 do
52 Result := is_developer_exception and then
53 equal (name, developer_exception_name)
54 end
55
56 developer_exception_name: STRING is
57 -- Name of last developer-raised exception
58 require
59 applicable: is_developer_exception
60 do
61 Result := original_tag_name
62 end
63
64 is_signal: BOOLEAN is
65 -- Is last exception originally due to an external
66 -- event (operating system signal)?
67 do
68 Result := (original_exception = Signal_exception)
69 end
70
71 is_system_exception: BOOLEAN is
72 -- Is last exception originally due to an
73 -- external event (operating system error)?
74 do
75 Result :=
76 (original_exception = External_exception) or else
77 (original_exception = Operating_system_exception)
78 end
79
80 tag_name: STRING is
81 -- Tag of last violated assertion clause
82 external
83 "C use %"eif_except.h%""
84 alias
85 "eeltag"
86 end
87
88 recipient_name: STRING is
89 -- Name of the routine whose execution was
90 -- interrupted by last exception
91 external
92 "C use %"eif_except.h%""
93 alias
94 "eelrout"
95 end
96
97 class_name: STRING is
98 -- Name of the class that includes the recipient
99 -- of original form of last exception
100 external
101 "C use %"eif_except.h%""
102 alias
103 "eelclass"
104 end
105
106 exception: INTEGER is
107 -- Code of last exception that occurred
108 external
109 "C use %"eif_except.h%""
110 alias
111 "eelcode"
112 end
113
114 exception_trace: STRING is
115 -- String representation of the exception trace
116 external
117 "C use %"eif_except.h%""
118 alias
119 "stack_trace_string"
120 end
121
122 original_tag_name: STRING is
123 -- Assertion tag for original form of last
124 -- assertion violation.
125 external
126 "C use %"eif_except.h%""
127 alias
128 "eeotag"
129 end
130
131 original_exception: INTEGER is
132 -- Original code of last exception that triggered
133 -- current exception
134 external
135 "C use %"eif_except.h%""
136 alias
137 "eeocode"
138 end
139
140 original_recipient_name: STRING is
141 -- Name of the routine whose execution was
142 -- interrupted by original form of last exception
143 external
144 "C use %"eif_except.h%""
145 alias
146 "eeorout"
147 end
148
149 original_class_name: STRING is
150 -- Name of the class that includes the recipient
151 -- of original form of last exception
152 external
153 "C use %"eif_except.h%""
154 alias
155 "eeoclass"
156 end
157
158 feature -- Status setting
159
160 catch (code: INTEGER) is
161 -- Make sure that any exception of code `code' will be
162 -- caught. This is the default.
163 external
164 "C use %"eif_except.h%""
165 alias
166 "eecatch"
167 end
168
169 ignore (code: INTEGER) is
170 -- Make sure that any exception of code `code' will be
171 -- ignored. This is not the default.
172 external
173 "C use %"eif_except.h%""
174 alias
175 "eeignore"
176 end
177
178 raise (name: STRING) is
179 -- Raise a developer exception of name `name'.
180 local
181 str: ANY
182 do
183 if name /= Void then
184 str := name.to_c
185 end
186 exclear
187 eraise ($str, Developer_exception)
188 end
189
190 raise_retrieval_exception (name: STRING) is
191 -- Raise a retrieval exception of name `name'.
192 local
193 str: ANY
194 do
195 if name /= Void then
196 str := name.to_c
197 end
198 exclear
199 eraise ($str, Retrieve_exception)
200 end
201
202 die (code: INTEGER) is
203 -- Terminate execution with exit status `code',
204 -- without triggering an exception.
205 external
206 "C use %"eif_except.h%""
207 alias
208 "esdie"
209 end
210
211 new_die (code: INTEGER) is obsolete "Use ``die''"
212 -- Terminate execution with exit status `code',
213 -- without triggering an exception.
214 external
215 "C use %"eif_except.h%""
216 alias
217 "esdie"
218 end
219
220 message_on_failure is
221 -- Print an exception history table
222 -- in case of failure.
223 -- This is the default.
224 do
225 c_trace_exception (True)
226 end
227
228 no_message_on_failure is
229 -- Do not print an exception history table
230 -- in case of failure.
231 do
232 c_trace_exception (False)
233 end
234
235 feature {NONE} -- Implementation
236
237 exclear is
238 external
239 "C use %"eif_except.h%""
240 end
241
242 eraise (str: POINTER; code: INTEGER) is
243 -- Raise an exception
244 external
245 "C signature (char *, long) use %"eif_except.h%""
246 end
247
248 c_trace_exception (b: BOOLEAN) is
249 external
250 "C use %"eif_except.h%""
251 alias
252 "eetrace"
253 end
254
255 indexing
256
257 library: "[
258 EiffelBase: Library of reusable components for Eiffel.
259 ]"
260
261 status: "[
262 Copyright 1986-2001 Interactive Software Engineering (ISE).
263 For ISE customers the original versions are an ISE product
264 covered by the ISE Eiffel license and support agreements.
265 ]"
266
267 license: "[
268 EiffelBase may now be used by anyone as FREE SOFTWARE to
269 develop any product, public-domain or commercial, without
270 payment to ISE, under the terms of the ISE Free Eiffel Library
271 License (IFELL) at http://eiffel.com/products/base/license.html.
272 ]"
273
274 source: "[
275 Interactive Software Engineering Inc.
276 ISE Building
277 360 Storke Road, Goleta, CA 93117 USA
278 Telephone 805-685-1006, Fax 805-685-6869
279 Electronic mail <info@eiffel.com>
280 Customer support http://support.eiffel.com
281 ]"
282
283 info: "[
284 For latest info see award-winning pages: http://eiffel.com
285 ]"
286
287 end -- class EXCEPTIONS
288
289

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23