[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: An engine for octave
From: |
Jesse Bennett |
Subject: |
Re: An engine for octave |
Date: |
Wed, 21 Apr 1999 17:37:41 -0500 (CDT) |
Min,
I have a working engine for Octave which implements the following Matlab C
API functions:
engOpen
engClose
engGetFull
engPutFull
engEvalString
engOutputBuffer
I have been meaning to clean it up and submit it to the Octave sources
mailing list, but I just haven't found the time. Basically, it works by
forking, initializing pipes for stdin/stdout, then exec'ing Octave.
Commands are then sent to the engine as if they were typed at the command
line.
The only problem I had with this approach is that there is not a good way
in Octave to "load" a file from stdin (needed by engPutFull). IIRC, the
load will not terminate without an EOF, and the EOF character causes
Octave to close stdin (or something like that, I never got around to
investigating the problem in detail). In any case, only the first load
succeeds with this method. The workaround I used was to create a fifo,
and then pass the data through it. This is not a portable approach, since
some UNIX systems will not allow ordinary users to create fifos. A
temporary file could also be used, but this is messy as well. It would be
nice if someone created a patch for Octave that allows `load -ascii "-"'
to work (at least for a single matrix).
What I have works, but it is basically a hack that sorely needs improving.
There is very little error checking, and if the calling C program exits or
dies without closing the engine it has to be killed manually.
Since it seems others are interested in this, I will try to get it
organized this weekend and post the code on the sources list.
Jesse Bennett
On March 31, 1999, Min Xu wrote:
> I am considering an engine for octave which may open an instance of
> octave, do any number of fevals, and exchange of data between the
> calling C/C++ program and the octave instance, and surely close the
> instance when done.
[snip]
> I checked the help-octave archive. It seems that the interest of
> embedding octave in another environment is always high. Has anyone
> done anything in that? If not, I will code one.
- Re: An engine for octave,
Jesse Bennett <=