#| -*-Scheme-*-
-$Id: fileio.scm,v 1.13 1999/02/16 00:40:59 cph Exp $
+$Id: fileio.scm,v 1.14 1999/02/16 00:49:52 cph Exp $
Copyright (c) 1991-1999 Massachusetts Institute of Technology
(SET-OUTPUT-BUFFER-SIZE ,operation/set-output-buffer-size)
(SET-OUTPUT-TERMINAL-MODE ,operation/set-output-terminal-mode)
(WRITE-CHAR ,operation/write-char)
- (WRITE-STRING ,operation/write-string)
(WRITE-SUBSTRING ,operation/write-substring)))
(other-operations
`((CLOSE ,operation/close)
#| -*-Scheme-*-
-$Id: genio.scm,v 1.10 1999/02/16 00:41:03 cph Exp $
+$Id: genio.scm,v 1.11 1999/02/16 00:50:04 cph Exp $
Copyright (c) 1991-1999 Massachusetts Institute of Technology
(SET-OUTPUT-BUFFER-SIZE ,operation/set-output-buffer-size)
(SET-OUTPUT-TERMINAL-MODE ,operation/set-output-terminal-mode)
(WRITE-CHAR ,operation/write-char)
- (WRITE-STRING ,operation/write-string)
(WRITE-SUBSTRING ,operation/write-substring)))
(other-operations
`((CLOSE ,operation/close)
(define (operation/write-char port char)
(output-buffer/write-char-block (port/output-buffer port) char))
-(define (operation/write-string port string)
- (output-buffer/write-string-block (port/output-buffer port) string))
-
(define (operation/write-substring port string start end)
(output-buffer/write-substring-block (port/output-buffer port)
string start end))
#| -*-Scheme-*-
-$Id: output.scm,v 14.17 1999/01/02 06:11:34 cph Exp $
+$Id: output.scm,v 14.18 1999/02/16 00:49:02 cph Exp $
Copyright (c) 1988-1999 Massachusetts Institute of Technology
((output-port/operation/write-char port) port char))
(define (output-port/write-string port string)
- ((output-port/operation/write-string port) port string))
+ (output-port/write-substring port string 0 (string-length string)))
(define (output-port/write-substring port string start end)
((output-port/operation/write-substring port) port string start end))
#| -*-Scheme-*-
-$Id: port.scm,v 1.11 1999/01/02 06:11:34 cph Exp $
+$Id: port.scm,v 1.12 1999/02/16 00:49:21 cph Exp $
Copyright (c) 1991-1999 Massachusetts Institute of Technology
READ-SUBSTRING
;; output operations:
WRITE-CHAR
- WRITE-STRING
WRITE-SUBSTRING
FLUSH-OUTPUT
DISCRETIONARY-FLUSH-OUTPUT)))
(define output-port/operation/write-char
(record-accessor port-rtd 'WRITE-CHAR))
-(define output-port/operation/write-string
- (record-accessor port-rtd 'WRITE-STRING))
-
(define output-port/operation/write-substring
(record-accessor port-rtd 'WRITE-SUBSTRING))
((DISCARD-CHARS) (input-port/operation/discard-chars port))
((READ-SUBSTRING) (input-port/operation/read-substring port))
((WRITE-CHAR) (output-port/operation/write-char port))
- ((WRITE-STRING) (output-port/operation/write-string port))
((WRITE-SUBSTRING) (output-port/operation/write-substring port))
((FLUSH-OUTPUT) (output-port/operation/flush-output port))
((DISCRETIONARY-FLUSH-OUTPUT)
(define (default-operation/write-char port char)
((output-port/operation/write-substring port) port (string char) 0 1))
-(define (default-operation/write-string port string)
- ((output-port/operation/write-substring port)
- port
- string 0 (string-length string)))
-
(define (default-operation/write-substring port string start end)
(let ((write-char (output-port/operation/write-char port)))
(let loop ((index start))
(define install-output-operations!
(let ((operation-names
- '(WRITE-CHAR WRITE-SUBSTRING WRITE-STRING
- FLUSH-OUTPUT DISCRETIONARY-FLUSH-OUTPUT))
+ '(WRITE-CHAR WRITE-SUBSTRING FLUSH-OUTPUT DISCRETIONARY-FLUSH-OUTPUT))
(operation-defaults
(list default-operation/write-char
default-operation/write-substring
- default-operation/write-string
default-operation/flush-output
default-operation/flush-output)))
(let ((updaters
#| -*-Scheme-*-
-$Id: runtime.pkg,v 14.305 1999/02/16 00:40:48 cph Exp $
+$Id: runtime.pkg,v 14.306 1999/02/16 00:49:11 cph Exp $
Copyright (c) 1988-1999 Massachusetts Institute of Technology
operation/set-output-buffer-size
operation/set-output-terminal-mode
operation/write-char
- operation/write-string
operation/write-substring)
(initialization (initialize-package!)))
output-port/operation/discretionary-flush
output-port/operation/flush-output
output-port/operation/write-char
- output-port/operation/write-string
output-port/operation/write-substring
output-port/state
output-port?
#| -*-Scheme-*-
-$Id: strott.scm,v 14.5 1999/01/02 06:19:10 cph Exp $
+$Id: strott.scm,v 14.6 1999/02/16 00:53:21 cph Exp $
Copyright (c) 1988-1999 Massachusetts Institute of Technology
(set! output-string-template
(make-output-port `((WRITE-SELF ,operation/write-self)
(WRITE-CHAR ,operation/write-char)
- (WRITE-STRING ,operation/write-string))
- false)))
+ (WRITE-SUBSTRING ,operation/write-substring))
+ #f)))
(define (with-output-to-truncated-string max thunk)
(call-with-current-continuation
(lambda (return)
- (cons false
+ (cons #f
(apply string-append
(reverse!
(let ((state
(define-structure (output-string-state (type vector)
(conc-name output-string-state/))
- (return false read-only true)
- (max-length false read-only true)
+ (return #f read-only #t)
+ (max-length #f read-only #t)
accumulator
counter)
(counter (output-string-state/counter state)))
(if (zero? counter)
((output-string-state/return state)
- (cons true (apply string-append (reverse! accumulator))))
+ (cons #t (apply string-append (reverse! accumulator))))
(begin
(set-output-string-state/accumulator!
state
(cons (string char) accumulator))
(set-output-string-state/counter! state (-1+ counter)))))))
-(define (operation/write-string port string)
+(define (operation/write-substring port string start end)
(let ((state (output-port/state port)))
- (let ((accumulator (cons string (output-string-state/accumulator state)))
- (counter
- (- (output-string-state/counter state) (string-length string))))
+ (let ((accumulator
+ (cons (substring string start end)
+ (output-string-state/accumulator state)))
+ (counter (- (output-string-state/counter state) (- end start))))
(if (negative? counter)
((output-string-state/return state)
- (cons true
+ (cons #t
(substring (apply string-append (reverse! accumulator))
0
(output-string-state/max-length state))))
#| -*-Scheme-*-
-$Id: runtime.pkg,v 14.311 1999/02/16 00:40:53 cph Exp $
+$Id: runtime.pkg,v 14.312 1999/02/16 00:49:36 cph Exp $
Copyright (c) 1988-1999 Massachusetts Institute of Technology
operation/set-output-buffer-size
operation/set-output-terminal-mode
operation/write-char
- operation/write-string
operation/write-substring)
(initialization (initialize-package!)))
output-port/operation/discretionary-flush
output-port/operation/flush-output
output-port/operation/write-char
- output-port/operation/write-string
output-port/operation/write-substring
output-port/state
output-port?