-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose Z3_get_version in the high-level interface
- Loading branch information
1 parent
182a6a8
commit a1d6458
Showing
3 changed files
with
37 additions
and
0 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
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use std::ffi::CStr; | ||
|
||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)] | ||
pub struct Version { | ||
major: u32, | ||
minor: u32, | ||
build_number: u32, | ||
revision_number: u32, | ||
} | ||
|
||
pub fn version() -> Version { | ||
let mut ver = Version::default(); | ||
unsafe { | ||
z3_sys::Z3_get_version( | ||
&mut ver.major, | ||
&mut ver.minor, | ||
&mut ver.build_number, | ||
&mut ver.revision_number, | ||
); | ||
} | ||
ver | ||
} | ||
|
||
pub fn full_version() -> &'static str { | ||
let ver_ptr = unsafe { z3_sys::Z3_get_full_version() }; | ||
let ver = unsafe { CStr::from_ptr(ver_ptr) }; | ||
ver.to_str() | ||
.expect("Z3_get_full_version returned non-UTF-8 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