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

David Ulrich 81ce451e65 less lexer logging, parser generator syntax changed? преди 1 година
dwarf 1566a5afc0 pedantic fixes преди 4 години
hash_fns ad98d1218c Add sha256 and sha512 hash functions преди 4 години
lexer ca436af643 work in progress of C parser преди 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 преди 1 година
test 81ce451e65 less lexer logging, parser generator syntax changed? преди 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 преди 1 година
err.h a23db7f116 parenthesis support for rpn converter преди 4 години
fs.c cea9524df9 fix bug where an invalid directory name would be iterated under certain conditions преди 1 година
fs.h 361c5abd25 general matrix functions преди 1 година
hash.c cea3e90f43 fixed hash table bug преди 1 година
hash.h 32cf5ffd8c fixed HT_getp преди 1 година
heap.c aeb139e7e0 heap improvements преди 1 година
heap.h aeb139e7e0 heap improvements преди 1 година
ini.c 9d1eb56746 ini file reader преди 2 години
ini.h 9d1eb56746 ini file reader преди 2 години
initest.ini 9d1eb56746 ini file reader преди 2 години
macros.h 79f6846952 added missing file преди 3 години
matrix.c 6badfa1609 fixes and additions to matrix functions преди 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 години
mempool.c 1566a5afc0 pedantic fixes преди 4 години
mempool.h 1566a5afc0 pedantic fixes преди 4 години
misc.c 4113c0aa2b -fstrict-prototypes compatibility преди 4 години
misc.h aed8b7086f a couple string fns for parsing c преди 3 години
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 40243a0b3e fixed uninitialized field преди 2 години
sets.h 4113c0aa2b -fstrict-prototypes compatibility преди 4 години
sexp.c a7205d374e bunch of more stuf преди 5 години
sexp.h a7205d374e bunch of more stuf преди 5 години
stats.c d683425a27 completely untested stats code преди 4 години
stats.h d683425a27 completely untested stats code преди 4 години
sti.c ba5958df42 base64 decoder преди 1 година
sti.h ba5958df42 base64 decoder преди 1 година
string.c 67ee36a494 Switch from bit array to bit fields/mask for table lookup преди 1 година
string.h 7bfe62fde8 str functions преди 1 година
string_int.c 21dcd2df95 fixed resize bug in string_int преди 1 година
string_int.h 0e0e2ff2a7 string internment table changes to keep definition hidden преди 2 години
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 преди 1 година
utf.c 5215f86c4b recursive_glob() преди 1 година
utf.h 7dbda9d2fb much better hash table macros преди 1 година
vec.c 295bee2fa0 VEC_CAT преди 4 години
vec.h 882765075d vec_inc improvement преди 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