#![allow(unsafe_code)]
use super::report::{report_bool, report_i32};
use crate::panic_guard::FfiBoundary;
use crate::runtime::EngineContext;
use crate::sys;
#[doc(hidden)]
#[unsafe(no_mangle)]
pub unsafe extern "C" fn rust__handler__check(
ctx: *mut EngineContext,
thd: *const sys::THD,
check_opt: *const sys::HaCheckOpt,
out: *mut i32,
) -> bool {
FfiBoundary::run_default(false, || {
let engine = unsafe { &mut *ctx }.engine_mut();
let (thd, check_opt) = unsafe { (thd.as_ref(), check_opt.as_ref()) };
report_i32(out, engine.check(thd, check_opt))
})
}
#[doc(hidden)]
#[unsafe(no_mangle)]
pub unsafe extern "C" fn rust__handler__repair(
ctx: *mut EngineContext,
thd: *const sys::THD,
check_opt: *const sys::HaCheckOpt,
out: *mut i32,
) -> bool {
FfiBoundary::run_default(false, || {
let engine = unsafe { &mut *ctx }.engine_mut();
let (thd, check_opt) = unsafe { (thd.as_ref(), check_opt.as_ref()) };
report_i32(out, engine.repair(thd, check_opt))
})
}
#[doc(hidden)]
#[unsafe(no_mangle)]
pub unsafe extern "C" fn rust__handler__optimize(
ctx: *mut EngineContext,
thd: *const sys::THD,
check_opt: *const sys::HaCheckOpt,
out: *mut i32,
) -> bool {
FfiBoundary::run_default(false, || {
let engine = unsafe { &mut *ctx }.engine_mut();
let (thd, check_opt) = unsafe { (thd.as_ref(), check_opt.as_ref()) };
report_i32(out, engine.optimize(thd, check_opt))
})
}
#[doc(hidden)]
#[unsafe(no_mangle)]
pub unsafe extern "C" fn rust__handler__analyze(
ctx: *mut EngineContext,
thd: *const sys::THD,
check_opt: *const sys::HaCheckOpt,
out: *mut i32,
) -> bool {
FfiBoundary::run_default(false, || {
let engine = unsafe { &mut *ctx }.engine_mut();
let (thd, check_opt) = unsafe { (thd.as_ref(), check_opt.as_ref()) };
report_i32(out, engine.analyze(thd, check_opt))
})
}
#[doc(hidden)]
#[unsafe(no_mangle)]
pub unsafe extern "C" fn rust__handler__check_and_repair(
ctx: *mut EngineContext,
thd: *const sys::THD,
out: *mut bool,
) -> bool {
FfiBoundary::run_default(false, || {
let engine = unsafe { &mut *ctx }.engine_mut();
report_bool(out, engine.check_and_repair(unsafe { thd.as_ref() }))
})
}
#[doc(hidden)]
#[unsafe(no_mangle)]
pub unsafe extern "C" fn rust__handler__check_for_upgrade(
ctx: *mut EngineContext,
check_opt: *const sys::HaCheckOpt,
out: *mut i32,
) -> bool {
FfiBoundary::run_default(false, || {
let engine = unsafe { &mut *ctx }.engine_mut();
report_i32(out, engine.check_for_upgrade(unsafe { check_opt.as_ref() }))
})
}