mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-24 20:45:06 +02:00
Added I/O predicates
This commit is contained in:
parent
ae4b5fe4c2
commit
e68c275af4
1 changed files with 36 additions and 6 deletions
|
@ -109,6 +109,10 @@
|
||||||
write-string
|
write-string
|
||||||
flush-output-port
|
flush-output-port
|
||||||
read-line
|
read-line
|
||||||
|
input-port?
|
||||||
|
output-port?
|
||||||
|
input-port-open?
|
||||||
|
output-port-open?
|
||||||
features
|
features
|
||||||
any
|
any
|
||||||
every
|
every
|
||||||
|
@ -177,12 +181,6 @@
|
||||||
; open-input-string
|
; open-input-string
|
||||||
; open-output-string
|
; open-output-string
|
||||||
;
|
;
|
||||||
; ; it seems like these should be very do-able??
|
|
||||||
; input-port-open?
|
|
||||||
; input-port?
|
|
||||||
; output-port-open?
|
|
||||||
; output-port?
|
|
||||||
;
|
|
||||||
; for a lot of the following, need begin-splicing, or syntax-rules
|
; for a lot of the following, need begin-splicing, or syntax-rules
|
||||||
; binary-port?
|
; binary-port?
|
||||||
; define-values
|
; define-values
|
||||||
|
@ -937,4 +935,36 @@
|
||||||
(define-c eof-object
|
(define-c eof-object
|
||||||
"(void *data, int argc, closure _, object k)"
|
"(void *data, int argc, closure _, object k)"
|
||||||
" return_closcall1(data, k, Cyc_EOF); ")
|
" return_closcall1(data, k, Cyc_EOF); ")
|
||||||
|
(define-c input-port?
|
||||||
|
"(void *data, int argc, closure _, object k, object port)"
|
||||||
|
" port_type *p = (port_type *)port;
|
||||||
|
Cyc_check_port(data, port);
|
||||||
|
return_closcall1(
|
||||||
|
data,
|
||||||
|
k,
|
||||||
|
(p->mode == 1) ? boolean_t : boolean_f); ")
|
||||||
|
(define-c output-port?
|
||||||
|
"(void *data, int argc, closure _, object k, object port)"
|
||||||
|
" port_type *p = (port_type *)port;
|
||||||
|
Cyc_check_port(data, port);
|
||||||
|
return_closcall1(
|
||||||
|
data,
|
||||||
|
k,
|
||||||
|
(p->mode == 0) ? boolean_t : boolean_f); ")
|
||||||
|
(define-c input-port-open?
|
||||||
|
"(void *data, int argc, closure _, object k, object port)"
|
||||||
|
" port_type *p = (port_type *)port;
|
||||||
|
Cyc_check_port(data, port);
|
||||||
|
return_closcall1(
|
||||||
|
data,
|
||||||
|
k,
|
||||||
|
(p->mode == 1 && p->fp != NULL) ? boolean_t : boolean_f); ")
|
||||||
|
(define-c output-port-open?
|
||||||
|
"(void *data, int argc, closure _, object k, object port)"
|
||||||
|
" port_type *p = (port_type *)port;
|
||||||
|
Cyc_check_port(data, port);
|
||||||
|
return_closcall1(
|
||||||
|
data,
|
||||||
|
k,
|
||||||
|
(p->mode == 0 && p->fp != NULL) ? boolean_t : boolean_f); ")
|
||||||
))
|
))
|
||||||
|
|
Loading…
Add table
Reference in a new issue