init-defpackage.scm 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. ; Part of Scheme 48 1.9. See file COPYING for notices and license.
  2. ; Authors: Richard Kelsey, Jonathan Rees, Mike Sperber
  3. ; This file has to be loaded into the initial-image before any use of
  4. ; DEFINE-STRUCTURE. Compare with alt/init-defpackage.scm.
  5. ; The procedure given to DEFINE-SYNTACTIC-TOWER-MAKER is called when
  6. ; a DEFINE-STRUCTURE form is evaluated.
  7. (define-syntactic-tower-maker
  8. (let ((comp-env-macro-eval
  9. (*structure-ref compiler-envs 'comp-env-macro-eval))
  10. (make-simple-interface
  11. (*structure-ref interfaces 'make-simple-interface))
  12. (env (interaction-environment)))
  13. (lambda (clauses id)
  14. (if (null? clauses)
  15. ;; (make-syntactic-tower eval (list scheme) id)
  16. (comp-env-macro-eval (package->environment env))
  17. (delay
  18. (let ((package (eval `(a-package ,(if id
  19. `(for-syntax ,id)
  20. '(for-syntax))
  21. ,@clauses)
  22. env)))
  23. (ensure-loaded (make-structure package
  24. (lambda ()
  25. (make-simple-interface #f '()))
  26. 'for-syntax))
  27. (cons eval package)))))))
  28. (define-reader read)