[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #38684] embedded.cc demo of apendix A.3 from m
From: |
Tatsuro MATSUOKA |
Subject: |
[Octave-bug-tracker] [bug #38684] embedded.cc demo of apendix A.3 from manual gives an error |
Date: |
Tue, 09 Apr 2013 06:51:36 +0000 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31 |
Follow-up Comment #2, bug #38684 (project octave):
The embedded.cc in 3.6.4 manual seems to be outdated.
It is corrected in 3.7.2+ (development source) manual.
//embedded.cc in 3.7.2+ (development source) manual
#include <iostream>
#include <octave/oct.h>
#include <octave/octave.h>
#include <octave/parse.h>
int
main (void)
{
string_vector argv (2);
argv(0) = "embedded";
argv(1) = "-q";
octave_main (2, argv.c_str_vec (), 1);
octave_idx_type n = 2;
octave_value_list in;
for (octave_idx_type i = 0; i < n; i++)
in(i) = octave_value (5 * (i + 1));
octave_value_list out = feval ("gcd", in, 1);
if (!error_state && 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 << "invalidn";
return 0;
}
The above works correctly under 3.6.4.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?38684>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/