Functions
dtarray_float Fixed-capacity float array with binary serialization.
Provides heap-allocated, fixed-size storage for float values with copy, equality comparison, and pack/unpack serialization to byte buffers. The instance and element storage are allocated as a single contiguous block, keeping allocation and disposal simple.
dtarray_int32 Fixed-capacity int32 array with binary serialization.
Allocates instance and element storage as a single contiguous block for a fixed element count. Provides pack and unpack helpers that serialize the count followed by each element as little-endian int32 values, with graceful handling of element count mismatches during deserialization.
dtbuffer Heap-backed buffer descriptor with explicit ownership semantics.
Allocates or wraps a byte payload behind a lightweight descriptor that tracks length and ownership flags. Only buffers created via dtbuffer_create() free their payload on disposal; wrapped buffers leave lifecycle management to the caller. All allocations are tracked through the dtbuffer ledger channel.
dtbytes Hexadecimal formatting of byte sequences.
Formats a contiguous byte buffer as uppercase hex text grouped into 4-byte blocks separated by spaces. Intended for diagnostic output and log inspection of raw binary data.
dtchunker Buffer chunking and reassembly for size-limited transports.
Splits a source buffer into fixed-size chunks for sequential transmission and reassembles received chunks back into the original buffer. A header chunk carries total length and a magic number for stream validation. Export and import modes are mutually exclusive per session; internal buffers are reused across resets to avoid repeated allocation.
dtcore Top-level include for the dtcore library.
Umbrella header that pulls in the library version constants. Include individual module headers directly for specific functionality.
dtcore_constants Auto-generated compile-time constants for dtcore.
Defines model number ranges for randomizers, rasters, and glyphs, plus the KVP list magic number and well-known string keys used for network configuration and node identity across the library.
dtcore_helper Saturating integer arithmetic macros.
Provides in-place increment and add macros for int32_t counters that clamp at INT32_MAX rather than wrapping, suitable for monotonic counters where overflow would corrupt state.
dterr Structured error capture and chaining with source location.
Each error is a heap-allocated node carrying a code, source file, function, line number, formatted message, and an optional inner cause. Macros standardize the goto-cleanup error-propagation pattern used throughout the library. Errors can be iterated in causal order and disposed as a chain with a single call.
dteventlogger Fixed-size ring buffer for timestamped event logging.
Accumulates a bounded number of fixed-width event records, overwriting the oldest entries when full. Supports snapshot cloning for safe inspection under concurrent writes, and formats item1 records to the log facility or into an allocated string.
dtflipper Dual-buffer ownership flipping with busy-state coordination.
Manages two preallocated buffers with upper/lower roles that can be swapped when neither is held. Busy flags prevent flipping while either buffer is in use, and a critical-path variant avoids system calls for use inside interrupt or critical section contexts.
dtglyph Vtable facade for text glyph rendering.
Defines a two-method dispatch interface for blitting a text string onto a raster at a given position with a color, and for computing the bounding box of a string. Concrete implementations register a vtable keyed by model number for selection at runtime.
dtglyph_dos DOS-style fixed-width glyph renderer.
Implements the dtglyph facade for blitting text and computing bounding boxes using a DOS-style fixed-width font. Configurable width, height, and stride allow the renderer to target different raster formats.
dtguid 16-byte identifier with deterministic generation and serialization.
Provides comparison, copy, zero-check, and three levels of text formatting for 128-bit identifiers. Generation supports sequential process-local counters, hash-derived values from byte inputs or strings, and integer seeds. Pack and unpack functions integrate with the dtpackx wire format.
dtguidable Vtable facade for GUID retrieval.
Defines a single-method dispatch interface allowing any object to expose its GUID through a common handle without exposing its concrete type. Implementations register a vtable keyed by model number; callers invoke the dispatcher with an opaque handle.
dtguidable_pool Fixed-capacity pool of guidable handles with GUID lookup.
Stores a bounded set of dtguidable handles and supports insertion, removal, count query, and GUID-based search. Includes binary serialization for packing pool state into a byte buffer.
dtheaper Heap allocator with embedded length metadata and ledger tracking.
Wraps malloc with a length prefix stored ahead of the payload, enabling fill and release operations that are self-contained and safe. All allocations and frees are counted through the dtheaper ledger channel, making leaks straightforward to detect in tests.
dtkvp Resizable key-value pair list with serialization support.
Provides a growable list of string key-value pairs with set, lookup, and removal by name. Serializes to URL-encoded form, plain text, and compact binary with magic-number validation, using a doubling-growth allocation strategy to stay lean in resource-constrained environments.
dtlcg 32-bit linear congruential pseudo-random number generator.
Provides a minimal, deterministic PRNG suitable for tests, simulations, and non-security uses. State is caller-owned; seed explicitly before use. A range helper maps raw outputs to a bounded signed integer interval.
dtledger Per-class allocation accounting with counters and watermarks.
Tracks heap allocation and deallocation for named classes via static ledger instances. Records current balance, cumulative totals, and high/low watermarks for both instance counts and byte usage. Primarily used in unit tests to verify that all allocations are properly released.
dtlog Leveled logging with pluggable sink and lazy initialization.
Provides tagged, severity-leveled message emission through a lazily initialized default logger that writes to stdout. The sink, hook, and output file are all replaceable after initialization. A pre-emit hook can suppress individual messages, and dterr chain emission is built in.
dtobject Vtable facade for basic object lifecycle and identity operations.
Defines a seven-method dispatch interface covering creation, copy, disposal, equality, class-name query, interface membership, and string rendering. Implementations register a vtable keyed by model number; the facade dispatches through opaque handles, enabling generic containers and utilities to manage objects without knowing their concrete types.
dtpackable Vtable facade for polymorphic binary serialization.
Defines a four-method dispatch interface covering length query, pack, unpack, and post-unpack validation. Implementations register a vtable keyed by model number; the facade dispatches through an opaque handle, enabling generic serialization pipelines without concrete type knowledge.
dtpackx Little-endian binary pack and unpack helpers for C types.
Provides length-query, pack, and unpack functions for integers, floats, booleans, bytes, float arrays, and NUL-terminated strings using a consistent little-endian wire format. Return values are bytes consumed or written; negative indicates overflow. Macros wrap calls with automatic bounds checking and error jumps.
dtparse Strict decimal numeric parsing with full-input validation.
Parses signed 32-bit integers and double-precision floats from C strings, rejecting trailing characters, partial conversions, out-of-range values, and non-finite results. Addresses a common gap in libc parsers, which accept trailing garbage and report success.
dtpicosdk_helper RP2040 Pico SDK convenience helpers.
Provides initialization, reboot, bootloader entry, and keyboard polling wrappers for the Raspberry Pi Pico SDK. Simplifies common startup and interactive-prompt patterns used in Pico-targeted firmware.
dtrandomizer Vtable facade for polymorphic random integer generation.
Defines a three-method dispatch interface for producing the next value, resetting state, and disposing an instance. Concrete implementations register a vtable keyed by model number; callers hold an opaque handle and invoke the dispatcher without knowing the underlying algorithm.
dtrandomizer_browngrav Brownian random walk with gravitational attraction.
Generates successive integer values using a Brownian motion model with a configurable restoring force toward an attraction point. Implements the dtrandomizer, dtobject, and dtpackable facades for polymorphic use and binary serialization of configuration and state.
dtrandomizer_uniform Uniform step random walk within a bounded range.
Generates successive integer values by applying a bounded uniform random step from a home position, using an LCG for the underlying randomness. Implements the dtrandomizer, dtobject, and dtpackable facades for polymorphic use and binary serialization of configuration and state.
dtraster Vtable facade for pixel buffer operations.
Defines a dispatch interface for raster blitting, per-pixel read/write, buffer management, shape query, and compatible raster creation. Concrete implementations register a vtable keyed by model number, allowing framebuffers, sprites, and format-converting rasters to be used interchangeably. Includes primitive filled and outlined rectangle drawing built on top of the facade.
dtraster_rgb565 RGB565 raster implementation with optional big-endian storage.
Provides a pixel buffer in 16-bit RGB565 format, implementing the dtraster, dtobject, and dtpackable facades. Configurable byte order allows targeting displays that expect big-endian packed pixels alongside the default little-endian layout.
dtraster_rgba8888 RGBA8888 raster implementation.
Provides a heap-backed pixel buffer in 32-bit RGBA8888 format, implementing the dtraster, dtobject, and dtpackable facades. Supports blit, per-pixel read/write, buffer assignment, and new-buffer allocation.
dtrgb565 Packed RGB565 color type with accessors and named constants.
Stores a color as a packed 16-bit value with inline constructors from 8-bit RGB components or a raw value. Component accessors expand 5- and 6-bit fields back to 8-bit values. Includes round-trip conversion to and from dtrgba8888_t and a set of named color constants.
dtrgba8888 32-bit RGBA color type with inline constructors and named constants.
Stores a color as four separate 8-bit R, G, B, and A bytes with an inline constructor and a macro initializer. Includes a comparison function and a full set of named color constants matching the RGB565 palette.
dtringfifo Lock-free SPSC byte ring buffer over caller-provided storage.
Implements single-producer single-consumer FIFO byte transfer using atomic head and tail indices with no OS locking. Storage is caller-supplied; the ring does not allocate. Partial push and pop are supported, with the return value indicating actual bytes transferred.
dtrpc Vtable facade for KVP-based remote procedure calls.
Defines a single-method dispatch interface where request and response are both dtkvp_list_t instances. A refusal flag allows the callee to decline without treating the exchange as an error. Implementations register a vtable keyed by model number for selection at runtime.
dtrpc_registry Growable list of RPC handles.
Maintains a heap-allocated array of dtrpc_handle values that grows in fixed increments as handles are added. Provides indexed retrieval and bulk disposal of all registered handles.
dtstr Heap-allocated string formatting and concatenation.
Provides printf-style string construction into new heap allocations and appending of formatted text to existing ones with optional separators. All allocations are tracked through the dtstr ledger channel; pair every allocation with a matching dispose call.
dttimeout Timeout duration type and sentinel constants.
Defines a signed 32-bit millisecond timeout type with FOREVER (-1) and NOWAIT (0) sentinels for use in blocking and polling call sites.
dttrap Conditional diagnostic accumulator with count-triggered callback.
Accumulates formatted text lines and increments a counter on each event. Once the count reaches a configured threshold, trapping stops and an optional callback fires. Intended for capturing the first N occurrences of a repeating condition during debugging.
dtunittest Minimal C unit-test harness for suites, assertions, and reporting.
Provides suite and test runners, a pattern filter, per-test setup and teardown hooks, and optional ledger auditing for leak detection. Assert macros cover boolean, integer, float, pointer, string, and byte-buffer comparisons, all jumping to a caller-defined cleanup label on failure.
dtvtable Model-indexed vtable registry for runtime dispatch.
Maps 32-bit model numbers to vtable pointers using caller-provided parallel arrays. Registration is idempotent for existing mappings. Lookup uses a linear scan up to the first empty slot. Macros reduce the boilerplate of defining and dispatching vtable-based APIs.
dtwallclock Wallclock duration formatting helpers.
Formats integer microsecond or millisecond durations into fixed-width HH:MM:SS strings suitable for log output and diagnostics. Avoids dynamic allocation by writing into caller-provided storage.
dtcore Library flavor and version identification macros.
Provides DTCORE_VERSION string constants that identify the library build at runtime. Used by dtruntime and diagnostic routines to report the active library variant in environment tables and log output.
This file is processed by tooling in the automated build system. It's important to maintain the structure and formatting of the version macros for compatibility with version parsing scripts.