# HG changeset patch
# User Michael Godfrey <michaeldgodfrey@gmail.com>
# Date 1395766841 0
#      Tue Mar 25 17:00:41 2014 +0000
# Node ID 90c199446ceabc68d6a2acbef50f4b2e35ea08aa
# Parent  d0d9f6daa4b6fd61ec4bd26877a0168a6b9c8485
Fix print test for figure and -P command

diff -r d0d9f6daa4b6 -r 90c199446cea scripts/plot/util/print.m
--- a/scripts/plot/util/print.m	Mon Mar 24 21:24:16 2014 -0700
+++ b/scripts/plot/util/print.m	Tue Mar 25 17:00:41 2014 +0000
@@ -103,17 +103,32 @@
 ##     Encapsulated PostScript (level 1 and 2, mono and color).  The FLTK
 ## graphic toolkit generates PostScript level 3.0.
 ##
-##   @item  tex
+##   @item  pslatex
 ##   @itemx epslatex
-##   @itemx epslatexstandalone
-##   @itemx pstex
-##   @itemx pslatex
 ##   @itemx pdflatex
-##     Generate a @LaTeX{} (or @TeX{}) file for labels and eps/ps/pdf
-## for graphics.  The file produced by @code{epslatexstandalone} can be
-## processed directly by @LaTeX{}.  The other formats are intended to
-## be included in a @LaTeX{} (or @TeX{}) document.  The @code{tex} device
-## is the same as the @code{epslatex} device.  The @code{pdflatex} device
+##   @itemx (pslatex,epslatex,pdflatex)standalone
+##     Generate a @LaTeX{} file @var{filename.tex} for the labels and a
+## @var{filename.ps/eps/pdf} file
+## for the graphics. The 
+## graphics file will have the suffix .ps/eps/pdf depending on the
+## device type. The @LaTeX{} file produced by the @var{standalone} option can be
+## processed directly by @LaTeX{}.  The file generated without the 
+## @var{standalone} option is intended to
+## be included in a @LaTeX{} document. In any case, the @LaTeX{} file
+## contains an @code{\includegraphics} command so that the generated graphics
+## file is automatically included when the @LaTeX{} file is processed
+## by @LaTeX{}. The text that is included in the @LaTeX{} 
+## file contains exactly the strings that were provided in the plot. If
+## any of the special characters in @TeX{} mode were used, the file must be
+## edited before @LaTeX{} processing. Specifically, the special characters must
+## be enclosed in $ ... $, and other characters that are recognized by @LaTeX{} 
+## may also need editing, for instance by use of braces. If the @var{standalone} option
+## is used @var{pdflatex} can be used to generate a @var{pdf} file for inclusion
+## in another document by means of the @code{\includegraphics} command.
+## Even if this option is not used, the @LaTeX{} file will require further
+## editing before inclusion in another @LaTeX{} document. This editing will 
+## depend on the various options used in the including file.
+## The @var{pdflatex} device
 ## is only available for the FLTK graphics toolkit.
 ##
 ##   @item tikz
@@ -175,29 +190,17 @@
 ## Some examples are;
 ##
 ##   @table @code
+##   @item pdfwrite
+##     Produces pdf output from eps
+##
 ##   @item ljet2p
 ##     HP LaserJet @nospell{IIP}
 ##
-##   @item ljet3
-##     HP LaserJet III
-##
-##   @item deskjet
-##     HP DeskJet and DeskJet Plus
-##
-##   @item cdj550
-##     HP DeskJet 550C
-##
-##   @item paintjet
-##     HP PointJet
-##
 ##   @item pcx24b
 ##     24-bit color PCX file format
 ##
 ##   @item ppm
 ##     Portable Pixel Map file format
-##
-##   @item pdfwrite
-##     Produces pdf output from eps
 ##   @end table
 ##
 ##   For a complete list, type @code{system ("gs -h")} to see what formats
@@ -254,24 +257,34 @@
 ##
 ## The filename and options can be given in any order.
 ##
-## Example: Print to a file using the svg device.
+## Example: Print to a file using the pdf device.
 ##
 ## @example
 ## @group
 ## figure (1);
 ## clf ();
 ## surf (peaks);
-## print -dsvg figure1.svg
+## print figure1.pdf
 ## @end group
 ## @end example
 ##
-## Example: Print to an HP DeskJet 550C.
+## Example: Print to a file using jpg device.
 ##
 ## @example
 ## @group
 ## clf ();
 ## surf (peaks);
-## print -dcdj550
+## print -djpg figure2.jpg
+## @end group
+## @end example
+##
+## Example: Print to printer named PS_printer using ps format.
+##
+## @example
+## @group
+## clf ();
+## surf (peaks);
+## print -dpswrite -PPS__printer 
 ## @end group
 ## @end example
 ##
@@ -288,7 +301,7 @@
   opts.lpr_cmd = @lpr;
   opts.epstool_cmd = @epstool;
 
-  if (! isfigure (opts.figure))
+  if (isempty (opts.figure))
     error ("print: no figure to print");
   endif
 
@@ -414,7 +427,7 @@
       endif
     endif
 
-    ## call the graphcis toolkit print script
+    ## call the graphics toolkit print script
     switch (get (opts.figure, "__graphics_toolkit__"))
       case "gnuplot"
         opts = __gnuplot_print__ (opts);
@@ -689,7 +702,7 @@
       cmd = sprintf ("%s %s", cmd, opts.lpr_options);
     endif
     if (! isempty (opts.printer))
-      cmd = sprintf ("%s -P %s", cmd, opts.printer);
+      cmd = sprintf ("%s %s", cmd, opts.printer);
     endif
   elseif (isempty (opts.lpr_binary))
     error ("print:nolpr", "print.m: 'lpr' not found in PATH");
diff -r d0d9f6daa4b6 -r 90c199446cea scripts/plot/util/private/__print_parse_opts__.m
--- a/scripts/plot/util/private/__print_parse_opts__.m	Mon Mar 24 21:24:16 2014 -0700
+++ b/scripts/plot/util/private/__print_parse_opts__.m	Tue Mar 25 17:00:41 2014 +0000
@@ -335,7 +335,8 @@
       error ("print: a file name may not specified when spooling to a printer")
     endif
     if (! any (strcmp (arg_st.devopt, gs_device_list))
-      || ! any (strcmp (arg_st.devopt, {"pswrite", "ps2write"})))
+      ||  any (strcmp (arg_st.devopt, {"pswrite", "ps2write"}))
+       )
       ## Only postscript and supported ghostscript devices
       error ("print: invalid format for spooling to a printer")
     endif
