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

izzy 44bbc1d770 fixed missing typedefs to use stdint types 1 ماه پیش
dwarf 1566a5afc0 pedantic fixes 4 سال پیش
hash_fns ad98d1218c Add sha256 and sha512 hash functions 4 سال پیش
lexer da943df7a5 memcpy experiments 1 ماه پیش
parser 81ce451e65 less lexer logging, parser generator syntax changed? 1 سال پیش
scripting c921594825 fixed a unch of encoding and alignment bugs 3 سال پیش
string_utils d805238a81 fs write_whole_file 2 سال پیش
test 812e0e8868 strtof 1 ماه پیش
.gitignore 7dbda9d2fb much better hash table macros 1 سال پیش
LICENSE d6f6c74b64 Initial commit 5 سال پیش
README.md f761fd33d2 more heap functions 4 سال پیش
b64.c ba29a5f706 initial pass at base64_encode 1 سال پیش
b64.h ba29a5f706 initial pass at base64_encode 1 سال پیش
build.sh aed8b7086f a couple string fns for parsing c 3 سال پیش
conventions.h f16efae2ef coding conventions, todo list of string functions 2 سال پیش
err.h a23db7f116 parenthesis support for rpn converter 5 سال پیش
fs.c caa456783e read_whole_dir functions 1 سال پیش
fs.h caa456783e read_whole_dir functions 1 سال پیش
hash.c fbd6499d20 compatibility fixes 3 ماه پیش
hash.h caa456783e read_whole_dir functions 1 سال پیش
heap.c aeb139e7e0 heap improvements 1 سال پیش
heap.h 39b3db3344 improvements to s-expression parser 10 ماه پیش
ini.c 9d1eb56746 ini file reader 2 سال پیش
ini.h 9d1eb56746 ini file reader 2 سال پیش
initest.ini 9d1eb56746 ini file reader 2 سال پیش
macros.h 341558379f vec naming updates, set bugfix 1 ماه پیش
matrix.c 2b5abfc46c meh 1 سال پیش
matrix.h 6badfa1609 fixes and additions to matrix functions 1 سال پیش
memarena.c a7205d374e bunch of more stuf 5 سال پیش
memarena.h a7205d374e bunch of more stuf 5 سال پیش
memcpy.c da943df7a5 memcpy experiments 1 ماه پیش
mempool.c 1566a5afc0 pedantic fixes 4 سال پیش
mempool.h fbd6499d20 compatibility fixes 3 ماه پیش
misc.c 197298b3be bugfix epoch ts helper 9 ماه پیش
misc.h cb6a6f722e missing system headers 5 ماه پیش
rb.c 6230a20751 red-black trees 4 سال پیش
rb.h 04b125e9fe heap structure and basic functions 4 سال پیش
ring.c 1566a5afc0 pedantic fixes 4 سال پیش
ring.h e1386d6e03 real path fs helper 4 سال پیش
rpn.c 55b5b4c665 bug fixes 3 سال پیش
rpn.h 1566a5afc0 pedantic fixes 4 سال پیش
sets.c 341558379f vec naming updates, set bugfix 1 ماه پیش
sets.h 4113c0aa2b -fstrict-prototypes compatibility 4 سال پیش
sexp.c 39b3db3344 improvements to s-expression parser 10 ماه پیش
sexp.h 39b3db3344 improvements to s-expression parser 10 ماه پیش
slot.c 44bbc1d770 fixed missing typedefs to use stdint types 1 ماه پیش
slot.h 44bbc1d770 fixed missing typedefs to use stdint types 1 ماه پیش
spinlock.h 5478d9f8fe spinlock code 1 ماه پیش
stats.c d683425a27 completely untested stats code 4 سال پیش
stats.h d683425a27 completely untested stats code 4 سال پیش
sti.c 88b033d88b slot vector 1 ماه پیش
sti.h 88b033d88b slot vector 1 ماه پیش
string.c 0d46af308a apparently missing includes in string.c 8 ماه پیش
string.h cb6a6f722e missing system headers 5 ماه پیش
string_int.c 21dcd2df95 fixed resize bug in string_int 2 سال پیش
string_int.h 0e0e2ff2a7 string internment table changes to keep definition hidden 2 سال پیش
strtof.c 812e0e8868 strtof 1 ماه پیش
svec.c 3b1f7c8a09 stable vec. not very configurable atm. 1 سال پیش
svec.h 3b1f7c8a09 stable vec. not very configurable atm. 1 سال پیش
talloc.c a56a8a925f cleaned up macros in hash.c 4 سال پیش
talloc.h aed8b7086f a couple string fns for parsing c 3 سال پیش
test.c f0e141c800 strrchr for utf8 2 سال پیش
utf.c 5215f86c4b recursive_glob() 2 سال پیش
utf.h 7dbda9d2fb much better hash table macros 1 سال پیش
vec.c fbd6499d20 compatibility fixes 3 ماه پیش
vec.h 341558379f vec naming updates, set bugfix 1 ماه پیش

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