summaryrefslogtreecommitdiffstatshomepage
path: root/py/obj.h
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-11-17 00:16:14 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-11-17 00:16:14 +0200
commit838eb1fa2d365ee085082b26e8b8b6ec657af572 (patch)
tree4e3546f54910bc831928a4c749c3375d40abe6a3 /py/obj.h
parentf4a6a577ab133781c06aec029c806c878555730a (diff)
downloadmicropython-838eb1fa2d365ee085082b26e8b8b6ec657af572.tar.gz
micropython-838eb1fa2d365ee085082b26e8b8b6ec657af572.zip
stream: Implement seek operation support via ioctl, wrapped in generic method.
Also, implement for unix port.
Diffstat (limited to 'py/obj.h')
-rw-r--r--py/obj.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/py/obj.h b/py/obj.h
index ab5123417f..09f277a198 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -231,8 +231,6 @@ void mp_get_buffer_raise(mp_obj_t obj, mp_buffer_info_t *bufinfo, mp_uint_t flag
// Stream protocol
#define MP_STREAM_ERROR (-1)
-#define MP_STREAM_FLUSH (1)
-#define MP_STREAM_POLL (2)
typedef struct _mp_stream_p_t {
// On error, functions should return MP_STREAM_ERROR and fill in *errcode (values
// are implementation-dependent, but will be exposed to user, e.g. via exception).
@@ -242,6 +240,17 @@ typedef struct _mp_stream_p_t {
mp_uint_t is_text : 1; // default is bytes, set this for text stream
} mp_stream_p_t;
+// Stream ioctl request codes
+#define MP_STREAM_FLUSH (1)
+#define MP_STREAM_SEEK (2)
+#define MP_STREAM_POLL (3)
+
+// Argument structure for MP_STREAM_SEEK
+struct mp_stream_seek_t {
+ mp_off_t offset;
+ int whence;
+};
+
struct _mp_obj_type_t {
mp_obj_base_t base;
qstr name;