Mercurial > hg > octave-nkf
diff scripts/plot/__fltk_print__.m @ 10862:337db4e1342d
Warn on absence of fig2dev/pstoedit only when needed.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Thu, 05 Aug 2010 20:28:16 -0400 |
parents | 2f70e7098cbe |
children | d19d2abdd65f |
line wrap: on
line diff
--- a/scripts/plot/__fltk_print__.m +++ b/scripts/plot/__fltk_print__.m @@ -141,50 +141,62 @@ endfunction function status = __fig2dev__ (opts, figfile, devopt, devfile) + persistent warn_on_absence = true if (nargin < 4) devfile = opts.name; endif if (nargin < 3) devopt = opts.devopt; endif - cmd = sprintf ("%s -L %s %s %s 2>&1", opts.fig2dev_binary, devopt, figfile, devfile); - [status, output] = system (cmd); - if (opts.debug) - fprintf ("fig2dev command: %s", cmd) - endif - if (status) - warning ("print:fig2devfailed", "print.m: error running fig2dev.") - disp (cmd) - disp (output) + if (! isempty (opts.fig2dev_binary)) + cmd = sprintf ("%s -L %s %s %s 2>&1", opts.fig2dev_binary, devopt, figfile, devfile); + [status, output] = system (cmd); + if (opts.debug) + fprintf ("fig2dev command: %s", cmd) + endif + if (status) + warning ("print:fig2devfailed", "print.m: error running fig2dev.") + disp (cmd) + disp (output) + endif + elseif (isempty (opts.fig2dev_binary) && warn_on_absence) + warning ("print:nofig2dev", "print.m: 'fig2dev' not found in EXEC_PATH.") + warn_on_absence = false; endif endfunction function status = __pstoedit__ (opts, devopt, name) + persistent warn_on_absence = true if (nargin < 3) name = opts.name; endif if (nargin < 2) devopt = opts.devopt; endif - tmp_epsfile = strcat (tmpnam (), ".eps"); - if (opts.tight_flag) - __tight_eps_bbox__ (opts, tmp_epsfile); - endif - drawnow ("eps", tmp_epsfile) - cmd = sprintf ("%s -f %s %s %s 2>&1", opts.pstoedit_binary, devopt, tmp_epsfile, name); - [status, output] = system (cmd); - if (opts.debug) - fprintf ("pstoedit command: %s", cmd) - endif - if (status) - warning ("print:pstoeditfailed", "print.m: error running pstoedit.") - disp (cmd) - disp (output) - endif - [status, output] = unlink (tmp_epsfile); - if (status != 0) - disp (output) - warning ("print.m: failed to delete temporay file, '%s'.", tmp_epsfile) + tmp_epsfile = strcat (tmpnam (), ".eps"); + if (opts.tight_flag) + __tight_eps_bbox__ (opts, tmp_epsfile); + endif + if (! isempty (opts.pstoedit_binary)) + drawnow ("eps", tmp_epsfile) + cmd = sprintf ("%s -f %s %s %s 2>&1", opts.pstoedit_binary, devopt, tmp_epsfile, name); + [status, output] = system (cmd); + if (opts.debug) + fprintf ("pstoedit command: %s", cmd) + endif + if (status) + warning ("print:pstoeditfailed", "print.m: error running pstoedit.") + disp (cmd) + disp (output) + endif + [status, output] = unlink (tmp_epsfile); + if (status != 0) + disp (output) + warning ("print.m: failed to delete temporay file, '%s'.", tmp_epsfile) + endif + elseif (isempty (opts.pstoedit_binary) && warn_on_absence) + warning ("print:nopstoedit", "print.m: 'pstoedit' not found in EXEC_PATH.") + warn_on_absence = false; endif endfunction