DPTLib
DPTLib copied to clipboard
My C libraries
DPTLib
version 0.4.0
© David Thomas, 2013-2022
Overview
DPTLib is my platform independent C library. It contains a wide variety of functions, formed of various portable C code that I've written for PrivateEye, MotionMasks and other projects. Please consider it a permanent work in progress.
Modules
Base
-
base/debug.h
— debugging and logging macros -
base/result.h
— generic function return values -
base/types.h
— fixed-width integer types -
base/utils.h
— various utilities
Databases
-
databases/digest-db.h
— digest database -
databases/filename-db.h
— filename database -
databases/tag-db.h
— tag database -
databases/pickle.h
— (de-)serialising associative arrays-
databases/pickle-reader-hash.h
— glue methods to let pickle read from hashes -
databases/pickle-writer-hash.h
— glue methods to let pickle write to hashes
-
Data Structures
-
datastruct/atom.h
— indexed data block storage -
datastruct/bitarr.h
— arrays of bits -
datastruct/bitfifo.h
— fifo which stores bits -
datastruct/bitvec.h
— flexible arrays of bits -
datastruct/cache.h
— generic single-block cache -
datastruct/hash.h
— associative arrays -
datastruct/hlist.h
— "Hanson" linked list library - from the book C Interfaces and Implementations -
datastruct/list.h
— linked lists -
datastruct/ntree.h
— n-ary trees -
datastruct/vector.h
— flexible arrays
Frame Buffer
-
framebuf/bitmap.h
— bitmap image type-
framebuf/bitmap-set.h
— a set of bitmap images
-
-
framebuf/bmfont.h
— a proportional bitmap font engine {docs} -
framebuf/colour.h
— colour definition and conversion -
framebuf/composite.h
— Porter-Duff image compositing {docs} -
framebuf/pixelfmt.h
— pixel formats -
framebuf/screen.h
— screen type
Geometry
-
geom/box.h
— box type -
geom/packer.h
— box packing for layout -
geom/layout.h
— laying out elements using the packer -
geom/point.h
— point type
I/O
-
io/stream.h
— stream system-
io/stream-stdio.h
— C standard IO stream implementation -
io/stream-mem.h
— memory block IO stream implementation -
io/stream-packbits.h
— PackBits compression - from TIFF -
io/stream-mtfcomp.h
— "move to front" adaptive compression stream - from the book Small Memory Software, Chapter 4
-
Test
-
test/txtscr.h
— text format 'screen'
Utilities
-
utils/array.h
— array utilities -
utils/barith.h
— binary arithmetic -
utils/bsearch.h
— binary searching arrays -
utils/bytesex.h
— reversing bytesex -
utils/fxp.h
— fixed point helpers -
utils/maths.h
— maths utils -
utils/pack.h
— structure packing and unpacking helpers -
utils/primes.h
— cache of prime numbers
Building
Use CMake, e.g.:
mkdir build
cd build
cmake ..
make -j4
Testing
Enable BUILD_TESTS
, e.g. using ccmake
and build. Then invoke DPTLibTest like:
./DPTLibTest -resources <path to DPTLib>
It'll spew a load of test output. If successful you'll see:
++ Tests completed in 0.9909s: 18 of 18 tests passed.