General extension library for C. No required dependencies beyond common POSIX platform headers.
The name derives from "[st]andard library, [i]zzy", in the same vein as stb, and izzy being an old handle of mine.
(Un)licensed under the Unlicense, which is effectively lawyer speak for Public Domain in all sane countries that have the concept of Public Domain. To quote Sam Hocevar, You just DO WHAT THE FUCK YOU WANT TO.
Warning
The API may change drastically with no notice. This is my personal set of utilities and I have not permanently settled on how it should work.
A few of the functions have terrible performance when compiled with -O0 but excellent performance when compiled with -O1/2/3.
Repos:
Github
Notabug (Currently down due to the Goddamn AI scrapers. Fuck Sam Altman.)
Gitlab
Codeberg
Compiling
Symlink or copy the code into your project however you wish,
#include "sti/sti.h",
and compile
sti/sti.c to get everything at once, or select individual pairs a la carte.
Some components are optional by default and need to be explicitly included:
- debug.h Magic type-detecting debugging macros.
Features
Type-safe Data Structures
- [docs] VEC, an auto-sizing buffer similar to stb's sb or C++'s vector<>, whence the name.
- [docs] HT, an open-addressing, linear probing hash table that supports arbitrary keys.
- [docs] SVEC, an unrolled list that works like VEC but offers stable pointers for items.
- [docs] SLOT, like SVEC, except tracks occupancy. Effectively an iterable block allocator. I use it
constantly. This is the third most useful data structure after VEC and HT.
- [docs] RING, a fixed-size ring buffer.
- [docs] RB, a relatively basic red-black tree. There are very few situtations where a hash table is not
a superior choice.
- [docs] HEAP, a very basic min/max heap.
Helpers
Eliminating common boilerplate.
- [docs] File handling and filesystem helpers.
Utilities
- [docs] Set of type-detecting macros for easily printing debug information to the console.
- [docs] Configurable parser from infix notation (normal math) to reverse Polish notation (RPN).
- [docs] S-Expression (LISP-like) string parser supporting several brace types.
- [docs] Basic, Windows-style INI file parser.
- [docs] Base64 encoding and decoding.
- [docs] Global and local hash table based string internment.
- [docs] Simple spinlock functions based pure on C atomics.
- [docs] Selected public-domain, 3rd-party hash functions, included here for convenience.
And there is a bunch of random, half-finished junk in the library because that's how it grows.