C library implementing various parts of Vieter.
 
 
 
Go to file
GreekStapler 72fea90e13 fix: strcat can not be used on uninitialised strings in non-musl environments. 2023-01-28 10:28:41 +00:00
.woodpecker test: also test with -O3 which can produce extra errors 2023-01-26 12:24:34 +01:00
include refactor: Decided to not return char** in function that creates the package description after all, now returns char*. 2023-01-27 22:17:57 +00:00
src fix: strcat can not be used on uninitialised strings in non-musl environments. 2023-01-28 10:28:41 +00:00
test fix: Somehow, test file changed line endings to CRLF. Changed it back to LF. 2023-01-27 22:24:54 +00:00
.clangd chore: add some more config files 2023-01-18 16:58:33 +01:00
.gitignore test: started porting cron tests 2023-01-18 13:59:10 +01:00
Makefile chore: fix merge marker in makefile 2023-01-28 09:58:32 +01:00
README.md chore: fix merge marker in makefile 2023-01-28 09:58:32 +01:00

README.md

libvieter

This library powers part of Vieter, most notably the sections that can easily be implemented in C (or just parts I want to implement in C because it's fun).

The goal of this library is to be as self-contained as possible; data structures should be implemented manually if possible.

See the source code for the list of modules.

Development

Compilation

Everything is handled by the provided Makefile. To compile the static library, simply run make.

Required libraries

Libvieter requires libarchive.

Project structure

Each module has its own subdirectory inside src, e.g. src/cron. This directory contains the actual implementation of a module, along with any internally used header files. Each internal function should be defined in a header file, as to make testing these possible.

Each module should also have its own header file inside the include directory. This header file defines the public API that the library exposes for this specific module.

Any code in a module may only import internal headers from that module, along with any of the public API header files. Modules should not depend on each other's internal implementationns.

Each module should contain a README describing its contents.

All file names, function names... (even internals) should follow snake case convention and have a prefix unique to that module, starting with vieter_. For example, the cron modules uses the vieter_cron_ prefix for everything.

Header files should only import what they explicitely need. If some function is only used in a .c file, the import should be placed in the .c file instead.

Testing

This library uses Acutest for its tests. Tests should be placed in the test subdirectory, further divided into directories that correspond to those in src. Test files should begin with test_, and their format should follow the expected format for Acutest.

Each test_ is compiled separately into a binary, linked with libvieter. A test file can import any of the public API header files, along with any header files defined in its respective module. This allows testing internal functions.

To run the tests, simply run make test. If you wish to only run a specific test binary, you can find them in build/test.

compile_commands.json

Clangd requires a compile_commands.json to function properly. You can generate it using bear:

make clean
bear -- make
bear --append -- make build-test

This will create a compile_commands.json file in the current directory.