QuerySignal.st
changeset 4464 cec93c942c14
parent 4442 89b7da98c78a
child 4466 9cba6f4ecec4
--- a/QuerySignal.st	Tue Jul 27 16:54:33 1999 +0200
+++ b/QuerySignal.st	Wed Jul 28 09:53:29 1999 +0200
@@ -10,6 +10,8 @@
  hereby transferred.
 "
 
+'From Smalltalk/X, Version:3.5.3 on 26-jul-1999 at 00:02:43'                    !
+
 Signal subclass:#QuerySignal
 	instanceVariableNames:'defaultAnswer hasDefault'
 	classVariableNames:''
@@ -243,7 +245,8 @@
       If the receiver is queried during evaluation, answer with someAnswer.
       This is a wrapper for #handle:do: for lazy typists; no new functionality."
 
-      ^ self handle:[:ex | ex proceedWith:someAnswer] do:aBlock.
+      thisContext markForHandle.
+      aBlock value.
 
       "
        |q|
@@ -270,7 +273,7 @@
 
     "Created: / 10.7.1996 / 15:08:20 / cg"
     "Modified: / 14.10.1996 / 16:59:18 / cg"
-    "Modified: / 2.3.1998 / 10:41:45 / stefan"
+    "Modified: / 25.7.1999 / 23:34:02 / stefan"
 ! !
 
 !QuerySignal methodsFor:'initialization'!
@@ -351,6 +354,27 @@
     "Modified: / 22.3.1999 / 12:45:32 / stefan"
 !
 
+handlerForSignal:signal context:theContext originator:originator
+    "answer the handler block for the signal from originator.
+     The block is retrieved from aContext.
+     Answer nil if the signal is not handled"
+
+    |arg|
+
+    theContext selector == #'answer:do:' ifTrue:[
+        (self accepts:signal) ifTrue:[
+            arg := theContext argAt:1.
+            ^ [:ex| ex proceedWith:arg].
+        ]
+    ] ifFalse:[
+        ^ super handlerForSignal:signal context:theContext originator:originator.
+    ].
+
+    ^ nil
+
+    "Created: / 25.7.1999 / 23:33:05 / stefan"
+!
+
 isQuerySignal
     "return true, if this is a querySignal - always return true here"
 
@@ -369,23 +393,12 @@
 
     con := thisContext sender.
     [con notNil] whileTrue:[
-        con := con findNextContextWithSelector:#doRaise 
-                                            or:#handle:do:
-                                            or:#handle:from:do:.
+        con := con findSpecialHandle:true raise:true.
         con notNil ifTrue:[
-            (con selector == #handle:do:) ifFalse:[
+            (con selector == #answer:do:) ifFalse:[
                 ^ super raiseRequest
             ].
             (s := con receiver) == self ifTrue:[
-                "/ found a non-busy handler ...
-                "/ if its sender is a #answer context,
-                "/ fetch its value quickly from it.
-                con := con sender.
-                con selector == #answer:do: ifFalse:[
-                    con receiver == self ifFalse:[
-                        ^ super raiseRequest
-                    ]
-                ].
                 ^ con argAt:1
             ] ifFalse:[
                 (s accepts:self) ifTrue:[
@@ -404,7 +417,7 @@
     ^ super raiseRequest
 
     "Modified: / 15.6.1998 / 21:27:37 / cg"
-    "Modified: / 23.7.1999 / 15:22:25 / stefan"
+    "Modified: / 25.7.1999 / 23:35:11 / stefan"
 !
 
 raise
@@ -428,5 +441,5 @@
 !QuerySignal class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/QuerySignal.st,v 1.26 1999-07-23 14:54:06 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/QuerySignal.st,v 1.27 1999-07-28 07:53:27 stefan Exp $'
 ! !