stubs.scm 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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, Mike Sperber, Robert
  6. ;;; Ransom, Marcus Crestani, Sebastian Rheinnecker
  7. ;;;
  8. ;;; scheme48-1.9.2/scheme/env/command.scm
  9. ;;; scheme48-1.9.2/scheme/env/pacman.scm
  10. ;;; scheme48-1.9.2/scheme/env/user.scm
  11. ;;;
  12. ;;; A minimal set of stubs from the Scheme 48 command processor needed for
  13. ;;; prescheme compilation.
  14. (define-module (prescheme env stubs)
  15. #:use-module (prescheme scheme48)
  16. #:export (config-package))
  17. (define *user-context-initializers* '())
  18. (define user-context
  19. (let ((ctx #f))
  20. (lambda ()
  21. (unless ctx
  22. (set! ctx (make-user-context)))
  23. ctx)))
  24. (define (make-user-context)
  25. (let ((context (make-symbol-table)))
  26. (for-each (lambda (name+thunk)
  27. (table-set! context (car name+thunk) ((cdr name+thunk))))
  28. *user-context-initializers*)
  29. context))
  30. (define (user-context-accessor name initializer)
  31. (set! *user-context-initializers*
  32. (append *user-context-initializers*
  33. (list (cons name initializer))))
  34. (lambda ()
  35. (table-ref (user-context) name)))
  36. (define config-package
  37. (user-context-accessor 'config-package interaction-environment))