diff options
Diffstat (limited to 'guile/starlet')
-rw-r--r-- | guile/starlet/base.scm | 9 | ||||
-rw-r--r-- | guile/starlet/state-rw.scm | 13 |
2 files changed, 22 insertions, 0 deletions
diff --git a/guile/starlet/base.scm b/guile/starlet/base.scm index f0424af..efb2c64 100644 --- a/guile/starlet/base.scm +++ b/guile/starlet/base.scm @@ -22,6 +22,7 @@ scale-to-range hirestime state-for-each + state-map get-attributes set-attr! get-attr-name @@ -48,6 +49,7 @@ find-attr fixture? fixture-attribute? + get-fixture-name selection-hook sel programmer-state @@ -268,6 +270,13 @@ (hash-ref (get-state-hash-table state) (cons fix attr))) +(define (state-map func state) + (hash-map->list (lambda (key value) + (func (car key) + (cdr key) + value)) + (get-state-hash-table state))) + ;; Add the contents of state "new" to "combined-state" (define (add-state-to-state! merge-rule new combined-state) diff --git a/guile/starlet/state-rw.scm b/guile/starlet/state-rw.scm new file mode 100644 index 0000000..5b14c6e --- /dev/null +++ b/guile/starlet/state-rw.scm @@ -0,0 +1,13 @@ +(define-module (starlet state-rw) + #:use-module (starlet base) + #:export (write-state)) + + +(define (write-state state) + (state-map + (lambda (fix attr val) + (list 'at + (get-fixture-name fix) + (get-attr-name attr) + val)) + state)) |