C ABI bridge for non-Crystal integrations.
Exposes stable C symbols, opaque handles, flat structs, and explicit
status/error handling for FFI callers.
Lives at ffi/ffi.cr (not termisu/ffi.cr) so the require "./termisu/*"
glob in src/termisu.cr cannot reach it - plain require "termisu"
consumers must not link the exported C symbols. Build src/termisu_ffi.cr
to produce libtermisu.
Class methods
bracketed_paste?(handle : UInt64) : UInt8
Sourceclear(handle : UInt64) : Status
Sourceclose(handle : UInt64) : Status
Sourcecopy_last_error(buffer : Pointer(UInt8), buffer_len : UInt64) : UInt64
Sourcecreate(sync_updates : Bool) : UInt64
Sourcedestroy(handle : UInt64) : Status
Sourcedisable_bracketed_paste(handle : UInt64) : Status
Sourcedisable_enhanced_keyboard(handle : UInt64) : Status
Sourcedisable_mouse(handle : UInt64) : Status
Sourcedisable_timer(handle : UInt64) : Status
Sourceenable_bracketed_paste(handle : UInt64) : Status
Sourceenable_enhanced_keyboard(handle : UInt64) : Status
Sourceenable_mouse(handle : UInt64) : Status
Sourceenable_system_timer_ms(handle : UInt64, interval_ms : Int32) : Status
Sourceenable_timer_ms(handle : UInt64, interval_ms : Int32) : Status
Sourceenhanced_keyboard?(handle : UInt64) : UInt8
Sourcehide_cursor(handle : UInt64) : Status
Sourcemouse_enabled?(handle : UInt64) : UInt8
Query counterparts for the three input modes. Without these a C or JS caller
can toggle a mode but never ask whether it is on, and has to shadow the state
itself — which desynchronizes the moment with_mode suspends and restores.
Sourcepoll_event(handle : UInt64, timeout_ms : Int32, out_event : Pointer(ABI::Event)) : Status
Sourcerender(handle : UInt64) : Status
Sourceset_cell(handle : UInt64, x : Int32, y : Int32, codepoint : UInt32, style : Pointer(ABI::CellStyle)) : Status
Sourceset_cells(handle : UInt64, ops : Pointer(ABI::CellOp), count : UInt64) : Status
Applies count cell writes with a single guard + registry fetch.
Per-op semantics match set_cell: ops rejected by the buffer (out of
bounds, unfittable wide char, zero-width char) are skipped and the call
returns Rejected after processing every op; malformed ops (invalid
codepoint, color mode, or attribute bits) raise and abort the batch with
Error, leaving prior ops applied. ops may be null only when count is 0.
Sourceset_cursor(handle : UInt64, x : Int32, y : Int32) : Status
Sourceset_sync_updates(handle : UInt64, enabled : Bool) : Status
Sourceshow_cursor(handle : UInt64) : Status
Sourcesize(handle : UInt64, out_size : Pointer(ABI::Size)) : Status
Sourcesync(handle : UInt64) : Status
Sourcesync_updates?(handle : UInt64) : UInt8
Source