libxml-rs 0.1.0-alpha.12

Phase 10: xmllint + xmlcatalog. Native-Rust forensic reimplementation of libxml2+libxslt with C ABI drop-in replacement. Full xmllint and xmlcatalog CLIs (debug, copy, format, valid, xpath, xinclude, html, noent, compact text nodes, catalog shell) with upstream exit codes, byte-identical differential parity against libxml2 2.15.3 across a 44-case suite, 1110 tests passing, XSLT 1.0 engine + EXSLT + all prior surfaces.
Documentation
//! Internal version management (§83, §84).
//!
//! Backs the public C ABI version APIs (xmlLibxmlVersion, xmlCheckVersion, etc.)
//! with Rust-side version information.
//!
//! # Phase 0 status
//!
//! Minimal stub implementation returning the target compatibility version (libxml2 2.12.x).

use std::os::raw::c_char;
use std::sync::OnceLock;

static VERSION_STRING: OnceLock<Vec<u8>> = OnceLock::new();

/// Return a pointer to a static C string containing the libxml version.
pub fn version_string() -> *const c_char {
    let bytes = VERSION_STRING.get_or_init(|| {
        // Target libxml2 2.15.3 compatibility.
        b"2.15.3\0".to_vec()
    });
    bytes.as_ptr() as *const c_char
}

/// Check that the library version is at least the requested version.
/// Returns 0 if compatible, -1 if not.
pub fn check_version(version: std::os::raw::c_int) -> std::os::raw::c_int {
    let our_version = 2 * 10000 + 15 * 100 + 3; // 2.15.3
    if our_version >= version {
        0
    } else {
        -1
    }
}