diff --git a/scsh/libscsh.scm b/scsh/libscsh.scm index a6515a5..e46b253 100644 --- a/scsh/libscsh.scm +++ b/scsh/libscsh.scm @@ -5,23 +5,18 @@ (define (return-from-vm n) (with-continuation (if #t #f) (lambda () n))) -(define *user-context*) - -;; must be called from a running command processor -(define (save-user-envs!) - (set! *user-context* (user-context))) - -(define (startup args) - (start-new-session *user-context* - (current-input-port) - (current-output-port) - (current-error-port) - args - #t) ;batch? - (with-interaction-environment - (user-environment) - (lambda () - (return-from-vm 0)))) +(define (startup user-context) + (lambda (args) + (start-new-session user-context + (current-input-port) + (current-output-port) + (current-error-port) + args + #t) ;batch? + (with-interaction-environment + (user-environment) + (lambda () + (return-from-vm 0))))) (define (s48-command command-string) (let* ((in (make-string-input-port command-string)) @@ -45,7 +40,7 @@ (display "null as result" (current-error-port))) ((null? (cdr args)) - (display "evaluated:" (current-error-port)) + (display "evaluated to:" (current-error-port)) (display (car args)(current-error-port)) (newline (current-error-port)) (car args)) @@ -56,8 +51,9 @@ (display "s48-command got not exactly one s-exp" (current-error-port))))) +;; must be called from a running command processor (define (dump-libscsh-image filename) - (dump-scsh-program startup filename)) + (dump-scsh-program (startup (user-context)) filename)) (define-exported-binding "s48-command" s48-command) diff --git a/scsh/scsh-package.scm b/scsh/scsh-package.scm index 3806340..4490477 100644 --- a/scsh/scsh-package.scm +++ b/scsh/scsh-package.scm @@ -481,8 +481,7 @@ bitwise) (files syslog)) -(define-structure libscsh (export startup - save-user-envs!) +(define-structure libscsh (export dump-libscsh-image) (open scheme external-calls (subset i/o (current-error-port))