changeset 19111:9254ff4036b2 gui-release

maint: Periodic merge of stable to gui-release.
author John W. Eaton <jwe@octave.org>
date Wed, 10 Sep 2014 14:16:03 -0400
parents 2e6b34324d50 (current diff) 14bb81940528 (diff)
children dbe9a11f5dcb 63c5f95afeb3
files doc/interpreter/plot.txi liboctave/array/Sparse.cc
diffstat 4 files changed, 85 insertions(+), 48 deletions(-) [+]
line wrap: on
line diff
--- a/doc/interpreter/plot.txi	Sat Aug 23 16:07:03 2014 +0200
+++ b/doc/interpreter/plot.txi	Wed Sep 10 14:16:03 2014 -0400
@@ -594,20 +594,26 @@
 @subsection Use of the @code{interpreter} Property
 
 All text objects---such as titles, labels, legends, and text---include
-the property @qcode{"interpreter"}, this property determines the manner in
-which special control sequences in the text are rendered.  If the interpreter
-is set to @qcode{"none"}, then no rendering occurs.  Currently the
-@qcode{"latex"} interpreter is not implemented and is equivalent to
-@qcode{"none"}.
+the property @qcode{"interpreter"} that determines the manner in
+which special control sequences in the text are rendered.
+
+The interpreter property can take three values: @qcode{"none"}, @qcode{"tex"},
+@qcode{"latex"}.  If the interpreter is set to @qcode{"none"} then no special
+rendering occurs---the displayed text is a verbatim copy of the specified text.
+Currently, the @qcode{"latex"} interpreter is not implemented and is equivalent
+to @qcode{"none"}.
 
 The @qcode{"tex"} option implements a subset of @TeX{} functionality when
 rendering text.  This allows the insertion of special glyphs such as Greek
-characters or mathematical symbols.  The special characters are inserted with
-a code following a backslash (\) character, as in the table
-@ref{tab:extended}.
-
-In addition, the formatting of the text can be changed within the string
-by using the codes
+characters or mathematical symbols.  The special characters are inserted with a
+code following a backslash (\) character, as shown in @ref{tab:extended}.
+
+Note that for on-screen display the interpreter property is honored by all
+graphics toolkits.  However for printing, @strong{only} the @qcode{"gnuplot"}
+toolkit renders @TeX{} instructions.
+
+Besides special glyphs, the formatting of text can be changed within the
+string by using the codes
 
 @multitable @columnfractions .2 .2 .6 .2
 @item @tab \bf @tab Bold font @tab
@@ -616,8 +622,8 @@
 @item @tab \rm @tab Normal font @tab
 @end multitable
 
-These may be used in conjunction with the @{ and @} characters to limit
-the change in the font to part of the string.  For example,
+These codes may be used in conjunction with the @{ and @} characters to limit
+the change to just a part of the string.  For example,
 
 @example
 xlabel ('@{\bf H@} = a @{\bf V@}')
@@ -931,6 +937,13 @@
 saves the current figure to an encapsulated PostScript file called
 @file{foo.eps}.
 
+The different graphic toolkits have different print capabilities.  In
+particular, the OpenGL based toolkits such as @code{fltk} do not support
+the @qcode{"interpreter"} property of text objects.  This means special
+symbols drawn with the @qcode{"tex"} interpreter will appear correctly
+on-screen but will be rendered with interpreter @qcode{"none"} when printing.
+Switch graphics toolkits for printing if this is a concern.
+
 @DOCSTRING(print)
 
 @DOCSTRING(saveas)
