nothings / single_file_libs

List of single-file C/C++ libraries.
8.96k stars 588 forks source link

dvector.h, lonesha256.h, randomic.h, parray.h, and swrap.h #118

Open BareRose opened 6 years ago

BareRose commented 6 years ago

Because I really liked the single-file public domain approach to libraries employed by the main stb family (and many others on this list) I ended up using it for my personal-use libraries, some of which ended up getting published on my github. All but two of my repos are such libraries (those two being twrap and uwrap, both are obsoleted by swrap anyway).

All of them are CC0 - the most lawyer-friendly way of spelling "public domain", more so than unlicense actually - and truly single-file, the included LICENSE files are mostly for github's benefit as it doesn't properly mark the repos as CC0 without them. They should be listed as "public domain" because that's what they are.

Below some brief summaries and suggestions for listing categories:

dvector.h Based off ccVector, which I originally got off this very list. Does basically the same thing but with additional frustum-related functionality and is IMO better than ccVector overall (though I'm clearly biased). Obviously belongs in the "vectors" category.

lonesha256.h Single sha256 function for when that's all the crypto you need. Probably the biggest addition to the list as crypto-related or even just general hashing libraries are hard to come by in single-file PD form. Could go either under "hashing" or "crypto", preferrably "crypto".

randomic.h If you like public domain, you'll adore smallprng, which is the algorithm randomic uses (because for some stupid reason Mersenne Twister isn't public domain). It additionally lets you easily integrate it into your multithreaded applications through the use of atomics. Might need a new "PRNG" category, if that needs to be avoided "multithreading" is the next best fit.

parray.h Really neat - if I do say so myself - multi-purpose data structure for pointers. It's a dynamically-sized array, a stack, a queue, and a binary-searchable list all in one. Obviously belongs in the "data structures" category.

~~darray.h Same as parray but for those cases where you have to store your data directly in your array instead of pointers to your data. Could even replace parray but I still use both in my projects. Obvious "data structures" is obvious.~~

swrap.h Socket wrapper that neatly wraps-up platform-specifcs about sockets and provides a (slightly) simplified interface with automatic IPv4 vs IPv6 agnosticity. More of a pure wrapper than the other ones on the list and supports both UDP and TCP. Belongs in "network" category with the other socket wrappers.