changeset 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 5a55773fcaa9
files scripts/ChangeLog scripts/plot/__fltk_print__.m scripts/plot/__print_parse_opts__.m
diffstat 3 files changed, 43 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,5 +1,7 @@
 2010-08-05  Ben Abbott <bpabbott@mac.com>
 
+	* /plot/__print_parse_opts__.m, plot/__fltk_print__.m: Don't warn on
+	absence of fig2dev or pstoedit until they are needed.
 	* plot/__print_parse_opts__.m, plot/__fltk_print__.m: Add epslatex,
 	pslatex, and pdflatex output for fltk backend. Use the gs png16m device
 	instead of png256.
--- 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
 
--- a/scripts/plot/__print_parse_opts__.m
+++ b/scripts/plot/__print_parse_opts__.m
@@ -387,7 +387,7 @@
   if (! isfield (data, binary))
     ## Reinitialize when `user_binaries' is present.
     data.(binary).bin = "";
-    data.(binary).warn_on_absence = true;
+    data.(binary).warn_on_absence = false;
   endif
 
   if (isempty (data.(binary).bin))