Dave,

ProcessWrapper looks like a win32-only project to me, and Sig's gnuplot package 
appears to use OSProcess for unix.   Please let me know if I am missing 
something.

It is true that OSProcess' unit tests cause Pharo to experience an ugly death, 
but a lot seems to work.  I am having some success with code such as

 gp := PipeableOSProcess command:'gnuplot'.
 gp
        exec:'set output ""';
        exec:'set terminal png';
        exec:'plot sin(x)'.

but I cannot get any output without shutting down the process.  Are any of the 
problems you describe relevant to that, or am I asking too much, or perhaps 
just going about this incorrectly?

Bill



-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of David T. Lewis
Sent: Sunday, November 15, 2009 6:57 PM
To: [email protected]
Subject: Re: [Pharo-project] OSProcess - working on gnuplot

On Sun, Nov 15, 2009 at 03:04:49PM -0500, Schwab,Wilhelm K wrote:
> 
> I am slowly gathering ideas on how to write an interface to gnuplot.
> It will probably be enough to use PipeableOSPRocess class>>command: to 
> grab output from it, but it will be inefficient for producing large 
> numbers of graphs.
> 
> Ideally, I would like to run the program and obtain output without 
> creating so much as a named pipe; it appears to be possible to route 
> output to standard out, so there is a potential for it to work.  For a 
> single graph, think I see how to make that go.
> 
> For large numbers of graphs, one could allow gnuplot to write the 
> files; that might even be preferred in many situations, but right now 
> I appear to be designing that way because I don't know another way - 
> I'm trying to leave Windows behind me :)

Hi Bill,

You should probably first check out the suggestion from Levente:

> You don't have to reinvent the wheel all the time:
> http://www.squeaksource.com/GNUPlot.html

But your question is interesting to me, because the first free software thing I 
ever wrote was gl_plot, which appeared in comp.sources.unix volume 18, and was 
used for generating graphics to support gnuplot on PC unix (Microport System 
V/AT) back before PC unix had graphics support. It's still out there in case 
you want to run gnuplot on your 286 unix pc:

  http://ftp.isc.org/pub/usenet/comp.sources.unix/volume18/gl_plot

Anyway, back to the new millenium. Yes you should definitely be able to control 
a gnuplot process with a connected PipeableOSProcess. That's what it is 
designed for.

> Is there a clean way to start gnuplot, leave it running, write to its 
> stdin, read from its stdout almost as if it were a TCP server, and 
> then close it when I'm ready to do so?

Sure, see PipeableOSProcess class>>tkExample for an example of how to do this. 
Use /usr/bin/gnuplot instead of /usr/bin/wish of course. However (and this is a 
big caveat at the moment), OSProcess and CommandShell currently do not work 
properly on Pharo for reasons that I don't yet understand. So definitely check 
out Levente's suggestion as a first step.

> I tried running CommandShell thinking
> that might let me demo it, but appears to be stuck back in MVC??

CommandShell has user interfaces for both Morphic and MVC. Pharo does not have 
MVC, but that should not effect the Morphic side, other than the annoyance of 
having to skip over the errors when you load it.

Dave


_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to