Access standardization: clean types

This commit is contained in:
Gregory Lirent 2022-06-08 21:01:12 +03:00
parent d592c0adac
commit 28de64f7ba
2 changed files with 21 additions and 76 deletions

View File

@ -37,7 +37,6 @@ typedef enum libcdsb_value_types {
struct libcdsb_string { char* buffer; };
struct libcdsb_array { void* mem; size_t size; vtype type; };
struct libcdsb_value { void* mem; int flags; vtype type; };
struct libcdsb_map { struct libcdsb_map_node* root; vtype type; };
struct libcdsb_set { struct libcdsb_rbtree_node* root; vtype type; };
@ -61,14 +60,11 @@ typedef float vtype_float;
typedef double vtype_double;
typedef long double vtype_ldouble;
typedef struct libcdsb_value_pair vtype_kvpair;
typedef struct libcdsb_value vtype_value;
typedef struct libcdsb_array vtype_array;
typedef struct libcdsb_map vtype_map;
typedef struct libcdsb_set vtype_set;
typedef struct libcdsb_list vtype_list;
typedef struct libcdsb_string vtype_string;
typedef struct libcdsb_iterator vtype_iterator;
typedef struct libcdsb_array vtype_array;
typedef struct libcdsb_map vtype_map;
typedef struct libcdsb_set vtype_set;
typedef struct libcdsb_list vtype_list;
typedef struct libcdsb_string vtype_string;
/* Get utf8 chars count in string */
@ -142,38 +138,4 @@ extern void map_free(vtype_map* x);
/* Free set resources */
extern void vset_free(vtype_set* x);
extern void value_init(vtype_value* dest);
extern void value_free(vtype_value* dest);
extern _Bool value_is_readonly (const vtype_value* node);
extern _Bool value_is_strict_type(const vtype_value* node);
extern void value_is_null (const vtype_value* dest);
extern void value_nmemb (const vtype_value* dest);
extern void* value_get_pointer (const vtype_value* src);
extern _Bool value_set_pointer(vtype_value* node, const void* src);
extern _Bool value_set_cstring(vtype_value* node, const char* src);
extern _Bool value_set_string (vtype_value* node, const vtype_string* src);
extern _Bool value_set_array (vtype_value* node, const vtype_array* src);
extern _Bool value_set_list (vtype_value* node, const vtype_list* src);
extern _Bool value_set_map (vtype_value* node, const vtype_map* src);
extern _Bool value_set_vset (vtype_value* node, const vtype_set* src);
extern _Bool value_set_boolean(vtype_value* node, vtype_bool src);
extern _Bool value_set_uint8 (vtype_value* node, vtype_uint8 src);
extern _Bool value_set_uint16 (vtype_value* node, vtype_uint16 src);
extern _Bool value_set_uint32 (vtype_value* node, vtype_uint32 src);
extern _Bool value_set_uint64 (vtype_value* node, vtype_uint64 src);
extern _Bool value_set_int8 (vtype_value* node, vtype_int8 src);
extern _Bool value_set_int16 (vtype_value* node, vtype_int16 src);
extern _Bool value_set_int32 (vtype_value* node, vtype_int32 src);
extern _Bool value_set_int64 (vtype_value* node, vtype_int64 src);
extern _Bool value_set_float (vtype_value* node, vtype_float src);
extern _Bool value_set_double (vtype_value* node, vtype_double src);
extern _Bool value_set_ldouble(vtype_value* node, vtype_ldouble src);
#endif /* LIBCDSB_VTYPE_H */

View File

@ -38,43 +38,26 @@
#include "__attributes.h"
typedef vtype_uint8 u8_t;
typedef vtype_uint16 u16_t;
typedef vtype_uint32 u32_t;
typedef vtype_uint64 u64_t;
typedef vtype_uint8 u8_t;
typedef vtype_uint16 u16_t;
typedef vtype_uint32 u32_t;
typedef vtype_uint64 u64_t;
typedef vtype_int8 s8_t;
typedef vtype_int16 s16_t;
typedef vtype_int32 s32_t;
typedef vtype_int64 s64_t;
typedef vtype_int8 s8_t;
typedef vtype_int16 s16_t;
typedef vtype_int32 s32_t;
typedef vtype_int64 s64_t;
typedef vtype_float fl_t;
typedef vtype_double dbl_t;
typedef vtype_ldouble ldbl_t;
typedef vtype_float fl_t;
typedef vtype_double dbl_t;
typedef vtype_ldouble ldbl_t;
typedef vtype_string str_t;
typedef vtype_array arr_t;
typedef vtype_list list_t;
typedef vtype_map map_t;
typedef vtype_set set_t;
typedef vtype_value val_t;
typedef vtype_kvpair kvp_t;
typedef vtype_iterator iter_t;
typedef vtype_string str_t;
typedef vtype_array arr_t;
typedef vtype_list list_t;
typedef vtype_map map_t;
typedef vtype_set set_t;
typedef enum {
VF_UNDEFINED = 0x00,
VF_WRITEABLE = 0x01,
VF_CHANGEABLE = 0x02,
VF_REMOVABLE = 0x0f
} vtype_value_flags;
ainline(val_t* value_set(val_t* d, void* ptr, vtype type, int flags)) {
d->mem = ptr;
d->type = type;
d->flags = flags;
return d;
}
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);