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) {
|
||||
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;
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Add table
Reference in a new issue