From 4fa86f069e7cc2a81b152e5ef2745ee8493fa5e4 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 3 Jun 2021 15:33:07 +0200 Subject: Add patch-many This time it works. --- guile/starlet/scanout.scm | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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) -- cgit v1.2.3