diff options
| author | Tyge Løvset <[email protected]> | 2023-02-01 10:12:22 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2023-02-01 10:12:22 +0100 |
| commit | a8998a52082f86a71bf152c5baa9ebc005871142 (patch) | |
| tree | e231d86dba26d1495b893432fde7db17ac3eac08 /docs | |
| parent | 6ce6ef3307e52db5813d3c8d6a2cba52df06daf8 (diff) | |
| download | STC-modified-a8998a52082f86a71bf152c5baa9ebc005871142.tar.gz STC-modified-a8998a52082f86a71bf152c5baa9ebc005871142.zip | |
Update docs formatting and README.md
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/cbits_api.md | 16 | ||||
| -rw-r--r-- | docs/cbox_api.md | 8 | ||||
| -rw-r--r-- | docs/cdeq_api.md | 16 | ||||
| -rw-r--r-- | docs/clist_api.md | 26 | ||||
| -rw-r--r-- | docs/cmap_api.md | 40 | ||||
| -rw-r--r-- | docs/crandom_api.md | 22 | ||||
| -rw-r--r-- | docs/cregex_api.md | 32 | ||||
| -rw-r--r-- | docs/cset_api.md | 18 | ||||
| -rw-r--r-- | docs/cspan_api.md | 43 | ||||
| -rw-r--r-- | docs/cstr_api.md | 208 | ||||
| -rw-r--r-- | docs/csview_api.md | 40 | ||||
| -rw-r--r-- | docs/cvec_api.md | 24 |
12 files changed, 247 insertions, 246 deletions
diff --git a/docs/cbits_api.md b/docs/cbits_api.md index 726fb68b..f3967739 100644 --- a/docs/cbits_api.md +++ b/docs/cbits_api.md @@ -21,25 +21,25 @@ All cbits definitions and prototypes are available by including a single header ```c cbits cbits_init(void); cbits cbits_from(const char* str); -cbits cbits_with_size(intptr_t size, bool value); // size must be <= N if N is defined +cbits cbits_with_size(intptr_t size, bool value); // size must be <= N if N is defined cbits cbits_with_pattern(intptr_t size, uint64_t pattern); cbits cbits_clone(cbits other); void cbits_clear(cbits* self); cbits* cbits_copy(cbits* self, const cbits* other); -void cbits_resize(cbits* self, intptr_t size, bool value); // only if i_len is not defined +void cbits_resize(cbits* self, intptr_t size, bool value); // only if i_len is not defined void cbits_drop(cbits* self); -cbits* cbits_take(cbits* self, const cbits* other); // give other to self -cbits cbits_move(cbits* self); // transfer self to caller +cbits* cbits_take(cbits* self, const cbits* other); // give other to self +cbits cbits_move(cbits* self); // transfer self to caller intptr_t cbits_size(const cbits* self); -intptr_t cbits_count(const cbits* self); // count number of bits set +intptr_t cbits_count(const cbits* self); // count number of bits set bool cbits_test(const cbits* self, intptr_t i); -bool cbits_at(const cbits* self, intptr_t i); // same as cbits_test() +bool cbits_at(const cbits* self, intptr_t i); // same as cbits_test() bool cbits_subset_of(const cbits* self, const cbits* other); // is set a subset of other? -bool cbits_disjoint(const cbits* self, const cbits* other); // no common bits +bool cbits_disjoint(const cbits* self, const cbits* other); // no common bits char* cbits_to_str(const cbits* self, char* str, intptr_t start, intptr_t stop); void cbits_set(cbits* self, intptr_t i); @@ -52,7 +52,7 @@ void cbits_flip(cbits* self, intptr_t i); void cbits_intersect(cbits* self, const cbits* other); void cbits_union(cbits* self, const cbits* other); -void cbits_xor(cbits* self, const cbits* other); // set of disjoint bits +void cbits_xor(cbits* self, const cbits* other); // set of disjoint bits ``` ## Types diff --git a/docs/cbox_api.md b/docs/cbox_api.md index 8906f154..4430b9f8 100644 --- a/docs/cbox_api.md +++ b/docs/cbox_api.md @@ -48,10 +48,10 @@ void cbox_X_drop(cbox_X* self); // destruct the co void cbox_X_reset(cbox_X* self); void cbox_X_reset_to(cbox_X* self, i_val* p); // assign new cbox from ptr. Takes ownership of p. -uint64_t cbox_X_hash(const cbox_X* x); // hash value -int cbox_X_cmp(const cbox_X* x, const cbox_X* y); // compares pointer addresses if no `i_cmp` is specified. - // is defined. Otherwise uses 'i_cmp' or default cmp. -bool cbox_X_eq(const cbox_X* x, const cbox_X* y); // cbox_X_cmp() == 0 +uint64_t cbox_X_hash(const cbox_X* x); // hash value +int cbox_X_cmp(const cbox_X* x, const cbox_X* y); // compares pointer addresses if no `i_cmp` is specified. + // is defined. Otherwise uses 'i_cmp' or default cmp. +bool cbox_X_eq(const cbox_X* x, const cbox_X* y); // cbox_X_cmp() == 0 // functions on pointed to objects. diff --git a/docs/cdeq_api.md b/docs/cdeq_api.md index 44a75fc2..716a608c 100644 --- a/docs/cdeq_api.md +++ b/docs/cdeq_api.md @@ -35,17 +35,17 @@ void cdeq_X_copy(cdeq_X* self, const cdeq_X* other); cdeq_X_iter cdeq_X_copy_range(cdeq_X* self, i_val* pos, const i_val* p1, const i_val* p2); bool cdeq_X_reserve(cdeq_X* self, intptr_t cap); void cdeq_X_shrink_to_fit(cdeq_X* self); -void cdeq_X_drop(cdeq_X* self); // destructor +void cdeq_X_drop(cdeq_X* self); // destructor bool cdeq_X_empty(const cdeq_X* self); intptr_t cdeq_X_size(const cdeq_X* self); intptr_t cdeq_X_capacity(const cdeq_X* self); const cdeq_X_value* cdeq_X_at(const cdeq_X* self, intptr_t idx); -const cdeq_X_value* cdeq_X_get(const cdeq_X* self, i_valraw raw); // return NULL if not found -cdeq_X_value* cdeq_X_get_mut(cdeq_X* self, i_valraw raw); // mutable get +const cdeq_X_value* cdeq_X_get(const cdeq_X* self, i_valraw raw); // return NULL if not found +cdeq_X_value* cdeq_X_get_mut(cdeq_X* self, i_valraw raw); // mutable get cdeq_X_iter cdeq_X_find(const cdeq_X* self, i_valraw raw); -cdeq_X_iter cdeq_X_find_in(cdeq_X_iter i1, cdeq_X_iter i2, i_valraw raw); // return cvec_X_end() if not found +cdeq_X_iter cdeq_X_find_in(cdeq_X_iter i1, cdeq_X_iter i2, i_valraw raw); // return cvec_X_end() if not found cdeq_X_value* cdeq_X_front(const cdeq_X* self); cdeq_X_value* cdeq_X_back(const cdeq_X* self); @@ -55,14 +55,14 @@ cdeq_X_value* cdeq_X_emplace_front(cdeq_X* self, i_valraw raw); void cdeq_X_pop_front(cdeq_X* self); cdeq_X_value* cdeq_X_push_back(cdeq_X* self, i_val value); -cdeq_X_value* cdeq_X_push(cdeq_X* self, i_val value); // alias for push_back() +cdeq_X_value* cdeq_X_push(cdeq_X* self, i_val value); // alias for push_back() cdeq_X_value* cdeq_X_emplace_back(cdeq_X* self, i_valraw raw); -cdeq_X_value* cdeq_X_emplace(cdeq_X* self, i_valraw raw); // alias for emplace_back() +cdeq_X_value* cdeq_X_emplace(cdeq_X* self, i_valraw raw); // alias for emplace_back() void cdeq_X_pop_back(cdeq_X* self); -cdeq_X_iter cdeq_X_insert(cdeq_X* self, intptr_t idx, i_val value); // move value +cdeq_X_iter cdeq_X_insert(cdeq_X* self, intptr_t idx, i_val value); // move value cdeq_X_iter cdeq_X_insert_n(cdeq_X* self, intptr_t idx, const i_val[] arr, intptr_t n); // move arr values -cdeq_X_iter cdeq_X_insert_at(cdeq_X* self, cdeq_X_iter it, i_val value); // move value +cdeq_X_iter cdeq_X_insert_at(cdeq_X* self, cdeq_X_iter it, i_val value); // move value cdeq_X_iter cdeq_X_insert_range(cdeq_X* self, i_val* pos, const i_val* p1, const i_val* p2); diff --git a/docs/clist_api.md b/docs/clist_api.md index 13c27308..29bfd5ff 100644 --- a/docs/clist_api.md +++ b/docs/clist_api.md @@ -45,33 +45,33 @@ clist_X clist_X_clone(clist_X list); void clist_X_clear(clist_X* self); void clist_X_copy(clist_X* self, const clist_X* other); -void clist_X_drop(clist_X* self); // destructor +void clist_X_drop(clist_X* self); // destructor bool clist_X_empty(const clist_X* list); -intptr_t clist_X_count(const clist_X* list); // size() in O(n) time +intptr_t clist_X_count(const clist_X* list); // size() in O(n) time clist_X_value* clist_X_back(const clist_X* self); clist_X_value* clist_X_front(const clist_X* self); -void clist_X_push_back(clist_X* self, i_val value); // note: no pop_back() +void clist_X_push_back(clist_X* self, i_val value); // note: no pop_back() void clist_X_push_front(clist_X* self, i_val value); -void clist_X_push(clist_X* self, i_val value); // alias for push_back() +void clist_X_push(clist_X* self, i_val value); // alias for push_back() void clist_X_emplace_back(clist_X* self, i_valraw raw); void clist_X_emplace_front(clist_X* self, i_valraw raw); -void clist_X_emplace(clist_X* self, i_valraw raw); // alias for emplace_back() +void clist_X_emplace(clist_X* self, i_valraw raw); // alias for emplace_back() -clist_X_iter clist_X_insert_at(clist_X* self, clist_X_iter it, i_val value); // return iter to new elem +clist_X_iter clist_X_insert_at(clist_X* self, clist_X_iter it, i_val value); // return iter to new elem clist_X_iter clist_X_emplace_at(clist_X* self, clist_X_iter it, i_valraw raw); void clist_X_pop_front(clist_X* self); -clist_X_iter clist_X_erase_at(clist_X* self, clist_X_iter it); // return iter after it +clist_X_iter clist_X_erase_at(clist_X* self, clist_X_iter it); // return iter after it clist_X_iter clist_X_erase_range(clist_X* self, clist_X_iter it1, clist_X_iter it2); -intptr_t clist_X_remove(clist_X* self, i_valraw raw); // removes all matches +intptr_t clist_X_remove(clist_X* self, i_valraw raw); // removes all matches -clist_X clist_X_split_off(clist_X* self, clist_X_iter i1, clist_X_iter i2); // split off [i1, i2) -clist_X_iter clist_X_splice(clist_X* self, clist_X_iter it, clist_X* other); // return updated valid it -clist_X_iter clist_X_splice_range(clist_X* self, clist_X_iter it, // return updated valid it +clist_X clist_X_split_off(clist_X* self, clist_X_iter i1, clist_X_iter i2); // split off [i1, i2) +clist_X_iter clist_X_splice(clist_X* self, clist_X_iter it, clist_X* other); // return updated valid it +clist_X_iter clist_X_splice_range(clist_X* self, clist_X_iter it, // return updated valid it clist_X* other, clist_X_iter it1, clist_X_iter it2); clist_X_iter clist_X_find(const clist_X* self, i_valraw raw); @@ -83,10 +83,10 @@ void clist_X_sort(clist_X* self); void clist_X_reverse(clist_X* self); // Node API -clist_X_node* clist_X_get_node(clist_X_value* val); // get the enclosing node +clist_X_node* clist_X_get_node(clist_X_value* val); // get the enclosing node clist_X_value* clist_X_push_node_back(clist_X* self, clist_X_node* node); clist_X_value* clist_X_insert_node_after(clist_X* self, clist_X_node* ref, clist_X_node* node); -clist_X_node* clist_X_unlink_node_after(clist_X* self, clist_X_node* ref); // return the unlinked node +clist_X_node* clist_X_unlink_node_after(clist_X* self, clist_X_node* ref); // return the unlinked node void clist_X_erase_node_after(clist_X* self, clist_X_node* node); clist_X_iter clist_X_begin(const clist_X* self); diff --git a/docs/cmap_api.md b/docs/cmap_api.md index 7b8fbb8f..8e5a53d9 100644 --- a/docs/cmap_api.md +++ b/docs/cmap_api.md @@ -53,32 +53,32 @@ cmap_X cmap_X_clone(cmap_x map); void cmap_X_clear(cmap_X* self); void cmap_X_copy(cmap_X* self, const cmap_X* other); -float cmap_X_max_load_factor(const cmap_X* self); // default: 0.85f +float cmap_X_max_load_factor(const cmap_X* self); // default: 0.85f bool cmap_X_reserve(cmap_X* self, intptr_t size); void cmap_X_shrink_to_fit(cmap_X* self); -void cmap_X_drop(cmap_X* self); // destructor +void cmap_X_drop(cmap_X* self); // destructor intptr_t cmap_X_size(const cmap_X* self); -intptr_t cmap_X_capacity(const cmap_X* self); // buckets * max_load_factor +intptr_t cmap_X_capacity(const cmap_X* self); // buckets * max_load_factor bool cmap_X_empty(const cmap_X* self ); -intptr_t cmap_X_bucket_count(const cmap_X* self); // num. of allocated buckets +intptr_t cmap_X_bucket_count(const cmap_X* self); // num. of allocated buckets -const cmap_X_mapped* cmap_X_at(const cmap_X* self, i_keyraw rkey); // rkey must be in map -cmap_X_mapped* cmap_X_at_mut(cmap_X* self, i_keyraw rkey); // mutable at -const cmap_X_value* cmap_X_get(const cmap_X* self, i_keyraw rkey); // const get -cmap_X_value* cmap_X_get_mut(cmap_X* self, i_keyraw rkey); // mutable get +const cmap_X_mapped* cmap_X_at(const cmap_X* self, i_keyraw rkey); // rkey must be in map +cmap_X_mapped* cmap_X_at_mut(cmap_X* self, i_keyraw rkey); // mutable at +const cmap_X_value* cmap_X_get(const cmap_X* self, i_keyraw rkey); // const get +cmap_X_value* cmap_X_get_mut(cmap_X* self, i_keyraw rkey); // mutable get bool cmap_X_contains(const cmap_X* self, i_keyraw rkey); -cmap_X_iter cmap_X_find(const cmap_X* self, i_keyraw rkey); // find element +cmap_X_iter cmap_X_find(const cmap_X* self, i_keyraw rkey); // find element -cmap_X_result cmap_X_insert(cmap_X* self, i_key key, i_val mapped); // no change if key in map -cmap_X_result cmap_X_insert_or_assign(cmap_X* self, i_key key, i_val mapped); // always update mapped -cmap_X_result cmap_X_push(cmap_X* self, cmap_X_value entry); // similar to insert +cmap_X_result cmap_X_insert(cmap_X* self, i_key key, i_val mapped); // no change if key in map +cmap_X_result cmap_X_insert_or_assign(cmap_X* self, i_key key, i_val mapped); // always update mapped +cmap_X_result cmap_X_push(cmap_X* self, cmap_X_value entry); // similar to insert -cmap_X_result cmap_X_emplace(cmap_X* self, i_keyraw rkey, i_valraw rmapped); // no change if rkey in map +cmap_X_result cmap_X_emplace(cmap_X* self, i_keyraw rkey, i_valraw rmapped); // no change if rkey in map cmap_X_result cmap_X_emplace_or_assign(cmap_X* self, i_keyraw rkey, i_valraw rmapped); // always update rmapped -intptr_t cmap_X_erase(cmap_X* self, i_keyraw rkey); // return 0 or 1 -cmap_X_iter cmap_X_erase_at(cmap_X* self, cmap_X_iter it); // return iter after it +intptr_t cmap_X_erase(cmap_X* self, i_keyraw rkey); // return 0 or 1 +cmap_X_iter cmap_X_erase_at(cmap_X* self, cmap_X_iter it); // return iter after it void cmap_X_erase_entry(cmap_X* self, cmap_X_value* entry); cmap_X_iter cmap_X_begin(const cmap_X* self); @@ -91,13 +91,13 @@ cmap_X_raw cmap_X_value_toraw(cmap_X_value* pval); ``` Helpers: ```c -uint64_t c_default_hash(const X *obj); // macro, calls cfasthash(obj, sizeof *obj) -uint64_t cstrhash(const char *str); // string hash funcion, uses strlen() -uint64_t cfasthash(const void *data, intptr_t len); // base hash function +uint64_t c_default_hash(const X *obj); // macro, calls cfasthash(obj, sizeof *obj) +uint64_t cstrhash(const char *str); // string hash funcion, uses strlen() +uint64_t cfasthash(const void *data, intptr_t len); // base hash function // equalto template parameter functions: -bool c_default_eq(const i_keyraw* a, const i_keyraw* b); // *a == *b -bool c_memcmp_eq(const i_keyraw* a, const i_keyraw* b); // !memcmp(a, b, sizeof *a) +bool c_default_eq(const i_keyraw* a, const i_keyraw* b); // *a == *b +bool c_memcmp_eq(const i_keyraw* a, const i_keyraw* b); // !memcmp(a, b, sizeof *a) ``` ## Types diff --git a/docs/crandom_api.md b/docs/crandom_api.md index 7dced0eb..391c485f 100644 --- a/docs/crandom_api.md +++ b/docs/crandom_api.md @@ -41,22 +41,22 @@ All crandom definitions and prototypes are available by including a single heade ## Methods ```c -void csrandom(uint64_t seed); // seed global stc64 prng -uint64_t crandom(void); // global stc64_rand(rng) -double crandomf(void); // global stc64_randf(rng) +void csrandom(uint64_t seed); // seed global stc64 prng +uint64_t crandom(void); // global stc64_rand(rng) +double crandomf(void); // global stc64_randf(rng) -stc64_t stc64_new(uint64_t seed); // stc64_init(s) is deprecated -stc64_t stc64_with_seq(uint64_t seed, uint64_t seq); // with unique stream +stc64_t stc64_new(uint64_t seed); // stc64_init(s) is deprecated +stc64_t stc64_with_seq(uint64_t seed, uint64_t seq); // with unique stream -uint64_t stc64_rand(stc64_t* rng); // range [0, 2^64 - 1] -double stc64_randf(stc64_t* rng); // range [0.0, 1.0) +uint64_t stc64_rand(stc64_t* rng); // range [0, 2^64 - 1] +double stc64_randf(stc64_t* rng); // range [0.0, 1.0) -stc64_uniform_t stc64_uniform_new(int64_t low, int64_t high); // uniform-distribution -int64_t stc64_uniform(stc64_t* rng, stc64_uniform_t* dist); // range [low, high] +stc64_uniform_t stc64_uniform_new(int64_t low, int64_t high); // uniform-distribution +int64_t stc64_uniform(stc64_t* rng, stc64_uniform_t* dist); // range [low, high] stc64_uniformf_t stc64_uniformf_new(double lowf, double highf); -double stc64_uniformf(stc64_t* rng, stc64_uniformf_t* dist); // range [lowf, highf) +double stc64_uniformf(stc64_t* rng, stc64_uniformf_t* dist); // range [lowf, highf) -stc64_normalf_t stc64_normalf_new(double mean, double stddev); // normal-distribution +stc64_normalf_t stc64_normalf_new(double mean, double stddev); // normal-distribution double stc64_normalf(stc64_t* rng, stc64_normalf_t* dist); ``` ## Types diff --git a/docs/cregex_api.md b/docs/cregex_api.md index 3d4392b0..e74040d8 100644 --- a/docs/cregex_api.md +++ b/docs/cregex_api.md @@ -24,35 +24,35 @@ enum { cregex cregex_init(void); cregex cregex_from(const char* pattern, int cflags = CREG_DEFAULT); - /* return CREG_OK, or negative error code on failure */ + // return CREG_OK, or negative error code on failure int cregex_compile(cregex *self, const char* pattern, int cflags = CREG_DEFAULT); - /* num. of capture groups in regex. 0 if RE is invalid. First group is the full match */ + // num. of capture groups in regex. 0 if RE is invalid. First group is the full match int cregex_captures(const cregex* self); - /* return CREG_OK, CREG_NOMATCH, or CREG_MATCHERROR */ + // return CREG_OK, CREG_NOMATCH, or CREG_MATCHERROR int cregex_find(const cregex* re, const char* input, csview match[], int mflags = CREG_DEFAULT); - /* Search inside input string-view only */ + // Search inside input string-view only int cregex_find_sv(const cregex* re, csview input, csview match[]); - /* All-in-one search (compile + find + drop) */ + // All-in-one search (compile + find + drop) int cregex_find_pattern(const char* pattern, const char* input, csview match[], int cmflags = CREG_DEFAULT); - /* Check if there are matches in input */ + // Check if there are matches in input bool cregex_is_match(const cregex* re, const char* input); - /* Replace all matches in input */ -cstr cregex_replace(const cregex* re, const char* input, const char* replace, count = MAX_INT); - /* Replace count matches in input string-view. Optionally transform replacement with mfun. */ -cstr cregex_replace_sv(const cregex* re, csview input, const char* replace, unsigned count = MAX_INT); -cstr cregex_replace_sv(const cregex* re, csview input, const char* replace, unsigned count, + // Replace all matches in input +cstr cregex_replace(const cregex* re, const char* input, const char* replace, int count = INT_MAX); + // Replace count matches in input string-view. Optionally transform replacement with mfun. +cstr cregex_replace_sv(const cregex* re, csview input, const char* replace, int count = INT_MAX); +cstr cregex_replace_sv(const cregex* re, csview input, const char* replace, int count, bool(*mfun)(int capgrp, csview match, cstr* mstr), int rflags); - /* All-in-one replacement (compile + find/replace + drop) */ -cstr cregex_replace_pattern(const char* pattern, const char* input, const char* replace, count = MAX_INT); -cstr cregex_replace_pattern(const char* pattern, const char* input, const char* replace, unsigned count, + // All-in-one replacement (compile + find/replace + drop) +cstr cregex_replace_pattern(const char* pattern, const char* input, const char* replace, int count = INT_MAX); +cstr cregex_replace_pattern(const char* pattern, const char* input, const char* replace, int count, bool(*mfun)(int capgrp, csview match, cstr* mstr), int rflags); - -void cregex_drop(cregex* self); /* destroy */ + // destroy +void cregex_drop(cregex* self); ``` ### Error codes diff --git a/docs/cset_api.md b/docs/cset_api.md index 2e80a49b..ef4df63b 100644 --- a/docs/cset_api.md +++ b/docs/cset_api.md @@ -35,27 +35,27 @@ cset_X cset_X_clone(cset_x set); void cset_X_clear(cset_X* self); void cset_X_copy(cset_X* self, const cset_X* other); -float cset_X_max_load_factor(const cset_X* self); // default: 0.85 +float cset_X_max_load_factor(const cset_X* self); // default: 0.85 bool cset_X_reserve(cset_X* self, intptr_t size); void cset_X_shrink_to_fit(cset_X* self); -void cset_X_drop(cset_X* self); // destructor +void cset_X_drop(cset_X* self); // destructor -intptr_t cset_X_size(const cset_X* self); // num. of allocated buckets -intptr_t cset_X_capacity(const cset_X* self); // buckets * max_load_factor +intptr_t cset_X_size(const cset_X* self); // num. of allocated buckets +intptr_t cset_X_capacity(const cset_X* self); // buckets * max_load_factor bool cset_X_empty(const cset_X* self); intptr_t cset_X_bucket_count(const cset_X* self); bool cset_X_contains(const cset_X* self, i_keyraw rkey); -const cset_X_value* cset_X_get(const cset_X* self, i_keyraw rkey); // return NULL if not found -cset_X_value* cset_X_get_mut(cset_X* self, i_keyraw rkey); // mutable get +const cset_X_value* cset_X_get(const cset_X* self, i_keyraw rkey); // return NULL if not found +cset_X_value* cset_X_get_mut(cset_X* self, i_keyraw rkey); // mutable get cset_X_iter cset_X_find(const cset_X* self, i_keyraw rkey); cset_X_result cset_X_insert(cset_X* self, i_key key); -cset_X_result cset_X_push(cset_X* self, i_key key); // alias for insert. +cset_X_result cset_X_push(cset_X* self, i_key key); // alias for insert. cset_X_result cset_X_emplace(cset_X* self, i_keyraw rkey); -intptr_t cset_X_erase(cset_X* self, i_keyraw rkey); // return 0 or 1 -cset_X_iter cset_X_erase_at(cset_X* self, cset_X_iter it); // return iter after it +intptr_t cset_X_erase(cset_X* self, i_keyraw rkey); // return 0 or 1 +cset_X_iter cset_X_erase_at(cset_X* self, cset_X_iter it); // return iter after it void cset_X_erase_entry(cset_X* self, cset_X_value* entry); cset_X_iter cset_X_begin(const cset_X* self); diff --git a/docs/cspan_api.md b/docs/cspan_api.md index 8f6f695f..70587f3e 100644 --- a/docs/cspan_api.md +++ b/docs/cspan_api.md @@ -9,43 +9,44 @@ The **cspan** is templated non-owning multi-dimensional view of an array. See th ```c #include <stc/cspan.h> -using_cspan(SpanType, ValueType, Rank); // define SpanType with ValueType elements. - // Rank is number of dimensions (max 4) +using_cspan(SpanType, ValueType); // define a 1-d SpanType with ValueType elements. +using_cspan(SpanTypeN, ValueType, Rank); // define multi-dimensional span with Rank. + // Rank is number of dimensions (max 5) // Shorthands: -using_cspan2(S, ValueType); // define span types S, S2 with ranks 1, 2. -using_cspan3(S, ValueType); // define span types S, S2, S3 with ranks 1, 2, 3. -using_cspan4(S, ValueType); // define span types S, S2, S3, S4 with ranks 1, 2, 3, 4. +using_cspan2(S, ValueType); // define span types S, S2 with ranks 1, 2. +using_cspan3(S, ValueType); // define span types S, S2, S3 with ranks 1, 2, 3. +using_cspan4(S, ValueType); // define span types S, S2, S3, S4 with ranks 1, 2, 3, 4. +using_cspan5(S, ValueType); // define span types S, S2, .., S5 with ranks 1, 2, 3, 4, 5. ``` ## Methods Note that `cspan_md()`, `cmake_from*()`, `cspan_atN()`, `and cspan_subspanN()` require a (safe) cast to its span-type on assignment, but not on initialization of a span variable. All functions are type-safe, and arguments are side-effect safe, except for SpanType arg. which must not have side-effects. ```c -SpanTypeN cspan_md(ValueType* data, intptr_t xdim, ...); // create a multi-dimensional cspan -SpanType cspan_make(T SpanType, {v1, v2, ...}); // make a 1d-dimensional cspan from values -SpanType cspan_from(STCContainer* cnt); // create a 1d cspan from a compatible STC container -SpanType cspan_from_array(ValueType array[]); // create a 1d cspan from a C array - -intptr_t cspan_size(const SpanTypeN* self); // return number of elements -unsigned cspan_rank(const SpanTypeN* self); // return number of dimensions -intptr_t cspan_index(const SpanTypeN* self, intptr_t x, ...); // index of element +SpanTypeN cspan_md(ValueType* data, intptr_t xdim, ...); // create a multi-dimensional cspan +SpanType cspan_make(T SpanType, {v1, v2, ...}); // make a 1d-dimensional cspan from values +SpanType cspan_from(STCContainer* cnt); // create a 1d cspan from a compatible STC container +SpanType cspan_from_array(ValueType array[]); // create a 1d cspan from a C array + +intptr_t cspan_size(const SpanTypeN* self); // return number of elements +unsigned cspan_rank(const SpanTypeN* self); // return number of dimensions +intptr_t cspan_index(const SpanTypeN* self, intptr_t x, ..); // index of element -ValueType* cspan_at(SpanTypeN* self, intptr_t x, ...); // at(): num of args specifies rank of input span. +ValueType* cspan_at(SpanTypeN* self, intptr_t x, ...); // at(): num of args specifies rank of input span. ValueType* cspan_front(SpanTypeN* self); ValueType* cspan_back(SpanTypeN* self); // return a subspan of lower rank: -SpanType cspan_submd2(SpanType2* self, intptr_t x); // return a 1d subspan from a 2d span. -SpanTypeN cspan_submd3(SpanType3* self, intptr_t x, ...); // return a 1d or 2d subspan from a 3d span. -SpanTypeN cspan_submd4(SpanType4* self, intptr_t x, ...); // number of args determines rank of output span. +SpanType cspan_submd2(SpanType2* self, intptr_t x); // return a 1d subspan from a 2d span. +SpanTypeN cspan_submd3(SpanType3* self, intptr_t x, ...); // return a 1d or 2d subspan from a 3d span. +SpanTypeN cspan_submd4(SpanType4* self, intptr_t x, ...); // number of args determines rank of output span. +SpanTypeN cspan_submd5(SpanType5* self, intptr_t x, ...); - // return a sliced span of same rank: -void cspan_slice(SpanTypeN* self, {x0,x1}, {y0,y1},...); // slice multidim span into a md subspan. +void cspan_slice(SpanTypeN* self, {x0,x1}, {y0,y1},...); // slice a span to make it a subspan of same rank - // return a subspan of same rank. Like e.g. cspan_slice(&ms3, {offset, offset+count}, {0}, {0}); + // return a subspan of same rank. Similar to e.g. cspan_slice(&ms3, {offset, offset+count}, {0}, {0}); SpanType cspan_subspan(const SpanType* self, intptr_t offset, intptr_t count); SpanType2 cspan_subspan2(const SpanType2 self, intptr_t offset, intptr_t count); SpanType3 cspan_subspan3(const SpanType3 self, intptr_t offset, intptr_t count); -SpanType4 cspan_subspan4(const SpanType4 self, intptr_t offset, intptr_t count); SpanTypeN_iter SpanType_begin(const SpanTypeN* self); SpanTypeN_iter SpanType_end(const SpanTypeN* self); diff --git a/docs/cstr_api.md b/docs/cstr_api.md index 6bf5c723..37316d4d 100644 --- a/docs/cstr_api.md +++ b/docs/cstr_api.md @@ -18,114 +18,114 @@ All cstr definitions and prototypes are available by including a single header f ## Methods ```c -cstr cstr_init(void); // constructor; same as cstr_NULL. -cstr cstr_lit(const char literal_only[]); // cstr from literal; no strlen() call. -cstr cstr_from(const char* str); // constructor using strlen() -cstr cstr_from_n(const char* str, intptr_t n); // constructor with n first bytes of str -cstr cstr_from_sv(csview sv); // construct cstr from csview -cstr cstr_with_capacity(intptr_t cap); -cstr cstr_with_size(intptr_t len, char fill); // repeat fill len times -cstr cstr_from_fmt(const char* fmt, ...); // printf() formatting -cstr cstr_clone(cstr s); - -cstr* cstr_take(cstr* self, cstr s); // take ownership of s, i.e. don't drop s. -cstr cstr_move(cstr* self); // move string to caller, leave self empty -void cstr_drop(cstr* self); // destructor - -const char* cstr_str(const cstr* self); // cast to const char* -char* cstr_data(cstr* self); // cast to mutable char* -csview cstr_sv(const cstr* self); // cast to string view -cstr_buf cstr_buffer(cstr* self); // cast to mutable buffer (with capacity) - -intptr_t cstr_size(const cstr* self); -intptr_t cstr_capacity(const cstr* self); -bool cstr_empty(const cstr* self); - -char* cstr_reserve(cstr* self, intptr_t capacity); // return pointer to buffer -void cstr_resize(cstr* self, intptr_t len, char fill); -void cstr_shrink_to_fit(cstr* self); -void cstr_clear(cstr* self); - -char* cstr_assign(cstr* self, const char* str); -char* cstr_assign_n(cstr* self, const char* str, intptr_t n); // assign n first bytes of str -char* cstr_assign_sv(cstr* self, csview sv); -char* cstr_copy(cstr* self, cstr s); // copy-assign a cstr -int cstr_printf(cstr* self, const char* fmt, ...); // source and target must not overlap. - -char* cstr_append(cstr* self, const char* str); -char* cstr_append_n(cstr* self, const char* str, intptr_t n); // append n first bytes of str -char* cstr_append_sv(cstr* self, csview str); -char* cstr_append_s(cstr* self, cstr str); -int cstr_append_fmt(cstr* self, const char* fmt, ...); // printf() formatting -char* cstr_append_uninit(cstr* self, intptr_t len); // return ptr to start of uninited data - -void cstr_push(cstr* self, const char* chr); // append one utf8 char -void cstr_pop(cstr* self); // pop one utf8 char - -void cstr_insert(cstr* self, intptr_t pos, const char* ins); -void cstr_insert_sv(cstr* self, intptr_t pos, csview ins); -void cstr_insert_s(cstr* self, intptr_t pos, cstr ins); - -void cstr_erase(cstr* self, intptr_t pos, intptr_t len); // erase len bytes from pos - -void cstr_replace(cstr* self, const char* search, const char* repl, unsigned count = MAX_INT); -cstr cstr_replace_sv(csview in, csview search, csview repl, unsigned count); -void cstr_replace_at(cstr* self, intptr_t pos, intptr_t len, const char* repl); // replace at a position -void cstr_replace_at_sv(cstr* self, intptr_t pos, intptr_t len, const csview repl); -void cstr_replace_at_s(cstr* self, intptr_t pos, intptr_t len, cstr repl); - -bool cstr_equals(const cstr* self, const char* str); -bool cstr_equals_sv(const cstr* self, csview sv); -bool cstr_equals_s(const cstr* self, cstr s); - -intptr_t cstr_find(const cstr* self, const char* search); -intptr_t cstr_find_at(const cstr* self, intptr_t pos, const char* search); // search from pos -bool cstr_contains(const cstr* self, const char* search); - -bool cstr_starts_with(const cstr* self, const char* str); -bool cstr_starts_with_sv(const cstr* self, csview sv); -bool cstr_starts_with_s(const cstr* self, cstr s); - -bool cstr_ends_with(const cstr* self, const char* str); -bool cstr_ends_with_sv(const cstr* self, csview sv); -bool cstr_ends_with_s(const cstr* self, cstr s); - -bool cstr_getline(cstr *self, FILE *stream); // cstr_getdelim(self, '\n', stream) -bool cstr_getdelim(cstr *self, int delim, FILE *stream); // does not append delim to result +cstr cstr_init(void); // constructor; same as cstr_NULL. +cstr cstr_lit(const char literal_only[]); // cstr from literal; no strlen() call. +cstr cstr_from(const char* str); // constructor using strlen() +cstr cstr_from_n(const char* str, intptr_t n); // constructor with n first bytes of str +cstr cstr_from_sv(csview sv); // construct cstr from csview +cstr cstr_with_capacity(intptr_t cap); +cstr cstr_with_size(intptr_t len, char fill); // repeat fill len times +cstr cstr_from_fmt(const char* fmt, ...); // printf() formatting +cstr cstr_clone(cstr s); + +cstr* cstr_take(cstr* self, cstr s); // take ownership of s, i.e. don't drop s. +cstr cstr_move(cstr* self); // move string to caller, leave self empty +void cstr_drop(cstr* self); // destructor + +const char* cstr_str(const cstr* self); // cast to const char* +char* cstr_data(cstr* self); // cast to mutable char* +csview cstr_sv(const cstr* self); // cast to string view +cstr_buf cstr_buffer(cstr* self); // cast to mutable buffer (with capacity) + +intptr_t cstr_size(const cstr* self); +intptr_t cstr_capacity(const cstr* self); +bool cstr_empty(const cstr* self); + +char* cstr_reserve(cstr* self, intptr_t capacity); // return pointer to buffer +void cstr_resize(cstr* self, intptr_t len, char fill); +void cstr_shrink_to_fit(cstr* self); +void cstr_clear(cstr* self); + +char* cstr_assign(cstr* self, const char* str); +char* cstr_assign_n(cstr* self, const char* str, intptr_t n); // assign n first bytes of str +char* cstr_assign_sv(cstr* self, csview sv); +char* cstr_copy(cstr* self, cstr s); // copy-assign a cstr +int cstr_printf(cstr* self, const char* fmt, ...); // source and target must not overlap. + +char* cstr_append(cstr* self, const char* str); +char* cstr_append_n(cstr* self, const char* str, intptr_t n); // append n first bytes of str +char* cstr_append_sv(cstr* self, csview str); +char* cstr_append_s(cstr* self, cstr str); +int cstr_append_fmt(cstr* self, const char* fmt, ...); // printf() formatting +char* cstr_append_uninit(cstr* self, intptr_t len); // return ptr to start of uninited data + +void cstr_push(cstr* self, const char* chr); // append one utf8 char +void cstr_pop(cstr* self); // pop one utf8 char + +void cstr_insert(cstr* self, intptr_t pos, const char* ins); +void cstr_insert_sv(cstr* self, intptr_t pos, csview ins); +void cstr_insert_s(cstr* self, intptr_t pos, cstr ins); + +void cstr_erase(cstr* self, intptr_t pos, intptr_t len); // erase len bytes from pos + +void cstr_replace(cstr* self, const char* search, const char* repl, unsigned count = MAX_INT); +cstr cstr_replace_sv(csview in, csview search, csview repl, unsigned count); +void cstr_replace_at(cstr* self, intptr_t pos, intptr_t len, const char* repl); // replace at a pos +void cstr_replace_at_sv(cstr* self, intptr_t pos, intptr_t len, const csview repl); +void cstr_replace_at_s(cstr* self, intptr_t pos, intptr_t len, cstr repl); + +bool cstr_equals(const cstr* self, const char* str); +bool cstr_equals_sv(const cstr* self, csview sv); +bool cstr_equals_s(const cstr* self, cstr s); + +intptr_t cstr_find(const cstr* self, const char* search); +intptr_t cstr_find_at(const cstr* self, intptr_t pos, const char* search); // search from pos +bool cstr_contains(const cstr* self, const char* search); + +bool cstr_starts_with(const cstr* self, const char* str); +bool cstr_starts_with_sv(const cstr* self, csview sv); +bool cstr_starts_with_s(const cstr* self, cstr s); + +bool cstr_ends_with(const cstr* self, const char* str); +bool cstr_ends_with_sv(const cstr* self, csview sv); +bool cstr_ends_with_s(const cstr* self, cstr s); + +bool cstr_getline(cstr *self, FILE *stream); // cstr_getdelim(self, '\n', stream) +bool cstr_getdelim(cstr *self, int delim, FILE *stream); // does not append delim to result ``` #### UTF8 methods ```c -intptr_t cstr_u8_size(const cstr* self); // number of utf8 codepoints -intptr_t cstr_u8_size_n(const cstr self, intptr_t nbytes); // utf8 size within n bytes -intptr_t cstr_u8_to_pos(const cstr* self, intptr_t u8idx); // byte pos offset at utf8 codepoint index -const char* cstr_u8_at(const cstr* self, intptr_t u8idx); // char* position at utf8 codepoint index -csview cstr_u8_chr(const cstr* self, intptr_t u8idx); // get utf8 character as a csview -void cstr_u8_replace_at(cstr* self, intptr_t bytepos, intptr_t u8len, csview repl); // replace u8len utf8 chars -void cstr_u8_erase(cstr* self, intptr_t bytepos, intptr_t u8len); // erase u8len codepoints from pos +intptr_t cstr_u8_size(const cstr* self); // number of utf8 codepoints +intptr_t cstr_u8_size_n(const cstr self, intptr_t nbytes); // utf8 size within n bytes +intptr_t cstr_u8_to_pos(const cstr* self, intptr_t u8idx); // byte pos offset at utf8 codepoint index +const char* cstr_u8_at(const cstr* self, intptr_t u8idx); // char* position at utf8 codepoint index +csview cstr_u8_chr(const cstr* self, intptr_t u8idx); // get utf8 character as a csview +void cstr_u8_replace_at(cstr* self, intptr_t bytepos, intptr_t u8len, csview repl); // replace u8len utf8 chars +void cstr_u8_erase(cstr* self, intptr_t bytepos, intptr_t u8len); // erase u8len codepoints from pos // iterate utf8 codepoints -cstr_iter cstr_begin(const cstr* self); -cstr_iter cstr_end(const cstr* self); -void cstr_next(cstr_iter* it); -cstr_iter cstr_advance(cstr_iter it, intptr_t n); +cstr_iter cstr_begin(const cstr* self); +cstr_iter cstr_end(const cstr* self); +void cstr_next(cstr_iter* it); +cstr_iter cstr_advance(cstr_iter it, intptr_t n); // utf8 functions requires linking with src/utf8code.c symbols: -bool cstr_valid_utf8(const cstr* self); // check if str is valid utf8 -cstr cstr_casefold_sv(csview sv); // returns new casefolded utf8 cstr - -cstr cstr_tolower(const char* str); // returns new lowercase utf8 cstr -cstr cstr_tolower_sv(csview sv); // returns new lowercase utf8 cstr -void cstr_lowercase(cstr* self); // transform cstr to lowercase utf8 - -cstr cstr_toupper(const char* str); // returns new uppercase utf8 cstr -cstr cstr_toupper_sv(csview sv); // returns new uppercase utf8 cstr -void cstr_uppercase(cstr* self); // transform cstr to uppercase utf8 - -int cstr_icmp(const cstr* s1, const cstr* s2); // utf8 case-insensitive comparison -bool cstr_iequals(const cstr* self, const char* str); // " -bool cstr_istarts_with(const cstr* self, const char* str); // " -bool cstr_iends_with(const cstr* self, const char* str); // " +bool cstr_valid_utf8(const cstr* self); // check if str is valid utf8 +cstr cstr_casefold_sv(csview sv); // returns new casefolded utf8 cstr + +cstr cstr_tolower(const char* str); // returns new lowercase utf8 cstr +cstr cstr_tolower_sv(csview sv); // returns new lowercase utf8 cstr +void cstr_lowercase(cstr* self); // transform cstr to lowercase utf8 + +cstr cstr_toupper(const char* str); // returns new uppercase utf8 cstr +cstr cstr_toupper_sv(csview sv); // returns new uppercase utf8 cstr +void cstr_uppercase(cstr* self); // transform cstr to uppercase utf8 + +int cstr_icmp(const cstr* s1, const cstr* s2); // utf8 case-insensitive comparison +bool cstr_iequals(const cstr* self, const char* str); // " +bool cstr_istarts_with(const cstr* self, const char* str); // " +bool cstr_iends_with(const cstr* self, const char* str); // " ``` Note that all methods with arguments `(..., const char* str, intptr_t n)`, `n` must be within the range of `str` length. @@ -141,10 +141,10 @@ char* cstrnstrn(const char* str, const char* search, intptr_t slen, intpt ## Types -| Type name | Type definition | Used to represent... | -|:----------------|:-------------------------------------------|:---------------------| -| `cstr` | `struct { ... }` | The string type | -| `cstr_value` | `char` | String element type | +| Type name | Type definition | Used to represent... | +|:----------------|:---------------------------------------------|:---------------------| +| `cstr` | `struct { ... }` | The string type | +| `cstr_value` | `char` | String element type | | `csview` | `struct { const char *str; intptr_t size; }` | String view type | | `cstr_buf` | `struct { char *data; intptr_t size, cap; }` | String buffer type | diff --git a/docs/csview_api.md b/docs/csview_api.md index 8064e4fd..3971c6a6 100644 --- a/docs/csview_api.md +++ b/docs/csview_api.md @@ -26,11 +26,11 @@ All csview definitions and prototypes are available by including a single header ## Methods ```c -csview c_SV(const char literal_only[]); // construct from literal, no strlen() -csview c_SV(const char* str, intptr_t n); // construct from str and length n -csview csview_lit(const char literal_only[]); // alias for c_SV(lit) -csview csview_from(const char* str); // construct from const char* -csview csview_from_n(const char* str, intptr_t n); // alias for c_SV(str, n) +csview c_SV(const char literal_only[]); // construct from literal, no strlen() +csview c_SV(const char* str, intptr_t n); // construct from str and length n +csview csview_lit(const char literal_only[]); // alias for c_SV(lit) +csview csview_from(const char* str); // construct from const char* +csview csview_from_n(const char* str, intptr_t n); // alias for c_SV(str, n) intptr_t csview_size(csview sv); bool csview_empty(csview sv); @@ -43,8 +43,8 @@ bool csview_contains(csview sv, const char* str); bool csview_starts_with(csview sv, const char* str); bool csview_ends_with(csview sv, const char* str); -csview csview_substr_ex(csview sv, intptr_t pos, intptr_t n); // negative pos count from end -csview csview_slice_ex(csview sv, intptr_t p1, intptr_t p2); // negative p1, p2 count from end +csview csview_substr_ex(csview sv, intptr_t pos, intptr_t n); // negative pos count from end +csview csview_slice_ex(csview sv, intptr_t p1, intptr_t p2); // negative p1, p2 count from end csview csview_token(csview sv, const char* sep, intptr_t* start); // *start > sv.size after last token ``` @@ -52,32 +52,32 @@ csview csview_token(csview sv, const char* sep, intptr_t* start); // *s ```c intptr_t csview_u8_size(csview sv); csview csview_u8_substr(csview sv, intptr_t bytepos, intptr_t u8len); -bool csview_valid_utf8(csview sv); // requires linking with src/utf8code.c +bool csview_valid_utf8(csview sv); // requires linking with src/utf8code.c csview_iter csview_begin(const csview* self); csview_iter csview_end(const csview* self); -void csview_next(csview_iter* it); // utf8 codepoint step, not byte! +void csview_next(csview_iter* it); // utf8 codepoint step, not byte! csview_iter csview_advance(csview_iter it, intptr_t n); -// from utf8.h + // from utf8.h intptr_t utf8_size(const char *s); -intptr_t utf8_size_n(const char *s, intptr_t nbytes); // number of UTF8 codepoints within n bytes -const char* utf8_at(const char *s, intptr_t index); // from UTF8 index to char* position -intptr_t utf8_pos(const char* s, intptr_t index); // from UTF8 index to byte index position -unsigned utf8_chr_size(const char* s); // UTF8 character size: 1-4 -// implemented in src/utf8code.c: +intptr_t utf8_size_n(const char *s, intptr_t nbytes); // number of UTF8 codepoints within n bytes +const char* utf8_at(const char *s, intptr_t index); // from UTF8 index to char* position +intptr_t utf8_pos(const char* s, intptr_t index); // from UTF8 index to byte index position +unsigned utf8_chr_size(const char* s); // UTF8 character size: 1-4 + // implemented in src/utf8code.c: bool utf8_valid(const char* s); bool utf8_valid_n(const char* s, intptr_t nbytes); -uint32_t utf8_decode(utf8_decode_t *d, uint8_t byte); // decode next byte to utf8, return state. -unsigned utf8_encode(char *out, uint32_t codepoint); // encode unicode cp into out buffer -uint32_t utf8_peek(const char* s); // codepoint value of character at s -uint32_t utf8_peek_off(const char* s, int offset); // codepoint value at utf8 pos (may be negative) +uint32_t utf8_decode(utf8_decode_t *d, uint8_t byte); // decode next byte to utf8, return state. +unsigned utf8_encode(char *out, uint32_t codepoint); // encode unicode cp into out buffer +uint32_t utf8_peek(const char* s); // codepoint value of character at s +uint32_t utf8_peek_off(const char* s, int offset); // codepoint value at utf8 pos (may be negative) ``` #### Extended cstr methods ```c csview cstr_substr(const cstr* self, intptr_t pos, intptr_t n); -csview cstr_substr_ex(const cstr* s, intptr_t pos, intptr_t n); // negative pos count from end +csview cstr_substr_ex(const cstr* s, intptr_t pos, intptr_t n); // negative pos count from end csview cstr_u8_substr(const cstr* self, intptr_t bytepos, intptr_t u8len); csview cstr_slice(const cstr* self, intptr_t p1, intptr_t p2); diff --git a/docs/cvec_api.md b/docs/cvec_api.md index d67e80fd..057caa7c 100644 --- a/docs/cvec_api.md +++ b/docs/cvec_api.md @@ -40,23 +40,23 @@ void cvec_X_copy(cvec_X* self, const cvec_X* other); cvec_X_iter cvec_X_copy_range(cvec_X* self, i_val* pos, const i_val* p1, const i_val* p2); bool cvec_X_reserve(cvec_X* self, intptr_t cap); bool cvec_X_resize(cvec_X* self, intptr_t size, i_val null); -cvec_X_iter cvec_X_insert_uninit(cvec_X* self, i_val* pos, intptr_t n); // return pos iter +cvec_X_iter cvec_X_insert_uninit(cvec_X* self, i_val* pos, intptr_t n); // return pos iter void cvec_X_shrink_to_fit(cvec_X* self); -void cvec_X_drop(cvec_X* self); // destructor +void cvec_X_drop(cvec_X* self); // destructor bool cvec_X_empty(const cvec_X* self); intptr_t cvec_X_size(const cvec_X* self); intptr_t cvec_X_capacity(const cvec_X* self); const cvec_X_value* cvec_X_at(const cvec_X* self, intptr_t idx); -const cvec_X_value* cvec_X_get(const cvec_X* self, i_valraw raw); // return NULL if not found +const cvec_X_value* cvec_X_get(const cvec_X* self, i_valraw raw); // return NULL if not found cvec_X_value* cvec_X_at_mut(cvec_X* self, intptr_t idx); -cvec_X_value* cvec_X_get_mut(cvec_X* self, i_valraw raw); // find mutable value, return value ptr +cvec_X_value* cvec_X_get_mut(cvec_X* self, i_valraw raw); // find mutable value, return value ptr cvec_X_iter cvec_X_find(const cvec_X* self, i_valraw raw); -cvec_X_iter cvec_X_find_in(cvec_X_iter i1, cvec_X_iter i2, i_valraw raw); // return cvec_X_end() if not found +cvec_X_iter cvec_X_find_in(cvec_X_iter i1, cvec_X_iter i2, i_valraw raw); // return cvec_X_end() if not found // On sorted vectors: -cvec_X_iter cvec_X_binary_search(const cvec_X* self, i_valraw raw); // at elem == raw, else end -cvec_X_iter cvec_X_lower_bound(const cvec_X* self, i_valraw raw); // at first elem >= raw, else end +cvec_X_iter cvec_X_binary_search(const cvec_X* self, i_valraw raw); // at elem == raw, else end +cvec_X_iter cvec_X_lower_bound(const cvec_X* self, i_valraw raw); // at first elem >= raw, else end cvec_X_iter cvec_X_binary_search_in(cvec_X_iter i1, cvec_X_iter i2, i_valraw raw, cvec_X_iter* lower_bound); @@ -65,15 +65,15 @@ cvec_X_value* cvec_X_back(const cvec_X* self); cvec_X_value* cvec_X_push(cvec_X* self, i_val value); cvec_X_value* cvec_X_emplace(cvec_X* self, i_valraw raw); -cvec_X_value* cvec_X_push_back(cvec_X* self, i_val value); // alias for push -cvec_X_value* cvec_X_emplace_back(cvec_X* self, i_valraw raw); // alias for emplace +cvec_X_value* cvec_X_push_back(cvec_X* self, i_val value); // alias for push +cvec_X_value* cvec_X_emplace_back(cvec_X* self, i_valraw raw); // alias for emplace void cvec_X_pop(cvec_X* self); -void cvec_X_pop_back(cvec_X* self); // alias for pop +void cvec_X_pop_back(cvec_X* self); // alias for pop -cvec_X_iter cvec_X_insert(cvec_X* self, intptr_t idx, i_val value); // move value +cvec_X_iter cvec_X_insert(cvec_X* self, intptr_t idx, i_val value); // move value cvec_X_iter cvec_X_insert_n(cvec_X* self, intptr_t idx, const i_val[] arr, intptr_t n); // move n values -cvec_X_iter cvec_X_insert_at(cvec_X* self, cvec_X_iter it, i_val value); // move value +cvec_X_iter cvec_X_insert_at(cvec_X* self, cvec_X_iter it, i_val value); // move value cvec_X_iter cvec_X_insert_range(cvec_X* self, i_val* pos, const i_val* p1, const i_val* p2); |
