48 Commits

Author SHA1 Message Date
Aryadev Chavali
3d738fc123 merge prick_functions and prick_macros into one lisp package 2026-03-26 11:19:14 +00:00
Aryadev Chavali
6353268c7b prick_sv: PRICK_SHORTHAND 2026-03-17 21:16:41 +00:00
Aryadev Chavali
bdd5b5c5a8 prick_darr: PRICK_SHORTHAND 2026-03-17 21:16:32 +00:00
Aryadev Chavali
3bebc86991 prick_btree: PRICK_SHORTHAND 2026-03-17 21:08:21 +00:00
Aryadev Chavali
192efb5aef prick_sv|prick_btree: some tasks 2026-03-17 21:05:38 +00:00
Aryadev Chavali
88cfe77b5f prick_arena: shorthand 2026-03-17 21:04:31 +00:00
Aryadev Chavali
65c424530f prick_arena: major bug fixes and namespacing 2026-03-17 20:59:48 +00:00
Aryadev Chavali
8a3ae735dc prick_vec: PRICK_SHORTHAND quality of life feature
A little QoL feature implemented as a preprocesser flag, where we
provide macros without the `prick_` prefix that link to the prick_vec
functions.
2026-03-17 20:36:48 +00:00
Aryadev Chavali
277606d483 prick_vec: added vec_pop and vec_find 2026-03-17 20:36:39 +00:00
Aryadev Chavali
ead8983ded deleted prick.org and split TODOs into header files
Makes more sense - any users of libraries should be aware of what
tasks are to be done, even if they don't have access to the repo
itself.
2026-03-17 20:28:28 +00:00
Aryadev Chavali
e370be62bf prick_sv: fix some mistakes 2026-03-09 07:16:38 +00:00
Aryadev Chavali
50e4509204 typing error in prick.functions 2026-03-07 23:49:00 +00:00
Aryadev Chavali
a6af885f41 Adjust in-package for prick.macros 2026-03-07 23:46:28 +00:00
Aryadev Chavali
0e05452f27 Adjust README for new common lisp libraries. 2026-03-07 23:43:05 +00:00
Aryadev Chavali
19f4d24e6d prick_functions and prick_macros: common lisp libraries 2026-03-07 23:42:50 +00:00
Aryadev Chavali
fe86d19463 prick_sv 2026-03-01 00:25:05 +00:00
Aryadev Chavali
ae2aa133b8 prick_vec: Added stddef for max_align_t 2026-01-22 18:43:46 +00:00
Aryadev Chavali
21ccbaa562 Reference prick_vec in prick_darr 2026-01-22 18:37:30 +00:00
Aryadev Chavali
514852b54a prick_vec: A different way to do dynamic arrays
This is an SBO'd stable dynamic array.
2026-01-22 18:36:51 +00:00
Aryadev Chavali
97403121a3 prick_btree: simplicity is king
no need for helpers, just force the user to pass in the relevant
components when required.
2026-01-22 18:10:42 +00:00
Aryadev Chavali
00d4ebe4a4 prick_darr: hard fail when unable to allocate resources
So if calloc fails, hard exit with a message.
tbh if you're working on something and I run out of memory here, I'm
doing you a favour.
2025-12-12 01:33:25 +00:00
Aryadev Chavali
aaa074912f Add prick.org for tasks 2025-12-11 21:13:33 +00:00
Aryadev Chavali
f93f0d46ae Indentation 2025-12-11 21:13:27 +00:00
Aryadev Chavali
9a62cd34f4 Actually use the custom print function in prick_bnode_print for value 2025-12-11 21:11:56 +00:00
Aryadev Chavali
69ec22ae74 prick_darr: adjust commentary 2025-12-11 21:08:05 +00:00
Aryadev Chavali
2e3742c190 prick_darr: namespace all functions and structures with prick_ 2025-12-11 20:49:12 +00:00
Aryadev Chavali
324b1d2dd5 prick_btree: rearrange prick_bnode_print function arguments 2025-11-25 19:14:46 +00:00
Aryadev Chavali
9b7a5af6ec prick_btree: Add assertion to ensure all management functions aren't NULL 2025-11-25 19:08:00 +00:00
Aryadev Chavali
8783361010 prick_btree: add custom printing function for values
Something you can feed in to the init function to be used by the
printer functions.
2025-11-25 19:07:23 +00:00
Aryadev Chavali
0278ee8599 gitignore 2025-11-25 18:50:45 +00:00
Aryadev Chavali
d3c284f762 prick_btree: refactor for namespacing
everything should have a `prick_` prepended name.  Just makes sense.
2025-11-25 18:50:22 +00:00
Aryadev Chavali
3ca2f3fb2a prick_btree: provide a general btree_t structure
This structure stores our comparator and allocator functions, as well
as a root node, ensuring we're using the same functions on one tree.
Makes the API much cleaner to use.
2025-11-17 01:05:09 +00:00
Aryadev Chavali
6d91af65aa prick_btree
Still need to make it better imo
2025-11-17 00:56:28 +00:00
Aryadev Chavali
cb583d0277 types -> prick_aliases 2025-11-17 00:56:19 +00:00
Aryadev Chavali
50bd444d7e arena -> prick_arena 2025-11-17 00:56:19 +00:00
Aryadev Chavali
f4364f38d1 vec -> prick_darr.h 2025-11-17 00:56:19 +00:00
Aryadev Chavali
44d97efd54 Added README 2025-11-17 00:18:17 +00:00
Aryadev Chavali
c93d358b6a Add types.h for useful type aliases
So simple it's not got any functions.
2025-04-09 22:55:37 +01:00
Aryadev Chavali
4218fa3a2c Translate region_delete_rec while loop to for loop, minor edits 2025-04-09 22:52:58 +01:00
Aryadev Chavali
1dd0f8835c Fixed arena_realloc
So the real purpose of arena_realloc is to figure out if we can get
away with just adjusting the region that the pointer given resides in
so that we don't need to _actually_ allocate any new memory.

