[Gambas-user] Conflicting and bewildering help for pipes

Bruce bbruen at ...2308...
Wed Oct 30 00:33:47 CET 2013


On Wed, 2013-10-30 at 00:00 +0100, Benoît Minisini wrote:
> Le 29/10/2013 23:12, Tobias Boege a écrit :
> > On Fri, 25 Oct 2013, Beno?t Minisini wrote:
> >> Le 24/10/2013 15:08, Tobias Boege a ?crit :
> >>> My workaround always was like this:
> >>>
> >>>     ' Create the read pipe special file
> >>>     hGPstdout = Pipe "/tmp/gnuplotFIFO2" For Write
> >>>     Close #hGPstdout
> >>>     ' Create write end
> >>>     hGPpipe = Pipe "/tmp/gnuplotFIFO1" For Write
> >>>     ' Start writer
> >>>     hGPproc = Shell "gnuplot </tmp/gnuplotFIFO1 >/tmp/gnuplotFIFO2"
> >>>     ' Really create read end
> >>>     hGPstdout = Pipe "/tmp/gnuplotFIFO2" For Read Watch
> >>>
> >>> Note that since the shell which starts hGPproc already opened
> >>> /tmp/gnuplotFIFO2, you won't have any deadlock problems when opening
> >>> hGPstdout For Read afterwards.
> >>>
> >>> Anyway, if I
> >>>
> >>>     Print #hGPpipe, "plot x^2"
> >>>
> >>> only garbage (not non-sense but the string is always scrambled) seems to
> >>> arrive at gnuplot. Also, I seem to get output from gnuplot irregularly. So
> >>> I'm out of options for now. I remember that raising Read events for streams
> >>> has been subject to issues from time to time...
> >>>
> >>> Regards,
> >>> Tobi
> >>>
> >>
> >> Please give details. I tried what you said (but "plot x*x" because"
> >> "plot x^2" seems to not be the good syntax), and I always got the plot
> >> as expected.
> >>
> >
> > OK. The attached project gives the following output after I pressed
> > "Button1" four or five times:
> >
> > ---
> > Read             line 0: non-integer passed to boolean operator
> >
> >
> > Read
> > gnuplot> lot x^1
> >           ^
> >           line 0: invalid command
> >
> >
> > Read
> > gnuplot> pot x^1
> >           ^
> >           line 0:
> > Read    invalid command
> >
> >
> > Read
> > gnuplot> lotx^1
> >           ^
> >           line 0: invalid command
> >
> >
> > Read
> > gnuplot> plp plot x^1
> >           ^
> >
> > Read    line 0: invalid command
> >
> >
> >
> > ---
> >
> > You can see that in each message, one character is missing so that "plot" is
> > "lot" or "pot" or "lot" again. The missing characters "plp" appear in the
> > last message, totally mis-placed.
> >
> > Am I maybe reading incorrectly from the pipe?
> >
> > Regards,
> > Tobi
> >
> 
> Spoke too fast. Now I have the same output as you (more or less)...
> 

OK, I have made a few changes to plotdoc (attached).

This version makes a plot and lets us interact with it.

Notes:
1) sending the "show all" command gets us lots of text back from gnuplot
and it all appears to be contained within my "Read [" and "] ..done"
tags. So it looks as though we are getting (stdout) text back properly.
2) one thing I have found with gnuplot is that you must tell it to quit
or you end up with zombie tasks. (In fact this was the main reason I
started using pipes.)
3) when you run this plotdoc put the mouse over the plot window and try
[Shift]+[Ctrl]+[mouse wheel] - Now we see the "junk" appearing. But it
is all inside "Read [", "] ..done" pairs, so it looks as though gnuplot
either sends the errors back through stdout or that we are already
getting stderr inside the pipe.
4) if you just run gnuplot within a terminal, plot sin(x) and use the
mousewheel there is no junk output.  Maybe its gnuplot that has got a
problem when it is run from some other task???

-- 
Bruce <bbruen at ...2308...>
Paddys-Hill dot net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gnuplotter-0.0.1.tar.gz
Type: application/x-compressed-tar
Size: 29730 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20131030/19ddc45d/attachment.bin>


More information about the User mailing list