From e4bbedd87ad6462301c30357c9e87a7ee6be8fd0 Mon Sep 17 00:00:00 2001 From: Lion Kortlepel Date: Wed, 14 Jan 2026 23:49:43 +0100 Subject: docs: complete readme --- README.md | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4fb18d3..ceb9fd6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,45 @@ # LS Ring-Buffer Queue -Single-header queue implementation in ANSI C. +Minimal, single-header ring-buffer queue for C. -- Header-only +- Type-safe via macro code generation (not macro function calls) - ANSI C +- Header-only +- Ring-buffer (no memory copying, no allocations) +- Full coverage tests (branches, lines, functions) + +## Quick Start + +1. Copy `ls_queue.h` to your project. +2. Define any number of queue types: + ```c + LS_QUEUE_TYPE_INLINE(int, int_queue, 32) + ``` + + **OR** for separate declaration/implementation: + + ```c + // In header: + LS_QUEUE_TYPE_DECL(int, int_queue, 32) + + // In source file: + LS_QUEUE_TYPE_IMPL(int, int_queue, 32) + ``` +3. Use the queue with normal C function calls: + ```c + int_queue q; + int_queue_init(&q); + if (!int_queue_push(&q, 42)) { + // push failed, queue full, handle that here + } + int val; + if (int_queue_pop(&q, &val)) { + // use val + } + ``` + +See [`ls_queue.h`](ls_queue.h) for detailed documentation and usage patterns. + +## License + +MIT. -- cgit