libcjsonp/include/bits/__generics.h

36 lines
1.8 KiB
C
Raw Normal View History

2022-08-26 10:07:43 +03:00
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "../../modules/libcdsb/include/bits/__generics.h"
#ifndef LIBCJSONP_BITS_GENERICS_H
#define LIBCJSONP_BITS_GENERICS_H
#define _LIBCJSONP_vtypeof_hack(x) (vtype)(_Generic((x),\
default: VTYPE_POINTER,\
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 _LIBCJSONP_vtypeof(x) _Generic((x), default: _LIBCJSONP_vtypeof_hack(_Generic((x), default: (x),const char*: &(x),char*:&(x))), const json_t*:json_type(x),json_t*:json_type(x))
#define _LIBCJSONP_value_pointer(x) _Generic((x), default: _LIBCDSB_value_pointer(x), const json_t*: json_value(x), json_t*: json_value(x))
#endif /* LIBCJSONP_BITS_GENERICS_H */