30 #include "_sexp-types.h"
31 #include "../../../common/util.h"
35 typedef uint8_t SEXP_valtype_t;
37 #define SEXP_VALTYPE_EMPTY 0
38 #define SEXP_VALTYPE_STRING 1
39 #define SEXP_VALTYPE_NUMBER 2
40 #define SEXP_VALTYPE_LIST 3
54 #define SEXP_VALP_ALIGN (4 > sizeof(void *) ? 4 : sizeof(void *))
55 #define SEXP_VALP_MASK (UINTPTR_MAX << 2)
56 #define SEXP_VALT_MASK 3
57 #define SEXP_VALP_HDR(p) ((SEXP_valhdr_t *)(((uintptr_t)(p)) & SEXP_VALP_MASK))
59 int SEXP_val_new (
SEXP_val_t *dst,
size_t vmemsize, SEXP_valtype_t type);
60 void SEXP_val_dsc (
SEXP_val_t *dst, uintptr_t ptr);
63 uintptr_t SEXP_rawval_incref (uintptr_t valp);
64 int SEXP_rawval_decref (uintptr_t valp);
66 #define SEXP_DEFNUM(s,T) struct SEXP_val_num_##s { T n; SEXP_numtype_t t; } __attribute__ ((packed))
67 #define SEXP_NCASTP(s,p) ((struct SEXP_val_num_##s *)(p))
68 #define SEXP_NTYPEP(sz,p) *((SEXP_numtype_t *)(((uint8_t *)(p)) + (sz) - sizeof (SEXP_numtype_t)))
70 SEXP_numtype_t SEXP_rawval_number_type (
SEXP_val_t *dsc);
73 SEXP_DEFNUM(f,
double);
74 SEXP_DEFNUM(i8, int8_t);
75 SEXP_DEFNUM(u8, uint8_t);
76 SEXP_DEFNUM(i16, int16_t);
77 SEXP_DEFNUM(u16, uint16_t);
78 SEXP_DEFNUM(i32, int32_t);
79 SEXP_DEFNUM(u32, uint32_t);
80 SEXP_DEFNUM(i64, int64_t);
81 SEXP_DEFNUM(u64, uint64_t);
92 #define SEXP_LCASTP(p) ((struct SEXP_val_list *)(p))
102 uintptr_t SEXP_rawval_list_copy (uintptr_t s_valp);
104 uintptr_t SEXP_rawval_lblk_copy (uintptr_t lblkp, uint16_t n_skip);
105 uintptr_t SEXP_rawval_lblk_new (uint8_t sz);
106 uintptr_t SEXP_rawval_lblk_incref (uintptr_t lblkp);
107 int SEXP_rawval_lblk_decref (uintptr_t lblkp);
109 uintptr_t SEXP_rawval_lblk_fill (uintptr_t lblkp,
SEXP_t *s_exp[], uint16_t s_exp_count);
110 uintptr_t SEXP_rawval_lblk_add (uintptr_t lblkp,
const SEXP_t *s_exp);
111 uintptr_t SEXP_rawval_lblk_add1 (uintptr_t lblkp,
const SEXP_t *s_exp);
112 uintptr_t SEXP_rawval_lblk_last (uintptr_t lblkp);
113 SEXP_t *SEXP_rawval_lblk_nth (uintptr_t lblkp, uint32_t n);
114 uintptr_t SEXP_rawval_lblk_replace (uintptr_t lblkp, uint32_t n,
const SEXP_t *n_val,
SEXP_t **o_val);
115 int SEXP_rawval_lblk_cb (uintptr_t lblkp,
int (*func) (
SEXP_t *,
void *),
void *arg, uint32_t n);
116 void SEXP_rawval_lblk_free (uintptr_t lblkp,
void (*func) (
SEXP_t *));
117 void SEXP_rawval_lblk_free1 (uintptr_t lblkp,
void (*func) (
SEXP_t *));
119 #define SEXP_LBLK_ALIGN (16 > sizeof(void *) ? 16 : sizeof(void *))
120 #define SEXP_LBLKP_MASK (UINTPTR_MAX << 4)
121 #define SEXP_LBLKS_MASK 0x0f
123 #define SEXP_VALP_LBLK(valp) ((struct SEXP_val_lblk *)((uintptr_t)(valp) & SEXP_LBLKP_MASK))
125 uintptr_t SEXP_rawval_copy(uintptr_t s_valp);
Definition: _sexp-value.h:87
Definition: _sexp-value.h:47
Definition: _sexp-value.h:42
Definition: _sexp-value.h:94
Definition: sexp-types.h:82