diff options
author | David Thompson <dthompson@member.fsf.org> | 2013-12-01 19:03:44 -0500 |
---|---|---|
committer | David Thompson <dthompson@member.fsf.org> | 2013-12-01 19:03:44 -0500 |
commit | 2aec8d0cba2a2bf1001014ee5dadbafc95831a64 (patch) | |
tree | 17d2040e4f35d65d1ab12ff239663f9a2559679e /2d | |
parent | 01d4ad4394760689cb8422f83113e0ec9ba1908e (diff) |
Make signal-set! a coroutine.
* 2d/signals.el (signal-set!): Make coroutine.
(signal-set-and-propagate!): New procedure.
Diffstat (limited to '2d')
-rw-r--r-- | 2d/signals.scm | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/2d/signals.scm b/2d/signals.scm index 1f776ed..39e4d86 100644 --- a/2d/signals.scm +++ b/2d/signals.scm @@ -25,6 +25,7 @@ #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) #:use-module (srfi srfi-26) + #:use-module (2d coroutine) #:export (<signal> signal? make-signal @@ -110,7 +111,12 @@ value will be propagated to LISTENER." "Detach all connectors from SIGNAL." (%set-signal-connectors! signal '())) -(define* (signal-set! signal value #:optional (from #f)) +(codefine* (signal-set! signal value #:optional (from #f)) + "Set VALUE for SIGNAL from the connected signal FROM and +propagate VALUE to all connected signals. " + (signal-set-and-propagate! signal value from)) + +(define (signal-set-and-propagate! signal value from) "Set VALUE for SIGNAL from the connected signal FROM and propagate VALUE to all connected signals. " (let ((value (%signal-transform signal value from))) @@ -126,7 +132,7 @@ propagate VALUE to all connected signals. " "Receive VALUE for SIGNAL from the connected signal FROM. VALUE will be set if it passes through the filter." (when (signal-keep? signal value from) - (signal-set! signal value from))) + (signal-set-and-propagate! signal value from))) ;;; ;;; Primitive signals |