sleigh-compiler 2.0.0

Rust bindings for the Ghidra SLEIGH compiler. Used to compile processor .slaspec files into .sla files
Documentation
pub use bridge::*;

#[cxx::bridge]
mod bridge {
    #[derive(Debug)]
    struct CompileResponse {
        pub exit_code: i32,
        pub errors: Vec<String>,
        pub warnings: Vec<String>,
    }

    struct PreprocessorDefine {
        pub name: String,
        pub value: String,
    }

    unsafe extern "C++" {
        include!("sleigh-compiler/src/ffi/cpp/bridge.hh");

        type SleighCompileProxy;

        #[rust_name = "new_sleigh_compiler"]
        fn construct_new_sleigh_compile() -> UniquePtr<SleighCompileProxy>;

        // Allowing too many arguments to mirror the C++ API
        #[rust_name = "set_all_options"]
        #[allow(clippy::too_many_arguments)]
        fn setAllOptionsProxy(
            self: Pin<&mut SleighCompileProxy>,
            defines: &CxxVector<PreprocessorDefine>,
            unnecessaryPcodeWarning: bool,
            lenientConflict: bool,
            allCollisionWarning: bool,
            allNopWarning: bool,
            deadTempWarning: bool,
            enforceLocalKeyWord: bool,
            largeTemporaryWarning: bool,
            caseSensitiveRegisterNames: bool,
            debugOutput: bool,
        );

        #[rust_name = "run_compilation"]
        fn run_compilation_proxy(
            self: Pin<&mut SleighCompileProxy>,
            filein: Pin<&CxxString>,
            fileout: Pin<&CxxString>,
        ) -> Result<CompileResponse>;
    }
}