Added string output ports

This commit is contained in:
Justin Ethier 2016-08-26 03:22:41 -04:00
parent 374e57e1ff
commit c46309463b

View file

@ -138,6 +138,8 @@
output-port? output-port?
input-port-open? input-port-open?
output-port-open? output-port-open?
get-output-string
open-output-string
features features
Cyc-version Cyc-version
any any
@ -193,9 +195,7 @@
; ; need string ports ; ; need string ports
; ; may be able to use POSIX string steams for this, see: open_memstream ; ; may be able to use POSIX string steams for this, see: open_memstream
; ; however there may be portability issues with that. looks like BSD and windows don't have it ; ; however there may be portability issues with that. looks like BSD and windows don't have it
; get-output-string
; open-input-string ; open-input-string
; open-output-string
; ;
; ;; no binary/text ports yet ; ;; no binary/text ports yet
; binary-port? ; binary-port?
@ -1161,6 +1161,14 @@
data, data,
k, k,
((p->mode == 0 && p->fp != NULL) ? boolean_t : boolean_f)); ") ((p->mode == 0 && p->fp != NULL) ? boolean_t : boolean_f)); ")
(define-c open-output-string
"(void *data, int argc, closure _, object k)"
" port_type p = Cyc_io_open_output_string(data);
return_closcall1(data, k, &p); ")
(define-c get-output-string
"(void *data, int argc, closure _, object k, object port)"
" Cyc_io_get_output_string(data, k, port);
")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; syntax-rules ;; syntax-rules