|
Cthulhu
0.2.10
Cthulhu compiler collection
|
Unified interface over streaming io. More...

Modules | |
| io implementation details | |
| internal io implementation details | |
| typedef typedefCT_BEGIN_API struct io_t | io_t |
| CT_IO_API os_error_t | io_free (STA_RELEASE io_t *io) |
| destroy an IO object and free its memory More... | |
| CT_IO_API os_error_t | io_close (INOUT_NOTNULL io_t *io) |
| destroy an IO object More... | |
| CT_NODISCARD CT_IO_API io_t * | io_file (const char *path, os_access_t mode, arena_t *arena) |
| create an IO object from a file More... | |
| CT_NODISCARD CT_IO_API io_t * | io_memory (const char *name, const void *data, size_t size, os_access_t flags, arena_t *arena) |
| create an IO object from an initial view of memory More... | |
| CT_NODISCARD CT_IO_API io_t * | io_blob (const char *name, size_t size, os_access_t flags, arena_t *arena) |
create an IO object in memory of a given size size specifies the initial internal buffer size, the file seek position starts at 0 More... | |
| CT_NODISCARD CT_IO_API io_t * | io_view (const char *name, const void *data, size_t size, arena_t *arena) |
| create a readonly IO object for a given view of memory More... | |
| CT_NODISCARD CT_IO_API io_t * | io_string (const char *name, const char *string, arena_t *arena) |
| create an IO view of a string create a readonly IO view of a string More... | |
| CT_NODISCARD CT_IO_API io_t * | io_file_init (STA_WRITES(IO_FILE_SIZE) void *buffer, const char *path, os_access_t mode) |
| create an io object from a file initializes an io object using a preallocated buffer. More... | |
| CT_NODISCARD CT_IO_API io_t * | io_memory_init (STA_WRITES(IO_BUFFER_SIZE) void *buffer, const char *name, const void *data, size_t size, os_access_t flags, arena_t *arena) |
| create an io object from a memory buffer initializes an io object using a preallocated buffer. More... | |
| CT_NODISCARD CT_IO_API io_t * | io_blob_init (STA_WRITES(IO_BUFFER_SIZE) void *buffer, const char *name, size_t size, os_access_t flags, arena_t *arena) |
| create an io object from a memory buffer initializes an io object using a preallocated buffer. More... | |
| CT_NODISCARD CT_IO_API io_t * | io_view_init (STA_WRITES(IO_VIEW_SIZE) void *buffer, const char *name, const void *data, size_t size) |
| create an io object from a memory buffer initializes an io object using a preallocated buffer. More... | |
| CT_NODISCARD CT_IO_API io_t * | io_string_init (STA_WRITES(IO_VIEW_SIZE) void *buffer, const char *name, const char *string) |
| create an io object from a memory buffer initializes an io object using a preallocated buffer. More... | |
| CT_IO_API size_t | io_read (io_t *io, STA_WRITES(size) void *dst, size_t size) |
| read from an io object More... | |
| CT_IO_API size_t | io_write (io_t *io, STA_READS(size) const void *src, size_t size) |
| write to an io object More... | |
| CT_IO_API size_t | io_printf (io_t *io, STA_FORMAT_STRING const char *fmt,...) |
| printf to an io object More... | |
| CT_IO_API size_t | io_vprintf (io_t *io, const char *fmt, va_list args) |
| vprintf to an io object More... | |
| CT_NODISCARD CT_IO_API const char * | io_name (const io_t *io) |
| get the name of an io object More... | |
| CT_NODISCARD CT_IO_API size_t | io_size (io_t *io) |
| get the total size of an io objects contents More... | |
| CT_NODISCARD CT_IO_API size_t | io_seek (io_t *io, size_t offset) |
| seek to an absolute offset in a file More... | |
| CT_NODISCARD CT_IO_API void * | io_map (io_t *io, os_protect_t protect) |
| map an io object into memory maps an io objects entire contents into memory. More... | |
| CT_NODISCARD CT_IO_API os_error_t | io_error (const io_t *io) |
| get the last error from the io object More... | |
| CT_IO_API io_t * | io_stdout (void) |
| get the global stdout IO object More... | |
| CT_IO_API io_t * | io_stderr (void) |
| get the global stderr IO object More... | |
Unified interface over streaming io.
| CT_NODISCARD CT_IO_API io_t* io_blob | ( | const char * | name, |
| size_t | size, | ||
| os_access_t | flags, | ||
| arena_t * | arena | ||
| ) |
create an IO object in memory of a given size size specifies the initial internal buffer size, the file seek position starts at 0
| name | the name of the io object |
| size | the starting size of the buffer |
| flags | the access mode |
| arena | the arena to allocate from |
| CT_NODISCARD CT_IO_API io_t* io_blob_init | ( | STA_WRITES(IO_BUFFER_SIZE) void * | buffer, |
| const char * | name, | ||
| size_t | size, | ||
| os_access_t | flags, | ||
| arena_t * | arena | ||
| ) |
create an io object from a memory buffer initializes an io object using a preallocated buffer.
buffer must be at least IO_MEMORY_SIZE bytes large buffer must be aligned to alignof(io_t) | buffer | the buffer to use for the io object |
| name | the name of the io object |
| size | the starting size of the buffer |
| flags | the access mode |
| arena | the arena to allocate from |
| CT_IO_API os_error_t io_close | ( | INOUT_NOTNULL io_t * | io | ) |
destroy an IO object
| io | the io object |
| CT_NODISCARD CT_IO_API os_error_t io_error | ( | const io_t * | io | ) |
| CT_NODISCARD CT_IO_API io_t* io_file | ( | const char * | path, |
| os_access_t | mode, | ||
| arena_t * | arena | ||
| ) |
| CT_NODISCARD CT_IO_API io_t* io_file_init | ( | STA_WRITES(IO_FILE_SIZE) void * | buffer, |
| const char * | path, | ||
| os_access_t | mode | ||
| ) |
create an io object from a file initializes an io object using a preallocated buffer.
buffer must be at least IO_FILE_SIZE bytes large buffer must be aligned to alignof(io_t) | buffer | the buffer to use for the io object |
| path | the path to the file |
| mode | the access mode of the file |
| CT_IO_API os_error_t io_free | ( | STA_RELEASE io_t * | io | ) |
destroy an IO object and free its memory
| io | the io object |
| CT_NODISCARD CT_IO_API void* io_map | ( | io_t * | io, |
| os_protect_t | protect | ||
| ) |
map an io object into memory maps an io objects entire contents into memory.
protect as well as the access mode the io object was created with.| io | the io object to map from |
| protect | the protection level of the memory |
| CT_NODISCARD CT_IO_API io_t* io_memory | ( | const char * | name, |
| const void * | data, | ||
| size_t | size, | ||
| os_access_t | flags, | ||
| arena_t * | arena | ||
| ) |
create an IO object from an initial view of memory
size bytes from data into a new buffer| name | the name of the io block |
| data | the data to copy into the initial buffer |
| size | the size of the data |
| flags | the access mode of the file |
| arena | the arena to allocate from |
public allocating api
| CT_NODISCARD CT_IO_API io_t* io_memory_init | ( | STA_WRITES(IO_BUFFER_SIZE) void * | buffer, |
| const char * | name, | ||
| const void * | data, | ||
| size_t | size, | ||
| os_access_t | flags, | ||
| arena_t * | arena | ||
| ) |
create an io object from a memory buffer initializes an io object using a preallocated buffer.
buffer must be at least IO_MEMORY_SIZE bytes large buffer must be aligned to alignof(io_t) | buffer | the buffer to use for the io object |
| name | the name of the io block |
| data | the data to copy into the initial buffer |
| size | the size of the data |
| flags | the access mode of the file |
| arena | the arena to allocate from |
| CT_NODISCARD CT_IO_API const char* io_name | ( | const io_t * | io | ) |
| CT_IO_API size_t io_printf | ( | io_t * | io, |
| STA_FORMAT_STRING const char * | fmt, | ||
| ... | |||
| ) |
printf to an io object
| io | the io object |
| fmt | the format string |
| ... | the format arguments |
| CT_IO_API size_t io_read | ( | io_t * | io, |
| STA_WRITES(size) void * | dst, | ||
| size_t | size | ||
| ) |
read from an io object
| io | the io object |
| dst | the dst buffer to read into |
| size | the number of bytes to read |
| CT_NODISCARD CT_IO_API size_t io_seek | ( | io_t * | io, |
| size_t | offset | ||
| ) |
| CT_NODISCARD CT_IO_API size_t io_size | ( | io_t * | io | ) |
| CT_IO_API io_t* io_stderr | ( | void | ) |
| CT_IO_API io_t* io_stdout | ( | void | ) |
| CT_NODISCARD CT_IO_API io_t* io_string | ( | const char * | name, |
| const char * | string, | ||
| arena_t * | arena | ||
| ) |
| CT_NODISCARD CT_IO_API io_t* io_string_init | ( | STA_WRITES(IO_VIEW_SIZE) void * | buffer, |
| const char * | name, | ||
| const char * | string | ||
| ) |
create an io object from a memory buffer initializes an io object using a preallocated buffer.
buffer must be at least IO_VIEW_SIZE bytes large buffer must be aligned to alignof(io_t) | buffer | the buffer to use for the io object |
| name | the name of the IO view |
| string | the backing string view |
| CT_NODISCARD CT_IO_API io_t* io_view | ( | const char * | name, |
| const void * | data, | ||
| size_t | size, | ||
| arena_t * | arena | ||
| ) |
create a readonly IO object for a given view of memory
data must point to a valid memory region of size bytes| name | the name of the IO view |
| data | the data to provide in the view |
| size | the size of the data |
| arena | the arena to allocate from |
public allocating api
| CT_NODISCARD CT_IO_API io_t* io_view_init | ( | STA_WRITES(IO_VIEW_SIZE) void * | buffer, |
| const char * | name, | ||
| const void * | data, | ||
| size_t | size | ||
| ) |
create an io object from a memory buffer initializes an io object using a preallocated buffer.
buffer must be at least IO_VIEW_SIZE bytes large buffer must be aligned to alignof(io_t) | buffer | the buffer to use for the io object |
| name | the name of the IO view |
| data | the data to provide in the view |
| size | the size of the data |
| CT_IO_API size_t io_vprintf | ( | io_t * | io, |
| const char * | fmt, | ||
| va_list | args | ||
| ) |
write to an io object
| io | the io object |
| src | the source buffer to copy from |
| size | the number of bytes to copy into the file |