From a285bfb891ea00df8ab5cbb21f899ce9ced5f460 Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Mon, 4 Jan 2021 18:25:44 +0100 Subject: Simplified: Removed CONTAINER_input_t type, replaced with CONTAINER_rawvalue_t --- docs/cdeq_api.md | 1 - docs/clist_api.md | 3 +-- docs/cmap_api.md | 6 +++--- docs/cpque_api.md | 1 - docs/cqueue_api.md | 3 +-- docs/cset_api.md | 6 +++--- docs/cstack_api.md | 3 +-- docs/cvec_api.md | 3 +-- stc/ccommon.h | 2 +- stc/cdeq.h | 5 ++--- stc/clist.h | 9 ++++----- stc/cmap.h | 16 ++++++++-------- stc/cpque.h | 9 ++++----- stc/cqueue.h | 7 +++---- stc/cstack.h | 7 +++---- stc/cvec.h | 5 ++--- 16 files changed, 37 insertions(+), 49 deletions(-) diff --git a/docs/cdeq_api.md b/docs/cdeq_api.md index 5ba9b356..701b5dc8 100644 --- a/docs/cdeq_api.md +++ b/docs/cdeq_api.md @@ -30,7 +30,6 @@ using_cdeq(str, cstr_t, cstr_compare_raw, cstr_del, cstr_from, cstr_to_raw, cons |:---------------------|:------------------------------------|:-----------------------| | `cdeq_X` | `struct { cdeq_X_value_t* data; }` | The cdeq type | | `cdeq_X_value_t` | `Value` | The cdeq value type | -| `cdeq_X_input_t` | `cdeq_X_value_t` | The input type | | `cdeq_X_rawvalue_t` | `RawValue` | The raw value type | | `cdeq_X_iter_t` | `struct { cdeq_X_value_t* ref; }` | The iterator type | diff --git a/docs/clist_api.md b/docs/clist_api.md index 7badccbb..f0f85d1b 100644 --- a/docs/clist_api.md +++ b/docs/clist_api.md @@ -30,7 +30,6 @@ using_clist(str, cstr_t, cstr_compare_raw, cstr_del, cstr_from, cstr_to_raw, con |:----------------------|:------------------------------------|:--------------------------| | `clist_X` | `struct { clist_X_node_t* last; }` | The clist type | | `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_value_t *ref; ... }`| clist iterator | @@ -62,7 +61,7 @@ size_t clist_X_size(clist_X list); // note: O(n) clist_X_value_t* clist_X_front(clist_X* self); clist_X_value_t* clist_X_back(clist_X* self); -void clist_X_push_n(clist_X *self, const clist_X_input_t arr[], size_t size); +void clist_X_push_n(clist_X *self, const clist_X_rawvalue_t arr[], size_t size); void clist_X_emplace_back(clist_X* self, RawValue ref); void clist_X_push_back(clist_X* self, Value value); diff --git a/docs/cmap_api.md b/docs/cmap_api.md index 04395f3b..d3b85439 100644 --- a/docs/cmap_api.md +++ b/docs/cmap_api.md @@ -55,11 +55,11 @@ using_cmap(str, cstr_t, cstr_t, cstr_del, |:---------------------|:------------------------------------------------|:------------------------------| | `cmap_X` | `struct { ... }` | The cmap type | | `cmap_X_rawkey_t` | `RawKey` | The raw key type | -| `cmap_X_rawval_t` | `RawMapped` | The raw mapped type | +| `cmap_X_rawmapped_t | `RawMapped` | The raw mapped type | | `cmap_X_key_t` | `Key` | The key type | | `cmap_X_mapped_t` | `Mapped` | The mapped type | | `cmap_X_value_t` | `struct { Key first; Mapped second; }` | The value type | -| `cmap_X_input_t` | `struct { RawKey first; RawMapped second; }` | RawKey + RawVal type | +| `cmap_X_rawvalue_t` | `struct { RawKey first; RawMapped second; }` | RawKey + RawVal type | | `cmap_X_result_t` | `struct { cmap_X_value_t first; bool second; }` | Result of insert/put/emplace | | `cmap_X_iter_t` | `struct { cmap_X_value_t *ref; ... }` | Iterator type | @@ -96,7 +96,7 @@ 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_X_push_n(cmap_X* self, const cmap_X_input_t arr[], size_t size); +void cmap_X_push_n(cmap_X* self, const cmap_X_rawvalue_t arr[], size_t size); cmap_X_result_t cmap_X_emplace(cmap_X* self, RawKey rkey, RawMapped rmapped); cmap_X_result_t cmap_X_insert(cmap_X* self, cmap_X_input_t rval); diff --git a/docs/cpque_api.md b/docs/cpque_api.md index ab9e8117..9ac48ec7 100644 --- a/docs/cpque_api.md +++ b/docs/cpque_api.md @@ -21,7 +21,6 @@ Declaring `using_cpque(my, cvec_my, >);`, `X` should be replaced by `my` in the |:---------------------|:--------------------------------------|:------------------------| | `cpque_X` | `struct {cpque_X_value_t* data; ...}` | The cpque type | | `cpque_X_value_t` | Depends on underlying container type | The cpque element type | -| `cpque_X_input_t` | " | cpque input type | | `cpque_X_rawvalue_t` | " | cpque raw value type | ## Header file diff --git a/docs/cqueue_api.md b/docs/cqueue_api.md index 721b2069..f5fe3f21 100644 --- a/docs/cqueue_api.md +++ b/docs/cqueue_api.md @@ -20,7 +20,6 @@ will affect the names of all cqueue types and methods. E.g. declaring `using_cqu |:----------------------|:---------------------------------------|:-------------------------| | `cqueue_X` | Depends on underlying container type | The cqueue type | | `cqueue_X_value_t` | " | The cqueue element type | -| `cqueue_X_input_t` | " | cqueue input type | | `cqueue_X_rawvalue_t` | " | cqueue raw value type | | `cqueue_X_iter_t` | " | cqueue iterator | @@ -44,7 +43,7 @@ bool cqueue_X_empty(cqueue_X q); cqueue_X_value_t* cqueue_X_front(cqueue_X* self); cqueue_X_value_t* cqueue_X_back(cqueue_X* self); -void cqueue_X_push_n(cqueue_X *self, const cqueue_X_input_t arr[], size_t size); +void cqueue_X_push_n(cqueue_X *self, const cqueue_X_rawvalue_t arr[], size_t size); void cqueue_X_emplace(cqueue_X* self, cqueue_X_rawvalue_t raw); void cqueue_X_push(cqueue_X* self, cqueue_X_value_t value); void cqueue_X_pop(cqueue_X* self); diff --git a/docs/cset_api.md b/docs/cset_api.md index 70ca0d8c..31698a87 100644 --- a/docs/cset_api.md +++ b/docs/cset_api.md @@ -27,10 +27,10 @@ be replaced by `my` in all of the following documentation. |:---------------------|:--------------------------------------|:-------------------------| | `cset_X` | `struct { ... }` | The cset type | | `cset_X_rawkey_t` | `RawKey` | The raw key type | +| `cset_X_rawvalue_t` | `cset_X_rawkey_t` | The raw key type | | `cset_X_key_t` | `Key` | The key type | -| `cset_X_value_t` | `Key` | The value type | +| `cset_X_value_t` | `cset_X_key_t` | The value type | | `cset_X_result_t` | `struct { Key first; bool second; }` | Result of insert/emplace | -| `cset_X_input_t` | `cset_X_rawkey_t` | The input type (rawkey) | | `cset_X_iter_t` | `struct { cset_X_value_t *ref; ... }` | Iterator type | ## Constants and macros @@ -65,7 +65,7 @@ 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_X_push_n(cset_X* self, const cset_X_input_t in[], size_t size); +void cset_X_push_n(cset_X* self, const RawKey arr[], size_t size); cset_X_result_t cset_X_emplace(cset_X* self, RawKey rkey); cset_X_result_t cset_X_insert(cset_X* self, RawKey rkey); diff --git a/docs/cstack_api.md b/docs/cstack_api.md index 6da14d1e..1bf3fb7f 100644 --- a/docs/cstack_api.md +++ b/docs/cstack_api.md @@ -20,7 +20,6 @@ affect the names of all cstack types and methods. E.g. declaring `using_cstack(m |:----------------------|:---------------------------------------|:----------------------------| | `cstack_X` | Depends on underlying container type | The cstack type | | `cstack_X_value_t` | " | The cstack element type | -| `cstack_X_input_t` | " | cstack input type | | `cstack_X_rawvalue_t` | " | cstack raw value type | | `cstack_X_iter_t` | " | cstack iterator | @@ -43,7 +42,7 @@ size_t cstack_X_size(cstack_X st); bool cstack_X_empty(cstack_X st); cstack_X_value_t* cstack_X_top(cstack_X* self); -void cstack_X_push_n(cstack_X *self, const cstack_X_input_t arr[], size_t size); +void cstack_X_push_n(cstack_X *self, const cstack_X_rawvalue_t arr[], size_t size); void cstack_X_emplace(cstack_X* self, cstack_X_rawvalue_t raw); void cstack_X_push(cstack_X* self, cstack_X_value_t value); void cstack_X_pop(cstack_X* self); diff --git a/docs/cvec_api.md b/docs/cvec_api.md index 2a79f3d7..9377f08c 100644 --- a/docs/cvec_api.md +++ b/docs/cvec_api.md @@ -30,7 +30,6 @@ using_cvec(str, cstr_t, cstr_compare_raw, cstr_del, cstr_from, cstr_to_raw, cons |:---------------------|:------------------------------------|:-----------------------| | `cvec_X` | `struct { cvec_X_value_t* data; }` | The cvec type | | `cvec_X_value_t` | `Value` | The cvec value type | -| `cvec_X_input_t` | `cvec_X_value_t` | The input type | | `cvec_X_rawvalue_t` | `RawValue` | The raw value type | | `cvec_X_iter_t` | `struct { cvec_X_value_t* ref; }` | The iterator type | @@ -71,7 +70,7 @@ cvec_X_value_t* cvec_X_at(cvec_X* self, size_t idx); 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 arr[], size_t size); +void cvec_X_push_n(cvec_X *self, const cvec_X_rawvalue_t arr[], size_t size); void cvec_X_emplace_back(cvec_X* self, RawValue raw); void cvec_X_push_back(cvec_X* self, Value value); void cvec_X_pop_back(cvec_X* self); diff --git a/stc/ccommon.h b/stc/ccommon.h index aae3cdd2..856ffaf5 100644 --- a/stc/ccommon.h +++ b/stc/ccommon.h @@ -116,7 +116,7 @@ b; b != __b ? c_free(b) : (void)0, b = NULL) #define c_push_items(self, ctype, ...) do { \ - const ctype##_input_t __arr[] = __VA_ARGS__; \ + const ctype##_rawvalue_t __arr[] = __VA_ARGS__; \ ctype##_push_n(self, __arr, sizeof __arr/sizeof *__arr); \ } while (0) diff --git a/stc/cdeq.h b/stc/cdeq.h index 4655cd0b..811b6b6c 100644 --- a/stc/cdeq.h +++ b/stc/cdeq.h @@ -42,7 +42,6 @@ #define typedefs_cdeq(X, Value, RawValue) \ typedef Value cdeq_##X##_value_t; \ typedef RawValue cdeq_##X##_rawvalue_t; \ - typedef cdeq_##X##_rawvalue_t cdeq_##X##_input_t; \ typedef struct { cdeq_##X##_value_t *ref; } cdeq_##X##_iter_t; \ typedef struct { \ cdeq_##X##_value_t *base, *data; \ @@ -96,7 +95,7 @@ } \ \ STC_API void \ - cdeq_##X##_push_n(cdeq_##X *self, const cdeq_##X##_input_t arr[], size_t n); \ + cdeq_##X##_push_n(cdeq_##X *self, const cdeq_##X##_rawvalue_t arr[], size_t n); \ STC_API void \ cdeq_##X##_push_back(cdeq_##X* self, Value value); \ STC_INLINE void \ @@ -210,7 +209,7 @@ #define _c_implement_cdeq_7(X, Value, valueCompareRaw, valueDestroy, valueFromRaw, valueToRaw, RawValue) \ \ STC_DEF void \ - cdeq_##X##_push_n(cdeq_##X *self, const cdeq_##X##_input_t arr[], size_t n) { \ + cdeq_##X##_push_n(cdeq_##X *self, const cdeq_##X##_rawvalue_t arr[], size_t n) { \ _cdeq_##X##_expand(self, n, false); \ cdeq_##X##_value_t* p = self->data + cdeq_##X##_size(*self); \ for (size_t i=0; i < n; ++i) *p++ = valueFromRaw(arr[i]); \ diff --git a/stc/clist.h b/stc/clist.h index e2374213..7a3a6397 100644 --- a/stc/clist.h +++ b/stc/clist.h @@ -88,7 +88,7 @@ #define c_emplace_after(self, ctype, pos, ...) do { \ ctype* __self = self; \ ctype##_iter_t __pos = pos; \ - const ctype##_input_t __arr[] = __VA_ARGS__; \ + const ctype##_rawvalue_t __arr[] = __VA_ARGS__; \ for (size_t __i=0; __ilast) self->last = entry; \ } \ STC_DEF void \ - clist_##X##_push_n(clist_##X *self, const clist_##X##_input_t in[], size_t size) { \ - for (size_t i=0; i */ \ -\ typedef ctype##_t cpque_##X; \ typedef ctype##_value_t cpque_##X##_value_t; \ typedef ctype##_rawvalue_t cpque_##X##_rawvalue_t; \ - typedef ctype##_input_t cpque_##X##_input_t; \ +\ STC_INLINE cpque_##X \ cpque_##X##_init(void) {return ctype##_init();} \ STC_INLINE cpque_##X \ @@ -82,7 +81,7 @@ cpque_##X##_push(self, ctype##_value_from_raw(raw)); \ } \ STC_API void \ - cpque_##X##_push_n(cpque_##X *self, const cpque_##X##_input_t in[], size_t size); \ + cpque_##X##_push_n(cpque_##X *self, const cpque_##X##_rawvalue_t arr[], size_t size); \ \ implement_cpque(X, ctype, cmpOpr) @@ -130,9 +129,9 @@ if (c != n) arr[c] = value; \ } \ STC_API void \ - cpque_##X##_push_n(cpque_##X *self, const cpque_##X##_input_t in[], size_t size) { \ + cpque_##X##_push_n(cpque_##X *self, const cpque_##X##_rawvalue_t arr[], size_t size) { \ ctype##_reserve(self, cpque_##X##_size(*self) + size); \ - for (size_t i=0; idata + _cvec_size(self); \ for (size_t i=0; i < n; ++i) *p++ = valueFromRaw(arr[i]); \ -- cgit v1.2.3