CI / test (push) Failing after 15s
components.txt listed it but no source existed, so just modules skipped it and the picker said 'Module manager not found'. Panel button + popup: loaded instances (click to unload), available modules (click to load), Browse... Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
86 lines
2.8 KiB
MoonBit
86 lines
2.8 KiB
MoonBit
// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT!
|
|
///|
|
|
/// A loadable module found on the module search path.
|
|
pub(all) struct ModuleInfo {
|
|
id : String; name : String; path : String; loaded : UInt
|
|
}
|
|
///|
|
|
/// A module instance currently loaded in the panel, in panel order.
|
|
pub(all) struct InstanceInfo {
|
|
slot : String; module_ : String; name : String
|
|
}
|
|
///|
|
|
pub fn available() -> Array[ModuleInfo] {
|
|
|
|
let return_area = mbt_ffi_malloc(8)
|
|
wasmImportAvailable(return_area);
|
|
|
|
let array : Array[ModuleInfo] = [];
|
|
for index = 0; index < (mbt_ffi_load32((return_area) + 4)); index = index + 1 {
|
|
let iter_base = (mbt_ffi_load32((return_area) + 0)) + (index * 28)
|
|
|
|
let result = mbt_ffi_ptr2str(mbt_ffi_load32((iter_base) + 0), mbt_ffi_load32((iter_base) + 4))
|
|
|
|
let result0 = mbt_ffi_ptr2str(mbt_ffi_load32((iter_base) + 8), mbt_ffi_load32((iter_base) + 12))
|
|
|
|
let result1 = mbt_ffi_ptr2str(mbt_ffi_load32((iter_base) + 16), mbt_ffi_load32((iter_base) + 20))
|
|
|
|
array.push(ModuleInfo::{id : result, name : result0, path : result1, loaded : (mbt_ffi_load32((iter_base) + 24)).reinterpret_as_uint()})
|
|
}
|
|
mbt_ffi_free(mbt_ffi_load32((return_area) + 0))
|
|
let ret = array
|
|
mbt_ffi_free(return_area)
|
|
return ret
|
|
|
|
}
|
|
///|
|
|
pub fn loaded() -> Array[InstanceInfo] {
|
|
|
|
let return_area = mbt_ffi_malloc(8)
|
|
wasmImportLoaded(return_area);
|
|
|
|
let array : Array[InstanceInfo] = [];
|
|
for index = 0; index < (mbt_ffi_load32((return_area) + 4)); index = index + 1 {
|
|
let iter_base = (mbt_ffi_load32((return_area) + 0)) + (index * 24)
|
|
|
|
let result = mbt_ffi_ptr2str(mbt_ffi_load32((iter_base) + 0), mbt_ffi_load32((iter_base) + 4))
|
|
|
|
let result0 = mbt_ffi_ptr2str(mbt_ffi_load32((iter_base) + 8), mbt_ffi_load32((iter_base) + 12))
|
|
|
|
let result1 = mbt_ffi_ptr2str(mbt_ffi_load32((iter_base) + 16), mbt_ffi_load32((iter_base) + 20))
|
|
|
|
array.push(InstanceInfo::{slot : result, module_ : result0, name : result1})
|
|
}
|
|
mbt_ffi_free(mbt_ffi_load32((return_area) + 0))
|
|
let ret = array
|
|
mbt_ffi_free(return_area)
|
|
return ret
|
|
|
|
}
|
|
///|
|
|
/// Load the module file at `path` into the panel (any number of instances).
|
|
pub fn load_module(path : String) -> Unit {
|
|
|
|
let ptr = mbt_ffi_str2ptr(path)
|
|
wasmImportLoadModule(ptr, path.length());
|
|
mbt_ffi_free(ptr)
|
|
|
|
}
|
|
///|
|
|
/// Unload one loaded instance, freeing its panel space.
|
|
pub fn unload_instance(slot : String) -> Unit {
|
|
|
|
let ptr = mbt_ffi_str2ptr(slot)
|
|
wasmImportUnloadInstance(ptr, slot.length());
|
|
mbt_ffi_free(ptr)
|
|
|
|
}
|
|
///|
|
|
/// Ask the host to show its native file chooser for a .wasm elsewhere on disk.
|
|
pub fn browse() -> Unit {
|
|
|
|
wasmImportBrowse();
|
|
|
|
}
|
|
|