#| -*-Scheme-*-
-$Id: genio.scm,v 1.32 2004/05/27 16:06:31 cph Exp $
+$Id: genio.scm,v 1.33 2005/11/29 06:41:45 cph Exp $
Copyright 1991,1993,1995,1996,1999,2002 Massachusetts Institute of Technology
-Copyright 2003,2004 Massachusetts Institute of Technology
+Copyright 2003,2004,2005 Massachusetts Institute of Technology
This file is part of MIT/GNU Scheme.
(define-structure (gstate (type vector) (constructor #f))
;; Changes to this structure must be copied to "fileio.scm" and
- ;; "ttyio.scm".
+ ;; "ttyio.scm", "strnin.scm", "strout.scm", and "strott.scm".
(input-buffer #f read-only #t)
(output-buffer #f read-only #t)
coding
(make-port-type (append input-operations
output-operations
other-operations)
+ #f))
+ (set! generic-no-i/o-type
+ (make-port-type other-operations
#f)))
(initialize-name-maps!)
(initialize-conditions!))
(define generic-input-type)
(define generic-output-type)
(define generic-i/o-type)
+(define generic-no-i/o-type)
\f
;;;; Input operations
(eq-intersection (known-input-codings)
(known-output-codings)))
((input-port? port) (known-input-codings))
- (else (known-output-codings))))
+ ((output-port? port) (known-output-codings))
+ (else '())))
(define (generic-io/line-ending port)
(gstate-line-ending (port/state port)))
(eq-intersection (known-input-line-endings)
(known-output-line-endings)))
((input-port? port) (known-input-line-endings))
- (else (known-output-line-endings))))
+ ((output-port? port) (known-output-line-endings))
+ (else '())))
(define (line-ending channel name for-output?)
(guarantee-symbol name #f)
#| -*-Scheme-*-
-$Id: runtime.pkg,v 14.565 2005/10/24 02:30:08 cph Exp $
+$Id: runtime.pkg,v 14.566 2005/11/29 06:46:06 cph Exp $
Copyright 1988,1989,1990,1991,1992,1993 Massachusetts Institute of Technology
Copyright 1994,1995,1996,1997,1998,1999 Massachusetts Institute of Technology
generic-input-type
generic-output-type
make-gstate)
+ (export (runtime string-input)
+ generic-no-i/o-type
+ make-gstate)
+ (export (runtime string-output)
+ generic-no-i/o-type
+ make-gstate)
+ (export (runtime truncated-string-output)
+ generic-no-i/o-type
+ make-gstate)
(initialization (initialize-package!)))
(define-package (runtime gensym)
#| -*-Scheme-*-
-$Id: strnin.scm,v 14.13 2004/02/16 05:38:37 cph Exp $
+$Id: strnin.scm,v 14.14 2005/11/29 06:50:59 cph Exp $
Copyright 1988,1990,1993,1999,2003,2004 Massachusetts Institute of Technology
+Copyright 2005 Massachusetts Institute of Technology
This file is part of MIT/GNU Scheme.
(define (open-input-string string #!optional start end)
(guarantee-string string 'OPEN-INPUT-STRING)
- (let ((end
- (if (or (default-object? end) (not end))
- (string-length string)
- (guarantee-substring-end-index end (string-length string)
- 'OPEN-INPUT-STRING))))
+ (let* ((end
+ (if (or (default-object? end) (not end))
+ (string-length string)
+ (guarantee-substring-end-index end (string-length string)
+ 'OPEN-INPUT-STRING)))
+ (start
+ (if (or (default-object? start) (not start))
+ 0
+ (guarantee-substring-start-index start end 'OPEN-INPUT-STRING))))
(make-port input-string-port-type
- (make-istate
- string
- (if (or (default-object? start) (not start))
- 0
- (guarantee-substring-start-index start end
- 'OPEN-INPUT-STRING))
- end))))
+ (make-gstate #f #f 'TEXT string start end))))
(define input-string-port-type)
(define (initialize-package!)
,(lambda (port output-port)
port
(write-string " from string" output-port))))
- #f))
+ generic-no-i/o-type))
unspecific)
-(define-structure (istate (type vector))
+(define-structure (istate (type vector)
+ (initial-offset 4) ;must match "genio.scm"
+ (constructor #f))
(string #f read-only #t)
start
(end #f read-only #t))
\ No newline at end of file
#| -*-Scheme-*-
-$Id: strott.scm,v 14.12 2004/02/16 05:38:42 cph Exp $
+$Id: strott.scm,v 14.13 2005/11/29 06:52:28 cph Exp $
-Copyright 1988,1993,1999,2004 Massachusetts Institute of Technology
+Copyright 1988,1993,1999,2004,2005 Massachusetts Institute of Technology
This file is part of MIT/GNU Scheme.
(define (with-output-to-truncated-string max thunk)
(call-with-current-continuation
(lambda (k)
- (let ((state (make-astate k max (make-string (fix:min max 128)) 0)))
+ (let ((state
+ (make-gstate #f #f 'TEXT k max (make-string (fix:min max 128)) 0)))
(with-output-to-port (make-port output-string-port-type state)
thunk)
(cons #f
,(lambda (port output-port)
port
(write-string " to string (truncating)" output-port))))
- #f))
+ generic-no-i/o-type))
unspecific)
-(define-structure (astate (type vector))
+(define-structure (astate (type vector)
+ (initial-offset 4) ;must match "genio.scm"
+ (constructor #f))
(return #f read-only #t)
(max-length #f read-only #t)
chars
#| -*-Scheme-*-
-$Id: strout.scm,v 14.20 2005/05/30 04:10:38 cph Exp $
+$Id: strout.scm,v 14.21 2005/11/29 06:54:11 cph Exp $
Copyright 1988,1990,1993,1999,2000,2001 Massachusetts Institute of Technology
Copyright 2003,2004,2005 Massachusetts Institute of Technology
(declare (usual-integrations))
\f
(define (open-output-string)
- (make-port accumulator-output-port-type (make-astate)))
+ (make-port accumulator-output-port-type
+ (make-gstate #f #f 'TEXT #f #f)))
(define (get-output-string port)
((port/operation port 'EXTRACT-OUTPUT) port))
(lambda (port)
(with-output-to-port port thunk))))
-(define-structure (astate (type vector) (constructor make-astate ()))
- (chars #f)
+(define-structure (astate (type vector)
+ (initial-offset 4) ;must match "genio.scm"
+ (constructor #f))
+ chars
index)
(define (maybe-reset-astate state)
,(lambda (port output-port)
port
(write-string " to string" output-port))))
- #f))
+ generic-no-i/o-type))
unspecific)
\ No newline at end of file