octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to break out of a computation?


From: John W. Eaton
Subject: Re: How to break out of a computation?
Date: Mon, 20 Feb 2006 12:44:19 -0500

On 18-Feb-2006, Sebastien Loisel wrote:

| Sorry, I wasn't clear enough. It's not an Octave thing, it's a GUI thing.
| You see, I grab all of Octave's outputs and buffer them, then eventually
| display them in my GUI window.

The code in pager.cc already handles buffering of Octave output.  Are
you not using any of that?

| Because the way it was written thus far, my
| GUI (not Octave) was *not* displaying any of Octave's intermediate result
| *until* the eval_string() call returned. This bug wasn't Octave's fault, it
| was my fault.

You are using eval_string to process commands typed in the GUI input
window?  To me, that doesn't seem like the best way to handle user
input.  If you are using eval_string, how do you handle multi-line
input?

| > Also, if you are finding that you need to modify the Octave internals
| 
| I'm avoiding that as much as I can. There is a one-line patch I had the
| regret of sending David Bateman. To get the GUI to work under MinGW, the
| line
| 
| std::ostream &get_cerr(void) { return cerr; }
| 
| must be added in error.cc. In Linux, no such patch is needed. This is in
| fact a problem with the semantics of DLL in Windows. That is the only
| modification to core octave so far and I really think it'll stay that way.

I don't think I want to add this function to Octave.  A DLL or shared
library is just an implementation detail.  There should be one
std::cerr symbol for a program.  If there are multiple std::cerr symbols
depending on the way a program is linked, then I would think that is a
bug in the compiler/libraries on your system.  Can you point to some
explanation of why this would not be a bug?

| The few things that might come back to bite me are:
| 
| 1)
| address@hidden octave-2.1.72]$ grep -l cout */*.cc
| liboctave/Array-util.cc
| scripts/gethelp.cc
| src/file-io.cc
| src/octave.cc
| src/oct-stream.cc
| src/pager.cc
| src/parse.cc
| src/pt-plot.cc
| src/toplev.cc

Some of these are just comments or code in #if 0/#endif sections that
mention std::cout, or are standalone programs that are used to build
Octave, but are not part of the Octave interpreter (gethelp.cc). 

Of the rest:

  octave.cc:
    std::cout is used for startup and version messages.  It doesn't
    make sense to me to have these messages go through the pager,
    since it should be possible to run "octave --help" at the command
    line without having to have a pager program installed, or even to
    have to start if you do.

  pager.cc:
    std::cout is used when the pager is not enabled (where else would
    you have the output go?).

  parse.y:
    parse_and_execute writes info messages directly to std::cout (used
    for debugging of which startup files are being read).

  toplev.cc:
    After recovering from an exception, or when exiting, Octave prints
    a newline character to std::cout.


jwe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]