#![doc = include_str!("../README.md")]
use std::os::raw::{c_char, c_ulong};
mod config;
mod detector;
mod error;
mod ffi;
mod status;
pub use config::SpotConfig;
pub use detector::SpotDetector;
pub use error::{SpotError, SpotResult};
pub use status::SpotStatus;
pub use ffi::{FreeFn, FrexpFn, LdexpFn, MallocFn, Math2Fn, MathFn};
pub use std::os::raw::c_double as SpotFloat;
pub fn version() -> String {
let mut buffer = vec![0u8; 256];
unsafe {
ffi::libspot_version(buffer.as_mut_ptr() as *mut c_char, buffer.len() as c_ulong);
}
String::from_utf8_lossy(&buffer)
.trim_end_matches('\0')
.to_string()
}
pub unsafe fn set_math_functions(log: Option<MathFn>, exp: Option<MathFn>, pow: Option<Math2Fn>) {
ffi::set_math_functions(log, exp, pow);
}
pub unsafe fn set_float_utils(ldexp: Option<LdexpFn>, frexp: Option<FrexpFn>) {
ffi::set_float_utils(ldexp, frexp);
}