diff options
Diffstat (limited to 'stdlib/getput.tl')
-rw-r--r-- | stdlib/getput.tl | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/stdlib/getput.tl b/stdlib/getput.tl index 7c5b4542..d9717593 100644 --- a/stdlib/getput.tl +++ b/stdlib/getput.tl @@ -62,83 +62,83 @@ (put-jsonl obj s flat-p)) t) -(defun file-get (name) - (with-stream (s (open-file name)) +(defun file-get (name : mopt) + (with-stream (s (open-file name `r@mopt`)) (read s))) -(defun file-put (name obj) - (with-stream (s (open-file name "w")) +(defun file-put (name obj : mopt) + (with-stream (s (open-file name `w@mopt`)) (prinl obj s))) -(defun file-append (name obj) - (with-stream (s (open-file name "a")) +(defun file-append (name obj : mopt) + (with-stream (s (open-file name `a@mopt`)) (prinl obj s))) -(defun file-get-string (name) - (with-stream (s (open-file name)) +(defun file-get-string (name : mopt) + (with-stream (s (open-file name `r@mopt`)) (get-string s))) -(defun file-put-string (name string) - (with-stream (s (open-file name "w")) +(defun file-put-string (name string : mopt) + (with-stream (s (open-file name `w@mopt`)) (put-string string s))) -(defun file-append-string (name string) - (with-stream (s (open-file name "a")) +(defun file-append-string (name string : mopt) + (with-stream (s (open-file name `a@mopt`)) (put-string string s))) (defun file-get-lines (name) (get-lines (open-file name))) -(defun file-put-lines (name lines) - (with-stream (s (open-file name "w")) +(defun file-put-lines (name lines : mopt) + (with-stream (s (open-file name `w@mopt`)) (put-lines lines s))) -(defun file-append-lines (name lines) - (with-stream (s (open-file name "a")) +(defun file-append-lines (name lines : mopt) + (with-stream (s (open-file name `a@mopt`)) (put-lines lines s))) -(defun file-get-buf (name : bytes (seek 0)) - (with-stream (s (open-file name (if bytes "rbu" "rb"))) +(defun file-get-buf (name : bytes (seek 0) mopt) + (with-stream (s (open-file name `rb@(if bytes "u")@mopt`)) (sys:get-buf-common s bytes seek))) -(defun file-put-buf (name buf : (seek 0)) - (with-stream (s (open-file name "wb")) +(defun file-put-buf (name buf : (seek 0) mopt) + (with-stream (s (open-file name `wb@mopt`)) (unless (zerop seek) (seek-stream s seek :from-current)) (put-buf buf 0 s))) -(defun file-place-buf (name buf : (seek 0)) - (with-stream (s (open-file name "mb")) +(defun file-place-buf (name buf : (seek 0) mopt) + (with-stream (s (open-file name `mb@mopt`)) (unless (zerop seek) (seek-stream s seek :from-current)) (put-buf buf 0 s))) -(defun file-append-buf (name buf) - (with-stream (s (open-file name "ab")) +(defun file-append-buf (name buf : mopt) + (with-stream (s (open-file name `ab@mopt`)) (put-buf buf 0 s))) -(defun file-get-json (name) - (with-stream (s (open-file name)) +(defun file-get-json (name : mopt) + (with-stream (s (open-file name `r@mopt`)) (get-json s))) -(defun file-put-json (name obj : flat-p) - (with-stream (s (open-file name "w")) +(defun file-put-json (name obj : flat-p mopt) + (with-stream (s (open-file name `w@mopt`)) (put-jsonl obj s flat-p))) -(defun file-append-json (name obj : flat-p) - (with-stream (s (open-file name "a")) +(defun file-append-json (name obj : flat-p mopt) + (with-stream (s (open-file name `a@mopt`)) (put-jsonl obj s flat-p))) -(defun file-get-jsons (name) - (with-stream (s (open-file name)) +(defun file-get-jsons (name : mopt) + (with-stream (s (open-file name `r@mopt`)) (get-jsons s))) -(defun file-put-jsons (name seq : flat-p) - (with-stream (s (open-file name "w")) +(defun file-put-jsons (name seq : flat-p mopt) + (with-stream (s (open-file name `w@mopt`)) (put-jsons seq s flat-p))) -(defun file-append-jsons (name seq : flat-p) - (with-stream (s (open-file name "a")) +(defun file-append-jsons (name seq : flat-p mopt) + (with-stream (s (open-file name `a@mopt`)) (put-jsons s seq flat-p))) (defun command-get (cmd) |