From octave-maintainers-request at bevo dot che dot wisc dot edu Mon Dec 16 11:23:24 2002 Subject: Re: ROctave From: "John W. Eaton" To: Duncan Temple Lang Cc: octave-maintainers mailing list Date: Mon, 16 Dec 2002 11:23:13 -0600 [I'm copying this to the octave-maintainers mailing list so that we can maybe start a discussion of this there as well. --jwe] On 7-Dec-2002, Duncan Temple Lang wrote: | The only difficulty that might arise in the longer term is what I | would ideally like to have: an Octave embedded in R. OK, I've been thinking about how to do something similar (allow people to load Octave in other programs) and it is currently possible to load all of Octave as a shared library. The main Octave program is now just #ifdef HAVE_CONFIG_H #include #endif #include "f77-fcn.h" #include "lo-ieee.h" #include "octave.h" int main (int argc, char **argv) { return octave_main (argc, argv); } and octave_main and everything else is in a set of shared libraries, so you can load them and call octave_main in your own application. The problem is that this also starts up the interactive command loop. So we really need an interface that looks something like // load shared libraries... octave_init (); // perhaps with an argument to say not interactive? // other stuff... for (;;) { // ... octave_value result = parse_and_execute_octave_command (???); // or some other method of controlling Octave... } Though I'm not sure what would be best. As things are now, octave_value is probably only useful inside a C++ program, and it's not clear to me how we should control Octave from another program. In some cases, parsing and evaluating strings might be OK, but in other cases, you may want to build a parse tree using some function calls and then evaluate that directly, skipping the lexer/parser. As a minimum, I think we need to write a few functions that allow us to initialize Octave without starting up the interactive I/O system so we can just use Octave as a compute engine. jwe