Skip to content

Commit 2a900ca

Browse files
committed
Add GetVersion() to the interface, test it, and update the build version
1 parent 085a1e7 commit 2a900ca

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
[package]
88
name = "MathCatForPython"
9-
version = "0.1.4"
9+
version = "0.2.0"
1010
authors = ["Neil Soiffer <soiffer@alum.mit.edu>"]
1111
edition = "2018"
1212

Example/test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def GetSpeech():
4848

4949

5050
SetMathCATPreferences() # you only need to this once
51+
print("Using MathCAT version '{}'".format(libmathcat.GetVersion()))
5152

5253
mathml = "<math><mfrac> <mn>1</mn> <mi>X</mi> </mfrac> </math>"
5354
SetMathMLForMathCAT(mathml)

src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ pub fn SetRulesDir(_py: Python, rules_dir_location: String) -> PyResult<()> {
5757
pub fn SetMathML(_py: Python, mathml_str: String) -> PyResult<String> {
5858
return convert_error( set_mathml(mathml_str) );
5959
}
60+
61+
#[pyfunction]
62+
/// Get the version number (e.g., "0.2.0") of MathCAT.
63+
pub fn GetVersion(_py: Python) -> PyResult<String> {
64+
return Ok( get_version() );
65+
}
66+
6067
#[pyfunction]
6168
/// Get the spoken text of the MathML that was set.
6269
/// The speech takes into account any AT or user preferences.
@@ -144,6 +151,7 @@ pub fn GetNavigationMathML(_py: Python) -> PyResult<(String, usize)> {
144151
fn libmathcat(_py: Python, m: &PyModule) -> PyResult<()> {
145152
m.add_function(wrap_pyfunction!(SetRulesDir, m)?)?;
146153
m.add_function(wrap_pyfunction!(SetMathML, m)?)?;
154+
m.add_function(wrap_pyfunction!(GetVersion, m)?)?;
147155
m.add_function(wrap_pyfunction!(GetSpokenText, m)?)?;
148156
m.add_function(wrap_pyfunction!(SetPreference, m)?)?;
149157
m.add_function(wrap_pyfunction!(GetPreference, m)?)?;

0 commit comments

Comments
 (0)