45 #ifndef SYS_IOSTREAM_CAPACITY 46 #define SYS_IOSTREAM_CAPACITY 8 54 #define SYS_IOSTREAM_EOF (-1) 97 sys_iostream_event_t events,
bool sys_iostream_set_callback(sys_iostream_t *stream, sys_iostream_callback_t callback, void *userdata)
Set a callback for stream readiness events.
int sys_iostream_peek(sys_iostream_t *s)
Look at the next byte without consuming it.
Data is available to read.
size_t sys_iostream_read(sys_iostream_t *s, char *buf, size_t n)
Read bytes from a stream.
struct sys_iostream_t sys_iostream_t
An opaque byte stream.
void(* sys_iostream_callback_t)(sys_iostream_t *stream, sys_iostream_event_t events, void *userdata)
Callback invoked when a stream becomes ready for I/O.
ptrdiff_t sys_iostream_seek(sys_iostream_t *s, ptrdiff_t offset, bool abs)
Move a stream's read/write position.
The stream can accept output.
size_t sys_iostream_write(sys_iostream_t *s, const char *buf, size_t n)
Write bytes to a stream.
sys_iostream_event_t
Stream readiness event flags.
void sys_iostream_close(sys_iostream_t *s)
Release a stream back to the pool.
bool sys_iostream_eof(sys_iostream_t *s)
Report whether a stream has permanently ended.