Fixes bug 163722: missing open-string-output-port and open-string-input-port

This commit is contained in:
Abdulaziz Ghuloum 2007-11-21 16:55:56 -05:00
parent d314bacc24
commit 2eca32fc8e
3 changed files with 19 additions and 9 deletions

View File

@ -15,7 +15,7 @@
(library (ikarus io input-strings) (library (ikarus io input-strings)
(export open-input-string with-input-from-string) (export open-input-string open-string-input-port with-input-from-string)
(import (import
(ikarus system $strings) (ikarus system $strings)
(ikarus system $bytevectors) (ikarus system $bytevectors)
@ -23,7 +23,9 @@
(ikarus system $pairs) (ikarus system $pairs)
(ikarus system $ports) (ikarus system $ports)
(ikarus system $io) (ikarus system $io)
(except (ikarus) open-input-string with-input-from-string)) (except (ikarus)
open-input-string open-string-input-port
with-input-from-string))
(define-syntax message-case (define-syntax message-case
(syntax-rules (else) (syntax-rules (else)
@ -82,15 +84,23 @@
(error 'input-string-handler (error 'input-string-handler
"message not handled" (cons msg args))]))))) "message not handled" (cons msg args))])))))
(define ($open-input-string str)
(let ([port (make-input-port
(make-input-string-handler str)
'#vu8())])
port))
(define open-input-string (define open-input-string
(lambda (str) (lambda (str)
(unless (string? str) (unless (string? str)
(error 'open-input-string "not a string" str)) (error 'open-input-string "not a string" str))
(let ([port (make-input-port ($open-input-string str)))
(make-input-string-handler str)
'#vu8())])
port)))
(define open-string-input-port
(lambda (str)
(unless (string? str)
(error 'open-string-input-port "not a string" str))
($open-input-string str)))
(define with-input-from-string (define with-input-from-string
(lambda (str proc) (lambda (str proc)

View File

@ -1 +1 @@
1104 1105

View File

@ -1125,8 +1125,8 @@
[open-file-input-port r ip] [open-file-input-port r ip]
[open-file-input/output-port r ip] [open-file-input/output-port r ip]
[open-file-output-port r ip] [open-file-output-port r ip]
[open-string-input-port r ip] [open-string-input-port i r ip]
[open-string-output-port r ip] [open-string-output-port i r ip]
[output-port-buffer-mode r ip] [output-port-buffer-mode r ip]
[port-eof? r ip] [port-eof? r ip]
[port-has-port-position? r ip] [port-has-port-position? r ip]