(define library-db?
(make-bundle-predicate 'library-database))
-
-(define-deferred host-library-db
- (make-library-db 'host))
\f
(define (make-library name . keylist)
(if name
\f
;;;; Syntax
-(define-automatic-property '->scode '(name imports exports syntaxed-contents)
+(define-automatic-property 'scode '(name imports exports contents)
#f
(lambda (name imports exports contents)
(make-scode-declaration
(exports ,(map library-export->list exports))))
(make-scode-quotation contents))))
+(define (eval-r7rs-source source db)
+ (let ((program (register-r7rs-source! source db)))
+ (if program
+ (scode-eval (library-contents program)
+ (library-environment program)))))
+
(define-automatic-property 'contents
'(parsed-contents imports exports imports-environment)
#f
(declare (usual-integrations))
\f
+(define-deferred host-library-db
+ (make-library-db 'host))
+
+(define (finish-host-library-db!)
+ (add-standard-libraries! host-library-db))
+
(define (add-standard-libraries! db)
(register-libraries! (make-standard-libraries) db))
value))
#f))
+(define-deferred current-load-library-db
+ (make-unsettable-parameter host-library-db))
+
(define-deferred param:eval-unit
(make-unsettable-parameter #f
(lambda (value)
load/suppress-loading-message?))
\f
(define (load pathname #!optional environment syntax-table purify?)
- syntax-table ;ignored
+ (declare (ignore syntax-table))
(let ((environment
(if (default-object? environment)
(current-load-environment)
(define (file-loadable? pathname)
(receive (pathname* loader notifier) (choose-load-method pathname)
- loader notifier
+ (declare (ignore loader notifier))
(if pathname* #t #f)))
(define (choose-load-method pathname)
(define (source-loader pathname)
(lambda (environment purify?)
- purify?
- (call-with-input-file pathname
- (lambda (port)
- (let loop ((value unspecific))
- (let ((sexp (read port)))
- (if (eof-object? sexp)
- value
- (loop (repl-eval sexp environment)))))))))
+ (declare (ignore purify?))
+ (let ((source (read-r7rs-source pathname)))
+ (if source
+ (eval-r7rs-source source (current-load-library-db))
+ (call-with-input-file pathname
+ (lambda (port)
+ (let loop ((value unspecific))
+ (let ((sexp (read port)))
+ (if (eof-object? sexp)
+ value
+ (loop (repl-eval sexp environment)))))))))))
(define (wrap-loader pathname loader)
(lambda (environment purify?)
(runtime hash)
(runtime dynamic)
(runtime regular-sexpression)
- (runtime library database)
+ (runtime library standard)
;; Microcode data structures
(runtime history)
(runtime scode)
(runtime structure-parser)
(runtime swank)
(runtime stack-sampler)
+ ;; Done very late since it will look up lots of global variables.
+ ((runtime library standard) finish-host-library-db!)
;; Last since it turns on runtime handling of microcode errors.
((runtime microcode-errors) initialize-error-hooks!)))
\f
built-in-object-file
condition-type:not-loading
current-load-environment
+ current-load-library-db
current-load-pathname
fasl-file?
fasload
(parent (runtime library))
(export (runtime library)
define-automatic-property
- host-library-db
library-contents
library-db?
library-environment
(define-package (runtime library parser)
(files "library-parser")
(parent (runtime library))
+ (export (runtime)
+ read-r7rs-source)
(export (runtime library)
library-name=?
library-name?
r7rs-source-program
r7rs-source-libraries
r7rs-source?
- read-r7rs-source
register-r7rs-source!))
(define-package (runtime library standard)
(files "library-standard")
(parent (runtime library))
+ (export (runtime)
+ host-library-db)
(export (runtime library)
add-standard-libraries!
check-standard-libraries!
(export ()
environment ;R7RS
)
- (export (runtime library)
- imports->environment))
\ No newline at end of file
+ (export (runtime)
+ eval-r7rs-source))
\ No newline at end of file