primer3-sys 0.1.0

Raw FFI bindings to the primer3 C library
Documentation
//! Raw FFI bindings to the primer3 C library.
//!
//! This crate provides unsafe, low-level bindings generated by `bindgen`.
//! Most users should use the `primer3` crate instead, which provides a safe,
//! idiomatic Rust API on top of these bindings.

#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(clippy::all, clippy::pub_underscore_fields)]

include!(concat!(env!("OUT_DIR"), "/bindings.rs"));

// Manual FFI declarations for dpal (dynamic programming alignment).
// bindgen cannot handle the `dpal_ssm` typedef (`int[UCHAR_MAX+1][UCHAR_MAX+1]`)
// so we declare the types and functions manually.
//
// Re-exported at the crate root so callers use `primer3_sys::dpal_args` etc.
#[allow(clippy::all)]
mod dpal_ffi {
    pub const DPAL_MAX_ALIGN: usize = 1600;
    pub const DPAL_ERROR_SCORE: ::std::os::raw::c_int = ::std::os::raw::c_int::MIN;
    pub const DPAL_LOCAL: ::std::os::raw::c_int = 0;
    pub const DPAL_GLOBAL_END: ::std::os::raw::c_int = 1;
    pub const DPAL_GLOBAL: ::std::os::raw::c_int = 2;
    pub const DPAL_LOCAL_END: ::std::os::raw::c_int = 3;

    pub type dpal_ssm = [[::std::os::raw::c_int; 256]; 256];

    #[repr(C)]
    pub struct dpal_args {
        pub check_chars: ::std::os::raw::c_int,
        pub fail_stop: ::std::os::raw::c_int,
        pub flag: ::std::os::raw::c_int,
        pub force_generic: ::std::os::raw::c_int,
        pub force_long_generic: ::std::os::raw::c_int,
        pub force_long_maxgap1: ::std::os::raw::c_int,
        pub gap: ::std::os::raw::c_int,
        pub gapl: ::std::os::raw::c_int,
        pub max_gap: ::std::os::raw::c_int,
        pub score_max: ::std::os::raw::c_int,
        pub ssm: dpal_ssm,
    }

    #[repr(C)]
    pub struct dpal_results {
        pub msg: *const ::std::os::raw::c_char,
        pub path: [[::std::os::raw::c_int; 2]; DPAL_MAX_ALIGN],
        pub path_length: ::std::os::raw::c_int,
        pub align_end_1: ::std::os::raw::c_int,
        pub align_end_2: ::std::os::raw::c_int,
        pub score: f64,
        pub sec_struct: *mut ::std::os::raw::c_char,
    }

    pub const DPM_FAST: ::std::os::raw::c_int = 0;
    pub const DPM_GENERAL: ::std::os::raw::c_int = 1;
    pub const DPM_DEBUG: ::std::os::raw::c_int = 2;
    pub const DPM_STRUCT: ::std::os::raw::c_int = 3;

    unsafe extern "C" {
        pub fn dpal_set_default_nt_args(a: *mut dpal_args);
        pub fn dpal_set_h_nt_matrix(a: *mut dpal_args);
        pub fn dpal_set_ambiguity_code_matrix(a: *mut dpal_args) -> ::std::os::raw::c_int;
        pub fn set_dpal_args(a: *mut dpal_args);
        pub fn dpal(
            s1: *const ::std::os::raw::c_uchar,
            s2: *const ::std::os::raw::c_uchar,
            args: *const dpal_args,
            mode: ::std::os::raw::c_int,
            out: *mut dpal_results,
        );
    }
}

pub use dpal_ffi::*;