1use std::sync::{Arc, Mutex};
3use mumu::parser::interpreter::{Interpreter, DynamicFn, DynamicFnInfo};
4use mumu::parser::types::{FunctionValue, Value};
5
6mod extract;
7pub use extract::*;
8
9pub fn register_all(interp: &mut Interpreter) {
12 let func: DynamicFn = Arc::new(Mutex::new(extract_text_bridge));
14 let info = DynamicFnInfo::new(func, true); interp.register_dynamic_function_ex("html:extract_text", info);
16
17 interp.set_variable(
19 "html:extract_text",
20 Value::Function(Box::new(FunctionValue::Named("html:extract_text".to_string()))),
21 );
22}
23
24#[cfg(not(target_arch = "wasm32"))]
27#[no_mangle]
28pub extern "C" fn Cargo_lock(
29 interp_ptr: *mut ::std::ffi::c_void,
30 _extra: *const ::std::ffi::c_void,
31) -> i32 {
32 if interp_ptr.is_null() {
33 eprintln!("[html plugin] null interpreter pointer");
34 return 1;
35 }
36 let interp = unsafe { &mut *(interp_ptr as *mut Interpreter) };
37 register_all(interp);
38 0
39}