* Added write-byte to ikarus.io-primitives

This commit is contained in:
Abdulaziz Ghuloum 2007-05-18 08:19:03 -04:00
parent 35fa003558
commit 9032492bf3
3 changed files with 13 additions and 11 deletions

Binary file not shown.

View File

@ -1,11 +1,12 @@
(library (ikarus io-primitives)
(export read-char unread-char peek-char write-char newline
(export read-char unread-char peek-char write-char write-byte newline
port-name input-port-name output-port-name
close-input-port reset-input-port!
flush-output-port close-output-port)
(import
(ikarus system $io)
(ikarus system $fx)
(ikarus system $ports)
(except (ikarus) read-char unread-char peek-char write-char
newline port-name input-port-name output-port-name
@ -25,18 +26,18 @@
(error 'write-char "~s is not an output-port" p))
(error 'write-char "~s is not a character" c))]))
#;(define write-byte
(define write-byte
(case-lambda
[(c)
(if (char? c)
($write-char c (current-output-port))
(error 'write-char "~s is not a character" c))]
[(c p)
(if (char? c)
[(b)
(if (and (fixnum? b) ($fx<= 0 b) ($fx<= b 255))
($write-byte b (current-output-port))
(error 'write-byte "~s is not a byte" b))]
[(b p)
(if (and (fixnum? b) ($fx<= 0 b) ($fx<= b 255))
(if (output-port? p)
($write-char c p)
(error 'write-char "~s is not an output-port" p))
(error 'write-char "~s is not a character" c))]))
($write-byte b p)
(error 'write-byte "~s is not an output-port" p))
(error 'write-byte "~s is not a byte" b))]))
;;;
(define newline
(case-lambda

View File

@ -398,6 +398,7 @@
[display i r]
[write i r]
[write-char i]
[write-byte i]
[read i r]
[read-char i r]
[read-token i]