module
Termisu::FFI::Conversions
Defined in:
termisu/ffi/conversions.crConstant Summary
-
ATTRIBUTE_MASK =
(((((((Attribute::Bold.value | Attribute::Underline.value) | Attribute::Reverse.value) | Attribute::Blink.value) | Attribute::Dim.value) | Attribute::Cursive.value) | Attribute::Hidden.value) | Attribute::Strikethrough.value).to_u16
Class Method Summary
- .attr_from_bits(bits : UInt16) : Attribute
-
.blank_event : Termisu::FFI::ABI::Event
Fully zeroed None event, deterministic across every field.
- .codepoint_to_char(codepoint : UInt32) : Char
- .color_from_abi(color : Termisu::FFI::ABI::Color) : Color
- .style_from_abi(style : Termisu::FFI::ABI::CellStyle) : Tuple(Color, Color, Attribute)
- .style_from_ptr(style : Pointer(Termisu::FFI::ABI::CellStyle)) : Tuple(Color, Color, Attribute)
- .to_abi_event(event : Event::Any) : Termisu::FFI::ABI::Event
-
.write_abi_event(event : Event::Any, out_event : Pointer(Termisu::FFI::ABI::Event)) : Nil
Writes
eventinto the caller's struct in place, without zeroing it first. -
.write_blank_event(out_event : Pointer(Termisu::FFI::ABI::Event)) : Nil
No-event marker (poll timeout): readers only touch event_type and modifiers for a None event; key_char = -1 is kept as the "no char" sentinel blank_event has always guaranteed.
Class Method Detail
Fully zeroed None event, deterministic across every field. The FFI poll hot path uses write_blank_event instead, which skips the memset.
Writes event into the caller's struct in place, without zeroing it
first. ABI readers dispatch on event_type and only touch that type's
fields (see readEvent in javascript/core/src/structs.ts): event_type and
modifiers are always read; key_, mouse_, resize_, tick_, mode_* and
preedit_* only for their own type, with resize_old_/mode_previous
gated behind their has_ flags. Each writer below sets exactly that
read-set (writing explicit zeros for absent optional fields), so any
other byte in the caller's buffer may keep stale content.
No-event marker (poll timeout): readers only touch event_type and modifiers for a None event; key_char = -1 is kept as the "no char" sentinel blank_event has always guaranteed.