Skip to main content

mumuflow/
lib.rs

1// flow/src/lib.rs
2
3use std::ffi::c_void;
4use mumu::parser::interpreter::Interpreter;
5
6mod trans;
7mod compose;
8mod slice;
9mod to_array;
10mod filter;
11mod throttle;
12
13pub use trans::register_flow_trans;
14pub use compose::register_flow_compose;
15pub use slice::register_flow_slice;
16pub use to_array::register_flow_to_array;
17pub use filter::register_flow_filter;
18pub use throttle::register_flow_throttle;
19
20#[export_name = "Cargo_lock"]
21pub unsafe extern "C" fn cargo_lock(interp_ptr: *mut c_void, extra_str: *const c_void) -> i32 {
22    if interp_ptr.is_null() {
23        return 1;
24    }
25    let interp = &mut *(interp_ptr as *mut Interpreter);
26
27    if interp.is_verbose() {
28        eprintln!("[flow:Cargo.lock] => bridging flow plugin...");
29        if !extra_str.is_null() {
30            use std::ffi::CStr;
31            let c_str = CStr::from_ptr(extra_str as *const i8);
32            eprintln!("[flow:Cargo.lock] => extra arg='{}'", c_str.to_string_lossy());
33        }
34    }
35
36    register_flow_trans(interp);
37    register_flow_compose(interp);
38    register_flow_slice(interp);
39    register_flow_to_array(interp);
40    register_flow_filter(interp);
41    register_flow_throttle(interp);
42
43    if interp.is_verbose() {
44        eprintln!("[flow:Cargo.lock] => done bridging flow plugin");
45    }
46
47    0
48}