|
From: Ethan M. <merritt@u.washington.edu> - 2003-10-20 19:49:41
|
[apologies if you receive this message twice. Since I'm not entirely
sure that the new gnu...@li... is working,
I have CCed various interested parties directly]
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=20
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()=
=2E
* 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=20
problem in my tests using the awk script below. =20
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.
Before proceeding any further, I'd like to hear more detail from=20
Johannes about what problem this line was originally fixing.
I have not noticed any dropped paste events or mouse clicks,
but I may not be testing the right combination of events.
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.=20
My test awk script:
BEGIN {
gp=3D"./gnuplot"
print "set term post" |gp
print "set mouse" |gp
print "set term x11" |gp
for (k=3D1; k<500; k++) {
print "reset"|gp
print "plot x*x*" k |gp
}
}
On Friday 10 October 2003 00:57, Petr Mikulik wrote:
>
> This Octave script may show the error earlier than the awk script:
>
> gset mouse
> #do_print=3D1;
> do_print=3D0;
>
> x=3D1:600;
> y=3Dsin(x/3);
> if do_print
> gset term post lw 2 'Helvetica' 16
> gset out 'gpbug.ps'
> end
>
> for k=3D1:30
> gset grid
> title(sprintf('loop %i',k))
> plot(x*1e-3,y,';curve;')
> replot
> end
>
> if do_print
> gset out
> gset term pop
> end
>
> ---
> Petr Mikulik
--=20
Ethan A Merritt merritt@u.washington.edu
Biomolecular Structure Center Box 357742
University of Washington, Seattle, WA 98195
|