Some minor improvements.

dump-libscsh-image is now the only export of the libscsh package.
This commit is contained in:
mainzelm 2002-05-23 09:52:26 +00:00
parent e8fe6105bf
commit 1585024cd4
2 changed files with 16 additions and 21 deletions

View File

@ -5,23 +5,18 @@
(define (return-from-vm n) (define (return-from-vm n)
(with-continuation (if #t #f) (lambda () n))) (with-continuation (if #t #f) (lambda () n)))
(define *user-context*) (define (startup user-context)
(lambda (args)
;; must be called from a running command processor (start-new-session user-context
(define (save-user-envs!) (current-input-port)
(set! *user-context* (user-context))) (current-output-port)
(current-error-port)
(define (startup args) args
(start-new-session *user-context* #t) ;batch?
(current-input-port) (with-interaction-environment
(current-output-port) (user-environment)
(current-error-port) (lambda ()
args (return-from-vm 0)))))
#t) ;batch?
(with-interaction-environment
(user-environment)
(lambda ()
(return-from-vm 0))))
(define (s48-command command-string) (define (s48-command command-string)
(let* ((in (make-string-input-port command-string)) (let* ((in (make-string-input-port command-string))
@ -45,7 +40,7 @@
(display "null as result" (display "null as result"
(current-error-port))) (current-error-port)))
((null? (cdr args)) ((null? (cdr args))
(display "evaluated:" (current-error-port)) (display "evaluated to:" (current-error-port))
(display (car args)(current-error-port)) (display (car args)(current-error-port))
(newline (current-error-port)) (newline (current-error-port))
(car args)) (car args))
@ -56,8 +51,9 @@
(display "s48-command got not exactly one s-exp" (display "s48-command got not exactly one s-exp"
(current-error-port))))) (current-error-port)))))
;; must be called from a running command processor
(define (dump-libscsh-image filename) (define (dump-libscsh-image filename)
(dump-scsh-program startup filename)) (dump-scsh-program (startup (user-context)) filename))
(define-exported-binding "s48-command" s48-command) (define-exported-binding "s48-command" s48-command)

View File

@ -481,8 +481,7 @@
bitwise) bitwise)
(files syslog)) (files syslog))
(define-structure libscsh (export startup (define-structure libscsh (export dump-libscsh-image)
save-user-envs!)
(open scheme (open scheme
external-calls external-calls
(subset i/o (current-error-port)) (subset i/o (current-error-port))