--- a/liboctave/array/Sparse.cc	Sat Aug 23 16:07:03 2014 +0200
+++ b/liboctave/array/Sparse.cc	Wed Sep 10 14:16:03 2014 -0400
@@ -853,6 +853,10 @@
             for (octave_idx_type j = cidx (i); j < cidx (i+1); j++)
               {
                 octave_idx_type tmp = i * old_nr + ridx (j);
+                if (tmp < 0)
+                  (*current_liboctave_error_handler)
+                    ("reshape: overflow in octave_idx_type prevents reshaping array");
+
                 octave_idx_type ii = tmp % new_nr;
                 octave_idx_type jj = (tmp - ii) / new_nr;
                 for (octave_idx_type k = kk; k < jj; k++)
--- a/scripts/plot/util/print.m	Sat Aug 23 16:07:03 2014 +0200
+++ b/scripts/plot/util/print.m	Wed Sep 10 14:16:03 2014 -0400
@@ -103,18 +103,29 @@
 ##     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
-## is only available for the FLTK graphics toolkit.
+##   @itemx pslatexstandalone
+##   @itemx epslatexstandalone
+##   @itemx pdflatexstandalone
+##     Generate a @LaTeX{} file @file{@var{filename}.tex} for the text
+## portions of a plot and a file @file{@var{filename}.(ps|eps|pdf)} for the
+## remaining graphics.  The graphics file suffix .ps|eps|pdf is determined
+## by the specified device type.  The @LaTeX{} file produced by the
+## @samp{standalone} option can be processed directly by @LaTeX{}.  The file
+## generated without the @samp{standalone} option is intended to be included
+## from another @LaTeX{} document.  In either case, the @LaTeX{} file
+## contains an @code{\includegraphics} command so that the generated graphics
+## file is automatically included when the @LaTeX{} file is processed.  The
+## text that is written to the @LaTeX{} file contains the strings
+## @strong{exactly} as they were specified in the plot.  If any special
+## characters of the @TeX{} mode interpreter were used, the file must be
+## edited before @LaTeX{} processing.  Specifically, the special characters
+## must be enclosed with dollar signs (@code{$ @dots{} $}), and other
+## characters that are recognized by @LaTeX{} may also need editing (.e.g.,
+## braces).  The @samp{pdflatex} device, and any of the @samp{standalone}
+## formats, are not available with the Gnuplot toolkit.
 ##
 ##   @item tikz
 ##     Generate a @LaTeX{} file using PGF/TikZ@.  For the FLTK toolkit
@@ -175,29 +186,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 +253,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 +297,7 @@
   opts.lpr_cmd = @lpr;
   opts.epstool_cmd = @epstool;
 
-  if (! isfigure (opts.figure))
+  if (isempty (opts.figure) || ! isfigure (opts.figure))
     error ("print: no figure to print");
   endif
 
@@ -414,7 +423,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 +698,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");
--- a/scripts/time/datenum.m	Sat Aug 23 16:07:03 2014 +0200
+++ b/scripts/time/datenum.m	Wed Sep 10 14:16:03 2014 -0400
@@ -23,6 +23,7 @@
 ## @deftypefnx {Function File} {@var{days} =} datenum (@var{year}, @var{month}, @var{day}, @var{hour}, @var{minute})
 ## @deftypefnx {Function File} {@var{days} =} datenum (@var{year}, @var{month}, @var{day}, @var{hour}, @var{minute}, @var{second})
 ## @deftypefnx {Function File} {@var{days} =} datenum ("datestr")
+## @deftypefnx {Function File} {@var{days} =} datenum ("datestr", @var{f})
 ## @deftypefnx {Function File} {@var{days} =} datenum ("datestr", @var{p})
 ## @deftypefnx {Function File} {[@var{days}, @var{secs}] =} datenum (@dots{})
 ## Return the date/time input as a serial day number, with Jan 1, 0000
@@ -37,9 +38,17 @@
 ## The input may be a date vector (see @code{datevec}), 
 ## datestr (see @code{datestr}), or directly specified as input.
 ##
-## When processing input datestrings, @var{p} is the year at the start of the
-## century to which two-digit years will be referenced.  If not specified, it
-## defaults to the current year minus 50.
+## When processing input datestrings, @var{f} is the format string used to
+## interpret date strings (see @code{datestr}).  If no format @var{f} is
+## specified, then a relatively slow search is performed through various
+## formats.  It is always preferable to specify the format string @var{f} if
+## it is known.  Formats which do not specify a particular time component
+## will have the value set to zero.  Formats which do not specify a date
+## will default to January 1st of the current year.
+##
+## @var{p} is the year at the start of the century to which two-digit years
+## will be referenced.  If not specified, it defaults to the current year
+## minus 50.
 ##
 ## The optional output @var{secs} holds the time on the specified day with
 ## greater precision than @var{days}.
@@ -196,6 +205,8 @@
 %!assert (datenum ({"5/19/2001"}), 730990)
 %!assert (datenum (char ("5/19/2001", "6/6/1944")), [730990; 710189])
 %!assert (datenum ({"5/19/2001", "6/6/1944"}), [730990; 710189])
+## Test string input with format string
+%!assert (datenum ("5-19, 2001", "mm-dd, yyyy"), 730990)
 
 %% Test input validation
 %!error datenum ()