General extension library for C. No dependencies beyond common POSIX platform headers. \[st]andard library, [i]zzy\, in the same vein as stb.

izzy fbd6499d20 compatibility fixes vor 4 Wochen
dwarf 1566a5afc0 pedantic fixes vor 4 Jahren
hash_fns ad98d1218c Add sha256 and sha512 hash functions vor 4 Jahren
lexer 8d3831617c progress on the c parser vor 2 Monaten
parser 81ce451e65 less lexer logging, parser generator syntax changed? vor 1 Jahr
scripting c921594825 fixed a unch of encoding and alignment bugs vor 3 Jahren
string_utils d805238a81 fs write_whole_file vor 1 Jahr
test 81ce451e65 less lexer logging, parser generator syntax changed? vor 1 Jahr
.gitignore 7dbda9d2fb much better hash table macros vor 1 Jahr
LICENSE d6f6c74b64 Initial commit vor 5 Jahren
README.md f761fd33d2 more heap functions vor 4 Jahren
b64.c ba29a5f706 initial pass at base64_encode vor 1 Jahr
b64.h ba29a5f706 initial pass at base64_encode vor 1 Jahr
build.sh aed8b7086f a couple string fns for parsing c vor 3 Jahren
conventions.h f16efae2ef coding conventions, todo list of string functions vor 1 Jahr
err.h a23db7f116 parenthesis support for rpn converter vor 4 Jahren
fs.c caa456783e read_whole_dir functions vor 1 Jahr
fs.h caa456783e read_whole_dir functions vor 1 Jahr
hash.c fbd6499d20 compatibility fixes vor 4 Wochen
hash.h caa456783e read_whole_dir functions vor 1 Jahr
heap.c aeb139e7e0 heap improvements vor 1 Jahr
heap.h 39b3db3344 improvements to s-expression parser vor 7 Monaten
ini.c 9d1eb56746 ini file reader vor 2 Jahren
ini.h 9d1eb56746 ini file reader vor 2 Jahren
initest.ini 9d1eb56746 ini file reader vor 2 Jahren
macros.h 79f6846952 added missing file vor 4 Jahren
matrix.c 2b5abfc46c meh vor 1 Jahr
matrix.h 6badfa1609 fixes and additions to matrix functions vor 1 Jahr
memarena.c a7205d374e bunch of more stuf vor 5 Jahren
memarena.h a7205d374e bunch of more stuf vor 5 Jahren
mempool.c 1566a5afc0 pedantic fixes vor 4 Jahren
mempool.h fbd6499d20 compatibility fixes vor 4 Wochen
misc.c 197298b3be bugfix epoch ts helper vor 6 Monaten
misc.h cb6a6f722e missing system headers vor 3 Monaten
rb.c 6230a20751 red-black trees vor 4 Jahren
rb.h 04b125e9fe heap structure and basic functions vor 4 Jahren
ring.c 1566a5afc0 pedantic fixes vor 4 Jahren
ring.h e1386d6e03 real path fs helper vor 4 Jahren
rpn.c 55b5b4c665 bug fixes vor 3 Jahren
rpn.h 1566a5afc0 pedantic fixes vor 4 Jahren
sets.c 40243a0b3e fixed uninitialized field vor 2 Jahren
sets.h 4113c0aa2b -fstrict-prototypes compatibility vor 4 Jahren
sexp.c 39b3db3344 improvements to s-expression parser vor 7 Monaten
sexp.h 39b3db3344 improvements to s-expression parser vor 7 Monaten
stats.c d683425a27 completely untested stats code vor 4 Jahren
stats.h d683425a27 completely untested stats code vor 4 Jahren
sti.c ba5958df42 base64 decoder vor 1 Jahr
sti.h ba5958df42 base64 decoder vor 1 Jahr
string.c 0d46af308a apparently missing includes in string.c vor 5 Monaten
string.h cb6a6f722e missing system headers vor 3 Monaten
string_int.c 21dcd2df95 fixed resize bug in string_int vor 1 Jahr
string_int.h 0e0e2ff2a7 string internment table changes to keep definition hidden vor 2 Jahren
svec.c 3b1f7c8a09 stable vec. not very configurable atm. vor 1 Jahr
svec.h 3b1f7c8a09 stable vec. not very configurable atm. vor 1 Jahr
talloc.c a56a8a925f cleaned up macros in hash.c vor 4 Jahren
talloc.h aed8b7086f a couple string fns for parsing c vor 3 Jahren
test.c f0e141c800 strrchr for utf8 vor 1 Jahr
utf.c 5215f86c4b recursive_glob() vor 1 Jahr
utf.h 7dbda9d2fb much better hash table macros vor 1 Jahr
vec.c fbd6499d20 compatibility fixes vor 4 Wochen
vec.h ca39d3cbef VEC_RM macros off-by-one vor 4 Monaten

README.md

sti

General extension library for C. No dependencies beyond common POSIX platform headers. "[st]andard library, [i]zzy", in the same vein as stb.

#include "sti/sti.h" and compile sti/sti.c to get everything at once, or select individual pairs a la carte.

(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 -O2/3.

Some of the _EACH() loop macros use typeof, a gcc-specific extension. I am not currently aware of a workaround for clang.

Features

  • Auto-sizing array/vector<>/"stretchy buffer"
  • Open-addressing hash table
  • Red-black tree
  • Sets
  • Min/max heap
  • Custom memory allocators
    • Memory pool using non-reserved virtual memory maps
    • Arena allocator using non-reserved virtual memory maps
    • talloc (tree allocator; simple wrapper around malloc)
  • S-expression parser
  • Generic, configurable shunting-yard algorithm to RPN
  • Filesystem utlities:
    • List files in directory
    • Walk directories recursively with callback
    • Path manipulation functions
  • String helpers
    • UTF-8/32 versions of [most] of the C std lib.
    • String splitting
  • Basic statitistics calculation
  • Miscellaneous math helpers
  • Miscellaneous Public Domain hash functions
  • Configurable state-machine based lexer generator

Most of the data structures use macro magic to be relatively type-safe and avoid void* casting where possible. Acknowledgements to nothings/Sean Barrett for the concept.

TODO

  • Documentation
  • sexp could use some love:
    • Escaped chars string support
    • More api helper fns
    • Named arguments
  • Basic tests for important fns