-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolve issues when linking two IPASIR libraries
- Loading branch information
Showing
11 changed files
with
102 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,5 @@ version = "0.1.0" | |
edition = "2021" | ||
|
||
[dependencies] | ||
cc = "1.0" | ||
paste = "1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,87 @@ | ||
#[macro_export] | ||
use cc::Build; | ||
pub use paste::paste; | ||
|
||
#[macro_export(local_inner_macros)] | ||
macro_rules! ipasir_definitions { | ||
() => { | ||
extern "C" { | ||
pub fn ipasir_signature() -> *const std::ffi::c_char; | ||
pub fn ipasir_init() -> *mut std::ffi::c_void; | ||
pub fn ipasir_release(slv: *mut std::ffi::c_void); | ||
pub fn ipasir_add(slv: *mut std::ffi::c_void, lit: i32); | ||
pub fn ipasir_assume(slv: *mut std::ffi::c_void, lit: i32); | ||
pub fn ipasir_solve(slv: *mut std::ffi::c_void) -> std::ffi::c_int; | ||
pub fn ipasir_val(slv: *mut std::ffi::c_void, lit: i32) -> i32; | ||
pub fn ipasir_failed(slv: *mut std::ffi::c_void, lit: i32) -> std::ffi::c_int; | ||
pub fn ipasir_set_terminate( | ||
($prefix:ident) => { | ||
paste! { | ||
extern "C" { | ||
pub fn [<$prefix _signature>]() -> *const std::ffi::c_char; | ||
pub fn [<$prefix _init>]() -> *mut std::ffi::c_void; | ||
pub fn [<$prefix _release>](slv: *mut std::ffi::c_void); | ||
pub fn [<$prefix _add>](slv: *mut std::ffi::c_void, lit: i32); | ||
pub fn [<$prefix _assume>](slv: *mut std::ffi::c_void, lit: i32); | ||
pub fn [<$prefix _solve>](slv: *mut std::ffi::c_void) -> std::ffi::c_int; | ||
pub fn [<$prefix _val>](slv: *mut std::ffi::c_void, lit: i32) -> i32; | ||
pub fn [<$prefix _failed>](slv: *mut std::ffi::c_void, lit: i32) -> std::ffi::c_int; | ||
pub fn [<$prefix _set_terminate>]( | ||
slv: *mut std::ffi::c_void, | ||
data: *mut std::ffi::c_void, | ||
cb: Option<unsafe extern "C" fn(*mut std::ffi::c_void) -> std::ffi::c_int>, | ||
); | ||
pub fn [<$prefix _set_learn>]( | ||
slv: *mut std::ffi::c_void, | ||
data: *mut std::ffi::c_void, | ||
max_len: std::ffi::c_int, | ||
cb: Option<unsafe extern "C" fn(*mut std::ffi::c_void, *const i32)>, | ||
); | ||
} | ||
pub unsafe fn ipasir_signature() -> *const std::ffi::c_char { | ||
[<$prefix _signature>]() | ||
} | ||
pub unsafe fn ipasir_init() -> *mut std::ffi::c_void { | ||
[<$prefix _init>]() | ||
} | ||
pub unsafe fn ipasir_release(slv: *mut std::ffi::c_void) { | ||
[<$prefix _release>](slv) | ||
} | ||
pub unsafe fn ipasir_add(slv: *mut std::ffi::c_void, lit: i32) { | ||
[<$prefix _add>](slv, lit) | ||
} | ||
pub unsafe fn ipasir_assume(slv: *mut std::ffi::c_void, lit: i32) { | ||
[<$prefix _assume>](slv, lit) | ||
} | ||
pub unsafe fn ipasir_solve(slv: *mut std::ffi::c_void) -> std::ffi::c_int { | ||
[<$prefix _solve>](slv) | ||
} | ||
pub unsafe fn ipasir_val(slv: *mut std::ffi::c_void, lit: i32) -> i32 { | ||
[<$prefix _val>](slv, lit) | ||
} | ||
pub unsafe fn ipasir_failed(slv: *mut std::ffi::c_void, lit: i32) -> std::ffi::c_int { | ||
[<$prefix _failed>](slv, lit) | ||
} | ||
pub unsafe fn ipasir_set_terminate ( | ||
slv: *mut std::ffi::c_void, | ||
data: *mut std::ffi::c_void, | ||
cb: Option<unsafe extern "C" fn(*mut std::ffi::c_void) -> std::ffi::c_int>, | ||
); | ||
pub fn ipasir_set_learn( | ||
ptr: *mut std::ffi::c_void, | ||
) { | ||
[<$prefix _set_terminate>](slv, data, cb) | ||
} | ||
pub unsafe fn ipasir_set_learn( | ||
slv: *mut std::ffi::c_void, | ||
data: *mut std::ffi::c_void, | ||
max_len: std::ffi::c_int, | ||
cb: Option<unsafe extern "C" fn(*mut std::ffi::c_void, *const i32)>, | ||
); | ||
){ | ||
[<$prefix _set_learn>](slv, data, max_len, cb) | ||
} | ||
} | ||
}; | ||
} | ||
|
||
pub fn change_ipasir_prefix(build: &mut Build, prefix: &str) { | ||
build | ||
.define("ipasir_signature", format!("{prefix}_signature").as_ref()) | ||
.define("ipasir_init", format!("{prefix}_init").as_ref()) | ||
.define("ipasir_release", format!("{prefix}_release").as_ref()) | ||
.define("ipasir_add", format!("{prefix}_add").as_ref()) | ||
.define("ipasir_assume", format!("{prefix}_assume").as_ref()) | ||
.define("ipasir_solve", format!("{prefix}_solve").as_ref()) | ||
.define("ipasir_val", format!("{prefix}_val").as_ref()) | ||
.define("ipasir_failed", format!("{prefix}_failed").as_ref()) | ||
.define( | ||
"ipasir_set_terminate", | ||
format!("{prefix}_set_terminate").as_ref(), | ||
) | ||
.define("ipasir_set_learn", format!("{prefix}_set_learn").as_ref()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
use pindakaas_build_macros::ipasir_definitions; | ||
|
||
ipasir_definitions!(); | ||
ipasir_definitions!(intel_sat); |
Submodule intel_sat
updated
12 files
+3 −3 | Topi.cc | |
+3 −3 | TopiAsg.cc | |
+3 −3 | TopiBacktrack.cc | |
+3 −3 | TopiBcp.cc | |
+3 −3 | TopiBitCompression.cc | |
+3 −3 | TopiCompression.cc | |
+3 −3 | TopiConflictAnalysis.cc | |
+3 −3 | TopiDebugPrinting.cc | |
+3 −3 | TopiDecision.cc | |
+3 −3 | TopiRestart.cc | |
+3 −3 | TopiWL.cc | |
+3 −3 | Topor.cc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters