From 200a539df68c321eb8678cc1d35a75832c2b738b Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Tue, 1 Dec 2020 08:04:01 +0100 Subject: Small fixes, and changed tag parameter name to X. --- docs/cbitset_api.md | 10 ++--- docs/clist_api.md | 90 +++++++++++++++++++------------------- docs/cmap_api.md | 94 ++++++++++++++++++++-------------------- docs/cset_api.md | 78 ++++++++++++++++----------------- docs/cvec_api.md | 122 ++++++++++++++++++++++++++-------------------------- 5 files changed, 197 insertions(+), 197 deletions(-) diff --git a/docs/cbitset_api.md b/docs/cbitset_api.md index 1fa28fe8..d485f35a 100644 --- a/docs/cbitset_api.md +++ b/docs/cbitset_api.md @@ -27,8 +27,9 @@ The interfaces to create a cbitset object: cbitset_t cbitset_init(void); cbitset_t cbitset_with_size(size_t size, bool value); cbitset_t cbitset_from_str(const char* str); -cbitset_t cbitset_clone(cbitset_t other); -cbitset_t cbitset_move(cbitset_t* self); +void cbitset_resize(cbitset_t* self, size_t size, bool value); + +void cbitset_del(cbitset_t* self); cbitset_t cbitset_intersect(cbitset_t s1, cbitset_t s2); cbitset_t cbitset_union(cbitset_t s1, cbitset_t s2); @@ -37,9 +38,8 @@ cbitset_t cbitset_not(cbitset_t s1); cbitset_t* cbitset_take(cbitset_t* self, cbitset_t other); cbitset_t* cbitset_assign(cbitset_t* self, cbitset_t other); - -void cbitset_resize(cbitset_t* self, size_t size, bool value); -void cbitset_del(cbitset_t* self); +cbitset_t cbitset_clone(cbitset_t other); +cbitset_t cbitset_move(cbitset_t* self); size_t cbitset_size(cbitset_t set); size_t cbitset_count(cbitset_t set); diff --git a/docs/clist_api.md b/docs/clist_api.md index eba55a90..74ae44f5 100644 --- a/docs/clist_api.md +++ b/docs/clist_api.md @@ -9,15 +9,15 @@ This describes the API of circular singly linked list type **clist**. ```c #define using_clist_str() -#define using_clist(T, Value, valueDestroy=c_default_del, +#define using_clist(X, Value, valueDestroy=c_default_del, valueCompareRaw=c_default_compare, RawValue=Value, valueToRaw=c_default_to_raw, valueFromRaw=c_default_from_raw) ``` The macro `using_clist()` can be instantiated with 2, 3, 4, or 7 arguments in the global scope. -Default values are given above for args not specified. `T` is a type tag name and -will affect the names of all clist types and methods. E.g. declaring `using_clist(my, int);`, `T` should +Default values are given above for args not specified. `X` is a type tag name and +will affect the names of all clist types and methods. E.g. declaring `using_clist(my, int);`, `X` should be replaced by `my` in all of the following documentation. `using_clist_str()` is a predefined macro for `using_clist(str, cstr_t, ...)`. @@ -26,17 +26,17 @@ be replaced by `my` in all of the following documentation. | Type name | Type definition | Used to represent... | |:----------------------|:---------------------------------------|:------------------------------------| -| `clist_T` | `struct { clist_T_node_t* last; }` | The clist type | -| `clist_T_node_t` | `struct {` | clist node | -| | ` struct clist_T_node* next;` | | -| | ` clist_T_value_t value;` | | +| `clist_X` | `struct { clist_X_node_t* last; }` | The clist type | +| `clist_X_node_t` | `struct {` | clist node | +| | ` struct clist_X_node* next;` | | +| | ` clist_X_value_t value;` | | | | `}` | | -| `clist_T_value_t` | `Value` | The clist element type | -| `clist_T_input_t` | `clist_T_value_t` | clist input type | -| `clist_T_rawvalue_t` | `RawValue` | clist raw value type | -| `clist_T_iter_t` | `struct {` | clist iterator | +| `clist_X_value_t` | `Value` | The clist element type | +| `clist_X_input_t` | `clist_X_value_t` | clist input type | +| `clist_X_rawvalue_t` | `RawValue` | clist raw value type | +| `clist_X_iter_t` | `struct {` | clist iterator | +| | ` clist_X_value_t* val;` | | | | ` ...;` | | -| | ` clist_T_value_t* val;` | | | | `}` | | @@ -58,52 +58,52 @@ All clist definitions and prototypes may be included in your C source file by in ### Construction -The interfaces to create a clist_T object: +The interfaces to create a clist_X object: ```c -clist_T clist_T_init(void); +clist_X clist_X_init(void); -void clist_T_clear(clist_T* self); -void clist_T_del(clist_T* self); +void clist_X_clear(clist_X* self); +void clist_X_del(clist_X* self); -bool clist_T_empty(clist_T list); -size_t clist_T_size(clist_T list); -Value clist_T_value_from_raw(RawValue val); +bool clist_X_empty(clist_X list); +size_t clist_X_size(clist_X list); +Value clist_X_value_from_raw(RawValue val); -clist_T_value_t* clist_T_front(clist_T* self); -clist_T_value_t* clist_T_back(clist_T* self); +clist_X_value_t* clist_X_front(clist_X* self); +clist_X_value_t* clist_X_back(clist_X* self); -void clist_T_push_n(clist_T *self, const clist_T_input_t in[], size_t size); -void clist_T_push_back(clist_T* self, Value value); -void clist_T_emplace_back(clist_T* self, RawValue val); +void clist_X_push_n(clist_X *self, const clist_X_input_t in[], size_t size); +void clist_X_push_back(clist_X* self, Value value); +void clist_X_emplace_back(clist_X* self, RawValue val); -void clist_T_push_front(clist_T* self, Value value); -void clist_T_emplace_front(clist_T* self, RawValue val); -void clist_T_pop_front(clist_T* self); +void clist_X_push_front(clist_X* self, Value value); +void clist_X_emplace_front(clist_X* self, RawValue val); +void clist_X_pop_front(clist_X* self); -clist_T_iter_t clist_T_insert_after(clist_T* self, clist_T_iter_t pos, Value val); -clist_T_iter_t clist_T_emplace_after(clist_T* self, clist_T_iter_t pos, RawValue val); +clist_X_iter_t clist_X_insert_after(clist_X* self, clist_X_iter_t pos, Value val); +clist_X_iter_t clist_X_emplace_after(clist_X* self, clist_X_iter_t pos, RawValue val); -clist_T_iter_t clist_T_erase_after(clist_T* self, clist_T_iter_t pos); -clist_T_iter_t clist_T_erase_range_after(clist_T* self, clist_T_iter_t pos, clist_T_iter_t finish); +clist_X_iter_t clist_X_erase_after(clist_X* self, clist_X_iter_t pos); +clist_X_iter_t clist_X_erase_range_after(clist_X* self, clist_X_iter_t pos, clist_X_iter_t finish); -void clist_T_splice_front(clist_T* self, clist_T* other); -void clist_T_splice_back(clist_T* self, clist_T* other); -void clist_T_splice_after(clist_T* self, clist_T_iter_t pos, clist_T* other); +void clist_X_splice_front(clist_X* self, clist_X* other); +void clist_X_splice_back(clist_X* self, clist_X* other); +void clist_X_splice_after(clist_X* self, clist_X_iter_t pos, clist_X* other); -clist_T_iter_t clist_T_find(const clist_T* self, RawValue val); -clist_T_iter_t clist_T_find_before(const clist_T* self, - clist_T_iter_t first, clist_T_iter_t finish, RawValue val); +clist_X_iter_t clist_X_find(const clist_X* self, RawValue val); +clist_X_iter_t clist_X_find_before(const clist_X* self, + clist_X_iter_t first, clist_X_iter_t finish, RawValue val); -size_t clist_T_remove(clist_T* self, RawValue val); +size_t clist_X_remove(clist_X* self, RawValue val); -void clist_T_sort(clist_T* self); +void clist_X_sort(clist_X* self); -clist_T_iter_t clist_T_before_begin(const clist_T* self); -clist_T_iter_t clist_T_begin(const clist_T* self); -clist_T_iter_t clist_T_last(const clist_T* self); -clist_T_iter_t clist_T_end(const clist_T* self); -void clist_T_next(clist_T_iter_t* it); -clist_T_value_t* clist_T_itval(clist_T_iter_t it); +clist_X_iter_t clist_X_before_begin(const clist_X* self); +clist_X_iter_t clist_X_begin(const clist_X* self); +clist_X_iter_t clist_X_last(const clist_X* self); +clist_X_iter_t clist_X_end(const clist_X* self); +void clist_X_next(clist_X_iter_t* it); +clist_X_value_t* clist_X_itval(clist_X_iter_t it); ``` Example: diff --git a/docs/cmap_api.md b/docs/cmap_api.md index 05d59da8..3062bc07 100644 --- a/docs/cmap_api.md +++ b/docs/cmap_api.md @@ -11,14 +11,14 @@ This describes the API of the unordered map type **cmap**. #define using_cmap_strkey(Mapped, mappedDestroy=c_default_del) -#define using_cmap_strval(T, Key, keyEquals=c_default_equals, +#define using_cmap_strval(X, Key, keyEquals=c_default_equals, keyHash=c_default_hash16, keyDestroy=c_default_del, RawKey=Key, keyToRaw=c_default_to_raw, keyFromRaw=c_default_from_raw) -#define using_cmap(T, Key, Mapped, mappedDestroy=c_default_del, +#define using_cmap(X, Key, Mapped, mappedDestroy=c_default_del, keyEqualsRaw=c_default_equals, keyHashRaw=c_default_hash16, keyDestroy=c_default_del, @@ -29,8 +29,8 @@ This describes the API of the unordered map type **cmap**. mappedFromRaw=c_default_from_raw) ``` The macro `using_cmap()` can be instantiated with 3, 4, 6, 10, or 12 arguments in the global scope. -Default values are given above for args not specified. `T` is a type tag name and -will affect the names of all cmap types and methods. E.g. declaring `using_cmap(my, int);`, `T` should +Default values are given above for args not specified. `X` is a type tag name and +will affect the names of all cmap types and methods. E.g. declaring `using_cmap(my, int);`, `X` should be replaced by `my` in all of the following documentation. `using_cmap_str()` is a predefined macro for `using_cmap(str, cstr_t, ...)`. @@ -39,25 +39,25 @@ be replaced by `my` in all of the following documentation. | Type name | Type definition | Used to represent... | |:---------------------|:--------------------------------------|:-----------------------------------| -| `cmap_T` | `struct {` | The cmap type | -| | ` cmap_T_value_t* table; | | +| `cmap_X` | `struct {` | The cmap type | +| | ` cmap_X_value_t* table;` | | | | ` uint8_t* _hashx;` | | | | ` ...;` | | | | `}` | | -| `cmap_T_key_t` | `Key` | The cmap key type | -| `cmap_T_mapped_t` | `Mapped` | cmap mapped type | -| `cmap_T_value_t` | `struct {` | The cmap value type | -| | ` cmap_T_key_t first; | | -| | ` cmap_T_mapped_t second;` | | +| `cmap_X_key_t` | `Key` | The cmap key type | +| `cmap_X_mapped_t` | `Mapped` | cmap mapped type | +| `cmap_X_value_t` | `struct {` | The cmap value type | +| | ` cmap_X_key_t first;` | | +| | ` cmap_X_mapped_t second;` | | | | `}` | | -| `cmap_T_input_t` | `cmap_T_value_t` | cmap input type | -| `cmap_T_rawvalue_t` | `RawMapped` | cmap raw value type | -| `cmap_T_result_t` | `struct {` | Result of insert/put/emplace | -| | ` cmap_T_value_t* first;` | | -| | ` bool second;` /* inserted */ | | +| `cmap_X_input_t` | `cmap_X_value_t` | cmap input type | +| `cmap_X_rawvalue_t` | `RawMapped` | cmap raw value type | +| `cmap_X_result_t` | `struct {` | Result of insert/put/emplace | +| | ` cmap_X_value_t* first;` | | +| | ` bool second; /* inserted */` | | | | `}` | | -| `cmap_T_iter_t` | `struct {` | cmap iterator | -| | ` cmap_T_value_t* val;` | | +| `cmap_X_iter_t` | `struct {` | cmap iterator | +| | ` cmap_X_value_t* val;` | | | | ` ...;` | | | | `}` | | @@ -83,45 +83,45 @@ All cmap definitions and prototypes may be included in your C source file by inc ### Construction -The interface for cmap_T: +The interface for cmap_X: ```c -cmap_T cmap_T_init(void); -cmap_T cmap_T_with_capacity(size_t cap); -void cmap_T_set_load_factors(cmap_T* self, float max, float shrink); +cmap_X cmap_X_init(void); +cmap_X cmap_X_with_capacity(size_t cap); +void cmap_X_set_load_factors(cmap_X* self, float max, float shrink); -void cmap_T_clear(cmap_T* self); -void cmap_T_reserve(cmap_T* self, size_t size); -void cmap_T_swap(cmap_T* a, cmap_T* b); +void cmap_X_clear(cmap_X* self); +void cmap_X_reserve(cmap_X* self, size_t size); +void cmap_X_swap(cmap_X* a, cmap_X* b); -void cmap_T_del(cmap_T* self); +void cmap_X_del(cmap_X* self); -bool cmap_T_empty(cmap_T m); -size_t cmap_T_size(cmap_T m); -size_t cmap_T_bucket_count(cmap_T m); -size_t cmap_T_capacity(cmap_T m); +bool cmap_X_empty(cmap_X m); +size_t cmap_X_size(cmap_X m); +size_t cmap_X_bucket_count(cmap_X m); +size_t cmap_X_capacity(cmap_X m); -void cmap_T_push_n(cmap_T* self, const cmap_T_input_t in[], size_t size); +void cmap_X_push_n(cmap_X* self, const cmap_X_input_t in[], size_t size); -cmap_T_result_t cmap_T_emplace(cmap_T* self, RawKey rawKey, RawMapped rawVal); -cmap_T_result_t cmap_T_insert(cmap_T* self, cmap_T_input_t in); -cmap_T_result_t cmap_T_insert_or_assign(cmap_T* self, RawKey rawKey, RawMapped rawVal); -cmap_T_result_t cmap_T_put(cmap_T* self, RawKey rawKey, RawMapped rawVal); -cmap_T_result_t cmap_T_putv(cmap_T* self, RawKey rawKey, Mapped mapped); -cmap_T_mapped_t* cmap_T_at(const cmap_T* self, RawKey rawKey); +cmap_X_result_t cmap_X_emplace(cmap_X* self, RawKey rawKey, RawMapped rawVal); +cmap_X_result_t cmap_X_insert(cmap_X* self, cmap_X_input_t in); +cmap_X_result_t cmap_X_insert_or_assign(cmap_X* self, RawKey rawKey, RawMapped rawVal); +cmap_X_result_t cmap_X_put(cmap_X* self, RawKey rawKey, RawMapped rawVal); +cmap_X_result_t cmap_X_putv(cmap_X* self, RawKey rawKey, Mapped mapped); +cmap_X_mapped_t* cmap_X_at(const cmap_X* self, RawKey rawKey); -size_t cmap_T_erase(cmap_T* self, RawKey rawKey); -void cmap_T_erase_entry(cmap_T* self, cmap_T_value_t* val); -cmap_T_iter_t cmap_T_erase_at(cmap_T* self, cmap_T_iter_t pos); +size_t cmap_X_erase(cmap_X* self, RawKey rawKey); +void cmap_X_erase_entry(cmap_X* self, cmap_X_value_t* val); +cmap_X_iter_t cmap_X_erase_at(cmap_X* self, cmap_X_iter_t pos); -cmap_T_value_t* cmap_T_find(const cmap_T* self, RawKey rawKey); -bool cmap_T_contains(const cmap_T* self, RawKey rawKey); +cmap_X_value_t* cmap_X_find(const cmap_X* self, RawKey rawKey); +bool cmap_X_contains(const cmap_X* self, RawKey rawKey); -cmap_T_iter_t cmap_T_begin(cmap_T* self); -cmap_T_iter_t cmap_T_end(cmap_T* self); -void cmap_T_next(cmap_T_iter_t* it); -cmap_T_mapped_t* cmap_T_itval(cmap_T_iter_t it); +cmap_X_iter_t cmap_X_begin(cmap_X* self); +cmap_X_iter_t cmap_X_end(cmap_X* self); +void cmap_X_next(cmap_X_iter_t* it); +cmap_X_mapped_t* cmap_X_itval(cmap_X_iter_t it); -cmap_bucket_t cmap_T_bucket(const cmap_T* self, const cmap_T_rawkey_t* rawKeyPtr); +cmap_bucket_t cmap_X_bucket(const cmap_X* self, const cmap_X_rawkey_t* rawKeyPtr); uint32_t c_default_hash16(const void *data, size_t len); uint32_t c_default_hash32(const void* data, size_t len); diff --git a/docs/cset_api.md b/docs/cset_api.md index 88a735bd..5e24a56e 100644 --- a/docs/cset_api.md +++ b/docs/cset_api.md @@ -9,7 +9,7 @@ This describes the API of the unordered set type **cset**. ```c #define using_cset_str() -#define using_cset(T, Key, keyEqualsRaw=c_default_equals, +#define using_cset(X, Key, keyEqualsRaw=c_default_equals, keyHashRaw=c_default_hash16, keyDestroy=c_default_del, RawKey=Key, @@ -17,8 +17,8 @@ This describes the API of the unordered set type **cset**. keyFromRaw=c_default_from_raw) ``` The macro `using_cset()` can be instantiated with 2, 4, 5, or 8 arguments in the global scope. -Default values are given above for args not specified. `T` is a type tag name and -will affect the names of all cset types and methods. E.g. declaring `using_cset(my, int);`, `T` should +Default values are given above for args not specified. `X` is a type tag name and +will affect the names of all cset types and methods. E.g. declaring `using_cset(my, int);`, `X` should be replaced by `my` in all of the following documentation. `using_cset_str()` is a predefined macro for `using_cset(str, cstr_t, ...)`. @@ -27,21 +27,21 @@ be replaced by `my` in all of the following documentation. | Type name | Type definition | Used to represent... | |:---------------------|:--------------------------------------|:-----------------------------------| -| `cset_T` | `struct {` | The cset type | -| | ` cset_T_value_t* table; | | +| `cset_X` | `struct {` | The cset type | +| | ` cset_X_value_t* table;` | | | | ` uint8_t* _hashx;` | | | | ` ...;` | | | | `}` | | -| `cset_T_key_t` | `Key` | The cset key type | -| `cset_T_mapped_t` | `Mapped` | cset mapped type | -| `cset_T_value_t` | `Key` | The cset value type | -| `cset_T_result_t` | `struct {` | Result of insert/emplace | -| | ` cset_T_value_t* first;` | | -| | ` bool second;` /* inserted */ | | +| `cset_X_key_t` | `Key` | The cset key type | +| `cset_X_mapped_t` | `Mapped` | cset mapped type | +| `cset_X_value_t` | `Key` | The cset value type | +| `cset_X_result_t` | `struct {` | Result of insert/emplace | +| | ` cset_X_value_t* first;` | | +| | ` bool second; /* inserted */` | | | | `}` | | -| `cset_T_input_t` | `cset_T_value_t` | cset input type | -| `cset_T_iter_t` | `struct {` | cset iterator | -| | ` cset_T_value_t* val;` | | +| `cset_X_input_t` | `cset_X_value_t` | cset input type | +| `cset_X_iter_t` | `struct {` | cset iterator | +| | ` cset_X_value_t* val;` | | | | ` ...;` | | | | `}` | | @@ -67,41 +67,41 @@ All cset definitions and prototypes may be included in your C source file by inc ### Construction -The interface for cset_T: +The interface for cset_X: ```c -cset_T cset_T_init(void); -cset_T cset_T_with_capacity(size_t cap); -void cset_T_set_load_factors(cset_T* self, float max, float shrink); +cset_X cset_X_init(void); +cset_X cset_X_with_capacity(size_t cap); +void cset_X_set_load_factors(cset_X* self, float max, float shrink); -void cset_T_clear(cset_T* self); -void cset_T_reserve(cset_T* self, size_t size); -void cset_T_swap(cset_T* a, cset_T* b); +void cset_X_clear(cset_X* self); +void cset_X_reserve(cset_X* self, size_t size); +void cset_X_swap(cset_X* a, cset_X* b); -void cset_T_del(cset_T* self); +void cset_X_del(cset_X* self); -bool cset_T_empty(cset_T m); -size_t cset_T_size(cset_T m); -size_t cset_T_bucket_count(cset_T m); -size_t cset_T_capacity(cset_T m); +bool cset_X_empty(cset_X m); +size_t cset_X_size(cset_X m); +size_t cset_X_bucket_count(cset_X m); +size_t cset_X_capacity(cset_X m); -void cset_T_push_n(cset_T* self, const cset_T_input_t in[], size_t size); +void cset_X_push_n(cset_X* self, const cset_X_input_t in[], size_t size); -cset_T_result_t cset_T_emplace(cset_T* self, cset_T_rawkey_t rawKey); -cset_T_result_t cset_T_insert(cset_T* self, cset_T_rawkey_t rawKey); +cset_X_result_t cset_X_emplace(cset_X* self, cset_X_rawkey_t rawKey); +cset_X_result_t cset_X_insert(cset_X* self, cset_X_rawkey_t rawKey); -size_t cset_T_erase(cset_T* self, cset_T_rawkey_t rawKey); -void cset_T_erase_entry(cset_T* self, cset_T_key_t* key); -cset_T_iter_t cset_T_erase_at(cset_T* self, cset_T_iter_t pos); +size_t cset_X_erase(cset_X* self, cset_X_rawkey_t rawKey); +void cset_X_erase_entry(cset_X* self, cset_X_key_t* key); +cset_X_iter_t cset_X_erase_at(cset_X* self, cset_X_iter_t pos); -cset_T_value_t* cset_T_find(const cset_T* self, cset_T_rawkey_t rawKey); -bool cset_T_contains(const cset_T* self, cset_T_rawkey_t rawKey); +cset_X_value_t* cset_X_find(const cset_X* self, cset_X_rawkey_t rawKey); +bool cset_X_contains(const cset_X* self, cset_X_rawkey_t rawKey); -cset_T_iter_t cset_T_begin(cset_T* self); -cset_T_iter_t cset_T_end(cset_T* self); -void cset_T_next(cset_T_iter_t* it); -cset_T_mapped_t* cset_T_itval(cset_T_iter_t it); +cset_X_iter_t cset_X_begin(cset_X* self); +cset_X_iter_t cset_X_end(cset_X* self); +void cset_X_next(cset_X_iter_t* it); +cset_X_mapped_t* cset_X_itval(cset_X_iter_t it); -cset_bucket_t cset_T_bucket(const cset_T* self, const cset_T_rawkey_t* rawKeyPtr); +cset_bucket_t cset_X_bucket(const cset_X* self, const cset_X_rawkey_t* rawKeyPtr); uint32_t c_default_hash16(const void *data, size_t len); uint32_t c_default_hash32(const void* data, size_t len); diff --git a/docs/cvec_api.md b/docs/cvec_api.md index b9782341..1d521b55 100644 --- a/docs/cvec_api.md +++ b/docs/cvec_api.md @@ -9,15 +9,15 @@ This describes the API of vector type **cvec**. ```c #define using_cvec_str() -#define using_cvec(T, Value, valueDestroy=c_default_del, +#define using_cvec(X, Value, valueDestroy=c_default_del, valueCompareRaw=c_default_compare, RawValue=Value, valueToRaw=c_default_to_raw, valueFromRaw=c_default_from_raw) ``` The macro `using_cvec()` can be instantiated with 2, 3, 4, or 7 arguments in the global scope. -Defaults values are given above for args not specified. `T` is a type tag name and -will affect the names of all cvec types and methods. E.g. declaring `using_cvec(my, int);`, `T` should +Defaults values are given above for args not specified. `X` is a type tag name and +will affect the names of all cvec types and methods. E.g. declaring `using_cvec(my, int);`, `X` should be replaced by `my` in all of the following documentation. `using_cvec_str()` is a predefined macro for `using_cvec(str, cstr_t, ...)`. @@ -26,11 +26,11 @@ be replaced by `my` in all of the following documentation. | Type name | Type definition | Used to represent... | |:---------------------|:---------------------------------------|:------------------------------------| -| `cvec_T` | `struct { cvec_T_value_t* data; }` | The cvec type | -| `cvec_T_value_t` | `Value` | The cvec element type | -| `cvec_T_input_t` | `cvec_T_value_t` | cvec input type | -| `cvec_T_rawvalue_t` | `RawValue` | cvec raw value type | -| `cvec_T_iter_t` | `struct { cvec_T_value_t* val; }` | cvec iterator | +| `cvec_X` | `struct { cvec_X_value_t* data; }` | The cvec type | +| `cvec_X_value_t` | `Value` | The cvec element type | +| `cvec_X_input_t` | `cvec_X_value_t` | cvec input type | +| `cvec_X_rawvalue_t` | `RawValue` | cvec raw value type | +| `cvec_X_iter_t` | `struct { cvec_X_value_t* val; }` | cvec iterator | ## Constants and macros @@ -55,57 +55,57 @@ All cvec definitions and prototypes may be included in your C source file by inc The interface for cvec: ```c -cvec_T cvec_T_init(void); -cvec_T cvec_T_with_size(size_t size, Value fill_val); -cvec_T cvec_T_with_capacity(size_t size); - -void cvec_T_clear(cvec_T* self); -void cvec_T_reserve(cvec_T* self, size_t cap); -void cvec_T_resize(cvec_T* self, size_t size, Value fill_val); -void cvec_T_swap(cvec_T* a, cvec_T* b); - -void cvec_T_del(cvec_T* self); - -bool cvec_T_empty(cvec_T vec); -size_t cvec_T_size(cvec_T vec); -size_t cvec_T_capacity(cvec_T vec); -Value cvec_T_value_from_raw(RawValue val); - -cvec_T_value_t* cvec_T_at(cvec_T* self, size_t i); -cvec_T_value_t* cvec_T_front(cvec_T* self); -cvec_T_value_t* cvec_T_back(cvec_T* self); - -void cvec_T_push_n(cvec_T *self, const cvec_T_input_t in[], size_t size); -void cvec_T_push_back(cvec_T* self, Value value); -void cvec_T_emplace_back(cvec_T* self, RawValue val); -void cvec_T_pop_back(cvec_T* self); - -cvec_T_iter_t cvec_T_insert_at(cvec_T* self, cvec_T_iter_t pos, Value value); -cvec_T_iter_t cvec_T_insert_at_idx(cvec_T* self, size_t idx, Value value); -cvec_T_iter_t cvec_T_emplace_at(cvec_T* self, cvec_T_iter_t pos, RawValue val); -cvec_T_iter_t cvec_T_emplace_at_idx(cvec_T* self, size_t idx, RawValue val); -cvec_T_iter_t cvec_T_insert_range(cvec_T* self, cvec_T_iter_t pos, - cvec_T_iter_t first, cvec_T_iter_t finish); -cvec_T_iter_t cvec_T_insert_range_p(cvec_T* self, cvec_T_value_t* pos, - const cvec_T_value_t* pfirst, const cvec_T_value_t* pfinish); - -cvec_T_iter_t cvec_T_erase_at(cvec_T* self, cvec_T_iter_t pos); -cvec_T_iter_t cvec_T_erase_at_idx(cvec_T* self, size_t idx); -cvec_T_iter_t cvec_T_erase_range(cvec_T* self, cvec_T_iter_t first, cvec_T_iter_t finish); -cvec_T_iter_t cvec_T_erase_range_p(cvec_T* self, cvec_T_value_t* first, cvec_T_value_t* finish); -cvec_T_iter_t cvec_T_erase_range_idx(cvec_T* self, size_t ifirst, size_t ifinish); - -cvec_T_iter_t cvec_T_find(const cvec_T* self, RawValue val); -cvec_T_iter_t cvec_T_find_in_range(const cvec_T* self, - cvec_T_iter_t first, cvec_T_iter_t finish, RawValue val); - -void cvec_T_sort(cvec_T* self); -void cvec_T_sort_with(cvec_T* self, size_t ifirst, size_t ifinish, - int(*cmp)(const cvec_T_value_t*, const cvec_T_value_t*)); - -cvec_T_iter_t cvec_T_begin(const cvec_T* self); -cvec_T_iter_t cvec_T_last(const cvec_T* self); -cvec_T_iter_t cvec_T_end(const cvec_T* self); -void cvec_T_next(cvec_T_iter_t* it); -cvec_T_value_t* cvec_T_itval(cvec_T_iter_t it); +cvec_X cvec_X_init(void); +cvec_X cvec_X_with_size(size_t size, Value fill_val); +cvec_X cvec_X_with_capacity(size_t size); + +void cvec_X_clear(cvec_X* self); +void cvec_X_reserve(cvec_X* self, size_t cap); +void cvec_X_resize(cvec_X* self, size_t size, Value fill_val); +void cvec_X_swap(cvec_X* a, cvec_X* b); + +void cvec_X_del(cvec_X* self); + +bool cvec_X_empty(cvec_X vec); +size_t cvec_X_size(cvec_X vec); +size_t cvec_X_capacity(cvec_X vec); +Value cvec_X_value_from_raw(RawValue val); + +cvec_X_value_t* cvec_X_at(cvec_X* self, size_t i); +cvec_X_value_t* cvec_X_front(cvec_X* self); +cvec_X_value_t* cvec_X_back(cvec_X* self); + +void cvec_X_push_n(cvec_X *self, const cvec_X_input_t in[], size_t size); +void cvec_X_push_back(cvec_X* self, Value value); +void cvec_X_emplace_back(cvec_X* self, RawValue val); +void cvec_X_pop_back(cvec_X* self); + +cvec_X_iter_t cvec_X_insert_at(cvec_X* self, cvec_X_iter_t pos, Value value); +cvec_X_iter_t cvec_X_insert_at_idx(cvec_X* self, size_t idx, Value value); +cvec_X_iter_t cvec_X_emplace_at(cvec_X* self, cvec_X_iter_t pos, RawValue val); +cvec_X_iter_t cvec_X_emplace_at_idx(cvec_X* self, size_t idx, RawValue val); +cvec_X_iter_t cvec_X_insert_range(cvec_X* self, cvec_X_iter_t pos, + cvec_X_iter_t first, cvec_X_iter_t finish); +cvec_X_iter_t cvec_X_insert_range_p(cvec_X* self, cvec_X_value_t* pos, + const cvec_X_value_t* pfirst, const cvec_X_value_t* pfinish); + +cvec_X_iter_t cvec_X_erase_at(cvec_X* self, cvec_X_iter_t pos); +cvec_X_iter_t cvec_X_erase_at_idx(cvec_X* self, size_t idx); +cvec_X_iter_t cvec_X_erase_range(cvec_X* self, cvec_X_iter_t first, cvec_X_iter_t finish); +cvec_X_iter_t cvec_X_erase_range_p(cvec_X* self, cvec_X_value_t* first, cvec_X_value_t* finish); +cvec_X_iter_t cvec_X_erase_range_idx(cvec_X* self, size_t ifirst, size_t ifinish); + +cvec_X_iter_t cvec_X_find(const cvec_X* self, RawValue val); +cvec_X_iter_t cvec_X_find_in_range(const cvec_X* self, + cvec_X_iter_t first, cvec_X_iter_t finish, RawValue val); + +void cvec_X_sort(cvec_X* self); +void cvec_X_sort_with(cvec_X* self, size_t ifirst, size_t ifinish, + int(*cmp)(const cvec_X_value_t*, const cvec_X_value_t*)); + +cvec_X_iter_t cvec_X_begin(const cvec_X* self); +cvec_X_iter_t cvec_X_last(const cvec_X* self); +cvec_X_iter_t cvec_X_end(const cvec_X* self); +void cvec_X_next(cvec_X_iter_t* it); +cvec_X_value_t* cvec_X_itval(cvec_X_iter_t it); ``` -- cgit v1.2.3