|
Banjo API 1.1.0-alpha
Low-level C99 game development API
|
Go to the source code of this file.
Data Structures | |
| struct | bj_stream_callbacks |
Macros | |
| #define | bj_stream_read_t(stream, type, buffer) |
| #define | bj_stream_skip_t(stream, type) |
Typedefs | |
| typedef enum bj_seek_origin | bj_seek_origin |
| typedef enum bj_stream_flag | bj_stream_flag |
| typedef size_t(* | bj_stream_read_fn) (void *buffer, size_t count, void *user_data, enum bj_stream_status *status) |
| typedef size_t(* | bj_stream_write_fn) (const void *data, size_t count, void *user_data, enum bj_stream_status *status) |
| typedef bj_bool(* | bj_stream_seek_fn) (size_t position, void *user_data) |
| typedef size_t(* | bj_stream_size_fn) (void *user_data) |
| typedef bj_bool(* | bj_stream_flush_fn) (void *user_data) |
| typedef void(* | bj_stream_close_fn) (void *user_data) |
Enumerations | |
| enum | bj_seek_origin { BJ_SEEK_BEGIN = 0x00 , BJ_SEEK_CURRENT = 0x01 , BJ_SEEK_END = 0x02 } |
| enum | bj_stream_flag { BJ_STREAM_READ = 0x01 , BJ_STREAM_WRITE = 0x02 , BJ_STREAM_APPEND = 0x04 , BJ_STREAM_TRUNCATE = 0x08 , BJ_STREAM_CREATE = 0x10 , BJ_STREAM_EXCLUSIVE = 0x20 , BJ_STREAM_READ_WRITE = BJ_STREAM_READ | BJ_STREAM_WRITE } |
| enum | bj_stream_status { BJ_STREAM_STATUS_OK = 0 , BJ_STREAM_STATUS_END = 1 , BJ_STREAM_STATUS_NOT_READY = 2 , BJ_STREAM_STATUS_ERROR = 3 , BJ_STREAM_STATUS_READ_ONLY = 4 , BJ_STREAM_STATUS_WRITE_ONLY = 5 , BJ_STREAM_STATUS_LOCKED = 6 } |
Functions | |
| struct bj_stream * | bj_create_stream (void) |
| struct bj_stream * | bj_allocate_stream (void) |
| struct bj_stream * | bj_create_stream_from_read_memory (const void *data, size_t length) |
| struct bj_stream * | bj_open_stream_read (const void *data, size_t length) |
| struct bj_stream * | bj_create_stream_from_memory (void *data, size_t length, uint32_t flags) |
| struct bj_stream * | bj_create_stream_from_path (struct bj_str path, uint32_t flags, struct bj_error **error) |
| struct bj_stream * | bj_open_stream_file (const char *path, struct bj_error **error) |
| struct bj_stream * | bj_create_stream_from_callbacks (const struct bj_stream_callbacks *callbacks, uint32_t flags, void *user_data, struct bj_error **error) |
| struct bj_stream * | bj_create_stream_span (struct bj_stream *parent, size_t offset, size_t length) |
| void | bj_destroy_stream (struct bj_stream *stream) |
| void | bj_close_stream (struct bj_stream *stream) |
| size_t | bj_read_stream (struct bj_stream *stream, void *dest, size_t count) |
| size_t | bj_write_stream (struct bj_stream *stream, const void *data, size_t count) |
| bj_bool | bj_flush_stream (struct bj_stream *stream) |
| size_t | bj_stream_length (struct bj_stream *stream) |
| size_t | bj_get_stream_length (struct bj_stream *stream) |
| size_t | bj_seek_stream (struct bj_stream *stream, ptrdiff_t position, enum bj_seek_origin from) |
| size_t | bj_stream_position (struct bj_stream *stream) |
| size_t | bj_tell_stream (struct bj_stream *stream) |
| const void * | bj_stream_peek (struct bj_stream *stream, size_t offset, size_t length) |
| enum bj_stream_status | bj_stream_status (const struct bj_stream *stream) |
| void | bj_clear_stream_status (struct bj_stream *stream) |
| uint32_t | bj_stream_flags (const struct bj_stream *stream) |
| bj_bool | bj_stream_has_flag (const struct bj_stream *stream, enum bj_stream_flag flag) |
| bj_bool | bj_stream_is_seekable (const struct bj_stream *stream) |
| bj_bool | bj_stream_is_mapped (const struct bj_stream *stream) |
Byte-order reads and writes | |
Each reader takes the bytes of one integer at the cursor and decodes them in the order its name gives, _le for little-endian and _be for big-endian, whatever the order of the computer. Signed integers are in two's complement. It gives BJ_TRUE when all the bytes were there. Else BJ_FALSE, with the destination left as it was, the bytes that were left consumed, and the reason in bj_stream_status. A 0 destination skips the integer. Each writer stores one integer at the cursor in the order its name gives, and gives BJ_TRUE when all its bytes went through. A 0 stream gives BJ_FALSE. | |
| bj_bool | bj_read_stream_u8 (struct bj_stream *stream, uint8_t *value) |
| bj_bool | bj_read_stream_i8 (struct bj_stream *stream, int8_t *value) |
| bj_bool | bj_read_stream_u16_le (struct bj_stream *stream, uint16_t *value) |
| bj_bool | bj_read_stream_u16_be (struct bj_stream *stream, uint16_t *value) |
| bj_bool | bj_read_stream_i16_le (struct bj_stream *stream, int16_t *value) |
| bj_bool | bj_read_stream_i16_be (struct bj_stream *stream, int16_t *value) |
| bj_bool | bj_read_stream_u32_le (struct bj_stream *stream, uint32_t *value) |
| bj_bool | bj_read_stream_u32_be (struct bj_stream *stream, uint32_t *value) |
| bj_bool | bj_read_stream_i32_le (struct bj_stream *stream, int32_t *value) |
| bj_bool | bj_read_stream_i32_be (struct bj_stream *stream, int32_t *value) |
| bj_bool | bj_read_stream_u64_le (struct bj_stream *stream, uint64_t *value) |
| bj_bool | bj_read_stream_u64_be (struct bj_stream *stream, uint64_t *value) |
| bj_bool | bj_read_stream_i64_le (struct bj_stream *stream, int64_t *value) |
| bj_bool | bj_read_stream_i64_be (struct bj_stream *stream, int64_t *value) |
| bj_bool | bj_write_stream_u8 (struct bj_stream *stream, uint8_t value) |
| bj_bool | bj_write_stream_i8 (struct bj_stream *stream, int8_t value) |
| bj_bool | bj_write_stream_u16_le (struct bj_stream *stream, uint16_t value) |
| bj_bool | bj_write_stream_u16_be (struct bj_stream *stream, uint16_t value) |
| bj_bool | bj_write_stream_i16_le (struct bj_stream *stream, int16_t value) |
| bj_bool | bj_write_stream_i16_be (struct bj_stream *stream, int16_t value) |
| bj_bool | bj_write_stream_u32_le (struct bj_stream *stream, uint32_t value) |
| bj_bool | bj_write_stream_u32_be (struct bj_stream *stream, uint32_t value) |
| bj_bool | bj_write_stream_i32_le (struct bj_stream *stream, int32_t value) |
| bj_bool | bj_write_stream_i32_be (struct bj_stream *stream, int32_t value) |
| bj_bool | bj_write_stream_u64_le (struct bj_stream *stream, uint64_t value) |
| bj_bool | bj_write_stream_u64_be (struct bj_stream *stream, uint64_t value) |
| bj_bool | bj_write_stream_i64_le (struct bj_stream *stream, int64_t value) |
| bj_bool | bj_write_stream_i64_be (struct bj_stream *stream, int64_t value) |