aboutsummaryrefslogtreecommitdiff
path: root/guile/starlet
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-05-20 20:59:24 +0200
committerThomas White <taw@physics.org>2021-05-22 11:58:53 +0200
commit84a2c09c909b2dd249873d199cc9ea83e59f60fe (patch)
tree48c156614d4e3e1f9cd4335bf8c0b19b69d2dfa8 /guile/starlet
parent0c7c05b20256d5cf31ac829c788326bbaef5c2ec (diff)
Add total-num-attrs
Diffstat (limited to 'guile/starlet')
-rw-r--r--guile/starlet/scanout.scm8
1 files changed, 8 insertions, 0 deletions
diff --git a/guile/starlet/scanout.scm b/guile/starlet/scanout.scm
index c5b95aa..70698d4 100644
--- a/guile/starlet/scanout.scm
+++ b/guile/starlet/scanout.scm
@@ -31,6 +31,7 @@
#:use-module (srfi srfi-1)
#:export (patch-fixture!
scanout-freq
+ total-num-attrs
register-state!
current-value))
@@ -45,6 +46,13 @@
(define state-names (make-atomic-box '()))
+(define (total-num-attrs)
+ (fold (lambda (fix prev)
+ (+ prev (length (get-fixture-attrs fix))))
+ 0
+ (atomic-box-ref fixtures)))
+
+
(define (get-state-name st)
(assq-ref (atomic-box-ref state-names)
st))