Array interface standardization

This commit is contained in:
Gregory Lirent 2022-06-09 16:26:11 +03:00
parent 41c46ed1f9
commit 5a8a7ee6ef
4 changed files with 165 additions and 89 deletions

View File

@ -9,18 +9,24 @@
/*#####################################################################################################################*/
typedef int (*array_access_callback)(void* value, ssize_t index, vtype type, void* data);
extern void array_init(vtype_array* x, vtype type) LIBCDSB_nt__ LIBCDSB_nn1__;
extern void* array_at(const vtype_array* s, ssize_t index) LIBCDSB_nt__ LIBCDSB_nn1__;
extern _Bool array_slice(vtype_array* x, vtype_array* src, ssize_t index, size_t count, _Bool cut) LIBCDSB_nt__ LIBCDSB_nn12__;
extern bool array_slice(vtype_array* x, vtype_array* src, ssize_t index, size_t count, bool cut) LIBCDSB_nt__ LIBCDSB_nn12__;
extern void array_sort (vtype_array* x) LIBCDSB_nt__ LIBCDSB_nn1__;
extern void array_reverse(vtype_array* x) LIBCDSB_nt__ LIBCDSB_nn1__;
#define array_push(x, value) _LIBCDSB_Generic(libcdsb_array, push, value)(x, value)
#define array_indexof(x, value) _LIBCDSB_Generic(libcdsb_array, indexof, value)(x, value)
#define array_pop(x, value, data, callback) _LIBCDSB_Generic(libcdsb_array, find, value)(x, value, data, callback, 0, 1)
#define array_find(x, value, data, callback) _LIBCDSB_Generic(libcdsb_array, find, value)(x, value, data, callback, 0, 0)
#define array_rfind(x, value, data, callback) _LIBCDSB_Generic(libcdsb_array, find, value)(x, value, data, callback, 1, 0)
#define list_countof(x, value) _LIBCDSB_Generic(libcdsb_array, count, value)(x, value)
#define array_remove(x, value) array_pop(x, value, 0, 0)
#define in_array(x, value) (array_find(x, value, 0, 0) == 0)
#define in_array(x, value) (array_indexof(x, value) >= 0)
#define array_push_back(x, value) _LIBCDSB_Generic(libcdsb_array, push, value)(x, value)
/*#####################################################################################################################*/
@ -44,24 +50,44 @@ extern void libcdsb_array_push_float (vtype_array* x, vtype_float value
extern void libcdsb_array_push_double (vtype_array* x, vtype_double value) LIBCDSB_nt__ LIBCDSB_nn1__;
extern void libcdsb_array_push_ldouble(vtype_array* x, vtype_ldouble value) LIBCDSB_nt__ LIBCDSB_nn1__;
extern ssize_t libcdsb_array_indexof_pointer(const vtype_array* x, const void* value) LIBCDSB_pure__ LIBCDSB_nn1__;
extern ssize_t libcdsb_array_indexof_string (const vtype_array* x, const char* value) LIBCDSB_pure__ LIBCDSB_nn12__;
extern ssize_t libcdsb_array_indexof_array (const vtype_array* x, const vtype_string* value) LIBCDSB_pure__ LIBCDSB_nn12__;
extern ssize_t libcdsb_array_indexof_list (const vtype_array* x, const vtype_array* value) LIBCDSB_pure__ LIBCDSB_nn12__;
extern ssize_t libcdsb_array_indexof_map (const vtype_array* x, const vtype_list* value) LIBCDSB_pure__ LIBCDSB_nn12__;
extern ssize_t libcdsb_array_indexof_vset (const vtype_array* x, const vtype_map* value) LIBCDSB_pure__ LIBCDSB_nn12__;
extern ssize_t libcdsb_array_indexof_cstring(const vtype_array* x, const vtype_set* value) LIBCDSB_pure__ LIBCDSB_nn1__;
extern ssize_t libcdsb_array_indexof_boolean(const vtype_array* x, vtype_bool value) LIBCDSB_pure__ LIBCDSB_nn1__;
extern ssize_t libcdsb_array_indexof_uint8 (const vtype_array* x, vtype_uint8 value) LIBCDSB_pure__ LIBCDSB_nn1__;
extern ssize_t libcdsb_array_indexof_uint16 (const vtype_array* x, vtype_uint16 value) LIBCDSB_pure__ LIBCDSB_nn1__;
extern ssize_t libcdsb_array_indexof_uint32 (const vtype_array* x, vtype_uint32 value) LIBCDSB_pure__ LIBCDSB_nn1__;
extern ssize_t libcdsb_array_indexof_uint64 (const vtype_array* x, vtype_uint64 value) LIBCDSB_pure__ LIBCDSB_nn1__;
extern ssize_t libcdsb_array_indexof_int8 (const vtype_array* x, vtype_int8 value) LIBCDSB_pure__ LIBCDSB_nn1__;
extern ssize_t libcdsb_array_indexof_int16 (const vtype_array* x, vtype_int16 value) LIBCDSB_pure__ LIBCDSB_nn1__;
extern ssize_t libcdsb_array_indexof_int32 (const vtype_array* x, vtype_int32 value) LIBCDSB_pure__ LIBCDSB_nn1__;
extern ssize_t libcdsb_array_indexof_int64 (const vtype_array* x, vtype_int64 value) LIBCDSB_pure__ LIBCDSB_nn1__;
extern ssize_t libcdsb_array_indexof_float (const vtype_array* x, vtype_float value) LIBCDSB_pure__ LIBCDSB_nn1__;
extern ssize_t libcdsb_array_indexof_double (const vtype_array* x, vtype_double value) LIBCDSB_pure__ LIBCDSB_nn1__;
extern ssize_t libcdsb_array_indexof_ldouble(const vtype_array* x, vtype_ldouble value) LIBCDSB_pure__ LIBCDSB_nn1__;
extern size_t libcdsb_array_count_pointer(const vtype_array* s, const void* value);
extern size_t libcdsb_array_count_cstring(const vtype_array* s, const char* value);
extern size_t libcdsb_array_count_string (const vtype_array* s, const vtype_string* value);
extern size_t libcdsb_array_count_array (const vtype_array* s, const vtype_array* value);
extern size_t libcdsb_array_count_list (const vtype_array* s, const vtype_list* value);
extern size_t libcdsb_array_count_map (const vtype_array* s, const vtype_map* value);
extern size_t libcdsb_array_count_vset (const vtype_array* s, const vtype_set* value);
extern size_t libcdsb_array_count_boolean(const vtype_array* s, vtype_bool value);
extern size_t libcdsb_array_count_int8 (const vtype_array* s, vtype_int8 value);
extern size_t libcdsb_array_count_int16 (const vtype_array* s, vtype_int16 value);
extern size_t libcdsb_array_count_int32 (const vtype_array* s, vtype_int32 value);
extern size_t libcdsb_array_count_int64 (const vtype_array* s, vtype_int64 value);
extern size_t libcdsb_array_count_uint8 (const vtype_array* s, vtype_uint8 value);
extern size_t libcdsb_array_count_uint16 (const vtype_array* s, vtype_uint16 value);
extern size_t libcdsb_array_count_uint32 (const vtype_array* s, vtype_uint32 value);
extern size_t libcdsb_array_count_uint64 (const vtype_array* s, vtype_uint64 value);
extern size_t libcdsb_array_count_float (const vtype_array* s, vtype_float value);
extern size_t libcdsb_array_count_double (const vtype_array* s, vtype_double value);
extern size_t libcdsb_array_count_ldouble(const vtype_array* s, vtype_ldouble value);
extern int libcdsb_array_find_pointer(vtype_array* x, const void* value, void* data, array_access_callback, bool reverse, bool cut) LIBCDSB_nt__ LIBCDSB_nn1__;
extern int libcdsb_array_find_string (vtype_array* x, const char* value, void* data, array_access_callback, bool reverse, bool cut) LIBCDSB_nt__ LIBCDSB_nn12__;
extern int libcdsb_array_find_array (vtype_array* x, const vtype_string* value, void* data, array_access_callback, bool reverse, bool cut) LIBCDSB_nt__ LIBCDSB_nn12__;
extern int libcdsb_array_find_list (vtype_array* x, const vtype_array* value, void* data, array_access_callback, bool reverse, bool cut) LIBCDSB_nt__ LIBCDSB_nn12__;
extern int libcdsb_array_find_map (vtype_array* x, const vtype_list* value, void* data, array_access_callback, bool reverse, bool cut) LIBCDSB_nt__ LIBCDSB_nn12__;
extern int libcdsb_array_find_vset (vtype_array* x, const vtype_map* value, void* data, array_access_callback, bool reverse, bool cut) LIBCDSB_nt__ LIBCDSB_nn12__;
extern int libcdsb_array_find_cstring(vtype_array* x, const vtype_set* value, void* data, array_access_callback, bool reverse, bool cut) LIBCDSB_nt__ LIBCDSB_nn1__;
extern int libcdsb_array_find_boolean(vtype_array* x, vtype_bool value, void* data, array_access_callback, bool reverse, bool cut) LIBCDSB_nt__ LIBCDSB_nn1__;
extern int libcdsb_array_find_uint8 (vtype_array* x, vtype_uint8 value, void* data, array_access_callback, bool reverse, bool cut) LIBCDSB_nt__ LIBCDSB_nn1__;
extern int libcdsb_array_find_uint16 (vtype_array* x, vtype_uint16 value, void* data, array_access_callback, bool reverse, bool cut) LIBCDSB_nt__ LIBCDSB_nn1__;
extern int libcdsb_array_find_uint32 (vtype_array* x, vtype_uint32 value, void* data, array_access_callback, bool reverse, bool cut) LIBCDSB_nt__ LIBCDSB_nn1__;
extern int libcdsb_array_find_uint64 (vtype_array* x, vtype_uint64 value, void* data, array_access_callback, bool reverse, bool cut) LIBCDSB_nt__ LIBCDSB_nn1__;
extern int libcdsb_array_find_int8 (vtype_array* x, vtype_int8 value, void* data, array_access_callback, bool reverse, bool cut) LIBCDSB_nt__ LIBCDSB_nn1__;
extern int libcdsb_array_find_int16 (vtype_array* x, vtype_int16 value, void* data, array_access_callback, bool reverse, bool cut) LIBCDSB_nt__ LIBCDSB_nn1__;
extern int libcdsb_array_find_int32 (vtype_array* x, vtype_int32 value, void* data, array_access_callback, bool reverse, bool cut) LIBCDSB_nt__ LIBCDSB_nn1__;
extern int libcdsb_array_find_int64 (vtype_array* x, vtype_int64 value, void* data, array_access_callback, bool reverse, bool cut) LIBCDSB_nt__ LIBCDSB_nn1__;
extern int libcdsb_array_find_float (vtype_array* x, vtype_float value, void* data, array_access_callback, bool reverse, bool cut) LIBCDSB_nt__ LIBCDSB_nn1__;
extern int libcdsb_array_find_double (vtype_array* x, vtype_double value, void* data, array_access_callback, bool reverse, bool cut) LIBCDSB_nt__ LIBCDSB_nn1__;
extern int libcdsb_array_find_ldouble(vtype_array* x, vtype_ldouble value, void* data, array_access_callback, bool reverse, bool cut) LIBCDSB_nt__ LIBCDSB_nn1__;
#endif /* LIBCDSB_ARRAY_H */

View File

@ -6,18 +6,18 @@
#ifndef LIBCDSB_EXTRA_ARRAY_H
#define LIBCDSB_EXTRA_ARRAY_H
typedef int (*array_access_callback)(void* value, ssize_t index, vtype type, void* data);
#define array_get(s, index, data, callback) libcdsb_array_get(s, index, data, callback, 0)
#define array_pop(s, index, data, callback) libcdsb_array_get(s, index, data, callback, 1)
#define array_remove(s, index) libcdsb_array_get(s, index, 0, 0, 1)
#define array_get_by_index(s, index, data, callback) libcdsb_array_get(s, index, data, callback, 0)
#define array_pop_by_index(s, index, data, callback) libcdsb_array_get(s, index, data, callback, 1)
#define array_remove_by_index(s, index) libcdsb_array_get(s, index, 0, 0, 1)
#define array_foreach(x, data, callback) libcdsb_array_foreach(x, data, callback, 0)
extern int libcdsb_array_get (vtype_array* x, ssize_t index, void* data, array_access_callback, vtype_bool cut) LIBCDSB_nt__ LIBCDSB_nn1__;
extern ssize_t libcdsb_array_find(const vtype_array* x, const void* value, vtype value_type) LIBCDSB_nt__ LIBCDSB_nn1__;
extern ssize_t libcdsb_array_push( vtype_array* x, const void* value, vtype value_type) LIBCDSB_nt__ LIBCDSB_nn1__;
extern ssize_t libcdsb_array_push(vtype_array* x, const void* value, vtype value_type) LIBCDSB_nt__ LIBCDSB_nn1__;
extern int libcdsb_array_foreach(vtype_array* x, void* data, array_access_callback, vtype_bool flush) LIBCDSB_nt__ LIBCDSB_nn13__;
extern size_t libcdsb_array_count(const vtype_array* s, const void* value, vtype type) LIBCDSB_nt__ LIBCDSB_nn1__;
extern int libcdsb_array_find (vtype_array* x, const void* value, vtype type, void* data, array_access_callback, bool reverse, bool cut) LIBCDSB_nt__ LIBCDSB_nn1__;
extern int libcdsb_array_get (vtype_array* x, ssize_t index, void* data, array_access_callback, bool cut) LIBCDSB_nt__ LIBCDSB_nn1__;
extern int libcdsb_array_foreach(vtype_array* x, void* data, array_access_callback, bool flush) LIBCDSB_nt__ LIBCDSB_nn13__;
#endif /* LIBCDSB_EXTRA_ARRAY_H */

View File

@ -5,43 +5,9 @@
#include "../__internal/assert.h"
#include "../__internal/vnode.h"
ssize_t libcdsb_array_find(const arr_t* x, const void* v, vtype vt) {
int c;
ssize_t index;
if (is_integer(x->type)) {
tvalue_assert(vt);
} else if (is_float(x->type)) {
tvalue_assert(vt);
} else type_assert(x->type, vt);
index = -1;
if (!x->size)
return index;
void* p = x->mem;
void* e = array_end(x);
assert(!is_null(x->mem));
do {
++index;
c = vtype_compare(p, x->type, v, vt);
if (c == 0)
return index;
p += vtype_size(x->type);
} while (p < e);
return -1;
}
ssize_t libcdsb_array_push(arr_t* x, const void* v, vtype vt) {
ssize_t libcdsb_array_push(arr_t* x, const void* v, vtype t) {
ssize_t i = x->size;
vnode_t n = vnode_tcreate(x->type, v, vt);
vnode_t n = vnode_tcreate(x->type, v, t);
x->mem = realloc(x->mem, ++x->size * vtype_size(x->type));
memcpy(array_internal_at(x, i), vnode_peek(&n, x->type), vtype_size(x->type));
@ -53,6 +19,28 @@ ssize_t libcdsb_array_push(arr_t* x, const void* v, vtype vt) {
}
size_t libcdsb_array_count(const arr_t* s, const void* v, vtype t) {
void *p;
void *e;
int cmp;
size_t n;
p = s->mem;
e = array_end(s);
n = 0;
do {
cmp = vtype_compare(p, s->type, v, t);
if (cmp == 0) ++n;
p += vtype_size(s->type);
} while (p < e);
return n;
}
int libcdsb_array_get(vtype_array* x, ssize_t i, void* _, array_access_callback callback, vtype_bool cut) {
int r = 0;
@ -68,7 +56,49 @@ int libcdsb_array_get(vtype_array* x, ssize_t i, void* _, array_access_callback
}
int libcdsb_array_foreach(vtype_array* x, void* data, array_access_callback callback, _Bool flush) {
int libcdsb_array_find(arr_t* x, const void* v, vtype t, void* _, array_access_callback callback, bool r, bool cut) {
void *p;
ssize_t i;
int cmp;
if (!x->size) return -1;
if (!r) {
p = x->mem;
i = 0;
do {
cmp = vtype_compare(p, x->type, v, t);
if (cmp == 0) break;
p += vtype_size(x->type);
++i;
} while (i < x->size);
if (i >= x->size) return -1;
} else {
p = array_end(x);
i = x->size;
while (i--) {
p -= vtype_size(x->type);
cmp = vtype_compare(p, x->type, v, t);
if (cmp == 0) break;
}
if (i < 0) return i;
}
if (callback) cmp = callback(p, i, x->type, _);
if (cut) array_cut(x, i, 1);
return cmp;
}
int libcdsb_array_foreach(vtype_array* x, void* data, array_access_callback callback, bool flush) {
void* p;
void* e;

View File

@ -3,25 +3,45 @@
#include "include.h"
ssize_t libcdsb_array_indexof_pointer(const arr_t* x, const void* v) { return libcdsb_array_find(x, &v, vtypeof(&v)); }
ssize_t libcdsb_array_indexof_string (const arr_t* x, const char* v) { return libcdsb_array_find(x, &v, vtypeof(&v)); }
ssize_t libcdsb_array_indexof_array (const arr_t* x, const str_t* v) { return libcdsb_array_find(x, v, vtypeof( v)); }
ssize_t libcdsb_array_indexof_list (const arr_t* x, const arr_t* v) { return libcdsb_array_find(x, v, vtypeof( v)); }
ssize_t libcdsb_array_indexof_map (const arr_t* x, const list_t* v) { return libcdsb_array_find(x, v, vtypeof( v)); }
ssize_t libcdsb_array_indexof_vset (const arr_t* x, const map_t* v) { return libcdsb_array_find(x, v, vtypeof( v)); }
ssize_t libcdsb_array_indexof_cstring(const arr_t* x, const set_t* v) { return libcdsb_array_find(x, v, vtypeof( v)); }
ssize_t libcdsb_array_indexof_boolean(const arr_t* x, _Bool v) { return libcdsb_array_find(x, &v, vtypeof(&v)); }
ssize_t libcdsb_array_indexof_int8 (const arr_t* x, s8_t v) { return libcdsb_array_find(x, &v, vtypeof(&v)); }
ssize_t libcdsb_array_indexof_int16 (const arr_t* x, s16_t v) { return libcdsb_array_find(x, &v, vtypeof(&v)); }
ssize_t libcdsb_array_indexof_int32 (const arr_t* x, s32_t v) { return libcdsb_array_find(x, &v, vtypeof(&v)); }
ssize_t libcdsb_array_indexof_int64 (const arr_t* x, s64_t v) { return libcdsb_array_find(x, &v, vtypeof(&v)); }
ssize_t libcdsb_array_indexof_uint8 (const arr_t* x, u8_t v) { return libcdsb_array_find(x, &v, vtypeof(&v)); }
ssize_t libcdsb_array_indexof_uint16 (const arr_t* x, u16_t v) { return libcdsb_array_find(x, &v, vtypeof(&v)); }
ssize_t libcdsb_array_indexof_uint32 (const arr_t* x, u32_t v) { return libcdsb_array_find(x, &v, vtypeof(&v)); }
ssize_t libcdsb_array_indexof_uint64 (const arr_t* x, u64_t v) { return libcdsb_array_find(x, &v, vtypeof(&v)); }
ssize_t libcdsb_array_indexof_float (const arr_t* x, fl_t v) { return libcdsb_array_find(x, &v, vtypeof(&v)); }
ssize_t libcdsb_array_indexof_double (const arr_t* x, dbl_t v) { return libcdsb_array_find(x, &v, vtypeof(&v)); }
ssize_t libcdsb_array_indexof_ldouble(const arr_t* x, ldbl_t v) { return libcdsb_array_find(x, &v, vtypeof(&v)); }
int libcdsb_array_find_pointer(arr_t* x, const void* v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_array_find_string (arr_t* x, const char* v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_array_find_array (arr_t* x, const str_t* v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, v, vtypeof( v), _, cb, r, cut); }
int libcdsb_array_find_list (arr_t* x, const arr_t* v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, v, vtypeof( v), _, cb, r, cut); }
int libcdsb_array_find_map (arr_t* x, const list_t* v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, v, vtypeof( v), _, cb, r, cut); }
int libcdsb_array_find_vset (arr_t* x, const map_t* v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, v, vtypeof( v), _, cb, r, cut); }
int libcdsb_array_find_cstring(arr_t* x, const set_t* v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, v, vtypeof( v), _, cb, r, cut); }
int libcdsb_array_find_boolean(arr_t* x, bool v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_array_find_int8 (arr_t* x, s8_t v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_array_find_int16 (arr_t* x, s16_t v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_array_find_int32 (arr_t* x, s32_t v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_array_find_int64 (arr_t* x, s64_t v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_array_find_uint8 (arr_t* x, u8_t v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_array_find_uint16 (arr_t* x, u16_t v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_array_find_uint32 (arr_t* x, u32_t v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_array_find_uint64 (arr_t* x, u64_t v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_array_find_float (arr_t* x, fl_t v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_array_find_double (arr_t* x, dbl_t v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_array_find_ldouble(arr_t* x, ldbl_t v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, &v, vtypeof(&v), _, cb, r, cut); }
size_t libcdsb_array_count_pointer(const arr_t* x, const void* v) { return libcdsb_array_count(x, &v, vtypeof(&v)); }
size_t libcdsb_array_count_cstring(const arr_t* x, const char* v) { return libcdsb_array_count(x, &v, vtypeof(&v)); }
size_t libcdsb_array_count_string (const arr_t* x, const str_t* v) { return libcdsb_array_count(x, v, vtypeof( v)); }
size_t libcdsb_array_count_array (const arr_t* x, const arr_t* v) { return libcdsb_array_count(x, v, vtypeof( v)); }
size_t libcdsb_array_count_list (const arr_t* x, const list_t* v) { return libcdsb_array_count(x, v, vtypeof( v)); }
size_t libcdsb_array_count_map (const arr_t* x, const map_t* v) { return libcdsb_array_count(x, v, vtypeof( v)); }
size_t libcdsb_array_count_vset (const arr_t* x, const set_t* v) { return libcdsb_array_count(x, v, vtypeof( v)); }
size_t libcdsb_array_count_boolean(const arr_t* x, bool v) { return libcdsb_array_count(x, &v, vtypeof(&v)); }
size_t libcdsb_array_count_int8 (const arr_t* x, s8_t v) { return libcdsb_array_count(x, &v, vtypeof(&v)); }
size_t libcdsb_array_count_int16 (const arr_t* x, s16_t v) { return libcdsb_array_count(x, &v, vtypeof(&v)); }
size_t libcdsb_array_count_int32 (const arr_t* x, s32_t v) { return libcdsb_array_count(x, &v, vtypeof(&v)); }
size_t libcdsb_array_count_int64 (const arr_t* x, s64_t v) { return libcdsb_array_count(x, &v, vtypeof(&v)); }
size_t libcdsb_array_count_uint8 (const arr_t* x, u8_t v) { return libcdsb_array_count(x, &v, vtypeof(&v)); }
size_t libcdsb_array_count_uint16 (const arr_t* x, u16_t v) { return libcdsb_array_count(x, &v, vtypeof(&v)); }
size_t libcdsb_array_count_uint32 (const arr_t* x, u32_t v) { return libcdsb_array_count(x, &v, vtypeof(&v)); }
size_t libcdsb_array_count_uint64 (const arr_t* x, u64_t v) { return libcdsb_array_count(x, &v, vtypeof(&v)); }
size_t libcdsb_array_count_float (const arr_t* x, fl_t v) { return libcdsb_array_count(x, &v, vtypeof(&v)); }
size_t libcdsb_array_count_double (const arr_t* x, dbl_t v) { return libcdsb_array_count(x, &v, vtypeof(&v)); }
size_t libcdsb_array_count_ldouble(const arr_t* x, ldbl_t v) { return libcdsb_array_count(x, &v, vtypeof(&v)); }
void libcdsb_array_push_pointer(arr_t* x, const void* v) { libcdsb_array_push(x, &v, vtypeof(&v)); }
void libcdsb_array_push_cstring(arr_t* x, const char* v) { libcdsb_array_push(x, &v, vtypeof(&v)); }
@ -30,7 +50,7 @@ void libcdsb_array_push_array (arr_t* x, const arr_t* v) { libcdsb_array_push(
void libcdsb_array_push_list (arr_t* x, const list_t* v) { libcdsb_array_push(x, v, vtypeof( v)); }
void libcdsb_array_push_map (arr_t* x, const map_t* v) { libcdsb_array_push(x, v, vtypeof( v)); }
void libcdsb_array_push_vset (arr_t* x, const set_t* v) { libcdsb_array_push(x, v, vtypeof( v)); }
void libcdsb_array_push_boolean(arr_t* x, _Bool v) { libcdsb_array_push(x, &v, vtypeof(&v)); }
void libcdsb_array_push_boolean(arr_t* x, bool v) { libcdsb_array_push(x, &v, vtypeof(&v)); }
void libcdsb_array_push_int8 (arr_t* x, s8_t v) { libcdsb_array_push(x, &v, vtypeof(&v)); }
void libcdsb_array_push_int16 (arr_t* x, s16_t v) { libcdsb_array_push(x, &v, vtypeof(&v)); }
void libcdsb_array_push_int32 (arr_t* x, s32_t v) { libcdsb_array_push(x, &v, vtypeof(&v)); }