summaryrefslogtreecommitdiff
path: root/py/stream.h
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-03-24 19:09:00 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-03-24 19:09:00 +0200
commitd4c8e626f280ab096c1341577931d8071972bd4c (patch)
tree03f9b713f06fa06c42491567e1c58d075117b1f7 /py/stream.h
parenta5d48b1162fc57cb45c591702ed60cffc3f0588b (diff)
py/stream: Add mp_stream_writeall() helper function.
Spools entire output buffer to a blocking stream (chunk by chunk if needed).
Diffstat (limited to 'py/stream.h')
-rw-r--r--py/stream.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/py/stream.h b/py/stream.h
index 0471777c7..2354fd3c0 100644
--- a/py/stream.h
+++ b/py/stream.h
@@ -49,6 +49,9 @@ mp_obj_t mp_stream_unbuffered_iter(mp_obj_t self);
mp_obj_t mp_stream_write(mp_obj_t self_in, const void *buf, size_t len);
+// Helper function to write entire buf to *blocking* stream
+mp_uint_t mp_stream_writeall(mp_obj_t stream, const byte *buf, mp_uint_t size, int *errcode);
+
#if MICROPY_STREAMS_NON_BLOCK
// TODO: This is POSIX-specific (but then POSIX is the only real thing,
// and anything else just emulates it, right?)