session.scm 780 B

1234567891011121314151617181920212223242526
  1. ; Copyright (c) 1993-2008 by Richard Kelsey and Jonathan Rees. See file COPYING.
  2. ; Session data
  3. ; The initializers are saved in images.
  4. (define *session-data-initializers* '())
  5. (define (make-session-data-slot! init)
  6. (let ((slot (length *session-data-initializers*)))
  7. (set! *session-data-initializers* (cons init *session-data-initializers*))
  8. (if (vector? (session-data))
  9. (set-session-data! (list->vector
  10. (reverse
  11. (cons init
  12. (reverse (vector->list (session-data))))))))
  13. slot))
  14. (define (session-data-ref slot)
  15. (vector-ref (session-data) slot))
  16. (define (session-data-set! slot value)
  17. (vector-set! (session-data) slot value))
  18. (define (initialize-session-data!)
  19. (set-session-data! (list->vector (reverse *session-data-initializers*))))