updating references to *config-env* I missed

This commit is contained in:
Alex Shinn 2011-10-05 20:22:50 +09:00
parent ac4403ea7a
commit ef14dac179
3 changed files with 21 additions and 19 deletions

View file

@ -14,7 +14,7 @@
/* #define SEXP_USE_NATIVE_X86 1 */ /* #define SEXP_USE_NATIVE_X86 1 */
/* uncomment this to disable the module system */ /* uncomment this to disable the module system */
/* Currently this just loads the config.scm from main and */ /* Currently this just loads the meta.scm from main and */
/* sets up an (import (module name)) macro. */ /* sets up an (import (module name)) macro. */
/* #define SEXP_USE_MODULES 0 */ /* #define SEXP_USE_MODULES 0 */

View file

@ -65,8 +65,8 @@
;;> ;;>
;;> @itemlist[ ;;> @itemlist[
;;> @item{@scheme|{@in [<module>]}| - switch to @var{<module>}, or the @scheme{interaction-environment} if @var{<module>} is not specified} ;;> @item{@scheme|{@in [<module>]}| - switch to @var{<module>}, or the @scheme{interaction-environment} if @var{<module>} is not specified}
;;> @item{@scheme|{@config <expr>}| - evaluate @var{<expr>} in the @scheme{(config)} module} ;;> @item{@scheme|{@meta <expr>}| - evaluate @var{<expr>} in the @scheme{(meta)} module}
;;> @item{@scheme|{@config-module-is <module>}| - switch the config module to @var{<module>}} ;;> @item{@scheme|{@meta-module-is <module>}| - switch the meta module to @var{<module>}}
;;> @item{@scheme|{@exit}| - exit the REPL} ;;> @item{@scheme|{@exit}| - exit the REPL}
;;> ] ;;> ]
@ -79,7 +79,7 @@
(module-env (module-env
(if (module? module) (if (module? module)
module module
(eval `(load-module ',module) *config-env*))) (eval `(load-module ',module) *meta-env*)))
(interaction-environment))) (interaction-environment)))
(history-file (history-file
(cond ((memq 'history-file: o) => cadr) (cond ((memq 'history-file: o) => cadr)
@ -95,7 +95,7 @@
(raw? (cond ((memq 'raw?: o) => cadr) (raw? (cond ((memq 'raw?: o) => cadr)
(else (member (get-environment-variable "TERM") (else (member (get-environment-variable "TERM")
'("emacs" "dumb")))))) '("emacs" "dumb"))))))
(let lp ((module module) (env env) (config-env *config-env*)) (let lp ((module module) (env env) (meta-env *meta-env*))
(let* ((prompt (let* ((prompt
(string-append (if module (write-to-string module) "") "> ")) (string-append (if module (write-to-string module) "") "> "))
(line (line
@ -111,7 +111,7 @@
'complete?: buffer-complete-sexp?))))) 'complete?: buffer-complete-sexp?)))))
(cond (cond
((or (not line) (eof-object? line))) ((or (not line) (eof-object? line)))
((equal? line "") (lp module env config-env)) ((equal? line "") (lp module env meta-env))
(else (else
(history-commit! history line) (history-commit! history line)
(cond (cond
@ -121,7 +121,7 @@
(continue lp)) (continue lp))
(define (fail msg . args) (define (fail msg . args)
(apply warn msg args) (apply warn msg args)
(continue module env config-env)) (continue module env meta-env))
(call-with-input-string line (call-with-input-string line
(lambda (in) (lambda (in)
(let ((op (read/ss in))) (let ((op (read/ss in)))
@ -130,28 +130,30 @@
(let ((name (read/ss in))) (let ((name (read/ss in)))
(cond (cond
((eof-object? name) ((eof-object? name)
(continue #f (interaction-environment) config-env)) (continue #f (interaction-environment) meta-env))
((eval `(load-module ',name) config-env) ((eval `(load-module ',name) meta-env)
=> (lambda (m) => (lambda (m)
(continue name (module-env m) config-env))) (continue name (module-env m) meta-env)))
(else (else
(fail "couldn't find module:" name))))) (fail "couldn't find module:" name)))))
((config) ((meta config)
(if (eq? op 'config)
(display "Note: @config has been renamed @meta\n" out))
(let ((expr (read/ss in))) (let ((expr (read/ss in)))
(cond (cond
((and ((and
(symbol? expr) (symbol? expr)
(eqv? escape (string-ref (symbol->string expr) 0))) (eqv? escape (string-ref (symbol->string expr) 0)))
(meta config-env (meta meta-env
(substring line 6 (string-length line)) (substring line 6 (string-length line))
(lambda _ (continue module env config-env)))) (lambda _ (continue module env meta-env))))
(else (else
(eval expr config-env) (eval expr meta-env)
(continue module env config-env))))) (continue module env meta-env)))))
((config-module-is) ((meta-module-is)
(let ((name (read/ss in))) (let ((name (read/ss in)))
(cond (cond
((eval `(load-module ',name) config-env) ((eval `(load-module ',name) meta-env)
=> (lambda (m) (lp module env (module-env m)))) => (lambda (m) (lp module env (module-env m))))
(else (else
(fail "couldn't find module:" name))))) (fail "couldn't find module:" name)))))
@ -180,7 +182,7 @@
(display "Interrupt\n" (current-error-port)) (display "Interrupt\n" (current-error-port))
(thread-terminate! thread)) (thread-terminate! thread))
(lambda () (thread-join! (thread-start! thread)))))) (lambda () (thread-join! (thread-start! thread))))))
(lp module env config-env))))))) (lp module env meta-env)))))))
(if history-file (if history-file
(call-with-output-file history-file (call-with-output-file history-file
(lambda (out) (write (history->list history) out)))))) (lambda (out) (write (history->list history) out))))))

View file

@ -91,7 +91,7 @@
(mod-name (map (lambda (x) (or (string->number x) (string->symbol x))) (mod-name (map (lambda (x) (or (string->number x) (string->symbol x)))
(path-split mod-path)))) (path-split mod-path))))
(cond (cond
((eval `(find-module ',mod-name) *config-env*) ((eval `(find-module ',mod-name) *meta-env*)
=> (lambda (mod) => (lambda (mod)
(cond (cond
((assq 'include-shared (vector-ref mod 2)) ((assq 'include-shared (vector-ref mod 2))