LibLS

LS Libraries

Lion’s Standard (LS) libraries is a collection of header-only ANSI C (C89) libraries.

These aim to be:

All of these libraries are MIT licensed.

Container libraries use macros to generate type-specific implementations. All generated code is macro-free.

Libraries

Vector

A dynamic array (vector).

Repo: https://github.com/libls/vec

Example usage:

LS_VEC_INLINE(int, int_vector)

// somewhere in the same file
int_vector vec;
int_vector_init(&vec);
int_vector_push(&vec, 42);
// use vec.data, vec.size, etc.
int_vector_clear(&vec);

Queue

A static (non-allocating) queue.

Repo: https://github.com/libls/queue

Example usage:

LS_QUEUE_INLINE(int, int_queue, 32)

// somewhere in the same file
int_queue q;
int_queue_init(&q);
int_queue_push(&q, 42);
int val;
if (int_queue_pop(&q, &val)) {
    // do something with val
}

Test

A minimal unit testing framework.

Repo: https://github.com/libls/test

Example usage:

#define LS_TEST_IMPLEMENTATION
#include "ls_test.h"

TEST_CASE(test_add) {
    ASSERT_EQ(add(1, 2), 3, "%d");
    return 0;
}

TEST_MAIN

AI usage notice: The extent to which AI/LLMs are used in the development and maintenance of these libraries is documented here.