#| -*-Scheme-*-
-$Id: fileio.scm,v 1.26 2005/12/12 21:41:23 cph Exp $
+$Id: fileio.scm,v 1.27 2005/12/14 05:44:31 cph Exp $
Copyright 1991,1993,1994,1995,1996,1999 Massachusetts Institute of Technology
Copyright 2001,2004,2005 Massachusetts Institute of Technology
(channel (file-open-input-channel (->namestring pathname)))
(port
(make-port input-file-type
- (make-gstate channel #f 'TEXT pathname))))
+ (make-gstate channel #f 'TEXT 'TEXT pathname))))
(set-channel-port! channel port)
(port/set-line-ending port (file-line-ending pathname))
port))
(file-open-output-channel filename))))
(port
(make-port output-file-type
- (make-gstate #f channel 'TEXT pathname))))
+ (make-gstate #f channel 'TEXT 'TEXT pathname))))
(set-channel-port! channel port)
(port/set-line-ending port (file-line-ending pathname))
port))
(channel (file-open-io-channel (->namestring pathname)))
(port
(make-port i/o-file-type
- (make-gstate channel channel 'TEXT pathname))))
+ (make-gstate channel channel 'TEXT 'TEXT pathname))))
(set-channel-port! channel port)
(port/set-line-ending port (file-line-ending pathname))
port))
(channel (file-open-input-channel (->namestring pathname)))
(port
(make-port input-file-type
- (make-gstate channel #f 'BINARY pathname))))
+ (make-gstate channel #f 'BINARY 'BINARY pathname))))
(set-channel-port! channel port)
port))
(file-open-output-channel filename))))
(port
(make-port output-file-type
- (make-gstate #f channel 'BINARY pathname))))
+ (make-gstate #f channel 'BINARY 'BINARY pathname))))
(set-channel-port! channel port)
port))
(channel (file-open-io-channel (->namestring pathname)))
(port
(make-port i/o-file-type
- (make-gstate channel channel 'BINARY pathname))))
+ (make-gstate channel channel 'BINARY 'BINARY pathname))))
(set-channel-port! channel port)
port))
\f
#| -*-Scheme-*-
-$Id: genio.scm,v 1.35 2005/12/12 21:45:36 cph Exp $
+$Id: genio.scm,v 1.36 2005/12/14 05:44:36 cph Exp $
Copyright 1991,1993,1995,1996,1999,2002 Massachusetts Institute of Technology
Copyright 2003,2004,2005 Massachusetts Institute of Technology
(let ((port
(make-port (generic-i/o-port-type (source-type source)
(sink-type sink))
- (make-gstate source sink 'TEXT))))
+ (make-gstate source sink 'TEXT 'TEXT))))
(let ((ib (port-input-buffer port)))
(if ib
((source/set-port (input-buffer-source ib)) port)))
coding
line-ending)
-(define (make-gstate source sink type . extra)
+(define (make-gstate source sink coder-name normalizer-name . extra)
(list->vector
(cons* (and source
- (make-input-buffer (->source source 'MAKE-GSTATE) type))
+ (make-input-buffer (->source source 'MAKE-GSTATE)
+ coder-name
+ normalizer-name))
(and sink
- (make-output-buffer (->sink sink 'MAKE-GSTATE) type))
- type
- type
+ (make-output-buffer (->sink sink 'MAKE-GSTATE)
+ coder-name
+ normalizer-name))
+ coder-name
+ normalizer-name
extra)))
(define-integrable (port-input-buffer port)
(and for-output?
(known-input-line-ending? name)
(not (known-output-line-ending? name))))
- (if (and channel (eq? 'TCP-STREAM-SOCKET (channel-type channel)))
+ (if (and channel (eq? (channel-type channel) 'TCP-STREAM-SOCKET))
'CRLF
(default-line-ending))
name))
decode
normalize)
-(define (make-input-buffer source type)
+(define (make-input-buffer source coder-name normalizer-name)
(%make-input-buffer source
(make-string byte-buffer-length)
byte-buffer-length
byte-buffer-length
- (name->decoder type)
+ (name->decoder coder-name)
(name->normalizer
- (line-ending ((source/get-channel source)) type #f))))
+ (line-ending ((source/get-channel source))
+ normalizer-name
+ #f))))
(define (input-buffer-open? ib)
((source/open? (input-buffer-source ib))))
encode
denormalize)
-(define (make-output-buffer sink type)
+(define (make-output-buffer sink coder-name normalizer-name)
(%make-output-buffer sink
(make-string byte-buffer-length)
0
- (name->encoder type)
+ (name->encoder coder-name)
(name->denormalizer
- (line-ending ((sink/get-channel sink)) type #t))))
+ (line-ending ((sink/get-channel sink))
+ normalizer-name
+ #t))))
(define (output-buffer-open? ob)
((sink/open? (output-buffer-sink ob))))
#| -*-Scheme-*-
-$Id: strnin.scm,v 14.15 2005/12/12 21:52:35 cph Exp $
+$Id: strnin.scm,v 14.16 2005/12/14 05:44:41 cph Exp $
Copyright 1988,1990,1993,1999,2003,2004 Massachusetts Institute of Technology
Copyright 2005 Massachusetts Institute of Technology
0
(guarantee-substring-start-index start end 'OPEN-INPUT-STRING))))
(make-port input-string-port-type
- (make-gstate (make-string-source string start end) #f 'TEXT))))
+ (make-gstate (make-string-source string start end)
+ #f
+ 'ISO-8859-1
+ 'NEWLINE))))
(define (make-string-source string start end)
(let ((index start))
#| -*-Scheme-*-
-$Id: strott.scm,v 14.14 2005/12/12 21:55:23 cph Exp $
+$Id: strott.scm,v 14.15 2005/12/14 05:44:45 cph Exp $
Copyright 1988,1993,1999,2004,2005 Massachusetts Institute of Technology
(make-port output-string-port-type
(receive (sink extract extract!)
(make-accumulator-sink limit k)
- (make-gstate #f sink 'TEXT extract extract!)))))
+ (make-gstate #f
+ sink
+ 'ISO-8859-1
+ 'NEWLINE
+ extract
+ extract!)))))
(generator port)
(cons #f (get-output-string port))))))
#| -*-Scheme-*-
-$Id: strout.scm,v 14.22 2005/12/12 21:55:39 cph Exp $
+$Id: strout.scm,v 14.23 2005/12/14 05:44:49 cph Exp $
Copyright 1988,1990,1993,1999,2000,2001 Massachusetts Institute of Technology
Copyright 2003,2004,2005 Massachusetts Institute of Technology
(define (open-output-string)
(make-port accumulator-output-port-type
(receive (sink extract extract!) (make-accumulator-sink)
- (make-gstate #f sink 'TEXT extract extract!))))
+ (make-gstate #f sink 'ISO-8859-1 'NEWLINE extract extract!))))
(define (get-output-string port)
((port/operation port 'EXTRACT-OUTPUT) port))
#| -*-Scheme-*-
-$Id: ttyio.scm,v 1.22 2005/12/12 21:55:44 cph Exp $
+$Id: ttyio.scm,v 1.23 2005/12/14 05:44:53 cph Exp $
Copyright 1991,1993,1996,1999,2003,2004 Massachusetts Institute of Technology
Copyright 2005 Massachusetts Institute of Technology
(make-gstate input-channel
output-channel
'TEXT
+ 'TEXT
(channel-type=file? input-channel)))
(define (set-console-i/o-port! port)