Single-file public domain libraries for C.
(Well, technically double-file — each library comes as a .h and .c pair.)
| library | files | description |
|---|---|---|
| Base | Base.h, Base.c |
This is my standard library replacement and the essential piece that ties the rest of the codebase together, originally inspired by Mr. 4th. It depends on nothing*, and everything depends on it. |
| LongGFX | LongGFX.h, LongGFX_Win32.c |
OS-abstracted library for graphics and multimedia applications, offering a simple API for window creation, message boxes, and input handling. |
| LongD3D11 | LongD3D11.h, LongD3D11_Win32.c |
A reusable D3D11 layer that initializes the graphics context and sets up all required function pointers. |
| LongOGL | LongOGL.h, LongOGL_Win32.c |
A reusable OpenGL layer that initializes the graphics context and sets up all required function pointers. |
| LongRender | LongRender.h, LongRender.c, LongRender_OGL.c |
A batched 2D quad renderer for colored and textured rectangles with rounded corners and soft edges, as well as gradients. |
| LongTest | LongTest.h |
A simple, single-file framework for running tests. |
| LongScanner | LongScanner.h, LongScanner.c |
A scanner and tokenizer for UTF-8-encoded text, suitable for building more advanced lexers and parsers. Also includes CSV and JSON parsers built using it. |
| CLex | CLex.h, CLex.c |
An experimental non-recursive C parser that parses types (without a type table) and expressions (with proper precedence). |
| Metagen | Metagen.c, Metagen.h, Metamain.c |
A metaprogramming system that consumes Metadesk files to generate code and data tables. Inspired by Ryan Fleury. |
*It still depends on <string.h> for memset, memcpy, and memcmp, and on <math.h> for sin, cos, tan, and atan.
Here are a few example programs built using the libraries above—some turned out more useful than I thought:
Showcases most of the features in Base. For example, logging:
Showcases the 2D renderer's capability:
A simple program that benchmarks your system's memory bandwidth, inspired by @mmozeiko.
A CLI tool for globbing file names or contents. It’s multi-threaded and uses Win32 IOCP with Async IO for file loading.
This is my favorite tool by far. Once you get used to the extended syntax, it feels much faster and more natural than findstr.