|
From: Petr M. <mi...@ph...> - 2003-10-21 10:09:25
|
> Petr Mikulik and John Bollinger alerted me to the recurrence of an > old problem. When (1) gnuplot is run from a script and (2) mouse > input is enabled, then characters are dropped from the input > stream. > > I initially thought this was something I had broken with my X11 > initialization patches (revisions 1.71 - 1.74 of term/x11.trm). > But after backing these out altogether, I still see the problem, > although possibly with a lower frequency. > > After much poking about in the source code, I came > across this bit in term/x11.trm > > /* apparently multi-character inputs like escape sequences > * but also mouse-pasted text got buffered and therefore > * didn't trigger the select() function in X11_waitforinput(). > * Switching to unbuffered input solved this (although I don't > * really like this solution 23 Jan 2002 (joze) */ > setvbuf(stdin, (char *) 0, _IONBF, 0); > > Commenting out this one setvbuf() line solves 99% of the > problem in my tests using the awk script below. > > 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. > > It would also be good to hear from Petr or some other Octave > user as to whether removing the setvbuf() line also fixes > things in Octave. I've tried it with Octave, but there is no change with or without setvbuf. Gnuplot mostly looses the first character. Probably, there was a thread on this topic around 23 Jan 2002, where Johanness submitted his patch ...? What I can confirm, is that I have this problem with gnuplot cvs'ed on June 21 2003 and newer. And, in the version of 21.6.2003, commenting out the setvbuf command, only the first char written is lost; otherwise many of them. --- Petr Mikulik |