kvector.h (808B)
1 /* 2 ** kvector.h 3 ** Kernel Vectors (heterogenous arrays) 4 ** See Copyright Notice in klisp.h 5 */ 6 7 #ifndef kvector_h 8 #define kvector_h 9 10 #include "kobject.h" 11 #include "kstate.h" 12 13 /* constructors */ 14 15 TValue kvector_new_sf(klisp_State *K, uint32_t length, TValue fill); 16 TValue kvector_new_bs_g(klisp_State *K, bool m, 17 const TValue *buf, uint32_t length); 18 19 /* predicates */ 20 21 bool kvectorp(TValue obj); 22 bool kimmutable_vectorp(TValue obj); 23 bool kmutable_vectorp(TValue obj); 24 25 /* some macros to access the parts of vectors */ 26 27 #define kvector_buf(tv_) (tv2vector(tv_)->array) 28 #define kvector_size(tv_) (tv2vector(tv_)->sizearray) 29 30 #define kvector_emptyp(tv_) (kvector_size(tv_) == 0) 31 #define kvector_mutablep(tv_) (kis_mutable(tv_)) 32 #define kvector_immutablep(tv_) (kis_immutable(tv_)) 33 34 #endif