Windows ginput function [Was: fopen doesn't return when opening a fifo!!]
David Bateman
David.Bateman at motorola.com
Wed Apr 2 11:24:22 CDT 2008
John W. Eaton wrote:
> On 2-Apr-2008, David Bateman wrote:
>
> | It is the __gnuplot_ginput__.m function that sends the command to print
> | to gnuplot, so we are in full control of the output. To try and address
> | some of these issues, I added a tag in front of the expected output (ie
> | "OCTAVE:") and so we can reject the rest.
>
> OK, so there could be other output mixed in? What other things does
> gnuplot write to stdout?
>
I don't know if there is, I just took the precaution that there might be.
> | I see the output stream from
> | gnuplot opened with popen2 to be blocking reads just around the read
> | statement to prevent the need to a while loop around the read, though if
> | you feel the while loop is better to allow ctrl-c to work then that's
> | easy to implement as well. I should probably also have a while loop
> | looking for the expected "OCTAVE:" tag as well, to prevent rubbish that
> | might be printed by gnuplot affecting the use of ginput.
>
> I think it would be best if we can have a way for interrupts to work
> here, otherwise it seems we would be stuck if gnuplot fails to respond.
>
Then we need to have O_NONBLOCK set on the output pipe and use a while
loop to probe for input.. This wait loop in Octave will however
needlessly consume CPU cycles.. I have that version of the code as well
if you'd prefer.
> What is the new argument to open_gnuplot_stream for? In the patch you
> sent, one possibility was to open the pipe to gnuplot with popen.
>
I didn't see the point of opening with popen if we were printing and the
stream would be closed when drawnow exited.
D.
--
David Bateman David.Bateman at motorola.com
Motorola Labs - Paris +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin +33 6 72 01 06 33 (Mob)
91193 Gif-Sur-Yvette FRANCE +33 1 69 35 77 01 (Fax)
The information contained in this communication has been classified as:
[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary
More information about the Bug-octave
mailing list