locations.scm 971 B

1234567891011121314151617181920212223242526272829303132
  1. ; Copyright (c) 1993-2007 by Richard Kelsey and Jonathan Rees. See file COPYING.
  2. ; Locations
  3. (define location-rtd
  4. (make-record-type 'location '(id defined? contents)))
  5. (define-record-discloser location-rtd
  6. (lambda (l) `(location ,(location-id l))))
  7. (define make-undefined-location
  8. (let ((make (record-constructor location-rtd
  9. '(id defined? contents))))
  10. (lambda (id)
  11. (make id #f '*empty*))))
  12. (define location? (record-predicate location-rtd))
  13. (define location-id (record-accessor location-rtd 'id))
  14. (define set-location-id! (record-modifier location-rtd 'id))
  15. (define location-defined? (record-accessor location-rtd 'defined?))
  16. (define contents (record-accessor location-rtd 'contents))
  17. (define set-defined?! (record-modifier location-rtd 'defined?))
  18. (define (set-location-defined?! loc ?)
  19. (set-defined?! loc ?)
  20. (if (not ?)
  21. (set-contents! loc '*empty*)))
  22. (define set-contents! (record-modifier location-rtd 'contents))