From f60047d4b013eb7f75ad4f5c63eda63153a4bf8e Mon Sep 17 00:00:00 2001 From: kartofen Date: Sun, 8 Sep 2024 20:02:06 +0300 Subject: value is now opaque --- src/value.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/value.h') diff --git a/src/value.h b/src/value.h index 264e083..f5f66d3 100644 --- a/src/value.h +++ b/src/value.h @@ -57,6 +57,21 @@ struct value { size_t refs; }; +#define vvalue_type(v) ((v)->type) +#define vvalue_refs(v) ((v)->refs) + +#define vvalue_atom(v) ((v)->value.atom) +#define vvalue_str(v) ((v)->value.str) +#define vvalue_num(v) ((v)->value.num) +#define vvalue_cons(v) ((v)->value.cons) +#define vvalue_proc(v) ((v)->value.proc) +#define vvalue_proc_builtin(v) ((v)->value.proc_builtin) + +#define value_set_type(v, type) (vvalue_type(v) = type) +#define value_set_refs(v, refs) (vvalue_refs(v) = refs) +#define value_inc_refs(v) (++vvalue_refs(v)) +#define value_dec_refs(v) (--vvalue_refs(v)) + value_t value_create(enum value_type type, void * value); void value_destroy(value_t value); -- cgit v1.2.3