From 74bf6a57c3c852d8b5237f2b5920556c63da1d79 Mon Sep 17 00:00:00 2001 From: Jonathan Bradley Date: Thu, 5 Dec 2024 15:05:04 -0500 Subject: pkarr: first-pass --- pk.h.in | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'pk.h.in') diff --git a/pk.h.in b/pk.h.in index e3af304..6ae6b89 100644 --- a/pk.h.in +++ b/pk.h.in @@ -27,6 +27,7 @@ * # define PK_IMPL_MEM * # define PK_IMPL_STR * # define PK_IMPL_EV +* # define PK_IMPL_ARR * #include "pk.h" * ``` * @@ -119,6 +120,26 @@ * that in this provided scenario a given mgr will still grow if a second EV is * registered. * +******************************************************************************** +* pkarr.h: def PK_IMPL_ARR before including pk.h to enable ad-hoc +* +* Provides a structure for managing contiguous lists +* +* The following definitions (shown with defaults) can be overridden: +* PK_ARR_INITIAL_COUNT 16 +* PK_ARR_GROW_RATIO 1.5 +* +* Initialize `stride`, `alignment` (optional), and `bkt` (optional) members +* *before* calling any `pk_arr_*` methods. +* ``` c +* struct pk_arr arr = {0}; +* arr.stride = sizeof(obj); +* arr.alignment = alignof(obj); // optional +* arr.bkt = bkt; // optional +* pk_arr_reserve(&arr, 10); // optional +* pk_arr_append(&arr, &obj); +* ``` +* *******************************************************************************/ #define PK_VERSION "@@PK_VERSION@@" @@ -136,4 +157,7 @@ # ifndef PK_IMPL_EV # define PK_IMPL_EV # endif +# ifndef PK_IMPL_ARR +# define PK_IMPL_ARR +# endif #endif -- cgit v1.2.3