use std::sync::{Arc, Mutex};
use mumu::parser::interpreter::{Interpreter, DynamicFn, DynamicFnInfo};
use mumu::parser::types::{FunctionValue, Value};
mod extract;
pub use extract::*;
pub fn register_all(interp: &mut Interpreter) {
let func: DynamicFn = Arc::new(Mutex::new(extract_text_bridge));
let info = DynamicFnInfo::new(func, true); interp.register_dynamic_function_ex("html:extract_text", info);
interp.set_variable(
"html:extract_text",
Value::Function(Box::new(FunctionValue::Named("html:extract_text".to_string()))),
);
}
#[cfg(not(target_arch = "wasm32"))]
#[no_mangle]
pub extern "C" fn Cargo_lock(
interp_ptr: *mut ::std::ffi::c_void,
_extra: *const ::std::ffi::c_void,
) -> i32 {
if interp_ptr.is_null() {
eprintln!("[html plugin] null interpreter pointer");
return 1;
}
let interp = unsafe { &mut *(interp_ptr as *mut Interpreter) };
register_all(interp);
0
}