The goal of this project is to experiment and learn through the implementation of common algorithms, data structures, and libraries written in portable C(99) aiming to get a unified API and predictable behavior between multiple platforms.
- Windows: MSVC, WSL, Clang, MinGW 32/64, Cygwin
- Ubuntu: GCC, Clang
- Raspbian: GCC
- GalliumOS (Braswell): GCC, Clang
Architectures on these platforms: x86, x64, and ARM
The following are the set of modules that are "usable", this means the functions defined in the module are tested and implemented across the different platforms, but the module may not be fully implemented.
These are common C data types and algorithms with an abstraction layer over them
Cstring
: Provides a set of functions to operate onchar*
Array
: Dynamic array implementation that uses a headerstruct
to track the number of elements and the data type sizeSlice
: An abstraction over a contiguous sequence ofconst
bytes
Set of containers implemented using opaque pointers. All the containers (and other modules like Slice
) support Iterator
through function pointers
Hashtable
: A generic implementation that uses function pointers to hash, allocate, and deallocate keys and valuesList
: A doubly linked listVector
: Similar to the array module but using an opaque pointer
Set of functions to work on sequences of bytes representing text
Regex
: A regex engine using NFAs (based on Russ Cox's articles on regular expressions)Unicode
: A work-in-progress implementation of the Unicode Standard version 9.0 (Normalization and Case-Folding are the big TODOs of this module)
Modules that work with different OS primitives
Thread
: Provides an abstraction layer overpthread
andWin32
to work with threads, locks, and sync methodsSignal
: Basic and cross-platform signal handlingTimer
: High-resolution timersIO
: Set of functions to work with files and directories
To compile the project you need to get the latest release version of the sbs build system from here based on your platform.
- GCC or Clang
- Clang
- Visual Studio Developer Command Prompt: You will need the Microsoft C++ (MSVC) compiler toolset for the particular architecture you want to compile for. For more information check this Microsoft page: Build C/C++ code on the command line.
Based on your platform run sbs build linux-gcc-release
or sbs build win-clang-release
(or the -debug
version if needed).
If you want to compile with Clang under Linux, you can run:
sbs build linux-gcc-release -tc=clang
I am a curious and self-taught programmer that loves to "destroy" the black-box to know how all the abstractions day after day I work upon work to better understand the benefits, the limitations, and to get an accurate and expected outcome from them.
For this project, I chose C because of 2 reasons: it is a simple yet powerful language that runs almost anywhere, and I want to improve my skills on memory management, pointers, portability, efficiency, and security while programming on it. Being that my day-to-day work is not in C, I think this may be the best way to learn it, and, on the other side, all the knowledge I gain with C is tremendously helpful to understand how other languages work under the hood.
Yes, sure. Being it is a project to experiment and learn, I encourage you to fork the project and contribute to it, or participate through the Issues.
On every module, I try to document the functions and data structures, but the truth is, some modules might be outdated or just lacking documentation.
Yes, check the tests
folder and navigate through the different test suites. There you will find usages of the different modules functions. Also projects like sbs and Zenit heavily rely on fllib.
MIT