From 05bed02ad93225a04b407f7a0d78ebcb73e885e2 Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Wed, 8 Jun 2022 00:11:42 +0300 Subject: [PATCH 1/6] Update implementation of set (recursion => stack) --- src/set/base.c | 39 +++++++++--------- src/set/copy.c | 102 +++++++++++++++++++++++++++++++++++------------- src/set/extra.c | 19 +++------ 3 files changed, 98 insertions(+), 62 deletions(-) diff --git a/src/set/base.c b/src/set/base.c index 141801a..23b1dd9 100644 --- a/src/set/base.c +++ b/src/set/base.c @@ -5,9 +5,6 @@ #include "../__internal/rbtree.h" -/*#####################################################################################################################*/ - - void vset_init(vtype_set* x, vtype t) { x->root = rbnode_empty; x->type = t; @@ -46,16 +43,16 @@ void vset_free(vtype_set* x) { size_t vset_size(const vtype_set* x) { - stack_t s = { .prev = 0, .value = x->root }; + stack_t z = { .prev = 0, .value = x->root }; size_t n = 0; rbnode_t* c; - while ((c = stack_pop(&s))) { + while ((c = stack_pop(&z))) { ++n; if (!rbnode_is_empty(c->left)) - stack_push(&s, c->left); + stack_push(&z, c->left); if (!rbnode_is_empty(c->right)) - stack_push(&s, c->right); + stack_push(&z, c->right); } return n; @@ -63,25 +60,23 @@ size_t vset_size(const vtype_set* x) { int vset_compare(const vtype_set* s0, const vtype_set* s1) { - stack_t s = { .prev = 0, .value = 0 }; + stack_t z = { .prev = 0, .value = 0 }; vtype t = s0->type; int c = 0; if (s0 == s1 || s0->root == s1->root) return 0; if (s0->type != s1->type) return s0->type - s1->type; - stack_push(&s, s0->root); - stack_push(&s, s1->root); + stack_push(&z, s1->root); + stack_push(&z, s0->root); - for (rbnode_t *c0, *c1;;) { - c0 = stack_pop(&s); - c1 = stack_pop(&s); - - if (is_null(c0)) return 0; + for (rbnode_t *c0, *c1;!is_null(z.value);) { + c0 = stack_pop(&z); + c1 = stack_pop(&z); if (rbnode_is_empty(c0) || rbnode_is_empty(c1)) { if (c0 != c1) { - stack_flush(&s); + stack_flush(&z); return rbnode_is_empty(c0) ? -1 : 1; } } else if ((c = vnode_compare(c0->value, t, c1->value, t))) { @@ -93,12 +88,14 @@ int vset_compare(const vtype_set* s0, const vtype_set* s1) { if (!c) c = vnode_compare(c0->left->value, t, c1->value, t); } - if (c) { stack_flush(&s); return c; } + if (c) { stack_flush(&z); return c; } } else { - stack_push(&s, c0->left); - stack_push(&s, c1->left); - stack_push(&s, c0->right); - stack_push(&s, c1->right); + stack_push(&z, c1->right); + stack_push(&z, c0->right); + stack_push(&z, c1->left); + stack_push(&z, c0->left); } } + + return 0; } diff --git a/src/set/copy.c b/src/set/copy.c index ac75e6a..07e5ef3 100644 --- a/src/set/copy.c +++ b/src/set/copy.c @@ -4,56 +4,102 @@ #include "../../include/set.h" #include "../__internal/rbtree.h" -/*#####################################################################################################################*/ - -static void copy_child(rbnode_t* x, vtype t, const rbnode_t* l, const rbnode_t* r) { - - if (!rbnode_is_empty(l)) { - x->left = rbnode_create(vnode_duplicate(&l->value, t), x, l->colored); - copy_child(x->left, t, l->left, l->right); - } else x->left = rbnode_empty; - - if (!rbnode_is_empty(r)) { - x->left = rbnode_create(vnode_duplicate(&r->value, t), x, r->colored); - copy_child(x->right, t, r->right, r->right); - } else x->right = rbnode_empty; -} - -/*#####################################################################################################################*/ - vtype_set vset_copy(const vtype_set* s) { - set_t x = { .type = s->type }; + set_t x = { .type = s->type }; + stack_t z = { .prev = 0, .value = s->root }; + vtype t = s->type; if (!rbnode_is_empty(s->root)) { - x.root = rbnode_create(vnode_duplicate(&s->root->value, s->type), rbnode_empty, 0); + x.root = rbnode_create(vnode_duplicate(&s->root->value, t), rbnode_empty, 0); + stack_push(&z, x.root); + + do { + rbnode_t *p0, *p1; + + p0 = stack_pop(&z); + p1 = stack_pop(&z); + + if (!rbnode_is_empty(p1->left)) { + p0->left = rbnode_create(vnode_duplicate(&p1->left->value, t), p0, p1->left->colored); + stack_push(&z, p1->left); + stack_push(&z, p0->left); + } + + if (!rbnode_is_empty(p1->right)) { + p0->right = rbnode_create(vnode_duplicate(&p1->right->value, t), p0, p1->right->colored); + stack_push(&z, p1->right); + stack_push(&z, p0->right); + } + + } while (!is_null(z.value)); - copy_child(x.root, s->type, s->root->left, s->root->right); } else x.root = rbnode_empty; return x; } -vtype_set* vset_duplicate(const vtype_set* s) { - set_t* x = malloc(sizeof(*x)); - x->type = s->type; +vtype_set* vset_duplicate(const vtype_set* s) { + + set_t* x = malloc(sizeof(*x)); + stack_t z = { .prev = 0, .value = s->root }; + vtype t = x->type = s->type; if (!rbnode_is_empty(s->root)) { - x->root = rbnode_create(vnode_duplicate(&s->root->value, s->type), rbnode_empty, 0); + x->root = rbnode_create(vnode_duplicate(&s->root->value, t), rbnode_empty, 0); + stack_push(&z, x->root); + + do { + rbnode_t *p0 = stack_pop(&z); + rbnode_t *p1 = stack_pop(&z); + + if (!rbnode_is_empty(p1->left)) { + p0->left = rbnode_create(vnode_duplicate(&p1->left->value, t), p0, p1->left->colored); + stack_push(&z, p1->left); + stack_push(&z, p0->left); + } + + if (!rbnode_is_empty(p1->right)) { + p0->right = rbnode_create(vnode_duplicate(&p1->right->value, t), p0, p1->right->colored); + stack_push(&z, p1->right); + stack_push(&z, p0->right); + } + + } while (!is_null(z.value)); - copy_child(x->root, s->type, s->root->left, s->root->right); } else x->root = rbnode_empty; return x; } + void vset_copy_init(vtype_set* x, const vtype_set* s) { - x->type = s->type; + + stack_t z = { .prev = 0, .value = s->root }; + vtype t = x->type = s->type; if (!rbnode_is_empty(s->root)) { - x->root = rbnode_create(vnode_duplicate(&s->root->value, s->type), rbnode_empty, 0); + x->root = rbnode_create(vnode_duplicate(&s->root->value, t), rbnode_empty, 0); + stack_push(&z, x->root); + + do { + rbnode_t *p0 = stack_pop(&z); + rbnode_t *p1 = stack_pop(&z); + + if (!rbnode_is_empty(p1->left)) { + p0->left = rbnode_create(vnode_duplicate(&p1->left->value, t), p0, p1->left->colored); + stack_push(&z, p1->left); + stack_push(&z, p0->left); + } + + if (!rbnode_is_empty(p1->right)) { + p0->right = rbnode_create(vnode_duplicate(&p1->right->value, t), p0, p1->right->colored); + stack_push(&z, p1->right); + stack_push(&z, p0->right); + } + + } while (!is_null(z.value)); - copy_child(x->root, s->type, s->root->left, s->root->right); } else x->root = rbnode_empty; } diff --git a/src/set/extra.c b/src/set/extra.c index 9acc2d1..da5bb36 100644 --- a/src/set/extra.c +++ b/src/set/extra.c @@ -4,9 +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; @@ -73,25 +70,21 @@ _Bool libcdsb_vset_insert(set_t* x, const void* v, vtype t) { } -/*#####################################################################################################################*/ - - int libcdsb_vset_foreach(const set_t* x, void* data, int (*callback)(const void* value, vtype type, void* data)) { - stack_t s = { .prev = 0, .value = x->root }; + stack_t z = { .prev = 0, .value = x->root }; int r = 0; rbnode_t* c; if (rbnode_is_empty(x->root)) return 0; - while ((c = stack_pop(&s))) { + while ((c = stack_pop(&z))) { if ((r = callback(vnode_peek(&c->value, x->type), x->type, data))) { - stack_flush(&s); + stack_flush(&z); break; } - if (!rbnode_is_empty(c->left)) - stack_push(&s, c->left); - if (!rbnode_is_empty(c->right)) - stack_push(&s, c->right); + + if (!rbnode_is_empty(c->right)) stack_push(&z, c->right); + if (!rbnode_is_empty(c->left)) stack_push(&z, c->left); } return r; From 624efada63d4236f527c0c4631830fbb7551d43a Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Wed, 8 Jun 2022 09:56:14 +0300 Subject: [PATCH 2/6] Add map implementation --- include/__attributes.h | 3 + include/extra/map.h | 46 +++++ include/map.h | 417 +++++++++++++++++++++++++++++++++++++++++ src/map/base.c | 108 +++++++++++ src/map/copy.c | 120 ++++++++++++ src/map/extra.c | 121 ++++++++++++ src/map/generics.c | 404 +++++++++++++++++++++++++++++++++++++++ src/map/include.h | 40 ++++ 8 files changed, 1259 insertions(+) create mode 100644 include/extra/map.h create mode 100644 include/map.h create mode 100644 src/map/base.c create mode 100644 src/map/copy.c create mode 100644 src/map/extra.c create mode 100644 src/map/generics.c create mode 100644 src/map/include.h diff --git a/include/__attributes.h b/include/__attributes.h index 1039aba..9e29a9a 100644 --- a/include/__attributes.h +++ b/include/__attributes.h @@ -9,7 +9,10 @@ #define LIBCDSB_nn2__ __attribute__ ((nonnull (2))) #define LIBCDSB_nn12__ __attribute__ ((nonnull (1,2))) #define LIBCDSB_nn123__ __attribute__ ((nonnull (1,2,3))) +#define LIBCDSB_nn124__ __attribute__ ((nonnull (1,2,4))) #define LIBCDSB_nn13__ __attribute__ ((nonnull (1,3))) +#define LIBCDSB_nn23__ __attribute__ ((nonnull (2,3))) +#define LIBCDSB_nn23__ __attribute__ ((nonnull (2,3))) #define LIBCDSB_pure__ LIBCDSB_nt__ __attribute__ ((pure)) #define LIBCDSB_wur__ __attribute__ ((warn_unused_result)) diff --git a/include/extra/map.h b/include/extra/map.h new file mode 100644 index 0000000..9815e8a --- /dev/null +++ b/include/extra/map.h @@ -0,0 +1,46 @@ +/* This software is licensed by the MIT License, see LICENSE file */ +/* Copyright © 2022 Gregory Lirent */ + +#include "../map.h" + +#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_vset_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__; + +#endif /* LIBCDSB_EXTRA_MAP_H */ + + +#if defined(LIBCDSB_SET_H) && !defined(LIBCDSB_EXTRA_MAP_H_EXT) +#define LIBCDSB_EXTRA_MAP_H_EXT + +#define map_copy_keys(s) _Generic((s),\ + const vtype_map*: vset_copy, vtype_map*: vset_copy,\ + const void*: vset_copy, void*: vset_copy\ +)((set_t*)(s)) + +#define map_duplicate_keys(s) _Generic((s),\ + const vtype_map*: vset_duplicate, vtype_map*: vset_duplicate,\ + const void*: vset_duplicate, void*: vset_duplicate\ +)((set_t*)(s)) + +#define map_copy_init_keys(x, s) _Generic((x),\ + vtype_set*: _Generic((s),\ + const vtype_map*: vset_copy_init, vtype_map*: vset_copy_init,\ + const void*: vset_copy_init, void*: vset_copy_init\ + ),\ + void*: _Generic((s),\ + const vtype_map*: vset_copy_init, vtype_map*: vset_copy_init,\ + const void*: vset_copy_init, void*: vset_copy_init\ + )\ +)((x), (set_t*)(s)) + +#endif /* LIBCDSB_EXTRA_MAP_H_EXT */ diff --git a/include/map.h b/include/map.h new file mode 100644 index 0000000..c86e441 --- /dev/null +++ b/include/map.h @@ -0,0 +1,417 @@ +/* This software is licensed by the MIT License, see LICENSE file */ +/* Copyright © 2022 Gregory Lirent */ + +#include "__generics.h" +#include "vtype.h" + +#ifndef LIBCDSB_MAP_H +#define LIBCDSB_MAP_H + +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) +#define map_get(x, s, key) _LIBCDSB_Generic (libcdsb_map, find, key)(x, s, key, 0) +#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 _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_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_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_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_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_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_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_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_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_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/src/map/base.c b/src/map/base.c new file mode 100644 index 0000000..7251cfe --- /dev/null +++ b/src/map/base.c @@ -0,0 +1,108 @@ +/* This software is licensed by the MIT License, see LICENSE file */ +/* Copyright © 2022 Gregory Lirent */ + +#include "include.h" + +void map_init(map_t* x, vtype t) { + x->root = mnode_empty; + x->type = t; +} + + +void map_free(map_t* x) { + mnode_t* t; + mnode_t* c; + + c = x->root; + + while (!mnode_is_empty(x->root)) { + if (!mnode_is_empty(c->left)) { + c = c->left; + } else if (!mnode_is_empty(c->right)) { + c = c->right; + } else if (!mnode_is_root(c)) { + vnode_free(&c->key, x->type); + vnode_free(&c->value, c->type); + + t = c; + c = c->parent; + + if (t == c->left) c->left = mnode_empty; + else c->right = mnode_empty; + + free(t); + } else { + vnode_free(&c->key, x->type); + vnode_free(&c->value, c->type); + x->root = mnode_empty; + } + } + + x->type = 0; +} + + +size_t map_size(const map_t* x) { + stack_t z = { .prev = 0, .value = x->root }; + size_t n = 0; + rbnode_t* c; + + if (!mnode_is_empty(x->root)) { + while ((c = stack_pop(&z))) { + ++n; + if (!rbnode_is_empty(c->left)) + stack_push(&z, c->left); + if (!rbnode_is_empty(c->right)) + stack_push(&z, c->right); + } + } + + return n; +} + + +int map_compare(const map_t* s0, const map_t* s1) { + + stack_t z = { .prev = 0, .value = 0 }; + vtype t = s0->type; + int c = 0; + + if (s0 == s1 || s0->root == s1->root) return 0; + if (s0->type != s1->type) return s0->type - s1->type; + + stack_push(&z, s1->root); + stack_push(&z, s0->root); + + for (mnode_t *c0, *c1;!is_null(z.value);) { + c0 = stack_pop(&z); + c1 = stack_pop(&z); + + if (mnode_is_empty(c0) || mnode_is_empty(c1)) { + if (c0 != c1) { + stack_flush(&z); + return mnode_is_empty(c0) ? -1 : 1; + } + } else if ((c = vnode_compare(c0->key, t, c1->key, t)) || (c = vnode_compare(c0->value, c0->type, c1->value, c1->type))) { + if (c0->left == c1->right) { + c = vnode_compare(c1->key, t, c0->right->key, t ); + if (!c) c = vnode_compare(c1->value, c1->type, c0->right->value, c0->type); + if (!c) c = vnode_compare(c1->left->key, t, c0->key, t ); + if (!c) c = vnode_compare(c1->left->value, c1->type, c0->value, c0->type); + } else if (c0->right == c1->left) { + c = vnode_compare(c0->key, t, c1->right->key, t ); + if (!c) c = vnode_compare(c0->value, c0->type, c1->right->value, c1->type); + if (!c) c = vnode_compare(c0->left->key, t, c1->key, t ); + if (!c) c = vnode_compare(c0->left->value, c0->type, c1->value, c1->type); + } + + if (c) { stack_flush(&z); return c; } + } else { + stack_push(&z, c1->right); + stack_push(&z, c0->right); + stack_push(&z, c1->left); + stack_push(&z, c0->left); + } + } + + return 0; +} diff --git a/src/map/copy.c b/src/map/copy.c new file mode 100644 index 0000000..ba5b31f --- /dev/null +++ b/src/map/copy.c @@ -0,0 +1,120 @@ +/* This software is licensed by the MIT License, see LICENSE file */ +/* Copyright © 2022 Gregory Lirent */ + +#include "include.h" + +map_t map_copy(const map_t* s) { + + map_t x = { .type = s->type }; + stack_t z = { .prev = 0, .value = s->root }; + vtype t = s->type; + + if (!mnode_is_empty(s->root)) { + x.root = mnode_create(vnode_duplicate(&s->root->value, t), rbnode_empty, 0); + stack_push(&z, x.root); + + do { + mnode_t *p0 = stack_pop(&z); + mnode_t *p1 = stack_pop(&z); + + if (!mnode_is_empty(p1->left)) { + p0->left = mnode_create(vnode_duplicate(&p1->left->key, t), p0, p1->left->colored); + p0->left->type = p1->left->type; + p0->left->value = vnode_duplicate(&p1->left->value, p1->left->type); + + stack_push(&z, p1->left); + stack_push(&z, p0->left); + } + + if (!mnode_is_empty(p1->right)) { + p0->right = mnode_create(vnode_duplicate(&p1->right->key, t), p0, p1->right->colored); + p0->right->type = p1->right->type; + p0->right->value = vnode_duplicate(&p1->right->value, p1->right->type); + + stack_push(&z, p1->right); + stack_push(&z, p0->right); + } + + } while (!is_null(z.value)); + + } else x.root = mnode_empty; + + return x; +} + + +map_t* map_duplicate(const map_t* s) { + + map_t* x = malloc(sizeof(*x)); + stack_t z = { .prev = 0, .value = s->root }; + vtype t = x->type = s->type; + + if (!mnode_is_empty(s->root)) { + x->root = mnode_create(vnode_duplicate(&s->root->value, t), rbnode_empty, 0); + stack_push(&z, x->root); + + do { + mnode_t *p0 = stack_pop(&z); + mnode_t *p1 = stack_pop(&z); + + if (!mnode_is_empty(p1->left)) { + p0->left = mnode_create(vnode_duplicate(&p1->left->key, t), p0, p1->left->colored); + p0->left->type = p1->left->type; + p0->left->value = vnode_duplicate(&p1->left->value, p1->left->type); + + stack_push(&z, p1->left); + stack_push(&z, p0->left); + } + + if (!mnode_is_empty(p1->right)) { + p0->right = mnode_create(vnode_duplicate(&p1->right->key, t), p0, p1->right->colored); + p0->right->type = p1->right->type; + p0->right->value = vnode_duplicate(&p1->right->value, p1->right->type); + + stack_push(&z, p1->right); + stack_push(&z, p0->right); + } + + } while (!is_null(z.value)); + + } else x->root = mnode_empty; + + return x; +} + + +void map_copy_init(map_t* x, const map_t* s) { + + stack_t z = { .prev = 0, .value = s->root }; + vtype t = x->type = s->type; + + if (!mnode_is_empty(s->root)) { + x->root = mnode_create(vnode_duplicate(&s->root->value, t), rbnode_empty, 0); + stack_push(&z, x->root); + + do { + mnode_t *p0 = stack_pop(&z); + mnode_t *p1 = stack_pop(&z); + + if (!mnode_is_empty(p1->left)) { + p0->left = mnode_create(vnode_duplicate(&p1->left->key, t), p0, p1->left->colored); + p0->left->type = p1->left->type; + p0->left->value = vnode_duplicate(&p1->left->value, p1->left->type); + + stack_push(&z, p1->left); + stack_push(&z, p0->left); + } + + if (!mnode_is_empty(p1->right)) { + p0->right = mnode_create(vnode_duplicate(&p1->right->key, t), p0, p1->right->colored); + p0->right->type = p1->right->type; + p0->right->value = vnode_duplicate(&p1->right->value, p1->right->type); + + stack_push(&z, p1->right); + stack_push(&z, p0->right); + } + + } while (!is_null(z.value)); + + } else x->root = mnode_empty; +} diff --git a/src/map/extra.c b/src/map/extra.c new file mode 100644 index 0000000..1ea08c6 --- /dev/null +++ b/src/map/extra.c @@ -0,0 +1,121 @@ +/* This software is licensed by the MIT License, see LICENSE file */ +/* Copyright © 2022 Gregory Lirent */ + +#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->value, 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 rbnode_empty; +} + + +_Bool libcdsb_vset_update(map_t* x, const void* k, vtype kt, const void* v, vtype vt) { + int cmp; + mnode_t* n; + mnode_t* p; + vnode_t kn; + + n = x->root; + kn = vnode_tcreate(x->type, k, kt); + kt = x->type; + k = vnode_peek(&kn, kt); + + if (!mnode_is_empty(n)) { + do { + p = n; + cmp = vtype_compare(k, kt, vnode_peek(&n->key, kt), kt); + + if (cmp == 0) { + vnode_free(&n->key, kt); + vnode_free(&n->value, n->type); + + n->key = kn; + n->value = vnode_create(v, vt); + n->type = vt; + + return true; + } + + n = (cmp < 0) ? n->left : n->right; + } while (!mnode_is_empty(n)); + + n = mnode_create(kn, p, 1); + + if (cmp < 0) p->left = n; + else p->right = n; + + if (!mnode_is_root(p)) + mnode_fixup(&x->root, n); + + } else n = x->root = mnode_create(kn, mnode_empty, 0); + + n->value = vnode_create(v, vt); + n->type = vt; + + return false; +} + + +int libcdsb_map_foreach(map_t* x, void* dt, map_foreach_callback callback, _Bool flush) { + stack_t z = { .prev = 0, .value = x->root }; + int r = 0; + mnode_t* c; + + if (mnode_is_empty(x->root)) return 0; + + while ((c = stack_pop(&z))) { + if ((r = callback(vnode_peek(&c->key, x->type), x->type, vnode_peek(&c->value, c->type), c->type, dt))) + break; + + + if (!mnode_is_empty(c->right)) stack_push(&z, c->right); + if (!mnode_is_empty(c->left)) stack_push(&z, c->left); + + if (flush) { + vnode_free(&c->key, x->type); + vnode_free(&c->value, c->type); + free(c); + } + } + + if (flush) { + while (c) { + if (!mnode_is_empty(c->right)) stack_push(&z, c->right); + if (!mnode_is_empty(c->left)) stack_push(&z, c->left); + + vnode_free(&c->key, x->type); + vnode_free(&c->value, c->type); + free(c); + + c = stack_pop(&z); + } + + memset(x, 0, sizeof(*x)); + } else stack_flush(&z); + + return r; +} diff --git a/src/map/generics.c b/src/map/generics.c new file mode 100644 index 0000000..837c1b2 --- /dev/null +++ b/src/map/generics.c @@ -0,0 +1,404 @@ +/* This software is licensed by the MIT License, see LICENSE file */ +/* Copyright © 2022 Gregory Lirent */ + +#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); } + +_Bool libcdsb_map_update_pointer_pointer(map_t* x, const void* k, const void* v) { return libcdsb_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +_Bool libcdsb_map_update_pointer_boolean(map_t* x, const void* k, _Bool v) { return libcdsb_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +_Bool libcdsb_map_update_cstring_boolean(map_t* x, const char* k, _Bool v) { return libcdsb_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_update(x, &k, vtypeof(&k), v, vtypeof( v)); } +_Bool libcdsb_map_update_boolean_boolean(map_t* x, const _Bool k, _Bool v) { return libcdsb_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_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_vset_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); } diff --git a/src/map/include.h b/src/map/include.h new file mode 100644 index 0000000..29db5c4 --- /dev/null +++ b/src/map/include.h @@ -0,0 +1,40 @@ +/* This software is licensed by the MIT License, see LICENSE file */ +/* Copyright © 2022 Gregory Lirent */ + +#include "../../include/extra/map.h" +#include "../__internal/assert.h" +#include "../__internal/rbtree.h" + +#ifndef LIBCDSB_SRC_MAP_INCLUDE_H +#define LIBCDSB_SRC_MAP_INCLUDE_H + +typedef struct libcdsb_map_node { + struct libcdsb_map_node* left; + struct libcdsb_map_node* right; + struct libcdsb_map_node* parent; + + vnode_t key; + short colored; + short type; + vnode_t value; +} mnode_t; + +static_assert(offsetof(struct libcdsb_rbtree_node, left) == offsetof(struct libcdsb_map_node, left), "Implementation assert"); +static_assert(offsetof(struct libcdsb_rbtree_node, right) == offsetof(struct libcdsb_map_node, right), "Implementation assert"); +static_assert(offsetof(struct libcdsb_rbtree_node, parent) == offsetof(struct libcdsb_map_node, parent), "Implementation assert"); +static_assert(offsetof(struct libcdsb_rbtree_node, colored) == offsetof(struct libcdsb_map_node, colored), "Implementation assert"); +static_assert(offsetof(struct libcdsb_rbtree_node, value) == offsetof(struct libcdsb_map_node, key), "Implementation assert"); + +static_assert(offsetof(struct libcdsb_set, root) == offsetof(struct libcdsb_map, root), "Implementation assert"); +static_assert(offsetof(struct libcdsb_set, type) == offsetof(struct libcdsb_map, type), "Implementation assert"); + + +#define mnode_empty ((mnode_t*)LIBCDSB_RBTREE_NODE_EMPTY) +#define mnode_create(k, p, c) ((mnode_t*)libcdsb_rbtree_node_create(k, (rbnode_t*)p, c, sizeof(mnode_t))) +#define mnode_fixup(r, n) libcdsb_rbtree_node_fixup((rbnode_t**)(r), (rbnode_t*)(n)) +#define mnode_delete(r, n) (mnode_t*)libcdsb_rbtree_node_delete((rbnode_t**)(r), (rbnode_t*)(n)) + +#define mnode_is_empty(n) ((n) == mnode_empty) +#define mnode_is_root(n) mnode_is_empty((n)->parent) + +#endif /* LIBCDSB_SRC_MAP_INCLUDE_H */ From 472639a6816c434e77683ea1858e10c53eee7615 Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Wed, 8 Jun 2022 09:57:41 +0300 Subject: [PATCH 3/6] Update array (extra) foreach implementation --- include/extra/array.h | 7 +++++-- src/array/extra.c | 11 ++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/include/extra/array.h b/include/extra/array.h index f720a78..99fe5c2 100644 --- a/include/extra/array.h +++ b/include/extra/array.h @@ -6,17 +6,20 @@ #ifndef LIBCDSB_EXTRA_ARRAY_H #define LIBCDSB_EXTRA_ARRAY_H +typedef int (*array_foreach_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_foreach libcdsb_array_foreach +#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 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(const vtype_array* x, void* data, int (*callback)(void* value, ssize_t index, vtype type, void* data)) LIBCDSB_nt__ LIBCDSB_nn13__; +extern int libcdsb_array_foreach(vtype_array* x, void* data, array_foreach_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 4486800..b2e6240 100644 --- a/src/array/extra.c +++ b/src/array/extra.c @@ -76,7 +76,7 @@ ssize_t libcdsb_array_get(val_t* x, arr_t* s, ssize_t i, _Bool cut) { /*#####################################################################################################################*/ -int libcdsb_array_foreach(const vtype_array* x, void* data, int (*callback)(void* value, ssize_t index, vtype type, void* data)) { +int libcdsb_array_foreach(vtype_array* x, void* data, array_foreach_callback callback, _Bool flush) { void* p; void* e; @@ -86,14 +86,19 @@ int libcdsb_array_foreach(const vtype_array* x, void* data, int (*callback)(void p = x->mem; e = x->mem + x->size*vtype_size(x->type); n = 0; + r = 0; while (p < e) { if ((r = callback(p, n, x->type, data))) - return r; + break; p += vtype_size(x->type); ++n; } - return 0; + if (flush) { + free(x->mem); + memset(x, 0, sizeof(*x)); + } + return r; } From 659c329880f0512aed7c7c5b006b059bfbfe063e Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Wed, 8 Jun 2022 09:57:57 +0300 Subject: [PATCH 4/6] Update list (extra) foreach implementation --- include/extra/list.h | 7 +++++-- src/list/extra.c | 34 +++++++++++++++++++++++++++------- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/include/extra/list.h b/include/extra/list.h index a227b0e..e1759b1 100644 --- a/include/extra/list.h +++ b/include/extra/list.h @@ -6,11 +6,14 @@ #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_foreach libcdsb_list_foreach +#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__; @@ -19,6 +22,6 @@ extern size_t libcdsb_list_count(const vtype_list* s, const void* value, vtype 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(const vtype_list* x, void* data, int (*callback)(void* value, ssize_t index, vtype type, void* data)) LIBCDSB_nt__ LIBCDSB_nn13__; +extern int libcdsb_list_foreach(vtype_list* x, void* data, list_foreach_callback, _Bool flush) LIBCDSB_nt__ LIBCDSB_nn13__; #endif /* LIBCDSB_EXTRA_LIST_H */ diff --git a/src/list/extra.c b/src/list/extra.c index 9e8405c..b51ee54 100644 --- a/src/list/extra.c +++ b/src/list/extra.c @@ -163,20 +163,40 @@ _Bool libcdsb_list_update(list_t* x, ssize_t i, const void* v, vtype t, int ins) /*#####################################################################################################################*/ -int libcdsb_list_foreach(const vtype_list* x, void* data, int (*callback)(void* value, ssize_t index, vtype type, void* data)) { +int libcdsb_list_foreach(vtype_list* x, void* data, list_foreach_callback callback, _Bool flush) { + lnode_t* n; lnode_t* c; - size_t n; + size_t i; int r; c = x->first; - n = 0; + i = 0; while (!is_null(c)) { - if ((r = callback(vnode_peek(&c->node, c->type), n, c->type, data)) != 0) - return r; - c = c->next; - ++n; + if ((r = callback(vnode_peek(&c->node, c->type), i, c->type, data)) != 0) + break; + + n = c->next; + + if (flush) { + vnode_free(&c->node, c->type); + free(c); + } + + c = n; + ++i; + } + + if (flush) { + while(!is_null(c)) { + n = c->next; + vnode_free(&c->node, c->type); + free(c); + c = n; + } + + memset(x, 0, sizeof(*x)); } return 0; From 2f0a3a3c8e897468e77bd409fd8918ed85d070be Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Wed, 8 Jun 2022 09:58:16 +0300 Subject: [PATCH 5/6] Update set (extra) foreach implementation --- include/extra/set.h | 11 +++++++---- src/set/extra.c | 26 ++++++++++++++++++++++---- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/include/extra/set.h b/include/extra/set.h index 7f37db5..8849e09 100644 --- a/include/extra/set.h +++ b/include/extra/set.h @@ -6,11 +6,14 @@ #ifndef LIBCDSB_EXTRA_SET_H #define LIBCDSB_EXTRA_SET_H -#define vset_foreach libcdsb_vset_foreach +typedef int (*vset_foreach_callback)(const void* value, vtype type, void* data); -extern _Bool libcdsb_vset_find (vtype_value* x, vtype_set* s, const void* value, vtype type, _Bool cut); -extern _Bool libcdsb_vset_insert(vtype_set* x, const void* value, vtype type); -extern int libcdsb_vset_foreach(const vtype_set* x, void* data, int (*callback)(const void* value, vtype type, void* data)) LIBCDSB_nt__ LIBCDSB_nn13__; +#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 int libcdsb_vset_foreach(vtype_set* x, void* data, vset_foreach_callback, _Bool flush) LIBCDSB_nt__ LIBCDSB_nn13__; #endif /* LIBCDSB_EXTRA_SET_H */ diff --git a/src/set/extra.c b/src/set/extra.c index da5bb36..6c841f6 100644 --- a/src/set/extra.c +++ b/src/set/extra.c @@ -70,7 +70,7 @@ _Bool libcdsb_vset_insert(set_t* x, const void* v, vtype t) { } -int libcdsb_vset_foreach(const set_t* x, void* data, int (*callback)(const void* value, vtype type, void* data)) { +int libcdsb_vset_foreach(set_t* x, void* data, vset_foreach_callback callback, _Bool flush) { stack_t z = { .prev = 0, .value = x->root }; int r = 0; rbnode_t* c; @@ -78,14 +78,32 @@ int libcdsb_vset_foreach(const set_t* x, void* data, int (*callback)(const void* if (rbnode_is_empty(x->root)) return 0; while ((c = stack_pop(&z))) { - if ((r = callback(vnode_peek(&c->value, x->type), x->type, data))) { - stack_flush(&z); + if ((r = callback(vnode_peek(&c->value, x->type), x->type, data))) break; - } + if (!rbnode_is_empty(c->right)) stack_push(&z, c->right); if (!rbnode_is_empty(c->left)) stack_push(&z, c->left); + + if (flush) { + vnode_free(&c->value, x->type); + free(c); + } } + if (flush) { + while (c) { + if (!rbnode_is_empty(c->right)) stack_push(&z, c->right); + if (!rbnode_is_empty(c->left)) stack_push(&z, c->left); + + vnode_free(&c->value, x->type); + free(c); + + c = stack_pop(&z); + } + + memset(x, 0, sizeof(*x)); + } else stack_flush(&z); + return r; } From a95f3f18ea19671ea22ec98d278abe4aead29639 Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Wed, 8 Jun 2022 09:58:49 +0300 Subject: [PATCH 6/6] Refacor set --- src/set/base.c | 22 ++++++++++++---------- src/set/copy.c | 12 +++++------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/set/base.c b/src/set/base.c index 23b1dd9..07752bb 100644 --- a/src/set/base.c +++ b/src/set/base.c @@ -5,13 +5,13 @@ #include "../__internal/rbtree.h" -void vset_init(vtype_set* x, vtype t) { +void vset_init(set_t* x, vtype t) { x->root = rbnode_empty; x->type = t; } -void vset_free(vtype_set* x) { +void vset_free(set_t* x) { rbnode_t* t; rbnode_t* c; @@ -42,24 +42,26 @@ void vset_free(vtype_set* x) { } -size_t vset_size(const vtype_set* x) { +size_t vset_size(const set_t* x) { stack_t z = { .prev = 0, .value = x->root }; size_t n = 0; rbnode_t* c; - while ((c = stack_pop(&z))) { - ++n; - if (!rbnode_is_empty(c->left)) - stack_push(&z, c->left); - if (!rbnode_is_empty(c->right)) - stack_push(&z, c->right); + if (!rbnode_is_empty(x->root)) { + while ((c = stack_pop(&z))) { + ++n; + if (!rbnode_is_empty(c->left)) + stack_push(&z, c->left); + if (!rbnode_is_empty(c->right)) + stack_push(&z, c->right); + } } return n; } -int vset_compare(const vtype_set* s0, const vtype_set* s1) { +int vset_compare(const set_t* s0, const set_t* s1) { stack_t z = { .prev = 0, .value = 0 }; vtype t = s0->type; int c = 0; diff --git a/src/set/copy.c b/src/set/copy.c index 07e5ef3..954d7d8 100644 --- a/src/set/copy.c +++ b/src/set/copy.c @@ -4,7 +4,7 @@ #include "../../include/set.h" #include "../__internal/rbtree.h" -vtype_set vset_copy(const vtype_set* s) { +set_t vset_copy(const set_t* s) { set_t x = { .type = s->type }; stack_t z = { .prev = 0, .value = s->root }; @@ -15,10 +15,8 @@ vtype_set vset_copy(const vtype_set* s) { stack_push(&z, x.root); do { - rbnode_t *p0, *p1; - - p0 = stack_pop(&z); - p1 = stack_pop(&z); + rbnode_t *p0 = stack_pop(&z); + rbnode_t *p1 = stack_pop(&z); if (!rbnode_is_empty(p1->left)) { p0->left = rbnode_create(vnode_duplicate(&p1->left->value, t), p0, p1->left->colored); @@ -40,7 +38,7 @@ vtype_set vset_copy(const vtype_set* s) { } -vtype_set* vset_duplicate(const vtype_set* s) { +set_t* vset_duplicate(const set_t* s) { set_t* x = malloc(sizeof(*x)); stack_t z = { .prev = 0, .value = s->root }; @@ -74,7 +72,7 @@ vtype_set* vset_duplicate(const vtype_set* s) { } -void vset_copy_init(vtype_set* x, const vtype_set* s) { +void vset_copy_init(set_t* x, const set_t* s) { stack_t z = { .prev = 0, .value = s->root }; vtype t = x->type = s->type;