2006-04-05 03:48:27 -04:00
|
|
|
(define *evaluation-environment*)
|
|
|
|
(define *evaluation-environment-name*)
|
|
|
|
(define *user-environment* #f)
|
|
|
|
|
|
|
|
(define (load-evaluation-environment package)
|
2005-09-27 12:18:04 -04:00
|
|
|
(let ((structure (reify-structure package)))
|
|
|
|
(load-structure structure)
|
|
|
|
(rt-structure->environment structure)))
|
|
|
|
|
2006-04-05 03:48:27 -04:00
|
|
|
(define (evaluation-environment-name)
|
|
|
|
(if (eq? *evaluation-environment*
|
|
|
|
*user-environment*)
|
|
|
|
(string->symbol "") ; aehm...
|
|
|
|
*evaluation-environment-name*))
|
2005-09-27 12:18:04 -04:00
|
|
|
|
|
|
|
(define (set-evaluation-package! package-name)
|
|
|
|
(set! *evaluation-environment*
|
2006-04-05 03:48:27 -04:00
|
|
|
(load-evaluation-environment package-name))
|
|
|
|
(set! *evaluation-environment-name* package-name))
|
|
|
|
|
|
|
|
(define (init-evaluation-environment! user-env)
|
|
|
|
(set-evaluation-package! user-env)
|
|
|
|
(set! *user-environment* (evaluation-environment)))
|
2005-09-27 12:18:04 -04:00
|
|
|
|
|
|
|
(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:36:30 -04:00
|
|
|
(eval (read-sexp-from-string str)
|
|
|
|
(evaluation-environment)))
|
2005-09-27 12:18:04 -04:00
|
|
|
|
|
|
|
(define (eval-s-expr s-expr)
|
2005-09-27 12:36:30 -04:00
|
|
|
(eval s-expr (evaluation-environment)))
|
2005-09-27 12:18:04 -04:00
|
|
|
|