mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
Added read-line
This commit is contained in:
parent
f5729c4526
commit
f530eb1804
2 changed files with 10 additions and 2 deletions
|
@ -1381,8 +1381,11 @@ object Cyc_io_read_line(object cont, object port) {
|
||||||
if (c == EOF && i == 0) {
|
if (c == EOF && i == 0) {
|
||||||
return_funcall1(cont, Cyc_EOF);
|
return_funcall1(cont, Cyc_EOF);
|
||||||
} else if (c == EOF || i == 1023 || c == '\n') {
|
} else if (c == EOF || i == 1023 || c == '\n') {
|
||||||
make_string(s, buf);
|
buf[i] = '\0';
|
||||||
return_funcall1(cont, &s);
|
{
|
||||||
|
make_string(s, buf);
|
||||||
|
return_funcall1(cont, &s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
buf[i++] = c;
|
buf[i++] = c;
|
||||||
|
|
|
@ -78,6 +78,7 @@
|
||||||
newline
|
newline
|
||||||
write-char
|
write-char
|
||||||
flush-output-port
|
flush-output-port
|
||||||
|
read-line
|
||||||
features
|
features
|
||||||
)
|
)
|
||||||
(begin
|
(begin
|
||||||
|
@ -139,6 +140,10 @@
|
||||||
(if (null? lst)
|
(if (null? lst)
|
||||||
end
|
end
|
||||||
(func (car lst) (foldr func end (cdr lst)))))
|
(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)
|
(define (flush-output-port . port)
|
||||||
(if (null? port)
|
(if (null? port)
|
||||||
(Cyc-flush-output-port (current-output-port))
|
(Cyc-flush-output-port (current-output-port))
|
||||||
|
|
Loading…
Add table
Reference in a new issue