|
1 " |
|
2 COPYRIGHT (c) 1993 by Claus Gittinger |
|
3 All Rights Reserved |
|
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 IdentitySet subclass:#SignalSet |
|
14 instanceVariableNames:'special' |
|
15 classVariableNames:'' |
|
16 poolDictionaries:'' |
|
17 category:'Kernel-Exceptions' |
|
18 ! |
|
19 |
|
20 SignalSet comment:' |
|
21 |
|
22 COPYRIGHT (c) 1993 by Claus Gittinger |
|
23 All Rights Reserved |
|
24 |
|
25 SignalSet allows catching of multiple signals. A SignalSet consists of |
|
26 a number of signals and also implements the handle:do: method just as |
|
27 signals do. However, any signal from the SignalSet will, if signalled, lead |
|
28 into the handler. |
|
29 For more detail, see comment in Signal and examples in doc/coding. |
|
30 |
|
31 %W% %E% |
|
32 '! |
|
33 |
|
34 !SignalSet class methodsFor:'instance creation'! |
|
35 |
|
36 anySignal |
|
37 "return a new signalSet catching any signal" |
|
38 |
|
39 ^ self basicNew special:#any |
|
40 ! ! |
|
41 |
|
42 !SignalSet methodsFor:'save evaluation'! |
|
43 |
|
44 handle:handleBlock do:aBlock |
|
45 "evaluate the argument, aBlock. |
|
46 If any of the signals in the receiver is raised during evaluation, |
|
47 evaluate the handleBlock passing it an Exception argument. |
|
48 The handler may decide how to react to the signal by sending |
|
49 a corresponding message to the exception (see there). |
|
50 If the signal is not raised, return the value of evaluating |
|
51 aBlock." |
|
52 |
|
53 ^ aBlock value "the real logic is in raise/Exception" |
|
54 ! ! |
|
55 |
|
56 !SignalSet methodsFor:'queries'! |
|
57 |
|
58 includes:aSignal |
|
59 "return true, if the receiver contains the argument, aSignal. |
|
60 The special any-Set includes every signal." |
|
61 |
|
62 (special == #any) ifTrue:[ |
|
63 ^ aSignal isKindOf:Signal |
|
64 ]. |
|
65 ^ super includes:aSignal |
|
66 ! ! |
|
67 |
|
68 !SignalSet methodsFor:'private'! |
|
69 |
|
70 special:how |
|
71 special := how |
|
72 ! ! |