#include #include #include #include #include int main (void) { // Create embedded Octave application. string_vector argv (2); argv(0) = "embedded"; argv(1) = "-q"; octave::embedded_application app (2, argv.c_str_vec ()); // Make it work (initializes load path, executes startup files, etc.). app.execute (); try { feval ("path", ovl (), 0); octave_idx_type n = 2; octave_value_list in; for (octave_idx_type i = 0; i < n; i++) in(i) = octave_value (5 * (i + 2)); octave_value_list out = feval ("gcd", in, 1); if (out.length () > 0) std::cout << "GCD of [" << in(0).int_value () << ", " << in(1).int_value () << "] is " << out(0).int_value () << std::endl; else std::cout << "invalid\n"; } catch (octave::execution_exception&) { std::cerr << "execution error in octave interpreter" << std::endl; } catch (octave::interrupt_exception&) { std::cerr << "octave interpreter was interrupted" << std::endl; } return 0; }