octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: wait_for_file ??


From: bpabbott
Subject: Re: wait_for_file ??
Date: Thu, 09 Sep 2010 18:33:39 +0000 (GMT)

On 09 Sep, 2010,at 02:01 PM, "John W. Eaton" <address@hidden> wrote:

On 9-Sep-2010, Shai Ayal wrote:

| On Thu, Sep 9, 2010 at 3:15 PM, Ben Abbott <address@hidden> wrote:
| >
| > Why not always use ... fid = popen ("cat ...")?
| >
| >        fid = popen (pipeline, "w")
| >
| > where `pipeline' is a string containing a piped command line. Which could be just gs. For "print test.jpg" ...
| >
| >        pipeline = "cat | gs -dQUIET -dNOPAUSE -dBATCH -dSAFER -sDEVICE=jpeg -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -r150x150 -dEPSCrop -sOutputFile=test.jpg"
| >
| > For fig ..
| >
| >        pipeline = "cat | pstoedit -f fig test.fig"
| >
| > For emf ...
| >
| >        pipeline = "cat | pstoedit -f fig | fig2dev -L emf test.emf"
| >
| > I'm not sure the "cat" is needed except in Shai's example, but you using this approach a pipeline of conversions can be implemented.
|
| The cat is not needed. I just used it for the example.

If you can arrange for the entire sequence of print commands to be a
pipeline, then that should take care of any race conditions related to
file creation within the print command.

It occurred to me later that there could still be problems for things like

print ("-depsc", "foo.eps");
system ("lpr -P foo.eps");
 
I haven't looked at whether lpr support pipes on all platforms, but I'm expecting the following to work.

pipleline = "gs -dQUIET ... -dFIXEDMEDIA offset.ps - | lpr -l"
fid = popen (pipeline, "w");
drawnow ("eps" , sprintf ("%d" , fid));

If I'm missing something, please let me know.

Ben


reply via email to

[Prev in Thread] Current Thread [Next in Thread]