/* This software is licensed by the Apache License 2.0, see LICENSE file */ /* Copyright © 2022 Gregory Lirent */ #include "include.h" #ifndef LIBCDSB_SRC_INTERNAL_VNODE_H #define LIBCDSB_SRC_INTERNAL_VNODE_H #define is_permissible(T) (sizeof(void*) >= sizeof(T) && _Alignof(void*) >= _Alignof(T)) typedef union { void* ptr; _Bool b; str_t s; arr_t a; list_t l; map_t m; set_t vs; u8_t u8; u16_t u16; u32_t u32; u64_t u64; fl_t f; dbl_t d; ldbl_t ld; } var_t; typedef void* vnode_t; extern vnode_t libcdsb_vnode_create(const void* value, vtype type); extern vnode_t libcdsb_vnode_create_target(vtype target_type, const void* value, vtype type); extern void libcdsb_vnode_free(vnode_t* x, vtype type); extern void* libcdsb_vnode_peek(const vnode_t* x, vtype type); #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 #define vnode_compare(s0, t0, s1, t1) vtype_compare(vnode_peek(s0, t0), t0, vnode_peek(s1, t1), t1) #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_stringify(n, t) vtype_stringify(vnode_peek(n, t), t) #endif /* LIBCDSB_SRC_INTERNAL_VNODE_H */