further fstream development

parent 3433eae5
......@@ -5,9 +5,15 @@
fread fread-l fseek fseek-l
rw-fstream-from-file rw-fstream-from-string
r-fstream-from-file r-fstream-from-string
w-fstream-from-file-append w-fstream-from-string-append
feof freadline freadline-l
make-empty-rw-fstream
make-empty-r-fstream
make-empty-w-fstream
))
;; Functional port or stream
(define-immutable-record-type <fstream-rw>
(make-fstream-rw n m l r meta)
fstream-rw?
......@@ -284,6 +290,9 @@
(define (r-fstream-from-file str)
(rw->r (rw-fstream-from-file str)))
(define (w-fstream-from-file-append str)
(rw->w (seek-l (rw-fstream-from-file str) 0)))
(define (rw-fstream-from-string str)
(with-input-from-string str
(lambda ()
......@@ -295,6 +304,9 @@
(define (r-fstream-from-string str)
(rw->r (rw-fstream-from-string str)))
(define (w-fstream-from-string-append str)
(rw->w (seek-l (rw-fstream-from-string str) 0)))
(define (freadline stream)
(cond
((fstream-rw? stream)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment