Add dict type

This commit is contained in:
2022-08-14 18:18:34 +03:00
parent 2ad4665e17
commit aa4828b4ed
15 changed files with 1222 additions and 177 deletions
+8
View File
@@ -57,17 +57,24 @@ typedef vtype_array arr_t;
typedef vtype_list list_t;
typedef vtype_map map_t;
typedef vtype_set set_t;
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);
extern int libcdsb_vtype_compare_values_eq(const void* s0, const void* s1, vtype t);
extern hash_t libcdsb_vtype_hash(void* value, vtype type);
#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),\
@@ -78,6 +85,7 @@ extern int libcdsb_vtype_compare_values_eq(const void* s0, const void* s1, vtype
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,\
+2
View File
@@ -29,7 +29,9 @@ extern void* libcdsb_vnode_peek(const vnode_t* x, vtype type);
#define vnode_peek libcdsb_vnode_peek
#define vnode_free libcdsb_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)