From a8519434f058d0ab60bf7f90acc61997cb982cfa Mon Sep 17 00:00:00 2001 From: ubq323 Date: Wed, 26 Jun 2024 14:44:19 +0100 Subject: add cfunc type and rudimentary stdlib --- val.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'val.c') diff --git a/val.c b/val.c index ec200d3..7c8b25a 100644 --- a/val.c +++ b/val.c @@ -76,6 +76,9 @@ void print_val(Val v) { break; } break; + case TY_CFUNC: + printf("[cfunc]"); + break; } } @@ -98,6 +101,7 @@ bool val_equal(Val a, Val b) { case TY_NUM: return AS_NUM(a) == AS_NUM(b); case TY_BOOL: return AS_BOOL(a) == AS_BOOL(b); case TY_OBJ: return AS_OBJ(a) == AS_OBJ(b); + case TY_CFUNC: return AS_CFUNC(a) == AS_CFUNC(b); default: return false; } } @@ -114,6 +118,7 @@ const char *typename_str(Val v) { case OTY_FUNC: return "Func"; } break; + case TY_CFUNC: return "cfunc"; } return "???"; } -- cgit v1.2.3