diff options
| author | Tyge Løvset <[email protected]> | 2021-01-04 18:25:44 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2021-01-04 18:25:44 +0100 |
| commit | a285bfb891ea00df8ab5cbb21f899ce9ced5f460 (patch) | |
| tree | 28ea8c9fc44ae54a3655751b62d9c77212e1678c /stc | |
| parent | 8505d9caf2280c0b7486fef9e018befe9d9fcb96 (diff) | |
| download | STC-modified-a285bfb891ea00df8ab5cbb21f899ce9ced5f460.tar.gz STC-modified-a285bfb891ea00df8ab5cbb21f899ce9ced5f460.zip | |
Simplified: Removed CONTAINER_input_t type, replaced with CONTAINER_rawvalue_t
Diffstat (limited to 'stc')
| -rw-r--r-- | stc/ccommon.h | 2 | ||||
| -rw-r--r-- | stc/cdeq.h | 5 | ||||
| -rw-r--r-- | stc/clist.h | 9 | ||||
| -rw-r--r-- | stc/cmap.h | 16 | ||||
| -rw-r--r-- | stc/cpque.h | 9 | ||||
| -rw-r--r-- | stc/cqueue.h | 7 | ||||
| -rw-r--r-- | stc/cstack.h | 7 | ||||
| -rw-r--r-- | stc/cvec.h | 5 |
8 files changed, 27 insertions, 33 deletions
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)
@@ -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; __i<sizeof __arr/sizeof *__arr; ++__i) \
__pos = ctype##_emplace_after(__self, __pos, __arr[__i]); \
} while (0)
@@ -102,7 +102,6 @@ STC_API size_t _clist_size(const clist_void* self); \
using_clist_types(X, Value); \
typedef RawValue clist_##X##_rawvalue_t; \
- typedef clist_##X##_rawvalue_t clist_##X##_input_t; \
\
STC_INLINE clist_##X \
clist_##X##_init(void) {clist_##X x = clist_inits; return x;} \
@@ -123,7 +122,7 @@ STC_API size_t _clist_size(const clist_void* self); clist_##X##_clear(clist_##X* self) {clist_##X##_del(self);} \
\
STC_API void \
- clist_##X##_push_n(clist_##X *self, const clist_##X##_input_t in[], size_t size); \
+ clist_##X##_push_n(clist_##X *self, const clist_##X##_rawvalue_t arr[], size_t size); \
STC_API void \
clist_##X##_push_back(clist_##X* self, Value value); \
STC_INLINE void \
@@ -237,8 +236,8 @@ STC_API size_t _clist_size(const clist_void* self); if (!self->last) 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<size; ++i) clist_##X##_push_back(self, valueFromRaw(in[i])); \
+ clist_##X##_push_n(clist_##X *self, const clist_##X##_rawvalue_t arr[], size_t size) { \
+ for (size_t i=0; i<size; ++i) clist_##X##_push_back(self, valueFromRaw(arr[i])); \
} \
\
STC_DEF clist_##X##_iter_t \
@@ -158,7 +158,7 @@ typedef struct {size_t idx; uint32_t hx;} cmap_bucket_t, cset_bucket_t; typedef Key ctype##_##X##_key_t; \
typedef Mapped ctype##_##X##_mapped_t; \
typedef RawKey ctype##_##X##_rawkey_t; \
- typedef RawMapped ctype##_##X##_rawval_t; \
+ typedef RawMapped ctype##_##X##_rawmapped_t; \
\
typedef CSET_ONLY_##ctype( ctype##_##X##_key_t ) \
CMAP_ONLY_##ctype( struct {ctype##_##X##_key_t first; \
@@ -172,8 +172,8 @@ typedef struct {size_t idx; uint32_t hx;} cmap_bucket_t, cset_bucket_t; } \
typedef CSET_ONLY_##ctype( ctype##_##X##_rawkey_t ) \
CMAP_ONLY_##ctype( struct {ctype##_##X##_rawkey_t first; \
- ctype##_##X##_rawval_t second;} ) \
- ctype##_##X##_input_t; \
+ ctype##_##X##_rawmapped_t second;} ) \
+ ctype##_##X##_rawvalue_t; \
\
typedef struct { \
ctype##_##X##_value_t *first; \
@@ -222,7 +222,7 @@ typedef struct {size_t idx; uint32_t hx;} cmap_bucket_t, cset_bucket_t; STC_API void \
ctype##_##X##_reserve(ctype##_##X* self, size_t size); \
STC_API void \
- ctype##_##X##_push_n(ctype##_##X* self, const ctype##_##X##_input_t arr[], size_t size); \
+ ctype##_##X##_push_n(ctype##_##X* self, const ctype##_##X##_rawvalue_t arr[], size_t size); \
STC_API void \
ctype##_##X##_del(ctype##_##X* self); \
STC_API void \
@@ -244,9 +244,9 @@ typedef struct {size_t idx; uint32_t hx;} cmap_bucket_t, cset_bucket_t; return res; \
} \
STC_INLINE ctype##_##X##_result_t \
- ctype##_##X##_insert(ctype##_##X* self, ctype##_##X##_input_t in) { \
- return CSET_ONLY_##ctype(ctype##_##X##_insert_key_(self, in)) \
- CMAP_ONLY_##ctype(ctype##_##X##_emplace(self, in.first, in.second)); \
+ ctype##_##X##_insert(ctype##_##X* self, ctype##_##X##_rawvalue_t arr) { \
+ return CSET_ONLY_##ctype(ctype##_##X##_insert_key_(self, arr)) \
+ CMAP_ONLY_##ctype(ctype##_##X##_emplace(self, arr.first, arr.second)); \
} \
\
CMAP_ONLY_##ctype( \
@@ -326,7 +326,7 @@ typedef struct {size_t idx; uint32_t hx;} cmap_bucket_t, cset_bucket_t; return h; \
} \
STC_DEF void \
- ctype##_##X##_push_n(ctype##_##X* self, const ctype##_##X##_input_t arr[], size_t n) { \
+ ctype##_##X##_push_n(ctype##_##X* self, const ctype##_##X##_rawvalue_t arr[], size_t n) { \
for (size_t i=0; i<n; ++i) CMAP_ONLY_##ctype(ctype##_##X##_put(self, arr[i].first, arr[i].second)) \
CSET_ONLY_##ctype(ctype##_##X##_insert(self, arr[i])) ; \
} \
diff --git a/stc/cpque.h b/stc/cpque.h index da2ad690..d2df1de5 100644 --- a/stc/cpque.h +++ b/stc/cpque.h @@ -50,11 +50,10 @@ #include "cvec.h"
#define using_cpque(X, ctype, cmpOpr) /* cmpOpr: < or > */ \
-\
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; i<size; ++i) cpque_##X##_push(self, in[i]); \
+ for (size_t i=0; i<size; ++i) cpque_##X##_push(self, arr[i]); \
} \
\
typedef cpque_##X cpque_##X##_t
diff --git a/stc/cqueue.h b/stc/cqueue.h index 0d349a26..0481797e 100644 --- a/stc/cqueue.h +++ b/stc/cqueue.h @@ -57,11 +57,10 @@ #include "clist.h"
#define using_cqueue(X, ctype) \
-\
typedef ctype##_t cqueue_##X; \
typedef ctype##_value_t cqueue_##X##_value_t; \
typedef ctype##_rawvalue_t cqueue_##X##_rawvalue_t; \
- typedef ctype##_input_t cqueue_##X##_input_t; \
+\
STC_INLINE cqueue_##X \
cqueue_##X##_init(void) {return ctype##_init();} \
STC_INLINE cqueue_##X \
@@ -89,8 +88,8 @@ ctype##_emplace_back(self, raw); \
} \
STC_INLINE void \
- cqueue_##X##_push_n(cqueue_##X *self, const cqueue_##X##_input_t in[], size_t size) { \
- ctype##_push_n(self, in, size); \
+ cqueue_##X##_push_n(cqueue_##X *self, const cqueue_##X##_rawvalue_t arr[], size_t size) { \
+ ctype##_push_n(self, arr, size); \
} \
typedef ctype##_iter_t cqueue_##X##_iter_t; \
STC_INLINE cqueue_##X##_iter_t \
diff --git a/stc/cstack.h b/stc/cstack.h index 7bf9cfe3..276a577d 100644 --- a/stc/cstack.h +++ b/stc/cstack.h @@ -46,11 +46,10 @@ #include "cvec.h"
#define using_cstack(X, ctype) \
-\
typedef ctype##_t cstack_##X; \
typedef ctype##_value_t cstack_##X##_value_t; \
typedef ctype##_rawvalue_t cstack_##X##_rawvalue_t; \
- typedef ctype##_input_t cstack_##X##_input_t; \
+\
STC_INLINE cstack_##X \
cstack_##X##_init(void) {return ctype##_init();} \
STC_INLINE cstack_##X \
@@ -76,8 +75,8 @@ ctype##_emplace_back(self, raw); \
} \
STC_INLINE void \
- cstack_##X##_push_n(cstack_##X *self, const cstack_##X##_input_t in[], size_t size) { \
- ctype##_push_n(self, in, size); \
+ cstack_##X##_push_n(cstack_##X *self, const cstack_##X##_rawvalue_t arr[], size_t size) { \
+ ctype##_push_n(self, arr, size); \
} \
typedef ctype##_iter_t cstack_##X##_iter_t; \
STC_INLINE cstack_##X##_iter_t \
@@ -42,7 +42,6 @@ #define typedefs_cvec(X, Value, RawValue) \
typedef Value cvec_##X##_value_t; \
typedef RawValue cvec_##X##_rawvalue_t; \
- typedef cvec_##X##_rawvalue_t cvec_##X##_input_t; \
typedef struct { cvec_##X##_value_t *ref; } cvec_##X##_iter_t; \
typedef struct { \
cvec_##X##_value_t* data; \
@@ -97,7 +96,7 @@ cvec_##X##_del(self); *self = x; \
} \
STC_API void \
- cvec_##X##_push_n(cvec_##X *self, const cvec_##X##_input_t arr[], size_t size); \
+ cvec_##X##_push_n(cvec_##X *self, const cvec_##X##_rawvalue_t arr[], size_t size); \
STC_API void \
cvec_##X##_push_back(cvec_##X* self, Value value); \
STC_INLINE void \
@@ -199,7 +198,7 @@ #define _c_implement_cvec_7(X, Value, valueCompareRaw, valueDestroy, valueFromRaw, valueToRaw, RawValue) \
\
STC_DEF void \
- cvec_##X##_push_n(cvec_##X *self, const cvec_##X##_input_t arr[], size_t n) { \
+ cvec_##X##_push_n(cvec_##X *self, const cvec_##X##_rawvalue_t arr[], size_t n) { \
cvec_##X##_reserve(self, cvec_##X##_size(*self) + n); \
cvec_##X##_value_t* p = self->data + _cvec_size(self); \
for (size_t i=0; i < n; ++i) *p++ = valueFromRaw(arr[i]); \
|
