CI / test (push) Failing after 16s
moon-plasma / moonplasma / MoonPlasma / Moon Plasma become chandra / Chandra everywhere: the WIT package (chandra:desktop, chandra:host, chandra:wm), the MoonBit module (chandra/desktop) and generated bindings, the Rust host, identifiers (ChandraCompositor), the session script (chandra-session) and desktop entry (chandra.desktop), config and data paths ($XDG_CONFIG_HOME/chandra, share/chandra/modules), env vars (CHANDRA_*), UI strings, docs and tests. The test fixture components are rebuilt against the renamed WIT. Saved panel.edn and state.edn are still read from the old $XDG_CONFIG_HOME/moon-plasma until the first save writes the new copy. The remote repository keeps its experiments/moon-plasma name for now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPL5hi3L9oVBoRd373Qr4n
289 lines
7.6 KiB
MoonBit
289 lines
7.6 KiB
MoonBit
// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT!
|
|
///|
|
|
/// Result of `recvmsg`: byte count (-1 would-block, -2 error, 0 EOF), an fd received over
|
|
/// SCM_RIGHTS (-1 when none), and the bytes read.
|
|
pub(all) struct Received {
|
|
count : Int; fd : Int; data : FixedArray[Byte]
|
|
}
|
|
///|
|
|
/// Listen on a unix socket at `path`; -1 on failure.
|
|
pub fn unix_listen(path : String) -> Int {
|
|
|
|
let ptr = mbt_ffi_str2ptr(path)
|
|
let result : Int = wasmImportUnixListen(ptr, path.length());
|
|
let ret = result
|
|
mbt_ffi_free(ptr)
|
|
return ret
|
|
|
|
}
|
|
///|
|
|
/// Accept a pending client (non-blocking); -1 when none.
|
|
pub fn unix_accept(listen_fd : Int) -> Int {
|
|
|
|
let result : Int = wasmImportUnixAccept(listen_fd);
|
|
let ret = result
|
|
return ret
|
|
|
|
}
|
|
///|
|
|
pub fn unix_connect(path : String) -> Int {
|
|
|
|
let ptr = mbt_ffi_str2ptr(path)
|
|
let result : Int = wasmImportUnixConnect(ptr, path.length());
|
|
let ret = result
|
|
mbt_ffi_free(ptr)
|
|
return ret
|
|
|
|
}
|
|
///|
|
|
pub fn close_fd(fd : Int) -> Unit {
|
|
|
|
wasmImportCloseFd(fd);
|
|
|
|
}
|
|
///|
|
|
pub fn unlink(path : String) -> Unit {
|
|
|
|
let ptr = mbt_ffi_str2ptr(path)
|
|
wasmImportUnlink(ptr, path.length());
|
|
mbt_ffi_free(ptr)
|
|
|
|
}
|
|
///|
|
|
/// 1 when `fd` is readable within `timeout-ms`, 0 on timeout, <0 on error.
|
|
pub fn poll_read(fd : Int, timeout_ms : Int) -> Int {
|
|
|
|
let result : Int = wasmImportPollRead(fd, timeout_ms);
|
|
let ret = result
|
|
return ret
|
|
|
|
}
|
|
///|
|
|
pub fn recvmsg(fd : Int, max_len : UInt) -> Received {
|
|
|
|
let return_area = mbt_ffi_malloc(16)
|
|
wasmImportRecvmsg(fd, (max_len).reinterpret_as_int(), return_area);
|
|
|
|
let result = mbt_ffi_ptr2bytes(mbt_ffi_load32((return_area) + 8), mbt_ffi_load32((return_area) + 12))
|
|
let ret = Received::{count : mbt_ffi_load32((return_area) + 0), fd : mbt_ffi_load32((return_area) + 4), data : result}
|
|
mbt_ffi_free(return_area)
|
|
return ret
|
|
|
|
}
|
|
///|
|
|
/// Send `data`, with `send-fd` (or -1) as SCM_RIGHTS; bytes sent or <0.
|
|
pub fn sendmsg(fd : Int, data : FixedArray[Byte], send_fd : Int) -> Int {
|
|
|
|
let ptr = mbt_ffi_bytes2ptr(data)
|
|
|
|
let result : Int = wasmImportSendmsg(fd, ptr, data.length(), send_fd);
|
|
let ret = result
|
|
mbt_ffi_free(ptr)
|
|
return ret
|
|
|
|
}
|
|
///|
|
|
pub fn memfd_create(name : String, size : Int) -> Int {
|
|
|
|
let ptr = mbt_ffi_str2ptr(name)
|
|
let result : Int = wasmImportMemfdCreate(ptr, name.length(), size);
|
|
let ret = result
|
|
mbt_ffi_free(ptr)
|
|
return ret
|
|
|
|
}
|
|
///|
|
|
pub fn pwrite(fd : Int, data : FixedArray[Byte], offset : Int) -> Int {
|
|
|
|
let ptr = mbt_ffi_bytes2ptr(data)
|
|
|
|
let result : Int = wasmImportPwrite(fd, ptr, data.length(), offset);
|
|
let ret = result
|
|
mbt_ffi_free(ptr)
|
|
return ret
|
|
|
|
}
|
|
///|
|
|
/// Copy `size` bytes of the file behind `fd` (mapped read-only by the host).
|
|
pub fn mmap_read(fd : Int, size : Int) -> FixedArray[Byte] {
|
|
|
|
let return_area = mbt_ffi_malloc(8)
|
|
wasmImportMmapRead(fd, size, return_area);
|
|
|
|
let result = mbt_ffi_ptr2bytes(mbt_ffi_load32((return_area) + 0), mbt_ffi_load32((return_area) + 4))
|
|
let ret = result
|
|
mbt_ffi_free(return_area)
|
|
return ret
|
|
|
|
}
|
|
///|
|
|
/// Copy `len` bytes starting at `offset` of the file behind `fd` (a client's buffer inside its
|
|
/// shared pool; a pool can be far larger than any one buffer, so never read from byte 0).
|
|
pub fn mmap_read_at(fd : Int, offset : Int, len : Int) -> FixedArray[Byte] {
|
|
|
|
let return_area = mbt_ffi_malloc(8)
|
|
wasmImportMmapReadAt(fd, offset, len, return_area);
|
|
|
|
let result = mbt_ffi_ptr2bytes(mbt_ffi_load32((return_area) + 0), mbt_ffi_load32((return_area) + 4))
|
|
let ret = result
|
|
mbt_ffi_free(return_area)
|
|
return ret
|
|
|
|
}
|
|
///|
|
|
pub fn read_file(path : String) -> FixedArray[Byte] {
|
|
|
|
let ptr = mbt_ffi_str2ptr(path)
|
|
let return_area = mbt_ffi_malloc(8)
|
|
wasmImportReadFile(ptr, path.length(), return_area);
|
|
|
|
let result = mbt_ffi_ptr2bytes(mbt_ffi_load32((return_area) + 0), mbt_ffi_load32((return_area) + 4))
|
|
let ret = result
|
|
mbt_ffi_free(ptr)
|
|
mbt_ffi_free(return_area)
|
|
return ret
|
|
|
|
}
|
|
///|
|
|
pub fn write_file(path : String, data : FixedArray[Byte]) -> Int {
|
|
|
|
let ptr = mbt_ffi_str2ptr(path)
|
|
|
|
let ptr0 = mbt_ffi_bytes2ptr(data)
|
|
|
|
let result : Int = wasmImportWriteFile(ptr, path.length(), ptr0, data.length());
|
|
let ret = result
|
|
mbt_ffi_free(ptr)
|
|
mbt_ffi_free(ptr0)
|
|
return ret
|
|
|
|
}
|
|
///|
|
|
/// Contents of a small /proc or /sys file ("" when unreadable).
|
|
pub fn read_proc(path : String) -> FixedArray[Byte] {
|
|
|
|
let ptr = mbt_ffi_str2ptr(path)
|
|
let return_area = mbt_ffi_malloc(8)
|
|
wasmImportReadProc(ptr, path.length(), return_area);
|
|
|
|
let result = mbt_ffi_ptr2bytes(mbt_ffi_load32((return_area) + 0), mbt_ffi_load32((return_area) + 4))
|
|
let ret = result
|
|
mbt_ffi_free(ptr)
|
|
mbt_ffi_free(return_area)
|
|
return ret
|
|
|
|
}
|
|
///|
|
|
pub fn mkdir_p(path : String) -> Bool {
|
|
|
|
let ptr = mbt_ffi_str2ptr(path)
|
|
let result : Int = wasmImportMkdirP(ptr, path.length());
|
|
let ret = (result != 0)
|
|
mbt_ffi_free(ptr)
|
|
return ret
|
|
|
|
}
|
|
///|
|
|
/// Names of the *.desktop files directly in `dir`.
|
|
pub fn list_desktop_files(dir : String) -> Array[String] {
|
|
|
|
let ptr = mbt_ffi_str2ptr(dir)
|
|
let return_area = mbt_ffi_malloc(8)
|
|
wasmImportListDesktopFiles(ptr, dir.length(), return_area);
|
|
|
|
let array : Array[String] = [];
|
|
for index = 0; index < (mbt_ffi_load32((return_area) + 4)); index = index + 1 {
|
|
let iter_base = (mbt_ffi_load32((return_area) + 0)) + (index * 8)
|
|
|
|
let result = mbt_ffi_ptr2str(mbt_ffi_load32((iter_base) + 0), mbt_ffi_load32((iter_base) + 4))
|
|
|
|
array.push(result)
|
|
}
|
|
mbt_ffi_free(mbt_ffi_load32((return_area) + 0))
|
|
let ret = array
|
|
mbt_ffi_free(ptr)
|
|
mbt_ffi_free(return_area)
|
|
return ret
|
|
|
|
}
|
|
///|
|
|
pub fn sleep_ms(ms : Int) -> Unit {
|
|
|
|
wasmImportSleepMs(ms);
|
|
|
|
}
|
|
///|
|
|
/// Milliseconds on a monotonic clock (event timestamps).
|
|
pub fn monotonic_ms() -> UInt64 {
|
|
|
|
let result : Int64 = wasmImportMonotonicMs();
|
|
let ret = (result).reinterpret_as_uint64()
|
|
return ret
|
|
|
|
}
|
|
///|
|
|
/// Print a line to the host's stderr.
|
|
pub fn log(message : String) -> Unit {
|
|
|
|
let ptr = mbt_ffi_str2ptr(message)
|
|
wasmImportLog(ptr, message.length());
|
|
mbt_ffi_free(ptr)
|
|
|
|
}
|
|
///|
|
|
pub fn getpid() -> Int {
|
|
|
|
let result : Int = wasmImportGetpid();
|
|
let ret = result
|
|
return ret
|
|
|
|
}
|
|
///|
|
|
/// 0 year, 1 month (1-12), 2 day, 3 hour, 4 minute, 5 second, 6 weekday (0 = Sunday).
|
|
pub fn wall_time_field(which : Int) -> Int {
|
|
|
|
let result : Int = wasmImportWallTimeField(which);
|
|
let ret = result
|
|
return ret
|
|
|
|
}
|
|
///|
|
|
pub fn getenv(name : String) -> String {
|
|
|
|
let ptr = mbt_ffi_str2ptr(name)
|
|
let return_area = mbt_ffi_malloc(8)
|
|
wasmImportGetenv(ptr, name.length(), return_area);
|
|
|
|
let result = mbt_ffi_ptr2str(mbt_ffi_load32((return_area) + 0), mbt_ffi_load32((return_area) + 4))
|
|
let ret = result
|
|
mbt_ffi_free(ptr)
|
|
mbt_ffi_free(return_area)
|
|
return ret
|
|
|
|
}
|
|
///|
|
|
pub fn has_exe(name : String) -> Bool {
|
|
|
|
let ptr = mbt_ffi_str2ptr(name)
|
|
let result : Int = wasmImportHasExe(ptr, name.length());
|
|
let ret = (result != 0)
|
|
mbt_ffi_free(ptr)
|
|
return ret
|
|
|
|
}
|
|
///|
|
|
/// Launch `cmd` detached with WAYLAND_DISPLAY set to `display`.
|
|
pub fn spawn(cmd : String, display : String) -> Bool {
|
|
|
|
let ptr = mbt_ffi_str2ptr(cmd)
|
|
|
|
let ptr0 = mbt_ffi_str2ptr(display)
|
|
let result : Int = wasmImportSpawn(ptr, cmd.length(), ptr0, display.length());
|
|
let ret = (result != 0)
|
|
mbt_ffi_free(ptr)
|
|
mbt_ffi_free(ptr0)
|
|
return ret
|
|
|
|
}
|
|
|