• v0.5.0 2338b3e92c

    v0.5.0 Stable

    sezieru released this 2025-11-05 09:49:03 +00:00 | 2 commits to main since this release

    Signed by sezieru
    SSH key fingerprint: SHA256:SX8aEgM8s/W8UI4mrbqqdj3129LpDpaK6uq+sZvfJ/Y

    🧮 libb20 v0.5.0 — First Full Release (C90 + C++20 + Parity Suite)

    This marks libb20’s first official release and its transition from a standalone C90 proof-of-concept into a multi-language, reusable codec library with formal parity validation.


    🧩 Core Components

    🧱 C90 Library (libb20.c / libb20.h)

    • Full ANSI C90 implementation of the base-20 codec.

    • Shared math and UTF-8 helpers; clean re-entrant API.

    • b20_status_str() for human-readable diagnostics.

    • Reference CLI (kb20-c90ref) with:

      • encode / decode
      • --text / --bin modes
      • --zero <code point> / --alphabet <20 code points>
    • Big-endian (MSB-first) format, serving as the canonical specification.


    ⚙️ C++20 Library (libb20.hpp / libb20.cpp)

    • b20::codec class providing idiomatic C++ API.

    • b20::status, error_category(), and status_message() integrate with std::error_code.

    • b20::alphabet and b20::options for configurable alphabets and binary-digit modes.

    • Stream manipulators:

      std::cin  >> b20::encode(codec) >> std::string;
      std::cout << b20::decode(codec) << std::string;
      
    • 100 % on-wire compatibility with the C90 implementation.

    🖥 Reference CLI (kb20-cpp20ref)

    • Command parity with C90 (encode/decode).
    • Modes: --text (default) and --bin|--binary-digits.
    • Options: --zero <utf8-scalar> or --alphabet <20 utf8-scalars>.
    • Reads stdin / writes stdout (both binary-safe).
    • Uses generic helpers for robust I/O and UTF-8 parsing.

    🧰 Generic Helpers (contrib/)

    • utf8_helpers – compact UTF-8 decoder/encoder (parse_n_exact, parse_prefix_n).
    • io_helpers – portable read_all, write_all, read_exact, read_until.
    • Independent of libb20; reusable across projects.

    🧪 Parity Test Suite (tests/test_kb20.sh)

    Cross-implementation tests ensuring C90 ↔ C++20 compatibility.

    Coverage

    • Text-mode roundtrip C → C++ and C++ → C.

    • Custom alphabets:

      • --zero override (e.g. Kaktovik U+1D2C0)
      • Full 20-scalar map.
    • Binary-digits (--bin) mode with random payloads (byte-for-byte).

    • Boundary sizes: 4 / 5 / 6 / 9 / 10 / 11 bytes.

    Usage

    make -C src/c
    make -C src/cpp
    tests/test_kb20.sh "Sample text to encode"
    # or:
    echo "..." | tests/test_kb20.sh
    

    🐞 Fixes & Validation

    • Corrected base-20 division remainder (cur % base vs cur & base).
    • Validated all alphabets (20 distinct scalars; no ‘-’; no surrogates).
    • Verified full parity across all CLI modes.

    🧱 Build System

    • Unified Makefiles for C90 and C++20.
    • debug and clean targets; automatic dependency generation.
    • contrib/ included via -Icontrib.

    📂 Layout

    .
    ├── src
    │   ├── c            # C90 library + kb20-c90ref
    │   │   └── contrib  # generic UTF-8 helpers
    │   └── cpp          # C++20 libb20 + kb20-cpp20ref
    │       └── contrib  # generic UTF-8 and I/O helpers
    └── tests            # cross-implementation parity suite
    

    Verification

    • Encoding/decoding parity confirmed across all test inputs.
    • UTF-8 scalars and binary-digit modes verified.
    • Clean builds with clang C90 & clang++ C++20 (-Wall -Wextra -W -pedantic -O2).

    🏁 Release Summary

    v0.5.0 establishes the full architectural baseline for libb20:

    • Stable C90 specification.
    • Modern C++20 library.
    • Reusable generic helpers.
    • Automated cross-impl parity suite.

    All future language ports (Python, TypeScript, etc.) will target this release for compatibility.

    Downloads