author | Claus Gittinger <cg@exept.de> |
Mon, 02 Aug 1999 10:57:32 +0200 | |
changeset 4486 | f84def7aaf3f |
parent 4476 | 696ac99f2a52 |
child 4491 | 5041cae5651c |
permissions | -rw-r--r-- |
1 | 1 |
" |
2 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
159 | 3 |
All Rights Reserved |
1 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
13 |
Object subclass:#Signal |
|
1249 | 14 |
instanceVariableNames:'mayProceed notifierString nameClass message handlerBlock parent' |
4438 | 15 |
classVariableNames:'NoHandlerSignal GenericSignal ProceedErrorSignal |
16 |
WrongProceedabilitySignal' |
|
1249 | 17 |
poolDictionaries:'' |
18 |
category:'Kernel-Exceptions' |
|
1 | 19 |
! |
20 |
||
2207 | 21 |
!Signal class methodsFor:'documentation'! |
44 | 22 |
|
88 | 23 |
copyright |
24 |
" |
|
25 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
159 | 26 |
All Rights Reserved |
88 | 27 |
|
28 |
This software is furnished under a license and may be used |
|
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
35 |
! |
|
36 |
||
44 | 37 |
documentation |
38 |
" |
|
70 | 39 |
Signal and Exception provide a framework for exception handling. |
44 | 40 |
|
70 | 41 |
A Signal object is usually defined somewhere up in the calling chain |
42 |
and associated with some abnormal event. Many signals are also |
|
43 |
created at startup time and reused. |
|
44 | 44 |
|
70 | 45 |
When the event is raised (by Signal>>raise) the control will be either |
46 |
given to a debugger or - if a handler was defined - to the handler. |
|
47 |
The handler will get a description of what (and where) happened in an |
|
120 | 48 |
Exception object and can decide how to react on the situation (i.e. |
49 |
proceed, return or restart). |
|
70 | 50 |
|
51 |
There is also a companion class called SignalSet, which allows handling |
|
52 |
multiple signals with one handler (for example all arithmetic signals). |
|
53 |
And, finally there is a very special SignalSet which allows catching |
|
54 |
any signal (SignalSet>>anySignal). |
|
55 |
||
171 | 56 |
Since there is no official documentation on signal handling (i.e. none |
57 |
of the books describes it), this Signal implementation has been modeled |
|
58 |
after what some PD programs seem to expect and what alpha/beta testers told |
|
59 |
me it should look like. |
|
60 |
It may not be perfect and undergo minor changes. |
|
44 | 61 |
|
120 | 62 |
special: |
63 |
||
70 | 64 |
In addition to the nested catch & throw mechanism, signals can also be |
120 | 65 |
used when no such handler scope exists. To support this, signals can be |
66 |
assigned a handlerBlock, which gets evaluated with the exception as argument |
|
67 |
in case no handler was found (on the stack). |
|
70 | 68 |
|
171 | 69 |
If no handler was found (i.e. neither a handler context on the stack, nor |
70 |
a static handler block), the NoHandlerSignal will be raised instead, |
|
120 | 71 |
passing it the original exception in its exception-parameter. |
171 | 72 |
This NoHandlerSignal can be handled just like any other signal. |
73 |
(therefore, it is possible to catch any error by catching NoHandlerSignal. |
|
70 | 74 |
|
120 | 75 |
When the NoHandler signal is raised, and neither a handler-context, nor |
76 |
a handler block is defined for it, an emergencyHandler(-block) is evaluated. |
|
77 |
This block is either provided by the current process |
|
78 |
(see Process>>emergencySignalHandler) or as a global default by the Exception |
|
79 |
class (see Exception>>emergencyHandler). |
|
80 |
The default emergencyHandlerBlock (from Exception) will bring up a debugger. |
|
81 |
||
82 |
HandlerBlocks allow a global (if its the EmergencyHandler in Exception) |
|
83 |
or per-process signal handling to be added. Even to code which was never |
|
84 |
planned to handle signals. |
|
70 | 85 |
|
171 | 86 |
See samples in 'doc/coding' and actual raise code in Exception. |
1 | 87 |
|
1275 | 88 |
[Instance variables:] |
70 | 89 |
|
3157 | 90 |
mayProceed <Boolean> hint for the debugger - program may |
91 |
proceed (currently not honored by the |
|
92 |
debugger) |
|
1275 | 93 |
|
3157 | 94 |
notifierString <String> error message to be output |
70 | 95 |
|
3157 | 96 |
nameClass <Class> for the printOn-implementation; nameClass |
97 |
is the class, to which message (below) |
|
98 |
should be sent to create the receiver. |
|
1 | 99 |
|
3157 | 100 |
message <Symbol> for the printOn-implementation; message |
101 |
is the selector, which should be sent to |
|
102 |
nameClass (above) to create the receiver. |
|
1 | 103 |
|
3157 | 104 |
handlerBlock <Block> if nonNil, a 1-arg block to be |
105 |
evaluated when no handler context is |
|
106 |
found. The block gets the exception |
|
107 |
object as argument. This will play the role |
|
108 |
of an on-stack handler. |
|
1275 | 109 |
|
110 |
[Class variables:] |
|
70 | 111 |
|
3157 | 112 |
NoHandlerSignal <Signal> signal raised when no handler for a signal |
113 |
was found in raise. |
|
114 |
If this one is not handled either, |
|
115 |
Exceptions emergencyHandler will be evaluated |
|
116 |
instead (or a per-proces handler, if there |
|
117 |
is one). |
|
1292 | 118 |
|
119 |
[author:] |
|
3157 | 120 |
Claus Gittinger |
1292 | 121 |
|
1275 | 122 |
[see also:] |
3157 | 123 |
Exception |
124 |
SignalSet QuerySignal |
|
125 |
Object |
|
126 |
(``Exception handling and signals'': programming/exceptions.html) |
|
44 | 127 |
" |
128 |
! ! |
|
1 | 129 |
|
2207 | 130 |
!Signal class methodsFor:'initialization'! |
1 | 131 |
|
3004
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
132 |
initGenericSignal |
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
133 |
"setup the parent of all signals." |
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
134 |
|
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
135 |
GenericSignal isNil ifTrue:[ |
4438 | 136 |
GenericSignal := self basicNew notifierString: 'unknown Signal with: '. |
137 |
GenericSignal nameClass:self message:#genericSignal. |
|
138 |
GenericSignal mayProceed:true. |
|
3004
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
139 |
]. |
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
140 |
|
4438 | 141 |
"Modified: / 8.10.1997 / 11:58:01 / cg" |
142 |
"Modified: / 27.2.1998 / 14:17:20 / stefan" |
|
3004
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
143 |
! |
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
144 |
|
159 | 145 |
initialize |
44 | 146 |
"setup the signal used to handle unhandled signals" |
147 |
||
3004
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
148 |
GenericSignal isNil ifTrue:[ |
4438 | 149 |
self initGenericSignal. |
3010 | 150 |
]. |
3004
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
151 |
|
3010 | 152 |
NoHandlerSignal isNil ifTrue:[ |
4438 | 153 |
NoHandlerSignal := ErrorSignal newSignal. |
154 |
NoHandlerSignal nameClass:self message:#noHandlerSignal. |
|
155 |
NoHandlerSignal notifierString:'unhandled exception'. |
|
156 |
ProceedErrorSignal := ErrorSignal newSignal. |
|
157 |
ProceedErrorSignal nameClass:self message:#proceedErrorSignal. |
|
158 |
ProceedErrorSignal notifierString:'handler tried to proceed from nonproceedable signal'. |
|
159 |
WrongProceedabilitySignal := ErrorSignal newSignal. |
|
160 |
WrongProceedabilitySignal nameClass:self message:#wrongProceedabilitySignal. |
|
161 |
WrongProceedabilitySignal notifierString:'attempt to raise a nonproceedable signal proceedable'. |
|
61 | 162 |
] |
3004
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
163 |
|
4438 | 164 |
"Modified: / 8.10.1997 / 11:48:40 / cg" |
165 |
"Modified: / 27.2.1998 / 14:17:59 / stefan" |
|
1 | 166 |
! ! |
167 |
||
2207 | 168 |
!Signal class methodsFor:'instance creation'! |
1 | 169 |
|
170 |
new |
|
171 |
"return a new signal" |
|
172 |
||
4438 | 173 |
^ (self basicNew) notifierString:'signal'; mayProceed:true |
3004
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
174 |
|
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
175 |
" |
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
176 |
Signal new |
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
177 |
" |
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
178 |
|
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
179 |
"Modified: 8.10.1997 / 11:51:39 / cg" |
1 | 180 |
! ! |
181 |
||
2207 | 182 |
!Signal class methodsFor:'Signal constants'! |
1 | 183 |
|
3004
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
184 |
genericSignal |
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
185 |
"return the generic signal - thats the parent of all signals |
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
186 |
in the system." |
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
187 |
|
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
188 |
^ GenericSignal |
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
189 |
|
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
190 |
"Created: 8.10.1997 / 11:46:28 / cg" |
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
191 |
"Modified: 8.10.1997 / 11:47:08 / cg" |
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
192 |
! |
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
193 |
|
1 | 194 |
noHandlerSignal |
44 | 195 |
"return the signal used to handle unhandled signals" |
196 |
||
1 | 197 |
^ NoHandlerSignal |
4438 | 198 |
! |
199 |
||
200 |
proceedErrorSignal |
|
201 |
"return the signal used to indicate that a handler tried to |
|
202 |
proceed a signal marked as nonproceedable. |
|
203 |
The parameter for the exception raised by this signal is |
|
204 |
the exception which tried to proceed." |
|
205 |
||
206 |
^ ProceedErrorSignal |
|
207 |
||
208 |
"Modified: / 27.2.1998 / 14:22:13 / stefan" |
|
209 |
"Created: / 27.2.1998 / 14:36:15 / stefan" |
|
210 |
! |
|
211 |
||
212 |
wrongProceedabilitySignal |
|
213 |
"return the signal used to indicate that a signaler wants |
|
214 |
to raise a nonproceedable signal proceedable. |
|
215 |
proceed a signal marked as nonproceedable. |
|
216 |
The parameter for the exception raised by this signal is |
|
217 |
the unproceedable signal." |
|
218 |
||
219 |
^ WrongProceedabilitySignal |
|
220 |
||
221 |
"Created: / 27.2.1998 / 14:24:19 / stefan" |
|
1 | 222 |
! ! |
223 |
||
622 | 224 |
!Signal methodsFor:'accessing'! |
1 | 225 |
|
622 | 226 |
errorString |
4438 | 227 |
"return the notifier string. |
228 |
If the notifier string starts with space, prepend |
|
229 |
the parents notifier string" |
|
230 |
||
231 |
notifierString isNil ifTrue:[ |
|
232 |
^ parent errorString |
|
233 |
] ifFalse:[ |
|
234 |
(notifierString size > 0 |
|
235 |
and:[notifierString first == (Character space)]) ifTrue:[ |
|
236 |
^ parent errorString, notifierString |
|
237 |
] ifFalse:[ |
|
238 |
^ notifierString |
|
239 |
]. |
|
240 |
] |
|
241 |
||
242 |
" |
|
243 |
Object errorSignal errorString |
|
244 |
" |
|
245 |
||
246 |
"Modified: / 12.3.1998 / 15:04:41 / stefan" |
|
247 |
! |
|
248 |
||
249 |
errorStringExtra:extraString with:aParameter |
|
250 |
"used when raising with a given error string and/or parameter; |
|
251 |
if the errorString starts with a space, it is appended to the receivers |
|
252 |
notifier string; if it ends with a space, it is prepended. |
|
253 |
Otherwise, the extraString is returned. |
|
254 |
If no extraString is given, use the signals default errorString." |
|
255 |
||
256 |
|t| |
|
1 | 257 |
|
4438 | 258 |
(self inheritsFrom:Object userNotificationSignal) ifTrue:[ |
259 |
"/ all userNotifications pass the extraString unchanged. |
|
260 |
^ extraString |
|
261 |
]. |
|
262 |
||
263 |
extraString isNil ifTrue:[ |
|
264 |
t := self errorString |
|
265 |
] ifFalse:[ |
|
266 |
t := extraString. |
|
267 |
(extraString endsWith:Character space) ifTrue:[ |
|
268 |
t := extraString, self errorString |
|
269 |
] ifFalse:[ |
|
270 |
(extraString startsWith:Character space) ifTrue:[ |
|
271 |
t := self errorString, extraString |
|
272 |
] |
|
273 |
]. |
|
274 |
]. |
|
275 |
^ t. |
|
276 |
||
277 |
"/ aParameter isNil ifTrue:[ |
|
278 |
"/ ^ t |
|
279 |
"/ ]. |
|
280 |
"/ |
|
281 |
"/ (t startsWith:' ') ifTrue:[ |
|
282 |
"/ ^ aParameter printString , t |
|
283 |
"/ ]. |
|
284 |
"/ (t endsWith:' ') ifTrue:[ |
|
285 |
"/ ^ t , aParameter printString |
|
286 |
"/ ]. |
|
287 |
"/ ^ t |
|
288 |
||
289 |
"Modified: / 25.3.1997 / 12:12:37 / cg" |
|
290 |
"Created: / 12.3.1998 / 15:11:31 / stefan" |
|
622 | 291 |
! |
159 | 292 |
|
622 | 293 |
handlerBlock |
294 |
"return the handlerblock - if non-nil, this will be evaluated with the exception |
|
295 |
object as argument, if no #handle:do: context was found on the stack." |
|
296 |
||
297 |
^ handlerBlock |
|
1 | 298 |
! |
299 |
||
622 | 300 |
handlerBlock:aOneArgBlock |
301 |
"set the handlerblock - this will be evaluated with the exception |
|
302 |
object as argument, if no #handle:do: context was found on the stack." |
|
159 | 303 |
|
622 | 304 |
handlerBlock := aOneArgBlock |
305 |
! |
|
159 | 306 |
|
622 | 307 |
mayProceed |
308 |
"return the signals ability to proceed. |
|
309 |
This flag is (currently) not checked by the system; |
|
310 |
be prepared for changes here, to eventually have nonProceedable |
|
311 |
signals refuse to let you continue execution." |
|
1 | 312 |
|
622 | 313 |
^ mayProceed |
1 | 314 |
! |
315 |
||
316 |
mayProceed:aBoolean |
|
44 | 317 |
"set/clear the signals ability to proceed. |
419 | 318 |
This flag is (currently) not checked by the system; |
319 |
be prepared for changes here, to eventually have nonProceedable |
|
320 |
signals refuse to let you continue execution." |
|
1 | 321 |
|
322 |
mayProceed := aBoolean |
|
323 |
! |
|
324 |
||
622 | 325 |
nameClass:aClass message:aSelector |
326 |
"this sets the class & selector of a method which returns |
|
327 |
that signal - this is simply for documentation purposes - |
|
328 |
see Signal>>printOn: implementation. |
|
329 |
(took me a while to find that one out ;-)" |
|
419 | 330 |
|
622 | 331 |
nameClass := aClass. |
332 |
message := aSelector |
|
419 | 333 |
! |
334 |
||
622 | 335 |
notifierString |
336 |
"return the notifier string" |
|
159 | 337 |
|
622 | 338 |
^ notifierString |
339 |
! |
|
340 |
||
341 |
notifierString:aString |
|
342 |
"set the notifier string" |
|
343 |
||
344 |
notifierString := aString |
|
159 | 345 |
! |
346 |
||
347 |
parent |
|
348 |
"return the parent-signal of the receiver" |
|
349 |
||
350 |
^ parent |
|
351 |
! |
|
352 |
||
622 | 353 |
parent:aSignal |
354 |
"set the parent-signal of the receiver." |
|
355 |
||
356 |
parent := aSignal |
|
3004
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
357 |
! |
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
358 |
|
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
359 |
parent:aSignal mayProceed:aBoolean |
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
360 |
"set the parent-signal and the mayProceed flag of the receiver." |
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
361 |
|
3010 | 362 |
parent := aSignal. |
363 |
mayProceed := aBoolean. |
|
3004
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
364 |
|
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
365 |
"Modified: 8.10.1997 / 11:56:11 / cg" |
622 | 366 |
! ! |
367 |
||
368 |
!Signal methodsFor:'copying'! |
|
369 |
||
3348
37b0481be091
must catch #deppCopyUsing: instead of #deepCopy.
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
370 |
deepCopyUsing:aDictionary |
622 | 371 |
"raise an error - deepCopy is not allowed for signals" |
1 | 372 |
|
622 | 373 |
^ self deepCopyError |
3348
37b0481be091
must catch #deppCopyUsing: instead of #deepCopy.
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
374 |
|
37b0481be091
must catch #deppCopyUsing: instead of #deepCopy.
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
375 |
"Created: / 31.3.1998 / 15:43:01 / cg" |
622 | 376 |
! ! |
377 |
||
378 |
!Signal methodsFor:'instance creation'! |
|
1 | 379 |
|
622 | 380 |
newSignal |
381 |
"create a new signal, using the receiver as a prototype and |
|
382 |
setting the parent of the new signal to the receiver." |
|
1 | 383 |
|
3010 | 384 |
^ (self copy) parent:self |
3004
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
385 |
|
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
386 |
"Modified: 8.10.1997 / 11:53:06 / cg" |
70 | 387 |
! |
388 |
||
622 | 389 |
newSignalMayProceed:aBoolean |
390 |
"create a new signal, using the receiver as a prototype and |
|
391 |
setting the parent of the new signal to the receiver." |
|
362 | 392 |
|
3010 | 393 |
^ (self copy) parent:self mayProceed:aBoolean |
70 | 394 |
|
3004
220af5090ec2
added the genericSignal for PP compatiblity
Claus Gittinger <cg@exept.de>
parents:
2893
diff
changeset
|
395 |
"Modified: 8.10.1997 / 11:57:13 / cg" |
1 | 396 |
! ! |
397 |
||
159 | 398 |
!Signal methodsFor:'printing'! |
399 |
||
400 |
printOn:aStream |
|
401 |
"append a printed representation of the receiver on aStream" |
|
402 |
||
403 |
nameClass notNil ifTrue:[ |
|
404 |
aStream nextPutAll:nameClass name. |
|
405 |
aStream space. |
|
406 |
aStream nextPutAll:message. |
|
407 |
^ self |
|
408 |
]. |
|
409 |
^ super printOn:aStream |
|
410 |
! ! |
|
411 |
||
622 | 412 |
!Signal methodsFor:'queries'! |
413 |
||
414 |
accepts:aSignal |
|
415 |
"return true, if the receiver accepts the argument, aSignal. |
|
416 |
(i.e. the receiver is aSignal or a parent of it). False otherwise." |
|
417 |
||
418 |
|s| |
|
419 |
||
420 |
aSignal isQuerySignal ifTrue:[^ false]. |
|
421 |
||
422 |
s := aSignal. |
|
423 |
[s notNil] whileTrue:[ |
|
4438 | 424 |
self == s ifTrue:[^ true]. |
425 |
s := s parent |
|
622 | 426 |
]. |
427 |
^ false |
|
4438 | 428 |
|
429 |
"Modified: / 22.3.1999 / 12:45:42 / stefan" |
|
622 | 430 |
! |
431 |
||
4464
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
432 |
handlerForSignal:signal context:theContext originator:originator |
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
433 |
"answer the handler block for the signal from originator. |
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
434 |
The block is retrieved from aContext. |
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
435 |
Answer nil if the signal is not handled" |
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
436 |
|
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
437 |
|
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
438 |
(theContext selector ~~ #'handle:from:do:' |
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
439 |
or:[(theContext argAt:2) == originator]) ifTrue:[ |
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
440 |
(self accepts:signal) ifTrue:[ |
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
441 |
^ theContext argAt:1 |
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
442 |
] |
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
443 |
]. |
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
444 |
|
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
445 |
^ nil |
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
446 |
|
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
447 |
"Created: / 25.7.1999 / 19:55:43 / stefan" |
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
448 |
! |
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
449 |
|
4476 | 450 |
handlingExceptionInContext:theContext |
4473
793078981f01
added #handlingSignalInContext:
Claus Gittinger <cg@exept.de>
parents:
4466
diff
changeset
|
451 |
"answer the handling signal from aContext." |
793078981f01
added #handlingSignalInContext:
Claus Gittinger <cg@exept.de>
parents:
4466
diff
changeset
|
452 |
|
793078981f01
added #handlingSignalInContext:
Claus Gittinger <cg@exept.de>
parents:
4466
diff
changeset
|
453 |
^ self |
793078981f01
added #handlingSignalInContext:
Claus Gittinger <cg@exept.de>
parents:
4466
diff
changeset
|
454 |
! |
793078981f01
added #handlingSignalInContext:
Claus Gittinger <cg@exept.de>
parents:
4466
diff
changeset
|
455 |
|
622 | 456 |
inheritsFrom:anotherSignal |
457 |
"return true, if the receiver is a child of anotherSignal |
|
458 |
(i.e. if handling anotherSignal also handles the receiver) |
|
459 |
This is almost the same as accepts, but returns false, if |
|
460 |
the receiver is identical to anotherSignal." |
|
461 |
||
462 |
self == anotherSignal ifTrue:[^ false]. |
|
463 |
^ anotherSignal accepts:self |
|
3521
4d83701cfc28
care for nil receiver in #isHandledIn:
Claus Gittinger <cg@exept.de>
parents:
3348
diff
changeset
|
464 |
|
4d83701cfc28
care for nil receiver in #isHandledIn:
Claus Gittinger <cg@exept.de>
parents:
3348
diff
changeset
|
465 |
"Modified: / 6.6.1998 / 20:37:47 / cg" |
622 | 466 |
! |
467 |
||
468 |
isHandled |
|
469 |
"return true, if there is a handler for the receiver signal. |
|
470 |
Raising an unhandled signal will usually lead into the debugger, |
|
2689 | 471 |
but can be caught globally by setting Exceptions EmergencyHandler." |
622 | 472 |
|
473 |
^ self isHandledIn:(thisContext sender). |
|
474 |
! |
|
475 |
||
476 |
isHandledIn:aContext |
|
477 |
"return true, if there is a handler for the receiver signal in the |
|
478 |
contextChain starting with aContext." |
|
479 |
||
3521
4d83701cfc28
care for nil receiver in #isHandledIn:
Claus Gittinger <cg@exept.de>
parents:
3348
diff
changeset
|
480 |
|con r| |
622 | 481 |
|
482 |
con := aContext. |
|
483 |
[con notNil] whileTrue:[ |
|
4464
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
484 |
con := con findSpecialHandle:true raise:false. |
3521
4d83701cfc28
care for nil receiver in #isHandledIn:
Claus Gittinger <cg@exept.de>
parents:
3348
diff
changeset
|
485 |
con notNil ifTrue:[ |
4d83701cfc28
care for nil receiver in #isHandledIn:
Claus Gittinger <cg@exept.de>
parents:
3348
diff
changeset
|
486 |
((r := con receiver) notNil |
4464
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
487 |
and:[(r handlerForSignal:self context:con originator:nil) notNil] |
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
488 |
) ifTrue:[ |
3521
4d83701cfc28
care for nil receiver in #isHandledIn:
Claus Gittinger <cg@exept.de>
parents:
3348
diff
changeset
|
489 |
"found a handler context" |
4d83701cfc28
care for nil receiver in #isHandledIn:
Claus Gittinger <cg@exept.de>
parents:
3348
diff
changeset
|
490 |
^ true |
4d83701cfc28
care for nil receiver in #isHandledIn:
Claus Gittinger <cg@exept.de>
parents:
3348
diff
changeset
|
491 |
] |
4d83701cfc28
care for nil receiver in #isHandledIn:
Claus Gittinger <cg@exept.de>
parents:
3348
diff
changeset
|
492 |
] |
622 | 493 |
]. |
494 |
^ false |
|
2207 | 495 |
|
4464
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
496 |
"Created: / 23.7.1999 / 14:03:34 / stefan" |
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
497 |
"Modified: / 26.7.1999 / 15:24:34 / stefan" |
622 | 498 |
! |
499 |
||
500 |
isQuerySignal |
|
1249 | 501 |
"return true, if this is a querySignal - always return false here" |
502 |
||
622 | 503 |
^ false |
1249 | 504 |
|
505 |
"Modified: 22.4.1996 / 13:45:06 / cg" |
|
622 | 506 |
! |
507 |
||
508 |
isSignal |
|
509 |
"return true, if the receiver is some kind of signal; |
|
510 |
true returned here - the method is redefined from Object." |
|
511 |
||
512 |
^ true |
|
513 |
! ! |
|
514 |
||
515 |
!Signal methodsFor:'raising'! |
|
516 |
||
4438 | 517 |
newException |
518 |
"answer a new exception object for this signal. |
|
519 |
Subclasses may redefine this method" |
|
520 |
||
4440 | 521 |
^ Exception signal:self originator:nil |
4438 | 522 |
|
523 |
"Created: / 26.2.1998 / 19:53:56 / stefan" |
|
4440 | 524 |
"Modified: / 23.7.1999 / 13:41:00 / stefan" |
4438 | 525 |
! |
526 |
||
527 |
newExceptionFrom:originator |
|
528 |
"answer a new exception object for this signal. |
|
529 |
Set the originator. |
|
530 |
Subclasses may redefine this method" |
|
531 |
||
4440 | 532 |
^ Exception signal:self originator:originator |
4438 | 533 |
|
534 |
"Created: / 27.2.1998 / 09:17:00 / stefan" |
|
4440 | 535 |
"Modified: / 23.7.1999 / 13:41:15 / stefan" |
4438 | 536 |
! |
537 |
||
622 | 538 |
raise |
4438 | 539 |
"raise a signal nonproceedable. |
622 | 540 |
The signals notifierString is used as errorString." |
541 |
||
4438 | 542 |
^ self newException raise |
1326 | 543 |
|
4438 | 544 |
"Modified: / 2.5.1996 / 16:36:23 / cg" |
545 |
"Modified: / 5.3.1998 / 16:44:36 / stefan" |
|
622 | 546 |
! |
547 |
||
548 |
raiseErrorString:aString |
|
1326 | 549 |
"raise a signal nonproceedable. |
622 | 550 |
The argument is used as errorString." |
551 |
||
4438 | 552 |
^ (self newException errorString:aString) raise. |
1326 | 553 |
|
4438 | 554 |
"Modified: / 9.5.1996 / 15:17:59 / cg" |
555 |
"Modified: / 12.3.1998 / 15:15:22 / stefan" |
|
622 | 556 |
! |
557 |
||
1610 | 558 |
raiseErrorString:aString in:aContext |
559 |
"raise a signal nonproceedable. |
|
560 |
The argument is used as errorString. |
|
561 |
The additional context is passed as the context responsible for the raise, |
|
562 |
allowing a raise to mimicri the exception happened somewhere else." |
|
563 |
||
4438 | 564 |
^ (self newException |
565 |
signal:self |
|
566 |
parameter:nil |
|
567 |
errorString:aString |
|
568 |
suspendedContext:aContext |
|
569 |
originator:nil) raise. |
|
1610 | 570 |
|
4438 | 571 |
"Created: / 26.7.1996 / 16:42:32 / cg" |
572 |
"Modified: / 26.7.1996 / 16:42:47 / cg" |
|
573 |
"Modified: / 12.3.1998 / 15:43:43 / stefan" |
|
1610 | 574 |
! |
575 |
||
622 | 576 |
raiseFrom:something |
1326 | 577 |
"raise a signal nonproceedable. |
4438 | 578 |
The argument, something is passed both as parameter and originator." |
622 | 579 |
|
4438 | 580 |
^ ((self newExceptionFrom:something) parameter:something) raise |
1326 | 581 |
|
4438 | 582 |
"Modified: / 2.5.1996 / 16:36:38 / cg" |
583 |
"Modified: / 5.3.1998 / 16:49:55 / stefan" |
|
622 | 584 |
! |
585 |
||
586 |
raiseIn:aContext |
|
1326 | 587 |
"raise a signal nonproceedable. |
622 | 588 |
The signals notifierString is used as errorString. |
589 |
The additional context is passed as the context responsible for the raise, |
|
590 |
allowing a raise to mimicri the exception happened somewhere else." |
|
591 |
||
4438 | 592 |
^ (self newException suspendedContext:aContext) raise. |
1326 | 593 |
|
4438 | 594 |
"Modified: / 2.5.1996 / 16:36:44 / cg" |
595 |
"Modified: / 5.3.1998 / 16:50:21 / stefan" |
|
622 | 596 |
! |
597 |
||
598 |
raiseRequest |
|
1326 | 599 |
"raise a signal proceedable. |
622 | 600 |
The signals notifierString is used as errorString." |
601 |
||
4438 | 602 |
^ self newException raiseRequest. |
1326 | 603 |
|
4438 | 604 |
"Modified: / 2.5.1996 / 16:36:52 / cg" |
605 |
"Modified: / 5.3.1998 / 16:50:46 / stefan" |
|
622 | 606 |
! |
607 |
||
3103 | 608 |
raiseRequestFrom:something |
609 |
"raise a signal proceedable. |
|
4438 | 610 |
The argument, something is passed both as parameter and originator." |
3103 | 611 |
|
4438 | 612 |
^ ((self newExceptionFrom:something) parameter:something) raiseRequest. |
3103 | 613 |
|
4438 | 614 |
"Modified: / 2.5.1996 / 16:36:38 / cg" |
615 |
"Modified: / 5.3.1998 / 16:52:46 / stefan" |
|
3103 | 616 |
! |
617 |
||
622 | 618 |
raiseRequestWith:aParameter |
1326 | 619 |
"raise a signal proceedable. |
622 | 620 |
The signals notifierString is used as errorString." |
621 |
||
4438 | 622 |
^ (self newException parameter:aParameter) raiseRequest. |
1326 | 623 |
|
4438 | 624 |
"Modified: / 9.5.1996 / 15:13:20 / cg" |
625 |
"Modified: / 12.3.1998 / 15:16:57 / stefan" |
|
622 | 626 |
! |
627 |
||
628 |
raiseRequestWith:aParameter errorString:aString |
|
1326 | 629 |
"raise a signal proceedable. |
622 | 630 |
The argument, aString is used as errorString." |
631 |
||
4438 | 632 |
^ (self newException |
633 |
parameter:aParameter; |
|
634 |
errorString:aString |
|
635 |
) raiseRequest |
|
1326 | 636 |
|
4438 | 637 |
"Modified: / 9.5.1996 / 15:13:35 / cg" |
638 |
"Modified: / 12.3.1998 / 15:17:52 / stefan" |
|
622 | 639 |
! |
640 |
||
641 |
raiseRequestWith:aParameter errorString:aString in:aContext |
|
1326 | 642 |
"raise a signal proceedable. |
622 | 643 |
The argument, aString is used as errorString. |
1608 | 644 |
The additional context is passed as the context responsible for the raise, |
645 |
allowing a raise to mimicri the exception happened somewhere else." |
|
622 | 646 |
|
4438 | 647 |
^ (self newException |
648 |
parameter:aParameter; |
|
649 |
errorString:aString; |
|
650 |
suspendedContext:aContext) raiseRequest |
|
1326 | 651 |
|
4438 | 652 |
"Modified: / 26.7.1996 / 16:29:27 / cg" |
653 |
"Modified: / 12.3.1998 / 15:18:34 / stefan" |
|
622 | 654 |
! |
655 |
||
656 |
raiseRequestWith:aParameter in:aContext |
|
1326 | 657 |
"raise a signal proceedable. |
622 | 658 |
The signals notifierString is used as errorString. |
1608 | 659 |
The additional context is passed as the context responsible for the raise, |
660 |
allowing a raise to mimicri the exception happened somewhere else." |
|
622 | 661 |
|
4438 | 662 |
^ (self newException |
663 |
parameter:aParameter; |
|
664 |
suspendedContext:aContext) raiseRequest. |
|
1326 | 665 |
|
4438 | 666 |
"Modified: / 26.7.1996 / 16:29:33 / cg" |
667 |
"Modified: / 12.3.1998 / 15:18:55 / stefan" |
|
622 | 668 |
! |
669 |
||
670 |
raiseWith:aParameter |
|
1326 | 671 |
"raise a signal nonproceedable. |
4438 | 672 |
The argument, aParameter is passed as parameter." |
622 | 673 |
|
4438 | 674 |
^ (self newException parameter:aParameter) raise. |
1326 | 675 |
|
4438 | 676 |
"Modified: / 9.5.1996 / 15:14:24 / cg" |
677 |
"Modified: / 12.3.1998 / 15:19:11 / stefan" |
|
622 | 678 |
! |
679 |
||
680 |
raiseWith:aParameter errorString:aString |
|
4438 | 681 |
"raise a signal nonproceedable. |
622 | 682 |
The argument, aString is used as errorString, aParameter is passed |
683 |
as exception parameter." |
|
684 |
||
4438 | 685 |
^ (self newException |
686 |
parameter:aParameter; |
|
687 |
errorString:aString) raise. |
|
1326 | 688 |
|
4438 | 689 |
"Modified: / 9.5.1996 / 15:14:32 / cg" |
690 |
"Modified: / 12.3.1998 / 15:19:40 / stefan" |
|
1326 | 691 |
! |
692 |
||
693 |
raiseWith:aParameter errorString:aString in:aContext |
|
4438 | 694 |
"raise a signal nonproceedable. |
1326 | 695 |
The argument, aString is used as errorString, aParameter is passed |
1608 | 696 |
as exception parameter. |
697 |
The additional context is passed as the context responsible for the raise, |
|
698 |
allowing a raise to mimicri the exception happened somewhere else." |
|
699 |
||
1326 | 700 |
|
4438 | 701 |
^ (self newException |
702 |
parameter:aParameter; |
|
703 |
errorString:aString; |
|
704 |
suspendedContext:aContext) raise. |
|
1326 | 705 |
|
4438 | 706 |
"Created: / 2.5.1996 / 16:37:25 / cg" |
707 |
"Modified: / 26.7.1996 / 16:29:42 / cg" |
|
708 |
"Modified: / 12.3.1998 / 15:20:12 / stefan" |
|
3157 | 709 |
! |
710 |
||
711 |
raiseWith:aParameter in:aContext |
|
712 |
"raise a signal nonproceedable. |
|
4438 | 713 |
The argument, aParameter is passed as parameter." |
3157 | 714 |
|
4438 | 715 |
^ (self newException parameter:aParameter; |
716 |
suspendedContext:aContext) raise. |
|
3157 | 717 |
|
718 |
"Modified: / 9.5.1996 / 15:14:24 / cg" |
|
719 |
"Created: / 4.1.1998 / 14:38:15 / cg" |
|
4438 | 720 |
"Modified: / 12.3.1998 / 15:34:51 / stefan" |
622 | 721 |
! ! |
722 |
||
1 | 723 |
!Signal methodsFor:'save evaluation'! |
724 |
||
622 | 725 |
catch:aBlock |
726 |
"evaluate the argument, aBlock. |
|
727 |
If the receiver-signal is raised during evaluation, abort |
|
728 |
the evaluation and return true; otherwise return false. |
|
729 |
This is the catch & throw mechanism found in other languages, |
|
730 |
where the returned value indicates if an exception occured." |
|
731 |
||
732 |
|raiseOccurred| |
|
733 |
||
734 |
raiseOccurred := false. |
|
735 |
self handle:[:ex | raiseOccurred := true. ex return] do:aBlock. |
|
736 |
^ raiseOccurred |
|
737 |
||
738 |
" |
|
739 |
Object messageNotUnderstoodSignal catch:[ |
|
740 |
123 size open |
|
741 |
] |
|
742 |
" |
|
743 |
! |
|
744 |
||
1 | 745 |
handle:handleBlock do:aBlock |
746 |
"evaluate the argument, aBlock. |
|
747 |
If the receiver-signal is raised during evaluation, |
|
748 |
evaluate the handleBlock passing it an Exception argument. |
|
749 |
The handler may decide how to react to the signal by sending |
|
750 |
a corresponding message to the exception (see there). |
|
751 |
If the signal is not raised, return the value of evaluating |
|
752 |
aBlock." |
|
753 |
||
4464
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
754 |
thisContext markForHandle. |
4438 | 755 |
^ aBlock value "the real logic is in Exception>>doRaise" |
95 | 756 |
|
757 |
" |
|
758 |
Object messageNotUnderstoodSignal handle:[:ex | |
|
4438 | 759 |
'oops' printNL. |
760 |
ex return |
|
95 | 761 |
] do:[ |
4438 | 762 |
123 size open |
95 | 763 |
] |
764 |
" |
|
120 | 765 |
|
95 | 766 |
" |
767 |
|num| |
|
768 |
||
769 |
num := 0. |
|
770 |
Number divisionByZeroSignal handle:[:ex | |
|
4438 | 771 |
'oops' printNL. |
772 |
ex return |
|
95 | 773 |
] do:[ |
4438 | 774 |
123 / num |
95 | 775 |
] |
776 |
" |
|
4438 | 777 |
|
4464
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
778 |
"Modified: / 25.7.1999 / 19:43:01 / stefan" |
44 | 779 |
! |
780 |
||
362 | 781 |
handle:handleBlock from:anObject do:aBlock |
782 |
"evaluate the argument, aBlock. |
|
783 |
If the receiver-signal is raised during evaluation, |
|
784 |
and the exception originated from anObject, |
|
785 |
evaluate the handleBlock passing it an Exception argument. |
|
786 |
The handler may decide how to react to the signal by sending |
|
787 |
a corresponding message to the exception (see there). |
|
788 |
If the signal is not raised, return the value of evaluating |
|
789 |
aBlock." |
|
790 |
||
4464
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
791 |
thisContext markForHandle. |
4438 | 792 |
^ aBlock value "the real logic is in Exception>>doRaise" |
362 | 793 |
|
794 |
" |
|
2689 | 795 |
the first open will be caught; the second not: |
362 | 796 |
|
797 |
|o1 o2| |
|
798 |
||
799 |
o1 := 123. |
|
800 |
o2 := nil. |
|
801 |
Object messageNotUnderstoodSignal |
|
4438 | 802 |
handle: |
803 |
[:ex | |
|
804 |
'oops' printNL. |
|
805 |
ex proceed |
|
806 |
] |
|
807 |
from:o1 |
|
808 |
do: |
|
809 |
[ |
|
810 |
o1 open. |
|
811 |
o2 open |
|
812 |
] |
|
362 | 813 |
" |
4438 | 814 |
|
4464
cec93c942c14
Use context flag for exception handling instead of searching for
Stefan Vogel <sv@exept.de>
parents:
4440
diff
changeset
|
815 |
"Modified: / 25.7.1999 / 19:43:40 / stefan" |
362 | 816 |
! |
817 |
||
419 | 818 |
ignoreIn:aBlock |
159 | 819 |
"evaluate the argument, aBlock. |
820 |
Ignore the receiver-signal during evaluation - i.e. simply |
|
419 | 821 |
continue. |
822 |
This makes only sense for some signals, such as UserInterrupt |
|
823 |
or AbortSignal, because continuing after an exception without any cleanup |
|
824 |
often leads to followup-errors." |
|
159 | 825 |
|
4486
f84def7aaf3f
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
4476
diff
changeset
|
826 |
^ self handle:[:ex | ex proceedWith:nil] do:aBlock. |
159 | 827 |
|
828 |
" |
|
419 | 829 |
Object messageNotUnderstoodSignal ignoreIn:[ |
4486
f84def7aaf3f
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
4476
diff
changeset
|
830 |
123 size open |
61 | 831 |
] |
832 |
" |
|
1 | 833 |
! ! |
834 |
||
2207 | 835 |
!Signal class methodsFor:'documentation'! |
1249 | 836 |
|
837 |
version |
|
4486
f84def7aaf3f
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
4476
diff
changeset
|
838 |
^ '$Header: /cvs/stx/stx/libbasic/Signal.st,v 1.58 1999-08-02 08:57:09 cg Exp $' |
1249 | 839 |
! ! |
622 | 840 |
Signal initialize! |