--- a/SignalSet.st Thu Nov 23 11:48:27 1995 +0100
+++ b/SignalSet.st Thu Nov 23 12:08:17 1995 +0100
@@ -33,10 +33,6 @@
"
!
-version
- ^ '$Header: /cvs/stx/stx/libbasic/SignalSet.st,v 1.15 1995-11-11 15:26:54 cg Exp $'
-!
-
documentation
"
SignalSet allows catching of multiple signals. A SignalSet consists of
@@ -56,6 +52,10 @@
Use signalSets if totally unrelated signals should be handled by one common
handler.
"
+!
+
+version
+ ^ '$Header: /cvs/stx/stx/libbasic/SignalSet.st,v 1.16 1995-11-23 11:08:17 cg Exp $'
! !
!SignalSet class methodsFor:'instance creation'!
@@ -70,8 +70,51 @@
^ SetOfAnySignal
! !
+!SignalSet methodsFor:'queries'!
+
+accepts:aSignal
+ "return true, if the receiver accepts the argument, aSignal.
+ (i.e. if any of the receivers elements is aSignal or a parent of it).
+ False otherwise. The special anySet accepts any (non-query) signal."
+
+ (self == SetOfAnySignal) ifTrue:[^ aSignal isQuerySignal not].
+ self do:[:sig | (sig accepts:aSignal) ifTrue:[^ true]].
+ ^ false
+!
+
+includes:aSignal
+ "return true, if the receiver contains the argument, aSignal.
+ The special any-Set includes every (non-query) signal."
+
+ (self == SetOfAnySignal) ifTrue:[
+ ^ (aSignal isSignal and:[aSignal isQuerySignal not])
+ ].
+ ^ super includes:aSignal
+! !
+
!SignalSet methodsFor:'save evaluation'!
+catch:aBlock
+ "evaluate the argument, aBlock.
+ If any of the signals in the receiver is raised during evaluation,
+ abort the evaluation and return true; otherwise return false.
+ With the special anySignal, evaluation can be performed totally save
+ from signals
+ - but who (beside radical c++ fans) would do that ?"
+
+ |raiseOccurred|
+
+ raiseOccurred := false.
+ self handle:[:ex | raiseOccurred := true. ex return] do:aBlock.
+ ^ raiseOccurred
+
+ "
+ SignalSet anySignal catch:[
+ (#(1 2 3 4) at:5) / 0.0
+ ]
+ "
+!
+
handle:handleBlock do:aBlock
"evaluate the argument, aBlock.
If any of the signals in the receiver is raised during evaluation,
@@ -106,27 +149,6 @@
^ aBlock value "the real logic is in raise/Exception"
!
-catch:aBlock
- "evaluate the argument, aBlock.
- If any of the signals in the receiver is raised during evaluation,
- abort the evaluation and return true; otherwise return false.
- With the special anySignal, evaluation can be performed totally save
- from signals
- - but who (beside radical c++ fans) would do that ?"
-
- |raiseOccurred|
-
- raiseOccurred := false.
- self handle:[:ex | raiseOccurred := true. ex return] do:aBlock.
- ^ raiseOccurred
-
- "
- SignalSet anySignal catch:[
- (#(1 2 3 4) at:5) / 0.0
- ]
- "
-!
-
ignore:aBlock
"evaluate the argument, aBlock.
Ignore the receiver-signal during evaluation - i.e. simply
@@ -143,24 +165,3 @@
"
! !
-!SignalSet methodsFor:'queries'!
-
-accepts:aSignal
- "return true, if the receiver accepts the argument, aSignal.
- (i.e. if any of the receivers elements is aSignal or a parent of it).
- False otherwise. The special anySet accepts any (non-query) signal."
-
- (self == SetOfAnySignal) ifTrue:[^ aSignal isQuerySignal not].
- self do:[:sig | (sig accepts:aSignal) ifTrue:[^ true]].
- ^ false
-!
-
-includes:aSignal
- "return true, if the receiver contains the argument, aSignal.
- The special any-Set includes every (non-query) signal."
-
- (self == SetOfAnySignal) ifTrue:[
- ^ (aSignal isSignal and:[aSignal isQuerySignal not])
- ].
- ^ super includes:aSignal
-! !