Merge branch 'develop' of lirent/libcdsb into master

This commit is contained in:
Gregory Lirent 2022-08-24 13:28:12 +03:00 committed by Gogs
commit 71e1859383
116 changed files with 3074 additions and 5323 deletions

View File

@ -3,7 +3,7 @@
#include <assert.h>
#include <stdio.h>
#include "../include/extra/array.h"
#include "../include/array.h"
typedef vtype_array arr_t;

View File

@ -4,7 +4,7 @@
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include "../include/extra/dict.h"
#include "../include/dict.h"
typedef vtype_dict dict_t;
@ -40,20 +40,25 @@ int main(int argc, char** argv) {
dict_t dict;
vtype_float fl = 0.0;
int a;
vtype_float b;
dict_init(&dict);
for (size_t i = 0; i < 28; ++i) {
for (vtype_int32 i = 0; i < 28; ++i) {
if (i%2) {
dict_update(&dict, (vtype_float)fl, (vtype_int32)i);
dict_update(&dict, fl, i);
} else {
dict_update(&dict, (vtype_int32)i, (vtype_float)fl);
dict_update(&dict, i, fl);
}
fl += 0.05;
}
dict_get(&dict, 14, "Get value:", print_value);
dict_pop(&dict, 0.25, "Pop value:", print_value);
a = 13;
b = 0.25;
dict_get(&dict, a, "Get value:", print_value);
dict_pop(&dict, b, "Pop value:", print_value);
dict_foreach(&dict, "Foreach loop:", print_value);

View File

@ -3,7 +3,7 @@
#include <stdio.h>
#include <stdlib.h>
#include "../include/extra/list.h"
#include "../include/list.h"
typedef vtype_list list_t;
@ -33,11 +33,11 @@ int main(int argc, char** argv) {
list_init(&list);
for (size_t i = 0; i < 28; ++i) {
for (vtype_int32 i = 0; i < 28; ++i) {
if (i%2) {
list_push_back(&list, (vtype_int32)i);
list_push_back(&list, i);
} else {
list_push_back(&list, (vtype_float)fl);
list_push_back(&list, fl);
fl += 0.05;
}
}

View File

@ -4,7 +4,7 @@
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include "../include/extra/map.h"
#include "../include/map.h"
typedef vtype_map map_t;
@ -34,20 +34,24 @@ int main(int argc, char** argv) {
map_t map;
vtype_float fl = 0.0;
int a, b;
map_init(&map, VTYPE_INT32);
for (size_t i = 0; i < 28; ++i) {
for (vtype_int32 i = 0; i < 28; ++i) {
if (i%2) {
map_update(&map, i, (vtype_int32)i);
map_update(&map, i, i);
} else {
map_update(&map, i, (vtype_float)fl);
map_update(&map, i, fl);
fl += 0.05;
}
}
map_get(&map, 13, "Get value:", print_value);
map_pop(&map, 18, "Pop value:", print_value);
a = 13;
b = 18;
map_get(&map, a, "Get value:", print_value);
map_pop(&map, b, "Pop value:", print_value);
map_foreach(&map, "Foreach loop:", print_value);

View File

@ -3,7 +3,7 @@
#include <assert.h>
#include <stdio.h>
#include "../include/extra/set.h"
#include "../include/set.h"
typedef vtype_set vset_t;
@ -22,6 +22,7 @@ int print_value(const void* value, vtype type, void* data) {
int main(int argc, char** argv) {
vset_t set;
int a, b;
vset_init(&set, VTYPE_INT32);
@ -29,8 +30,11 @@ int main(int argc, char** argv) {
vset_push(&set, i);
}
vset_get(&set, 13, "Get value:", print_value);
vset_pop(&set, 18, "Pop value:", print_value);
a = 13;
b = 18;
vset_get(&set, a, "Get value:", print_value);
vset_pop(&set, b, "Pop value:", print_value);
vset_foreach(&set, "Foreach loop:", print_value);

View File

@ -2,8 +2,8 @@
/* Copyright © 2022 Gregory Lirent */
#include <stdio.h>
#include "../include/extra/string.h"
#include "../include/extra/array.h"
#include "../include/array.h"
#include "../include/string.h"
typedef vtype_string str_t;
typedef vtype_array arr_t;
@ -25,14 +25,14 @@ int main(int argc, char** argv) {
printf("%s\n", str.buffer);
arr_t parts = string_split(&str, ',', -1);
arr_t parts = string_split(&str, ',');
printf("%lu\n", array_size(&parts));
for (size_t i = 0; i < array_size(&parts); ++i) {
str_t* value = array_at(&parts, i);
str_t* value = at_array(&parts, i);
string_trim_spaces(value);
string_trim(value, 0);
printf("%s (%lu)\n", value->buffer, string_nmemb(value));
}

View File

@ -1,71 +0,0 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#ifndef LIBCDSB_CORE_GENERICS_H
#define LIBCDSB_CORE_GENERICS_H
#define _LIBCDSB_Generic(T, f, v) _Generic((v),\
void*: T ## _ ## f ## _pointer, const void*: T ## _ ## f ## _pointer,\
char*: T ## _ ## f ## _cstring, const char*: T ## _ ## f ## _cstring,\
vtype_string*: T ## _ ## f ## _string, const vtype_string*: T ## _ ## f ## _string,\
vtype_array*: T ## _ ## f ## _array, const vtype_array*: T ## _ ## f ## _array,\
vtype_list*: T ## _ ## f ## _list, const vtype_list*: T ## _ ## f ## _list,\
vtype_map*: T ## _ ## f ## _map, const vtype_map*: T ## _ ## f ## _map,\
vtype_set*: T ## _ ## f ## _vset, const vtype_set*: T ## _ ## f ## _vset,\
vtype_dict*: T ## _ ## f ## _dict, const vtype_dict*: T ## _ ## f ## _dict,\
vtype_bool: T ## _ ## f ## _boolean,\
vtype_uint8: T ## _ ## f ## _uint8,\
vtype_uint16: T ## _ ## f ## _uint16,\
vtype_uint32: T ## _ ## f ## _uint32,\
vtype_uint64: T ## _ ## f ## _uint64,\
vtype_int8: T ## _ ## f ## _int8,\
vtype_int16: T ## _ ## f ## _int16,\
vtype_int32: T ## _ ## f ## _int32,\
vtype_int64: T ## _ ## f ## _int64,\
vtype_float: T ## _ ## f ## _float,\
vtype_double: T ## _ ## f ## _double,\
vtype_ldouble: T ## _ ## f ## _ldouble\
)
#define _LIBCDSB_Generic2(T, f, k, v) _Generic((k),\
void*: _LIBCDSB_Generic(T, f ## _pointer, v), const void*: _LIBCDSB_Generic(T, f ## _pointer, v),\
char*: _LIBCDSB_Generic(T, f ## _cstring, v), const char*: _LIBCDSB_Generic(T, f ## _cstring, v),\
vtype_string*: _LIBCDSB_Generic(T, f ## _string, v), const vtype_string*: _LIBCDSB_Generic(T, f ## _string, v),\
vtype_array*: _LIBCDSB_Generic(T, f ## _array, v), const vtype_array*: _LIBCDSB_Generic(T, f ## _array, v),\
vtype_list*: _LIBCDSB_Generic(T, f ## _list, v), const vtype_list*: _LIBCDSB_Generic(T, f ## _list, v),\
vtype_map*: _LIBCDSB_Generic(T, f ## _map, v), const vtype_map*: _LIBCDSB_Generic(T, f ## _map, v),\
vtype_set*: _LIBCDSB_Generic(T, f ## _vset, v), const vtype_set*: _LIBCDSB_Generic(T, f ## _vset, v),\
vtype_dict*: _LIBCDSB_Generic(T, f ## _dict, v), const vtype_dict*: _LIBCDSB_Generic(T, f ## _dict, v),\
vtype_bool: _LIBCDSB_Generic(T, f ## _boolean, v),\
vtype_uint8: _LIBCDSB_Generic(T, f ## _uint8, v),\
vtype_uint16: _LIBCDSB_Generic(T, f ## _uint16, v),\
vtype_uint32: _LIBCDSB_Generic(T, f ## _uint32, v),\
vtype_uint64: _LIBCDSB_Generic(T, f ## _uint64, v),\
vtype_int8: _LIBCDSB_Generic(T, f ## _int8, v),\
vtype_int16: _LIBCDSB_Generic(T, f ## _int16, v),\
vtype_int32: _LIBCDSB_Generic(T, f ## _int32, v),\
vtype_int64: _LIBCDSB_Generic(T, f ## _int64, v),\
vtype_float: _LIBCDSB_Generic(T, f ## _float, v),\
vtype_double: _LIBCDSB_Generic(T, f ## _double, v),\
vtype_ldouble: _LIBCDSB_Generic(T, f ## _ldouble, v)\
)
#define _LIBCDSB_GenericS(T, f, v) _Generic((v),\
void*: T ## _ ## f ## _cstring, const void*: T ## _ ## f ## _cstring,\
char*: T ## _ ## f ## _cstring, const char*: T ## _ ## f ## _cstring,\
vtype_string*: T ## _ ## f ## _string, const vtype_string*: T ## _ ## f ## _string,\
int: T ## _ ## f ## _char, unsigned int: T ## _ ## f ## _char,\
char: T ## _ ## f ## _char, unsigned char: T ## _ ## f ## _char,\
short: T ## _ ## f ## _char, unsigned short: T ## _ ## f ## _char\
)
#define _LIBCDSB_GenericS2(T, f, s, d) _Generic((s),\
void*: _LIBCDSB_GenericS(T, f ## _cstring, d), const void*: _LIBCDSB_GenericS(T, f ## _cstring, d),\
char*: _LIBCDSB_GenericS(T, f ## _cstring, d), const char*: _LIBCDSB_GenericS(T, f ## _cstring, d),\
vtype_string*: _LIBCDSB_GenericS(T, f ## _string, d), const vtype_string*: _LIBCDSB_GenericS(T, f ## _string, d),\
int: _LIBCDSB_GenericS(T, f ## _char, d), unsigned int: _LIBCDSB_GenericS(T, f ## _char, d),\
char: _LIBCDSB_GenericS(T, f ## _char, d), unsigned char: _LIBCDSB_GenericS(T, f ## _char, d),\
short: _LIBCDSB_GenericS(T, f ## _char, d), unsigned short: _LIBCDSB_GenericS(T, f ## _char, d)\
)
#endif /* LIBCDSB_CORE_GENERICS_H */

View File

@ -1,95 +1,50 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "__generics.h"
#include "bits/__generics.h"
#include "vtype.h"
#ifndef LIBCDSB_ARRAY_H
#define LIBCDSB_ARRAY_H
/*#####################################################################################################################*/
typedef int (*array_access_callback)(void* value, ssize_t index, vtype type, void* data);
extern void array_init (vtype_array* x, vtype type) Nonnull__(1);
extern void* array_at (const vtype_array* s, ssize_t index) Nonnull__(1);
extern size_t array_slice(vtype_array* x, vtype_array* src, ssize_t index, size_t count, bool cut) Nonnull__(1);
/*#####################################################################################################################*/
inline void array_init (vtype_array* x, vtype type) Always_inline__ Nonnull__(1);
extern size_t array_slice (vtype_array* x, vtype_array* src, ssize_t index, size_t count, bool cut) Nonnull__(1);
extern void array_sort (vtype_array* x) Nonnull__(1);
extern void array_reverse(vtype_array* x) Nonnull__(1);
extern void array_reverse (vtype_array* x) Nonnull__(1);
#define array_pop(x, value, data, callback) _LIBCDSB_Generic(libcdsb_array, find, value)(x, value, data, callback, 0, 1)
#define array_find(x, value, data, callback) _LIBCDSB_Generic(libcdsb_array, find, value)(x, value, data, callback, 0, 0)
#define array_rfind(x, value, data, callback) _LIBCDSB_Generic(libcdsb_array, find, value)(x, value, data, callback, 1, 0)
#define array_countof(x, value) _LIBCDSB_Generic(libcdsb_array, count, value)(x, value)
#define array_remove(x, value) array_pop(x, value, 0, 0)
#define in_array(x, value) (array_find(x, value, 0, 0) == 0)
extern void* at_array(const vtype_array* s, ssize_t index) Nonnull__(1);
#define array_push_back(x, value) _LIBCDSB_Generic(libcdsb_array, push, value)(x, value)
inline void array_init (vtype_array* x, vtype type) { x->type = type; x->mem = (void*)(x->size = 0); }
/*#####################################################################################################################*/
extern void libcdsb_array_push_pointer(vtype_array* x, const void* value) Nonnull__(1);
extern void libcdsb_array_push_cstring(vtype_array* x, const char* value) Nonnull__(1,2);
extern void libcdsb_array_push_string (vtype_array* x, const vtype_string* value) Nonnull__(1,2);
extern void libcdsb_array_push_array (vtype_array* x, const vtype_array* value) Nonnull__(1,2);
extern void libcdsb_array_push_list (vtype_array* x, const vtype_list* value) Nonnull__(1,2);
extern void libcdsb_array_push_map (vtype_array* x, const vtype_map* value) Nonnull__(1,2);
extern void libcdsb_array_push_vset (vtype_array* x, const vtype_set* value) Nonnull__(1,2);
extern void libcdsb_array_push_dict (vtype_array* x, const vtype_dict* value) Nonnull__(1,2);
extern void libcdsb_array_push_boolean(vtype_array* x, vtype_bool value) Nonnull__(1);
extern void libcdsb_array_push_uint8 (vtype_array* x, vtype_uint8 value) Nonnull__(1);
extern void libcdsb_array_push_uint16 (vtype_array* x, vtype_uint16 value) Nonnull__(1);
extern void libcdsb_array_push_uint32 (vtype_array* x, vtype_uint32 value) Nonnull__(1);
extern void libcdsb_array_push_uint64 (vtype_array* x, vtype_uint64 value) Nonnull__(1);
extern void libcdsb_array_push_int8 (vtype_array* x, vtype_int8 value) Nonnull__(1);
extern void libcdsb_array_push_int16 (vtype_array* x, vtype_int16 value) Nonnull__(1);
extern void libcdsb_array_push_int32 (vtype_array* x, vtype_int32 value) Nonnull__(1);
extern void libcdsb_array_push_int64 (vtype_array* x, vtype_int64 value) Nonnull__(1);
extern void libcdsb_array_push_float (vtype_array* x, vtype_float value) Nonnull__(1);
extern void libcdsb_array_push_double (vtype_array* x, vtype_double value) Nonnull__(1);
extern void libcdsb_array_push_ldouble(vtype_array* x, vtype_ldouble value) Nonnull__(1);
#define array_pop(x, value, data, callback) libcdsb_array_find (x, _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value), data, callback, 0, 1)
#define array_get array_find
#define array_pop_by_index(x, index, data, callback) libcdsb_array_get (x, index, data, callback, 1)
#define array_get_by_index(x, index, data, callback) libcdsb_array_get (x, index, data, callback, 0)
#define array_find(x, value, data, callback) libcdsb_array_find (x, _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value), data, callback, 0, 0)
#define array_rfind(x, value, data, callback) libcdsb_array_find (x, _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value), data, callback, 1, 0)
#define array_countof(x, value) libcdsb_array_count (x, _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value))
#define array_push_back(x, value) libcdsb_array_insert (x, _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value))
#define array_attach_back(x, value) libcdsb_array_attach (x, _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value))
#define array_foreach(x, data, callback) libcdsb_array_foreach(x, data, callback, 0)
#define array_remove(x, value) array_pop (x, value, 0, 0)
#define array_remove_by_index(x, index) array_pop_by_index (x, index, 0, 0)
extern size_t libcdsb_array_count_pointer(const vtype_array* s, const void* value) Nonnull__(1);
extern size_t libcdsb_array_count_cstring(const vtype_array* s, const char* value) Nonnull__(1,2);
extern size_t libcdsb_array_count_string (const vtype_array* s, const vtype_string* value) Nonnull__(1,2);
extern size_t libcdsb_array_count_array (const vtype_array* s, const vtype_array* value) Nonnull__(1,2);
extern size_t libcdsb_array_count_list (const vtype_array* s, const vtype_list* value) Nonnull__(1,2);
extern size_t libcdsb_array_count_map (const vtype_array* s, const vtype_map* value) Nonnull__(1,2);
extern size_t libcdsb_array_count_vset (const vtype_array* s, const vtype_set* value) Nonnull__(1,2);
extern size_t libcdsb_array_count_dict (const vtype_array* s, const vtype_dict* value) Nonnull__(1,2);
extern size_t libcdsb_array_count_boolean(const vtype_array* s, vtype_bool value) Nonnull__(1);
extern size_t libcdsb_array_count_int8 (const vtype_array* s, vtype_int8 value) Nonnull__(1);
extern size_t libcdsb_array_count_int16 (const vtype_array* s, vtype_int16 value) Nonnull__(1);
extern size_t libcdsb_array_count_int32 (const vtype_array* s, vtype_int32 value) Nonnull__(1);
extern size_t libcdsb_array_count_int64 (const vtype_array* s, vtype_int64 value) Nonnull__(1);
extern size_t libcdsb_array_count_uint8 (const vtype_array* s, vtype_uint8 value) Nonnull__(1);
extern size_t libcdsb_array_count_uint16 (const vtype_array* s, vtype_uint16 value) Nonnull__(1);
extern size_t libcdsb_array_count_uint32 (const vtype_array* s, vtype_uint32 value) Nonnull__(1);
extern size_t libcdsb_array_count_uint64 (const vtype_array* s, vtype_uint64 value) Nonnull__(1);
extern size_t libcdsb_array_count_float (const vtype_array* s, vtype_float value) Nonnull__(1);
extern size_t libcdsb_array_count_double (const vtype_array* s, vtype_double value) Nonnull__(1);
extern size_t libcdsb_array_count_ldouble(const vtype_array* s, vtype_ldouble value) Nonnull__(1);
#define in_array(x, value) (array_get(x, value, 0, 0) == 0)
extern int libcdsb_array_find_pointer(vtype_array* x, const void* value, void* data, array_access_callback, bool reverse, bool cut) Nonnull__(1);
extern int libcdsb_array_find_cstring(vtype_array* x, const char* value, void* data, array_access_callback, bool reverse, bool cut) Nonnull__(1,2);
extern int libcdsb_array_find_string (vtype_array* x, const vtype_string* value, void* data, array_access_callback, bool reverse, bool cut) Nonnull__(1,2);
extern int libcdsb_array_find_array (vtype_array* x, const vtype_array* value, void* data, array_access_callback, bool reverse, bool cut) Nonnull__(1,2);
extern int libcdsb_array_find_list (vtype_array* x, const vtype_list* value, void* data, array_access_callback, bool reverse, bool cut) Nonnull__(1,2);
extern int libcdsb_array_find_map (vtype_array* x, const vtype_map* value, void* data, array_access_callback, bool reverse, bool cut) Nonnull__(1,2);
extern int libcdsb_array_find_vset (vtype_array* x, const vtype_set* value, void* data, array_access_callback, bool reverse, bool cut) Nonnull__(1,2);
extern int libcdsb_array_find_dict (vtype_array* x, const vtype_dict* value, void* data, array_access_callback, bool reverse, bool cut) Nonnull__(1,2);
extern int libcdsb_array_find_boolean(vtype_array* x, vtype_bool value, void* data, array_access_callback, bool reverse, bool cut) Nonnull__(1);
extern int libcdsb_array_find_uint8 (vtype_array* x, vtype_uint8 value, void* data, array_access_callback, bool reverse, bool cut) Nonnull__(1);
extern int libcdsb_array_find_uint16 (vtype_array* x, vtype_uint16 value, void* data, array_access_callback, bool reverse, bool cut) Nonnull__(1);
extern int libcdsb_array_find_uint32 (vtype_array* x, vtype_uint32 value, void* data, array_access_callback, bool reverse, bool cut) Nonnull__(1);
extern int libcdsb_array_find_uint64 (vtype_array* x, vtype_uint64 value, void* data, array_access_callback, bool reverse, bool cut) Nonnull__(1);
extern int libcdsb_array_find_int8 (vtype_array* x, vtype_int8 value, void* data, array_access_callback, bool reverse, bool cut) Nonnull__(1);
extern int libcdsb_array_find_int16 (vtype_array* x, vtype_int16 value, void* data, array_access_callback, bool reverse, bool cut) Nonnull__(1);
extern int libcdsb_array_find_int32 (vtype_array* x, vtype_int32 value, void* data, array_access_callback, bool reverse, bool cut) Nonnull__(1);
extern int libcdsb_array_find_int64 (vtype_array* x, vtype_int64 value, void* data, array_access_callback, bool reverse, bool cut) Nonnull__(1);
extern int libcdsb_array_find_float (vtype_array* x, vtype_float value, void* data, array_access_callback, bool reverse, bool cut) Nonnull__(1);
extern int libcdsb_array_find_double (vtype_array* x, vtype_double value, void* data, array_access_callback, bool reverse, bool cut) Nonnull__(1);
extern int libcdsb_array_find_ldouble(vtype_array* x, vtype_ldouble value, void* data, array_access_callback, bool reverse, bool cut) Nonnull__(1);
/*#####################################################################################################################*/
extern ssize_t libcdsb_array_insert (vtype_array* x, const void* value, vtype type) Nonnull__(1);
extern ssize_t libcdsb_array_attach (vtype_array* x, const void* value, vtype type) Nonnull__(1);
extern int libcdsb_array_find (vtype_array* x, const void* value, vtype type, void* data, array_access_callback, bool reverse, bool cut) Nonnull__(1);
extern int libcdsb_array_get (vtype_array* x, ssize_t index, void* data, array_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_array_foreach (vtype_array* x, void* data, array_access_callback, bool flush) Nonnull__(1,3);
extern size_t libcdsb_array_count(const vtype_array* s, const void* value, vtype type) Pure__ Warn_unused_result__ Nonnull__(1);
#endif /* LIBCDSB_ARRAY_H */

View File

@ -1,12 +1,12 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#ifndef LIBCDSB_CORE_ATTRIBUTES_H
#define LIBCDSB_CORE_ATTRIBUTES_H
#ifndef LIBCDSB_BITS_ATTRIBUTES_H
#define LIBCDSB_BITS_ATTRIBUTES_H
#define Pure__ __attribute__ ((pure))
#define Always_inline__ __attribute__ ((always_inline))
#define Warn_unused_result__ __attribute__ ((warn_unused_result))
#define Nonnull__(...) __attribute__ ((nonnull (__VA_ARGS__)))
#endif /* LIBCDSB_CORE_ATTRIBUTES_H */
#endif /* LIBCDSB_BITS_ATTRIBUTES_H */

51
include/bits/__generics.h Normal file
View File

@ -0,0 +1,51 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#ifndef LIBCDSB_BITS_GENERICS_H
#define LIBCDSB_BITS_GENERICS_H
#define vtypeof(x) (vtype)(_Generic((x),\
const void*: VTYPE_POINTER, void*: VTYPE_POINTER,\
const char**: VTYPE_STRING, char**: VTYPE_STRING,\
const vtype_string*: VTYPE_STRING, vtype_string*: VTYPE_STRING,\
const vtype_array*: VTYPE_ARRAY, vtype_array*: VTYPE_ARRAY,\
const vtype_list*: VTYPE_LIST, vtype_list*: VTYPE_LIST,\
const vtype_map*: VTYPE_MAP, vtype_map*: VTYPE_MAP,\
const vtype_set*: VTYPE_SET, vtype_set*: VTYPE_SET,\
const vtype_dict*: VTYPE_DICT, vtype_dict*: VTYPE_DICT,\
vtype_bool: VTYPE_BOOLEAN,\
vtype_uint8: VTYPE_UINT8,\
vtype_uint16: VTYPE_UINT16,\
vtype_uint32: VTYPE_UINT32,\
vtype_uint64: VTYPE_UINT64,\
vtype_int8: VTYPE_INT8,\
vtype_int16: VTYPE_INT16,\
vtype_int32: VTYPE_INT32,\
vtype_int64: VTYPE_INT64,\
vtype_float: VTYPE_FLOAT,\
vtype_double: VTYPE_DOUBLE,\
vtype_ldouble: VTYPE_LDOUBLE))
#define _LIBCDSB_vtypeof(x) vtypeof(_Generic((x), default: (x), const char*: &(x), char*: &(x)))
#define _LIBCDSB_value_pointer(x) _Generic((x), default: &(x),\
vtype_string*: (x), const vtype_string*: (x),\
vtype_array*: (x), const vtype_array*: (x),\
vtype_list*: (x), const vtype_list*: (x),\
vtype_map*: (x), const vtype_map*: (x),\
vtype_set*: (x), const vtype_set*: (x),\
vtype_dict*: (x), const vtype_dict*: (x))
#define _LIBCDSB_to_cstring(x) _Generic((x), default: _LIBCDSB_nothing,\
vtype_string*: _LIBCDSB_deref1, const vtype_string*: _LIBCDSB_deref1,\
int: libcdsb_char_to_cstring, unsigned int: libcdsb_char_to_cstring,\
char: libcdsb_char_to_cstring, unsigned char: libcdsb_char_to_cstring,\
short: libcdsb_char_to_cstring, unsigned short: libcdsb_char_to_cstring\
)(x)
inline const void* _LIBCDSB_nothing(const void* x) __attribute__((always_inline));
inline const void* _LIBCDSB_deref1 (const void* x) __attribute__((always_inline));
inline const void* _LIBCDSB_nothing(const void* x) { return x; }
inline const void* _LIBCDSB_deref1 (const void* x) { return *(void**)x; }
#endif /* LIBCDSB_BITS_GENERICS_H */

20
include/bits/__rbtree.h Normal file
View File

@ -0,0 +1,20 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#ifndef LIBCDSB_BITS_RBTREE_H
#define LIBCDSB_BITS_RBTREE_H
typedef enum {
RBFOREACH_UNSPECIFIED = 0x00,
RBFOREACH_REVERSE = 0x80,
RBFOREACH_INORDER = 0x01,
RBFOREACH_PREORDER = 0x02,
RBFOREACH_POSTORDER = 0x04,
RBFOREACH_BREADTH_FIRST = 0x08,
RBFOREACH_INORDER_REVERSE = RBFOREACH_INORDER | RBFOREACH_REVERSE,
RBFOREACH_PREORDER_REVERSE = RBFOREACH_PREORDER | RBFOREACH_REVERSE,
RBFOREACH_POSTORDER_REVERSE = RBFOREACH_POSTORDER | RBFOREACH_REVERSE,
RBFOREACH_BREADTH_FIRST_REVERSE = RBFOREACH_BREADTH_FIRST | RBFOREACH_REVERSE
} rbforeach_t;
#endif /* LIBCDSB_BITS_RBTREE_H */

View File

@ -2,10 +2,12 @@
/* Copyright © 2022 Gregory Lirent */
#include <string.h>
#include "../__attributes.h"
#include "__attributes.h"
#ifndef LIBCDSB_EXTRA_CSTRING_H
#define LIBCDSB_EXTRA_CSTRING_H
#ifndef LIBCDSB_BITS_CSTRING_H
#define LIBCDSB_BITS_CSTRING_H
extern const char* libcdsb_char_to_cstring(int c) Warn_unused_result__;
extern size_t libcdsb_strlen (const char* s) Pure__ Warn_unused_result__ Nonnull__(1);
extern size_t libcdsb_strasciilen(const char* s) Pure__ Warn_unused_result__ Nonnull__(1);
@ -14,11 +16,4 @@ extern char* libcdsb_strdup (const char* s) Warn_unused_result__ Nonnu
extern char* libcdsb_strndup(const char* s, size_t n) Warn_unused_result__ Nonnull__(1);
extern void* libcdsb_memndup(const void* m, size_t n) Warn_unused_result__ Nonnull__(1);
#define strlen libcdsb_strlen
#define strasciilen libcdsb_strasciilen
#define strdup libcdsb_strdup
#define strndup libcdsb_strndup
#define memndup libcdsb_memndup
#endif /* LIBCDSB_EXTRA_CSTRING_H */
#endif /* LIBCDSB_BITS_CSTRING_H */

View File

@ -2,10 +2,10 @@
/* Copyright © 2022 Gregory Lirent */
#include <stddef.h>
#include "../__attributes.h"
#include "__attributes.h"
#ifndef LIBCDSB_EXTRA_MEMORY_H
#define LIBCDSB_EXTRA_MEMORY_H
#ifndef LIBCDSB_BITS_MEMORY_H
#define LIBCDSB_BITS_MEMORY_H
typedef struct libcdsb_stack_node {
struct libcdsb_stack_node* prev;
@ -16,6 +16,7 @@ extern void libcdsb_stack_init (stack_t* stack) Nonnull__(1)
extern void libcdsb_stack_push (stack_t* stack, void* value) Nonnull__(1);
extern void libcdsb_stack_push_many(stack_t* stack, size_t n, ...) Nonnull__(1);
extern void* libcdsb_stack_pop (stack_t* stack) Nonnull__(1);
extern void libcdsb_stack_reverse (stack_t* stack) Nonnull__(1);
extern void libcdsb_stack_flush (stack_t* stack) Nonnull__(1);
extern void* libcdsb_aalloc (size_t a, size_t n) Warn_unused_result__;
@ -25,16 +26,4 @@ extern void* libcdsb_realloc(void *p, size_t n) Warn_unused_result__;
extern void libcdsb_free(void* s);
#define aligned_alloc libcdsb_aalloc
#define malloc libcdsb_malloc
#define calloc libcdsb_calloc
#define realloc libcdsb_realloc
#define free libcdsb_free
#define stack_init libcdsb_stack_init
#define stack_push libcdsb_stack_push
#define stack_push_many libcdsb_stack_push_many
#define stack_pop libcdsb_stack_pop
#define stack_flush libcdsb_stack_flush
#endif /* LIBCDSB_EXTRA_MEMORY_H */
#endif /* LIBCDSB_BITS_MEMORY_H */

View File

@ -1,466 +1,41 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "__generics.h"
#include "bits/__generics.h"
#include "vtype.h"
#ifndef LIBCDSB_DICT_H
#define LIBCDSB_DICT_H
/*#####################################################################################################################*/
typedef int (*dict_access_callback)(const void* key, vtype key_type, void* value, vtype value_type, void* data);
extern void dict_init(vtype_dict* x) Nonnull__(1);
/*#####################################################################################################################*/
#define dict_pop(x, key, data, callback) _LIBCDSB_Generic (libcdsb_dict, get_by, key)(x, key, data, callback, 1)
#define dict_get(x, key, data, callback) _LIBCDSB_Generic (libcdsb_dict, get_by, key)(x, key, data, callback, 0)
#define dict_update(x, key, value) _LIBCDSB_Generic2(libcdsb_dict, update, key, value)(x, key, value)
#define dict_remove(x, key) dict_pop(x, key, 0, 0)
inline void dict_init(vtype_dict* x) Always_inline__ Nonnull__(1);
inline void dict_init(vtype_dict* x) { x->nodes = (void*)(x->capacity = x->size = 0); }
/*#####################################################################################################################*/
#define dict_pop(x, key, data, callback) libcdsb_dict_find (x, _LIBCDSB_value_pointer(key), _LIBCDSB_vtypeof(key), data, callback, 1)
#define dict_get(x, key, data, callback) libcdsb_dict_find (x, _LIBCDSB_value_pointer(key), _LIBCDSB_vtypeof(key), data, callback, 0)
#define dict_update(x, key, value) libcdsb_dict_update (x, _LIBCDSB_value_pointer(key), _LIBCDSB_vtypeof(key), _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value))
#define dict_inject(x, key, value) libcdsb_dict_inject (x, _LIBCDSB_value_pointer(key), _LIBCDSB_vtypeof(key), _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value))
#define dict_inject_key(x, key, value) libcdsb_dict_inject_key (x, _LIBCDSB_value_pointer(key), _LIBCDSB_vtypeof(key), _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value))
#define dict_inject_value(x, key, value) libcdsb_dict_inject_value(x, _LIBCDSB_value_pointer(key), _LIBCDSB_vtypeof(key), _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value))
#define dict_foreach(x, data, callback) libcdsb_dict_foreach (x, data, callback, 0)
#define dict_remove(x, key) dict_pop (x, key, 0, 0)
#define in_dict(x, key) (dict_get(&x, key, 0, 0) == 0)
/*#####################################################################################################################*/
extern int libcdsb_dict_get_by_pointer(vtype_dict* x, const void* key, void* data, dict_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_dict_get_by_cstring(vtype_dict* x, const char* key, void* data, dict_access_callback, bool cut) Nonnull__(1,2);
extern int libcdsb_dict_get_by_string (vtype_dict* x, const vtype_string* key, void* data, dict_access_callback, bool cut) Nonnull__(1,2);
extern int libcdsb_dict_get_by_array (vtype_dict* x, const vtype_array* key, void* data, dict_access_callback, bool cut) Nonnull__(1,2);
extern int libcdsb_dict_get_by_list (vtype_dict* x, const vtype_list* key, void* data, dict_access_callback, bool cut) Nonnull__(1,2);
extern int libcdsb_dict_get_by_map (vtype_dict* x, const vtype_map* key, void* data, dict_access_callback, bool cut) Nonnull__(1,2);
extern int libcdsb_dict_get_by_vset (vtype_dict* x, const vtype_set* key, void* data, dict_access_callback, bool cut) Nonnull__(1,2);
extern int libcdsb_dict_get_by_dict (vtype_dict* x, const vtype_dict* key, void* data, dict_access_callback, bool cut) Nonnull__(1,2);
extern int libcdsb_dict_get_by_boolean(vtype_dict* x, vtype_bool key, void* data, dict_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_dict_get_by_int8 (vtype_dict* x, vtype_int8 key, void* data, dict_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_dict_get_by_int16 (vtype_dict* x, vtype_int16 key, void* data, dict_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_dict_get_by_int32 (vtype_dict* x, vtype_int32 key, void* data, dict_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_dict_get_by_int64 (vtype_dict* x, vtype_int64 key, void* data, dict_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_dict_get_by_uint8 (vtype_dict* x, vtype_uint8 key, void* data, dict_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_dict_get_by_uint16 (vtype_dict* x, vtype_uint16 key, void* data, dict_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_dict_get_by_uint32 (vtype_dict* x, vtype_uint32 key, void* data, dict_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_dict_get_by_uint64 (vtype_dict* x, vtype_uint64 key, void* data, dict_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_dict_get_by_float (vtype_dict* x, vtype_float key, void* data, dict_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_dict_get_by_double (vtype_dict* x, vtype_double key, void* data, dict_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_dict_get_by_ldouble(vtype_dict* x, vtype_ldouble key, void* data, dict_access_callback, bool cut) Nonnull__(1);
extern bool libcdsb_dict_update_pointer_pointer(vtype_dict* x, const void* key, const void* value) Nonnull__(1);
extern bool libcdsb_dict_update_pointer_cstring(vtype_dict* x, const void* key, const char* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_pointer_string (vtype_dict* x, const void* key, const vtype_string* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_pointer_array (vtype_dict* x, const void* key, const vtype_array* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_pointer_list (vtype_dict* x, const void* key, const vtype_list* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_pointer_map (vtype_dict* x, const void* key, const vtype_map* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_pointer_vset (vtype_dict* x, const void* key, const vtype_set* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_pointer_dict (vtype_dict* x, const void* key, const vtype_dict* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_pointer_boolean(vtype_dict* x, const void* key, vtype_bool value) Nonnull__(1);
extern bool libcdsb_dict_update_pointer_int8 (vtype_dict* x, const void* key, vtype_int8 value) Nonnull__(1);
extern bool libcdsb_dict_update_pointer_int16 (vtype_dict* x, const void* key, vtype_int16 value) Nonnull__(1);
extern bool libcdsb_dict_update_pointer_int32 (vtype_dict* x, const void* key, vtype_int32 value) Nonnull__(1);
extern bool libcdsb_dict_update_pointer_int64 (vtype_dict* x, const void* key, vtype_int64 value) Nonnull__(1);
extern bool libcdsb_dict_update_pointer_uint8 (vtype_dict* x, const void* key, vtype_uint8 value) Nonnull__(1);
extern bool libcdsb_dict_update_pointer_uint16 (vtype_dict* x, const void* key, vtype_uint16 value) Nonnull__(1);
extern bool libcdsb_dict_update_pointer_uint32 (vtype_dict* x, const void* key, vtype_uint32 value) Nonnull__(1);
extern bool libcdsb_dict_update_pointer_uint64 (vtype_dict* x, const void* key, vtype_uint64 value) Nonnull__(1);
extern bool libcdsb_dict_update_pointer_float (vtype_dict* x, const void* key, vtype_float value) Nonnull__(1);
extern bool libcdsb_dict_update_pointer_double (vtype_dict* x, const void* key, vtype_double value) Nonnull__(1);
extern bool libcdsb_dict_update_pointer_ldouble(vtype_dict* x, const void* key, vtype_ldouble value) Nonnull__(1);
extern bool libcdsb_dict_update_cstring_pointer(vtype_dict* x, const char* key, const void* value) Nonnull__(1,2);
extern bool libcdsb_dict_update_cstring_cstring(vtype_dict* x, const char* key, const char* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_cstring_string (vtype_dict* x, const char* key, const vtype_string* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_cstring_array (vtype_dict* x, const char* key, const vtype_array* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_cstring_list (vtype_dict* x, const char* key, const vtype_list* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_cstring_map (vtype_dict* x, const char* key, const vtype_map* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_cstring_vset (vtype_dict* x, const char* key, const vtype_set* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_cstring_dict (vtype_dict* x, const char* key, const vtype_dict* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_cstring_boolean(vtype_dict* x, const char* key, vtype_bool value) Nonnull__(1,2);
extern bool libcdsb_dict_update_cstring_int8 (vtype_dict* x, const char* key, vtype_int8 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_cstring_int16 (vtype_dict* x, const char* key, vtype_int16 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_cstring_int32 (vtype_dict* x, const char* key, vtype_int32 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_cstring_int64 (vtype_dict* x, const char* key, vtype_int64 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_cstring_uint8 (vtype_dict* x, const char* key, vtype_uint8 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_cstring_uint16 (vtype_dict* x, const char* key, vtype_uint16 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_cstring_uint32 (vtype_dict* x, const char* key, vtype_uint32 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_cstring_uint64 (vtype_dict* x, const char* key, vtype_uint64 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_cstring_float (vtype_dict* x, const char* key, vtype_float value) Nonnull__(1,2);
extern bool libcdsb_dict_update_cstring_double (vtype_dict* x, const char* key, vtype_double value) Nonnull__(1,2);
extern bool libcdsb_dict_update_cstring_ldouble(vtype_dict* x, const char* key, vtype_ldouble value) Nonnull__(1,2);
extern bool libcdsb_dict_update_string_pointer(vtype_dict* x, const vtype_string* key, const void* value) Nonnull__(1,2);
extern bool libcdsb_dict_update_string_cstring(vtype_dict* x, const vtype_string* key, const char* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_string_string (vtype_dict* x, const vtype_string* key, const vtype_string* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_string_array (vtype_dict* x, const vtype_string* key, const vtype_array* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_string_list (vtype_dict* x, const vtype_string* key, const vtype_list* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_string_map (vtype_dict* x, const vtype_string* key, const vtype_map* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_string_vset (vtype_dict* x, const vtype_string* key, const vtype_set* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_string_dict (vtype_dict* x, const vtype_string* key, const vtype_dict* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_string_boolean(vtype_dict* x, const vtype_string* key, vtype_bool value) Nonnull__(1,2);
extern bool libcdsb_dict_update_string_int8 (vtype_dict* x, const vtype_string* key, vtype_int8 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_string_int16 (vtype_dict* x, const vtype_string* key, vtype_int16 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_string_int32 (vtype_dict* x, const vtype_string* key, vtype_int32 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_string_int64 (vtype_dict* x, const vtype_string* key, vtype_int64 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_string_uint8 (vtype_dict* x, const vtype_string* key, vtype_uint8 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_string_uint16 (vtype_dict* x, const vtype_string* key, vtype_uint16 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_string_uint32 (vtype_dict* x, const vtype_string* key, vtype_uint32 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_string_uint64 (vtype_dict* x, const vtype_string* key, vtype_uint64 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_string_float (vtype_dict* x, const vtype_string* key, vtype_float value) Nonnull__(1,2);
extern bool libcdsb_dict_update_string_double (vtype_dict* x, const vtype_string* key, vtype_double value) Nonnull__(1,2);
extern bool libcdsb_dict_update_string_ldouble(vtype_dict* x, const vtype_string* key, vtype_ldouble value) Nonnull__(1,2);
extern bool libcdsb_dict_update_array_pointer(vtype_dict* x, const vtype_array* key, const void* value) Nonnull__(1,2);
extern bool libcdsb_dict_update_array_cstring(vtype_dict* x, const vtype_array* key, const char* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_array_string (vtype_dict* x, const vtype_array* key, const vtype_string* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_array_array (vtype_dict* x, const vtype_array* key, const vtype_array* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_array_list (vtype_dict* x, const vtype_array* key, const vtype_list* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_array_map (vtype_dict* x, const vtype_array* key, const vtype_map* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_array_vset (vtype_dict* x, const vtype_array* key, const vtype_set* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_array_dict (vtype_dict* x, const vtype_array* key, const vtype_dict* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_array_boolean(vtype_dict* x, const vtype_array* key, vtype_bool value) Nonnull__(1,2);
extern bool libcdsb_dict_update_array_int8 (vtype_dict* x, const vtype_array* key, vtype_int8 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_array_int16 (vtype_dict* x, const vtype_array* key, vtype_int16 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_array_int32 (vtype_dict* x, const vtype_array* key, vtype_int32 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_array_int64 (vtype_dict* x, const vtype_array* key, vtype_int64 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_array_uint8 (vtype_dict* x, const vtype_array* key, vtype_uint8 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_array_uint16 (vtype_dict* x, const vtype_array* key, vtype_uint16 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_array_uint32 (vtype_dict* x, const vtype_array* key, vtype_uint32 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_array_uint64 (vtype_dict* x, const vtype_array* key, vtype_uint64 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_array_float (vtype_dict* x, const vtype_array* key, vtype_float value) Nonnull__(1,2);
extern bool libcdsb_dict_update_array_double (vtype_dict* x, const vtype_array* key, vtype_double value) Nonnull__(1,2);
extern bool libcdsb_dict_update_array_ldouble(vtype_dict* x, const vtype_array* key, vtype_ldouble value) Nonnull__(1,2);
extern bool libcdsb_dict_update_list_pointer(vtype_dict* x, const vtype_list* key, const void* value) Nonnull__(1,2);
extern bool libcdsb_dict_update_list_cstring(vtype_dict* x, const vtype_list* key, const char* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_list_string (vtype_dict* x, const vtype_list* key, const vtype_string* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_list_array (vtype_dict* x, const vtype_list* key, const vtype_array* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_list_list (vtype_dict* x, const vtype_list* key, const vtype_list* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_list_map (vtype_dict* x, const vtype_list* key, const vtype_map* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_list_vset (vtype_dict* x, const vtype_list* key, const vtype_set* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_list_dict (vtype_dict* x, const vtype_list* key, const vtype_dict* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_list_boolean(vtype_dict* x, const vtype_list* key, vtype_bool value) Nonnull__(1,2);
extern bool libcdsb_dict_update_list_int8 (vtype_dict* x, const vtype_list* key, vtype_int8 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_list_int16 (vtype_dict* x, const vtype_list* key, vtype_int16 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_list_int32 (vtype_dict* x, const vtype_list* key, vtype_int32 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_list_int64 (vtype_dict* x, const vtype_list* key, vtype_int64 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_list_uint8 (vtype_dict* x, const vtype_list* key, vtype_uint8 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_list_uint16 (vtype_dict* x, const vtype_list* key, vtype_uint16 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_list_uint32 (vtype_dict* x, const vtype_list* key, vtype_uint32 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_list_uint64 (vtype_dict* x, const vtype_list* key, vtype_uint64 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_list_float (vtype_dict* x, const vtype_list* key, vtype_float value) Nonnull__(1,2);
extern bool libcdsb_dict_update_list_double (vtype_dict* x, const vtype_list* key, vtype_double value) Nonnull__(1,2);
extern bool libcdsb_dict_update_list_ldouble(vtype_dict* x, const vtype_list* key, vtype_ldouble value) Nonnull__(1,2);
extern bool libcdsb_dict_update_map_pointer(vtype_dict* x, const vtype_map* key, const void* value) Nonnull__(1,2);
extern bool libcdsb_dict_update_map_cstring(vtype_dict* x, const vtype_map* key, const char* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_map_string (vtype_dict* x, const vtype_map* key, const vtype_string* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_map_array (vtype_dict* x, const vtype_map* key, const vtype_array* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_map_list (vtype_dict* x, const vtype_map* key, const vtype_list* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_map_map (vtype_dict* x, const vtype_map* key, const vtype_map* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_map_vset (vtype_dict* x, const vtype_map* key, const vtype_set* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_map_dict (vtype_dict* x, const vtype_map* key, const vtype_dict* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_map_boolean(vtype_dict* x, const vtype_map* key, vtype_bool value) Nonnull__(1,2);
extern bool libcdsb_dict_update_map_int8 (vtype_dict* x, const vtype_map* key, vtype_int8 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_map_int16 (vtype_dict* x, const vtype_map* key, vtype_int16 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_map_int32 (vtype_dict* x, const vtype_map* key, vtype_int32 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_map_int64 (vtype_dict* x, const vtype_map* key, vtype_int64 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_map_uint8 (vtype_dict* x, const vtype_map* key, vtype_uint8 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_map_uint16 (vtype_dict* x, const vtype_map* key, vtype_uint16 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_map_uint32 (vtype_dict* x, const vtype_map* key, vtype_uint32 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_map_uint64 (vtype_dict* x, const vtype_map* key, vtype_uint64 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_map_float (vtype_dict* x, const vtype_map* key, vtype_float value) Nonnull__(1,2);
extern bool libcdsb_dict_update_map_double (vtype_dict* x, const vtype_map* key, vtype_double value) Nonnull__(1,2);
extern bool libcdsb_dict_update_map_ldouble(vtype_dict* x, const vtype_map* key, vtype_ldouble value) Nonnull__(1,2);
extern bool libcdsb_dict_update_vset_pointer(vtype_dict* x, const vtype_set* key, const void* value) Nonnull__(1,2);
extern bool libcdsb_dict_update_vset_cstring(vtype_dict* x, const vtype_set* key, const char* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_vset_string (vtype_dict* x, const vtype_set* key, const vtype_string* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_vset_array (vtype_dict* x, const vtype_set* key, const vtype_array* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_vset_list (vtype_dict* x, const vtype_set* key, const vtype_list* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_vset_map (vtype_dict* x, const vtype_set* key, const vtype_map* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_vset_vset (vtype_dict* x, const vtype_set* key, const vtype_set* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_vset_dict (vtype_dict* x, const vtype_set* key, const vtype_dict* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_vset_boolean(vtype_dict* x, const vtype_set* key, vtype_bool value) Nonnull__(1,2);
extern bool libcdsb_dict_update_vset_int8 (vtype_dict* x, const vtype_set* key, vtype_int8 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_vset_int16 (vtype_dict* x, const vtype_set* key, vtype_int16 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_vset_int32 (vtype_dict* x, const vtype_set* key, vtype_int32 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_vset_int64 (vtype_dict* x, const vtype_set* key, vtype_int64 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_vset_uint8 (vtype_dict* x, const vtype_set* key, vtype_uint8 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_vset_uint16 (vtype_dict* x, const vtype_set* key, vtype_uint16 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_vset_uint32 (vtype_dict* x, const vtype_set* key, vtype_uint32 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_vset_uint64 (vtype_dict* x, const vtype_set* key, vtype_uint64 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_vset_float (vtype_dict* x, const vtype_set* key, vtype_float value) Nonnull__(1,2);
extern bool libcdsb_dict_update_vset_double (vtype_dict* x, const vtype_set* key, vtype_double value) Nonnull__(1,2);
extern bool libcdsb_dict_update_vset_ldouble(vtype_dict* x, const vtype_set* key, vtype_ldouble value) Nonnull__(1,2);
extern bool libcdsb_dict_update_dict_pointer(vtype_dict* x, const vtype_dict* key, const void* value) Nonnull__(1,2);
extern bool libcdsb_dict_update_dict_cstring(vtype_dict* x, const vtype_dict* key, const char* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_dict_string (vtype_dict* x, const vtype_dict* key, const vtype_string* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_dict_array (vtype_dict* x, const vtype_dict* key, const vtype_array* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_dict_list (vtype_dict* x, const vtype_dict* key, const vtype_list* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_dict_map (vtype_dict* x, const vtype_dict* key, const vtype_map* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_dict_vset (vtype_dict* x, const vtype_dict* key, const vtype_set* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_dict_dict (vtype_dict* x, const vtype_dict* key, const vtype_dict* value) Nonnull__(1,2,3);
extern bool libcdsb_dict_update_dict_boolean(vtype_dict* x, const vtype_dict* key, vtype_bool value) Nonnull__(1,2);
extern bool libcdsb_dict_update_dict_int8 (vtype_dict* x, const vtype_dict* key, vtype_int8 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_dict_int16 (vtype_dict* x, const vtype_dict* key, vtype_int16 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_dict_int32 (vtype_dict* x, const vtype_dict* key, vtype_int32 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_dict_int64 (vtype_dict* x, const vtype_dict* key, vtype_int64 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_dict_uint8 (vtype_dict* x, const vtype_dict* key, vtype_uint8 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_dict_uint16 (vtype_dict* x, const vtype_dict* key, vtype_uint16 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_dict_uint32 (vtype_dict* x, const vtype_dict* key, vtype_uint32 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_dict_uint64 (vtype_dict* x, const vtype_dict* key, vtype_uint64 value) Nonnull__(1,2);
extern bool libcdsb_dict_update_dict_float (vtype_dict* x, const vtype_dict* key, vtype_float value) Nonnull__(1,2);
extern bool libcdsb_dict_update_dict_double (vtype_dict* x, const vtype_dict* key, vtype_double value) Nonnull__(1,2);
extern bool libcdsb_dict_update_dict_ldouble(vtype_dict* x, const vtype_dict* key, vtype_ldouble value) Nonnull__(1,2);
extern bool libcdsb_dict_update_boolean_pointer(vtype_dict* x, vtype_bool key, const void* value) Nonnull__(1);
extern bool libcdsb_dict_update_boolean_cstring(vtype_dict* x, vtype_bool key, const char* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_boolean_string (vtype_dict* x, vtype_bool key, const vtype_string* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_boolean_array (vtype_dict* x, vtype_bool key, const vtype_array* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_boolean_list (vtype_dict* x, vtype_bool key, const vtype_list* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_boolean_map (vtype_dict* x, vtype_bool key, const vtype_map* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_boolean_vset (vtype_dict* x, vtype_bool key, const vtype_set* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_boolean_dict (vtype_dict* x, vtype_bool key, const vtype_dict* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_boolean_boolean(vtype_dict* x, vtype_bool key, vtype_bool value) Nonnull__(1);
extern bool libcdsb_dict_update_boolean_int8 (vtype_dict* x, vtype_bool key, vtype_int8 value) Nonnull__(1);
extern bool libcdsb_dict_update_boolean_int16 (vtype_dict* x, vtype_bool key, vtype_int16 value) Nonnull__(1);
extern bool libcdsb_dict_update_boolean_int32 (vtype_dict* x, vtype_bool key, vtype_int32 value) Nonnull__(1);
extern bool libcdsb_dict_update_boolean_int64 (vtype_dict* x, vtype_bool key, vtype_int64 value) Nonnull__(1);
extern bool libcdsb_dict_update_boolean_uint8 (vtype_dict* x, vtype_bool key, vtype_uint8 value) Nonnull__(1);
extern bool libcdsb_dict_update_boolean_uint16 (vtype_dict* x, vtype_bool key, vtype_uint16 value) Nonnull__(1);
extern bool libcdsb_dict_update_boolean_uint32 (vtype_dict* x, vtype_bool key, vtype_uint32 value) Nonnull__(1);
extern bool libcdsb_dict_update_boolean_uint64 (vtype_dict* x, vtype_bool key, vtype_uint64 value) Nonnull__(1);
extern bool libcdsb_dict_update_boolean_float (vtype_dict* x, vtype_bool key, vtype_float value) Nonnull__(1);
extern bool libcdsb_dict_update_boolean_double (vtype_dict* x, vtype_bool key, vtype_double value) Nonnull__(1);
extern bool libcdsb_dict_update_boolean_ldouble(vtype_dict* x, vtype_bool key, vtype_ldouble value) Nonnull__(1);
extern bool libcdsb_dict_update_uint8_pointer(vtype_dict* x, vtype_uint8 key, const void* value) Nonnull__(1);
extern bool libcdsb_dict_update_uint8_cstring(vtype_dict* x, vtype_uint8 key, const char* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_uint8_string (vtype_dict* x, vtype_uint8 key, const vtype_string* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_uint8_array (vtype_dict* x, vtype_uint8 key, const vtype_array* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_uint8_list (vtype_dict* x, vtype_uint8 key, const vtype_list* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_uint8_map (vtype_dict* x, vtype_uint8 key, const vtype_map* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_uint8_vset (vtype_dict* x, vtype_uint8 key, const vtype_set* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_uint8_dict (vtype_dict* x, vtype_uint8 key, const vtype_dict* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_uint8_boolean(vtype_dict* x, vtype_uint8 key, vtype_bool value) Nonnull__(1);
extern bool libcdsb_dict_update_uint8_int8 (vtype_dict* x, vtype_uint8 key, vtype_int8 value) Nonnull__(1);
extern bool libcdsb_dict_update_uint8_int16 (vtype_dict* x, vtype_uint8 key, vtype_int16 value) Nonnull__(1);
extern bool libcdsb_dict_update_uint8_int32 (vtype_dict* x, vtype_uint8 key, vtype_int32 value) Nonnull__(1);
extern bool libcdsb_dict_update_uint8_int64 (vtype_dict* x, vtype_uint8 key, vtype_int64 value) Nonnull__(1);
extern bool libcdsb_dict_update_uint8_uint8 (vtype_dict* x, vtype_uint8 key, vtype_uint8 value) Nonnull__(1);
extern bool libcdsb_dict_update_uint8_uint16 (vtype_dict* x, vtype_uint8 key, vtype_uint16 value) Nonnull__(1);
extern bool libcdsb_dict_update_uint8_uint32 (vtype_dict* x, vtype_uint8 key, vtype_uint32 value) Nonnull__(1);
extern bool libcdsb_dict_update_uint8_uint64 (vtype_dict* x, vtype_uint8 key, vtype_uint64 value) Nonnull__(1);
extern bool libcdsb_dict_update_uint8_float (vtype_dict* x, vtype_uint8 key, vtype_float value) Nonnull__(1);
extern bool libcdsb_dict_update_uint8_double (vtype_dict* x, vtype_uint8 key, vtype_double value) Nonnull__(1);
extern bool libcdsb_dict_update_uint8_ldouble(vtype_dict* x, vtype_uint8 key, vtype_ldouble value) Nonnull__(1);
extern bool libcdsb_dict_update_uint16_pointer(vtype_dict* x, vtype_uint16 key, const void* value) Nonnull__(1);
extern bool libcdsb_dict_update_uint16_cstring(vtype_dict* x, vtype_uint16 key, const char* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_uint16_string (vtype_dict* x, vtype_uint16 key, const vtype_string* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_uint16_array (vtype_dict* x, vtype_uint16 key, const vtype_array* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_uint16_list (vtype_dict* x, vtype_uint16 key, const vtype_list* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_uint16_map (vtype_dict* x, vtype_uint16 key, const vtype_map* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_uint16_vset (vtype_dict* x, vtype_uint16 key, const vtype_set* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_uint16_dict (vtype_dict* x, vtype_uint16 key, const vtype_dict* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_uint16_boolean(vtype_dict* x, vtype_uint16 key, vtype_bool value) Nonnull__(1);
extern bool libcdsb_dict_update_uint16_int8 (vtype_dict* x, vtype_uint16 key, vtype_int8 value) Nonnull__(1);
extern bool libcdsb_dict_update_uint16_int16 (vtype_dict* x, vtype_uint16 key, vtype_int16 value) Nonnull__(1);
extern bool libcdsb_dict_update_uint16_int32 (vtype_dict* x, vtype_uint16 key, vtype_int32 value) Nonnull__(1);
extern bool libcdsb_dict_update_uint16_int64 (vtype_dict* x, vtype_uint16 key, vtype_int64 value) Nonnull__(1);
extern bool libcdsb_dict_update_uint16_uint8 (vtype_dict* x, vtype_uint16 key, vtype_uint8 value) Nonnull__(1);
extern bool libcdsb_dict_update_uint16_uint16 (vtype_dict* x, vtype_uint16 key, vtype_uint16 value) Nonnull__(1);
extern bool libcdsb_dict_update_uint16_uint32 (vtype_dict* x, vtype_uint16 key, vtype_uint32 value) Nonnull__(1);
extern bool libcdsb_dict_update_uint16_uint64 (vtype_dict* x, vtype_uint16 key, vtype_uint64 value) Nonnull__(1);
extern bool libcdsb_dict_update_uint16_float (vtype_dict* x, vtype_uint16 key, vtype_float value) Nonnull__(1);
extern bool libcdsb_dict_update_uint16_double (vtype_dict* x, vtype_uint16 key, vtype_double value) Nonnull__(1);
extern bool libcdsb_dict_update_uint16_ldouble(vtype_dict* x, vtype_uint16 key, vtype_ldouble value) Nonnull__(1);
extern bool libcdsb_dict_update_uint32_pointer(vtype_dict* x, vtype_uint32 key, const void* value) Nonnull__(1);
extern bool libcdsb_dict_update_uint32_cstring(vtype_dict* x, vtype_uint32 key, const char* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_uint32_string (vtype_dict* x, vtype_uint32 key, const vtype_string* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_uint32_array (vtype_dict* x, vtype_uint32 key, const vtype_array* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_uint32_list (vtype_dict* x, vtype_uint32 key, const vtype_list* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_uint32_map (vtype_dict* x, vtype_uint32 key, const vtype_map* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_uint32_vset (vtype_dict* x, vtype_uint32 key, const vtype_set* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_uint32_dict (vtype_dict* x, vtype_uint32 key, const vtype_dict* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_uint32_boolean(vtype_dict* x, vtype_uint32 key, vtype_bool value) Nonnull__(1);
extern bool libcdsb_dict_update_uint32_int8 (vtype_dict* x, vtype_uint32 key, vtype_int8 value) Nonnull__(1);
extern bool libcdsb_dict_update_uint32_int16 (vtype_dict* x, vtype_uint32 key, vtype_int16 value) Nonnull__(1);
extern bool libcdsb_dict_update_uint32_int32 (vtype_dict* x, vtype_uint32 key, vtype_int32 value) Nonnull__(1);
extern bool libcdsb_dict_update_uint32_int64 (vtype_dict* x, vtype_uint32 key, vtype_int64 value) Nonnull__(1);
extern bool libcdsb_dict_update_uint32_uint8 (vtype_dict* x, vtype_uint32 key, vtype_uint8 value) Nonnull__(1);
extern bool libcdsb_dict_update_uint32_uint16 (vtype_dict* x, vtype_uint32 key, vtype_uint16 value) Nonnull__(1);
extern bool libcdsb_dict_update_uint32_uint32 (vtype_dict* x, vtype_uint32 key, vtype_uint32 value) Nonnull__(1);
extern bool libcdsb_dict_update_uint32_uint64 (vtype_dict* x, vtype_uint32 key, vtype_uint64 value) Nonnull__(1);
extern bool libcdsb_dict_update_uint32_float (vtype_dict* x, vtype_uint32 key, vtype_float value) Nonnull__(1);
extern bool libcdsb_dict_update_uint32_double (vtype_dict* x, vtype_uint32 key, vtype_double value) Nonnull__(1);
extern bool libcdsb_dict_update_uint32_ldouble(vtype_dict* x, vtype_uint32 key, vtype_ldouble value) Nonnull__(1);
extern bool libcdsb_dict_update_uint64_pointer(vtype_dict* x, vtype_uint64 key, const void* value) Nonnull__(1);
extern bool libcdsb_dict_update_uint64_cstring(vtype_dict* x, vtype_uint64 key, const char* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_uint64_string (vtype_dict* x, vtype_uint64 key, const vtype_string* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_uint64_array (vtype_dict* x, vtype_uint64 key, const vtype_array* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_uint64_list (vtype_dict* x, vtype_uint64 key, const vtype_list* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_uint64_map (vtype_dict* x, vtype_uint64 key, const vtype_map* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_uint64_vset (vtype_dict* x, vtype_uint64 key, const vtype_set* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_uint64_dict (vtype_dict* x, vtype_uint64 key, const vtype_dict* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_uint64_boolean(vtype_dict* x, vtype_uint64 key, vtype_bool value) Nonnull__(1);
extern bool libcdsb_dict_update_uint64_int8 (vtype_dict* x, vtype_uint64 key, vtype_int8 value) Nonnull__(1);
extern bool libcdsb_dict_update_uint64_int16 (vtype_dict* x, vtype_uint64 key, vtype_int16 value) Nonnull__(1);
extern bool libcdsb_dict_update_uint64_int32 (vtype_dict* x, vtype_uint64 key, vtype_int32 value) Nonnull__(1);
extern bool libcdsb_dict_update_uint64_int64 (vtype_dict* x, vtype_uint64 key, vtype_int64 value) Nonnull__(1);
extern bool libcdsb_dict_update_uint64_uint8 (vtype_dict* x, vtype_uint64 key, vtype_uint8 value) Nonnull__(1);
extern bool libcdsb_dict_update_uint64_uint16 (vtype_dict* x, vtype_uint64 key, vtype_uint16 value) Nonnull__(1);
extern bool libcdsb_dict_update_uint64_uint32 (vtype_dict* x, vtype_uint64 key, vtype_uint32 value) Nonnull__(1);
extern bool libcdsb_dict_update_uint64_uint64 (vtype_dict* x, vtype_uint64 key, vtype_uint64 value) Nonnull__(1);
extern bool libcdsb_dict_update_uint64_float (vtype_dict* x, vtype_uint64 key, vtype_float value) Nonnull__(1);
extern bool libcdsb_dict_update_uint64_double (vtype_dict* x, vtype_uint64 key, vtype_double value) Nonnull__(1);
extern bool libcdsb_dict_update_uint64_ldouble(vtype_dict* x, vtype_uint64 key, vtype_ldouble value) Nonnull__(1);
extern bool libcdsb_dict_update_int8_pointer(vtype_dict* x, vtype_int8 key, const void* value) Nonnull__(1);
extern bool libcdsb_dict_update_int8_cstring(vtype_dict* x, vtype_int8 key, const char* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_int8_string (vtype_dict* x, vtype_int8 key, const vtype_string* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_int8_array (vtype_dict* x, vtype_int8 key, const vtype_array* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_int8_list (vtype_dict* x, vtype_int8 key, const vtype_list* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_int8_map (vtype_dict* x, vtype_int8 key, const vtype_map* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_int8_vset (vtype_dict* x, vtype_int8 key, const vtype_set* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_int8_dict (vtype_dict* x, vtype_int8 key, const vtype_dict* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_int8_boolean(vtype_dict* x, vtype_int8 key, vtype_bool value) Nonnull__(1);
extern bool libcdsb_dict_update_int8_int8 (vtype_dict* x, vtype_int8 key, vtype_int8 value) Nonnull__(1);
extern bool libcdsb_dict_update_int8_int16 (vtype_dict* x, vtype_int8 key, vtype_int16 value) Nonnull__(1);
extern bool libcdsb_dict_update_int8_int32 (vtype_dict* x, vtype_int8 key, vtype_int32 value) Nonnull__(1);
extern bool libcdsb_dict_update_int8_int64 (vtype_dict* x, vtype_int8 key, vtype_int64 value) Nonnull__(1);
extern bool libcdsb_dict_update_int8_uint8 (vtype_dict* x, vtype_int8 key, vtype_uint8 value) Nonnull__(1);
extern bool libcdsb_dict_update_int8_uint16 (vtype_dict* x, vtype_int8 key, vtype_uint16 value) Nonnull__(1);
extern bool libcdsb_dict_update_int8_uint32 (vtype_dict* x, vtype_int8 key, vtype_uint32 value) Nonnull__(1);
extern bool libcdsb_dict_update_int8_uint64 (vtype_dict* x, vtype_int8 key, vtype_uint64 value) Nonnull__(1);
extern bool libcdsb_dict_update_int8_float (vtype_dict* x, vtype_int8 key, vtype_float value) Nonnull__(1);
extern bool libcdsb_dict_update_int8_double (vtype_dict* x, vtype_int8 key, vtype_double value) Nonnull__(1);
extern bool libcdsb_dict_update_int8_ldouble(vtype_dict* x, vtype_int8 key, vtype_ldouble value) Nonnull__(1);
extern bool libcdsb_dict_update_int16_pointer(vtype_dict* x, vtype_int16 key, const void* value) Nonnull__(1);
extern bool libcdsb_dict_update_int16_cstring(vtype_dict* x, vtype_int16 key, const char* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_int16_string (vtype_dict* x, vtype_int16 key, const vtype_string* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_int16_array (vtype_dict* x, vtype_int16 key, const vtype_array* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_int16_list (vtype_dict* x, vtype_int16 key, const vtype_list* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_int16_map (vtype_dict* x, vtype_int16 key, const vtype_map* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_int16_vset (vtype_dict* x, vtype_int16 key, const vtype_set* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_int16_dict (vtype_dict* x, vtype_int16 key, const vtype_dict* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_int16_boolean(vtype_dict* x, vtype_int16 key, vtype_bool value) Nonnull__(1);
extern bool libcdsb_dict_update_int16_int8 (vtype_dict* x, vtype_int16 key, vtype_int8 value) Nonnull__(1);
extern bool libcdsb_dict_update_int16_int16 (vtype_dict* x, vtype_int16 key, vtype_int16 value) Nonnull__(1);
extern bool libcdsb_dict_update_int16_int32 (vtype_dict* x, vtype_int16 key, vtype_int32 value) Nonnull__(1);
extern bool libcdsb_dict_update_int16_int64 (vtype_dict* x, vtype_int16 key, vtype_int64 value) Nonnull__(1);
extern bool libcdsb_dict_update_int16_uint8 (vtype_dict* x, vtype_int16 key, vtype_uint8 value) Nonnull__(1);
extern bool libcdsb_dict_update_int16_uint16 (vtype_dict* x, vtype_int16 key, vtype_uint16 value) Nonnull__(1);
extern bool libcdsb_dict_update_int16_uint32 (vtype_dict* x, vtype_int16 key, vtype_uint32 value) Nonnull__(1);
extern bool libcdsb_dict_update_int16_uint64 (vtype_dict* x, vtype_int16 key, vtype_uint64 value) Nonnull__(1);
extern bool libcdsb_dict_update_int16_float (vtype_dict* x, vtype_int16 key, vtype_float value) Nonnull__(1);
extern bool libcdsb_dict_update_int16_double (vtype_dict* x, vtype_int16 key, vtype_double value) Nonnull__(1);
extern bool libcdsb_dict_update_int16_ldouble(vtype_dict* x, vtype_int16 key, vtype_ldouble value) Nonnull__(1);
extern bool libcdsb_dict_update_int32_pointer(vtype_dict* x, vtype_int32 key, const void* value) Nonnull__(1);
extern bool libcdsb_dict_update_int32_cstring(vtype_dict* x, vtype_int32 key, const char* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_int32_string (vtype_dict* x, vtype_int32 key, const vtype_string* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_int32_array (vtype_dict* x, vtype_int32 key, const vtype_array* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_int32_list (vtype_dict* x, vtype_int32 key, const vtype_list* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_int32_map (vtype_dict* x, vtype_int32 key, const vtype_map* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_int32_vset (vtype_dict* x, vtype_int32 key, const vtype_set* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_int32_dict (vtype_dict* x, vtype_int32 key, const vtype_dict* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_int32_boolean(vtype_dict* x, vtype_int32 key, vtype_bool value) Nonnull__(1);
extern bool libcdsb_dict_update_int32_int8 (vtype_dict* x, vtype_int32 key, vtype_int8 value) Nonnull__(1);
extern bool libcdsb_dict_update_int32_int16 (vtype_dict* x, vtype_int32 key, vtype_int16 value) Nonnull__(1);
extern bool libcdsb_dict_update_int32_int32 (vtype_dict* x, vtype_int32 key, vtype_int32 value) Nonnull__(1);
extern bool libcdsb_dict_update_int32_int64 (vtype_dict* x, vtype_int32 key, vtype_int64 value) Nonnull__(1);
extern bool libcdsb_dict_update_int32_uint8 (vtype_dict* x, vtype_int32 key, vtype_uint8 value) Nonnull__(1);
extern bool libcdsb_dict_update_int32_uint16 (vtype_dict* x, vtype_int32 key, vtype_uint16 value) Nonnull__(1);
extern bool libcdsb_dict_update_int32_uint32 (vtype_dict* x, vtype_int32 key, vtype_uint32 value) Nonnull__(1);
extern bool libcdsb_dict_update_int32_uint64 (vtype_dict* x, vtype_int32 key, vtype_uint64 value) Nonnull__(1);
extern bool libcdsb_dict_update_int32_float (vtype_dict* x, vtype_int32 key, vtype_float value) Nonnull__(1);
extern bool libcdsb_dict_update_int32_double (vtype_dict* x, vtype_int32 key, vtype_double value) Nonnull__(1);
extern bool libcdsb_dict_update_int32_ldouble(vtype_dict* x, vtype_int32 key, vtype_ldouble value) Nonnull__(1);
extern bool libcdsb_dict_update_int64_pointer(vtype_dict* x, vtype_int64 key, const void* value) Nonnull__(1);
extern bool libcdsb_dict_update_int64_cstring(vtype_dict* x, vtype_int64 key, const char* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_int64_string (vtype_dict* x, vtype_int64 key, const vtype_string* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_int64_array (vtype_dict* x, vtype_int64 key, const vtype_array* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_int64_list (vtype_dict* x, vtype_int64 key, const vtype_list* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_int64_map (vtype_dict* x, vtype_int64 key, const vtype_map* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_int64_vset (vtype_dict* x, vtype_int64 key, const vtype_set* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_int64_dict (vtype_dict* x, vtype_int64 key, const vtype_dict* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_int64_boolean(vtype_dict* x, vtype_int64 key, vtype_bool value) Nonnull__(1);
extern bool libcdsb_dict_update_int64_int8 (vtype_dict* x, vtype_int64 key, vtype_int8 value) Nonnull__(1);
extern bool libcdsb_dict_update_int64_int16 (vtype_dict* x, vtype_int64 key, vtype_int16 value) Nonnull__(1);
extern bool libcdsb_dict_update_int64_int32 (vtype_dict* x, vtype_int64 key, vtype_int32 value) Nonnull__(1);
extern bool libcdsb_dict_update_int64_int64 (vtype_dict* x, vtype_int64 key, vtype_int64 value) Nonnull__(1);
extern bool libcdsb_dict_update_int64_uint8 (vtype_dict* x, vtype_int64 key, vtype_uint8 value) Nonnull__(1);
extern bool libcdsb_dict_update_int64_uint16 (vtype_dict* x, vtype_int64 key, vtype_uint16 value) Nonnull__(1);
extern bool libcdsb_dict_update_int64_uint32 (vtype_dict* x, vtype_int64 key, vtype_uint32 value) Nonnull__(1);
extern bool libcdsb_dict_update_int64_uint64 (vtype_dict* x, vtype_int64 key, vtype_uint64 value) Nonnull__(1);
extern bool libcdsb_dict_update_int64_float (vtype_dict* x, vtype_int64 key, vtype_float value) Nonnull__(1);
extern bool libcdsb_dict_update_int64_double (vtype_dict* x, vtype_int64 key, vtype_double value) Nonnull__(1);
extern bool libcdsb_dict_update_int64_ldouble(vtype_dict* x, vtype_int64 key, vtype_ldouble value) Nonnull__(1);
extern bool libcdsb_dict_update_float_pointer(vtype_dict* x, vtype_float key, const void* value) Nonnull__(1);
extern bool libcdsb_dict_update_float_cstring(vtype_dict* x, vtype_float key, const char* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_float_string (vtype_dict* x, vtype_float key, const vtype_string* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_float_array (vtype_dict* x, vtype_float key, const vtype_array* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_float_list (vtype_dict* x, vtype_float key, const vtype_list* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_float_map (vtype_dict* x, vtype_float key, const vtype_map* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_float_vset (vtype_dict* x, vtype_float key, const vtype_set* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_float_dict (vtype_dict* x, vtype_float key, const vtype_dict* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_float_boolean(vtype_dict* x, vtype_float key, vtype_bool value) Nonnull__(1);
extern bool libcdsb_dict_update_float_int8 (vtype_dict* x, vtype_float key, vtype_int8 value) Nonnull__(1);
extern bool libcdsb_dict_update_float_int16 (vtype_dict* x, vtype_float key, vtype_int16 value) Nonnull__(1);
extern bool libcdsb_dict_update_float_int32 (vtype_dict* x, vtype_float key, vtype_int32 value) Nonnull__(1);
extern bool libcdsb_dict_update_float_int64 (vtype_dict* x, vtype_float key, vtype_int64 value) Nonnull__(1);
extern bool libcdsb_dict_update_float_uint8 (vtype_dict* x, vtype_float key, vtype_uint8 value) Nonnull__(1);
extern bool libcdsb_dict_update_float_uint16 (vtype_dict* x, vtype_float key, vtype_uint16 value) Nonnull__(1);
extern bool libcdsb_dict_update_float_uint32 (vtype_dict* x, vtype_float key, vtype_uint32 value) Nonnull__(1);
extern bool libcdsb_dict_update_float_uint64 (vtype_dict* x, vtype_float key, vtype_uint64 value) Nonnull__(1);
extern bool libcdsb_dict_update_float_float (vtype_dict* x, vtype_float key, vtype_float value) Nonnull__(1);
extern bool libcdsb_dict_update_float_double (vtype_dict* x, vtype_float key, vtype_double value) Nonnull__(1);
extern bool libcdsb_dict_update_float_ldouble(vtype_dict* x, vtype_float key, vtype_ldouble value) Nonnull__(1);
extern bool libcdsb_dict_update_double_pointer(vtype_dict* x, vtype_double key, const void* value) Nonnull__(1);
extern bool libcdsb_dict_update_double_cstring(vtype_dict* x, vtype_double key, const char* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_double_string (vtype_dict* x, vtype_double key, const vtype_string* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_double_array (vtype_dict* x, vtype_double key, const vtype_array* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_double_list (vtype_dict* x, vtype_double key, const vtype_list* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_double_map (vtype_dict* x, vtype_double key, const vtype_map* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_double_vset (vtype_dict* x, vtype_double key, const vtype_set* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_double_dict (vtype_dict* x, vtype_double key, const vtype_dict* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_double_boolean(vtype_dict* x, vtype_double key, vtype_bool value) Nonnull__(1);
extern bool libcdsb_dict_update_double_int8 (vtype_dict* x, vtype_double key, vtype_int8 value) Nonnull__(1);
extern bool libcdsb_dict_update_double_int16 (vtype_dict* x, vtype_double key, vtype_int16 value) Nonnull__(1);
extern bool libcdsb_dict_update_double_int32 (vtype_dict* x, vtype_double key, vtype_int32 value) Nonnull__(1);
extern bool libcdsb_dict_update_double_int64 (vtype_dict* x, vtype_double key, vtype_int64 value) Nonnull__(1);
extern bool libcdsb_dict_update_double_uint8 (vtype_dict* x, vtype_double key, vtype_uint8 value) Nonnull__(1);
extern bool libcdsb_dict_update_double_uint16 (vtype_dict* x, vtype_double key, vtype_uint16 value) Nonnull__(1);
extern bool libcdsb_dict_update_double_uint32 (vtype_dict* x, vtype_double key, vtype_uint32 value) Nonnull__(1);
extern bool libcdsb_dict_update_double_uint64 (vtype_dict* x, vtype_double key, vtype_uint64 value) Nonnull__(1);
extern bool libcdsb_dict_update_double_float (vtype_dict* x, vtype_double key, vtype_float value) Nonnull__(1);
extern bool libcdsb_dict_update_double_double (vtype_dict* x, vtype_double key, vtype_double value) Nonnull__(1);
extern bool libcdsb_dict_update_double_ldouble(vtype_dict* x, vtype_double key, vtype_ldouble value) Nonnull__(1);
extern bool libcdsb_dict_update_ldouble_pointer(vtype_dict* x, vtype_ldouble key, const void* value) Nonnull__(1);
extern bool libcdsb_dict_update_ldouble_cstring(vtype_dict* x, vtype_ldouble key, const char* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_ldouble_string (vtype_dict* x, vtype_ldouble key, const vtype_string* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_ldouble_array (vtype_dict* x, vtype_ldouble key, const vtype_array* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_ldouble_list (vtype_dict* x, vtype_ldouble key, const vtype_list* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_ldouble_map (vtype_dict* x, vtype_ldouble key, const vtype_map* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_ldouble_vset (vtype_dict* x, vtype_ldouble key, const vtype_set* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_ldouble_dict (vtype_dict* x, vtype_ldouble key, const vtype_dict* value) Nonnull__(1,3);
extern bool libcdsb_dict_update_ldouble_boolean(vtype_dict* x, vtype_ldouble key, vtype_bool value) Nonnull__(1);
extern bool libcdsb_dict_update_ldouble_int8 (vtype_dict* x, vtype_ldouble key, vtype_int8 value) Nonnull__(1);
extern bool libcdsb_dict_update_ldouble_int16 (vtype_dict* x, vtype_ldouble key, vtype_int16 value) Nonnull__(1);
extern bool libcdsb_dict_update_ldouble_int32 (vtype_dict* x, vtype_ldouble key, vtype_int32 value) Nonnull__(1);
extern bool libcdsb_dict_update_ldouble_int64 (vtype_dict* x, vtype_ldouble key, vtype_int64 value) Nonnull__(1);
extern bool libcdsb_dict_update_ldouble_uint8 (vtype_dict* x, vtype_ldouble key, vtype_uint8 value) Nonnull__(1);
extern bool libcdsb_dict_update_ldouble_uint16 (vtype_dict* x, vtype_ldouble key, vtype_uint16 value) Nonnull__(1);
extern bool libcdsb_dict_update_ldouble_uint32 (vtype_dict* x, vtype_ldouble key, vtype_uint32 value) Nonnull__(1);
extern bool libcdsb_dict_update_ldouble_uint64 (vtype_dict* x, vtype_ldouble key, vtype_uint64 value) Nonnull__(1);
extern bool libcdsb_dict_update_ldouble_float (vtype_dict* x, vtype_ldouble key, vtype_float value) Nonnull__(1);
extern bool libcdsb_dict_update_ldouble_double (vtype_dict* x, vtype_ldouble key, vtype_double value) Nonnull__(1);
extern bool libcdsb_dict_update_ldouble_ldouble(vtype_dict* x, vtype_ldouble key, vtype_ldouble value) Nonnull__(1);
extern bool libcdsb_dict_update (vtype_dict* x, const void* key, vtype key_type, const void* value, vtype value_type) Nonnull__(1);
extern bool libcdsb_dict_inject (vtype_dict* x, const void* key, vtype key_type, const void* value, vtype value_type) Nonnull__(1);
extern bool libcdsb_dict_inject_key (vtype_dict* x, const void* key, vtype key_type, const void* value, vtype value_type) Nonnull__(1);
extern bool libcdsb_dict_inject_value (vtype_dict* x, const void* key, vtype key_type, const void* value, vtype value_type) Nonnull__(1);
extern int libcdsb_dict_find (vtype_dict* x, const void* key, vtype key_type, void* data, dict_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_dict_foreach (vtype_dict* x, void* data, dict_access_callback, bool flush) Nonnull__(1,3);
extern bool libcdsb_dict_shrink_to_fit(vtype_dict* x) Nonnull__(1);
#endif /* LIBCDSB_DICT_H */

View File

@ -1,21 +0,0 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "../array.h"
#ifndef LIBCDSB_EXTRA_ARRAY_H
#define LIBCDSB_EXTRA_ARRAY_H
#define array_get_by_index(s, index, data, callback) libcdsb_array_get(s, index, data, callback, 0)
#define array_pop_by_index(s, index, data, callback) libcdsb_array_get(s, index, data, callback, 1)
#define array_remove_by_index(s, index) libcdsb_array_get(s, index, 0, 0, 1)
#define array_foreach(x, data, callback) libcdsb_array_foreach(x, data, callback, 0)
extern ssize_t libcdsb_array_push (vtype_array* x, const void* value, vtype value_type) Nonnull__(1);
extern size_t libcdsb_array_count (const vtype_array* s, const void* value, vtype type) Pure__ Warn_unused_result__ Nonnull__(1);
extern int libcdsb_array_find (vtype_array* x, const void* value, vtype type, void* data, array_access_callback, bool reverse, bool cut) Nonnull__(1);
extern int libcdsb_array_get (vtype_array* x, ssize_t index, void* data, array_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_array_foreach(vtype_array* x, void* data, array_access_callback, bool flush) Nonnull__(1,3);
#endif /* LIBCDSB_EXTRA_ARRAY_H */

View File

@ -1,29 +0,0 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "../dict.h"
#ifndef LIBCDSB_EXTRA_DICT_H
#define LIBCDSB_EXTRA_DICT_H
#define dict_foreach(x, data, callback) libcdsb_dict_foreach(x, data, callback, 0)
extern bool libcdsb_dict_update (vtype_dict* x, const void* key, vtype key_type, const void* value, vtype value_type) Nonnull__(1);
extern int libcdsb_dict_find (vtype_dict* x, const void* key, vtype key_type, void* data, dict_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_dict_foreach (vtype_dict* x, void* data, dict_access_callback, bool flush) Nonnull__(1,3);
extern bool libcdsb_dict_shrink_to_fit(vtype_dict* x) Nonnull__(1);
#endif /* LIBCDSB_EXTRA_DICT_H */
#if defined(LIBCDSB_LIST_H) && !defined(LIBCDSB_EXTRA_DICT_H_EXT)
#define LIBCDSB_EXTRA_DICT_H_EXT
#define dict_copy_keys libcdsb_dict_copy_keys
#define dict_duplicate_keys libcdsb_dict_duplicate_keys
#define dict_init_keys libcdsb_dict_init_keys
extern vtype_list libcdsb_dict_copy_keys (const vtype_dict* s) Nonnull__(1);
extern vtype_list* libcdsb_dict_duplicate_keys(const vtype_dict* s) Nonnull__(1);
extern void libcdsb_dict_init_keys (vtype_list* x, const vtype_dict* s) Nonnull__(1,2);
#endif /* LIBCDSB_EXTRA_DICT_H_EXT */

View File

@ -1,22 +0,0 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "../list.h"
#ifndef LIBCDSB_EXTRA_LIST_H
#define LIBCDSB_EXTRA_LIST_H
#define list_get_by_index(x, index, data, callback) libcdsb_list_get(x, index, data, callback, 0)
#define list_pop_by_index(x, index, data, callback) libcdsb_list_get(x, index, data, callback, 1)
#define list_remove_by_index(x, index) libcdsb_list_get(x, index, 0, 0, 1)
#define list_foreach(x, data, callback) libcdsb_list_foreach(x, data, callback, 0)
extern bool libcdsb_list_update(vtype_list* x, ssize_t index, const void* value, vtype type, int ins_direction) Nonnull__(1);
extern size_t libcdsb_list_count(const vtype_list* s, const void* value, vtype type) Pure__ Warn_unused_result__ Nonnull__(1);
extern int libcdsb_list_find (vtype_list* x, const void* value, vtype type, void* data, list_access_callback, bool reverse, bool cut) Nonnull__(1);
extern int libcdsb_list_get (vtype_list* x, ssize_t index, void* data, list_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_list_foreach(vtype_list* x, void* data, list_access_callback, bool flush) Nonnull__(1,3);
#endif /* LIBCDSB_EXTRA_LIST_H */

View File

@ -1,42 +0,0 @@
/* 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
#define map_foreach(x, data, callback) libcdsb_map_foreach(x, data, callback, 0)
extern bool libcdsb_map_update (vtype_map* x, const void* key, vtype key_type, const void* value, vtype value_type) Nonnull__(1);
extern int libcdsb_map_find (vtype_map* x, const void* key, vtype key_type, void* data, map_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_map_foreach(vtype_map* x, void* data, map_access_callback, bool flush) Nonnull__(1,3);
#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 */

View File

@ -1,15 +0,0 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "../set.h"
#ifndef LIBCDSB_EXTRA_SET_H
#define LIBCDSB_EXTRA_SET_H
#define vset_foreach(x, data, callback) libcdsb_vset_foreach(x, data, callback, 0)
extern bool libcdsb_vset_insert (vtype_set* x, const void* value, vtype type) Nonnull__(1);
extern int libcdsb_vset_find (vtype_set* x, const void* value, vtype type, void* data, vset_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_vset_foreach(vtype_set* x, void* data, vset_access_callback, bool flush) Nonnull__(1,3);
#endif /* LIBCDSB_EXTRA_SET_H */

View File

@ -1,84 +0,0 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "../string.h"
#ifndef LIBCDSB_EXTRA_STRING_H
#define LIBCDSB_EXTRA_STRING_H
/*#####################################################################################################################*/
#define string_split(s, sep, maxn) _LIBCDSB_GenericS(libcdsb_string, split, sep)(s, sep, maxn)
#define string_case_compare string_compare_case_insensitive
#define string_replace_r(x, src, dest, maxn) _LIBCDSB_GenericS2(libcdsb_string, replace_r, src, dest)(x, src, dest, maxn)
#define string_trim(x, arg) _LIBCDSB_GenericS(libcdsb_string, trim, arg)(x, arg, 0)
#define string_ltrim(x, arg) _LIBCDSB_GenericS(libcdsb_string, trim, arg)(x, arg, -1)
#define string_rtrim(x, arg) _LIBCDSB_GenericS(libcdsb_string, trim, arg)(x, arg, 1)
extern size_t string_to_lower (vtype_string* x) Nonnull__(1);
extern size_t string_to_upper (vtype_string* x) Nonnull__(1);
extern size_t string_capitalize(vtype_string* x) Nonnull__(1);
extern size_t string_reverse (vtype_string* x) Nonnull__(1);
extern size_t string_align_center(vtype_string* x, size_t padsize, int padchr) Nonnull__(1);
extern size_t string_align_right (vtype_string* x, size_t padsize, int padchr) Nonnull__(1);
extern size_t string_align_left (vtype_string* x, size_t padsize, int padchr) Nonnull__(1);
extern void libcdsb_string_replace(vtype_string* x, char* dest, size_t dest_nmemb, const char* src, size_t nmemb) Nonnull__(1,2);
/*#####################################################################################################################*/
extern int string_compare_case_insensitive(const vtype_string* s0, const vtype_string* s1) Pure__ Warn_unused_result__ Nonnull__(1,2);
inline vtype_array libcdsb_string_split_string (const vtype_string* s, const vtype_string* sep, size_t maxn) Nonnull__(1) Always_inline__;
extern vtype_array libcdsb_string_split_cstring(const vtype_string* s, const char* sep, size_t maxn) Nonnull__(1);
extern vtype_array libcdsb_string_split_char (const vtype_string* s, int chr, size_t maxn) Nonnull__(1);
inline void libcdsb_string_trim_string (vtype_string* x, const vtype_string* s, int direction) Nonnull__(1) Always_inline__;
extern void libcdsb_string_trim_cstring(vtype_string* x, const char* s, int direction) Nonnull__(1);
extern void libcdsb_string_trim_char (vtype_string* x, int sc, int direction) Nonnull__(1);
inline size_t libcdsb_string_replace_r_string_string (vtype_string*restrict x, const vtype_string*restrict src, const vtype_string*restrict dest, size_t maxn) Nonnull__(1) Always_inline__;
inline size_t libcdsb_string_replace_r_string_cstring (vtype_string*restrict x, const vtype_string*restrict src, const char*restrict dest, size_t maxn) Nonnull__(1) Always_inline__;
inline size_t libcdsb_string_replace_r_string_char (vtype_string*restrict x, const vtype_string*restrict src, int dest, size_t maxn) Nonnull__(1) Always_inline__;
inline size_t libcdsb_string_replace_r_cstring_string (vtype_string*restrict x, const char*restrict src, const vtype_string*restrict dest, size_t maxn) Nonnull__(1) Always_inline__;
extern size_t libcdsb_string_replace_r_cstring_cstring(vtype_string*restrict x, const char*restrict src, const char*restrict dest, size_t maxn) Nonnull__(1);
extern size_t libcdsb_string_replace_r_cstring_char (vtype_string*restrict x, const char*restrict src, int dest, size_t maxn) Nonnull__(1);
inline size_t libcdsb_string_replace_r_char_string (vtype_string*restrict x, int src, const vtype_string*restrict dest, size_t maxn) Nonnull__(1) Always_inline__;
extern size_t libcdsb_string_replace_r_char_cstring (vtype_string*restrict x, int src, const char*restrict dest, size_t maxn) Nonnull__(1);
#define libcdsb_string_replace_r_char_char libcdsb_string_replace_char_char
/*#####################################################################################################################*/
inline vtype_array libcdsb_string_split_string(const vtype_string* x, const vtype_string* sep, size_t maxn) {
return string_split(x, sep->buffer, maxn);
}
inline void libcdsb_string_trim_string(vtype_string* x, const vtype_string* s, int direction) {
return libcdsb_string_trim_cstring (x, s->buffer, direction);
}
inline size_t libcdsb_string_replace_r_string_string (vtype_string*restrict x, const vtype_string*restrict src, const vtype_string*restrict dest, size_t maxn) {
return string_replace_r(x, src->buffer, dest->buffer, maxn);
}
inline size_t libcdsb_string_replace_r_string_cstring(vtype_string*restrict x, const vtype_string*restrict src, const char*restrict dest, size_t maxn) {
return string_replace_r(x, src->buffer, dest, maxn);
}
inline size_t libcdsb_string_replace_r_cstring_string(vtype_string*restrict x, const char*restrict src, const vtype_string*restrict dest, size_t maxn) {
return string_replace_r(x, src, dest->buffer, maxn);
}
inline size_t libcdsb_string_replace_r_string_char (vtype_string*restrict x, const vtype_string*restrict src, int dest, size_t maxn) {
return string_replace_r(x, src->buffer, dest, maxn);
}
inline size_t libcdsb_string_replace_r_char_string (vtype_string*restrict x, int src, const vtype_string*restrict dest, size_t maxn) {
return string_replace_r(x, src, dest->buffer, maxn);
}
#endif /* LIBCDSB_EXTRA_STRING_H */

View File

@ -1,12 +0,0 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "../vtype.h"
#ifndef LIBCDSB_EXTRA_VTYPE_H
#define LIBCDSB_EXTRA_VTYPE_H
extern const char* libcdsb_vtype_name(vtype t) Warn_unused_result__;
extern const char* libcdsb_vtype_stringify(const void* value, vtype t) Warn_unused_result__;
#endif /* LIBCDSB_EXTRA_VTYPE_H */

View File

@ -1,97 +1,53 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "__generics.h"
#include "bits/__generics.h"
#include "vtype.h"
#ifndef LIBCDSB_LIST_H
#define LIBCDSB_LIST_H
/*#####################################################################################################################*/
typedef int (*list_access_callback)(void* value, ssize_t index, vtype type, void* data);
extern void list_init (vtype_list* x) Nonnull__(1);
/*#####################################################################################################################*/
inline void list_init (vtype_list* x) Always_inline__ Nonnull__(1);
extern void list_extend (vtype_list* x, const vtype_list* s) Nonnull__(1,2);
extern size_t list_slice (vtype_list* x, vtype_list* src, ssize_t index, size_t count, bool cut) Nonnull__(1,2);
extern void list_sort (vtype_list* x) Nonnull__(1);
extern void list_reverse(vtype_list* x) Nonnull__(1);
#define list_pop(x, value, data, callback) _LIBCDSB_Generic(libcdsb_list, find, value)(x, value, data, callback, 0, 1)
#define list_find(x, value, data, callback) _LIBCDSB_Generic(libcdsb_list, find, value)(x, value, data, callback, 0, 0)
#define list_rfind(x, value, data, callback) _LIBCDSB_Generic(libcdsb_list, find, value)(x, value, data, callback, 1, 0)
#define list_countof(x, value) _LIBCDSB_Generic(libcdsb_list, count, value)(x, value)
#define list_remove(x, value) list_pop(x, value, 0, 0)
#define in_list(x, value) (list_find(x, value, 0, 0) == 0)
#define list_insert(x, index, value) _LIBCDSB_Generic(libcdsb_list, update, value)(x, index, value, -1)
#define list_replace(x, index, value) _LIBCDSB_Generic(libcdsb_list, update, value)(x, index, value, 0)
#define list_push_back(x, value) _LIBCDSB_Generic(libcdsb_list, update, value)(x, -1, value, 1)
#define list_push_front(x, value) _LIBCDSB_Generic(libcdsb_list, update, value)(x, 0, value, -1)
inline void list_init (vtype_list* x) { x->first = x->last = 0; }
/*#####################################################################################################################*/
extern int libcdsb_list_find_pointer(vtype_list* x, const void* value, void* data, list_access_callback, bool reverse, bool cut) Nonnull__(1);
extern int libcdsb_list_find_cstring(vtype_list* x, const char* value, void* data, list_access_callback, bool reverse, bool cut) Nonnull__(1,2);
extern int libcdsb_list_find_string (vtype_list* x, const vtype_string* value, void* data, list_access_callback, bool reverse, bool cut) Nonnull__(1,2);
extern int libcdsb_list_find_array (vtype_list* x, const vtype_array* value, void* data, list_access_callback, bool reverse, bool cut) Nonnull__(1,2);
extern int libcdsb_list_find_list (vtype_list* x, const vtype_list* value, void* data, list_access_callback, bool reverse, bool cut) Nonnull__(1,2);
extern int libcdsb_list_find_map (vtype_list* x, const vtype_map* value, void* data, list_access_callback, bool reverse, bool cut) Nonnull__(1,2);
extern int libcdsb_list_find_vset (vtype_list* x, const vtype_set* value, void* data, list_access_callback, bool reverse, bool cut) Nonnull__(1,2);
extern int libcdsb_list_find_dict (vtype_list* x, const vtype_dict* value, void* data, list_access_callback, bool reverse, bool cut) Nonnull__(1,2);
extern int libcdsb_list_find_boolean(vtype_list* x, vtype_bool value, void* data, list_access_callback, bool reverse, bool cut) Nonnull__(1);
extern int libcdsb_list_find_int8 (vtype_list* x, vtype_int8 value, void* data, list_access_callback, bool reverse, bool cut) Nonnull__(1);
extern int libcdsb_list_find_int16 (vtype_list* x, vtype_int16 value, void* data, list_access_callback, bool reverse, bool cut) Nonnull__(1);
extern int libcdsb_list_find_int32 (vtype_list* x, vtype_int32 value, void* data, list_access_callback, bool reverse, bool cut) Nonnull__(1);
extern int libcdsb_list_find_int64 (vtype_list* x, vtype_int64 value, void* data, list_access_callback, bool reverse, bool cut) Nonnull__(1);
extern int libcdsb_list_find_uint8 (vtype_list* x, vtype_uint8 value, void* data, list_access_callback, bool reverse, bool cut) Nonnull__(1);
extern int libcdsb_list_find_uint16 (vtype_list* x, vtype_uint16 value, void* data, list_access_callback, bool reverse, bool cut) Nonnull__(1);
extern int libcdsb_list_find_uint32 (vtype_list* x, vtype_uint32 value, void* data, list_access_callback, bool reverse, bool cut) Nonnull__(1);
extern int libcdsb_list_find_uint64 (vtype_list* x, vtype_uint64 value, void* data, list_access_callback, bool reverse, bool cut) Nonnull__(1);
extern int libcdsb_list_find_float (vtype_list* x, vtype_float value, void* data, list_access_callback, bool reverse, bool cut) Nonnull__(1);
extern int libcdsb_list_find_double (vtype_list* x, vtype_double value, void* data, list_access_callback, bool reverse, bool cut) Nonnull__(1);
extern int libcdsb_list_find_ldouble(vtype_list* x, vtype_ldouble value, void* data, list_access_callback, bool reverse, bool cut) Nonnull__(1);
#define list_pop(x, value, data, callback) libcdsb_list_find (x, _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value), data, callback, 0, 1)
#define list_get list_find
#define list_pop_by_index(x, index, data, callback) libcdsb_list_get (x, index, data, callback, 1)
#define list_get_by_index(x, index, data, callback) libcdsb_list_get (x, index, data, callback, 0)
#define list_find(x, value, data, callback) libcdsb_list_find (x, _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value), data, callback, 0, 0)
#define list_rfind(x, value, data, callback) libcdsb_list_find (x, _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value), data, callback, 1, 0)
#define list_countof(x, value) libcdsb_list_count (x, _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value))
#define list_insert(x, index, value) libcdsb_list_insert (x, index, _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value), -1)
#define list_replace(x, index, value) libcdsb_list_insert (x, index, _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value), 0)
#define list_push_back(x, value) libcdsb_list_insert (x, -1, _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value), 1)
#define list_push_front(x, value) libcdsb_list_insert (x, 0, _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value), -1)
#define list_attach_back(x, value) libcdsb_list_attach (x, -1, _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value), 1)
#define list_attach_front(x, value) libcdsb_list_attach (x, 0, _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value), -1)
#define list_foreach(x, data, callback) libcdsb_list_foreach(x, data, callback, 0)
#define list_remove(x, value) list_pop (x, value, 0, 0)
#define list_remove_by_index(x, index) list_pop_by_index (x, index, 0, 0)
extern size_t libcdsb_list_count_pointer(const vtype_list* s, const void* value) Nonnull__(1);
extern size_t libcdsb_list_count_cstring(const vtype_list* s, const char* value) Nonnull__(1,2);
extern size_t libcdsb_list_count_string (const vtype_list* s, const vtype_string* value) Nonnull__(1,2);
extern size_t libcdsb_list_count_array (const vtype_list* s, const vtype_array* value) Nonnull__(1,2);
extern size_t libcdsb_list_count_list (const vtype_list* s, const vtype_list* value) Nonnull__(1,2);
extern size_t libcdsb_list_count_map (const vtype_list* s, const vtype_map* value) Nonnull__(1,2);
extern size_t libcdsb_list_count_vset (const vtype_list* s, const vtype_set* value) Nonnull__(1,2);
extern size_t libcdsb_list_count_dict (const vtype_list* s, const vtype_dict* value) Nonnull__(1,2);
extern size_t libcdsb_list_count_boolean(const vtype_list* s, vtype_bool value) Nonnull__(1);
extern size_t libcdsb_list_count_int8 (const vtype_list* s, vtype_int8 value) Nonnull__(1);
extern size_t libcdsb_list_count_int16 (const vtype_list* s, vtype_int16 value) Nonnull__(1);
extern size_t libcdsb_list_count_int32 (const vtype_list* s, vtype_int32 value) Nonnull__(1);
extern size_t libcdsb_list_count_int64 (const vtype_list* s, vtype_int64 value) Nonnull__(1);
extern size_t libcdsb_list_count_uint8 (const vtype_list* s, vtype_uint8 value) Nonnull__(1);
extern size_t libcdsb_list_count_uint16 (const vtype_list* s, vtype_uint16 value) Nonnull__(1);
extern size_t libcdsb_list_count_uint32 (const vtype_list* s, vtype_uint32 value) Nonnull__(1);
extern size_t libcdsb_list_count_uint64 (const vtype_list* s, vtype_uint64 value) Nonnull__(1);
extern size_t libcdsb_list_count_float (const vtype_list* s, vtype_float value) Nonnull__(1);
extern size_t libcdsb_list_count_double (const vtype_list* s, vtype_double value) Nonnull__(1);
extern size_t libcdsb_list_count_ldouble(const vtype_list* s, vtype_ldouble value) Nonnull__(1);
#define in_list(x, value) (list_get(x, value, 0, 0) == 0)
extern bool libcdsb_list_update_pointer(vtype_list* x, ssize_t index, const void* value, int ins_direction) Nonnull__(1);
extern bool libcdsb_list_update_cstring(vtype_list* x, ssize_t index, const char* value, int ins_direction) Nonnull__(1,3);
extern bool libcdsb_list_update_string (vtype_list* x, ssize_t index, const vtype_string* value, int ins_direction) Nonnull__(1,3);
extern bool libcdsb_list_update_array (vtype_list* x, ssize_t index, const vtype_array* value, int ins_direction) Nonnull__(1,3);
extern bool libcdsb_list_update_list (vtype_list* x, ssize_t index, const vtype_list* value, int ins_direction) Nonnull__(1,3);
extern bool libcdsb_list_update_map (vtype_list* x, ssize_t index, const vtype_map* value, int ins_direction) Nonnull__(1,3);
extern bool libcdsb_list_update_vset (vtype_list* x, ssize_t index, const vtype_set* value, int ins_direction) Nonnull__(1,3);
extern bool libcdsb_list_update_dict (vtype_list* x, ssize_t index, const vtype_dict* value, int ins_direction) Nonnull__(1,3);
extern bool libcdsb_list_update_boolean(vtype_list* x, ssize_t index, vtype_bool value, int ins_direction) Nonnull__(1);
extern bool libcdsb_list_update_int8 (vtype_list* x, ssize_t index, vtype_int8 value, int ins_direction) Nonnull__(1);
extern bool libcdsb_list_update_int16 (vtype_list* x, ssize_t index, vtype_int16 value, int ins_direction) Nonnull__(1);
extern bool libcdsb_list_update_int32 (vtype_list* x, ssize_t index, vtype_int32 value, int ins_direction) Nonnull__(1);
extern bool libcdsb_list_update_int64 (vtype_list* x, ssize_t index, vtype_int64 value, int ins_direction) Nonnull__(1);
extern bool libcdsb_list_update_uint8 (vtype_list* x, ssize_t index, vtype_uint8 value, int ins_direction) Nonnull__(1);
extern bool libcdsb_list_update_uint16 (vtype_list* x, ssize_t index, vtype_uint16 value, int ins_direction) Nonnull__(1);
extern bool libcdsb_list_update_uint32 (vtype_list* x, ssize_t index, vtype_uint32 value, int ins_direction) Nonnull__(1);
extern bool libcdsb_list_update_uint64 (vtype_list* x, ssize_t index, vtype_uint64 value, int ins_direction) Nonnull__(1);
extern bool libcdsb_list_update_float (vtype_list* x, ssize_t index, vtype_float value, int ins_direction) Nonnull__(1);
extern bool libcdsb_list_update_double (vtype_list* x, ssize_t index, vtype_double value, int ins_direction) Nonnull__(1);
extern bool libcdsb_list_update_ldouble(vtype_list* x, ssize_t index, vtype_ldouble value, int ins_direction) Nonnull__(1);
/*#####################################################################################################################*/
extern bool libcdsb_list_insert (vtype_list* x, ssize_t index, const void* value, vtype type, int ins_direction) Nonnull__(1);
extern bool libcdsb_list_attach (vtype_list* x, ssize_t index, const void* value, vtype type, int ins_direction) Nonnull__(1);
extern int libcdsb_list_find (vtype_list* x, const void* value, vtype type, void* data, list_access_callback, bool reverse, bool cut) Nonnull__(1);
extern int libcdsb_list_get (vtype_list* x, ssize_t index, void* data, list_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_list_foreach (vtype_list* x, void* data, list_access_callback, bool flush) Nonnull__(1,3);
extern size_t libcdsb_list_count(const vtype_list* s, const void* value, vtype type) Pure__ Warn_unused_result__ Nonnull__(1);
#endif /* LIBCDSB_LIST_H */

View File

@ -1,466 +1,35 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "__generics.h"
#include "bits/__generics.h"
#include "bits/__rbtree.h"
#include "vtype.h"
#ifndef LIBCDSB_MAP_H
#define LIBCDSB_MAP_H
/*#####################################################################################################################*/
typedef int (*map_access_callback)(const void* key, vtype key_type, void* value, vtype value_type, void* data);
/*#####################################################################################################################*/
extern void map_init(vtype_map* x, vtype key_type) Nonnull__(1);
#define map_pop(x, key, data, callback) _LIBCDSB_Generic (libcdsb_map, find, key)(x, key, data, callback, 1)
#define map_get(x, key, data, callback) _LIBCDSB_Generic (libcdsb_map, find, key)(x, key, data, callback, 0)
#define map_update(x, key, value) _LIBCDSB_Generic2(libcdsb_map, update, key, value)(x, key, value)
#define map_remove(x, key) map_pop(x, key, 0, 0)
/*#####################################################################################################################*/
#define in_map(x, key) (map_get(&x, key, 0, 0) == 0)
#define map_pop(x, key, data, callback) libcdsb_map_find (x, _LIBCDSB_value_pointer(key), _LIBCDSB_vtypeof(key), data, callback, 1)
#define map_get(x, key, data, callback) libcdsb_map_find (x, _LIBCDSB_value_pointer(key), _LIBCDSB_vtypeof(key), data, callback, 0)
#define map_update(x, key, value) libcdsb_map_update (x, _LIBCDSB_value_pointer(key), _LIBCDSB_vtypeof(key), _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value))
#define map_inject(x, key, value) libcdsb_map_inject (x, _LIBCDSB_value_pointer(key), _LIBCDSB_vtypeof(key), _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value))
#define map_foreach(x, data, callback) libcdsb_map_foreach (x, data, callback, RBFOREACH_UNSPECIFIED, 0)
#define map_remove(x, key) map_pop (x, key, 0, 0)
#define in_map(x, key) (map_get(x, key, 0, 0) == 0)
/*#####################################################################################################################*/
extern int libcdsb_map_find_pointer(vtype_map* x, const void* key, void* data, map_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_map_find_cstring(vtype_map* x, const char* key, void* data, map_access_callback, bool cut) Nonnull__(1,2);
extern int libcdsb_map_find_string (vtype_map* x, const vtype_string* key, void* data, map_access_callback, bool cut) Nonnull__(1,2);
extern int libcdsb_map_find_array (vtype_map* x, const vtype_array* key, void* data, map_access_callback, bool cut) Nonnull__(1,2);
extern int libcdsb_map_find_list (vtype_map* x, const vtype_list* key, void* data, map_access_callback, bool cut) Nonnull__(1,2);
extern int libcdsb_map_find_map (vtype_map* x, const vtype_map* key, void* data, map_access_callback, bool cut) Nonnull__(1,2);
extern int libcdsb_map_find_vset (vtype_map* x, const vtype_set* key, void* data, map_access_callback, bool cut) Nonnull__(1,2);
extern int libcdsb_map_find_dict (vtype_map* x, const vtype_dict* key, void* data, map_access_callback, bool cut) Nonnull__(1,2);
extern int libcdsb_map_find_boolean(vtype_map* x, vtype_bool key, void* data, map_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_map_find_int8 (vtype_map* x, vtype_int8 key, void* data, map_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_map_find_int16 (vtype_map* x, vtype_int16 key, void* data, map_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_map_find_int32 (vtype_map* x, vtype_int32 key, void* data, map_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_map_find_int64 (vtype_map* x, vtype_int64 key, void* data, map_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_map_find_uint8 (vtype_map* x, vtype_uint8 key, void* data, map_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_map_find_uint16 (vtype_map* x, vtype_uint16 key, void* data, map_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_map_find_uint32 (vtype_map* x, vtype_uint32 key, void* data, map_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_map_find_uint64 (vtype_map* x, vtype_uint64 key, void* data, map_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_map_find_float (vtype_map* x, vtype_float key, void* data, map_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_map_find_double (vtype_map* x, vtype_double key, void* data, map_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_map_find_ldouble(vtype_map* x, vtype_ldouble key, void* data, map_access_callback, bool cut) Nonnull__(1);
extern bool libcdsb_map_update_pointer_pointer(vtype_map* x, const void* key, const void* value) Nonnull__(1);
extern bool libcdsb_map_update_pointer_cstring(vtype_map* x, const void* key, const char* value) Nonnull__(1,3);
extern bool libcdsb_map_update_pointer_string (vtype_map* x, const void* key, const vtype_string* value) Nonnull__(1,3);
extern bool libcdsb_map_update_pointer_array (vtype_map* x, const void* key, const vtype_array* value) Nonnull__(1,3);
extern bool libcdsb_map_update_pointer_list (vtype_map* x, const void* key, const vtype_list* value) Nonnull__(1,3);
extern bool libcdsb_map_update_pointer_map (vtype_map* x, const void* key, const vtype_map* value) Nonnull__(1,3);
extern bool libcdsb_map_update_pointer_vset (vtype_map* x, const void* key, const vtype_set* value) Nonnull__(1,3);
extern bool libcdsb_map_update_pointer_dict (vtype_map* x, const void* key, const vtype_dict* value) Nonnull__(1,3);
extern bool libcdsb_map_update_pointer_boolean(vtype_map* x, const void* key, vtype_bool value) Nonnull__(1);
extern bool libcdsb_map_update_pointer_int8 (vtype_map* x, const void* key, vtype_int8 value) Nonnull__(1);
extern bool libcdsb_map_update_pointer_int16 (vtype_map* x, const void* key, vtype_int16 value) Nonnull__(1);
extern bool libcdsb_map_update_pointer_int32 (vtype_map* x, const void* key, vtype_int32 value) Nonnull__(1);
extern bool libcdsb_map_update_pointer_int64 (vtype_map* x, const void* key, vtype_int64 value) Nonnull__(1);
extern bool libcdsb_map_update_pointer_uint8 (vtype_map* x, const void* key, vtype_uint8 value) Nonnull__(1);
extern bool libcdsb_map_update_pointer_uint16 (vtype_map* x, const void* key, vtype_uint16 value) Nonnull__(1);
extern bool libcdsb_map_update_pointer_uint32 (vtype_map* x, const void* key, vtype_uint32 value) Nonnull__(1);
extern bool libcdsb_map_update_pointer_uint64 (vtype_map* x, const void* key, vtype_uint64 value) Nonnull__(1);
extern bool libcdsb_map_update_pointer_float (vtype_map* x, const void* key, vtype_float value) Nonnull__(1);
extern bool libcdsb_map_update_pointer_double (vtype_map* x, const void* key, vtype_double value) Nonnull__(1);
extern bool libcdsb_map_update_pointer_ldouble(vtype_map* x, const void* key, vtype_ldouble value) Nonnull__(1);
extern bool libcdsb_map_update_cstring_pointer(vtype_map* x, const char* key, const void* value) Nonnull__(1,2);
extern bool libcdsb_map_update_cstring_cstring(vtype_map* x, const char* key, const char* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_cstring_string (vtype_map* x, const char* key, const vtype_string* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_cstring_array (vtype_map* x, const char* key, const vtype_array* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_cstring_list (vtype_map* x, const char* key, const vtype_list* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_cstring_map (vtype_map* x, const char* key, const vtype_map* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_cstring_vset (vtype_map* x, const char* key, const vtype_set* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_cstring_dict (vtype_map* x, const char* key, const vtype_dict* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_cstring_boolean(vtype_map* x, const char* key, vtype_bool value) Nonnull__(1,2);
extern bool libcdsb_map_update_cstring_int8 (vtype_map* x, const char* key, vtype_int8 value) Nonnull__(1,2);
extern bool libcdsb_map_update_cstring_int16 (vtype_map* x, const char* key, vtype_int16 value) Nonnull__(1,2);
extern bool libcdsb_map_update_cstring_int32 (vtype_map* x, const char* key, vtype_int32 value) Nonnull__(1,2);
extern bool libcdsb_map_update_cstring_int64 (vtype_map* x, const char* key, vtype_int64 value) Nonnull__(1,2);
extern bool libcdsb_map_update_cstring_uint8 (vtype_map* x, const char* key, vtype_uint8 value) Nonnull__(1,2);
extern bool libcdsb_map_update_cstring_uint16 (vtype_map* x, const char* key, vtype_uint16 value) Nonnull__(1,2);
extern bool libcdsb_map_update_cstring_uint32 (vtype_map* x, const char* key, vtype_uint32 value) Nonnull__(1,2);
extern bool libcdsb_map_update_cstring_uint64 (vtype_map* x, const char* key, vtype_uint64 value) Nonnull__(1,2);
extern bool libcdsb_map_update_cstring_float (vtype_map* x, const char* key, vtype_float value) Nonnull__(1,2);
extern bool libcdsb_map_update_cstring_double (vtype_map* x, const char* key, vtype_double value) Nonnull__(1,2);
extern bool libcdsb_map_update_cstring_ldouble(vtype_map* x, const char* key, vtype_ldouble value) Nonnull__(1,2);
extern bool libcdsb_map_update_string_pointer(vtype_map* x, const vtype_string* key, const void* value) Nonnull__(1,2);
extern bool libcdsb_map_update_string_cstring(vtype_map* x, const vtype_string* key, const char* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_string_string (vtype_map* x, const vtype_string* key, const vtype_string* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_string_array (vtype_map* x, const vtype_string* key, const vtype_array* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_string_list (vtype_map* x, const vtype_string* key, const vtype_list* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_string_map (vtype_map* x, const vtype_string* key, const vtype_map* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_string_vset (vtype_map* x, const vtype_string* key, const vtype_set* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_string_dict (vtype_map* x, const vtype_string* key, const vtype_dict* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_string_boolean(vtype_map* x, const vtype_string* key, vtype_bool value) Nonnull__(1,2);
extern bool libcdsb_map_update_string_int8 (vtype_map* x, const vtype_string* key, vtype_int8 value) Nonnull__(1,2);
extern bool libcdsb_map_update_string_int16 (vtype_map* x, const vtype_string* key, vtype_int16 value) Nonnull__(1,2);
extern bool libcdsb_map_update_string_int32 (vtype_map* x, const vtype_string* key, vtype_int32 value) Nonnull__(1,2);
extern bool libcdsb_map_update_string_int64 (vtype_map* x, const vtype_string* key, vtype_int64 value) Nonnull__(1,2);
extern bool libcdsb_map_update_string_uint8 (vtype_map* x, const vtype_string* key, vtype_uint8 value) Nonnull__(1,2);
extern bool libcdsb_map_update_string_uint16 (vtype_map* x, const vtype_string* key, vtype_uint16 value) Nonnull__(1,2);
extern bool libcdsb_map_update_string_uint32 (vtype_map* x, const vtype_string* key, vtype_uint32 value) Nonnull__(1,2);
extern bool libcdsb_map_update_string_uint64 (vtype_map* x, const vtype_string* key, vtype_uint64 value) Nonnull__(1,2);
extern bool libcdsb_map_update_string_float (vtype_map* x, const vtype_string* key, vtype_float value) Nonnull__(1,2);
extern bool libcdsb_map_update_string_double (vtype_map* x, const vtype_string* key, vtype_double value) Nonnull__(1,2);
extern bool libcdsb_map_update_string_ldouble(vtype_map* x, const vtype_string* key, vtype_ldouble value) Nonnull__(1,2);
extern bool libcdsb_map_update_array_pointer(vtype_map* x, const vtype_array* key, const void* value) Nonnull__(1,2);
extern bool libcdsb_map_update_array_cstring(vtype_map* x, const vtype_array* key, const char* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_array_string (vtype_map* x, const vtype_array* key, const vtype_string* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_array_array (vtype_map* x, const vtype_array* key, const vtype_array* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_array_list (vtype_map* x, const vtype_array* key, const vtype_list* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_array_map (vtype_map* x, const vtype_array* key, const vtype_map* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_array_vset (vtype_map* x, const vtype_array* key, const vtype_set* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_array_dict (vtype_map* x, const vtype_array* key, const vtype_dict* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_array_boolean(vtype_map* x, const vtype_array* key, vtype_bool value) Nonnull__(1,2);
extern bool libcdsb_map_update_array_int8 (vtype_map* x, const vtype_array* key, vtype_int8 value) Nonnull__(1,2);
extern bool libcdsb_map_update_array_int16 (vtype_map* x, const vtype_array* key, vtype_int16 value) Nonnull__(1,2);
extern bool libcdsb_map_update_array_int32 (vtype_map* x, const vtype_array* key, vtype_int32 value) Nonnull__(1,2);
extern bool libcdsb_map_update_array_int64 (vtype_map* x, const vtype_array* key, vtype_int64 value) Nonnull__(1,2);
extern bool libcdsb_map_update_array_uint8 (vtype_map* x, const vtype_array* key, vtype_uint8 value) Nonnull__(1,2);
extern bool libcdsb_map_update_array_uint16 (vtype_map* x, const vtype_array* key, vtype_uint16 value) Nonnull__(1,2);
extern bool libcdsb_map_update_array_uint32 (vtype_map* x, const vtype_array* key, vtype_uint32 value) Nonnull__(1,2);
extern bool libcdsb_map_update_array_uint64 (vtype_map* x, const vtype_array* key, vtype_uint64 value) Nonnull__(1,2);
extern bool libcdsb_map_update_array_float (vtype_map* x, const vtype_array* key, vtype_float value) Nonnull__(1,2);
extern bool libcdsb_map_update_array_double (vtype_map* x, const vtype_array* key, vtype_double value) Nonnull__(1,2);
extern bool libcdsb_map_update_array_ldouble(vtype_map* x, const vtype_array* key, vtype_ldouble value) Nonnull__(1,2);
extern bool libcdsb_map_update_list_pointer(vtype_map* x, const vtype_list* key, const void* value) Nonnull__(1,2);
extern bool libcdsb_map_update_list_cstring(vtype_map* x, const vtype_list* key, const char* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_list_string (vtype_map* x, const vtype_list* key, const vtype_string* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_list_array (vtype_map* x, const vtype_list* key, const vtype_array* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_list_list (vtype_map* x, const vtype_list* key, const vtype_list* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_list_map (vtype_map* x, const vtype_list* key, const vtype_map* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_list_vset (vtype_map* x, const vtype_list* key, const vtype_set* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_list_dict (vtype_map* x, const vtype_list* key, const vtype_dict* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_list_boolean(vtype_map* x, const vtype_list* key, vtype_bool value) Nonnull__(1,2);
extern bool libcdsb_map_update_list_int8 (vtype_map* x, const vtype_list* key, vtype_int8 value) Nonnull__(1,2);
extern bool libcdsb_map_update_list_int16 (vtype_map* x, const vtype_list* key, vtype_int16 value) Nonnull__(1,2);
extern bool libcdsb_map_update_list_int32 (vtype_map* x, const vtype_list* key, vtype_int32 value) Nonnull__(1,2);
extern bool libcdsb_map_update_list_int64 (vtype_map* x, const vtype_list* key, vtype_int64 value) Nonnull__(1,2);
extern bool libcdsb_map_update_list_uint8 (vtype_map* x, const vtype_list* key, vtype_uint8 value) Nonnull__(1,2);
extern bool libcdsb_map_update_list_uint16 (vtype_map* x, const vtype_list* key, vtype_uint16 value) Nonnull__(1,2);
extern bool libcdsb_map_update_list_uint32 (vtype_map* x, const vtype_list* key, vtype_uint32 value) Nonnull__(1,2);
extern bool libcdsb_map_update_list_uint64 (vtype_map* x, const vtype_list* key, vtype_uint64 value) Nonnull__(1,2);
extern bool libcdsb_map_update_list_float (vtype_map* x, const vtype_list* key, vtype_float value) Nonnull__(1,2);
extern bool libcdsb_map_update_list_double (vtype_map* x, const vtype_list* key, vtype_double value) Nonnull__(1,2);
extern bool libcdsb_map_update_list_ldouble(vtype_map* x, const vtype_list* key, vtype_ldouble value) Nonnull__(1,2);
extern bool libcdsb_map_update_map_pointer(vtype_map* x, const vtype_map* key, const void* value) Nonnull__(1,2);
extern bool libcdsb_map_update_map_cstring(vtype_map* x, const vtype_map* key, const char* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_map_string (vtype_map* x, const vtype_map* key, const vtype_string* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_map_array (vtype_map* x, const vtype_map* key, const vtype_array* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_map_list (vtype_map* x, const vtype_map* key, const vtype_list* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_map_map (vtype_map* x, const vtype_map* key, const vtype_map* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_map_vset (vtype_map* x, const vtype_map* key, const vtype_set* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_map_dict (vtype_map* x, const vtype_map* key, const vtype_dict* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_map_boolean(vtype_map* x, const vtype_map* key, vtype_bool value) Nonnull__(1,2);
extern bool libcdsb_map_update_map_int8 (vtype_map* x, const vtype_map* key, vtype_int8 value) Nonnull__(1,2);
extern bool libcdsb_map_update_map_int16 (vtype_map* x, const vtype_map* key, vtype_int16 value) Nonnull__(1,2);
extern bool libcdsb_map_update_map_int32 (vtype_map* x, const vtype_map* key, vtype_int32 value) Nonnull__(1,2);
extern bool libcdsb_map_update_map_int64 (vtype_map* x, const vtype_map* key, vtype_int64 value) Nonnull__(1,2);
extern bool libcdsb_map_update_map_uint8 (vtype_map* x, const vtype_map* key, vtype_uint8 value) Nonnull__(1,2);
extern bool libcdsb_map_update_map_uint16 (vtype_map* x, const vtype_map* key, vtype_uint16 value) Nonnull__(1,2);
extern bool libcdsb_map_update_map_uint32 (vtype_map* x, const vtype_map* key, vtype_uint32 value) Nonnull__(1,2);
extern bool libcdsb_map_update_map_uint64 (vtype_map* x, const vtype_map* key, vtype_uint64 value) Nonnull__(1,2);
extern bool libcdsb_map_update_map_float (vtype_map* x, const vtype_map* key, vtype_float value) Nonnull__(1,2);
extern bool libcdsb_map_update_map_double (vtype_map* x, const vtype_map* key, vtype_double value) Nonnull__(1,2);
extern bool libcdsb_map_update_map_ldouble(vtype_map* x, const vtype_map* key, vtype_ldouble value) Nonnull__(1,2);
extern bool libcdsb_map_update_vset_pointer(vtype_map* x, const vtype_set* key, const void* value) Nonnull__(1,2);
extern bool libcdsb_map_update_vset_cstring(vtype_map* x, const vtype_set* key, const char* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_vset_string (vtype_map* x, const vtype_set* key, const vtype_string* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_vset_array (vtype_map* x, const vtype_set* key, const vtype_array* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_vset_list (vtype_map* x, const vtype_set* key, const vtype_list* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_vset_map (vtype_map* x, const vtype_set* key, const vtype_map* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_vset_vset (vtype_map* x, const vtype_set* key, const vtype_set* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_vset_dict (vtype_map* x, const vtype_set* key, const vtype_dict* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_vset_boolean(vtype_map* x, const vtype_set* key, vtype_bool value) Nonnull__(1,2);
extern bool libcdsb_map_update_vset_int8 (vtype_map* x, const vtype_set* key, vtype_int8 value) Nonnull__(1,2);
extern bool libcdsb_map_update_vset_int16 (vtype_map* x, const vtype_set* key, vtype_int16 value) Nonnull__(1,2);
extern bool libcdsb_map_update_vset_int32 (vtype_map* x, const vtype_set* key, vtype_int32 value) Nonnull__(1,2);
extern bool libcdsb_map_update_vset_int64 (vtype_map* x, const vtype_set* key, vtype_int64 value) Nonnull__(1,2);
extern bool libcdsb_map_update_vset_uint8 (vtype_map* x, const vtype_set* key, vtype_uint8 value) Nonnull__(1,2);
extern bool libcdsb_map_update_vset_uint16 (vtype_map* x, const vtype_set* key, vtype_uint16 value) Nonnull__(1,2);
extern bool libcdsb_map_update_vset_uint32 (vtype_map* x, const vtype_set* key, vtype_uint32 value) Nonnull__(1,2);
extern bool libcdsb_map_update_vset_uint64 (vtype_map* x, const vtype_set* key, vtype_uint64 value) Nonnull__(1,2);
extern bool libcdsb_map_update_vset_float (vtype_map* x, const vtype_set* key, vtype_float value) Nonnull__(1,2);
extern bool libcdsb_map_update_vset_double (vtype_map* x, const vtype_set* key, vtype_double value) Nonnull__(1,2);
extern bool libcdsb_map_update_vset_ldouble(vtype_map* x, const vtype_set* key, vtype_ldouble value) Nonnull__(1,2);
extern bool libcdsb_map_update_dict_pointer(vtype_map* x, const vtype_dict* key, const void* value) Nonnull__(1,2);
extern bool libcdsb_map_update_dict_cstring(vtype_map* x, const vtype_dict* key, const char* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_dict_string (vtype_map* x, const vtype_dict* key, const vtype_string* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_dict_array (vtype_map* x, const vtype_dict* key, const vtype_array* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_dict_list (vtype_map* x, const vtype_dict* key, const vtype_list* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_dict_map (vtype_map* x, const vtype_dict* key, const vtype_map* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_dict_vset (vtype_map* x, const vtype_dict* key, const vtype_set* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_dict_dict (vtype_map* x, const vtype_dict* key, const vtype_dict* value) Nonnull__(1,2,3);
extern bool libcdsb_map_update_dict_boolean(vtype_map* x, const vtype_dict* key, vtype_bool value) Nonnull__(1,2);
extern bool libcdsb_map_update_dict_int8 (vtype_map* x, const vtype_dict* key, vtype_int8 value) Nonnull__(1,2);
extern bool libcdsb_map_update_dict_int16 (vtype_map* x, const vtype_dict* key, vtype_int16 value) Nonnull__(1,2);
extern bool libcdsb_map_update_dict_int32 (vtype_map* x, const vtype_dict* key, vtype_int32 value) Nonnull__(1,2);
extern bool libcdsb_map_update_dict_int64 (vtype_map* x, const vtype_dict* key, vtype_int64 value) Nonnull__(1,2);
extern bool libcdsb_map_update_dict_uint8 (vtype_map* x, const vtype_dict* key, vtype_uint8 value) Nonnull__(1,2);
extern bool libcdsb_map_update_dict_uint16 (vtype_map* x, const vtype_dict* key, vtype_uint16 value) Nonnull__(1,2);
extern bool libcdsb_map_update_dict_uint32 (vtype_map* x, const vtype_dict* key, vtype_uint32 value) Nonnull__(1,2);
extern bool libcdsb_map_update_dict_uint64 (vtype_map* x, const vtype_dict* key, vtype_uint64 value) Nonnull__(1,2);
extern bool libcdsb_map_update_dict_float (vtype_map* x, const vtype_dict* key, vtype_float value) Nonnull__(1,2);
extern bool libcdsb_map_update_dict_double (vtype_map* x, const vtype_dict* key, vtype_double value) Nonnull__(1,2);
extern bool libcdsb_map_update_dict_ldouble(vtype_map* x, const vtype_dict* key, vtype_ldouble value) Nonnull__(1,2);
extern bool libcdsb_map_update_boolean_pointer(vtype_map* x, vtype_bool key, const void* value) Nonnull__(1);
extern bool libcdsb_map_update_boolean_cstring(vtype_map* x, vtype_bool key, const char* value) Nonnull__(1,3);
extern bool libcdsb_map_update_boolean_string (vtype_map* x, vtype_bool key, const vtype_string* value) Nonnull__(1,3);
extern bool libcdsb_map_update_boolean_array (vtype_map* x, vtype_bool key, const vtype_array* value) Nonnull__(1,3);
extern bool libcdsb_map_update_boolean_list (vtype_map* x, vtype_bool key, const vtype_list* value) Nonnull__(1,3);
extern bool libcdsb_map_update_boolean_map (vtype_map* x, vtype_bool key, const vtype_map* value) Nonnull__(1,3);
extern bool libcdsb_map_update_boolean_vset (vtype_map* x, vtype_bool key, const vtype_set* value) Nonnull__(1,3);
extern bool libcdsb_map_update_boolean_dict (vtype_map* x, vtype_bool key, const vtype_dict* value) Nonnull__(1,3);
extern bool libcdsb_map_update_boolean_boolean(vtype_map* x, vtype_bool key, vtype_bool value) Nonnull__(1);
extern bool libcdsb_map_update_boolean_int8 (vtype_map* x, vtype_bool key, vtype_int8 value) Nonnull__(1);
extern bool libcdsb_map_update_boolean_int16 (vtype_map* x, vtype_bool key, vtype_int16 value) Nonnull__(1);
extern bool libcdsb_map_update_boolean_int32 (vtype_map* x, vtype_bool key, vtype_int32 value) Nonnull__(1);
extern bool libcdsb_map_update_boolean_int64 (vtype_map* x, vtype_bool key, vtype_int64 value) Nonnull__(1);
extern bool libcdsb_map_update_boolean_uint8 (vtype_map* x, vtype_bool key, vtype_uint8 value) Nonnull__(1);
extern bool libcdsb_map_update_boolean_uint16 (vtype_map* x, vtype_bool key, vtype_uint16 value) Nonnull__(1);
extern bool libcdsb_map_update_boolean_uint32 (vtype_map* x, vtype_bool key, vtype_uint32 value) Nonnull__(1);
extern bool libcdsb_map_update_boolean_uint64 (vtype_map* x, vtype_bool key, vtype_uint64 value) Nonnull__(1);
extern bool libcdsb_map_update_boolean_float (vtype_map* x, vtype_bool key, vtype_float value) Nonnull__(1);
extern bool libcdsb_map_update_boolean_double (vtype_map* x, vtype_bool key, vtype_double value) Nonnull__(1);
extern bool libcdsb_map_update_boolean_ldouble(vtype_map* x, vtype_bool key, vtype_ldouble value) Nonnull__(1);
extern bool libcdsb_map_update_uint8_pointer(vtype_map* x, vtype_uint8 key, const void* value) Nonnull__(1);
extern bool libcdsb_map_update_uint8_cstring(vtype_map* x, vtype_uint8 key, const char* value) Nonnull__(1,3);
extern bool libcdsb_map_update_uint8_string (vtype_map* x, vtype_uint8 key, const vtype_string* value) Nonnull__(1,3);
extern bool libcdsb_map_update_uint8_array (vtype_map* x, vtype_uint8 key, const vtype_array* value) Nonnull__(1,3);
extern bool libcdsb_map_update_uint8_list (vtype_map* x, vtype_uint8 key, const vtype_list* value) Nonnull__(1,3);
extern bool libcdsb_map_update_uint8_map (vtype_map* x, vtype_uint8 key, const vtype_map* value) Nonnull__(1,3);
extern bool libcdsb_map_update_uint8_vset (vtype_map* x, vtype_uint8 key, const vtype_set* value) Nonnull__(1,3);
extern bool libcdsb_map_update_uint8_dict (vtype_map* x, vtype_uint8 key, const vtype_dict* value) Nonnull__(1,3);
extern bool libcdsb_map_update_uint8_boolean(vtype_map* x, vtype_uint8 key, vtype_bool value) Nonnull__(1);
extern bool libcdsb_map_update_uint8_int8 (vtype_map* x, vtype_uint8 key, vtype_int8 value) Nonnull__(1);
extern bool libcdsb_map_update_uint8_int16 (vtype_map* x, vtype_uint8 key, vtype_int16 value) Nonnull__(1);
extern bool libcdsb_map_update_uint8_int32 (vtype_map* x, vtype_uint8 key, vtype_int32 value) Nonnull__(1);
extern bool libcdsb_map_update_uint8_int64 (vtype_map* x, vtype_uint8 key, vtype_int64 value) Nonnull__(1);
extern bool libcdsb_map_update_uint8_uint8 (vtype_map* x, vtype_uint8 key, vtype_uint8 value) Nonnull__(1);
extern bool libcdsb_map_update_uint8_uint16 (vtype_map* x, vtype_uint8 key, vtype_uint16 value) Nonnull__(1);
extern bool libcdsb_map_update_uint8_uint32 (vtype_map* x, vtype_uint8 key, vtype_uint32 value) Nonnull__(1);
extern bool libcdsb_map_update_uint8_uint64 (vtype_map* x, vtype_uint8 key, vtype_uint64 value) Nonnull__(1);
extern bool libcdsb_map_update_uint8_float (vtype_map* x, vtype_uint8 key, vtype_float value) Nonnull__(1);
extern bool libcdsb_map_update_uint8_double (vtype_map* x, vtype_uint8 key, vtype_double value) Nonnull__(1);
extern bool libcdsb_map_update_uint8_ldouble(vtype_map* x, vtype_uint8 key, vtype_ldouble value) Nonnull__(1);
extern bool libcdsb_map_update_uint16_pointer(vtype_map* x, vtype_uint16 key, const void* value) Nonnull__(1);
extern bool libcdsb_map_update_uint16_cstring(vtype_map* x, vtype_uint16 key, const char* value) Nonnull__(1,3);
extern bool libcdsb_map_update_uint16_string (vtype_map* x, vtype_uint16 key, const vtype_string* value) Nonnull__(1,3);
extern bool libcdsb_map_update_uint16_array (vtype_map* x, vtype_uint16 key, const vtype_array* value) Nonnull__(1,3);
extern bool libcdsb_map_update_uint16_list (vtype_map* x, vtype_uint16 key, const vtype_list* value) Nonnull__(1,3);
extern bool libcdsb_map_update_uint16_map (vtype_map* x, vtype_uint16 key, const vtype_map* value) Nonnull__(1,3);
extern bool libcdsb_map_update_uint16_vset (vtype_map* x, vtype_uint16 key, const vtype_set* value) Nonnull__(1,3);
extern bool libcdsb_map_update_uint16_dict (vtype_map* x, vtype_uint16 key, const vtype_dict* value) Nonnull__(1,3);
extern bool libcdsb_map_update_uint16_boolean(vtype_map* x, vtype_uint16 key, vtype_bool value) Nonnull__(1);
extern bool libcdsb_map_update_uint16_int8 (vtype_map* x, vtype_uint16 key, vtype_int8 value) Nonnull__(1);
extern bool libcdsb_map_update_uint16_int16 (vtype_map* x, vtype_uint16 key, vtype_int16 value) Nonnull__(1);
extern bool libcdsb_map_update_uint16_int32 (vtype_map* x, vtype_uint16 key, vtype_int32 value) Nonnull__(1);
extern bool libcdsb_map_update_uint16_int64 (vtype_map* x, vtype_uint16 key, vtype_int64 value) Nonnull__(1);
extern bool libcdsb_map_update_uint16_uint8 (vtype_map* x, vtype_uint16 key, vtype_uint8 value) Nonnull__(1);
extern bool libcdsb_map_update_uint16_uint16 (vtype_map* x, vtype_uint16 key, vtype_uint16 value) Nonnull__(1);
extern bool libcdsb_map_update_uint16_uint32 (vtype_map* x, vtype_uint16 key, vtype_uint32 value) Nonnull__(1);
extern bool libcdsb_map_update_uint16_uint64 (vtype_map* x, vtype_uint16 key, vtype_uint64 value) Nonnull__(1);
extern bool libcdsb_map_update_uint16_float (vtype_map* x, vtype_uint16 key, vtype_float value) Nonnull__(1);
extern bool libcdsb_map_update_uint16_double (vtype_map* x, vtype_uint16 key, vtype_double value) Nonnull__(1);
extern bool libcdsb_map_update_uint16_ldouble(vtype_map* x, vtype_uint16 key, vtype_ldouble value) Nonnull__(1);
extern bool libcdsb_map_update_uint32_pointer(vtype_map* x, vtype_uint32 key, const void* value) Nonnull__(1);
extern bool libcdsb_map_update_uint32_cstring(vtype_map* x, vtype_uint32 key, const char* value) Nonnull__(1,3);
extern bool libcdsb_map_update_uint32_string (vtype_map* x, vtype_uint32 key, const vtype_string* value) Nonnull__(1,3);
extern bool libcdsb_map_update_uint32_array (vtype_map* x, vtype_uint32 key, const vtype_array* value) Nonnull__(1,3);
extern bool libcdsb_map_update_uint32_list (vtype_map* x, vtype_uint32 key, const vtype_list* value) Nonnull__(1,3);
extern bool libcdsb_map_update_uint32_map (vtype_map* x, vtype_uint32 key, const vtype_map* value) Nonnull__(1,3);
extern bool libcdsb_map_update_uint32_vset (vtype_map* x, vtype_uint32 key, const vtype_set* value) Nonnull__(1,3);
extern bool libcdsb_map_update_uint32_dict (vtype_map* x, vtype_uint32 key, const vtype_dict* value) Nonnull__(1,3);
extern bool libcdsb_map_update_uint32_boolean(vtype_map* x, vtype_uint32 key, vtype_bool value) Nonnull__(1);
extern bool libcdsb_map_update_uint32_int8 (vtype_map* x, vtype_uint32 key, vtype_int8 value) Nonnull__(1);
extern bool libcdsb_map_update_uint32_int16 (vtype_map* x, vtype_uint32 key, vtype_int16 value) Nonnull__(1);
extern bool libcdsb_map_update_uint32_int32 (vtype_map* x, vtype_uint32 key, vtype_int32 value) Nonnull__(1);
extern bool libcdsb_map_update_uint32_int64 (vtype_map* x, vtype_uint32 key, vtype_int64 value) Nonnull__(1);
extern bool libcdsb_map_update_uint32_uint8 (vtype_map* x, vtype_uint32 key, vtype_uint8 value) Nonnull__(1);
extern bool libcdsb_map_update_uint32_uint16 (vtype_map* x, vtype_uint32 key, vtype_uint16 value) Nonnull__(1);
extern bool libcdsb_map_update_uint32_uint32 (vtype_map* x, vtype_uint32 key, vtype_uint32 value) Nonnull__(1);
extern bool libcdsb_map_update_uint32_uint64 (vtype_map* x, vtype_uint32 key, vtype_uint64 value) Nonnull__(1);
extern bool libcdsb_map_update_uint32_float (vtype_map* x, vtype_uint32 key, vtype_float value) Nonnull__(1);
extern bool libcdsb_map_update_uint32_double (vtype_map* x, vtype_uint32 key, vtype_double value) Nonnull__(1);
extern bool libcdsb_map_update_uint32_ldouble(vtype_map* x, vtype_uint32 key, vtype_ldouble value) Nonnull__(1);
extern bool libcdsb_map_update_uint64_pointer(vtype_map* x, vtype_uint64 key, const void* value) Nonnull__(1);
extern bool libcdsb_map_update_uint64_cstring(vtype_map* x, vtype_uint64 key, const char* value) Nonnull__(1,3);
extern bool libcdsb_map_update_uint64_string (vtype_map* x, vtype_uint64 key, const vtype_string* value) Nonnull__(1,3);
extern bool libcdsb_map_update_uint64_array (vtype_map* x, vtype_uint64 key, const vtype_array* value) Nonnull__(1,3);
extern bool libcdsb_map_update_uint64_list (vtype_map* x, vtype_uint64 key, const vtype_list* value) Nonnull__(1,3);
extern bool libcdsb_map_update_uint64_map (vtype_map* x, vtype_uint64 key, const vtype_map* value) Nonnull__(1,3);
extern bool libcdsb_map_update_uint64_vset (vtype_map* x, vtype_uint64 key, const vtype_set* value) Nonnull__(1,3);
extern bool libcdsb_map_update_uint64_dict (vtype_map* x, vtype_uint64 key, const vtype_dict* value) Nonnull__(1,3);
extern bool libcdsb_map_update_uint64_boolean(vtype_map* x, vtype_uint64 key, vtype_bool value) Nonnull__(1);
extern bool libcdsb_map_update_uint64_int8 (vtype_map* x, vtype_uint64 key, vtype_int8 value) Nonnull__(1);
extern bool libcdsb_map_update_uint64_int16 (vtype_map* x, vtype_uint64 key, vtype_int16 value) Nonnull__(1);
extern bool libcdsb_map_update_uint64_int32 (vtype_map* x, vtype_uint64 key, vtype_int32 value) Nonnull__(1);
extern bool libcdsb_map_update_uint64_int64 (vtype_map* x, vtype_uint64 key, vtype_int64 value) Nonnull__(1);
extern bool libcdsb_map_update_uint64_uint8 (vtype_map* x, vtype_uint64 key, vtype_uint8 value) Nonnull__(1);
extern bool libcdsb_map_update_uint64_uint16 (vtype_map* x, vtype_uint64 key, vtype_uint16 value) Nonnull__(1);
extern bool libcdsb_map_update_uint64_uint32 (vtype_map* x, vtype_uint64 key, vtype_uint32 value) Nonnull__(1);
extern bool libcdsb_map_update_uint64_uint64 (vtype_map* x, vtype_uint64 key, vtype_uint64 value) Nonnull__(1);
extern bool libcdsb_map_update_uint64_float (vtype_map* x, vtype_uint64 key, vtype_float value) Nonnull__(1);
extern bool libcdsb_map_update_uint64_double (vtype_map* x, vtype_uint64 key, vtype_double value) Nonnull__(1);
extern bool libcdsb_map_update_uint64_ldouble(vtype_map* x, vtype_uint64 key, vtype_ldouble value) Nonnull__(1);
extern bool libcdsb_map_update_int8_pointer(vtype_map* x, vtype_int8 key, const void* value) Nonnull__(1);
extern bool libcdsb_map_update_int8_cstring(vtype_map* x, vtype_int8 key, const char* value) Nonnull__(1,3);
extern bool libcdsb_map_update_int8_string (vtype_map* x, vtype_int8 key, const vtype_string* value) Nonnull__(1,3);
extern bool libcdsb_map_update_int8_array (vtype_map* x, vtype_int8 key, const vtype_array* value) Nonnull__(1,3);
extern bool libcdsb_map_update_int8_list (vtype_map* x, vtype_int8 key, const vtype_list* value) Nonnull__(1,3);
extern bool libcdsb_map_update_int8_map (vtype_map* x, vtype_int8 key, const vtype_map* value) Nonnull__(1,3);
extern bool libcdsb_map_update_int8_vset (vtype_map* x, vtype_int8 key, const vtype_set* value) Nonnull__(1,3);
extern bool libcdsb_map_update_int8_dict (vtype_map* x, vtype_int8 key, const vtype_dict* value) Nonnull__(1,3);
extern bool libcdsb_map_update_int8_boolean(vtype_map* x, vtype_int8 key, vtype_bool value) Nonnull__(1);
extern bool libcdsb_map_update_int8_int8 (vtype_map* x, vtype_int8 key, vtype_int8 value) Nonnull__(1);
extern bool libcdsb_map_update_int8_int16 (vtype_map* x, vtype_int8 key, vtype_int16 value) Nonnull__(1);
extern bool libcdsb_map_update_int8_int32 (vtype_map* x, vtype_int8 key, vtype_int32 value) Nonnull__(1);
extern bool libcdsb_map_update_int8_int64 (vtype_map* x, vtype_int8 key, vtype_int64 value) Nonnull__(1);
extern bool libcdsb_map_update_int8_uint8 (vtype_map* x, vtype_int8 key, vtype_uint8 value) Nonnull__(1);
extern bool libcdsb_map_update_int8_uint16 (vtype_map* x, vtype_int8 key, vtype_uint16 value) Nonnull__(1);
extern bool libcdsb_map_update_int8_uint32 (vtype_map* x, vtype_int8 key, vtype_uint32 value) Nonnull__(1);
extern bool libcdsb_map_update_int8_uint64 (vtype_map* x, vtype_int8 key, vtype_uint64 value) Nonnull__(1);
extern bool libcdsb_map_update_int8_float (vtype_map* x, vtype_int8 key, vtype_float value) Nonnull__(1);
extern bool libcdsb_map_update_int8_double (vtype_map* x, vtype_int8 key, vtype_double value) Nonnull__(1);
extern bool libcdsb_map_update_int8_ldouble(vtype_map* x, vtype_int8 key, vtype_ldouble value) Nonnull__(1);
extern bool libcdsb_map_update_int16_pointer(vtype_map* x, vtype_int16 key, const void* value) Nonnull__(1);
extern bool libcdsb_map_update_int16_cstring(vtype_map* x, vtype_int16 key, const char* value) Nonnull__(1,3);
extern bool libcdsb_map_update_int16_string (vtype_map* x, vtype_int16 key, const vtype_string* value) Nonnull__(1,3);
extern bool libcdsb_map_update_int16_array (vtype_map* x, vtype_int16 key, const vtype_array* value) Nonnull__(1,3);
extern bool libcdsb_map_update_int16_list (vtype_map* x, vtype_int16 key, const vtype_list* value) Nonnull__(1,3);
extern bool libcdsb_map_update_int16_map (vtype_map* x, vtype_int16 key, const vtype_map* value) Nonnull__(1,3);
extern bool libcdsb_map_update_int16_vset (vtype_map* x, vtype_int16 key, const vtype_set* value) Nonnull__(1,3);
extern bool libcdsb_map_update_int16_dict (vtype_map* x, vtype_int16 key, const vtype_dict* value) Nonnull__(1,3);
extern bool libcdsb_map_update_int16_boolean(vtype_map* x, vtype_int16 key, vtype_bool value) Nonnull__(1);
extern bool libcdsb_map_update_int16_int8 (vtype_map* x, vtype_int16 key, vtype_int8 value) Nonnull__(1);
extern bool libcdsb_map_update_int16_int16 (vtype_map* x, vtype_int16 key, vtype_int16 value) Nonnull__(1);
extern bool libcdsb_map_update_int16_int32 (vtype_map* x, vtype_int16 key, vtype_int32 value) Nonnull__(1);
extern bool libcdsb_map_update_int16_int64 (vtype_map* x, vtype_int16 key, vtype_int64 value) Nonnull__(1);
extern bool libcdsb_map_update_int16_uint8 (vtype_map* x, vtype_int16 key, vtype_uint8 value) Nonnull__(1);
extern bool libcdsb_map_update_int16_uint16 (vtype_map* x, vtype_int16 key, vtype_uint16 value) Nonnull__(1);
extern bool libcdsb_map_update_int16_uint32 (vtype_map* x, vtype_int16 key, vtype_uint32 value) Nonnull__(1);
extern bool libcdsb_map_update_int16_uint64 (vtype_map* x, vtype_int16 key, vtype_uint64 value) Nonnull__(1);
extern bool libcdsb_map_update_int16_float (vtype_map* x, vtype_int16 key, vtype_float value) Nonnull__(1);
extern bool libcdsb_map_update_int16_double (vtype_map* x, vtype_int16 key, vtype_double value) Nonnull__(1);
extern bool libcdsb_map_update_int16_ldouble(vtype_map* x, vtype_int16 key, vtype_ldouble value) Nonnull__(1);
extern bool libcdsb_map_update_int32_pointer(vtype_map* x, vtype_int32 key, const void* value) Nonnull__(1);
extern bool libcdsb_map_update_int32_cstring(vtype_map* x, vtype_int32 key, const char* value) Nonnull__(1,3);
extern bool libcdsb_map_update_int32_string (vtype_map* x, vtype_int32 key, const vtype_string* value) Nonnull__(1,3);
extern bool libcdsb_map_update_int32_array (vtype_map* x, vtype_int32 key, const vtype_array* value) Nonnull__(1,3);
extern bool libcdsb_map_update_int32_list (vtype_map* x, vtype_int32 key, const vtype_list* value) Nonnull__(1,3);
extern bool libcdsb_map_update_int32_map (vtype_map* x, vtype_int32 key, const vtype_map* value) Nonnull__(1,3);
extern bool libcdsb_map_update_int32_vset (vtype_map* x, vtype_int32 key, const vtype_set* value) Nonnull__(1,3);
extern bool libcdsb_map_update_int32_dict (vtype_map* x, vtype_int32 key, const vtype_dict* value) Nonnull__(1,3);
extern bool libcdsb_map_update_int32_boolean(vtype_map* x, vtype_int32 key, vtype_bool value) Nonnull__(1);
extern bool libcdsb_map_update_int32_int8 (vtype_map* x, vtype_int32 key, vtype_int8 value) Nonnull__(1);
extern bool libcdsb_map_update_int32_int16 (vtype_map* x, vtype_int32 key, vtype_int16 value) Nonnull__(1);
extern bool libcdsb_map_update_int32_int32 (vtype_map* x, vtype_int32 key, vtype_int32 value) Nonnull__(1);
extern bool libcdsb_map_update_int32_int64 (vtype_map* x, vtype_int32 key, vtype_int64 value) Nonnull__(1);
extern bool libcdsb_map_update_int32_uint8 (vtype_map* x, vtype_int32 key, vtype_uint8 value) Nonnull__(1);
extern bool libcdsb_map_update_int32_uint16 (vtype_map* x, vtype_int32 key, vtype_uint16 value) Nonnull__(1);
extern bool libcdsb_map_update_int32_uint32 (vtype_map* x, vtype_int32 key, vtype_uint32 value) Nonnull__(1);
extern bool libcdsb_map_update_int32_uint64 (vtype_map* x, vtype_int32 key, vtype_uint64 value) Nonnull__(1);
extern bool libcdsb_map_update_int32_float (vtype_map* x, vtype_int32 key, vtype_float value) Nonnull__(1);
extern bool libcdsb_map_update_int32_double (vtype_map* x, vtype_int32 key, vtype_double value) Nonnull__(1);
extern bool libcdsb_map_update_int32_ldouble(vtype_map* x, vtype_int32 key, vtype_ldouble value) Nonnull__(1);
extern bool libcdsb_map_update_int64_pointer(vtype_map* x, vtype_int64 key, const void* value) Nonnull__(1);
extern bool libcdsb_map_update_int64_cstring(vtype_map* x, vtype_int64 key, const char* value) Nonnull__(1,3);
extern bool libcdsb_map_update_int64_string (vtype_map* x, vtype_int64 key, const vtype_string* value) Nonnull__(1,3);
extern bool libcdsb_map_update_int64_array (vtype_map* x, vtype_int64 key, const vtype_array* value) Nonnull__(1,3);
extern bool libcdsb_map_update_int64_list (vtype_map* x, vtype_int64 key, const vtype_list* value) Nonnull__(1,3);
extern bool libcdsb_map_update_int64_map (vtype_map* x, vtype_int64 key, const vtype_map* value) Nonnull__(1,3);
extern bool libcdsb_map_update_int64_vset (vtype_map* x, vtype_int64 key, const vtype_set* value) Nonnull__(1,3);
extern bool libcdsb_map_update_int64_dict (vtype_map* x, vtype_int64 key, const vtype_dict* value) Nonnull__(1,3);
extern bool libcdsb_map_update_int64_boolean(vtype_map* x, vtype_int64 key, vtype_bool value) Nonnull__(1);
extern bool libcdsb_map_update_int64_int8 (vtype_map* x, vtype_int64 key, vtype_int8 value) Nonnull__(1);
extern bool libcdsb_map_update_int64_int16 (vtype_map* x, vtype_int64 key, vtype_int16 value) Nonnull__(1);
extern bool libcdsb_map_update_int64_int32 (vtype_map* x, vtype_int64 key, vtype_int32 value) Nonnull__(1);
extern bool libcdsb_map_update_int64_int64 (vtype_map* x, vtype_int64 key, vtype_int64 value) Nonnull__(1);
extern bool libcdsb_map_update_int64_uint8 (vtype_map* x, vtype_int64 key, vtype_uint8 value) Nonnull__(1);
extern bool libcdsb_map_update_int64_uint16 (vtype_map* x, vtype_int64 key, vtype_uint16 value) Nonnull__(1);
extern bool libcdsb_map_update_int64_uint32 (vtype_map* x, vtype_int64 key, vtype_uint32 value) Nonnull__(1);
extern bool libcdsb_map_update_int64_uint64 (vtype_map* x, vtype_int64 key, vtype_uint64 value) Nonnull__(1);
extern bool libcdsb_map_update_int64_float (vtype_map* x, vtype_int64 key, vtype_float value) Nonnull__(1);
extern bool libcdsb_map_update_int64_double (vtype_map* x, vtype_int64 key, vtype_double value) Nonnull__(1);
extern bool libcdsb_map_update_int64_ldouble(vtype_map* x, vtype_int64 key, vtype_ldouble value) Nonnull__(1);
extern bool libcdsb_map_update_float_pointer(vtype_map* x, vtype_float key, const void* value) Nonnull__(1);
extern bool libcdsb_map_update_float_cstring(vtype_map* x, vtype_float key, const char* value) Nonnull__(1,3);
extern bool libcdsb_map_update_float_string (vtype_map* x, vtype_float key, const vtype_string* value) Nonnull__(1,3);
extern bool libcdsb_map_update_float_array (vtype_map* x, vtype_float key, const vtype_array* value) Nonnull__(1,3);
extern bool libcdsb_map_update_float_list (vtype_map* x, vtype_float key, const vtype_list* value) Nonnull__(1,3);
extern bool libcdsb_map_update_float_map (vtype_map* x, vtype_float key, const vtype_map* value) Nonnull__(1,3);
extern bool libcdsb_map_update_float_vset (vtype_map* x, vtype_float key, const vtype_set* value) Nonnull__(1,3);
extern bool libcdsb_map_update_float_dict (vtype_map* x, vtype_float key, const vtype_dict* value) Nonnull__(1,3);
extern bool libcdsb_map_update_float_boolean(vtype_map* x, vtype_float key, vtype_bool value) Nonnull__(1);
extern bool libcdsb_map_update_float_int8 (vtype_map* x, vtype_float key, vtype_int8 value) Nonnull__(1);
extern bool libcdsb_map_update_float_int16 (vtype_map* x, vtype_float key, vtype_int16 value) Nonnull__(1);
extern bool libcdsb_map_update_float_int32 (vtype_map* x, vtype_float key, vtype_int32 value) Nonnull__(1);
extern bool libcdsb_map_update_float_int64 (vtype_map* x, vtype_float key, vtype_int64 value) Nonnull__(1);
extern bool libcdsb_map_update_float_uint8 (vtype_map* x, vtype_float key, vtype_uint8 value) Nonnull__(1);
extern bool libcdsb_map_update_float_uint16 (vtype_map* x, vtype_float key, vtype_uint16 value) Nonnull__(1);
extern bool libcdsb_map_update_float_uint32 (vtype_map* x, vtype_float key, vtype_uint32 value) Nonnull__(1);
extern bool libcdsb_map_update_float_uint64 (vtype_map* x, vtype_float key, vtype_uint64 value) Nonnull__(1);
extern bool libcdsb_map_update_float_float (vtype_map* x, vtype_float key, vtype_float value) Nonnull__(1);
extern bool libcdsb_map_update_float_double (vtype_map* x, vtype_float key, vtype_double value) Nonnull__(1);
extern bool libcdsb_map_update_float_ldouble(vtype_map* x, vtype_float key, vtype_ldouble value) Nonnull__(1);
extern bool libcdsb_map_update_double_pointer(vtype_map* x, vtype_double key, const void* value) Nonnull__(1);
extern bool libcdsb_map_update_double_cstring(vtype_map* x, vtype_double key, const char* value) Nonnull__(1,3);
extern bool libcdsb_map_update_double_string (vtype_map* x, vtype_double key, const vtype_string* value) Nonnull__(1,3);
extern bool libcdsb_map_update_double_array (vtype_map* x, vtype_double key, const vtype_array* value) Nonnull__(1,3);
extern bool libcdsb_map_update_double_list (vtype_map* x, vtype_double key, const vtype_list* value) Nonnull__(1,3);
extern bool libcdsb_map_update_double_map (vtype_map* x, vtype_double key, const vtype_map* value) Nonnull__(1,3);
extern bool libcdsb_map_update_double_vset (vtype_map* x, vtype_double key, const vtype_set* value) Nonnull__(1,3);
extern bool libcdsb_map_update_double_dict (vtype_map* x, vtype_double key, const vtype_dict* value) Nonnull__(1,3);
extern bool libcdsb_map_update_double_boolean(vtype_map* x, vtype_double key, vtype_bool value) Nonnull__(1);
extern bool libcdsb_map_update_double_int8 (vtype_map* x, vtype_double key, vtype_int8 value) Nonnull__(1);
extern bool libcdsb_map_update_double_int16 (vtype_map* x, vtype_double key, vtype_int16 value) Nonnull__(1);
extern bool libcdsb_map_update_double_int32 (vtype_map* x, vtype_double key, vtype_int32 value) Nonnull__(1);
extern bool libcdsb_map_update_double_int64 (vtype_map* x, vtype_double key, vtype_int64 value) Nonnull__(1);
extern bool libcdsb_map_update_double_uint8 (vtype_map* x, vtype_double key, vtype_uint8 value) Nonnull__(1);
extern bool libcdsb_map_update_double_uint16 (vtype_map* x, vtype_double key, vtype_uint16 value) Nonnull__(1);
extern bool libcdsb_map_update_double_uint32 (vtype_map* x, vtype_double key, vtype_uint32 value) Nonnull__(1);
extern bool libcdsb_map_update_double_uint64 (vtype_map* x, vtype_double key, vtype_uint64 value) Nonnull__(1);
extern bool libcdsb_map_update_double_float (vtype_map* x, vtype_double key, vtype_float value) Nonnull__(1);
extern bool libcdsb_map_update_double_double (vtype_map* x, vtype_double key, vtype_double value) Nonnull__(1);
extern bool libcdsb_map_update_double_ldouble(vtype_map* x, vtype_double key, vtype_ldouble value) Nonnull__(1);
extern bool libcdsb_map_update_ldouble_pointer(vtype_map* x, vtype_ldouble key, const void* value) Nonnull__(1);
extern bool libcdsb_map_update_ldouble_cstring(vtype_map* x, vtype_ldouble key, const char* value) Nonnull__(1,3);
extern bool libcdsb_map_update_ldouble_string (vtype_map* x, vtype_ldouble key, const vtype_string* value) Nonnull__(1,3);
extern bool libcdsb_map_update_ldouble_array (vtype_map* x, vtype_ldouble key, const vtype_array* value) Nonnull__(1,3);
extern bool libcdsb_map_update_ldouble_list (vtype_map* x, vtype_ldouble key, const vtype_list* value) Nonnull__(1,3);
extern bool libcdsb_map_update_ldouble_map (vtype_map* x, vtype_ldouble key, const vtype_map* value) Nonnull__(1,3);
extern bool libcdsb_map_update_ldouble_vset (vtype_map* x, vtype_ldouble key, const vtype_set* value) Nonnull__(1,3);
extern bool libcdsb_map_update_ldouble_dict (vtype_map* x, vtype_ldouble key, const vtype_dict* value) Nonnull__(1,3);
extern bool libcdsb_map_update_ldouble_boolean(vtype_map* x, vtype_ldouble key, vtype_bool value) Nonnull__(1);
extern bool libcdsb_map_update_ldouble_int8 (vtype_map* x, vtype_ldouble key, vtype_int8 value) Nonnull__(1);
extern bool libcdsb_map_update_ldouble_int16 (vtype_map* x, vtype_ldouble key, vtype_int16 value) Nonnull__(1);
extern bool libcdsb_map_update_ldouble_int32 (vtype_map* x, vtype_ldouble key, vtype_int32 value) Nonnull__(1);
extern bool libcdsb_map_update_ldouble_int64 (vtype_map* x, vtype_ldouble key, vtype_int64 value) Nonnull__(1);
extern bool libcdsb_map_update_ldouble_uint8 (vtype_map* x, vtype_ldouble key, vtype_uint8 value) Nonnull__(1);
extern bool libcdsb_map_update_ldouble_uint16 (vtype_map* x, vtype_ldouble key, vtype_uint16 value) Nonnull__(1);
extern bool libcdsb_map_update_ldouble_uint32 (vtype_map* x, vtype_ldouble key, vtype_uint32 value) Nonnull__(1);
extern bool libcdsb_map_update_ldouble_uint64 (vtype_map* x, vtype_ldouble key, vtype_uint64 value) Nonnull__(1);
extern bool libcdsb_map_update_ldouble_float (vtype_map* x, vtype_ldouble key, vtype_float value) Nonnull__(1);
extern bool libcdsb_map_update_ldouble_double (vtype_map* x, vtype_ldouble key, vtype_double value) Nonnull__(1);
extern bool libcdsb_map_update_ldouble_ldouble(vtype_map* x, vtype_ldouble key, vtype_ldouble value) Nonnull__(1);
extern bool libcdsb_map_update (vtype_map* x, const void* key, vtype key_type, const void* value, vtype value_type) Nonnull__(1);
extern bool libcdsb_map_inject (vtype_map* x, const void* key, vtype key_type, const void* value, vtype value_type) Nonnull__(1);
extern int libcdsb_map_find (vtype_map* x, const void* key, vtype key_type, void* data, map_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_map_foreach(vtype_map* x, void* data, map_access_callback, rbforeach_t, bool flush) Nonnull__(1,3);
#endif /* LIBCDSB_MAP_H */

View File

@ -1,67 +1,35 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "__generics.h"
#include "bits/__generics.h"
#include "bits/__rbtree.h"
#include "vtype.h"
#ifndef LIBCDSB_SET_H
#define LIBCDSB_SET_H
/*#####################################################################################################################*/
typedef int (*vset_access_callback)(const void* value, vtype type, void* data);
/*#####################################################################################################################*/
extern void vset_init(vtype_set* x, vtype type) Nonnull__(1);
#define vset_pop(x, value, data, callback) _LIBCDSB_Generic (libcdsb_vset, find, value)(x, value, data, callback, 1)
#define vset_get(x, value, data, callback) _LIBCDSB_Generic (libcdsb_vset, find, value)(x, value, data, callback, 0)
#define vset_push(x, value) _LIBCDSB_Generic (libcdsb_vset, push, value)(x, value)
#define vset_remove(x, value) vset_pop(x, value, 0, 0)
/*#####################################################################################################################*/
#define in_vset(x, value) (vset_get(&x, value, 0, 0) == 0)
#define vset_pop(x, value, data, callback) libcdsb_vset_find (x, _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value), data, callback, 1)
#define vset_get(x, value, data, callback) libcdsb_vset_find (x, _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value), data, callback, 0)
#define vset_push(x, value) libcdsb_vset_insert (x, _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value))
#define vset_attach(x, value) libcdsb_vset_attach (x, _LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value))
#define vset_foreach(x, data, callback) libcdsb_vset_foreach(x, data, callback, RBFOREACH_UNSPECIFIED, 0)
#define vset_remove(x, value) vset_pop (x, value, 0, 0)
#define in_vset(x, value) (vset_get(x, value, 0, 0) == 0)
/*#####################################################################################################################*/
extern bool libcdsb_vset_push_pointer(vtype_set* x, const void* value) Nonnull__(1);
extern bool libcdsb_vset_push_cstring(vtype_set* x, const char* value) Nonnull__(1,2);
extern bool libcdsb_vset_push_string (vtype_set* x, const vtype_string* value) Nonnull__(1,2);
extern bool libcdsb_vset_push_array (vtype_set* x, const vtype_array* value) Nonnull__(1,2);
extern bool libcdsb_vset_push_list (vtype_set* x, const vtype_list* value) Nonnull__(1,2);
extern bool libcdsb_vset_push_map (vtype_set* x, const vtype_map* value) Nonnull__(1,2);
extern bool libcdsb_vset_push_vset (vtype_set* x, const vtype_set* value) Nonnull__(1,2);
extern bool libcdsb_vset_push_dict (vtype_set* x, const vtype_dict* value) Nonnull__(1,2);
extern bool libcdsb_vset_push_boolean(vtype_set* x, vtype_bool value) Nonnull__(1);
extern bool libcdsb_vset_push_uint8 (vtype_set* x, vtype_uint8 value) Nonnull__(1);
extern bool libcdsb_vset_push_uint16 (vtype_set* x, vtype_uint16 value) Nonnull__(1);
extern bool libcdsb_vset_push_uint32 (vtype_set* x, vtype_uint32 value) Nonnull__(1);
extern bool libcdsb_vset_push_uint64 (vtype_set* x, vtype_uint64 value) Nonnull__(1);
extern bool libcdsb_vset_push_int8 (vtype_set* x, vtype_int8 value) Nonnull__(1);
extern bool libcdsb_vset_push_int16 (vtype_set* x, vtype_int16 value) Nonnull__(1);
extern bool libcdsb_vset_push_int32 (vtype_set* x, vtype_int32 value) Nonnull__(1);
extern bool libcdsb_vset_push_int64 (vtype_set* x, vtype_int64 value) Nonnull__(1);
extern bool libcdsb_vset_push_float (vtype_set* x, vtype_float value) Nonnull__(1);
extern bool libcdsb_vset_push_double (vtype_set* x, vtype_double value) Nonnull__(1);
extern bool libcdsb_vset_push_ldouble(vtype_set* x, vtype_ldouble value) Nonnull__(1);
extern int libcdsb_vset_find_pointer(vtype_set* x, const void* value, void* data, vset_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_vset_find_cstring(vtype_set* x, const char* value, void* data, vset_access_callback, bool cut) Nonnull__(1,2);
extern int libcdsb_vset_find_string (vtype_set* x, const vtype_string* value, void* data, vset_access_callback, bool cut) Nonnull__(1,2);
extern int libcdsb_vset_find_array (vtype_set* x, const vtype_array* value, void* data, vset_access_callback, bool cut) Nonnull__(1,2);
extern int libcdsb_vset_find_list (vtype_set* x, const vtype_list* value, void* data, vset_access_callback, bool cut) Nonnull__(1,2);
extern int libcdsb_vset_find_map (vtype_set* x, const vtype_map* value, void* data, vset_access_callback, bool cut) Nonnull__(1,2);
extern int libcdsb_vset_find_vset (vtype_set* x, const vtype_set* value, void* data, vset_access_callback, bool cut) Nonnull__(1,2);
extern int libcdsb_vset_find_dict (vtype_set* x, const vtype_dict* value, void* data, vset_access_callback, bool cut) Nonnull__(1,2);
extern int libcdsb_vset_find_boolean(vtype_set* x, vtype_bool value, void* data, vset_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_vset_find_uint8 (vtype_set* x, vtype_uint8 value, void* data, vset_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_vset_find_uint16 (vtype_set* x, vtype_uint16 value, void* data, vset_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_vset_find_uint32 (vtype_set* x, vtype_uint32 value, void* data, vset_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_vset_find_uint64 (vtype_set* x, vtype_uint64 value, void* data, vset_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_vset_find_int8 (vtype_set* x, vtype_int8 value, void* data, vset_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_vset_find_int16 (vtype_set* x, vtype_int16 value, void* data, vset_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_vset_find_int32 (vtype_set* x, vtype_int32 value, void* data, vset_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_vset_find_int64 (vtype_set* x, vtype_int64 value, void* data, vset_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_vset_find_float (vtype_set* x, vtype_float value, void* data, vset_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_vset_find_double (vtype_set* x, vtype_double value, void* data, vset_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_vset_find_ldouble(vtype_set* x, vtype_ldouble value, void* data, vset_access_callback, bool cut) Nonnull__(1);
extern bool libcdsb_vset_insert (vtype_set* x, const void* value, vtype type) Nonnull__(1);
extern bool libcdsb_vset_attach (vtype_set* x, const void* value, vtype type) Nonnull__(1);
extern int libcdsb_vset_find (vtype_set* x, const void* value, vtype type, void* data, vset_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_vset_foreach(vtype_set* x, void* data, vset_access_callback, rbforeach_t, bool flush) Nonnull__(1,3);
#endif /* LIBCDSB_SET_H */

View File

@ -1,88 +1,48 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "__generics.h"
#include "bits/__generics.h"
#include "vtype.h"
#include <uchar.h>
#ifndef LIBCDSB_STRING_H
#define LIBCDSB_STRING_H
/*#####################################################################################################################*/
extern void string_init(vtype_string* x, const char* value) Nonnull__(1);
extern size_t string_slice (vtype_string* x, vtype_string* s, ssize_t index, size_t nchars, bool cut) Nonnull__(1,2);
extern size_t string_reverse (vtype_string* x) Nonnull__(1);
extern size_t string_to_lower (vtype_string* x) Nonnull__(1);
extern size_t string_to_upper (vtype_string* x) Nonnull__(1);
extern size_t string_capitalize(vtype_string* x) Nonnull__(1);
extern char* string_at(const vtype_string* s, ssize_t index) Nonnull__(1);
extern size_t string_slice(vtype_string* x, vtype_string* s, ssize_t index, size_t nchars, bool cut) Nonnull__(1,2);
#define string_indexof(s, arg) _LIBCDSB_GenericS(libcdsb_string, indexof, arg)(s, arg)
#define string_count(s, arg) _LIBCDSB_GenericS(libcdsb_string, count, arg)(s, arg)
#define string_concat(x, value) _LIBCDSB_GenericS(libcdsb_string, concat, value)(x, value)
#define string_trim_spaces(x) libcdsb_string_trim_spaces(x, 0)
#define string_ltrim_spaces(x) libcdsb_string_trim_spaces(x, -1)
#define string_rtrim_spaces(x) libcdsb_string_trim_spaces(x, 1)
#define string_replace(x, src, dest, maxn) _LIBCDSB_GenericS2(libcdsb_string, replace, src, dest)(x, src, dest, maxn)
extern char* at_string (const vtype_string* s, ssize_t index) Nonnull__(1);
/*#####################################################################################################################*/
inline ssize_t libcdsb_string_indexof_string (const vtype_string* s, const vtype_string* arg) Pure__ Warn_unused_result__ Nonnull__(1) Always_inline__;
extern ssize_t libcdsb_string_indexof_cstring(const vtype_string* s, const char* arg) Pure__ Warn_unused_result__ Nonnull__(1);
extern ssize_t libcdsb_string_indexof_char (const vtype_string* s, int arg) Pure__ Warn_unused_result__ Nonnull__(1);
inline size_t libcdsb_string_count_string (const vtype_string* s, const vtype_string* arg) Pure__ Warn_unused_result__ Nonnull__(1) Always_inline__;
extern size_t libcdsb_string_count_cstring(const vtype_string* s, const char* arg) Pure__ Warn_unused_result__ Nonnull__(1);
extern size_t libcdsb_string_count_char (const vtype_string* s, int arg) Pure__ Warn_unused_result__ Nonnull__(1);
inline bool libcdsb_string_concat_string (vtype_string* x, const vtype_string* value) Nonnull__(1) Always_inline__;
extern bool libcdsb_string_concat_cstring(vtype_string* x, const char* value) Nonnull__(1);
extern bool libcdsb_string_concat_char (vtype_string* x, int value) Nonnull__(1);
extern void libcdsb_string_trim_spaces(vtype_string* x, int direction) Nonnull__(1);
inline size_t libcdsb_string_replace_string_string (vtype_string* x, const vtype_string* src, const vtype_string* dest, size_t maxn) Nonnull__(1) Always_inline__;
inline size_t libcdsb_string_replace_string_cstring (vtype_string* x, const vtype_string* src, const char* dest, size_t maxn) Nonnull__(1) Always_inline__;
inline size_t libcdsb_string_replace_string_char (vtype_string* x, const vtype_string* src, int dest, size_t maxn) Nonnull__(1) Always_inline__;
inline size_t libcdsb_string_replace_cstring_string (vtype_string* x, const char* src, const vtype_string* dest, size_t maxn) Nonnull__(1) Always_inline__;
extern size_t libcdsb_string_replace_cstring_cstring(vtype_string* x, const char* src, const char* dest, size_t maxn) Nonnull__(1);
extern size_t libcdsb_string_replace_cstring_char (vtype_string* x, const char* src, int dest, size_t maxn) Nonnull__(1);
inline size_t libcdsb_string_replace_char_string (vtype_string* x, int src, const vtype_string* dest, size_t maxn) Nonnull__(1) Always_inline__;
extern size_t libcdsb_string_replace_char_cstring (vtype_string* x, int src, const char* dest, size_t maxn) Nonnull__(1);
extern size_t libcdsb_string_replace_char_char (vtype_string* x, int src, int dest, size_t maxn) Nonnull__(1);
#define string_init(x, s) libcdsb_string_init (x, _LIBCDSB_to_cstring(s), 0)
#define string_indexof(x, s) libcdsb_string_indexof(x, _LIBCDSB_to_cstring(s))
#define string_count(x, s) libcdsb_string_count (x, _LIBCDSB_to_cstring(s), 0)
#define string_concat(x, s) libcdsb_string_concat (x, _LIBCDSB_to_cstring(s), 0)
#define string_align(x, n, c) libcdsb_string_align (x, n, c, 0)
#define string_lalign(x, n, c) libcdsb_string_align (x, n, c, -1)
#define string_ralign(x, n, c) libcdsb_string_align (x, n, c, 1)
#define string_split(x, s) libcdsb_string_split (x, _LIBCDSB_to_cstring(s), 0, -1)
#define string_trim(x, s) libcdsb_string_trim (x, _LIBCDSB_to_cstring(s), 0)
#define string_ltrim(x, s) libcdsb_string_trim (x, _LIBCDSB_to_cstring(s), -1)
#define string_rtrim(x, s) libcdsb_string_trim (x, _LIBCDSB_to_cstring(s), 1)
#define string_replace(x, s, d) libcdsb_string_replace(x, _LIBCDSB_to_cstring(s), 0, _LIBCDSB_to_cstring(d), 0, -1)
/*#####################################################################################################################*/
inline ssize_t libcdsb_string_indexof_string(const vtype_string* s, const vtype_string* arg) {
return string_indexof(s, arg->buffer);
}
inline void libcdsb_string_init (vtype_string* x, const char* s, size_t nmemb) Always_inline__ Nonnull__(1);
extern bool libcdsb_string_concat (vtype_string* x, const char* s, size_t nmemb) Nonnull__(1);
extern void libcdsb_string_trim (vtype_string* x, const char* s, int direction) Nonnull__(1);
extern size_t libcdsb_string_align (vtype_string* x, size_t padsize, int padchr, int direction) Nonnull__(1);
extern ssize_t libcdsb_string_indexof(const vtype_string* x, const char* s) Pure__ Warn_unused_result__ Nonnull__(1);
extern size_t libcdsb_string_count (const vtype_string* x, const char* s, size_t nmemb) Pure__ Warn_unused_result__ Nonnull__(1);
extern vtype_array libcdsb_string_split (const vtype_string* x, const char* s, size_t nmemb, size_t maxn) Nonnull__(1);
extern size_t libcdsb_string_replace(vtype_string* x, const char* s, size_t snmemb, const char* d, size_t dnmemb, size_t maxn) Nonnull__(1,2);
inline size_t libcdsb_string_count_string(const vtype_string* s, const vtype_string* arg) {
return string_count(s, arg->buffer);
}
inline void libcdsb_string_init (vtype_string* x, const char* s, size_t nmemb) { x->buffer = ((nmemb) ? libcdsb_strndup(s, nmemb) : libcdsb_strdup(s)); }
inline bool libcdsb_string_concat_string(vtype_string* x, const vtype_string* s) {
return string_concat(x, s->buffer);
}
inline size_t libcdsb_string_replace_string_string (vtype_string* x, const vtype_string* src, const vtype_string* dest, size_t maxn) {
return string_replace(x, src->buffer, dest->buffer, maxn);
}
inline size_t libcdsb_string_replace_string_cstring(vtype_string* x, const vtype_string* src, const char* dest, size_t maxn) {
return string_replace(x, src->buffer, dest, maxn);
}
inline size_t libcdsb_string_replace_cstring_string(vtype_string* x, const char* src, const vtype_string* dest, size_t maxn) {
return string_replace(x, src, dest->buffer, maxn);
}
inline size_t libcdsb_string_replace_string_char (vtype_string* x, const vtype_string* src, int dest, size_t maxn) {
return string_replace(x, src->buffer, dest, maxn);
}
inline size_t libcdsb_string_replace_char_string (vtype_string* x, int src, const vtype_string* dest, size_t maxn) {
return string_replace(x, src, dest->buffer, maxn);
}
#endif /* LIBCDSB_BASE_STRING_H */
#endif /* LIBCDSB_STRING_H */

View File

@ -5,7 +5,8 @@
#include <unistd.h>
#include <stdbool.h>
#include "__attributes.h"
#include "bits/cstring.h"
#include "bits/memory.h"
#ifndef LIBCDSB_VTYPE_H
#define LIBCDSB_VTYPE_H
@ -33,6 +34,7 @@ typedef enum libcdsb_value_types {
VTYPE_DICT = 18,
} vtype;
/*#####################################################################################################################*/
struct libcdsb_string { char* buffer; };
struct libcdsb_array { void* mem; size_t size; vtype type; };
@ -43,6 +45,8 @@ struct libcdsb_set { struct libcdsb_rbtree_node* root; vtype type; };
struct libcdsb_list { struct libcdsb_list_node* last; struct libcdsb_list_node* first; };
struct libcdsb_dict { struct libcdsb_dict_node** nodes; size_t capacity; size_t size; };
/*#####################################################################################################################*/
typedef void* vtype_pointer;
typedef bool vtype_bool;
@ -70,101 +74,91 @@ typedef struct libcdsb_dict vtype_dict;
typedef struct libcdsb_string vtype_string;
/* Get utf8 chars count in string */
extern size_t string_size(const vtype_string* x) Pure__ Warn_unused_result__ Nonnull__(1);
/* Get string size in bytes */
extern size_t string_nmemb(const vtype_string* x) Pure__ Warn_unused_result__ Nonnull__(1);
/* Get count of the array elements */
extern size_t array_size(const vtype_array* x) Pure__ Warn_unused_result__ Nonnull__(1);
/* Get array size in bytes */
extern size_t array_nmemb(const vtype_array* x) Pure__ Warn_unused_result__ Nonnull__(1);
/* Get count of the list elements */
extern size_t list_size(const vtype_list* x) Pure__ Warn_unused_result__ Nonnull__(1);
/* Get count of the map elements */
extern size_t map_size(const vtype_map* x) Pure__ Warn_unused_result__ Nonnull__(1);
/* Get count of the set elements */
extern size_t vset_size(const vtype_set* x) Pure__ Warn_unused_result__ Nonnull__(1);
/* Get count of the dict elements */
extern size_t dict_size(const vtype_dict* x) Pure__ Warn_unused_result__ Nonnull__(1);
/* Get count of the available nodes */
extern size_t dict_capacity(const vtype_dict* x) Pure__ Warn_unused_result__ Nonnull__(1);
extern const char* libcdsb_vtype_name (vtype t) Warn_unused_result__;
extern const char* libcdsb_vtype_stringify(const void* value, vtype t) Warn_unused_result__;
/* Cpmpare 2 strings */
extern int string_compare(const vtype_string* s0, const vtype_string* s1) Pure__ Warn_unused_result__ Nonnull__(1,2);
/* Compare 2 arrays */
extern int array_compare(const vtype_array* s0, const vtype_array* s1) Pure__ Warn_unused_result__ Nonnull__(1,2);
/* Compare 2 lists */
extern int list_compare(const vtype_list* s0, const vtype_list* s1) Pure__ Warn_unused_result__ Nonnull__(1,2);
/* Compare 2 maps */
extern int map_compare(const vtype_map* s0, const vtype_map* s1) Pure__ Warn_unused_result__ Nonnull__(1,2);
/* Compare 2 sets */
extern int vset_compare(const vtype_set* s0, const vtype_set* s1) Pure__ Warn_unused_result__ Nonnull__(1,2);
/* Compare 2 dicts */
extern int dict_compare(const vtype_dict* s0, const vtype_dict* s1) Pure__ Warn_unused_result__ Nonnull__(1,2);
/*#####################################################################################################################*/
/* Copy string to another */
extern vtype_string string_copy(const vtype_string* s) Pure__ Warn_unused_result__ Nonnull__(1);
/* Copy array to another */
extern vtype_array array_copy(const vtype_array* s) Pure__ Warn_unused_result__ Nonnull__(1);
/* Copy list to another */
extern vtype_list list_copy(const vtype_list* s) Pure__ Warn_unused_result__ Nonnull__(1);
/* Copy map to another */
extern vtype_map map_copy(const vtype_map* s) Pure__ Warn_unused_result__ Nonnull__(1);
/* Copy set to another */
extern vtype_set vset_copy(const vtype_set* s) Pure__ Warn_unused_result__ Nonnull__(1);
/* Copy set to another */
extern vtype_dict dict_copy(const vtype_dict* s) Pure__ Warn_unused_result__ Nonnull__(1);
extern size_t string_size (const vtype_string* x) Pure__ Warn_unused_result__ Nonnull__(1);
extern size_t array_nmemb (const vtype_array* x) Pure__ Warn_unused_result__ Nonnull__(1);
extern size_t list_size (const vtype_list* x) Pure__ Warn_unused_result__ Nonnull__(1);
extern size_t map_size (const vtype_map* x) Pure__ Warn_unused_result__ Nonnull__(1);
extern size_t vset_size (const vtype_set* x) Pure__ Warn_unused_result__ Nonnull__(1);
inline size_t string_nmemb (const vtype_string* x) Always_inline__ Pure__ Warn_unused_result__ Nonnull__(1);
inline size_t array_size (const vtype_array* x) Always_inline__ Pure__ Warn_unused_result__ Nonnull__(1);
inline size_t dict_size (const vtype_dict* x) Always_inline__ Pure__ Warn_unused_result__ Nonnull__(1);
inline size_t dict_capacity(const vtype_dict* x) Always_inline__ Pure__ Warn_unused_result__ Nonnull__(1);
/* Duplicate string memory block */
extern vtype_string* string_duplicate(const vtype_string* s) Warn_unused_result__ Nonnull__(1);
/* Duplicate array memory block */
extern vtype_array* array_duplicate(const vtype_array* s) Warn_unused_result__ Nonnull__(1);
/* Duplicate list memory block */
extern vtype_list* list_duplicate(const vtype_list* s) Warn_unused_result__ Nonnull__(1);
/* Duplicate map memory block */
extern vtype_map* map_duplicate(const vtype_map* s) Warn_unused_result__ Nonnull__(1);
/* Duplicate set memory block */
extern vtype_set* vset_duplicate(const vtype_set* s) Warn_unused_result__ Nonnull__(1);
/* Duplicate dict memory block */
extern vtype_dict* dict_duplicate(const vtype_dict* s) Warn_unused_result__ Nonnull__(1);
extern int string_case_compare(const vtype_string* s0, const vtype_string* s1) Pure__ Warn_unused_result__ Nonnull__(1,2);
extern int string_compare (const vtype_string* s0, const vtype_string* s1) Pure__ Warn_unused_result__ Nonnull__(1,2);
extern int array_compare (const vtype_array* s0, const vtype_array* s1) Pure__ Warn_unused_result__ Nonnull__(1,2);
extern int list_compare (const vtype_list* s0, const vtype_list* s1) Pure__ Warn_unused_result__ Nonnull__(1,2);
extern int map_compare (const vtype_map* s0, const vtype_map* s1) Pure__ Warn_unused_result__ Nonnull__(1,2);
extern int vset_compare (const vtype_set* s0, const vtype_set* s1) Pure__ Warn_unused_result__ Nonnull__(1,2);
extern int dict_compare (const vtype_dict* s0, const vtype_dict* s1) Pure__ Warn_unused_result__ Nonnull__(1,2);
/* Copy string and store result to the memory block */
extern void string_copy_init(vtype_string* x, const vtype_string* s) Nonnull__(1,2);
/* Copy array and store result to the memory block */
extern void array_copy_init(vtype_array* x, const vtype_array* s) Nonnull__(1,2);
/* Copy list and store result to the memory block */
extern void list_copy_init(vtype_list* x, const vtype_list* s) Nonnull__(1,2);
/* Copy map and store result to the memory block */
extern void map_copy_init(vtype_map* x, const vtype_map* s) Nonnull__(1,2);
/* Copy set and store result to the memory block */
extern void vset_copy_init(vtype_set* x, const vtype_set* s) Nonnull__(1,2);
/* Copy dict and store result to the memory block */
extern void dict_copy_init(vtype_dict* x, const vtype_dict* s) Nonnull__(1,2);
inline vtype_string string_copy (const vtype_string* s) Always_inline__ Pure__ Warn_unused_result__ Nonnull__(1);
extern vtype_array array_copy (const vtype_array* s) Pure__ Warn_unused_result__ Nonnull__(1);
extern vtype_list list_copy (const vtype_list* s) Pure__ Warn_unused_result__ Nonnull__(1);
extern vtype_map map_copy (const vtype_map* s) Pure__ Warn_unused_result__ Nonnull__(1);
extern vtype_set vset_copy (const vtype_set* s) Pure__ Warn_unused_result__ Nonnull__(1);
extern vtype_dict dict_copy (const vtype_dict* s) Pure__ Warn_unused_result__ Nonnull__(1);
extern vtype_list dict_copy_keys(const vtype_dict* s) Pure__ Warn_unused_result__ Nonnull__(1);
#define map_copy_keys(s) vset_copy((vtype_set*)s)
/* Free string resources */
extern void string_free(vtype_string* x);
/* Free array resources */
extern void array_free(vtype_array* x);
/* Free list resources */
extern void list_free(vtype_list* x);
/* Free map resources */
extern void map_free(vtype_map* x);
/* Free set resources */
extern void vset_free(vtype_set* x);
/* Free dict resources */
extern void dict_free(vtype_dict* x);
inline vtype_string* string_duplicate (const vtype_string* s) Always_inline__ Warn_unused_result__ Nonnull__(1);
extern vtype_array* array_duplicate (const vtype_array* s) Warn_unused_result__ Nonnull__(1);
extern vtype_list* list_duplicate (const vtype_list* s) Warn_unused_result__ Nonnull__(1);
extern vtype_map* map_duplicate (const vtype_map* s) Warn_unused_result__ Nonnull__(1);
extern vtype_set* vset_duplicate (const vtype_set* s) Warn_unused_result__ Nonnull__(1);
extern vtype_dict* dict_duplicate (const vtype_dict* s) Warn_unused_result__ Nonnull__(1);
extern vtype_list* dict_duplicate_keys(const vtype_dict* s) Warn_unused_result__ Nonnull__(1);
#define map_duplicate_keys(s) vset_duplicate((vtype_set*)s)
inline void string_copy_init (vtype_string* x, const vtype_string* s) Always_inline__ Nonnull__(1,2);
extern void array_copy_init (vtype_array* x, const vtype_array* s) Nonnull__(1,2);
extern void list_copy_init (vtype_list* x, const vtype_list* s) Nonnull__(1,2);
extern void map_copy_init (vtype_map* x, const vtype_map* s) Nonnull__(1,2);
extern void vset_copy_init (vtype_set* x, const vtype_set* s) Nonnull__(1,2);
extern void dict_copy_init (vtype_dict* x, const vtype_dict* s) Nonnull__(1,2);
extern void dict_init_keys (vtype_list* x, const vtype_dict* s) Nonnull__(1,2);
#define map_copy_init_keys(x, s) vset_duplicate(x, (vtype_set*)s)
inline void string_free(vtype_string* x) Always_inline__;
extern void array_free (vtype_array* x);
extern void list_free (vtype_list* x);
extern void map_free (vtype_map* x);
extern void vset_free (vtype_set* x);
extern void dict_free (vtype_dict* x);
/* Get hash of the string */
extern vtype_hash string_hash(const vtype_string* s) Pure__ Warn_unused_result__ Nonnull__(1);
/* Get hash of the array */
extern vtype_hash array_hash(const vtype_array* s) Pure__ Warn_unused_result__ Nonnull__(1);
/* Get hash of the list */
extern vtype_hash list_hash(const vtype_list* s) Pure__ Warn_unused_result__ Nonnull__(1);
/* Get hash of the map */
extern vtype_hash map_hash(const vtype_map* s) Pure__ Warn_unused_result__ Nonnull__(1);
/* Get hash of the set */
extern vtype_hash vset_hash(const vtype_set* s) Pure__ Warn_unused_result__ Nonnull__(1);
/* Get hash of the dict */
extern vtype_hash dict_hash(const vtype_dict* s) Pure__ Warn_unused_result__ Nonnull__(1);
extern vtype_hash array_hash (const vtype_array* s) Pure__ Warn_unused_result__ Nonnull__(1);
extern vtype_hash list_hash (const vtype_list* s) Pure__ Warn_unused_result__ Nonnull__(1);
extern vtype_hash map_hash (const vtype_map* s) Pure__ Warn_unused_result__ Nonnull__(1);
extern vtype_hash vset_hash (const vtype_set* s) Pure__ Warn_unused_result__ Nonnull__(1);
extern vtype_hash dict_hash (const vtype_dict* s) Pure__ Warn_unused_result__ Nonnull__(1);
/*#####################################################################################################################*/
inline size_t array_size (const vtype_array* x) { return x->size; }
inline size_t dict_size (const vtype_dict* x) { return x->size; }
inline size_t dict_capacity(const vtype_dict* x) { return x->capacity; }
inline size_t string_nmemb (const vtype_string* x) { return (x->buffer) ? libcdsb_strlen(x->buffer) : 0; }
inline void string_free ( vtype_string* x) { libcdsb_free(x->buffer); x->buffer = 0; }
inline vtype_string string_copy(const vtype_string* s) {
vtype_string x = { .buffer = libcdsb_strdup(s->buffer) };
return x;
}
inline vtype_string* string_duplicate(const vtype_string* s) {
void** x = libcdsb_malloc(sizeof(*x));
*x = libcdsb_strdup(s->buffer);
return (void*)x;
}
inline void string_copy_init(vtype_string* x, const vtype_string* s) {
x->buffer = libcdsb_strdup(s->buffer);
}
#endif /* LIBCDSB_VTYPE_H */

View File

@ -1,7 +1,7 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "../../include/__attributes.h"
#include "../../include/bits/__attributes.h"
#define pure__ Pure__
#define const__ __attribute__((const))

View File

@ -7,15 +7,11 @@
#include <stdlib.h>
#include "../../include/vtype.h"
#include "../../include/extra/memory.h"
#include "../../include/extra/cstring.h"
#include "../../include/extra/vtype.h"
#include "__attributes.h"
#ifndef LIBCDSB_SRC_INTERNAL_INCLUDE
#define LIBCDSB_SRC_INTERNAL_INCLUDE
extern const size_t LIBCDSB_VTYPE_SIZES[19];
#define is_x64 (sizeof(void*) == sizeof(vtype_uint64))
#define is_big_endian (*((unsigned int*)"\0\0\0\1") < (unsigned int)0xffff)
#define is_little_endian (!is_big_endian)
@ -38,8 +34,6 @@ extern const size_t LIBCDSB_VTYPE_SIZES[19];
#define abs(v) _Generic((v), ldbl_t: fabsl, dbl_t: fabs, fl_t: fabsf)(v)
#include "__attributes.h"
typedef vtype_uint8 u8_t;
typedef vtype_uint16 u16_t;
typedef vtype_uint32 u32_t;
@ -64,40 +58,46 @@ typedef vtype_dict dict_t;
typedef vtype_hash hash_t;
extern int libcdsb_vtype_compare_values (const void* s0, vtype t0, const void* s1, vtype t1) pure__ wur__;
extern int libcdsb_vtype_compare_values_eq(const void* s0, const void* s1, vtype t) pure__ wur__;
extern hash_t libcdsb_vtype_hash (const void* value, vtype type) pure__ wur__;
extern const size_t LIBCDSB_BUILTIN_VTYPE_SIZES[19];
extern int libcdsb_builtin_vtype_compare_values (const void* s0, vtype t0, const void* s1, vtype t1) pure__ wur__;
extern int libcdsb_builtin_vtype_compare_values_eq(const void* s0, const void* s1, vtype t) pure__ wur__;
extern hash_t libcdsb_builtin_vtype_hash (const void* value, vtype type) pure__ wur__;
ainline(stack_t* libcdsb_builtin_stack_insert(stack_t* x, void* v)) {
stack_t* p = x->prev;
if (!is_null(x->prev = malloc(sizeof(*x)))) {
x->prev->prev = p;
x->prev->value = v;
} else abort();
return x->prev;
}
#define aligned_alloc libcdsb_aalloc
#define malloc libcdsb_malloc
#define calloc libcdsb_calloc
#define realloc libcdsb_realloc
#define free libcdsb_free
#define stack_init libcdsb_stack_init
#define stack_push libcdsb_stack_push
#define stack_push_many libcdsb_stack_push_many
#define stack_insert libcdsb_builtin_stack_insert
#define stack_pop libcdsb_stack_pop
#define stack_reverse libcdsb_stack_reverse
#define stack_flush libcdsb_stack_flush
#define strlen libcdsb_strlen
#define strasciilen libcdsb_strasciilen
#define strdup libcdsb_strdup
#define strndup libcdsb_strndup
#define memndup libcdsb_memndup
#define vtype_stringify libcdsb_vtype_stringify
#define vtype_name libcdsb_vtype_name
#define vtype_compare libcdsb_vtype_compare_values
#define vtype_compare_eq libcdsb_vtype_compare_values_eq
#define vtype_hash libcdsb_vtype_hash
#define vtype_size(type) (LIBCDSB_VTYPE_SIZES[type])
#define vtypeof(x) (vtype)(_Generic((x),\
const void**: VTYPE_POINTER, void**: VTYPE_POINTER, const void*: VTYPE_POINTER, void*: VTYPE_POINTER,\
const char**: VTYPE_STRING, char**: VTYPE_STRING, const char*: VTYPE_STRING, char*: VTYPE_STRING,\
const str_t*: VTYPE_STRING, str_t*: VTYPE_STRING, str_t: VTYPE_STRING,\
const arr_t*: VTYPE_ARRAY, arr_t*: VTYPE_ARRAY, arr_t: VTYPE_ARRAY,\
const list_t*: VTYPE_LIST, list_t*: VTYPE_LIST, list_t: VTYPE_LIST,\
const map_t*: VTYPE_MAP, map_t*: VTYPE_MAP, map_t: VTYPE_MAP,\
const set_t*: VTYPE_SET, set_t*: VTYPE_SET, set_t: VTYPE_SET,\
const dict_t*: VTYPE_DICT, dict_t*: VTYPE_DICT, dict_t: VTYPE_DICT,\
const vtype_bool*: VTYPE_BOOLEAN, vtype_bool*: VTYPE_BOOLEAN, vtype_bool: VTYPE_BOOLEAN,\
const vtype_uint8*: VTYPE_UINT8, vtype_uint8*: VTYPE_UINT8, vtype_uint8: VTYPE_UINT8,\
const vtype_uint16*: VTYPE_UINT16, vtype_uint16*: VTYPE_UINT16, vtype_uint16: VTYPE_UINT16,\
const vtype_uint32*: VTYPE_UINT32, vtype_uint32*: VTYPE_UINT32, vtype_uint32: VTYPE_UINT32,\
const vtype_uint64*: VTYPE_UINT64, vtype_uint64*: VTYPE_UINT64, vtype_uint64: VTYPE_UINT64,\
const vtype_int8*: VTYPE_INT8, vtype_int8*: VTYPE_INT8, vtype_int8: VTYPE_INT8,\
const vtype_int16*: VTYPE_INT16, vtype_int16*: VTYPE_INT16, vtype_int16: VTYPE_INT16,\
const vtype_int32*: VTYPE_INT32, vtype_int32*: VTYPE_INT32, vtype_int32: VTYPE_INT32,\
const vtype_int64*: VTYPE_INT64, vtype_int64*: VTYPE_INT64, vtype_int64: VTYPE_INT64,\
const vtype_float*: VTYPE_FLOAT, vtype_float*: VTYPE_FLOAT, vtype_float: VTYPE_FLOAT,\
const vtype_double*: VTYPE_DOUBLE, vtype_double*: VTYPE_DOUBLE, vtype_double: VTYPE_DOUBLE,\
const vtype_ldouble*: VTYPE_LDOUBLE, vtype_ldouble*: VTYPE_LDOUBLE, vtype_ldouble: VTYPE_LDOUBLE))
#define vtype_compare libcdsb_builtin_vtype_compare_values
#define vtype_compare_eq libcdsb_builtin_vtype_compare_values_eq
#define vtype_hash libcdsb_builtin_vtype_hash
#define vtype_size(type) (LIBCDSB_BUILTIN_VTYPE_SIZES[type])
#endif /* LIBCDSB_SRC_INTERNAL_INCLUDE */

View File

@ -15,18 +15,28 @@ typedef struct libcdsb_rbtree_node {
short colored;
} rbnode_t;
extern rbnode_t LIBCDSB_RBTREE_NODE_EMPTY[1];
extern rbnode_t LIBCDSB_BUILTIN_RBTREE_NODE_EMPTY[1];
extern void* libcdsb_rbtree_node_create(void* value, rbnode_t* parent, int colored, int size) Nonnull__(1,2);
extern void libcdsb_rbtree_node_fixup (rbnode_t** root, rbnode_t* node) Nonnull__(1,2);
extern rbnode_t* libcdsb_rbtree_node_delete(rbnode_t** root, rbnode_t* node) Nonnull__(1,2);
extern void* libcdsb_builtin_rbtree_node_create(void* value, rbnode_t* parent, int colored, int size) Nonnull__( 2);
extern void libcdsb_builtin_rbtree_node_fixup (rbnode_t** root, rbnode_t* node) Nonnull__(1,2);
extern rbnode_t* libcdsb_builtin_rbtree_node_delete(rbnode_t** root, rbnode_t* node) Nonnull__(1,2);
#define rbnode_empty ((rbnode_t*)LIBCDSB_RBTREE_NODE_EMPTY)
#define rbnode_create(v, p, c) ((rbnode_t*)libcdsb_rbtree_node_create(v, p, c, sizeof(rbnode_t)))
#define rbnode_fixup libcdsb_rbtree_node_fixup
#define rbnode_delete libcdsb_rbtree_node_delete
extern stack_t libcdsb_builtin_rbtree_iter_inorder (rbnode_t** root, bool reverse);
extern stack_t libcdsb_builtin_rbtree_iter_preorder (rbnode_t** root, bool reverse);
extern stack_t libcdsb_builtin_rbtree_iter_postorder (rbnode_t** root, bool reverse);
extern stack_t libcdsb_builtin_rbtree_iter_breath_first(rbnode_t** root, bool reverse);
#define rbnode_empty ((rbnode_t*)LIBCDSB_BUILTIN_RBTREE_NODE_EMPTY)
#define rbnode_create(v, p, c) ((rbnode_t*)libcdsb_builtin_rbtree_node_create(v, p, c, sizeof(rbnode_t)))
#define rbnode_fixup libcdsb_builtin_rbtree_node_fixup
#define rbnode_delete libcdsb_builtin_rbtree_node_delete
#define rbnode_is_empty(n) ((n) == rbnode_empty)
#define rbnode_is_root(n) rbnode_is_empty((n)->parent)
#define rbiter_inorder libcdsb_builtin_rbtree_iter_inorder
#define rbiter_preorder libcdsb_builtin_rbtree_iter_preorder
#define rbiter_postorder libcdsb_builtin_rbtree_iter_postorder
#define rbiter_breath_first libcdsb_builtin_rbtree_iter_breath_first
#endif /* LIBCDSB_SRC_INTERNAL_RBTREE_H */

View File

@ -2,6 +2,7 @@
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
#include "assert.h"
#ifndef LIBCDSB_SRC_INTERNAL_VNODE_H
#define LIBCDSB_SRC_INTERNAL_VNODE_H
@ -18,22 +19,50 @@ typedef union {
typedef void* vnode_t;
extern vnode_t libcdsb_vnode_create (const void* value, vtype type) wur__;
extern vnode_t libcdsb_vnode_create_target(vtype target_type, const void* value, vtype type) wur__;
extern vnode_t libcdsb_builtin_vnode_create (const void* value, vtype type) wur__;
extern vnode_t libcdsb_builtin_vnode_create_target(vtype target_type, const void* value, vtype type) wur__;
extern void libcdsb_vnode_free(vnode_t* x, vtype type) Nonnull__(1);
extern void* libcdsb_vnode_peek(const vnode_t* x, vtype type) pure__ wur__ Nonnull__(1);
extern void libcdsb_builtin_vnode_free(vnode_t* x, vtype type) Nonnull__(1);
extern void* libcdsb_builtin_vnode_peek(const vnode_t* x, vtype type) pure__ wur__ Nonnull__(1);
#define vnode_create libcdsb_vnode_create
#define vnode_tcreate libcdsb_vnode_create_target
#define vnode_peek libcdsb_vnode_peek
#define vnode_free libcdsb_vnode_free
ainline(void libcdsb_builtin_vnode_attach(vnode_t* node, const void* value, vtype type)) {
if (type < VTYPE_STRING) {
*node = libcdsb_builtin_vnode_create(value, type);
} else if (sizeof(str_t) == sizeof(void*) && type == VTYPE_STRING) {
*node = *(char**)value;
} else {
*node = malloc(vtype_size(type));
memcpy(*node, value, vtype_size(type));
}
}
ainline(void libcdsb_builtin_vnode_tattach(vnode_t* node, vtype target_type, const void* value, vtype type)) {
if (type < VTYPE_STRING) {
*node = libcdsb_builtin_vnode_create_target(target_type, value, type);
} else {
type_assert(target_type, type);
if (sizeof(str_t) == sizeof(void*) && type == VTYPE_STRING) {
*node = *(char**)value;
} else {
*node = malloc(vtype_size(type));
memcpy(*node, value, vtype_size(type));
}
}
}
#define vnode_create libcdsb_builtin_vnode_create
#define vnode_tcreate libcdsb_builtin_vnode_create_target
#define vnode_attach libcdsb_builtin_vnode_attach
#define vnode_tattach libcdsb_builtin_vnode_tattach
#define vnode_peek libcdsb_builtin_vnode_peek
#define vnode_free libcdsb_builtin_vnode_free
#define vnode_hash(vnode, type) vtype_hash(vnode_peek(vnode, type), type)
#define vnode_compare(s0, t0, s1, t1) vtype_compare(vnode_peek(s0, t0), t0, vnode_peek(s1, t1), t1)
#define vnode_compare_eq(s0, s1, t) vtype_compare_eq(vnode_peek(s0, t), vnode_peek(s1, t), t)
#define vnode_duplicate(vnode, type) libcdsb_vnode_create(vnode_peek(vnode, type), type)
#define vnode_tduplicate(target_type, vnode, type) libcdsb_vnode_create_target(target_type, vnode_peek(vnode, type), type)
#define vnode_duplicate(vnode, type) vnode_create(vnode_peek(vnode, type), type)
#define vnode_tduplicate(target_type, vnode, type) vnode_tcreate(target_type, vnode_peek(vnode, type), type)
#define vnode_stringify(n, t) vtype_stringify(vnode_peek(n, t), t)

View File

@ -2,45 +2,13 @@
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
#include "../__internal/assert.h"
#include "../__internal/vnode.h"
ssize_t libcdsb_array_push(arr_t* x, const void* v, vtype t) {
ssize_t i = x->size;
vnode_t n = vnode_tcreate(x->type, v, t);
x->mem = realloc(x->mem, ++x->size * vtype_size(x->type));
memcpy(array_internal_at(x, i), vnode_peek(&n, x->type), vtype_size(x->type));
if (vtype_size(x->type) > sizeof(void*) && x->type < VTYPE_STRING)
vnode_free(&n, x->type);
return i;
void* at_array(const arr_t* x, ssize_t i) {
if (i < 0 && (i += x->size) < 0)
i = 0;
return x->mem + i * vtype_size(x->type);
}
size_t libcdsb_array_count(const arr_t* s, const void* v, vtype t) {
void *p;
void *e;
int cmp;
size_t n;
p = s->mem;
e = array_end(s);
n = 0;
do {
cmp = vtype_compare(p, s->type, v, t);
if (cmp == 0) ++n;
p += vtype_size(s->type);
} while (p < e);
return n;
}
int libcdsb_array_get(vtype_array* x, ssize_t i, void* _, array_access_callback callback, vtype_bool cut) {
int r = 0;
@ -55,7 +23,6 @@ int libcdsb_array_get(vtype_array* x, ssize_t i, void* _, array_access_callback
return r;
}
int libcdsb_array_find(arr_t* x, const void* v, vtype t, void* _, array_access_callback callback, bool r, bool cut) {
void *p;
ssize_t i;
@ -97,7 +64,6 @@ int libcdsb_array_find(arr_t* x, const void* v, vtype t, void* _, array_access_c
return cmp;
}
int libcdsb_array_foreach(vtype_array* x, void* data, array_access_callback callback, bool flush) {
void* p;

View File

@ -1,119 +0,0 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
#include "../__internal/assert.h"
typedef void (*type_free)(void*);
static inline type_free get_type_free(vtype type) {
switch (type) {
default:
#ifndef NDEBUG
abort();
#endif
case VTYPE_STRING: return (void*)string_free;
case VTYPE_ARRAY: return (void*) array_free;
case VTYPE_LIST: return (void*) list_free;
case VTYPE_MAP: return (void*) map_free;
case VTYPE_SET: return (void*) vset_free;
case VTYPE_DICT: return (void*) dict_free;
}
}
/*#####################################################################################################################*/
hash_t array_hash(const arr_t* s) {
hash_t hash = 0;
if (s->size > 0)
hash = vtype_hash(s->mem, s->type);
if (s->size > 1)
hash += vtype_hash(array_internal_at(s, s->size - 1), s->type);
hash ^= s->size;
return hash + VTYPE_ARRAY;
}
void array_init(arr_t* x, vtype t) {
x->type = t;
x->size = 0;
x->mem = nullptr;
}
void array_free(arr_t* x) {
if (x->size && x->type >= VTYPE_STRING) {
void* p = x->mem;
type_free free_;
assert(!is_null(p));
free_ = get_type_free(x->type);
do {
free_(p);
p += vtype_size(x->type);
} while (--x->size);
}
free(x->mem);
memset(x, 0, sizeof(*x));
}
/*#####################################################################################################################*/
size_t array_size (const arr_t* x) {
return x->size;
}
size_t array_nmemb(const arr_t* x) {
return x->size*vtype_size(x->type);
}
void* array_at(const arr_t* x, ssize_t i) {
if (i < 0 && (i += x->size) < 0) i = 0;
return x->mem + i*vtype_size(x->type);
}
/*#####################################################################################################################*/
int array_compare(const arr_t* s0, const arr_t* s1) {
void *e;
void *p0;
void *p1;
int c;
if (s0 == s1)
return 0;
if (s0->type != s1->type)
return (s0->type < s1->type) ? -1 : 1;
if (s0->size != s1->size)
return (s0->size < s1->size) ? -1 : 1;
if (!s0->size && !s0->size)
return 0;
assert(!is_null(s0->mem) && !is_null(s1->mem));
p0 = s0->mem;
p1 = s1->mem;
e = array_end(s0);
do {
c = vtype_compare_eq(p0, p1, s0->type);
if (c == 0) {
p0 += vtype_size(s0->type);
p1 += vtype_size(s0->type);
} else return c;
} while (p0 < e);
return 0;
}

35
src/array/comparison.c Normal file
View File

@ -0,0 +1,35 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
int array_compare(const arr_t* s0, const arr_t* s1) {
void *e, *p0, *p1;
int cmp;
if (s0 == s1 || (!s0->size && !s0->size))
return 0;
if (s0->type != s1->type)
return (s0->type < s1->type) ? -1 : 1;
if (s0->size != s1->size)
return (s0->size < s1->size) ? -1 : 1;
p0 = s0->mem;
p1 = s1->mem;
e = array_end(s0);
do {
cmp = vtype_compare_eq(p0, p1, s0->type);
if (cmp == 0) {
p0 += vtype_size(s0->type);
p1 += vtype_size(s0->type);
} else return cmp;
} while (p0 < e);
return 0;
}

46
src/array/compute.c Normal file
View File

@ -0,0 +1,46 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
#include "../__internal/assert.h"
size_t array_nmemb(const arr_t* x) {
return x->size*vtype_size(x->type);
}
hash_t array_hash(const arr_t* s) {
hash_t hash = 0;
if (s->size > 0)
hash = vtype_hash(s->mem, s->type);
if (s->size > 1)
hash += vtype_hash(array_internal_at(s, s->size - 1), s->type);
hash ^= s->size;
return hash + VTYPE_ARRAY;
}
size_t libcdsb_array_count(const arr_t* s, const void* v, vtype t) {
void *p;
void *e;
int cmp;
size_t n;
p = s->mem;
e = array_end(s);
n = 0;
do {
cmp = vtype_compare(p, s->type, v, t);
if (cmp == 0) ++n;
p += vtype_size(s->type);
} while (p < e);
return n;
}

View File

@ -4,23 +4,6 @@
#include "include.h"
#include "../__internal/assert.h"
typedef void (*type_initializer)(void*, const void*);
static inline type_initializer get_type_initializer(vtype type) {
switch (type) {
default:
#ifndef NDEBUG
abort();
#endif
case VTYPE_STRING: return (void*)string_copy_init;
case VTYPE_ARRAY: return (void*) array_copy_init;
case VTYPE_LIST: return (void*) list_copy_init;
case VTYPE_MAP: return (void*) map_copy_init;
case VTYPE_SET: return (void*) vset_copy_init;
case VTYPE_DICT: return (void*) dict_copy_init;
}
}
arr_t array_copy(const arr_t* s) {
arr_t x = { .mem = 0, .size = 0, .type = 0 };
@ -30,15 +13,13 @@ arr_t array_copy(const arr_t* s) {
if (s->type >= VTYPE_STRING) {
void *p, *v, *e;
type_initializer init;
x.mem = p = malloc(x.size*vtype_size(x.type));
v = s->mem;
e = array_end(&x);
init = get_type_initializer(s->type);
do {
init(p, v);
copy_init(p, v, s->type);
p += vtype_size(x.type);
v += vtype_size(x.type);
} while (p < e);
@ -59,15 +40,13 @@ arr_t* array_duplicate(const arr_t* s) {
if (s->type >= VTYPE_STRING) {
void *p, *v, *e;
type_initializer init;
x->mem = p = malloc(x->size*vtype_size(x->type));
v = s->mem;
e = array_end(x);
init = get_type_initializer(s->type);
do {
init(p, v);
copy_init(p, v, s->type);
p += vtype_size(x->type);
v += vtype_size(x->type);
} while (p < e);
@ -86,15 +65,13 @@ void array_copy_init(arr_t* x, const arr_t* s) {
if (s->type >= VTYPE_STRING) {
void *p, *v, *e;
type_initializer init;
x->mem = p = malloc(x->size*vtype_size(x->type));
v = s->mem;
e = array_end(x);
init = get_type_initializer(s->type);
do {
init(p, v);
copy_init(p, v, s->type);
p += vtype_size(x->type);
v += vtype_size(x->type);
} while (p < e);
@ -120,15 +97,13 @@ size_t array_slice(arr_t* x, arr_t* s, ssize_t i, size_t n, _Bool cut) {
if (!cut && s->type >= VTYPE_STRING) {
void *p, *v, *e;
type_initializer init;
p = x->mem;
v = array_internal_at(s, i);
e = array_internal_at(x, n);
init = get_type_initializer(s->type);
do {
init(p, v);
copy_init(p, v, s->type);
p += vtype_size(x->type);
v += vtype_size(x->type);
} while (p < e);

View File

@ -1,67 +0,0 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
int libcdsb_array_find_pointer(arr_t* x, const void* v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_array_find_cstring(arr_t* x, const char* v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_array_find_string (arr_t* x, const str_t* v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, v, vtypeof( v), _, cb, r, cut); }
int libcdsb_array_find_array (arr_t* x, const arr_t* v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, v, vtypeof( v), _, cb, r, cut); }
int libcdsb_array_find_list (arr_t* x, const list_t* v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, v, vtypeof( v), _, cb, r, cut); }
int libcdsb_array_find_map (arr_t* x, const map_t* v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, v, vtypeof( v), _, cb, r, cut); }
int libcdsb_array_find_vset (arr_t* x, const set_t* v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, v, vtypeof( v), _, cb, r, cut); }
int libcdsb_array_find_dict (arr_t* x, const dict_t* v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, v, vtypeof( v), _, cb, r, cut); }
int libcdsb_array_find_boolean(arr_t* x, bool v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_array_find_int8 (arr_t* x, s8_t v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_array_find_int16 (arr_t* x, s16_t v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_array_find_int32 (arr_t* x, s32_t v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_array_find_int64 (arr_t* x, s64_t v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_array_find_uint8 (arr_t* x, u8_t v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_array_find_uint16 (arr_t* x, u16_t v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_array_find_uint32 (arr_t* x, u32_t v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_array_find_uint64 (arr_t* x, u64_t v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_array_find_float (arr_t* x, fl_t v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_array_find_double (arr_t* x, dbl_t v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_array_find_ldouble(arr_t* x, ldbl_t v, void* _, array_access_callback cb, bool r, bool cut) { return libcdsb_array_find(x, &v, vtypeof(&v), _, cb, r, cut); }
size_t libcdsb_array_count_pointer(const arr_t* x, const void* v) { return libcdsb_array_count(x, &v, vtypeof(&v)); }
size_t libcdsb_array_count_cstring(const arr_t* x, const char* v) { return libcdsb_array_count(x, &v, vtypeof(&v)); }
size_t libcdsb_array_count_string (const arr_t* x, const str_t* v) { return libcdsb_array_count(x, v, vtypeof( v)); }
size_t libcdsb_array_count_array (const arr_t* x, const arr_t* v) { return libcdsb_array_count(x, v, vtypeof( v)); }
size_t libcdsb_array_count_list (const arr_t* x, const list_t* v) { return libcdsb_array_count(x, v, vtypeof( v)); }
size_t libcdsb_array_count_map (const arr_t* x, const map_t* v) { return libcdsb_array_count(x, v, vtypeof( v)); }
size_t libcdsb_array_count_vset (const arr_t* x, const set_t* v) { return libcdsb_array_count(x, v, vtypeof( v)); }
size_t libcdsb_array_count_dict (const arr_t* x, const dict_t* v) { return libcdsb_array_count(x, v, vtypeof( v)); }
size_t libcdsb_array_count_boolean(const arr_t* x, bool v) { return libcdsb_array_count(x, &v, vtypeof(&v)); }
size_t libcdsb_array_count_int8 (const arr_t* x, s8_t v) { return libcdsb_array_count(x, &v, vtypeof(&v)); }
size_t libcdsb_array_count_int16 (const arr_t* x, s16_t v) { return libcdsb_array_count(x, &v, vtypeof(&v)); }
size_t libcdsb_array_count_int32 (const arr_t* x, s32_t v) { return libcdsb_array_count(x, &v, vtypeof(&v)); }
size_t libcdsb_array_count_int64 (const arr_t* x, s64_t v) { return libcdsb_array_count(x, &v, vtypeof(&v)); }
size_t libcdsb_array_count_uint8 (const arr_t* x, u8_t v) { return libcdsb_array_count(x, &v, vtypeof(&v)); }
size_t libcdsb_array_count_uint16 (const arr_t* x, u16_t v) { return libcdsb_array_count(x, &v, vtypeof(&v)); }
size_t libcdsb_array_count_uint32 (const arr_t* x, u32_t v) { return libcdsb_array_count(x, &v, vtypeof(&v)); }
size_t libcdsb_array_count_uint64 (const arr_t* x, u64_t v) { return libcdsb_array_count(x, &v, vtypeof(&v)); }
size_t libcdsb_array_count_float (const arr_t* x, fl_t v) { return libcdsb_array_count(x, &v, vtypeof(&v)); }
size_t libcdsb_array_count_double (const arr_t* x, dbl_t v) { return libcdsb_array_count(x, &v, vtypeof(&v)); }
size_t libcdsb_array_count_ldouble(const arr_t* x, ldbl_t v) { return libcdsb_array_count(x, &v, vtypeof(&v)); }
void libcdsb_array_push_pointer(arr_t* x, const void* v) { libcdsb_array_push(x, &v, vtypeof(&v)); }
void libcdsb_array_push_cstring(arr_t* x, const char* v) { libcdsb_array_push(x, &v, vtypeof(&v)); }
void libcdsb_array_push_string (arr_t* x, const str_t* v) { libcdsb_array_push(x, v, vtypeof( v)); }
void libcdsb_array_push_array (arr_t* x, const arr_t* v) { libcdsb_array_push(x, v, vtypeof( v)); }
void libcdsb_array_push_list (arr_t* x, const list_t* v) { libcdsb_array_push(x, v, vtypeof( v)); }
void libcdsb_array_push_map (arr_t* x, const map_t* v) { libcdsb_array_push(x, v, vtypeof( v)); }
void libcdsb_array_push_vset (arr_t* x, const set_t* v) { libcdsb_array_push(x, v, vtypeof( v)); }
void libcdsb_array_push_dict (arr_t* x, const dict_t* v) { libcdsb_array_push(x, v, vtypeof( v)); }
void libcdsb_array_push_boolean(arr_t* x, bool v) { libcdsb_array_push(x, &v, vtypeof(&v)); }
void libcdsb_array_push_int8 (arr_t* x, s8_t v) { libcdsb_array_push(x, &v, vtypeof(&v)); }
void libcdsb_array_push_int16 (arr_t* x, s16_t v) { libcdsb_array_push(x, &v, vtypeof(&v)); }
void libcdsb_array_push_int32 (arr_t* x, s32_t v) { libcdsb_array_push(x, &v, vtypeof(&v)); }
void libcdsb_array_push_int64 (arr_t* x, s64_t v) { libcdsb_array_push(x, &v, vtypeof(&v)); }
void libcdsb_array_push_uint8 (arr_t* x, u8_t v) { libcdsb_array_push(x, &v, vtypeof(&v)); }
void libcdsb_array_push_uint16 (arr_t* x, u16_t v) { libcdsb_array_push(x, &v, vtypeof(&v)); }
void libcdsb_array_push_uint32 (arr_t* x, u32_t v) { libcdsb_array_push(x, &v, vtypeof(&v)); }
void libcdsb_array_push_uint64 (arr_t* x, u64_t v) { libcdsb_array_push(x, &v, vtypeof(&v)); }
void libcdsb_array_push_float (arr_t* x, fl_t v) { libcdsb_array_push(x, &v, vtypeof(&v)); }
void libcdsb_array_push_double (arr_t* x, dbl_t v) { libcdsb_array_push(x, &v, vtypeof(&v)); }
void libcdsb_array_push_ldouble(arr_t* x, ldbl_t v) { libcdsb_array_push(x, &v, vtypeof(&v)); }

View File

@ -2,12 +2,26 @@
/* Copyright © 2022 Gregory Lirent */
#include "../../include/array.h"
#include "../../include/extra/array.h"
#include "../__internal/include.h"
#ifndef LIBCDSB_SRC_ARRAY_INCLUDE_H
#define LIBCDSB_SRC_ARRAY_INCLUDE_H
ainline(void copy_init(void* x, const void* s, vtype t)) {
switch (t) {
default:
#ifndef NDEBUG
abort();
#endif
case VTYPE_STRING: string_copy_init(x, s); break;
case VTYPE_ARRAY: array_copy_init(x, s); break;
case VTYPE_LIST: list_copy_init(x, s); break;
case VTYPE_MAP: map_copy_init(x, s); break;
case VTYPE_SET: vset_copy_init(x, s); break;
case VTYPE_DICT: dict_copy_init(x, s); break;
}
}
ainline(void array_cut(arr_t* x, size_t i, size_t n)) {
void* v = x->mem + i*vtype_size(x->type);
void* e = v + n*vtype_size(x->type);

32
src/array/memory.c Normal file
View File

@ -0,0 +1,32 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
#include "../__internal/assert.h"
void array_free(arr_t* x) {
if (x->size && x->type >= VTYPE_STRING) {
void* p = x->mem;
assert(!is_null(p));
do {
switch (x->type) {
default:
#ifndef NDEBUG
abort();
#endif
case VTYPE_STRING: string_free(p); break;
case VTYPE_ARRAY: array_free(p); break;
case VTYPE_LIST: list_free(p); break;
case VTYPE_MAP: map_free(p); break;
case VTYPE_SET: vset_free(p); break;
case VTYPE_DICT: dict_free(p); break;
}
p += vtype_size(x->type);
} while (--x->size);
}
free(x->mem);
memset(x, 0, sizeof(*x));
}

52
src/array/modify.c Normal file
View File

@ -0,0 +1,52 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
#include "../__internal/assert.h"
#include "../__internal/vnode.h"
ssize_t libcdsb_array_insert(arr_t* x, const void* v, vtype t) {
ssize_t i;
vnode_t n;
i = x->size;
n = vnode_tcreate(x->type, v, t);
x->mem = realloc(x->mem, ++x->size * vtype_size(x->type));
if (t < VTYPE_STRING) {
n = vnode_tcreate(x->type, v, t);
memcpy(array_internal_at(x, i), vnode_peek(&n, x->type), vtype_size(x->type));
if (vtype_size(x->type) > sizeof(vnode_t))
vnode_free(&n, x->type);
} else {
type_assert(x->type, t);
copy_init(array_internal_at(x, i), v, t);
}
return i;
}
ssize_t libcdsb_array_attach(arr_t* x, const void* v, vtype t) {
ssize_t i;
vnode_t n;
i = x->size;
x->mem = realloc(x->mem, ++x->size * vtype_size(x->type));
if (t < VTYPE_STRING) {
n = vnode_tcreate(x->type, v, t);
memcpy(array_internal_at(x, i), vnode_peek(&n, x->type), vtype_size(x->type));
if (vtype_size(x->type) > sizeof(vnode_t))
vnode_free(&n, x->type);
} else {
type_assert(x->type, t);
memcpy(array_internal_at(x, i), v, vtype_size(t));
}
return i;
}

View File

@ -4,78 +4,42 @@
#include "include.h"
#include "../__internal/assert.h"
static_assert((
VTYPE_UINT8 == 2 &&
VTYPE_UINT16 == 3 &&
VTYPE_UINT32 == 4 &&
VTYPE_UINT64 == 5 &&
VTYPE_INT8 == 6 &&
VTYPE_INT16 == 7 &&
VTYPE_INT32 == 8 &&
VTYPE_INT64 == 9 &&
VTYPE_FLOAT == 10 &&
VTYPE_DOUBLE == 11 &&
VTYPE_LDOUBLE == 12 &&
VTYPE_STRING == 13 &&
VTYPE_MAP == 14 &&
VTYPE_ARRAY == 15 &&
VTYPE_LIST == 16 &&
VTYPE_SET == 17
), "enum values assertion");
typedef int (*compare_f)(const void*, const void*);
static int uint8_compare (const u8_t* s0, const u8_t* s1) { if (*s0 == *s1) return 0; return *s0 < *s1 ? -1 : 1; }
static int uint16_compare (const u16_t* s0, const u16_t* s1) { if (*s0 == *s1) return 0; return *s0 < *s1 ? -1 : 1; }
static int uint32_compare (const u32_t* s0, const u32_t* s1) { if (*s0 == *s1) return 0; return *s0 < *s1 ? -1 : 1; }
static int uint64_compare (const u64_t* s0, const u64_t* s1) { if (*s0 == *s1) return 0; return *s0 < *s1 ? -1 : 1; }
static int int8_compare (const s8_t* s0, const s8_t* s1) { if (*s0 == *s1) return 0; return *s0 < *s1 ? -1 : 1; }
static int int16_compare (const s16_t* s0, const s16_t* s1) { if (*s0 == *s1) return 0; return *s0 < *s1 ? -1 : 1; }
static int int32_compare (const s32_t* s0, const s32_t* s1) { if (*s0 == *s1) return 0; return *s0 < *s1 ? -1 : 1; }
static int int64_compare (const s64_t* s0, const s64_t* s1) { if (*s0 == *s1) return 0; return *s0 < *s1 ? -1 : 1; }
static int float_compare (const fl_t* s0, const fl_t* s1) { if (*s0 == *s1) return 0; return *s0 < *s1 ? -1 : 1; }
static int double_compare (const dbl_t* s0, const dbl_t* s1) { if (*s0 == *s1) return 0; return *s0 < *s1 ? -1 : 1; }
static int ldouble_compare(const ldbl_t* s0, const ldbl_t* s1) { if (*s0 == *s1) return 0; return *s0 < *s1 ? -1 : 1; }
static int libcdsb_builtin_compare_uint8 (const u8_t* s0, const u8_t* s1) { if (*s0 == *s1) return 0; return *s0 < *s1 ? -1 : 1; }
static int libcdsb_builtin_compare_uint16 (const u16_t* s0, const u16_t* s1) { if (*s0 == *s1) return 0; return *s0 < *s1 ? -1 : 1; }
static int libcdsb_builtin_compare_uint32 (const u32_t* s0, const u32_t* s1) { if (*s0 == *s1) return 0; return *s0 < *s1 ? -1 : 1; }
static int libcdsb_builtin_compare_uint64 (const u64_t* s0, const u64_t* s1) { if (*s0 == *s1) return 0; return *s0 < *s1 ? -1 : 1; }
static int libcdsb_builtin_compare_int8 (const s8_t* s0, const s8_t* s1) { if (*s0 == *s1) return 0; return *s0 < *s1 ? -1 : 1; }
static int libcdsb_builtin_compare_int16 (const s16_t* s0, const s16_t* s1) { if (*s0 == *s1) return 0; return *s0 < *s1 ? -1 : 1; }
static int libcdsb_builtin_compare_int32 (const s32_t* s0, const s32_t* s1) { if (*s0 == *s1) return 0; return *s0 < *s1 ? -1 : 1; }
static int libcdsb_builtin_compare_int64 (const s64_t* s0, const s64_t* s1) { if (*s0 == *s1) return 0; return *s0 < *s1 ? -1 : 1; }
static int libcdsb_builtin_compare_float (const fl_t* s0, const fl_t* s1) { if (*s0 == *s1) return 0; return *s0 < *s1 ? -1 : 1; }
static int libcdsb_builtin_compare_double (const dbl_t* s0, const dbl_t* s1) { if (*s0 == *s1) return 0; return *s0 < *s1 ? -1 : 1; }
static int libcdsb_builtin_compare_ldouble(const ldbl_t* s0, const ldbl_t* s1) { if (*s0 == *s1) return 0; return *s0 < *s1 ? -1 : 1; }
static int (*COMPARE[16])(const void*, const void*) = {
(void*) uint8_compare,
(void*) uint16_compare,
(void*) uint32_compare,
(void*) uint64_compare,
(void*) int8_compare,
(void*) int16_compare,
(void*) int32_compare,
(void*) int64_compare,
(void*) float_compare,
(void*) double_compare,
(void*) ldouble_compare,
(void*) string_compare,
(void*) map_compare,
(void*) array_compare,
(void*) list_compare,
(void*) vset_compare
};
static compare_f libcdsb_builtin_get_comparator(vtype t) {
static void* comparators[17] = { libcdsb_builtin_compare_uint8, libcdsb_builtin_compare_uint16,
libcdsb_builtin_compare_uint32, libcdsb_builtin_compare_uint64,
libcdsb_builtin_compare_int8, libcdsb_builtin_compare_int16,
libcdsb_builtin_compare_int32, libcdsb_builtin_compare_int64,
libcdsb_builtin_compare_float, libcdsb_builtin_compare_double,
libcdsb_builtin_compare_ldouble, string_compare, map_compare,
array_compare, list_compare, vset_compare, dict_compare };
/*#####################################################################################################################*/
ainline(int get_compare_index(vtype t)) {
if (t == VTYPE_POINTER) {
if (is_x64) t = VTYPE_UINT64;
else t = VTYPE_UINT32;
} else if (t == VTYPE_BOOLEAN) t = VTYPE_UINT8;
return t - VTYPE_UINT8;
return comparators[t - VTYPE_UINT8];
}
/*#####################################################################################################################*/
void array_sort(arr_t* x) {
int i = get_compare_index(x->type);
if (x->size > 1)
qsort(x->mem, x->size, vtype_size(x->type), COMPARE[i]);
qsort(x->mem, x->size, vtype_size(x->type), libcdsb_builtin_get_comparator(x->type));
}
void array_reverse(arr_t* x) {

View File

@ -1,9 +1,27 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "../include/extra/cstring.h"
#include "../modules/libunic/include.h"
#include "__internal/include.h"
static _Thread_local int LIBCDSB_BUILTIN_COUNTER = 0;
static _Thread_local char LIBCDSB_BUILTIN_BUFFER[16][5];
const char* libcdsb_char_to_cstring(int c) {
char* p;
if (LIBCDSB_BUILTIN_COUNTER > 15)
LIBCDSB_BUILTIN_COUNTER = 0;
if (is_null(p = tochar_unicode(LIBCDSB_BUILTIN_BUFFER[LIBCDSB_BUILTIN_COUNTER], c))) {
LIBCDSB_BUILTIN_BUFFER[LIBCDSB_BUILTIN_COUNTER][0] = 0;
} else *p = 0;
return LIBCDSB_BUILTIN_BUFFER[LIBCDSB_BUILTIN_COUNTER++];
}
size_t libcdsb_strlen(const char* s) {
static const size_t m = (sizeof(size_t) == 8) ? 0x8080808080808080UL : 0x80808080UL;
static const size_t d = (sizeof(size_t) == 8) ? 0x0101010101010101UL : 0x01010101UL;

87
src/dict/access.c Normal file
View File

@ -0,0 +1,87 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
int libcdsb_dict_find(dict_t* x, const void* k, vtype t, void* dt, dict_access_callback callback, bool cut) {
dnode_t *c, **p;
int r;
void* key;
if (x->capacity) {
c = *(p = x->nodes + (vtype_hash(k, t) % x->capacity));
while (!is_null(c)) {
key = vnode_peek(&c->key, c->key_type);
if (vtype_compare(k, t, key, c->key_type) == 0) {
r = (callback) ? callback(key, c->key_type, vnode_peek(&c->value, c->value_type), c->value_type, dt) : 0;
if (cut) {
*p = c->prev;
vnode_free(&c->key, c->key_type);
vnode_free(&c->value, c->value_type);
free(c);
--x->size;
}
return r;
} else c = *(p = &c->prev);
}
}
return -1;
}
int libcdsb_dict_foreach(dict_t* x, void* dt, dict_access_callback callback, bool flush) {
dnode_t *c;
ssize_t i;
int r;
r = 0;
i = x->capacity;
while (i) {
c = x->nodes[--i];
while (!is_null(c)) {
r = callback(vnode_peek(&c->key, c->key_type), c->key_type,
vnode_peek(&c->value, c->value_type), c->value_type, dt);
c = c->prev;
if (r) {
if (!flush) goto end_;
else goto flush_loop_;
} else if (flush) {
vnode_free(&x->nodes[i]->key, x->nodes[i]->key_type);
vnode_free(&x->nodes[i]->value, x->nodes[i]->value_type);
free(x->nodes[i]);
x->nodes[i] = c;
}
}
}
if (flush) {
while (i) {
--i;
while (!is_null(x->nodes[i])) { flush_loop_:
vnode_free(&x->nodes[i]->key, x->nodes[i]->key_type);
vnode_free(&x->nodes[i]->value, x->nodes[i]->value_type);
c = x->nodes[i]->prev;
free(x->nodes[i]);
x->nodes[i] = c;
}
}
free(x->nodes);
memset(x, 0, sizeof(*x));
}
end_:
return r;
}

View File

@ -1,111 +0,0 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
/*#####################################################################################################################*/
hash_t dict_hash(const dict_t* s) {
dnode_t *min, *max;
size_t i;
dnode_t *c;
hash_t hash;
if (!s->size)
return 0;
min = max = nullptr;
i = s->capacity;
while (i--) {
c = s->nodes[i];
while (!is_null(c)) {
if (is_null(min) || vnode_compare(&c->key, c->key_type, &min->key, min->key_type) < 0) min = c;
if (is_null(max) || vnode_compare(&c->key, c->key_type, &max->key, max->key_type) > 0) max = c;
c = c->prev;
}
}
hash = vnode_hash(&min->key, min->key_type);
if (s->size > 0)
hash += vnode_hash(&max->key, max->key_type);
return (hash ^ s->size) + VTYPE_DICT;
}
void dict_init(dict_t* x) {
memset(x, 0, sizeof(*x));
}
/*#####################################################################################################################*/
void dict_free(dict_t* x) {
while (x->capacity--) {
while (!is_null(x->nodes[x->capacity])) {
vnode_free(&x->nodes[x->capacity]->key, x->nodes[x->capacity]->key_type);
vnode_free(&x->nodes[x->capacity]->value, x->nodes[x->capacity]->value_type);
x->nodes[x->capacity] = x->nodes[x->capacity]->prev;
}
}
free(x->nodes);
memset(x, 0, sizeof(*x));
}
/*#####################################################################################################################*/
size_t dict_size(const dict_t* x) {
return x->size;
}
size_t dict_capacity(const dict_t* x) {
return x->capacity;
}
/*#####################################################################################################################*/
int dict_compare(const dict_t* s0, const dict_t* s1) {
dnode_t *c0, *c1;
size_t i;
int cmp;
if (s0 == s1)
return 0;
if (s0->size != s1->size)
return s0->size < s1->size ? -1 : 1;
i = s0->capacity;
while (i--) {
c0 = s0->nodes[i];
while (!is_null(c0)) {
c1 = s1->nodes[vnode_hash(&c0->key, c0->key_type) % s1->capacity];
cmp = -1;
while (!is_null(c1)) {
if ((cmp = vnode_compare(&c0->key, c0->key_type, &c1->key, c1->key_type) == 0)) {
cmp = vnode_compare(&c0->value, c0->value_type, &c1->value, c1->value_type);
break;
}
c1 = c1->prev;
}
if (cmp) return cmp;
c0 = c0->prev;
}
}
return 0;
}

44
src/dict/comparison.c Normal file
View File

@ -0,0 +1,44 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
int dict_compare(const dict_t* s0, const dict_t* s1) {
dnode_t *c0, *c1;
size_t i;
int cmp;
if (s0 == s1)
return 0;
if (s0->size != s1->size)
return s0->size < s1->size ? -1 : 1;
i = s0->capacity;
while (i--) {
c0 = s0->nodes[i];
while (!is_null(c0)) {
c1 = s1->nodes[vnode_hash(&c0->key, c0->key_type) % s1->capacity];
cmp = -1;
while (!is_null(c1)) {
if ((cmp = vnode_compare(&c0->key, c0->key_type, &c1->key, c1->key_type) == 0)) {
cmp = vnode_compare(&c0->value, c0->value_type, &c1->value, c1->value_type);
break;
}
c1 = c1->prev;
}
if (cmp) return cmp;
c0 = c0->prev;
}
}
return 0;
}

35
src/dict/compute.c Normal file
View File

@ -0,0 +1,35 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
hash_t dict_hash(const dict_t* s) {
dnode_t *min, *max;
size_t i;
dnode_t *c;
hash_t hash;
if (!s->size)
return 0;
min = max = nullptr;
i = s->capacity;
while (i--) {
c = s->nodes[i];
while (!is_null(c)) {
if (is_null(min) || vnode_compare(&c->key, c->key_type, &min->key, min->key_type) < 0) min = c;
if (is_null(max) || vnode_compare(&c->key, c->key_type, &max->key, max->key_type) > 0) max = c;
c = c->prev;
}
}
hash = vnode_hash(&min->key, min->key_type);
if (s->size > 0)
hash += vnode_hash(&max->key, max->key_type);
return (hash ^ s->size) + VTYPE_DICT;
}

View File

@ -1,11 +1,10 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "../list/include.h"
#include "include.h"
/*#####################################################################################################################*/
static inline dnode_t* dnode_duplicate(const dnode_t* s, dnode_t* p) {
static inline dnode_t* libcdsb_builtin_duplicate(const dnode_t* s, dnode_t* p) {
dnode_t* x = malloc(sizeof(*x));
x->prev = p;
@ -32,7 +31,7 @@ dict_t dict_copy(const dict_t* s) {
n = s->nodes[i];
while (!is_null(n)) {
x.nodes[i] = dnode_duplicate(n, x.nodes[i]);
x.nodes[i] = libcdsb_builtin_duplicate(n, x.nodes[i]);
n = n->prev;
}
}
@ -54,7 +53,7 @@ dict_t* dict_duplicate(const dict_t* s) {
n = s->nodes[i];
while (!is_null(n)) {
x->nodes[i] = dnode_duplicate(n, x->nodes[i]);
x->nodes[i] = libcdsb_builtin_duplicate(n, x->nodes[i]);
n = n->prev;
}
}
@ -75,8 +74,81 @@ void dict_copy_init(dict_t* x, const dict_t* s) {
n = s->nodes[i];
while (!is_null(n)) {
x->nodes[i] = dnode_duplicate(n, x->nodes[i]);
x->nodes[i] = libcdsb_builtin_duplicate(n, x->nodes[i]);
n = n->prev;
}
}
}
list_t libcdsb_dict_copy_keys(const dict_t* s) {
list_t x;
dnode_t *c;
size_t i;
i = s->capacity;
list_init(&x);
while (i--) {
c = s->nodes[i];
while (!is_null(c)) {
if (is_null(x.first)) {
libcdsb_builtin_init(&x, vnode_duplicate(&c->key, c->key_type), c->key_type);
} else libcdsb_builtin_push(&x, vnode_duplicate(&c->key, c->key_type), c->key_type);
c = c->prev;
}
}
return x;
}
list_t* libcdsb_dict_duplicate_keys(const dict_t* s) {
list_t* x;
dnode_t *c;
size_t i;
x = malloc(sizeof(*x));
i = s->capacity;
list_init(x);
while (i--) {
c = s->nodes[i];
while (!is_null(c)) {
if (is_null(x->first)) {
libcdsb_builtin_init(x, vnode_duplicate(&c->key, c->key_type), c->key_type);
} else libcdsb_builtin_push(x, vnode_duplicate(&c->key, c->key_type), c->key_type);
c = c->prev;
}
}
return x;
}
void libcdsb_dict_init_keys(list_t* x, const dict_t* s) {
dnode_t *c;
size_t i;
x = malloc(sizeof(*x));
i = s->capacity;
list_init(x);
while (i--) {
c = s->nodes[i];
while (!is_null(c)) {
if (is_null(x->first)) {
libcdsb_builtin_init(x, vnode_duplicate(&c->key, c->key_type), c->key_type);
} else libcdsb_builtin_push(x, vnode_duplicate(&c->key, c->key_type), c->key_type);
c = c->prev;
}
}
}

View File

@ -1,236 +0,0 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "../../include/extra/list.h"
#include "include.h"
/*#####################################################################################################################*/
static void dict_rehash(dict_t* s, size_t capacity) {
dnode_t **nodes, *c, *n, **p;
size_t i;
i = s->capacity;
nodes = calloc(sizeof(*nodes), capacity);
while (i--) {
c = s->nodes[i];
while (!is_null(c)) {
p = nodes + (vnode_hash(&c->key, c->key_type) % capacity);
n = c->prev;
c->prev = *p;
*p = c;
c = n;
}
}
free(s->nodes);
s->nodes = nodes;
s->capacity = capacity;
}
/*#####################################################################################################################*/
bool libcdsb_dict_shrink_to_fit(dict_t* s) {
size_t capacity;
capacity = (s->size / CAPACITY_BLOCK) + 1;
capacity *= CAPACITY_BLOCK;
while (((double)s->size / capacity) > 0.65)
capacity += CAPACITY_BLOCK;
if (capacity >= s->capacity)
return false;
dict_rehash(s, capacity);
return true;
}
bool libcdsb_dict_update(dict_t* x, const void* k, vtype kt, const void* v, vtype vt) {
dnode_t *c, **p;
if (!x->capacity || (double)x->size / x->capacity > REBUILD_POINT_MAX)
dict_rehash(x, x->capacity + CAPACITY_BLOCK);
c = *(p = x->nodes + (vtype_hash(k, kt) % x->capacity));
while (!is_null(c)) {
if (vtype_compare(k, kt, vnode_peek(&c->key, c->key_type), c->key_type) == 0) {
vnode_free(&c->value, c->value_type);
c->value = vnode_create(v, vt);
c->value_type = vt;
return true;
} else c = c->prev;
}
c = malloc(sizeof(*c));
c->prev = *p;
c->key = vnode_create(k, kt);
c->value = vnode_create(v, vt);
c->key_type = kt;
c->value_type = vt;
*p = c;
++x->size;
return false;
}
int libcdsb_dict_find(dict_t* x, const void* k, vtype t, void* dt, dict_access_callback callback, bool cut) {
dnode_t *c, **p;
int r;
void* key;
if (x->capacity) {
c = *(p = x->nodes + (vtype_hash(k, t) % x->capacity));
while (!is_null(c)) {
key = vnode_peek(&c->key, c->key_type);
if (vtype_compare(k, t, key, c->key_type) == 0) {
r = (callback) ? callback(key, c->key_type, vnode_peek(&c->value, c->value_type), c->value_type, dt) : 0;
if (cut) {
*p = c->prev;
vnode_free(&c->key, c->key_type);
vnode_free(&c->value, c->value_type);
free(c);
--x->size;
}
return r;
} else c = *(p = &c->prev);
}
}
return -1;
}
int libcdsb_dict_foreach(dict_t* x, void* dt, dict_access_callback callback, bool flush) {
dnode_t *c;
ssize_t i;
int r;
r = 0;
i = x->capacity;
while (i) {
c = x->nodes[--i];
while (!is_null(c)) {
r = callback(vnode_peek(&c->key, c->key_type), c->key_type,
vnode_peek(&c->value, c->value_type), c->value_type, dt);
c = c->prev;
if (r) {
if (!flush) goto end_;
else goto flush_loop_;
} else if (flush) {
vnode_free(&x->nodes[i]->key, x->nodes[i]->key_type);
vnode_free(&x->nodes[i]->value, x->nodes[i]->value_type);
free(x->nodes[i]);
x->nodes[i] = c;
}
}
}
if (flush) {
while (i) {
--i;
while (!is_null(x->nodes[i])) { flush_loop_:
vnode_free(&x->nodes[i]->key, x->nodes[i]->key_type);
vnode_free(&x->nodes[i]->value, x->nodes[i]->value_type);
c = x->nodes[i]->prev;
free(x->nodes[i]);
x->nodes[i] = c;
}
}
free(x->nodes);
memset(x, 0, sizeof(*x));
}
end_:
return r;
}
/*#####################################################################################################################*/
vtype_list libcdsb_dict_copy_keys(const vtype_dict* s) {
vtype_list x;
dnode_t *c;
size_t i;
i = s->capacity;
list_init(&x);
while (i--) {
c = s->nodes[i];
while (!is_null(c)) {
libcdsb_list_update(&x, -1, vnode_peek(&c->key, c->key_type), c->key_type, 1);
c = c->prev;
}
}
return x;
}
vtype_list* libcdsb_dict_duplicate_keys(const vtype_dict* s) {
vtype_list* x;
dnode_t *c;
size_t i;
x = malloc(sizeof(*x));
i = s->capacity;
list_init(x);
while (i--) {
c = s->nodes[i];
while (!is_null(c)) {
libcdsb_list_update(x, -1, vnode_peek(&c->key, c->key_type), c->key_type, 1);
c = c->prev;
}
}
return x;
}
void libcdsb_dict_init_keys(vtype_list* x, const vtype_dict* s) {
dnode_t *c;
size_t i;
x = malloc(sizeof(*x));
i = s->capacity;
list_init(x);
while (i--) {
c = s->nodes[i];
while (!is_null(c)) {
libcdsb_list_update(x, -1, vnode_peek(&c->key, c->key_type), c->key_type, 1);
c = c->prev;
}
}
}

View File

@ -1,445 +0,0 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
int libcdsb_dict_find_by_pointer(dict_t* x, const void* k, void* _, dict_access_callback cb, bool cut) { return libcdsb_dict_find(x, &k, vtypeof(&k), _, cb, cut); }
int libcdsb_dict_find_by_cstring(dict_t* x, const char* k, void* _, dict_access_callback cb, bool cut) { return libcdsb_dict_find(x, &k, vtypeof(&k), _, cb, cut); }
int libcdsb_dict_find_by_string (dict_t* x, const str_t* k, void* _, dict_access_callback cb, bool cut) { return libcdsb_dict_find(x, k, vtypeof( k), _, cb, cut); }
int libcdsb_dict_find_by_array (dict_t* x, const arr_t* k, void* _, dict_access_callback cb, bool cut) { return libcdsb_dict_find(x, k, vtypeof( k), _, cb, cut); }
int libcdsb_dict_find_by_list (dict_t* x, const list_t* k, void* _, dict_access_callback cb, bool cut) { return libcdsb_dict_find(x, k, vtypeof( k), _, cb, cut); }
int libcdsb_dict_find_by_map (dict_t* x, const map_t* k, void* _, dict_access_callback cb, bool cut) { return libcdsb_dict_find(x, k, vtypeof( k), _, cb, cut); }
int libcdsb_dict_find_by_vset (dict_t* x, const set_t* k, void* _, dict_access_callback cb, bool cut) { return libcdsb_dict_find(x, k, vtypeof( k), _, cb, cut); }
int libcdsb_dict_find_by_dict (dict_t* x, const dict_t* k, void* _, dict_access_callback cb, bool cut) { return libcdsb_dict_find(x, k, vtypeof( k), _, cb, cut); }
int libcdsb_dict_find_by_boolean(dict_t* x, bool k, void* _, dict_access_callback cb, bool cut) { return libcdsb_dict_find(x, &k, vtypeof(&k), _, cb, cut); }
int libcdsb_dict_find_by_int8 (dict_t* x, s8_t k, void* _, dict_access_callback cb, bool cut) { return libcdsb_dict_find(x, &k, vtypeof(&k), _, cb, cut); }
int libcdsb_dict_find_by_int16 (dict_t* x, s16_t k, void* _, dict_access_callback cb, bool cut) { return libcdsb_dict_find(x, &k, vtypeof(&k), _, cb, cut); }
int libcdsb_dict_find_by_int32 (dict_t* x, s32_t k, void* _, dict_access_callback cb, bool cut) { return libcdsb_dict_find(x, &k, vtypeof(&k), _, cb, cut); }
int libcdsb_dict_find_by_int64 (dict_t* x, s64_t k, void* _, dict_access_callback cb, bool cut) { return libcdsb_dict_find(x, &k, vtypeof(&k), _, cb, cut); }
int libcdsb_dict_find_by_uint8 (dict_t* x, u8_t k, void* _, dict_access_callback cb, bool cut) { return libcdsb_dict_find(x, &k, vtypeof(&k), _, cb, cut); }
int libcdsb_dict_find_by_uint16 (dict_t* x, u16_t k, void* _, dict_access_callback cb, bool cut) { return libcdsb_dict_find(x, &k, vtypeof(&k), _, cb, cut); }
int libcdsb_dict_find_by_uint32 (dict_t* x, u32_t k, void* _, dict_access_callback cb, bool cut) { return libcdsb_dict_find(x, &k, vtypeof(&k), _, cb, cut); }
int libcdsb_dict_find_by_uint64 (dict_t* x, u64_t k, void* _, dict_access_callback cb, bool cut) { return libcdsb_dict_find(x, &k, vtypeof(&k), _, cb, cut); }
int libcdsb_dict_find_by_float (dict_t* x, fl_t k, void* _, dict_access_callback cb, bool cut) { return libcdsb_dict_find(x, &k, vtypeof(&k), _, cb, cut); }
int libcdsb_dict_find_by_double (dict_t* x, dbl_t k, void* _, dict_access_callback cb, bool cut) { return libcdsb_dict_find(x, &k, vtypeof(&k), _, cb, cut); }
int libcdsb_dict_find_by_ldouble(dict_t* x, ldbl_t k, void* _, dict_access_callback cb, bool cut) { return libcdsb_dict_find(x, &k, vtypeof(&k), _, cb, cut); }
bool libcdsb_dict_update_pointer_pointer(dict_t* x, const void* k, const void* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_pointer_cstring(dict_t* x, const void* k, const char* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_pointer_string (dict_t* x, const void* k, const str_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_pointer_array (dict_t* x, const void* k, const arr_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_pointer_list (dict_t* x, const void* k, const list_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_pointer_map (dict_t* x, const void* k, const map_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_pointer_vset (dict_t* x, const void* k, const set_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_pointer_dict (dict_t* x, const void* k, const dict_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_pointer_boolean(dict_t* x, const void* k, bool v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_pointer_int8 (dict_t* x, const void* k, s8_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_pointer_int16 (dict_t* x, const void* k, s16_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_pointer_int32 (dict_t* x, const void* k, s32_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_pointer_int64 (dict_t* x, const void* k, s64_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_pointer_uint8 (dict_t* x, const void* k, u8_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_pointer_uint16 (dict_t* x, const void* k, u16_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_pointer_uint32 (dict_t* x, const void* k, u32_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_pointer_uint64 (dict_t* x, const void* k, u64_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_pointer_float (dict_t* x, const void* k, fl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_pointer_double (dict_t* x, const void* k, dbl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_pointer_ldouble(dict_t* x, const void* k, ldbl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_cstring_pointer(dict_t* x, const char* k, const void* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_cstring_cstring(dict_t* x, const char* k, const char* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_cstring_string (dict_t* x, const char* k, const str_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_cstring_array (dict_t* x, const char* k, const arr_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_cstring_list (dict_t* x, const char* k, const list_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_cstring_map (dict_t* x, const char* k, const map_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_cstring_vset (dict_t* x, const char* k, const set_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_cstring_dict (dict_t* x, const char* k, const dict_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_cstring_boolean(dict_t* x, const char* k, bool v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_cstring_int8 (dict_t* x, const char* k, s8_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_cstring_int16 (dict_t* x, const char* k, s16_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_cstring_int32 (dict_t* x, const char* k, s32_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_cstring_int64 (dict_t* x, const char* k, s64_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_cstring_uint8 (dict_t* x, const char* k, u8_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_cstring_uint16 (dict_t* x, const char* k, u16_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_cstring_uint32 (dict_t* x, const char* k, u32_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_cstring_uint64 (dict_t* x, const char* k, u64_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_cstring_float (dict_t* x, const char* k, fl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_cstring_double (dict_t* x, const char* k, dbl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_cstring_ldouble(dict_t* x, const char* k, ldbl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_string_pointer(dict_t* x, const str_t* k, const void* v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_string_cstring(dict_t* x, const str_t* k, const char* v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_string_string (dict_t* x, const str_t* k, const str_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_string_array (dict_t* x, const str_t* k, const arr_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_string_list (dict_t* x, const str_t* k, const list_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_string_map (dict_t* x, const str_t* k, const map_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_string_vset (dict_t* x, const str_t* k, const set_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_string_dict (dict_t* x, const str_t* k, const dict_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_string_boolean(dict_t* x, const str_t* k, bool v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_string_int8 (dict_t* x, const str_t* k, s8_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_string_int16 (dict_t* x, const str_t* k, s16_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_string_int32 (dict_t* x, const str_t* k, s32_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_string_int64 (dict_t* x, const str_t* k, s64_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_string_uint8 (dict_t* x, const str_t* k, u8_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_string_uint16 (dict_t* x, const str_t* k, u16_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_string_uint32 (dict_t* x, const str_t* k, u32_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_string_uint64 (dict_t* x, const str_t* k, u64_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_string_float (dict_t* x, const str_t* k, fl_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_string_double (dict_t* x, const str_t* k, dbl_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_string_ldouble(dict_t* x, const str_t* k, ldbl_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_array_pointer(dict_t* x, const arr_t* k, const void* v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_array_cstring(dict_t* x, const arr_t* k, const char* v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_array_string (dict_t* x, const arr_t* k, const str_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_array_array (dict_t* x, const arr_t* k, const arr_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_array_list (dict_t* x, const arr_t* k, const list_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_array_map (dict_t* x, const arr_t* k, const map_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_array_vset (dict_t* x, const arr_t* k, const set_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_array_dict (dict_t* x, const arr_t* k, const dict_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_array_boolean(dict_t* x, const arr_t* k, bool v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_array_int8 (dict_t* x, const arr_t* k, s8_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_array_int16 (dict_t* x, const arr_t* k, s16_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_array_int32 (dict_t* x, const arr_t* k, s32_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_array_int64 (dict_t* x, const arr_t* k, s64_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_array_uint8 (dict_t* x, const arr_t* k, u8_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_array_uint16 (dict_t* x, const arr_t* k, u16_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_array_uint32 (dict_t* x, const arr_t* k, u32_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_array_uint64 (dict_t* x, const arr_t* k, u64_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_array_float (dict_t* x, const arr_t* k, fl_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_array_double (dict_t* x, const arr_t* k, dbl_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_array_ldouble(dict_t* x, const arr_t* k, ldbl_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_list_pointer(dict_t* x, const list_t* k, const void* v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_list_cstring(dict_t* x, const list_t* k, const char* v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_list_string (dict_t* x, const list_t* k, const str_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_list_array (dict_t* x, const list_t* k, const arr_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_list_list (dict_t* x, const list_t* k, const list_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_list_map (dict_t* x, const list_t* k, const map_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_list_vset (dict_t* x, const list_t* k, const set_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_list_dict (dict_t* x, const list_t* k, const dict_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_list_boolean(dict_t* x, const list_t* k, bool v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_list_int8 (dict_t* x, const list_t* k, s8_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_list_int16 (dict_t* x, const list_t* k, s16_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_list_int32 (dict_t* x, const list_t* k, s32_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_list_int64 (dict_t* x, const list_t* k, s64_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_list_uint8 (dict_t* x, const list_t* k, u8_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_list_uint16 (dict_t* x, const list_t* k, u16_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_list_uint32 (dict_t* x, const list_t* k, u32_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_list_uint64 (dict_t* x, const list_t* k, u64_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_list_float (dict_t* x, const list_t* k, fl_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_list_double (dict_t* x, const list_t* k, dbl_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_list_ldouble(dict_t* x, const list_t* k, ldbl_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_map_pointer(dict_t* x, const map_t* k, const void* v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_map_cstring(dict_t* x, const map_t* k, const char* v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_map_string (dict_t* x, const map_t* k, const str_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_map_array (dict_t* x, const map_t* k, const arr_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_map_list (dict_t* x, const map_t* k, const list_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_map_map (dict_t* x, const map_t* k, const map_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_map_vset (dict_t* x, const map_t* k, const set_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_map_dict (dict_t* x, const map_t* k, const dict_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_map_boolean(dict_t* x, const map_t* k, bool v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_map_int8 (dict_t* x, const map_t* k, s8_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_map_int16 (dict_t* x, const map_t* k, s16_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_map_int32 (dict_t* x, const map_t* k, s32_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_map_int64 (dict_t* x, const map_t* k, s64_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_map_uint8 (dict_t* x, const map_t* k, u8_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_map_uint16 (dict_t* x, const map_t* k, u16_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_map_uint32 (dict_t* x, const map_t* k, u32_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_map_uint64 (dict_t* x, const map_t* k, u64_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_map_float (dict_t* x, const map_t* k, fl_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_map_double (dict_t* x, const map_t* k, dbl_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_map_ldouble(dict_t* x, const map_t* k, ldbl_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_vset_pointer(dict_t* x, const set_t* k, const void* v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_vset_cstring(dict_t* x, const set_t* k, const char* v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_vset_string (dict_t* x, const set_t* k, const str_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_vset_array (dict_t* x, const set_t* k, const arr_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_vset_list (dict_t* x, const set_t* k, const list_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_vset_map (dict_t* x, const set_t* k, const map_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_vset_vset (dict_t* x, const set_t* k, const set_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_vset_dict (dict_t* x, const set_t* k, const dict_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_vset_boolean(dict_t* x, const set_t* k, bool v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_vset_int8 (dict_t* x, const set_t* k, s8_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_vset_int16 (dict_t* x, const set_t* k, s16_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_vset_int32 (dict_t* x, const set_t* k, s32_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_vset_int64 (dict_t* x, const set_t* k, s64_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_vset_uint8 (dict_t* x, const set_t* k, u8_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_vset_uint16 (dict_t* x, const set_t* k, u16_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_vset_uint32 (dict_t* x, const set_t* k, u32_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_vset_uint64 (dict_t* x, const set_t* k, u64_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_vset_float (dict_t* x, const set_t* k, fl_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_vset_double (dict_t* x, const set_t* k, dbl_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_vset_ldouble(dict_t* x, const set_t* k, ldbl_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_dict_pointer(dict_t* x, const dict_t* k, const void* v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_dict_cstring(dict_t* x, const dict_t* k, const char* v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_dict_string (dict_t* x, const dict_t* k, const str_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_dict_array (dict_t* x, const dict_t* k, const arr_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_dict_list (dict_t* x, const dict_t* k, const list_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_dict_map (dict_t* x, const dict_t* k, const map_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_dict_vset (dict_t* x, const dict_t* k, const set_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_dict_dict (dict_t* x, const dict_t* k, const dict_t* v) { return libcdsb_dict_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_dict_update_dict_boolean(dict_t* x, const dict_t* k, bool v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_dict_int8 (dict_t* x, const dict_t* k, s8_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_dict_int16 (dict_t* x, const dict_t* k, s16_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_dict_int32 (dict_t* x, const dict_t* k, s32_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_dict_int64 (dict_t* x, const dict_t* k, s64_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_dict_uint8 (dict_t* x, const dict_t* k, u8_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_dict_uint16 (dict_t* x, const dict_t* k, u16_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_dict_uint32 (dict_t* x, const dict_t* k, u32_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_dict_uint64 (dict_t* x, const dict_t* k, u64_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_dict_float (dict_t* x, const dict_t* k, fl_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_dict_double (dict_t* x, const dict_t* k, dbl_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_dict_ldouble(dict_t* x, const dict_t* k, ldbl_t v) { return libcdsb_dict_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_boolean_pointer(dict_t* x, bool k, const void* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_boolean_cstring(dict_t* x, bool k, const char* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_boolean_string (dict_t* x, bool k, const str_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_boolean_array (dict_t* x, bool k, const arr_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_boolean_list (dict_t* x, bool k, const list_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_boolean_map (dict_t* x, bool k, const map_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_boolean_vset (dict_t* x, bool k, const set_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_boolean_dict (dict_t* x, bool k, const dict_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_boolean_boolean(dict_t* x, bool k, bool v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_boolean_int8 (dict_t* x, bool k, s8_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_boolean_int16 (dict_t* x, bool k, s16_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_boolean_int32 (dict_t* x, bool k, s32_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_boolean_int64 (dict_t* x, bool k, s64_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_boolean_uint8 (dict_t* x, bool k, u8_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_boolean_uint16 (dict_t* x, bool k, u16_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_boolean_uint32 (dict_t* x, bool k, u32_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_boolean_uint64 (dict_t* x, bool k, u64_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_boolean_float (dict_t* x, bool k, fl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_boolean_double (dict_t* x, bool k, dbl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_boolean_ldouble(dict_t* x, bool k, ldbl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint8_pointer(dict_t* x, u8_t k, const void* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint8_cstring(dict_t* x, u8_t k, const char* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint8_string (dict_t* x, u8_t k, const str_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_uint8_array (dict_t* x, u8_t k, const arr_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_uint8_list (dict_t* x, u8_t k, const list_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_uint8_map (dict_t* x, u8_t k, const map_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_uint8_vset (dict_t* x, u8_t k, const set_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_uint8_dict (dict_t* x, u8_t k, const dict_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_uint8_boolean(dict_t* x, u8_t k, bool v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint8_int8 (dict_t* x, u8_t k, s8_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint8_int16 (dict_t* x, u8_t k, s16_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint8_int32 (dict_t* x, u8_t k, s32_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint8_int64 (dict_t* x, u8_t k, s64_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint8_uint8 (dict_t* x, u8_t k, u8_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint8_uint16 (dict_t* x, u8_t k, u16_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint8_uint32 (dict_t* x, u8_t k, u32_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint8_uint64 (dict_t* x, u8_t k, u64_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint8_float (dict_t* x, u8_t k, fl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint8_double (dict_t* x, u8_t k, dbl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint8_ldouble(dict_t* x, u8_t k, ldbl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint16_pointer(dict_t* x, u16_t k, const void* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint16_cstring(dict_t* x, u16_t k, const char* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint16_string (dict_t* x, u16_t k, const str_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_uint16_array (dict_t* x, u16_t k, const arr_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_uint16_list (dict_t* x, u16_t k, const list_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_uint16_map (dict_t* x, u16_t k, const map_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_uint16_vset (dict_t* x, u16_t k, const set_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_uint16_dict (dict_t* x, u16_t k, const dict_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_uint16_boolean(dict_t* x, u16_t k, bool v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint16_int8 (dict_t* x, u16_t k, s8_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint16_int16 (dict_t* x, u16_t k, s16_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint16_int32 (dict_t* x, u16_t k, s32_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint16_int64 (dict_t* x, u16_t k, s64_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint16_uint8 (dict_t* x, u16_t k, u8_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint16_uint16 (dict_t* x, u16_t k, u16_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint16_uint32 (dict_t* x, u16_t k, u32_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint16_uint64 (dict_t* x, u16_t k, u64_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint16_float (dict_t* x, u16_t k, fl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint16_double (dict_t* x, u16_t k, dbl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint16_ldouble(dict_t* x, u16_t k, ldbl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint32_pointer(dict_t* x, u32_t k, const void* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint32_cstring(dict_t* x, u32_t k, const char* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint32_string (dict_t* x, u32_t k, const str_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_uint32_array (dict_t* x, u32_t k, const arr_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_uint32_list (dict_t* x, u32_t k, const list_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_uint32_map (dict_t* x, u32_t k, const map_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_uint32_vset (dict_t* x, u32_t k, const set_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_uint32_dict (dict_t* x, u32_t k, const dict_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_uint32_boolean(dict_t* x, u32_t k, bool v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint32_int8 (dict_t* x, u32_t k, s8_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint32_int16 (dict_t* x, u32_t k, s16_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint32_int32 (dict_t* x, u32_t k, s32_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint32_int64 (dict_t* x, u32_t k, s64_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint32_uint8 (dict_t* x, u32_t k, u8_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint32_uint16 (dict_t* x, u32_t k, u16_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint32_uint32 (dict_t* x, u32_t k, u32_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint32_uint64 (dict_t* x, u32_t k, u64_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint32_float (dict_t* x, u32_t k, fl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint32_double (dict_t* x, u32_t k, dbl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint32_ldouble(dict_t* x, u32_t k, ldbl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint64_pointer(dict_t* x, u64_t k, const void* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint64_cstring(dict_t* x, u64_t k, const char* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint64_string (dict_t* x, u64_t k, const str_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_uint64_array (dict_t* x, u64_t k, const arr_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_uint64_list (dict_t* x, u64_t k, const list_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_uint64_map (dict_t* x, u64_t k, const map_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_uint64_vset (dict_t* x, u64_t k, const set_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_uint64_dict (dict_t* x, u64_t k, const dict_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_uint64_boolean(dict_t* x, u64_t k, bool v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint64_int8 (dict_t* x, u64_t k, s8_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint64_int16 (dict_t* x, u64_t k, s16_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint64_int32 (dict_t* x, u64_t k, s32_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint64_int64 (dict_t* x, u64_t k, s64_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint64_uint8 (dict_t* x, u64_t k, u8_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint64_uint16 (dict_t* x, u64_t k, u16_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint64_uint32 (dict_t* x, u64_t k, u32_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint64_uint64 (dict_t* x, u64_t k, u64_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint64_float (dict_t* x, u64_t k, fl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint64_double (dict_t* x, u64_t k, dbl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_uint64_ldouble(dict_t* x, u64_t k, ldbl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int8_pointer(dict_t* x, s8_t k, const void* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int8_cstring(dict_t* x, s8_t k, const char* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int8_string (dict_t* x, s8_t k, const str_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_int8_array (dict_t* x, s8_t k, const arr_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_int8_list (dict_t* x, s8_t k, const list_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_int8_map (dict_t* x, s8_t k, const map_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_int8_vset (dict_t* x, s8_t k, const set_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_int8_dict (dict_t* x, s8_t k, const dict_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_int8_boolean(dict_t* x, s8_t k, bool v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int8_int8 (dict_t* x, s8_t k, s8_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int8_int16 (dict_t* x, s8_t k, s16_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int8_int32 (dict_t* x, s8_t k, s32_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int8_int64 (dict_t* x, s8_t k, s64_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int8_uint8 (dict_t* x, s8_t k, u8_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int8_uint16 (dict_t* x, s8_t k, u16_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int8_uint32 (dict_t* x, s8_t k, u32_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int8_uint64 (dict_t* x, s8_t k, u64_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int8_float (dict_t* x, s8_t k, fl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int8_double (dict_t* x, s8_t k, dbl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int8_ldouble(dict_t* x, s8_t k, ldbl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int16_pointer(dict_t* x, s16_t k, const void* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int16_cstring(dict_t* x, s16_t k, const char* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int16_string (dict_t* x, s16_t k, const str_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_int16_array (dict_t* x, s16_t k, const arr_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_int16_list (dict_t* x, s16_t k, const list_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_int16_map (dict_t* x, s16_t k, const map_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_int16_vset (dict_t* x, s16_t k, const set_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_int16_dict (dict_t* x, s16_t k, const dict_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_int16_boolean(dict_t* x, s16_t k, bool v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int16_int8 (dict_t* x, s16_t k, s8_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int16_int16 (dict_t* x, s16_t k, s16_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int16_int32 (dict_t* x, s16_t k, s32_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int16_int64 (dict_t* x, s16_t k, s64_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int16_uint8 (dict_t* x, s16_t k, u8_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int16_uint16 (dict_t* x, s16_t k, u16_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int16_uint32 (dict_t* x, s16_t k, u32_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int16_uint64 (dict_t* x, s16_t k, u64_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int16_float (dict_t* x, s16_t k, fl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int16_double (dict_t* x, s16_t k, dbl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int16_ldouble(dict_t* x, s16_t k, ldbl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int32_pointer(dict_t* x, s32_t k, const void* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int32_cstring(dict_t* x, s32_t k, const char* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int32_string (dict_t* x, s32_t k, const str_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_int32_array (dict_t* x, s32_t k, const arr_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_int32_list (dict_t* x, s32_t k, const list_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_int32_map (dict_t* x, s32_t k, const map_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_int32_vset (dict_t* x, s32_t k, const set_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_int32_dict (dict_t* x, s32_t k, const dict_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_int32_boolean(dict_t* x, s32_t k, bool v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int32_int8 (dict_t* x, s32_t k, s8_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int32_int16 (dict_t* x, s32_t k, s16_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int32_int32 (dict_t* x, s32_t k, s32_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int32_int64 (dict_t* x, s32_t k, s64_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int32_uint8 (dict_t* x, s32_t k, u8_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int32_uint16 (dict_t* x, s32_t k, u16_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int32_uint32 (dict_t* x, s32_t k, u32_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int32_uint64 (dict_t* x, s32_t k, u64_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int32_float (dict_t* x, s32_t k, fl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int32_double (dict_t* x, s32_t k, dbl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int32_ldouble(dict_t* x, s32_t k, ldbl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int64_pointer(dict_t* x, s64_t k, const void* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int64_cstring(dict_t* x, s64_t k, const char* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int64_string (dict_t* x, s64_t k, const str_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_int64_array (dict_t* x, s64_t k, const arr_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_int64_list (dict_t* x, s64_t k, const list_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_int64_map (dict_t* x, s64_t k, const map_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_int64_vset (dict_t* x, s64_t k, const set_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_int64_dict (dict_t* x, s64_t k, const dict_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_int64_boolean(dict_t* x, s64_t k, bool v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int64_int8 (dict_t* x, s64_t k, s8_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int64_int16 (dict_t* x, s64_t k, s16_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int64_int32 (dict_t* x, s64_t k, s32_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int64_int64 (dict_t* x, s64_t k, s64_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int64_uint8 (dict_t* x, s64_t k, u8_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int64_uint16 (dict_t* x, s64_t k, u16_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int64_uint32 (dict_t* x, s64_t k, u32_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int64_uint64 (dict_t* x, s64_t k, u64_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int64_float (dict_t* x, s64_t k, fl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int64_double (dict_t* x, s64_t k, dbl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_int64_ldouble(dict_t* x, s64_t k, ldbl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_float_pointer(dict_t* x, fl_t k, const void* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_float_cstring(dict_t* x, fl_t k, const char* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_float_string (dict_t* x, fl_t k, const str_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_float_array (dict_t* x, fl_t k, const arr_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_float_list (dict_t* x, fl_t k, const list_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_float_map (dict_t* x, fl_t k, const map_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_float_vset (dict_t* x, fl_t k, const set_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_float_dict (dict_t* x, fl_t k, const dict_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_float_boolean(dict_t* x, fl_t k, bool v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_float_int8 (dict_t* x, fl_t k, s8_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_float_int16 (dict_t* x, fl_t k, s16_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_float_int32 (dict_t* x, fl_t k, s32_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_float_int64 (dict_t* x, fl_t k, s64_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_float_uint8 (dict_t* x, fl_t k, u8_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_float_uint16 (dict_t* x, fl_t k, u16_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_float_uint32 (dict_t* x, fl_t k, u32_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_float_uint64 (dict_t* x, fl_t k, u64_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_float_float (dict_t* x, fl_t k, fl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_float_double (dict_t* x, fl_t k, dbl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_float_ldouble(dict_t* x, fl_t k, ldbl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_double_pointer(dict_t* x, dbl_t k, const void* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_double_cstring(dict_t* x, dbl_t k, const char* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_double_string (dict_t* x, dbl_t k, const str_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_double_array (dict_t* x, dbl_t k, const arr_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_double_list (dict_t* x, dbl_t k, const list_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_double_map (dict_t* x, dbl_t k, const map_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_double_vset (dict_t* x, dbl_t k, const set_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_double_dict (dict_t* x, dbl_t k, const dict_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_double_boolean(dict_t* x, dbl_t k, bool v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_double_int8 (dict_t* x, dbl_t k, s8_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_double_int16 (dict_t* x, dbl_t k, s16_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_double_int32 (dict_t* x, dbl_t k, s32_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_double_int64 (dict_t* x, dbl_t k, s64_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_double_uint8 (dict_t* x, dbl_t k, u8_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_double_uint16 (dict_t* x, dbl_t k, u16_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_double_uint32 (dict_t* x, dbl_t k, u32_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_double_uint64 (dict_t* x, dbl_t k, u64_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_double_float (dict_t* x, dbl_t k, fl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_double_double (dict_t* x, dbl_t k, dbl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_double_ldouble(dict_t* x, dbl_t k, ldbl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_ldouble_pointer(dict_t* x, ldbl_t k, const void* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_ldouble_cstring(dict_t* x, ldbl_t k, const char* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_ldouble_string (dict_t* x, ldbl_t k, const str_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_ldouble_array (dict_t* x, ldbl_t k, const arr_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_ldouble_list (dict_t* x, ldbl_t k, const list_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_ldouble_map (dict_t* x, ldbl_t k, const map_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_ldouble_vset (dict_t* x, ldbl_t k, const set_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_ldouble_dict (dict_t* x, ldbl_t k, const dict_t* v) { return libcdsb_dict_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_dict_update_ldouble_boolean(dict_t* x, ldbl_t k, bool v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_ldouble_int8 (dict_t* x, ldbl_t k, s8_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_ldouble_int16 (dict_t* x, ldbl_t k, s16_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_ldouble_int32 (dict_t* x, ldbl_t k, s32_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_ldouble_int64 (dict_t* x, ldbl_t k, s64_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_ldouble_uint8 (dict_t* x, ldbl_t k, u8_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_ldouble_uint16 (dict_t* x, ldbl_t k, u16_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_ldouble_uint32 (dict_t* x, ldbl_t k, u32_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_ldouble_uint64 (dict_t* x, ldbl_t k, u64_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_ldouble_float (dict_t* x, ldbl_t k, fl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_ldouble_double (dict_t* x, ldbl_t k, dbl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_dict_update_ldouble_ldouble(dict_t* x, ldbl_t k, ldbl_t v) { return libcdsb_dict_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }

View File

@ -1,7 +1,7 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "../../include/extra/dict.h"
#include "../../include/dict.h"
#include "../__internal/assert.h"
#include "../__internal/rbtree.h"

19
src/dict/memory.c Normal file
View File

@ -0,0 +1,19 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
void dict_free(dict_t* x) {
while (x->capacity--) {
while (!is_null(x->nodes[x->capacity])) {
vnode_free(&x->nodes[x->capacity]->key, x->nodes[x->capacity]->key_type);
vnode_free(&x->nodes[x->capacity]->value, x->nodes[x->capacity]->value_type);
x->nodes[x->capacity] = x->nodes[x->capacity]->prev;
}
}
free(x->nodes);
memset(x, 0, sizeof(*x));
}

189
src/dict/modify.c Normal file
View File

@ -0,0 +1,189 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "../../include/list.h"
#include "include.h"
static void libcdsb_builtin_rehash(dict_t* s, size_t capacity) {
dnode_t **nodes, *c, *n, **p;
size_t i;
i = s->capacity;
nodes = calloc(sizeof(*nodes), capacity);
while (i--) {
c = s->nodes[i];
while (!is_null(c)) {
p = nodes + (vnode_hash(&c->key, c->key_type) % capacity);
n = c->prev;
c->prev = *p;
*p = c;
c = n;
}
}
free(s->nodes);
s->nodes = nodes;
s->capacity = capacity;
}
/*#####################################################################################################################*/
bool libcdsb_dict_shrink_to_fit(dict_t* s) {
size_t capacity;
capacity = (s->size / CAPACITY_BLOCK) + 1;
capacity *= CAPACITY_BLOCK;
while (((double)s->size / capacity) > 0.65)
capacity += CAPACITY_BLOCK;
if (capacity >= s->capacity)
return false;
libcdsb_builtin_rehash(s, capacity);
return true;
}
bool libcdsb_dict_update(dict_t* x, const void* k, vtype kt, const void* v, vtype vt) {
dnode_t *c, **p;
if (!x->capacity || (double)x->size / x->capacity > REBUILD_POINT_MAX)
libcdsb_builtin_rehash(x, x->capacity + CAPACITY_BLOCK);
c = *(p = x->nodes + (vtype_hash(k, kt) % x->capacity));
while (!is_null(c)) {
if (vtype_compare(k, kt, vnode_peek(&c->key, c->key_type), c->key_type) == 0) {
vnode_free(&c->value, c->value_type);
c->value = vnode_create(v, vt);
c->value_type = vt;
return true;
} else c = c->prev;
}
c = malloc(sizeof(*c));
c->prev = *p;
c->key = vnode_create(k, kt);
c->value = vnode_create(v, vt);
c->key_type = kt;
c->value_type = vt;
*p = c;
++x->size;
return false;
}
bool libcdsb_dict_inject(dict_t* x, const void* k, vtype kt, const void* v, vtype vt) {
dnode_t *c, **p;
if (!x->capacity || (double)x->size / x->capacity > REBUILD_POINT_MAX)
libcdsb_builtin_rehash(x, x->capacity + CAPACITY_BLOCK);
c = *(p = x->nodes + (vtype_hash(k, kt) % x->capacity));
while (!is_null(c)) {
if (vtype_compare(k, kt, vnode_peek(&c->key, c->key_type), c->key_type) == 0) {
vnode_free(&c->value, c->value_type);
c->value = vnode_create(v, vt);
c->value_type = vt;
return true;
} else c = c->prev;
}
c = malloc(sizeof(*c));
c->prev = *p;
c->key_type = kt;
c->value_type = vt;
vnode_attach(&c->key, k, kt);
vnode_attach(&c->value, v, vt);
*p = c;
++x->size;
return false;
}
bool libcdsb_dict_inject_key(dict_t* x, const void* k, vtype kt, const void* v, vtype vt) {
dnode_t *c, **p;
if (!x->capacity || (double)x->size / x->capacity > REBUILD_POINT_MAX)
libcdsb_builtin_rehash(x, x->capacity + CAPACITY_BLOCK);
c = *(p = x->nodes + (vtype_hash(k, kt) % x->capacity));
while (!is_null(c)) {
if (vtype_compare(k, kt, vnode_peek(&c->key, c->key_type), c->key_type) == 0) {
vnode_free(&c->value, c->value_type);
c->value = vnode_create(v, vt);
c->value_type = vt;
return true;
} else c = c->prev;
}
c = malloc(sizeof(*c));
c->prev = *p;
c->value = vnode_create(v, vt);
c->key_type = kt;
c->value_type = vt;
vnode_attach(&c->key, k, kt);
*p = c;
++x->size;
return false;
}
bool libcdsb_dict_inject_value(dict_t* x, const void* k, vtype kt, const void* v, vtype vt) {
dnode_t *c, **p;
if (!x->capacity || (double)x->size / x->capacity > REBUILD_POINT_MAX)
libcdsb_builtin_rehash(x, x->capacity + CAPACITY_BLOCK);
c = *(p = x->nodes + (vtype_hash(k, kt) % x->capacity));
while (!is_null(c)) {
if (vtype_compare(k, kt, vnode_peek(&c->key, c->key_type), c->key_type) == 0) {
vnode_free(&c->value, c->value_type);
c->value = vnode_create(v, vt);
c->value_type = vt;
return true;
} else c = c->prev;
}
c = malloc(sizeof(*c));
c->prev = *p;
c->key = vnode_create(k, kt);
c->key_type = kt;
c->value_type = vt;
vnode_attach(&c->value, v, vt);
*p = c;
++x->size;
return false;
}

View File

@ -3,7 +3,7 @@
#include "include.h"
static void lnode_cut(list_t* s, lnode_t* cur) {
static void libcdsb_builtin_cut(list_t* s, lnode_t* cur) {
vnode_free(&cur->node, cur->type);
@ -18,79 +18,8 @@ static void lnode_cut(list_t* s, lnode_t* cur) {
free(cur);
}
/*#####################################################################################################################*/
bool libcdsb_list_update(list_t* x, ssize_t i, const void* v, vtype t, int ins) {
ldir_t dir;
lnode_t* c;
if (i < 0) {
i = ~i;
dir = LD_PREV;
} else dir = LD_NEXT;
c = ldir_dir((lnode_t*)x, dir);
while (i && !is_null(c)) {
c = ldir_dir(c, dir);
--i;
}
if (i && dir == LD_PREV) {
c = x->first;
} else if (i) return false;
if (is_null(c)) {
x->first = x->last = c = calloc(sizeof(*c), 1);
} else if (ins) {
lnode_t *v = malloc(sizeof(*v));
dir = (ins < 0) ? LD_PREV : LD_NEXT;
ldir_dir(v, dir) = ldir_dir(c, dir);
ldir_inv(v, dir) = c;
c = v;
if (!is_null(ldir_dir(c, dir))) {
ldir_inv(ldir_dir(c, dir), dir) = c;
} else ldir_inv((lnode_t*)x, dir) = c;
ldir_dir(ldir_inv(c, dir), dir) = c;
} else vnode_free(&c->node, c->type);
c->node = vnode_create(v, t);
c->type = t;
return true;
}
size_t libcdsb_list_count(const list_t* s, const void* v, vtype t) {
lnode_t* c;
size_t n;
int cmp;
c = s->first;
n = 0;
while (!is_null(c)) {
cmp = vtype_compare(vnode_peek(&c->node, c->type), c->type, v, t);
if (cmp == 0) ++n;
c = c->next;
}
return n;
}
int libcdsb_list_get(vtype_list* x, ssize_t i, void* _, list_access_callback callback, bool cut) {
ldir_t dir;
@ -116,7 +45,7 @@ int libcdsb_list_get(vtype_list* x, ssize_t i, void* _, list_access_callback cal
i = (callback) ? callback(vnode_peek(&c->node, c->type), i, c->type, _) : 0;
if (cut) lnode_cut(x, c);
if (cut) libcdsb_builtin_cut(x, c);
return i;
}
@ -138,7 +67,7 @@ int libcdsb_list_find(vtype_list* x, const void* v, vtype t, void* _, list_acces
if (cmp == 0) {
i = (callback) ? callback(vnode_peek(&c->node, c->type), (r)?~i:i, c->type, _) : 0;
if (cut) lnode_cut(x, c);
if (cut) libcdsb_builtin_cut(x, c);
return i;
}

View File

@ -1,93 +0,0 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
/*#####################################################################################################################*/
hash_t list_hash(const list_t* s) {
hash_t hash = 0;
if (!is_null(s->first)) {
hash = vnode_hash(&s->first->node, s->first->type);
if (s->first != s->last) {
hash += vnode_hash(&s->first->node, s->first->type);
hash ^= list_size(s);
} else hash ^= 1;
}
return hash + VTYPE_LIST;
}
void list_init(list_t* x) {
memset(x, 0, sizeof(*x));
}
void list_free(list_t* x) {
lnode_t* c;
lnode_t* next;
c = x->first;
while (!is_null(c)) {
next = c->next;
vnode_free(&c->node, c->type);
free(c);
c = next;
}
memset(x, 0, sizeof(*x));
}
/*#####################################################################################################################*/
size_t list_size(const list_t* x) {
lnode_t* c;
size_t n;
c = x->first;
n = 0;
while (!is_null(c)) {
c = c->next;
++n;
}
return n;
}
/*#####################################################################################################################*/
int list_compare(const list_t* s0, const list_t* s1) {
lnode_t *c0, *c1;
int c;
if (s0 == s1) return 0;
c0 = s0->first;
c1 = s1->first;
for (;;) {
if (is_null(c0) || is_null(c1)) {
return (c0 == c1) ? 0 : (ssize_t)c0 - (ssize_t)c1;
}
c = lnode_compare(c0, c1);
if (c != 0) break;
c0 = c0->next;
c1 = c1->next;
}
for (;;) {
c0 = c0->next;
c1 = c1->next;
if (is_null(c0) || is_null(c1)) {
return (c0 == c1) ? 0 : (ssize_t)c0 - (ssize_t)c1;
}
}
}

36
src/list/comparison.c Normal file
View File

@ -0,0 +1,36 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
int list_compare(const list_t* s0, const list_t* s1) {
lnode_t *c0, *c1;
int c;
if (s0 == s1) return 0;
c0 = s0->first;
c1 = s1->first;
for (;;) {
if (is_null(c0) || is_null(c1)) {
return (c0 == c1) ? 0 : (ssize_t)c0 - (ssize_t)c1;
}
c = lnode_compare(c0, c1);
if (c != 0) break;
c0 = c0->next;
c1 = c1->next;
}
for (;;) {
c0 = c0->next;
c1 = c1->next;
if (is_null(c0) || is_null(c1)) {
return (c0 == c1) ? 0 : (ssize_t)c0 - (ssize_t)c1;
}
}
}

57
src/list/compute.c Normal file
View File

@ -0,0 +1,57 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
size_t list_size(const list_t* x) {
lnode_t* c;
size_t n;
c = x->first;
n = 0;
while (!is_null(c)) {
c = c->next;
++n;
}
return n;
}
hash_t list_hash(const list_t* s) {
hash_t hash = 0;
if (!is_null(s->first)) {
hash = vnode_hash(&s->first->node, s->first->type);
if (s->first != s->last) {
hash += vnode_hash(&s->first->node, s->first->type);
hash ^= list_size(s);
} else hash ^= 1;
}
return hash + VTYPE_LIST;
}
size_t libcdsb_list_count(const list_t* s, const void* v, vtype t) {
lnode_t* c;
size_t n;
int cmp;
c = s->first;
n = 0;
while (!is_null(c)) {
cmp = vtype_compare(vnode_peek(&c->node, c->type), c->type, v, t);
if (cmp == 0) ++n;
c = c->next;
}
return n;
}

View File

@ -3,34 +3,6 @@
#include "include.h"
/*#####################################################################################################################*/
static void init_first(list_t* x, vnode_t v, vtype t) {
lnode_t* node = malloc(sizeof(*node));
node->next = nullptr;
node->prev = nullptr;
node->node = v;
node->type = t;
x->first = node;
x->last = node;
}
static void push_next(list_t* x, vnode_t v, vtype t) {
lnode_t* node = malloc(sizeof(*node));
node->next = nullptr;
node->prev = x->last;
node->node = v;
node->type = t;
x->last->next = node;
x->last = node;
}
/*#####################################################################################################################*/
list_t list_copy(const list_t* s) {
list_t x;
lnode_t* c;
@ -41,15 +13,16 @@ list_t list_copy(const list_t* s) {
if (is_null(c))
return x;
init_first(&x, vnode_duplicate(&c->node, c->type), c->type);
libcdsb_builtin_init(&x, vnode_duplicate(&c->node, c->type), c->type);
while (!is_null(c = c->next)) {
push_next(&x, vnode_duplicate(&c->node, c->type), c->type);
libcdsb_builtin_push(&x, vnode_duplicate(&c->node, c->type), c->type);
}
return x;
}
list_t* list_duplicate(const list_t* s) {
list_t* x;
lnode_t* c;
@ -60,15 +33,16 @@ list_t* list_duplicate(const list_t* s) {
if (is_null(c))
return x;
init_first(x, vnode_duplicate(&c->node, c->type), c->type);
libcdsb_builtin_init(x, vnode_duplicate(&c->node, c->type), c->type);
while (!is_null(c = c->next)) {
push_next(x, vnode_duplicate(&c->node, c->type), c->type);
libcdsb_builtin_push(x, vnode_duplicate(&c->node, c->type), c->type);
}
return x;
}
void list_copy_init(list_t* x, const list_t* s) {
lnode_t* c;
@ -78,14 +52,13 @@ void list_copy_init(list_t* x, const list_t* s) {
if (is_null(c))
return;
init_first(x, vnode_duplicate(&c->node, c->type), c->type);
libcdsb_builtin_init(x, vnode_duplicate(&c->node, c->type), c->type);
while (!is_null(c = c->next)) {
push_next(x, vnode_duplicate(&c->node, c->type), c->type);
libcdsb_builtin_push(x, vnode_duplicate(&c->node, c->type), c->type);
}
}
/*#####################################################################################################################*/
void list_extend(list_t* x, const list_t* s) {
lnode_t* c;
@ -96,7 +69,7 @@ void list_extend(list_t* x, const list_t* s) {
return;
if (is_null(x->first)) {
init_first(x, vnode_duplicate(&c->node, c->type), c->type);
libcdsb_builtin_init(x, vnode_duplicate(&c->node, c->type), c->type);
c = c->next;
if (is_null(c))
@ -104,12 +77,11 @@ void list_extend(list_t* x, const list_t* s) {
}
do {
push_next(x, vnode_duplicate(&c->node, c->type), c->type);
libcdsb_builtin_push(x, vnode_duplicate(&c->node, c->type), c->type);
} while (!is_null(c = c->next));
}
size_t list_slice(list_t* x, list_t* s, ssize_t i, size_t n, _Bool cut) {
lnode_t* c;
@ -158,13 +130,13 @@ size_t list_slice(list_t* x, list_t* s, ssize_t i, size_t n, _Bool cut) {
else r -= n;
if (!cut) {
init_first(x, vnode_duplicate(&c->node, c->type), c->type);
libcdsb_builtin_init(x, vnode_duplicate(&c->node, c->type), c->type);
while ((c = c->next) != e) {
push_next(x, vnode_duplicate(&c->node, c->type), c->type);
libcdsb_builtin_push(x, vnode_duplicate(&c->node, c->type), c->type);
}
push_next(x, vnode_duplicate(&e->node, e->type), e->type);
libcdsb_builtin_push(x, vnode_duplicate(&e->node, e->type), e->type);
} else {
if (c->prev) {
c->prev->next = e->next;

View File

@ -1,67 +0,0 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
int libcdsb_list_find_pointer(list_t* x, const void* v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_list_find_cstring(list_t* x, const char* v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_list_find_string (list_t* x, const str_t* v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, v, vtypeof( v), _, cb, r, cut); }
int libcdsb_list_find_array (list_t* x, const arr_t* v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, v, vtypeof( v), _, cb, r, cut); }
int libcdsb_list_find_list (list_t* x, const list_t* v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, v, vtypeof( v), _, cb, r, cut); }
int libcdsb_list_find_map (list_t* x, const map_t* v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, v, vtypeof( v), _, cb, r, cut); }
int libcdsb_list_find_vset (list_t* x, const set_t* v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, v, vtypeof( v), _, cb, r, cut); }
int libcdsb_list_find_dict (list_t* x, const dict_t* v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, v, vtypeof( v), _, cb, r, cut); }
int libcdsb_list_find_boolean(list_t* x, bool v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_list_find_int8 (list_t* x, s8_t v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_list_find_int16 (list_t* x, s16_t v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_list_find_int32 (list_t* x, s32_t v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_list_find_int64 (list_t* x, s64_t v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_list_find_uint8 (list_t* x, u8_t v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_list_find_uint16 (list_t* x, u16_t v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_list_find_uint32 (list_t* x, u32_t v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_list_find_uint64 (list_t* x, u64_t v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_list_find_float (list_t* x, fl_t v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_list_find_double (list_t* x, dbl_t v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); }
int libcdsb_list_find_ldouble(list_t* x, ldbl_t v, void* _, list_access_callback cb, bool r, bool cut) { return libcdsb_list_find(x, &v, vtypeof(&v), _, cb, r, cut); }
size_t libcdsb_list_count_pointer(const list_t* s, const void* v) { return libcdsb_list_count((void*)s, &v, vtypeof(&v)); }
size_t libcdsb_list_count_cstring(const list_t* s, const char* v) { return libcdsb_list_count((void*)s, &v, vtypeof(&v)); }
size_t libcdsb_list_count_string (const list_t* s, const str_t* v) { return libcdsb_list_count((void*)s, v, vtypeof( v)); }
size_t libcdsb_list_count_array (const list_t* s, const arr_t* v) { return libcdsb_list_count((void*)s, v, vtypeof( v)); }
size_t libcdsb_list_count_list (const list_t* s, const list_t* v) { return libcdsb_list_count((void*)s, v, vtypeof( v)); }
size_t libcdsb_list_count_map (const list_t* s, const map_t* v) { return libcdsb_list_count((void*)s, v, vtypeof( v)); }
size_t libcdsb_list_count_vset (const list_t* s, const set_t* v) { return libcdsb_list_count((void*)s, v, vtypeof( v)); }
size_t libcdsb_list_count_dict (const list_t* s, const dict_t* v) { return libcdsb_list_count((void*)s, v, vtypeof( v)); }
size_t libcdsb_list_count_boolean(const list_t* s, bool v) { return libcdsb_list_count((void*)s, &v, vtypeof(&v)); }
size_t libcdsb_list_count_int8 (const list_t* s, s8_t v) { return libcdsb_list_count((void*)s, &v, vtypeof(&v)); }
size_t libcdsb_list_count_int16 (const list_t* s, s16_t v) { return libcdsb_list_count((void*)s, &v, vtypeof(&v)); }
size_t libcdsb_list_count_int32 (const list_t* s, s32_t v) { return libcdsb_list_count((void*)s, &v, vtypeof(&v)); }
size_t libcdsb_list_count_int64 (const list_t* s, s64_t v) { return libcdsb_list_count((void*)s, &v, vtypeof(&v)); }
size_t libcdsb_list_count_uint8 (const list_t* s, u8_t v) { return libcdsb_list_count((void*)s, &v, vtypeof(&v)); }
size_t libcdsb_list_count_uint16 (const list_t* s, u16_t v) { return libcdsb_list_count((void*)s, &v, vtypeof(&v)); }
size_t libcdsb_list_count_uint32 (const list_t* s, u32_t v) { return libcdsb_list_count((void*)s, &v, vtypeof(&v)); }
size_t libcdsb_list_count_uint64 (const list_t* s, u64_t v) { return libcdsb_list_count((void*)s, &v, vtypeof(&v)); }
size_t libcdsb_list_count_float (const list_t* s, fl_t v) { return libcdsb_list_count((void*)s, &v, vtypeof(&v)); }
size_t libcdsb_list_count_double (const list_t* s, dbl_t v) { return libcdsb_list_count((void*)s, &v, vtypeof(&v)); }
size_t libcdsb_list_count_ldouble(const list_t* s, ldbl_t v) { return libcdsb_list_count((void*)s, &v, vtypeof(&v)); }
bool libcdsb_list_update_pointer(list_t* x, ssize_t i, const void* v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); }
bool libcdsb_list_update_cstring(list_t* x, ssize_t i, const char* v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); }
bool libcdsb_list_update_string (list_t* x, ssize_t i, const str_t* v, int ins) { return libcdsb_list_update(x, i, v, vtypeof( v), ins); }
bool libcdsb_list_update_array (list_t* x, ssize_t i, const arr_t* v, int ins) { return libcdsb_list_update(x, i, v, vtypeof( v), ins); }
bool libcdsb_list_update_list (list_t* x, ssize_t i, const list_t* v, int ins) { return libcdsb_list_update(x, i, v, vtypeof( v), ins); }
bool libcdsb_list_update_map (list_t* x, ssize_t i, const map_t* v, int ins) { return libcdsb_list_update(x, i, v, vtypeof( v), ins); }
bool libcdsb_list_update_vset (list_t* x, ssize_t i, const set_t* v, int ins) { return libcdsb_list_update(x, i, v, vtypeof( v), ins); }
bool libcdsb_list_update_dict (list_t* x, ssize_t i, const dict_t* v, int ins) { return libcdsb_list_update(x, i, v, vtypeof( v), ins); }
bool libcdsb_list_update_boolean(list_t* x, ssize_t i, bool v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); }
bool libcdsb_list_update_int8 (list_t* x, ssize_t i, s8_t v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); }
bool libcdsb_list_update_int16 (list_t* x, ssize_t i, s16_t v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); }
bool libcdsb_list_update_int32 (list_t* x, ssize_t i, s32_t v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); }
bool libcdsb_list_update_int64 (list_t* x, ssize_t i, s64_t v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); }
bool libcdsb_list_update_uint8 (list_t* x, ssize_t i, u8_t v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); }
bool libcdsb_list_update_uint16 (list_t* x, ssize_t i, u16_t v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); }
bool libcdsb_list_update_uint32 (list_t* x, ssize_t i, u32_t v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); }
bool libcdsb_list_update_uint64 (list_t* x, ssize_t i, u64_t v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); }
bool libcdsb_list_update_float (list_t* x, ssize_t i, fl_t v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); }
bool libcdsb_list_update_double (list_t* x, ssize_t i, dbl_t v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); }
bool libcdsb_list_update_ldouble(list_t* x, ssize_t i, ldbl_t v, int ins) { return libcdsb_list_update(x, i, &v, vtypeof(&v), ins); }

View File

@ -1,7 +1,7 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "../../include/extra/list.h"
#include "../../include/list.h"
#include "../__internal/vnode.h"
#ifndef LIBCDSB_SRC_LIST_INCLUDE_H
@ -20,6 +20,31 @@ typedef struct libcdsb_list_node {
vtype type;
} lnode_t;
ainline(void libcdsb_builtin_init(list_t* x, vnode_t v, vtype t)) {
lnode_t* node = malloc(sizeof(*node));
node->next = nullptr;
node->prev = nullptr;
node->node = v;
node->type = t;
x->first = node;
x->last = node;
}
ainline(void libcdsb_builtin_push(list_t* x, vnode_t v, vtype t)) {
lnode_t* node = malloc(sizeof(*node));
node->next = nullptr;
node->prev = x->last;
node->node = v;
node->type = t;
x->last->next = node;
x->last = node;
}
#define ldir_dir(cur, d) (&((cur)->prev))[(d)>>1]
#define ldir_inv(cur, d) (&((cur)->prev))[(d)&1]

20
src/list/memory.c Normal file
View File

@ -0,0 +1,20 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
void list_free(list_t* x) {
lnode_t* c;
lnode_t* next;
c = x->first;
while (!is_null(c)) {
next = c->next;
vnode_free(&c->node, c->type);
free(c);
c = next;
}
memset(x, 0, sizeof(*x));
}

98
src/list/modify.c Normal file
View File

@ -0,0 +1,98 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
bool libcdsb_list_insert(list_t* x, ssize_t i, const void* v, vtype t, int ins) {
ldir_t dir;
lnode_t* c;
if (i < 0) {
i = ~i;
dir = LD_PREV;
} else dir = LD_NEXT;
c = ldir_dir((lnode_t*)x, dir);
while (i && !is_null(c)) {
c = ldir_dir(c, dir);
--i;
}
if (i && dir == LD_PREV) {
c = x->first;
} else if (i) return false;
if (is_null(c)) {
x->first = x->last = c = calloc(sizeof(*c), 1);
} else if (ins) {
lnode_t *v = malloc(sizeof(*v));
dir = (ins < 0) ? LD_PREV : LD_NEXT;
ldir_dir(v, dir) = ldir_dir(c, dir);
ldir_inv(v, dir) = c;
c = v;
if (!is_null(ldir_dir(c, dir))) {
ldir_inv(ldir_dir(c, dir), dir) = c;
} else ldir_inv((lnode_t*)x, dir) = c;
ldir_dir(ldir_inv(c, dir), dir) = c;
} else vnode_free(&c->node, c->type);
c->node = vnode_create(v, t);
c->type = t;
return true;
}
bool libcdsb_list_attach(list_t* x, ssize_t i, const void* v, vtype t, int ins) {
ldir_t dir;
lnode_t* c;
if (i < 0) {
i = ~i;
dir = LD_PREV;
} else dir = LD_NEXT;
c = ldir_dir((lnode_t*)x, dir);
while (i && !is_null(c)) {
c = ldir_dir(c, dir);
--i;
}
if (i && dir == LD_PREV) {
c = x->first;
} else if (i) return false;
if (is_null(c)) {
x->first = x->last = c = calloc(sizeof(*c), 1);
} else if (ins) {
lnode_t *v = malloc(sizeof(*v));
dir = (ins < 0) ? LD_PREV : LD_NEXT;
ldir_dir(v, dir) = ldir_dir(c, dir);
ldir_inv(v, dir) = c;
c = v;
if (!is_null(ldir_dir(c, dir))) {
ldir_inv(ldir_dir(c, dir), dir) = c;
} else ldir_inv((lnode_t*)x, dir) = c;
ldir_dir(ldir_inv(c, dir), dir) = c;
} else vnode_free(&c->node, c->type);
vnode_attach(&c->node, v, c->type = t);
return true;
}

View File

@ -3,9 +3,7 @@
#include "include.h"
/*#####################################################################################################################*/
static inline void lnode_swap(lnode_t* s0, lnode_t* s1) {
static inline void libcdsb_builtin_swap(lnode_t* s0, lnode_t* s1) {
vnode_t v = s0->node;
vtype t = s0->type;
@ -16,6 +14,7 @@ static inline void lnode_swap(lnode_t* s0, lnode_t* s1) {
s1->type = t;
}
/*#####################################################################################################################*/
void list_sort(list_t* x) {
stack_t z;
@ -37,12 +36,12 @@ void list_sort(list_t* x) {
for (lnode_t* c = l; c != r; c = c->next) {
if (lnode_compare(c, r) <= 0) {
p = (is_null(p)) ? l : p->next;
lnode_swap(p, c);
libcdsb_builtin_swap(p, c);
}
}
p = (is_null(p)) ? l : p->next;
lnode_swap(p, r);
libcdsb_builtin_swap(p, r);
stack_push(&z, r);
stack_push(&z, p->next);
@ -58,7 +57,7 @@ void list_reverse(list_t* x) {
lnode_t *r = x->last;
while (l != r) {
lnode_swap(l, r);
libcdsb_builtin_swap(l, r);
if ((r = r->prev) == l)
break;
l = l->next;

114
src/map/access.c Normal file
View File

@ -0,0 +1,114 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
static int libcdsb_builtin_foreach(map_t* x, void* data, map_access_callback callback) {
stack_t z, *top, *bot, *cur;
mnode_t* n;
int r = 0;
memset(&z, 0, sizeof(z));
if (rbnode_is_empty(z.value = x->root))
return 0;
for (top = bot = &z;;) {
for (cur = bot;;) {
n = top->value;
if (!mnode_is_empty(n->left)) cur = stack_insert(cur, n->left);
if (!mnode_is_empty(n->right)) cur = stack_insert(cur, n->right);
if (!r) {
r = callback(vnode_peek(&n->key, x->type), x->type, vnode_peek(&n->value, n->type), n->type, data);
} else {
stack_flush(&z);
return r;
}
if (top == bot) {
top = top->prev;
break;
} else top = top->prev;
}
if (!is_null(top)) {
while (!is_null(bot->prev)) bot = bot->prev;
} else break;
}
stack_flush(&z);
return r;
}
/*#####################################################################################################################*/
int libcdsb_map_find(map_t* x, const void* k, vtype t, void* _, map_access_callback callback, bool cut) {
mnode_t* c;
void *key;
int cmp;
c = x->root;
while (!mnode_is_empty(c)) {
key = vnode_peek(&c->key, x->type);
cmp = vtype_compare(k, t, key, x->type);
if (cmp == 0) {
cmp = (callback) ? callback(key, x->type, vnode_peek(&c->value, c->type), c->type, _) : 0;
if (cut) {
c = mnode_delete(&x->root, c);
vnode_free(&c->key, x->type);
vnode_free(&c->value, c->type);
free(c);
}
return cmp;
} else c = (cmp < 0) ? c->left : c->right;
}
return -1;
}
int libcdsb_map_foreach(map_t* x, void* data, map_access_callback callback, rbforeach_t type, bool flush) {
bool reverse;
stack_t iter;
mnode_t* n;
int r = 0;
reverse = type&RBFOREACH_REVERSE;
switch (type&(RBFOREACH_INORDER|RBFOREACH_PREORDER|RBFOREACH_POSTORDER|RBFOREACH_BREADTH_FIRST)) {
case RBFOREACH_INORDER: iter = miter_inorder (&x->root, reverse); break;
case RBFOREACH_PREORDER: iter = miter_preorder (&x->root, reverse); break;
case RBFOREACH_POSTORDER: iter = miter_postorder(&x->root, reverse); break;
default:
case RBFOREACH_BREADTH_FIRST: if (reverse || flush) {
iter = miter_breath_first(&x->root, type&RBFOREACH_REVERSE);
break;
} else return libcdsb_builtin_foreach(x, data, callback);
}
while ((n = stack_pop(&iter))) {
if (!r) {
r = callback(vnode_peek(&n->key, x->type), x->type, vnode_peek(&n->value, n->type), n->type, data);
} else if (!flush) {
stack_flush(&iter);
return r;
}
if (flush) {
vnode_free(&n->value, x->type);
free(n);
}
}
if (flush) x->root = mnode_empty;
return r;
}

View File

@ -1,163 +0,0 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
/*#####################################################################################################################*/
static inline int mnode_compare(const mnode_t* s0, const mnode_t* s1, vtype t) {
int c = vnode_compare_eq(&s0->key, &s1->key, t);
return !c ? vnode_compare(&s0->value, s0->type, &s1->value, s1->type) : c;
}
static inline hash_t mnode_hash(const mnode_t* s, vtype t) {
return vnode_hash(&s->key, t) + vnode_hash(&s->value, s->type) + t;
}
/*#####################################################################################################################*/
hash_t map_hash(const map_t* s) {
stack_t z;
mnode_t *c0, *c1;
hash_t hash, v;
if (mnode_is_empty(s->root))
return 0;
stack_init(&z);
stack_push(&z, s->root->left);
hash = 1;
if (!mnode_is_empty(c0 = stack_pop(&z))) {
do {
++hash;
if (!mnode_is_empty(c0->right)) stack_push(&z, c0->right);
if (!mnode_is_empty(c0->left)) stack_push(&z, c1 = c0->left);
} while (!is_null(c0 = stack_pop(&z)));
}
v = mnode_hash(c1, s->type);
stack_push(&z, s->root->right);
if (!mnode_is_empty(c0 = stack_pop(&z))) {
do {
++hash;
if (!mnode_is_empty(c0->right)) stack_push(&z, c1 = c0->right);
if (!mnode_is_empty(c0->left)) stack_push(&z, c0->left);
} while (!is_null(c0 = stack_pop(&z)));
}
v += mnode_hash(c1, s->type);
return (hash ^ v) + VTYPE_MAP;
}
/*#####################################################################################################################*/
void map_init(map_t* x, vtype t) {
x->root = mnode_empty;
x->type = t;
}
void map_free(map_t* x) {
mnode_t *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;
size_t n;
rbnode_t* c;
stack_init(&z);
stack_push(&z, x->root);
n = 0;
if (!mnode_is_empty(x->root)) {
while ((c = stack_pop(&z))) {
++n;
if (!rbnode_is_empty(c->right)) stack_push(&z, c->right);
if (!rbnode_is_empty(c->left)) stack_push(&z, c->left);
}
}
return n;
}
/*#####################################################################################################################*/
int map_compare(const map_t* s0, const map_t* s1) {
stack_t z;
mnode_t *c0, *c1;
int cmp;
if (s0 == s1 || s0->root == s1->root)
return 0;
if (s0->type != s1->type)
return s0->type - s1->type;
stack_init(&z);
stack_push_many(&z, 2, (void*)s1, (void*)s0);
cmp = 0;
do {
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 ((cmp = mnode_compare(c0, c1, s0->type))) {
if (c0->left == c1->right) { // == mnode_empty
cmp = mnode_compare(c0->right, c1, s0->type);
if (!cmp) cmp = mnode_compare(c0, c1->left, s0->type);
} else if (c0->right == c1->left) { // == mnode_empty
cmp = mnode_compare(c0, c1->right, s0->type);
if (!cmp) cmp = mnode_compare(c0->left, c1, s0->type);
}
if (cmp) {
stack_flush(&z);
return cmp;
}
} else stack_push_many(&z, 4, c1->right, c0->right, c1->left, c0->left);
} while (!is_null(z.value));
return 0;
}

56
src/map/comparison.c Normal file
View File

@ -0,0 +1,56 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
static inline int libcdsb_builtin_compare(const mnode_t* s0, const mnode_t* s1, vtype t) {
int c = vnode_compare_eq(&s0->key, &s1->key, t);
return !c ? vnode_compare(&s0->value, s0->type, &s1->value, s1->type) : c;
}
/*#####################################################################################################################*/
int map_compare(const map_t* s0, const map_t* s1) {
stack_t z;
mnode_t *c0, *c1;
int cmp;
if (s0 == s1 || s0->root == s1->root)
return 0;
if (s0->type != s1->type)
return s0->type - s1->type;
stack_init(&z);
stack_push_many(&z, 2, (void*)s1, (void*)s0);
cmp = 0;
do {
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 ((cmp = libcdsb_builtin_compare(c0, c1, s0->type))) {
if (c0->left == c1->right) { // == mnode_empty
cmp = libcdsb_builtin_compare(c0->right, c1, s0->type);
if (!cmp) cmp = libcdsb_builtin_compare(c0, c1->left, s0->type);
} else if (c0->right == c1->left) { // == mnode_empty
cmp = libcdsb_builtin_compare(c0, c1->right, s0->type);
if (!cmp) cmp = libcdsb_builtin_compare(c0->left, c1, s0->type);
}
if (cmp) {
stack_flush(&z);
return cmp;
}
} else stack_push_many(&z, 4, c1->right, c0->right, c1->left, c0->left);
} while (!is_null(z.value));
return 0;
}

70
src/map/compute.c Normal file
View File

@ -0,0 +1,70 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
static inline hash_t libcdsb_builtin_hash(const mnode_t* s, vtype t) {
return vnode_hash(&s->key, t) + vnode_hash(&s->value, s->type) + t;
}
/*#####################################################################################################################*/
size_t map_size(const map_t* x) {
stack_t z;
size_t n;
rbnode_t* c;
stack_init(&z);
stack_push(&z, x->root);
n = 0;
if (!mnode_is_empty(x->root)) {
while ((c = stack_pop(&z))) {
++n;
if (!rbnode_is_empty(c->right)) stack_push(&z, c->right);
if (!rbnode_is_empty(c->left)) stack_push(&z, c->left);
}
}
return n;
}
hash_t map_hash(const map_t* s) {
stack_t z;
mnode_t *c0, *c1;
hash_t hash, v;
if (mnode_is_empty(s->root))
return 0;
stack_init(&z);
stack_push(&z, s->root->left);
hash = 1;
if (!mnode_is_empty(c0 = stack_pop(&z))) {
do {
++hash;
if (!mnode_is_empty(c0->right)) stack_push(&z, c0->right);
if (!mnode_is_empty(c0->left)) stack_push(&z, c1 = c0->left);
} while (!is_null(c0 = stack_pop(&z)));
}
v = libcdsb_builtin_hash(c1, s->type);
stack_push(&z, s->root->right);
if (!mnode_is_empty(c0 = stack_pop(&z))) {
do {
++hash;
if (!mnode_is_empty(c0->right)) stack_push(&z, c1 = c0->right);
if (!mnode_is_empty(c0->left)) stack_push(&z, c0->left);
} while (!is_null(c0 = stack_pop(&z)));
}
v += libcdsb_builtin_hash(c1, s->type);
return (hash ^ v) + VTYPE_MAP;
}

View File

@ -3,9 +3,7 @@
#include "include.h"
/*#####################################################################################################################*/
static inline mnode_t* mnode_duplicate(const mnode_t* s, mnode_t* p, const vtype t) {
static inline mnode_t* libcdsb_builtin_duplicate(const mnode_t* s, mnode_t* p, const vtype t) {
mnode_t* x;
x = mnode_create(vnode_duplicate(&s->key, t), p, s->colored);
@ -28,7 +26,7 @@ map_t map_copy(const map_t* s) {
x.type = s->type;
if (!mnode_is_empty(s->root)) {
x.root = mnode_duplicate(s->root, mnode_empty, s->type);
x.root = libcdsb_builtin_duplicate(s->root, mnode_empty, s->type);
stack_push(&z, x.root);
do {
@ -36,12 +34,12 @@ map_t map_copy(const map_t* s) {
mnode_t *p1 = stack_pop(&z);
if (!mnode_is_empty(p1->left)) {
p0->left = mnode_duplicate(p1->left, p0, s->type);
p0->left = libcdsb_builtin_duplicate(p1->left, p0, s->type);
stack_push_many(&z, 2, p1->left, p0->left);
}
if (!mnode_is_empty(p1->right)) {
p0->right = mnode_duplicate(p1->right, p0, s->type);
p0->right = libcdsb_builtin_duplicate(p1->right, p0, s->type);
stack_push_many(&z, 2, p1->right, p0->right);
}
@ -65,7 +63,7 @@ map_t* map_duplicate(const map_t* s) {
x->type = s->type;
if (!mnode_is_empty(s->root)) {
x->root = mnode_duplicate(s->root, mnode_empty, s->type);
x->root = libcdsb_builtin_duplicate(s->root, mnode_empty, s->type);
stack_push(&z, x->root);
do {
@ -73,12 +71,12 @@ map_t* map_duplicate(const map_t* s) {
mnode_t *p1 = stack_pop(&z);
if (!mnode_is_empty(p1->left)) {
p0->left = mnode_duplicate(p1->left, p0, s->type);
p0->left = libcdsb_builtin_duplicate(p1->left, p0, s->type);
stack_push_many(&z, 2, p1->left, p0->left);
}
if (!mnode_is_empty(p1->right)) {
p0->right = mnode_duplicate(p1->right, p0, s->type);
p0->right = libcdsb_builtin_duplicate(p1->right, p0, s->type);
stack_push_many(&z, 2, p1->right, p0->right);
}
@ -100,7 +98,7 @@ void map_copy_init(map_t* x, const map_t* s) {
x->type = s->type;
if (!mnode_is_empty(s->root)) {
x->root = mnode_duplicate(s->root, mnode_empty, s->type);
x->root = libcdsb_builtin_duplicate(s->root, mnode_empty, s->type);
stack_push(&z, x->root);
do {
@ -108,12 +106,12 @@ void map_copy_init(map_t* x, const map_t* s) {
mnode_t *p1 = stack_pop(&z);
if (!mnode_is_empty(p1->left)) {
p0->left = mnode_duplicate(p1->left, p0, s->type);
p0->left = libcdsb_builtin_duplicate(p1->left, p0, s->type);
stack_push_many(&z, 2, p1->left, p0->left);
}
if (!mnode_is_empty(p1->right)) {
p0->right = mnode_duplicate(p1->right, p0, s->type);
p0->right = libcdsb_builtin_duplicate(p1->right, p0, s->type);
stack_push_many(&z, 2, p1->right, p0->right);
}

View File

@ -1,125 +0,0 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
bool libcdsb_map_update(map_t* x, const void* k, vtype kt, const void* v, vtype vt) {
int cmp;
mnode_t* n;
mnode_t* p;
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, x->type);
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_find(map_t* x, const void* k, vtype t, void* _, map_access_callback callback, bool cut) {
mnode_t* c;
void *key;
int cmp;
c = x->root;
while (!mnode_is_empty(c)) {
key = vnode_peek(&c->key, x->type);
cmp = vtype_compare(k, t, key, x->type);
if (cmp == 0) {
cmp = (callback) ? callback(key, x->type, vnode_peek(&c->value, c->type), c->type, _) : 0;
if (cut) {
c = mnode_delete(&x->root, c);
vnode_free(&c->key, x->type);
vnode_free(&c->value, c->type);
free(c);
}
return cmp;
} else c = (cmp < 0) ? c->left : c->right;
}
return -1;
}
int libcdsb_map_foreach(map_t* x, void* dt, map_access_callback callback, bool flush) {
stack_t z;
int r;
mnode_t* c;
stack_init(&z);
stack_push(&z, x->root);
r = 0;
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;
}

View File

@ -1,445 +0,0 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
int libcdsb_map_find_pointer(map_t* x, const void* k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); }
int libcdsb_map_find_cstring(map_t* x, const char* k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); }
int libcdsb_map_find_string (map_t* x, const str_t* k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, k, vtypeof( k), _, cb, cut); }
int libcdsb_map_find_array (map_t* x, const arr_t* k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, k, vtypeof( k), _, cb, cut); }
int libcdsb_map_find_list (map_t* x, const list_t* k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, k, vtypeof( k), _, cb, cut); }
int libcdsb_map_find_map (map_t* x, const map_t* k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, k, vtypeof( k), _, cb, cut); }
int libcdsb_map_find_vset (map_t* x, const set_t* k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, k, vtypeof( k), _, cb, cut); }
int libcdsb_map_find_dict (map_t* x, const dict_t* k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, k, vtypeof( k), _, cb, cut); }
int libcdsb_map_find_boolean(map_t* x, bool k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); }
int libcdsb_map_find_int8 (map_t* x, s8_t k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); }
int libcdsb_map_find_int16 (map_t* x, s16_t k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); }
int libcdsb_map_find_int32 (map_t* x, s32_t k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); }
int libcdsb_map_find_int64 (map_t* x, s64_t k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); }
int libcdsb_map_find_uint8 (map_t* x, u8_t k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); }
int libcdsb_map_find_uint16 (map_t* x, u16_t k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); }
int libcdsb_map_find_uint32 (map_t* x, u32_t k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); }
int libcdsb_map_find_uint64 (map_t* x, u64_t k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); }
int libcdsb_map_find_float (map_t* x, fl_t k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); }
int libcdsb_map_find_double (map_t* x, dbl_t k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); }
int libcdsb_map_find_ldouble(map_t* x, ldbl_t k, void* _, map_access_callback cb, bool cut) { return libcdsb_map_find(x, &k, vtypeof(&k), _, cb, cut); }
bool libcdsb_map_update_pointer_pointer(map_t* x, const void* k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_pointer_cstring(map_t* x, const void* k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_pointer_string (map_t* x, const void* k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_pointer_array (map_t* x, const void* k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_pointer_list (map_t* x, const void* k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_pointer_map (map_t* x, const void* k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_pointer_vset (map_t* x, const void* k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_pointer_dict (map_t* x, const void* k, const dict_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_pointer_boolean(map_t* x, const void* k, bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_pointer_int8 (map_t* x, const void* k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_pointer_int16 (map_t* x, const void* k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_pointer_int32 (map_t* x, const void* k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_pointer_int64 (map_t* x, const void* k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_pointer_uint8 (map_t* x, const void* k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_pointer_uint16 (map_t* x, const void* k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_pointer_uint32 (map_t* x, const void* k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_pointer_uint64 (map_t* x, const void* k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_pointer_float (map_t* x, const void* k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_pointer_double (map_t* x, const void* k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_pointer_ldouble(map_t* x, const void* k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_cstring_pointer(map_t* x, const char* k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_cstring_cstring(map_t* x, const char* k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_cstring_string (map_t* x, const char* k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_cstring_array (map_t* x, const char* k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_cstring_list (map_t* x, const char* k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_cstring_map (map_t* x, const char* k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_cstring_vset (map_t* x, const char* k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_cstring_dict (map_t* x, const char* k, const dict_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_cstring_boolean(map_t* x, const char* k, bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_cstring_int8 (map_t* x, const char* k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_cstring_int16 (map_t* x, const char* k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_cstring_int32 (map_t* x, const char* k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_cstring_int64 (map_t* x, const char* k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_cstring_uint8 (map_t* x, const char* k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_cstring_uint16 (map_t* x, const char* k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_cstring_uint32 (map_t* x, const char* k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_cstring_uint64 (map_t* x, const char* k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_cstring_float (map_t* x, const char* k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_cstring_double (map_t* x, const char* k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_cstring_ldouble(map_t* x, const char* k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_string_pointer(map_t* x, const str_t* k, const void* v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_string_cstring(map_t* x, const str_t* k, const char* v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_string_string (map_t* x, const str_t* k, const str_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_string_array (map_t* x, const str_t* k, const arr_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_string_list (map_t* x, const str_t* k, const list_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_string_map (map_t* x, const str_t* k, const map_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_string_vset (map_t* x, const str_t* k, const set_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_string_dict (map_t* x, const str_t* k, const dict_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_string_boolean(map_t* x, const str_t* k, bool v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_string_int8 (map_t* x, const str_t* k, s8_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_string_int16 (map_t* x, const str_t* k, s16_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_string_int32 (map_t* x, const str_t* k, s32_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_string_int64 (map_t* x, const str_t* k, s64_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_string_uint8 (map_t* x, const str_t* k, u8_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_string_uint16 (map_t* x, const str_t* k, u16_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_string_uint32 (map_t* x, const str_t* k, u32_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_string_uint64 (map_t* x, const str_t* k, u64_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_string_float (map_t* x, const str_t* k, fl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_string_double (map_t* x, const str_t* k, dbl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_string_ldouble(map_t* x, const str_t* k, ldbl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_array_pointer(map_t* x, const arr_t* k, const void* v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_array_cstring(map_t* x, const arr_t* k, const char* v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_array_string (map_t* x, const arr_t* k, const str_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_array_array (map_t* x, const arr_t* k, const arr_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_array_list (map_t* x, const arr_t* k, const list_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_array_map (map_t* x, const arr_t* k, const map_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_array_vset (map_t* x, const arr_t* k, const set_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_array_dict (map_t* x, const arr_t* k, const dict_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_array_boolean(map_t* x, const arr_t* k, bool v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_array_int8 (map_t* x, const arr_t* k, s8_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_array_int16 (map_t* x, const arr_t* k, s16_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_array_int32 (map_t* x, const arr_t* k, s32_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_array_int64 (map_t* x, const arr_t* k, s64_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_array_uint8 (map_t* x, const arr_t* k, u8_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_array_uint16 (map_t* x, const arr_t* k, u16_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_array_uint32 (map_t* x, const arr_t* k, u32_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_array_uint64 (map_t* x, const arr_t* k, u64_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_array_float (map_t* x, const arr_t* k, fl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_array_double (map_t* x, const arr_t* k, dbl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_array_ldouble(map_t* x, const arr_t* k, ldbl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_list_pointer(map_t* x, const list_t* k, const void* v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_list_cstring(map_t* x, const list_t* k, const char* v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_list_string (map_t* x, const list_t* k, const str_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_list_array (map_t* x, const list_t* k, const arr_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_list_list (map_t* x, const list_t* k, const list_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_list_map (map_t* x, const list_t* k, const map_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_list_vset (map_t* x, const list_t* k, const set_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_list_dict (map_t* x, const list_t* k, const dict_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_list_boolean(map_t* x, const list_t* k, bool v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_list_int8 (map_t* x, const list_t* k, s8_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_list_int16 (map_t* x, const list_t* k, s16_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_list_int32 (map_t* x, const list_t* k, s32_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_list_int64 (map_t* x, const list_t* k, s64_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_list_uint8 (map_t* x, const list_t* k, u8_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_list_uint16 (map_t* x, const list_t* k, u16_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_list_uint32 (map_t* x, const list_t* k, u32_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_list_uint64 (map_t* x, const list_t* k, u64_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_list_float (map_t* x, const list_t* k, fl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_list_double (map_t* x, const list_t* k, dbl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_list_ldouble(map_t* x, const list_t* k, ldbl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_map_pointer(map_t* x, const map_t* k, const void* v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_map_cstring(map_t* x, const map_t* k, const char* v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_map_string (map_t* x, const map_t* k, const str_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_map_array (map_t* x, const map_t* k, const arr_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_map_list (map_t* x, const map_t* k, const list_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_map_map (map_t* x, const map_t* k, const map_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_map_vset (map_t* x, const map_t* k, const set_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_map_dict (map_t* x, const map_t* k, const dict_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_map_boolean(map_t* x, const map_t* k, bool v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_map_int8 (map_t* x, const map_t* k, s8_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_map_int16 (map_t* x, const map_t* k, s16_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_map_int32 (map_t* x, const map_t* k, s32_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_map_int64 (map_t* x, const map_t* k, s64_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_map_uint8 (map_t* x, const map_t* k, u8_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_map_uint16 (map_t* x, const map_t* k, u16_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_map_uint32 (map_t* x, const map_t* k, u32_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_map_uint64 (map_t* x, const map_t* k, u64_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_map_float (map_t* x, const map_t* k, fl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_map_double (map_t* x, const map_t* k, dbl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_map_ldouble(map_t* x, const map_t* k, ldbl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_vset_pointer(map_t* x, const set_t* k, const void* v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_vset_cstring(map_t* x, const set_t* k, const char* v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_vset_string (map_t* x, const set_t* k, const str_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_vset_array (map_t* x, const set_t* k, const arr_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_vset_list (map_t* x, const set_t* k, const list_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_vset_map (map_t* x, const set_t* k, const map_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_vset_vset (map_t* x, const set_t* k, const set_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_vset_dict (map_t* x, const set_t* k, const dict_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_vset_boolean(map_t* x, const set_t* k, bool v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_vset_int8 (map_t* x, const set_t* k, s8_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_vset_int16 (map_t* x, const set_t* k, s16_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_vset_int32 (map_t* x, const set_t* k, s32_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_vset_int64 (map_t* x, const set_t* k, s64_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_vset_uint8 (map_t* x, const set_t* k, u8_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_vset_uint16 (map_t* x, const set_t* k, u16_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_vset_uint32 (map_t* x, const set_t* k, u32_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_vset_uint64 (map_t* x, const set_t* k, u64_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_vset_float (map_t* x, const set_t* k, fl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_vset_double (map_t* x, const set_t* k, dbl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_vset_ldouble(map_t* x, const set_t* k, ldbl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_dict_pointer(map_t* x, const dict_t* k, const void* v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_dict_cstring(map_t* x, const dict_t* k, const char* v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_dict_string (map_t* x, const dict_t* k, const str_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_dict_array (map_t* x, const dict_t* k, const arr_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_dict_list (map_t* x, const dict_t* k, const list_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_dict_map (map_t* x, const dict_t* k, const map_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_dict_vset (map_t* x, const dict_t* k, const set_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_dict_dict (map_t* x, const dict_t* k, const dict_t* v) { return libcdsb_map_update(x, k, vtypeof(k), v, vtypeof( v)); }
bool libcdsb_map_update_dict_boolean(map_t* x, const dict_t* k, bool v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_dict_int8 (map_t* x, const dict_t* k, s8_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_dict_int16 (map_t* x, const dict_t* k, s16_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_dict_int32 (map_t* x, const dict_t* k, s32_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_dict_int64 (map_t* x, const dict_t* k, s64_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_dict_uint8 (map_t* x, const dict_t* k, u8_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_dict_uint16 (map_t* x, const dict_t* k, u16_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_dict_uint32 (map_t* x, const dict_t* k, u32_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_dict_uint64 (map_t* x, const dict_t* k, u64_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_dict_float (map_t* x, const dict_t* k, fl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_dict_double (map_t* x, const dict_t* k, dbl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_dict_ldouble(map_t* x, const dict_t* k, ldbl_t v) { return libcdsb_map_update(x, k, vtypeof(k), &v, vtypeof(&v)); }
bool libcdsb_map_update_boolean_pointer(map_t* x, const bool k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_boolean_cstring(map_t* x, const bool k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_boolean_string (map_t* x, const bool k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_boolean_array (map_t* x, const bool k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_boolean_list (map_t* x, const bool k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_boolean_map (map_t* x, const bool k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_boolean_vset (map_t* x, const bool k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_boolean_dict (map_t* x, const bool k, const dict_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_boolean_boolean(map_t* x, const bool k, bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_boolean_int8 (map_t* x, const bool k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_boolean_int16 (map_t* x, const bool k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_boolean_int32 (map_t* x, const bool k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_boolean_int64 (map_t* x, const bool k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_boolean_uint8 (map_t* x, const bool k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_boolean_uint16 (map_t* x, const bool k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_boolean_uint32 (map_t* x, const bool k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_boolean_uint64 (map_t* x, const bool k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_boolean_float (map_t* x, const bool k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_boolean_double (map_t* x, const bool k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_boolean_ldouble(map_t* x, const bool k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int8_pointer(map_t* x, const s8_t k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int8_cstring(map_t* x, const s8_t k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int8_string (map_t* x, const s8_t k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_int8_array (map_t* x, const s8_t k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_int8_list (map_t* x, const s8_t k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_int8_map (map_t* x, const s8_t k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_int8_vset (map_t* x, const s8_t k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_int8_dict (map_t* x, const s8_t k, const dict_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_int8_boolean(map_t* x, const s8_t k, bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int8_int8 (map_t* x, const s8_t k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int8_int16 (map_t* x, const s8_t k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int8_int32 (map_t* x, const s8_t k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int8_int64 (map_t* x, const s8_t k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int8_uint8 (map_t* x, const s8_t k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int8_uint16 (map_t* x, const s8_t k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int8_uint32 (map_t* x, const s8_t k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int8_uint64 (map_t* x, const s8_t k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int8_float (map_t* x, const s8_t k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int8_double (map_t* x, const s8_t k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int8_ldouble(map_t* x, const s8_t k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int16_pointer(map_t* x, const s16_t k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int16_cstring(map_t* x, const s16_t k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int16_string (map_t* x, const s16_t k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_int16_array (map_t* x, const s16_t k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_int16_list (map_t* x, const s16_t k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_int16_map (map_t* x, const s16_t k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_int16_vset (map_t* x, const s16_t k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_int16_dict (map_t* x, const s16_t k, const dict_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_int16_boolean(map_t* x, const s16_t k, bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int16_int8 (map_t* x, const s16_t k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int16_int16 (map_t* x, const s16_t k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int16_int32 (map_t* x, const s16_t k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int16_int64 (map_t* x, const s16_t k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int16_uint8 (map_t* x, const s16_t k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int16_uint16 (map_t* x, const s16_t k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int16_uint32 (map_t* x, const s16_t k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int16_uint64 (map_t* x, const s16_t k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int16_float (map_t* x, const s16_t k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int16_double (map_t* x, const s16_t k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int16_ldouble(map_t* x, const s16_t k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int32_pointer(map_t* x, const s32_t k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int32_cstring(map_t* x, const s32_t k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int32_string (map_t* x, const s32_t k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_int32_array (map_t* x, const s32_t k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_int32_list (map_t* x, const s32_t k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_int32_map (map_t* x, const s32_t k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_int32_vset (map_t* x, const s32_t k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_int32_dict (map_t* x, const s32_t k, const dict_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_int32_boolean(map_t* x, const s32_t k, bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int32_int8 (map_t* x, const s32_t k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int32_int16 (map_t* x, const s32_t k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int32_int32 (map_t* x, const s32_t k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int32_int64 (map_t* x, const s32_t k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int32_uint8 (map_t* x, const s32_t k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int32_uint16 (map_t* x, const s32_t k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int32_uint32 (map_t* x, const s32_t k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int32_uint64 (map_t* x, const s32_t k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int32_float (map_t* x, const s32_t k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int32_double (map_t* x, const s32_t k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int32_ldouble(map_t* x, const s32_t k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int64_pointer(map_t* x, const s64_t k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int64_cstring(map_t* x, const s64_t k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int64_string (map_t* x, const s64_t k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_int64_array (map_t* x, const s64_t k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_int64_list (map_t* x, const s64_t k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_int64_map (map_t* x, const s64_t k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_int64_vset (map_t* x, const s64_t k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_int64_dict (map_t* x, const s64_t k, const dict_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_int64_boolean(map_t* x, const s64_t k, bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int64_int8 (map_t* x, const s64_t k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int64_int16 (map_t* x, const s64_t k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int64_int32 (map_t* x, const s64_t k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int64_int64 (map_t* x, const s64_t k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int64_uint8 (map_t* x, const s64_t k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int64_uint16 (map_t* x, const s64_t k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int64_uint32 (map_t* x, const s64_t k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int64_uint64 (map_t* x, const s64_t k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int64_float (map_t* x, const s64_t k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int64_double (map_t* x, const s64_t k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_int64_ldouble(map_t* x, const s64_t k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint8_pointer(map_t* x, const u8_t k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint8_cstring(map_t* x, const u8_t k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint8_string (map_t* x, const u8_t k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_uint8_array (map_t* x, const u8_t k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_uint8_list (map_t* x, const u8_t k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_uint8_map (map_t* x, const u8_t k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_uint8_vset (map_t* x, const u8_t k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_uint8_dict (map_t* x, const u8_t k, const dict_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_uint8_boolean(map_t* x, const u8_t k, bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint8_int8 (map_t* x, const u8_t k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint8_int16 (map_t* x, const u8_t k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint8_int32 (map_t* x, const u8_t k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint8_int64 (map_t* x, const u8_t k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint8_uint8 (map_t* x, const u8_t k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint8_uint16 (map_t* x, const u8_t k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint8_uint32 (map_t* x, const u8_t k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint8_uint64 (map_t* x, const u8_t k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint8_float (map_t* x, const u8_t k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint8_double (map_t* x, const u8_t k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint8_ldouble(map_t* x, const u8_t k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint16_pointer(map_t* x, const u16_t k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint16_cstring(map_t* x, const u16_t k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint16_string (map_t* x, const u16_t k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_uint16_array (map_t* x, const u16_t k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_uint16_list (map_t* x, const u16_t k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_uint16_map (map_t* x, const u16_t k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_uint16_vset (map_t* x, const u16_t k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_uint16_dict (map_t* x, const u16_t k, const dict_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_uint16_boolean(map_t* x, const u16_t k, bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint16_int8 (map_t* x, const u16_t k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint16_int16 (map_t* x, const u16_t k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint16_int32 (map_t* x, const u16_t k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint16_int64 (map_t* x, const u16_t k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint16_uint8 (map_t* x, const u16_t k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint16_uint16 (map_t* x, const u16_t k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint16_uint32 (map_t* x, const u16_t k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint16_uint64 (map_t* x, const u16_t k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint16_float (map_t* x, const u16_t k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint16_double (map_t* x, const u16_t k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint16_ldouble(map_t* x, const u16_t k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint32_pointer(map_t* x, const u32_t k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint32_cstring(map_t* x, const u32_t k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint32_string (map_t* x, const u32_t k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_uint32_array (map_t* x, const u32_t k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_uint32_list (map_t* x, const u32_t k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_uint32_map (map_t* x, const u32_t k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_uint32_vset (map_t* x, const u32_t k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_uint32_dict (map_t* x, const u32_t k, const dict_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_uint32_boolean(map_t* x, const u32_t k, bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint32_int8 (map_t* x, const u32_t k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint32_int16 (map_t* x, const u32_t k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint32_int32 (map_t* x, const u32_t k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint32_int64 (map_t* x, const u32_t k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint32_uint8 (map_t* x, const u32_t k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint32_uint16 (map_t* x, const u32_t k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint32_uint32 (map_t* x, const u32_t k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint32_uint64 (map_t* x, const u32_t k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint32_float (map_t* x, const u32_t k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint32_double (map_t* x, const u32_t k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint32_ldouble(map_t* x, const u32_t k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint64_pointer(map_t* x, const u64_t k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint64_cstring(map_t* x, const u64_t k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint64_string (map_t* x, const u64_t k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_uint64_array (map_t* x, const u64_t k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_uint64_list (map_t* x, const u64_t k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_uint64_map (map_t* x, const u64_t k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_uint64_vset (map_t* x, const u64_t k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_uint64_dict (map_t* x, const u64_t k, const dict_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_uint64_boolean(map_t* x, const u64_t k, bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint64_int8 (map_t* x, const u64_t k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint64_int16 (map_t* x, const u64_t k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint64_int32 (map_t* x, const u64_t k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint64_int64 (map_t* x, const u64_t k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint64_uint8 (map_t* x, const u64_t k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint64_uint16 (map_t* x, const u64_t k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint64_uint32 (map_t* x, const u64_t k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint64_uint64 (map_t* x, const u64_t k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint64_float (map_t* x, const u64_t k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint64_double (map_t* x, const u64_t k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_uint64_ldouble(map_t* x, const u64_t k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_float_pointer(map_t* x, const fl_t k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_float_cstring(map_t* x, const fl_t k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_float_string (map_t* x, const fl_t k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_float_array (map_t* x, const fl_t k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_float_list (map_t* x, const fl_t k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_float_map (map_t* x, const fl_t k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_float_vset (map_t* x, const fl_t k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_float_dict (map_t* x, const fl_t k, const dict_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_float_boolean(map_t* x, const fl_t k, bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_float_int8 (map_t* x, const fl_t k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_float_int16 (map_t* x, const fl_t k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_float_int32 (map_t* x, const fl_t k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_float_int64 (map_t* x, const fl_t k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_float_uint8 (map_t* x, const fl_t k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_float_uint16 (map_t* x, const fl_t k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_float_uint32 (map_t* x, const fl_t k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_float_uint64 (map_t* x, const fl_t k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_float_float (map_t* x, const fl_t k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_float_double (map_t* x, const fl_t k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_float_ldouble(map_t* x, const fl_t k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_double_pointer(map_t* x, const dbl_t k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_double_cstring(map_t* x, const dbl_t k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_double_string (map_t* x, const dbl_t k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_double_array (map_t* x, const dbl_t k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_double_list (map_t* x, const dbl_t k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_double_map (map_t* x, const dbl_t k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_double_vset (map_t* x, const dbl_t k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_double_dict (map_t* x, const dbl_t k, const dict_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_double_boolean(map_t* x, const dbl_t k, bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_double_int8 (map_t* x, const dbl_t k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_double_int16 (map_t* x, const dbl_t k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_double_int32 (map_t* x, const dbl_t k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_double_int64 (map_t* x, const dbl_t k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_double_uint8 (map_t* x, const dbl_t k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_double_uint16 (map_t* x, const dbl_t k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_double_uint32 (map_t* x, const dbl_t k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_double_uint64 (map_t* x, const dbl_t k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_double_float (map_t* x, const dbl_t k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_double_double (map_t* x, const dbl_t k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_double_ldouble(map_t* x, const dbl_t k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_ldouble_pointer(map_t* x, const ldbl_t k, const void* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_ldouble_cstring(map_t* x, const ldbl_t k, const char* v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_ldouble_string (map_t* x, const ldbl_t k, const str_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_ldouble_array (map_t* x, const ldbl_t k, const arr_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_ldouble_list (map_t* x, const ldbl_t k, const list_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_ldouble_map (map_t* x, const ldbl_t k, const map_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_ldouble_vset (map_t* x, const ldbl_t k, const set_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_ldouble_dict (map_t* x, const ldbl_t k, const dict_t* v) { return libcdsb_map_update(x, &k, vtypeof(&k), v, vtypeof( v)); }
bool libcdsb_map_update_ldouble_boolean(map_t* x, const ldbl_t k, bool v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_ldouble_int8 (map_t* x, const ldbl_t k, s8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_ldouble_int16 (map_t* x, const ldbl_t k, s16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_ldouble_int32 (map_t* x, const ldbl_t k, s32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_ldouble_int64 (map_t* x, const ldbl_t k, s64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_ldouble_uint8 (map_t* x, const ldbl_t k, u8_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_ldouble_uint16 (map_t* x, const ldbl_t k, u16_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_ldouble_uint32 (map_t* x, const ldbl_t k, u32_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_ldouble_uint64 (map_t* x, const ldbl_t k, u64_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_ldouble_float (map_t* x, const ldbl_t k, fl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_ldouble_double (map_t* x, const ldbl_t k, dbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }
bool libcdsb_map_update_ldouble_ldouble(map_t* x, const ldbl_t k, ldbl_t v) { return libcdsb_map_update(x, &k, vtypeof(&k), &v, vtypeof(&v)); }

View File

@ -1,7 +1,7 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "../../include/extra/map.h"
#include "../../include/map.h"
#include "../__internal/assert.h"
#include "../__internal/rbtree.h"
@ -24,16 +24,20 @@ static_assert(offsetof(struct libcdsb_rbtree_node, right) == offsetof(struct lib
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_empty ((mnode_t*)rbnode_empty)
#define mnode_create(k, p, c) ((mnode_t*)libcdsb_builtin_rbtree_node_create(k, (rbnode_t*)p, c, sizeof(mnode_t)))
#define mnode_fixup(r, n) libcdsb_builtin_rbtree_node_fixup((rbnode_t**)(r), (rbnode_t*)(n))
#define mnode_delete(r, n) (mnode_t*)libcdsb_builtin_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)
#define miter_inorder(x, reverse) rbiter_inorder((void*)x, reverse)
#define miter_preorder(x, reverse) rbiter_preorder((void*)x, reverse)
#define miter_postorder(x, reverse) rbiter_postorder((void*)x, reverse)
#define miter_breath_first(x, reverse) rbiter_breath_first((void*)x, reverse)
#endif /* LIBCDSB_SRC_MAP_INCLUDE_H */

41
src/map/memory.c Normal file
View File

@ -0,0 +1,41 @@
/* 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, *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;
}

88
src/map/modify.c Normal file
View File

@ -0,0 +1,88 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
bool libcdsb_map_update(map_t* x, const void* k, vtype kt, const void* v, vtype vt) {
int cmp;
mnode_t* n;
mnode_t* p;
if (!mnode_is_empty(n = x->root)) {
do {
p = n;
cmp = vtype_compare(k, kt, vnode_peek(&n->key, kt), kt);
if (cmp == 0) {
vnode_free(&n->value, n->type);
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(nullptr, 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(nullptr, mnode_empty, 0);
n->key = vnode_tcreate(x->type, k, kt);
n->value = vnode_create(v, vt);
n->type = vt;
return false;
}
bool libcdsb_map_inject(map_t* x, const void* k, vtype kt, const void* v, vtype vt) {
int cmp;
mnode_t* n;
mnode_t* p;
vnode_t kn;
vnode_tattach(&kn, x->type, k, kt);
n = x->root;
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, x->type);
vnode_free(&n->value, n->type);
n->key = kn;
vnode_attach(&n->value, v, 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);
vnode_attach(&n->value, v, n->type = vt);
return false;
}

View File

@ -2,8 +2,8 @@
/* Copyright © 2022 Gregory Lirent */
#include <stdlib.h>
#include "../include/extra/cstring.h"
#include "__internal/include.h"
#undef aligned_alloc
#undef malloc
#undef realloc

View File

@ -11,19 +11,12 @@ typedef enum libcdsb_rbtree_node_direction {
#define rbdir_dir(cur, d) (&((cur)->left))[(d)>>1]
#define rbdir_inv(cur, d) (&((cur)->left))[(d)&1]
/*#####################################################################################################################*/
#define rotate libcdsb_builtin_rotate
#define replace libcdsb_builtin_replace
#define fixup libcdsb_builtin_fixup
rbnode_t LIBCDSB_RBTREE_NODE_EMPTY[1] = {{
.colored = 0,
.value = 0,
.parent = rbnode_empty,
.left = rbnode_empty,
.right = rbnode_empty
}};
/*#####################################################################################################################*/
static inline void rotate(rbnode_t **x, rbnode_t *c, rbdir_t d) {
static void libcdsb_builtin_rotate(rbnode_t **x, rbnode_t *c, rbdir_t d) {
rbnode_t* n = rbdir_inv(c, d);
rbdir_inv(c, d) = rbdir_dir(n, d);
@ -41,7 +34,8 @@ static inline void rotate(rbnode_t **x, rbnode_t *c, rbdir_t d) {
c->parent = n;
}
static inline void replace(rbnode_t** x, rbnode_t* c, rbnode_t* n) {
static void libcdsb_builtin_replace(rbnode_t** x, rbnode_t* c, rbnode_t* n) {
if (!rbnode_is_root(c)) {
if (c->parent->left == c) {
c->parent->left = n;
@ -51,10 +45,7 @@ static inline void replace(rbnode_t** x, rbnode_t* c, rbnode_t* n) {
}
/*#####################################################################################################################*/
static void delete_fixup(rbnode_t** x, rbnode_t* n) {
static void libcdsb_builtin_fixup(rbnode_t** x, rbnode_t* n) {
rbdir_t d;
rbnode_t *s, *p;
@ -98,8 +89,16 @@ static void delete_fixup(rbnode_t** x, rbnode_t* n) {
/*#####################################################################################################################*/
rbnode_t LIBCDSB_BUILTIN_RBTREE_NODE_EMPTY[1] = {{
.colored = 0,
.value = 0,
.parent = rbnode_empty,
.left = rbnode_empty,
.right = rbnode_empty
}};
rbnode_t* libcdsb_rbtree_node_delete(rbnode_t** x, rbnode_t* c) {
rbnode_t* libcdsb_builtin_rbtree_node_delete(rbnode_t** x, rbnode_t* c) {
rbnode_t *n, *t;
int s;
@ -135,14 +134,14 @@ rbnode_t* libcdsb_rbtree_node_delete(rbnode_t** x, rbnode_t* c) {
t->left = c->left;
}
if (!s) delete_fixup(x, n);
if (!s) fixup(x, n);
return c;
}
void libcdsb_rbtree_node_fixup(rbnode_t** x, rbnode_t* n) {
void libcdsb_builtin_rbtree_node_fixup(rbnode_t** x, rbnode_t* n) {
rbdir_t d[2];
rbnode_t *u, *p, *gp;
@ -181,7 +180,7 @@ void libcdsb_rbtree_node_fixup(rbnode_t** x, rbnode_t* n) {
}
void* libcdsb_rbtree_node_create(void* v, rbnode_t* p, int c, int n) {
void* libcdsb_builtin_rbtree_node_create(void* v, rbnode_t* p, int c, int n) {
rbnode_t* x;
x = malloc(n);
@ -194,3 +193,160 @@ void* libcdsb_rbtree_node_create(void* v, rbnode_t* p, int c, int n) {
return x;
}
stack_t libcdsb_builtin_rbtree_iter_inorder(rbnode_t** root, bool reverse) {
rbnode_t *n, hack;
stack_t z, *bot;
memset(&z, 0, sizeof(z));
if (rbnode_is_empty(*root))
return z;
hack.right = *root;
n = &hack;
for (bot = &z;;) {
for (;;) {
if (rbnode_is_empty(n->right)) {
if (rbnode_is_root(n->parent) || n->parent->left == n) {
n = n->parent;
break;
} else n = n->parent;
if (rbnode_is_root(n->parent) || n->parent->left == n) {
n = n->parent;
break;
}
do {
n = n->parent;
} while (n->parent->right == n);
n = n->parent;
} else {
n = n->right;
while (!rbnode_is_empty(n->left))
n = n->left;
break;
}
if (rbnode_is_root(n)) {
bot = z.prev;
z = *bot;
free(bot);
if (reverse)
stack_reverse(&z);
return z;
}
}
bot = stack_insert(bot, n);
}
}
stack_t libcdsb_builtin_rbtree_iter_preorder(rbnode_t** root, bool reverse) {
stack_t z, *cur, *next;
rbnode_t *n;
memset(&z, 0, sizeof(z));
if (rbnode_is_empty(*root))
return z;
z.value = *root;
cur = &z;
do {
n = (next = cur)->value;
if (!rbnode_is_empty(n->left)) next = stack_insert(cur, n->left);
if (!rbnode_is_empty(n->right)) stack_insert(next, n->right);
} while (!is_null(cur = cur->prev));
if (reverse)
stack_reverse(&z);
return z;
}
stack_t libcdsb_builtin_rbtree_iter_postorder(rbnode_t** root, bool reverse) {
rbnode_t *p, *n;
stack_t z, *bot;
bot = &z;
z.prev = 0;
z.value = 0;
if (rbnode_is_empty(p = *root))
return z;
goto mid_;
do {
if (n->parent->right != n && !rbnode_is_empty(n->parent->right)) {
p = n->parent->right;
do { mid_:
n = p;
p = !rbnode_is_empty(p->left) ? p->left : p->right;
} while (!rbnode_is_empty(p));
} else n = n->parent;
bot = stack_insert(bot, n);
} while (!rbnode_is_root(n));
bot = z.prev;
z = *bot;
free(bot);
if (reverse)
stack_reverse(&z);
return z;
}
stack_t libcdsb_builtin_rbtree_iter_breath_first(rbnode_t** root, bool reverse) {
stack_t z, *top, *bot, *cur;
rbnode_t* n;
memset(&z, 0, sizeof(z));
if (rbnode_is_empty(z.value = *root))
return z;
for (top = bot = &z;;) {
for (cur = bot;;) {
n = top->value;
if (!rbnode_is_empty(n->left)) cur = stack_insert(cur, n->left);
if (!rbnode_is_empty(n->right)) cur = stack_insert(cur, n->right);
if (top == bot) {
top = top->prev;
break;
} else top = top->prev;
}
if (!is_null(top)) {
while (!is_null(bot->prev)) bot = bot->prev;
} else break;
}
if (reverse)
stack_reverse(&z);
return z;
}

114
src/set/access.c Normal file
View File

@ -0,0 +1,114 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "../../include/set.h"
#include "../__internal/rbtree.h"
static int libcdsb_builtin_foreach(set_t* x, void* data, vset_access_callback callback) {
stack_t z, *top, *bot, *cur;
rbnode_t* n;
int r = 0;
memset(&z, 0, sizeof(z));
if (rbnode_is_empty(z.value = x->root))
return 0;
for (top = bot = &z;;) {
for (cur = bot;;) {
n = top->value;
if (!rbnode_is_empty(n->left)) cur = stack_insert(cur, n->left);
if (!rbnode_is_empty(n->right)) cur = stack_insert(cur, n->right);
if (!r) {
r = callback(vnode_peek(&n->value, x->type), x->type, data);
} else {
stack_flush(&z);
return r;
}
if (top == bot) {
top = top->prev;
break;
} else top = top->prev;
}
if (!is_null(top)) {
while (!is_null(bot->prev)) bot = bot->prev;
} else break;
}
stack_flush(&z);
return r;
}
/*#####################################################################################################################*/
int libcdsb_vset_find(vtype_set* x, const void* v, vtype t, void* _, vset_access_callback callback, bool cut) {
rbnode_t* c;
void *val;
int cmp;
c = x->root;
while (!rbnode_is_empty(c)) {
val = vnode_peek(&c->value, x->type);
cmp = vtype_compare(v, t, val, x->type);
if (cmp == 0) {
cmp = (callback) ? callback(val, x->type, _) : 0;
if (cut) {
c = rbnode_delete(&x->root, c);
vnode_free(&c->value, x->type);
free(c);
}
return cmp;
} else c = (cmp < 0) ? c->left : c->right;
}
return -1;
}
int libcdsb_vset_foreach(set_t* x, void* data, vset_access_callback callback, rbforeach_t type, bool flush) {
bool reverse;
stack_t iter;
rbnode_t* n;
int r = 0;
reverse = type&RBFOREACH_REVERSE;
switch (type&(RBFOREACH_INORDER|RBFOREACH_PREORDER|RBFOREACH_POSTORDER|RBFOREACH_BREADTH_FIRST)) {
case RBFOREACH_INORDER: iter = rbiter_inorder (&x->root, reverse); break;
case RBFOREACH_PREORDER: iter = rbiter_preorder (&x->root, reverse); break;
case RBFOREACH_POSTORDER: iter = rbiter_postorder(&x->root, reverse); break;
default:
case RBFOREACH_BREADTH_FIRST: if (reverse || flush) {
iter = rbiter_breath_first(&x->root, type&RBFOREACH_REVERSE);
break;
} else return libcdsb_builtin_foreach(x, data, callback);
}
while ((n = stack_pop(&iter))) {
if (!r) {
r = callback(vnode_peek(&n->value, x->type), x->type, data);
} else if (!flush) {
stack_flush(&iter);
return r;
}
if (flush) {
vnode_free(&n->value, x->type);
free(n);
}
}
if (flush) x->root = rbnode_empty;
return r;
}

View File

@ -1,161 +0,0 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "../../include/set.h"
#include "../__internal/rbtree.h"
/*#####################################################################################################################*/
static inline int rbnode_compare(const rbnode_t* s0, const rbnode_t* s1, vtype t) {
return vnode_compare(s0->value, t, s1->value, t);
}
static inline hash_t rbnode_hash(const rbnode_t* s, vtype t) {
return vnode_hash(&s->value, t);
}
/*#####################################################################################################################*/
hash_t vset_hash(const set_t* s) {
stack_t z;
rbnode_t *c0, *c1;
hash_t hash, v;
if (rbnode_is_empty(s->root))
return 0;
stack_init(&z);
stack_push(&z, s->root->left);
hash = 1;
if (!rbnode_is_empty(c0 = stack_pop(&z))) {
do {
++hash;
if (!rbnode_is_empty(c0->right)) stack_push(&z, c0->right);
if (!rbnode_is_empty(c0->left)) stack_push(&z, c1 = c0->left);
} while (!is_null(c0 = stack_pop(&z)));
}
v = rbnode_hash(c1, s->type);
stack_push(&z, s->root->right);
if (!rbnode_is_empty(c0 = stack_pop(&z))) {
do {
++hash;
if (!rbnode_is_empty(c0->right)) stack_push(&z, c1 = c0->right);
if (!rbnode_is_empty(c0->left)) stack_push(&z, c0->left);
} while (!is_null(c0 = stack_pop(&z)));
}
v += rbnode_hash(c1, s->type);
return (hash ^ v) + VTYPE_SET;
}
/*#####################################################################################################################*/
void vset_init(set_t* x, vtype t) {
x->root = rbnode_empty;
x->type = t;
}
void vset_free(set_t* x) {
rbnode_t *t, *c;
c = x->root;
while (!rbnode_is_empty(x->root)) {
if (!rbnode_is_empty(c->left)) {
c = c->left;
} else if (!rbnode_is_empty(c->right)) {
c = c->right;
} else if (!rbnode_is_root(c)) {
vnode_free(&c->value, x->type);
t = c;
c = c->parent;
if (t == c->left) c->left = rbnode_empty;
else c->right = rbnode_empty;
free(t);
} else {
vnode_free(&c->value, x->type);
x->root = rbnode_empty;
}
}
x->type = 0;
}
/*#####################################################################################################################*/
size_t vset_size(const set_t* x) {
stack_t z;
size_t n;
rbnode_t* c;
stack_init(&z);
stack_push(&z, x->root);
n = 0;
if (!rbnode_is_empty(x->root)) {
while ((c = stack_pop(&z))) {
++n;
if (!rbnode_is_empty(c->right)) stack_push(&z, c->right);
if (!rbnode_is_empty(c->left)) stack_push(&z, c->left);
}
}
return n;
}
/*#####################################################################################################################*/
int vset_compare(const set_t* s0, const set_t* s1) {
stack_t z;
rbnode_t *c0, *c1;
int cmp;
if (s0 == s1 || s0->root == s1->root)
return 0;
if (s0->type != s1->type)
return s0->type - s1->type;
stack_init(&z);
stack_push_many(&z, 2, (void*)s1, (void*)s0);
cmp = 0;
do {
c0 = stack_pop(&z);
c1 = stack_pop(&z);
if (rbnode_is_empty(c0) || rbnode_is_empty(c1)) {
if (c0 != c1) {
stack_flush(&z);
return rbnode_is_empty(c0) ? -1 : 1;
}
} else if ((cmp = rbnode_compare(c0, c1, s0->type))) {
if (c0->left == c1->right) { // == rbnode_empty
cmp = rbnode_compare(c0->right, c1, s0->type);
if (!cmp) cmp = rbnode_compare(c0, c1->left, s0->type);
} else if (c0->right == c1->left) { // == rbnode_empty
cmp = rbnode_compare(c0, c1->right, s0->type);
if (!cmp) cmp = rbnode_compare(c0->left, c1, s0->type);
}
if (cmp) {
stack_flush(&z);
return cmp;
}
} else stack_push_many(&z, 4, c1->right, c0->right, c1->left, c0->left);
} while (!is_null(z.value));
return 0;
}

55
src/set/comparison.c Normal file
View File

@ -0,0 +1,55 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "../../include/set.h"
#include "../__internal/rbtree.h"
static inline int libcdsb_builtin_compare(const rbnode_t* s0, const rbnode_t* s1, vtype t) {
return vnode_compare(s0->value, t, s1->value, t);
}
/*#####################################################################################################################*/
int vset_compare(const set_t* s0, const set_t* s1) {
stack_t z;
rbnode_t *c0, *c1;
int cmp;
if (s0 == s1 || s0->root == s1->root)
return 0;
if (s0->type != s1->type)
return s0->type - s1->type;
stack_init(&z);
stack_push_many(&z, 2, (void*)s1, (void*)s0);
cmp = 0;
do {
c0 = stack_pop(&z);
c1 = stack_pop(&z);
if (rbnode_is_empty(c0) || rbnode_is_empty(c1)) {
if (c0 != c1) {
stack_flush(&z);
return rbnode_is_empty(c0) ? -1 : 1;
}
} else if ((cmp = libcdsb_builtin_compare(c0, c1, s0->type))) {
if (c0->left == c1->right) { // == rbnode_empty
cmp = libcdsb_builtin_compare(c0->right, c1, s0->type);
if (!cmp) cmp = libcdsb_builtin_compare(c0, c1->left, s0->type);
} else if (c0->right == c1->left) { // == rbnode_empty
cmp = libcdsb_builtin_compare(c0, c1->right, s0->type);
if (!cmp) cmp = libcdsb_builtin_compare(c0->left, c1, s0->type);
}
if (cmp) {
stack_flush(&z);
return cmp;
}
} else stack_push_many(&z, 4, c1->right, c0->right, c1->left, c0->left);
} while (!is_null(z.value));
return 0;
}

71
src/set/compute.c Normal file
View File

@ -0,0 +1,71 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "../../include/set.h"
#include "../__internal/rbtree.h"
static inline hash_t libcdsb_builtin_hash(const rbnode_t* s, vtype t) {
return vnode_hash(&s->value, t);
}
/*#####################################################################################################################*/
size_t vset_size(const set_t* x) {
stack_t z;
size_t n;
rbnode_t* c;
stack_init(&z);
stack_push(&z, x->root);
n = 0;
if (!rbnode_is_empty(x->root)) {
while ((c = stack_pop(&z))) {
++n;
if (!rbnode_is_empty(c->right)) stack_push(&z, c->right);
if (!rbnode_is_empty(c->left)) stack_push(&z, c->left);
}
}
return n;
}
hash_t vset_hash(const set_t* s) {
stack_t z;
rbnode_t *c0, *c1;
hash_t hash, v;
if (rbnode_is_empty(s->root))
return 0;
stack_init(&z);
stack_push(&z, s->root->left);
hash = 1;
if (!rbnode_is_empty(c0 = stack_pop(&z))) {
do {
++hash;
if (!rbnode_is_empty(c0->right)) stack_push(&z, c0->right);
if (!rbnode_is_empty(c0->left)) stack_push(&z, c1 = c0->left);
} while (!is_null(c0 = stack_pop(&z)));
}
v = libcdsb_builtin_hash(c1, s->type);
stack_push(&z, s->root->right);
if (!rbnode_is_empty(c0 = stack_pop(&z))) {
do {
++hash;
if (!rbnode_is_empty(c0->right)) stack_push(&z, c1 = c0->right);
if (!rbnode_is_empty(c0->left)) stack_push(&z, c0->left);
} while (!is_null(c0 = stack_pop(&z)));
}
v += libcdsb_builtin_hash(c1, s->type);
return (hash ^ v) + VTYPE_SET;
}

View File

@ -1,115 +0,0 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "../../include/extra/set.h"
#include "../__internal/rbtree.h"
bool libcdsb_vset_insert(set_t* x, const void* v, vtype t) {
int cmp;
rbnode_t* n;
rbnode_t* p;
vnode_t vn;
n = x->root;
vn = vnode_tcreate(x->type, v, t);
t = x->type;
v = vnode_peek(&vn, t);
if (!rbnode_is_empty(n)) {
do {
p = n;
cmp = vtype_compare(v, t, vnode_peek(&n->value, t), t);
if (cmp == 0) {
vnode_free(&vn, t);
return false;
}
n = (cmp < 0) ? n->left : n->right;
} while (!rbnode_is_empty(n));
n = rbnode_create(vn, p, 1);
if (cmp < 0) p->left = n;
else p->right = n;
if (!rbnode_is_root(p))
rbnode_fixup(&x->root, n);
} else n = x->root = rbnode_create(vn, rbnode_empty, 0);
return true;
}
int libcdsb_vset_find(vtype_set* x, const void* v, vtype t, void* _, vset_access_callback callback, bool cut) {
rbnode_t* c;
void *val;
int cmp;
c = x->root;
while (!rbnode_is_empty(c)) {
val = vnode_peek(&c->value, x->type);
cmp = vtype_compare(v, t, val, x->type);
if (cmp == 0) {
cmp = (callback) ? callback(val, x->type, _) : 0;
if (cut) {
c = rbnode_delete(&x->root, c);
vnode_free(&c->value, x->type);
free(c);
}
return cmp;
} else c = (cmp < 0) ? c->left : c->right;
}
return -1;
}
int libcdsb_vset_foreach(set_t* x, void* data, vset_access_callback callback, bool flush) {
stack_t z;
int r;
rbnode_t* c;
stack_init(&z);
stack_push(&z, x->root);
r = 0;
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)))
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;
}

View File

@ -1,47 +0,0 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "../../include/extra/set.h"
#include "../__internal/include.h"
int libcdsb_vset_find_pointer(set_t* x, const void* v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); }
int libcdsb_vset_find_cstring(set_t* x, const char* v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); }
int libcdsb_vset_find_string (set_t* x, const str_t* v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, v, vtypeof( v), _, cb, cut); }
int libcdsb_vset_find_array (set_t* x, const arr_t* v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, v, vtypeof( v), _, cb, cut); }
int libcdsb_vset_find_list (set_t* x, const list_t* v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, v, vtypeof( v), _, cb, cut); }
int libcdsb_vset_find_map (set_t* x, const map_t* v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, v, vtypeof( v), _, cb, cut); }
int libcdsb_vset_find_vset (set_t* x, const set_t* v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, v, vtypeof( v), _, cb, cut); }
int libcdsb_vset_find_dict (set_t* x, const dict_t* v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, v, vtypeof( v), _, cb, cut); }
int libcdsb_vset_find_boolean(set_t* x, bool v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); }
int libcdsb_vset_find_int8 (set_t* x, s8_t v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); }
int libcdsb_vset_find_int16 (set_t* x, s16_t v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); }
int libcdsb_vset_find_int32 (set_t* x, s32_t v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); }
int libcdsb_vset_find_int64 (set_t* x, s64_t v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); }
int libcdsb_vset_find_uint8 (set_t* x, u8_t v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); }
int libcdsb_vset_find_uint16 (set_t* x, u16_t v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); }
int libcdsb_vset_find_uint32 (set_t* x, u32_t v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); }
int libcdsb_vset_find_uint64 (set_t* x, u64_t v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); }
int libcdsb_vset_find_float (set_t* x, fl_t v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); }
int libcdsb_vset_find_double (set_t* x, dbl_t v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); }
int libcdsb_vset_find_ldouble(set_t* x, ldbl_t v, void* _, vset_access_callback cb, bool cut) { return libcdsb_vset_find(x, &v, vtypeof(&v), _, cb, cut); }
bool libcdsb_vset_push_pointer(set_t* x, const void* v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); }
bool libcdsb_vset_push_cstring(set_t* x, const char* v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); }
bool libcdsb_vset_push_string (set_t* x, const str_t* v) { return libcdsb_vset_insert(x, v, vtypeof( v)); }
bool libcdsb_vset_push_array (set_t* x, const arr_t* v) { return libcdsb_vset_insert(x, v, vtypeof( v)); }
bool libcdsb_vset_push_list (set_t* x, const list_t* v) { return libcdsb_vset_insert(x, v, vtypeof( v)); }
bool libcdsb_vset_push_map (set_t* x, const map_t* v) { return libcdsb_vset_insert(x, v, vtypeof( v)); }
bool libcdsb_vset_push_vset (set_t* x, const set_t* v) { return libcdsb_vset_insert(x, v, vtypeof( v)); }
bool libcdsb_vset_push_dict (set_t* x, const dict_t* v) { return libcdsb_vset_insert(x, v, vtypeof( v)); }
bool libcdsb_vset_push_boolean(set_t* x, bool v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); }
bool libcdsb_vset_push_int8 (set_t* x, s8_t v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); }
bool libcdsb_vset_push_int16 (set_t* x, s16_t v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); }
bool libcdsb_vset_push_int32 (set_t* x, s32_t v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); }
bool libcdsb_vset_push_int64 (set_t* x, s64_t v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); }
bool libcdsb_vset_push_uint8 (set_t* x, u8_t v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); }
bool libcdsb_vset_push_uint16 (set_t* x, u16_t v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); }
bool libcdsb_vset_push_uint32 (set_t* x, u32_t v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); }
bool libcdsb_vset_push_uint64 (set_t* x, u64_t v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); }
bool libcdsb_vset_push_float (set_t* x, fl_t v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); }
bool libcdsb_vset_push_double (set_t* x, dbl_t v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); }
bool libcdsb_vset_push_ldouble(set_t* x, ldbl_t v) { return libcdsb_vset_insert(x, &v, vtypeof(&v)); }

39
src/set/memory.c Normal file
View File

@ -0,0 +1,39 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "../../include/set.h"
#include "../__internal/rbtree.h"
void vset_init(set_t* x, vtype t) {
x->root = rbnode_empty;
x->type = t;
}
void vset_free(set_t* x) {
rbnode_t *t, *c;
c = x->root;
while (!rbnode_is_empty(x->root)) {
if (!rbnode_is_empty(c->left)) {
c = c->left;
} else if (!rbnode_is_empty(c->right)) {
c = c->right;
} else if (!rbnode_is_root(c)) {
vnode_free(&c->value, x->type);
t = c;
c = c->parent;
if (t == c->left) c->left = rbnode_empty;
else c->right = rbnode_empty;
free(t);
} else {
vnode_free(&c->value, x->type);
x->root = rbnode_empty;
}
}
x->type = 0;
}

74
src/set/modify.c Normal file
View File

@ -0,0 +1,74 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "../../include/set.h"
#include "../__internal/rbtree.h"
#include "../__internal/assert.h"
bool libcdsb_vset_insert(set_t* x, const void* v, vtype t) {
int cmp;
rbnode_t* n;
rbnode_t* p;
if (!rbnode_is_empty(n = x->root)) {
do {
p = n;
cmp = vtype_compare(v, t, vnode_peek(&n->value, t), t);
if (cmp == 0) return false;
n = (cmp < 0) ? n->left : n->right;
} while (!rbnode_is_empty(n));
n = rbnode_create(nullptr, p, 1);
if (cmp < 0) p->left = n;
else p->right = n;
if (!rbnode_is_root(p))
rbnode_fixup(&x->root, n);
} else n = x->root = rbnode_create(nullptr, rbnode_empty, 0);
n->value = vnode_tcreate(x->type, v, t);
return true;
}
bool libcdsb_vset_attach(set_t* x, const void* v, vtype t) {
int cmp;
rbnode_t* n;
rbnode_t* p;
vnode_t vn;
vnode_tattach(&vn, x->type, v, t);
n = x->root;
t = x->type;
v = vnode_peek(&vn, t);
if (!rbnode_is_empty(n)) {
do {
p = n;
cmp = vtype_compare(v, t, vnode_peek(&n->value, t), t);
if (cmp == 0) {
vnode_free(&vn, t);
return false;
}
n = (cmp < 0) ? n->left : n->right;
} while (!rbnode_is_empty(n));
n = rbnode_create(vn, p, 1);
if (cmp < 0) p->left = n;
else p->right = n;
if (!rbnode_is_root(p))
rbnode_fixup(&x->root, n);
} else n = x->root = rbnode_create(vn, rbnode_empty, 0);
return true;
}

View File

@ -27,6 +27,7 @@ void libcdsb_stack_push(stack_t* x, void* value) {
x->value = value;
}
void libcdsb_stack_push_many(stack_t* x, size_t c, ...) {
va_list args;
@ -52,6 +53,7 @@ void libcdsb_stack_push_many(stack_t* x, size_t c, ...) {
va_end(args);
}
void* libcdsb_stack_pop(stack_t* x) {
stack_t* n;
@ -70,14 +72,50 @@ void* libcdsb_stack_pop(stack_t* x) {
}
void libcdsb_stack_flush(stack_t* stack) {
void libcdsb_stack_reverse(stack_t* x) {
stack_t z, *iter, *n, copy;
if (x->prev) {
z.prev = 0;
z.value = x->value;
iter = x->prev;
while (iter->prev) {
n = iter;
iter = n->prev;
copy.prev = z.prev;
copy.value = z.value;
z.prev = n;
z.value = n->value;
n->prev = copy.prev;
n->value = copy.value;
}
copy.prev = z.prev;
copy.value = z.value;
x->prev = iter;
x->value = iter->value;
iter->prev = copy.prev;
iter->value = copy.value;
}
}
void libcdsb_stack_flush(stack_t* x) {
stack_t* c;
while (stack->prev) {
c = stack->prev;
stack->prev = c->prev;
while (x->prev) {
c = x->prev;
x->prev = c->prev;
free(c);
}
stack->value = 0;
x->value = 0;
}

61
src/string/access.c Normal file
View File

@ -0,0 +1,61 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
char* at_string(const str_t* s, ssize_t i) {
char *e, *p;
size_t n, l;
if (is_null(s->buffer) || !*s->buffer)
return nullptr;
n = strasciilen(s->buffer);
e = s->buffer + n;
if (i > n) {
p = s->buffer + n;
e = p + strlen(p);
do { p = next_char(p); } while (--i && p < e);
return (!i) ? p : nullptr;
} else if (i < 0 && n < (l = strlen(s->buffer))) {
p = s->buffer + l;
do { p = prev_char(p); } while (++i && p >= s->buffer);
return (!i) ? p : nullptr;
} else if (i < 0 && (i += l) < 0) i = 0;
return s->buffer + i;
}
ssize_t libcdsb_string_indexof(const str_t* x, const char* s) {
char *e, *p;
size_t n;
if (is_null(x->buffer) || is_null(s) || !*x->buffer || !*s) {
return 0;
}
if (!is_null(p = strstr(x->buffer, s))) {
n = strasciilen(x->buffer);
e = x->buffer + n;
if (e >= p) return p - x->buffer;
do {
e = next_char(e);
++n;
} while (e < p);
if (e != p) {
/* Trying to find index of inconsistent string part
* It is not make a sense on that abstract level */
} else return n;
}
return -1;
}

View File

@ -1,142 +0,0 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
hash_t string_hash(const str_t* s) {
hash_t hash = 0;
size_t nmemb = string_nmemb(s);
if (nmemb > 0)
hash = s->buffer[0];
if (nmemb > 1)
hash += s->buffer[nmemb-1];
hash ^= nmemb;
return hash + VTYPE_STRING;
}
size_t string_nmemb(const str_t* s) {
return (!is_null(s->buffer)) ? strlen(s->buffer) : 0;
}
size_t string_size(const str_t* s) {
size_t n;
char* p;
if (is_null(s->buffer) || !*s->buffer)
return 0;
n = strasciilen(s->buffer);
p = s->buffer + n;
while (*p) {
p = next_char(p);
++n;
}
return n;
}
void string_init(str_t* x, const char* s) {
size_t n = (!is_null(s)) ? strlen(s) : 0;
if (n) x->buffer = strndup(s, n);
else memset(x, 0, sizeof(*x));
}
void string_free(str_t* x) {
free(x->buffer);
memset(x, 0, sizeof(*x));
}
int string_compare(const str_t* s0, const str_t* s1) {
ssize_t n0, n1;
if (s0 == s1) return 0;
n0 = (!is_null(s0->buffer)) ? strlen(s0->buffer) : 0;
n1 = (!is_null(s1->buffer)) ? strlen(s1->buffer) : 0;
n0 -= n1;
if (n0 || !n1) return n0;
return memcmp(s0->buffer, s1->buffer, n1);
}
/*#####################################################################################################################*/
bool libcdsb_string_concat_cstring(str_t* x, const char* s) {
size_t n;
size_t xn;
if ((n = (!is_null(s)) ? strlen(s) : 0)) {
xn = (!is_null(x->buffer)) ? strlen(x->buffer) : 0;
x->buffer = realloc(x->buffer, xn + ++n);
memcpy(x->buffer + xn, s, n);
return true;
}
return false;
}
bool libcdsb_string_concat_char(str_t* x, int chr) {
size_t xn;
size_t n;
char *e;
char s[5] = {0};
if (!is_null(e = tochar_unicode(s, chr))) {
xn = (!is_null(x->buffer)) ? strlen(x->buffer) : 0;
n = e - s;
x->buffer = realloc(x->buffer, xn + ++n);
memcpy(x->buffer + xn, s, n);
return true;
}
return false;
}
/*#####################################################################################################################*/
str_t string_copy(const str_t* s) {
str_t x = { .buffer = 0 };
size_t n = (!is_null(s->buffer)) ? strlen(s->buffer) : 0;
if (n) x.buffer = strndup(s->buffer, n);
return x;
}
str_t* string_duplicate(const str_t* s) {
str_t* x = calloc(sizeof(*x), 1);
size_t n = (!is_null(s->buffer)) ? strlen(s->buffer) : 0;
if (n) x->buffer = strndup(s->buffer, n);
return x;
}
void string_copy_init(str_t* x, const str_t* s) {
size_t n = (!is_null(s->buffer)) ? strlen(s->buffer) : 0;
if (n) x->buffer = strndup(s->buffer, n);
else memset(x, 0, sizeof(*x));
}

66
src/string/comparison.c Normal file
View File

@ -0,0 +1,66 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include <ctype.h>
#include "include.h"
int string_compare(const str_t* s0, const str_t* s1) {
ssize_t n0, n1;
if (s0 == s1) return 0;
n0 = (!is_null(s0->buffer)) ? strlen(s0->buffer) : 0;
n1 = (!is_null(s1->buffer)) ? strlen(s1->buffer) : 0;
n0 -= n1;
if (n0 || !n1) return n0;
return memcmp(s0->buffer, s1->buffer, n1);
}
int string_case_compare(const str_t* s0, const str_t* s1) {
const char *p0, *p1, *t0, *t1;
ssize_t n0, n1;
u32_t uc0, uc1;
if (s0 == s1) return 0;
p0 = s0->buffer;
p1 = s1->buffer;
n0 = (!is_null(p0)) ? strasciilen(p0) : 0;
n1 = (!is_null(p1)) ? strasciilen(p1) : 0;
n0 -= n1;
if (!n0 && n1) {
do {
n0 = toupper(*(p0++));
n0 -= toupper(*(p1++));
if (n0) return n0;
} while(--n1);
} else return memcmp(s0->buffer, s1->buffer, n1);
while (*p0 && *p1) {
t0 = fromchar_unicode(&uc0, p0);
t1 = fromchar_unicode(&uc1, p1);
if (is_null(t0) || is_null(t1)) {
n0 = (ssize_t)*(unsigned char*)(p0++) - *(unsigned char*)(p1++);
if (n0) return n0;
} else {
n0 = toupper_unicode(uc0);
if ((n0 -= toupper_unicode(uc1)))
return n0;
p0 = t0;
p1 = t1;
}
}
n0 = *(unsigned char*)p0 - *(unsigned char*)p1;
return n0;
}

60
src/string/compute.c Normal file
View File

@ -0,0 +1,60 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
size_t string_size(const str_t* s) {
size_t n;
char* p;
if (is_null(s->buffer) || !*s->buffer)
return 0;
n = strasciilen(s->buffer);
p = s->buffer + n;
while (*p) {
p = next_char(p);
++n;
}
return n;
}
hash_t string_hash(const str_t* s) {
hash_t hash = 0;
size_t nmemb = string_nmemb(s);
if (nmemb > 0)
hash = s->buffer[0];
if (nmemb > 1)
hash += s->buffer[nmemb-1];
hash ^= nmemb;
return hash + VTYPE_STRING;
}
size_t libcdsb_string_count(const str_t* x, const char* s, size_t sn) {
char* p;
size_t c;
if (is_null(x->buffer) || is_null(s) || !*x->buffer || !*s) {
return 0;
}
if (!sn) sn = strlen(s);
p = x->buffer;
c = 0;
while (!is_null(p = strstr(p, s))) {
p += sn;
++c;
}
return c;
}

78
src/string/copy.c Normal file
View File

@ -0,0 +1,78 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
size_t string_slice(str_t* x, str_t* s, ssize_t i, size_t c, bool cut) {
char *e, *p, *v;
size_t n = 0;
memset(x, 0, sizeof(*x));
if (!c) return n;
p = at_string(s, i);
if (is_null(p))
return n;
e = p + strlen(p);
v = p;
while (c-- && v < e) {
v = next_char(v);
++n;
}
x->buffer = strndup(p, v - p);
if (cut) {
memmove(p, v, strlen(v) + 1);
}
return n;
}
arr_t libcdsb_string_split(const str_t* x, const char* s, size_t sn, size_t maxn) {
arr_t ret;
char *p, *e;
str_t* v;
ret.mem = 0;
ret.size = 0;
ret.type = VTYPE_STRING;
if (is_null(x->buffer))
return ret;
if (is_null(s) || !*s) {
v = ret.mem = malloc(sizeof(str_t));
v->buffer = strdup(x->buffer);
return ret;
}
if (!sn) sn = strlen(s);
p = x->buffer;
e = p;
while (maxn-- && !is_null(p = strstr(p, s))) {
p += sn;
v = ret.mem = realloc(ret.mem, ++ret.size * sizeof(str_t));
v[ret.size-1].buffer = strndup(e, p - e);
p += sn;
e = p;
}
if (*e) {
sn = strlen(e);
v = ret.mem = realloc(ret.mem, ++ret.size*sizeof(str_t));
v[ret.size-1].buffer = strndup(e, sn);
}
return ret;
}

View File

@ -1,142 +0,0 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
/*#####################################################################################################################*/
static char* string_info(const vtype_string* s, size_t* size, size_t* nmemb) {
char* p;
char* v;
if (is_null(s->buffer) || !*s->buffer) {
*size = *nmemb = 0;
return s->buffer;
}
*size = *nmemb = strasciilen(s->buffer);
p = s->buffer + *nmemb;
if (!*p) return p;
while (*(v = next_char(p))) {
++*size;
*nmemb += v - p;
p = v;
}
++*size;
*nmemb += v - p;
return p;
}
static int fetch_pad(char buffer[4], int chr) {
char* p;
if (chr) {
p = tochar_unicode(buffer, chr);
chr = !is_null(p) ? p - buffer : 0;
}
if (!chr) {
*buffer = ' ';
chr = 1;
}
return chr;
}
/*#####################################################################################################################*/
size_t string_align_center(vtype_string* x, size_t n, int pc) {
char s[4];
size_t l;
size_t ls;
size_t rs;
char* p;
string_info(x, &ls, &l);
if (ls < n) {
pc = fetch_pad(s, pc);
ls = n - ls;
rs = ls / 2;
} else return ls;
x->buffer = p = realloc(x->buffer, l + ls*pc + 1);
memmove(x->buffer + (ls -= rs)*pc, x->buffer, l);
for (size_t i = 0; i < ls; ++i) {
p = memcpy(p, s, pc) + pc;
}
p += l;
for (size_t i = 0; i < rs; ++i) {
p = memcpy(p, s, pc) + pc;
}
*p = 0;
return n;
}
size_t string_align_right(vtype_string* x, size_t n, int pc) {
char s[4];
size_t l;
size_t ls;
char* p;
string_info(x, &ls, &l);
if (ls < n) {
pc = fetch_pad(s, pc);
ls = n - ls;
} else return ls;
x->buffer = p = realloc(x->buffer, ++l + ls*pc);
memmove(x->buffer + ls*pc, x->buffer, l);
for (size_t i = 0; i < ls; ++i) {
p = memcpy(p, s, pc) + pc;
}
return n;
}
size_t string_align_left(vtype_string* x, size_t n, int pc) {
char s[4];
size_t l;
size_t rs;
char* p;
string_info(x, &rs, &l);
if (rs < n) {
pc = fetch_pad(s, pc);
rs = n - rs;
} else return rs;
x->buffer = realloc(x->buffer, l + rs*pc + 1);
p = x->buffer + l;
for (size_t i = 0; i < rs; ++i) {
p = memcpy(p, s, pc) + pc;
}
*p = 0;
return n;
}

View File

@ -1,89 +0,0 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
arr_t libcdsb_string_split_cstring(const str_t* s, const char* a, size_t maxn) {
arr_t x = { .mem = 0, .size = 0, .type = VTYPE_STRING };
size_t n;
char* p;
char* e;
str_t* v;
if (is_null(s->buffer)) {
return x;
}
if (is_null(a) || !*a) {
v = x.mem = malloc(sizeof(str_t));
v->buffer = strdup(s->buffer);
return x;
}
n = strlen(a);
p = s->buffer;
e = p;
while (maxn-- && !is_null(p = strstr(p, a))) {
p += n;
v = x.mem = realloc(x.mem, ++x.size*sizeof(str_t));
v[x.size-1].buffer = strndup(e, p - e);
p += n;
e = p;
}
if (*e) {
n = strlen(e);
v = x.mem = realloc(x.mem, ++x.size*sizeof(str_t));
v[x.size-1].buffer = strndup(e, n);
}
return x;
}
arr_t libcdsb_string_split_char(const str_t* s, int ac, size_t maxn) {
arr_t x = { .mem = 0, .size = 0, .type = VTYPE_STRING };
char a[5] = { 0 };
size_t n;
char* p;
char* e;
str_t* v;
if (is_null(s->buffer)) {
return x;
}
if (is_null(p = tochar_unicode(a, ac)) || !(n = p - a)) {
v = x.mem = malloc(sizeof(str_t));
v->buffer = strdup(s->buffer);
return x;
}
p = s->buffer;
e = p;
while (maxn-- && !is_null(p = strstr(p, a))) {
p += n;
v = x.mem = realloc(x.mem, ++x.size*sizeof(str_t));
v[x.size-1].buffer = strndup(e, p - e);
p += n;
e = p;
}
if (*e) {
n = strlen(e);
v = x.mem = realloc(x.mem, ++x.size*sizeof(str_t));
v[x.size-1].buffer = strndup(e, n);
}
return x;
}

View File

@ -1,174 +0,0 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
char* string_at(const str_t* s, ssize_t i) {
char *e, *p;
size_t n, l;
if (is_null(s->buffer) || !*s->buffer)
return nullptr;
n = strasciilen(s->buffer);
e = s->buffer + n;
if (i > n) {
p = s->buffer + n;
e = p + strlen(p);
do { p = next_char(p); } while (--i && p < e);
return (!i) ? p : nullptr;
} else if (i < 0 && n < (l = strlen(s->buffer))) {
p = s->buffer + l;
do { p = prev_char(p); } while (++i && p >= s->buffer);
return (!i) ? p : nullptr;
} else if (i < 0 && (i += l) < 0) i = 0;
return s->buffer + i;
}
size_t string_slice(str_t* x, str_t* s, ssize_t i, size_t c, bool cut) {
char *e, *p, *v;
size_t n = 0;
memset(x, 0, sizeof(*x));
if (!c) return n;
p = string_at(s, i);
if (is_null(p))
return n;
e = p + strlen(p);
v = p;
while (c-- && v < e) {
v = next_char(v);
++n;
}
x->buffer = strndup(p, v - p);
if (cut) {
memmove(p, v, strlen(v) + 1);
}
return n;
}
/*#####################################################################################################################*/
ssize_t libcdsb_string_indexof_cstring(const str_t* s, const char* a) {
char *e, *p;
size_t n;
if (is_null(s->buffer) || is_null(a) || !*s->buffer || !*a) {
return 0;
}
if (!is_null(p = strstr(s->buffer, a))) {
n = strasciilen(s->buffer);
e = s->buffer + n;
if (e >= p) return p - s->buffer;
do {
e = next_char(e);
++n;
} while (e < p);
if (e != p) {
/* Trying to find index of inconsistent string part
* It is not make a sense on that abstract level */
} else return n;
}
return -1;
}
ssize_t libcdsb_string_indexof_char(const str_t* s, int ac) {
size_t n;
char* e;
char a[5] = { 0 };
char* p = tochar_unicode(a, ac);
if (is_null(s->buffer) || !*s->buffer || is_null(p)) {
return 0;
}
if (!is_null(p = strstr(s->buffer, a))) {
n = strasciilen(s->buffer);
e = s->buffer + n;
if (e >= p) return p - s->buffer;
do {
e = next_char(e);
++n;
} while (e < p);
if (e != p) {
/* Trying to find index of inconsistent string part
* It is not make a sense on that abstract level */
} else return n;
}
return -1;
}
/*#####################################################################################################################*/
size_t libcdsb_string_count_cstring(const str_t* s, const char* a) {
char* p;
size_t n, c;
if (is_null(s->buffer) || is_null(a) || !*s->buffer || !*a) {
return 0;
}
n = strlen(a);
p = s->buffer;
c = 0;
while (!is_null(p = strstr(p, a))) {
p += n;
++c;
}
return c;
}
size_t libcdsb_string_count_char(const str_t* s, int ac) {
size_t n, c;
char a[5] = {0};
char* p = tochar_unicode(a, ac);
if (is_null(s->buffer) || !*s->buffer || is_null(p)) {
return 0;
}
n = p - a;
p = s->buffer;
c = 0;
while (!is_null(p = strstr(p, a))) {
p += n;
++c;
}
return c;
}

View File

@ -2,20 +2,20 @@
/* Copyright © 2022 Gregory Lirent */
#include "../../modules/libunic/include.h"
#include "../../include/extra/string.h"
#include "../../include/string.h"
#include "../__internal/include.h"
#ifndef LIBCDSB_SRC_STRING_INCLUDE_H
#define LIBCDSB_SRC_STRING_INCLUDE_H
ainline(char* next_char(char* s)) {
ainline(char* libcdsb_builtin_next_char(char* s)) {
int cs = charsize(s);
if (cs) return s + cs;
return ++s;
}
ainline(char* prev_char(char* s)) {
ainline(char* libcdsb_builtin_prev_char(char* s)) {
if (*(--s)&0x80) {
char* p = s;
@ -29,4 +29,7 @@ ainline(char* prev_char(char* s)) {
return s;
}
#define next_char libcdsb_builtin_next_char
#define prev_char libcdsb_builtin_prev_char
#endif /* LIBCDSB_SRC_STRING_INCLUDE_H */

275
src/string/modify.c Normal file
View File

@ -0,0 +1,275 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
static void string_trim_spaces(str_t* x, int direction) {
static size_t m[32/(sizeof(size_t))] = {0};
u8_t* l;
u8_t* r;
if (sizeof(size_t) == 8) {
m[0] = 0x0000000100002e00UL;
} else {
m[0] = 0x00002e00UL;
m[1] = 0x00000001UL;
}
if (is_null(x->buffer))
return;
l = (void*)x->buffer;
r = (void*)x->buffer + strlen(x->buffer);
if (direction <= 0) {
while (m[*l/(8*sizeof(size_t))]&((size_t)1<<(*l%(8*sizeof(size_t))))) {
++l;
}
}
if (direction >= 0) {
do {
--r;
} while (m[*r/(8*sizeof(size_t))]&((size_t)1<<(*r%(8*sizeof(size_t)))));
++r;
}
if (x->buffer != (char*)l) {
memmove(x->buffer, l, r-l);
r -= (char*)l - x->buffer;
}
*r = 0;
}
static char* string_info(const str_t* s, size_t* size, size_t* nmemb) {
char* p;
char* v;
if (is_null(s->buffer) || !*s->buffer) {
*size = *nmemb = 0;
return s->buffer;
}
*size = *nmemb = strasciilen(s->buffer);
p = s->buffer + *nmemb;
if (!*p) return p;
while (*(v = next_char(p))) {
++*size;
*nmemb += v - p;
p = v;
}
++*size;
*nmemb += v - p;
return p;
}
static int fetch_pad(char buffer[4], int chr) {
char* p;
if (chr) {
p = tochar_unicode(buffer, chr);
chr = !is_null(p) ? p - buffer : 0;
}
if (!chr) {
*buffer = ' ';
chr = 1;
}
return chr;
}
/*#####################################################################################################################*/
bool libcdsb_string_concat(str_t* x, const char* s, size_t n) {
size_t xn;
if (n || (n = !is_null(s) ? strlen(s) : 0)) {
xn = (!is_null(x->buffer)) ? strlen(x->buffer) : 0;
x->buffer = realloc(x->buffer, xn + ++n);
memcpy(x->buffer + xn, s, n);
return true;
}
return false;
}
void libcdsb_string_trim(str_t* x, const char* s, int direction) {
u8_t* l;
u8_t* r;
size_t n;
bool f;
struct {
const char* p;
size_t n;
}* m;
if (is_null(s)) {
string_trim_spaces(x, direction);
return;
}
if (is_null(x->buffer) || !*s)
return;
if (x->buffer == s) {
*x->buffer = 0;
return;
}
n = 0;
m = 0;
while (*(l = (void*)next_char((void*)s))) {
m = realloc(m, ++n*sizeof(*m));
m[n-1].n = (char*)l - s;
m[n-1].p = s;
s = (void*)l;
}
m = realloc(m, ++n*sizeof(*m));
m[n-1].n = (char*)l - s;
m[n-1].p = s;
l = (void*)x->buffer;
r = (void*)x->buffer + strlen(x->buffer);
if (direction <= 0) {
f = false;
do for (size_t i = 0; i < n; ++i) {
if (memcmp(l, m[i].p, m[i].n) == 0) {
f = true;
l += m[i].n;
break;
}
} while(f && !(f = false));
}
if (direction >= 0) {
f = false;
do for (size_t i = 0; i < n; ++i) {
if (memcmp(r - m[i].n, m[i].p, m[i].n) == 0) {
f = true;
r -= m[i].n;
break;
}
} while(f && !(f = false));
}
if (x->buffer != (char*)l) {
memmove(x->buffer, l, r-l);
r -= (char*)l - x->buffer;
}
*r = 0;
}
size_t libcdsb_string_align(str_t* x, size_t n, int pc, int direction) {
char *p, s[4];
size_t l, ls, rs;
string_info(x, &ls, &l);
if (ls < n) {
pc = fetch_pad(s, pc);
if (direction == 0) {
ls = n - ls;
rs = ls / 2;
ls -= rs;
} else if (direction < 0) {
rs = n - ls;
ls = 0;
} else {
ls = n - ls;
rs = 0;
}
} else return ls;
x->buffer = p = realloc(x->buffer, l + ((ls + rs) * pc) + 1);
if (ls) {
memmove(x->buffer + ls * pc, x->buffer, l);
do {
p = memcpy(p, s, pc) + pc;
} while (--ls);
p += l;
} else p = x->buffer + l;
while (rs--) p = memcpy(p, s, pc) + pc;
*p = 0;
return n;
}
size_t libcdsb_string_replace(str_t* x, const char* s, size_t sn, const char* d, size_t dn, size_t m) {
char *sc, *dc;
char *p;
size_t c, n, o;
if (is_null(x->buffer) || is_null(s) || !*x->buffer || !*(char*)s)
return 0;
if (s == d) return string_count(x, s);
if (!sn) sn = strlen(s);
if (!dn) dn = !is_null(d) ? strlen(d) : dn;
n = strlen(x->buffer);
p = x->buffer;
sc = dc = (void*)(c = 0);
if (x->buffer == s) {
x->buffer = realloc(x->buffer, dn + 1);
memcpy(x->buffer, d, dn);
x->buffer[dn] = 0;
return 1;
}
if (x->buffer < (char*)s && (char*)s < x->buffer + n) s = sc = memndup(s, sn);
if (x->buffer <= (char*)d && (char*)d < x->buffer + n) d = dc = memndup(d, dn);
while (m-- && !is_null(p = strstr(p, s))) {
if (sn != dn) {
size_t l = n;
if (sn < dn) {
n += dn - sn;
o = p - x->buffer;
x->buffer = realloc(x->buffer, n + 1);
p = x->buffer + o;
} else n -= sn - dn;
memmove(p + dn, p + sn, l - (p + n - x->buffer) + 1);
}
p += sn;
++c;
}
free(sc);
free(dc);
return c;
}

View File

@ -1,223 +0,0 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
size_t libcdsb_string_replace_cstring_cstring(str_t* x, const char* a, const char* d, size_t maxn) {
char *p, *t, *r;
size_t c, n, an, dn;
if (a == d) return string_count(x, a);
if (is_null(x->buffer) || is_null(a) || !*x->buffer || !*a) {
return 0;
}
an = strlen(a);
dn = (!is_null(d)) ? strlen(d) : 0;
n = strlen(x->buffer);
p = x->buffer;
c = 0;
t = 0;
r = 0;
if (x->buffer == a) {
x->buffer = realloc(x->buffer, dn + 1);
memcpy(x->buffer, d, dn);
x->buffer[dn] = 0;
return 1;
}
if (x->buffer < a && a < x->buffer + n) {
a = r = memndup(a, an);
}
if (x->buffer <= d && d < x->buffer + n) {
d = t = memndup(d, dn);
}
while (maxn-- && !is_null(p = strstr(p, a))) {
libcdsb_string_replace(x, p, an, d, dn);
p += an;
++c;
}
free(r);
free(t);
return c;
}
size_t libcdsb_string_replace_cstring_char(str_t* x, const char* a, int dc, size_t maxn) {
char *p, *t;
char d[4];
size_t c, n, an, dn;
if (is_null(x->buffer) || is_null(a) || !*x->buffer || !*a) {
return 0;
}
an = strlen(a);
p = tochar_unicode(d, dc);
dn = (!is_null(p)) ? p - d : 0;
n = strlen(x->buffer);
p = x->buffer;
c = 0;
t = 0;
if (x->buffer == a) {
x->buffer = realloc(x->buffer, dn + 1);
memcpy(x->buffer, d, dn);
x->buffer[dn] = 0;
return 1;
} else if (x->buffer < a && a < x->buffer + n) {
a = t = memndup(a, an);
}
while (maxn-- && !is_null(p = strstr(p, a))) {
libcdsb_string_replace(x, p, an, d, dn);
p += an;
++c;
}
free(t);
return c;
}
size_t libcdsb_string_replace_char_cstring(str_t* x, int ac, const char* d, size_t maxn) {
char *p, *t;
char a[4];
size_t c, n, an, dn;
p = tochar_unicode(a, ac);
if (is_null(x->buffer) || is_null(p) || !*x->buffer || !*p) {
return 0;
}
an = p - a;
dn = (!is_null(d)) ? strlen(d) : 0;
n = strlen(x->buffer);
p = x->buffer;
c = 0;
t = 0;
if (x->buffer <= d && d < x->buffer + n) {
d = t = memndup(d, dn);
}
while (maxn-- && !is_null(p = strstr(p, a))) {
libcdsb_string_replace(x, p, an, d, dn);
p += an;
++c;
}
free(t);
return c;
}
size_t libcdsb_string_replace_char_char(str_t* x, int ac, int dc, size_t maxn) {
char* p;
char a[4];
char d[4];
size_t c, an, dn;
p = tochar_unicode(a, ac);
if (is_null(x->buffer) || is_null(p) || !*x->buffer || !*p) {
return 0;
}
an = p - a;
p = tochar_unicode(d, dc);
dn = (!is_null(p)) ? p - d : 0;
p = x->buffer;
c = 0;
while (maxn-- && !is_null(p = strstr(p, a))) {
libcdsb_string_replace(x, p, an, d, dn);
p += an;
++c;
}
return c;
}
size_t libcdsb_string_replace_r_cstring_cstring(str_t* x, const char*restrict a, const char*restrict d, size_t maxn) {
char *restrict p;
size_t c, an, dn;
if (is_null(x->buffer) || is_null(a) || !*x->buffer || !*a) {
return 0;
}
an = strlen(a);
dn = (!is_null(d)) ? strlen(d) : 0;
p = x->buffer;
c = 0;
while (maxn-- && !is_null(p = strstr(p, a))) {
libcdsb_string_replace(x, p, an, d, dn);
p += an;
++c;
}
return c;
}
size_t libcdsb_string_replace_r_cstring_char(str_t* x, const char*restrict a, int dc, size_t maxn) {
char *restrict p;
char d[4];
size_t c, an, dn;
if (is_null(x->buffer) || is_null(a) || !*x->buffer || !*a) {
return 0;
}
an = strlen(a);
p = tochar_unicode(d, dc);
dn = (!is_null(p)) ? p - d : 0;
p = x->buffer;
c = 0;
while (maxn-- && !is_null(p = strstr(p, a))) {
libcdsb_string_replace(x, p, an, d, dn);
p += an;
++c;
}
return c;
}
size_t libcdsb_string_replace_r_char_cstring(str_t* x, int ac, const char*restrict d, size_t maxn) {
char *restrict p;
char a[4];
size_t c, an, dn;
p = tochar_unicode(a, ac);
if (is_null(x->buffer) || is_null(p) || !*x->buffer || !*p) {
return 0;
}
an = p - a;
dn = (!is_null(d)) ? strlen(d) : 0;
p = x->buffer;
c = 0;
while (maxn-- && !is_null(p = strstr(p, a))) {
libcdsb_string_replace(x, p, an, d, dn);
p += an;
++c;
}
return c;
}

View File

@ -1,60 +1,59 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include <ctype.h>
#include "include.h"
int string_compare_case_insensitive(const str_t* s0, const str_t* s1) {
const char *p0, *p1, *t0, *t1;
ssize_t n0, n1;
u32_t uc0, uc1;
static void libcdsb_builtin_replace(str_t* x, char* p, size_t n, const char* v, size_t vn) {
if (n != vn) {
size_t l = strlen(x->buffer);
if (s0 == s1) return 0;
if (n < vn) {
char* t = x->buffer;
p0 = s0->buffer;
p1 = s1->buffer;
n0 = (!is_null(p0)) ? strasciilen(p0) : 0;
n1 = (!is_null(p1)) ? strasciilen(p1) : 0;
n0 -= n1;
if (!n0 && n1) {
do {
n0 = toupper(*(p0++));
n0 -= toupper(*(p1++));
if (n0) return n0;
} while(--n1);
} else return memcmp(s0->buffer, s1->buffer, n1);
while (*p0 && *p1) {
t0 = fromchar_unicode(&uc0, p0);
t1 = fromchar_unicode(&uc1, p1);
if (is_null(t0) || is_null(t1)) {
n0 = (ssize_t)*(unsigned char*)(p0++) - *(unsigned char*)(p1++);
if (n0) return n0;
} else {
n0 = toupper_unicode(uc0);
if ((n0 -= toupper_unicode(uc1)))
return n0;
p0 = t0;
p1 = t1;
}
x->buffer = realloc(x->buffer, l + (vn - n) + 1);
p = x->buffer + (p - t);
}
n0 = *(unsigned char*)p0 - *(unsigned char*)p1;
memmove(p+vn, p+n, l - (p+n - x->buffer) + 1);
}
return n0;
memcpy(p, v, vn);
}
/*#####################################################################################################################*/
size_t string_reverse(str_t* x) {
char *t, *p, *v;
size_t n;
if (is_null(x->buffer) || !*x->buffer)
return 0;
n = strlen(x->buffer);
t = malloc(n + 1);
p = t + n;
v = x->buffer;
n = 0;
while (p > t) {
int cs = charsize(v);
if (cs > 1) {
p = memcpy(p - cs, v, cs);
v += cs;
} else *(--p) = *(v++);
++n;
}
free(x->buffer);
x->buffer = t;
return n;
}
size_t string_to_lower(str_t* x) {
char ps[4];
char *es, *p, *e;
u32_t uc0, uc1;
@ -76,7 +75,7 @@ size_t string_to_lower(str_t* x) {
es = tochar_unicode(ps, uc1);
if (!is_null(es)) {
libcdsb_string_replace(x, p, e-p, ps, es-ps);
libcdsb_builtin_replace(x, p, e-p, ps, es-ps);
++n;
}
}
@ -112,7 +111,7 @@ size_t string_to_upper(str_t* x) {
es = tochar_unicode(ps, uc1);
if (!is_null(es)) {
libcdsb_string_replace(x, p, e-p, ps, es-ps);
libcdsb_builtin_replace(x, p, e-p, ps, es-ps);
++n;
}
}
@ -146,7 +145,7 @@ size_t string_capitalize(str_t* x) {
es = tochar_unicode(ps, uc1);
if (!is_null(es)) {
libcdsb_string_replace(x, p, e-p, ps, es-ps);
libcdsb_builtin_replace(x, p, e-p, ps, es-ps);
++n;
}
}
@ -164,7 +163,7 @@ size_t string_capitalize(str_t* x) {
es = tochar_unicode(ps, uc1);
if (!is_null(es)) {
libcdsb_string_replace(x, p, e-p, ps, es-ps);
libcdsb_builtin_replace(x, p, e-p, ps, es-ps);
++n;
}
}
@ -175,56 +174,3 @@ size_t string_capitalize(str_t* x) {
return n;
}
/*#####################################################################################################################*/
size_t string_reverse(str_t* x) {
char *t, *p, *v;
size_t n;
if (is_null(x->buffer) || !*x->buffer)
return 0;
n = strlen(x->buffer);
t = malloc(n + 1);
p = t + n;
v = x->buffer;
n = 0;
while (p > t) {
int cs = charsize(v);
if (cs > 1) {
p = memcpy(p - cs, v, cs);
v += cs;
} else *(--p) = *(v++);
++n;
}
free(x->buffer);
x->buffer = t;
return n;
}
/*#####################################################################################################################*/
void libcdsb_string_replace(str_t* x, char* p, size_t n, const char* v, size_t vn) {
if (n != vn) {
size_t l = strlen(x->buffer);
if (n < vn) {
char* t = x->buffer;
x->buffer = realloc(x->buffer, l + (vn - n) + 1);
p = x->buffer + (p - t);
}
memmove(p+vn, p+n, l - (p+n - x->buffer) + 1);
}
memcpy(p, v, vn);
}

View File

@ -1,160 +0,0 @@
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "include.h"
/*#####################################################################################################################*/
void libcdsb_string_trim_spaces(str_t* x, int direction) {
static size_t m[32/(sizeof(size_t))] = {0};
u8_t* l;
u8_t* r;
if (sizeof(size_t) == 8) {
m[0] = 0x0000000100002e00UL;
} else {
m[0] = 0x00002e00UL;
m[1] = 0x00000001UL;
}
if (is_null(x->buffer))
return;
l = (void*)x->buffer;
r = (void*)x->buffer + strlen(x->buffer);
if (direction <= 0) {
while (m[*l/(8*sizeof(size_t))]&((size_t)1<<(*l%(8*sizeof(size_t))))) {
++l;
}
}
if (direction >= 0) {
do {
--r;
} while (m[*r/(8*sizeof(size_t))]&((size_t)1<<(*r%(8*sizeof(size_t)))));
++r;
}
if (x->buffer != (char*)l) {
memmove(x->buffer, l, r-l);
r -= (char*)l - x->buffer;
}
*r = 0;
}
/*#####################################################################################################################*/
void libcdsb_string_trim_cstring(str_t* x, const char* s, int direction) {
u8_t* l;
u8_t* r;
size_t n;
bool f;
struct {
const char* p;
size_t n;
}* m;
if (is_null(s))
return libcdsb_string_trim_spaces(x, direction);
if (is_null(x->buffer) || !*s)
return;
if (x->buffer == s) {
*x->buffer = 0;
return;
}
n = 0;
m = 0;
while (*(l = (void*)next_char((void*)s))) {
m = realloc(m, ++n*sizeof(*m));
m[n-1].n = (char*)l - s;
m[n-1].p = s;
s = (void*)l;
}
m = realloc(m, ++n*sizeof(*m));
m[n-1].n = (char*)l - s;
m[n-1].p = s;
l = (void*)x->buffer;
r = (void*)x->buffer + strlen(x->buffer);
if (direction <= 0) {
f = false;
do for (size_t i = 0; i < n; ++i) {
if (memcmp(l, m[i].p, m[i].n) == 0) {
f = true;
l += m[i].n;
break;
}
} while(f && !(f = false));
}
if (direction >= 0) {
f = false;
do for (size_t i = 0; i < n; ++i) {
if (memcmp(r - m[i].n, m[i].p, m[i].n) == 0) {
f = true;
r -= m[i].n;
break;
}
} while(f && !(f = false));
}
if (x->buffer != (char*)l) {
memmove(x->buffer, l, r-l);
r -= (char*)l - x->buffer;
}
*r = 0;
}
void libcdsb_string_trim_char(str_t* x, int sc, int direction) {
u8_t* l;
u8_t* r;
char p[4];
size_t n;
if (!sc)
return libcdsb_string_trim_spaces(x, direction);
if (is_null(x->buffer) || is_null(l = (void*)tochar_unicode(p, sc)))
return;
n = (char*)l - p;
l = (void*)x->buffer;
r = (void*)x->buffer + strlen(x->buffer);
if (direction <= 0) {
while (memcmp(l, p, n) == 0) {
l += n;
}
}
if (direction >= 0) {
while (memcmp(r-n, p, n) == 0) {
r -= n;
}
}
if (x->buffer != (char*)l) {
memmove(x->buffer, l, r-l);
r -= (char*)l - x->buffer;
}
*r = 0;
}

View File

@ -4,8 +4,6 @@
#include <stdio.h>
#include "__internal/include.h"
/*#####################################################################################################################*/
#define sh__(a) #a
#define s__(a) sh__(a)
@ -19,14 +17,14 @@
double: "%."s__(DBL_DIG)"lg",\
long double: "%."s__(LDBL_DIG)"Lg")
#define stringify(v) sprintf(STRINGIFY_BUFFER, fstring(v), (v))
#define stringify(v) sprintf(LIBCDSB_BUILTIN_BUFFER[LIBCDSB_BUILTIN_COUNTER], fstring(v), (v))
static _Thread_local char STRINGIFY_BUFFER[64];
static _Thread_local int LIBCDSB_BUILTIN_COUNTER = 0;
static _Thread_local char LIBCDSB_BUILTIN_BUFFER[16][64];
/*#####################################################################################################################*/
const size_t LIBCDSB_VTYPE_SIZES[19] = {
const size_t LIBCDSB_BUILTIN_VTYPE_SIZES[19] = {
sizeof(void*), sizeof(bool),
sizeof(u8_t), sizeof(u16_t), sizeof(u32_t), sizeof(u64_t),
sizeof(s8_t), sizeof(s16_t), sizeof(s32_t), sizeof(s64_t),
@ -36,11 +34,11 @@ const size_t LIBCDSB_VTYPE_SIZES[19] = {
};
/*#####################################################################################################################*/
const char* libcdsb_vtype_name(vtype t) {
switch (t) { default: abort();
switch (t) {
#ifndef NDEBUG
default: abort();
#endif
case VTYPE_POINTER: return "VTYPE_POINTER";
case VTYPE_BOOLEAN: return "VTYPE_BOOLEAN";
case VTYPE_UINT8: return "VTYPE_UINT8";
@ -69,6 +67,9 @@ const char* libcdsb_vtype_stringify(const void* v, vtype t) {
if (t == VTYPE_BOOLEAN) return (*(vtype_bool*)v) ? "true" : "false";
if (t == VTYPE_STRING) return *(char**)v;
if (LIBCDSB_BUILTIN_COUNTER > 15)
LIBCDSB_BUILTIN_COUNTER = 0;
switch (t) {
case VTYPE_INT8: stringify(*( s8_t*)v); break;
case VTYPE_INT16: stringify(*( s16_t*)v); break;
@ -79,25 +80,25 @@ const char* libcdsb_vtype_stringify(const void* v, vtype t) {
case VTYPE_UINT32: stringify(*( u32_t*)v); break;
case VTYPE_UINT64: stringify(*( u64_t*)v); break;
case VTYPE_FLOAT: if (abs(*(fl_t*)v) <= FLT_EPSILON) {
STRINGIFY_BUFFER[0] = 0x30;
STRINGIFY_BUFFER[1] = 0x00;
LIBCDSB_BUILTIN_BUFFER[LIBCDSB_BUILTIN_COUNTER][0] = 0x30;
LIBCDSB_BUILTIN_BUFFER[LIBCDSB_BUILTIN_COUNTER][1] = 0x00;
} else stringify(*(fl_t*)v);
break;
case VTYPE_DOUBLE: if (abs(*(dbl_t*)v) <= DBL_EPSILON) {
STRINGIFY_BUFFER[0] = 0x30;
STRINGIFY_BUFFER[1] = 0x00;
LIBCDSB_BUILTIN_BUFFER[LIBCDSB_BUILTIN_COUNTER][0] = 0x30;
LIBCDSB_BUILTIN_BUFFER[LIBCDSB_BUILTIN_COUNTER][1] = 0x00;
} else stringify(*(dbl_t*)v);
break;
case VTYPE_LDOUBLE: if (abs(*(ldbl_t*)v) <= LDBL_EPSILON) {
STRINGIFY_BUFFER[0] = 0x30;
STRINGIFY_BUFFER[1] = 0x00;
LIBCDSB_BUILTIN_BUFFER[LIBCDSB_BUILTIN_COUNTER][0] = 0x30;
LIBCDSB_BUILTIN_BUFFER[LIBCDSB_BUILTIN_COUNTER][1] = 0x00;
} else stringify(*(ldbl_t*)v);
break;
case VTYPE_POINTER: sprintf(STRINGIFY_BUFFER, (sizeof(void*) == 8) ? "0x%016lx" : "0x%08x", (uintptr_t)*(void**)v); break;
case VTYPE_POINTER: sprintf(LIBCDSB_BUILTIN_BUFFER[LIBCDSB_BUILTIN_COUNTER], (sizeof(void*) == 8) ? "0x%016lx" : "0x%08x", (uintptr_t)*(void**)v); break;
default: sprintf(STRINGIFY_BUFFER, "<%s>", libcdsb_vtype_name(t));
default: sprintf(LIBCDSB_BUILTIN_BUFFER[LIBCDSB_BUILTIN_COUNTER], "<%s>", libcdsb_vtype_name(t));
break;
}
return STRINGIFY_BUFFER;
return LIBCDSB_BUILTIN_BUFFER[LIBCDSB_BUILTIN_COUNTER++];
}

View File

@ -5,7 +5,7 @@
#include "__internal/vnode.h"
#include "../include/string.h"
static vtype internal_round(u64_t* x, ldbl_t v) {
static vtype libcdsb_builtin_round(u64_t* x, ldbl_t v) {
if (v > 0) {
*x = (u64_t)(v + 0.5);
return VTYPE_UINT64;
@ -15,18 +15,16 @@ static vtype internal_round(u64_t* x, ldbl_t v) {
}
}
/*#####################################################################################################################*/
static vnode_t create_value(vtype xt, const void* v, vtype t) {
static vnode_t libcdsb_builtin_create_value(vtype xt, const void* v, vtype t) {
var_t _;
if (t == VTYPE_FLOAT) {
t = internal_round(&_.u64, *(fl_t*)v);
t = libcdsb_builtin_round(&_.u64, *(fl_t*)v);
} else if (t == VTYPE_DOUBLE) {
t = internal_round(&_.u64, *(dbl_t*)v);
t = libcdsb_builtin_round(&_.u64, *(dbl_t*)v);
} else if (t == VTYPE_LDOUBLE) {
t = internal_round(&_.u64, *(ldbl_t*)v);
t = libcdsb_builtin_round(&_.u64, *(ldbl_t*)v);
}
if (sizeof(void*) == 8) {
@ -85,7 +83,7 @@ static vnode_t create_value(vtype xt, const void* v, vtype t) {
}
static vnode_t create_float(vtype xt, const void* v, vtype t) {
static vnode_t libcdsb_builtin_create_float(vtype xt, const void* v, vtype t) {
var_t _;
if (t == VTYPE_UINT8 || t == VTYPE_BOOLEAN ) {
@ -131,11 +129,9 @@ static vnode_t create_float(vtype xt, const void* v, vtype t) {
return _.ptr;
}
/*#####################################################################################################################*/
vnode_t libcdsb_vnode_create(const void* v, vtype t) {
vnode_t libcdsb_builtin_vnode_create(const void* v, vtype t) {
var_t _ = { .ptr = 0 };
switch (t) { default: abort();
@ -198,10 +194,7 @@ vnode_t libcdsb_vnode_create(const void* v, vtype t) {
}
/*#####################################################################################################################*/
void* libcdsb_vnode_peek(const vnode_t* x, vtype t) {
void* libcdsb_builtin_vnode_peek(const vnode_t* x, vtype t) {
switch (t) { default: abort();
case VTYPE_FLOAT: if (is_permissible(fl_t)) goto vt_; else goto pt_;
@ -232,7 +225,7 @@ void* libcdsb_vnode_peek(const vnode_t* x, vtype t) {
}
void libcdsb_vnode_free(vnode_t* x, vtype t) {
void libcdsb_builtin_vnode_free(vnode_t* x, vtype t) {
switch (t) { default: abort();
@ -271,18 +264,15 @@ void libcdsb_vnode_free(vnode_t* x, vtype t) {
}
/*#####################################################################################################################*/
vnode_t libcdsb_vnode_create_target(vtype xt, const void* v, vtype t) {
vnode_t libcdsb_builtin_vnode_create_target(vtype xt, const void* v, vtype t) {
var_t _ = { .ptr = 0 };
if (xt <= VTYPE_LDOUBLE) {
if (t >= VTYPE_STRING) t = VTYPE_POINTER;
if (xt <= VTYPE_INT64)
return create_value(xt, v, t);
return create_float(xt, v, t);
return libcdsb_builtin_create_value(xt, v, t);
return libcdsb_builtin_create_float(xt, v, t);
} else if (t == VTYPE_POINTER && (t = xt) > VTYPE_STRING) {
v = *(void**)v;
}

View File

@ -6,7 +6,7 @@
/*#####################################################################################################################*/
static ldbl_t normalize_value(const void* v, vtype t) {
static ldbl_t libcdsb_builtin_normalize(const void* v, vtype t) {
if (t == VTYPE_BOOLEAN || t == VTYPE_UINT8) {
return *(u8_t*)v;
} else if (t == VTYPE_UINT16) {
@ -30,7 +30,7 @@ static ldbl_t normalize_value(const void* v, vtype t) {
} else return abs(*(ldbl_t*)v) <= LDBL_EPSILON ? 0 : *(ldbl_t*)v;
}
static hash_t ldouble_hash(ldbl_t s) {
static hash_t libcdsb_builtin_hash_float(ldbl_t s) {
hash_t hash;
if (sizeof(hash_t) == sizeof(u64_t)) {
@ -61,14 +61,14 @@ static hash_t ldouble_hash(ldbl_t s) {
/*#####################################################################################################################*/
int libcdsb_vtype_compare_values(const void* s0, vtype t0, const void* s1, vtype t1) {
if (t0 == t1) return libcdsb_vtype_compare_values_eq(s0, s1, t0);
int libcdsb_builtin_vtype_compare_values(const void* s0, vtype t0, const void* s1, vtype t1) {
if (t0 == t1) return libcdsb_builtin_vtype_compare_values_eq(s0, s1, t0);
if (t0 <= VTYPE_LDOUBLE && t1 <= VTYPE_LDOUBLE) {
ldbl_t d0, d1;
d0 = normalize_value(s0, t0);
d1 = normalize_value(s1, t1);
d0 = libcdsb_builtin_normalize(s0, t0);
d1 = libcdsb_builtin_normalize(s1, t1);
return (abs(d0 - d1) <= LDBL_EPSILON) ? 0 : (d0 < d1 ? -1 : 1);
}
@ -77,7 +77,7 @@ int libcdsb_vtype_compare_values(const void* s0, vtype t0, const void* s1, vtype
}
int libcdsb_vtype_compare_values_eq(const void* s0, const void* s1, vtype t) {
int libcdsb_builtin_vtype_compare_values_eq(const void* s0, const void* s1, vtype t) {
#define compare(T, s0, s1) *(T*)s0 == *(T*)s1 ? 0 : (*(T*)s0 < *(T*)s1 ? -1 : 1)
@ -117,7 +117,7 @@ int libcdsb_vtype_compare_values_eq(const void* s0, const void* s1, vtype t) {
/*#####################################################################################################################*/
hash_t libcdsb_vtype_hash(const void* v, vtype t) {
hash_t libcdsb_builtin_vtype_hash(const void* v, vtype t) {
switch (t) { default: abort();
@ -147,8 +147,8 @@ hash_t libcdsb_vtype_hash(const void* v, vtype t) {
case VTYPE_SET: return vset_hash(v);
case VTYPE_DICT: return dict_hash(v);
case VTYPE_FLOAT: return ldouble_hash(*(fl_t*)v);
case VTYPE_DOUBLE: return ldouble_hash(*(dbl_t*)v);
case VTYPE_LDOUBLE: return ldouble_hash(*(ldbl_t*)v);
case VTYPE_FLOAT: return libcdsb_builtin_hash_float(*(fl_t*)v);
case VTYPE_DOUBLE: return libcdsb_builtin_hash_float(*(dbl_t*)v);
case VTYPE_LDOUBLE: return libcdsb_builtin_hash_float(*(ldbl_t*)v);
}
}

View File

@ -51,6 +51,8 @@ tests: $(addprefix $(BUILD_PATH)/global-,$(notdir $(basename $(wildcard ./src/gl
########################################################################################################################
CFLAGS:=$(CFLAGS) ../modules/libunic/bin/libunic.a
$(BUILD_PATH)/obj/%.o: ./src/%.c | $(BUILD_PATH)/obj/
$(CC) $^ -o $@ $(CFLAGS)
@ -72,7 +74,7 @@ $(BUILD_PATH)/obj/global-%.o: ./src/global/src/%.c | $(BUILD_PATH)/obj/
$(BUILD_PATH)/array-%: ./src/array/%.c $(OBJECTS_ARRAY) | $(BUILD_PATH)/
$(CC) $^ -o $@ $(CFLAGS) -g3 -Wall
$(BUILD_PATH)/string-%: ./src/string/%.c $(OBJECTS_STRING) | $(BUILD_PATH)/
$(CC) $^ -o $@ ../modules/libunic/bin/libunic.a $(CFLAGS) -g3 -Wall
$(CC) $^ -o $@ $(CFLAGS) -g3 -Wall
$(BUILD_PATH)/list-%: ./src/list/%.c $(OBJECTS_LIST) | $(BUILD_PATH)/
$(CC) $^ -o $@ $(CFLAGS) -g3 -Wall
$(BUILD_PATH)/map-%: ./src/map/%.c $(OBJECTS_MAP) | $(BUILD_PATH)/
@ -82,7 +84,7 @@ $(BUILD_PATH)/set-%: ./src/set/%.c $(OBJECTS_SET) | $(BUILD_PATH)/
$(BUILD_PATH)/dict-%: ./src/dict/%.c $(OBJECTS_DICT) | $(BUILD_PATH)/
$(CC) $^ -o $@ $(CFLAGS) -g3 -Wall
$(BUILD_PATH)/global-%: ./src/global/%.c $(OBJECTS_GLOBAL) | $(BUILD_PATH)/
$(CC) $^ ../bin/debug/libcdsb.a ../modules/libunic/bin/libunic.a -o $@ $(CFLAGS) -g3 -Wall
$(CC) $^ ../bin/debug/libcdsb.a -o $@ $(CFLAGS) -g3 -Wall
########################################################################################################################

View File

@ -2,7 +2,7 @@
/* Copyright © 2022 Gregory Lirent */
#include <stdio.h>
#include "../../include/extra/vtype.h"
#include "../../include/vtype.h"
#ifndef LIBCDSB_TESTS_TEST_H
#define LIBCDSB_TESTS_TEST_H

Some files were not shown because too many files have changed in this diff Show More