locations.scm 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. ;;; Ported from Scheme 48 1.9. See file COPYING for notices and license.
  2. ;;;
  3. ;;; Port Author: Andrew Whatson
  4. ;;;
  5. ;;; Original Authors: Richard Kelsey, Jonathan Rees
  6. ;;;
  7. ;;; scheme48-1.9.2/scheme/alt/locations.scm
  8. ;;;
  9. ;;; Locations
  10. (define-module (prescheme locations)
  11. #:use-module (srfi srfi-9)
  12. #:use-module (prescheme record-discloser)
  13. #:export (location?
  14. location-defined?
  15. location-assigned?
  16. location-id
  17. set-location-id!
  18. make-undefined-location
  19. set-location-defined?!
  20. contents
  21. set-contents!))
  22. (define-record-type :location
  23. (make-location id defined? contents)
  24. location?
  25. (id location-id set-location-id!)
  26. (defined? location-defined? set-defined?!)
  27. (contents contents set-contents!))
  28. (define-record-discloser :location
  29. (lambda (l) `(location ,(location-id l))))
  30. (define (make-undefined-location id)
  31. (make-location id #f '*empty*))
  32. (define (set-location-defined?! loc ?)
  33. (set-defined?! loc ?)
  34. (if (not ?)
  35. (set-contents! loc '*empty*)))