diff options
author | Thomas White <taw@physics.org> | 2021-05-13 11:00:16 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2021-05-13 11:00:16 +0200 |
commit | 6e86ea3f962577dca6f5ce703ab22e0ad2390d2b (patch) | |
tree | cf12f0651f262df6915a7bb8fb2be82d62523532 /guile/starlet/scanout.scm | |
parent | cecbbeb8dc71d99adbb078a690714011f91f4ce5 (diff) |
Avoid mutation of state objects by "set-state-name!"
Diffstat (limited to 'guile/starlet/scanout.scm')
-rw-r--r-- | guile/starlet/scanout.scm | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/guile/starlet/scanout.scm b/guile/starlet/scanout.scm index 7833076..e7ab623 100644 --- a/guile/starlet/scanout.scm +++ b/guile/starlet/scanout.scm @@ -41,6 +41,21 @@ ;; List of states being scanned out (define state-list (make-atomic-box '())) +;; Association list of names to states +(define state-names (make-atomic-box '())) + + +(define (get-state-name st) + (assq-ref (atomic-box-ref state-names) + st)) + + +(define (set-state-name! st name) + (atomic-box-set! state-names + (assq-set! (atomic-box-ref state-names) + st + name))) + ;; Patch a new fixture (define* (patch-real name |