Update generics (vtype_variable)
This commit is contained in:
parent
a3107ef73b
commit
a4c95fe95e
@ -22,15 +22,15 @@ inline void array_init (vtype_array* x, vtype type) { x->type = type; x->me
|
||||
|
||||
/*#####################################################################################################################*/
|
||||
|
||||
#define array_pop(x, value, data, callback) libcdsb_array_find (x, libcdsb_variable_build(_LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value)), data, callback, 0, 1)
|
||||
#define array_pop(x, value, data, callback) libcdsb_array_find (x, _LIBCDSB_var(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_variable_build(_LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value)), data, callback, 0, 0)
|
||||
#define array_rfind(x, value, data, callback) libcdsb_array_find (x, libcdsb_variable_build(_LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value)), data, callback, 1, 0)
|
||||
#define array_countof(x, value) libcdsb_array_count (x, libcdsb_variable_build(_LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value)))
|
||||
#define array_push_back(x, value) libcdsb_array_insert (x, libcdsb_variable_build(_LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value)))
|
||||
#define array_attach_back(x, value) libcdsb_array_attach (x, libcdsb_variable_build(_LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value)))
|
||||
#define array_find(x, value, data, callback) libcdsb_array_find (x, _LIBCDSB_var(value), data, callback, 0, 0)
|
||||
#define array_rfind(x, value, data, callback) libcdsb_array_find (x, _LIBCDSB_var(value), data, callback, 1, 0)
|
||||
#define array_countof(x, value) libcdsb_array_count (x, _LIBCDSB_var(value))
|
||||
#define array_push_back(x, value) libcdsb_array_insert (x, _LIBCDSB_var(value))
|
||||
#define array_attach_back(x, value) libcdsb_array_attach (x, _LIBCDSB_var(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)
|
||||
|
@ -26,6 +26,7 @@
|
||||
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),\
|
||||
@ -34,6 +35,7 @@
|
||||
vtype_map*: (x), const vtype_map*: (x),\
|
||||
vtype_set*: (x), const vtype_set*: (x),\
|
||||
vtype_dict*: (x), const vtype_dict*: (x))
|
||||
#define _LIBCDSB_var(x) libcdsb_variable_build(_LIBCDSB_value_pointer(x), _LIBCDSB_vtypeof(x))
|
||||
|
||||
#define _LIBCDSB_to_cstring(x) _Generic((x), default: _LIBCDSB_nothing,\
|
||||
vtype_string*: _LIBCDSB_deref1, const vtype_string*: _LIBCDSB_deref1,\
|
||||
|
@ -17,12 +17,12 @@ inline void dict_init(vtype_dict* x) { x->nodes = (void*)(x->capacity = x->size
|
||||
|
||||
/*#####################################################################################################################*/
|
||||
|
||||
#define dict_pop(x, key, data, callback) libcdsb_dict_find (x, libcdsb_variable_build(_LIBCDSB_value_pointer(key), _LIBCDSB_vtypeof(key)), data, callback, 1)
|
||||
#define dict_get(x, key, data, callback) libcdsb_dict_find (x, libcdsb_variable_build(_LIBCDSB_value_pointer(key), _LIBCDSB_vtypeof(key)), data, callback, 0)
|
||||
#define dict_update(x, key, value) libcdsb_dict_update (x, libcdsb_variable_build(_LIBCDSB_value_pointer(key), _LIBCDSB_vtypeof(key)), libcdsb_variable_build(_LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value)), 0, 0)
|
||||
#define dict_inject(x, key, value) libcdsb_dict_inject (x, libcdsb_variable_build(_LIBCDSB_value_pointer(key), _LIBCDSB_vtypeof(key)), libcdsb_variable_build(_LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value)), 0, 0)
|
||||
#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 dict_pop(x, key, data, callback) libcdsb_dict_find (x, _LIBCDSB_var(key), data, callback, 1)
|
||||
#define dict_get(x, key, data, callback) libcdsb_dict_find (x, _LIBCDSB_var(key), data, callback, 0)
|
||||
#define dict_update(x, key, value) libcdsb_dict_update (x, _LIBCDSB_var(key), _LIBCDSB_var(value), 0, 0)
|
||||
#define dict_inject(x, key, value) libcdsb_dict_inject (x, _LIBCDSB_var(key), _LIBCDSB_var(value), 0, 0)
|
||||
#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)
|
||||
|
||||
|
@ -21,19 +21,19 @@ inline void list_init (vtype_list* x) { x->first = x->last = 0; }
|
||||
|
||||
/*#####################################################################################################################*/
|
||||
|
||||
#define list_pop(x, value, data, callback) libcdsb_list_find (x, libcdsb_variable_build(_LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value)), data, callback, 0, 1)
|
||||
#define list_pop(x, value, data, callback) libcdsb_list_find (x, _LIBCDSB_var(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_variable_build(_LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value)), data, callback, 0, 0)
|
||||
#define list_rfind(x, value, data, callback) libcdsb_list_find (x, libcdsb_variable_build(_LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value)), data, callback, 1, 0)
|
||||
#define list_countof(x, value) libcdsb_list_count (x, libcdsb_variable_build(_LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value)))
|
||||
#define list_insert(x, index, value) libcdsb_list_insert (x, index, libcdsb_variable_build(_LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value)), -1, 0, 0)
|
||||
#define list_replace(x, index, value) libcdsb_list_insert (x, index, libcdsb_variable_build(_LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value)), 0, 0, 0)
|
||||
#define list_push_back(x, value) libcdsb_list_insert (x, -1, libcdsb_variable_build(_LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value)), 1, 0, 0)
|
||||
#define list_push_front(x, value) libcdsb_list_insert (x, 0, libcdsb_variable_build(_LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value)), -1, 0, 0)
|
||||
#define list_attach_back(x, value) libcdsb_list_attach (x, -1, libcdsb_variable_build(_LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value)), 1, 0, 0)
|
||||
#define list_attach_front(x, value) libcdsb_list_attach (x, 0, libcdsb_variable_build(_LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value)), -1, 0, 0)
|
||||
#define list_find(x, value, data, callback) libcdsb_list_find (x, _LIBCDSB_var(value), data, callback, 0, 0)
|
||||
#define list_rfind(x, value, data, callback) libcdsb_list_find (x, _LIBCDSB_var(value), data, callback, 1, 0)
|
||||
#define list_countof(x, value) libcdsb_list_count (x, _LIBCDSB_var(value))
|
||||
#define list_insert(x, index, value) libcdsb_list_insert (x, index, _LIBCDSB_var(value), -1, 0, 0)
|
||||
#define list_replace(x, index, value) libcdsb_list_insert (x, index, _LIBCDSB_var(value), 0, 0, 0)
|
||||
#define list_push_back(x, value) libcdsb_list_insert (x, -1, _LIBCDSB_var(value), 1, 0, 0)
|
||||
#define list_push_front(x, value) libcdsb_list_insert (x, 0, _LIBCDSB_var(value), -1, 0, 0)
|
||||
#define list_attach_back(x, value) libcdsb_list_attach (x, -1, _LIBCDSB_var(value), 1, 0, 0)
|
||||
#define list_attach_front(x, value) libcdsb_list_attach (x, 0, _LIBCDSB_var(value), -1, 0, 0)
|
||||
#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)
|
||||
|
@ -16,10 +16,10 @@ extern void map_init(vtype_map* x, vtype key_type) Nonnull__(1);
|
||||
|
||||
/*#####################################################################################################################*/
|
||||
|
||||
#define map_pop(x, key, data, callback) libcdsb_map_find (x, libcdsb_variable_build(_LIBCDSB_value_pointer(key), _LIBCDSB_vtypeof(key)), data, callback, 1)
|
||||
#define map_get(x, key, data, callback) libcdsb_map_find (x, libcdsb_variable_build(_LIBCDSB_value_pointer(key), _LIBCDSB_vtypeof(key)), data, callback, 0)
|
||||
#define map_update(x, key, value) libcdsb_map_update (x, libcdsb_variable_build(_LIBCDSB_value_pointer(key), _LIBCDSB_vtypeof(key)), libcdsb_variable_build(_LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value)), 0, 0)
|
||||
#define map_inject(x, key, value) libcdsb_map_inject (x, libcdsb_variable_build(_LIBCDSB_value_pointer(key), _LIBCDSB_vtypeof(key)), libcdsb_variable_build(_LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value)), 0, 0)
|
||||
#define map_pop(x, key, data, callback) libcdsb_map_find (x, _LIBCDSB_var(key), data, callback, 1)
|
||||
#define map_get(x, key, data, callback) libcdsb_map_find (x, _LIBCDSB_var(key), data, callback, 0)
|
||||
#define map_update(x, key, value) libcdsb_map_update (x, _LIBCDSB_var(key), _LIBCDSB_var(value), 0, 0)
|
||||
#define map_inject(x, key, value) libcdsb_map_inject (x, _LIBCDSB_var(key), _LIBCDSB_var(value), 0, 0)
|
||||
#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)
|
||||
|
||||
|
@ -16,10 +16,10 @@ extern void vset_init(vtype_set* x, vtype type) Nonnull__(1);
|
||||
|
||||
/*#####################################################################################################################*/
|
||||
|
||||
#define vset_pop(x, value, data, callback) libcdsb_vset_find (x, libcdsb_variable_build(_LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value)), data, callback, 1)
|
||||
#define vset_get(x, value, data, callback) libcdsb_vset_find (x, libcdsb_variable_build(_LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value)), data, callback, 0)
|
||||
#define vset_push(x, value) libcdsb_vset_insert (x, libcdsb_variable_build(_LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value)))
|
||||
#define vset_attach(x, value) libcdsb_vset_attach (x, libcdsb_variable_build(_LIBCDSB_value_pointer(value), _LIBCDSB_vtypeof(value)))
|
||||
#define vset_pop(x, value, data, callback) libcdsb_vset_find (x, _LIBCDSB_var(value), data, callback, 1)
|
||||
#define vset_get(x, value, data, callback) libcdsb_vset_find (x, _LIBCDSB_var(value), data, callback, 0)
|
||||
#define vset_push(x, value) libcdsb_vset_insert (x, _LIBCDSB_var(value))
|
||||
#define vset_attach(x, value) libcdsb_vset_attach (x, _LIBCDSB_var(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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user