From f331192861d8ba02af7fd47f2e0c6d6db7515007 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Thu, 20 Jun 2024 23:26:18 +0100 Subject: add (if cond if-true if-false) builtin --- val.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'val.h') diff --git a/val.h b/val.h index db0a789..aa20b48 100644 --- a/val.h +++ b/val.h @@ -30,6 +30,8 @@ void print_val(Val v); void println_val(Val v); const char *typename_str(Val v); +bool is_truthy(Val v); + typedef enum { OTY_STRING, @@ -55,7 +57,7 @@ ObjString *objstring_copy_cstr(State *s, char *str); ObjString *objstring_take(State *S, char *src, size_t len); -#define IS_NIL(x) (x.ty == NIL) +#define IS_NIL(x) (x.ty == TY_NIL) #define IS_NUM(x) (x.ty == TY_NUM) #define IS_BOOL(x) (x.ty == TY_BOOL) #define IS_OBJ(x) (x.ty == TY_OBJ) -- cgit v1.2.3