aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-06-03 15:33:07 +0200
committerThomas White <taw@physics.org>2021-06-03 15:33:07 +0200
commit4fa86f069e7cc2a81b152e5ef2745ee8493fa5e4 (patch)
tree6fac22b1192fe321281fef658378c1edf31c884b
parent24feb43400e76b4505c57bf28ade6851a022738d (diff)
Add patch-many
This time it works.
-rw-r--r--guile/starlet/scanout.scm22
1 files changed, 22 insertions, 0 deletions
diff --git a/guile/starlet/scanout.scm b/guile/starlet/scanout.scm
index 4d38f0f..eb895dd 100644
--- a/guile/starlet/scanout.scm
+++ b/guile/starlet/scanout.scm
@@ -30,6 +30,7 @@
#:use-module (ice-9 exceptions)
#:use-module (srfi srfi-1)
#:export (patch-fixture!
+ patch-many!
scanout-freq
total-num-attrs
register-state!
@@ -86,6 +87,27 @@
(define name (patch-real (quote name) stuff ...)))))
+;; Patch several new fixtures
+(define* (patch-many-real name
+ class
+ start-addrs
+ #:key (universe 0) (friendly-name "Fixture"))
+ (map (lambda (start-addr n)
+ (patch-real `(list-ref ,name ,n)
+ class
+ start-addr
+ #:universe universe
+ #:friendly-name friendly-name))
+ start-addrs
+ (iota (length start-addrs))))
+
+
+(define-syntax patch-many!
+ (syntax-rules ()
+ ((_ name stuff ...)
+ (define name (patch-many-real (quote name) stuff ...)))))
+
+
(define (state-has-fix-attr fix attr tnow state)
(let ((val (state-find fix attr state)))
(if (eq? 'no-value val)