picofuse

Macros | Typedefs | Enumerations | Functions
io.h File Reference

Opaque byte streams for reading, writing, seeking, and readiness notification. More...

#include <stdbool.h>
#include <stddef.h>
Include dependency graph for io.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SYS_IOSTREAM_CAPACITY   8
 Maximum number of open streams.
 
#define SYS_IOSTREAM_EOF   (-1)
 Value returned by sys_iostream_peek() at the end of a stream.
 

Typedefs

typedef struct sys_iostream_t sys_iostream_t
 An opaque byte stream. More...
 
typedef enum sys_iostream_event_t sys_iostream_event_t
 Stream readiness event flags. More...
 
typedef 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. More...
 

Enumerations

enum  sys_iostream_event_t { sys_iostream_event_none = 0, sys_iostream_event_read = 1u, sys_iostream_event_write = 2u }
 Stream readiness event flags. More...
 

Functions

void sys_iostream_close (sys_iostream_t *s)
 Release a stream back to the pool. More...
 
int sys_iostream_peek (sys_iostream_t *s)
 Look at the next byte without consuming it. More...
 
size_t sys_iostream_read (sys_iostream_t *s, char *buf, size_t n)
 Read bytes from a stream. More...
 
bool sys_iostream_eof (sys_iostream_t *s)
 Report whether a stream has permanently ended. More...
 
size_t sys_iostream_write (sys_iostream_t *s, const char *buf, size_t n)
 Write bytes to a stream. More...
 
ptrdiff_t sys_iostream_seek (sys_iostream_t *s, ptrdiff_t offset, bool abs)
 Move a stream's read/write position. More...
 
bool sys_iostream_set_callback (sys_iostream_t *stream, sys_iostream_callback_t callback, void *userdata)
 Set a callback for stream readiness events. More...
 

Detailed Description

Opaque byte streams for reading, writing, seeking, and readiness notification.

Definition in file io.h.