From f6364ebcac0d0a88a3cc6812fd2120c97b42cc26 Mon Sep 17 00:00:00 2001 From: bnewbold Date: Fri, 2 Dec 2016 01:40:30 -0800 Subject: basic impl of solving equations --- src/bin/mt-tool.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/bin') diff --git a/src/bin/mt-tool.rs b/src/bin/mt-tool.rs index 929990f..8ef2464 100644 --- a/src/bin/mt-tool.rs +++ b/src/bin/mt-tool.rs @@ -57,6 +57,8 @@ fn main() { let mut opts = Options::new(); opts.optflag("h", "help", "print this help menu"); opts.optflag("", "version", "print the version"); + opts.optmulti("", "dep", "dependent variable", "VAR"); + opts.optmulti("", "indep", "dependent variable", "VAR"); let matches = match opts.parse(&args[1..]) { Ok(m) => m, @@ -85,6 +87,14 @@ fn main() { let cmd = matches.free[0].clone(); match cmd.as_str() { "parse" => { parse_modelica_files(matches.free[1..].iter().map(|x| x.to_string()).collect()); }, + "solve_for" => { + if matches.free.len() != 2 { + println!("Expected a path to load"); + exit(-1); + } + let me = modelthing::load_model_entry(Path::new(&matches.free[1])).unwrap(); + println!("{:?}", me.ast.solve_for(matches.opt_strs("indep"), matches.opt_strs("dep"))); + }, "transpile_scheme" => { if matches.free.len() != 2 { println!("Expected a single path to load"); -- cgit v1.2.3