flow-mumu 0.1.2

Stream tranform tools plugin for the Lava language
Documentation
// flow/src/lib.rs

use std::ffi::c_void;
use mumu::parser::interpreter::Interpreter;

mod trans;
mod compose;
mod slice;
mod to_array;
mod filter;
mod throttle;

pub use trans::register_flow_trans;
pub use compose::register_flow_compose;
pub use slice::register_flow_slice;
pub use to_array::register_flow_to_array;
pub use filter::register_flow_filter;
pub use throttle::register_flow_throttle;

#[export_name = "Cargo_lock"]
pub unsafe extern "C" fn cargo_lock(interp_ptr: *mut c_void, extra_str: *const c_void) -> i32 {
    if interp_ptr.is_null() {
        return 1;
    }
    let interp = &mut *(interp_ptr as *mut Interpreter);

    if interp.is_verbose() {
        eprintln!("[flow:Cargo.lock] => bridging flow plugin...");
        if !extra_str.is_null() {
            use std::ffi::CStr;
            let c_str = CStr::from_ptr(extra_str as *const i8);
            eprintln!("[flow:Cargo.lock] => extra arg='{}'", c_str.to_string_lossy());
        }
    }

    register_flow_trans(interp);
    register_flow_compose(interp);
    register_flow_slice(interp);
    register_flow_to_array(interp);
    register_flow_filter(interp);
    register_flow_throttle(interp);

    if interp.is_verbose() {
        eprintln!("[flow:Cargo.lock] => done bridging flow plugin");
    }

    0
}