From: Petr M. <mi...@ph...> - 2003-10-27 15:10:40
|
> > > With the setvbuf() in place, running the awk script causes the > > > first 120+ plot commands to be lost in transit!!!!!! > > > > > > Without the setvbuf() command, only a single character is > > > dropped - the first one following the first plot command. > > > > I've tried it with Octave, but there is no change with or without > > setvbuf. Gnuplot mostly looses the first character. > > Last night I built Octave 2.1.50 so that I could test this > myself. What I found is that the Octave problem and the awk > problem are not the same. > > The Octave problem can, I believe, be solved with the first > patch attached below (ipc_lock.patch). This one causes > X11_waitforinput() to refuse to read any more characters > using getc(stdin) while it is waiting for a response from the > mousing pipe. > > This still leaves awk losing many lines of input, which is > fixed only if I also remove the call to setvbuf() as in the > second patch below (setvbuf.patch). > > Applying these two patches makes both the awk and octave > test scripts run on my usual desktop machine under linux. > > I've tested both with gnu libreadline and with the builtin > readline. But I have not yet tested on other machines, and > I would not like to commit either patch to CVS without more > extensive testing. > > In particular I am concerned that if the response from the > mouse pipe is lost altogether, then the first patch will cause > gnuplot will hang. I need to add some sort of timeout or > upper limit of attempts to read from the mouse pipe. I'd a look to the patch of June 21 which made the break; even though I don't understand it, I've found that commenting out the "X11_waitforinput();" call does not produce the forgetting-pipe error: /* Force default font at start of plot */ #ifdef USE_MOUSE /* EAM June 2003 - Flush the set font command through the pipe */ /* to gnuplot_x11, then wait for it to return the resulting */ /* font size information (v_char and h_char). */ if (!default_font_size_known) { X11_set_default_font(); FFLUSH(); X11_waitforinput(); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ default_font_size_known = TRUE; } #else X11_set_default_font(); #endif X11_set_font(""); } Does that command have to be there? Petr |