commander-s/scheme/focus.scm

23 lines
715 B
Scheme

(define-record-type focus-table :focus-table
(really-make-focus-table table count)
focus-table?
(table focus-table-table)
(count focus-table-count set-focus-table-count!))
(define (make-empty-focus-table)
(really-make-focus-table (make-integer-table) 0))
(define (add-focus-object focus-table object)
(let ((count (+ 1 (focus-table-count focus-table))))
(set-focus-table-count! focus-table count)
(table-set!
(focus-table-table focus-table) count object)
count))
(define (get-focus-object focus-table index)
(table-ref (focus-table-table focus-table) index))
(define (make-focus-object-reference table obj)
(let ((id (add-focus-object table obj)))
`(focus-value-ref ,id)))