The previous implementation did this in the special case where the
pointer given _is_ the entire region.  But we can adjust the region's
size _if_ the pointer given is the last allocation on the region
i.e. it's on the tail end.
2025-04-09 22:49:21 +01:00
Aryadev Chavali
1b78493b19 Completely document arena's functions and make region public
If someone uses the arena functionality, they may as well get the
region functionality for free.  In particular, they may just want a
fixed bump allocator implementation which they can get here for free.
2024-11-01 08:16:03 +00:00
Aryadev Chavali
9427c3d324 Implement arena_reset 2024-11-01 08:15:46 +00:00
Aryadev Chavali
cf93eede6b region_delete->region_delete_rec and slightly rework arena_realloc
1) Better naming.

2) Use MIN macro for choosing the size to copy over from the old
buffer to the new one.  Also fix issue where we free the old region of
memory before copying it over to the new buffer.
2024-11-01 08:13:11 +00:00
Aryadev Chavali
46f62c5d2c Simple arena implementation using singly linked list
Manages individual allocations via a bump allocator (region), with
unfit allocations triggering a new region allocation that is added to
a linked list.  Any new region allocations will always be oversized
for the initially requested size, to amortize the cost of future
allocations.
2024-11-01 07:48:19 +00:00
Aryadev Chavali
f0f1e06e1e VEC_MULT may be set as user, so have a #if guard. 2024-10-24 03:17:54 +01:00
Aryadev Chavali
3a8f0c8d00 Use VEC_MULT in vec_ensure_remaining 2024-10-24 03:13:14 +01:00
Aryadev Chavali
14dea7c48c Clean up macros in vec.h 2024-10-24 03:13:03 +01:00
Aryadev Chavali
6ca508851a Vector library 2024-10-01 05:21:59 +01:00