144#define bj_stream_read_t(stream, type, buffer) bj_read_stream(stream, buffer, sizeof(type))
152#define bj_stream_skip_t(stream, type) bj_read_stream(stream, 0, sizeof(type))
General-purpose definitions for Banjo API.
Recoverable error handling.
struct bj_stream bj_stream
Definition api.h:352
#define BANJO_EXPORT
Definition api.h:155
Error structure.
Definition error.h:131
struct bj_stream * bj_open_stream_read(const void *data, size_t length)
Creates a new struct bj_stream for reading from a memory buffer.
size_t bj_seek_stream(struct bj_stream *stream, ptrdiff_t position, enum bj_seek_origin from)
Seeks to a new position in the stream relative to a specified origin.
size_t bj_get_stream_length(struct bj_stream *stream)
Get the size of the stream.
struct bj_stream * bj_allocate_stream(void)
Allocate a new bj_stream object.
struct bj_stream * bj_open_stream_file(const char *path, struct bj_error **error)
Creates a new struct bj_stream for reading from a file.
bj_seek_origin
Position in a bj_stream to use for origin.
Definition stream.h:22
size_t bj_tell_stream(struct bj_stream *stream)
Returns the current position of the cursor in the stream.
void bj_close_stream(struct bj_stream *stream)
Deletes a struct bj_stream object and releases associated memory.
size_t bj_read_stream(struct bj_stream *stream, void *dest, size_t count)
Reads data from the stream into a destination buffer.
@ BJ_SEEK_CURRENT
The current position of the stream.
Definition stream.h:24
@ BJ_SEEK_END
The end of the stream.
Definition stream.h:25
@ BJ_SEEK_BEGIN
The beginning of the stream.
Definition stream.h:23