|
Cthulhu
0.2.10
Cthulhu compiler collection
|
Generic vector of typed values. More...

Data Structures | |
| struct | typevec_t |
| A vector with a fixed type size. More... | |
Functions | |
| CT_STD_API void | typevec_init (typevec_t *vec, size_t width, size_t len, arena_t *arena) |
| initialize a typed vector More... | |
| CT_STD_API typevec_t | typevec_make (size_t width, size_t len, arena_t *arena) |
| create a new typed vector on the stack More... | |
| CT_NODISCARD CT_STD_API typevec_t * | typevec_new (size_t width, size_t len, arena_t *arena) |
| create a new typed vector on the heap More... | |
| CT_NODISCARD CT_STD_API typevec_t * | typevec_of (size_t width, size_t len, arena_t *arena) |
| create a new typed vector with an initial size and length More... | |
| CT_NODISCARD CT_STD_API typevec_t * | typevec_of_array (size_t width, STA_READS(count *width) const void *src, size_t count, arena_t *arena) |
create a new typed vector from an array this copies count * width bytes from src to the vector More... | |
| CT_NODISCARD CT_STD_API typevec_t * | typevec_slice (const typevec_t *vec, size_t start, size_t end) |
| create a new typevec from an existing typevec More... | |
| CT_NODISCARD CT_PUREFN CT_STD_API size_t | typevec_len (const typevec_t *vec) |
| get the length of a vector More... | |
| CT_STD_API void | typevec_set (typevec_t *vec, size_t index, const void *src) |
| set an element in the vector More... | |
| CT_STD_API void | typevec_get (const typevec_t *vec, size_t index, STA_WRITES(vec->width) void *dst) |
| get an element from the vector More... | |
| CT_STD_API void | typevec_tail (const typevec_t *vec, void *dst) |
| get the last element from the vector More... | |
| CT_STD_API void * | typevec_push (typevec_t *vec, const void *src) |
| push a value onto the vector More... | |
| CT_STD_API void | typevec_append (typevec_t *vec, const void *src, size_t len) |
| append multiple values onto the vector More... | |
| CT_STD_API void | typevec_pop (typevec_t *vec, void *dst) |
| pop a value from the vector More... | |
| CT_NODISCARD CT_PUREFN CT_STD_API void * | typevec_offset (const typevec_t *vec, size_t index) |
| get a pointer to the value at the given index More... | |
| CT_NODISCARD CT_PUREFN CT_STD_API void * | typevec_data (const typevec_t *vec) |
| get a pointer to the underlying data More... | |
| CT_STD_API void | typevec_sort (typevec_t *vec, int(*cmp)(const void *, const void *)) |
| sort a vector More... | |
| CT_STD_API void | typevec_reset (typevec_t *vec) |
| reset a vector More... | |
Variables | |
| CT_STD_API const typevec_t | kEmptyTypevec |
Generic vector of typed values.
| CT_STD_API void typevec_append | ( | typevec_t * | vec, |
| const void * | src, | ||
| size_t | len | ||
| ) |
| CT_NODISCARD CT_PUREFN CT_STD_API void* typevec_data | ( | const typevec_t * | vec | ) |
| CT_STD_API void typevec_get | ( | const typevec_t * | vec, |
| size_t | index, | ||
| STA_WRITES(vec->width) void * | dst | ||
| ) |
get an element from the vector
index < typevec_len(vec) this copies width bytes from the vector at index index to dst | vec | the vector to get the value from |
| index | the index to get the value from |
| dst | the destination to copy the value to |
| CT_NODISCARD CT_PUREFN CT_STD_API size_t typevec_len | ( | const typevec_t * | vec | ) |
| CT_NODISCARD CT_STD_API typevec_t* typevec_new | ( | size_t | width, |
| size_t | len, | ||
| arena_t * | arena | ||
| ) |
| CT_NODISCARD CT_STD_API typevec_t* typevec_of | ( | size_t | width, |
| size_t | len, | ||
| arena_t * | arena | ||
| ) |
create a new typed vector with an initial size and length
len using typevec_set with valid values rather than using typevec_push | width | the size of the type |
| len | the initial length of the vector |
| arena | the arena to allocate from |
| CT_NODISCARD CT_STD_API typevec_t* typevec_of_array | ( | size_t | width, |
| STA_READS(count *width) const void * | src, | ||
| size_t | count, | ||
| arena_t * | arena | ||
| ) |
create a new typed vector from an array this copies count * width bytes from src to the vector
| width | the size of the type |
| src | the array to copy from |
| count | the number of elements in the array |
| arena | the arena to allocate from |
| CT_NODISCARD CT_PUREFN CT_STD_API void* typevec_offset | ( | const typevec_t * | vec, |
| size_t | index | ||
| ) |
get a pointer to the value at the given index
index < typevec_len(vec) | vec | the vector to get the value from |
| index | the index to get the value from |
| CT_STD_API void typevec_pop | ( | typevec_t * | vec, |
| void * | dst | ||
| ) |
| CT_STD_API void* typevec_push | ( | typevec_t * | vec, |
| const void * | src | ||
| ) |
| CT_STD_API void typevec_reset | ( | typevec_t * | vec | ) |
| CT_STD_API void typevec_set | ( | typevec_t * | vec, |
| size_t | index, | ||
| const void * | src | ||
| ) |
| CT_NODISCARD CT_STD_API typevec_t* typevec_slice | ( | const typevec_t * | vec, |
| size_t | start, | ||
| size_t | end | ||
| ) |
| CT_STD_API void typevec_sort | ( | typevec_t * | vec, |
| int(*)(const void *, const void *) | cmp | ||
| ) |
| CT_STD_API void typevec_tail | ( | const typevec_t * | vec, |
| void * | dst | ||
| ) |