From de4421a4d722f21a1206051a2fdf3cd3d52ad4f0 Mon Sep 17 00:00:00 2001 From: zeichensystem <83899451+zeichensystem@users.noreply.github.com> Date: Sun, 21 Dec 2025 20:51:24 +0100 Subject: [PATCH] Add README --- LICENSE.txt | 9 +++++++++ README.txt | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 LICENSE.txt create mode 100644 README.txt diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..71a8603 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,9 @@ +Copyright 2025 ~fruit + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +cf. https://opensource.org/license/mit (last-retrieved 2025-12-21) diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..854f5e0 --- /dev/null +++ b/README.txt @@ -0,0 +1,55 @@ +libguf - typesafe C99 containers +-------------------------------------------------------------------------------- +1. Intro +---------- +"Look mom, no void pointers!" + +This is a work in progress of my personal header only datastructure and +algorithm utility library which (ab)uses the C pre-processor to achieve +typesafety. + +There is no reason this exists apart from "this is kind of fun and silly", +you should just use C++ :) + +It uses a similar approach of "include parametrisation" to achieve strongly +typed data structures as used in https://github.com/ludocode/pottery + +Look at "src/test/example.c" for an example. + + +2. How to build +----------------- +Setup CMake with +$ cmake -DCMAKE_BUILD_TYPE=Debug -S . -B build/debug + +And build the example with +$ cmake --build build/debug/ --target libguf_example + + +3. Tests +---------- +The tests in src/test are written in C++20, which made it easy to just use the +STL types in order to check their behaviour against the custom libguf C types. + + +4. What it includes +-------------------- +- guf_dbuf.h: a dynamic array (like std::vector) +- guf_dict.h: a hashtable (elements are stored contiguously, like python3's + compact dicts) +- guf_str.h: a string-buffer with short-string-optimisation (guf_str) and + a string-view (guf_str_view) type +- guf_rand.h: random number algorithms +- guf_sort.h: sort algorithms +- guf_math.h: math I guess? +- guf_linalg.h: linear algebra types and algorithms for computer graphics etc. +- ... and more + + +5. License +----------- +MIT (cf. LICENSE.txt). + + +-------------------------------------------------------------------------------- +~fruit