#| -*-Scheme-*-
-$Id: genio.scm,v 1.18 2003/02/14 18:28:32 cph Exp $
+$Id: genio.scm,v 1.19 2003/03/21 17:50:58 cph Exp $
-Copyright (c) 1991-1999, 2002 Massachusetts Institute of Technology
+Copyright 1991,1993,1995,1996,1999,2002 Massachusetts Institute of Technology
+Copyright 2003 Massachusetts Institute of Technology
This file is part of MIT/GNU Scheme.
(else 'RAW))))
(define (operation/set-input-terminal-mode port mode)
- (case mode
- ((COOKED) (terminal-cooked-input (operation/input-channel port)))
- ((RAW) (terminal-raw-input (operation/input-channel port)))
- ((#F) unspecific)
- (else (error:wrong-type-datum mode "terminal mode"))))
+ (let ((channel (operation/input-channel port)))
+ (if (channel-type=terminal? channel)
+ (case mode
+ ((COOKED) (terminal-cooked-input channel))
+ ((RAW) (terminal-raw-input channel))
+ ((#F) unspecific)
+ (else (error:wrong-type-datum mode "terminal mode")))
+ unspecific)))
\f
(define (operation/flush-output port)
(output-buffer/drain-block (port/output-buffer port)))
(else 'RAW))))
(define (operation/set-output-terminal-mode port mode)
- (case mode
- ((COOKED) (terminal-cooked-output (operation/output-channel port)))
- ((RAW) (terminal-raw-output (operation/output-channel port)))
- ((#F) unspecific)
- (else (error:wrong-type-datum mode "terminal mode"))))
+ (let ((channel (operation/output-channel port)))
+ (if (channel-type=terminal? channel)
+ (case mode
+ ((COOKED) (terminal-cooked-output (operation/output-channel port)))
+ ((RAW) (terminal-raw-output (operation/output-channel port)))
+ ((#F) unspecific)
+ (else (error:wrong-type-datum mode "terminal mode")))
+ unspecific)))
(define (operation/close port)
(operation/close-input port)
#| -*-Scheme-*-
-$Id: rep.scm,v 14.60 2003/03/07 20:41:23 cph Exp $
+$Id: rep.scm,v 14.61 2003/03/21 17:51:03 cph Exp $
Copyright 1986,1987,1988,1989,1990,1991 Massachusetts Institute of Technology
Copyright 1992,1993,1994,1998,1999,2001 Massachusetts Institute of Technology
(if cmdl
(cmdl/level cmdl)
0)))
+
+(define (nearest-cmdl/batch-mode?)
+ (let ((cmdl *nearest-cmdl*))
+ (if cmdl
+ (cmdl/batch-mode? cmdl)
+ #f)))
+
+(define (cmdl/batch-mode? cmdl)
+ (and (= (cmdl/level cmdl) 1)
+ (implemented-primitive-procedure? (ucode-primitive batch-mode? 0))
+ ((ucode-primitive batch-mode? 0))))
\f
;;;; Operations
#| -*-Scheme-*-
-$Id: runtime.pkg,v 14.439 2003/03/14 20:11:53 cph Exp $
+$Id: runtime.pkg,v 14.440 2003/03/21 17:51:09 cph Exp $
Copyright 1988,1989,1990,1991,1992,1993 Massachusetts Institute of Technology
Copyright 1994,1995,1996,1997,1998,1999 Massachusetts Institute of Technology
cmdl-message/null
cmdl-message/strings
cmdl/base
+ cmdl/batch-mode?
cmdl/driver
cmdl/level
cmdl/operation
make-repl-history
make-repl-message
nearest-cmdl
+ nearest-cmdl/batch-mode?
nearest-cmdl/level
nearest-cmdl/port
nearest-repl
#| -*-Scheme-*-
-$Id: savres.scm,v 14.43 2003/02/14 18:28:33 cph Exp $
+$Id: savres.scm,v 14.44 2003/03/21 17:51:14 cph Exp $
Copyright 1988,1989,1990,1991,1992,1995 Massachusetts Institute of Technology
Copyright 1998,1999,2000,2001,2002,2003 Massachusetts Institute of Technology
(set! world-identification identify)
(abort->top-level
(lambda (cmdl)
- (identify-world (cmdl/port cmdl))
+ (if (not (cmdl/batch-mode? cmdl))
+ (identify-world (cmdl/port cmdl)))
(event-distributor/invoke! event:after-restart))))
((not identify)
#t)
#| -*-Scheme-*-
-$Id: ttyio.scm,v 1.14 2003/02/14 18:28:34 cph Exp $
+$Id: ttyio.scm,v 1.15 2003/03/21 17:51:19 cph Exp $
-Copyright (c) 1991-1999 Massachusetts Institute of Technology
+Copyright 1991,1993,1996,1999,2003 Massachusetts Institute of Technology
This file is part of MIT/GNU Scheme.
(let ((char (input-buffer/read-char (port/input-buffer port))))
(if (eof-object? char)
(signal-end-of-input port))
- (if (and char (console-port-state/echo-input? (port/state port)))
+ (if (and char
+ (not (nearest-cmdl/batch-mode?))
+ (console-port-state/echo-input? (port/state port)))
(output-port/write-char port char))
char))
(define (signal-end-of-input port)
- (fresh-line port)
- (write-string "End of input stream reached" port)
+ (if (not (nearest-cmdl/batch-mode?))
+ (begin
+ (fresh-line port)
+ (write-string "End of input stream reached" port)))
(%exit))
(define (operation/read-finish port)
#| -*-Scheme-*-
-$Id: usrint.scm,v 1.19 2003/02/14 18:28:34 cph Exp $
+$Id: usrint.scm,v 1.20 2003/03/21 17:51:23 cph Exp $
-Copyright (c) 1991-1999, 2001 Massachusetts Institute of Technology
+Copyright 1991,1992,1993,1994,1995,2001 Massachusetts Institute of Technology
+Copyright 2003 Massachusetts Institute of Technology
This file is part of MIT/GNU Scheme.
(error:wrong-type-datum prompt "a string or standard prompt"))))
(define (write-command-prompt port prompt level)
- (port/with-output-terminal-mode port 'COOKED
- (lambda ()
- (fresh-line port)
- (newline port)
- (if (and (pair? prompt)
- (eq? 'STANDARD (car prompt)))
- (begin
- (write level port)
- (write-string " " port)
- (write-string (cdr prompt) port))
- (write-string prompt port))
- (flush-output port))))
+ (if (not (nearest-cmdl/batch-mode?))
+ (port/with-output-terminal-mode port 'COOKED
+ (lambda ()
+ (fresh-line port)
+ (newline port)
+ (if (and (pair? prompt)
+ (eq? 'STANDARD (car prompt)))
+ (begin
+ (write level port)
+ (write-string " " port)
+ (write-string (cdr prompt) port))
+ (write-string prompt port))
+ (flush-output port)))))
(define (prompt-for-command-expression prompt #!optional port)
(let ((prompt (canonicalize-command-prompt prompt))
(define (default/write-result port expression object hash-number)
expression
- (port/with-output-terminal-mode port 'COOKED
- (lambda ()
- (fresh-line port)
- (write-string ";" port)
- (if (and write-result:undefined-value-is-special?
- (undefined-value? object))
- (write-string "Unspecified return value" port)
- (begin
- (write-string "Value" port)
- (if hash-number
- (begin
- (write-string " " port)
- (write hash-number port)))
- (write-string ": " port)
- (write object port))))))
+ (if (not (nearest-cmdl/batch-mode?))
+ (port/with-output-terminal-mode port 'COOKED
+ (lambda ()
+ (fresh-line port)
+ (write-string ";" port)
+ (if (and write-result:undefined-value-is-special?
+ (undefined-value? object))
+ (write-string "Unspecified return value" port)
+ (begin
+ (write-string "Value" port)
+ (if hash-number
+ (begin
+ (write-string " " port)
+ (write hash-number port)))
+ (write-string ": " port)
+ (write object port)))))))
(define write-result:undefined-value-is-special? true)