#| -*-Scheme-*-
-$Id: runtime.pkg,v 14.651 2008/07/26 05:12:20 cph Exp $
+$Id: runtime.pkg,v 14.652 2008/07/26 05:45:35 cph Exp $
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
(open-wide-input-string open-input-string)
(string->input-port open-input-string)
(with-string-output-port call-with-narrow-output-string)
- call-with-input-bytes
+ call-with-input-octets
call-with-input-string
call-with-narrow-output-string
- call-with-output-bytes
+ call-with-output-octets
call-with-truncated-output-string
call-with-wide-output-string
get-output-string
get-output-string!
- open-input-bytes
+ open-input-octets
open-input-string
open-narrow-output-string
- open-output-bytes
+ open-output-octets
open-wide-output-string
with-input-from-string
with-output-to-string
#| -*-Scheme-*-
-$Id: stringio.scm,v 14.2 2008/07/26 05:12:20 cph Exp $
+$Id: stringio.scm,v 14.3 2008/07/26 05:45:36 cph Exp $
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
\f
;;;; Input as byte vector
-(define (call-with-input-bytes bytes procedure)
- (let ((port (open-input-bytes bytes)))
+(define (call-with-input-octets octets procedure)
+ (let ((port (open-input-octets octets)))
(let ((value (procedure port)))
(close-input-port port)
value)))
-(define (open-input-bytes bytes #!optional start end)
- (guarantee-xstring bytes 'OPEN-INPUT-BYTES)
+(define (open-input-octets octets #!optional start end)
+ (guarantee-xstring octets 'OPEN-INPUT-OCTETS)
(receive (start end)
- (check-index-limits start end (xstring-length bytes) 'OPEN-INPUT-BYTES)
+ (check-index-limits start end (xstring-length octets) 'OPEN-INPUT-OCTETS)
(let ((port
- (make-generic-i/o-port (make-bytes-source bytes start end)
+ (make-generic-i/o-port (make-octets-source octets start end)
#f
- bytes-input-type)))
+ octets-input-type)))
(port/set-coding port 'ISO-8859-1)
(port/set-line-ending port 'NEWLINE)
port)))
-(define (make-bytes-source string start end)
+(define (make-octets-source string start end)
(let ((index start))
(make-non-channel-port-source
(lambda ()
(set! index limit))
n)))))
-(define (make-bytes-input-type)
+(define (make-octets-input-type)
(make-port-type `((WRITE-SELF
,(lambda (port output-port)
port
(loop index)))))
(xsubstring-find-previous-char string start end #\newline)))
\f
-;;;; Output as bytes
+;;;; Output as octets
-(define (call-with-output-bytes generator)
- (let ((port (open-output-bytes)))
+(define (call-with-output-octets generator)
+ (let ((port (open-output-octets)))
(generator port)
(get-output-string port)))
-(define (open-output-bytes)
+(define (open-output-octets)
(let ((port
(let ((os (make-ostate (make-vector-8b 16) 0 #f)))
(make-generic-i/o-port #f
(make-byte-sink os)
- bytes-output-type
+ octets-output-type
os))))
(port/set-line-ending port 'NEWLINE)
port))
(define (make-byte-sink os)
(make-non-channel-port-sink
- (lambda (bytes start end)
+ (lambda (octets start end)
(let ((index (ostate-index os)))
(let ((n (fix:+ index (fix:- end start))))
(let ((buffer (ostate-buffer os)))
(loop (fix:+ m m)))))))
(substring-move! buffer 0 index new 0)
new))))
- (substring-move! bytes start end (ostate-buffer os) index)
+ (substring-move! octets start end (ostate-buffer os) index)
(set-ostate-index! os n)
(fix:- end start))))))
-(define (make-bytes-output-type)
- (make-port-type `((EXTRACT-OUTPUT ,bytes-out/extract-output)
- (EXTRACT-OUTPUT! ,bytes-out/extract-output!)
- (POSITION ,bytes-out/position)
- (WRITE-SELF ,bytes-out/write-self))
+(define (make-octets-output-type)
+ (make-port-type `((EXTRACT-OUTPUT ,octets-out/extract-output)
+ (EXTRACT-OUTPUT! ,octets-out/extract-output!)
+ (POSITION ,octets-out/position)
+ (WRITE-SELF ,octets-out/write-self))
(generic-i/o-port-type #f #t)))
-(define (bytes-out/extract-output port)
+(define (octets-out/extract-output port)
(output-port/flush-output port)
- (let ((os (output-bytes-port/os port)))
+ (let ((os (output-octets-port/os port)))
(string-head (ostate-buffer os) (ostate-index os))))
-(define (bytes-out/extract-output! port)
+(define (octets-out/extract-output! port)
(output-port/flush-output port)
- (let ((os (output-bytes-port/os port)))
- (let ((bytes (ostate-buffer os)))
- (set-string-maximum-length! bytes (ostate-index os))
+ (let ((os (output-octets-port/os port)))
+ (let ((octets (ostate-buffer os)))
+ (set-string-maximum-length! octets (ostate-index os))
(set-ostate-buffer! os (make-vector-8b 16))
(set-ostate-index! os 0)
- bytes)))
+ octets)))
-(define (bytes-out/position port)
+(define (octets-out/position port)
(output-port/flush-output port)
- (ostate-index (output-bytes-port/os port)))
+ (ostate-index (output-octets-port/os port)))
-(define (bytes-out/write-self port output-port)
+(define (octets-out/write-self port output-port)
port
(write-string " to byte vector" output-port))
\f
(define narrow-input-type)
(define wide-input-type)
(define external-input-type)
-(define bytes-input-type)
+(define octets-input-type)
(define narrow-output-type)
(define wide-output-type)
-(define bytes-output-type)
-(define output-bytes-port/os)
+(define octets-output-type)
+(define output-octets-port/os)
(define (initialize-package!)
(set! narrow-input-type (make-narrow-input-type))
(set! wide-input-type (make-wide-input-type))
(set! external-input-type (make-external-input-type))
- (set! bytes-input-type (make-bytes-input-type))
+ (set! octets-input-type (make-octets-input-type))
(set! narrow-output-type (make-narrow-output-type))
(set! wide-output-type (make-wide-output-type))
- (set! bytes-output-type (make-bytes-output-type))
- (set! output-bytes-port/os (generic-i/o-port-accessor 0))
+ (set! octets-output-type (make-octets-output-type))
+ (set! output-octets-port/os (generic-i/o-port-accessor 0))
unspecific)
\ No newline at end of file
#| -*-Scheme-*-
-$Id: unicode.scm,v 1.38 2008/07/19 01:41:17 cph Exp $
+$Id: unicode.scm,v 1.39 2008/07/26 05:45:36 cph Exp $
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
\f
(define (coded-input-opener coding)
(lambda (string #!optional start end)
- (let ((port (open-input-bytes string start end)))
+ (let ((port (open-input-octets string start end)))
(port/set-coding port coding)
(port/set-line-ending port 'NEWLINE)
port)))
(define (coded-output-opener coding)
(lambda ()
- (let ((port (open-output-bytes)))
+ (let ((port (open-output-octets)))
(port/set-coding port coding)
(port/set-line-ending port 'NEWLINE)
port)))
(utf32-le-string-length string start end)))
(define (utf32-be-string-length string #!optional start end)
- (%utf32-string-length string start end "32BE" utf32-be-bytes->code-point
+ (%utf32-string-length string start end "32BE" utf32-be-octets->code-point
'UTF32-BE-STRING-LENGTH))
(define (utf32-le-string-length string #!optional start end)
- (%utf32-string-length string start end "32LE" utf32-le-bytes->code-point
+ (%utf32-string-length string start end "32LE" utf32-le-octets->code-point
'UTF32-LE-STRING-LENGTH))
(define (%utf32-string-length string start end type combiner caller)
(utf32-le-string-valid? string start end)))
(define (utf32-be-string-valid? string #!optional start end)
- (%utf32-string-valid? string start end utf32-be-bytes->code-point
+ (%utf32-string-valid? string start end utf32-be-octets->code-point
'UTF32-BE-STRING-VALID?))
(define (utf32-le-string-valid? string #!optional start end)
- (%utf32-string-valid? string start end utf32-le-bytes->code-point
+ (%utf32-string-valid? string start end utf32-le-octets->code-point
'UTF32-LE-STRING-VALID?))
(define (%utf32-string-valid? string start end combiner caller)
(lambda (string start end)
(validate-utf32-char string start end combiner)))))
-(define-integrable (utf32-be-bytes->code-point b0 b1 b2 b3)
+(define-integrable (utf32-be-octets->code-point b0 b1 b2 b3)
(+ (* b0 #x01000000)
(fix:lsh b1 16)
(fix:lsh b2 8)
b3))
-(define-integrable (utf32-le-bytes->code-point b0 b1 b2 b3)
+(define-integrable (utf32-le-octets->code-point b0 b1 b2 b3)
(+ (* b3 #x01000000)
(fix:lsh b2 16)
(fix:lsh b1 8)
(utf16-le-string-length string start end)))
(define (utf16-be-string-length string #!optional start end)
- (%utf16-string-length string start end "16BE" be-bytes->digit16
+ (%utf16-string-length string start end "16BE" be-octets->digit16
'UTF16-BE-STRING-LENGTH))
(define (utf16-le-string-length string #!optional start end)
- (%utf16-string-length string start end "16LE" le-bytes->digit16
+ (%utf16-string-length string start end "16LE" le-octets->digit16
'UTF16-LE-STRING-LENGTH))
(define (%utf16-string-length string start end type combiner caller)
(utf16-le-string-valid? string start end)))
(define (utf16-be-string-valid? string #!optional start end)
- (%utf16-string-valid? string start end be-bytes->digit16
+ (%utf16-string-valid? string start end be-octets->digit16
'UTF16-BE-STRING-VALID?))
(define (utf16-le-string-valid? string #!optional start end)
- (%utf16-string-valid? string start end le-bytes->digit16
+ (%utf16-string-valid? string start end le-octets->digit16
'UTF16-LE-STRING-VALID?))
(define (%utf16-string-valid? string start end combiner caller)
(fix:+ start 2)))))
start))
-(define (be-bytes->digit16 b0 b1)
+(define (be-octets->digit16 b0 b1)
(fix:or (fix:lsh b0 8) b1))
-(define (le-bytes->digit16 b0 b1)
+(define (le-octets->digit16 b0 b1)
(fix:or (fix:lsh b1 8) b0))
(define-integrable (high-surrogate? n)
#| -*-Scheme-*-
-$Id: mod-lisp.scm,v 1.39 2008/07/19 01:41:17 cph Exp $
+$Id: mod-lisp.scm,v 1.40 2008/07/26 05:45:36 cph Exp $
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
(set-status-header response code)
(set-content-type-header response 'text/html)
(set-entity response
- (call-with-output-bytes
- (lambda (port)
- (write-xml
- (let ((message (status-message code)))
- (html:html #f
- "\n"
- (html:head #f
- "\n"
- (html:title #f code " " message)
- "\n")
- "\n"
- (html:body #f
- "\n"
- (html:h1 #f message)
- "\n"
- extra
- "\n")
- "\n"))
- port)
- (newline port)))))
+ (call-with-output-octets
+ (lambda (port)
+ (write-xml
+ (let ((message (status-message code)))
+ (html:html #f
+ "\n"
+ (html:head #f
+ "\n"
+ (html:title #f code " " message)
+ "\n")
+ "\n"
+ (html:body #f
+ "\n"
+ (html:h1 #f message)
+ "\n"
+ extra
+ "\n")
+ "\n"))
+ port)
+ (newline port)))))
(define (set-status-header message code)
(set-header message
#| -*-Scheme-*-
-$Id: xmlrpc.scm,v 1.17 2008/07/19 01:41:17 cph Exp $
+$Id: xmlrpc.scm,v 1.18 2008/07/26 05:45:36 cph Exp $
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
(if (eq? (http-request-method) 'post)
(let ((entity (http-request-entity)))
(if entity
- (let ((document (read-xml (open-input-bytes entity))))
+ (let ((document (read-xml (open-input-octets entity))))
(if document
(write-xml (process-xmlrpc-request document pathname) port)
(http-status-response 400 "Ill-formed XML entity")))
#| -*-Scheme-*-
-$Id: xml-output.scm,v 1.44 2008/07/19 01:41:17 cph Exp $
+$Id: xml-output.scm,v 1.45 2008/07/26 05:45:36 cph Exp $
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
(write-xml-1 xml port options))))
(define (xml->string xml . options)
- (call-with-output-bytes
- (lambda (port)
- (set-coding xml port)
- (write-xml-1 xml port options))))
+ (call-with-output-octets
+ (lambda (port)
+ (set-coding xml port)
+ (write-xml-1 xml port options))))
(define (xml->wide-string xml . options)
(call-with-wide-output-string