--- a/Signal.st Tue Aug 22 15:31:49 1995 +0200
+++ b/Signal.st Wed Aug 23 19:50:59 1995 +0200
@@ -22,7 +22,7 @@
COPYRIGHT (c) 1993 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libbasic/Signal.st,v 1.25 1995-08-11 03:03:42 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Signal.st,v 1.26 1995-08-23 17:50:18 claus Exp $
'!
!Signal class methodsFor:'documentation'!
@@ -43,7 +43,7 @@
version
"
-$Header: /cvs/stx/stx/libbasic/Signal.st,v 1.25 1995-08-11 03:03:42 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Signal.st,v 1.26 1995-08-23 17:50:18 claus Exp $
"
!
@@ -372,6 +372,16 @@
!Signal methodsFor:'queries'!
+inheritsFrom:anotherSignal
+ "return true, if the receiver is a child of anotherSignal
+ (i.e. if handling anotherSignal also handles the receiver)
+ This is almost the same as accepts, but returns false, if
+ the receiver is identical to anotherSignal."
+
+ self == anotherSignal ifTrue:[^ false].
+ ^ anotherSignal accepts:self
+!
+
accepts:aSignal
"return true, if the receiver accepts the argument, aSignal.
(i.e. the receiver is aSignal or a parent of it). False otherwise."
@@ -405,11 +415,12 @@
"return true, if there is a handler for the receiver signal in the
contextChain starting with aContext."
- |con|
+ |con sel|
con := aContext.
[con notNil] whileTrue:[
- (con selector == #handle:do:) ifTrue:[
+ (((sel := con selector) == #handle:do:)
+ or:[sel == #handle:from:do:]) ifTrue:[
"
is this is the Signal>>handle:do: context
or a SignalSet>>handle:do: context with self in it ?
@@ -425,6 +436,23 @@
^ false
! !
+!Signal methodsFor:'private'!
+
+errorStringFor:template
+ "used when raising with a given error string; if the given
+ errorString starts with a space, it is appended to the receivers
+ notifier string; if it ends with a space, it is prepended.
+ Otherwise, the errorString is returned."
+
+ (template startsWith:' ') ifTrue:[
+ ^ notifierString , template
+ ].
+ (template endsWith:' ') ifTrue:[
+ ^ template , notifierString
+ ].
+ ^ template
+! !
+
!Signal methodsFor:'raising'!
raise
@@ -447,7 +475,7 @@
^ (Exception
signal:self
parameter:nil
- errorString:aString
+ errorString:(self errorStringFor:aString)
suspendedContext:thisContext sender) raise.
!
@@ -501,7 +529,7 @@
^ (Exception
signal:self
parameter:aParameter
- errorString:aString
+ errorString:(self errorStringFor:aString)
suspendedContext:thisContext sender) raise.
!
@@ -550,7 +578,7 @@
^ (Exception
signal:self
parameter:aParameter
- errorString:aString
+ errorString:(self errorStringFor:aString)
suspendedContext:thisContext sender) raiseRequest
!
@@ -563,6 +591,6 @@
^ (Exception
signal:self
parameter:aParameter
- errorString:aString
+ errorString:(self errorStringFor:aString)
suspendedContext:aContext) raiseRequest
! !