From 13142dc7f38e6b148efadc97edffca8664b9cde7 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Wed, 20 Aug 2025 22:43:23 +0100 Subject: refactor lisp runtime to use vec_t* instead of ivec_t* bit nicer to look at, should have about the same painful performance hit anyway. --- alisp.h | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'alisp.h') diff --git a/alisp.h b/alisp.h index fe24c74..bf12784 100644 --- a/alisp.h +++ b/alisp.h @@ -53,7 +53,9 @@ typedef struct Vector void *data; } vec_t; -#define VEC_MULT 2 +#define VEC_MULT 2 +#define VEC_DEFAULT_CAPACITY 8 + void vec_free(vec_t *); void vec_ensure_free(vec_t *, u64); void vec_append(vec_t *, void *, u64); @@ -103,12 +105,6 @@ typedef struct lisp_t *car, *cdr; } cons_t; -typedef struct -{ - // 2 levels of indirection... disgusting - void *data; -} lvec_t; - /// System context - essentially something to help with system management typedef struct { @@ -129,7 +125,7 @@ lisp_t *cons(sys_t *, lisp_t *, lisp_t *); i64 as_int(lisp_t *); sv_t *as_sym(lisp_t *); cons_t *as_cons(lisp_t *); -void *as_vec(lisp_t *); +vec_t *as_vec(lisp_t *); #define CAR(L) (as_cons(L)->car) #define CDR(L) (as_cons(L)->cdr) @@ -174,6 +170,6 @@ tag_t get_tag(lisp_t *); lisp_t *tag_int(i64); lisp_t *tag_sym(sv_t *); lisp_t *tag_cons(cons_t *); -lisp_t *tag_vec(lvec_t *); +lisp_t *tag_vec(vec_t *); #endif -- cgit v1.2.3-13-gbd6f