From 7b9204a8680539bc4795a14f3d9a34e47981d0c3 Mon Sep 17 00:00:00 2001 From: nodist Date: Thu, 5 Nov 2026 15:22:02 -0500 Subject: more objects and special slab for gc --- include/kpl/array.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 include/kpl/array.h (limited to 'include/kpl/array.h') diff --git a/include/kpl/array.h b/include/kpl/array.h new file mode 100644 index 0000000..de3b0e8 --- /dev/null +++ b/include/kpl/array.h @@ -0,0 +1,31 @@ +/* + * KPL array methods + */ + +#pragma once + +/* + * Create new array + */ +kpl_object_array *kpl_object_array_create(kpl_thread *thread, kpl_value_bit_width value_bit_width, + int32_t value_size); + +/* + * Return array to gc before sweep + */ +inline void kpl_object_array_destroy(kpl_thread *thread, kpl_object_array *object_array) { + kpl_gc_delete(thread, (kpl_object*) object_array); +} + +typedef enum : int32_t { + KPL_ARRAY_RESULT_TAG_SUCCESS = 0, + KPL_ARRAY_RESULT_TAG_RESIZE_FAIL = 1, + KPL_ARRAY_RESULT_TAG_ARRAY_EMPTY = 2, + KPL_ARRAY_RESULT_TAG_INDEX_INVALID = 3 +} kpl_array_result_tag; + +// TODO PUSH + +// TODO POP + +// TODO INDEX -- cgit v1.2.3