2005-09-27 12:18:04 -04:00
|
|
|
(define (init-evaluation-environment package)
|
|
|
|
(let ((structure (reify-structure package)))
|
|
|
|
(load-structure structure)
|
|
|
|
(rt-structure->environment structure)))
|
|
|
|
|
|
|
|
(define *evaluation-environment*)
|
|
|
|
|
|
|
|
(define (set-evaluation-package! package-name)
|
|
|
|
(set! *evaluation-environment*
|
|
|
|
(init-evaluation-environment package-name)))
|
|
|
|
|
|
|
|
(define (evaluation-environment)
|
|
|
|
*evaluation-environment*)
|
|
|
|
|
|
|
|
(define (read-sexp-from-string string)
|
|
|
|
(let ((string-port (open-input-string string)))
|
|
|
|
(read string-port)))
|
|
|
|
|
|
|
|
(define (eval-string str)
|
2005-09-27 12:33:27 -04:00
|
|
|
(with-inspector-handler
|
2005-09-27 12:18:04 -04:00
|
|
|
(lambda ()
|
|
|
|
(eval (read-sexp-from-string str)
|
|
|
|
(evaluation-environment)))))
|
|
|
|
|
|
|
|
(define (eval-s-expr s-expr)
|
2005-09-27 12:33:27 -04:00
|
|
|
(with-inspector-handler
|
2005-09-27 12:18:04 -04:00
|
|
|
(lambda ()
|
|
|
|
(eval s-expr (evaluation-environment)))))
|
|
|
|
|