From ab75d629d3486f34e87e9863ffae50ec694c6bc8 Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Wed, 8 Jun 2022 20:56:59 +0300 Subject: [PATCH 01/27] Array access standardization --- include/array.h | 2 +- include/extra/array.h | 14 ++++++-------- src/array/{base-copy.c => copy.c} | 0 src/array/extra.c | 28 ++++++++++------------------ 4 files changed, 17 insertions(+), 27 deletions(-) rename src/array/{base-copy.c => copy.c} (100%) diff --git a/include/array.h b/include/array.h index 05042f0..6736627 100644 --- a/include/array.h +++ b/include/array.h @@ -12,7 +12,7 @@ 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_nn1__; +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__; diff --git a/include/extra/array.h b/include/extra/array.h index 99fe5c2..3b15ca5 100644 --- a/include/extra/array.h +++ b/include/extra/array.h @@ -6,20 +6,18 @@ #ifndef LIBCDSB_EXTRA_ARRAY_H #define LIBCDSB_EXTRA_ARRAY_H -typedef int (*array_foreach_callback)(void* value, ssize_t index, vtype type, void* data); +typedef int (*array_access_callback)(void* value, ssize_t index, vtype type, void* data); - -#define array_get(x, s, index) libcdsb_array_get(x, s, index, 0) -#define array_pop(x, s, index) libcdsb_array_get(x, s, index, 1) -#define array_remove(s, index) libcdsb_array_get(0, s, index, 1) +#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_foreach(x, data, callback) libcdsb_array_foreach(x, data, callback, 0) -extern ssize_t libcdsb_array_get(vtype_value* x, vtype_array* s, ssize_t index, _Bool cut) LIBCDSB_nt__ LIBCDSB_nn2__; - +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 int libcdsb_array_foreach(vtype_array* x, void* data, array_foreach_callback, _Bool flush) LIBCDSB_nt__ LIBCDSB_nn13__; +extern int libcdsb_array_foreach(vtype_array* x, void* data, array_access_callback, vtype_bool flush) LIBCDSB_nt__ LIBCDSB_nn13__; #endif /* LIBCDSB_EXTRA_ARRAY_H */ diff --git a/src/array/base-copy.c b/src/array/copy.c similarity index 100% rename from src/array/base-copy.c rename to src/array/copy.c diff --git a/src/array/extra.c b/src/array/extra.c index b2e6240..d78332b 100644 --- a/src/array/extra.c +++ b/src/array/extra.c @@ -38,6 +38,7 @@ ssize_t libcdsb_array_find(const arr_t* x, const void* v, vtype vt) { return -1; } + ssize_t libcdsb_array_push(arr_t* x, const void* v, vtype vt) { ssize_t i = x->size; vnode_t n = vnode_tcreate(x->type, v, vt); @@ -51,32 +52,23 @@ ssize_t libcdsb_array_push(arr_t* x, const void* v, vtype vt) { return i; } -ssize_t libcdsb_array_get(val_t* x, arr_t* s, ssize_t i, _Bool cut) { - if (i < 0 && (i += s->size) < 0) i = 0; +int libcdsb_array_get(vtype_array* x, ssize_t i, void* _, array_access_callback callback, vtype_bool cut) { - if (i < s->size) { - assert(!is_null(s->mem)); + int r = 0; - if (cut) { - if (!is_null(x)) { - vnode_t n = vnode_create(array_internal_at(s, i), s->type); - value_set(x, n, s->type, VF_WRITEABLE|VF_REMOVABLE); - } + if (i < 0 && (i += x->size) < 0) i = 0; - array_cut(s, i, 1); - } else value_set(x, array_internal_at(s, i), s->type, VF_WRITEABLE); - } else { - i = -1; - memset(x, 0, sizeof(*x)); - } + if (i < x->size) { + if (callback) r = callback(array_internal_at(x, i), i, x->type, _); + if (cut) array_cut(x, i, 1); + } else return -1; - return i; + return r; } -/*#####################################################################################################################*/ -int libcdsb_array_foreach(vtype_array* x, void* data, array_foreach_callback callback, _Bool flush) { +int libcdsb_array_foreach(vtype_array* x, void* data, array_access_callback callback, _Bool flush) { void* p; void* e; From 426f391561ec600dd689a09c3ee8b257f4e497fb Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Wed, 8 Jun 2022 20:59:07 +0300 Subject: [PATCH 02/27] List access standardization --- include/extra/list.h | 16 ++-- include/list.h | 53 ++++++------- src/list/extra.c | 178 ++++++++++++++++++++----------------------- src/list/generics.c | 38 ++++----- 4 files changed, 135 insertions(+), 150 deletions(-) diff --git a/include/extra/list.h b/include/extra/list.h index e1759b1..579784d 100644 --- a/include/extra/list.h +++ b/include/extra/list.h @@ -6,22 +6,18 @@ #ifndef LIBCDSB_EXTRA_LIST_H #define LIBCDSB_EXTRA_LIST_H -typedef int (*list_foreach_callback)(void* value, ssize_t index, vtype type, void* data); - - -#define list_get_by_index(x, s, index) libcdsb_list_get(x, s, index, 0) -#define list_pop_by_index(x, s, index) libcdsb_list_get(x, s, index, 1) -#define list_remove_by_index(s, index) libcdsb_list_get(0, s, index, 1) +#define list_get_by_index(x, index, data, callback) libcdsb_list_get(x, index, data, callback, 0) +#define list_pop_by_index(x, index, data, callback) libcdsb_list_get(x, index, data, callback, 1) +#define list_remove_by_index(x, index) libcdsb_list_get(x, index, 0, 0, 1) #define list_foreach(x, data, callback) libcdsb_list_foreach(x, data, callback, 0) -extern ssize_t libcdsb_list_find (vtype_value* x, vtype_list* s, const void* value, vtype type, _Bool reverse, _Bool cut) LIBCDSB_nt__ LIBCDSB_nn2__; extern _Bool libcdsb_list_update(vtype_list* x, ssize_t index, const void* value, vtype type, int ins_direction) LIBCDSB_nt__ LIBCDSB_nn1__; extern size_t libcdsb_list_count(const vtype_list* s, const void* value, vtype type) LIBCDSB_nt__ LIBCDSB_nn1__; -extern ssize_t libcdsb_list_get(vtype_value* x, vtype_list* s, ssize_t index, _Bool cut) LIBCDSB_nt__ LIBCDSB_nn2__; - -extern int libcdsb_list_foreach(vtype_list* x, void* data, list_foreach_callback, _Bool flush) LIBCDSB_nt__ LIBCDSB_nn13__; +extern int libcdsb_list_find (vtype_list* x, const void* value, vtype type, void* data, list_access_callback, _Bool reverse, _Bool cut) LIBCDSB_nt__ LIBCDSB_nn1__; +extern int libcdsb_list_get (vtype_list* x, ssize_t index, void* data, list_access_callback, _Bool cut) LIBCDSB_nt__ LIBCDSB_nn1__; +extern int libcdsb_list_foreach(vtype_list* x, void* data, list_access_callback, _Bool flush) LIBCDSB_nt__ LIBCDSB_nn13__; #endif /* LIBCDSB_EXTRA_LIST_H */ diff --git a/include/list.h b/include/list.h index eda1488..2b811f8 100644 --- a/include/list.h +++ b/include/list.h @@ -9,19 +9,20 @@ /*#####################################################################################################################*/ +typedef int (*list_access_callback)(void* value, ssize_t index, vtype type, void* data); + extern void list_init(vtype_list* x); extern void list_extend(vtype_list* x, const vtype_list* s); extern void list_sort(vtype_list* x); extern void list_reverse(vtype_list* x); -#define list_pop(x, s, value) _LIBCDSB_Generic(libcdsb_list, find, value)(x, s, value, 0, 1) -#define list_find(x, s, value) _LIBCDSB_Generic(libcdsb_list, find, value)(x, s, value, 0, 0) -#define list_rfind(x, s, value) _LIBCDSB_Generic(libcdsb_list, find, value)(x, s, value, 1, 0) -#define list_countof(s, value) _LIBCDSB_Generic(libcdsb_list, count, value)(s, value) -#define list_indexof(s, value) list_find(0, s, value) -#define list_remove(s, value) list_pop(0, s, value) -#define in_list(s, value) (list_indexof(s, value) >= 0) +#define list_pop(x, value, data, callback) _LIBCDSB_Generic(libcdsb_list, find, value)(x, value, data, callback, 0, 1) +#define list_find(x, value, data, callback) _LIBCDSB_Generic(libcdsb_list, find, value)(x, value, data, callback, 0, 0) +#define list_rfind(x, value, data, callback) _LIBCDSB_Generic(libcdsb_list, find, value)(x, value, data, callback, 1, 0) +#define list_countof(x, value) _LIBCDSB_Generic(libcdsb_list, count, value)(x, value) +#define list_remove(x, value) list_pop(x, value, 0, 0) +#define in_list(x, value) (list_find(x, value, 0, 0) == 0) #define list_insert(x, index, value) _LIBCDSB_Generic(libcdsb_list, update, value)(x, index, value, -1) #define list_replace(x, index, value) _LIBCDSB_Generic(libcdsb_list, update, value)(x, index, value, 0) @@ -30,25 +31,25 @@ extern void list_reverse(vtype_list* x); /*#####################################################################################################################*/ -extern ssize_t libcdsb_list_find_pointer(vtype_value* x, vtype_list* s, const void* value, _Bool reverse, _Bool cut); -extern ssize_t libcdsb_list_find_cstring(vtype_value* x, vtype_list* s, const char* value, _Bool reverse, _Bool cut); -extern ssize_t libcdsb_list_find_string (vtype_value* x, vtype_list* s, const vtype_string* value, _Bool reverse, _Bool cut); -extern ssize_t libcdsb_list_find_array (vtype_value* x, vtype_list* s, const vtype_array* value, _Bool reverse, _Bool cut); -extern ssize_t libcdsb_list_find_list (vtype_value* x, vtype_list* s, const vtype_list* value, _Bool reverse, _Bool cut); -extern ssize_t libcdsb_list_find_map (vtype_value* x, vtype_list* s, const vtype_map* value, _Bool reverse, _Bool cut); -extern ssize_t libcdsb_list_find_vset (vtype_value* x, vtype_list* s, const vtype_set* value, _Bool reverse, _Bool cut); -extern ssize_t libcdsb_list_find_boolean(vtype_value* x, vtype_list* s, vtype_bool value, _Bool reverse, _Bool cut); -extern ssize_t libcdsb_list_find_int8 (vtype_value* x, vtype_list* s, vtype_int8 value, _Bool reverse, _Bool cut); -extern ssize_t libcdsb_list_find_int16 (vtype_value* x, vtype_list* s, vtype_int16 value, _Bool reverse, _Bool cut); -extern ssize_t libcdsb_list_find_int32 (vtype_value* x, vtype_list* s, vtype_int32 value, _Bool reverse, _Bool cut); -extern ssize_t libcdsb_list_find_int64 (vtype_value* x, vtype_list* s, vtype_int64 value, _Bool reverse, _Bool cut); -extern ssize_t libcdsb_list_find_uint8 (vtype_value* x, vtype_list* s, vtype_uint8 value, _Bool reverse, _Bool cut); -extern ssize_t libcdsb_list_find_uint16 (vtype_value* x, vtype_list* s, vtype_uint16 value, _Bool reverse, _Bool cut); -extern ssize_t libcdsb_list_find_uint32 (vtype_value* x, vtype_list* s, vtype_uint32 value, _Bool reverse, _Bool cut); -extern ssize_t libcdsb_list_find_uint64 (vtype_value* x, vtype_list* s, vtype_uint64 value, _Bool reverse, _Bool cut); -extern ssize_t libcdsb_list_find_float (vtype_value* x, vtype_list* s, vtype_float value, _Bool reverse, _Bool cut); -extern ssize_t libcdsb_list_find_double (vtype_value* x, vtype_list* s, vtype_double value, _Bool reverse, _Bool cut); -extern ssize_t libcdsb_list_find_ldouble(vtype_value* x, vtype_list* s, vtype_ldouble value, _Bool reverse, _Bool cut); +extern int libcdsb_list_find_pointer(vtype_list* x, const void* value, void* data, list_access_callback, _Bool reverse, _Bool cut); +extern int libcdsb_list_find_cstring(vtype_list* x, const char* value, void* data, list_access_callback, _Bool reverse, _Bool cut); +extern int libcdsb_list_find_string (vtype_list* x, const vtype_string* value, void* data, list_access_callback, _Bool reverse, _Bool cut); +extern int libcdsb_list_find_array (vtype_list* x, const vtype_array* value, void* data, list_access_callback, _Bool reverse, _Bool cut); +extern int libcdsb_list_find_list (vtype_list* x, const vtype_list* value, void* data, list_access_callback, _Bool reverse, _Bool cut); +extern int libcdsb_list_find_map (vtype_list* x, const vtype_map* value, void* data, list_access_callback, _Bool reverse, _Bool cut); +extern int libcdsb_list_find_vset (vtype_list* x, const vtype_set* value, void* data, list_access_callback, _Bool reverse, _Bool cut); +extern int libcdsb_list_find_boolean(vtype_list* x, vtype_bool value, void* data, list_access_callback, _Bool reverse, _Bool cut); +extern int libcdsb_list_find_int8 (vtype_list* x, vtype_int8 value, void* data, list_access_callback, _Bool reverse, _Bool cut); +extern int libcdsb_list_find_int16 (vtype_list* x, vtype_int16 value, void* data, list_access_callback, _Bool reverse, _Bool cut); +extern int libcdsb_list_find_int32 (vtype_list* x, vtype_int32 value, void* data, list_access_callback, _Bool reverse, _Bool cut); +extern int libcdsb_list_find_int64 (vtype_list* x, vtype_int64 value, void* data, list_access_callback, _Bool reverse, _Bool cut); +extern int libcdsb_list_find_uint8 (vtype_list* x, vtype_uint8 value, void* data, list_access_callback, _Bool reverse, _Bool cut); +extern int libcdsb_list_find_uint16 (vtype_list* x, vtype_uint16 value, void* data, list_access_callback, _Bool reverse, _Bool cut); +extern int libcdsb_list_find_uint32 (vtype_list* x, vtype_uint32 value, void* data, list_access_callback, _Bool reverse, _Bool cut); +extern int libcdsb_list_find_uint64 (vtype_list* x, vtype_uint64 value, void* data, list_access_callback, _Bool reverse, _Bool cut); +extern int libcdsb_list_find_float (vtype_list* x, vtype_float value, void* data, list_access_callback, _Bool reverse, _Bool cut); +extern int libcdsb_list_find_double (vtype_list* x, vtype_double value, void* data, list_access_callback, _Bool reverse, _Bool cut); +extern int libcdsb_list_find_ldouble(vtype_list* x, vtype_ldouble value, void* data, list_access_callback, _Bool reverse, _Bool cut); extern size_t libcdsb_list_count_pointer(const vtype_list* s, const void* value); extern size_t libcdsb_list_count_cstring(const vtype_list* s, const char* value); diff --git a/src/list/extra.c b/src/list/extra.c index b51ee54..0880996 100644 --- a/src/list/extra.c +++ b/src/list/extra.c @@ -3,12 +3,9 @@ #include "include.h" -/*#####################################################################################################################*/ +static void lnode_cut(list_t* s, lnode_t* cur) { -static void lnode_cut(val_t* x, list_t* s, lnode_t* cur) { - if (!is_null(x)) { - value_set(x, cur->node, cur->type, VF_WRITEABLE|VF_REMOVABLE); - } else vnode_free(&cur->node, cur->type); + vnode_free(&cur->node, cur->type); if (!is_null(cur->prev)) { cur->prev->next = cur->next; @@ -21,93 +18,6 @@ static void lnode_cut(val_t* x, list_t* s, lnode_t* cur) { free(cur); } -/*#####################################################################################################################*/ - -ssize_t libcdsb_list_get(val_t* x, list_t* s, ssize_t i, _Bool cut) { - - ldir_t dir; - lnode_t* c; - size_t n; - - if (i < 0) { - n = (i = ~i); - dir = LD_PREV; - } else { - n = i; - dir = LD_NEXT; - } - - c = ldir_dir((lnode_t*)s, dir); - - if (!is_null(x)) memset(x, 0, sizeof(*x)); - - while (n && !is_null(c)) { - c = ldir_dir(c, dir); - --n; - } - - if (n || is_null(c)) return -1; - - if (!cut && !is_null(x)) { - value_set(x, &c->node, c->type, VF_WRITEABLE|VF_CHANGEABLE); - } else if (cut) lnode_cut(x, s, c); - - return i; -} - - -/*#####################################################################################################################*/ - -ssize_t libcdsb_list_find(val_t* x, list_t* s, const void* v, vtype t, _Bool r, _Bool cut) { - ldir_t dir = r ? LD_PREV : LD_NEXT; - - lnode_t* c; - ssize_t i; - int cmp; - - c = ldir_dir((lnode_t*)s, dir); - i = 0; - - if (!is_null(x)) memset(x, 0, sizeof(*x)); - - while (!is_null(c)) { - cmp = vtype_compare(vnode_peek(&c->node, c->type), c->type, v, t); - - if (cmp == 0) { - if (!cut && !is_null(x)) { - value_set(x, &c->node, c->type, VF_WRITEABLE|VF_CHANGEABLE); - } else if (cut) lnode_cut(x, s, c); - - return i; - } - - c = ldir_dir(c, dir); - ++i; - } - - return -1; -} - - -size_t libcdsb_list_count(const list_t* s, const void* v, vtype t) { - - lnode_t* c; - size_t n; - int cmp; - - c = s->first; - n = 0; - - while (!is_null(c)) { - cmp = vtype_compare(vnode_peek(&c->node, c->type), c->type, v, t); - - if (cmp == 0) ++n; - - c = c->next; - } - - return n; -} /*#####################################################################################################################*/ @@ -160,10 +70,88 @@ _Bool libcdsb_list_update(list_t* x, ssize_t i, const void* v, vtype t, int ins) } -/*#####################################################################################################################*/ +size_t libcdsb_list_count(const list_t* s, const void* v, vtype t) { + + lnode_t* c; + size_t n; + int cmp; + + c = s->first; + n = 0; + + while (!is_null(c)) { + cmp = vtype_compare(vnode_peek(&c->node, c->type), c->type, v, t); + + if (cmp == 0) ++n; + + c = c->next; + } + + return n; +} -int libcdsb_list_foreach(vtype_list* x, void* data, list_foreach_callback callback, _Bool flush) { +int libcdsb_list_get(vtype_list* x, ssize_t i, void* _, list_access_callback callback, _Bool cut) { + + ldir_t dir; + lnode_t* c; + size_t n; + + if (i < 0) { + n = ~i; + dir = LD_PREV; + } else { + n = i; + dir = LD_NEXT; + } + + c = ldir_dir((lnode_t*)x, dir); + + while (n && !is_null(c)) { + c = ldir_dir(c, dir); + --n; + } + + if (n || is_null(c)) return -1; + + i = (callback) ? callback(vnode_peek(&c->node, c->type), i, c->type, _) : 0; + + if (cut) lnode_cut(x, c); + + return i; +} + + +int libcdsb_list_find(vtype_list* x, const void* v, vtype t, void* _, list_access_callback callback, _Bool r, _Bool cut) { + ldir_t dir; + lnode_t* c; + ssize_t i; + int cmp; + + dir = r ? LD_PREV : LD_NEXT; + c = ldir_dir((lnode_t*)x, dir); + i = 0; + + while (!is_null(c)) { + cmp = vtype_compare(vnode_peek(&c->node, c->type), c->type, v, t); + + if (cmp == 0) { + i = (callback) ? callback(vnode_peek(&c->node, c->type), (r)?~i:i, c->type, _) : 0; + + if (cut) lnode_cut(x, c); + + return i; + } + + c = ldir_dir(c, dir); + ++i; + } + + return -1; +} + + +int libcdsb_list_foreach(vtype_list* x, void* data, list_access_callback callback, _Bool flush) { lnode_t* n; lnode_t* c; @@ -178,7 +166,7 @@ int libcdsb_list_foreach(vtype_list* x, void* data, list_foreach_callback callba break; n = c->next; - + if (flush) { vnode_free(&c->node, c->type); free(c); diff --git a/src/list/generics.c b/src/list/generics.c index f86b4a7..5a95a71 100644 --- a/src/list/generics.c +++ b/src/list/generics.c @@ -3,25 +3,25 @@ #include "include.h" -ssize_t libcdsb_list_find_pointer(val_t* x, list_t* s, const void* v, _Bool r, _Bool cut) { return libcdsb_list_find(x, s, &v, vtypeof(&v), r, cut); } -ssize_t libcdsb_list_find_cstring(val_t* x, list_t* s, const char* v, _Bool r, _Bool cut) { return libcdsb_list_find(x, s, &v, vtypeof(&v), r, cut); } -ssize_t libcdsb_list_find_string (val_t* x, list_t* s, const str_t* v, _Bool r, _Bool cut) { return libcdsb_list_find(x, s, v, vtypeof( v), r, cut); } -ssize_t libcdsb_list_find_array (val_t* x, list_t* s, const arr_t* v, _Bool r, _Bool cut) { return libcdsb_list_find(x, s, v, vtypeof( v), r, cut); } -ssize_t libcdsb_list_find_list (val_t* x, list_t* s, const list_t* v, _Bool r, _Bool cut) { return libcdsb_list_find(x, s, v, vtypeof( v), r, cut); } -ssize_t libcdsb_list_find_map (val_t* x, list_t* s, const map_t* v, _Bool r, _Bool cut) { return libcdsb_list_find(x, s, v, vtypeof( v), r, cut); } -ssize_t libcdsb_list_find_vset (val_t* x, list_t* s, const set_t* v, _Bool r, _Bool cut) { return libcdsb_list_find(x, s, v, vtypeof( v), r, cut); } -ssize_t libcdsb_list_find_boolean(val_t* x, list_t* s, _Bool v, _Bool r, _Bool cut) { return libcdsb_list_find(x, s, &v, vtypeof(&v), r, cut); } -ssize_t libcdsb_list_find_int8 (val_t* x, list_t* s, s8_t v, _Bool r, _Bool cut) { return libcdsb_list_find(x, s, &v, vtypeof(&v), r, cut); } -ssize_t libcdsb_list_find_int16 (val_t* x, list_t* s, s16_t v, _Bool r, _Bool cut) { return libcdsb_list_find(x, s, &v, vtypeof(&v), r, cut); } -ssize_t libcdsb_list_find_int32 (val_t* x, list_t* s, s32_t v, _Bool r, _Bool cut) { return libcdsb_list_find(x, s, &v, vtypeof(&v), r, cut); } -ssize_t libcdsb_list_find_int64 (val_t* x, list_t* s, s64_t v, _Bool r, _Bool cut) { return libcdsb_list_find(x, s, &v, vtypeof(&v), r, cut); } -ssize_t libcdsb_list_find_uint8 (val_t* x, list_t* s, u8_t v, _Bool r, _Bool cut) { return libcdsb_list_find(x, s, &v, vtypeof(&v), r, cut); } -ssize_t libcdsb_list_find_uint16 (val_t* x, list_t* s, u16_t v, _Bool r, _Bool cut) { return libcdsb_list_find(x, s, &v, vtypeof(&v), r, cut); } -ssize_t libcdsb_list_find_uint32 (val_t* x, list_t* s, u32_t v, _Bool r, _Bool cut) { return libcdsb_list_find(x, s, &v, vtypeof(&v), r, cut); } -ssize_t libcdsb_list_find_uint64 (val_t* x, list_t* s, u64_t v, _Bool r, _Bool cut) { return libcdsb_list_find(x, s, &v, vtypeof(&v), r, cut); } -ssize_t libcdsb_list_find_float (val_t* x, list_t* s, fl_t v, _Bool r, _Bool cut) { return libcdsb_list_find(x, s, &v, vtypeof(&v), r, cut); } -ssize_t libcdsb_list_find_double (val_t* x, list_t* s, dbl_t v, _Bool r, _Bool cut) { return libcdsb_list_find(x, s, &v, vtypeof(&v), r, cut); } -ssize_t libcdsb_list_find_ldouble(val_t* x, list_t* s, ldbl_t v, _Bool r, _Bool cut) { return libcdsb_list_find(x, s, &v, vtypeof(&v), r, cut); } +int libcdsb_list_find_pointer(list_t* x, const void* v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } +int libcdsb_list_find_cstring(list_t* x, const char* v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } +int libcdsb_list_find_string (list_t* x, const str_t* v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, v, vtypeof( v), _, cb, r, cut); } +int libcdsb_list_find_array (list_t* x, const arr_t* v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, v, vtypeof( v), _, cb, r, cut); } +int libcdsb_list_find_list (list_t* x, const list_t* v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, v, vtypeof( v), _, cb, r, cut); } +int libcdsb_list_find_map (list_t* x, const map_t* v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, v, vtypeof( v), _, cb, r, cut); } +int libcdsb_list_find_vset (list_t* x, const set_t* v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, v, vtypeof( v), _, cb, r, cut); } +int libcdsb_list_find_boolean(list_t* x, _Bool v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } +int libcdsb_list_find_int8 (list_t* x, s8_t v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } +int libcdsb_list_find_int16 (list_t* x, s16_t v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } +int libcdsb_list_find_int32 (list_t* x, s32_t v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } +int libcdsb_list_find_int64 (list_t* x, s64_t v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } +int libcdsb_list_find_uint8 (list_t* x, u8_t v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } +int libcdsb_list_find_uint16 (list_t* x, u16_t v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } +int libcdsb_list_find_uint32 (list_t* x, u32_t v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } +int libcdsb_list_find_uint64 (list_t* x, u64_t v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } +int libcdsb_list_find_float (list_t* x, fl_t v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } +int libcdsb_list_find_double (list_t* x, dbl_t v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } +int libcdsb_list_find_ldouble(list_t* x, ldbl_t v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } size_t libcdsb_list_count_pointer(const list_t* s, const void* v) { return libcdsb_list_count((void*)s, &v, vtypeof(&v)); } size_t libcdsb_list_count_cstring(const list_t* s, const char* v) { return libcdsb_list_count((void*)s, &v, vtypeof(&v)); } From 4b3204c00f8e1e2231cea82d4f44a9544a052567 Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Wed, 8 Jun 2022 20:59:46 +0300 Subject: [PATCH 03/27] Set access standardization --- include/extra/set.h | 9 +++---- include/set.h | 40 ++++++++++++++++--------------- src/set/extra.c | 58 ++++++++++++++++++++++----------------------- src/set/generics.c | 38 ++++++++++++++--------------- 4 files changed, 72 insertions(+), 73 deletions(-) diff --git a/include/extra/set.h b/include/extra/set.h index 8849e09..7c2adc0 100644 --- a/include/extra/set.h +++ b/include/extra/set.h @@ -6,14 +6,11 @@ #ifndef LIBCDSB_EXTRA_SET_H #define LIBCDSB_EXTRA_SET_H -typedef int (*vset_foreach_callback)(const void* value, vtype type, void* data); - - #define vset_foreach(x, data, callback) libcdsb_vset_foreach(x, data, callback, 0) -extern _Bool libcdsb_vset_find (vtype_value* x, vtype_set* s, const void* value, vtype type, _Bool cut) LIBCDSB_nt__ LIBCDSB_nn23__; -extern _Bool libcdsb_vset_insert(vtype_set* x, const void* value, vtype type) LIBCDSB_nt__ LIBCDSB_nn12__; +extern _Bool libcdsb_vset_insert(vtype_set* x, const void* value, vtype type) LIBCDSB_nt__ LIBCDSB_nn12__; -extern int libcdsb_vset_foreach(vtype_set* x, void* data, vset_foreach_callback, _Bool flush) LIBCDSB_nt__ LIBCDSB_nn13__; +extern int libcdsb_vset_find (vtype_set* x, const void* value, vtype type, void* data, vset_access_callback, _Bool cut) LIBCDSB_nt__ LIBCDSB_nn1__; +extern int libcdsb_vset_foreach(vtype_set* x, void* data, vset_access_callback, _Bool flush) LIBCDSB_nt__ LIBCDSB_nn13__; #endif /* LIBCDSB_EXTRA_SET_H */ diff --git a/include/set.h b/include/set.h index 11e265b..bf642d7 100644 --- a/include/set.h +++ b/include/set.h @@ -7,6 +7,8 @@ #ifndef LIBCDSB_SET_H #define LIBCDSB_SET_H +typedef int (*vset_access_callback)(const void* value, vtype type, void* data); + extern void vset_init(vtype_set* x, vtype type); #define vset_remove(x, value) _LIBCDSB_Generic (libcdsb_vset, touch, value)(x, value, 1) @@ -34,24 +36,24 @@ extern _Bool libcdsb_vset_push_float (vtype_set* x, vtype_float value) extern _Bool libcdsb_vset_push_double (vtype_set* x, vtype_double value); extern _Bool libcdsb_vset_push_ldouble(vtype_set* x, vtype_ldouble value); -extern _Bool libcdsb_vset_touch_pointer(vtype_set* x, const void* value, _Bool cut); -extern _Bool libcdsb_vset_touch_cstring(vtype_set* x, const char* value, _Bool cut); -extern _Bool libcdsb_vset_touch_string (vtype_set* x, const vtype_string* value, _Bool cut); -extern _Bool libcdsb_vset_touch_array (vtype_set* x, const vtype_array* value, _Bool cut); -extern _Bool libcdsb_vset_touch_list (vtype_set* x, const vtype_list* value, _Bool cut); -extern _Bool libcdsb_vset_touch_map (vtype_set* x, const vtype_map* value, _Bool cut); -extern _Bool libcdsb_vset_touch_vset (vtype_set* x, const vtype_set* value, _Bool cut); -extern _Bool libcdsb_vset_touch_boolean(vtype_set* x, vtype_bool value, _Bool cut); -extern _Bool libcdsb_vset_touch_uint8 (vtype_set* x, vtype_uint8 value, _Bool cut); -extern _Bool libcdsb_vset_touch_uint16 (vtype_set* x, vtype_uint16 value, _Bool cut); -extern _Bool libcdsb_vset_touch_uint32 (vtype_set* x, vtype_uint32 value, _Bool cut); -extern _Bool libcdsb_vset_touch_uint64 (vtype_set* x, vtype_uint64 value, _Bool cut); -extern _Bool libcdsb_vset_touch_int8 (vtype_set* x, vtype_int8 value, _Bool cut); -extern _Bool libcdsb_vset_touch_int16 (vtype_set* x, vtype_int16 value, _Bool cut); -extern _Bool libcdsb_vset_touch_int32 (vtype_set* x, vtype_int32 value, _Bool cut); -extern _Bool libcdsb_vset_touch_int64 (vtype_set* x, vtype_int64 value, _Bool cut); -extern _Bool libcdsb_vset_touch_float (vtype_set* x, vtype_float value, _Bool cut); -extern _Bool libcdsb_vset_touch_double (vtype_set* x, vtype_double value, _Bool cut); -extern _Bool libcdsb_vset_touch_ldouble(vtype_set* x, vtype_ldouble value, _Bool cut); +extern int libcdsb_vset_find_pointer(vtype_set* x, const void* value, void* data, vset_access_callback, _Bool cut); +extern int libcdsb_vset_find_cstring(vtype_set* x, const char* value, void* data, vset_access_callback, _Bool cut); +extern int libcdsb_vset_find_string (vtype_set* x, const vtype_string* value, void* data, vset_access_callback, _Bool cut); +extern int libcdsb_vset_find_array (vtype_set* x, const vtype_array* value, void* data, vset_access_callback, _Bool cut); +extern int libcdsb_vset_find_list (vtype_set* x, const vtype_list* value, void* data, vset_access_callback, _Bool cut); +extern int libcdsb_vset_find_map (vtype_set* x, const vtype_map* value, void* data, vset_access_callback, _Bool cut); +extern int libcdsb_vset_find_vset (vtype_set* x, const vtype_set* value, void* data, vset_access_callback, _Bool cut); +extern int libcdsb_vset_find_boolean(vtype_set* x, vtype_bool value, void* data, vset_access_callback, _Bool cut); +extern int libcdsb_vset_find_uint8 (vtype_set* x, vtype_uint8 value, void* data, vset_access_callback, _Bool cut); +extern int libcdsb_vset_find_uint16 (vtype_set* x, vtype_uint16 value, void* data, vset_access_callback, _Bool cut); +extern int libcdsb_vset_find_uint32 (vtype_set* x, vtype_uint32 value, void* data, vset_access_callback, _Bool cut); +extern int libcdsb_vset_find_uint64 (vtype_set* x, vtype_uint64 value, void* data, vset_access_callback, _Bool cut); +extern int libcdsb_vset_find_int8 (vtype_set* x, vtype_int8 value, void* data, vset_access_callback, _Bool cut); +extern int libcdsb_vset_find_int16 (vtype_set* x, vtype_int16 value, void* data, vset_access_callback, _Bool cut); +extern int libcdsb_vset_find_int32 (vtype_set* x, vtype_int32 value, void* data, vset_access_callback, _Bool cut); +extern int libcdsb_vset_find_int64 (vtype_set* x, vtype_int64 value, void* data, vset_access_callback, _Bool cut); +extern int libcdsb_vset_find_float (vtype_set* x, vtype_float value, void* data, vset_access_callback, _Bool cut); +extern int libcdsb_vset_find_double (vtype_set* x, vtype_double value, void* data, vset_access_callback, _Bool cut); +extern int libcdsb_vset_find_ldouble(vtype_set* x, vtype_ldouble value, void* data, vset_access_callback, _Bool cut); #endif /* LIBCDSB_SET_H */ diff --git a/src/set/extra.c b/src/set/extra.c index 8d899bb..81334da 100644 --- a/src/set/extra.c +++ b/src/set/extra.c @@ -4,34 +4,6 @@ #include "../../include/extra/set.h" #include "../__internal/rbtree.h" -_Bool libcdsb_vset_find(val_t* x, set_t* s, const void* v, vtype t, _Bool cut) { - rbnode_t* c; - int cmp; - - c = s->root; - - while (!rbnode_is_empty(c)) { - - cmp = vtype_compare(vnode_peek(&c->value, s->type), s->type, v, t); - - if (cmp == 0) { - if (cut) { - c = rbnode_delete(&s->root, c); - if (!is_null(x)) { - value_set(x, c->value, s->type, VF_WRITEABLE|VF_REMOVABLE); - } else vnode_free(&c->value, s->type); - free(c); - } else if (!is_null(x)) value_set(x, c->value, s->type, VF_UNDEFINED); - - return true; - } - - c = (cmp < 0) ? c->right : c->left; - } - return false; -} - - _Bool libcdsb_vset_insert(set_t* x, const void* v, vtype t) { int cmp; rbnode_t* n; @@ -70,7 +42,35 @@ _Bool libcdsb_vset_insert(set_t* x, const void* v, vtype t) { } -int libcdsb_vset_foreach(set_t* x, void* data, vset_foreach_callback callback, _Bool flush) { +int libcdsb_vset_find(vtype_set* x, const void* v, vtype t, void* _, vset_access_callback callback, _Bool cut) { + rbnode_t* c; + void *val; + int cmp; + + c = x->root; + + while (!rbnode_is_empty(c)) { + val = vnode_peek(&c->value, x->type); + cmp = vtype_compare(val, x->type, v, t); + + if (cmp == 0) { + cmp = (callback) ? callback(val, x->type, _) : 0; + + if (cut) { + c = rbnode_delete(&x->root, c); + vnode_free(&c->value, x->type); + free(c); + } + + return cmp; + } + } + + return -1; +} + + +int libcdsb_vset_foreach(set_t* x, void* data, vset_access_callback callback, _Bool flush) { stack_t z = { .prev = 0, .value = x->root }; int r = 0; rbnode_t* c; diff --git a/src/set/generics.c b/src/set/generics.c index 946ea80..0711775 100644 --- a/src/set/generics.c +++ b/src/set/generics.c @@ -4,25 +4,25 @@ #include "../../include/extra/set.h" #include "../__internal/include.h" -_Bool libcdsb_vset_touch_pointer(set_t* x, const void* k, _Bool f) { return libcdsb_vset_find(0, x, &k, vtypeof(&k), f); } -_Bool libcdsb_vset_touch_cstring(set_t* x, const char* k, _Bool f) { return libcdsb_vset_find(0, x, &k, vtypeof(&k), f); } -_Bool libcdsb_vset_touch_string (set_t* x, const str_t* k, _Bool f) { return libcdsb_vset_find(0, x, k, vtypeof( k), f); } -_Bool libcdsb_vset_touch_array (set_t* x, const arr_t* k, _Bool f) { return libcdsb_vset_find(0, x, k, vtypeof( k), f); } -_Bool libcdsb_vset_touch_list (set_t* x, const list_t* k, _Bool f) { return libcdsb_vset_find(0, x, k, vtypeof( k), f); } -_Bool libcdsb_vset_touch_map (set_t* x, const map_t* k, _Bool f) { return libcdsb_vset_find(0, x, k, vtypeof( k), f); } -_Bool libcdsb_vset_touch_vset (set_t* x, const set_t* k, _Bool f) { return libcdsb_vset_find(0, x, k, vtypeof( k), f); } -_Bool libcdsb_vset_touch_boolean(set_t* x, _Bool k, _Bool f) { return libcdsb_vset_find(0, x, &k, vtypeof(&k), f); } -_Bool libcdsb_vset_touch_int8 (set_t* x, s8_t k, _Bool f) { return libcdsb_vset_find(0, x, &k, vtypeof(&k), f); } -_Bool libcdsb_vset_touch_int16 (set_t* x, s16_t k, _Bool f) { return libcdsb_vset_find(0, x, &k, vtypeof(&k), f); } -_Bool libcdsb_vset_touch_int32 (set_t* x, s32_t k, _Bool f) { return libcdsb_vset_find(0, x, &k, vtypeof(&k), f); } -_Bool libcdsb_vset_touch_int64 (set_t* x, s64_t k, _Bool f) { return libcdsb_vset_find(0, x, &k, vtypeof(&k), f); } -_Bool libcdsb_vset_touch_uint8 (set_t* x, u8_t k, _Bool f) { return libcdsb_vset_find(0, x, &k, vtypeof(&k), f); } -_Bool libcdsb_vset_touch_uint16 (set_t* x, u16_t k, _Bool f) { return libcdsb_vset_find(0, x, &k, vtypeof(&k), f); } -_Bool libcdsb_vset_touch_uint32 (set_t* x, u32_t k, _Bool f) { return libcdsb_vset_find(0, x, &k, vtypeof(&k), f); } -_Bool libcdsb_vset_touch_uint64 (set_t* x, u64_t k, _Bool f) { return libcdsb_vset_find(0, x, &k, vtypeof(&k), f); } -_Bool libcdsb_vset_touch_float (set_t* x, fl_t k, _Bool f) { return libcdsb_vset_find(0, x, &k, vtypeof(&k), f); } -_Bool libcdsb_vset_touch_double (set_t* x, dbl_t k, _Bool f) { return libcdsb_vset_find(0, x, &k, vtypeof(&k), f); } -_Bool libcdsb_vset_touch_ldouble(set_t* x, ldbl_t k, _Bool f) { return libcdsb_vset_find(0, x, &k, vtypeof(&k), f); } +int libcdsb_vset_find_pointer(set_t* x, const void* v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } +int libcdsb_vset_find_cstring(set_t* x, const char* v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } +int libcdsb_vset_find_string (set_t* x, const str_t* v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, v, vtypeof( v), _, cb, cut); } +int libcdsb_vset_find_array (set_t* x, const arr_t* v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, v, vtypeof( v), _, cb, cut); } +int libcdsb_vset_find_list (set_t* x, const list_t* v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, v, vtypeof( v), _, cb, cut); } +int libcdsb_vset_find_map (set_t* x, const map_t* v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, v, vtypeof( v), _, cb, cut); } +int libcdsb_vset_find_vset (set_t* x, const set_t* v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, v, vtypeof( v), _, cb, cut); } +int libcdsb_vset_find_boolean(set_t* x, _Bool v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } +int libcdsb_vset_find_int8 (set_t* x, s8_t v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } +int libcdsb_vset_find_int16 (set_t* x, s16_t v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } +int libcdsb_vset_find_int32 (set_t* x, s32_t v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } +int libcdsb_vset_find_int64 (set_t* x, s64_t v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } +int libcdsb_vset_find_uint8 (set_t* x, u8_t v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } +int libcdsb_vset_find_uint16 (set_t* x, u16_t v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } +int libcdsb_vset_find_uint32 (set_t* x, u32_t v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } +int libcdsb_vset_find_uint64 (set_t* x, u64_t v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } +int libcdsb_vset_find_float (set_t* x, fl_t v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } +int libcdsb_vset_find_double (set_t* x, dbl_t v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } +int libcdsb_vset_find_ldouble(set_t* x, ldbl_t v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } _Bool libcdsb_vset_push_pointer(set_t* x, const void* v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); } _Bool libcdsb_vset_push_cstring(set_t* x, const char* v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); } From d592c0adacf11b575bf8639e2e186d9bee0f2a9b Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Wed, 8 Jun 2022 21:00:33 +0300 Subject: [PATCH 04/27] Map access standardization --- include/extra/map.h | 7 ++--- include/map.h | 40 +++++++++++++++-------------- src/map/extra.c | 62 ++++++++++++++++++++++----------------------- src/map/generics.c | 38 +++++++++++++-------------- 4 files changed, 73 insertions(+), 74 deletions(-) diff --git a/include/extra/map.h b/include/extra/map.h index 88514d3..458d75e 100644 --- a/include/extra/map.h +++ b/include/extra/map.h @@ -6,15 +6,12 @@ #ifndef LIBCDSB_EXTRA_MAP_H #define LIBCDSB_EXTRA_MAP_H -typedef int (*map_foreach_callback)(const void* key, vtype key_type, void* value, vtype value_type, void* data); - - #define map_foreach(x, data, callback) libcdsb_map_foreach(x, data, callback, 0) -extern _Bool libcdsb_map_find (vtype_value* x, vtype_map* s, const void* key, vtype key_type, _Bool cut) LIBCDSB_nt__ LIBCDSB_nn23__; extern _Bool libcdsb_map_update(vtype_map* x, const void* k, vtype kt, const void* v, vtype vt) LIBCDSB_nt__ LIBCDSB_nn124__; -extern int libcdsb_map_foreach(vtype_map* x, void* data, map_foreach_callback, _Bool flush) LIBCDSB_nt__ LIBCDSB_nn13__; +extern int libcdsb_map_find (vtype_map* x, const void* key, vtype key_type, void* data, map_access_callback, _Bool cut) LIBCDSB_nt__ LIBCDSB_nn1__; +extern int libcdsb_map_foreach(vtype_map* x, void* data, map_access_callback, _Bool flush) LIBCDSB_nt__ LIBCDSB_nn13__; #endif /* LIBCDSB_EXTRA_MAP_H */ diff --git a/include/map.h b/include/map.h index c86e441..8e204a3 100644 --- a/include/map.h +++ b/include/map.h @@ -7,6 +7,8 @@ #ifndef LIBCDSB_MAP_H #define LIBCDSB_MAP_H +typedef int (*map_access_callback)(const void* key, vtype key_type, void* value, vtype value_type, void* data); + extern void map_init(vtype_map* x, vtype key_type); #define map_pop(x, s, key) _LIBCDSB_Generic (libcdsb_map, find, key)(x, s, key, 1) @@ -14,25 +16,25 @@ extern void map_init(vtype_map* x, vtype key_type); #define map_update(x, key, value) _LIBCDSB_Generic2(libcdsb_map, update, key, value)(x, key, value) #define map_remove(x, key) map_pop(0, x, key) -extern _Bool libcdsb_map_find_pointer(vtype_value* x, vtype_map* s, const void* key, _Bool cut); -extern _Bool libcdsb_map_find_cstring(vtype_value* x, vtype_map* s, const char* key, _Bool cut); -extern _Bool libcdsb_map_find_string (vtype_value* x, vtype_map* s, const vtype_string* key, _Bool cut); -extern _Bool libcdsb_map_find_array (vtype_value* x, vtype_map* s, const vtype_array* key, _Bool cut); -extern _Bool libcdsb_map_find_list (vtype_value* x, vtype_map* s, const vtype_list* key, _Bool cut); -extern _Bool libcdsb_map_find_map (vtype_value* x, vtype_map* s, const vtype_map* key, _Bool cut); -extern _Bool libcdsb_map_find_vset (vtype_value* x, vtype_map* s, const vtype_set* key, _Bool cut); -extern _Bool libcdsb_map_find_boolean(vtype_value* x, vtype_map* s, vtype_bool key, _Bool cut); -extern _Bool libcdsb_map_find_int8 (vtype_value* x, vtype_map* s, vtype_int8 key, _Bool cut); -extern _Bool libcdsb_map_find_int16 (vtype_value* x, vtype_map* s, vtype_int16 key, _Bool cut); -extern _Bool libcdsb_map_find_int32 (vtype_value* x, vtype_map* s, vtype_int32 key, _Bool cut); -extern _Bool libcdsb_map_find_int64 (vtype_value* x, vtype_map* s, vtype_int64 key, _Bool cut); -extern _Bool libcdsb_map_find_uint8 (vtype_value* x, vtype_map* s, vtype_uint8 key, _Bool cut); -extern _Bool libcdsb_map_find_uint16 (vtype_value* x, vtype_map* s, vtype_uint16 key, _Bool cut); -extern _Bool libcdsb_map_find_uint32 (vtype_value* x, vtype_map* s, vtype_uint32 key, _Bool cut); -extern _Bool libcdsb_map_find_uint64 (vtype_value* x, vtype_map* s, vtype_uint64 key, _Bool cut); -extern _Bool libcdsb_map_find_float (vtype_value* x, vtype_map* s, vtype_float key, _Bool cut); -extern _Bool libcdsb_map_find_double (vtype_value* x, vtype_map* s, vtype_double key, _Bool cut); -extern _Bool libcdsb_map_find_ldouble(vtype_value* x, vtype_map* s, vtype_ldouble key, _Bool cut); +extern int libcdsb_map_find_pointer(vtype_map* x, const void* key, void* data, map_access_callback, _Bool cut); +extern int libcdsb_map_find_cstring(vtype_map* x, const char* key, void* data, map_access_callback, _Bool cut); +extern int libcdsb_map_find_string (vtype_map* x, const vtype_string* key, void* data, map_access_callback, _Bool cut); +extern int libcdsb_map_find_array (vtype_map* x, const vtype_array* key, void* data, map_access_callback, _Bool cut); +extern int libcdsb_map_find_list (vtype_map* x, const vtype_list* key, void* data, map_access_callback, _Bool cut); +extern int libcdsb_map_find_map (vtype_map* x, const vtype_map* key, void* data, map_access_callback, _Bool cut); +extern int libcdsb_map_find_vset (vtype_map* x, const vtype_set* key, void* data, map_access_callback, _Bool cut); +extern int libcdsb_map_find_boolean(vtype_map* x, vtype_bool key, void* data, map_access_callback, _Bool cut); +extern int libcdsb_map_find_int8 (vtype_map* x, vtype_int8 key, void* data, map_access_callback, _Bool cut); +extern int libcdsb_map_find_int16 (vtype_map* x, vtype_int16 key, void* data, map_access_callback, _Bool cut); +extern int libcdsb_map_find_int32 (vtype_map* x, vtype_int32 key, void* data, map_access_callback, _Bool cut); +extern int libcdsb_map_find_int64 (vtype_map* x, vtype_int64 key, void* data, map_access_callback, _Bool cut); +extern int libcdsb_map_find_uint8 (vtype_map* x, vtype_uint8 key, void* data, map_access_callback, _Bool cut); +extern int libcdsb_map_find_uint16 (vtype_map* x, vtype_uint16 key, void* data, map_access_callback, _Bool cut); +extern int libcdsb_map_find_uint32 (vtype_map* x, vtype_uint32 key, void* data, map_access_callback, _Bool cut); +extern int libcdsb_map_find_uint64 (vtype_map* x, vtype_uint64 key, void* data, map_access_callback, _Bool cut); +extern int libcdsb_map_find_float (vtype_map* x, vtype_float key, void* data, map_access_callback, _Bool cut); +extern int libcdsb_map_find_double (vtype_map* x, vtype_double key, void* data, map_access_callback, _Bool cut); +extern int libcdsb_map_find_ldouble(vtype_map* x, vtype_ldouble key, void* data, map_access_callback, _Bool cut); extern _Bool libcdsb_map_update_pointer_pointer(vtype_map* x, const void* key, const void* value); extern _Bool libcdsb_map_update_pointer_cstring(vtype_map* x, const void* key, const char* value); diff --git a/src/map/extra.c b/src/map/extra.c index f395d68..d9cb163 100644 --- a/src/map/extra.c +++ b/src/map/extra.c @@ -3,36 +3,6 @@ #include "include.h" - -_Bool libcdsb_map_find(val_t* x, map_t* s, const void* k, vtype t, _Bool cut) { - mnode_t* c; - int cmp; - - c = s->root; - - while (!mnode_is_empty(c)) { - - cmp = vtype_compare(vnode_peek(&c->key, s->type), s->type, k, t); - - if (cmp == 0) { - if (cut) { - c = mnode_delete(&s->root, c); - if (!is_null(x)) { - value_set(x, c->value, c->type, VF_WRITEABLE|VF_REMOVABLE); - } else vnode_free(&c->value, c->type); - vnode_free(&c->key, s->type); - free(c); - } else if (!is_null(x)) value_set(x, &c->value, c->type, VF_WRITEABLE|VF_CHANGEABLE); - - return true; - } - - c = (cmp < 0) ? c->right : c->left; - } - return false; -} - - _Bool libcdsb_map_update(map_t* x, const void* k, vtype kt, const void* v, vtype vt) { int cmp; mnode_t* n; @@ -80,7 +50,37 @@ _Bool libcdsb_map_update(map_t* x, const void* k, vtype kt, const void* v, vtype } -int libcdsb_map_foreach(map_t* x, void* dt, map_foreach_callback callback, _Bool flush) { +int libcdsb_map_find(map_t* x, const void* k, vtype t, void* _, map_access_callback callback, _Bool cut) { + mnode_t* c; + void *key; + int cmp; + + c = x->root; + + while (!mnode_is_empty(c)) { + key = vnode_peek(&c->key, x->type); + cmp = vtype_compare(key, x->type, k, t); + + if (cmp == 0) { + cmp = (callback) ? callback(key, x->type, vnode_peek(&c->value, c->type), c->type, _) : 0; + + if (cut) { + c = mnode_delete(&x->root, c); + vnode_free(&c->key, x->type); + vnode_free(&c->value, c->type); + free(c); + } + + return cmp; + } + } + + return -1; + +} + + +int libcdsb_map_foreach(map_t* x, void* dt, map_access_callback callback, _Bool flush) { stack_t z = { .prev = 0, .value = x->root }; int r = 0; mnode_t* c; diff --git a/src/map/generics.c b/src/map/generics.c index 69774a4..72a98b2 100644 --- a/src/map/generics.c +++ b/src/map/generics.c @@ -3,25 +3,25 @@ #include "include.h" -_Bool libcdsb_map_find_pointer(val_t* x, map_t* s, const void* k, _Bool cut) { return libcdsb_map_find(x, s, &k, vtypeof(&k), cut); } -_Bool libcdsb_map_find_cstring(val_t* x, map_t* s, const char* k, _Bool cut) { return libcdsb_map_find(x, s, &k, vtypeof(&k), cut); } -_Bool libcdsb_map_find_string (val_t* x, map_t* s, const str_t* k, _Bool cut) { return libcdsb_map_find(x, s, k, vtypeof( k), cut); } -_Bool libcdsb_map_find_array (val_t* x, map_t* s, const arr_t* k, _Bool cut) { return libcdsb_map_find(x, s, k, vtypeof( k), cut); } -_Bool libcdsb_map_find_list (val_t* x, map_t* s, const list_t* k, _Bool cut) { return libcdsb_map_find(x, s, k, vtypeof( k), cut); } -_Bool libcdsb_map_find_map (val_t* x, map_t* s, const map_t* k, _Bool cut) { return libcdsb_map_find(x, s, k, vtypeof( k), cut); } -_Bool libcdsb_map_find_vset (val_t* x, map_t* s, const set_t* k, _Bool cut) { return libcdsb_map_find(x, s, k, vtypeof( k), cut); } -_Bool libcdsb_map_find_boolean(val_t* x, map_t* s, _Bool k, _Bool cut) { return libcdsb_map_find(x, s, &k, vtypeof(&k), cut); } -_Bool libcdsb_map_find_int8 (val_t* x, map_t* s, s8_t k, _Bool cut) { return libcdsb_map_find(x, s, &k, vtypeof(&k), cut); } -_Bool libcdsb_map_find_int16 (val_t* x, map_t* s, s16_t k, _Bool cut) { return libcdsb_map_find(x, s, &k, vtypeof(&k), cut); } -_Bool libcdsb_map_find_int32 (val_t* x, map_t* s, s32_t k, _Bool cut) { return libcdsb_map_find(x, s, &k, vtypeof(&k), cut); } -_Bool libcdsb_map_find_int64 (val_t* x, map_t* s, s64_t k, _Bool cut) { return libcdsb_map_find(x, s, &k, vtypeof(&k), cut); } -_Bool libcdsb_map_find_uint8 (val_t* x, map_t* s, u8_t k, _Bool cut) { return libcdsb_map_find(x, s, &k, vtypeof(&k), cut); } -_Bool libcdsb_map_find_uint16 (val_t* x, map_t* s, u16_t k, _Bool cut) { return libcdsb_map_find(x, s, &k, vtypeof(&k), cut); } -_Bool libcdsb_map_find_uint32 (val_t* x, map_t* s, u32_t k, _Bool cut) { return libcdsb_map_find(x, s, &k, vtypeof(&k), cut); } -_Bool libcdsb_map_find_uint64 (val_t* x, map_t* s, u64_t k, _Bool cut) { return libcdsb_map_find(x, s, &k, vtypeof(&k), cut); } -_Bool libcdsb_map_find_float (val_t* x, map_t* s, fl_t k, _Bool cut) { return libcdsb_map_find(x, s, &k, vtypeof(&k), cut); } -_Bool libcdsb_map_find_double (val_t* x, map_t* s, dbl_t k, _Bool cut) { return libcdsb_map_find(x, s, &k, vtypeof(&k), cut); } -_Bool libcdsb_map_find_ldouble(val_t* x, map_t* s, ldbl_t k, _Bool cut) { return libcdsb_map_find(x, s, &k, vtypeof(&k), cut); } +int libcdsb_map_find_pointer(map_t* x, const void* k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } +int libcdsb_map_find_cstring(map_t* x, const char* k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } +int libcdsb_map_find_string (map_t* x, const str_t* k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, k, vtypeof( k), _, cb, cut); } +int libcdsb_map_find_array (map_t* x, const arr_t* k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, k, vtypeof( k), _, cb, cut); } +int libcdsb_map_find_list (map_t* x, const list_t* k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, k, vtypeof( k), _, cb, cut); } +int libcdsb_map_find_map (map_t* x, const map_t* k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, k, vtypeof( k), _, cb, cut); } +int libcdsb_map_find_vset (map_t* x, const set_t* k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, k, vtypeof( k), _, cb, cut); } +int libcdsb_map_find_boolean(map_t* x, _Bool k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } +int libcdsb_map_find_int8 (map_t* x, s8_t k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } +int libcdsb_map_find_int16 (map_t* x, s16_t k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } +int libcdsb_map_find_int32 (map_t* x, s32_t k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } +int libcdsb_map_find_int64 (map_t* x, s64_t k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } +int libcdsb_map_find_uint8 (map_t* x, u8_t k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } +int libcdsb_map_find_uint16 (map_t* x, u16_t k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } +int libcdsb_map_find_uint32 (map_t* x, u32_t k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } +int libcdsb_map_find_uint64 (map_t* x, u64_t k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } +int libcdsb_map_find_float (map_t* x, fl_t k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } +int libcdsb_map_find_double (map_t* x, dbl_t k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } +int libcdsb_map_find_ldouble(map_t* x, ldbl_t k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } _Bool libcdsb_map_update_pointer_pointer(map_t* x, const void* k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } _Bool libcdsb_map_update_pointer_cstring(map_t* x, const void* k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } From 28de64f7baa6764e8d163318593d96b97fd51bb4 Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Wed, 8 Jun 2022 21:01:12 +0300 Subject: [PATCH 05/27] Access standardization: clean types --- include/vtype.h | 48 ++++----------------------------------- src/__internal/include.h | 49 +++++++++++++--------------------------- 2 files changed, 21 insertions(+), 76 deletions(-) diff --git a/include/vtype.h b/include/vtype.h index dca09a8..fd58e25 100644 --- a/include/vtype.h +++ b/include/vtype.h @@ -37,7 +37,6 @@ typedef enum libcdsb_value_types { struct libcdsb_string { char* buffer; }; struct libcdsb_array { void* mem; size_t size; vtype type; }; -struct libcdsb_value { void* mem; int flags; vtype type; }; struct libcdsb_map { struct libcdsb_map_node* root; vtype type; }; struct libcdsb_set { struct libcdsb_rbtree_node* root; vtype type; }; @@ -61,14 +60,11 @@ typedef float vtype_float; typedef double vtype_double; typedef long double vtype_ldouble; -typedef struct libcdsb_value_pair vtype_kvpair; -typedef struct libcdsb_value vtype_value; -typedef struct libcdsb_array vtype_array; -typedef struct libcdsb_map vtype_map; -typedef struct libcdsb_set vtype_set; -typedef struct libcdsb_list vtype_list; -typedef struct libcdsb_string vtype_string; -typedef struct libcdsb_iterator vtype_iterator; +typedef struct libcdsb_array vtype_array; +typedef struct libcdsb_map vtype_map; +typedef struct libcdsb_set vtype_set; +typedef struct libcdsb_list vtype_list; +typedef struct libcdsb_string vtype_string; /* Get utf8 chars count in string */ @@ -142,38 +138,4 @@ extern void map_free(vtype_map* x); /* Free set resources */ extern void vset_free(vtype_set* x); - - - - -extern void value_init(vtype_value* dest); -extern void value_free(vtype_value* dest); - -extern _Bool value_is_readonly (const vtype_value* node); -extern _Bool value_is_strict_type(const vtype_value* node); -extern void value_is_null (const vtype_value* dest); - -extern void value_nmemb (const vtype_value* dest); -extern void* value_get_pointer (const vtype_value* src); - -extern _Bool value_set_pointer(vtype_value* node, const void* src); -extern _Bool value_set_cstring(vtype_value* node, const char* src); -extern _Bool value_set_string (vtype_value* node, const vtype_string* src); -extern _Bool value_set_array (vtype_value* node, const vtype_array* src); -extern _Bool value_set_list (vtype_value* node, const vtype_list* src); -extern _Bool value_set_map (vtype_value* node, const vtype_map* src); -extern _Bool value_set_vset (vtype_value* node, const vtype_set* src); -extern _Bool value_set_boolean(vtype_value* node, vtype_bool src); -extern _Bool value_set_uint8 (vtype_value* node, vtype_uint8 src); -extern _Bool value_set_uint16 (vtype_value* node, vtype_uint16 src); -extern _Bool value_set_uint32 (vtype_value* node, vtype_uint32 src); -extern _Bool value_set_uint64 (vtype_value* node, vtype_uint64 src); -extern _Bool value_set_int8 (vtype_value* node, vtype_int8 src); -extern _Bool value_set_int16 (vtype_value* node, vtype_int16 src); -extern _Bool value_set_int32 (vtype_value* node, vtype_int32 src); -extern _Bool value_set_int64 (vtype_value* node, vtype_int64 src); -extern _Bool value_set_float (vtype_value* node, vtype_float src); -extern _Bool value_set_double (vtype_value* node, vtype_double src); -extern _Bool value_set_ldouble(vtype_value* node, vtype_ldouble src); - #endif /* LIBCDSB_VTYPE_H */ diff --git a/src/__internal/include.h b/src/__internal/include.h index 9c77a66..7418f32 100644 --- a/src/__internal/include.h +++ b/src/__internal/include.h @@ -38,43 +38,26 @@ #include "__attributes.h" -typedef vtype_uint8 u8_t; -typedef vtype_uint16 u16_t; -typedef vtype_uint32 u32_t; -typedef vtype_uint64 u64_t; +typedef vtype_uint8 u8_t; +typedef vtype_uint16 u16_t; +typedef vtype_uint32 u32_t; +typedef vtype_uint64 u64_t; -typedef vtype_int8 s8_t; -typedef vtype_int16 s16_t; -typedef vtype_int32 s32_t; -typedef vtype_int64 s64_t; +typedef vtype_int8 s8_t; +typedef vtype_int16 s16_t; +typedef vtype_int32 s32_t; +typedef vtype_int64 s64_t; -typedef vtype_float fl_t; -typedef vtype_double dbl_t; -typedef vtype_ldouble ldbl_t; +typedef vtype_float fl_t; +typedef vtype_double dbl_t; +typedef vtype_ldouble ldbl_t; -typedef vtype_string str_t; -typedef vtype_array arr_t; -typedef vtype_list list_t; -typedef vtype_map map_t; -typedef vtype_set set_t; -typedef vtype_value val_t; -typedef vtype_kvpair kvp_t; -typedef vtype_iterator iter_t; +typedef vtype_string str_t; +typedef vtype_array arr_t; +typedef vtype_list list_t; +typedef vtype_map map_t; +typedef vtype_set set_t; -typedef enum { - VF_UNDEFINED = 0x00, - VF_WRITEABLE = 0x01, - VF_CHANGEABLE = 0x02, - VF_REMOVABLE = 0x0f -} vtype_value_flags; - -ainline(val_t* value_set(val_t* d, void* ptr, vtype type, int flags)) { - d->mem = ptr; - d->type = type; - d->flags = flags; - - return d; -} extern int libcdsb_vtype_compare_values(const void* s0, vtype t0, const void* s1, vtype t1); extern int libcdsb_vtype_compare_values_eq(const void* s0, const void* s1, vtype t); From ec76ed2d14eda05f8d2c81e0b7aacdc079f2b275 Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Wed, 8 Jun 2022 21:19:03 +0300 Subject: [PATCH 06/27] Change list sort to stack-based --- src/list/sort.c | 61 +++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/src/list/sort.c b/src/list/sort.c index 9162654..037881f 100644 --- a/src/list/sort.c +++ b/src/list/sort.c @@ -16,38 +16,39 @@ static inline void lnode_swap(lnode_t* s0, lnode_t* s1) { s1->type = t; } -static inline lnode_t* pivot(lnode_t *l, lnode_t *r) { - - lnode_t *c = l->prev; - - for (lnode_t* i = l; i != r; i = i->next) { - if (lnode_compare(i, r) < 0) { - c = (is_null(c)) ? l : c->next; - lnode_swap(c, i); - } - } - - c = (is_null(c)) ? l : c->next; - lnode_swap(c, r); - - return c; -} - -static void quick_sort(lnode_t* l, lnode_t* r) { - lnode_t* p; - - if (!is_null(r) && l != r && l != r->next) { - p = pivot(l, r); - - quick_sort(l, p->prev); - quick_sort(p->next, r); - } -} - -/*#####################################################################################################################*/ void list_sort(list_t* x) { - return quick_sort(x->first, x->last); + stack_t z = { .prev = 0, .value = x->last}; + lnode_t *l; + lnode_t *r; + + stack_push(&z, x->first); + + while (z.value) { + + l = stack_pop(&z); + r = stack_pop(&z); + + if (!is_null(r) && l != r && l != r->next) { + + lnode_t *p = l->prev; + + for (lnode_t* c = l; c != r; c = c->next) { + if (lnode_compare(c, r) < 0) { + p = (is_null(p)) ? l : p->next; + lnode_swap(p, c); + } + } + + p = (is_null(p)) ? l : p->next; + lnode_swap(p, r); + + stack_push(&z, r); + stack_push(&z, p->next); + stack_push(&z, p->prev); + stack_push(&z, l); + } + } } From 183c9af18a1a5714102c7f9dc93b92398381be85 Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Thu, 9 Jun 2022 11:08:28 +0300 Subject: [PATCH 07/27] Fix list (copy) lnode push --- src/list/copy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/list/copy.c b/src/list/copy.c index a68334f..fb714ae 100644 --- a/src/list/copy.c +++ b/src/list/copy.c @@ -25,8 +25,8 @@ static void push_next(list_t* x, vnode_t v, vtype t) { node->node = v; node->type = t; - x->last = node; x->last->next = node; + x->last = node; } /*#####################################################################################################################*/ From c6cc57575999a4095437f1cdf7f8bc81a0b50e84 Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Thu, 9 Jun 2022 11:39:19 +0300 Subject: [PATCH 08/27] Update tests base --- tests/Makefile | 17 ++++++++++ tests/include/random.h | 9 +++++ tests/include/test.h | 8 ++--- tests/src/random.c | 24 ++++++++++++- tests/src/test.c | 77 ++++++++++++++++++++++++++---------------- 5 files changed, 101 insertions(+), 34 deletions(-) diff --git a/tests/Makefile b/tests/Makefile index d810ace..f9a6205 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -35,6 +35,12 @@ OBJECTS_LIST := $(addprefix $(BUILD_PATH)/obj/,$(OBJECTS_TESTS)) $(addprefix . OBJECTS_MAP := $(addprefix $(BUILD_PATH)/obj/,$(OBJECTS_TESTS)) $(addprefix ../bin/debug/obj/,$(OBJECTS_MAP)) OBJECTS_SET := $(addprefix $(BUILD_PATH)/obj/,$(OBJECTS_TESTS)) $(addprefix ../bin/debug/obj/,$(OBJECTS_SET)) +OBJECTS_STRING := $(OBJECTS_STRING) $(addprefix $(BUILD_PATH)/obj/,$(call c_objects,./src/string/src/,string-)) +OBJECTS_ARRAY := $(OBJECTS_ARRAY) $(addprefix $(BUILD_PATH)/obj/,$(call c_objects,./src/array/src/,array-)) +OBJECTS_LIST := $(OBJECTS_LIST) $(addprefix $(BUILD_PATH)/obj/,$(call c_objects,./src/list/src/,list-)) +OBJECTS_MAP := $(OBJECTS_MAP) $(addprefix $(BUILD_PATH)/obj/,$(call c_objects,./src/map/src/,map-)) +OBJECTS_SET := $(OBJECTS_SET) $(addprefix $(BUILD_PATH)/obj/,$(call c_objects,./src/set/src/,set-)) + ######################################################################################################################## tests: modules @@ -50,6 +56,17 @@ tests: $(addprefix $(BUILD_PATH)/set-,$(notdir $(basename $(wildcard ./src/set/* $(BUILD_PATH)/obj/%.o: ./src/%.c | $(BUILD_PATH)/obj/ $(CC) $^ -o $@ $(CFLAGS) +$(BUILD_PATH)/obj/array-%.o: ./src/array/src/%.c | $(BUILD_PATH)/obj/ + $(CC) $^ -o $@ $(CFLAGS) +$(BUILD_PATH)/obj/string-%.o: ./src/string/src/%.c | $(BUILD_PATH)/obj/ + $(CC) $^ -o $@ $(CFLAGS) +$(BUILD_PATH)/obj/list-%.o: ./src/list/src/%.c | $(BUILD_PATH)/obj/ + $(CC) $^ -o $@ $(CFLAGS) +$(BUILD_PATH)/obj/map-%.o: ./src/map/src/%.c | $(BUILD_PATH)/obj/ + $(CC) $^ -o $@ $(CFLAGS) +$(BUILD_PATH)/obj/set-%.o: ./src/set/src/%.c | $(BUILD_PATH)/obj/ + $(CC) $^ -o $@ $(CFLAGS) + $(BUILD_PATH)/array-%: ./src/array/%.c $(OBJECTS_ARRAY) | $(BUILD_PATH)/ $(CC) $^ -o $@ $(CFLAGS) -g3 -Wall $(BUILD_PATH)/string-%: ./src/string/%.c $(OBJECTS_STRING) | $(BUILD_PATH)/ diff --git a/tests/include/random.h b/tests/include/random.h index 69b2b07..517c27b 100644 --- a/tests/include/random.h +++ b/tests/include/random.h @@ -2,10 +2,16 @@ /* Copyright © 2022 Gregory Lirent */ #include "../../include/vtype.h" +#include "../../src/__internal/vnode.h" #ifndef LIBCDSB_TESTS_RANDOM_H #define LIBCDSB_TESTS_RANDOM_H +typedef struct { + var_t value[1]; + vtype type; +} value_t; + extern int random_init(int argc, char** argv); extern vtype_bool random_boolean(); @@ -25,4 +31,7 @@ extern vtype_int64 random_int64(); extern char random_ascii_char(); extern unsigned int random_unicode_symbol(); + +extern value_t random_value(); + #endif /* LIBCDSB_TESTS_RANDOM_H */ diff --git a/tests/include/test.h b/tests/include/test.h index 2b689ce..ac3d5e9 100644 --- a/tests/include/test.h +++ b/tests/include/test.h @@ -7,10 +7,10 @@ #ifndef LIBCDSB_TESTS_TEST_H #define LIBCDSB_TESTS_TEST_H -extern void put_separator(); -extern void print_container_values_prefix(const char* name, const char* prefix); -extern void print_container_value(const ssize_t* index, const void* value, const vtype type, _Bool print_type); -extern void print_container_info(const char* name, const char* el_name, const vtype* type, ssize_t size, ssize_t nmemb); +extern void put_separator(unsigned int hpos); +extern void print_container_values_prefix(const char* name, const char* prefix, unsigned int hpos); +extern void print_container_value(const ssize_t* index, const void* value, const vtype type, _Bool print_type, unsigned int hpos); +extern void print_container_info(const char* name, const char* el_name, const vtype* type, ssize_t size, ssize_t nmemb, unsigned int hpos); extern void test_init(int argc, char** argv); diff --git a/tests/src/random.c b/tests/src/random.c index c77e74a..337932c 100644 --- a/tests/src/random.c +++ b/tests/src/random.c @@ -11,7 +11,7 @@ static void init(unsigned int seed) { if (!seed) seed = time(0); printf("\e[36mRandom module initialized with seed: \e[m\e[32m%u\n\e[m", seed); - put_separator(); + put_separator(0); srand(seed); } @@ -109,3 +109,25 @@ unsigned int random_unicode_symbol() { case 19: return (random_uint16()%0x03d8) + 0x01f300; } } + +value_t random_value() { + value_t v; + switch (random_uint8()%13) { + default: + case 0: v.value[0].b = random_boolean(); v.type = VTYPE_BOOLEAN; break; + case 1: v.value[0].u8 = random_uint8 (); v.type = VTYPE_UINT8; break; + case 2: v.value[0].u16 = random_uint16 (); v.type = VTYPE_UINT16; break; + case 3: v.value[0].u32 = random_uint32 (); v.type = VTYPE_UINT32; break; + case 4: v.value[0].u64 = random_uint64 (); v.type = VTYPE_UINT64; break; + case 5: v.value[0].u8 = random_int8 (); v.type = VTYPE_INT8; break; + case 6: v.value[0].u16 = random_int16 (); v.type = VTYPE_INT16; break; + case 7: v.value[0].u32 = random_int32 (); v.type = VTYPE_INT32; break; + case 8: v.value[0].u64 = random_int64 (); v.type = VTYPE_INT64; break; + case 9: v.value[0].f = random_float (); v.type = VTYPE_FLOAT; break; + case 10: v.value[0].d = random_double (); v.type = VTYPE_DOUBLE; break; + case 11: v.value[0].ld = random_ldouble(); v.type = VTYPE_LDOUBLE; break; + case 12: v.value[0].ptr = (void*)(uintptr_t)random_uint64(); v.type = VTYPE_POINTER; break; + } + + return v; +} diff --git a/tests/src/test.c b/tests/src/test.c index 1d570cf..32e11e4 100644 --- a/tests/src/test.c +++ b/tests/src/test.c @@ -1,6 +1,7 @@ /* This software is licensed by the MIT License, see LICENSE file */ /* Copyright © 2022 Gregory Lirent */ +#include #include #include "../include/test.h" #include "../include/time.h" @@ -15,25 +16,59 @@ static void test_uload() { if (TEST_NAME) { timer_stop(&GLOBAL_TIMER); puts(""); - put_separator(); + put_separator(0); printf("\e[36mTest \"\e[m\e[32;1m%s\e[m\e[36m\" is end.\nExecusion time: \e[m\e[32m%.6Lf sec\e[m\n", TEST_NAME, timer_value(&GLOBAL_TIMER)); - put_separator(); + put_separator(0); timer_free(&GLOBAL_TIMER); } } -void put_separator() { puts("\e[37;2m=== === === === === === === ===\e[m"); } +void test_init(int argc, char** argv) { + timer_init(&GLOBAL_TIMER); + timer_start(&GLOBAL_TIMER); -void print_container_values_prefix(const char* name, const char* prefix) { - if (prefix) { - printf("\e[36m%s %s values:\e[m\n", name, prefix); - } else printf("\e[36m%s values:\e[m\n", name); + TEST_NAME = strrchr(argv[0], '/') ? strrchr(argv[0], '/') + 1 : argv[0]; + + put_separator(0); + printf("\e[H\e[J\e[36mTest \"\e[m\e[32;1m%s\e[m\e[36m\" is loaded\e[m\n", TEST_NAME); + put_separator(0); + + random_init(argc, argv); + + puts(""); } -void print_container_value(const ssize_t* index, const void* value, const vtype type, _Bool print_type) { +void hp_printf(unsigned int hpos, const char* format, ...) { + va_list args; + + va_start(args, format); + vprintf(format, args); + + printf("\e[%dG", hpos+1); + + vprintf(format, args); + va_end(args); +} + + +void put_separator(unsigned int hpos) { + printf("\e[%dG\e[37;2m=== === === === === === === ===\e[m\n", hpos+1); +} + +void print_container_values_prefix(const char* name, const char* prefix, unsigned int hpos) { + if (prefix) { + printf("\e[%dG\e[36m%s %s values:\e[m\n", hpos+1, name, prefix); + } else { + printf("\e[%dG\e[36m%s values:\e[m\n", hpos+1, name); + } +} + +void print_container_value(const ssize_t* index, const void* value, const vtype type, _Bool print_type, unsigned int hpos) { if (index) { - printf("\e[32;1m%5ld: \e[m", *index); - } else fputs(" ", stdout); + printf("\e[%dG\e[32;1m%5ld: \e[m", hpos+1, *index); + } else { + printf("\e[%dG ", hpos+1); + } printf("\e[31m%24s\e[m", libcdsb_vtype_stringify(value, type)); @@ -44,15 +79,15 @@ void print_container_value(const ssize_t* index, const void* value, const vtype puts(""); } -void print_container_info(const char* name, const char* el_name, const vtype* type, ssize_t size, ssize_t nmemb) { +void print_container_info(const char* name, const char* el_name, const vtype* type, ssize_t size, ssize_t nmemb, unsigned int hpos) { if (!el_name) el_name = "elements"; if (type) { - printf("\e[36m%s initialized with type `\e[m\e[32;1m%s\e[m\e[36m`\n", name, libcdsb_vtype_name(*type)); + printf("\e[%dG\e[36m%s initialized with type `\e[m\e[32;1m%s\e[m\e[36m`\n", hpos+1, name, libcdsb_vtype_name(*type)); } if (size >= 0 || nmemb >= 0) { - printf("\e[36m%s consists of \e[m", name); + printf("\e[%dG\e[36m%s consists of \e[m", hpos+1, name); } if (size >= 0) { @@ -66,19 +101,3 @@ void print_container_info(const char* name, const char* el_name, const vtype* ty printf("\e[32m%ld bytes\e[m\n", nmemb); } } - - -void test_init(int argc, char** argv) { - timer_init(&GLOBAL_TIMER); - timer_start(&GLOBAL_TIMER); - - TEST_NAME = strrchr(argv[0], '/') ? strrchr(argv[0], '/') + 1 : argv[0]; - - put_separator(); - printf("\e[H\e[J\e[36mTest \"\e[m\e[32;1m%s\e[m\e[36m\" is loaded\e[m\n", TEST_NAME); - put_separator(); - - random_init(argc, argv); - - puts(""); -} From 760c04fb498850a1e25666d8c9c70d287dc67354 Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Thu, 9 Jun 2022 11:39:37 +0300 Subject: [PATCH 09/27] Update list tests --- tests/src/list/main.c | 25 +++-- tests/src/list/plug.h | 74 +++----------- tests/src/list/remove.c | 32 ------ tests/src/list/src/io.c | 188 ++++++++++++++++++++++++++++++++++++ tests/src/list/src/plug.c | 20 ++++ tests/src/list/src/random.c | 83 ++++++++++++++++ 6 files changed, 314 insertions(+), 108 deletions(-) delete mode 100644 tests/src/list/remove.c create mode 100644 tests/src/list/src/io.c create mode 100644 tests/src/list/src/plug.c create mode 100644 tests/src/list/src/random.c diff --git a/tests/src/list/main.c b/tests/src/list/main.c index 529a266..cfee210 100644 --- a/tests/src/list/main.c +++ b/tests/src/list/main.c @@ -6,19 +6,18 @@ int main(int argc, char** argv) { test_init(argc, argv); - vtype_list x; - - list_init(&x); - - for (int i = 0, n = 12 + random_boolean(); i < n; ++i) { - list_push_random(&x, random_boolean()); - } - list_sort(&x); - list_info(&x); - list_print(&x, "sorted"); - - list_reverse(&x); - list_print(&x, "reversed"); + list_t x = { .first = 0, .last = 0 }; + list_t y = { .first = 0, .last = 0 }; list_free(&x); + + visual_push2(&x, (random_uint8()%5) + 12, &y, (random_uint8()%5) + 12); + + visual_extend(&x, &y); + + visual_sort2(&x, &y); + visual_remove2(&x, &y); + + list_free(&y); + list_free(&y); } diff --git a/tests/src/list/plug.h b/tests/src/list/plug.h index d3571ed..7362e9d 100644 --- a/tests/src/list/plug.h +++ b/tests/src/list/plug.h @@ -9,69 +9,17 @@ #include "../../../src/__internal/vnode.h" -vtype_string* string_duplicate(const vtype_string* x) { return 0; } -vtype_array* array_duplicate (const vtype_array* x) { return 0; } -vtype_map* map_duplicate (const vtype_map* x) { return 0; } -vtype_set* vset_duplicate (const vtype_set* x) { return 0; } +extern void list_print(list_t* x, const char* prefix, unsigned int hpos); +extern void list_info (list_t* x, unsigned int hpos); -void string_free(vtype_string* x) {} -void array_free (vtype_array* x) {} -void map_free (vtype_map* x) {} -void vset_free (vtype_set* x) {} +extern void list_push_random(list_t* x, _Bool silent, unsigned int hpos); +extern void list_remove_random(list_t* x, _Bool silent, unsigned int hpos); -int string_compare(const vtype_string* s0, const vtype_string* s1) { return random_int8(); } -int array_compare (const vtype_array* s0, const vtype_array* s1) { return random_int8(); } -int map_compare (const vtype_map* s0, const vtype_map* s1) { return random_int8(); } -int vset_compare (const vtype_set* s0, const vtype_set* s1) { return random_int8(); } +extern void visual_push(list_t* x, size_t n); +extern void visual_sort(list_t* x); +extern void visual_remove(list_t* x); - -static void list_push_random(vtype_list* x, vtype_bool front) { - - if (!front) switch (random_uint8()%13) { - default: - case 0: list_push_back(x, random_boolean()); break; - case 1: list_push_back(x, random_uint8()); break; - case 2: list_push_back(x, random_uint16()); break; - case 3: list_push_back(x, random_uint32()); break; - case 4: list_push_back(x, random_uint64()); break; - case 5: list_push_back(x, random_int8()); break; - case 6: list_push_back(x, random_int16()); break; - case 7: list_push_back(x, random_int32()); break; - case 8: list_push_back(x, random_int64()); break; - case 9: list_push_back(x, (void*)((sizeof(void*) == 8) ? random_uint64() : random_uint32())); break; - case 10: list_push_back(x, random_float()); break; - case 11: list_push_back(x, random_double()); break; - case 12: list_push_back(x, random_ldouble()); break; - } else switch (random_uint8()%13) { - default: - case 0: list_push_front(x, random_boolean()); break; - case 1: list_push_front(x, random_uint8()); break; - case 2: list_push_front(x, random_uint16()); break; - case 3: list_push_front(x, random_uint32()); break; - case 4: list_push_front(x, random_uint64()); break; - case 5: list_push_front(x, random_int8()); break; - case 6: list_push_front(x, random_int16()); break; - case 7: list_push_front(x, random_int32()); break; - case 8: list_push_front(x, random_int64()); break; - case 9: list_push_front(x, (void*)((sizeof(void*) == 8) ? random_uint64() : random_uint32())); break; - case 10: list_push_front(x, random_float()); break; - case 11: list_push_front(x, random_double()); break; - case 12: list_push_front(x, random_ldouble()); break; - } -} - -static int list_node_print(void* v, ssize_t i, vtype t, void* _) { - print_container_value(&i, v, t, 1); - return 0; -} - -static void list_print(const vtype_list* x, const char* prefix) { - print_container_values_prefix("List", prefix); - list_foreach(x, 0, list_node_print); - put_separator(); -} - -static void list_info(const vtype_list* x) { - print_container_info("List", "nodes", 0, list_size(x), -1); - put_separator(); -} +extern void visual_push2(list_t* x0, size_t n0, list_t* x1, size_t n1); +extern void visual_remove2(list_t* x0, list_t* x1); +extern void visual_sort2(list_t* x0, list_t* x1); +extern void visual_extend(list_t* x, list_t* s); diff --git a/tests/src/list/remove.c b/tests/src/list/remove.c deleted file mode 100644 index b3c7039..0000000 --- a/tests/src/list/remove.c +++ /dev/null @@ -1,32 +0,0 @@ -/* This software is licensed by the MIT License, see LICENSE file */ -/* Copyright © 2022 Gregory Lirent */ - -#include "plug.h" - -int main(int argc, char** argv) { - test_init(argc, argv); - - vtype_list x; - - list_init(&x); - - for (int i = 0, c = random_uint8()%12; i < 12; ++i) { - if (i == c) { - list_push_back(&x, 0); - } else list_push_random(&x, random_boolean()); - } - - list_info(&x); - list_print(&x, 0); - - for (int i = 0, n = list_countof(&x, 0); i < n; ++i) { - int index = list_indexof(&x, 0); - list_remove(&x, 0); - - printf("\e[36mRemove element with index \e[m\e[32;1m%d\e[m\e[36m from list\e[m\n", index); - } - put_separator(); - list_print(&x, "cleaned"); - - list_free(&x); -} diff --git a/tests/src/list/src/io.c b/tests/src/list/src/io.c new file mode 100644 index 0000000..5ed0ed0 --- /dev/null +++ b/tests/src/list/src/io.c @@ -0,0 +1,188 @@ +/* This software is licensed by the MIT License, see LICENSE file */ +/* Copyright © 2022 Gregory Lirent */ + +#include "../plug.h" + +static int list_node_print(void* v, ssize_t i, vtype t, void* _) { + print_container_value(&i, v, t, 1, *(unsigned int*)_); + return 0; +} + +void list_print(list_t* x, const char* prefix, unsigned int hpos) { + print_container_values_prefix("List", prefix, hpos); + list_foreach(x, &hpos, list_node_print); +} + +void list_info(list_t* x, unsigned int hpos) { + print_container_info("List", "nodes", 0, list_size(x), -1, hpos); +} + + +void visual_push(list_t* x, size_t n) { + for (int i = 0; i < n; ++i) { + fputs("\e[s", stdout); + + list_push_random(x, 0, 0); + + list_info(x, 0); + list_print(x, 0, 0); + + psleep(100000); + fputs("\e[u\e[J", stdout); + } +} + +void visual_sort(list_t* x) { + puts("\e[s\e[36mTry to sort list values:\e[m\n\n"); + put_separator(0); + list_sort(x); + list_info(x, 0); + list_print(x, "sorted", 0); + psleep(900000); + fputs("\e[u\e[J", stdout); + + puts("\e[s\e[36mTry to reverse list values:\e[m\n\n"); + put_separator(0); + list_reverse(x); + list_info(x, 0); + list_print(x, "reversed", 0); + psleep(900000); + fputs("\e[u\e[J", stdout); +} + +void visual_remove(list_t* x) { + while (x->first) { + fputs("\e[s", stdout); + list_remove_random(x, 0, 0); + list_info(x, 0); + list_print(x, 0, 0); + + psleep(100000); + if (!0) fputs("\e[u\e[J", stdout); + } +} + +void visual_push2(list_t* x0, size_t n0, list_t* x1, size_t n1) { + + for (;n0 || n1;) { + fputs("\e[s", stdout); + if (n0) { + list_push_random(x0, 0, 0); + --n0; + } else { + puts("\n\n"); + put_separator(0); + } + + fputs("\e[u\e[s", stdout); + + if (n1) { + list_push_random(x1, 0, 60); + --n1; + } else { + puts("\n\n"); + put_separator(60); + } + + list_info(x0, 0); + list_print(x0, 0, 0); + fputs("\e[u\e[s\e[4E", stdout); + list_info(x1, 60); + list_print(x1, 0, 60); + psleep(100000); + + fputs("\e[u\e[J", stdout); + } +} + +void visual_remove2(list_t* x0, list_t* x1) { + + for (;x0->first || x1->first;) { + fputs("\e[s", stdout); + + if (x0->first) { + list_remove_random(x0, 0, 0); + } else { + puts("\n\n"); + put_separator(0); + } + + fputs("\e[u\e[s", stdout); + + if (x1->first) { + list_remove_random(x1, 0, 60); + } else { + puts("\n\n"); + put_separator(60); + } + + list_info(x0, 0); + list_print(x0, 0, 0); + fputs("\e[u\e[s\e[4E", stdout); + list_info(x1, 60); + list_print(x1, 0, 60); + psleep(100000); + + fputs("\e[u\e[J", stdout); + } +} + + +void visual_sort2(list_t* x0, list_t* x1) { + printf("\e[s\e[36m%-60s%s\e[m\n\n","Try to sort list values:", "Try to sort list values:"); + printf("\e[32;1m%-60s%s\e[m\n", "SUCCESS", "SUCCESS"); + printf("\e[37;2m%-60s%s\e[m\n", "=== === === === === === === ===", "=== === === === === === === ==="); + + list_sort(x0); + list_sort(x1); + + list_info(x0, 0); + list_print(x0, "sorted", 0); + fputs("\e[u\e[s\e[4E", stdout); + list_info(x1, 60); + list_print(x1, "sorted", 60); + + psleep(900000); + fputs("\e[u\e[J", stdout); + + printf("\e[s\e[36m%-60s%s\e[m\n\n","Try to reverse list values:", "Try to reverse list values:"); + printf("\e[32;1m%-60s%s\e[m\n", "SUCCESS", "SUCCESS"); + printf("\e[37;2m%-60s%s\e[m\n", "=== === === === === === === ===", "=== === === === === === === ==="); + + list_reverse(x0); + list_reverse(x1); + + list_info(x0, 0); + list_print(x0, "reversed", 0); + fputs("\e[u\e[s\e[4E", stdout); + list_info(x1, 60); + list_print(x1, "reversed", 60); + + psleep(900000); + fputs("\e[u\e[J", stdout); +} + +void visual_extend(list_t* x, list_t* s) { + + puts("\e[s\e[36mTry to extend list:\e[m\n\n"); + printf("\e[37;2m%-60s%s\e[m\n", "=== === === === === === === ===", "=== === === === === === === ==="); + + list_info(x, 0); + list_print(x, "(dest)", 0); + fputs("\e[u\e[s\e[4E", stdout); + list_info(s, 60); + list_print(s, "(src)", 60); + + psleep(900000); + fputs("\e[u\e[s\e[2E\e[32;1mSUCCESS\e[m\e[J", stdout); + + list_extend(x, s); + + puts(""); + put_separator(0); + + list_info(x, 0); + list_print(x, "(dest)", 0); + psleep(900000); + fputs("\e[u\e[J", stdout); +} diff --git a/tests/src/list/src/plug.c b/tests/src/list/src/plug.c new file mode 100644 index 0000000..eff34f8 --- /dev/null +++ b/tests/src/list/src/plug.c @@ -0,0 +1,20 @@ +/* This software is licensed by the MIT License, see LICENSE file */ +/* Copyright © 2022 Gregory Lirent */ + +#include "../../../../src/__internal/include.h" +#include "../../../include/random.h" + +vtype_string* string_duplicate(const vtype_string* x) { return 0; } +vtype_array* array_duplicate (const vtype_array* x) { return 0; } +vtype_map* map_duplicate (const vtype_map* x) { return 0; } +vtype_set* vset_duplicate (const vtype_set* x) { return 0; } + +void string_free(vtype_string* x) {} +void array_free (vtype_array* x) {} +void map_free (vtype_map* x) {} +void vset_free (vtype_set* x) {} + +int string_compare(const vtype_string* s0, const vtype_string* s1) { return random_int8(); } +int array_compare (const vtype_array* s0, const vtype_array* s1) { return random_int8(); } +int map_compare (const vtype_map* s0, const vtype_map* s1) { return random_int8(); } +int vset_compare (const vtype_set* s0, const vtype_set* s1) { return random_int8(); } diff --git a/tests/src/list/src/random.c b/tests/src/list/src/random.c new file mode 100644 index 0000000..9d74048 --- /dev/null +++ b/tests/src/list/src/random.c @@ -0,0 +1,83 @@ +/* This software is licensed by the MIT License, see LICENSE file */ +/* Copyright © 2022 Gregory Lirent */ + +#include "../plug.h" + +static int remove_callback(void* v, ssize_t i, vtype t, void* _) { + struct { list_t* x; _Bool s; unsigned int p; } *x = _; + if (!x->s) { + print_container_value(0, v, t, 1, x->p); + } + + if (libcdsb_list_find(x->x, v, t, 0, 0, 1, 1)) { + return -2; + } + + return 0; +} + + +void list_push_random(list_t* x, _Bool silent, unsigned int hpos) { + + value_t v = random_value(); + _Bool r; + + if (random_boolean()) { + if (!silent) { + printf("\e[%dG\e[36mTry to push value to back of the list:\e[m\n", hpos+1); + } + r = libcdsb_list_update(x, -1, v.value, v.type, 1); + } else if (random_boolean()) { + if (!silent) { + printf("\e[%dG\e[36mTry to push value to front of the list:\e[m\n", hpos+1); + } + r = libcdsb_list_update(x, -1, v.value, v.type, 1); + } else { + ssize_t i = list_size(x); + i = random_uint64()% (i ? i : 1); + if (random_boolean()) i = ~i + 1; + + if (!silent) { + printf("\e[%dG\e[36mTry to change value with index \e[32;1m%ld\e[36m into list:\e[m\n", hpos+1, i); + } + + r = libcdsb_list_update(x, i, v.value, v.type, 0); + } + + if (!silent) { + print_container_value(0, v.value, v.type, 1, hpos); + printf("\e[%dG%s\n", hpos+1, r ? "\e[32;1mSUCCESS\e[m" : "\e[31;1mFAILURE\e[m"); + put_separator(hpos); + } +} + +void list_remove_random(list_t* x, _Bool silent, unsigned int hpos) { + + size_t n = list_size(x); + ssize_t i = random_uint64()%n; + + if (random_boolean()) i = ~i + 1; + + if (random_boolean()) { + if (!silent) { + printf("\e[%dG\e[36mTry to remove value from list by index:\e[m\n", hpos+1); + print_container_value(0, &i, (sizeof(ssize_t) == 8) ? VTYPE_INT64 : VTYPE_INT32, 0, hpos); + } + switch (list_remove_by_index(x, i)) { + case 0: if (!silent) printf("\e[%dG\e[32;1mSUCCESS\e[m\n", hpos+1); break; + default: if (!silent) printf("\e[%dG\e[32;1mFAILURE\e[m\n", hpos+1); break; + } + } else { + struct { list_t* x; _Bool s; unsigned int p; } v = { .x = x, .s = silent, .p = hpos }; + + if (!silent) printf("\e[%dG\e[36mTry to remove value from list:\e[m\n", hpos+1); + + switch (libcdsb_list_get(x, i, &v, remove_callback, 0)) { + case 0: if (!silent) printf("\e[%dG\e[32;1mSUCCESS\e[m\n", hpos+1); break; + case 2: if (!silent) printf("\n\e[%dG\e[32;1mFAILURE\e[m\n", hpos+1); break; + default: if (!silent) printf("\e[%dG\e[32;1mFAILURE\e[m\n", hpos+1); break; + } + } + + put_separator(hpos); +} From 0733020dcb8ce02fb3239fa2e2ed7b401320ad66 Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Thu, 9 Jun 2022 14:16:41 +0300 Subject: [PATCH 10/27] Split src/extra.c --- src/extra-memory.c | 72 +++++++++++++++++++++++++ src/extra-stack.c | 56 +++++++++++++++++++ src/extra.c | 130 --------------------------------------------- 3 files changed, 128 insertions(+), 130 deletions(-) create mode 100644 src/extra-memory.c create mode 100644 src/extra-stack.c diff --git a/src/extra-memory.c b/src/extra-memory.c new file mode 100644 index 0000000..72fdaab --- /dev/null +++ b/src/extra-memory.c @@ -0,0 +1,72 @@ +/* This software is licensed by the MIT License, see LICENSE file */ +/* Copyright © 2022 Gregory Lirent */ + +#include +#include "../include/extra/cstring.h" +#include "__internal/include.h" +#undef aligned_alloc +#undef malloc +#undef realloc +#undef calloc + +void* libcdsb_aalloc(size_t a, size_t n) { + void* x; + + if ((x = aligned_alloc(a, n))) + return x; + abort(); +} + + +void* libcdsb_calloc(size_t n, size_t c) { + void* x; + + if ((x = calloc(n, c))) + return x; + abort(); +} + + +void* libcdsb_malloc(size_t n) { + void* x; + + if ((x = malloc(n))) + return x; + abort(); +} + + +void* libcdsb_realloc(void* x, size_t n) { + if ((x = realloc(x, n))) + return x; + abort(); +} + +void* libcdsb_memndup(const void* m, size_t n) { + void* x; + + if ((x = malloc(n))) + return memcpy(x, m, n); + abort(); +} + + +char* libcdsb_strdup(const char* s) { + void* x; + size_t n; + + if ((x = malloc(n = strlen(s) + 1))) + return memcpy(x, s, n); + abort(); +} + + +char* libcdsb_strndup(const char* s, size_t n) { + void* x; + + if ((x = malloc(n + 1))) { + ((char*)memcpy(x, s, n))[n] = 0; + return x; + } + abort(); +} diff --git a/src/extra-stack.c b/src/extra-stack.c new file mode 100644 index 0000000..3a32bdf --- /dev/null +++ b/src/extra-stack.c @@ -0,0 +1,56 @@ +/* This software is licensed by the MIT License, see LICENSE file */ +/* Copyright © 2022 Gregory Lirent */ + +#include +#include "__internal/include.h" +#undef malloc + +void libcdsb_stack_init(stack_t* x) { + memset(x, 0, sizeof(*x)); +} + + +void libcdsb_stack_push(stack_t* x, void* value) { + stack_t* n; + + if (x->value) { + if (!(n = malloc(sizeof(*n)))) + abort(); + + n->prev = x->prev; + n->value = x->value; + x->prev = n; + } + + x->value = value; +} + +void* libcdsb_stack_pop(stack_t* x) { + + stack_t* n; + void* v; + + v = x->value; + + if (x->prev) { + n = x->prev; + x->prev = n->prev; + x->value = n->value; + free(n); + } else x->value = 0; + + return v; +} + + +void libcdsb_stack_flush(stack_t* stack) { + stack_t* c; + + while (stack->prev) { + c = stack->prev; + stack->prev = c->prev; + free(c); + } + + stack->value = 0; +} diff --git a/src/extra.c b/src/extra.c index a1c261c..175d14f 100644 --- a/src/extra.c +++ b/src/extra.c @@ -1,138 +1,8 @@ /* This software is licensed by the MIT License, see LICENSE file */ /* Copyright © 2022 Gregory Lirent */ -#include #include "../include/extra/cstring.h" #include "__internal/include.h" -#undef aligned_alloc -#undef malloc -#undef realloc -#undef calloc - -/*#####################################################################################################################*/ - -void* libcdsb_aalloc(size_t a, size_t n) { - void* x; - - if ((x = aligned_alloc(a, n))) - return x; - abort(); -} - - -void* libcdsb_calloc(size_t n, size_t c) { - void* x; - - if ((x = calloc(n, c))) - return x; - abort(); -} - - -void* libcdsb_malloc(size_t n) { - void* x; - - if ((x = malloc(n))) - return x; - abort(); -} - - -void* libcdsb_realloc(void* x, size_t n) { - if ((x = realloc(x, n))) - return x; - abort(); -} - - -/*#####################################################################################################################*/ - - -void* libcdsb_memndup(const void* m, size_t n) { - void* x; - - if ((x = malloc(n))) - return memcpy(x, m, n); - abort(); -} - - -char* libcdsb_strdup(const char* s) { - void* x; - size_t n; - - if ((x = malloc(n = strlen(s) + 1))) - return memcpy(x, s, n); - abort(); -} - - -char* libcdsb_strndup(const char* s, size_t n) { - void* x; - - if ((x = malloc(n + 1))) { - ((char*)memcpy(x, s, n))[n] = 0; - return x; - } - abort(); -} - - -/*#####################################################################################################################*/ - - -void libcdsb_stack_init(stack_t* x) { - memset(x, 0, sizeof(*x)); -} - - -void libcdsb_stack_push(stack_t* x, void* value) { - stack_t* n; - - if (x->value) { - if (!(n = malloc(sizeof(*n)))) - abort(); - - n->prev = x->prev; - n->value = x->value; - x->prev = n; - } - - x->value = value; -} - -void* libcdsb_stack_pop(stack_t* x) { - - stack_t* n; - void* v; - - v = x->value; - - if (x->prev) { - n = x->prev; - x->prev = n->prev; - x->value = n->value; - free(n); - } else x->value = 0; - - return v; -} - - -void libcdsb_stack_flush(stack_t* stack) { - stack_t* c; - - while (stack->prev) { - c = stack->prev; - stack->prev = c->prev; - free(c); - } - - stack->value = 0; -} - -/*#####################################################################################################################*/ - size_t libcdsb_strlen(const char* s) { static const size_t m = (sizeof(size_t) == 8) ? 0x8080808080808080UL : 0x80808080UL; From 5a8a7ee6ef14111b2b65f90e36784281a5bd4005 Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Thu, 9 Jun 2022 16:26:11 +0300 Subject: [PATCH 11/27] Array interface standardization --- include/array.h | 72 +++++++++++++++++++---------- include/extra/array.h | 18 ++++---- src/array/extra.c | 104 +++++++++++++++++++++++++++--------------- src/array/generics.c | 60 ++++++++++++++++-------- 4 files changed, 165 insertions(+), 89 deletions(-) diff --git a/include/array.h b/include/array.h index 6736627..4a9a67c 100644 --- a/include/array.h +++ b/include/array.h @@ -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 */ diff --git a/include/extra/array.h b/include/extra/array.h index 3b15ca5..d9d9ab8 100644 --- a/include/extra/array.h +++ b/include/extra/array.h @@ -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 */ diff --git a/src/array/extra.c b/src/array/extra.c index d78332b..1b35a78 100644 --- a/src/array/extra.c +++ b/src/array/extra.c @@ -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; diff --git a/src/array/generics.c b/src/array/generics.c index be0352a..cdcf787 100644 --- a/src/array/generics.c +++ b/src/array/generics.c @@ -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)); } From af5b89a2f48ddd1d1b15b901aac5e0e78ddb6b23 Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Thu, 9 Jun 2022 16:29:10 +0300 Subject: [PATCH 12/27] Refactor the using of bool type --- include/extra/list.h | 10 +- include/extra/map.h | 6 +- include/extra/set.h | 6 +- include/list.h | 76 ++-- include/map.h | 760 +++++++++++++++++++-------------------- include/set.h | 76 ++-- include/string.h | 10 +- include/vtype.h | 2 +- src/__internal/include.h | 4 +- src/__internal/vnode.h | 2 +- src/array/slice.c | 2 +- src/list/extra.c | 8 +- src/list/generics.c | 78 ++-- src/map/extra.c | 6 +- src/map/generics.c | 760 +++++++++++++++++++-------------------- src/set/extra.c | 6 +- src/set/generics.c | 76 ++-- src/string/base.c | 4 +- src/string/get.c | 2 +- src/string/trim.c | 2 +- src/vnode.c | 2 +- src/vtype-extra.c | 2 +- 22 files changed, 950 insertions(+), 950 deletions(-) diff --git a/include/extra/list.h b/include/extra/list.h index 579784d..89c5804 100644 --- a/include/extra/list.h +++ b/include/extra/list.h @@ -12,12 +12,12 @@ #define list_foreach(x, data, callback) libcdsb_list_foreach(x, data, callback, 0) -extern _Bool libcdsb_list_update(vtype_list* x, ssize_t index, const void* value, vtype type, int ins_direction) LIBCDSB_nt__ LIBCDSB_nn1__; +extern bool libcdsb_list_update(vtype_list* x, ssize_t index, const void* value, vtype type, int ins_direction) LIBCDSB_nt__ LIBCDSB_nn1__; -extern size_t libcdsb_list_count(const vtype_list* s, const void* value, vtype type) LIBCDSB_nt__ LIBCDSB_nn1__; +extern size_t libcdsb_list_count(const vtype_list* s, const void* value, vtype type) LIBCDSB_nt__ LIBCDSB_nn1__; -extern int libcdsb_list_find (vtype_list* x, const void* value, vtype type, void* data, list_access_callback, _Bool reverse, _Bool cut) LIBCDSB_nt__ LIBCDSB_nn1__; -extern int libcdsb_list_get (vtype_list* x, ssize_t index, void* data, list_access_callback, _Bool cut) LIBCDSB_nt__ LIBCDSB_nn1__; -extern int libcdsb_list_foreach(vtype_list* x, void* data, list_access_callback, _Bool flush) LIBCDSB_nt__ LIBCDSB_nn13__; +extern int libcdsb_list_find (vtype_list* x, const void* value, vtype type, void* data, list_access_callback, bool reverse, bool cut) LIBCDSB_nt__ LIBCDSB_nn1__; +extern int libcdsb_list_get (vtype_list* x, ssize_t index, void* data, list_access_callback, bool cut) LIBCDSB_nt__ LIBCDSB_nn1__; +extern int libcdsb_list_foreach(vtype_list* x, void* data, list_access_callback, bool flush) LIBCDSB_nt__ LIBCDSB_nn13__; #endif /* LIBCDSB_EXTRA_LIST_H */ diff --git a/include/extra/map.h b/include/extra/map.h index 458d75e..e4ac897 100644 --- a/include/extra/map.h +++ b/include/extra/map.h @@ -8,10 +8,10 @@ #define map_foreach(x, data, callback) libcdsb_map_foreach(x, data, callback, 0) -extern _Bool libcdsb_map_update(vtype_map* x, const void* k, vtype kt, const void* v, vtype vt) LIBCDSB_nt__ LIBCDSB_nn124__; +extern bool libcdsb_map_update(vtype_map* x, const void* k, vtype kt, const void* v, vtype vt) LIBCDSB_nt__ LIBCDSB_nn124__; -extern int libcdsb_map_find (vtype_map* x, const void* key, vtype key_type, void* data, map_access_callback, _Bool cut) LIBCDSB_nt__ LIBCDSB_nn1__; -extern int libcdsb_map_foreach(vtype_map* x, void* data, map_access_callback, _Bool flush) LIBCDSB_nt__ LIBCDSB_nn13__; +extern int libcdsb_map_find (vtype_map* x, const void* key, vtype key_type, void* data, map_access_callback, bool cut) LIBCDSB_nt__ LIBCDSB_nn1__; +extern int libcdsb_map_foreach(vtype_map* x, void* data, map_access_callback, bool flush) LIBCDSB_nt__ LIBCDSB_nn13__; #endif /* LIBCDSB_EXTRA_MAP_H */ diff --git a/include/extra/set.h b/include/extra/set.h index 7c2adc0..a6d097d 100644 --- a/include/extra/set.h +++ b/include/extra/set.h @@ -8,9 +8,9 @@ #define vset_foreach(x, data, callback) libcdsb_vset_foreach(x, data, callback, 0) -extern _Bool libcdsb_vset_insert(vtype_set* x, const void* value, vtype type) LIBCDSB_nt__ LIBCDSB_nn12__; +extern bool libcdsb_vset_insert(vtype_set* x, const void* value, vtype type) LIBCDSB_nt__ LIBCDSB_nn12__; -extern int libcdsb_vset_find (vtype_set* x, const void* value, vtype type, void* data, vset_access_callback, _Bool cut) LIBCDSB_nt__ LIBCDSB_nn1__; -extern int libcdsb_vset_foreach(vtype_set* x, void* data, vset_access_callback, _Bool flush) LIBCDSB_nt__ LIBCDSB_nn13__; +extern int libcdsb_vset_find (vtype_set* x, const void* value, vtype type, void* data, vset_access_callback, bool cut) LIBCDSB_nt__ LIBCDSB_nn1__; +extern int libcdsb_vset_foreach(vtype_set* x, void* data, vset_access_callback, bool flush) LIBCDSB_nt__ LIBCDSB_nn13__; #endif /* LIBCDSB_EXTRA_SET_H */ diff --git a/include/list.h b/include/list.h index 2b811f8..4f8ed03 100644 --- a/include/list.h +++ b/include/list.h @@ -31,25 +31,25 @@ extern void list_reverse(vtype_list* x); /*#####################################################################################################################*/ -extern int libcdsb_list_find_pointer(vtype_list* x, const void* value, void* data, list_access_callback, _Bool reverse, _Bool cut); -extern int libcdsb_list_find_cstring(vtype_list* x, const char* value, void* data, list_access_callback, _Bool reverse, _Bool cut); -extern int libcdsb_list_find_string (vtype_list* x, const vtype_string* value, void* data, list_access_callback, _Bool reverse, _Bool cut); -extern int libcdsb_list_find_array (vtype_list* x, const vtype_array* value, void* data, list_access_callback, _Bool reverse, _Bool cut); -extern int libcdsb_list_find_list (vtype_list* x, const vtype_list* value, void* data, list_access_callback, _Bool reverse, _Bool cut); -extern int libcdsb_list_find_map (vtype_list* x, const vtype_map* value, void* data, list_access_callback, _Bool reverse, _Bool cut); -extern int libcdsb_list_find_vset (vtype_list* x, const vtype_set* value, void* data, list_access_callback, _Bool reverse, _Bool cut); -extern int libcdsb_list_find_boolean(vtype_list* x, vtype_bool value, void* data, list_access_callback, _Bool reverse, _Bool cut); -extern int libcdsb_list_find_int8 (vtype_list* x, vtype_int8 value, void* data, list_access_callback, _Bool reverse, _Bool cut); -extern int libcdsb_list_find_int16 (vtype_list* x, vtype_int16 value, void* data, list_access_callback, _Bool reverse, _Bool cut); -extern int libcdsb_list_find_int32 (vtype_list* x, vtype_int32 value, void* data, list_access_callback, _Bool reverse, _Bool cut); -extern int libcdsb_list_find_int64 (vtype_list* x, vtype_int64 value, void* data, list_access_callback, _Bool reverse, _Bool cut); -extern int libcdsb_list_find_uint8 (vtype_list* x, vtype_uint8 value, void* data, list_access_callback, _Bool reverse, _Bool cut); -extern int libcdsb_list_find_uint16 (vtype_list* x, vtype_uint16 value, void* data, list_access_callback, _Bool reverse, _Bool cut); -extern int libcdsb_list_find_uint32 (vtype_list* x, vtype_uint32 value, void* data, list_access_callback, _Bool reverse, _Bool cut); -extern int libcdsb_list_find_uint64 (vtype_list* x, vtype_uint64 value, void* data, list_access_callback, _Bool reverse, _Bool cut); -extern int libcdsb_list_find_float (vtype_list* x, vtype_float value, void* data, list_access_callback, _Bool reverse, _Bool cut); -extern int libcdsb_list_find_double (vtype_list* x, vtype_double value, void* data, list_access_callback, _Bool reverse, _Bool cut); -extern int libcdsb_list_find_ldouble(vtype_list* x, vtype_ldouble value, void* data, list_access_callback, _Bool reverse, _Bool cut); +extern int libcdsb_list_find_pointer(vtype_list* x, const void* value, void* data, list_access_callback, bool reverse, bool cut); +extern int libcdsb_list_find_cstring(vtype_list* x, const char* value, void* data, list_access_callback, bool reverse, bool cut); +extern int libcdsb_list_find_string (vtype_list* x, const vtype_string* value, void* data, list_access_callback, bool reverse, bool cut); +extern int libcdsb_list_find_array (vtype_list* x, const vtype_array* value, void* data, list_access_callback, bool reverse, bool cut); +extern int libcdsb_list_find_list (vtype_list* x, const vtype_list* value, void* data, list_access_callback, bool reverse, bool cut); +extern int libcdsb_list_find_map (vtype_list* x, const vtype_map* value, void* data, list_access_callback, bool reverse, bool cut); +extern int libcdsb_list_find_vset (vtype_list* x, const vtype_set* value, void* data, list_access_callback, bool reverse, bool cut); +extern int libcdsb_list_find_boolean(vtype_list* x, vtype_bool value, void* data, list_access_callback, bool reverse, bool cut); +extern int libcdsb_list_find_int8 (vtype_list* x, vtype_int8 value, void* data, list_access_callback, bool reverse, bool cut); +extern int libcdsb_list_find_int16 (vtype_list* x, vtype_int16 value, void* data, list_access_callback, bool reverse, bool cut); +extern int libcdsb_list_find_int32 (vtype_list* x, vtype_int32 value, void* data, list_access_callback, bool reverse, bool cut); +extern int libcdsb_list_find_int64 (vtype_list* x, vtype_int64 value, void* data, list_access_callback, bool reverse, bool cut); +extern int libcdsb_list_find_uint8 (vtype_list* x, vtype_uint8 value, void* data, list_access_callback, bool reverse, bool cut); +extern int libcdsb_list_find_uint16 (vtype_list* x, vtype_uint16 value, void* data, list_access_callback, bool reverse, bool cut); +extern int libcdsb_list_find_uint32 (vtype_list* x, vtype_uint32 value, void* data, list_access_callback, bool reverse, bool cut); +extern int libcdsb_list_find_uint64 (vtype_list* x, vtype_uint64 value, void* data, list_access_callback, bool reverse, bool cut); +extern int libcdsb_list_find_float (vtype_list* x, vtype_float value, void* data, list_access_callback, bool reverse, bool cut); +extern int libcdsb_list_find_double (vtype_list* x, vtype_double value, void* data, list_access_callback, bool reverse, bool cut); +extern int libcdsb_list_find_ldouble(vtype_list* x, vtype_ldouble value, void* data, list_access_callback, bool reverse, bool cut); extern size_t libcdsb_list_count_pointer(const vtype_list* s, const void* value); extern size_t libcdsb_list_count_cstring(const vtype_list* s, const char* value); @@ -71,24 +71,24 @@ extern size_t libcdsb_list_count_float (const vtype_list* s, vtype_floa extern size_t libcdsb_list_count_double (const vtype_list* s, vtype_double value); extern size_t libcdsb_list_count_ldouble(const vtype_list* s, vtype_ldouble value); -extern _Bool libcdsb_list_update_pointer(vtype_list* x, ssize_t index, const void* value, int ins_direction); -extern _Bool libcdsb_list_update_cstring(vtype_list* x, ssize_t index, const char* value, int ins_direction); -extern _Bool libcdsb_list_update_string (vtype_list* x, ssize_t index, const vtype_string* value, int ins_direction); -extern _Bool libcdsb_list_update_array (vtype_list* x, ssize_t index, const vtype_array* value, int ins_direction); -extern _Bool libcdsb_list_update_list (vtype_list* x, ssize_t index, const vtype_list* value, int ins_direction); -extern _Bool libcdsb_list_update_map (vtype_list* x, ssize_t index, const vtype_map* value, int ins_direction); -extern _Bool libcdsb_list_update_vset (vtype_list* x, ssize_t index, const vtype_set* value, int ins_direction); -extern _Bool libcdsb_list_update_boolean(vtype_list* x, ssize_t index, vtype_bool value, int ins_direction); -extern _Bool libcdsb_list_update_int8 (vtype_list* x, ssize_t index, vtype_int8 value, int ins_direction); -extern _Bool libcdsb_list_update_int16 (vtype_list* x, ssize_t index, vtype_int16 value, int ins_direction); -extern _Bool libcdsb_list_update_int32 (vtype_list* x, ssize_t index, vtype_int32 value, int ins_direction); -extern _Bool libcdsb_list_update_int64 (vtype_list* x, ssize_t index, vtype_int64 value, int ins_direction); -extern _Bool libcdsb_list_update_uint8 (vtype_list* x, ssize_t index, vtype_uint8 value, int ins_direction); -extern _Bool libcdsb_list_update_uint16 (vtype_list* x, ssize_t index, vtype_uint16 value, int ins_direction); -extern _Bool libcdsb_list_update_uint32 (vtype_list* x, ssize_t index, vtype_uint32 value, int ins_direction); -extern _Bool libcdsb_list_update_uint64 (vtype_list* x, ssize_t index, vtype_uint64 value, int ins_direction); -extern _Bool libcdsb_list_update_float (vtype_list* x, ssize_t index, vtype_float value, int ins_direction); -extern _Bool libcdsb_list_update_double (vtype_list* x, ssize_t index, vtype_double value, int ins_direction); -extern _Bool libcdsb_list_update_ldouble(vtype_list* x, ssize_t index, vtype_ldouble value, int ins_direction); +extern bool libcdsb_list_update_pointer(vtype_list* x, ssize_t index, const void* value, int ins_direction); +extern bool libcdsb_list_update_cstring(vtype_list* x, ssize_t index, const char* value, int ins_direction); +extern bool libcdsb_list_update_string (vtype_list* x, ssize_t index, const vtype_string* value, int ins_direction); +extern bool libcdsb_list_update_array (vtype_list* x, ssize_t index, const vtype_array* value, int ins_direction); +extern bool libcdsb_list_update_list (vtype_list* x, ssize_t index, const vtype_list* value, int ins_direction); +extern bool libcdsb_list_update_map (vtype_list* x, ssize_t index, const vtype_map* value, int ins_direction); +extern bool libcdsb_list_update_vset (vtype_list* x, ssize_t index, const vtype_set* value, int ins_direction); +extern bool libcdsb_list_update_boolean(vtype_list* x, ssize_t index, vtype_bool value, int ins_direction); +extern bool libcdsb_list_update_int8 (vtype_list* x, ssize_t index, vtype_int8 value, int ins_direction); +extern bool libcdsb_list_update_int16 (vtype_list* x, ssize_t index, vtype_int16 value, int ins_direction); +extern bool libcdsb_list_update_int32 (vtype_list* x, ssize_t index, vtype_int32 value, int ins_direction); +extern bool libcdsb_list_update_int64 (vtype_list* x, ssize_t index, vtype_int64 value, int ins_direction); +extern bool libcdsb_list_update_uint8 (vtype_list* x, ssize_t index, vtype_uint8 value, int ins_direction); +extern bool libcdsb_list_update_uint16 (vtype_list* x, ssize_t index, vtype_uint16 value, int ins_direction); +extern bool libcdsb_list_update_uint32 (vtype_list* x, ssize_t index, vtype_uint32 value, int ins_direction); +extern bool libcdsb_list_update_uint64 (vtype_list* x, ssize_t index, vtype_uint64 value, int ins_direction); +extern bool libcdsb_list_update_float (vtype_list* x, ssize_t index, vtype_float value, int ins_direction); +extern bool libcdsb_list_update_double (vtype_list* x, ssize_t index, vtype_double value, int ins_direction); +extern bool libcdsb_list_update_ldouble(vtype_list* x, ssize_t index, vtype_ldouble value, int ins_direction); #endif /* LIBCDSB_LIST_H */ diff --git a/include/map.h b/include/map.h index 8e204a3..3551021 100644 --- a/include/map.h +++ b/include/map.h @@ -16,404 +16,404 @@ extern void map_init(vtype_map* x, vtype key_type); #define map_update(x, key, value) _LIBCDSB_Generic2(libcdsb_map, update, key, value)(x, key, value) #define map_remove(x, key) map_pop(0, x, key) -extern int libcdsb_map_find_pointer(vtype_map* x, const void* key, void* data, map_access_callback, _Bool cut); -extern int libcdsb_map_find_cstring(vtype_map* x, const char* key, void* data, map_access_callback, _Bool cut); -extern int libcdsb_map_find_string (vtype_map* x, const vtype_string* key, void* data, map_access_callback, _Bool cut); -extern int libcdsb_map_find_array (vtype_map* x, const vtype_array* key, void* data, map_access_callback, _Bool cut); -extern int libcdsb_map_find_list (vtype_map* x, const vtype_list* key, void* data, map_access_callback, _Bool cut); -extern int libcdsb_map_find_map (vtype_map* x, const vtype_map* key, void* data, map_access_callback, _Bool cut); -extern int libcdsb_map_find_vset (vtype_map* x, const vtype_set* key, void* data, map_access_callback, _Bool cut); -extern int libcdsb_map_find_boolean(vtype_map* x, vtype_bool key, void* data, map_access_callback, _Bool cut); -extern int libcdsb_map_find_int8 (vtype_map* x, vtype_int8 key, void* data, map_access_callback, _Bool cut); -extern int libcdsb_map_find_int16 (vtype_map* x, vtype_int16 key, void* data, map_access_callback, _Bool cut); -extern int libcdsb_map_find_int32 (vtype_map* x, vtype_int32 key, void* data, map_access_callback, _Bool cut); -extern int libcdsb_map_find_int64 (vtype_map* x, vtype_int64 key, void* data, map_access_callback, _Bool cut); -extern int libcdsb_map_find_uint8 (vtype_map* x, vtype_uint8 key, void* data, map_access_callback, _Bool cut); -extern int libcdsb_map_find_uint16 (vtype_map* x, vtype_uint16 key, void* data, map_access_callback, _Bool cut); -extern int libcdsb_map_find_uint32 (vtype_map* x, vtype_uint32 key, void* data, map_access_callback, _Bool cut); -extern int libcdsb_map_find_uint64 (vtype_map* x, vtype_uint64 key, void* data, map_access_callback, _Bool cut); -extern int libcdsb_map_find_float (vtype_map* x, vtype_float key, void* data, map_access_callback, _Bool cut); -extern int libcdsb_map_find_double (vtype_map* x, vtype_double key, void* data, map_access_callback, _Bool cut); -extern int libcdsb_map_find_ldouble(vtype_map* x, vtype_ldouble key, void* data, map_access_callback, _Bool cut); +extern int libcdsb_map_find_pointer(vtype_map* x, const void* key, void* data, map_access_callback, bool cut); +extern int libcdsb_map_find_cstring(vtype_map* x, const char* key, void* data, map_access_callback, bool cut); +extern int libcdsb_map_find_string (vtype_map* x, const vtype_string* key, void* data, map_access_callback, bool cut); +extern int libcdsb_map_find_array (vtype_map* x, const vtype_array* key, void* data, map_access_callback, bool cut); +extern int libcdsb_map_find_list (vtype_map* x, const vtype_list* key, void* data, map_access_callback, bool cut); +extern int libcdsb_map_find_map (vtype_map* x, const vtype_map* key, void* data, map_access_callback, bool cut); +extern int libcdsb_map_find_vset (vtype_map* x, const vtype_set* key, void* data, map_access_callback, bool cut); +extern int libcdsb_map_find_boolean(vtype_map* x, vtype_bool key, void* data, map_access_callback, bool cut); +extern int libcdsb_map_find_int8 (vtype_map* x, vtype_int8 key, void* data, map_access_callback, bool cut); +extern int libcdsb_map_find_int16 (vtype_map* x, vtype_int16 key, void* data, map_access_callback, bool cut); +extern int libcdsb_map_find_int32 (vtype_map* x, vtype_int32 key, void* data, map_access_callback, bool cut); +extern int libcdsb_map_find_int64 (vtype_map* x, vtype_int64 key, void* data, map_access_callback, bool cut); +extern int libcdsb_map_find_uint8 (vtype_map* x, vtype_uint8 key, void* data, map_access_callback, bool cut); +extern int libcdsb_map_find_uint16 (vtype_map* x, vtype_uint16 key, void* data, map_access_callback, bool cut); +extern int libcdsb_map_find_uint32 (vtype_map* x, vtype_uint32 key, void* data, map_access_callback, bool cut); +extern int libcdsb_map_find_uint64 (vtype_map* x, vtype_uint64 key, void* data, map_access_callback, bool cut); +extern int libcdsb_map_find_float (vtype_map* x, vtype_float key, void* data, map_access_callback, bool cut); +extern int libcdsb_map_find_double (vtype_map* x, vtype_double key, void* data, map_access_callback, bool cut); +extern int libcdsb_map_find_ldouble(vtype_map* x, vtype_ldouble key, void* data, map_access_callback, bool cut); -extern _Bool libcdsb_map_update_pointer_pointer(vtype_map* x, const void* key, const void* value); -extern _Bool libcdsb_map_update_pointer_cstring(vtype_map* x, const void* key, const char* value); -extern _Bool libcdsb_map_update_pointer_string (vtype_map* x, const void* key, const vtype_string* value); -extern _Bool libcdsb_map_update_pointer_array (vtype_map* x, const void* key, const vtype_array* value); -extern _Bool libcdsb_map_update_pointer_list (vtype_map* x, const void* key, const vtype_list* value); -extern _Bool libcdsb_map_update_pointer_map (vtype_map* x, const void* key, const vtype_map* value); -extern _Bool libcdsb_map_update_pointer_vset (vtype_map* x, const void* key, const vtype_set* value); -extern _Bool libcdsb_map_update_pointer_boolean(vtype_map* x, const void* key, vtype_bool value); -extern _Bool libcdsb_map_update_pointer_int8 (vtype_map* x, const void* key, vtype_int8 value); -extern _Bool libcdsb_map_update_pointer_int16 (vtype_map* x, const void* key, vtype_int16 value); -extern _Bool libcdsb_map_update_pointer_int32 (vtype_map* x, const void* key, vtype_int32 value); -extern _Bool libcdsb_map_update_pointer_int64 (vtype_map* x, const void* key, vtype_int64 value); -extern _Bool libcdsb_map_update_pointer_uint8 (vtype_map* x, const void* key, vtype_uint8 value); -extern _Bool libcdsb_map_update_pointer_uint16 (vtype_map* x, const void* key, vtype_uint16 value); -extern _Bool libcdsb_map_update_pointer_uint32 (vtype_map* x, const void* key, vtype_uint32 value); -extern _Bool libcdsb_map_update_pointer_uint64 (vtype_map* x, const void* key, vtype_uint64 value); -extern _Bool libcdsb_map_update_pointer_float (vtype_map* x, const void* key, vtype_float value); -extern _Bool libcdsb_map_update_pointer_double (vtype_map* x, const void* key, vtype_double value); -extern _Bool libcdsb_map_update_pointer_ldouble(vtype_map* x, const void* key, vtype_ldouble value); +extern bool libcdsb_map_update_pointer_pointer(vtype_map* x, const void* key, const void* value); +extern bool libcdsb_map_update_pointer_cstring(vtype_map* x, const void* key, const char* value); +extern bool libcdsb_map_update_pointer_string (vtype_map* x, const void* key, const vtype_string* value); +extern bool libcdsb_map_update_pointer_array (vtype_map* x, const void* key, const vtype_array* value); +extern bool libcdsb_map_update_pointer_list (vtype_map* x, const void* key, const vtype_list* value); +extern bool libcdsb_map_update_pointer_map (vtype_map* x, const void* key, const vtype_map* value); +extern bool libcdsb_map_update_pointer_vset (vtype_map* x, const void* key, const vtype_set* value); +extern bool libcdsb_map_update_pointer_boolean(vtype_map* x, const void* key, vtype_bool value); +extern bool libcdsb_map_update_pointer_int8 (vtype_map* x, const void* key, vtype_int8 value); +extern bool libcdsb_map_update_pointer_int16 (vtype_map* x, const void* key, vtype_int16 value); +extern bool libcdsb_map_update_pointer_int32 (vtype_map* x, const void* key, vtype_int32 value); +extern bool libcdsb_map_update_pointer_int64 (vtype_map* x, const void* key, vtype_int64 value); +extern bool libcdsb_map_update_pointer_uint8 (vtype_map* x, const void* key, vtype_uint8 value); +extern bool libcdsb_map_update_pointer_uint16 (vtype_map* x, const void* key, vtype_uint16 value); +extern bool libcdsb_map_update_pointer_uint32 (vtype_map* x, const void* key, vtype_uint32 value); +extern bool libcdsb_map_update_pointer_uint64 (vtype_map* x, const void* key, vtype_uint64 value); +extern bool libcdsb_map_update_pointer_float (vtype_map* x, const void* key, vtype_float value); +extern bool libcdsb_map_update_pointer_double (vtype_map* x, const void* key, vtype_double value); +extern bool libcdsb_map_update_pointer_ldouble(vtype_map* x, const void* key, vtype_ldouble value); -extern _Bool libcdsb_map_update_string_pointer(vtype_map* x, const vtype_string* key, const void* value); -extern _Bool libcdsb_map_update_string_cstring(vtype_map* x, const vtype_string* key, const char* value); -extern _Bool libcdsb_map_update_string_string (vtype_map* x, const vtype_string* key, const vtype_string* value); -extern _Bool libcdsb_map_update_string_array (vtype_map* x, const vtype_string* key, const vtype_array* value); -extern _Bool libcdsb_map_update_string_list (vtype_map* x, const vtype_string* key, const vtype_list* value); -extern _Bool libcdsb_map_update_string_map (vtype_map* x, const vtype_string* key, const vtype_map* value); -extern _Bool libcdsb_map_update_string_vset (vtype_map* x, const vtype_string* key, const vtype_set* value); -extern _Bool libcdsb_map_update_string_boolean(vtype_map* x, const vtype_string* key, vtype_bool value); -extern _Bool libcdsb_map_update_string_int8 (vtype_map* x, const vtype_string* key, vtype_int8 value); -extern _Bool libcdsb_map_update_string_int16 (vtype_map* x, const vtype_string* key, vtype_int16 value); -extern _Bool libcdsb_map_update_string_int32 (vtype_map* x, const vtype_string* key, vtype_int32 value); -extern _Bool libcdsb_map_update_string_int64 (vtype_map* x, const vtype_string* key, vtype_int64 value); -extern _Bool libcdsb_map_update_string_uint8 (vtype_map* x, const vtype_string* key, vtype_uint8 value); -extern _Bool libcdsb_map_update_string_uint16 (vtype_map* x, const vtype_string* key, vtype_uint16 value); -extern _Bool libcdsb_map_update_string_uint32 (vtype_map* x, const vtype_string* key, vtype_uint32 value); -extern _Bool libcdsb_map_update_string_uint64 (vtype_map* x, const vtype_string* key, vtype_uint64 value); -extern _Bool libcdsb_map_update_string_float (vtype_map* x, const vtype_string* key, vtype_float value); -extern _Bool libcdsb_map_update_string_double (vtype_map* x, const vtype_string* key, vtype_double value); -extern _Bool libcdsb_map_update_string_ldouble(vtype_map* x, const vtype_string* key, vtype_ldouble value); +extern bool libcdsb_map_update_string_pointer(vtype_map* x, const vtype_string* key, const void* value); +extern bool libcdsb_map_update_string_cstring(vtype_map* x, const vtype_string* key, const char* value); +extern bool libcdsb_map_update_string_string (vtype_map* x, const vtype_string* key, const vtype_string* value); +extern bool libcdsb_map_update_string_array (vtype_map* x, const vtype_string* key, const vtype_array* value); +extern bool libcdsb_map_update_string_list (vtype_map* x, const vtype_string* key, const vtype_list* value); +extern bool libcdsb_map_update_string_map (vtype_map* x, const vtype_string* key, const vtype_map* value); +extern bool libcdsb_map_update_string_vset (vtype_map* x, const vtype_string* key, const vtype_set* value); +extern bool libcdsb_map_update_string_boolean(vtype_map* x, const vtype_string* key, vtype_bool value); +extern bool libcdsb_map_update_string_int8 (vtype_map* x, const vtype_string* key, vtype_int8 value); +extern bool libcdsb_map_update_string_int16 (vtype_map* x, const vtype_string* key, vtype_int16 value); +extern bool libcdsb_map_update_string_int32 (vtype_map* x, const vtype_string* key, vtype_int32 value); +extern bool libcdsb_map_update_string_int64 (vtype_map* x, const vtype_string* key, vtype_int64 value); +extern bool libcdsb_map_update_string_uint8 (vtype_map* x, const vtype_string* key, vtype_uint8 value); +extern bool libcdsb_map_update_string_uint16 (vtype_map* x, const vtype_string* key, vtype_uint16 value); +extern bool libcdsb_map_update_string_uint32 (vtype_map* x, const vtype_string* key, vtype_uint32 value); +extern bool libcdsb_map_update_string_uint64 (vtype_map* x, const vtype_string* key, vtype_uint64 value); +extern bool libcdsb_map_update_string_float (vtype_map* x, const vtype_string* key, vtype_float value); +extern bool libcdsb_map_update_string_double (vtype_map* x, const vtype_string* key, vtype_double value); +extern bool libcdsb_map_update_string_ldouble(vtype_map* x, const vtype_string* key, vtype_ldouble value); -extern _Bool libcdsb_map_update_array_pointer(vtype_map* x, const vtype_array* key, const void* value); -extern _Bool libcdsb_map_update_array_cstring(vtype_map* x, const vtype_array* key, const char* value); -extern _Bool libcdsb_map_update_array_string (vtype_map* x, const vtype_array* key, const vtype_string* value); -extern _Bool libcdsb_map_update_array_array (vtype_map* x, const vtype_array* key, const vtype_array* value); -extern _Bool libcdsb_map_update_array_list (vtype_map* x, const vtype_array* key, const vtype_list* value); -extern _Bool libcdsb_map_update_array_map (vtype_map* x, const vtype_array* key, const vtype_map* value); -extern _Bool libcdsb_map_update_array_vset (vtype_map* x, const vtype_array* key, const vtype_set* value); -extern _Bool libcdsb_map_update_array_boolean(vtype_map* x, const vtype_array* key, vtype_bool value); -extern _Bool libcdsb_map_update_array_int8 (vtype_map* x, const vtype_array* key, vtype_int8 value); -extern _Bool libcdsb_map_update_array_int16 (vtype_map* x, const vtype_array* key, vtype_int16 value); -extern _Bool libcdsb_map_update_array_int32 (vtype_map* x, const vtype_array* key, vtype_int32 value); -extern _Bool libcdsb_map_update_array_int64 (vtype_map* x, const vtype_array* key, vtype_int64 value); -extern _Bool libcdsb_map_update_array_uint8 (vtype_map* x, const vtype_array* key, vtype_uint8 value); -extern _Bool libcdsb_map_update_array_uint16 (vtype_map* x, const vtype_array* key, vtype_uint16 value); -extern _Bool libcdsb_map_update_array_uint32 (vtype_map* x, const vtype_array* key, vtype_uint32 value); -extern _Bool libcdsb_map_update_array_uint64 (vtype_map* x, const vtype_array* key, vtype_uint64 value); -extern _Bool libcdsb_map_update_array_float (vtype_map* x, const vtype_array* key, vtype_float value); -extern _Bool libcdsb_map_update_array_double (vtype_map* x, const vtype_array* key, vtype_double value); -extern _Bool libcdsb_map_update_array_ldouble(vtype_map* x, const vtype_array* key, vtype_ldouble value); +extern bool libcdsb_map_update_array_pointer(vtype_map* x, const vtype_array* key, const void* value); +extern bool libcdsb_map_update_array_cstring(vtype_map* x, const vtype_array* key, const char* value); +extern bool libcdsb_map_update_array_string (vtype_map* x, const vtype_array* key, const vtype_string* value); +extern bool libcdsb_map_update_array_array (vtype_map* x, const vtype_array* key, const vtype_array* value); +extern bool libcdsb_map_update_array_list (vtype_map* x, const vtype_array* key, const vtype_list* value); +extern bool libcdsb_map_update_array_map (vtype_map* x, const vtype_array* key, const vtype_map* value); +extern bool libcdsb_map_update_array_vset (vtype_map* x, const vtype_array* key, const vtype_set* value); +extern bool libcdsb_map_update_array_boolean(vtype_map* x, const vtype_array* key, vtype_bool value); +extern bool libcdsb_map_update_array_int8 (vtype_map* x, const vtype_array* key, vtype_int8 value); +extern bool libcdsb_map_update_array_int16 (vtype_map* x, const vtype_array* key, vtype_int16 value); +extern bool libcdsb_map_update_array_int32 (vtype_map* x, const vtype_array* key, vtype_int32 value); +extern bool libcdsb_map_update_array_int64 (vtype_map* x, const vtype_array* key, vtype_int64 value); +extern bool libcdsb_map_update_array_uint8 (vtype_map* x, const vtype_array* key, vtype_uint8 value); +extern bool libcdsb_map_update_array_uint16 (vtype_map* x, const vtype_array* key, vtype_uint16 value); +extern bool libcdsb_map_update_array_uint32 (vtype_map* x, const vtype_array* key, vtype_uint32 value); +extern bool libcdsb_map_update_array_uint64 (vtype_map* x, const vtype_array* key, vtype_uint64 value); +extern bool libcdsb_map_update_array_float (vtype_map* x, const vtype_array* key, vtype_float value); +extern bool libcdsb_map_update_array_double (vtype_map* x, const vtype_array* key, vtype_double value); +extern bool libcdsb_map_update_array_ldouble(vtype_map* x, const vtype_array* key, vtype_ldouble value); -extern _Bool libcdsb_map_update_list_pointer(vtype_map* x, const vtype_list* key, const void* value); -extern _Bool libcdsb_map_update_list_cstring(vtype_map* x, const vtype_list* key, const char* value); -extern _Bool libcdsb_map_update_list_string (vtype_map* x, const vtype_list* key, const vtype_string* value); -extern _Bool libcdsb_map_update_list_array (vtype_map* x, const vtype_list* key, const vtype_array* value); -extern _Bool libcdsb_map_update_list_list (vtype_map* x, const vtype_list* key, const vtype_list* value); -extern _Bool libcdsb_map_update_list_map (vtype_map* x, const vtype_list* key, const vtype_map* value); -extern _Bool libcdsb_map_update_list_vset (vtype_map* x, const vtype_list* key, const vtype_set* value); -extern _Bool libcdsb_map_update_list_boolean(vtype_map* x, const vtype_list* key, vtype_bool value); -extern _Bool libcdsb_map_update_list_int8 (vtype_map* x, const vtype_list* key, vtype_int8 value); -extern _Bool libcdsb_map_update_list_int16 (vtype_map* x, const vtype_list* key, vtype_int16 value); -extern _Bool libcdsb_map_update_list_int32 (vtype_map* x, const vtype_list* key, vtype_int32 value); -extern _Bool libcdsb_map_update_list_int64 (vtype_map* x, const vtype_list* key, vtype_int64 value); -extern _Bool libcdsb_map_update_list_uint8 (vtype_map* x, const vtype_list* key, vtype_uint8 value); -extern _Bool libcdsb_map_update_list_uint16 (vtype_map* x, const vtype_list* key, vtype_uint16 value); -extern _Bool libcdsb_map_update_list_uint32 (vtype_map* x, const vtype_list* key, vtype_uint32 value); -extern _Bool libcdsb_map_update_list_uint64 (vtype_map* x, const vtype_list* key, vtype_uint64 value); -extern _Bool libcdsb_map_update_list_float (vtype_map* x, const vtype_list* key, vtype_float value); -extern _Bool libcdsb_map_update_list_double (vtype_map* x, const vtype_list* key, vtype_double value); -extern _Bool libcdsb_map_update_list_ldouble(vtype_map* x, const vtype_list* key, vtype_ldouble value); +extern bool libcdsb_map_update_list_pointer(vtype_map* x, const vtype_list* key, const void* value); +extern bool libcdsb_map_update_list_cstring(vtype_map* x, const vtype_list* key, const char* value); +extern bool libcdsb_map_update_list_string (vtype_map* x, const vtype_list* key, const vtype_string* value); +extern bool libcdsb_map_update_list_array (vtype_map* x, const vtype_list* key, const vtype_array* value); +extern bool libcdsb_map_update_list_list (vtype_map* x, const vtype_list* key, const vtype_list* value); +extern bool libcdsb_map_update_list_map (vtype_map* x, const vtype_list* key, const vtype_map* value); +extern bool libcdsb_map_update_list_vset (vtype_map* x, const vtype_list* key, const vtype_set* value); +extern bool libcdsb_map_update_list_boolean(vtype_map* x, const vtype_list* key, vtype_bool value); +extern bool libcdsb_map_update_list_int8 (vtype_map* x, const vtype_list* key, vtype_int8 value); +extern bool libcdsb_map_update_list_int16 (vtype_map* x, const vtype_list* key, vtype_int16 value); +extern bool libcdsb_map_update_list_int32 (vtype_map* x, const vtype_list* key, vtype_int32 value); +extern bool libcdsb_map_update_list_int64 (vtype_map* x, const vtype_list* key, vtype_int64 value); +extern bool libcdsb_map_update_list_uint8 (vtype_map* x, const vtype_list* key, vtype_uint8 value); +extern bool libcdsb_map_update_list_uint16 (vtype_map* x, const vtype_list* key, vtype_uint16 value); +extern bool libcdsb_map_update_list_uint32 (vtype_map* x, const vtype_list* key, vtype_uint32 value); +extern bool libcdsb_map_update_list_uint64 (vtype_map* x, const vtype_list* key, vtype_uint64 value); +extern bool libcdsb_map_update_list_float (vtype_map* x, const vtype_list* key, vtype_float value); +extern bool libcdsb_map_update_list_double (vtype_map* x, const vtype_list* key, vtype_double value); +extern bool libcdsb_map_update_list_ldouble(vtype_map* x, const vtype_list* key, vtype_ldouble value); -extern _Bool libcdsb_map_update_map_pointer(vtype_map* x, const vtype_map* key, const void* value); -extern _Bool libcdsb_map_update_map_cstring(vtype_map* x, const vtype_map* key, const char* value); -extern _Bool libcdsb_map_update_map_string (vtype_map* x, const vtype_map* key, const vtype_string* value); -extern _Bool libcdsb_map_update_map_array (vtype_map* x, const vtype_map* key, const vtype_array* value); -extern _Bool libcdsb_map_update_map_list (vtype_map* x, const vtype_map* key, const vtype_list* value); -extern _Bool libcdsb_map_update_map_map (vtype_map* x, const vtype_map* key, const vtype_map* value); -extern _Bool libcdsb_map_update_map_vset (vtype_map* x, const vtype_map* key, const vtype_set* value); -extern _Bool libcdsb_map_update_map_boolean(vtype_map* x, const vtype_map* key, vtype_bool value); -extern _Bool libcdsb_map_update_map_int8 (vtype_map* x, const vtype_map* key, vtype_int8 value); -extern _Bool libcdsb_map_update_map_int16 (vtype_map* x, const vtype_map* key, vtype_int16 value); -extern _Bool libcdsb_map_update_map_int32 (vtype_map* x, const vtype_map* key, vtype_int32 value); -extern _Bool libcdsb_map_update_map_int64 (vtype_map* x, const vtype_map* key, vtype_int64 value); -extern _Bool libcdsb_map_update_map_uint8 (vtype_map* x, const vtype_map* key, vtype_uint8 value); -extern _Bool libcdsb_map_update_map_uint16 (vtype_map* x, const vtype_map* key, vtype_uint16 value); -extern _Bool libcdsb_map_update_map_uint32 (vtype_map* x, const vtype_map* key, vtype_uint32 value); -extern _Bool libcdsb_map_update_map_uint64 (vtype_map* x, const vtype_map* key, vtype_uint64 value); -extern _Bool libcdsb_map_update_map_float (vtype_map* x, const vtype_map* key, vtype_float value); -extern _Bool libcdsb_map_update_map_double (vtype_map* x, const vtype_map* key, vtype_double value); -extern _Bool libcdsb_map_update_map_ldouble(vtype_map* x, const vtype_map* key, vtype_ldouble value); +extern bool libcdsb_map_update_map_pointer(vtype_map* x, const vtype_map* key, const void* value); +extern bool libcdsb_map_update_map_cstring(vtype_map* x, const vtype_map* key, const char* value); +extern bool libcdsb_map_update_map_string (vtype_map* x, const vtype_map* key, const vtype_string* value); +extern bool libcdsb_map_update_map_array (vtype_map* x, const vtype_map* key, const vtype_array* value); +extern bool libcdsb_map_update_map_list (vtype_map* x, const vtype_map* key, const vtype_list* value); +extern bool libcdsb_map_update_map_map (vtype_map* x, const vtype_map* key, const vtype_map* value); +extern bool libcdsb_map_update_map_vset (vtype_map* x, const vtype_map* key, const vtype_set* value); +extern bool libcdsb_map_update_map_boolean(vtype_map* x, const vtype_map* key, vtype_bool value); +extern bool libcdsb_map_update_map_int8 (vtype_map* x, const vtype_map* key, vtype_int8 value); +extern bool libcdsb_map_update_map_int16 (vtype_map* x, const vtype_map* key, vtype_int16 value); +extern bool libcdsb_map_update_map_int32 (vtype_map* x, const vtype_map* key, vtype_int32 value); +extern bool libcdsb_map_update_map_int64 (vtype_map* x, const vtype_map* key, vtype_int64 value); +extern bool libcdsb_map_update_map_uint8 (vtype_map* x, const vtype_map* key, vtype_uint8 value); +extern bool libcdsb_map_update_map_uint16 (vtype_map* x, const vtype_map* key, vtype_uint16 value); +extern bool libcdsb_map_update_map_uint32 (vtype_map* x, const vtype_map* key, vtype_uint32 value); +extern bool libcdsb_map_update_map_uint64 (vtype_map* x, const vtype_map* key, vtype_uint64 value); +extern bool libcdsb_map_update_map_float (vtype_map* x, const vtype_map* key, vtype_float value); +extern bool libcdsb_map_update_map_double (vtype_map* x, const vtype_map* key, vtype_double value); +extern bool libcdsb_map_update_map_ldouble(vtype_map* x, const vtype_map* key, vtype_ldouble value); -extern _Bool libcdsb_map_update_vset_pointer(vtype_map* x, const vtype_set* key, const void* value); -extern _Bool libcdsb_map_update_vset_cstring(vtype_map* x, const vtype_set* key, const char* value); -extern _Bool libcdsb_map_update_vset_string (vtype_map* x, const vtype_set* key, const vtype_string* value); -extern _Bool libcdsb_map_update_vset_array (vtype_map* x, const vtype_set* key, const vtype_array* value); -extern _Bool libcdsb_map_update_vset_list (vtype_map* x, const vtype_set* key, const vtype_list* value); -extern _Bool libcdsb_map_update_vset_map (vtype_map* x, const vtype_set* key, const vtype_map* value); -extern _Bool libcdsb_map_update_vset_vset (vtype_map* x, const vtype_set* key, const vtype_set* value); -extern _Bool libcdsb_map_update_vset_boolean(vtype_map* x, const vtype_set* key, vtype_bool value); -extern _Bool libcdsb_map_update_vset_int8 (vtype_map* x, const vtype_set* key, vtype_int8 value); -extern _Bool libcdsb_map_update_vset_int16 (vtype_map* x, const vtype_set* key, vtype_int16 value); -extern _Bool libcdsb_map_update_vset_int32 (vtype_map* x, const vtype_set* key, vtype_int32 value); -extern _Bool libcdsb_map_update_vset_int64 (vtype_map* x, const vtype_set* key, vtype_int64 value); -extern _Bool libcdsb_map_update_vset_uint8 (vtype_map* x, const vtype_set* key, vtype_uint8 value); -extern _Bool libcdsb_map_update_vset_uint16 (vtype_map* x, const vtype_set* key, vtype_uint16 value); -extern _Bool libcdsb_map_update_vset_uint32 (vtype_map* x, const vtype_set* key, vtype_uint32 value); -extern _Bool libcdsb_map_update_vset_uint64 (vtype_map* x, const vtype_set* key, vtype_uint64 value); -extern _Bool libcdsb_map_update_vset_float (vtype_map* x, const vtype_set* key, vtype_float value); -extern _Bool libcdsb_map_update_vset_double (vtype_map* x, const vtype_set* key, vtype_double value); -extern _Bool libcdsb_map_update_vset_ldouble(vtype_map* x, const vtype_set* key, vtype_ldouble value); +extern bool libcdsb_map_update_vset_pointer(vtype_map* x, const vtype_set* key, const void* value); +extern bool libcdsb_map_update_vset_cstring(vtype_map* x, const vtype_set* key, const char* value); +extern bool libcdsb_map_update_vset_string (vtype_map* x, const vtype_set* key, const vtype_string* value); +extern bool libcdsb_map_update_vset_array (vtype_map* x, const vtype_set* key, const vtype_array* value); +extern bool libcdsb_map_update_vset_list (vtype_map* x, const vtype_set* key, const vtype_list* value); +extern bool libcdsb_map_update_vset_map (vtype_map* x, const vtype_set* key, const vtype_map* value); +extern bool libcdsb_map_update_vset_vset (vtype_map* x, const vtype_set* key, const vtype_set* value); +extern bool libcdsb_map_update_vset_boolean(vtype_map* x, const vtype_set* key, vtype_bool value); +extern bool libcdsb_map_update_vset_int8 (vtype_map* x, const vtype_set* key, vtype_int8 value); +extern bool libcdsb_map_update_vset_int16 (vtype_map* x, const vtype_set* key, vtype_int16 value); +extern bool libcdsb_map_update_vset_int32 (vtype_map* x, const vtype_set* key, vtype_int32 value); +extern bool libcdsb_map_update_vset_int64 (vtype_map* x, const vtype_set* key, vtype_int64 value); +extern bool libcdsb_map_update_vset_uint8 (vtype_map* x, const vtype_set* key, vtype_uint8 value); +extern bool libcdsb_map_update_vset_uint16 (vtype_map* x, const vtype_set* key, vtype_uint16 value); +extern bool libcdsb_map_update_vset_uint32 (vtype_map* x, const vtype_set* key, vtype_uint32 value); +extern bool libcdsb_map_update_vset_uint64 (vtype_map* x, const vtype_set* key, vtype_uint64 value); +extern bool libcdsb_map_update_vset_float (vtype_map* x, const vtype_set* key, vtype_float value); +extern bool libcdsb_map_update_vset_double (vtype_map* x, const vtype_set* key, vtype_double value); +extern bool libcdsb_map_update_vset_ldouble(vtype_map* x, const vtype_set* key, vtype_ldouble value); -extern _Bool libcdsb_map_update_cstring_pointer(vtype_map* x, const char* key, const void* value); -extern _Bool libcdsb_map_update_cstring_cstring(vtype_map* x, const char* key, const char* value); -extern _Bool libcdsb_map_update_cstring_string (vtype_map* x, const char* key, const vtype_string* value); -extern _Bool libcdsb_map_update_cstring_array (vtype_map* x, const char* key, const vtype_array* value); -extern _Bool libcdsb_map_update_cstring_list (vtype_map* x, const char* key, const vtype_list* value); -extern _Bool libcdsb_map_update_cstring_map (vtype_map* x, const char* key, const vtype_map* value); -extern _Bool libcdsb_map_update_cstring_vset (vtype_map* x, const char* key, const vtype_set* value); -extern _Bool libcdsb_map_update_cstring_boolean(vtype_map* x, const char* key, vtype_bool value); -extern _Bool libcdsb_map_update_cstring_int8 (vtype_map* x, const char* key, vtype_int8 value); -extern _Bool libcdsb_map_update_cstring_int16 (vtype_map* x, const char* key, vtype_int16 value); -extern _Bool libcdsb_map_update_cstring_int32 (vtype_map* x, const char* key, vtype_int32 value); -extern _Bool libcdsb_map_update_cstring_int64 (vtype_map* x, const char* key, vtype_int64 value); -extern _Bool libcdsb_map_update_cstring_uint8 (vtype_map* x, const char* key, vtype_uint8 value); -extern _Bool libcdsb_map_update_cstring_uint16 (vtype_map* x, const char* key, vtype_uint16 value); -extern _Bool libcdsb_map_update_cstring_uint32 (vtype_map* x, const char* key, vtype_uint32 value); -extern _Bool libcdsb_map_update_cstring_uint64 (vtype_map* x, const char* key, vtype_uint64 value); -extern _Bool libcdsb_map_update_cstring_float (vtype_map* x, const char* key, vtype_float value); -extern _Bool libcdsb_map_update_cstring_double (vtype_map* x, const char* key, vtype_double value); -extern _Bool libcdsb_map_update_cstring_ldouble(vtype_map* x, const char* key, vtype_ldouble value); +extern bool libcdsb_map_update_cstring_pointer(vtype_map* x, const char* key, const void* value); +extern bool libcdsb_map_update_cstring_cstring(vtype_map* x, const char* key, const char* value); +extern bool libcdsb_map_update_cstring_string (vtype_map* x, const char* key, const vtype_string* value); +extern bool libcdsb_map_update_cstring_array (vtype_map* x, const char* key, const vtype_array* value); +extern bool libcdsb_map_update_cstring_list (vtype_map* x, const char* key, const vtype_list* value); +extern bool libcdsb_map_update_cstring_map (vtype_map* x, const char* key, const vtype_map* value); +extern bool libcdsb_map_update_cstring_vset (vtype_map* x, const char* key, const vtype_set* value); +extern bool libcdsb_map_update_cstring_boolean(vtype_map* x, const char* key, vtype_bool value); +extern bool libcdsb_map_update_cstring_int8 (vtype_map* x, const char* key, vtype_int8 value); +extern bool libcdsb_map_update_cstring_int16 (vtype_map* x, const char* key, vtype_int16 value); +extern bool libcdsb_map_update_cstring_int32 (vtype_map* x, const char* key, vtype_int32 value); +extern bool libcdsb_map_update_cstring_int64 (vtype_map* x, const char* key, vtype_int64 value); +extern bool libcdsb_map_update_cstring_uint8 (vtype_map* x, const char* key, vtype_uint8 value); +extern bool libcdsb_map_update_cstring_uint16 (vtype_map* x, const char* key, vtype_uint16 value); +extern bool libcdsb_map_update_cstring_uint32 (vtype_map* x, const char* key, vtype_uint32 value); +extern bool libcdsb_map_update_cstring_uint64 (vtype_map* x, const char* key, vtype_uint64 value); +extern bool libcdsb_map_update_cstring_float (vtype_map* x, const char* key, vtype_float value); +extern bool libcdsb_map_update_cstring_double (vtype_map* x, const char* key, vtype_double value); +extern bool libcdsb_map_update_cstring_ldouble(vtype_map* x, const char* key, vtype_ldouble value); -extern _Bool libcdsb_map_update_boolean_pointer(vtype_map* x, vtype_bool key, const void* value); -extern _Bool libcdsb_map_update_boolean_cstring(vtype_map* x, vtype_bool key, const char* value); -extern _Bool libcdsb_map_update_boolean_string (vtype_map* x, vtype_bool key, const vtype_string* value); -extern _Bool libcdsb_map_update_boolean_array (vtype_map* x, vtype_bool key, const vtype_array* value); -extern _Bool libcdsb_map_update_boolean_list (vtype_map* x, vtype_bool key, const vtype_list* value); -extern _Bool libcdsb_map_update_boolean_map (vtype_map* x, vtype_bool key, const vtype_map* value); -extern _Bool libcdsb_map_update_boolean_vset (vtype_map* x, vtype_bool key, const vtype_set* value); -extern _Bool libcdsb_map_update_boolean_boolean(vtype_map* x, vtype_bool key, vtype_bool value); -extern _Bool libcdsb_map_update_boolean_int8 (vtype_map* x, vtype_bool key, vtype_int8 value); -extern _Bool libcdsb_map_update_boolean_int16 (vtype_map* x, vtype_bool key, vtype_int16 value); -extern _Bool libcdsb_map_update_boolean_int32 (vtype_map* x, vtype_bool key, vtype_int32 value); -extern _Bool libcdsb_map_update_boolean_int64 (vtype_map* x, vtype_bool key, vtype_int64 value); -extern _Bool libcdsb_map_update_boolean_uint8 (vtype_map* x, vtype_bool key, vtype_uint8 value); -extern _Bool libcdsb_map_update_boolean_uint16 (vtype_map* x, vtype_bool key, vtype_uint16 value); -extern _Bool libcdsb_map_update_boolean_uint32 (vtype_map* x, vtype_bool key, vtype_uint32 value); -extern _Bool libcdsb_map_update_boolean_uint64 (vtype_map* x, vtype_bool key, vtype_uint64 value); -extern _Bool libcdsb_map_update_boolean_float (vtype_map* x, vtype_bool key, vtype_float value); -extern _Bool libcdsb_map_update_boolean_double (vtype_map* x, vtype_bool key, vtype_double value); -extern _Bool libcdsb_map_update_boolean_ldouble(vtype_map* x, vtype_bool key, vtype_ldouble value); +extern bool libcdsb_map_update_boolean_pointer(vtype_map* x, vtype_bool key, const void* value); +extern bool libcdsb_map_update_boolean_cstring(vtype_map* x, vtype_bool key, const char* value); +extern bool libcdsb_map_update_boolean_string (vtype_map* x, vtype_bool key, const vtype_string* value); +extern bool libcdsb_map_update_boolean_array (vtype_map* x, vtype_bool key, const vtype_array* value); +extern bool libcdsb_map_update_boolean_list (vtype_map* x, vtype_bool key, const vtype_list* value); +extern bool libcdsb_map_update_boolean_map (vtype_map* x, vtype_bool key, const vtype_map* value); +extern bool libcdsb_map_update_boolean_vset (vtype_map* x, vtype_bool key, const vtype_set* value); +extern bool libcdsb_map_update_boolean_boolean(vtype_map* x, vtype_bool key, vtype_bool value); +extern bool libcdsb_map_update_boolean_int8 (vtype_map* x, vtype_bool key, vtype_int8 value); +extern bool libcdsb_map_update_boolean_int16 (vtype_map* x, vtype_bool key, vtype_int16 value); +extern bool libcdsb_map_update_boolean_int32 (vtype_map* x, vtype_bool key, vtype_int32 value); +extern bool libcdsb_map_update_boolean_int64 (vtype_map* x, vtype_bool key, vtype_int64 value); +extern bool libcdsb_map_update_boolean_uint8 (vtype_map* x, vtype_bool key, vtype_uint8 value); +extern bool libcdsb_map_update_boolean_uint16 (vtype_map* x, vtype_bool key, vtype_uint16 value); +extern bool libcdsb_map_update_boolean_uint32 (vtype_map* x, vtype_bool key, vtype_uint32 value); +extern bool libcdsb_map_update_boolean_uint64 (vtype_map* x, vtype_bool key, vtype_uint64 value); +extern bool libcdsb_map_update_boolean_float (vtype_map* x, vtype_bool key, vtype_float value); +extern bool libcdsb_map_update_boolean_double (vtype_map* x, vtype_bool key, vtype_double value); +extern bool libcdsb_map_update_boolean_ldouble(vtype_map* x, vtype_bool key, vtype_ldouble value); -extern _Bool libcdsb_map_update_uint8_pointer(vtype_map* x, vtype_uint8 key, const void* value); -extern _Bool libcdsb_map_update_uint8_cstring(vtype_map* x, vtype_uint8 key, const char* value); -extern _Bool libcdsb_map_update_uint8_string (vtype_map* x, vtype_uint8 key, const vtype_string* value); -extern _Bool libcdsb_map_update_uint8_array (vtype_map* x, vtype_uint8 key, const vtype_array* value); -extern _Bool libcdsb_map_update_uint8_list (vtype_map* x, vtype_uint8 key, const vtype_list* value); -extern _Bool libcdsb_map_update_uint8_map (vtype_map* x, vtype_uint8 key, const vtype_map* value); -extern _Bool libcdsb_map_update_uint8_vset (vtype_map* x, vtype_uint8 key, const vtype_set* value); -extern _Bool libcdsb_map_update_uint8_boolean(vtype_map* x, vtype_uint8 key, vtype_bool value); -extern _Bool libcdsb_map_update_uint8_int8 (vtype_map* x, vtype_uint8 key, vtype_int8 value); -extern _Bool libcdsb_map_update_uint8_int16 (vtype_map* x, vtype_uint8 key, vtype_int16 value); -extern _Bool libcdsb_map_update_uint8_int32 (vtype_map* x, vtype_uint8 key, vtype_int32 value); -extern _Bool libcdsb_map_update_uint8_int64 (vtype_map* x, vtype_uint8 key, vtype_int64 value); -extern _Bool libcdsb_map_update_uint8_uint8 (vtype_map* x, vtype_uint8 key, vtype_uint8 value); -extern _Bool libcdsb_map_update_uint8_uint16 (vtype_map* x, vtype_uint8 key, vtype_uint16 value); -extern _Bool libcdsb_map_update_uint8_uint32 (vtype_map* x, vtype_uint8 key, vtype_uint32 value); -extern _Bool libcdsb_map_update_uint8_uint64 (vtype_map* x, vtype_uint8 key, vtype_uint64 value); -extern _Bool libcdsb_map_update_uint8_float (vtype_map* x, vtype_uint8 key, vtype_float value); -extern _Bool libcdsb_map_update_uint8_double (vtype_map* x, vtype_uint8 key, vtype_double value); -extern _Bool libcdsb_map_update_uint8_ldouble(vtype_map* x, vtype_uint8 key, vtype_ldouble value); +extern bool libcdsb_map_update_uint8_pointer(vtype_map* x, vtype_uint8 key, const void* value); +extern bool libcdsb_map_update_uint8_cstring(vtype_map* x, vtype_uint8 key, const char* value); +extern bool libcdsb_map_update_uint8_string (vtype_map* x, vtype_uint8 key, const vtype_string* value); +extern bool libcdsb_map_update_uint8_array (vtype_map* x, vtype_uint8 key, const vtype_array* value); +extern bool libcdsb_map_update_uint8_list (vtype_map* x, vtype_uint8 key, const vtype_list* value); +extern bool libcdsb_map_update_uint8_map (vtype_map* x, vtype_uint8 key, const vtype_map* value); +extern bool libcdsb_map_update_uint8_vset (vtype_map* x, vtype_uint8 key, const vtype_set* value); +extern bool libcdsb_map_update_uint8_boolean(vtype_map* x, vtype_uint8 key, vtype_bool value); +extern bool libcdsb_map_update_uint8_int8 (vtype_map* x, vtype_uint8 key, vtype_int8 value); +extern bool libcdsb_map_update_uint8_int16 (vtype_map* x, vtype_uint8 key, vtype_int16 value); +extern bool libcdsb_map_update_uint8_int32 (vtype_map* x, vtype_uint8 key, vtype_int32 value); +extern bool libcdsb_map_update_uint8_int64 (vtype_map* x, vtype_uint8 key, vtype_int64 value); +extern bool libcdsb_map_update_uint8_uint8 (vtype_map* x, vtype_uint8 key, vtype_uint8 value); +extern bool libcdsb_map_update_uint8_uint16 (vtype_map* x, vtype_uint8 key, vtype_uint16 value); +extern bool libcdsb_map_update_uint8_uint32 (vtype_map* x, vtype_uint8 key, vtype_uint32 value); +extern bool libcdsb_map_update_uint8_uint64 (vtype_map* x, vtype_uint8 key, vtype_uint64 value); +extern bool libcdsb_map_update_uint8_float (vtype_map* x, vtype_uint8 key, vtype_float value); +extern bool libcdsb_map_update_uint8_double (vtype_map* x, vtype_uint8 key, vtype_double value); +extern bool libcdsb_map_update_uint8_ldouble(vtype_map* x, vtype_uint8 key, vtype_ldouble value); -extern _Bool libcdsb_map_update_uint16_pointer(vtype_map* x, vtype_uint16 key, const void* value); -extern _Bool libcdsb_map_update_uint16_cstring(vtype_map* x, vtype_uint16 key, const char* value); -extern _Bool libcdsb_map_update_uint16_string (vtype_map* x, vtype_uint16 key, const vtype_string* value); -extern _Bool libcdsb_map_update_uint16_array (vtype_map* x, vtype_uint16 key, const vtype_array* value); -extern _Bool libcdsb_map_update_uint16_list (vtype_map* x, vtype_uint16 key, const vtype_list* value); -extern _Bool libcdsb_map_update_uint16_map (vtype_map* x, vtype_uint16 key, const vtype_map* value); -extern _Bool libcdsb_map_update_uint16_vset (vtype_map* x, vtype_uint16 key, const vtype_set* value); -extern _Bool libcdsb_map_update_uint16_boolean(vtype_map* x, vtype_uint16 key, vtype_bool value); -extern _Bool libcdsb_map_update_uint16_int8 (vtype_map* x, vtype_uint16 key, vtype_int8 value); -extern _Bool libcdsb_map_update_uint16_int16 (vtype_map* x, vtype_uint16 key, vtype_int16 value); -extern _Bool libcdsb_map_update_uint16_int32 (vtype_map* x, vtype_uint16 key, vtype_int32 value); -extern _Bool libcdsb_map_update_uint16_int64 (vtype_map* x, vtype_uint16 key, vtype_int64 value); -extern _Bool libcdsb_map_update_uint16_uint8 (vtype_map* x, vtype_uint16 key, vtype_uint8 value); -extern _Bool libcdsb_map_update_uint16_uint16 (vtype_map* x, vtype_uint16 key, vtype_uint16 value); -extern _Bool libcdsb_map_update_uint16_uint32 (vtype_map* x, vtype_uint16 key, vtype_uint32 value); -extern _Bool libcdsb_map_update_uint16_uint64 (vtype_map* x, vtype_uint16 key, vtype_uint64 value); -extern _Bool libcdsb_map_update_uint16_float (vtype_map* x, vtype_uint16 key, vtype_float value); -extern _Bool libcdsb_map_update_uint16_double (vtype_map* x, vtype_uint16 key, vtype_double value); -extern _Bool libcdsb_map_update_uint16_ldouble(vtype_map* x, vtype_uint16 key, vtype_ldouble value); +extern bool libcdsb_map_update_uint16_pointer(vtype_map* x, vtype_uint16 key, const void* value); +extern bool libcdsb_map_update_uint16_cstring(vtype_map* x, vtype_uint16 key, const char* value); +extern bool libcdsb_map_update_uint16_string (vtype_map* x, vtype_uint16 key, const vtype_string* value); +extern bool libcdsb_map_update_uint16_array (vtype_map* x, vtype_uint16 key, const vtype_array* value); +extern bool libcdsb_map_update_uint16_list (vtype_map* x, vtype_uint16 key, const vtype_list* value); +extern bool libcdsb_map_update_uint16_map (vtype_map* x, vtype_uint16 key, const vtype_map* value); +extern bool libcdsb_map_update_uint16_vset (vtype_map* x, vtype_uint16 key, const vtype_set* value); +extern bool libcdsb_map_update_uint16_boolean(vtype_map* x, vtype_uint16 key, vtype_bool value); +extern bool libcdsb_map_update_uint16_int8 (vtype_map* x, vtype_uint16 key, vtype_int8 value); +extern bool libcdsb_map_update_uint16_int16 (vtype_map* x, vtype_uint16 key, vtype_int16 value); +extern bool libcdsb_map_update_uint16_int32 (vtype_map* x, vtype_uint16 key, vtype_int32 value); +extern bool libcdsb_map_update_uint16_int64 (vtype_map* x, vtype_uint16 key, vtype_int64 value); +extern bool libcdsb_map_update_uint16_uint8 (vtype_map* x, vtype_uint16 key, vtype_uint8 value); +extern bool libcdsb_map_update_uint16_uint16 (vtype_map* x, vtype_uint16 key, vtype_uint16 value); +extern bool libcdsb_map_update_uint16_uint32 (vtype_map* x, vtype_uint16 key, vtype_uint32 value); +extern bool libcdsb_map_update_uint16_uint64 (vtype_map* x, vtype_uint16 key, vtype_uint64 value); +extern bool libcdsb_map_update_uint16_float (vtype_map* x, vtype_uint16 key, vtype_float value); +extern bool libcdsb_map_update_uint16_double (vtype_map* x, vtype_uint16 key, vtype_double value); +extern bool libcdsb_map_update_uint16_ldouble(vtype_map* x, vtype_uint16 key, vtype_ldouble value); -extern _Bool libcdsb_map_update_uint32_pointer(vtype_map* x, vtype_uint32 key, const void* value); -extern _Bool libcdsb_map_update_uint32_cstring(vtype_map* x, vtype_uint32 key, const char* value); -extern _Bool libcdsb_map_update_uint32_string (vtype_map* x, vtype_uint32 key, const vtype_string* value); -extern _Bool libcdsb_map_update_uint32_array (vtype_map* x, vtype_uint32 key, const vtype_array* value); -extern _Bool libcdsb_map_update_uint32_list (vtype_map* x, vtype_uint32 key, const vtype_list* value); -extern _Bool libcdsb_map_update_uint32_map (vtype_map* x, vtype_uint32 key, const vtype_map* value); -extern _Bool libcdsb_map_update_uint32_vset (vtype_map* x, vtype_uint32 key, const vtype_set* value); -extern _Bool libcdsb_map_update_uint32_boolean(vtype_map* x, vtype_uint32 key, vtype_bool value); -extern _Bool libcdsb_map_update_uint32_int8 (vtype_map* x, vtype_uint32 key, vtype_int8 value); -extern _Bool libcdsb_map_update_uint32_int16 (vtype_map* x, vtype_uint32 key, vtype_int16 value); -extern _Bool libcdsb_map_update_uint32_int32 (vtype_map* x, vtype_uint32 key, vtype_int32 value); -extern _Bool libcdsb_map_update_uint32_int64 (vtype_map* x, vtype_uint32 key, vtype_int64 value); -extern _Bool libcdsb_map_update_uint32_uint8 (vtype_map* x, vtype_uint32 key, vtype_uint8 value); -extern _Bool libcdsb_map_update_uint32_uint16 (vtype_map* x, vtype_uint32 key, vtype_uint16 value); -extern _Bool libcdsb_map_update_uint32_uint32 (vtype_map* x, vtype_uint32 key, vtype_uint32 value); -extern _Bool libcdsb_map_update_uint32_uint64 (vtype_map* x, vtype_uint32 key, vtype_uint64 value); -extern _Bool libcdsb_map_update_uint32_float (vtype_map* x, vtype_uint32 key, vtype_float value); -extern _Bool libcdsb_map_update_uint32_double (vtype_map* x, vtype_uint32 key, vtype_double value); -extern _Bool libcdsb_map_update_uint32_ldouble(vtype_map* x, vtype_uint32 key, vtype_ldouble value); +extern bool libcdsb_map_update_uint32_pointer(vtype_map* x, vtype_uint32 key, const void* value); +extern bool libcdsb_map_update_uint32_cstring(vtype_map* x, vtype_uint32 key, const char* value); +extern bool libcdsb_map_update_uint32_string (vtype_map* x, vtype_uint32 key, const vtype_string* value); +extern bool libcdsb_map_update_uint32_array (vtype_map* x, vtype_uint32 key, const vtype_array* value); +extern bool libcdsb_map_update_uint32_list (vtype_map* x, vtype_uint32 key, const vtype_list* value); +extern bool libcdsb_map_update_uint32_map (vtype_map* x, vtype_uint32 key, const vtype_map* value); +extern bool libcdsb_map_update_uint32_vset (vtype_map* x, vtype_uint32 key, const vtype_set* value); +extern bool libcdsb_map_update_uint32_boolean(vtype_map* x, vtype_uint32 key, vtype_bool value); +extern bool libcdsb_map_update_uint32_int8 (vtype_map* x, vtype_uint32 key, vtype_int8 value); +extern bool libcdsb_map_update_uint32_int16 (vtype_map* x, vtype_uint32 key, vtype_int16 value); +extern bool libcdsb_map_update_uint32_int32 (vtype_map* x, vtype_uint32 key, vtype_int32 value); +extern bool libcdsb_map_update_uint32_int64 (vtype_map* x, vtype_uint32 key, vtype_int64 value); +extern bool libcdsb_map_update_uint32_uint8 (vtype_map* x, vtype_uint32 key, vtype_uint8 value); +extern bool libcdsb_map_update_uint32_uint16 (vtype_map* x, vtype_uint32 key, vtype_uint16 value); +extern bool libcdsb_map_update_uint32_uint32 (vtype_map* x, vtype_uint32 key, vtype_uint32 value); +extern bool libcdsb_map_update_uint32_uint64 (vtype_map* x, vtype_uint32 key, vtype_uint64 value); +extern bool libcdsb_map_update_uint32_float (vtype_map* x, vtype_uint32 key, vtype_float value); +extern bool libcdsb_map_update_uint32_double (vtype_map* x, vtype_uint32 key, vtype_double value); +extern bool libcdsb_map_update_uint32_ldouble(vtype_map* x, vtype_uint32 key, vtype_ldouble value); -extern _Bool libcdsb_map_update_uint64_pointer(vtype_map* x, vtype_uint64 key, const void* value); -extern _Bool libcdsb_map_update_uint64_cstring(vtype_map* x, vtype_uint64 key, const char* value); -extern _Bool libcdsb_map_update_uint64_string (vtype_map* x, vtype_uint64 key, const vtype_string* value); -extern _Bool libcdsb_map_update_uint64_array (vtype_map* x, vtype_uint64 key, const vtype_array* value); -extern _Bool libcdsb_map_update_uint64_list (vtype_map* x, vtype_uint64 key, const vtype_list* value); -extern _Bool libcdsb_map_update_uint64_map (vtype_map* x, vtype_uint64 key, const vtype_map* value); -extern _Bool libcdsb_map_update_uint64_vset (vtype_map* x, vtype_uint64 key, const vtype_set* value); -extern _Bool libcdsb_map_update_uint64_boolean(vtype_map* x, vtype_uint64 key, vtype_bool value); -extern _Bool libcdsb_map_update_uint64_int8 (vtype_map* x, vtype_uint64 key, vtype_int8 value); -extern _Bool libcdsb_map_update_uint64_int16 (vtype_map* x, vtype_uint64 key, vtype_int16 value); -extern _Bool libcdsb_map_update_uint64_int32 (vtype_map* x, vtype_uint64 key, vtype_int32 value); -extern _Bool libcdsb_map_update_uint64_int64 (vtype_map* x, vtype_uint64 key, vtype_int64 value); -extern _Bool libcdsb_map_update_uint64_uint8 (vtype_map* x, vtype_uint64 key, vtype_uint8 value); -extern _Bool libcdsb_map_update_uint64_uint16 (vtype_map* x, vtype_uint64 key, vtype_uint16 value); -extern _Bool libcdsb_map_update_uint64_uint32 (vtype_map* x, vtype_uint64 key, vtype_uint32 value); -extern _Bool libcdsb_map_update_uint64_uint64 (vtype_map* x, vtype_uint64 key, vtype_uint64 value); -extern _Bool libcdsb_map_update_uint64_float (vtype_map* x, vtype_uint64 key, vtype_float value); -extern _Bool libcdsb_map_update_uint64_double (vtype_map* x, vtype_uint64 key, vtype_double value); -extern _Bool libcdsb_map_update_uint64_ldouble(vtype_map* x, vtype_uint64 key, vtype_ldouble value); +extern bool libcdsb_map_update_uint64_pointer(vtype_map* x, vtype_uint64 key, const void* value); +extern bool libcdsb_map_update_uint64_cstring(vtype_map* x, vtype_uint64 key, const char* value); +extern bool libcdsb_map_update_uint64_string (vtype_map* x, vtype_uint64 key, const vtype_string* value); +extern bool libcdsb_map_update_uint64_array (vtype_map* x, vtype_uint64 key, const vtype_array* value); +extern bool libcdsb_map_update_uint64_list (vtype_map* x, vtype_uint64 key, const vtype_list* value); +extern bool libcdsb_map_update_uint64_map (vtype_map* x, vtype_uint64 key, const vtype_map* value); +extern bool libcdsb_map_update_uint64_vset (vtype_map* x, vtype_uint64 key, const vtype_set* value); +extern bool libcdsb_map_update_uint64_boolean(vtype_map* x, vtype_uint64 key, vtype_bool value); +extern bool libcdsb_map_update_uint64_int8 (vtype_map* x, vtype_uint64 key, vtype_int8 value); +extern bool libcdsb_map_update_uint64_int16 (vtype_map* x, vtype_uint64 key, vtype_int16 value); +extern bool libcdsb_map_update_uint64_int32 (vtype_map* x, vtype_uint64 key, vtype_int32 value); +extern bool libcdsb_map_update_uint64_int64 (vtype_map* x, vtype_uint64 key, vtype_int64 value); +extern bool libcdsb_map_update_uint64_uint8 (vtype_map* x, vtype_uint64 key, vtype_uint8 value); +extern bool libcdsb_map_update_uint64_uint16 (vtype_map* x, vtype_uint64 key, vtype_uint16 value); +extern bool libcdsb_map_update_uint64_uint32 (vtype_map* x, vtype_uint64 key, vtype_uint32 value); +extern bool libcdsb_map_update_uint64_uint64 (vtype_map* x, vtype_uint64 key, vtype_uint64 value); +extern bool libcdsb_map_update_uint64_float (vtype_map* x, vtype_uint64 key, vtype_float value); +extern bool libcdsb_map_update_uint64_double (vtype_map* x, vtype_uint64 key, vtype_double value); +extern bool libcdsb_map_update_uint64_ldouble(vtype_map* x, vtype_uint64 key, vtype_ldouble value); -extern _Bool libcdsb_map_update_int8_pointer(vtype_map* x, vtype_int8 key, const void* value); -extern _Bool libcdsb_map_update_int8_cstring(vtype_map* x, vtype_int8 key, const char* value); -extern _Bool libcdsb_map_update_int8_string (vtype_map* x, vtype_int8 key, const vtype_string* value); -extern _Bool libcdsb_map_update_int8_array (vtype_map* x, vtype_int8 key, const vtype_array* value); -extern _Bool libcdsb_map_update_int8_list (vtype_map* x, vtype_int8 key, const vtype_list* value); -extern _Bool libcdsb_map_update_int8_map (vtype_map* x, vtype_int8 key, const vtype_map* value); -extern _Bool libcdsb_map_update_int8_vset (vtype_map* x, vtype_int8 key, const vtype_set* value); -extern _Bool libcdsb_map_update_int8_boolean(vtype_map* x, vtype_int8 key, vtype_bool value); -extern _Bool libcdsb_map_update_int8_int8 (vtype_map* x, vtype_int8 key, vtype_int8 value); -extern _Bool libcdsb_map_update_int8_int16 (vtype_map* x, vtype_int8 key, vtype_int16 value); -extern _Bool libcdsb_map_update_int8_int32 (vtype_map* x, vtype_int8 key, vtype_int32 value); -extern _Bool libcdsb_map_update_int8_int64 (vtype_map* x, vtype_int8 key, vtype_int64 value); -extern _Bool libcdsb_map_update_int8_uint8 (vtype_map* x, vtype_int8 key, vtype_uint8 value); -extern _Bool libcdsb_map_update_int8_uint16 (vtype_map* x, vtype_int8 key, vtype_uint16 value); -extern _Bool libcdsb_map_update_int8_uint32 (vtype_map* x, vtype_int8 key, vtype_uint32 value); -extern _Bool libcdsb_map_update_int8_uint64 (vtype_map* x, vtype_int8 key, vtype_uint64 value); -extern _Bool libcdsb_map_update_int8_float (vtype_map* x, vtype_int8 key, vtype_float value); -extern _Bool libcdsb_map_update_int8_double (vtype_map* x, vtype_int8 key, vtype_double value); -extern _Bool libcdsb_map_update_int8_ldouble(vtype_map* x, vtype_int8 key, vtype_ldouble value); +extern bool libcdsb_map_update_int8_pointer(vtype_map* x, vtype_int8 key, const void* value); +extern bool libcdsb_map_update_int8_cstring(vtype_map* x, vtype_int8 key, const char* value); +extern bool libcdsb_map_update_int8_string (vtype_map* x, vtype_int8 key, const vtype_string* value); +extern bool libcdsb_map_update_int8_array (vtype_map* x, vtype_int8 key, const vtype_array* value); +extern bool libcdsb_map_update_int8_list (vtype_map* x, vtype_int8 key, const vtype_list* value); +extern bool libcdsb_map_update_int8_map (vtype_map* x, vtype_int8 key, const vtype_map* value); +extern bool libcdsb_map_update_int8_vset (vtype_map* x, vtype_int8 key, const vtype_set* value); +extern bool libcdsb_map_update_int8_boolean(vtype_map* x, vtype_int8 key, vtype_bool value); +extern bool libcdsb_map_update_int8_int8 (vtype_map* x, vtype_int8 key, vtype_int8 value); +extern bool libcdsb_map_update_int8_int16 (vtype_map* x, vtype_int8 key, vtype_int16 value); +extern bool libcdsb_map_update_int8_int32 (vtype_map* x, vtype_int8 key, vtype_int32 value); +extern bool libcdsb_map_update_int8_int64 (vtype_map* x, vtype_int8 key, vtype_int64 value); +extern bool libcdsb_map_update_int8_uint8 (vtype_map* x, vtype_int8 key, vtype_uint8 value); +extern bool libcdsb_map_update_int8_uint16 (vtype_map* x, vtype_int8 key, vtype_uint16 value); +extern bool libcdsb_map_update_int8_uint32 (vtype_map* x, vtype_int8 key, vtype_uint32 value); +extern bool libcdsb_map_update_int8_uint64 (vtype_map* x, vtype_int8 key, vtype_uint64 value); +extern bool libcdsb_map_update_int8_float (vtype_map* x, vtype_int8 key, vtype_float value); +extern bool libcdsb_map_update_int8_double (vtype_map* x, vtype_int8 key, vtype_double value); +extern bool libcdsb_map_update_int8_ldouble(vtype_map* x, vtype_int8 key, vtype_ldouble value); -extern _Bool libcdsb_map_update_int16_pointer(vtype_map* x, vtype_int16 key, const void* value); -extern _Bool libcdsb_map_update_int16_cstring(vtype_map* x, vtype_int16 key, const char* value); -extern _Bool libcdsb_map_update_int16_string (vtype_map* x, vtype_int16 key, const vtype_string* value); -extern _Bool libcdsb_map_update_int16_array (vtype_map* x, vtype_int16 key, const vtype_array* value); -extern _Bool libcdsb_map_update_int16_list (vtype_map* x, vtype_int16 key, const vtype_list* value); -extern _Bool libcdsb_map_update_int16_map (vtype_map* x, vtype_int16 key, const vtype_map* value); -extern _Bool libcdsb_map_update_int16_vset (vtype_map* x, vtype_int16 key, const vtype_set* value); -extern _Bool libcdsb_map_update_int16_boolean(vtype_map* x, vtype_int16 key, vtype_bool value); -extern _Bool libcdsb_map_update_int16_int8 (vtype_map* x, vtype_int16 key, vtype_int8 value); -extern _Bool libcdsb_map_update_int16_int16 (vtype_map* x, vtype_int16 key, vtype_int16 value); -extern _Bool libcdsb_map_update_int16_int32 (vtype_map* x, vtype_int16 key, vtype_int32 value); -extern _Bool libcdsb_map_update_int16_int64 (vtype_map* x, vtype_int16 key, vtype_int64 value); -extern _Bool libcdsb_map_update_int16_uint8 (vtype_map* x, vtype_int16 key, vtype_uint8 value); -extern _Bool libcdsb_map_update_int16_uint16 (vtype_map* x, vtype_int16 key, vtype_uint16 value); -extern _Bool libcdsb_map_update_int16_uint32 (vtype_map* x, vtype_int16 key, vtype_uint32 value); -extern _Bool libcdsb_map_update_int16_uint64 (vtype_map* x, vtype_int16 key, vtype_uint64 value); -extern _Bool libcdsb_map_update_int16_float (vtype_map* x, vtype_int16 key, vtype_float value); -extern _Bool libcdsb_map_update_int16_double (vtype_map* x, vtype_int16 key, vtype_double value); -extern _Bool libcdsb_map_update_int16_ldouble(vtype_map* x, vtype_int16 key, vtype_ldouble value); +extern bool libcdsb_map_update_int16_pointer(vtype_map* x, vtype_int16 key, const void* value); +extern bool libcdsb_map_update_int16_cstring(vtype_map* x, vtype_int16 key, const char* value); +extern bool libcdsb_map_update_int16_string (vtype_map* x, vtype_int16 key, const vtype_string* value); +extern bool libcdsb_map_update_int16_array (vtype_map* x, vtype_int16 key, const vtype_array* value); +extern bool libcdsb_map_update_int16_list (vtype_map* x, vtype_int16 key, const vtype_list* value); +extern bool libcdsb_map_update_int16_map (vtype_map* x, vtype_int16 key, const vtype_map* value); +extern bool libcdsb_map_update_int16_vset (vtype_map* x, vtype_int16 key, const vtype_set* value); +extern bool libcdsb_map_update_int16_boolean(vtype_map* x, vtype_int16 key, vtype_bool value); +extern bool libcdsb_map_update_int16_int8 (vtype_map* x, vtype_int16 key, vtype_int8 value); +extern bool libcdsb_map_update_int16_int16 (vtype_map* x, vtype_int16 key, vtype_int16 value); +extern bool libcdsb_map_update_int16_int32 (vtype_map* x, vtype_int16 key, vtype_int32 value); +extern bool libcdsb_map_update_int16_int64 (vtype_map* x, vtype_int16 key, vtype_int64 value); +extern bool libcdsb_map_update_int16_uint8 (vtype_map* x, vtype_int16 key, vtype_uint8 value); +extern bool libcdsb_map_update_int16_uint16 (vtype_map* x, vtype_int16 key, vtype_uint16 value); +extern bool libcdsb_map_update_int16_uint32 (vtype_map* x, vtype_int16 key, vtype_uint32 value); +extern bool libcdsb_map_update_int16_uint64 (vtype_map* x, vtype_int16 key, vtype_uint64 value); +extern bool libcdsb_map_update_int16_float (vtype_map* x, vtype_int16 key, vtype_float value); +extern bool libcdsb_map_update_int16_double (vtype_map* x, vtype_int16 key, vtype_double value); +extern bool libcdsb_map_update_int16_ldouble(vtype_map* x, vtype_int16 key, vtype_ldouble value); -extern _Bool libcdsb_map_update_int32_pointer(vtype_map* x, vtype_int32 key, const void* value); -extern _Bool libcdsb_map_update_int32_cstring(vtype_map* x, vtype_int32 key, const char* value); -extern _Bool libcdsb_map_update_int32_string (vtype_map* x, vtype_int32 key, const vtype_string* value); -extern _Bool libcdsb_map_update_int32_array (vtype_map* x, vtype_int32 key, const vtype_array* value); -extern _Bool libcdsb_map_update_int32_list (vtype_map* x, vtype_int32 key, const vtype_list* value); -extern _Bool libcdsb_map_update_int32_map (vtype_map* x, vtype_int32 key, const vtype_map* value); -extern _Bool libcdsb_map_update_int32_vset (vtype_map* x, vtype_int32 key, const vtype_set* value); -extern _Bool libcdsb_map_update_int32_boolean(vtype_map* x, vtype_int32 key, vtype_bool value); -extern _Bool libcdsb_map_update_int32_int8 (vtype_map* x, vtype_int32 key, vtype_int8 value); -extern _Bool libcdsb_map_update_int32_int16 (vtype_map* x, vtype_int32 key, vtype_int16 value); -extern _Bool libcdsb_map_update_int32_int32 (vtype_map* x, vtype_int32 key, vtype_int32 value); -extern _Bool libcdsb_map_update_int32_int64 (vtype_map* x, vtype_int32 key, vtype_int64 value); -extern _Bool libcdsb_map_update_int32_uint8 (vtype_map* x, vtype_int32 key, vtype_uint8 value); -extern _Bool libcdsb_map_update_int32_uint16 (vtype_map* x, vtype_int32 key, vtype_uint16 value); -extern _Bool libcdsb_map_update_int32_uint32 (vtype_map* x, vtype_int32 key, vtype_uint32 value); -extern _Bool libcdsb_map_update_int32_uint64 (vtype_map* x, vtype_int32 key, vtype_uint64 value); -extern _Bool libcdsb_map_update_int32_float (vtype_map* x, vtype_int32 key, vtype_float value); -extern _Bool libcdsb_map_update_int32_double (vtype_map* x, vtype_int32 key, vtype_double value); -extern _Bool libcdsb_map_update_int32_ldouble(vtype_map* x, vtype_int32 key, vtype_ldouble value); +extern bool libcdsb_map_update_int32_pointer(vtype_map* x, vtype_int32 key, const void* value); +extern bool libcdsb_map_update_int32_cstring(vtype_map* x, vtype_int32 key, const char* value); +extern bool libcdsb_map_update_int32_string (vtype_map* x, vtype_int32 key, const vtype_string* value); +extern bool libcdsb_map_update_int32_array (vtype_map* x, vtype_int32 key, const vtype_array* value); +extern bool libcdsb_map_update_int32_list (vtype_map* x, vtype_int32 key, const vtype_list* value); +extern bool libcdsb_map_update_int32_map (vtype_map* x, vtype_int32 key, const vtype_map* value); +extern bool libcdsb_map_update_int32_vset (vtype_map* x, vtype_int32 key, const vtype_set* value); +extern bool libcdsb_map_update_int32_boolean(vtype_map* x, vtype_int32 key, vtype_bool value); +extern bool libcdsb_map_update_int32_int8 (vtype_map* x, vtype_int32 key, vtype_int8 value); +extern bool libcdsb_map_update_int32_int16 (vtype_map* x, vtype_int32 key, vtype_int16 value); +extern bool libcdsb_map_update_int32_int32 (vtype_map* x, vtype_int32 key, vtype_int32 value); +extern bool libcdsb_map_update_int32_int64 (vtype_map* x, vtype_int32 key, vtype_int64 value); +extern bool libcdsb_map_update_int32_uint8 (vtype_map* x, vtype_int32 key, vtype_uint8 value); +extern bool libcdsb_map_update_int32_uint16 (vtype_map* x, vtype_int32 key, vtype_uint16 value); +extern bool libcdsb_map_update_int32_uint32 (vtype_map* x, vtype_int32 key, vtype_uint32 value); +extern bool libcdsb_map_update_int32_uint64 (vtype_map* x, vtype_int32 key, vtype_uint64 value); +extern bool libcdsb_map_update_int32_float (vtype_map* x, vtype_int32 key, vtype_float value); +extern bool libcdsb_map_update_int32_double (vtype_map* x, vtype_int32 key, vtype_double value); +extern bool libcdsb_map_update_int32_ldouble(vtype_map* x, vtype_int32 key, vtype_ldouble value); -extern _Bool libcdsb_map_update_int64_pointer(vtype_map* x, vtype_int64 key, const void* value); -extern _Bool libcdsb_map_update_int64_cstring(vtype_map* x, vtype_int64 key, const char* value); -extern _Bool libcdsb_map_update_int64_string (vtype_map* x, vtype_int64 key, const vtype_string* value); -extern _Bool libcdsb_map_update_int64_array (vtype_map* x, vtype_int64 key, const vtype_array* value); -extern _Bool libcdsb_map_update_int64_list (vtype_map* x, vtype_int64 key, const vtype_list* value); -extern _Bool libcdsb_map_update_int64_map (vtype_map* x, vtype_int64 key, const vtype_map* value); -extern _Bool libcdsb_map_update_int64_vset (vtype_map* x, vtype_int64 key, const vtype_set* value); -extern _Bool libcdsb_map_update_int64_boolean(vtype_map* x, vtype_int64 key, vtype_bool value); -extern _Bool libcdsb_map_update_int64_int8 (vtype_map* x, vtype_int64 key, vtype_int8 value); -extern _Bool libcdsb_map_update_int64_int16 (vtype_map* x, vtype_int64 key, vtype_int16 value); -extern _Bool libcdsb_map_update_int64_int32 (vtype_map* x, vtype_int64 key, vtype_int32 value); -extern _Bool libcdsb_map_update_int64_int64 (vtype_map* x, vtype_int64 key, vtype_int64 value); -extern _Bool libcdsb_map_update_int64_uint8 (vtype_map* x, vtype_int64 key, vtype_uint8 value); -extern _Bool libcdsb_map_update_int64_uint16 (vtype_map* x, vtype_int64 key, vtype_uint16 value); -extern _Bool libcdsb_map_update_int64_uint32 (vtype_map* x, vtype_int64 key, vtype_uint32 value); -extern _Bool libcdsb_map_update_int64_uint64 (vtype_map* x, vtype_int64 key, vtype_uint64 value); -extern _Bool libcdsb_map_update_int64_float (vtype_map* x, vtype_int64 key, vtype_float value); -extern _Bool libcdsb_map_update_int64_double (vtype_map* x, vtype_int64 key, vtype_double value); -extern _Bool libcdsb_map_update_int64_ldouble(vtype_map* x, vtype_int64 key, vtype_ldouble value); +extern bool libcdsb_map_update_int64_pointer(vtype_map* x, vtype_int64 key, const void* value); +extern bool libcdsb_map_update_int64_cstring(vtype_map* x, vtype_int64 key, const char* value); +extern bool libcdsb_map_update_int64_string (vtype_map* x, vtype_int64 key, const vtype_string* value); +extern bool libcdsb_map_update_int64_array (vtype_map* x, vtype_int64 key, const vtype_array* value); +extern bool libcdsb_map_update_int64_list (vtype_map* x, vtype_int64 key, const vtype_list* value); +extern bool libcdsb_map_update_int64_map (vtype_map* x, vtype_int64 key, const vtype_map* value); +extern bool libcdsb_map_update_int64_vset (vtype_map* x, vtype_int64 key, const vtype_set* value); +extern bool libcdsb_map_update_int64_boolean(vtype_map* x, vtype_int64 key, vtype_bool value); +extern bool libcdsb_map_update_int64_int8 (vtype_map* x, vtype_int64 key, vtype_int8 value); +extern bool libcdsb_map_update_int64_int16 (vtype_map* x, vtype_int64 key, vtype_int16 value); +extern bool libcdsb_map_update_int64_int32 (vtype_map* x, vtype_int64 key, vtype_int32 value); +extern bool libcdsb_map_update_int64_int64 (vtype_map* x, vtype_int64 key, vtype_int64 value); +extern bool libcdsb_map_update_int64_uint8 (vtype_map* x, vtype_int64 key, vtype_uint8 value); +extern bool libcdsb_map_update_int64_uint16 (vtype_map* x, vtype_int64 key, vtype_uint16 value); +extern bool libcdsb_map_update_int64_uint32 (vtype_map* x, vtype_int64 key, vtype_uint32 value); +extern bool libcdsb_map_update_int64_uint64 (vtype_map* x, vtype_int64 key, vtype_uint64 value); +extern bool libcdsb_map_update_int64_float (vtype_map* x, vtype_int64 key, vtype_float value); +extern bool libcdsb_map_update_int64_double (vtype_map* x, vtype_int64 key, vtype_double value); +extern bool libcdsb_map_update_int64_ldouble(vtype_map* x, vtype_int64 key, vtype_ldouble value); -extern _Bool libcdsb_map_update_float_pointer(vtype_map* x, vtype_float key, const void* value); -extern _Bool libcdsb_map_update_float_cstring(vtype_map* x, vtype_float key, const char* value); -extern _Bool libcdsb_map_update_float_string (vtype_map* x, vtype_float key, const vtype_string* value); -extern _Bool libcdsb_map_update_float_array (vtype_map* x, vtype_float key, const vtype_array* value); -extern _Bool libcdsb_map_update_float_list (vtype_map* x, vtype_float key, const vtype_list* value); -extern _Bool libcdsb_map_update_float_map (vtype_map* x, vtype_float key, const vtype_map* value); -extern _Bool libcdsb_map_update_float_vset (vtype_map* x, vtype_float key, const vtype_set* value); -extern _Bool libcdsb_map_update_float_boolean(vtype_map* x, vtype_float key, vtype_bool value); -extern _Bool libcdsb_map_update_float_int8 (vtype_map* x, vtype_float key, vtype_int8 value); -extern _Bool libcdsb_map_update_float_int16 (vtype_map* x, vtype_float key, vtype_int16 value); -extern _Bool libcdsb_map_update_float_int32 (vtype_map* x, vtype_float key, vtype_int32 value); -extern _Bool libcdsb_map_update_float_int64 (vtype_map* x, vtype_float key, vtype_int64 value); -extern _Bool libcdsb_map_update_float_uint8 (vtype_map* x, vtype_float key, vtype_uint8 value); -extern _Bool libcdsb_map_update_float_uint16 (vtype_map* x, vtype_float key, vtype_uint16 value); -extern _Bool libcdsb_map_update_float_uint32 (vtype_map* x, vtype_float key, vtype_uint32 value); -extern _Bool libcdsb_map_update_float_uint64 (vtype_map* x, vtype_float key, vtype_uint64 value); -extern _Bool libcdsb_map_update_float_float (vtype_map* x, vtype_float key, vtype_float value); -extern _Bool libcdsb_map_update_float_double (vtype_map* x, vtype_float key, vtype_double value); -extern _Bool libcdsb_map_update_float_ldouble(vtype_map* x, vtype_float key, vtype_ldouble value); +extern bool libcdsb_map_update_float_pointer(vtype_map* x, vtype_float key, const void* value); +extern bool libcdsb_map_update_float_cstring(vtype_map* x, vtype_float key, const char* value); +extern bool libcdsb_map_update_float_string (vtype_map* x, vtype_float key, const vtype_string* value); +extern bool libcdsb_map_update_float_array (vtype_map* x, vtype_float key, const vtype_array* value); +extern bool libcdsb_map_update_float_list (vtype_map* x, vtype_float key, const vtype_list* value); +extern bool libcdsb_map_update_float_map (vtype_map* x, vtype_float key, const vtype_map* value); +extern bool libcdsb_map_update_float_vset (vtype_map* x, vtype_float key, const vtype_set* value); +extern bool libcdsb_map_update_float_boolean(vtype_map* x, vtype_float key, vtype_bool value); +extern bool libcdsb_map_update_float_int8 (vtype_map* x, vtype_float key, vtype_int8 value); +extern bool libcdsb_map_update_float_int16 (vtype_map* x, vtype_float key, vtype_int16 value); +extern bool libcdsb_map_update_float_int32 (vtype_map* x, vtype_float key, vtype_int32 value); +extern bool libcdsb_map_update_float_int64 (vtype_map* x, vtype_float key, vtype_int64 value); +extern bool libcdsb_map_update_float_uint8 (vtype_map* x, vtype_float key, vtype_uint8 value); +extern bool libcdsb_map_update_float_uint16 (vtype_map* x, vtype_float key, vtype_uint16 value); +extern bool libcdsb_map_update_float_uint32 (vtype_map* x, vtype_float key, vtype_uint32 value); +extern bool libcdsb_map_update_float_uint64 (vtype_map* x, vtype_float key, vtype_uint64 value); +extern bool libcdsb_map_update_float_float (vtype_map* x, vtype_float key, vtype_float value); +extern bool libcdsb_map_update_float_double (vtype_map* x, vtype_float key, vtype_double value); +extern bool libcdsb_map_update_float_ldouble(vtype_map* x, vtype_float key, vtype_ldouble value); -extern _Bool libcdsb_map_update_double_pointer(vtype_map* x, vtype_double key, const void* value); -extern _Bool libcdsb_map_update_double_cstring(vtype_map* x, vtype_double key, const char* value); -extern _Bool libcdsb_map_update_double_string (vtype_map* x, vtype_double key, const vtype_string* value); -extern _Bool libcdsb_map_update_double_array (vtype_map* x, vtype_double key, const vtype_array* value); -extern _Bool libcdsb_map_update_double_list (vtype_map* x, vtype_double key, const vtype_list* value); -extern _Bool libcdsb_map_update_double_map (vtype_map* x, vtype_double key, const vtype_map* value); -extern _Bool libcdsb_map_update_double_vset (vtype_map* x, vtype_double key, const vtype_set* value); -extern _Bool libcdsb_map_update_double_boolean(vtype_map* x, vtype_double key, vtype_bool value); -extern _Bool libcdsb_map_update_double_int8 (vtype_map* x, vtype_double key, vtype_int8 value); -extern _Bool libcdsb_map_update_double_int16 (vtype_map* x, vtype_double key, vtype_int16 value); -extern _Bool libcdsb_map_update_double_int32 (vtype_map* x, vtype_double key, vtype_int32 value); -extern _Bool libcdsb_map_update_double_int64 (vtype_map* x, vtype_double key, vtype_int64 value); -extern _Bool libcdsb_map_update_double_uint8 (vtype_map* x, vtype_double key, vtype_uint8 value); -extern _Bool libcdsb_map_update_double_uint16 (vtype_map* x, vtype_double key, vtype_uint16 value); -extern _Bool libcdsb_map_update_double_uint32 (vtype_map* x, vtype_double key, vtype_uint32 value); -extern _Bool libcdsb_map_update_double_uint64 (vtype_map* x, vtype_double key, vtype_uint64 value); -extern _Bool libcdsb_map_update_double_float (vtype_map* x, vtype_double key, vtype_float value); -extern _Bool libcdsb_map_update_double_double (vtype_map* x, vtype_double key, vtype_double value); -extern _Bool libcdsb_map_update_double_ldouble(vtype_map* x, vtype_double key, vtype_ldouble value); +extern bool libcdsb_map_update_double_pointer(vtype_map* x, vtype_double key, const void* value); +extern bool libcdsb_map_update_double_cstring(vtype_map* x, vtype_double key, const char* value); +extern bool libcdsb_map_update_double_string (vtype_map* x, vtype_double key, const vtype_string* value); +extern bool libcdsb_map_update_double_array (vtype_map* x, vtype_double key, const vtype_array* value); +extern bool libcdsb_map_update_double_list (vtype_map* x, vtype_double key, const vtype_list* value); +extern bool libcdsb_map_update_double_map (vtype_map* x, vtype_double key, const vtype_map* value); +extern bool libcdsb_map_update_double_vset (vtype_map* x, vtype_double key, const vtype_set* value); +extern bool libcdsb_map_update_double_boolean(vtype_map* x, vtype_double key, vtype_bool value); +extern bool libcdsb_map_update_double_int8 (vtype_map* x, vtype_double key, vtype_int8 value); +extern bool libcdsb_map_update_double_int16 (vtype_map* x, vtype_double key, vtype_int16 value); +extern bool libcdsb_map_update_double_int32 (vtype_map* x, vtype_double key, vtype_int32 value); +extern bool libcdsb_map_update_double_int64 (vtype_map* x, vtype_double key, vtype_int64 value); +extern bool libcdsb_map_update_double_uint8 (vtype_map* x, vtype_double key, vtype_uint8 value); +extern bool libcdsb_map_update_double_uint16 (vtype_map* x, vtype_double key, vtype_uint16 value); +extern bool libcdsb_map_update_double_uint32 (vtype_map* x, vtype_double key, vtype_uint32 value); +extern bool libcdsb_map_update_double_uint64 (vtype_map* x, vtype_double key, vtype_uint64 value); +extern bool libcdsb_map_update_double_float (vtype_map* x, vtype_double key, vtype_float value); +extern bool libcdsb_map_update_double_double (vtype_map* x, vtype_double key, vtype_double value); +extern bool libcdsb_map_update_double_ldouble(vtype_map* x, vtype_double key, vtype_ldouble value); -extern _Bool libcdsb_map_update_ldouble_pointer(vtype_map* x, vtype_ldouble key, const void* value); -extern _Bool libcdsb_map_update_ldouble_cstring(vtype_map* x, vtype_ldouble key, const char* value); -extern _Bool libcdsb_map_update_ldouble_string (vtype_map* x, vtype_ldouble key, const vtype_string* value); -extern _Bool libcdsb_map_update_ldouble_array (vtype_map* x, vtype_ldouble key, const vtype_array* value); -extern _Bool libcdsb_map_update_ldouble_list (vtype_map* x, vtype_ldouble key, const vtype_list* value); -extern _Bool libcdsb_map_update_ldouble_map (vtype_map* x, vtype_ldouble key, const vtype_map* value); -extern _Bool libcdsb_map_update_ldouble_vset (vtype_map* x, vtype_ldouble key, const vtype_set* value); -extern _Bool libcdsb_map_update_ldouble_boolean(vtype_map* x, vtype_ldouble key, vtype_bool value); -extern _Bool libcdsb_map_update_ldouble_int8 (vtype_map* x, vtype_ldouble key, vtype_int8 value); -extern _Bool libcdsb_map_update_ldouble_int16 (vtype_map* x, vtype_ldouble key, vtype_int16 value); -extern _Bool libcdsb_map_update_ldouble_int32 (vtype_map* x, vtype_ldouble key, vtype_int32 value); -extern _Bool libcdsb_map_update_ldouble_int64 (vtype_map* x, vtype_ldouble key, vtype_int64 value); -extern _Bool libcdsb_map_update_ldouble_uint8 (vtype_map* x, vtype_ldouble key, vtype_uint8 value); -extern _Bool libcdsb_map_update_ldouble_uint16 (vtype_map* x, vtype_ldouble key, vtype_uint16 value); -extern _Bool libcdsb_map_update_ldouble_uint32 (vtype_map* x, vtype_ldouble key, vtype_uint32 value); -extern _Bool libcdsb_map_update_ldouble_uint64 (vtype_map* x, vtype_ldouble key, vtype_uint64 value); -extern _Bool libcdsb_map_update_ldouble_float (vtype_map* x, vtype_ldouble key, vtype_float value); -extern _Bool libcdsb_map_update_ldouble_double (vtype_map* x, vtype_ldouble key, vtype_double value); -extern _Bool libcdsb_map_update_ldouble_ldouble(vtype_map* x, vtype_ldouble key, vtype_ldouble value); +extern bool libcdsb_map_update_ldouble_pointer(vtype_map* x, vtype_ldouble key, const void* value); +extern bool libcdsb_map_update_ldouble_cstring(vtype_map* x, vtype_ldouble key, const char* value); +extern bool libcdsb_map_update_ldouble_string (vtype_map* x, vtype_ldouble key, const vtype_string* value); +extern bool libcdsb_map_update_ldouble_array (vtype_map* x, vtype_ldouble key, const vtype_array* value); +extern bool libcdsb_map_update_ldouble_list (vtype_map* x, vtype_ldouble key, const vtype_list* value); +extern bool libcdsb_map_update_ldouble_map (vtype_map* x, vtype_ldouble key, const vtype_map* value); +extern bool libcdsb_map_update_ldouble_vset (vtype_map* x, vtype_ldouble key, const vtype_set* value); +extern bool libcdsb_map_update_ldouble_boolean(vtype_map* x, vtype_ldouble key, vtype_bool value); +extern bool libcdsb_map_update_ldouble_int8 (vtype_map* x, vtype_ldouble key, vtype_int8 value); +extern bool libcdsb_map_update_ldouble_int16 (vtype_map* x, vtype_ldouble key, vtype_int16 value); +extern bool libcdsb_map_update_ldouble_int32 (vtype_map* x, vtype_ldouble key, vtype_int32 value); +extern bool libcdsb_map_update_ldouble_int64 (vtype_map* x, vtype_ldouble key, vtype_int64 value); +extern bool libcdsb_map_update_ldouble_uint8 (vtype_map* x, vtype_ldouble key, vtype_uint8 value); +extern bool libcdsb_map_update_ldouble_uint16 (vtype_map* x, vtype_ldouble key, vtype_uint16 value); +extern bool libcdsb_map_update_ldouble_uint32 (vtype_map* x, vtype_ldouble key, vtype_uint32 value); +extern bool libcdsb_map_update_ldouble_uint64 (vtype_map* x, vtype_ldouble key, vtype_uint64 value); +extern bool libcdsb_map_update_ldouble_float (vtype_map* x, vtype_ldouble key, vtype_float value); +extern bool libcdsb_map_update_ldouble_double (vtype_map* x, vtype_ldouble key, vtype_double value); +extern bool libcdsb_map_update_ldouble_ldouble(vtype_map* x, vtype_ldouble key, vtype_ldouble value); #endif /* LIBCDSB_MAP_H */ diff --git a/include/set.h b/include/set.h index bf642d7..775ecc8 100644 --- a/include/set.h +++ b/include/set.h @@ -16,44 +16,44 @@ extern void vset_init(vtype_set* x, vtype type); #define in_vset(x, value) _LIBCDSB_Generic (libcdsb_vset, touch, value)(x, value, 0) -extern _Bool libcdsb_vset_push_pointer(vtype_set* x, const void* value); -extern _Bool libcdsb_vset_push_cstring(vtype_set* x, const char* value); -extern _Bool libcdsb_vset_push_string (vtype_set* x, const vtype_string* value); -extern _Bool libcdsb_vset_push_array (vtype_set* x, const vtype_array* value); -extern _Bool libcdsb_vset_push_list (vtype_set* x, const vtype_list* value); -extern _Bool libcdsb_vset_push_map (vtype_set* x, const vtype_map* value); -extern _Bool libcdsb_vset_push_vset (vtype_set* x, const vtype_set* value); -extern _Bool libcdsb_vset_push_boolean(vtype_set* x, vtype_bool value); -extern _Bool libcdsb_vset_push_uint8 (vtype_set* x, vtype_uint8 value); -extern _Bool libcdsb_vset_push_uint16 (vtype_set* x, vtype_uint16 value); -extern _Bool libcdsb_vset_push_uint32 (vtype_set* x, vtype_uint32 value); -extern _Bool libcdsb_vset_push_uint64 (vtype_set* x, vtype_uint64 value); -extern _Bool libcdsb_vset_push_int8 (vtype_set* x, vtype_int8 value); -extern _Bool libcdsb_vset_push_int16 (vtype_set* x, vtype_int16 value); -extern _Bool libcdsb_vset_push_int32 (vtype_set* x, vtype_int32 value); -extern _Bool libcdsb_vset_push_int64 (vtype_set* x, vtype_int64 value); -extern _Bool libcdsb_vset_push_float (vtype_set* x, vtype_float value); -extern _Bool libcdsb_vset_push_double (vtype_set* x, vtype_double value); -extern _Bool libcdsb_vset_push_ldouble(vtype_set* x, vtype_ldouble value); +extern bool libcdsb_vset_push_pointer(vtype_set* x, const void* value); +extern bool libcdsb_vset_push_cstring(vtype_set* x, const char* value); +extern bool libcdsb_vset_push_string (vtype_set* x, const vtype_string* value); +extern bool libcdsb_vset_push_array (vtype_set* x, const vtype_array* value); +extern bool libcdsb_vset_push_list (vtype_set* x, const vtype_list* value); +extern bool libcdsb_vset_push_map (vtype_set* x, const vtype_map* value); +extern bool libcdsb_vset_push_vset (vtype_set* x, const vtype_set* value); +extern bool libcdsb_vset_push_boolean(vtype_set* x, vtype_bool value); +extern bool libcdsb_vset_push_uint8 (vtype_set* x, vtype_uint8 value); +extern bool libcdsb_vset_push_uint16 (vtype_set* x, vtype_uint16 value); +extern bool libcdsb_vset_push_uint32 (vtype_set* x, vtype_uint32 value); +extern bool libcdsb_vset_push_uint64 (vtype_set* x, vtype_uint64 value); +extern bool libcdsb_vset_push_int8 (vtype_set* x, vtype_int8 value); +extern bool libcdsb_vset_push_int16 (vtype_set* x, vtype_int16 value); +extern bool libcdsb_vset_push_int32 (vtype_set* x, vtype_int32 value); +extern bool libcdsb_vset_push_int64 (vtype_set* x, vtype_int64 value); +extern bool libcdsb_vset_push_float (vtype_set* x, vtype_float value); +extern bool libcdsb_vset_push_double (vtype_set* x, vtype_double value); +extern bool libcdsb_vset_push_ldouble(vtype_set* x, vtype_ldouble value); -extern int libcdsb_vset_find_pointer(vtype_set* x, const void* value, void* data, vset_access_callback, _Bool cut); -extern int libcdsb_vset_find_cstring(vtype_set* x, const char* value, void* data, vset_access_callback, _Bool cut); -extern int libcdsb_vset_find_string (vtype_set* x, const vtype_string* value, void* data, vset_access_callback, _Bool cut); -extern int libcdsb_vset_find_array (vtype_set* x, const vtype_array* value, void* data, vset_access_callback, _Bool cut); -extern int libcdsb_vset_find_list (vtype_set* x, const vtype_list* value, void* data, vset_access_callback, _Bool cut); -extern int libcdsb_vset_find_map (vtype_set* x, const vtype_map* value, void* data, vset_access_callback, _Bool cut); -extern int libcdsb_vset_find_vset (vtype_set* x, const vtype_set* value, void* data, vset_access_callback, _Bool cut); -extern int libcdsb_vset_find_boolean(vtype_set* x, vtype_bool value, void* data, vset_access_callback, _Bool cut); -extern int libcdsb_vset_find_uint8 (vtype_set* x, vtype_uint8 value, void* data, vset_access_callback, _Bool cut); -extern int libcdsb_vset_find_uint16 (vtype_set* x, vtype_uint16 value, void* data, vset_access_callback, _Bool cut); -extern int libcdsb_vset_find_uint32 (vtype_set* x, vtype_uint32 value, void* data, vset_access_callback, _Bool cut); -extern int libcdsb_vset_find_uint64 (vtype_set* x, vtype_uint64 value, void* data, vset_access_callback, _Bool cut); -extern int libcdsb_vset_find_int8 (vtype_set* x, vtype_int8 value, void* data, vset_access_callback, _Bool cut); -extern int libcdsb_vset_find_int16 (vtype_set* x, vtype_int16 value, void* data, vset_access_callback, _Bool cut); -extern int libcdsb_vset_find_int32 (vtype_set* x, vtype_int32 value, void* data, vset_access_callback, _Bool cut); -extern int libcdsb_vset_find_int64 (vtype_set* x, vtype_int64 value, void* data, vset_access_callback, _Bool cut); -extern int libcdsb_vset_find_float (vtype_set* x, vtype_float value, void* data, vset_access_callback, _Bool cut); -extern int libcdsb_vset_find_double (vtype_set* x, vtype_double value, void* data, vset_access_callback, _Bool cut); -extern int libcdsb_vset_find_ldouble(vtype_set* x, vtype_ldouble value, void* data, vset_access_callback, _Bool cut); +extern int libcdsb_vset_find_pointer(vtype_set* x, const void* value, void* data, vset_access_callback, bool cut); +extern int libcdsb_vset_find_cstring(vtype_set* x, const char* value, void* data, vset_access_callback, bool cut); +extern int libcdsb_vset_find_string (vtype_set* x, const vtype_string* value, void* data, vset_access_callback, bool cut); +extern int libcdsb_vset_find_array (vtype_set* x, const vtype_array* value, void* data, vset_access_callback, bool cut); +extern int libcdsb_vset_find_list (vtype_set* x, const vtype_list* value, void* data, vset_access_callback, bool cut); +extern int libcdsb_vset_find_map (vtype_set* x, const vtype_map* value, void* data, vset_access_callback, bool cut); +extern int libcdsb_vset_find_vset (vtype_set* x, const vtype_set* value, void* data, vset_access_callback, bool cut); +extern int libcdsb_vset_find_boolean(vtype_set* x, vtype_bool value, void* data, vset_access_callback, bool cut); +extern int libcdsb_vset_find_uint8 (vtype_set* x, vtype_uint8 value, void* data, vset_access_callback, bool cut); +extern int libcdsb_vset_find_uint16 (vtype_set* x, vtype_uint16 value, void* data, vset_access_callback, bool cut); +extern int libcdsb_vset_find_uint32 (vtype_set* x, vtype_uint32 value, void* data, vset_access_callback, bool cut); +extern int libcdsb_vset_find_uint64 (vtype_set* x, vtype_uint64 value, void* data, vset_access_callback, bool cut); +extern int libcdsb_vset_find_int8 (vtype_set* x, vtype_int8 value, void* data, vset_access_callback, bool cut); +extern int libcdsb_vset_find_int16 (vtype_set* x, vtype_int16 value, void* data, vset_access_callback, bool cut); +extern int libcdsb_vset_find_int32 (vtype_set* x, vtype_int32 value, void* data, vset_access_callback, bool cut); +extern int libcdsb_vset_find_int64 (vtype_set* x, vtype_int64 value, void* data, vset_access_callback, bool cut); +extern int libcdsb_vset_find_float (vtype_set* x, vtype_float value, void* data, vset_access_callback, bool cut); +extern int libcdsb_vset_find_double (vtype_set* x, vtype_double value, void* data, vset_access_callback, bool cut); +extern int libcdsb_vset_find_ldouble(vtype_set* x, vtype_ldouble value, void* data, vset_access_callback, bool cut); #endif /* LIBCDSB_SET_H */ diff --git a/include/string.h b/include/string.h index 201abde..6586852 100644 --- a/include/string.h +++ b/include/string.h @@ -13,7 +13,7 @@ extern void string_init(vtype_string* x, const char* value) LIBCDSB_nt__ LIBCDSB_nn1__; extern char* string_at(const vtype_string* s, ssize_t index) LIBCDSB_nt__ LIBCDSB_nn1__; -extern _Bool string_slice(vtype_string* x, vtype_string* s, ssize_t index, size_t nchars, _Bool cut) LIBCDSB_nt__ LIBCDSB_nn12__; +extern bool string_slice(vtype_string* x, vtype_string* s, ssize_t index, size_t nchars, bool cut) LIBCDSB_nt__ LIBCDSB_nn12__; #define string_indexof(s, arg) _LIBCDSB_GenericS(libcdsb_string, indexof, arg)(s, arg) #define string_count(s, arg) _LIBCDSB_GenericS(libcdsb_string, count, arg)(s, arg) @@ -35,9 +35,9 @@ inline size_t libcdsb_string_count_string (const vtype_string* s, const vtype_st extern size_t libcdsb_string_count_cstring(const vtype_string* s, const char* arg) LIBCDSB_pure__ LIBCDSB_nn1__; extern size_t libcdsb_string_count_char (const vtype_string* s, int arg) LIBCDSB_pure__ LIBCDSB_nn1__; -inline _Bool libcdsb_string_concat_string (vtype_string* x, const vtype_string* value) __attribute__((always_inline)); -extern _Bool libcdsb_string_concat_cstring(vtype_string* x, const char* value) LIBCDSB_nt__ LIBCDSB_nn1__; -extern _Bool libcdsb_string_concat_char (vtype_string* x, int value) LIBCDSB_nt__ LIBCDSB_nn1__; +inline bool libcdsb_string_concat_string (vtype_string* x, const vtype_string* value) __attribute__((always_inline)); +extern bool libcdsb_string_concat_cstring(vtype_string* x, const char* value) LIBCDSB_nt__ LIBCDSB_nn1__; +extern bool libcdsb_string_concat_char (vtype_string* x, int value) LIBCDSB_nt__ LIBCDSB_nn1__; extern void libcdsb_string_trim_spaces(vtype_string* x, int direction) LIBCDSB_nt__ LIBCDSB_nn1__; @@ -61,7 +61,7 @@ inline size_t libcdsb_string_count_string(const vtype_string* s, const vtype_st return string_count(s, arg->buffer); } -inline _Bool libcdsb_string_concat_string(vtype_string* x, const vtype_string* s) { +inline bool libcdsb_string_concat_string(vtype_string* x, const vtype_string* s) { return string_concat(x, s->buffer); } diff --git a/include/vtype.h b/include/vtype.h index fd58e25..0ea46fe 100644 --- a/include/vtype.h +++ b/include/vtype.h @@ -44,7 +44,7 @@ struct libcdsb_set { struct libcdsb_rbtree_node* root; vtype type; }; struct libcdsb_list { struct libcdsb_list_node* last; struct libcdsb_list_node* first; }; typedef void* vtype_pointer; -typedef _Bool vtype_bool; +typedef bool vtype_bool; typedef uint_least8_t vtype_uint8; typedef uint_least16_t vtype_uint16; diff --git a/src/__internal/include.h b/src/__internal/include.h index 7418f32..81f1303 100644 --- a/src/__internal/include.h +++ b/src/__internal/include.h @@ -31,8 +31,8 @@ # define nullptr ((void*)0) #endif -#define true ((_Bool)1) -#define false ((_Bool)0) +#define true ((bool)1) +#define false ((bool)0) #define abs(v) _Generic((v), ldbl_t: fabsl, dbl_t: fabs, fl_t: fabsf)(v) diff --git a/src/__internal/vnode.h b/src/__internal/vnode.h index 4399da4..a119e62 100644 --- a/src/__internal/vnode.h +++ b/src/__internal/vnode.h @@ -9,7 +9,7 @@ #define is_permissible(T) (sizeof(void*) >= sizeof(T) && _Alignof(void*) >= _Alignof(T)) typedef union { - void* ptr; _Bool b; + void* ptr; bool b; str_t s; arr_t a; list_t l; map_t m; set_t vs; u8_t u8; u16_t u16; u32_t u32; u64_t u64; diff --git a/src/array/slice.c b/src/array/slice.c index 00c9549..660a2db 100644 --- a/src/array/slice.c +++ b/src/array/slice.c @@ -5,7 +5,7 @@ #include "../__internal/assert.h" #include "../__internal/vnode.h" -_Bool array_slice(arr_t* x, arr_t* s, ssize_t i, size_t n, _Bool cut) { +bool array_slice(arr_t* x, arr_t* s, ssize_t i, size_t n, bool cut) { if (n && s->size) { assert(!is_null(s->mem)); diff --git a/src/list/extra.c b/src/list/extra.c index 0880996..305c7e9 100644 --- a/src/list/extra.c +++ b/src/list/extra.c @@ -22,7 +22,7 @@ static void lnode_cut(list_t* s, lnode_t* cur) { /*#####################################################################################################################*/ -_Bool libcdsb_list_update(list_t* x, ssize_t i, const void* v, vtype t, int ins) { +bool libcdsb_list_update(list_t* x, ssize_t i, const void* v, vtype t, int ins) { ldir_t dir; lnode_t* c; @@ -91,7 +91,7 @@ size_t libcdsb_list_count(const list_t* s, const void* v, vtype t) { } -int libcdsb_list_get(vtype_list* x, ssize_t i, void* _, list_access_callback callback, _Bool cut) { +int libcdsb_list_get(vtype_list* x, ssize_t i, void* _, list_access_callback callback, bool cut) { ldir_t dir; lnode_t* c; @@ -122,7 +122,7 @@ int libcdsb_list_get(vtype_list* x, ssize_t i, void* _, list_access_callback cal } -int libcdsb_list_find(vtype_list* x, const void* v, vtype t, void* _, list_access_callback callback, _Bool r, _Bool cut) { +int libcdsb_list_find(vtype_list* x, const void* v, vtype t, void* _, list_access_callback callback, bool r, bool cut) { ldir_t dir; lnode_t* c; ssize_t i; @@ -151,7 +151,7 @@ int libcdsb_list_find(vtype_list* x, const void* v, vtype t, void* _, list_acces } -int libcdsb_list_foreach(vtype_list* x, void* data, list_access_callback callback, _Bool flush) { +int libcdsb_list_foreach(vtype_list* x, void* data, list_access_callback callback, bool flush) { lnode_t* n; lnode_t* c; diff --git a/src/list/generics.c b/src/list/generics.c index 5a95a71..5e44da7 100644 --- a/src/list/generics.c +++ b/src/list/generics.c @@ -3,25 +3,25 @@ #include "include.h" -int libcdsb_list_find_pointer(list_t* x, const void* v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } -int libcdsb_list_find_cstring(list_t* x, const char* v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } -int libcdsb_list_find_string (list_t* x, const str_t* v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, v, vtypeof( v), _, cb, r, cut); } -int libcdsb_list_find_array (list_t* x, const arr_t* v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, v, vtypeof( v), _, cb, r, cut); } -int libcdsb_list_find_list (list_t* x, const list_t* v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, v, vtypeof( v), _, cb, r, cut); } -int libcdsb_list_find_map (list_t* x, const map_t* v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, v, vtypeof( v), _, cb, r, cut); } -int libcdsb_list_find_vset (list_t* x, const set_t* v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, v, vtypeof( v), _, cb, r, cut); } -int libcdsb_list_find_boolean(list_t* x, _Bool v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } -int libcdsb_list_find_int8 (list_t* x, s8_t v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } -int libcdsb_list_find_int16 (list_t* x, s16_t v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } -int libcdsb_list_find_int32 (list_t* x, s32_t v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } -int libcdsb_list_find_int64 (list_t* x, s64_t v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } -int libcdsb_list_find_uint8 (list_t* x, u8_t v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } -int libcdsb_list_find_uint16 (list_t* x, u16_t v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } -int libcdsb_list_find_uint32 (list_t* x, u32_t v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } -int libcdsb_list_find_uint64 (list_t* x, u64_t v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } -int libcdsb_list_find_float (list_t* x, fl_t v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } -int libcdsb_list_find_double (list_t* x, dbl_t v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } -int libcdsb_list_find_ldouble(list_t* x, ldbl_t v, void* _, list_access_callback cb, _Bool r, _Bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } +int libcdsb_list_find_pointer(list_t* x, const void* v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } +int libcdsb_list_find_cstring(list_t* x, const char* v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } +int libcdsb_list_find_string (list_t* x, const str_t* v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, v, vtypeof( v), _, cb, r, cut); } +int libcdsb_list_find_array (list_t* x, const arr_t* v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, v, vtypeof( v), _, cb, r, cut); } +int libcdsb_list_find_list (list_t* x, const list_t* v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, v, vtypeof( v), _, cb, r, cut); } +int libcdsb_list_find_map (list_t* x, const map_t* v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, v, vtypeof( v), _, cb, r, cut); } +int libcdsb_list_find_vset (list_t* x, const set_t* v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, v, vtypeof( v), _, cb, r, cut); } +int libcdsb_list_find_boolean(list_t* x, bool v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } +int libcdsb_list_find_int8 (list_t* x, s8_t v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } +int libcdsb_list_find_int16 (list_t* x, s16_t v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } +int libcdsb_list_find_int32 (list_t* x, s32_t v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } +int libcdsb_list_find_int64 (list_t* x, s64_t v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } +int libcdsb_list_find_uint8 (list_t* x, u8_t v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } +int libcdsb_list_find_uint16 (list_t* x, u16_t v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } +int libcdsb_list_find_uint32 (list_t* x, u32_t v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } +int libcdsb_list_find_uint64 (list_t* x, u64_t v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } +int libcdsb_list_find_float (list_t* x, fl_t v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } +int libcdsb_list_find_double (list_t* x, dbl_t v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } +int libcdsb_list_find_ldouble(list_t* x, ldbl_t v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); } size_t libcdsb_list_count_pointer(const list_t* s, const void* v) { return libcdsb_list_count((void*)s, &v, vtypeof(&v)); } size_t libcdsb_list_count_cstring(const list_t* s, const char* v) { return libcdsb_list_count((void*)s, &v, vtypeof(&v)); } @@ -30,7 +30,7 @@ size_t libcdsb_list_count_array (const list_t* s, const arr_t* v) { return lib size_t libcdsb_list_count_list (const list_t* s, const list_t* v) { return libcdsb_list_count((void*)s, v, vtypeof( v)); } size_t libcdsb_list_count_map (const list_t* s, const map_t* v) { return libcdsb_list_count((void*)s, v, vtypeof( v)); } size_t libcdsb_list_count_vset (const list_t* s, const set_t* v) { return libcdsb_list_count((void*)s, v, vtypeof( v)); } -size_t libcdsb_list_count_boolean(const list_t* s, _Bool v) { return libcdsb_list_count((void*)s, &v, vtypeof(&v)); } +size_t libcdsb_list_count_boolean(const list_t* s, bool v) { return libcdsb_list_count((void*)s, &v, vtypeof(&v)); } size_t libcdsb_list_count_int8 (const list_t* s, s8_t v) { return libcdsb_list_count((void*)s, &v, vtypeof(&v)); } size_t libcdsb_list_count_int16 (const list_t* s, s16_t v) { return libcdsb_list_count((void*)s, &v, vtypeof(&v)); } size_t libcdsb_list_count_int32 (const list_t* s, s32_t v) { return libcdsb_list_count((void*)s, &v, vtypeof(&v)); } @@ -43,22 +43,22 @@ size_t libcdsb_list_count_float (const list_t* s, fl_t v) { return lib size_t libcdsb_list_count_double (const list_t* s, dbl_t v) { return libcdsb_list_count((void*)s, &v, vtypeof(&v)); } size_t libcdsb_list_count_ldouble(const list_t* s, ldbl_t v) { return libcdsb_list_count((void*)s, &v, vtypeof(&v)); } -_Bool libcdsb_list_update_pointer(list_t* x, ssize_t i, const void* v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); } -_Bool libcdsb_list_update_cstring(list_t* x, ssize_t i, const char* v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); } -_Bool libcdsb_list_update_string (list_t* x, ssize_t i, const str_t* v, int ins) { return libcdsb_list_update(x, i, v, vtypeof( v), ins); } -_Bool libcdsb_list_update_array (list_t* x, ssize_t i, const arr_t* v, int ins) { return libcdsb_list_update(x, i, v, vtypeof( v), ins); } -_Bool libcdsb_list_update_list (list_t* x, ssize_t i, const list_t* v, int ins) { return libcdsb_list_update(x, i, v, vtypeof( v), ins); } -_Bool libcdsb_list_update_map (list_t* x, ssize_t i, const map_t* v, int ins) { return libcdsb_list_update(x, i, v, vtypeof( v), ins); } -_Bool libcdsb_list_update_vset (list_t* x, ssize_t i, const set_t* v, int ins) { return libcdsb_list_update(x, i, v, vtypeof( v), ins); } -_Bool libcdsb_list_update_boolean(list_t* x, ssize_t i, _Bool v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); } -_Bool libcdsb_list_update_int8 (list_t* x, ssize_t i, s8_t v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); } -_Bool libcdsb_list_update_int16 (list_t* x, ssize_t i, s16_t v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); } -_Bool libcdsb_list_update_int32 (list_t* x, ssize_t i, s32_t v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); } -_Bool libcdsb_list_update_int64 (list_t* x, ssize_t i, s64_t v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); } -_Bool libcdsb_list_update_uint8 (list_t* x, ssize_t i, u8_t v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); } -_Bool libcdsb_list_update_uint16 (list_t* x, ssize_t i, u16_t v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); } -_Bool libcdsb_list_update_uint32 (list_t* x, ssize_t i, u32_t v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); } -_Bool libcdsb_list_update_uint64 (list_t* x, ssize_t i, u64_t v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); } -_Bool libcdsb_list_update_float (list_t* x, ssize_t i, fl_t v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); } -_Bool libcdsb_list_update_double (list_t* x, ssize_t i, dbl_t v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); } -_Bool libcdsb_list_update_ldouble(list_t* x, ssize_t i, ldbl_t v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); } +bool libcdsb_list_update_pointer(list_t* x, ssize_t i, const void* v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); } +bool libcdsb_list_update_cstring(list_t* x, ssize_t i, const char* v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); } +bool libcdsb_list_update_string (list_t* x, ssize_t i, const str_t* v, int ins) { return libcdsb_list_update(x, i, v, vtypeof( v), ins); } +bool libcdsb_list_update_array (list_t* x, ssize_t i, const arr_t* v, int ins) { return libcdsb_list_update(x, i, v, vtypeof( v), ins); } +bool libcdsb_list_update_list (list_t* x, ssize_t i, const list_t* v, int ins) { return libcdsb_list_update(x, i, v, vtypeof( v), ins); } +bool libcdsb_list_update_map (list_t* x, ssize_t i, const map_t* v, int ins) { return libcdsb_list_update(x, i, v, vtypeof( v), ins); } +bool libcdsb_list_update_vset (list_t* x, ssize_t i, const set_t* v, int ins) { return libcdsb_list_update(x, i, v, vtypeof( v), ins); } +bool libcdsb_list_update_boolean(list_t* x, ssize_t i, bool v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); } +bool libcdsb_list_update_int8 (list_t* x, ssize_t i, s8_t v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); } +bool libcdsb_list_update_int16 (list_t* x, ssize_t i, s16_t v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); } +bool libcdsb_list_update_int32 (list_t* x, ssize_t i, s32_t v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); } +bool libcdsb_list_update_int64 (list_t* x, ssize_t i, s64_t v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); } +bool libcdsb_list_update_uint8 (list_t* x, ssize_t i, u8_t v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); } +bool libcdsb_list_update_uint16 (list_t* x, ssize_t i, u16_t v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); } +bool libcdsb_list_update_uint32 (list_t* x, ssize_t i, u32_t v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); } +bool libcdsb_list_update_uint64 (list_t* x, ssize_t i, u64_t v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); } +bool libcdsb_list_update_float (list_t* x, ssize_t i, fl_t v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); } +bool libcdsb_list_update_double (list_t* x, ssize_t i, dbl_t v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); } +bool libcdsb_list_update_ldouble(list_t* x, ssize_t i, ldbl_t v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); } diff --git a/src/map/extra.c b/src/map/extra.c index d9cb163..0c553e1 100644 --- a/src/map/extra.c +++ b/src/map/extra.c @@ -3,7 +3,7 @@ #include "include.h" -_Bool libcdsb_map_update(map_t* x, const void* k, vtype kt, const void* v, vtype vt) { +bool libcdsb_map_update(map_t* x, const void* k, vtype kt, const void* v, vtype vt) { int cmp; mnode_t* n; mnode_t* p; @@ -50,7 +50,7 @@ _Bool libcdsb_map_update(map_t* x, const void* k, vtype kt, const void* v, vtype } -int libcdsb_map_find(map_t* x, const void* k, vtype t, void* _, map_access_callback callback, _Bool cut) { +int libcdsb_map_find(map_t* x, const void* k, vtype t, void* _, map_access_callback callback, bool cut) { mnode_t* c; void *key; int cmp; @@ -80,7 +80,7 @@ int libcdsb_map_find(map_t* x, const void* k, vtype t, void* _, map_access_callb } -int libcdsb_map_foreach(map_t* x, void* dt, map_access_callback callback, _Bool flush) { +int libcdsb_map_foreach(map_t* x, void* dt, map_access_callback callback, bool flush) { stack_t z = { .prev = 0, .value = x->root }; int r = 0; mnode_t* c; diff --git a/src/map/generics.c b/src/map/generics.c index 72a98b2..a8e1642 100644 --- a/src/map/generics.c +++ b/src/map/generics.c @@ -3,402 +3,402 @@ #include "include.h" -int libcdsb_map_find_pointer(map_t* x, const void* k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } -int libcdsb_map_find_cstring(map_t* x, const char* k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } -int libcdsb_map_find_string (map_t* x, const str_t* k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, k, vtypeof( k), _, cb, cut); } -int libcdsb_map_find_array (map_t* x, const arr_t* k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, k, vtypeof( k), _, cb, cut); } -int libcdsb_map_find_list (map_t* x, const list_t* k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, k, vtypeof( k), _, cb, cut); } -int libcdsb_map_find_map (map_t* x, const map_t* k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, k, vtypeof( k), _, cb, cut); } -int libcdsb_map_find_vset (map_t* x, const set_t* k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, k, vtypeof( k), _, cb, cut); } -int libcdsb_map_find_boolean(map_t* x, _Bool k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } -int libcdsb_map_find_int8 (map_t* x, s8_t k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } -int libcdsb_map_find_int16 (map_t* x, s16_t k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } -int libcdsb_map_find_int32 (map_t* x, s32_t k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } -int libcdsb_map_find_int64 (map_t* x, s64_t k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } -int libcdsb_map_find_uint8 (map_t* x, u8_t k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } -int libcdsb_map_find_uint16 (map_t* x, u16_t k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } -int libcdsb_map_find_uint32 (map_t* x, u32_t k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } -int libcdsb_map_find_uint64 (map_t* x, u64_t k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } -int libcdsb_map_find_float (map_t* x, fl_t k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } -int libcdsb_map_find_double (map_t* x, dbl_t k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } -int libcdsb_map_find_ldouble(map_t* x, ldbl_t k, void* _, map_access_callback cb, _Bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } +int libcdsb_map_find_pointer(map_t* x, const void* k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } +int libcdsb_map_find_cstring(map_t* x, const char* k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } +int libcdsb_map_find_string (map_t* x, const str_t* k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, k, vtypeof( k), _, cb, cut); } +int libcdsb_map_find_array (map_t* x, const arr_t* k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, k, vtypeof( k), _, cb, cut); } +int libcdsb_map_find_list (map_t* x, const list_t* k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, k, vtypeof( k), _, cb, cut); } +int libcdsb_map_find_map (map_t* x, const map_t* k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, k, vtypeof( k), _, cb, cut); } +int libcdsb_map_find_vset (map_t* x, const set_t* k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, k, vtypeof( k), _, cb, cut); } +int libcdsb_map_find_boolean(map_t* x, bool k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } +int libcdsb_map_find_int8 (map_t* x, s8_t k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } +int libcdsb_map_find_int16 (map_t* x, s16_t k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } +int libcdsb_map_find_int32 (map_t* x, s32_t k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } +int libcdsb_map_find_int64 (map_t* x, s64_t k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } +int libcdsb_map_find_uint8 (map_t* x, u8_t k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } +int libcdsb_map_find_uint16 (map_t* x, u16_t k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } +int libcdsb_map_find_uint32 (map_t* x, u32_t k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } +int libcdsb_map_find_uint64 (map_t* x, u64_t k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } +int libcdsb_map_find_float (map_t* x, fl_t k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } +int libcdsb_map_find_double (map_t* x, dbl_t k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } +int libcdsb_map_find_ldouble(map_t* x, ldbl_t k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); } -_Bool libcdsb_map_update_pointer_pointer(map_t* x, const void* k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_pointer_cstring(map_t* x, const void* k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_pointer_string (map_t* x, const void* k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_pointer_array (map_t* x, const void* k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_pointer_list (map_t* x, const void* k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_pointer_map (map_t* x, const void* k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_pointer_vset (map_t* x, const void* k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_pointer_boolean(map_t* x, const void* k, _Bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_pointer_int8 (map_t* x, const void* k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_pointer_int16 (map_t* x, const void* k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_pointer_int32 (map_t* x, const void* k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_pointer_int64 (map_t* x, const void* k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_pointer_uint8 (map_t* x, const void* k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_pointer_uint16 (map_t* x, const void* k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_pointer_uint32 (map_t* x, const void* k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_pointer_uint64 (map_t* x, const void* k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_pointer_float (map_t* x, const void* k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_pointer_double (map_t* x, const void* k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_pointer_ldouble(map_t* x, const void* k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_pointer_pointer(map_t* x, const void* k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_pointer_cstring(map_t* x, const void* k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_pointer_string (map_t* x, const void* k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_pointer_array (map_t* x, const void* k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_pointer_list (map_t* x, const void* k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_pointer_map (map_t* x, const void* k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_pointer_vset (map_t* x, const void* k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_pointer_boolean(map_t* x, const void* k, bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_pointer_int8 (map_t* x, const void* k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_pointer_int16 (map_t* x, const void* k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_pointer_int32 (map_t* x, const void* k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_pointer_int64 (map_t* x, const void* k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_pointer_uint8 (map_t* x, const void* k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_pointer_uint16 (map_t* x, const void* k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_pointer_uint32 (map_t* x, const void* k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_pointer_uint64 (map_t* x, const void* k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_pointer_float (map_t* x, const void* k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_pointer_double (map_t* x, const void* k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_pointer_ldouble(map_t* x, const void* k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_cstring_pointer(map_t* x, const char* k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_cstring_cstring(map_t* x, const char* k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_cstring_string (map_t* x, const char* k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_cstring_array (map_t* x, const char* k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_cstring_list (map_t* x, const char* k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_cstring_map (map_t* x, const char* k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_cstring_vset (map_t* x, const char* k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_cstring_boolean(map_t* x, const char* k, _Bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_cstring_int8 (map_t* x, const char* k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_cstring_int16 (map_t* x, const char* k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_cstring_int32 (map_t* x, const char* k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_cstring_int64 (map_t* x, const char* k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_cstring_uint8 (map_t* x, const char* k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_cstring_uint16 (map_t* x, const char* k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_cstring_uint32 (map_t* x, const char* k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_cstring_uint64 (map_t* x, const char* k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_cstring_float (map_t* x, const char* k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_cstring_double (map_t* x, const char* k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_cstring_ldouble(map_t* x, const char* k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_cstring_pointer(map_t* x, const char* k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_cstring_cstring(map_t* x, const char* k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_cstring_string (map_t* x, const char* k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_cstring_array (map_t* x, const char* k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_cstring_list (map_t* x, const char* k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_cstring_map (map_t* x, const char* k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_cstring_vset (map_t* x, const char* k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_cstring_boolean(map_t* x, const char* k, bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_cstring_int8 (map_t* x, const char* k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_cstring_int16 (map_t* x, const char* k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_cstring_int32 (map_t* x, const char* k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_cstring_int64 (map_t* x, const char* k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_cstring_uint8 (map_t* x, const char* k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_cstring_uint16 (map_t* x, const char* k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_cstring_uint32 (map_t* x, const char* k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_cstring_uint64 (map_t* x, const char* k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_cstring_float (map_t* x, const char* k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_cstring_double (map_t* x, const char* k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_cstring_ldouble(map_t* x, const char* k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_string_pointer(map_t* x, const str_t* k, const void* v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_string_cstring(map_t* x, const str_t* k, const char* v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_string_string (map_t* x, const str_t* k, const str_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } -_Bool libcdsb_map_update_string_array (map_t* x, const str_t* k, const arr_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } -_Bool libcdsb_map_update_string_list (map_t* x, const str_t* k, const list_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } -_Bool libcdsb_map_update_string_map (map_t* x, const str_t* k, const map_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } -_Bool libcdsb_map_update_string_vset (map_t* x, const str_t* k, const set_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } -_Bool libcdsb_map_update_string_boolean(map_t* x, const str_t* k, _Bool v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_string_int8 (map_t* x, const str_t* k, s8_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_string_int16 (map_t* x, const str_t* k, s16_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_string_int32 (map_t* x, const str_t* k, s32_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_string_int64 (map_t* x, const str_t* k, s64_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_string_uint8 (map_t* x, const str_t* k, u8_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_string_uint16 (map_t* x, const str_t* k, u16_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_string_uint32 (map_t* x, const str_t* k, u32_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_string_uint64 (map_t* x, const str_t* k, u64_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_string_float (map_t* x, const str_t* k, fl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_string_double (map_t* x, const str_t* k, dbl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_string_ldouble(map_t* x, const str_t* k, ldbl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_string_pointer(map_t* x, const str_t* k, const void* v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_string_cstring(map_t* x, const str_t* k, const char* v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_string_string (map_t* x, const str_t* k, const str_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } +bool libcdsb_map_update_string_array (map_t* x, const str_t* k, const arr_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } +bool libcdsb_map_update_string_list (map_t* x, const str_t* k, const list_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } +bool libcdsb_map_update_string_map (map_t* x, const str_t* k, const map_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } +bool libcdsb_map_update_string_vset (map_t* x, const str_t* k, const set_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } +bool libcdsb_map_update_string_boolean(map_t* x, const str_t* k, bool v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_string_int8 (map_t* x, const str_t* k, s8_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_string_int16 (map_t* x, const str_t* k, s16_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_string_int32 (map_t* x, const str_t* k, s32_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_string_int64 (map_t* x, const str_t* k, s64_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_string_uint8 (map_t* x, const str_t* k, u8_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_string_uint16 (map_t* x, const str_t* k, u16_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_string_uint32 (map_t* x, const str_t* k, u32_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_string_uint64 (map_t* x, const str_t* k, u64_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_string_float (map_t* x, const str_t* k, fl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_string_double (map_t* x, const str_t* k, dbl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_string_ldouble(map_t* x, const str_t* k, ldbl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_array_pointer(map_t* x, const arr_t* k, const void* v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_array_cstring(map_t* x, const arr_t* k, const char* v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_array_string (map_t* x, const arr_t* k, const str_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } -_Bool libcdsb_map_update_array_array (map_t* x, const arr_t* k, const arr_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } -_Bool libcdsb_map_update_array_list (map_t* x, const arr_t* k, const list_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } -_Bool libcdsb_map_update_array_map (map_t* x, const arr_t* k, const map_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } -_Bool libcdsb_map_update_array_vset (map_t* x, const arr_t* k, const set_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } -_Bool libcdsb_map_update_array_boolean(map_t* x, const arr_t* k, _Bool v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_array_int8 (map_t* x, const arr_t* k, s8_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_array_int16 (map_t* x, const arr_t* k, s16_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_array_int32 (map_t* x, const arr_t* k, s32_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_array_int64 (map_t* x, const arr_t* k, s64_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_array_uint8 (map_t* x, const arr_t* k, u8_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_array_uint16 (map_t* x, const arr_t* k, u16_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_array_uint32 (map_t* x, const arr_t* k, u32_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_array_uint64 (map_t* x, const arr_t* k, u64_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_array_float (map_t* x, const arr_t* k, fl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_array_double (map_t* x, const arr_t* k, dbl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_array_ldouble(map_t* x, const arr_t* k, ldbl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_array_pointer(map_t* x, const arr_t* k, const void* v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_array_cstring(map_t* x, const arr_t* k, const char* v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_array_string (map_t* x, const arr_t* k, const str_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } +bool libcdsb_map_update_array_array (map_t* x, const arr_t* k, const arr_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } +bool libcdsb_map_update_array_list (map_t* x, const arr_t* k, const list_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } +bool libcdsb_map_update_array_map (map_t* x, const arr_t* k, const map_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } +bool libcdsb_map_update_array_vset (map_t* x, const arr_t* k, const set_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } +bool libcdsb_map_update_array_boolean(map_t* x, const arr_t* k, bool v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_array_int8 (map_t* x, const arr_t* k, s8_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_array_int16 (map_t* x, const arr_t* k, s16_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_array_int32 (map_t* x, const arr_t* k, s32_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_array_int64 (map_t* x, const arr_t* k, s64_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_array_uint8 (map_t* x, const arr_t* k, u8_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_array_uint16 (map_t* x, const arr_t* k, u16_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_array_uint32 (map_t* x, const arr_t* k, u32_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_array_uint64 (map_t* x, const arr_t* k, u64_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_array_float (map_t* x, const arr_t* k, fl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_array_double (map_t* x, const arr_t* k, dbl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_array_ldouble(map_t* x, const arr_t* k, ldbl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_list_pointer(map_t* x, const list_t* k, const void* v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_list_cstring(map_t* x, const list_t* k, const char* v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_list_string (map_t* x, const list_t* k, const str_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } -_Bool libcdsb_map_update_list_array (map_t* x, const list_t* k, const arr_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } -_Bool libcdsb_map_update_list_list (map_t* x, const list_t* k, const list_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } -_Bool libcdsb_map_update_list_map (map_t* x, const list_t* k, const map_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } -_Bool libcdsb_map_update_list_vset (map_t* x, const list_t* k, const set_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } -_Bool libcdsb_map_update_list_boolean(map_t* x, const list_t* k, _Bool v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_list_int8 (map_t* x, const list_t* k, s8_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_list_int16 (map_t* x, const list_t* k, s16_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_list_int32 (map_t* x, const list_t* k, s32_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_list_int64 (map_t* x, const list_t* k, s64_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_list_uint8 (map_t* x, const list_t* k, u8_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_list_uint16 (map_t* x, const list_t* k, u16_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_list_uint32 (map_t* x, const list_t* k, u32_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_list_uint64 (map_t* x, const list_t* k, u64_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_list_float (map_t* x, const list_t* k, fl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_list_double (map_t* x, const list_t* k, dbl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_list_ldouble(map_t* x, const list_t* k, ldbl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_list_pointer(map_t* x, const list_t* k, const void* v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_list_cstring(map_t* x, const list_t* k, const char* v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_list_string (map_t* x, const list_t* k, const str_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } +bool libcdsb_map_update_list_array (map_t* x, const list_t* k, const arr_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } +bool libcdsb_map_update_list_list (map_t* x, const list_t* k, const list_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } +bool libcdsb_map_update_list_map (map_t* x, const list_t* k, const map_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } +bool libcdsb_map_update_list_vset (map_t* x, const list_t* k, const set_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } +bool libcdsb_map_update_list_boolean(map_t* x, const list_t* k, bool v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_list_int8 (map_t* x, const list_t* k, s8_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_list_int16 (map_t* x, const list_t* k, s16_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_list_int32 (map_t* x, const list_t* k, s32_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_list_int64 (map_t* x, const list_t* k, s64_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_list_uint8 (map_t* x, const list_t* k, u8_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_list_uint16 (map_t* x, const list_t* k, u16_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_list_uint32 (map_t* x, const list_t* k, u32_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_list_uint64 (map_t* x, const list_t* k, u64_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_list_float (map_t* x, const list_t* k, fl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_list_double (map_t* x, const list_t* k, dbl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_list_ldouble(map_t* x, const list_t* k, ldbl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_map_pointer(map_t* x, const map_t* k, const void* v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_map_cstring(map_t* x, const map_t* k, const char* v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_map_string (map_t* x, const map_t* k, const str_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } -_Bool libcdsb_map_update_map_array (map_t* x, const map_t* k, const arr_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } -_Bool libcdsb_map_update_map_list (map_t* x, const map_t* k, const list_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } -_Bool libcdsb_map_update_map_map (map_t* x, const map_t* k, const map_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } -_Bool libcdsb_map_update_map_vset (map_t* x, const map_t* k, const set_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } -_Bool libcdsb_map_update_map_boolean(map_t* x, const map_t* k, _Bool v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_map_int8 (map_t* x, const map_t* k, s8_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_map_int16 (map_t* x, const map_t* k, s16_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_map_int32 (map_t* x, const map_t* k, s32_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_map_int64 (map_t* x, const map_t* k, s64_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_map_uint8 (map_t* x, const map_t* k, u8_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_map_uint16 (map_t* x, const map_t* k, u16_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_map_uint32 (map_t* x, const map_t* k, u32_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_map_uint64 (map_t* x, const map_t* k, u64_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_map_float (map_t* x, const map_t* k, fl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_map_double (map_t* x, const map_t* k, dbl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_map_ldouble(map_t* x, const map_t* k, ldbl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_map_pointer(map_t* x, const map_t* k, const void* v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_map_cstring(map_t* x, const map_t* k, const char* v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_map_string (map_t* x, const map_t* k, const str_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } +bool libcdsb_map_update_map_array (map_t* x, const map_t* k, const arr_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } +bool libcdsb_map_update_map_list (map_t* x, const map_t* k, const list_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } +bool libcdsb_map_update_map_map (map_t* x, const map_t* k, const map_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } +bool libcdsb_map_update_map_vset (map_t* x, const map_t* k, const set_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } +bool libcdsb_map_update_map_boolean(map_t* x, const map_t* k, bool v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_map_int8 (map_t* x, const map_t* k, s8_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_map_int16 (map_t* x, const map_t* k, s16_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_map_int32 (map_t* x, const map_t* k, s32_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_map_int64 (map_t* x, const map_t* k, s64_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_map_uint8 (map_t* x, const map_t* k, u8_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_map_uint16 (map_t* x, const map_t* k, u16_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_map_uint32 (map_t* x, const map_t* k, u32_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_map_uint64 (map_t* x, const map_t* k, u64_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_map_float (map_t* x, const map_t* k, fl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_map_double (map_t* x, const map_t* k, dbl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_map_ldouble(map_t* x, const map_t* k, ldbl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_vset_pointer(map_t* x, const set_t* k, const void* v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_vset_cstring(map_t* x, const set_t* k, const char* v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_vset_string (map_t* x, const set_t* k, const str_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } -_Bool libcdsb_map_update_vset_array (map_t* x, const set_t* k, const arr_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } -_Bool libcdsb_map_update_vset_list (map_t* x, const set_t* k, const list_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } -_Bool libcdsb_map_update_vset_map (map_t* x, const set_t* k, const map_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } -_Bool libcdsb_map_update_vset_vset (map_t* x, const set_t* k, const set_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } -_Bool libcdsb_map_update_vset_boolean(map_t* x, const set_t* k, _Bool v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_vset_int8 (map_t* x, const set_t* k, s8_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_vset_int16 (map_t* x, const set_t* k, s16_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_vset_int32 (map_t* x, const set_t* k, s32_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_vset_int64 (map_t* x, const set_t* k, s64_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_vset_uint8 (map_t* x, const set_t* k, u8_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_vset_uint16 (map_t* x, const set_t* k, u16_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_vset_uint32 (map_t* x, const set_t* k, u32_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_vset_uint64 (map_t* x, const set_t* k, u64_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_vset_float (map_t* x, const set_t* k, fl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_vset_double (map_t* x, const set_t* k, dbl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_vset_ldouble(map_t* x, const set_t* k, ldbl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_vset_pointer(map_t* x, const set_t* k, const void* v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_vset_cstring(map_t* x, const set_t* k, const char* v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_vset_string (map_t* x, const set_t* k, const str_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } +bool libcdsb_map_update_vset_array (map_t* x, const set_t* k, const arr_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } +bool libcdsb_map_update_vset_list (map_t* x, const set_t* k, const list_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } +bool libcdsb_map_update_vset_map (map_t* x, const set_t* k, const map_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } +bool libcdsb_map_update_vset_vset (map_t* x, const set_t* k, const set_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); } +bool libcdsb_map_update_vset_boolean(map_t* x, const set_t* k, bool v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_vset_int8 (map_t* x, const set_t* k, s8_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_vset_int16 (map_t* x, const set_t* k, s16_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_vset_int32 (map_t* x, const set_t* k, s32_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_vset_int64 (map_t* x, const set_t* k, s64_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_vset_uint8 (map_t* x, const set_t* k, u8_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_vset_uint16 (map_t* x, const set_t* k, u16_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_vset_uint32 (map_t* x, const set_t* k, u32_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_vset_uint64 (map_t* x, const set_t* k, u64_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_vset_float (map_t* x, const set_t* k, fl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_vset_double (map_t* x, const set_t* k, dbl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } +bool libcdsb_map_update_vset_ldouble(map_t* x, const set_t* k, ldbl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_boolean_pointer(map_t* x, const _Bool k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_boolean_cstring(map_t* x, const _Bool k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_boolean_string (map_t* x, const _Bool k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_boolean_array (map_t* x, const _Bool k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_boolean_list (map_t* x, const _Bool k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_boolean_map (map_t* x, const _Bool k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_boolean_vset (map_t* x, const _Bool k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_boolean_boolean(map_t* x, const _Bool k, _Bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_boolean_int8 (map_t* x, const _Bool k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_boolean_int16 (map_t* x, const _Bool k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_boolean_int32 (map_t* x, const _Bool k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_boolean_int64 (map_t* x, const _Bool k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_boolean_uint8 (map_t* x, const _Bool k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_boolean_uint16 (map_t* x, const _Bool k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_boolean_uint32 (map_t* x, const _Bool k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_boolean_uint64 (map_t* x, const _Bool k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_boolean_float (map_t* x, const _Bool k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_boolean_double (map_t* x, const _Bool k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_boolean_ldouble(map_t* x, const _Bool k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_boolean_pointer(map_t* x, const bool k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_boolean_cstring(map_t* x, const bool k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_boolean_string (map_t* x, const bool k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_boolean_array (map_t* x, const bool k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_boolean_list (map_t* x, const bool k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_boolean_map (map_t* x, const bool k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_boolean_vset (map_t* x, const bool k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_boolean_boolean(map_t* x, const bool k, bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_boolean_int8 (map_t* x, const bool k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_boolean_int16 (map_t* x, const bool k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_boolean_int32 (map_t* x, const bool k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_boolean_int64 (map_t* x, const bool k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_boolean_uint8 (map_t* x, const bool k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_boolean_uint16 (map_t* x, const bool k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_boolean_uint32 (map_t* x, const bool k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_boolean_uint64 (map_t* x, const bool k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_boolean_float (map_t* x, const bool k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_boolean_double (map_t* x, const bool k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_boolean_ldouble(map_t* x, const bool k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int8_pointer(map_t* x, const s8_t k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int8_cstring(map_t* x, const s8_t k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int8_string (map_t* x, const s8_t k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_int8_array (map_t* x, const s8_t k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_int8_list (map_t* x, const s8_t k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_int8_map (map_t* x, const s8_t k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_int8_vset (map_t* x, const s8_t k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_int8_boolean(map_t* x, const s8_t k, _Bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int8_int8 (map_t* x, const s8_t k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int8_int16 (map_t* x, const s8_t k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int8_int32 (map_t* x, const s8_t k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int8_int64 (map_t* x, const s8_t k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int8_uint8 (map_t* x, const s8_t k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int8_uint16 (map_t* x, const s8_t k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int8_uint32 (map_t* x, const s8_t k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int8_uint64 (map_t* x, const s8_t k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int8_float (map_t* x, const s8_t k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int8_double (map_t* x, const s8_t k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int8_ldouble(map_t* x, const s8_t k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int8_pointer(map_t* x, const s8_t k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int8_cstring(map_t* x, const s8_t k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int8_string (map_t* x, const s8_t k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_int8_array (map_t* x, const s8_t k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_int8_list (map_t* x, const s8_t k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_int8_map (map_t* x, const s8_t k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_int8_vset (map_t* x, const s8_t k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_int8_boolean(map_t* x, const s8_t k, bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int8_int8 (map_t* x, const s8_t k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int8_int16 (map_t* x, const s8_t k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int8_int32 (map_t* x, const s8_t k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int8_int64 (map_t* x, const s8_t k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int8_uint8 (map_t* x, const s8_t k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int8_uint16 (map_t* x, const s8_t k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int8_uint32 (map_t* x, const s8_t k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int8_uint64 (map_t* x, const s8_t k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int8_float (map_t* x, const s8_t k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int8_double (map_t* x, const s8_t k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int8_ldouble(map_t* x, const s8_t k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int16_pointer(map_t* x, const s16_t k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int16_cstring(map_t* x, const s16_t k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int16_string (map_t* x, const s16_t k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_int16_array (map_t* x, const s16_t k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_int16_list (map_t* x, const s16_t k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_int16_map (map_t* x, const s16_t k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_int16_vset (map_t* x, const s16_t k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_int16_boolean(map_t* x, const s16_t k, _Bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int16_int8 (map_t* x, const s16_t k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int16_int16 (map_t* x, const s16_t k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int16_int32 (map_t* x, const s16_t k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int16_int64 (map_t* x, const s16_t k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int16_uint8 (map_t* x, const s16_t k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int16_uint16 (map_t* x, const s16_t k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int16_uint32 (map_t* x, const s16_t k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int16_uint64 (map_t* x, const s16_t k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int16_float (map_t* x, const s16_t k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int16_double (map_t* x, const s16_t k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int16_ldouble(map_t* x, const s16_t k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int16_pointer(map_t* x, const s16_t k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int16_cstring(map_t* x, const s16_t k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int16_string (map_t* x, const s16_t k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_int16_array (map_t* x, const s16_t k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_int16_list (map_t* x, const s16_t k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_int16_map (map_t* x, const s16_t k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_int16_vset (map_t* x, const s16_t k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_int16_boolean(map_t* x, const s16_t k, bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int16_int8 (map_t* x, const s16_t k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int16_int16 (map_t* x, const s16_t k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int16_int32 (map_t* x, const s16_t k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int16_int64 (map_t* x, const s16_t k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int16_uint8 (map_t* x, const s16_t k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int16_uint16 (map_t* x, const s16_t k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int16_uint32 (map_t* x, const s16_t k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int16_uint64 (map_t* x, const s16_t k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int16_float (map_t* x, const s16_t k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int16_double (map_t* x, const s16_t k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int16_ldouble(map_t* x, const s16_t k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int32_pointer(map_t* x, const s32_t k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int32_cstring(map_t* x, const s32_t k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int32_string (map_t* x, const s32_t k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_int32_array (map_t* x, const s32_t k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_int32_list (map_t* x, const s32_t k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_int32_map (map_t* x, const s32_t k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_int32_vset (map_t* x, const s32_t k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_int32_boolean(map_t* x, const s32_t k, _Bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int32_int8 (map_t* x, const s32_t k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int32_int16 (map_t* x, const s32_t k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int32_int32 (map_t* x, const s32_t k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int32_int64 (map_t* x, const s32_t k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int32_uint8 (map_t* x, const s32_t k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int32_uint16 (map_t* x, const s32_t k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int32_uint32 (map_t* x, const s32_t k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int32_uint64 (map_t* x, const s32_t k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int32_float (map_t* x, const s32_t k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int32_double (map_t* x, const s32_t k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int32_ldouble(map_t* x, const s32_t k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int32_pointer(map_t* x, const s32_t k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int32_cstring(map_t* x, const s32_t k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int32_string (map_t* x, const s32_t k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_int32_array (map_t* x, const s32_t k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_int32_list (map_t* x, const s32_t k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_int32_map (map_t* x, const s32_t k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_int32_vset (map_t* x, const s32_t k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_int32_boolean(map_t* x, const s32_t k, bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int32_int8 (map_t* x, const s32_t k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int32_int16 (map_t* x, const s32_t k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int32_int32 (map_t* x, const s32_t k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int32_int64 (map_t* x, const s32_t k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int32_uint8 (map_t* x, const s32_t k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int32_uint16 (map_t* x, const s32_t k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int32_uint32 (map_t* x, const s32_t k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int32_uint64 (map_t* x, const s32_t k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int32_float (map_t* x, const s32_t k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int32_double (map_t* x, const s32_t k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int32_ldouble(map_t* x, const s32_t k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int64_pointer(map_t* x, const s64_t k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int64_cstring(map_t* x, const s64_t k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int64_string (map_t* x, const s64_t k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_int64_array (map_t* x, const s64_t k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_int64_list (map_t* x, const s64_t k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_int64_map (map_t* x, const s64_t k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_int64_vset (map_t* x, const s64_t k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_int64_boolean(map_t* x, const s64_t k, _Bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int64_int8 (map_t* x, const s64_t k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int64_int16 (map_t* x, const s64_t k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int64_int32 (map_t* x, const s64_t k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int64_int64 (map_t* x, const s64_t k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int64_uint8 (map_t* x, const s64_t k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int64_uint16 (map_t* x, const s64_t k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int64_uint32 (map_t* x, const s64_t k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int64_uint64 (map_t* x, const s64_t k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int64_float (map_t* x, const s64_t k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int64_double (map_t* x, const s64_t k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_int64_ldouble(map_t* x, const s64_t k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int64_pointer(map_t* x, const s64_t k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int64_cstring(map_t* x, const s64_t k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int64_string (map_t* x, const s64_t k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_int64_array (map_t* x, const s64_t k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_int64_list (map_t* x, const s64_t k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_int64_map (map_t* x, const s64_t k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_int64_vset (map_t* x, const s64_t k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_int64_boolean(map_t* x, const s64_t k, bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int64_int8 (map_t* x, const s64_t k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int64_int16 (map_t* x, const s64_t k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int64_int32 (map_t* x, const s64_t k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int64_int64 (map_t* x, const s64_t k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int64_uint8 (map_t* x, const s64_t k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int64_uint16 (map_t* x, const s64_t k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int64_uint32 (map_t* x, const s64_t k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int64_uint64 (map_t* x, const s64_t k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int64_float (map_t* x, const s64_t k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int64_double (map_t* x, const s64_t k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_int64_ldouble(map_t* x, const s64_t k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint8_pointer(map_t* x, const u8_t k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint8_cstring(map_t* x, const u8_t k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint8_string (map_t* x, const u8_t k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_uint8_array (map_t* x, const u8_t k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_uint8_list (map_t* x, const u8_t k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_uint8_map (map_t* x, const u8_t k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_uint8_vset (map_t* x, const u8_t k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_uint8_boolean(map_t* x, const u8_t k, _Bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint8_int8 (map_t* x, const u8_t k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint8_int16 (map_t* x, const u8_t k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint8_int32 (map_t* x, const u8_t k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint8_int64 (map_t* x, const u8_t k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint8_uint8 (map_t* x, const u8_t k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint8_uint16 (map_t* x, const u8_t k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint8_uint32 (map_t* x, const u8_t k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint8_uint64 (map_t* x, const u8_t k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint8_float (map_t* x, const u8_t k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint8_double (map_t* x, const u8_t k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint8_ldouble(map_t* x, const u8_t k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint8_pointer(map_t* x, const u8_t k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint8_cstring(map_t* x, const u8_t k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint8_string (map_t* x, const u8_t k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_uint8_array (map_t* x, const u8_t k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_uint8_list (map_t* x, const u8_t k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_uint8_map (map_t* x, const u8_t k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_uint8_vset (map_t* x, const u8_t k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_uint8_boolean(map_t* x, const u8_t k, bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint8_int8 (map_t* x, const u8_t k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint8_int16 (map_t* x, const u8_t k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint8_int32 (map_t* x, const u8_t k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint8_int64 (map_t* x, const u8_t k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint8_uint8 (map_t* x, const u8_t k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint8_uint16 (map_t* x, const u8_t k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint8_uint32 (map_t* x, const u8_t k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint8_uint64 (map_t* x, const u8_t k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint8_float (map_t* x, const u8_t k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint8_double (map_t* x, const u8_t k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint8_ldouble(map_t* x, const u8_t k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint16_pointer(map_t* x, const u16_t k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint16_cstring(map_t* x, const u16_t k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint16_string (map_t* x, const u16_t k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_uint16_array (map_t* x, const u16_t k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_uint16_list (map_t* x, const u16_t k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_uint16_map (map_t* x, const u16_t k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_uint16_vset (map_t* x, const u16_t k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_uint16_boolean(map_t* x, const u16_t k, _Bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint16_int8 (map_t* x, const u16_t k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint16_int16 (map_t* x, const u16_t k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint16_int32 (map_t* x, const u16_t k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint16_int64 (map_t* x, const u16_t k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint16_uint8 (map_t* x, const u16_t k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint16_uint16 (map_t* x, const u16_t k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint16_uint32 (map_t* x, const u16_t k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint16_uint64 (map_t* x, const u16_t k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint16_float (map_t* x, const u16_t k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint16_double (map_t* x, const u16_t k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint16_ldouble(map_t* x, const u16_t k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint16_pointer(map_t* x, const u16_t k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint16_cstring(map_t* x, const u16_t k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint16_string (map_t* x, const u16_t k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_uint16_array (map_t* x, const u16_t k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_uint16_list (map_t* x, const u16_t k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_uint16_map (map_t* x, const u16_t k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_uint16_vset (map_t* x, const u16_t k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_uint16_boolean(map_t* x, const u16_t k, bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint16_int8 (map_t* x, const u16_t k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint16_int16 (map_t* x, const u16_t k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint16_int32 (map_t* x, const u16_t k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint16_int64 (map_t* x, const u16_t k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint16_uint8 (map_t* x, const u16_t k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint16_uint16 (map_t* x, const u16_t k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint16_uint32 (map_t* x, const u16_t k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint16_uint64 (map_t* x, const u16_t k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint16_float (map_t* x, const u16_t k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint16_double (map_t* x, const u16_t k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint16_ldouble(map_t* x, const u16_t k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint32_pointer(map_t* x, const u32_t k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint32_cstring(map_t* x, const u32_t k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint32_string (map_t* x, const u32_t k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_uint32_array (map_t* x, const u32_t k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_uint32_list (map_t* x, const u32_t k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_uint32_map (map_t* x, const u32_t k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_uint32_vset (map_t* x, const u32_t k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_uint32_boolean(map_t* x, const u32_t k, _Bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint32_int8 (map_t* x, const u32_t k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint32_int16 (map_t* x, const u32_t k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint32_int32 (map_t* x, const u32_t k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint32_int64 (map_t* x, const u32_t k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint32_uint8 (map_t* x, const u32_t k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint32_uint16 (map_t* x, const u32_t k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint32_uint32 (map_t* x, const u32_t k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint32_uint64 (map_t* x, const u32_t k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint32_float (map_t* x, const u32_t k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint32_double (map_t* x, const u32_t k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint32_ldouble(map_t* x, const u32_t k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint32_pointer(map_t* x, const u32_t k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint32_cstring(map_t* x, const u32_t k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint32_string (map_t* x, const u32_t k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_uint32_array (map_t* x, const u32_t k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_uint32_list (map_t* x, const u32_t k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_uint32_map (map_t* x, const u32_t k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_uint32_vset (map_t* x, const u32_t k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_uint32_boolean(map_t* x, const u32_t k, bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint32_int8 (map_t* x, const u32_t k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint32_int16 (map_t* x, const u32_t k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint32_int32 (map_t* x, const u32_t k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint32_int64 (map_t* x, const u32_t k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint32_uint8 (map_t* x, const u32_t k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint32_uint16 (map_t* x, const u32_t k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint32_uint32 (map_t* x, const u32_t k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint32_uint64 (map_t* x, const u32_t k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint32_float (map_t* x, const u32_t k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint32_double (map_t* x, const u32_t k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint32_ldouble(map_t* x, const u32_t k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint64_pointer(map_t* x, const u64_t k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint64_cstring(map_t* x, const u64_t k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint64_string (map_t* x, const u64_t k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_uint64_array (map_t* x, const u64_t k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_uint64_list (map_t* x, const u64_t k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_uint64_map (map_t* x, const u64_t k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_uint64_vset (map_t* x, const u64_t k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_uint64_boolean(map_t* x, const u64_t k, _Bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint64_int8 (map_t* x, const u64_t k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint64_int16 (map_t* x, const u64_t k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint64_int32 (map_t* x, const u64_t k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint64_int64 (map_t* x, const u64_t k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint64_uint8 (map_t* x, const u64_t k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint64_uint16 (map_t* x, const u64_t k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint64_uint32 (map_t* x, const u64_t k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint64_uint64 (map_t* x, const u64_t k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint64_float (map_t* x, const u64_t k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint64_double (map_t* x, const u64_t k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_uint64_ldouble(map_t* x, const u64_t k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint64_pointer(map_t* x, const u64_t k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint64_cstring(map_t* x, const u64_t k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint64_string (map_t* x, const u64_t k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_uint64_array (map_t* x, const u64_t k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_uint64_list (map_t* x, const u64_t k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_uint64_map (map_t* x, const u64_t k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_uint64_vset (map_t* x, const u64_t k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_uint64_boolean(map_t* x, const u64_t k, bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint64_int8 (map_t* x, const u64_t k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint64_int16 (map_t* x, const u64_t k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint64_int32 (map_t* x, const u64_t k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint64_int64 (map_t* x, const u64_t k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint64_uint8 (map_t* x, const u64_t k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint64_uint16 (map_t* x, const u64_t k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint64_uint32 (map_t* x, const u64_t k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint64_uint64 (map_t* x, const u64_t k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint64_float (map_t* x, const u64_t k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint64_double (map_t* x, const u64_t k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_uint64_ldouble(map_t* x, const u64_t k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_float_pointer(map_t* x, const fl_t k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_float_cstring(map_t* x, const fl_t k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_float_string (map_t* x, const fl_t k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_float_array (map_t* x, const fl_t k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_float_list (map_t* x, const fl_t k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_float_map (map_t* x, const fl_t k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_float_vset (map_t* x, const fl_t k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_float_boolean(map_t* x, const fl_t k, _Bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_float_int8 (map_t* x, const fl_t k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_float_int16 (map_t* x, const fl_t k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_float_int32 (map_t* x, const fl_t k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_float_int64 (map_t* x, const fl_t k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_float_uint8 (map_t* x, const fl_t k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_float_uint16 (map_t* x, const fl_t k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_float_uint32 (map_t* x, const fl_t k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_float_uint64 (map_t* x, const fl_t k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_float_float (map_t* x, const fl_t k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_float_double (map_t* x, const fl_t k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_float_ldouble(map_t* x, const fl_t k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_float_pointer(map_t* x, const fl_t k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_float_cstring(map_t* x, const fl_t k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_float_string (map_t* x, const fl_t k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_float_array (map_t* x, const fl_t k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_float_list (map_t* x, const fl_t k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_float_map (map_t* x, const fl_t k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_float_vset (map_t* x, const fl_t k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_float_boolean(map_t* x, const fl_t k, bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_float_int8 (map_t* x, const fl_t k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_float_int16 (map_t* x, const fl_t k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_float_int32 (map_t* x, const fl_t k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_float_int64 (map_t* x, const fl_t k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_float_uint8 (map_t* x, const fl_t k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_float_uint16 (map_t* x, const fl_t k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_float_uint32 (map_t* x, const fl_t k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_float_uint64 (map_t* x, const fl_t k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_float_float (map_t* x, const fl_t k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_float_double (map_t* x, const fl_t k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_float_ldouble(map_t* x, const fl_t k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_double_pointer(map_t* x, const dbl_t k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_double_cstring(map_t* x, const dbl_t k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_double_string (map_t* x, const dbl_t k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_double_array (map_t* x, const dbl_t k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_double_list (map_t* x, const dbl_t k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_double_map (map_t* x, const dbl_t k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_double_vset (map_t* x, const dbl_t k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_double_boolean(map_t* x, const dbl_t k, _Bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_double_int8 (map_t* x, const dbl_t k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_double_int16 (map_t* x, const dbl_t k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_double_int32 (map_t* x, const dbl_t k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_double_int64 (map_t* x, const dbl_t k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_double_uint8 (map_t* x, const dbl_t k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_double_uint16 (map_t* x, const dbl_t k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_double_uint32 (map_t* x, const dbl_t k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_double_uint64 (map_t* x, const dbl_t k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_double_float (map_t* x, const dbl_t k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_double_double (map_t* x, const dbl_t k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_double_ldouble(map_t* x, const dbl_t k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_double_pointer(map_t* x, const dbl_t k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_double_cstring(map_t* x, const dbl_t k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_double_string (map_t* x, const dbl_t k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_double_array (map_t* x, const dbl_t k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_double_list (map_t* x, const dbl_t k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_double_map (map_t* x, const dbl_t k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_double_vset (map_t* x, const dbl_t k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_double_boolean(map_t* x, const dbl_t k, bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_double_int8 (map_t* x, const dbl_t k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_double_int16 (map_t* x, const dbl_t k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_double_int32 (map_t* x, const dbl_t k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_double_int64 (map_t* x, const dbl_t k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_double_uint8 (map_t* x, const dbl_t k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_double_uint16 (map_t* x, const dbl_t k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_double_uint32 (map_t* x, const dbl_t k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_double_uint64 (map_t* x, const dbl_t k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_double_float (map_t* x, const dbl_t k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_double_double (map_t* x, const dbl_t k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_double_ldouble(map_t* x, const dbl_t k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_ldouble_pointer(map_t* x, const ldbl_t k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_ldouble_cstring(map_t* x, const ldbl_t k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_ldouble_string (map_t* x, const ldbl_t k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_ldouble_array (map_t* x, const ldbl_t k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_ldouble_list (map_t* x, const ldbl_t k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_ldouble_map (map_t* x, const ldbl_t k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_ldouble_vset (map_t* x, const ldbl_t k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } -_Bool libcdsb_map_update_ldouble_boolean(map_t* x, const ldbl_t k, _Bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_ldouble_int8 (map_t* x, const ldbl_t k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_ldouble_int16 (map_t* x, const ldbl_t k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_ldouble_int32 (map_t* x, const ldbl_t k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_ldouble_int64 (map_t* x, const ldbl_t k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_ldouble_uint8 (map_t* x, const ldbl_t k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_ldouble_uint16 (map_t* x, const ldbl_t k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_ldouble_uint32 (map_t* x, const ldbl_t k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_ldouble_uint64 (map_t* x, const ldbl_t k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_ldouble_float (map_t* x, const ldbl_t k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_ldouble_double (map_t* x, const ldbl_t k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } -_Bool libcdsb_map_update_ldouble_ldouble(map_t* x, const ldbl_t k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_ldouble_pointer(map_t* x, const ldbl_t k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_ldouble_cstring(map_t* x, const ldbl_t k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_ldouble_string (map_t* x, const ldbl_t k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_ldouble_array (map_t* x, const ldbl_t k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_ldouble_list (map_t* x, const ldbl_t k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_ldouble_map (map_t* x, const ldbl_t k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_ldouble_vset (map_t* x, const ldbl_t k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +bool libcdsb_map_update_ldouble_boolean(map_t* x, const ldbl_t k, bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_ldouble_int8 (map_t* x, const ldbl_t k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_ldouble_int16 (map_t* x, const ldbl_t k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_ldouble_int32 (map_t* x, const ldbl_t k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_ldouble_int64 (map_t* x, const ldbl_t k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_ldouble_uint8 (map_t* x, const ldbl_t k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_ldouble_uint16 (map_t* x, const ldbl_t k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_ldouble_uint32 (map_t* x, const ldbl_t k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_ldouble_uint64 (map_t* x, const ldbl_t k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_ldouble_float (map_t* x, const ldbl_t k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_ldouble_double (map_t* x, const ldbl_t k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } +bool libcdsb_map_update_ldouble_ldouble(map_t* x, const ldbl_t k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } diff --git a/src/set/extra.c b/src/set/extra.c index 81334da..d58056f 100644 --- a/src/set/extra.c +++ b/src/set/extra.c @@ -4,7 +4,7 @@ #include "../../include/extra/set.h" #include "../__internal/rbtree.h" -_Bool libcdsb_vset_insert(set_t* x, const void* v, vtype t) { +bool libcdsb_vset_insert(set_t* x, const void* v, vtype t) { int cmp; rbnode_t* n; rbnode_t* p; @@ -42,7 +42,7 @@ _Bool libcdsb_vset_insert(set_t* x, const void* v, vtype t) { } -int libcdsb_vset_find(vtype_set* x, const void* v, vtype t, void* _, vset_access_callback callback, _Bool cut) { +int libcdsb_vset_find(vtype_set* x, const void* v, vtype t, void* _, vset_access_callback callback, bool cut) { rbnode_t* c; void *val; int cmp; @@ -70,7 +70,7 @@ int libcdsb_vset_find(vtype_set* x, const void* v, vtype t, void* _, vset_access } -int libcdsb_vset_foreach(set_t* x, void* data, vset_access_callback callback, _Bool flush) { +int libcdsb_vset_foreach(set_t* x, void* data, vset_access_callback callback, bool flush) { stack_t z = { .prev = 0, .value = x->root }; int r = 0; rbnode_t* c; diff --git a/src/set/generics.c b/src/set/generics.c index 0711775..65be7a1 100644 --- a/src/set/generics.c +++ b/src/set/generics.c @@ -4,42 +4,42 @@ #include "../../include/extra/set.h" #include "../__internal/include.h" -int libcdsb_vset_find_pointer(set_t* x, const void* v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } -int libcdsb_vset_find_cstring(set_t* x, const char* v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } -int libcdsb_vset_find_string (set_t* x, const str_t* v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, v, vtypeof( v), _, cb, cut); } -int libcdsb_vset_find_array (set_t* x, const arr_t* v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, v, vtypeof( v), _, cb, cut); } -int libcdsb_vset_find_list (set_t* x, const list_t* v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, v, vtypeof( v), _, cb, cut); } -int libcdsb_vset_find_map (set_t* x, const map_t* v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, v, vtypeof( v), _, cb, cut); } -int libcdsb_vset_find_vset (set_t* x, const set_t* v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, v, vtypeof( v), _, cb, cut); } -int libcdsb_vset_find_boolean(set_t* x, _Bool v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } -int libcdsb_vset_find_int8 (set_t* x, s8_t v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } -int libcdsb_vset_find_int16 (set_t* x, s16_t v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } -int libcdsb_vset_find_int32 (set_t* x, s32_t v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } -int libcdsb_vset_find_int64 (set_t* x, s64_t v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } -int libcdsb_vset_find_uint8 (set_t* x, u8_t v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } -int libcdsb_vset_find_uint16 (set_t* x, u16_t v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } -int libcdsb_vset_find_uint32 (set_t* x, u32_t v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } -int libcdsb_vset_find_uint64 (set_t* x, u64_t v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } -int libcdsb_vset_find_float (set_t* x, fl_t v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } -int libcdsb_vset_find_double (set_t* x, dbl_t v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } -int libcdsb_vset_find_ldouble(set_t* x, ldbl_t v, void* _, vset_access_callback cb, _Bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } +int libcdsb_vset_find_pointer(set_t* x, const void* v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } +int libcdsb_vset_find_cstring(set_t* x, const char* v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } +int libcdsb_vset_find_string (set_t* x, const str_t* v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, v, vtypeof( v), _, cb, cut); } +int libcdsb_vset_find_array (set_t* x, const arr_t* v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, v, vtypeof( v), _, cb, cut); } +int libcdsb_vset_find_list (set_t* x, const list_t* v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, v, vtypeof( v), _, cb, cut); } +int libcdsb_vset_find_map (set_t* x, const map_t* v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, v, vtypeof( v), _, cb, cut); } +int libcdsb_vset_find_vset (set_t* x, const set_t* v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, v, vtypeof( v), _, cb, cut); } +int libcdsb_vset_find_boolean(set_t* x, bool v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } +int libcdsb_vset_find_int8 (set_t* x, s8_t v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } +int libcdsb_vset_find_int16 (set_t* x, s16_t v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } +int libcdsb_vset_find_int32 (set_t* x, s32_t v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } +int libcdsb_vset_find_int64 (set_t* x, s64_t v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } +int libcdsb_vset_find_uint8 (set_t* x, u8_t v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } +int libcdsb_vset_find_uint16 (set_t* x, u16_t v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } +int libcdsb_vset_find_uint32 (set_t* x, u32_t v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } +int libcdsb_vset_find_uint64 (set_t* x, u64_t v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } +int libcdsb_vset_find_float (set_t* x, fl_t v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } +int libcdsb_vset_find_double (set_t* x, dbl_t v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } +int libcdsb_vset_find_ldouble(set_t* x, ldbl_t v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); } -_Bool libcdsb_vset_push_pointer(set_t* x, const void* v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); } -_Bool libcdsb_vset_push_cstring(set_t* x, const char* v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); } -_Bool libcdsb_vset_push_string (set_t* x, const str_t* v) { return libcdsb_vset_insert(x, v, vtypeof( v)); } -_Bool libcdsb_vset_push_array (set_t* x, const arr_t* v) { return libcdsb_vset_insert(x, v, vtypeof( v)); } -_Bool libcdsb_vset_push_list (set_t* x, const list_t* v) { return libcdsb_vset_insert(x, v, vtypeof( v)); } -_Bool libcdsb_vset_push_map (set_t* x, const map_t* v) { return libcdsb_vset_insert(x, v, vtypeof( v)); } -_Bool libcdsb_vset_push_vset (set_t* x, const set_t* v) { return libcdsb_vset_insert(x, v, vtypeof( v)); } -_Bool libcdsb_vset_push_boolean(set_t* x, _Bool v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); } -_Bool libcdsb_vset_push_int8 (set_t* x, s8_t v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); } -_Bool libcdsb_vset_push_int16 (set_t* x, s16_t v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); } -_Bool libcdsb_vset_push_int32 (set_t* x, s32_t v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); } -_Bool libcdsb_vset_push_int64 (set_t* x, s64_t v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); } -_Bool libcdsb_vset_push_uint8 (set_t* x, u8_t v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); } -_Bool libcdsb_vset_push_uint16 (set_t* x, u16_t v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); } -_Bool libcdsb_vset_push_uint32 (set_t* x, u32_t v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); } -_Bool libcdsb_vset_push_uint64 (set_t* x, u64_t v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); } -_Bool libcdsb_vset_push_float (set_t* x, fl_t v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); } -_Bool libcdsb_vset_push_double (set_t* x, dbl_t v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); } -_Bool libcdsb_vset_push_ldouble(set_t* x, ldbl_t v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); } +bool libcdsb_vset_push_pointer(set_t* x, const void* v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); } +bool libcdsb_vset_push_cstring(set_t* x, const char* v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); } +bool libcdsb_vset_push_string (set_t* x, const str_t* v) { return libcdsb_vset_insert(x, v, vtypeof( v)); } +bool libcdsb_vset_push_array (set_t* x, const arr_t* v) { return libcdsb_vset_insert(x, v, vtypeof( v)); } +bool libcdsb_vset_push_list (set_t* x, const list_t* v) { return libcdsb_vset_insert(x, v, vtypeof( v)); } +bool libcdsb_vset_push_map (set_t* x, const map_t* v) { return libcdsb_vset_insert(x, v, vtypeof( v)); } +bool libcdsb_vset_push_vset (set_t* x, const set_t* v) { return libcdsb_vset_insert(x, v, vtypeof( v)); } +bool libcdsb_vset_push_boolean(set_t* x, bool v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); } +bool libcdsb_vset_push_int8 (set_t* x, s8_t v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); } +bool libcdsb_vset_push_int16 (set_t* x, s16_t v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); } +bool libcdsb_vset_push_int32 (set_t* x, s32_t v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); } +bool libcdsb_vset_push_int64 (set_t* x, s64_t v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); } +bool libcdsb_vset_push_uint8 (set_t* x, u8_t v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); } +bool libcdsb_vset_push_uint16 (set_t* x, u16_t v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); } +bool libcdsb_vset_push_uint32 (set_t* x, u32_t v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); } +bool libcdsb_vset_push_uint64 (set_t* x, u64_t v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); } +bool libcdsb_vset_push_float (set_t* x, fl_t v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); } +bool libcdsb_vset_push_double (set_t* x, dbl_t v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); } +bool libcdsb_vset_push_ldouble(set_t* x, ldbl_t v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); } diff --git a/src/string/base.c b/src/string/base.c index d4b4d46..a131640 100644 --- a/src/string/base.c +++ b/src/string/base.c @@ -60,7 +60,7 @@ int string_compare(const str_t* s0, const str_t* s1) { /*#####################################################################################################################*/ -_Bool libcdsb_string_concat_cstring(str_t* x, const char* s) { +bool libcdsb_string_concat_cstring(str_t* x, const char* s) { size_t n; size_t xn; @@ -77,7 +77,7 @@ _Bool libcdsb_string_concat_cstring(str_t* x, const char* s) { } -_Bool libcdsb_string_concat_char(str_t* x, int chr) { +bool libcdsb_string_concat_char(str_t* x, int chr) { size_t xn; size_t n; char *e; diff --git a/src/string/get.c b/src/string/get.c index 209ce9a..5493471 100644 --- a/src/string/get.c +++ b/src/string/get.c @@ -32,7 +32,7 @@ char* string_at(const str_t* s, ssize_t i) { } -_Bool string_slice(str_t* x, str_t* s, ssize_t i, size_t c, _Bool cut) { +bool string_slice(str_t* x, str_t* s, ssize_t i, size_t c, bool cut) { char *e, *p, *v; memset(x, 0, sizeof(*x)); diff --git a/src/string/trim.c b/src/string/trim.c index d40fe9c..abbdd34 100644 --- a/src/string/trim.c +++ b/src/string/trim.c @@ -56,7 +56,7 @@ void libcdsb_string_trim_cstring(str_t* x, const char* s, int direction) { u8_t* l; u8_t* r; size_t n; - _Bool f; + bool f; struct { const char* p; diff --git a/src/vnode.c b/src/vnode.c index 0963a99..ed834fe 100644 --- a/src/vnode.c +++ b/src/vnode.c @@ -170,7 +170,7 @@ vnode_t libcdsb_vnode_create(const void* v, vtype t) { break; - case VTYPE_BOOLEAN: _.b = *(_Bool*)v; + case VTYPE_BOOLEAN: _.b = *(bool*)v; break; case VTYPE_POINTER: _.ptr = *(void**)v; diff --git a/src/vtype-extra.c b/src/vtype-extra.c index 8f86f91..7953b38 100644 --- a/src/vtype-extra.c +++ b/src/vtype-extra.c @@ -27,7 +27,7 @@ static _Thread_local char STRINGIFY_BUFFER[64]; const size_t LIBCDSB_VTYPE_SIZES[18] = { - sizeof(void*), sizeof(_Bool), + sizeof(void*), sizeof(bool), sizeof(u8_t), sizeof(u16_t), sizeof(u32_t), sizeof(u64_t), sizeof(s8_t), sizeof(s16_t), sizeof(s32_t), sizeof(s64_t), sizeof(fl_t), sizeof(dbl_t), sizeof(ldbl_t), From f804d4277cf633d90e123b8b107ece285d46c950 Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Thu, 9 Jun 2022 22:02:12 +0300 Subject: [PATCH 13/27] Update list tests --- tests/src/list/main.c | 3 --- tests/src/list/src/random.c | 3 +-- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/src/list/main.c b/tests/src/list/main.c index cfee210..9cdcbcd 100644 --- a/tests/src/list/main.c +++ b/tests/src/list/main.c @@ -9,10 +9,7 @@ int main(int argc, char** argv) { list_t x = { .first = 0, .last = 0 }; list_t y = { .first = 0, .last = 0 }; - list_free(&x); - visual_push2(&x, (random_uint8()%5) + 12, &y, (random_uint8()%5) + 12); - visual_extend(&x, &y); visual_sort2(&x, &y); diff --git a/tests/src/list/src/random.c b/tests/src/list/src/random.c index 9d74048..2552978 100644 --- a/tests/src/list/src/random.c +++ b/tests/src/list/src/random.c @@ -38,7 +38,7 @@ void list_push_random(list_t* x, _Bool silent, unsigned int hpos) { if (random_boolean()) i = ~i + 1; if (!silent) { - printf("\e[%dG\e[36mTry to change value with index \e[32;1m%ld\e[36m into list:\e[m\n", hpos+1, i); + printf("\e[%dG\e[36mTry to change value with index \e[32;1m%ld\e[36m in the list:\e[m\n", hpos+1, i); } r = libcdsb_list_update(x, i, v.value, v.type, 0); @@ -74,7 +74,6 @@ void list_remove_random(list_t* x, _Bool silent, unsigned int hpos) { switch (libcdsb_list_get(x, i, &v, remove_callback, 0)) { case 0: if (!silent) printf("\e[%dG\e[32;1mSUCCESS\e[m\n", hpos+1); break; - case 2: if (!silent) printf("\n\e[%dG\e[32;1mFAILURE\e[m\n", hpos+1); break; default: if (!silent) printf("\e[%dG\e[32;1mFAILURE\e[m\n", hpos+1); break; } } From 26a33062e7ed0c504846fb3043ba8b3703732510 Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Thu, 9 Jun 2022 22:02:38 +0300 Subject: [PATCH 14/27] Update array tests --- tests/src/array/change.c | 29 ------ tests/src/array/main.c | 33 ++---- tests/src/array/plug.h | 30 +++--- tests/src/array/src/io.c | 197 +++++++++++++++++++++++++++++++++++ tests/src/array/src/plug.c | 25 +++++ tests/src/array/src/random.c | 83 +++++++++++++++ 6 files changed, 327 insertions(+), 70 deletions(-) delete mode 100644 tests/src/array/change.c create mode 100644 tests/src/array/src/io.c create mode 100644 tests/src/array/src/plug.c create mode 100644 tests/src/array/src/random.c diff --git a/tests/src/array/change.c b/tests/src/array/change.c deleted file mode 100644 index 989193a..0000000 --- a/tests/src/array/change.c +++ /dev/null @@ -1,29 +0,0 @@ -/* This software is licensed by the MIT License, see LICENSE file */ -/* Copyright © 2022 Gregory Lirent */ - -#include "plug.h" - -int main(int argc, char** argv) { - test_init(argc, argv); - - vtype_array y; - vtype_array x = array_random(8); - - array_info(&x); - array_sort(&x); - array_print(&x, 0); - - array_slice(&y, &x, 2, 4, 1); - - array_print(&x, "source"); - array_print(&y, "cutted"); - - array_remove(&x, -1); - array_remove(&y, -1); - - array_print(&x, "source (last removed)"); - array_print(&y, "cutted (last removed)"); - - array_free(&x); - array_free(&y); -} diff --git a/tests/src/array/main.c b/tests/src/array/main.c index a8b5ab4..18b31fd 100644 --- a/tests/src/array/main.c +++ b/tests/src/array/main.c @@ -3,36 +3,21 @@ #include "plug.h" -static void array_find_minimal(const vtype_array* x) { - array_print(x, 0); - for (vtype_uint64 v = 0; v < UINT64_MAX; ++v) { - ssize_t index = array_indexof(x, v); - if (index >= 0) { - printf("\e[36mValue \e[m\e[31m%lu\e[m\e[36m was found at the position \e[m\e[32;1m%ld\e[m\n", v, index); - break; - } - } - put_separator(); -} int main(int argc, char** argv) { test_init(argc, argv); - vtype_array x = { .mem = 0 }; + arr_t x = { .mem = 0, .size = 0, .type = random_uint8()%(VTYPE_LDOUBLE + 1) }; + arr_t y = { .mem = 0, .size = 0, .type = x.type }; - do { - array_free(&x); - x = array_random(8); - } while (x.type >= VTYPE_FLOAT); + visual_push(&x, (random_uint8()%17) + 16); - array_info(&x); - array_find_minimal(&x); + visual_slice(&x, &y); + visual_push2(&x, (random_uint8()%5) + 12, &y, (random_uint8()%5) + 12); - array_reverse(&x); - array_print(&x, "reversed"); + visual_sort2(&x, &y); + visual_remove2(&x, &y); - array_sort(&x); - array_print(&x, "sorted"); - - array_free(&x); + array_free(&y); + array_free(&y); } diff --git a/tests/src/array/plug.h b/tests/src/array/plug.h index dd8ed86..254611a 100644 --- a/tests/src/array/plug.h +++ b/tests/src/array/plug.h @@ -9,27 +9,22 @@ #include "../../include/test.h" #include "../../include/time.h" -vtype_string* string_duplicate(const vtype_string* x) { return 0; } -vtype_list* list_duplicate (const vtype_list* x) { return 0; } -vtype_map* map_duplicate (const vtype_map* x) { return 0; } -vtype_set* vset_duplicate (const vtype_set* x) { return 0; } -void string_free(vtype_string* x) {} -void list_free (vtype_list* x) {} -void map_free (vtype_map* x) {} -void vset_free (vtype_set* x) {} +extern void array_print(arr_t* x, const char* prefix, unsigned int hpos); +extern void array_info(arr_t* x, unsigned int hpos); -int string_compare(const vtype_string* s0, const vtype_string* s1) { return random_int8(); } -int list_compare (const vtype_list* s0, const vtype_list* s1) { return random_int8(); } -int map_compare (const vtype_map* s0, const vtype_map* s1) { return random_int8(); } -int vset_compare (const vtype_set* s0, const vtype_set* s1) { return random_int8(); } - -extern void string_copy_init(vtype_string* x, const vtype_string* s) { memset(x, 0, sizeof(*x)); } -extern void list_copy_init (vtype_list* x, const vtype_list* s) { memset(x, 0, sizeof(*x)); } -extern void map_copy_init (vtype_map* x, const vtype_map* s) { memset(x, 0, sizeof(*x)); } -extern void vset_copy_init (vtype_set* x, const vtype_set* s) { memset(x, 0, sizeof(*x)); } +extern void visual_push(arr_t* x, size_t n); +extern void visual_sort(arr_t* x); +extern void visual_remove(arr_t* x); +extern void visual_push2(arr_t* x0, size_t n0, arr_t* x1, size_t n1); +extern void visual_remove2(arr_t* x0, arr_t* x1); +extern void visual_sort2(arr_t* x0, arr_t* x1); +extern void visual_slice(arr_t* x, arr_t* s); +extern void array_push_random (arr_t* x, _Bool silent, unsigned int hpos); +extern void array_remove_random(arr_t* x, _Bool silent, unsigned int hpos); +/* static void array_push_random(vtype_array* x) { switch (random_uint8()%13) { default: @@ -95,3 +90,4 @@ static void array_info(const vtype_array* x) { print_container_info("Array", 0, &x->type, array_size(x), array_nmemb(x)); put_separator(); } +*/ diff --git a/tests/src/array/src/io.c b/tests/src/array/src/io.c new file mode 100644 index 0000000..127eaec --- /dev/null +++ b/tests/src/array/src/io.c @@ -0,0 +1,197 @@ +/* This software is licensed by the MIT License, see LICENSE file */ +/* Copyright © 2022 Gregory Lirent */ + +#include "../plug.h" + +static int array_value_print(void* v, ssize_t i, vtype t, void* _) { + print_container_value(&i, v, t, 1, *(unsigned int*)_); + return 0; +} + +void array_print(arr_t* x, const char* prefix, unsigned int hpos) { + print_container_values_prefix("Array", prefix, hpos); + array_foreach(x, &hpos, array_value_print); +} + +void array_info(arr_t* x, unsigned int hpos) { + print_container_info("Array", "nodes", 0, array_size(x), -1, hpos); +} + + +void visual_push(arr_t* x, size_t n) { + for (int i = 0; i < n; ++i) { + fputs("\e[s", stdout); + + array_push_random(x, 0, 0); + + array_info(x, 0); + array_print(x, 0, 0); + + psleep(100000); + fputs("\e[u\e[J", stdout); + } +} + +void visual_sort(arr_t* x) { + puts("\e[s\e[36mTry to sort array values:\e[m\n\n"); + put_separator(0); + array_sort(x); + array_info(x, 0); + array_print(x, "sorted", 0); + psleep(900000); + fputs("\e[u\e[J", stdout); + + puts("\e[s\e[36mTry to reverse array values:\e[m\n\n"); + put_separator(0); + array_reverse(x); + array_info(x, 0); + array_print(x, "reversed", 0); + psleep(900000); + fputs("\e[u\e[J", stdout); +} + +void visual_remove(arr_t* x) { + while (x->size) { + fputs("\e[s", stdout); + array_remove_random(x, 0, 0); + array_info(x, 0); + array_print(x, 0, 0); + + psleep(100000); + if (!0) fputs("\e[u\e[J", stdout); + } +} + +void visual_push2(arr_t* x0, size_t n0, arr_t* x1, size_t n1) { + + for (;n0 || n1;) { + fputs("\e[s", stdout); + if (n0) { + array_push_random(x0, 0, 0); + --n0; + } else { + puts("\n\n"); + put_separator(0); + } + + fputs("\e[u\e[s", stdout); + + if (n1) { + array_push_random(x1, 0, 60); + --n1; + } else { + puts("\n\n"); + put_separator(60); + } + + array_info(x0, 0); + array_print(x0, 0, 0); + fputs("\e[u\e[s\e[4E", stdout); + array_info(x1, 60); + array_print(x1, 0, 60); + psleep(100000); + + fputs("\e[u\e[J", stdout); + } +} + +void visual_remove2(arr_t* x0, arr_t* x1) { + + for (;x0->size || x1->size;) { + fputs("\e[s", stdout); + + if (x0->size) { + array_remove_random(x0, 0, 0); + } else { + puts("\n\n"); + put_separator(0); + } + + fputs("\e[u\e[s", stdout); + + if (x1->size) { + array_remove_random(x1, 0, 60); + } else { + puts("\n\n"); + put_separator(60); + } + + array_info(x0, 0); + array_print(x0, 0, 0); + fputs("\e[u\e[s\e[4E", stdout); + array_info(x1, 60); + array_print(x1, 0, 60); + psleep(100000); + + fputs("\e[u\e[J", stdout); + } +} + + +void visual_sort2(arr_t* x0, arr_t* x1) { + printf("\e[s\e[36m%-60s%s\e[m\n\n","Try to sort array values:", "Try to sort array values:"); + printf("\e[32;1m%-60s%s\e[m\n", "SUCCESS", "SUCCESS"); + printf("\e[37;2m%-60s%s\e[m\n", "=== === === === === === === ===", "=== === === === === === === ==="); + + array_sort(x0); + array_sort(x1); + + array_info(x0, 0); + array_print(x0, "sorted", 0); + fputs("\e[u\e[s\e[4E", stdout); + array_info(x1, 60); + array_print(x1, "sorted", 60); + + psleep(900000); + fputs("\e[u\e[J", stdout); + + printf("\e[s\e[36m%-60s%s\e[m\n\n","Try to reverse array values:", "Try to reverse array values:"); + printf("\e[32;1m%-60s%s\e[m\n", "SUCCESS", "SUCCESS"); + printf("\e[37;2m%-60s%s\e[m\n", "=== === === === === === === ===", "=== === === === === === === ==="); + + array_reverse(x0); + array_reverse(x1); + + array_info(x0, 0); + array_print(x0, "reversed", 0); + fputs("\e[u\e[s\e[4E", stdout); + array_info(x1, 60); + array_print(x1, "reversed", 60); + + psleep(900000); + fputs("\e[u\e[J", stdout); +} + +void visual_slice(arr_t* x, arr_t* s) { + + size_t n = array_size(x); + ssize_t i = random_uint64()%(n - 1); + + n = n - (i + 1); + + puts("\e[s\e[36mTry to slice array:\e[m\n\n"); + printf("\e[37;2m%-60s%s\e[m\n", "=== === === === === === === ===", "=== === === === === === === ==="); + + array_info(x, 0); + array_print(x, "(src)", 0); + fputs("\e[u\e[s\e[4E", stdout); + array_info(s, 60); + array_print(s, "(dest)", 60); + + psleep(900000); + + array_slice(s, x, i, n, 1); + fputs("\e[u\e[s\e[2E\e[32;1mSUCCESS\e[m\e[J", stdout); + + puts(""); + put_separator(0); + + array_info(x, 0); + array_print(x, "(src)", 0); + fputs("\e[u\e[s\e[4E", stdout); + array_info(s, 60); + array_print(s, "(dest)", 60); + psleep(900000); + + fputs("\e[u\e[J", stdout); +} diff --git a/tests/src/array/src/plug.c b/tests/src/array/src/plug.c new file mode 100644 index 0000000..30511e8 --- /dev/null +++ b/tests/src/array/src/plug.c @@ -0,0 +1,25 @@ +/* This software is licensed by the MIT License, see LICENSE file */ +/* Copyright © 2022 Gregory Lirent */ + +#include +#include "../../../../include/extra/vtype.h" + +vtype_string* string_duplicate(const vtype_string* x) { return 0; } +vtype_list* list_duplicate (const vtype_list* x) { return 0; } +vtype_map* map_duplicate (const vtype_map* x) { return 0; } +vtype_set* vset_duplicate (const vtype_set* x) { return 0; } + +void string_free(vtype_string* x) {} +void list_free (vtype_list* x) {} +void map_free (vtype_map* x) {} +void vset_free (vtype_set* x) {} + +int string_compare(const vtype_string* s0, const vtype_string* s1) { random_int8(); } +int list_compare (const vtype_list* s0, const vtype_list* s1) { random_int8(); } +int map_compare (const vtype_map* s0, const vtype_map* s1) { random_int8(); } +int vset_compare (const vtype_set* s0, const vtype_set* s1) { random_int8(); } + +extern void string_copy_init(vtype_string* x, const vtype_string* s) { memset(x, 0, sizeof(*x)); } +extern void list_copy_init (vtype_list* x, const vtype_list* s) { memset(x, 0, sizeof(*x)); } +extern void map_copy_init (vtype_map* x, const vtype_map* s) { memset(x, 0, sizeof(*x)); } +extern void vset_copy_init (vtype_set* x, const vtype_set* s) { memset(x, 0, sizeof(*x)); } diff --git a/tests/src/array/src/random.c b/tests/src/array/src/random.c new file mode 100644 index 0000000..22af216 --- /dev/null +++ b/tests/src/array/src/random.c @@ -0,0 +1,83 @@ +/* This software is licensed by the MIT License, see LICENSE file */ +/* Copyright © 2022 Gregory Lirent */ + +#include "../plug.h" + +static int remove_callback(void* v, ssize_t i, vtype t, void* _) { + struct { arr_t* x; _Bool s; unsigned int p; } *x = _; + if (!x->s) print_container_value(0, v, t, 1, x->p); + + if (libcdsb_array_find(x->x, v, t, 0, 0, 1, 1)) + return -2; + return 0; +} + +static int change_callback(void* v, ssize_t i, vtype t, void* _) { + struct { value_t v; _Bool s; unsigned int p; } *x = _; + + while (x->v.type != t) { x->v = random_value(); } + + memcpy(v, &x->v, vtype_size(t)); + return 0; +} + +void array_push_random(arr_t* x, _Bool silent, unsigned int hpos) { + + struct { value_t v; _Bool s; unsigned int p; } _ = { .v = random_value(), .s = silent, .p = hpos }; + _Bool r; + + if (random_boolean()) { + if (!silent) { + printf("\e[%dG\e[36mTry to push value to back of the array:\e[m\n", hpos+1); + } + + r = libcdsb_array_push(x, _.v.value, _.v.type) >= 0; + } else { + ssize_t i = array_size(x); + + i = random_uint64() % (i ? i : 1); + i = random_boolean() ? ~i + 1 : i ; + + if (!silent) { + printf("\e[%dG\e[36mTry to change value in the array with index \e[32;1m%ld\e[36m:\e[m\n", hpos+1, i); + } + + r = array_get_by_index(x, i, &_, change_callback) == 0; + } + + if (!silent) { + print_container_value(0, _.v.value, _.v.type, 1, hpos); + printf("\e[%dG%s\n", hpos+1, r ? "\e[32;1mSUCCESS\e[m" : "\e[31;1mFAILURE\e[m"); + put_separator(hpos); + } +} + +void array_remove_random(arr_t* x, _Bool silent, unsigned int hpos) { + + size_t n = array_size(x); + ssize_t i = random_uint64()%n; + + if (random_boolean()) i = ~i + 1; + + if (random_boolean()) { + if (!silent) { + printf("\e[%dG\e[36mTry to remove value from list by index:\e[m\n", hpos+1); + print_container_value(0, &i, (sizeof(ssize_t) == 8) ? VTYPE_INT64 : VTYPE_INT32, 0, hpos); + } + switch (array_remove_by_index(x, i)) { + case 0: if (!silent) printf("\e[%dG\e[32;1mSUCCESS\e[m\n", hpos+1); break; + default: if (!silent) printf("\e[%dG\e[32;1mFAILURE\e[m\n", hpos+1); break; + } + } else { + struct { arr_t* x; _Bool s; unsigned int p; } v = { .x = x, .s = silent, .p = hpos }; + + if (!silent) printf("\e[%dG\e[36mTry to remove value from list:\e[m\n", hpos+1); + + switch (libcdsb_array_get(x, i, &v, remove_callback, 0)) { + case 0: if (!silent) printf("\e[%dG\e[32;1mSUCCESS\e[m\n", hpos+1); break; + default: if (!silent) printf("\e[%dG\e[32;1mFAILURE\e[m\n", hpos+1); break; + } + } + + put_separator(hpos); +} From 34146981e6767842ab8b7898d304c614222d6b2c Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Fri, 10 Jun 2022 12:21:57 +0300 Subject: [PATCH 15/27] Add list slice --- include/list.h | 2 ++ src/list/copy.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++++ src/list/extra.c | 9 +++--- 3 files changed, 84 insertions(+), 4 deletions(-) diff --git a/include/list.h b/include/list.h index eda1488..a88fc19 100644 --- a/include/list.h +++ b/include/list.h @@ -12,6 +12,8 @@ extern void list_init(vtype_list* x); extern void list_extend(vtype_list* x, const vtype_list* s); +extern size_t list_slice(vtype_list* x, vtype_list* src, ssize_t index, size_t count, _Bool cut) LIBCDSB_nt__ LIBCDSB_nn12__; + extern void list_sort(vtype_list* x); extern void list_reverse(vtype_list* x); diff --git a/src/list/copy.c b/src/list/copy.c index fb714ae..c9839c6 100644 --- a/src/list/copy.c +++ b/src/list/copy.c @@ -107,3 +107,80 @@ void list_extend(list_t* x, const list_t* s) { push_next(x, vnode_duplicate(&c->node, c->type), c->type); } while (!is_null(c = c->next)); } + + + +size_t list_slice(list_t* x, list_t* s, ssize_t i, size_t n, _Bool cut) { + + ldir_t dir; + lnode_t* c; + lnode_t* e; + size_t r; + + r = n; + + if (!n || is_null(s->first)) { + memset(x, 0, sizeof(*x)); + return 0; + } + + if (i < 0) { + c = s->last; + e = s->last; + i = ~i; + + while (i && !is_null(c)) { + c = c->prev; + --i; + if (!n) { e = e->prev; } + else --n; + } + + if (is_null(c)) c = x->first; + } else { + c = s->first; + + while (i && !is_null(c)) { + c = c->next; + --i; + } + + e = c; + + while (n && !is_null(e)) { + e = e->next; + --n; + } + + if (is_null(e)) e = x->last; + } + + if (is_null(c)) return 0; + else r -= n; + + if (!cut) { + init_first(x, vnode_duplicate(&c->node, c->type), c->type); + + while ((c = c->next) != e) { + push_next(x, vnode_duplicate(&c->node, c->type), c->type); + } + + push_next(x, vnode_duplicate(&e->node, e->type), e->type); + } else { + if (c->prev) { + c->prev->next = e->next; + } else x->first = e->next; + + if (e->next) { + e->next->prev = c->prev; + } else s->last = c->prev; + + e->next = nullptr; + c->prev = nullptr; + + x->first = c; + x->last = e; + } + + return r; +} diff --git a/src/list/extra.c b/src/list/extra.c index b51ee54..8b578c7 100644 --- a/src/list/extra.c +++ b/src/list/extra.c @@ -59,14 +59,15 @@ ssize_t libcdsb_list_get(val_t* x, list_t* s, ssize_t i, _Bool cut) { /*#####################################################################################################################*/ ssize_t libcdsb_list_find(val_t* x, list_t* s, const void* v, vtype t, _Bool r, _Bool cut) { - ldir_t dir = r ? LD_PREV : LD_NEXT; + ldir_t dir; lnode_t* c; ssize_t i; int cmp; - c = ldir_dir((lnode_t*)s, dir); - i = 0; + dir = r ? LD_PREV : LD_NEXT; + c = ldir_dir((lnode_t*)s, dir); + i = 0; if (!is_null(x)) memset(x, 0, sizeof(*x)); @@ -178,7 +179,7 @@ int libcdsb_list_foreach(vtype_list* x, void* data, list_foreach_callback callba break; n = c->next; - + if (flush) { vnode_free(&c->node, c->type); free(c); From 2420b7bd6b04fae98bea9204389872185b87fc7b Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Fri, 10 Jun 2022 12:22:20 +0300 Subject: [PATCH 16/27] Update array slice --- include/array.h | 4 ++-- src/array/base-copy.c | 52 ++++++++++++++++++++++++++++++++++++----- src/array/slice.c | 54 ------------------------------------------- 3 files changed, 48 insertions(+), 62 deletions(-) delete mode 100644 src/array/slice.c diff --git a/include/array.h b/include/array.h index 05042f0..397f5a6 100644 --- a/include/array.h +++ b/include/array.h @@ -11,8 +11,8 @@ 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_nn1__; +extern void* array_at(const vtype_array* s, ssize_t index) LIBCDSB_nt__ LIBCDSB_nn1__; +extern size_t array_slice(vtype_array* x, vtype_array* src, ssize_t index, size_t count, _Bool cut) LIBCDSB_nt__ LIBCDSB_nn1__; extern void array_sort (vtype_array* x) LIBCDSB_nt__ LIBCDSB_nn1__; extern void array_reverse(vtype_array* x) LIBCDSB_nt__ LIBCDSB_nn1__; diff --git a/src/array/base-copy.c b/src/array/base-copy.c index fe4dbcf..967e74e 100644 --- a/src/array/base-copy.c +++ b/src/array/base-copy.c @@ -4,12 +4,11 @@ #include "include.h" #include "../__internal/assert.h" + arr_t array_copy(const arr_t* s) { arr_t x = { .mem = 0, .size = 0, .type = 0 }; if (s->size > 0) { - assert(!is_null(s->mem)); - x.type = s->type; x.size = s->size; @@ -41,12 +40,11 @@ arr_t array_copy(const arr_t* s) { return x; } + arr_t* array_duplicate(const arr_t* s) { arr_t* x = malloc(sizeof(*x)); if (s->size > 0) { - assert(!is_null(s->mem)); - x->type = s->type; x->size = s->size; @@ -78,10 +76,9 @@ arr_t* array_duplicate(const arr_t* s) { return x; } + void array_copy_init(arr_t* x, const arr_t* s) { if (s->size > 0) { - assert(!is_null(s->mem)); - x->type = s->type; x->size = s->size; @@ -110,3 +107,46 @@ void array_copy_init(arr_t* x, const arr_t* s) { } else x->mem = memndup(s->mem, x->size*vtype_size(x->type)); } else memset(x, 0, sizeof(*x)); } + + +size_t array_slice(arr_t* x, arr_t* s, ssize_t i, size_t n, _Bool cut) { + + if (!n || !s->size) { + memset(x, 0, sizeof(*x)); + return 0; + } + + if (i < 0 && (i += s->size) < 0) i = 0; + if (i + n > s->size) n = s->size - (i + 1); + + x->type = s->type; + x->size = n; + x->mem = malloc(x->size*vtype_size(x->type)); + + if (!cut && s->type >= VTYPE_STRING) { + void *p, *v, *e; + void (*init)(void*, const void*); + + p = x->mem; + v = array_internal_at(s, i); + e = array_internal_at(x, n); + + switch (s->type) { default: abort(); + case VTYPE_STRING: init = (void*)string_copy_init; break; + case VTYPE_ARRAY: init = (void*) array_copy_init; break; + case VTYPE_LIST: init = (void*) list_copy_init; break; + case VTYPE_MAP: init = (void*) map_copy_init; break; + case VTYPE_SET: init = (void*) vset_copy_init; break; + } + + do { + init(p, v); + p += vtype_size(x->type); + v += vtype_size(x->type); + } while (p < e); + } else memcpy(x->mem, array_internal_at(s, i), n*vtype_size(x->type)); + + if (cut) array_cut(s, i, n); + + return n; +} diff --git a/src/array/slice.c b/src/array/slice.c deleted file mode 100644 index 00c9549..0000000 --- a/src/array/slice.c +++ /dev/null @@ -1,54 +0,0 @@ -/* This software is licensed by the MIT License, see LICENSE file */ -/* Copyright © 2022 Gregory Lirent */ - -#include "include.h" -#include "../__internal/assert.h" -#include "../__internal/vnode.h" - -_Bool array_slice(arr_t* x, arr_t* s, ssize_t i, size_t n, _Bool cut) { - if (n && s->size) { - assert(!is_null(s->mem)); - - if (i < 0 && (i += s->size) < 0) i = 0; - - if (i + n > s->size) { - memset(x, 0, sizeof(*x)); - return false; - } - - x->type = s->type; - x->size = n; - x->mem = malloc(x->size*vtype_size(x->type)); - - if (!cut && s->type >= VTYPE_STRING) { - void *p, *v, *e; - void (*init)(void*, const void*); - - p = x->mem; - v = array_internal_at(s, i); - e = array_internal_at(x, n); - - switch (s->type) { default: abort(); - case VTYPE_STRING: init = (void*)string_copy_init; break; - case VTYPE_ARRAY: init = (void*) array_copy_init; break; - case VTYPE_LIST: init = (void*) list_copy_init; break; - case VTYPE_MAP: init = (void*) map_copy_init; break; - case VTYPE_SET: init = (void*) vset_copy_init; break; - } - - do { - init(p, v); - p += vtype_size(x->type); - v += vtype_size(x->type); - } while (p < e); - } else memcpy(x->mem, array_internal_at(s, i), n*vtype_size(x->type)); - - if (cut) array_cut(s, i, n); - } else { - memset(x, 0, sizeof(*x)); - - if (n && !s->size) return false; - } - - return true; -} From dcdf32e2e4d3b4d996646b61c994bd5b63fe5b96 Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Fri, 10 Jun 2022 16:29:54 +0300 Subject: [PATCH 17/27] Fix list sort bug --- src/list/sort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/list/sort.c b/src/list/sort.c index 037881f..8b927b4 100644 --- a/src/list/sort.c +++ b/src/list/sort.c @@ -34,7 +34,7 @@ void list_sort(list_t* x) { lnode_t *p = l->prev; for (lnode_t* c = l; c != r; c = c->next) { - if (lnode_compare(c, r) < 0) { + if (lnode_compare(c, r) <= 0) { p = (is_null(p)) ? l : p->next; lnode_swap(p, c); } From 11db0557b9b6b27b021e6563b6d091976a8fff8c Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Fri, 10 Jun 2022 17:08:06 +0300 Subject: [PATCH 18/27] Update list tests --- tests/src/list/main.c | 5 ++++- tests/src/list/plug.h | 1 + tests/src/list/src/io.c | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/tests/src/list/main.c b/tests/src/list/main.c index 9cdcbcd..71a3352 100644 --- a/tests/src/list/main.c +++ b/tests/src/list/main.c @@ -9,7 +9,10 @@ int main(int argc, char** argv) { list_t x = { .first = 0, .last = 0 }; list_t y = { .first = 0, .last = 0 }; - visual_push2(&x, (random_uint8()%5) + 12, &y, (random_uint8()%5) + 12); + visual_push(&x, (random_uint8()%9) + 8); + visual_slice(&x, &y); + + visual_push2(&x, (random_uint8()%5) + 12, &y, (random_uint8()%3) + 6); visual_extend(&x, &y); visual_sort2(&x, &y); diff --git a/tests/src/list/plug.h b/tests/src/list/plug.h index 7362e9d..21c7aa5 100644 --- a/tests/src/list/plug.h +++ b/tests/src/list/plug.h @@ -23,3 +23,4 @@ extern void visual_push2(list_t* x0, size_t n0, list_t* x1, size_t n1); extern void visual_remove2(list_t* x0, list_t* x1); extern void visual_sort2(list_t* x0, list_t* x1); extern void visual_extend(list_t* x, list_t* s); +extern void visual_slice(list_t* x, list_t* s); diff --git a/tests/src/list/src/io.c b/tests/src/list/src/io.c index 5ed0ed0..bbb441f 100644 --- a/tests/src/list/src/io.c +++ b/tests/src/list/src/io.c @@ -186,3 +186,38 @@ void visual_extend(list_t* x, list_t* s) { psleep(900000); fputs("\e[u\e[J", stdout); } + + +void visual_slice(list_t* x, list_t* s) { + + size_t n = list_size(x); + ssize_t i = random_uint64()%(n - 1); + + n = n - (i + 1); + + puts("\e[s\e[36mTry to slice list:\e[m\n\n"); + printf("\e[37;2m%-60s%s\e[m\n", "=== === === === === === === ===", "=== === === === === === === ==="); + + list_info(x, 0); + list_print(x, "(src)", 0); + fputs("\e[u\e[s\e[4E", stdout); + list_info(s, 60); + list_print(s, "(dest)", 60); + + psleep(900000); + + list_slice(s, x, i, n, 1); + fputs("\e[u\e[s\e[2E\e[32;1mSUCCESS\e[m\e[J", stdout); + + puts(""); + put_separator(0); + + list_info(x, 0); + list_print(x, "(src)", 0); + fputs("\e[u\e[s\e[4E", stdout); + list_info(s, 60); + list_print(s, "(dest)", 60); + psleep(900000); + + fputs("\e[u\e[J", stdout); +} From fe6732a39b37240a0fa7fb657fef49a931b6c955 Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Fri, 10 Jun 2022 17:08:36 +0300 Subject: [PATCH 19/27] Update array tests --- tests/src/array/src/plug.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/src/array/src/plug.c b/tests/src/array/src/plug.c index 30511e8..364b6fc 100644 --- a/tests/src/array/src/plug.c +++ b/tests/src/array/src/plug.c @@ -3,6 +3,7 @@ #include #include "../../../../include/extra/vtype.h" +#include "../../../include/random.h" vtype_string* string_duplicate(const vtype_string* x) { return 0; } vtype_list* list_duplicate (const vtype_list* x) { return 0; } @@ -14,10 +15,10 @@ void list_free (vtype_list* x) {} void map_free (vtype_map* x) {} void vset_free (vtype_set* x) {} -int string_compare(const vtype_string* s0, const vtype_string* s1) { random_int8(); } -int list_compare (const vtype_list* s0, const vtype_list* s1) { random_int8(); } -int map_compare (const vtype_map* s0, const vtype_map* s1) { random_int8(); } -int vset_compare (const vtype_set* s0, const vtype_set* s1) { random_int8(); } +int string_compare(const vtype_string* s0, const vtype_string* s1) { return random_int8(); } +int list_compare (const vtype_list* s0, const vtype_list* s1) { return random_int8(); } +int map_compare (const vtype_map* s0, const vtype_map* s1) { return random_int8(); } +int vset_compare (const vtype_set* s0, const vtype_set* s1) { return random_int8(); } extern void string_copy_init(vtype_string* x, const vtype_string* s) { memset(x, 0, sizeof(*x)); } extern void list_copy_init (vtype_list* x, const vtype_list* s) { memset(x, 0, sizeof(*x)); } From 333e9fd675294c3fd5ca683099dc24f096df0135 Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Fri, 10 Jun 2022 17:59:53 +0300 Subject: [PATCH 20/27] Fix list slice --- src/list/copy.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/list/copy.c b/src/list/copy.c index c9839c6..b790652 100644 --- a/src/list/copy.c +++ b/src/list/copy.c @@ -169,17 +169,14 @@ size_t list_slice(list_t* x, list_t* s, ssize_t i, size_t n, _Bool cut) { } else { if (c->prev) { c->prev->next = e->next; - } else x->first = e->next; + } else s->first = e->next; if (e->next) { e->next->prev = c->prev; } else s->last = c->prev; - e->next = nullptr; - c->prev = nullptr; - - x->first = c; - x->last = e; + (x->first = c)->prev = nullptr; + (x->last = e)->next = nullptr; } return r; From 8dc5a84d49737861715b2c91b0fadcafefa63f56 Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Fri, 10 Jun 2022 20:50:03 +0300 Subject: [PATCH 21/27] Update tests --- tests/src/array/src/random.c | 2 +- tests/src/list/src/io.c | 2 +- tests/src/list/src/random.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/src/array/src/random.c b/tests/src/array/src/random.c index 22af216..4dcc8b7 100644 --- a/tests/src/array/src/random.c +++ b/tests/src/array/src/random.c @@ -79,5 +79,5 @@ void array_remove_random(arr_t* x, _Bool silent, unsigned int hpos) { } } - put_separator(hpos); + if (!silent) put_separator(hpos); } diff --git a/tests/src/list/src/io.c b/tests/src/list/src/io.c index bbb441f..793ae33 100644 --- a/tests/src/list/src/io.c +++ b/tests/src/list/src/io.c @@ -58,7 +58,7 @@ void visual_remove(list_t* x) { list_print(x, 0, 0); psleep(100000); - if (!0) fputs("\e[u\e[J", stdout); + fputs("\e[u\e[J", stdout); } } diff --git a/tests/src/list/src/random.c b/tests/src/list/src/random.c index 2552978..5a4a1a9 100644 --- a/tests/src/list/src/random.c +++ b/tests/src/list/src/random.c @@ -78,5 +78,5 @@ void list_remove_random(list_t* x, _Bool silent, unsigned int hpos) { } } - put_separator(hpos); + if (!silent) put_separator(hpos); } From 41c220b50766ee7e29bd0e825ce152507605dae9 Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Fri, 10 Jun 2022 20:50:20 +0300 Subject: [PATCH 22/27] Update map tests --- tests/src/map/main.c | 8 +- tests/src/map/plug.h | 217 ++----------------------------------- tests/src/map/src/io.c | 83 ++++++++++++++ tests/src/map/src/plug.c | 20 ++++ tests/src/map/src/random.c | 53 +++++++++ 5 files changed, 169 insertions(+), 212 deletions(-) create mode 100644 tests/src/map/src/io.c create mode 100644 tests/src/map/src/plug.c create mode 100644 tests/src/map/src/random.c diff --git a/tests/src/map/main.c b/tests/src/map/main.c index f08ef64..d054ec0 100644 --- a/tests/src/map/main.c +++ b/tests/src/map/main.c @@ -6,8 +6,10 @@ int main(int argc, char** argv) { test_init(argc, argv); - map_t x = map_random(36, 0.1); + map_t x; - while(map_remove_random(&x, 0.1)) {} - map_free(&x); + map_init(&x, random_uint8()%VTYPE_LDOUBLE + 1); + + visual_push(&x, random_uint8()%17 + 16); + visual_remove(&x); } diff --git a/tests/src/map/plug.h b/tests/src/map/plug.h index 2ea8ee7..bb64636 100644 --- a/tests/src/map/plug.h +++ b/tests/src/map/plug.h @@ -7,214 +7,13 @@ #include "../../include/test.h" #include "../../include/time.h" -vtype_string* string_duplicate(const vtype_string* x) { return 0; } -vtype_array* array_duplicate (const vtype_array* x) { return 0; } -vtype_list* list_duplicate (const vtype_list* x) { return 0; } -vtype_set* vset_duplicate (const vtype_set* x) { return 0; } +void map_push_random(map_t* x, _Bool silent, unsigned int hpos); +void map_remove_random(map_t* x, _Bool silent, unsigned int hpos); -void string_free(vtype_string* x) {} -void array_free (vtype_array* x) {} -void list_free (vtype_list* x) {} -void vset_free (vtype_set* x) {} +void rbtree_print(const mnode_t* s, vtype t, const char* ind, bool br); +void map_print(map_t* x, const char* prefix, unsigned int hpos); +void map_info(const map_t* x, unsigned int hpos); +void map_rbtree_print(map_t *x, const char* prefix, unsigned int hpos); -int string_compare(const vtype_string* s0, const vtype_string* s1) { return random_int8(); } -int array_compare (const vtype_array* s0, const vtype_array* s1) { return random_int8(); } -int list_compare (const vtype_list* s0, const vtype_list* s1) { return random_int8(); } -int vset_compare (const vtype_set* s0, const vtype_set* s1) { return random_int8(); } - - -static int map_node_print(const void* k, vtype kt, void* v, vtype vt, void* _) { - printf(" \e[31m%24s\e[m \e[36m:\e[m", vtype_stringify(k, kt)); - printf(" \e[31m%s\e[m", vtype_stringify(v, vt)); - printf(" \e[36m(\e[m\e[32;1m%s\e[m\e[36m)\e[m\n", vtype_name(vt)); - return 0; -} - -static void map_print(map_t* x, const char* prefix) { - print_container_values_prefix("Map", prefix); - map_foreach(x, 0, map_node_print); - put_separator(); -} - -static void map_info(const map_t* x) { - print_container_info("Map", "nodes", &x->type, map_size(x), -1); - put_separator(); -} - -static void map_rbtree_print(const mnode_t* s, vtype t, const char* ind, bool br) { - if (!ind) { - ind = "\e[36m"; - br = 1; - } - - size_t n = strlen(ind); - char x[n + 10]; - - if (mnode_is_empty(s)) return; - - memcpy(x, ind, n); - memcpy(x + n, " \0 ", 9); - fputs(ind, stdout); - - if (br) { - fputs("\e[m\e[36;1mR\e[m\e[36m────\e[m", stdout); - } else { - fputs("\e[m\e[36;1mL\e[m\e[36m────\e[m", stdout); - memcpy(x + n, "│", 3); - x[n + 5] = ' '; - } - - fputs((s->colored) ? "\e[31;1m" : "\e[37m", stdout); - printf("%s\e[m \e[36m:\e[m ", vnode_stringify(&s->key, t)); - printf("\e[31m%s\e[m", vnode_stringify(&s->value, s->type)); - printf(" \e[36m(\e[m\e[32;1m%s\e[m\e[36m)\e[m\n", vtype_name(s->type)); - - map_rbtree_print(s->left, t, x, false); - map_rbtree_print(s->right, t, x, true); -} - -static void map_push_random(map_t* x, double pause) { - var_t _[2]; - vtype t[2]; - - printf("\e[s\e[36mUpdate value in map (\e[m\e[32;1m%s\e[m\e[36m)\e[m:\n", vtype_name(x->type)); - - switch (random_uint8()%13) { - default: - case 0: _[0].b = random_boolean(); print_container_value(0, _, t[0] = VTYPE_BOOLEAN, 1); break; - case 1: _[0].u8 = random_uint8(); print_container_value(0, _, t[0] = VTYPE_UINT8, 1); break; - case 2: _[0].u16 = random_uint16(); print_container_value(0, _, t[0] = VTYPE_UINT16, 1); break; - case 3: _[0].u32 = random_uint32(); print_container_value(0, _, t[0] = VTYPE_UINT32, 1); break; - case 4: _[0].u64 = random_uint64(); print_container_value(0, _, t[0] = VTYPE_UINT64, 1); break; - case 5: _[0].u8 = random_int8(); print_container_value(0, _, t[0] = VTYPE_INT8, 1); break; - case 6: _[0].u16 = random_int16(); print_container_value(0, _, t[0] = VTYPE_INT16, 1); break; - case 7: _[0].u32 = random_int32(); print_container_value(0, _, t[0] = VTYPE_INT32, 1); break; - case 8: _[0].u64 = random_int64(); print_container_value(0, _, t[0] = VTYPE_INT64, 1); break; - case 9: _[0].f = random_float(); print_container_value(0, _, t[0] = VTYPE_FLOAT, 1); break; - case 10: _[0].d = random_double(); print_container_value(0, _, t[0] = VTYPE_DOUBLE, 1); break; - case 11: _[0].ld = random_ldouble(); print_container_value(0, _, t[0] = VTYPE_LDOUBLE, 1); break; - - case 12: if (sizeof(void*) == 8) { - _[0].u64 = random_uint64(); print_container_value(0, _, t[0] = VTYPE_POINTER, 1); break; - } else { - _[0].u32 = random_uint32(); print_container_value(0, _, t[0] = VTYPE_POINTER, 1); break; - } - } - - switch (random_uint8()%13) { - default: - case 0: _[1].b = random_boolean(); print_container_value(0, _+1, t[1] = VTYPE_BOOLEAN, 1); break; - case 1: _[1].u8 = random_uint8(); print_container_value(0, _+1, t[1] = VTYPE_UINT8, 1); break; - case 2: _[1].u16 = random_uint16(); print_container_value(0, _+1, t[1] = VTYPE_UINT16, 1); break; - case 3: _[1].u32 = random_uint32(); print_container_value(0, _+1, t[1] = VTYPE_UINT32, 1); break; - case 4: _[1].u64 = random_uint64(); print_container_value(0, _+1, t[1] = VTYPE_UINT64, 1); break; - case 5: _[1].u8 = random_int8(); print_container_value(0, _+1, t[1] = VTYPE_INT8, 1); break; - case 6: _[1].u16 = random_int16(); print_container_value(0, _+1, t[1] = VTYPE_INT16, 1); break; - case 7: _[1].u32 = random_int32(); print_container_value(0, _+1, t[1] = VTYPE_INT32, 1); break; - case 8: _[1].u64 = random_int64(); print_container_value(0, _+1, t[1] = VTYPE_INT64, 1); break; - case 9: _[1].f = random_float(); print_container_value(0, _+1, t[1] = VTYPE_FLOAT, 1); break; - case 10: _[1].d = random_double(); print_container_value(0, _+1, t[1] = VTYPE_DOUBLE, 1); break; - case 11: _[1].ld = random_ldouble(); print_container_value(0, _+1, t[1] = VTYPE_LDOUBLE, 1); break; - - case 12: if (sizeof(void*) == 8) { - _[1].u64 = random_uint64(); print_container_value(0, _+1, t[1] = VTYPE_POINTER, 1); break; - } else { - _[1].u32 = random_uint32(); print_container_value(0, _+1, t[1] = VTYPE_POINTER, 1); break; - } - } - - if (libcdsb_map_update(x, _, t[0], _+1, t[1])) { - puts("\e[33;1mCHANGE\e[m"); - } else { - puts("\e[32;1mINSERT\e[m"); - } - - put_separator(); - - map_rbtree_print(x->root, x->type, 0, 0); - put_separator(); - psleep(pause * 1000000); - fputs("\e[u\e[J", stdout); -} - -static int map_node_remove_random(const void* k, vtype kt, void* v, vtype vt, void* data) { - struct { - size_t n; - map_t* set; - double pause; - } *d = data; - - if (!d->n--) { - map_node_print(k, kt, v, vt, 0); - - if (libcdsb_map_find(0, d->set, k, kt, 1)) { - puts("\e[32;1mSUCCESS\e[m"); - } else { - puts("\e[s\e[31;1mFAILURE\e[m"); - abort(); - } - - put_separator(); - - map_rbtree_print(d->set->root, d->set->type, 0, 0); - put_separator(); - psleep(d->pause * 1000000); - - return true; - } - return 0; -} - - -static bool map_remove_random(map_t* x, double pause) { - struct { - size_t n; - map_t* set; - double pause; - } d; - d.n = map_size(x); - d.set = x; - d.pause = pause; - - printf("\e[s\e[36mTry to remove value from map (\e[m\e[32;1m%s\e[m\e[36m)\e[m:\n", libcdsb_vtype_name(x->type)); - - if (d.n) { - d.n = random_uint32()%d.n; - } else goto end_; - - if (!map_foreach(x, &d, map_node_remove_random)) { - end_: - puts("\e[u\e[J\e[32;1mMap is empty\e[m"); - return false; - } - - fputs("\e[u\e[J", stdout); - return true; -} - -static map_t map_random(unsigned int n, double pause) { - map_t x; - - switch (random_uint8()%12) { - default: - case 0: map_init(&x, VTYPE_UINT8); break; - case 1: map_init(&x, VTYPE_UINT16); break; - case 2: map_init(&x, VTYPE_UINT32); break; - case 3: map_init(&x, VTYPE_UINT64); break; - case 4: map_init(&x, VTYPE_INT8); break; - case 5: map_init(&x, VTYPE_INT16); break; - case 6: map_init(&x, VTYPE_INT32); break; - case 7: map_init(&x, VTYPE_INT64); break; - case 8: map_init(&x, VTYPE_POINTER); break; - case 9: map_init(&x, VTYPE_FLOAT); break; - case 10: map_init(&x, VTYPE_DOUBLE); break; - case 11: map_init(&x, VTYPE_LDOUBLE); break; - } - - if (n) { - while (--n) map_push_random(&x, pause); - map_push_random(&x, pause); - } - - return x; -} +void visual_push(map_t* x, size_t n); +void visual_remove(map_t* x); diff --git a/tests/src/map/src/io.c b/tests/src/map/src/io.c new file mode 100644 index 0000000..5bb48f4 --- /dev/null +++ b/tests/src/map/src/io.c @@ -0,0 +1,83 @@ +/* This software is licensed by the MIT License, see LICENSE file */ +/* Copyright © 2022 Gregory Lirent */ + +#include "../plug.h" + +static int node_print_callback(const void* k, vtype kt, void* v, vtype vt, void* _) { + print_container_value(0, k, kt, 0, *(unsigned int*)_); + return 0; +} + +void map_print(map_t* x, const char* prefix, unsigned int hpos) { + print_container_values_prefix("Map", prefix, 0); + map_foreach(x, &hpos, node_print_callback); + put_separator(0); +} + +void map_info(const map_t* x, unsigned int hpos) { + print_container_info("Map", "nodes", &x->type, map_size(x), -1, 0); + put_separator(0); +} + +void map_rbtree_print(map_t *x, const char* prefix, unsigned int hpos) { + print_container_values_prefix("Map", prefix, 0); + rbtree_print(x->root, x->type, 0, 0); +} + +void rbtree_print(const mnode_t* s, vtype t, const char* ind, bool br) { + if (!ind) { + ind = "\e[36m"; + br = 1; + } + + size_t n = strlen(ind); + char x[n + 10]; + + if (mnode_is_empty(s)) return; + + memcpy(x, ind, n); + memcpy(x + n, " \0 ", 9); + + fputs(ind, stdout); + + if (br) { + fputs("\e[m\e[36;1mR\e[m\e[36m────\e[m", stdout); + } else { + fputs("\e[m\e[36;1mL\e[m\e[36m────\e[m", stdout); + memcpy(x + n, "│", 3); + x[n + 5] = ' '; + } + + fputs((s->colored) ? "\e[31;1m" : "\e[37m", stdout); + printf("%s\e[m \e[36m:\e[m ", vnode_stringify(&s->key, t)); + printf("\e[31m%s\e[m", vnode_stringify(&s->value, s->type)); + printf(" \e[36m(\e[m\e[32;1m%s\e[m\e[36m)\e[m\n", vtype_name(s->type)); + + rbtree_print(s->left, t, x, false); + rbtree_print(s->right, t, x, true); +} + +void visual_push(map_t* x, size_t n) { + while (n--) { + fputs("\e[s", stdout); + + map_push_random(x, 0, 0); + + map_info(x, 0); + rbtree_print(x->root, x->type, 0, 0); + + psleep(100000); + fputs("\e[u\e[J", stdout); + } +} + +void visual_remove(map_t* x) { + while (!mnode_is_empty(x->root)) { + fputs("\e[s", stdout); + map_remove_random(x, 0, 0); + map_info(x, 0); + rbtree_print(x->root, x->type, 0, 0); + psleep(100000); + fputs("\e[u\e[J", stdout); + } +} diff --git a/tests/src/map/src/plug.c b/tests/src/map/src/plug.c new file mode 100644 index 0000000..b2a8764 --- /dev/null +++ b/tests/src/map/src/plug.c @@ -0,0 +1,20 @@ +/* This software is licensed by the MIT License, see LICENSE file */ +/* Copyright © 2022 Gregory Lirent */ + +#include "../../../../src/__internal/include.h" +#include "../../../include/random.h" + +vtype_string* string_duplicate(const vtype_string* x) { return 0; } +vtype_array* array_duplicate (const vtype_array* x) { return 0; } +vtype_list* list_duplicate (const vtype_list* x) { return 0; } +vtype_set* vset_duplicate (const vtype_set* x) { return 0; } + +void string_free(vtype_string* x) {} +void array_free (vtype_array* x) {} +void list_free (vtype_list* x) {} +void vset_free (vtype_set* x) {} + +int string_compare(const vtype_string* s0, const vtype_string* s1) { return random_int8(); } +int array_compare (const vtype_array* s0, const vtype_array* s1) { return random_int8(); } +int list_compare (const vtype_list* s0, const vtype_list* s1) { return random_int8(); } +int vset_compare (const vtype_set* s0, const vtype_set* s1) { return random_int8(); } diff --git a/tests/src/map/src/random.c b/tests/src/map/src/random.c new file mode 100644 index 0000000..e917874 --- /dev/null +++ b/tests/src/map/src/random.c @@ -0,0 +1,53 @@ +/* This software is licensed by the MIT License, see LICENSE file */ +/* Copyright © 2022 Gregory Lirent */ + +#include "../plug.h" + +static int remove_callback(const void* k, vtype kt, void* v, vtype vt, void* _) { + struct { size_t n; map_t* x; unsigned int hp; } *d = _; + + if (!d->n--) { + print_container_value(0, k, kt, 0, d->hp); + + if (libcdsb_map_find(d->x, k, kt, 0, 0, 1)) { + printf("\e[%dG\e[32;1mSUCCESS\e[m", d->hp+1); + } else printf("\e[%dG\e[31;1mFAILURE\e[m", d->hp+1); + + return -2; + } + return 0; +} + +void map_push_random(map_t* x, _Bool silent, unsigned int hpos) { + + value_t k = random_value(); + value_t v = random_value(); + + if (!silent) { + printf("\e[%dG\e[36mUpdate value in map (\e[m\e[32;1m%s\e[m\e[36m) with key:\e[m\n", hpos+1, vtype_name(x->type)); + print_container_value(0, k.value, k.type, 1, hpos); + } + + if (libcdsb_map_update(x, k.value, k.type, v.value, v.type)) { + if (!silent) printf("\e[%dG\\e[33;1mCHANGE\e[m", hpos+1); + } else if (!silent) printf("\e[%dG\\e[32;1mINSERT\e[m", hpos+1); + + if (!silent) put_separator(0); +} + + +void map_remove_random(map_t* x, _Bool silent, unsigned int hpos) { + struct { size_t n; map_t* x; unsigned int hp; } d = { .n = map_size(x), .x = x, .hp = hpos }; + + if (!silent) + printf("\e[%dG\e[36mTry to remove value from map (\e[m\e[32;1m%s\e[m\e[36m) by key:\e[m\n", hpos+1, libcdsb_vtype_name(x->type)); + + if (d.n) { + d.n = random_uint32()%d.n; + map_foreach(x, &d, remove_callback); + } else if (!silent) { + printf("\e[%dG\e[32;1m\nFAILURE\e[m\n", hpos+1); + } + + if (!silent) put_separator(hpos); +} From d57f5ed2c6ef9435867e83e21fefdb5ee14ba3b7 Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Fri, 10 Jun 2022 21:17:07 +0300 Subject: [PATCH 23/27] Update map tests --- tests/src/map/plug.h | 1 - tests/src/map/src/io.c | 71 +++++++++++++++++++------------------- tests/src/map/src/random.c | 10 +++--- 3 files changed, 41 insertions(+), 41 deletions(-) diff --git a/tests/src/map/plug.h b/tests/src/map/plug.h index bb64636..a2ae449 100644 --- a/tests/src/map/plug.h +++ b/tests/src/map/plug.h @@ -10,7 +10,6 @@ void map_push_random(map_t* x, _Bool silent, unsigned int hpos); void map_remove_random(map_t* x, _Bool silent, unsigned int hpos); -void rbtree_print(const mnode_t* s, vtype t, const char* ind, bool br); void map_print(map_t* x, const char* prefix, unsigned int hpos); void map_info(const map_t* x, unsigned int hpos); void map_rbtree_print(map_t *x, const char* prefix, unsigned int hpos); diff --git a/tests/src/map/src/io.c b/tests/src/map/src/io.c index 5bb48f4..a01da4b 100644 --- a/tests/src/map/src/io.c +++ b/tests/src/map/src/io.c @@ -8,6 +8,39 @@ static int node_print_callback(const void* k, vtype kt, void* v, vtype vt, void* return 0; } +static void rbtree_print(const mnode_t* s, vtype t, const char* ind, bool br, unsigned int hpos) { + if (!ind) { + ind = "\e[36m"; + br = 1; + } + + size_t n = strlen(ind); + char x[n + 10]; + + if (mnode_is_empty(s)) return; + + memcpy(x, ind, n); + memcpy(x + n, " \0 ", 9); + + printf("\e[%dG%s", hpos+1, ind); + + if (br) { + fputs("\e[m\e[36;1mR\e[m\e[36m────\e[m", stdout); + } else { + fputs("\e[m\e[36;1mL\e[m\e[36m────\e[m", stdout); + memcpy(x + n, "│", 3); + x[n + 5] = ' '; + } + + fputs((s->colored) ? "\e[31;1m" : "\e[37m", stdout); + printf("%s\e[m \e[36m:\e[m ", vnode_stringify(&s->key, t)); + printf("\e[31m%s\e[m", vnode_stringify(&s->value, s->type)); + printf(" \e[36m(\e[m\e[32;1m%s\e[m\e[36m)\e[m\n", vtype_name(s->type)); + + rbtree_print(s->left, t, x, false, hpos); + rbtree_print(s->right, t, x, true, hpos); +} + void map_print(map_t* x, const char* prefix, unsigned int hpos) { print_container_values_prefix("Map", prefix, 0); map_foreach(x, &hpos, node_print_callback); @@ -21,41 +54,9 @@ void map_info(const map_t* x, unsigned int hpos) { void map_rbtree_print(map_t *x, const char* prefix, unsigned int hpos) { print_container_values_prefix("Map", prefix, 0); - rbtree_print(x->root, x->type, 0, 0); + rbtree_print(x->root, x->type, 0, 0, hpos); } -void rbtree_print(const mnode_t* s, vtype t, const char* ind, bool br) { - if (!ind) { - ind = "\e[36m"; - br = 1; - } - - size_t n = strlen(ind); - char x[n + 10]; - - if (mnode_is_empty(s)) return; - - memcpy(x, ind, n); - memcpy(x + n, " \0 ", 9); - - fputs(ind, stdout); - - if (br) { - fputs("\e[m\e[36;1mR\e[m\e[36m────\e[m", stdout); - } else { - fputs("\e[m\e[36;1mL\e[m\e[36m────\e[m", stdout); - memcpy(x + n, "│", 3); - x[n + 5] = ' '; - } - - fputs((s->colored) ? "\e[31;1m" : "\e[37m", stdout); - printf("%s\e[m \e[36m:\e[m ", vnode_stringify(&s->key, t)); - printf("\e[31m%s\e[m", vnode_stringify(&s->value, s->type)); - printf(" \e[36m(\e[m\e[32;1m%s\e[m\e[36m)\e[m\n", vtype_name(s->type)); - - rbtree_print(s->left, t, x, false); - rbtree_print(s->right, t, x, true); -} void visual_push(map_t* x, size_t n) { while (n--) { @@ -64,7 +65,7 @@ void visual_push(map_t* x, size_t n) { map_push_random(x, 0, 0); map_info(x, 0); - rbtree_print(x->root, x->type, 0, 0); + map_rbtree_print(x, 0, 0); psleep(100000); fputs("\e[u\e[J", stdout); @@ -76,7 +77,7 @@ void visual_remove(map_t* x) { fputs("\e[s", stdout); map_remove_random(x, 0, 0); map_info(x, 0); - rbtree_print(x->root, x->type, 0, 0); + map_rbtree_print(x, 0, 0); psleep(100000); fputs("\e[u\e[J", stdout); } diff --git a/tests/src/map/src/random.c b/tests/src/map/src/random.c index e917874..c4615f2 100644 --- a/tests/src/map/src/random.c +++ b/tests/src/map/src/random.c @@ -9,9 +9,9 @@ static int remove_callback(const void* k, vtype kt, void* v, vtype vt, void* _) if (!d->n--) { print_container_value(0, k, kt, 0, d->hp); - if (libcdsb_map_find(d->x, k, kt, 0, 0, 1)) { - printf("\e[%dG\e[32;1mSUCCESS\e[m", d->hp+1); - } else printf("\e[%dG\e[31;1mFAILURE\e[m", d->hp+1); + if (libcdsb_map_find(d->x, k, kt, 0, 0, 1) == 0) { + printf("\e[%dG\e[32;1mSUCCESS\e[m\n", d->hp+1); + } else printf("\e[%dG\e[31;1mFAILURE\e[m\n", d->hp+1); return -2; } @@ -29,8 +29,8 @@ void map_push_random(map_t* x, _Bool silent, unsigned int hpos) { } if (libcdsb_map_update(x, k.value, k.type, v.value, v.type)) { - if (!silent) printf("\e[%dG\\e[33;1mCHANGE\e[m", hpos+1); - } else if (!silent) printf("\e[%dG\\e[32;1mINSERT\e[m", hpos+1); + if (!silent) printf("\e[%dG\e[33;1mCHANGE\e[m\n", hpos+1); + } else if (!silent) printf("\e[%dG\e[32;1mINSERT\e[m\n", hpos+1); if (!silent) put_separator(0); } From f8878390a792dbefc7a07fda79abe349bdbf064a Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Fri, 10 Jun 2022 21:17:35 +0300 Subject: [PATCH 24/27] Update set tests --- tests/src/set/main.c | 8 +- tests/src/set/plug.h | 191 ++----------------------------------- tests/src/set/src/io.c | 82 ++++++++++++++++ tests/src/set/src/plug.c | 20 ++++ tests/src/set/src/random.c | 52 ++++++++++ 5 files changed, 166 insertions(+), 187 deletions(-) create mode 100644 tests/src/set/src/io.c create mode 100644 tests/src/set/src/plug.c create mode 100644 tests/src/set/src/random.c diff --git a/tests/src/set/main.c b/tests/src/set/main.c index be56d43..1ba5f76 100644 --- a/tests/src/set/main.c +++ b/tests/src/set/main.c @@ -6,8 +6,10 @@ int main(int argc, char** argv) { test_init(argc, argv); - set_t x = vset_random(36, 0.1); + set_t x; - while(vset_remove_random(&x, 0.1)) {} - vset_free(&x); + vset_init(&x, random_uint8()%VTYPE_LDOUBLE + 1); + + visual_push(&x, random_uint8()%17 + 16); + visual_remove(&x); } diff --git a/tests/src/set/plug.h b/tests/src/set/plug.h index fd4e092..756e649 100644 --- a/tests/src/set/plug.h +++ b/tests/src/set/plug.h @@ -8,188 +8,11 @@ #include "../../include/test.h" #include "../../include/time.h" -vtype_string* string_duplicate(const vtype_string* x) { return 0; } -vtype_array* array_duplicate (const vtype_array* x) { return 0; } -vtype_list* list_duplicate (const vtype_list* x) { return 0; } -vtype_map* map_duplicate (const vtype_map* x) { return 0; } +extern void vset_push_random(set_t* x, _Bool silent, unsigned int hpos); +extern void vset_remove_random(set_t* x, _Bool silent, unsigned int hpos); -void string_free(vtype_string* x) {} -void array_free (vtype_array* x) {} -void list_free (vtype_list* x) {} -void map_free (vtype_map* x) {} - -int string_compare(const vtype_string* s0, const vtype_string* s1) { return random_int8(); } -int array_compare (const vtype_array* s0, const vtype_array* s1) { return random_int8(); } -int list_compare (const vtype_list* s0, const vtype_list* s1) { return random_int8(); } -int map_compare (const vtype_map* s0, const vtype_map* s1) { return random_int8(); } - - -static int vset_node_print(const void* v, vtype t, void* _) { - print_container_value(0, v, t, false); - return 0; -} - -static void vset_print(set_t* x, const char* prefix) { - print_container_values_prefix("Set", prefix); - vset_foreach(x, 0, vset_node_print); - put_separator(); -} - -static void vset_info(const set_t* x) { - print_container_info("Set", "nodes", &x->type, vset_size(x), -1); - put_separator(); -} - -static void rbtree_print(const rbnode_t* s, vtype t, const char* ind, bool br) { - if (!ind) { - ind = "\e[36m"; - br = 1; - } - - size_t n = strlen(ind); - char x[n + 10]; - - if (rbnode_is_empty(s)) return; - - memcpy(x, ind, n); - memcpy(x + n, " \0 ", 9); - fputs(ind, stdout); - - if (br) { - fputs("\e[m\e[36;1mR\e[m\e[36m────\e[m", stdout); - } else { - fputs("\e[m\e[36;1mL\e[m\e[36m────\e[m", stdout); - memcpy(x + n, "│", 3); - x[n + 5] = ' '; - } - - - fputs((s->colored) ? "\e[31;1m" : "\e[37m", stdout); - printf("%s\e[m\n", libcdsb_vtype_stringify(vnode_peek(&s->value, t), t)); - - rbtree_print(s->left, t, x, false); - rbtree_print(s->right, t, x, true); -} - -static void vset_push_random(set_t* x, double pause) { - var_t _; - vtype t; - - printf("\e[s\e[36mTry to insert into set (\e[m\e[32;1m%s\e[m\e[36m)\e[m:\n", libcdsb_vtype_name(x->type)); - - switch (random_uint8()%13) { - default: - case 0: _.b = random_boolean(); print_container_value(0, &_, t = VTYPE_BOOLEAN, 1); break; - case 1: _.u8 = random_uint8(); print_container_value(0, &_, t = VTYPE_UINT8, 1); break; - case 2: _.u16 = random_uint16(); print_container_value(0, &_, t = VTYPE_UINT16, 1); break; - case 3: _.u32 = random_uint32(); print_container_value(0, &_, t = VTYPE_UINT32, 1); break; - case 4: _.u64 = random_uint64(); print_container_value(0, &_, t = VTYPE_UINT64, 1); break; - case 5: _.u8 = random_int8(); print_container_value(0, &_, t = VTYPE_INT8, 1); break; - case 6: _.u16 = random_int16(); print_container_value(0, &_, t = VTYPE_INT16, 1); break; - case 7: _.u32 = random_int32(); print_container_value(0, &_, t = VTYPE_INT32, 1); break; - case 8: _.u64 = random_int64(); print_container_value(0, &_, t = VTYPE_INT64, 1); break; - case 9: _.f = random_float(); print_container_value(0, &_, t = VTYPE_FLOAT, 1); break; - case 10: _.d = random_double(); print_container_value(0, &_, t = VTYPE_DOUBLE, 1); break; - case 11: _.ld = random_ldouble(); print_container_value(0, &_, t = VTYPE_LDOUBLE, 1); break; - - case 12: if (sizeof(void*) == 8) { - _.u64 = random_uint64(); print_container_value(0, &_, t = VTYPE_POINTER, 1); break; - } else { - _.u32 = random_uint32(); print_container_value(0, &_, t = VTYPE_POINTER, 1); break; - } - } - - if (libcdsb_vset_insert(x, &_, t)) { - puts("\e[32;1mSUCCESS\e[m"); - } else { - puts("\e[31;1mFAILURE\e[m"); - } - put_separator(); - - rbtree_print(x->root, x->type, 0, 0); - put_separator(); - psleep(pause * 1000000); - fputs("\e[u\e[J", stdout); -} - -static int vset_node_remove_random(const void* v, vtype t, void* data) { - struct { - size_t n; - set_t* set; - double pause; - } *d = data; - - if (!d->n--) { - print_container_value(0, v, t, 1); - - if (libcdsb_vset_find(0, d->set, v, t, 1)) { - puts("\e[32;1mSUCCESS\e[m"); - } else { - puts("\e[31;1mFAILURE\e[m"); - abort(); - } - - put_separator(); - - rbtree_print(d->set->root, d->set->type, 0, 0); - put_separator(); - psleep(d->pause * 1000000); - - return true; - } - return 0; -} - - -static bool vset_remove_random(set_t* x, double pause) { - struct { - size_t n; - set_t* set; - double pause; - } d; - d.n = vset_size(x); - d.set = x; - d.pause = pause; - - printf("\e[s\e[36mTry to remove value from set (\e[m\e[32;1m%s\e[m\e[36m)\e[m:\n", libcdsb_vtype_name(x->type)); - - if (d.n) { - d.n = random_uint32()%d.n; - } else goto end_; - - if (!vset_foreach(x, &d, vset_node_remove_random)) { - end_: - puts("\e[u\e[J\e[32;1mSet is empty\e[m"); - return false; - } - - fputs("\e[u\e[J", stdout); - return true; -} - -static set_t vset_random(unsigned int n, double pause) { - set_t x; - - switch (random_uint8()%12) { - default: - case 0: vset_init(&x, VTYPE_UINT8); break; - case 1: vset_init(&x, VTYPE_UINT16); break; - case 2: vset_init(&x, VTYPE_UINT32); break; - case 3: vset_init(&x, VTYPE_UINT64); break; - case 4: vset_init(&x, VTYPE_INT8); break; - case 5: vset_init(&x, VTYPE_INT16); break; - case 6: vset_init(&x, VTYPE_INT32); break; - case 7: vset_init(&x, VTYPE_INT64); break; - case 8: vset_init(&x, VTYPE_POINTER); break; - case 9: vset_init(&x, VTYPE_FLOAT); break; - case 10: vset_init(&x, VTYPE_DOUBLE); break; - case 11: vset_init(&x, VTYPE_LDOUBLE); break; - } - - if (n) { - while (--n) vset_push_random(&x, pause); - vset_push_random(&x, pause); - } - - return x; -} +extern void vset_print(set_t* x, const char* prefix, unsigned int hpos); +extern void vset_info(const set_t* x, unsigned int hpos); +extern void vset_rbtree_print(set_t *x, const char* prefix, unsigned int hpos); +extern void visual_push(set_t* x, size_t n); +extern void visual_remove(set_t* x); diff --git a/tests/src/set/src/io.c b/tests/src/set/src/io.c new file mode 100644 index 0000000..378aaf6 --- /dev/null +++ b/tests/src/set/src/io.c @@ -0,0 +1,82 @@ +/* This software is licensed by the MIT License, see LICENSE file */ +/* Copyright © 2022 Gregory Lirent */ + +#include "../plug.h" + + +static int node_print_callback(const void* v, vtype t, void* _) { + print_container_value(0, v, t, 0, *(unsigned int*)_); + return 0; +} + +static void rbtree_print(const rbnode_t* s, vtype t, const char* ind, bool br, unsigned int hpos) { + if (!ind) { + ind = "\e[36m"; + br = 1; + } + + size_t n = strlen(ind); + char x[n + 10]; + + if (rbnode_is_empty(s)) return; + + memcpy(x, ind, n); + memcpy(x + n, " \0 ", 9); + + printf("\e[%dG%s", hpos+1, ind); + + if (br) { + fputs("\e[m\e[36;1mR\e[m\e[36m────\e[m", stdout); + } else { + fputs("\e[m\e[36;1mL\e[m\e[36m────\e[m", stdout); + memcpy(x + n, "│", 3); + x[n + 5] = ' '; + } + + fputs((s->colored) ? "\e[31;1m" : "\e[37m", stdout); + printf("%s\e[m \e[36m\e[m\n", vnode_stringify(&s->value, t)); + + rbtree_print(s->left, t, x, false, hpos); + rbtree_print(s->right, t, x, true, hpos); +} + +void vset_print(set_t* x, const char* prefix, unsigned int hpos) { + print_container_values_prefix("Set", prefix, 0); + vset_foreach(x, &hpos, node_print_callback); + put_separator(0); +} + +void vset_info(const set_t* x, unsigned int hpos) { + print_container_info("Set", "nodes", &x->type, vset_size(x), -1, 0); + put_separator(0); +} + +void vset_rbtree_print(set_t *x, const char* prefix, unsigned int hpos) { + print_container_values_prefix("Set", prefix, 0); + rbtree_print(x->root, x->type, 0, 0, hpos); +} + +void visual_push(set_t* x, size_t n) { + while (n--) { + fputs("\e[s", stdout); + + vset_push_random(x, 0, 0); + + vset_info(x, 0); + vset_rbtree_print(x, 0, 0); + + psleep(100000); + fputs("\e[u\e[J", stdout); + } +} + +void visual_remove(set_t* x) { + while (!rbnode_is_empty(x->root)) { + fputs("\e[s", stdout); + vset_remove_random(x, 0, 0); + vset_info(x, 0); + vset_rbtree_print(x, 0, 0); + psleep(100000); + fputs("\e[u\e[J", stdout); + } +} diff --git a/tests/src/set/src/plug.c b/tests/src/set/src/plug.c new file mode 100644 index 0000000..00cf60d --- /dev/null +++ b/tests/src/set/src/plug.c @@ -0,0 +1,20 @@ +/* This software is licensed by the MIT License, see LICENSE file */ +/* Copyright © 2022 Gregory Lirent */ + +#include "../../../../src/__internal/include.h" +#include "../../../include/random.h" + +vtype_string* string_duplicate(const vtype_string* x) { return 0; } +vtype_array* array_duplicate (const vtype_array* x) { return 0; } +vtype_list* list_duplicate (const vtype_list* x) { return 0; } +vtype_map* map_duplicate (const vtype_map* x) { return 0; } + +void string_free(vtype_string* x) {} +void array_free (vtype_array* x) {} +void list_free (vtype_list* x) {} +void map_free (vtype_map* x) {} + +int string_compare(const vtype_string* s0, const vtype_string* s1) { return random_int8(); } +int array_compare (const vtype_array* s0, const vtype_array* s1) { return random_int8(); } +int list_compare (const vtype_list* s0, const vtype_list* s1) { return random_int8(); } +int map_compare (const vtype_map* s0, const vtype_map* s1) { return random_int8(); } diff --git a/tests/src/set/src/random.c b/tests/src/set/src/random.c new file mode 100644 index 0000000..dc6d6d5 --- /dev/null +++ b/tests/src/set/src/random.c @@ -0,0 +1,52 @@ +/* This software is licensed by the MIT License, see LICENSE file */ +/* Copyright © 2022 Gregory Lirent */ + +#include "../plug.h" + +static int remove_callback(const void* v, vtype t, void* _) { + struct { size_t n; set_t* x; unsigned int hp; } *d = _; + + if (!d->n--) { + print_container_value(0, v, t, 0, d->hp); + + if (libcdsb_vset_find(d->x, v, t, 0, 0, 1) == 0) { + printf("\e[%dG\e[32;1mSUCCESS\e[m\n", d->hp+1); + } else printf("\e[%dG\e[31;1mFAILURE\e[m\n", d->hp+1); + + return -2; + } + return 0; +} + +void vset_push_random(set_t* x, _Bool silent, unsigned int hpos) { + + value_t v = random_value(); + + if (!silent) { + printf("\e[%dG\e[36mUpdate value in set (\e[m\e[32;1m%s\e[m\e[36m):\e[m\n", hpos+1, vtype_name(x->type)); + print_container_value(0, v.value, v.type, 1, hpos); + } + + if (libcdsb_vset_insert(x, v.value, v.type)) { + if (!silent) printf("\e[%dG\e[32;1mSUCCESS\e[m\n", hpos+1); + } else if (!silent) printf("\e[%dG\e[31;1mFAILURE\e[m\n", hpos+1); + + if (!silent) put_separator(0); +} + + +void vset_remove_random(set_t* x, _Bool silent, unsigned int hpos) { + struct { size_t n; set_t* x; unsigned int hp; } d = { .n = vset_size(x), .x = x, .hp = hpos }; + + if (!silent) + printf("\e[%dG\e[36mTry to remove value from set (\e[m\e[32;1m%s\e[m\e[36m):\e[m\n", hpos+1, libcdsb_vtype_name(x->type)); + + if (d.n) { + d.n = random_uint32()%d.n; + vset_foreach(x, &d, remove_callback); + } else if (!silent) { + printf("\e[%dG\e[32;1m\nFAILURE\e[m\n", hpos+1); + } + + if (!silent) put_separator(hpos); +} From d0a89044f5807dfa65f19c45dc86ed710b571b51 Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Fri, 10 Jun 2022 21:22:52 +0300 Subject: [PATCH 25/27] Fix set & map (extra) find --- src/map/extra.c | 4 ++-- src/set/extra.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/map/extra.c b/src/map/extra.c index 0c553e1..b657db3 100644 --- a/src/map/extra.c +++ b/src/map/extra.c @@ -59,7 +59,7 @@ int libcdsb_map_find(map_t* x, const void* k, vtype t, void* _, map_access_callb while (!mnode_is_empty(c)) { key = vnode_peek(&c->key, x->type); - cmp = vtype_compare(key, x->type, k, t); + cmp = vtype_compare(k, t, key, x->type); if (cmp == 0) { cmp = (callback) ? callback(key, x->type, vnode_peek(&c->value, c->type), c->type, _) : 0; @@ -72,7 +72,7 @@ int libcdsb_map_find(map_t* x, const void* k, vtype t, void* _, map_access_callb } return cmp; - } + } else c = (cmp < 0) ? c->left : c->right; } return -1; diff --git a/src/set/extra.c b/src/set/extra.c index d58056f..44bce68 100644 --- a/src/set/extra.c +++ b/src/set/extra.c @@ -51,7 +51,7 @@ int libcdsb_vset_find(vtype_set* x, const void* v, vtype t, void* _, vset_access while (!rbnode_is_empty(c)) { val = vnode_peek(&c->value, x->type); - cmp = vtype_compare(val, x->type, v, t); + cmp = vtype_compare(v, t, val, x->type); if (cmp == 0) { cmp = (callback) ? callback(val, x->type, _) : 0; @@ -63,7 +63,7 @@ int libcdsb_vset_find(vtype_set* x, const void* v, vtype t, void* _, vset_access } return cmp; - } + } else c = (cmp < 0) ? c->left : c->right; } return -1; From 62dff9b10305d6d85014b385e1fced46d7d2e749 Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Fri, 10 Jun 2022 21:23:01 +0300 Subject: [PATCH 26/27] Update list copy --- src/list/copy.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/list/copy.c b/src/list/copy.c index b790652..ba45032 100644 --- a/src/list/copy.c +++ b/src/list/copy.c @@ -112,7 +112,6 @@ void list_extend(list_t* x, const list_t* s) { size_t list_slice(list_t* x, list_t* s, ssize_t i, size_t n, _Bool cut) { - ldir_t dir; lnode_t* c; lnode_t* e; size_t r; From a44a6d701ee02f0cb9bab5b003b45e8e59e1589c Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Fri, 10 Jun 2022 21:42:24 +0300 Subject: [PATCH 27/27] Update string tests --- tests/src/string/main.c | 77 +++++++++++++++-------------------- tests/src/string/plug.h | 69 ++++--------------------------- tests/src/string/src/io.c | 48 ++++++++++++++++++++++ tests/src/string/src/plug.c | 20 +++++++++ tests/src/string/src/random.c | 51 +++++++++++++++++++++++ tests/src/string/trim.c | 33 --------------- 6 files changed, 160 insertions(+), 138 deletions(-) create mode 100644 tests/src/string/src/io.c create mode 100644 tests/src/string/src/plug.c create mode 100644 tests/src/string/src/random.c delete mode 100644 tests/src/string/trim.c diff --git a/tests/src/string/main.c b/tests/src/string/main.c index 141e0cc..522b3f8 100644 --- a/tests/src/string/main.c +++ b/tests/src/string/main.c @@ -3,53 +3,13 @@ #include "plug.h" -static void string_concat_random(vtype_string* x, unsigned int n) { - char* v; - - if (random_boolean()) { - v = random_utf8_cstring(n); - } else v = random_ascii_cstring(n); - - string_concat(x, v); - free(v); -} - -static void string_replace_random(vtype_string* x, unsigned int n) { - char* v; - - if (random_boolean()) { - v = random_utf8_cstring(n); - } else v = random_ascii_cstring(n); - - string_replace(x, x, v, -1); - - free(v); -} - -static void string_print_compare(const vtype_string* s0, const vtype_string* s1) { - int c = string_compare(s0, s1); - char* m; - if (c == 0) m = "=="; - else m = (c < 0) ? "<" : ">"; - - puts("\e[36mStrings comparsion:\e[m\n"); - printf("\e[33m\"%s\"\e[m \e[31m%s\e[m \e[33m\"%s\"\e[m\n", s0->buffer, m, s1->buffer); -} - -static void string_print_case_compare(const vtype_string* s0, const vtype_string* s1) { - int c = string_case_compare(s0, s1); - char* m; - if (c == 0) m = "=="; - else m = (c < 0) ? "<" : ">"; - - puts("\e[36mStrings case insensitive comparsion:\e[m\n"); - printf("\e[33m\"%s\"\e[m \e[31m%s\e[m \e[33m\"%s\"\e[m\n", s0->buffer, m, s1->buffer); -} int main(int argc, char** argv) { test_init(argc, argv); - vtype_string x, y; + str_t x, y; + int c = random_unicode_symbol(); + fputs("\e[s", stdout); x = string_random(30); string_print(&x, "(part 1)"); @@ -77,8 +37,8 @@ int main(int argc, char** argv) { string_to_lower(&x); string_to_upper(&y); - string_print_compare(&x, &y); - string_print_case_compare(&x, &y); + visual_compare(&x, &y); + visual_case_compare(&x, &y); string_reverse(&y); string_capitalize(&y); @@ -87,4 +47,31 @@ int main(int argc, char** argv) { string_free(&x); string_free(&y); + + psleep(900000); + + fputs("\e[u\e[J", stdout); + + x = string_random(12); + + string_align_center(&x, 30, 0); + string_info(&x); + string_print(&x, 0); + + string_trim_spaces(&x); + string_info(&x); + string_print(&x, "trimmed"); + + put_separator(0); + string_align_center(&x, 30, c); + string_info(&x); + string_print(&x, 0); + + string_trim(&x, c); + string_info(&x); + string_print(&x, "trimmed"); + + psleep(900000); + + string_free(&x); } diff --git a/tests/src/string/plug.h b/tests/src/string/plug.h index e0b2ad5..241dc93 100644 --- a/tests/src/string/plug.h +++ b/tests/src/string/plug.h @@ -9,65 +9,14 @@ #include "../../include/test.h" #include "../../include/time.h" -vtype_array* array_duplicate (const vtype_array* x) { return 0; } -vtype_list* list_duplicate (const vtype_list* x) { return 0; } -vtype_map* map_duplicate (const vtype_map* x) { return 0; } -vtype_set* vset_duplicate (const vtype_set* x) { return 0; } +extern char* random_ascii_cstring(size_t size); +extern char* random_utf8_cstring(size_t size); +extern void string_concat_random(str_t* x, unsigned int n); +extern void string_replace_random(str_t* x, unsigned int n); -void array_free (vtype_array* x) {} -void list_free (vtype_list* x) {} -void map_free (vtype_map* x) {} -void vset_free (vtype_set* x) {} +extern void string_info(str_t* x); +extern void string_print(const str_t* x, const char* prefix); +extern str_t string_random(unsigned int n); -int array_compare (const vtype_array* s0, const vtype_array* s1) { return random_int8(); } -int list_compare (const vtype_list* s0, const vtype_list* s1) { return random_int8(); } -int map_compare (const vtype_map* s0, const vtype_map* s1) { return random_int8(); } -int vset_compare (const vtype_set* s0, const vtype_set* s1) { return random_int8(); } - -static char* random_ascii_cstring(size_t size) { - char* v = malloc(size + 1); - char* p = v; - - while (size--) { - *(p++) = random_ascii_char(); - } - *p = 0; - - return v; -} - -static char* random_utf8_cstring(size_t size) { - char* v = malloc(size * 4 + 1); - char* p = v; - - while (size--) { - p = tochar_unicode(p, random_unicode_symbol()); - } - - *p = 0; - return v; -} - -static void string_info(vtype_string* x) { - print_container_info("String", "utf8 chars", 0, string_size(x), string_nmemb(x)); - put_separator(); -} - -static void string_print(const vtype_string* x, const char* prefix) { - if (prefix) { - printf("\e[36m%s %s content:\e[m\n", "String", prefix); - } else printf("\e[36m%s content:\e[m\n", "String"); - - printf("\e[33m\"%s\"\e[m\n", x->buffer); - put_separator(); -} - -static vtype_string string_random(unsigned int n) { - vtype_string x; - - if (random_boolean()) { - x.buffer = random_utf8_cstring(n); - } else x.buffer = random_ascii_cstring(n); - - return x; -} +extern void visual_compare(const str_t* s0, const str_t* s1); +extern void visual_case_compare(const str_t* s0, const str_t* s1); diff --git a/tests/src/string/src/io.c b/tests/src/string/src/io.c new file mode 100644 index 0000000..1da8654 --- /dev/null +++ b/tests/src/string/src/io.c @@ -0,0 +1,48 @@ +/* This software is licensed by the MIT License, see LICENSE file */ +/* Copyright © 2022 Gregory Lirent */ + +#include "../plug.h" + +void string_info(str_t* x) { + print_container_info("String", "utf8 chars", 0, string_size(x), string_nmemb(x), 0); + put_separator(0); +} + +void string_print(const str_t* x, const char* prefix) { + if (prefix) { + printf("\e[36m%s %s content:\e[m\n", "String", prefix); + } else printf("\e[36m%s content:\e[m\n", "String"); + + printf("\e[33m\"%s\"\e[m\n", x->buffer); + put_separator(0); +} + +str_t string_random(unsigned int n) { + str_t x; + + if (random_boolean()) { + x.buffer = random_utf8_cstring(n); + } else x.buffer = random_ascii_cstring(n); + + return x; +} + +void visual_compare(const str_t* s0, const str_t* s1) { + int c = string_compare(s0, s1); + char* m; + if (c == 0) m = "=="; + else m = (c < 0) ? "<" : ">"; + + puts("\e[36mStrings comparsion:\e[m\n"); + printf("\e[33m\"%s\"\e[m \e[31m%s\e[m \e[33m\"%s\"\e[m\n", s0->buffer, m, s1->buffer); +} + +void visual_case_compare(const str_t* s0, const str_t* s1) { + int c = string_case_compare(s0, s1); + char* m; + if (c == 0) m = "=="; + else m = (c < 0) ? "<" : ">"; + + puts("\e[36mStrings case insensitive comparsion:\e[m\n"); + printf("\e[33m\"%s\"\e[m \e[31m%s\e[m \e[33m\"%s\"\e[m\n", s0->buffer, m, s1->buffer); +} diff --git a/tests/src/string/src/plug.c b/tests/src/string/src/plug.c new file mode 100644 index 0000000..6da62c4 --- /dev/null +++ b/tests/src/string/src/plug.c @@ -0,0 +1,20 @@ +/* This software is licensed by the MIT License, see LICENSE file */ +/* Copyright © 2022 Gregory Lirent */ + +#include "../../../../src/__internal/include.h" +#include "../../../include/random.h" + +vtype_array* array_duplicate (const vtype_array* x) { return 0; } +vtype_list* list_duplicate (const vtype_list* x) { return 0; } +vtype_map* map_duplicate (const vtype_map* x) { return 0; } +vtype_set* vset_duplicate (const vtype_set* x) { return 0; } + +void array_free (vtype_array* x) {} +void list_free (vtype_list* x) {} +void map_free (vtype_map* x) {} +void vset_free (vtype_set* x) {} + +int array_compare (const vtype_array* s0, const vtype_array* s1) { return random_int8(); } +int list_compare (const vtype_list* s0, const vtype_list* s1) { return random_int8(); } +int map_compare (const vtype_map* s0, const vtype_map* s1) { return random_int8(); } +int vset_compare (const vtype_set* s0, const vtype_set* s1) { return random_int8(); } diff --git a/tests/src/string/src/random.c b/tests/src/string/src/random.c new file mode 100644 index 0000000..36a587c --- /dev/null +++ b/tests/src/string/src/random.c @@ -0,0 +1,51 @@ +/* This software is licensed by the MIT License, see LICENSE file */ +/* Copyright © 2022 Gregory Lirent */ + +#include "../plug.h" + +char* random_ascii_cstring(size_t size) { + char* v = malloc(size + 1); + char* p = v; + + while (size--) { + *(p++) = random_ascii_char(); + } + *p = 0; + + return v; +} + +char* random_utf8_cstring(size_t size) { + char* v = malloc(size * 4 + 1); + char* p = v; + + while (size--) { + p = tochar_unicode(p, random_unicode_symbol()); + } + + *p = 0; + return v; +} + +void string_concat_random(str_t* x, unsigned int n) { + char* v; + + if (random_boolean()) { + v = random_utf8_cstring(n); + } else v = random_ascii_cstring(n); + + string_concat(x, v); + free(v); +} + +void string_replace_random(str_t* x, unsigned int n) { + char* v; + + if (random_boolean()) { + v = random_utf8_cstring(n); + } else v = random_ascii_cstring(n); + + string_replace(x, x, v, -1); + + free(v); +} diff --git a/tests/src/string/trim.c b/tests/src/string/trim.c deleted file mode 100644 index c5329d8..0000000 --- a/tests/src/string/trim.c +++ /dev/null @@ -1,33 +0,0 @@ -/* This software is licensed by the MIT License, see LICENSE file */ -/* Copyright © 2022 Gregory Lirent */ - -#include "plug.h" - - -int main(int argc, char** argv) { - test_init(argc, argv); - vtype_string x; - int c = random_unicode_symbol(); - - x = string_random(12); - - string_align_center(&x, 30, 0); - string_info(&x); - string_print(&x, 0); - - string_trim_spaces(&x); - string_info(&x); - string_print(&x, "trimmed"); - - put_separator(); - string_align_center(&x, 30, c); - string_info(&x); - string_print(&x, 0); - - string_trim(&x, c); - string_info(&x); - string_print(&x, "trimmed"); - - - string_free(&x); -}