Added read-line

This commit is contained in:
Justin Ethier 2015-07-30 22:55:46 -04:00
parent f5729c4526
commit f530eb1804
2 changed files with 10 additions and 2 deletions

View file

@ -1381,8 +1381,11 @@ object Cyc_io_read_line(object cont, object port) {
if (c == EOF && i == 0) {
return_funcall1(cont, Cyc_EOF);
} else if (c == EOF || i == 1023 || c == '\n') {
make_string(s, buf);
return_funcall1(cont, &s);
buf[i] = '\0';
{
make_string(s, buf);
return_funcall1(cont, &s);
}
}
buf[i++] = c;

View file

@ -78,6 +78,7 @@
newline
write-char
flush-output-port
read-line
features
)
(begin
@ -139,6 +140,10 @@
(if (null? lst)
end
(func (car lst) (foldr func end (cdr lst)))))
(define (read-line . port)
(if (null? port)
(Cyc-read-line (current-output-port))
(Cyc-read-line (car port))))
(define (flush-output-port . port)
(if (null? port)
(Cyc-flush-output-port (current-output-port))