module
Termisu::FFI
Overview
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.
Defined in:
termisu/ffi/abi.crtermisu/ffi/core.cr
termisu/ffi/ffi.cr
termisu/ffi/version.cr
Constant Summary
-
ABI_VERSION =
1_u32 -
PREEDIT_TEXT_CAPACITY =
32 -
Inline capacity (bytes) for ABI::Event preedit text. Composing strings are short (a handful of codepoints); longer preedit is truncated on a boundary.
Class Method Summary
- .clear(handle : UInt64) : Status
- .clear_error_message : Nil
- .close(handle : UInt64) : Status
- .copy_last_error(buffer : Pointer(UInt8), buffer_len : UInt64) : UInt64
- .create(sync_updates : Bool) : UInt64
- .destroy(handle : UInt64) : Status
- .disable_enhanced_keyboard(handle : UInt64) : Status
- .disable_mouse(handle : UInt64) : Status
- .disable_timer(handle : UInt64) : Status
- .enable_enhanced_keyboard(handle : UInt64) : Status
- .enable_mouse(handle : UInt64) : Status
- .enable_system_timer_ms(handle : UInt64, interval_ms : Int32) : Status
- .enable_timer_ms(handle : UInt64, interval_ms : Int32) : Status
- .hide_cursor(handle : UInt64) : Status
- .last_error_length : UInt64
- .poll_event(handle : UInt64, timeout_ms : Int32, out_event : Pointer(ABI::Event)) : Status
- .render(handle : UInt64) : Status
- .set_cell(handle : UInt64, x : Int32, y : Int32, codepoint : UInt32, style : Pointer(ABI::CellStyle)) : Status
-
.set_cells(handle : UInt64, ops : Pointer(ABI::CellOp), count : UInt64) : Status
Applies
countcell writes with a single guard + registry fetch. - .set_cursor(handle : UInt64, x : Int32, y : Int32) : Status
- .set_sync_updates(handle : UInt64, enabled : Bool) : Status
- .show_cursor(handle : UInt64) : Status
- .size(handle : UInt64, out_size : Pointer(ABI::Size)) : Status
- .sync(handle : UInt64) : Status
- .sync_updates?(handle : UInt64) : UInt8
Class Method Detail
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.