missing pdf terminal; was --> [changeset] print.m (matlab compatibility)

Ben Abbott bpabbott at mac.com
Thu Mar 12 19:26:41 CDT 2009


On Mar 12, 2009, at 1:12 AM, John W. Eaton wrote:

> On 11-Mar-2009, Michael Goffioul wrote:
>
> | On Wed, Mar 11, 2009 at 4:50 AM, John W. Eaton <jwe at octave.org>  
> wrote:
> | > So it won't work on Windows?
> |
> | Yes, it will. The gnuplot backend uses popen2 to communicate with
> | gnuplot, so numel(ostream) == 2. AFAIK, ginput works fine under
> | Windows now.
>
> Yes, when there is a plot window on the screen.  But gnuplot_drawnow
> begins with
>
>  function gnuplot_drawnow (h, term, file, mono, debug_file)
>
>    if (nargin < 4)
>      mono = false;
>    endif
>
>    if (nargin >= 3 && nargin <= 5)
>      ## Produce various output formats, or redirect gnuplot stream  
> to a
>      ## debug file.
>      plot_stream = [];
>      fid = [];
>      printing = ! output_to_screen (gnuplot_trim_term (term));
>      unwind_protect
> 	plot_stream = open_gnuplot_stream (1, []);
> 	...
>      unwind_protect_cleanup
> 	...
>      end_unwind_protect
>    elseif (nargin == 1)
>      ##  Graphics terminal for display.
>      plot_stream = get (h, "__plot_stream__");
>      if (isempty (plot_stream))
> 	plot_stream = open_gnuplot_stream (2, h);
>      ...
>
> and open_gnuplot_stream is:
>
>  function plot_stream = open_gnuplot_stream (npipes, h)
>    cmd = gnuplot_binary ();
>    if (npipes > 1)
>      [plot_stream(1), plot_stream(2), pid] = popen2 (cmd);
>      if (pid < 0)
> 	error ("drawnow: failed to open connection to gnuplot");
>      endif
>    else
>      plot_stream = popen (cmd, "w");
>      if (plot_stream < 0)
> 	error ("drawnow: failed to open connection to gnuplot");
>      endif
>    endif
>    if (! isempty (h))
>      set (h, "__plot_stream__", plot_stream);
>    endif
>  endfunction
>
> So we only use popen2 when output is to the screen.  Should we just
> always use popen2?  I can't remember the reason for sometimes using
> popen.
>
> jwe

I don' t think it matters either way.  __gnuplot_get_var__ uses the  
stream stored in the figure's "__plot_stream__" which is opened by  
popen2.

Shall I push __gnuplot_get_var__ and then check on the availability of  
the specified gnuplot terminal before printing?

Ben




More information about the Octave-maintainers mailing list