From help-octave-request at bevo dot che dot wisc dot edu Fri Dec 20 06:24:33 2002 Subject: Re: Hi, another newbie ... From: Paul Kienzle To: "Andrzej M. Ostruszka" , help-octave@bevo.che.wisc.edu Date: Fri, 20 Dec 2002 07:22:23 -0500 Andrzej M. Ostruszka wrote: > On Thu, Dec 19 (2002), Paul Kienzle wrote: > > Yes. You will need to make an octave value list for you input parameters > > and your returned parameters will be in an octave_value_list so it is a > > little bit ugly but not too difficult. > > I figured that out by myself :), I have only small suggestion to remove > constructors for octave_value_list other than with octave_value since > there's ambiguity below in append since it doesn't know which way to > choose (via octave_value or octave_value_list) > ... > args.append(-1.); > res = feval("...", args); > ... Adding args in reverse order is slightly more efficient since it doesn't have to keep stretching the octave_value vector it uses to store the list. args(1) = -1.; args(0) = A; Not enough to worry about though. > > > You can also call eval, which in some cases may be a little easier.. > > Could you elaborate a bit more on this? If you are operating on values in the caller's symbol table, then you can let octave take care of them by calling, e.g., eval("C=A*B;"); But if you can do this, I suppose you don't need the oct-file. > > > Additionally I'd like to access other octave functions > > > (defined as *.m or *.oct or even builtin) but I guess that the answer > > > for my first question also aswers that one. > > > > Once you are trying to call .m files you might as well use an oct file > > since you have to have almost all the machinery of octave available to > > do so. There are a few cases in which you might not want to do so, > > such as when you need your own event loop, but to do that we need to > > rework the octave toplevel code a bit. > > I'm not sure I understand the above. Do you suggest that the only > possibility (or at least much more convenient than others) is to write > main program in octave and call there external oct file instead of main > program beeing written in C++? I would love for you to send patches to make the octave interpreter easy to embed in C++ programs. Right now you can do it by cutting and pasting from octave.cc and toplev.cc, but code developed this way is harder to keep in sync with different versions of octave. Paul Kienzle pkienzle at users dot sf dot net ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------