Minimalist agentic harness in C
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334#pragma once
#include "lib.h"#include <stddef.h>#include <stdint.h>
typedef void (*vecDestroyFn)(void*);
// Dynamically sized list.// Length and capacity are both in units of `type_size`// Element destructor is called on vecDestroy. It is allowed to be null.typedef struct vec { usize type_size, length, capacity; u8 *data; vecDestroyFn destroy;} vec;
vec vecNew(usize type_size, vecDestroyFn destroy);
// Doubles the list's capacity, which is done by reallocing the data pointer.// This means that any pointers to the vec's data may be invalidated.error_t vecExpand(vec* vec, usize requested_capacity);
// Inserts `n` items of `vec->type_size` bytes into the list at the given `index`.error_t vecInsert(vec* vec, usize index, const void* items, usize n);
inline static error_t vecAppend(vec* vec, const void* items, usize n) { return vecInsert(vec, vec->length, items, n);}
void* vecGet(vec* vec, const usize index);
void vecDestroy(vec* vec);