bullno1 / bk

Base library for C99

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bk - Base library for C99

License

Modules

macro.h

Common macros that I have copied and pasted across way too many projects.

allocator.h

Common allocator interface, inspired by bkaradzic/bx.

An implementation using C runtime is provided in default_allocator.h.

assert.h

Assertion with an explanation message. It also provides "critical assertions" which cannot be disabled.

dlist.h

Intrusive doubly-linked list.

array.h

Dynamically sized array, inspired by stretchy_buffer but with support for non-default alignments.

fs.h

Common filesystem abstraction. The goal is to remove direct file access from libraries.

There are several implementations:

  • crt: provides direct access to the filesystem through C runtime's functions.
  • ro: wraps an underlying filesystem and make it read-only.
  • vfs: a "filesystem manager". Other filesystems can be mounted at different paths of this filesystem. In other words, it's a very primitive version of PhysicsFS without any archive codec.
  • prefix: adds a prefix to all paths. It can be used together with vfs to create a "bind mount".
  • mem: Use a memory buffer to store file content.

printf.h

printf-like functions which are compatible with fs streams.

Building

No special code generation or configure steps are required. Just add all the files in src to any build tool.

Individual modules can also be used separately in "single-header style" without building the whole library. For example, to use array.h in your project, put this in one source file:

#define  BK_IMPLEMENTATION
#include <bk/array.h>

About

Base library for C99

License:BSD 2-Clause "Simplified" License


Languages

Language:C 77.0%Language:Python 12.0%Language:C++ 10.2%Language:Makefile 0.8%