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 16:52:46 -0500

On 20-Feb-2006, Sebastien Loisel wrote:

| >
| > The code in pager.cc already handles buffering of Octave output.  Are
| > you not using any of that?
| 
| 
| I just look that up to see whether I am. I'm afraid I'm not. I'm rdbuf()ing
| octave_stdout to my own subclass of streambuf, which dumps everything to the
| window as soon as it receives it. I guess it would be niftier if I could
| grab octave_pager_buf's output and stuff, but the functions aren't virtual
| so I don't see how I can simply reuse the object.
| 
| Do you suggest a different approach?

If the code in pager.cc is close to what you want, but doesn't quite
do everything you need, then we can probably fix things so that it
will work for you.  You may have to suggest changes.  But I think that
would be better than duplicating much of that code on your own.

| 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?
| 
| 
| I don't handle them. What's the best way? (This is the way that's taught in
| the embed.cc example on octave.sourceforge.net aka octave forge.)

I think you should look at the way user input is handled by the
functions in src/input.cc.  Probably your command line should hook
into that (or use a similar method) instead of calling eval_string.
You might also get readline capability for free that way, but I don't
know for sure since I don't know the details of the way your QT widget
handles input.

|   octave.cc:
| >     std::cout is used for startup and version messages.  It doesn't
| 
| 
| Which means I won't be able to capture it in MinGW (in Linux, I could go
| back to rdbuf()fing cout, that would probably do it.) Should I just hard
| code your copyright message into Workshop so it gets printed in the output
| tab?

If there is some functionality that you need, please suggest it.
Perhaps we could have functions that return the startup messages as
character strings.  At startup, Octave could print the messages that
these functions return unless it is running in embedded mode.  In
embedded mode, it would be up to the application that is embedding
Octave to decide whether to use these functions and/or display their
output.

|   parse.y:
| >     parse_and_execute writes info messages directly to std::cout (used
| >     for debugging of which startup files are being read).
| 
| 
| Octave maintainer type debugging, or debugging that normal people could
| want? Because if it's the latter I'm missing it and I might want it.

User debugging/info.  These messages are written if you start Octave
with the --verbose option.  I think they could go to octave_stdout.

|   toplev.cc:
| >     After recovering from an exception, or when exiting, Octave prints
| >     a newline character to std::cout.
| 
| 
| Why? I guess a newline isn't too important.

So that if you do something like type ^D to exit Octave, you get

  octave-prompt> 
  shell-prompt> 

instead of

  octave-prompt> shell-prompt> 

I think these could to to octave_stdout, so I've made that change in
the CVS sources.

jwe



reply via email to

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